@inkeep/open-knowledge 0.25.0-beta.6 → 0.25.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/constants-6L3bwbSM.mjs +2 -0
- package/dist/{dist-CMJUtzX1.mjs → dist-7R982DBB.mjs} +1 -1
- package/dist/{dist-CWHBXHzy.mjs → dist-B1-OZ0zK.mjs} +4 -4
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/init-CGNl62xW.mjs +1 -0
- package/dist/{init-DvnBfvsT.mjs → init-D998mblu.mjs} +5 -5
- package/dist/loader-BfDp4sqJ.mjs +1 -0
- package/dist/{loader-DTIVnIQS.mjs → loader-CoLeuXs-.mjs} +2 -2
- package/dist/preview-CnOFDDeV.mjs +1 -0
- package/dist/{preview-CnShDa2p.mjs → preview-DWBYV32d.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-CNxdYTCc.js → ActivityModeContent-QvRIx_do.js} +1 -1
- package/dist/public/assets/{DocumentContext-bNGvFuJS.js → DocumentContext-zL3ZbwDo.js} +1 -1
- package/dist/public/assets/{GraphPanel-D5yxV_ez.js → GraphPanel-DiyMfzQg.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-CRYWYGK4.js → ManagedArtifactProperties-OxkUY14x.js} +1 -1
- package/dist/public/assets/{PropertyPanel-DgbQo3wG.js → PropertyPanel-D9A27c2E.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-CU-nEwde.js → SettingsDialogBody-cotnwVMw.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-Bfh-iuK_.js → SkillEditorActions-BsGotb40.js} +1 -1
- package/dist/public/assets/{SourceEditor-CAUoNOTU.js → SourceEditor-BZ3cbLjs.js} +1 -1
- package/dist/public/assets/{TerminalPanel-Ds-ev2-D.js → TerminalPanel-XlICQw5o.js} +1 -1
- package/dist/public/assets/{config-validation-events-DiOTHiAz.js → config-validation-events-yB2QWKKJ.js} +1 -1
- package/dist/public/assets/{dist-GmorMgHF.js → dist-BRGUidv4.js} +8 -6
- package/dist/public/assets/{documents-events-CSQluyCM.js → documents-events-DA8Q5ICz.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-TDYabCI-.js → file-tree-adapter-CP3Xa3us.js} +1 -1
- package/dist/public/assets/{index-BCPjnywU.js → index-CoukPsjj.js} +5 -5
- package/dist/public/assets/{keyboard-shortcuts-CZysvuV8.js → keyboard-shortcuts-DOkzBlgc.js} +1 -1
- package/dist/public/assets/{navigation-targets-CXdtVjj4.js → navigation-targets-DNRja8Z0.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-CvsZjaW-.js → open-managed-artifact-tab-DBkxdYp_.js} +1 -1
- package/dist/public/assets/{prop-types-C_2IQGCC.js → prop-types-C-aZftyS.js} +1 -1
- package/dist/public/assets/{selection-context-B6kAEK37.js → selection-context-vh0MmCBb.js} +1 -1
- package/dist/public/assets/{skill-actions-CPoGr_7b.js → skill-actions-Sc4IN52j.js} +1 -1
- package/dist/public/assets/{skills-api-mcV6MiPo.js → skills-api-ts3L80AV.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-C4nLupIH.js → target-navigation-intent-CIKQ1Hj-.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DEl5qeGr.js → typing-burst-detector-BT98lJOb.js} +1 -1
- package/dist/public/index.html +16 -16
- package/dist/{repair-launch-json-DpU0i0eM.mjs → repair-launch-json-DiMbidtg.mjs} +2 -2
- package/dist/repair-mcp-configs-dTwbVEwq.mjs +2 -0
- package/dist/repair-skills-BvhYVWdw.mjs +3 -0
- package/dist/repair-skills-qkZ_LTHD.mjs +1 -0
- package/dist/{src-BQi1rIBd.mjs → src-CeXDKSSn.mjs} +2 -2
- package/dist/{start-RS2gu3vK.mjs → start-BqOu87VR.mjs} +2 -2
- package/dist/start-ByfafCut.mjs +1 -0
- package/dist/write-project-skill-CAgr6zKv.mjs +36 -0
- package/package.json +1 -1
- package/dist/constants-D3-jp47D.mjs +0 -2
- package/dist/init-BPc0rfg_.mjs +0 -1
- package/dist/loader-Scpsv3B1.mjs +0 -1
- package/dist/preview-OyZSYy4k.mjs +0 -1
- package/dist/repair-mcp-configs-DioIDpS1.mjs +0 -2
- package/dist/repair-skills-BFe09bLm.mjs +0 -1
- package/dist/repair-skills-xrYOvyVd.mjs +0 -3
- package/dist/start-B2g--lvD.mjs +0 -1
- package/dist/write-project-skill-CRxX-42S.mjs +0 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-BM7BnAv2.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-MhJXZpsM.js","./propagation-api-CR2CQW4x.js","./ConsentDialogBody-CPX75E6Q.js","./dist-CQw2y-s3.js","./compiler-runtime-CVnuRdak.js","./checkbox-EGJP9xna.js","./dist-BXd_K33i.js","./button-DGf25ccp.js","./react-dom-C-oc-P2K.js","./dialog-CIq9aQLf.js","./dist-KBKQayVB.js","./dist-ug68MPTZ.js","./collapsible-CjgfK1G5.js","./chevron-right-jyIhGBkw.js","./project-paths-CcPGtodV.js","./label-DyT4OD9H.js","./radio-group-CFPLlVag.js","./dist-ICp_3rWY.js","./dist-AQSp7Qij.js","./tooltip-DiL7DBhT.js","./input-DkQ8Zmzd.js","./textarea-BQFFQ9_l.js","./McpConsentDialogBody-Dr_AIi2H.js","./mcp-consent-store-Q_heVQ86.js","./ActivityPanelDiffView-TEHR9A38.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-
|
|
2
|
-
import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{n as r,r as i,t as a}from"./compiler-runtime-CVnuRdak.js";import{$n as o,$t as s,A as c,At as l,B as u,Bn as d,Bt as f,Cn as p,Ct as m,D as h,Dr as g,Dt as _,En as v,Er as y,Et as b,F as x,Ft as S,G as C,Gn as w,Gt as T,H as E,Hn as D,Ht as O,I as k,It as A,Jn as j,Jt as M,K as N,Kn as P,Kt as F,L as I,Lt as L,Nt as R,O as z,Or as B,Ot as V,Pt as H,Q as U,Qn as W,Qt as G,R as K,Rn as ee,Rt as te,Sn as q,Sr as J,St as ne,Tr as re,Tt as ie,U as ae,Un as oe,Ut as se,V as ce,Vn as le,Vt as ue,W as de,Wn as fe,Wt as pe,Xn as me,Xt as he,Yn as ge,Yt as _e,Zt as ve,_n as ye,_t as be,a as xe,an as Se,ar as Ce,at as we,bn as Te,br as Ee,bt as De,c as Oe,cn as ke,cr as Ae,ct as je,d as Me,dn as Ne,dr as Pe,dt as Fe,en as Ie,er as Le,et as Re,f as ze,fn as Be,fr as Ve,ft as He,g as Ue,gn as We,gr as Ge,gt as Ke,h as qe,hn as Je,hr as Ye,ht as Xe,i as Ze,in as Qe,ir as $e,it as et,j as tt,k as nt,kr as rt,kt as it,l as at,ln as ot,lr as st,lt as ct,m as lt,mn as ut,mr as dt,mt as ft,n as pt,nn as mt,nr as ht,o as gt,on as _t,or as vt,ot as yt,p as bt,pn as xt,pr as St,pt as Ct,q as wt,qn as Tt,qt as Et,r as Dt,rn as Ot,rr as kt,rt as At,s as jt,sn as Mt,sr as Nt,st as Pt,t as Ft,tn as It,tr as Lt,tt as Rt,u as zt,un as Bt,ur as Vt,ut as Ht,v as Ut,vn as Wt,vr as Gt,vt as Kt,wn as qt,wr as Jt,wt as Yt,xn as Xt,xt as Zt,y as Qt,yn as $t,yt as en,z as tn,zn as nn,zt as rn}from"./DocumentContext-bNGvFuJS.js";import{n as Y,r as an,t as on}from"./dist-CQw2y-s3.js";import{A as sn,C as cn,D as ln,E as un,O as dn,S as fn,T as pn,_ as mn,a as hn,b as gn,c as _n,d as vn,f as yn,g as bn,h as xn,i as Sn,k as Cn,l as wn,m as Tn,n as En,o as Dn,p as On,r as kn,s as An,t as jn,u as Mn,v as Nn,w as Pn,x as Fn,y as In}from"./panel-BbrtnF__.js";import{A as Ln,Bi as Rn,Br as zn,Cr as Bn,Ct as Vn,D as Hn,Dt as Un,E as Wn,En as Gn,F as Kn,Fi as qn,Fn as Jn,Fr as Yn,Ft as Xn,Gi as Zn,Hi as Qn,Ht as $n,K as er,Ki as tr,Mr as nr,Ni as rr,Nr as ir,O as ar,Ot as or,P as sr,Pr as cr,Ri as lr,Rn as ur,S as dr,Sn as fr,Sr as pr,Tr as mr,Ui as hr,Ur as gr,Vn as _r,Vr as vr,Wi as yr,Wn as br,Wt as xr,Xr as Sr,Xt as Cr,Yt as wr,Zr as Tr,_n as Er,_r as Dr,an as Or,bn as kr,br as Ar,cn as jr,cr as Mr,ct as Nr,di as Pr,dn as Fr,dr as Ir,ei as Lr,fi as Rr,fn as zr,fr as Br,gn as Vr,gr as Hr,ji as Ur,jr as Wr,jt as Gr,k as Kr,kr as qr,li as Jr,ln as Yr,mt as Xr,n as Zr,ni as Qr,nn as $r,o as ei,oi as ti,or as ni,pi as ri,pr as ii,pt as ai,r as oi,ri as si,rt as ci,t as li,ti as ui,tr as di,un as fi,v as pi,vn as mi,vr as hi,w as gi,wn as _i,wt as vi,x as yi,xr as bi,zn as xi}from"./dist-GmorMgHF.js";import{t as Si}from"./react-dom-C-oc-P2K.js";import{c as Ci,l as wi,r as Ti,t as X,u as Ei}from"./button-DGf25ccp.js";import{$ as Di,B as Oi,C as ki,D as Ai,E as ji,F as Mi,G as Ni,I as Pi,J as Fi,K as Ii,L as Li,N as Ri,O as zi,P as Bi,Q as Vi,R as Hi,V as Ui,W as Wi,X as Gi,Y as Ki,Z as qi,_ as Ji,_t as Yi,at as Xi,c as Zi,ct as Qi,dt as $i,et as ea,f as ta,ft as na,g as ra,gt as ia,h as aa,ht as oa,it as sa,k as ca,lt as la,mt as ua,nt as da,o as fa,ot as pa,pt as ma,q as ha,r as ga,rt as _a,s as va,st as ya,t as ba,tt as xa,ut as Sa,v as Ca,vt as wa,w as Ta,yt as Ea,z as Da}from"./config-validation-events-DiOTHiAz.js";import{i as Oa,n as ka,r as Aa,t as ja}from"./toggle-group-Bc5FaFo3.js";import{a as Ma,c as Na,d as Pa,i as Fa,l as Ia,o as La,r as Ra,s as za,t as Ba,u as Va}from"./PropertyPanel-DgbQo3wG.js";import{_ as Ha,a as Ua,c as Wa,i as Ga,n as Ka,o as qa,s as Ja,t as Ya}from"./dialog-CIq9aQLf.js";import{t as Xa}from"./chevron-down-CzFz_0zd.js";import{t as Za}from"./chevron-left-Bb3WBx0B.js";import{t as Qa}from"./chevron-right-jyIhGBkw.js";import{a as $a,c as eo,i as to,l as no,n as ro,u as io}from"./prop-types-C_2IQGCC.js";import{A as ao,C as oo,D as so,E as co,O as lo,S as uo,T as fo,_ as po,a as mo,c as ho,d as go,g as _o,h as vo,i as yo,k as bo,l as xo,m as So,n as Co,o as wo,p as To,r as Eo,s as Do,u as Oo,v as ko,w as Ao,x as jo,y as Mo}from"./skill-actions-CPoGr_7b.js";import{a as No,c as Po,d as Fo,f as Io,i as Lo,l as Ro,m as zo,n as Bo,o as Vo,p as Ho,r as Uo,u as Wo}from"./config-context-DhhN0rlf.js";import{_ as Go,c as Ko,f as qo,g as Jo,h as Yo,i as Xo,l as Zo,m as Qo,o as $o,p as es,s as ts,t as ns,u as rs,v as is,y as as}from"./open-managed-artifact-tab-CvsZjaW-.js";import{i as os,n as ss,r as cs,t as ls}from"./collapsible-CjgfK1G5.js";import{a as us,i as ds,r as fs,t as ps}from"./cursor-CpjEfgnv.js";import{a as ms,c as hs,i as gs,n as _s,o as vs,r as ys,s as bs,t as xs}from"./agent-presence-BRmBPq78.js";import{n as Ss,r as Cs,t as ws}from"./dist-KBKQayVB.js";import{a as Ts,c as Es,l as Ds,n as Os,o as ks,r as As,s as js,u as Ms}from"./documents-events-CSQluyCM.js";import{t as Ns}from"./external-link-Bc6KvE1i.js";import{a as Ps,d as Fs,f as Is,i as Ls,l as Rs,o as zs,s as Bs}from"./dist-BXd_K33i.js";import{i as Vs,n as Hs,r as Us,t as Ws}from"./tooltip-DiL7DBhT.js";import{c as Gs,d as Ks,f as qs,g as Js,h as Ys,l as Xs,m as Zs,o as Qs,p as $s,s as ec,u as tc}from"./dist-ICp_3rWY.js";import{t as nc}from"./checkbox-EGJP9xna.js";import{n as rc,r as ic,t as ac}from"./dist-AQSp7Qij.js";import{A as oc,B as sc,C as cc,D as lc,E as uc,F as dc,H as fc,I as pc,L as mc,M as hc,N as gc,O as _c,P as vc,R as yc,S as bc,T as xc,V as Sc,_ as Cc,g as wc,h as Tc,i as Ec,j as Dc,k as Oc,m as kc,o as Ac,p as jc,r as Mc,u as Nc,v as Pc,w as Fc,x as Ic,z as Lc}from"./skills-api-mcV6MiPo.js";import{t as Rc}from"./label-DyT4OD9H.js";import{n as zc,t as Bc}from"./radio-group-CFPLlVag.js";import{t as Vc}from"./input-DkQ8Zmzd.js";import{a as Hc,i as Uc,n as Wc,r as Gc}from"./project-paths-CcPGtodV.js";import{n as Kc,t as qc}from"./mcp-consent-store-Q_heVQ86.js";import{C as Jc,D as Yc,E as Xc,O as Zc,S as Qc,T as $c,_ as el,a as tl,b as nl,d as rl,f as il,g as al,h as ol,i as sl,m as cl,n as ll,o as ul,p as dl,r as fl,u as pl,v as ml,w as hl,x as gl,y as _l}from"./navigation-targets-CXdtVjj4.js";import{a as vl,i as yl,o as bl}from"./startup-marks-CWTDb1CP.js";import{n as xl,r as Sl,t as Cl}from"./file-tree-rename-validation-BqGkSO9-.js";import{c as wl,i as Tl,l as El,o as Dl}from"./keyboard-shortcuts-CZysvuV8.js";import{$ as Ol,At as kl,Ct as Al,Dt as jl,Ft as Ml,I as Nl,It as Pl,J as Fl,Mt as Il,Ot as Ll,Pt as Rl,Q as zl,Tt as Bl,X as Vl,Z as Hl,at as Ul,bt as Wl,jt as Gl,k as Kl,w as ql}from"./dist-DWaLpHcz.js";import{n as Jl}from"./dist-E5KjgWw7.js";import{c as Yl,f as Xl,g as Zl,i as Ql,l as $l,n as eu,o as tu,p as nu,r as ru,s as iu,t as au,u as ou}from"./typing-burst-detector-DEl5qeGr.js";import{t as su}from"./target-navigation-intent-C4nLupIH.js";import"./textarea-BQFFQ9_l.js";import{c as cu,i as lu,n as uu,r as du,s as fu,u as pu}from"./selection-context-B6kAEK37.js";import{C as mu,D as hu,E as gu,O as _u,S as vu,T as yu,_ as bu,a as xu,b as Su,c as Cu,d as wu,f as Tu,g as Eu,h as Du,i as Ou,k as ku,l as Au,m as ju,n as Mu,o as Nu,p as Pu,r as Fu,s as Iu,t as Lu,u as Ru,v as zu,w as Bu,x as Vu,y as Hu}from"./file-tree-adapter-TDYabCI-.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function Uu(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.24.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-BM7BnAv2.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function Wu(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{bn(e,()=>t.signal,()=>n=!0)},u=In(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Nn:mn;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Ku:Gu,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Gu(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Gu(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ku(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var qu=class extends yn{#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||Ju(),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=On({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),xn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ju(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Yu=class extends sn{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 qu({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=Xu(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=Xu(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=Xu(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=Xu(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){xn.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=>cn(t,e))}findAll(e={}){return this.getAll().filter(t=>cn(e,t))}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return xn.batch(()=>Promise.all(e.map(e=>e.continue().catch(pn))))}};function Xu(e){return e.options.scope?.id}var Zu=class extends sn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??fn(r,t),a=this.get(i);return a||(a=new vn({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(){xn.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=>Pn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Pn(e,t)):t}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){xn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){xn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Qu=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Zu,this.#t=e.mutationCache||new Yu,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Cn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Tn.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(ln(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=gn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return xn.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;xn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return xn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=xn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(pn).catch(pn)}invalidateQueries(e,t={}){return xn.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=xn.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(pn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(pn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(ln(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(pn).catch(pn)}fetchInfiniteQuery(e){return e.behavior=Wu(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(pn).catch(pn)}ensureInfiniteQueryData(e){return e.behavior=Wu(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Tn.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(Fn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{un(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Fn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{un(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||=fn(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===dn&&(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()}},$u=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),ed=t(((e,t)=>{t.exports=$u()})),td=t((e=>{var t=ed(),n=r(),i=Si();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function ee(){B(H),B(U),B(W)}function te(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function q(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var J,ne;function re(e){if(J===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);J=t&&t[1]||``,ne=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-BM7BnAv2.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-MhJXZpsM.js","./propagation-api-CR2CQW4x.js","./ConsentDialogBody-CPX75E6Q.js","./dist-CQw2y-s3.js","./compiler-runtime-CVnuRdak.js","./checkbox-EGJP9xna.js","./dist-BXd_K33i.js","./button-DGf25ccp.js","./react-dom-C-oc-P2K.js","./dialog-CIq9aQLf.js","./dist-KBKQayVB.js","./dist-ug68MPTZ.js","./collapsible-CjgfK1G5.js","./chevron-right-jyIhGBkw.js","./project-paths-CcPGtodV.js","./label-DyT4OD9H.js","./radio-group-CFPLlVag.js","./dist-ICp_3rWY.js","./dist-AQSp7Qij.js","./tooltip-DiL7DBhT.js","./input-DkQ8Zmzd.js","./textarea-BQFFQ9_l.js","./McpConsentDialogBody-Dr_AIi2H.js","./mcp-consent-store-Q_heVQ86.js","./ActivityPanelDiffView-TEHR9A38.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-DiyMfzQg.js","./dist-BRGUidv4.js","./w3c-keyname-beU76Hfb.js","./documents-events-DA8Q5ICz.js","./toggle-group-Bc5FaFo3.js","./panel-BbrtnF__.js","./min-CGFu6QbN.js","./src-C3imF5Zq.js","./colors-DOVRXUpv.js","./ordinal-BLFf0NQg.js","./init-DAmDTHXL.js","./isObjectLike-0yTn5bno.js","./now-C9pOxV0O.js","./isSymbol-BgthEULk.js","./prop-types-C-aZftyS.js","./navigation-targets-DNRja8Z0.js","./startup-marks-CWTDb1CP.js","./target-navigation-intent-CIKQ1Hj-.js","./external-link-Bc6KvE1i.js","./ActivityModeContent-QvRIx_do.js","./DocumentContext-zL3ZbwDo.js","./dist-C3ftUzLd.js","./dist-DWaLpHcz.js","./dist-CHEQzAl9.js","./dist-BgLh90uo2.js","./dist-BZEgBj4N.js","./dist-Bqo1ZTng.js","./dist-Dtxdqotp.js","./dist-E5KjgWw7.js","./dist-BdwnfcKi.js","./stex-coA_FIxI.js","./chevron-down-CzFz_0zd.js","./config-context-DhhN0rlf.js","./file-tree-rename-validation-BqGkSO9-.js","./DocumentContext-B0sQn39F.css","./agent-presence-BRmBPq78.js","./cursor-CpjEfgnv.js","./dist-znFZQjzE.js","./dist-3l3ADjEo.js","./SettingsDialogBody-cotnwVMw.js","./open-managed-artifact-tab-DBkxdYp_.js","./skills-api-ts3L80AV.js","./config-validation-events-yB2QWKKJ.js","./skill-actions-Sc4IN52j.js","./keyboard-shortcuts-DOkzBlgc.js","./ManagedArtifactProperties-OxkUY14x.js","./PropertyPanel-D9A27c2E.js","./format-Fsxus_sZ.js","./selection-context-vh0MmCBb.js","./SourceEditor-BZ3cbLjs.js","./typing-burst-detector-BT98lJOb.js","./SkillEditorActions-BsGotb40.js","./TerminalPanel-XlICQw5o.js","./file-tree-adapter-CP3Xa3us.js","./TerminalPanel-BrP-ENHg.css","./telemetry-startup-Pz1ro4a2.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{n as r,r as i,t as a}from"./compiler-runtime-CVnuRdak.js";import{$n as o,$t as s,A as c,At as l,B as u,Bn as d,Bt as f,Cn as p,Ct as m,D as h,Dr as g,Dt as _,En as v,Er as y,Et as b,F as x,Ft as S,G as C,Gn as w,Gt as T,H as E,Hn as D,Ht as O,I as k,It as A,Jn as j,Jt as M,K as N,Kn as P,Kt as F,L as I,Lt as L,Nt as R,O as z,Or as B,Ot as V,Pt as H,Q as U,Qn as W,Qt as G,R as K,Rn as ee,Rt as te,Sn as q,Sr as J,St as ne,Tr as re,Tt as ie,U as ae,Un as oe,Ut as se,V as ce,Vn as le,Vt as ue,W as de,Wn as fe,Wt as pe,Xn as me,Xt as he,Yn as ge,Yt as _e,Zt as ve,_n as ye,_t as be,a as xe,an as Se,ar as Ce,at as we,bn as Te,br as Ee,bt as De,c as Oe,cn as ke,cr as Ae,ct as je,d as Me,dn as Ne,dr as Pe,dt as Fe,en as Ie,er as Le,et as Re,f as ze,fn as Be,fr as Ve,ft as He,g as Ue,gn as We,gr as Ge,gt as Ke,h as qe,hn as Je,hr as Ye,ht as Xe,i as Ze,in as Qe,ir as $e,it as et,j as tt,k as nt,kr as rt,kt as it,l as at,ln as ot,lr as st,lt as ct,m as lt,mn as ut,mr as dt,mt as ft,n as pt,nn as mt,nr as ht,o as gt,on as _t,or as vt,ot as yt,p as bt,pn as xt,pr as St,pt as Ct,q as wt,qn as Tt,qt as Et,r as Dt,rn as Ot,rr as kt,rt as At,s as jt,sn as Mt,sr as Nt,st as Pt,t as Ft,tn as It,tr as Lt,tt as Rt,u as zt,un as Bt,ur as Vt,ut as Ht,v as Ut,vn as Wt,vr as Gt,vt as Kt,wn as qt,wr as Jt,wt as Yt,xn as Xt,xt as Zt,y as Qt,yn as $t,yt as en,z as tn,zn as nn,zt as rn}from"./DocumentContext-zL3ZbwDo.js";import{n as Y,r as an,t as on}from"./dist-CQw2y-s3.js";import{A as sn,C as cn,D as ln,E as un,O as dn,S as fn,T as pn,_ as mn,a as hn,b as gn,c as _n,d as vn,f as yn,g as bn,h as xn,i as Sn,k as Cn,l as wn,m as Tn,n as En,o as Dn,p as On,r as kn,s as An,t as jn,u as Mn,v as Nn,w as Pn,x as Fn,y as In}from"./panel-BbrtnF__.js";import{A as Ln,Bi as Rn,Br as zn,Cr as Bn,Ct as Vn,D as Hn,Dt as Un,E as Wn,En as Gn,F as Kn,Fi as qn,Fn as Jn,Fr as Yn,Ft as Xn,Gi as Zn,Hi as Qn,Ht as $n,K as er,Ki as tr,Mr as nr,Ni as rr,Nr as ir,O as ar,Ot as or,P as sr,Pr as cr,Ri as lr,Rn as ur,S as dr,Sn as fr,Sr as pr,Tr as mr,Ui as hr,Ur as gr,Vn as _r,Vr as vr,Wi as yr,Wn as br,Wt as xr,Xr as Sr,Xt as Cr,Yt as wr,Zr as Tr,_n as Er,_r as Dr,an as Or,bn as kr,br as Ar,cn as jr,cr as Mr,ct as Nr,di as Pr,dn as Fr,dr as Ir,ei as Lr,fi as Rr,fn as zr,fr as Br,gn as Vr,gr as Hr,ji as Ur,jr as Wr,jt as Gr,k as Kr,kr as qr,li as Jr,ln as Yr,mt as Xr,n as Zr,ni as Qr,nn as $r,o as ei,oi as ti,or as ni,pi as ri,pr as ii,pt as ai,r as oi,ri as si,rt as ci,t as li,ti as ui,tr as di,un as fi,v as pi,vn as mi,vr as hi,w as gi,wn as _i,wt as vi,x as yi,xr as bi,zn as xi}from"./dist-BRGUidv4.js";import{t as Si}from"./react-dom-C-oc-P2K.js";import{c as Ci,l as wi,r as Ti,t as X,u as Ei}from"./button-DGf25ccp.js";import{$ as Di,B as Oi,C as ki,D as Ai,E as ji,F as Mi,G as Ni,I as Pi,J as Fi,K as Ii,L as Li,N as Ri,O as zi,P as Bi,Q as Vi,R as Hi,V as Ui,W as Wi,X as Gi,Y as Ki,Z as qi,_ as Ji,_t as Yi,at as Xi,c as Zi,ct as Qi,dt as $i,et as ea,f as ta,ft as na,g as ra,gt as ia,h as aa,ht as oa,it as sa,k as ca,lt as la,mt as ua,nt as da,o as fa,ot as pa,pt as ma,q as ha,r as ga,rt as _a,s as va,st as ya,t as ba,tt as xa,ut as Sa,v as Ca,vt as wa,w as Ta,yt as Ea,z as Da}from"./config-validation-events-yB2QWKKJ.js";import{i as Oa,n as ka,r as Aa,t as ja}from"./toggle-group-Bc5FaFo3.js";import{a as Ma,c as Na,d as Pa,i as Fa,l as Ia,o as La,r as Ra,s as za,t as Ba,u as Va}from"./PropertyPanel-D9A27c2E.js";import{_ as Ha,a as Ua,c as Wa,i as Ga,n as Ka,o as qa,s as Ja,t as Ya}from"./dialog-CIq9aQLf.js";import{t as Xa}from"./chevron-down-CzFz_0zd.js";import{t as Za}from"./chevron-left-Bb3WBx0B.js";import{t as Qa}from"./chevron-right-jyIhGBkw.js";import{a as $a,c as eo,i as to,l as no,n as ro,u as io}from"./prop-types-C-aZftyS.js";import{A as ao,C as oo,D as so,E as co,O as lo,S as uo,T as fo,_ as po,a as mo,c as ho,d as go,g as _o,h as vo,i as yo,k as bo,l as xo,m as So,n as Co,o as wo,p as To,r as Eo,s as Do,u as Oo,v as ko,w as Ao,x as jo,y as Mo}from"./skill-actions-Sc4IN52j.js";import{a as No,c as Po,d as Fo,f as Io,i as Lo,l as Ro,m as zo,n as Bo,o as Vo,p as Ho,r as Uo,u as Wo}from"./config-context-DhhN0rlf.js";import{_ as Go,c as Ko,f as qo,g as Jo,h as Yo,i as Xo,l as Zo,m as Qo,o as $o,p as es,s as ts,t as ns,u as rs,v as is,y as as}from"./open-managed-artifact-tab-DBkxdYp_.js";import{i as os,n as ss,r as cs,t as ls}from"./collapsible-CjgfK1G5.js";import{a as us,i as ds,r as fs,t as ps}from"./cursor-CpjEfgnv.js";import{a as ms,c as hs,i as gs,n as _s,o as vs,r as ys,s as bs,t as xs}from"./agent-presence-BRmBPq78.js";import{n as Ss,r as Cs,t as ws}from"./dist-KBKQayVB.js";import{a as Ts,c as Es,l as Ds,n as Os,o as ks,r as As,s as js,u as Ms}from"./documents-events-DA8Q5ICz.js";import{t as Ns}from"./external-link-Bc6KvE1i.js";import{a as Ps,d as Fs,f as Is,i as Ls,l as Rs,o as zs,s as Bs}from"./dist-BXd_K33i.js";import{i as Vs,n as Hs,r as Us,t as Ws}from"./tooltip-DiL7DBhT.js";import{c as Gs,d as Ks,f as qs,g as Js,h as Ys,l as Xs,m as Zs,o as Qs,p as $s,s as ec,u as tc}from"./dist-ICp_3rWY.js";import{t as nc}from"./checkbox-EGJP9xna.js";import{n as rc,r as ic,t as ac}from"./dist-AQSp7Qij.js";import{A as oc,B as sc,C as cc,D as lc,E as uc,F as dc,H as fc,I as pc,L as mc,M as hc,N as gc,O as _c,P as vc,R as yc,S as bc,T as xc,V as Sc,_ as Cc,g as wc,h as Tc,i as Ec,j as Dc,k as Oc,m as kc,o as Ac,p as jc,r as Mc,u as Nc,v as Pc,w as Fc,x as Ic,z as Lc}from"./skills-api-ts3L80AV.js";import{t as Rc}from"./label-DyT4OD9H.js";import{n as zc,t as Bc}from"./radio-group-CFPLlVag.js";import{t as Vc}from"./input-DkQ8Zmzd.js";import{a as Hc,i as Uc,n as Wc,r as Gc}from"./project-paths-CcPGtodV.js";import{n as Kc,t as qc}from"./mcp-consent-store-Q_heVQ86.js";import{C as Jc,D as Yc,E as Xc,O as Zc,S as Qc,T as $c,_ as el,a as tl,b as nl,d as rl,f as il,g as al,h as ol,i as sl,m as cl,n as ll,o as ul,p as dl,r as fl,u as pl,v as ml,w as hl,x as gl,y as _l}from"./navigation-targets-DNRja8Z0.js";import{a as vl,i as yl,o as bl}from"./startup-marks-CWTDb1CP.js";import{n as xl,r as Sl,t as Cl}from"./file-tree-rename-validation-BqGkSO9-.js";import{c as wl,i as Tl,l as El,o as Dl}from"./keyboard-shortcuts-DOkzBlgc.js";import{$ as Ol,At as kl,Ct as Al,Dt as jl,Ft as Ml,I as Nl,It as Pl,J as Fl,Mt as Il,Ot as Ll,Pt as Rl,Q as zl,Tt as Bl,X as Vl,Z as Hl,at as Ul,bt as Wl,jt as Gl,k as Kl,w as ql}from"./dist-DWaLpHcz.js";import{n as Jl}from"./dist-E5KjgWw7.js";import{c as Yl,f as Xl,g as Zl,i as Ql,l as $l,n as eu,o as tu,p as nu,r as ru,s as iu,t as au,u as ou}from"./typing-burst-detector-BT98lJOb.js";import{t as su}from"./target-navigation-intent-CIKQ1Hj-.js";import"./textarea-BQFFQ9_l.js";import{c as cu,i as lu,n as uu,r as du,s as fu,u as pu}from"./selection-context-vh0MmCBb.js";import{C as mu,D as hu,E as gu,O as _u,S as vu,T as yu,_ as bu,a as xu,b as Su,c as Cu,d as wu,f as Tu,g as Eu,h as Du,i as Ou,k as ku,l as Au,m as ju,n as Mu,o as Nu,p as Pu,r as Fu,s as Iu,t as Lu,u as Ru,v as zu,w as Bu,x as Vu,y as Hu}from"./file-tree-adapter-CP3Xa3us.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function Uu(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.24.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-BM7BnAv2.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function Wu(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{bn(e,()=>t.signal,()=>n=!0)},u=In(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Nn:mn;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Ku:Gu,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Gu(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Gu(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ku(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var qu=class extends yn{#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||Ju(),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=On({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),xn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ju(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Yu=class extends sn{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 qu({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=Xu(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=Xu(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=Xu(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=Xu(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){xn.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=>cn(t,e))}findAll(e={}){return this.getAll().filter(t=>cn(e,t))}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return xn.batch(()=>Promise.all(e.map(e=>e.continue().catch(pn))))}};function Xu(e){return e.options.scope?.id}var Zu=class extends sn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??fn(r,t),a=this.get(i);return a||(a=new vn({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(){xn.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=>Pn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Pn(e,t)):t}notify(e){xn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){xn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){xn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Qu=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Zu,this.#t=e.mutationCache||new Yu,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Cn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Tn.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(ln(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=gn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return xn.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;xn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return xn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=xn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(pn).catch(pn)}invalidateQueries(e,t={}){return xn.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=xn.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(pn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(pn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(ln(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(pn).catch(pn)}fetchInfiniteQuery(e){return e.behavior=Wu(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(pn).catch(pn)}ensureInfiniteQueryData(e){return e.behavior=Wu(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Tn.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(Fn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{un(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Fn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{un(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||=fn(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===dn&&(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()}},$u=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),ed=t(((e,t)=>{t.exports=$u()})),td=t((e=>{var t=ed(),n=r(),i=Si();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function ee(){B(H),B(U),B(W)}function te(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function q(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var J,ne;function re(e){if(J===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);J=t&&t[1]||``,ne=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+J+e+ne}var ie=!1;function ae(e,t){if(!e||ie)return``;ie=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -21,14 +21,14 @@ Error generating stack: `+e.message+`
|
|
|
21
21
|
`}function ox(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;ix(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?ax(e,o.headerOptions):void 0)}}))}else{let s=ix(e,t,n,r,i,a,o);return s?ax(s,o?.headerOptions):void 0}}function sx(e,t,n,r,i,a){return ox(e,e,t,n,r,i,a)}function cx(e){let t=e.endsWith(`
|
|
22
22
|
`),n=e.split(`
|
|
23
23
|
`).map(e=>e+`
|
|
24
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function lx(e,t){return`${e}\u0000${t}`}function ux(e,t,n){let r=bi(e).body,i=bi(t).body;return r===i?``:sx(n,r,i,``,``,{context:3})}function dx(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=pt(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=lx(t,r),a=n.get(e);if(a===void 0){let o=await fetch(`/api/history/${r}?docName=${encodeURIComponent(t)}`);if(i)return;if(!o.ok){s({status:`error`,diff:null});return}let c=await o.json();if(i)return;a=c.content??``,n.set(e,a)}if(i)return;let o=c.current?.document.getText(`source`).toString()??``,l=ux(a,o,t);if(i)return;s({status:`ready`,diff:l})}catch(e){i||(console.error(`[timeline-diff] failed to load entry diff`,{sha:r,docName:t,err:e}),s({status:`error`,diff:null}))}})(),()=>{i=!0}},d=[e,t,n],r[3]=n,r[4]=t,r[5]=e,r[6]=u,r[7]=d):(u=r[6],d=r[7]),(0,Q.useEffect)(u,d),o}var fx=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-TEHR9A38.js`),__vite__mapDeps([27,1,6,7,28]),import.meta.url)).ActivityPanelDiffView})),px=1e4,mx=6e4;async function hx(e,t,n){try{let r=await fetch(`/api/history?docName=${encodeURIComponent(e)}&limit=100`,{signal:t});if(!r.ok)return n.setError(n.unavailableMessage),`error`;let i=await r.json();return n.setEntries((i.entries??[]).filter(e=>e.type!==`checkpoint`)),n.setError(null),`ok`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw e;return n.setError(n.unavailableMessage),console.error(`[timeline]`,e),`error`}finally{t.aborted||n.setLoading(!1)}}function gx(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Ms._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Ms._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Ms._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Ms._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Ms._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function _x(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function vx(e){return e.slice(0,7)}function yx(e){return e.type===`upstream`?Ms._({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`?Ms._({id:`B2DrPb`}):e.author}function bx(e){let t=(0,$.c)(17),n,r;if(t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude`){let e;return t[3]===r?e=t[4]:(e=(0,Z.jsx)(ds,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(ps,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ms,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(fs,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(bs,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(vs,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(us,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function xx(e){let t=(0,$.c)(17),{entry:n,isDark:r}=e;if(n.type===`upstream`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(St,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[0]=e):e=t[0],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[1]===i?a=t[2]:(a=Gn(i),t[1]=i,t[2]=a);let o=a,s=r?Zr[o]??li[o]:li[o],c;t[3]!==s||t[4]!==i?(c=s??Cr(i),t[3]=s,t[4]=i,t[5]=c):c=t[5];let l=c;if(o!==`bot`){let e;t[6]===l?e=t[7]:(e={color:l},t[6]=l,t[7]=e);let n;return t[8]!==o||t[9]!==e?(n=(0,Z.jsx)(bx,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[8]=o,t[9]=e,t[10]=n):n=t[10],n}if(e.name===`File System`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Nd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`OpenKnowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(rd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Af,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=u):u=t[13],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(us,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(rd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Af,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Sx(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function Cx(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(Tx),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(wx)},children:[r?(0,Z.jsx)(Xa,{className:`size-3`}):(0,Z.jsx)(Qa,{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 wx(e){return!e}function Tx(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 Ex(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=dx(n,r,i),c;t[0]===s.status?c=t[1]:(c=s.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Fo,{className:`size-3 animate-spin`}),(0,Z.jsx)(Y,{id:`38foVZ`})]}),t[0]=s.status,t[1]=c);let l;t[2]===s.status?l=t[3]:(l=s.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(Y,{id:`vvWZnu`})}),t[2]=s.status,t[3]=l);let u;t[4]!==a||t[5]!==s.diff||t[6]!==s.status?(u=s.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Fo,{className:`size-3 animate-spin`}),(0,Z.jsx)(Y,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(fx,{diff:s.diff,viewType:a})}),t[4]=a,t[5]=s.diff,t[6]=s.status,t[7]=u):u=t[7];let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function Dx(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:i,cache:a,docName:o,expanded:s,onToggleExpanded:c,onRestoreSuccess:l}=e,{_:u}=an(),d;t[0]===n.timestamp?d=t[1]:(d=gx(n.timestamp),t[0]=n.timestamp,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=yx(n),t[2]=n,t[3]=p);let m=p,h;t[4]===n.timestamp?h=t[5]:(h=_x(n.timestamp),t[4]=n.timestamp,t[5]=h);let g=h,_;t[6]===n.sha?_=t[7]:(_=vx(n.sha),t[6]=n.sha,t[7]=_);let v=_,y=n.contributors.flatMap(Ox),b;t[8]===n?b=t[9]:(b=Sx(n),t[8]=n,t[9]=b);let x=b,[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useId)(),O,k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>E.current?.abort(),k=[],t[10]=O,t[11]=k):(O=t[10],k=t[11]),(0,Q.useEffect)(O,k);let A;t[12]!==n.sha||t[13]!==c?(A=()=>c(n.sha),t[12]=n.sha,t[13]=c,t[14]=A):A=t[14];let j=A,M;t[15]===C?M=t[16]:(M=function(){E.current?.abort(),E.current=null,T(!1),C(!1)},t[15]=C,t[16]=M);let N=M,P;t[17]!==u||t[18]!==o||t[19]!==n.sha||t[20]!==l||t[21]!==C?(P=async function(){T(!0);let e=new AbortController;E.current=e;let t=function(){e.signal.aborted||T(!1),E.current===e&&(E.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:o,commitSha:n.sha}),signal:e.signal})}catch(r){let i=r;!e.signal.aborted&&!(i instanceof DOMException&&i.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:o,sha:n.sha,err:i}),Ss.error(u({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)C(!1),l();else{let e=`HTTP ${r.status}`;try{let t=ci.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:o,sha:n.sha,status:r.status,detail:e}),Ss.error(u({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=u,t[18]=o,t[19]=n.sha,t[20]=l,t[21]=C,t[22]=P):P=t[22];let F=P,I;t[23]!==n||t[24]!==r?(I=(0,Z.jsx)(xx,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=I):I=t[25];let L=I,R=s?D:void 0,z=s?`bg-muted`:`hover:bg-muted/80`,B;t[26]===z?B=t[27]:(B=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,z],t[26]=z,t[27]=B);let V=B.join(` `),H;t[28]===j?H=t[29]:(H=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),j())},t[28]=j,t[29]=H);let U;t[30]===L?U=t[31]:(U=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:L}),t[30]=L,t[31]=U);let W;t[32]===m?W=t[33]:(W=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:m}),t[32]=m,t[33]=W);let G;t[34]!==n.timestamp||t[35]!==f?(G=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:f}),t[34]=n.timestamp,t[35]=f,t[36]=G):G=t[36];let K;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=K):K=t[37];let ee;t[38]===u?ee=t[39]:(ee=u({id:`Yea-K5`}),t[38]=u,t[39]=ee);let te;t[40]===C?te=t[41]:(te=e=>{e.stopPropagation(),C(!0)},t[40]=C,t[41]=te);let q;t[42]===w?q=t[43]:(q=w?(0,Z.jsx)(Fo,{className:`size-3 animate-spin`}):(0,Z.jsx)(hs,{className:`size-3`}),t[42]=w,t[43]=q);let J;t[44]!==w||t[45]!==ee||t[46]!==te||t[47]!==q?(J=(0,Z.jsx)(Vs,{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":ee,disabled:w,onClick:te,children:q})}),t[44]=w,t[45]=ee,t[46]=te,t[47]=q,t[48]=J):J=t[48];let ne;t[49]===u?ne=t[50]:(ne=u({id:`Yea-K5`}),t[49]=u,t[50]=ne);let re;t[51]===ne?re=t[52]:(re=(0,Z.jsx)(Hs,{side:`top`,children:ne}),t[51]=ne,t[52]=re);let ie;t[53]!==J||t[54]!==re?(ie=(0,Z.jsxs)(Ws,{children:[J,re]}),t[53]=J,t[54]=re,t[55]=ie):ie=t[55];let ae;t[56]!==W||t[57]!==G||t[58]!==ie?(ae=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[W,G,K,ie]}),t[56]=W,t[57]=G,t[58]=ie,t[59]=ae):ae=t[59];let oe;t[60]===x?oe=t[61]:(oe=x.length>0&&(0,Z.jsx)(Cx,{summaries:x}),t[60]=x,t[61]=oe);let se=y.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:y.join(`, `),children:y.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),ce;t[62]!==ae||t[63]!==oe||t[64]!==se?(ce=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ae,oe,se]}),t[62]=ae,t[63]=oe,t[64]=se,t[65]=ce):ce=t[65];let le;t[66]!==s||t[67]!==j||t[68]!==R||t[69]!==V||t[70]!==H||t[71]!==U||t[72]!==ce?(le=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":s,"aria-controls":R,"data-testid":`timeline-entry-expand`,className:V,onClick:j,onKeyDown:H,children:[U,ce]}),t[66]=s,t[67]=j,t[68]=R,t[69]=V,t[70]=H,t[71]=U,t[72]=ce,t[73]=le):le=t[73];let ue;t[74]!==a||t[75]!==i||t[76]!==D||t[77]!==o||t[78]!==n.sha||t[79]!==s?(ue=s&&(0,Z.jsx)(Ex,{sha:n.sha,docName:o,cache:a,diffLayout:i,panelId:D}),t[74]=a,t[75]=i,t[76]=D,t[77]=o,t[78]=n.sha,t[79]=s,t[80]=ue):ue=t[80];let de;t[81]!==le||t[82]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[le,ue]}),t[81]=le,t[82]=ue,t[83]=de):de=t[83];let fe;t[84]!==N||t[85]!==C?(fe=e=>{e?C(!0):N()},t[84]=N,t[85]=C,t[86]=fe):fe=t[86];let pe;t[87]===u?pe=t[88]:(pe=u({id:`Pyp1NA`}),t[87]=u,t[88]=pe);let me;t[89]===pe?me=t[90]:(me=(0,Z.jsx)(Wa,{children:pe}),t[89]=pe,t[90]=me);let he;t[91]!==g||t[92]!==m||t[93]!==v||t[94]!==f?(he={relative:f,absoluteTime:g,entrySha:v,authorName:m},t[91]=g,t[92]=m,t[93]=v,t[94]=f,t[95]=he):he=t[95];let ge;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(ge={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[96]=ge):ge=t[96];let _e;t[97]===he?_e=t[98]:(_e=(0,Z.jsx)(Ua,{children:(0,Z.jsx)(Y,{id:`h6EvY-`,values:he,components:ge})}),t[97]=he,t[98]=_e);let ve;t[99]!==me||t[100]!==_e?(ve=(0,Z.jsxs)(Ja,{children:[me,_e]}),t[99]=me,t[100]=_e,t[101]=ve):ve=t[101];let ye;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[102]=ye):ye=t[102];let be;t[103]===N?be=t[104]:(be=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:N,children:ye}),t[103]=N,t[104]=be);let xe;t[105]===F?xe=t[106]:(xe=()=>F(),t[105]=F,t[106]=xe);let Se;t[107]===w?Se=t[108]:(Se=w?(0,Z.jsx)(Fo,{className:`mr-2 size-4 animate-spin`}):null,t[107]=w,t[108]=Se);let Ce;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(Y,{id:`yKu_3Y`}),t[109]=Ce):Ce=t[109];let we;t[110]!==w||t[111]!==xe||t[112]!==Se?(we=(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:w,onClick:xe,children:[Se,Ce]}),t[110]=w,t[111]=xe,t[112]=Se,t[113]=we):we=t[113];let Te;t[114]!==be||t[115]!==we?(Te=(0,Z.jsxs)(qa,{children:[be,we]}),t[114]=be,t[115]=we,t[116]=Te):Te=t[116];let Ee;t[117]!==ve||t[118]!==Te?(Ee=(0,Z.jsxs)(Ga,{children:[ve,Te]}),t[117]=ve,t[118]=Te,t[119]=Ee):Ee=t[119];let De;t[120]!==S||t[121]!==fe||t[122]!==Ee?(De=(0,Z.jsx)(Ya,{open:S,onOpenChange:fe,children:Ee}),t[120]=S,t[121]=fe,t[122]=Ee,t[123]=De):De=t[123];let Oe;return t[124]!==de||t[125]!==De?(Oe=(0,Z.jsxs)(Z.Fragment,{children:[de,De]}),t[124]=de,t[125]=De,t[126]=Oe):Oe=t[126],Oe}function Ox(e){return e.docs}function kx(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{_:a}=an(),{resolvedTheme:o}=tr(),s=o===`dark`,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[0]=c):c=t[0];let[l,u]=(0,Q.useState)(c),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h]=(0,Q.useState)(Nx),[g,_]=(0,Q.useState)(Mx),v;t[1]===h?v=t[2]:(v=()=>{_(new Set),h.clear()},t[1]=h,t[2]=v);let y;t[3]===n?y=t[4]:(y=[n],t[3]=n,t[4]=y),(0,Q.useEffect)(v,y);let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=b):b=t[5];let x=b,S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(){_(new Set)},t[6]=S):S=t[6];let C=S,w,T;t[7]!==a||t[8]!==n?(w=()=>{if(!n){u([]);return}f(!0);let e=Fb({baseMs:px,maxBackoffMs:mx,isPaused:jx,poll:e=>hx(n,e,{setEntries:u,setError:m,setLoading:f,unavailableMessage:a({id:`brCtGB`})})});e.start();let t=()=>e.resume();return typeof document<`u`&&document.addEventListener(`visibilitychange`,t),()=>{e.stop(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,t)}},T=[n,a],t[7]=a,t[8]=n,t[9]=w,t[10]=T):(w=t[9],T=t[10]),(0,Q.useEffect)(w,T);let E=!d&&!p&&l.length>0,D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(An,{children:(0,Z.jsx)(Y,{id:`cklVjM`})}),t[11]=D):D=t[11];let O;t[12]!==a||t[13]!==r||t[14]!==E||t[15]!==i?(O=E&&(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(ja,{type:`single`,value:r,onValueChange:e=>{e&&i(e)},"aria-label":a({id:`XvPJaT`}),variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-md shrink-0`,children:[(0,Z.jsx)(ka,{value:`unified`,"aria-label":a({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(lf,{className:`size-3.5`})}),(0,Z.jsx)(ka,{value:`split`,"aria-label":a({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(_d,{className:`size-3.5`})})]})}),(0,Z.jsx)(Hs,{children:r===`unified`?(0,Z.jsx)(Y,{id:`379t2h`}):(0,Z.jsx)(Y,{id:`HXFyWD`})})]}),t[12]=a,t[13]=r,t[14]=E,t[15]=i,t[16]=O):O=t[16];let k;t[17]===O?k=t[18]:(k=(0,Z.jsxs)(Dn,{children:[D,O]}),t[17]=O,t[18]=k);let A;t[19]!==a||t[20]!==d?(A=d&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":a({id:`o49mDZ`}),children:[1,2,3].map(Ax)}),t[19]=a,t[20]=d,t[21]=A):A=t[21];let j;t[22]!==p||t[23]!==d?(j=!d&&p&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:p})}),t[22]=p,t[23]=d,t[24]=j):j=t[24];let M;t[25]!==l||t[26]!==p||t[27]!==d?(M=!d&&!p&&l.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Ta25TG`})})}),t[25]=l,t[26]=p,t[27]=d,t[28]=M):M=t[28];let N;t[29]!==h||t[30]!==r||t[31]!==n||t[32]!==l||t[33]!==p||t[34]!==g||t[35]!==s||t[36]!==d?(N=!d&&!p&&l.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:l.map(e=>(0,Z.jsx)(Dx,{entry:e,isDark:s,diffLayout:r,cache:h,docName:n,expanded:g.has(e.sha),onToggleExpanded:x,onRestoreSuccess:C},e.sha))}),t[29]=h,t[30]=r,t[31]=n,t[32]=l,t[33]=p,t[34]=g,t[35]=s,t[36]=d,t[37]=N):N=t[37];let P;t[38]!==A||t[39]!==j||t[40]!==M||t[41]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[A,j,M,N]}),t[38]=A,t[39]=j,t[40]=M,t[41]=N,t[42]=P):P=t[42];let F;return t[43]!==k||t[44]!==P?(F=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[k,P]}),t[43]=k,t[44]=P,t[45]=F):F=t[45],F}function Ax(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Qi,{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)(Qi,{className:`h-3 w-28`}),(0,Z.jsx)(Qi,{className:`h-3 w-40`})]})]},e)}function jx(){return typeof document<`u`&&document.visibilityState===`hidden`}function Mx(){return new Set}function Nx(){return new gs(32)}var Px=[{id:`outline`,icon:Hd},{id:`links`,icon:vt},{id:`graph`,icon:qd},{id:`timeline`,icon:gd}];function Fx(e){return e===`outline`?Ms._({id:`dD7NPy`}):e===`links`?Ms._({id:`Rj01Fz`}):e===`graph`?Ms._({id:`x2fr_j`}):Ms._({id:`cklVjM`})}function Ix(){return n(()=>import(`./GraphPanel-D5yxV_ez.js`),__vite__mapDeps([29,1,30,3,7,31,32,6,10,33,20,9,11,21,22,34,35,36,37,38,39,40,41,42,43,44,45,46,47]),import.meta.url)}var Lx=(0,Q.lazy)(async()=>({default:(await Ix()).GraphPanel})),Rx=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CNxdYTCc.js`),__vite__mapDeps([48,1,2,49,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,64,65]),import.meta.url)).ActivityModeContent}));function zx(e){let t=(0,$.c)(18),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,{_:s}=an(),[c,l]=(0,Q.useState)(`unified`),u=uy(),d,f,p;if(t[0]!==s||t[1]!==i||t[2]!==o||t[3]!==a||t[4]!==u){let e=u?Px.filter(Vx):Px;d=e.some(e=>e.id===i)?i:`outline`,f=o===`doc`&&e.length>1,p=f?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(ja,{type:`single`,variant:`outline`,value:d,onValueChange:e=>{e&&a(e)},"aria-label":s({id:`SrOuyg`}),children:e.map(Bx)})}):null,t[0]=s,t[1]=i,t[2]=o,t[3]=a,t[4]=u,t[5]=d,t[6]=f,t[7]=p}else d=t[5],f=t[6],p=t[7];let m;t[8]!==c||t[9]!==n||t[10]!==d||t[11]!==r||t[12]!==o||t[13]!==f?(m=o===`doc`?(0,Z.jsxs)(`div`,{...f?{role:`tabpanel`,id:`panel-${d}`,"aria-labelledby":`tab-${d}`}:{},className:`min-h-0 flex-1`,children:[d===`outline`&&(0,Z.jsx)(nu,{docName:n,isSourceMode:r}),d===`links`&&(0,Z.jsx)(Pb,{docName:n}),d===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-lCAuQ`})}),children:(0,Z.jsx)(Lx,{activeDocName:n})}),d===`timeline`&&(0,Z.jsx)(kx,{docName:n,diffLayout:c,onDiffLayoutChange:l})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(Rx,{})})}),t[8]=c,t[9]=n,t[10]=d,t[11]=r,t[12]=o,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Z.jsxs)(Z.Fragment,{children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Bx(e){let{id:t,icon:n}=e,r=Fx(t);return(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(ka,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(Vs,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Hs,{side:`bottom`,children:r})]},t)}function Vx(e){return e.id===`outline`}function Hx(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Ux(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Wx(e){return e/100*window.innerHeight}function Gx(e){return e/100*window.innerWidth}function Kx(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 qx({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Kx(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Ux(t,i);break;case`em`:r=Hx(t,i);break;case`vh`:r=Wx(i);break;case`vw`:r=Gx(i);break}return r}function Jx(e){return parseFloat(e.toFixed(3))}function Yx({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 Xx(e){let{panels:t}=e,n=Yx({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=Jx(qx({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Jx(qx({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Jx(qx({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Jx(qx({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 Zx(e,t=`Assertion error`){if(!e)throw Error(t)}function Qx(e,t){return Array.from(t).sort(e===`horizontal`?$x:eS)}function $x(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function eS(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function tS(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function nS(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 rS({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}=nS(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Zx(i,`No rect found`),i}var iS;function aS(){return iS===void 0&&(iS=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),iS}function oS(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Qx(n,Array.from(t.children).filter(tS).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,rS({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=aS()?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:Yx({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 sS=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)}}},cS=new Map,lS=new sS;function uS(e){cS=new Map(cS),cS.delete(e)}function dS(e,t){for(let[t]of cS)if(t.id===e)return t}function fS(e,t){for(let[t,n]of cS)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function pS(){return cS}function mS(e,t){return lS.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function hS(e,t){let n=cS.get(e);cS=new Map(cS),cS.set(e,t),lS.emit(`groupChange`,{group:e,prev:n,next:t})}function gS(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=nS(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 _S(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function vS(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:wS(e),b:wS(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Zx(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:CS(SS(n.a)),b:CS(SS(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 yS=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function bS(e){let t=getComputedStyle(TS(e)??e).display;return t===`flex`||t===`inline-flex`}function xS(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||bS(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`||yS.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function SS(e){let t=e.length;for(;t--;){let n=e[t];if(Zx(n,`Missing node`),xS(n))return n}return null}function CS(e){return e&&Number(getComputedStyle(e).zIndex)||0}function wS(e){let t=[];for(;e;)t.push(e),e=TS(e);return t}function TS(e){let{parentNode:t}=e;return _S(t)?t.host:t}function ES(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 DS({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!tS(n)||n.contains(e)||e.contains(n))return!0;if(vS(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(ES(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function OS(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=oS(r),a=gS(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&DS({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function kS(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 AS(e,t,n=0){return Math.abs(Jx(e)-Jx(t))<=n}function jS(e,t){return AS(e,t)?0:e>t?1:-1}function MS({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(jS(r,c)<0)if(a){let e=(i+c)/2;r=jS(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Jx(r),r}function NS({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(AS(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Zx(u!=null,`Invalid first pivot index`),Zx(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Zx(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(Zx(n!=null,`Previous layout not found for panel index ${t}`),AS(n,i)){let t=o-n;jS(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Zx(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(Zx(n!=null,`Previous layout not found for panel index ${t}`),AS(n,o)){let t=n-i;jS(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Zx(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&jS(i,c)<0)if(e>0){let t=c-o,n=t/2;jS(i+e,c)<0&&(e=jS(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;jS(i-e,c)<0&&(e=jS(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];Zx(e!=null,`Previous layout not found for panel index ${r}`);let a=MS({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];Zx(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=MS({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!AS(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(kS(c,l))return i;{let t=e<0?d:u,r=s[t];Zx(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=MS({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!AS(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Zx(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=MS({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(AS(i,s)||(t-=s-i,l[r]=s),AS(t,0))break;e>0?r--:r++}}}if(!AS(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 PS(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||jS(e[n],t[n])!==0)return!1;return!0}function FS({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!AS(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Zx(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Zx(i!=null,`No layout data found for index ${e}`);let o=r[e];Zx(o!=null,`No layout data found for index ${e}`);let s=MS({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!AS(a,0))for(let e=0;e<t.length;e++){let n=r[e];Zx(n!=null,`No layout data found for index ${e}`);let i=n+a,o=MS({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,AS(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function IS({groupId:e,panelId:t}){let n=()=>{let t=pS();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=FS({layout:NS({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});PS(l,p)||hS(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&AS(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Yx({group:t});o(Jx(qx({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function LS(e){e.defaultPrevented||OS(e,pS()).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=IS({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function RS(e){let t=pS();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 zS({groupId:e}){let t=()=>{let t=pS();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=FS({layout:e,panelConstraints:r});return n?o:(PS(o,c)||hS(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function BS(e,t){let n=RS(e),r=fS(n.id,!0),i=n.separators.find(t=>t.element===e);Zx(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Zx(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=zS({groupId:n.id}).getLayout(),c=FS({layout:NS({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});PS(s,c)||hS(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function VS(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=RS(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&BS(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&BS(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&BS(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&BS(t,-5);break;case`End`:e.preventDefault(),BS(t,100);break;case`Enter`:{e.preventDefault();let n=RS(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=fS(n.id,!0),o=n.separators.find(e=>e.element===t);Zx(o,`Matching separator not found`);let s=a.get(o);Zx(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Zx(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];BS(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=RS(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Zx(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(),BS(t,-100);break}}var HS={cursorFlags:0,state:`inactive`},US=new sS;function WS(){return HS}function GS(e){return US.addListener(`change`,e)}function KS(e){let t=HS,n={...HS};n.cursorFlags=e,HS=n,US.emit(`change`,{prev:t,next:n})}function qS(e){let t=HS;HS=e,US.emit(`change`,{prev:t,next:e})}function JS(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=pS(),n=OS(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),qS({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var YS=e=>e,XS=()=>{},ZS=1,QS=2,$S=4,eC=8,tC=3,nC=12,rC;function iC(){return rC===void 0&&(rC=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(rC=!0)),rC}function aC({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&&iC()){let t=(e&ZS)!==0,n=(e&QS)!==0,r=(e&$S)!==0,i=(e&eC)!==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 iC()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var oC=new WeakMap;function sC(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=oC.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=WS();switch(r.state){case`active`:case`hover`:{let e=aC({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}oC.set(e,{prevStyle:t,styleSheet:n})}function cC({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=NS({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(PS(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?ZS:QS;break;case`vertical`:s|=d<0?$S:eC;break}}else hS(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&tC:c|=s&tC,t.movementY===0?c|=o&nC:c|=s&nC,KS(c),sC(e)}function lC(e){let t=pS(),n=WS();switch(n.state){case`active`:cC({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function uC(e){if(e.defaultPrevented)return;let t=WS(),n=pS();switch(t.state){case`active`:if(e.buttons===0){qS({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=fS(e.group.id,!0);hS(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}cC({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=OS(e,n);r.length===0?t.state!==`inactive`&&qS({cursorFlags:0,state:`inactive`}):qS({cursorFlags:0,hitRegions:r,state:`hover`}),sC(e.currentTarget);break}}}function dC(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(WS().state){case`hover`:qS({cursorFlags:0,state:`inactive`})}}function fC(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=WS();switch(t.state){case`active`:qS({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(sC(e.currentTarget),t.hitRegions.forEach(e=>{let t=fS(e.group.id,!0);hS(e.group,t)}),e.preventDefault())}}function pC(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Jx(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Jx((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function mC(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Yx({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Jx(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function hC(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 gC({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=Jx(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]=Jx((r[e]??0)/a*l);else{let e=Jx(l/c.length);for(let t of c)u[t]=e}return u}function _C(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 vC=new Map;function yC(e){let t=!0;Zx(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=Yx({group:e});if(t===0)return;let n=fS(e.id);if(!n)return;let r=Xx(e),i=n.defaultLayoutDeferred?pC(r):n.layout,a=FS({layout:gC({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&PS(n.layout,a)&&hC(n.derivedPanelConstraints,r)&&n.groupSize===t)return;hS(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else mC(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Zx(!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=Yx({group:e}),s=Xx(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(_C(e.panels,l)||(l=void 0));let u=FS({layout:e.mutableState.layouts[c]??l??pC(s),panelConstraints:s}),d=e.element.ownerDocument;vC.set(d,(vC.get(d)??0)+1);let f=new Map;return oS(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),hS(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Zx(!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`,VS)}),vC.get(d)===1&&(d.addEventListener(`dblclick`,LS,!0),d.addEventListener(`pointerdown`,JS,!0),d.addEventListener(`pointerleave`,lC),d.addEventListener(`pointermove`,uC),d.addEventListener(`pointerout`,dC),d.addEventListener(`pointerup`,fC,!0)),function(){t=!1,vC.set(d,Math.max(0,(vC.get(d)??0)-1)),uS(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,VS)}),vC.get(d)||(d.removeEventListener(`dblclick`,LS,!0),d.removeEventListener(`pointerdown`,JS,!0),d.removeEventListener(`pointerleave`,lC),d.removeEventListener(`pointermove`,uC),d.removeEventListener(`pointerout`,dC),d.removeEventListener(`pointerup`,fC,!0)),a.disconnect()}}function bC(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function xC(e){let t=(0,Q.useId)();return`${e??t}`}var SC=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function CC(e){let t=(0,Q.useRef)(e);return SC(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function wC(...e){return CC(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function TC(e){let t=(0,Q.useRef)({...e});return SC(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var EC=(0,Q.createContext)(null);function DC(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:YS});(0,Q.useImperativeHandle)(t,()=>n.current,[]),SC(()=>{Object.assign(n.current,zS({groupId:e}))})}function OC({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=CC(e=>{PS(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=CC(e=>{PS(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=xC(s),v=(0,Q.useRef)(null),[y,b]=bC(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=wC(v,a);DC(_,o);let C=CC((e,t)=>{let r=WS(),i=dS(e),a=fS(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=TC({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=Qx(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Qx(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=dS(_),i=fS(_);r&&i&&hS(r,{...i,derivedPanelConstraints:Xx(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 SC(()=>{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=yC(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=fS(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=mS(_,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=AS(t.collapsedSize,i[t.panelId]),a=AS(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=WS().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(EC.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})})}OC.displayName=`Group`;function kC(){return(0,Q.useRef)(null)}function AC(){let e=(0,Q.useContext)(EC);return Zx(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function jC(e,t){let{id:n}=AC(),r=(0,Q.useRef)({collapse:XS,expand:XS,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:XS});(0,Q.useImperativeHandle)(t,()=>r.current,[]),SC(()=>{Object.assign(r.current,IS({groupId:n,panelId:e}))})}function MC({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=xC(c),_=TC({disabled:a}),v=(0,Q.useRef)(null),y=wC(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=AC(),T=d!==null,E=CC((e,t,n)=>{d?.(e,c,n)});SC(()=>{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]),jC(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>mS(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...NC,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})})}MC.displayName=`Panel`;var NC={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function PC(){return(0,Q.useRef)(null)}function FC({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=FS({layout:NS({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=FS({layout:NS({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function IC({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=xC(a),l=TC({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=wC(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=AC(),x=v===`horizontal`?`vertical`:`horizontal`;SC(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=GS(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=mS(_,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(FC({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,Q.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}IC.displayName=`Separator`;var LC=new Map;function RC(e){let t=LC.get(e);if(t)return t;let n=zC(e);return LC.set(e,n),n}async function zC(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-CVvCNjui.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-kHME1xsl.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-kHME1xsl.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-kHME1xsl.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-C3ftUzLd.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([50,1,51,31,52]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-B_7QuALZ.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-DlHfV6Cv.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-DuLkwqft.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-kHME1xsl.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-BZEgBj4N.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([54,1,55,51,31,52]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-Dtxdqotp.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([56,1,51,31,52]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-kHME1xsl.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-Cpo6SgEb.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-E5KjgWw7.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([57,1,55,51,31,53,50,52,54]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-kHME1xsl.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-uq5LpsPX.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-znFZQjzE.js`);return{python:e}},__vite__mapDeps([66,55,51,1,31,52]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r-DcEDABBa.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-C6V5dDsD.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-3l3ADjEo.js`);return{rust:e}},__vite__mapDeps([67,51,1,31,52]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-CQQBnjZX.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-BBOV2SBg.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-BZEgBj4N.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([54,1,55,51,31,52]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-BgLh90uo2.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([53,1,50,51,31,52,54,55]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-BdwnfcKi.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([58,1,51,31,52]),import.meta.url)).yaml().language;default:return null}}async function BC(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-Dtxdqotp.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([56,1,51,31,52]),import.meta.url)).json().language;if(t){let e=await RC(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-lQGk0tnp.js`);return{toml:e}},[],import.meta.url)).toml):null}function VC(e){let t=(0,$.c)(10),{_:n}=an(),r;t[0]===n?r=t[1]:(r=e=>n(e===413?{id:`C_WGy8`}:e===415?{id:`VM7H66`}:e===404?{id:`s0IDhW`}:e===400?{id:`N1mdmS`}:typeof e==`number`?{id:`96w9hU`,values:{status:e}}:{id:`ig5vUe`}),t[0]=n,t[1]=r);let i=r,{src:a,loadText:o}=e,s=(0,Q.useRef)(o),c=(0,Q.useRef)(i),l;t[2]!==o||t[3]!==i?(l=()=>{s.current=o,c.current=i},t[2]=o,t[3]=i,t[4]=l):l=t[4],(0,Q.useEffect)(l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`loading`},t[5]=u):u=t[5];let[d,f]=(0,Q.useState)(u),p,m;return t[6]!==n||t[7]!==a?(p=()=>{let e=!1,t=new AbortController;f({status:`loading`});let r=s.current;return r?(r(t.signal).then(t=>{if(!e){if(t.ok){f({status:`loaded`,content:t.text});return}f({status:`error`,message:t.message??c.current(t.status)})}}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()}):(fetch(a??``,{credentials:`same-origin`,signal:t.signal}).then(async e=>{if(!e.ok)throw Error(c.current(e.status));return e.text()}).then(t=>{e||f({status:`loaded`,content:t})}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:t instanceof Error?t.message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()})},m=[a,n],t[6]=n,t[7]=a,t[8]=p,t[9]=m):(p=t[8],m=t[9]),(0,Q.useEffect)(p,m),d}function HC(e){let t=(0,$.c)(10),{fileName:n,dataAttr:r,extraAttrs:i}=e,a=`${r}-state`,o;t[0]!==r||t[1]!==a?(o={[r]:``,[a]:`loading`},t[0]=r,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`Md709y`,values:{fileName:n}})}),t[3]=n,t[4]=s);let c;return t[5]!==i||t[6]!==n||t[7]!==o||t[8]!==s?(c=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center bg-background text-muted-foreground text-sm`,"aria-label":n,...o,...i,children:s}),t[5]=i,t[6]=n,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function UC(e){let t=(0,$.c)(16),{fileName:n,dataAttr:r,extraAttrs:i,message:a,openHref:o}=e,s=`${r}-state`,c;t[0]!==r||t[1]!==s?(c={[r]:``,[s]:`error`},t[0]=r,t[1]=s,t[2]=c):c=t[2];let l;t[3]===n?l=t[4]:(l=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`qdBUHP`,values:{fileName:n}})}),t[3]=n,t[4]=l);let u;t[5]===a?u=t[6]:(u=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:a}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o?(0,Z.jsx)(`a`,{href:o,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:(0,Z.jsx)(Y,{id:`9npOH9`})}):null,t[7]=o,t[8]=d);let f;return t[9]!==i||t[10]!==n||t[11]!==c||t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-2 bg-background p-4 text-center`,"aria-label":n,...c,...i,children:[l,u,d]}),t[9]=i,t[10]=n,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}var WC=ae({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),GC=E({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function KC(e){let t=(0,$.c)(23),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:s}=tr(),c=VC(i),l=c.status===`loaded`?c.content:null,u,d;t[4]!==n||t[5]!==l||t[6]!==s?(u=()=>{if(!a.current||l===null)return;let e=n.toLowerCase(),t=Ur(e),r=s===`dark`?WC:GC,i=!1,c=null;return BC(e,t).then(e=>{if(i||!a.current)return;let t=[ou,...e?[e]:[],Vl.editable.of(!0),jl.readOnly.of(!0),Vl.lineWrapping,r];c=new Vl({state:jl.create({doc:l,extensions:t}),parent:a.current}),o.current=c}),()=>{i=!0,c?.destroy(),o.current=null}},d=[l,n,s],t[4]=n,t[5]=l,t[6]=s,t[7]=u,t[8]=d):(u=t[7],d=t[8]),(0,Q.useEffect)(u,d);let f;t[9]===n?f=t[10]:(f={"data-text-viewer-extension":n},t[9]=n,t[10]=f);let p=f;if(c.status===`loading`){let e;return t[11]!==p||t[12]!==r?(e=(0,Z.jsx)(HC,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p}),t[11]=p,t[12]=r,t[13]=e):e=t[13],e}if(c.status===`error`){let e;return t[14]!==p||t[15]!==c.message||t[16]!==r||t[17]!==i.src?(e=(0,Z.jsx)(UC,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p,message:c.message,openHref:i.src}),t[14]=p,t[15]=c.message,t[16]=r,t[17]=i.src,t[18]=e):e=t[18],e}let m;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[19]=m):m=t[19];let h;return t[20]!==n||t[21]!==r?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loaded`,"data-text-viewer-extension":n,children:m}),t[20]=n,t[21]=r,t[22]=h):h=t[22],h}function qC(e){return Bn(`/api/asset?path=${encodeURIComponent(e)}`)}function JC(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function YC(e){let t=(0,$.c)(31),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=qC(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,d,f,p,m;if(t[4]!==n||t[5]!==l||t[6]!==i||t[7]!==r||t[8]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{if(p=l.includes(`.`)?l.split(`.`).pop()??``:``,f=p.length>0?p.toUpperCase():`FILE`,d=i?`text`:r,d===`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)(yt,{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],m=n;break bb0}if(d===`text`){let e;t[19]===n?e=t[20]:(e=JC(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(KC,{src:e,fileName:l,extension:p.toLowerCase()},n);break bb0}}t[4]=n,t[5]=l,t[6]=i,t[7]=r,t[8]=s,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else d=t[9],f=t[10],p=t[11],m=t[12];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[21]!==n||t[22]!==d||t[23]!==f||t[24]!==l||t[25]!==p||t[26]!==s?(h=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(je,{src:s,alt:l,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-full max-w-full`}):d===`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:f}),(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:()=>{u({url:s,projectRelPath:n,ext:p.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(Y,{id:`9npOH9`})})]})]})}),t[21]=n,t[22]=d,t[23]=f,t[24]=l,t[25]=p,t[26]=s,t[27]=h):h=t[27];let g;return t[28]!==l||t[29]!==h?(g=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:h}),t[28]=l,t[29]=h,t[30]=g):g=t[30],g}function XC(){let e=(0,$.c)(5),{_:t}=an(),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)(Qi,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Qi,{className:`h-4 w-full`}),(0,Z.jsx)(Qi,{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 ZC(e){let{_:t}=an();return e===`existing-repo`?[{id:`draft-spec`,icon:wd,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Hd,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:qd,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:Sf,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:wd,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:od,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function QC(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=an(),a=ZC(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){To(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch($C)};t[8]===r?d=t[9]:(d=wi(`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:wi(`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)(Ha,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(Ho,{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 $C(){}var ew=`ok-ask-ai-draft-v2`,tw={doc:null,dismissed:!1};function nw(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var rw=null,iw=new Set;function aw(e){if(e===null)return!0;let t=e.content;return!Array.isArray(t)||t.length===0?!0:t.every(e=>{let t=e.content;return!Array.isArray(t)||t.length===0})}function ow(){let e=nw();if(!e)return tw;try{let t=e.getItem(ew);if(!t)return tw;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?tw:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),tw}}function sw(){return rw===null&&(rw=ow()),rw}function cw(e){let t=nw();if(t)try{e&&!aw(e)?t.setItem(ew,JSON.stringify(e)):t.removeItem(ew)}catch{}}function lw(){for(let e of iw)e()}function uw(){return sw()}function dw(e){let t=e&&!aw(e)?e:null;rw={...sw(),doc:t},cw(t),lw()}function fw(){dw(null)}var pw=Ci(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function mw(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=wi(pw({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:a,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var hw=Wr;function gw(e){let t=I(e).kind;return t===`folder`||t===`asset`?t:`page`}function _w(e){let t=(0,$.c)(14),{items:n,query:r,selectedIndex:i,onSelect:a,loading:o,error:s,hasMore:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=c===void 0?!1:c,{_:f}=an(),p=(0,Q.useId)(),m=(0,Q.useRef)(null),h,g;t[0]===i?(h=t[1],g=t[2]):(h=()=>{(m.current?.querySelectorAll(`[role="option"]`))?.item(i)?.scrollIntoView({block:`nearest`})},g=[i],t[0]=i,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=i>=0&&i<n.length?n[i]:null,v;return t[3]!==f||t[4]!==u||t[5]!==d||t[6]!==n||t[7]!==p||t[8]!==l||t[9]!==a||t[10]!==r||t[11]!==i||t[12]!==_?(v=(0,Z.jsx)(`div`,{ref:m,className:`w-80 max-w-[min(28rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:l?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:f({id:`3m2GBo`})}):u?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`assertive`,children:f({id:`weP6me`})}):n.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:r.trim()===``?f({id:`0E9DR6`}):f({id:`yQyglE`})}):(0,Z.jsxs)(`div`,{role:`listbox`,id:p,"aria-label":f({id:`05n5wS`}),tabIndex:-1,className:`max-h-64 overflow-y-auto subtle-scrollbar`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:_?_.title:``}),n.map((e,t)=>{let n=t===i,r=gw(e.path),o=r===`folder`,s=o?`${e.path}/`:e.path;return(0,Z.jsxs)(`button`,{id:`${p}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-active":n,"data-mention-kind":r,"data-testid":`composer-mention-option-${e.docName}`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,Z.jsx)(Bt,{path:e.path,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),o?(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:f({id:`kNqMMd`})}):null]}),(0,Z.jsx)(`span`,{className:`line-clamp-2 break-all text-xs text-muted-foreground`,children:s})]})]},e.docName)}),d?(0,Z.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,"aria-hidden":!0,children:f({id:`F1T9y_`})}):null]})}),t[3]=f,t[4]=u,t[5]=d,t[6]=n,t[7]=p,t[8]=l,t[9]=a,t[10]=r,t[11]=i,t[12]=_,t[13]=v):v=t[13],v}var vw=8,yw=new ri(`composerMentionSuggestion`);function bw(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:fo(e.docName)}var xw=gr.create({name:`doc`,topNode:!0,content:`paragraph+`}),Sw=gr.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),Cw=gr.create({name:`text`,group:`inline`}),ww=gr.create({name:`hardBreak`,group:`inline`,inline:!0,selectable:!1,parseHTML(){return[{tag:`br`}]},renderHTML(){return[`br`]},addKeyboardShortcuts(){return{"Shift-Enter":()=>this.editor.commands.insertContent({type:`hardBreak`})}}}),Tw=vr.create({name:`composerHistory`,addProseMirrorPlugins(){return[nr(),ti({"Mod-z":cr,"Mod-y":ir,"Shift-Mod-z":ir})]}}),Ew=gr.create({name:`composerMention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{path:{default:``},label:{default:``}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.label||e.attrs.path);return[`span`,Qr(t,{"data-composer-mention":String(e.attrs.path??``),class:`composer-mention-chip`}),`@${n}`]},renderText({node:e}){return`@${e.attrs.path}`},addNodeView(){return({node:e,editor:t,getPos:n})=>{let r=String(e.attrs.path??``),i=String(e.attrs.label||e.attrs.path),a=document.createElement(`span`);a.className=`composer-mention-chip group/mention`,a.setAttribute(`data-composer-mention`,r),a.title=i;let o=document.createElement(`button`);o.type=`button`,o.className=`composer-mention-icon`,o.setAttribute(`aria-label`,Ms._({id:`Xzy0s0`,values:{fullLabel:i}}));let s=document.createElement(`span`);s.className=`composer-mention-glyph composer-mention-glyph-icon`,s.setAttribute(`aria-hidden`,`true`),s.innerHTML=xt(r),o.appendChild(s);let c=document.createElement(`span`);c.className=`composer-mention-glyph composer-mention-glyph-x`,c.setAttribute(`aria-hidden`,`true`),c.innerHTML=ut(Cs),o.appendChild(c),o.addEventListener(`mousedown`,e=>e.preventDefault()),o.addEventListener(`click`,r=>{r.preventDefault();let i=typeof n==`function`?n():null;i!=null&&t.chain().focus().deleteRange({from:i,to:i+e.nodeSize}).run()}),a.appendChild(o);let l=document.createElement(`span`);return l.className=`composer-mention-label`,l.textContent=i,a.appendChild(l),{dom:a}}},addProseMirrorPlugins(){return[kw(this.editor)]}});function Dw(e){return[xw,Sw,Cw,ww,Tw,Ew,...e?.placeholder?[hw.configure({placeholder:e.placeholder})]:[]]}function Ow(e=x){let t=[],n=!1,r=null,i=!1;return{snapshot(){return{loaded:n,error:i}},async getItems(a){if(!n){r||=e();try{t=await r,n=!0,i=!1}catch(e){console.error(`[composer-mention] failed to fetch pages`,e),t=[],i=!0}finally{r=null}}return k(t,a).map(e=>({docName:e.docName,title:e.title,path:bw(e)})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function kw(e){let t=Ow();return Te({editor:e,pluginKey:yw,char:`@`,items:({query:e})=>t.getItems(e),command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).insertContent([{type:`composerMention`,attrs:{path:n.path,label:n.title}},{type:`text`,text:` `}]).run()}catch(e){console.error(`[composer-mention] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=e=>{n?.command(e)},c=e=>{let n=e.items??[],{loaded:i,error:a}=t.snapshot();return{items:n,query:e.query??``,selectedIndex:r,onSelect:s,loading:!i&&!a,error:a,hasMore:n.length>=vw}},l=()=>{!e||!n||e.updateProps(c(n))};return{onBeforeStart(t){n=t,r=0;let s=ye(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new d(_w,{props:c(t),editor:t.editor}),s.popup.appendChild(e.element),i.stopAutoUpdate=s.startAutoUpdate()},onStart(e){n=e,r=0,l(),o?.()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),l(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,l(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,l(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){Wt(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,t.reset()}}}})}function Aw(e){let t=[],n=new Set,r=[];return e.state.doc.forEach(e=>{let i=``;e.forEach(e=>{if(e.type.name===`composerMention`){let r=String(e.attrs.path??``);r!==``&&(i+=`@${r}`,n.has(r)||(n.add(r),t.push(r)))}else e.isText?i+=e.text??``:e.type.name===`hardBreak`&&(i+=`
|
|
24
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function lx(e,t){return`${e}\u0000${t}`}function ux(e,t,n){let r=bi(e).body,i=bi(t).body;return r===i?``:sx(n,r,i,``,``,{context:3})}function dx(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=pt(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=lx(t,r),a=n.get(e);if(a===void 0){let o=await fetch(`/api/history/${r}?docName=${encodeURIComponent(t)}`);if(i)return;if(!o.ok){s({status:`error`,diff:null});return}let c=await o.json();if(i)return;a=c.content??``,n.set(e,a)}if(i)return;let o=c.current?.document.getText(`source`).toString()??``,l=ux(a,o,t);if(i)return;s({status:`ready`,diff:l})}catch(e){i||(console.error(`[timeline-diff] failed to load entry diff`,{sha:r,docName:t,err:e}),s({status:`error`,diff:null}))}})(),()=>{i=!0}},d=[e,t,n],r[3]=n,r[4]=t,r[5]=e,r[6]=u,r[7]=d):(u=r[6],d=r[7]),(0,Q.useEffect)(u,d),o}var fx=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-TEHR9A38.js`),__vite__mapDeps([27,1,6,7,28]),import.meta.url)).ActivityPanelDiffView})),px=1e4,mx=6e4;async function hx(e,t,n){try{let r=await fetch(`/api/history?docName=${encodeURIComponent(e)}&limit=100`,{signal:t});if(!r.ok)return n.setError(n.unavailableMessage),`error`;let i=await r.json();return n.setEntries((i.entries??[]).filter(e=>e.type!==`checkpoint`)),n.setError(null),`ok`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw e;return n.setError(n.unavailableMessage),console.error(`[timeline]`,e),`error`}finally{t.aborted||n.setLoading(!1)}}function gx(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Ms._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Ms._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Ms._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Ms._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Ms._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function _x(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function vx(e){return e.slice(0,7)}function yx(e){return e.type===`upstream`?Ms._({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`?Ms._({id:`B2DrPb`}):e.author}function bx(e){let t=(0,$.c)(17),n,r;if(t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude`){let e;return t[3]===r?e=t[4]:(e=(0,Z.jsx)(ds,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(ps,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ms,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(fs,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(bs,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(vs,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(us,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function xx(e){let t=(0,$.c)(17),{entry:n,isDark:r}=e;if(n.type===`upstream`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(St,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[0]=e):e=t[0],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[1]===i?a=t[2]:(a=Gn(i),t[1]=i,t[2]=a);let o=a,s=r?Zr[o]??li[o]:li[o],c;t[3]!==s||t[4]!==i?(c=s??Cr(i),t[3]=s,t[4]=i,t[5]=c):c=t[5];let l=c;if(o!==`bot`){let e;t[6]===l?e=t[7]:(e={color:l},t[6]=l,t[7]=e);let n;return t[8]!==o||t[9]!==e?(n=(0,Z.jsx)(bx,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[8]=o,t[9]=e,t[10]=n):n=t[10],n}if(e.name===`File System`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Nd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`OpenKnowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(rd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Af,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=u):u=t[13],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(us,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(rd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Af,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Sx(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function Cx(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(Tx),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(wx)},children:[r?(0,Z.jsx)(Xa,{className:`size-3`}):(0,Z.jsx)(Qa,{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 wx(e){return!e}function Tx(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 Ex(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=dx(n,r,i),c;t[0]===s.status?c=t[1]:(c=s.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Fo,{className:`size-3 animate-spin`}),(0,Z.jsx)(Y,{id:`38foVZ`})]}),t[0]=s.status,t[1]=c);let l;t[2]===s.status?l=t[3]:(l=s.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(Y,{id:`vvWZnu`})}),t[2]=s.status,t[3]=l);let u;t[4]!==a||t[5]!==s.diff||t[6]!==s.status?(u=s.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Fo,{className:`size-3 animate-spin`}),(0,Z.jsx)(Y,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(fx,{diff:s.diff,viewType:a})}),t[4]=a,t[5]=s.diff,t[6]=s.status,t[7]=u):u=t[7];let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function Dx(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:i,cache:a,docName:o,expanded:s,onToggleExpanded:c,onRestoreSuccess:l}=e,{_:u}=an(),d;t[0]===n.timestamp?d=t[1]:(d=gx(n.timestamp),t[0]=n.timestamp,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=yx(n),t[2]=n,t[3]=p);let m=p,h;t[4]===n.timestamp?h=t[5]:(h=_x(n.timestamp),t[4]=n.timestamp,t[5]=h);let g=h,_;t[6]===n.sha?_=t[7]:(_=vx(n.sha),t[6]=n.sha,t[7]=_);let v=_,y=n.contributors.flatMap(Ox),b;t[8]===n?b=t[9]:(b=Sx(n),t[8]=n,t[9]=b);let x=b,[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useId)(),O,k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>E.current?.abort(),k=[],t[10]=O,t[11]=k):(O=t[10],k=t[11]),(0,Q.useEffect)(O,k);let A;t[12]!==n.sha||t[13]!==c?(A=()=>c(n.sha),t[12]=n.sha,t[13]=c,t[14]=A):A=t[14];let j=A,M;t[15]===C?M=t[16]:(M=function(){E.current?.abort(),E.current=null,T(!1),C(!1)},t[15]=C,t[16]=M);let N=M,P;t[17]!==u||t[18]!==o||t[19]!==n.sha||t[20]!==l||t[21]!==C?(P=async function(){T(!0);let e=new AbortController;E.current=e;let t=function(){e.signal.aborted||T(!1),E.current===e&&(E.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:o,commitSha:n.sha}),signal:e.signal})}catch(r){let i=r;!e.signal.aborted&&!(i instanceof DOMException&&i.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:o,sha:n.sha,err:i}),Ss.error(u({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)C(!1),l();else{let e=`HTTP ${r.status}`;try{let t=ci.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:o,sha:n.sha,status:r.status,detail:e}),Ss.error(u({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=u,t[18]=o,t[19]=n.sha,t[20]=l,t[21]=C,t[22]=P):P=t[22];let F=P,I;t[23]!==n||t[24]!==r?(I=(0,Z.jsx)(xx,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=I):I=t[25];let L=I,R=s?D:void 0,z=s?`bg-muted`:`hover:bg-muted/80`,B;t[26]===z?B=t[27]:(B=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,z],t[26]=z,t[27]=B);let V=B.join(` `),H;t[28]===j?H=t[29]:(H=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),j())},t[28]=j,t[29]=H);let U;t[30]===L?U=t[31]:(U=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:L}),t[30]=L,t[31]=U);let W;t[32]===m?W=t[33]:(W=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:m}),t[32]=m,t[33]=W);let G;t[34]!==n.timestamp||t[35]!==f?(G=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:f}),t[34]=n.timestamp,t[35]=f,t[36]=G):G=t[36];let K;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=K):K=t[37];let ee;t[38]===u?ee=t[39]:(ee=u({id:`Yea-K5`}),t[38]=u,t[39]=ee);let te;t[40]===C?te=t[41]:(te=e=>{e.stopPropagation(),C(!0)},t[40]=C,t[41]=te);let q;t[42]===w?q=t[43]:(q=w?(0,Z.jsx)(Fo,{className:`size-3 animate-spin`}):(0,Z.jsx)(hs,{className:`size-3`}),t[42]=w,t[43]=q);let J;t[44]!==w||t[45]!==ee||t[46]!==te||t[47]!==q?(J=(0,Z.jsx)(Vs,{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":ee,disabled:w,onClick:te,children:q})}),t[44]=w,t[45]=ee,t[46]=te,t[47]=q,t[48]=J):J=t[48];let ne;t[49]===u?ne=t[50]:(ne=u({id:`Yea-K5`}),t[49]=u,t[50]=ne);let re;t[51]===ne?re=t[52]:(re=(0,Z.jsx)(Hs,{side:`top`,children:ne}),t[51]=ne,t[52]=re);let ie;t[53]!==J||t[54]!==re?(ie=(0,Z.jsxs)(Ws,{children:[J,re]}),t[53]=J,t[54]=re,t[55]=ie):ie=t[55];let ae;t[56]!==W||t[57]!==G||t[58]!==ie?(ae=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[W,G,K,ie]}),t[56]=W,t[57]=G,t[58]=ie,t[59]=ae):ae=t[59];let oe;t[60]===x?oe=t[61]:(oe=x.length>0&&(0,Z.jsx)(Cx,{summaries:x}),t[60]=x,t[61]=oe);let se=y.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:y.join(`, `),children:y.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),ce;t[62]!==ae||t[63]!==oe||t[64]!==se?(ce=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ae,oe,se]}),t[62]=ae,t[63]=oe,t[64]=se,t[65]=ce):ce=t[65];let le;t[66]!==s||t[67]!==j||t[68]!==R||t[69]!==V||t[70]!==H||t[71]!==U||t[72]!==ce?(le=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":s,"aria-controls":R,"data-testid":`timeline-entry-expand`,className:V,onClick:j,onKeyDown:H,children:[U,ce]}),t[66]=s,t[67]=j,t[68]=R,t[69]=V,t[70]=H,t[71]=U,t[72]=ce,t[73]=le):le=t[73];let ue;t[74]!==a||t[75]!==i||t[76]!==D||t[77]!==o||t[78]!==n.sha||t[79]!==s?(ue=s&&(0,Z.jsx)(Ex,{sha:n.sha,docName:o,cache:a,diffLayout:i,panelId:D}),t[74]=a,t[75]=i,t[76]=D,t[77]=o,t[78]=n.sha,t[79]=s,t[80]=ue):ue=t[80];let de;t[81]!==le||t[82]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[le,ue]}),t[81]=le,t[82]=ue,t[83]=de):de=t[83];let fe;t[84]!==N||t[85]!==C?(fe=e=>{e?C(!0):N()},t[84]=N,t[85]=C,t[86]=fe):fe=t[86];let pe;t[87]===u?pe=t[88]:(pe=u({id:`Pyp1NA`}),t[87]=u,t[88]=pe);let me;t[89]===pe?me=t[90]:(me=(0,Z.jsx)(Wa,{children:pe}),t[89]=pe,t[90]=me);let he;t[91]!==g||t[92]!==m||t[93]!==v||t[94]!==f?(he={relative:f,absoluteTime:g,entrySha:v,authorName:m},t[91]=g,t[92]=m,t[93]=v,t[94]=f,t[95]=he):he=t[95];let ge;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(ge={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[96]=ge):ge=t[96];let _e;t[97]===he?_e=t[98]:(_e=(0,Z.jsx)(Ua,{children:(0,Z.jsx)(Y,{id:`h6EvY-`,values:he,components:ge})}),t[97]=he,t[98]=_e);let ve;t[99]!==me||t[100]!==_e?(ve=(0,Z.jsxs)(Ja,{children:[me,_e]}),t[99]=me,t[100]=_e,t[101]=ve):ve=t[101];let ye;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[102]=ye):ye=t[102];let be;t[103]===N?be=t[104]:(be=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:N,children:ye}),t[103]=N,t[104]=be);let xe;t[105]===F?xe=t[106]:(xe=()=>F(),t[105]=F,t[106]=xe);let Se;t[107]===w?Se=t[108]:(Se=w?(0,Z.jsx)(Fo,{className:`mr-2 size-4 animate-spin`}):null,t[107]=w,t[108]=Se);let Ce;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(Y,{id:`yKu_3Y`}),t[109]=Ce):Ce=t[109];let we;t[110]!==w||t[111]!==xe||t[112]!==Se?(we=(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:w,onClick:xe,children:[Se,Ce]}),t[110]=w,t[111]=xe,t[112]=Se,t[113]=we):we=t[113];let Te;t[114]!==be||t[115]!==we?(Te=(0,Z.jsxs)(qa,{children:[be,we]}),t[114]=be,t[115]=we,t[116]=Te):Te=t[116];let Ee;t[117]!==ve||t[118]!==Te?(Ee=(0,Z.jsxs)(Ga,{children:[ve,Te]}),t[117]=ve,t[118]=Te,t[119]=Ee):Ee=t[119];let De;t[120]!==S||t[121]!==fe||t[122]!==Ee?(De=(0,Z.jsx)(Ya,{open:S,onOpenChange:fe,children:Ee}),t[120]=S,t[121]=fe,t[122]=Ee,t[123]=De):De=t[123];let Oe;return t[124]!==de||t[125]!==De?(Oe=(0,Z.jsxs)(Z.Fragment,{children:[de,De]}),t[124]=de,t[125]=De,t[126]=Oe):Oe=t[126],Oe}function Ox(e){return e.docs}function kx(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{_:a}=an(),{resolvedTheme:o}=tr(),s=o===`dark`,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[0]=c):c=t[0];let[l,u]=(0,Q.useState)(c),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h]=(0,Q.useState)(Nx),[g,_]=(0,Q.useState)(Mx),v;t[1]===h?v=t[2]:(v=()=>{_(new Set),h.clear()},t[1]=h,t[2]=v);let y;t[3]===n?y=t[4]:(y=[n],t[3]=n,t[4]=y),(0,Q.useEffect)(v,y);let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=b):b=t[5];let x=b,S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(){_(new Set)},t[6]=S):S=t[6];let C=S,w,T;t[7]!==a||t[8]!==n?(w=()=>{if(!n){u([]);return}f(!0);let e=Fb({baseMs:px,maxBackoffMs:mx,isPaused:jx,poll:e=>hx(n,e,{setEntries:u,setError:m,setLoading:f,unavailableMessage:a({id:`brCtGB`})})});e.start();let t=()=>e.resume();return typeof document<`u`&&document.addEventListener(`visibilitychange`,t),()=>{e.stop(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,t)}},T=[n,a],t[7]=a,t[8]=n,t[9]=w,t[10]=T):(w=t[9],T=t[10]),(0,Q.useEffect)(w,T);let E=!d&&!p&&l.length>0,D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(An,{children:(0,Z.jsx)(Y,{id:`cklVjM`})}),t[11]=D):D=t[11];let O;t[12]!==a||t[13]!==r||t[14]!==E||t[15]!==i?(O=E&&(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(ja,{type:`single`,value:r,onValueChange:e=>{e&&i(e)},"aria-label":a({id:`XvPJaT`}),variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-md shrink-0`,children:[(0,Z.jsx)(ka,{value:`unified`,"aria-label":a({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(lf,{className:`size-3.5`})}),(0,Z.jsx)(ka,{value:`split`,"aria-label":a({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(_d,{className:`size-3.5`})})]})}),(0,Z.jsx)(Hs,{children:r===`unified`?(0,Z.jsx)(Y,{id:`379t2h`}):(0,Z.jsx)(Y,{id:`HXFyWD`})})]}),t[12]=a,t[13]=r,t[14]=E,t[15]=i,t[16]=O):O=t[16];let k;t[17]===O?k=t[18]:(k=(0,Z.jsxs)(Dn,{children:[D,O]}),t[17]=O,t[18]=k);let A;t[19]!==a||t[20]!==d?(A=d&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":a({id:`o49mDZ`}),children:[1,2,3].map(Ax)}),t[19]=a,t[20]=d,t[21]=A):A=t[21];let j;t[22]!==p||t[23]!==d?(j=!d&&p&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:p})}),t[22]=p,t[23]=d,t[24]=j):j=t[24];let M;t[25]!==l||t[26]!==p||t[27]!==d?(M=!d&&!p&&l.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Ta25TG`})})}),t[25]=l,t[26]=p,t[27]=d,t[28]=M):M=t[28];let N;t[29]!==h||t[30]!==r||t[31]!==n||t[32]!==l||t[33]!==p||t[34]!==g||t[35]!==s||t[36]!==d?(N=!d&&!p&&l.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:l.map(e=>(0,Z.jsx)(Dx,{entry:e,isDark:s,diffLayout:r,cache:h,docName:n,expanded:g.has(e.sha),onToggleExpanded:x,onRestoreSuccess:C},e.sha))}),t[29]=h,t[30]=r,t[31]=n,t[32]=l,t[33]=p,t[34]=g,t[35]=s,t[36]=d,t[37]=N):N=t[37];let P;t[38]!==A||t[39]!==j||t[40]!==M||t[41]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[A,j,M,N]}),t[38]=A,t[39]=j,t[40]=M,t[41]=N,t[42]=P):P=t[42];let F;return t[43]!==k||t[44]!==P?(F=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[k,P]}),t[43]=k,t[44]=P,t[45]=F):F=t[45],F}function Ax(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Qi,{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)(Qi,{className:`h-3 w-28`}),(0,Z.jsx)(Qi,{className:`h-3 w-40`})]})]},e)}function jx(){return typeof document<`u`&&document.visibilityState===`hidden`}function Mx(){return new Set}function Nx(){return new gs(32)}var Px=[{id:`outline`,icon:Hd},{id:`links`,icon:vt},{id:`graph`,icon:qd},{id:`timeline`,icon:gd}];function Fx(e){return e===`outline`?Ms._({id:`dD7NPy`}):e===`links`?Ms._({id:`Rj01Fz`}):e===`graph`?Ms._({id:`x2fr_j`}):Ms._({id:`cklVjM`})}function Ix(){return n(()=>import(`./GraphPanel-DiyMfzQg.js`),__vite__mapDeps([29,1,30,3,7,31,32,6,10,33,20,9,11,21,22,34,35,36,37,38,39,40,41,42,43,44,45,46,47]),import.meta.url)}var Lx=(0,Q.lazy)(async()=>({default:(await Ix()).GraphPanel})),Rx=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-QvRIx_do.js`),__vite__mapDeps([48,1,2,49,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,64,65]),import.meta.url)).ActivityModeContent}));function zx(e){let t=(0,$.c)(18),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,{_:s}=an(),[c,l]=(0,Q.useState)(`unified`),u=uy(),d,f,p;if(t[0]!==s||t[1]!==i||t[2]!==o||t[3]!==a||t[4]!==u){let e=u?Px.filter(Vx):Px;d=e.some(e=>e.id===i)?i:`outline`,f=o===`doc`&&e.length>1,p=f?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(ja,{type:`single`,variant:`outline`,value:d,onValueChange:e=>{e&&a(e)},"aria-label":s({id:`SrOuyg`}),children:e.map(Bx)})}):null,t[0]=s,t[1]=i,t[2]=o,t[3]=a,t[4]=u,t[5]=d,t[6]=f,t[7]=p}else d=t[5],f=t[6],p=t[7];let m;t[8]!==c||t[9]!==n||t[10]!==d||t[11]!==r||t[12]!==o||t[13]!==f?(m=o===`doc`?(0,Z.jsxs)(`div`,{...f?{role:`tabpanel`,id:`panel-${d}`,"aria-labelledby":`tab-${d}`}:{},className:`min-h-0 flex-1`,children:[d===`outline`&&(0,Z.jsx)(nu,{docName:n,isSourceMode:r}),d===`links`&&(0,Z.jsx)(Pb,{docName:n}),d===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-lCAuQ`})}),children:(0,Z.jsx)(Lx,{activeDocName:n})}),d===`timeline`&&(0,Z.jsx)(kx,{docName:n,diffLayout:c,onDiffLayoutChange:l})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(Rx,{})})}),t[8]=c,t[9]=n,t[10]=d,t[11]=r,t[12]=o,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Z.jsxs)(Z.Fragment,{children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Bx(e){let{id:t,icon:n}=e,r=Fx(t);return(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(ka,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(Vs,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Hs,{side:`bottom`,children:r})]},t)}function Vx(e){return e.id===`outline`}function Hx(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Ux(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Wx(e){return e/100*window.innerHeight}function Gx(e){return e/100*window.innerWidth}function Kx(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 qx({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Kx(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Ux(t,i);break;case`em`:r=Hx(t,i);break;case`vh`:r=Wx(i);break;case`vw`:r=Gx(i);break}return r}function Jx(e){return parseFloat(e.toFixed(3))}function Yx({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 Xx(e){let{panels:t}=e,n=Yx({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=Jx(qx({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Jx(qx({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Jx(qx({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Jx(qx({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 Zx(e,t=`Assertion error`){if(!e)throw Error(t)}function Qx(e,t){return Array.from(t).sort(e===`horizontal`?$x:eS)}function $x(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function eS(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function tS(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function nS(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 rS({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}=nS(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Zx(i,`No rect found`),i}var iS;function aS(){return iS===void 0&&(iS=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),iS}function oS(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Qx(n,Array.from(t.children).filter(tS).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,rS({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=aS()?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:Yx({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 sS=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)}}},cS=new Map,lS=new sS;function uS(e){cS=new Map(cS),cS.delete(e)}function dS(e,t){for(let[t]of cS)if(t.id===e)return t}function fS(e,t){for(let[t,n]of cS)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function pS(){return cS}function mS(e,t){return lS.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function hS(e,t){let n=cS.get(e);cS=new Map(cS),cS.set(e,t),lS.emit(`groupChange`,{group:e,prev:n,next:t})}function gS(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=nS(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 _S(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function vS(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:wS(e),b:wS(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Zx(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:CS(SS(n.a)),b:CS(SS(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 yS=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function bS(e){let t=getComputedStyle(TS(e)??e).display;return t===`flex`||t===`inline-flex`}function xS(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||bS(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`||yS.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function SS(e){let t=e.length;for(;t--;){let n=e[t];if(Zx(n,`Missing node`),xS(n))return n}return null}function CS(e){return e&&Number(getComputedStyle(e).zIndex)||0}function wS(e){let t=[];for(;e;)t.push(e),e=TS(e);return t}function TS(e){let{parentNode:t}=e;return _S(t)?t.host:t}function ES(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 DS({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!tS(n)||n.contains(e)||e.contains(n))return!0;if(vS(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(ES(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function OS(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=oS(r),a=gS(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&DS({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function kS(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 AS(e,t,n=0){return Math.abs(Jx(e)-Jx(t))<=n}function jS(e,t){return AS(e,t)?0:e>t?1:-1}function MS({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(jS(r,c)<0)if(a){let e=(i+c)/2;r=jS(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Jx(r),r}function NS({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(AS(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Zx(u!=null,`Invalid first pivot index`),Zx(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Zx(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(Zx(n!=null,`Previous layout not found for panel index ${t}`),AS(n,i)){let t=o-n;jS(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Zx(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(Zx(n!=null,`Previous layout not found for panel index ${t}`),AS(n,o)){let t=n-i;jS(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Zx(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&jS(i,c)<0)if(e>0){let t=c-o,n=t/2;jS(i+e,c)<0&&(e=jS(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;jS(i-e,c)<0&&(e=jS(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];Zx(e!=null,`Previous layout not found for panel index ${r}`);let a=MS({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];Zx(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=MS({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!AS(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(kS(c,l))return i;{let t=e<0?d:u,r=s[t];Zx(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=MS({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!AS(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Zx(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=MS({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(AS(i,s)||(t-=s-i,l[r]=s),AS(t,0))break;e>0?r--:r++}}}if(!AS(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 PS(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||jS(e[n],t[n])!==0)return!1;return!0}function FS({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!AS(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Zx(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Zx(i!=null,`No layout data found for index ${e}`);let o=r[e];Zx(o!=null,`No layout data found for index ${e}`);let s=MS({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!AS(a,0))for(let e=0;e<t.length;e++){let n=r[e];Zx(n!=null,`No layout data found for index ${e}`);let i=n+a,o=MS({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,AS(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function IS({groupId:e,panelId:t}){let n=()=>{let t=pS();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=FS({layout:NS({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});PS(l,p)||hS(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&AS(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Yx({group:t});o(Jx(qx({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function LS(e){e.defaultPrevented||OS(e,pS()).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=IS({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function RS(e){let t=pS();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 zS({groupId:e}){let t=()=>{let t=pS();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=FS({layout:e,panelConstraints:r});return n?o:(PS(o,c)||hS(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function BS(e,t){let n=RS(e),r=fS(n.id,!0),i=n.separators.find(t=>t.element===e);Zx(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Zx(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=zS({groupId:n.id}).getLayout(),c=FS({layout:NS({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});PS(s,c)||hS(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function VS(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=RS(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&BS(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&BS(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&BS(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&BS(t,-5);break;case`End`:e.preventDefault(),BS(t,100);break;case`Enter`:{e.preventDefault();let n=RS(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=fS(n.id,!0),o=n.separators.find(e=>e.element===t);Zx(o,`Matching separator not found`);let s=a.get(o);Zx(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Zx(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];BS(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=RS(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Zx(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(),BS(t,-100);break}}var HS={cursorFlags:0,state:`inactive`},US=new sS;function WS(){return HS}function GS(e){return US.addListener(`change`,e)}function KS(e){let t=HS,n={...HS};n.cursorFlags=e,HS=n,US.emit(`change`,{prev:t,next:n})}function qS(e){let t=HS;HS=e,US.emit(`change`,{prev:t,next:e})}function JS(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=pS(),n=OS(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),qS({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var YS=e=>e,XS=()=>{},ZS=1,QS=2,$S=4,eC=8,tC=3,nC=12,rC;function iC(){return rC===void 0&&(rC=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(rC=!0)),rC}function aC({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&&iC()){let t=(e&ZS)!==0,n=(e&QS)!==0,r=(e&$S)!==0,i=(e&eC)!==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 iC()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var oC=new WeakMap;function sC(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=oC.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=WS();switch(r.state){case`active`:case`hover`:{let e=aC({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}oC.set(e,{prevStyle:t,styleSheet:n})}function cC({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=NS({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(PS(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?ZS:QS;break;case`vertical`:s|=d<0?$S:eC;break}}else hS(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&tC:c|=s&tC,t.movementY===0?c|=o&nC:c|=s&nC,KS(c),sC(e)}function lC(e){let t=pS(),n=WS();switch(n.state){case`active`:cC({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function uC(e){if(e.defaultPrevented)return;let t=WS(),n=pS();switch(t.state){case`active`:if(e.buttons===0){qS({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=fS(e.group.id,!0);hS(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}cC({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=OS(e,n);r.length===0?t.state!==`inactive`&&qS({cursorFlags:0,state:`inactive`}):qS({cursorFlags:0,hitRegions:r,state:`hover`}),sC(e.currentTarget);break}}}function dC(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(WS().state){case`hover`:qS({cursorFlags:0,state:`inactive`})}}function fC(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=WS();switch(t.state){case`active`:qS({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(sC(e.currentTarget),t.hitRegions.forEach(e=>{let t=fS(e.group.id,!0);hS(e.group,t)}),e.preventDefault())}}function pC(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Jx(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Jx((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function mC(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Yx({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Jx(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function hC(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 gC({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=Jx(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]=Jx((r[e]??0)/a*l);else{let e=Jx(l/c.length);for(let t of c)u[t]=e}return u}function _C(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 vC=new Map;function yC(e){let t=!0;Zx(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=Yx({group:e});if(t===0)return;let n=fS(e.id);if(!n)return;let r=Xx(e),i=n.defaultLayoutDeferred?pC(r):n.layout,a=FS({layout:gC({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&PS(n.layout,a)&&hC(n.derivedPanelConstraints,r)&&n.groupSize===t)return;hS(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else mC(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Zx(!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=Yx({group:e}),s=Xx(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(_C(e.panels,l)||(l=void 0));let u=FS({layout:e.mutableState.layouts[c]??l??pC(s),panelConstraints:s}),d=e.element.ownerDocument;vC.set(d,(vC.get(d)??0)+1);let f=new Map;return oS(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),hS(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Zx(!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`,VS)}),vC.get(d)===1&&(d.addEventListener(`dblclick`,LS,!0),d.addEventListener(`pointerdown`,JS,!0),d.addEventListener(`pointerleave`,lC),d.addEventListener(`pointermove`,uC),d.addEventListener(`pointerout`,dC),d.addEventListener(`pointerup`,fC,!0)),function(){t=!1,vC.set(d,Math.max(0,(vC.get(d)??0)-1)),uS(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,VS)}),vC.get(d)||(d.removeEventListener(`dblclick`,LS,!0),d.removeEventListener(`pointerdown`,JS,!0),d.removeEventListener(`pointerleave`,lC),d.removeEventListener(`pointermove`,uC),d.removeEventListener(`pointerout`,dC),d.removeEventListener(`pointerup`,fC,!0)),a.disconnect()}}function bC(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function xC(e){let t=(0,Q.useId)();return`${e??t}`}var SC=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function CC(e){let t=(0,Q.useRef)(e);return SC(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function wC(...e){return CC(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function TC(e){let t=(0,Q.useRef)({...e});return SC(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var EC=(0,Q.createContext)(null);function DC(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:YS});(0,Q.useImperativeHandle)(t,()=>n.current,[]),SC(()=>{Object.assign(n.current,zS({groupId:e}))})}function OC({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=CC(e=>{PS(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=CC(e=>{PS(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=xC(s),v=(0,Q.useRef)(null),[y,b]=bC(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=wC(v,a);DC(_,o);let C=CC((e,t)=>{let r=WS(),i=dS(e),a=fS(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=TC({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=Qx(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Qx(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=dS(_),i=fS(_);r&&i&&hS(r,{...i,derivedPanelConstraints:Xx(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 SC(()=>{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=yC(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=fS(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=mS(_,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=AS(t.collapsedSize,i[t.panelId]),a=AS(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=WS().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(EC.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})})}OC.displayName=`Group`;function kC(){return(0,Q.useRef)(null)}function AC(){let e=(0,Q.useContext)(EC);return Zx(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function jC(e,t){let{id:n}=AC(),r=(0,Q.useRef)({collapse:XS,expand:XS,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:XS});(0,Q.useImperativeHandle)(t,()=>r.current,[]),SC(()=>{Object.assign(r.current,IS({groupId:n,panelId:e}))})}function MC({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=xC(c),_=TC({disabled:a}),v=(0,Q.useRef)(null),y=wC(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=AC(),T=d!==null,E=CC((e,t,n)=>{d?.(e,c,n)});SC(()=>{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]),jC(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>mS(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...NC,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})})}MC.displayName=`Panel`;var NC={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function PC(){return(0,Q.useRef)(null)}function FC({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=FS({layout:NS({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=FS({layout:NS({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function IC({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=xC(a),l=TC({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=wC(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=AC(),x=v===`horizontal`?`vertical`:`horizontal`;SC(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=GS(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=mS(_,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(FC({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,Q.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}IC.displayName=`Separator`;var LC=new Map;function RC(e){let t=LC.get(e);if(t)return t;let n=zC(e);return LC.set(e,n),n}async function zC(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-CVvCNjui.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-kHME1xsl.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-kHME1xsl.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-kHME1xsl.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-C3ftUzLd.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([50,1,51,31,52]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-B_7QuALZ.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-DlHfV6Cv.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-DuLkwqft.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-kHME1xsl.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-BZEgBj4N.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([54,1,55,51,31,52]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-Dtxdqotp.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([56,1,51,31,52]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-kHME1xsl.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-Cpo6SgEb.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-E5KjgWw7.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([57,1,55,51,31,53,50,52,54]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-kHME1xsl.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-uq5LpsPX.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-znFZQjzE.js`);return{python:e}},__vite__mapDeps([66,55,51,1,31,52]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r-DcEDABBa.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-C6V5dDsD.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-3l3ADjEo.js`);return{rust:e}},__vite__mapDeps([67,51,1,31,52]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-CQQBnjZX.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-BBOV2SBg.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-BZEgBj4N.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([54,1,55,51,31,52]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-BgLh90uo2.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([53,1,50,51,31,52,54,55]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-BdwnfcKi.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([58,1,51,31,52]),import.meta.url)).yaml().language;default:return null}}async function BC(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-Dtxdqotp.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([56,1,51,31,52]),import.meta.url)).json().language;if(t){let e=await RC(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DWaLpHcz.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([51,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-lQGk0tnp.js`);return{toml:e}},[],import.meta.url)).toml):null}function VC(e){let t=(0,$.c)(10),{_:n}=an(),r;t[0]===n?r=t[1]:(r=e=>n(e===413?{id:`C_WGy8`}:e===415?{id:`VM7H66`}:e===404?{id:`s0IDhW`}:e===400?{id:`N1mdmS`}:typeof e==`number`?{id:`96w9hU`,values:{status:e}}:{id:`ig5vUe`}),t[0]=n,t[1]=r);let i=r,{src:a,loadText:o}=e,s=(0,Q.useRef)(o),c=(0,Q.useRef)(i),l;t[2]!==o||t[3]!==i?(l=()=>{s.current=o,c.current=i},t[2]=o,t[3]=i,t[4]=l):l=t[4],(0,Q.useEffect)(l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`loading`},t[5]=u):u=t[5];let[d,f]=(0,Q.useState)(u),p,m;return t[6]!==n||t[7]!==a?(p=()=>{let e=!1,t=new AbortController;f({status:`loading`});let r=s.current;return r?(r(t.signal).then(t=>{if(!e){if(t.ok){f({status:`loaded`,content:t.text});return}f({status:`error`,message:t.message??c.current(t.status)})}}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()}):(fetch(a??``,{credentials:`same-origin`,signal:t.signal}).then(async e=>{if(!e.ok)throw Error(c.current(e.status));return e.text()}).then(t=>{e||f({status:`loaded`,content:t})}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:t instanceof Error?t.message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()})},m=[a,n],t[6]=n,t[7]=a,t[8]=p,t[9]=m):(p=t[8],m=t[9]),(0,Q.useEffect)(p,m),d}function HC(e){let t=(0,$.c)(10),{fileName:n,dataAttr:r,extraAttrs:i}=e,a=`${r}-state`,o;t[0]!==r||t[1]!==a?(o={[r]:``,[a]:`loading`},t[0]=r,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`Md709y`,values:{fileName:n}})}),t[3]=n,t[4]=s);let c;return t[5]!==i||t[6]!==n||t[7]!==o||t[8]!==s?(c=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center bg-background text-muted-foreground text-sm`,"aria-label":n,...o,...i,children:s}),t[5]=i,t[6]=n,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function UC(e){let t=(0,$.c)(16),{fileName:n,dataAttr:r,extraAttrs:i,message:a,openHref:o}=e,s=`${r}-state`,c;t[0]!==r||t[1]!==s?(c={[r]:``,[s]:`error`},t[0]=r,t[1]=s,t[2]=c):c=t[2];let l;t[3]===n?l=t[4]:(l=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`qdBUHP`,values:{fileName:n}})}),t[3]=n,t[4]=l);let u;t[5]===a?u=t[6]:(u=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:a}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o?(0,Z.jsx)(`a`,{href:o,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:(0,Z.jsx)(Y,{id:`9npOH9`})}):null,t[7]=o,t[8]=d);let f;return t[9]!==i||t[10]!==n||t[11]!==c||t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-2 bg-background p-4 text-center`,"aria-label":n,...c,...i,children:[l,u,d]}),t[9]=i,t[10]=n,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}var WC=ae({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),GC=E({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function KC(e){let t=(0,$.c)(23),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:s}=tr(),c=VC(i),l=c.status===`loaded`?c.content:null,u,d;t[4]!==n||t[5]!==l||t[6]!==s?(u=()=>{if(!a.current||l===null)return;let e=n.toLowerCase(),t=Ur(e),r=s===`dark`?WC:GC,i=!1,c=null;return BC(e,t).then(e=>{if(i||!a.current)return;let t=[ou,...e?[e]:[],Vl.editable.of(!0),jl.readOnly.of(!0),Vl.lineWrapping,r];c=new Vl({state:jl.create({doc:l,extensions:t}),parent:a.current}),o.current=c}),()=>{i=!0,c?.destroy(),o.current=null}},d=[l,n,s],t[4]=n,t[5]=l,t[6]=s,t[7]=u,t[8]=d):(u=t[7],d=t[8]),(0,Q.useEffect)(u,d);let f;t[9]===n?f=t[10]:(f={"data-text-viewer-extension":n},t[9]=n,t[10]=f);let p=f;if(c.status===`loading`){let e;return t[11]!==p||t[12]!==r?(e=(0,Z.jsx)(HC,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p}),t[11]=p,t[12]=r,t[13]=e):e=t[13],e}if(c.status===`error`){let e;return t[14]!==p||t[15]!==c.message||t[16]!==r||t[17]!==i.src?(e=(0,Z.jsx)(UC,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p,message:c.message,openHref:i.src}),t[14]=p,t[15]=c.message,t[16]=r,t[17]=i.src,t[18]=e):e=t[18],e}let m;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[19]=m):m=t[19];let h;return t[20]!==n||t[21]!==r?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loaded`,"data-text-viewer-extension":n,children:m}),t[20]=n,t[21]=r,t[22]=h):h=t[22],h}function qC(e){return Bn(`/api/asset?path=${encodeURIComponent(e)}`)}function JC(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function YC(e){let t=(0,$.c)(31),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=qC(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,d,f,p,m;if(t[4]!==n||t[5]!==l||t[6]!==i||t[7]!==r||t[8]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{if(p=l.includes(`.`)?l.split(`.`).pop()??``:``,f=p.length>0?p.toUpperCase():`FILE`,d=i?`text`:r,d===`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)(yt,{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],m=n;break bb0}if(d===`text`){let e;t[19]===n?e=t[20]:(e=JC(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(KC,{src:e,fileName:l,extension:p.toLowerCase()},n);break bb0}}t[4]=n,t[5]=l,t[6]=i,t[7]=r,t[8]=s,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else d=t[9],f=t[10],p=t[11],m=t[12];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[21]!==n||t[22]!==d||t[23]!==f||t[24]!==l||t[25]!==p||t[26]!==s?(h=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(je,{src:s,alt:l,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-full max-w-full`}):d===`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:f}),(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:()=>{u({url:s,projectRelPath:n,ext:p.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(Y,{id:`9npOH9`})})]})]})}),t[21]=n,t[22]=d,t[23]=f,t[24]=l,t[25]=p,t[26]=s,t[27]=h):h=t[27];let g;return t[28]!==l||t[29]!==h?(g=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:h}),t[28]=l,t[29]=h,t[30]=g):g=t[30],g}function XC(){let e=(0,$.c)(5),{_:t}=an(),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)(Qi,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Qi,{className:`h-4 w-full`}),(0,Z.jsx)(Qi,{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 ZC(e){let{_:t}=an();return e===`existing-repo`?[{id:`draft-spec`,icon:wd,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Hd,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:qd,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:Sf,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:wd,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:od,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function QC(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=an(),a=ZC(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){To(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch($C)};t[8]===r?d=t[9]:(d=wi(`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:wi(`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)(Ha,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(Ho,{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 $C(){}var ew=`ok-ask-ai-draft-v2`,tw={doc:null,dismissed:!1};function nw(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var rw=null,iw=new Set;function aw(e){if(e===null)return!0;let t=e.content;return!Array.isArray(t)||t.length===0?!0:t.every(e=>{let t=e.content;return!Array.isArray(t)||t.length===0})}function ow(){let e=nw();if(!e)return tw;try{let t=e.getItem(ew);if(!t)return tw;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?tw:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),tw}}function sw(){return rw===null&&(rw=ow()),rw}function cw(e){let t=nw();if(t)try{e&&!aw(e)?t.setItem(ew,JSON.stringify(e)):t.removeItem(ew)}catch{}}function lw(){for(let e of iw)e()}function uw(){return sw()}function dw(e){let t=e&&!aw(e)?e:null;rw={...sw(),doc:t},cw(t),lw()}function fw(){dw(null)}var pw=Ci(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function mw(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=wi(pw({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:a,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var hw=Wr;function gw(e){let t=I(e).kind;return t===`folder`||t===`asset`?t:`page`}function _w(e){let t=(0,$.c)(14),{items:n,query:r,selectedIndex:i,onSelect:a,loading:o,error:s,hasMore:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=c===void 0?!1:c,{_:f}=an(),p=(0,Q.useId)(),m=(0,Q.useRef)(null),h,g;t[0]===i?(h=t[1],g=t[2]):(h=()=>{(m.current?.querySelectorAll(`[role="option"]`))?.item(i)?.scrollIntoView({block:`nearest`})},g=[i],t[0]=i,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=i>=0&&i<n.length?n[i]:null,v;return t[3]!==f||t[4]!==u||t[5]!==d||t[6]!==n||t[7]!==p||t[8]!==l||t[9]!==a||t[10]!==r||t[11]!==i||t[12]!==_?(v=(0,Z.jsx)(`div`,{ref:m,className:`w-80 max-w-[min(28rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:l?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:f({id:`3m2GBo`})}):u?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`assertive`,children:f({id:`weP6me`})}):n.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:r.trim()===``?f({id:`0E9DR6`}):f({id:`yQyglE`})}):(0,Z.jsxs)(`div`,{role:`listbox`,id:p,"aria-label":f({id:`05n5wS`}),tabIndex:-1,className:`max-h-64 overflow-y-auto subtle-scrollbar`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:_?_.title:``}),n.map((e,t)=>{let n=t===i,r=gw(e.path),o=r===`folder`,s=o?`${e.path}/`:e.path;return(0,Z.jsxs)(`button`,{id:`${p}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-active":n,"data-mention-kind":r,"data-testid":`composer-mention-option-${e.docName}`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,Z.jsx)(Bt,{path:e.path,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),o?(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:f({id:`kNqMMd`})}):null]}),(0,Z.jsx)(`span`,{className:`line-clamp-2 break-all text-xs text-muted-foreground`,children:s})]})]},e.docName)}),d?(0,Z.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,"aria-hidden":!0,children:f({id:`F1T9y_`})}):null]})}),t[3]=f,t[4]=u,t[5]=d,t[6]=n,t[7]=p,t[8]=l,t[9]=a,t[10]=r,t[11]=i,t[12]=_,t[13]=v):v=t[13],v}var vw=8,yw=new ri(`composerMentionSuggestion`);function bw(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:fo(e.docName)}var xw=gr.create({name:`doc`,topNode:!0,content:`paragraph+`}),Sw=gr.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),Cw=gr.create({name:`text`,group:`inline`}),ww=gr.create({name:`hardBreak`,group:`inline`,inline:!0,selectable:!1,parseHTML(){return[{tag:`br`}]},renderHTML(){return[`br`]},addKeyboardShortcuts(){return{"Shift-Enter":()=>this.editor.commands.insertContent({type:`hardBreak`})}}}),Tw=vr.create({name:`composerHistory`,addProseMirrorPlugins(){return[nr(),ti({"Mod-z":cr,"Mod-y":ir,"Shift-Mod-z":ir})]}}),Ew=gr.create({name:`composerMention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{path:{default:``},label:{default:``}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.label||e.attrs.path);return[`span`,Qr(t,{"data-composer-mention":String(e.attrs.path??``),class:`composer-mention-chip`}),`@${n}`]},renderText({node:e}){return`@${e.attrs.path}`},addNodeView(){return({node:e,editor:t,getPos:n})=>{let r=String(e.attrs.path??``),i=String(e.attrs.label||e.attrs.path),a=document.createElement(`span`);a.className=`composer-mention-chip group/mention`,a.setAttribute(`data-composer-mention`,r),a.title=i;let o=document.createElement(`button`);o.type=`button`,o.className=`composer-mention-icon`,o.setAttribute(`aria-label`,Ms._({id:`Xzy0s0`,values:{fullLabel:i}}));let s=document.createElement(`span`);s.className=`composer-mention-glyph composer-mention-glyph-icon`,s.setAttribute(`aria-hidden`,`true`),s.innerHTML=xt(r),o.appendChild(s);let c=document.createElement(`span`);c.className=`composer-mention-glyph composer-mention-glyph-x`,c.setAttribute(`aria-hidden`,`true`),c.innerHTML=ut(Cs),o.appendChild(c),o.addEventListener(`mousedown`,e=>e.preventDefault()),o.addEventListener(`click`,r=>{r.preventDefault();let i=typeof n==`function`?n():null;i!=null&&t.chain().focus().deleteRange({from:i,to:i+e.nodeSize}).run()}),a.appendChild(o);let l=document.createElement(`span`);return l.className=`composer-mention-label`,l.textContent=i,a.appendChild(l),{dom:a}}},addProseMirrorPlugins(){return[kw(this.editor)]}});function Dw(e){return[xw,Sw,Cw,ww,Tw,Ew,...e?.placeholder?[hw.configure({placeholder:e.placeholder})]:[]]}function Ow(e=x){let t=[],n=!1,r=null,i=!1;return{snapshot(){return{loaded:n,error:i}},async getItems(a){if(!n){r||=e();try{t=await r,n=!0,i=!1}catch(e){console.error(`[composer-mention] failed to fetch pages`,e),t=[],i=!0}finally{r=null}}return k(t,a).map(e=>({docName:e.docName,title:e.title,path:bw(e)})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function kw(e){let t=Ow();return Te({editor:e,pluginKey:yw,char:`@`,items:({query:e})=>t.getItems(e),command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).insertContent([{type:`composerMention`,attrs:{path:n.path,label:n.title}},{type:`text`,text:` `}]).run()}catch(e){console.error(`[composer-mention] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=e=>{n?.command(e)},c=e=>{let n=e.items??[],{loaded:i,error:a}=t.snapshot();return{items:n,query:e.query??``,selectedIndex:r,onSelect:s,loading:!i&&!a,error:a,hasMore:n.length>=vw}},l=()=>{!e||!n||e.updateProps(c(n))};return{onBeforeStart(t){n=t,r=0;let s=ye(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new d(_w,{props:c(t),editor:t.editor}),s.popup.appendChild(e.element),i.stopAutoUpdate=s.startAutoUpdate()},onStart(e){n=e,r=0,l(),o?.()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),l(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,l(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,l(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){Wt(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,t.reset()}}}})}function Aw(e){let t=[],n=new Set,r=[];return e.state.doc.forEach(e=>{let i=``;e.forEach(e=>{if(e.type.name===`composerMention`){let r=String(e.attrs.path??``);r!==``&&(i+=`@${r}`,n.has(r)||(n.add(r),t.push(r)))}else e.isText?i+=e.text??``:e.type.name===`hardBreak`&&(i+=`
|
|
25
25
|
`)}),r.push(i)}),{instruction:r.join(`
|
|
26
|
-
`).trim(),mentions:t}}function jw(e){let{instruction:t,mentions:n}=Aw(e);return t===``&&n.length===0}function Mw(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function Nw(e){let t=(0,$.c)(29),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:o,onSubmit:s,className:c,placeholder:l,initialDoc:u}=e,d=(0,Q.useRef)(i),f=(0,Q.useRef)(a),p=(0,Q.useRef)(o),m=(0,Q.useRef)(s),h;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==s?(h=()=>{d.current=i,f.current=a,p.current=o,m.current=s},t[0]=a,t[1]=i,t[2]=o,t[3]=s,t[4]=h):h=t[4],(0,Q.useEffect)(h);let g;t[5]===l?g=t[6]:(g=Dw({placeholder:l}),t[5]=l,t[6]=g);let _=u??void 0,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=wi(`composer-prosemirror py-1 outline-none`),t[7]=v):v=t[7];let y;t[8]===r?y=t[9]:(y={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:v},t[8]=r,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>t.key===`Escape`?yw.getState(e.state)?.active?!1:(e.dom.blur(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?yw.getState(e.state)?.active?!1:(m.current(),!0):!1,t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x={attributes:y,handleKeyDown:b},t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let{editor:t}=e;d.current(jw(t)),f.current?.(t.getJSON()),p.current?.(Aw(t).mentions)},t[13]=S):S=t[13];let C;t[14]!==g||t[15]!==_||t[16]!==x?(C={extensions:g,content:_,immediatelyRender:!0,editorProps:x,onUpdate:S},t[14]=g,t[15]=_,t[16]=x,t[17]=C):C=t[17];let w=D(C),T;t[18]!==w||t[19]!==u?(T=()=>{w&&(jw(w)&&Mw(u)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),fw()),d.current(jw(w)),p.current?.(Aw(w).mentions))},t[18]=w,t[19]=u,t[20]=T):T=t[20];let E;t[21]===w?E=t[22]:(E=[w],t[21]=w,t[22]=E),(0,Q.useEffect)(T,E);let O,k;t[23]===w?(O=t[24],k=t[25]):(O=()=>({focus:()=>w?.commands.focus(),blur:()=>w?.commands.blur(),clear:()=>w?.commands.clearContent(!0),setText:e=>{w&&(w.commands.setContent(e),f.current?.(w.getJSON()),p.current?.(Aw(w).mentions))},getContent:()=>w?Aw(w):{instruction:``,mentions:[]}}),k=[w],t[23]=w,t[24]=O,t[25]=k),(0,Q.useImperativeHandle)(n,O,k);let A;return t[26]!==c||t[27]!==w?(A=(0,Z.jsx)(ee,{editor:w,className:c}),t[26]=c,t[27]=w,t[28]=A):A=t[28],A}function Pw(e,t,n){return e.trim().length>0||t.length>0||n}var Fw=new Set(lo.map(e=>e.id));function Iw(e){return typeof e==`string`&&Fw.has(e)}function Lw(e){try{let t=ab(e);return Iw(t)?t:null}catch{return null}}function Rw(e,t){ob(e,t)}function zw(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:lo.find(e=>n[e.id]?.installed===!0)?.id??null}function Bw(e){let t=(0,$.c)(28),{scenario:n,className:r}=e,{_:i}=an(),{states:a,refresh:o}=So(),{dispatch:s}=Ao(),c=so(),l=Oo(),[u,d]=(0,Q.useState)(Uw),f=(0,Q.useRef)(!1),[p,m]=(0,Q.useState)(null),h=p!==null&&l!==null,g=(0,Q.useRef)(null),[_]=(0,Q.useState)(Hw),[v,y]=(0,Q.useState)(!0),[b,x]=(0,Q.useState)(!1),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(e),e||x(!1)},t[0]=S):S=t[0];let C=S,w=ZC(n),T;t[1]===a?T=t[2]:(T=e=>a[e.id]?.installed===!0,t[1]=a,t[2]=T);let E=lo.filter(T),D;t[3]===a?D=t[4]:(D=lo.every(e=>a[e.id]?.installed!=null),t[3]=a,t[4]=D);let O=D,k=O&&E.length===0,A,j;t[5]!==O||t[6]!==a?(A=()=>{if(!O||f.current)return;let e=zw({lastUsed:Lw(),states:a});d(t=>e===t?t:e)},j=[O,a],t[5]=O,t[6]=a,t[7]=A,t[8]=j):(A=t[7],j=t[8]),(0,Q.useEffect)(A,j);let M=function(e){f.current=!0,m(null),d(e),Rw(e)},N=function(e){f.current=!0,m(e)},P=function(){if(l===null||p===null)return;let{instruction:e,mentions:t}=g.current?.getContent()??{instruction:``,mentions:[]};if(!Pw(e,t,!1)){x(!0);return}let r=_o({workspace:c,description:e,scenario:n,mentions:t});r!==null&&(l.launchInTerminal(r,p),g.current?.clear(),fw())},F=function(e){let{instruction:t,mentions:r}=g.current?.getContent()??{instruction:``,mentions:[]};if(!Pw(t,r,!1)){x(!0);return}Rw(e);let i=_o({workspace:c,description:t,scenario:n,mentions:r});i!==null&&(s(e,i),g.current?.clear(),fw())},I=function(){h?P():u!==null&&F(u)},L=function(e){g.current?.setText(e),g.current?.focus()};if(k){let e;t[9]===r?e=t[10]:(e=wi(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[9]=r,t[10]=e);let n;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(us,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[11]=n):n=t[11];let i;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`3IseAk`})})]}),t[12]=i):i=t[12];let a;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:lo.map(Vw)}),t[13]=a):a=t[13];let o;return t[14]===e?o=t[15]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[14]=e,t[15]=o),o}let R=E.length>0,z=l!==null,B;t[16]===r?B=t[17]:(B=wi(`flex w-full flex-col gap-3`,r),t[16]=r,t[17]=B);let V;t[18]===i?V=t[19]:(V=i({id:`7hctf2`}),t[18]=i,t[19]=V);let H;t[20]===i?H=t[21]:(H=i({id:`0jD-Gn`}),t[20]=i,t[21]=H);let U;t[22]!==v||t[23]!==b?(U=b&&v?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(Y,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[22]=v,t[23]=b,t[24]=U):U=t[24];let W=u===null?(0,Z.jsx)(X,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(Y,{id:`hYgDIe`})}):(0,Z.jsxs)(mw,{children:[(0,Z.jsx)(X,{type:`button`,onClick:()=>h?P():F(u),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:h&&p!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(go,{id:ho(p),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`4rjwLG`,values:{0:Vn[p].displayName}})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(go,{id:u,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`9dw5bW`,values:{0:uo(u)}})]})}),(0,Z.jsxs)(jc,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(xc,{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)(Xa,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(Tc,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(wc,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),Do.map(e=>{let{displayName:t}=Vn[e];return(0,Z.jsxs)(Cc,{onSelect:()=>N(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(go,{id:ho(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),p===e?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,R?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(Ic,{}):null,(0,Z.jsxs)(wc,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),E.map(e=>(0,Z.jsxs)(Cc,{onSelect:()=>M(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(go,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!h&&e.id===u?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]})]})]}),G;return t[25]!==W||t[26]!==U?(G=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[U,W]}),t[25]=W,t[26]=U,t[27]=G):G=t[27],(0,Z.jsxs)(`div`,{className:B,children:[(0,Z.jsxs)(`div`,{className:`flex w-full 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)(Nw,{ref:g,ariaLabel:V,placeholder:H,onEmptyChange:C,onContentChange:dw,onSubmit:I,initialDoc:_,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),G]}),n!==`existing-repo`&&w.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:w.map(e=>{let t=e.icon;return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>L(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)})}):null]})}function Vw(e){return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void oo(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(go,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(Oa,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function Hw(){return uw().doc??void 0}function Uw(){return Lw()}var Ww=3100,Gw=3;function Kw(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Gw;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var qw={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},Jw=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function Yw(e,t={}){let n=t.rng??Math.random,r=t.colors??Jw,i=qw[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var Xw=1.8,Zw=90,Qw=16,$w=380,eT=.025,tT=.1,nT=.18,rT=400,iT=9.2736,aT=18.1799,oT=14.5244,sT={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function cT(e,t){let{halfWidth:n,apexLift:r}=sT[t];return`M${e-n} ${oT+.3} Q${e} ${oT-r}, ${e+n} ${oT+.3}`}function lT(e){let t=1.5,n=.3;return`M${e-t} ${oT-n} Q${e} ${oT+1.4}, ${e+t} ${oT-n}`}var uT=15,dT=15;function fT(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function pT(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=Kw(g,t);_(n),y(_T),S(Yw(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Ww)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(gT),S(Yw(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Ww))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/$w)),C=-Math.max(-1,Math.min(1,b/$w))*Qw,w=S*Qw,T=0,E=0;if(x>=1){let e=Math.min(x/Zw,1)*Xw;T=y/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!m&&D)return;l(),r+=(C-r)*tT,i+=(w-i)*tT,u.style.transform=`perspective(${rT}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*nT,o+=(E-o)*nT;let O=i*eT,k=-r*eT,A=a+O,j=o+k;h.current.x=A,h.current.y=j,p.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=wi(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=wi(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=wi(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:iT,cy:oT,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let ee=(F||T)&&`ok-blob-eye-hidden`,te;t[26]===ee?te=t[27]:(te=wi(`ok-blob-eye ok-blob-eye-right`,ee),t[26]=ee,t[27]=te);let q;t[28]===te?q=t[29]:(q=(0,Z.jsx)(`ellipse`,{cx:aT,cy:oT,rx:1.2722,ry:1.9083,className:te}),t[28]=te,t[29]=q);let J;t[30]===I?J=t[31]:(J=cT(iT,I),t[30]=I,t[31]=J);let ne=(!F||T)&&`ok-blob-eye-hidden`,re;t[32]===ne?re=t[33]:(re=wi(`ok-blob-happy-eye`,ne),t[32]=ne,t[33]=re);let ie;t[34]!==J||t[35]!==re?(ie=(0,Z.jsx)(`path`,{d:J,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:re}),t[34]=J,t[35]=re,t[36]=ie):ie=t[36];let ae;t[37]===I?ae=t[38]:(ae=cT(aT,I),t[37]=I,t[38]=ae);let oe=(!F||T)&&`ok-blob-eye-hidden`,se;t[39]===oe?se=t[40]:(se=wi(`ok-blob-happy-eye`,oe),t[39]=oe,t[40]=se);let ce;t[41]!==ae||t[42]!==se?(ce=(0,Z.jsx)(`path`,{d:ae,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:se}),t[41]=ae,t[42]=se,t[43]=ce):ce=t[43];let le;t[44]===T?le=t[45]:(le=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:lT(iT),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:lT(aT),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=le);let ue;t[46]!==K||t[47]!==q||t[48]!==ie||t[49]!==ce||t[50]!==le?(ue=(0,Z.jsxs)(`g`,{ref:p,children:[K,q,ie,ce,le]}),t[46]=K,t[47]=q,t[48]=ie,t[49]=ce,t[50]=le,t[51]=ue):ue=t[51];let de;t[52]!==B||t[53]!==H||t[54]!==ue?(de=(0,Z.jsxs)(`g`,{className:H,children:[U,ue]},B),t[52]=B,t[53]=H,t[54]=ue,t[55]=de):de=t[55];let fe;t[56]===T?fe=t[57]:(fe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=fe);let pe;t[58]!==v||t[59]!==x?(pe=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(mT)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=pe):pe=t[60];let me;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==de||t[65]!==fe||t[66]!==pe?(me=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:hT,children:[de,fe,pe]}),t[61]=D,t[62]=s,t[63]=z,t[64]=de,t[65]=fe,t[66]=pe,t[67]=me):me=t[67];let he;return t[68]!==R||t[69]!==me?(he=(0,Z.jsx)(`span`,{ref:d,className:R,children:me}),t[68]=R,t[69]=me,t[70]=he):he=t[70],he}function mT(e){return(0,Z.jsx)(`circle`,{cx:uT+e.originDx,cy:dT+e.originDy,r:e.size,className:`ok-blob-firework`,style:fT(e)},e.id)}function hT(e){return e.preventDefault()}function gT(e){return e+1}function _T(e){return e+1}function vT(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(pT,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function yT({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 bT=`open-knowledge:create-top-level-file`;function xT(e={}){window.dispatchEvent(new CustomEvent(bT,{detail:e}))}function ST(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(bT,t),()=>window.removeEventListener(bT,t)}function CT(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=an(),a=bo(),{title:o,subtitle:s}=yT({isOnboarding:!1,isEmbedded:a}),c=pa(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p=vT,m=i(o),h=i(s),_;t[3]!==p||t[4]!==n||t[5]!==m||t[6]!==h?(_=(0,Z.jsx)(p,{title:m,subtitle:h,celebrateSignal:n}),t[3]=p,t[4]=n,t[5]=m,t[6]=h,t[7]=_):_=t[7];let v;t[8]===a?v=t[9]:(v=a?(0,Z.jsx)(QC,{scenario:`existing-repo`}):(0,Z.jsx)(Bw,{scenario:`existing-repo`}),t[8]=a,t[9]=v);let y;t[10]!==u||t[11]!==f||t[12]!==d?(y=d||f||u.length>0?(0,Z.jsx)(ET,{templates:u,loading:d,error:f,onSelect:TT}):null,t[10]=u,t[11]=f,t[12]=d,t[13]=y):y=t[13];let b,x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`size-3`}),x=(0,Z.jsx)(Y,{id:`IajAbS`}),t[14]=b,t[15]=x):(b=t[14],x=t[15]);let S;t[16]===r?S=t[17]:(S=(0,Z.jsxs)(X,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[b,x]}),t[16]=r,t[17]=S);let C;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(X,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:wT,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(g,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=C):C=t[18];let w;t[19]===S?w=t[20]:(w=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[S,C]}),t[19]=S,t[20]=w);let T;t[21]!==w||t[22]!==y?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[y,w]}),t[21]=w,t[22]=y,t[23]=T):T=t[23];let E;return t[24]!==T||t[25]!==_||t[26]!==v?(E=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[_,v,T]}),t[24]=T,t[25]=_,t[26]=v,t[27]=E):E=t[27],E}function wT(){return xT({initialDir:``})}function TT(e,t){return xT({template:{folder:e,name:t}})}function ET(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=an(),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)(ge,{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)(DT,{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 DT(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=an(),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 OT(e){let t=(0,$.c)(20),{terminalVisible:n}=e,r=n===void 0?!1:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let{ok:t,body:n}=await $a();if(e)return;let r=t?Hn.safeParse(n):null;r?.success?(l(jT(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=ks(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(p.current)}},h=[],t[0]=m,t[1]=h):(m=t[0],h=t[1]),(0,Q.useEffect)(m,h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){clearTimeout(p.current),p.current=setTimeout(()=>d(AT),500),$a().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=Hn.safeParse(n);r.success&&l(jT(r.data.documents))}).catch(kT)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r){let e;t[4]!==u||t[5]!==y||t[6]!==v?(e=v?(0,Z.jsx)(MT,{isOnboarding:y,celebrateSignal:u}):null,t[4]=u,t[5]=y,t[6]=v,t[7]=e):e=t[7];let n;return t[8]===e?n=t[9]:(n=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-end px-6 sm:px-12 md:px-16 pb-8 pt-10`,children:e}),t[8]=e,t[9]=n),n}let S;t[10]!==u||t[11]!==y||t[12]!==v?(S=v?y?(0,Z.jsx)(NT,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(CT,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[10]=u,t[11]=y,t[12]=v,t[13]=S):S=t[13];let C;t[14]!==o||t[15]!==i?(C=(0,Z.jsx)(Jv,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[14]=o,t[15]=i,t[16]=C):C=t[16];let w;return t[17]!==S||t[18]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6 sm:px-12 md:px-16 subtle-scrollbar`,children:[S,C]}),t[17]=S,t[18]=C,t[19]=w):w=t[19],w}function kT(){}function AT(e){return e+1}function jT(e){return rl(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function MT(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=an(),a=bo(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=yT({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=vT,s=i(e),c=i(r),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l}else o=t[3],s=t[4],c=t[5],l=t[6];let u;t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:r}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function NT(e){let t=(0,$.c)(28),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=an(),a=bo(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=yT({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=vT,s=i(e),c=i(n),t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l}else o=t[2],s=t[3],c=t[4],l=t[5];let u;t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:n}),t[6]=o,t[7]=n,t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;t[11]===a?d=t[12]:(d=a?(0,Z.jsx)(QC,{scenario:`new-project`}):(0,Z.jsx)(Bw,{scenario:`new-project`}),t[11]=a,t[12]=d);let f;t[13]!==i||t[14]!==a?(f=i(a?{id:`GubkSu`}:{id:`xeXS4P`}),t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(FT,{label:f}),t[16]=f,t[17]=p);let m;t[18]===r?m=t[19]:(m=(0,Z.jsx)(Vv,{onPackSelect:r,onCreateBlankFile:PT}),t[18]=r,t[19]=m);let h;t[20]!==p||t[21]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[p,m]}),t[20]=p,t[21]=m,t[22]=h):h=t[22];let g;return t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==h?(g=(0,Z.jsxs)(`div`,{className:l,children:[u,d,h]}),t[23]=l,t[24]=u,t[25]=d,t[26]=h,t[27]=g):g=t[27],g}function PT(){return xT()}function FT(e){let t=(0,$.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n})}),t[0]=n,t[1]=r),r}function IT(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function LT(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=an(),[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)(zT,{}),(0,Z.jsx)(Qi,{className:`h-7 w-full`}),(0,Z.jsx)(Qi,{className:`h-7 w-full`}),(0,Z.jsx)(Qi,{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=IT(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 Xo(n,{[e]:t});if(!r.ok){let{error:e}=r;Ss.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 Xo(n,{[e]:null});if(!t.ok){let{error:e}=t;Ss.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,Va(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):Ia[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(_r(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 Xo(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 Xo(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},t[32]=a,t[33]=n,t[34]=i,t[35]=p,t[36]=u,t[37]=R):R=t[37];let z=R,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){d(null)},t[38]=B):B=t[38];let V=B,H=!o,U;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>s(!e),t[39]=U):U=t[39];let W=`size-3 transition-transform ${o?``:`rotate-90`}`,G;t[40]===W?G=t[41]:(G=(0,Z.jsx)(Qa,{className:W,"aria-hidden":!0}),t[40]=W,t[41]=G);let K;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`vQIVHc`})}),t[42]=K):K=t[42];let ee;t[43]===G?ee=t[44]:(ee=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[G,K]}),t[43]=G,t[44]=ee);let te;t[45]===h?te=t[46]:(te=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:RT,children:h}),t[45]=h,t[46]=te);let q;t[47]!==ee||t[48]!==te?(q=(0,Z.jsxs)(cs,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[ee,te]}),t[47]=ee,t[48]=te,t[49]=q):q=t[49];let J;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hSBIG-`})}),t[50]=J):J=t[50];let ne;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(ne=_.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)(za,{keyName:e,value:t,declared:Pa(t,ur(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]=ne):ne=t[59];let re;t[60]!==c||t[61]!==N?(re=c?(0,Z.jsx)(La,{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)(Lt,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=re):re=t[62];let ie;t[63]!==ne||t[64]!==re?(ie=(0,Z.jsx)(ss,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[J,ne,re]})}),t[63]=ne,t[64]=re,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)(ls,{open:H,onOpenChange:U,children:[q,ie]})}),t[66]=H,t[67]=q,t[68]=ie,t[69]=ae):ae=t[69],ae}function RT(e){return e.stopPropagation()}function zT(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(kd,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function BT(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?Ms._({id:`xOTzt5`}):t<3600?Ms._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?Ms._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?Ms._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function VT(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function HT(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:ia,label:Ms._({id:`QR5SP1`}),detail:VT(i)};case`template-edit`:return{Icon:Wo,label:Ms._({id:`-LHLx7`}),detail:VT(i)};case`template-delete`:return{Icon:Ro,label:Ms._({id:`_gkGSK`}),detail:VT(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:id,label:Ms._({id:`KPW5WC`}),detail:`${VT(e??``)} → ${VT(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:kd,label:Ms._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:kd,label:Ms._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:kd,label:Ms._({id:`ZQLDTl`}),detail:``};default:return{Icon:Id,label:r.replace(/-/g,` `),detail:VT(i)}}}function UT(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?Ms._({id:`B2DrPb`}):e.author||Ms._({id:`Ef7StM`})}function WT(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=Es(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)(ge,{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)(Qi,{className:`h-8 w-full`}),(0,Z.jsx)(Qi,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(GT)})}),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 GT(e){let{Icon:t,label:n,detail:r}=HT(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)(Af,{className:`size-3`,"aria-hidden":!0}),UT(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:BT(e.timestamp)})]},e.sha)}function KT(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function qT(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=KT(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function JT(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function YT(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:qT(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:JT(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:qT(e,t.pageTitles),children:a}}function XT(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)(Qi,{className:`h-12 w-full`}),(0,Z.jsx)(Qi,{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)(ge,{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)(Lt,{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)(Da,{template:e,onCreate:()=>l(e.name),onEdit:()=>ns(V(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(Na,{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)(Oi,{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(ZT)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),ns(V(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)(Ui,{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)(wv,{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 ZT(e){return e.name}function QT(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=wi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=wi(`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 $T(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=wi(`[&_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 eE(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=wi(`[&_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 tE(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=wi(`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 nE(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=wi(`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 rE(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=wi(`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 iE(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Ms._({id:`xOTzt5`});if(r<60)return Ms._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Ms._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Ms._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function aE(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 oE(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)(y,{className:`ml-1 size-3`}):(0,Z.jsx)(rt,{className:`ml-1 size-3`}):(0,Z.jsx)(ad,{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 sE(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=an(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=to(),l=ya(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)(Qi,{className:`size-5 rounded`}),(0,Z.jsx)(Qi,{className:`h-7 w-48`})]}),(0,Z.jsx)(Qi,{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)(Qi,{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)(Qi,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(uE)]})]}),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=YT(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=aE(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?_(lE):(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)(Io,{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)(Lt,{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)(LT,{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)(XT,{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)(WT,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=QT;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)(oE,{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)(nE,{"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)(oE,{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)(nE,{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)($T,{children:(0,Z.jsxs)(tE,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=eE,b=a.length?a.map(cE):(0,Z.jsx)(tE,{children:(0,Z.jsx)(rE,{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)(wv,{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 cE(e){return(0,Z.jsxs)(tE,{children:[(0,Z.jsx)(rE,{children:(0,Z.jsxs)(`a`,{href:Jc(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(jd,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(dt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(rE,{className:`text-muted-foreground`,children:e.kind===`file`?iE(e.modified):`—`})]},e.path)}function lE(e){return e===`asc`?`desc`:`asc`}function uE(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)(Qi,{className:`size-4 rounded`}),(0,Z.jsx)(Qi,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Qi,{className:`h-4 w-16`})})]},e)}function dE(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l,u;t[0]===o?(l=t[1],u=t[2]):(l=()=>{o?s.current?.focus():c.current?.focus()},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Ed,{className:`size-9`,"aria-hidden":`true`})}),t[3]=d):d=t[3];let f=o?void 0:-1,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Y,{id:`P3hnm0`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsx)(`h2`,{ref:c,id:`large-file-title`,tabIndex:f,className:`text-2xl font-light text-balance outline-none`,children:p}),t[5]=f,t[6]=m);let h;t[7]===r?h=t[8]:(h=Er(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=Er(i),t[9]=i,t[10]=g);let _;t[11]!==n||t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`GJH-AT`,values:{0:h,1:g,docName:n}})}),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==o?(y=o?(0,Z.jsxs)(X,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(B,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=y):y=t[20];let b;return t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[d,v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function fE(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(pE),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>f(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(){L(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 pE(){return new Set}function mE(e){let t=(0,$.c)(24),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=bi(r).body;s=D,i=bt,a=!1,o=Pt().parseWithFallback(e),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={attributes:{class:`pt-4 pb-4`}},t[5]=c):c=t[5];let l;t[6]!==i||t[7]!==a||t[8]!==o?(l={extensions:i,editable:a,content:o,editorProps:c},t[6]=i,t[7]=a,t[8]=o,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=[r],t[10]=r,t[11]=u);let d=s(l,u),[f]=(0,Q.useState)(hE),p=(0,Q.useRef)(null),m,h;t[12]===f?(m=t[13],h=t[14]):(m=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},h=[f],t[12]=f,t[13]=m,t[14]=h),(0,Q.useLayoutEffect)(m,h);let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}})})}),t[15]=g):g=t[15];let _;t[16]===d?_=t[17]:(_=(0,Z.jsx)(ee,{editor:d,className:`tiptap-editor-portal-content h-full`}),t[16]=d,t[17]=_);let v;t[18]!==f||t[19]!==_?(v=(0,ld.createPortal)(_,f),t[18]=f,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==n||t[22]!==v?(y=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:[g,v]}),t[21]=n,t[22]=v,t[23]=y):y=t[23],y}function hE(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var gE=`data-skill-markdown`;function _E(e){let t=(0,$.c)(12),{scope:n,name:r,path:i,fileName:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==n?(o={loadText:e=>Ac({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=VC(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)(HC,{fileName:a,dataAttr:gE}),t[4]=a,t[5]=e),e}if(s.status===`error`){let e;return t[6]!==s.message||t[7]!==a?(e=(0,Z.jsx)(UC,{fileName:a,dataAttr:gE,message:s.message}),t[6]=s.message,t[7]=a,t[8]=e):e=t[8],e}let c;return t[9]!==s.content||t[10]!==a?(c=(0,Z.jsx)(mE,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var vE=new Set([`md`,`mdx`]);function yE(e){let t=(0,$.c)(19),{scope:n,name:r,path:i}=e,a;t[0]===i?a=t[1]:(a=i.split(`/`).pop()??i,t[0]=i,t[1]=a);let o=a,s=o.lastIndexOf(`.`),c,l;if(t[2]!==s||t[3]!==o?(c=s>=0?o.slice(s+1).toLowerCase():``,l=vE.has(c),t[2]=s,t[3]=o,t[4]=c,t[5]=l):(c=t[4],l=t[5]),l){let e;return t[6]!==o||t[7]!==r||t[8]!==i||t[9]!==n?(e=(0,Z.jsx)(_E,{scope:n,name:r,path:i,fileName:o}),t[6]=o,t[7]=r,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}let u;t[11]!==r||t[12]!==i||t[13]!==n?(u=e=>Ac({scope:n,name:r,path:i},e),t[11]=r,t[12]=i,t[13]=n,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==o||t[17]!==u?(d=(0,Z.jsx)(KC,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function bE(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var xE=bE(()=>n(()=>import(`./SettingsDialogBody-CU-nEwde.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([68,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,69,8,70,21,18,19,71,33,72,65,24,47,73]),import.meta.url));function SE(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=an(),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:CE,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 CE(){return window.location.reload()}function wE(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(h,{fallbackRender:EE,onError:TE,children:n}),t[0]=n,t[1]=r),r}function TE(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function EE(e){return(0,Z.jsx)(SE,{...e})}function DE(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function OE(e){let t=(0,$.c)(94),{open:n,onOpenChange:r}=e,{_:i}=an(),{collabUrl:a}=pt(),{userBinding:o,userSynced:s,okignoreBinding:c,okignoreSynced:l}=Bo(),{desktopPresent:u}=Hi(),[d,f]=(0,Q.useState)(`preferences`),p,m;t[0]===n?(p=t[1],m=t[2]):(p=()=>{n&&f(`preferences`)},m=[n],t[0]=n,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=a!==null,g=typeof window<`u`&&window.okDesktop!=null,_;t[3]===i?_=t[4]:(_=i({id:`7PzzBU`}),t[3]=i,t[4]=_);let v;t[5]===i?v=t[6]:(v=i({id:`Q6hhn8`}),t[5]=i,t[6]=v);let y;t[7]===v?y=t[8]:(y={id:`preferences`,label:v},t[7]=v,t[8]=y);let b;t[9]===i?b=t[10]:(b=i({id:`4KmEoC`}),t[9]=i,t[10]=b);let x;t[11]===b?x=t[12]:(x={id:`hotkeys`,label:b},t[11]=b,t[12]=x);let S;t[13]===i?S=t[14]:(S=i({id:`AeXO77`}),t[13]=i,t[14]=S);let C;t[15]===S?C=t[16]:(C={id:`account`,label:S},t[15]=S,t[16]=C);let w;t[17]!==y||t[18]!==x||t[19]!==C?(w=[y,x,C],t[17]=y,t[18]=x,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==_?(T={id:`user`,label:_,enabled:!0,items:w},t[21]=w,t[22]=_,t[23]=T):T=t[23];let E;t[24]===i?E=t[25]:(E=i({id:`ZWyHmq`}),t[24]=i,t[25]=E);let D;t[26]===i?D=t[27]:(D=i({id:`Nu4DdT`}),t[26]=i,t[27]=D);let O;t[28]===D?O=t[29]:(O={id:`sync`,label:D},t[28]=D,t[29]=O);let k;t[30]===i?k=t[31]:(k=i({id:`A1taO8`}),t[30]=i,t[31]=k);let A;t[32]===k?A=t[33]:(A={id:`search`,label:k},t[32]=k,t[33]=A);let j;t[34]===i?j=t[35]:(j=g?[{id:`terminal`,label:i({id:`ALhMYW`})}]:[],t[34]=i,t[35]=j);let M;t[36]===i?M=t[37]:(M=i({id:`iTylMl`}),t[36]=i,t[37]=M);let N;t[38]===M?N=t[39]:(N={id:`project-templates`,label:M},t[38]=M,t[39]=N);let P;t[40]===i?P=t[41]:(P=i({id:`PCSkw2`}),t[40]=i,t[41]=P);let F;t[42]===P?F=t[43]:(F={id:`skills`,label:P},t[42]=P,t[43]=F);let I;t[44]===i?I=t[45]:(I=i({id:`3zyg_A`}),t[44]=i,t[45]=I);let L;t[46]===I?L=t[47]:(L={id:`okignore`,label:I},t[46]=I,t[47]=L);let R;t[48]===i?R=t[49]:(R=i({id:`cs4mps`}),t[48]=i,t[49]=R);let z;t[50]===R?z=t[51]:(z={id:`sharing`,label:R},t[50]=R,t[51]=z);let B;t[52]!==O||t[53]!==A||t[54]!==j||t[55]!==N||t[56]!==F||t[57]!==L||t[58]!==z?(B=[O,A,...j,N,F,L,z],t[52]=O,t[53]=A,t[54]=j,t[55]=N,t[56]=F,t[57]=L,t[58]=z,t[59]=B):B=t[59];let V;t[60]!==h||t[61]!==E||t[62]!==B?(V={id:`project`,label:E,enabled:h,items:B},t[60]=h,t[61]=E,t[62]=B,t[63]=V):V=t[63];let H;t[64]===i?H=t[65]:(H=i({id:`nbfdhU`}),t[64]=i,t[65]=H);let U;t[66]!==i||t[67]!==u?(U=[],t[66]=i,t[67]=u,t[68]=U):U=t[68];let W;t[69]!==H||t[70]!==U?(W={id:`integrations`,label:H,enabled:!0,items:U},t[69]=H,t[70]=U,t[71]=W):W=t[71];let G;t[72]!==T||t[73]!==V||t[74]!==W?(G=[T,V,W],t[72]=T,t[73]=V,t[74]=W,t[75]=G):G=t[75];let K=G,ee;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Wa,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})}),t[76]=ee):ee=t[76];let te;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Ua,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`RDrXh4`})}),t[77]=te):te=t[77];let q;t[78]!==d||t[79]!==K?(q=(0,Z.jsx)(kE,{groups:K,activeId:d,onSelect:f}),t[78]=d,t[79]=K,t[80]=q):q=t[80];let J;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(ME,{}),t[81]=J):J=t[81];let ne=s?o:null,re;t[82]!==d||t[83]!==c||t[84]!==l||t[85]!==ne?(re=(0,Z.jsx)(`section`,{"aria-labelledby":`settings-dialog-title`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:(0,Z.jsx)(wE,{children:(0,Z.jsx)(Q.Suspense,{fallback:J,children:(0,Z.jsx)(xE,{activeId:d,userBinding:ne,okignoreBinding:c,okignoreSynced:l})})})}),t[82]=d,t[83]=c,t[84]=l,t[85]=ne,t[86]=re):re=t[86];let ie;t[87]!==q||t[88]!==re?(ie=(0,Z.jsxs)(Ga,{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:[ee,te,q,re]}),t[87]=q,t[88]=re,t[89]=ie):ie=t[89];let ae;return t[90]!==r||t[91]!==n||t[92]!==ie?(ae=(0,Z.jsx)(Ya,{open:n,onOpenChange:r,children:ie}),t[90]=r,t[91]=n,t[92]=ie,t[93]=ae):ae=t[93],ae}function kE(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:i}=e,{_:a}=an(),o;t[0]===a?o=t[1]:(o=a({id:`y1t8bQ`}),t[0]=a,t[1]=o);let s;if(t[2]!==r||t[3]!==n||t[4]!==i){let e;t[6]!==r||t[7]!==i?(e=e=>(0,Z.jsx)(jE,{group:e,activeId:r,onSelect:i},e.id),t[6]=r,t[7]=i,t[8]=e):e=t[8],s=n.map(e),t[2]=r,t[3]=n,t[4]=i,t[5]=s}else s=t[5];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(AE,{}),t[9]=c):c=t[9];let l;return t[10]!==o||t[11]!==s?(l=(0,Z.jsxs)(`nav`,{"aria-label":o,className:`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:flex-col sm:gap-0 sm:overflow-x-visible sm:overflow-y-auto sm:border-r sm:border-b-0 sm:py-4`,children:[s,c]}),t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function AE(){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=DE(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:wi(`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)(Oa,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function jE(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=wi(`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:wi(`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 ME(){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)(Qi,{className:`h-5 w-32`}),r=(0,Z.jsx)(Qi,{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)(Qi,{className:`h-9 w-full`}),(0,Z.jsx)(Qi,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function NE(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=wi(`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)(OC,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function PE(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)(MC,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function FE(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=wi(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(IC,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function IE(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=wi(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var LE=Ci(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function RE(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=wi(LE({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{"data-slot":`input-group-addon`,"data-align":a,className:o,onMouseDown:zE,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function zE(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Ci(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function BE(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=wi(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function VE(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=wi(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Vc,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function HE(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}=an(),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)(VE,{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)(fd,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(Aa,{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)(Hs,{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)(Ws,{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)(jf,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(Aa,{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)(Hs,{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)(Ws,{children:[V,H]}),t[44]=V,t[45]=U);let W;t[46]!==R||t[47]!==U?(W=(0,Z.jsxs)(RE,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=W):W=t[48];let G;t[49]!==W||t[50]!==N?(G=(0,Z.jsxs)(IE,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,W]}),t[49]=W,t[50]=N,t[51]=G):G=t[51];let K;t[52]===w?K=t[53]:(K=(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]=K);let ee;t[54]===b?ee=t[55]:(ee=b({id:`oqB2ez`}),t[54]=b,t[55]=ee);let te=!S,q;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Jt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=q):q=t[56];let J;t[57]!==g||t[58]!==ee||t[59]!==te?(J=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:te,onClick:g,children:q})}),t[57]=g,t[58]=ee,t[59]=te,t[60]=J):J=t[60];let ne;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`oqB2ez`})}),t[61]=ne):ne=t[61];let re;t[62]===J?re=t[63]:(re=(0,Z.jsxs)(Ws,{children:[J,ne]}),t[62]=J,t[63]=re);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)(Xa,{"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)(Vs,{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)(Hs,{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)(Ws,{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)(cf,{"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)(Vs,{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)(Hs,{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)(Ws,{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)(Vc,{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)(Ws,{children:[(0,Z.jsx)(Vs,{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)(cf,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`bS_boY`})})]}),(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{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)(sf,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Hs,{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)(Cs,{"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)(Vs,{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)(Hs,{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)(Ws,{children:[xe,Se]}),t[108]=xe,t[109]=Ce);let we;return t[110]!==G||t[111]!==K||t[112]!==re||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,G,K,re,le,_e,ve,Ce]}),t[110]=G,t[111]=K,t[112]=re,t[113]=le,t[114]=k,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var UE={current:0,total:0},WE=120,GE=100;function KE(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?pe(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(F,n,qE)}function qE(){return null}function JE(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,`
|
|
26
|
+
`).trim(),mentions:t}}function jw(e){let{instruction:t,mentions:n}=Aw(e);return t===``&&n.length===0}function Mw(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function Nw(e){let t=(0,$.c)(29),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:o,onSubmit:s,className:c,placeholder:l,initialDoc:u}=e,d=(0,Q.useRef)(i),f=(0,Q.useRef)(a),p=(0,Q.useRef)(o),m=(0,Q.useRef)(s),h;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==s?(h=()=>{d.current=i,f.current=a,p.current=o,m.current=s},t[0]=a,t[1]=i,t[2]=o,t[3]=s,t[4]=h):h=t[4],(0,Q.useEffect)(h);let g;t[5]===l?g=t[6]:(g=Dw({placeholder:l}),t[5]=l,t[6]=g);let _=u??void 0,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=wi(`composer-prosemirror py-1 outline-none`),t[7]=v):v=t[7];let y;t[8]===r?y=t[9]:(y={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:v},t[8]=r,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>t.key===`Escape`?yw.getState(e.state)?.active?!1:(e.dom.blur(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?yw.getState(e.state)?.active?!1:(m.current(),!0):!1,t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x={attributes:y,handleKeyDown:b},t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let{editor:t}=e;d.current(jw(t)),f.current?.(t.getJSON()),p.current?.(Aw(t).mentions)},t[13]=S):S=t[13];let C;t[14]!==g||t[15]!==_||t[16]!==x?(C={extensions:g,content:_,immediatelyRender:!0,editorProps:x,onUpdate:S},t[14]=g,t[15]=_,t[16]=x,t[17]=C):C=t[17];let w=D(C),T;t[18]!==w||t[19]!==u?(T=()=>{w&&(jw(w)&&Mw(u)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),fw()),d.current(jw(w)),p.current?.(Aw(w).mentions))},t[18]=w,t[19]=u,t[20]=T):T=t[20];let E;t[21]===w?E=t[22]:(E=[w],t[21]=w,t[22]=E),(0,Q.useEffect)(T,E);let O,k;t[23]===w?(O=t[24],k=t[25]):(O=()=>({focus:()=>w?.commands.focus(),blur:()=>w?.commands.blur(),clear:()=>w?.commands.clearContent(!0),setText:e=>{w&&(w.commands.setContent(e),f.current?.(w.getJSON()),p.current?.(Aw(w).mentions))},getContent:()=>w?Aw(w):{instruction:``,mentions:[]}}),k=[w],t[23]=w,t[24]=O,t[25]=k),(0,Q.useImperativeHandle)(n,O,k);let A;return t[26]!==c||t[27]!==w?(A=(0,Z.jsx)(ee,{editor:w,className:c}),t[26]=c,t[27]=w,t[28]=A):A=t[28],A}function Pw(e,t,n){return e.trim().length>0||t.length>0||n}var Fw=new Set(lo.map(e=>e.id));function Iw(e){return typeof e==`string`&&Fw.has(e)}function Lw(e){try{let t=ab(e);return Iw(t)?t:null}catch{return null}}function Rw(e,t){ob(e,t)}function zw(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:lo.find(e=>n[e.id]?.installed===!0)?.id??null}function Bw(e){let t=(0,$.c)(28),{scenario:n,className:r}=e,{_:i}=an(),{states:a,refresh:o}=So(),{dispatch:s}=Ao(),c=so(),l=Oo(),[u,d]=(0,Q.useState)(Uw),f=(0,Q.useRef)(!1),[p,m]=(0,Q.useState)(null),h=p!==null&&l!==null,g=(0,Q.useRef)(null),[_]=(0,Q.useState)(Hw),[v,y]=(0,Q.useState)(!0),[b,x]=(0,Q.useState)(!1),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(e),e||x(!1)},t[0]=S):S=t[0];let C=S,w=ZC(n),T;t[1]===a?T=t[2]:(T=e=>a[e.id]?.installed===!0,t[1]=a,t[2]=T);let E=lo.filter(T),D;t[3]===a?D=t[4]:(D=lo.every(e=>a[e.id]?.installed!=null),t[3]=a,t[4]=D);let O=D,k=O&&E.length===0,A,j;t[5]!==O||t[6]!==a?(A=()=>{if(!O||f.current)return;let e=zw({lastUsed:Lw(),states:a});d(t=>e===t?t:e)},j=[O,a],t[5]=O,t[6]=a,t[7]=A,t[8]=j):(A=t[7],j=t[8]),(0,Q.useEffect)(A,j);let M=function(e){f.current=!0,m(null),d(e),Rw(e)},N=function(e){f.current=!0,m(e)},P=function(){if(l===null||p===null)return;let{instruction:e,mentions:t}=g.current?.getContent()??{instruction:``,mentions:[]};if(!Pw(e,t,!1)){x(!0);return}let r=_o({workspace:c,description:e,scenario:n,mentions:t});r!==null&&(l.launchInTerminal(r,p),g.current?.clear(),fw())},F=function(e){let{instruction:t,mentions:r}=g.current?.getContent()??{instruction:``,mentions:[]};if(!Pw(t,r,!1)){x(!0);return}Rw(e);let i=_o({workspace:c,description:t,scenario:n,mentions:r});i!==null&&(s(e,i),g.current?.clear(),fw())},I=function(){h?P():u!==null&&F(u)},L=function(e){g.current?.setText(e),g.current?.focus()};if(k){let e;t[9]===r?e=t[10]:(e=wi(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[9]=r,t[10]=e);let n;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(us,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[11]=n):n=t[11];let i;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`3IseAk`})})]}),t[12]=i):i=t[12];let a;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:lo.map(Vw)}),t[13]=a):a=t[13];let o;return t[14]===e?o=t[15]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[14]=e,t[15]=o),o}let R=E.length>0,z=l!==null,B;t[16]===r?B=t[17]:(B=wi(`flex w-full flex-col gap-3`,r),t[16]=r,t[17]=B);let V;t[18]===i?V=t[19]:(V=i({id:`7hctf2`}),t[18]=i,t[19]=V);let H;t[20]===i?H=t[21]:(H=i({id:`0jD-Gn`}),t[20]=i,t[21]=H);let U;t[22]!==v||t[23]!==b?(U=b&&v?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(Y,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[22]=v,t[23]=b,t[24]=U):U=t[24];let W=u===null?(0,Z.jsx)(X,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(Y,{id:`hYgDIe`})}):(0,Z.jsxs)(mw,{children:[(0,Z.jsx)(X,{type:`button`,onClick:()=>h?P():F(u),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:h&&p!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(go,{id:ho(p),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`4rjwLG`,values:{0:Vn[p].displayName}})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(go,{id:u,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`9dw5bW`,values:{0:uo(u)}})]})}),(0,Z.jsxs)(jc,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(xc,{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)(Xa,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(Tc,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(wc,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),Do.map(e=>{let{displayName:t}=Vn[e];return(0,Z.jsxs)(Cc,{onSelect:()=>N(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(go,{id:ho(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),p===e?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,R?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(Ic,{}):null,(0,Z.jsxs)(wc,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),E.map(e=>(0,Z.jsxs)(Cc,{onSelect:()=>M(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(go,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!h&&e.id===u?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]})]})]}),G;return t[25]!==W||t[26]!==U?(G=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[U,W]}),t[25]=W,t[26]=U,t[27]=G):G=t[27],(0,Z.jsxs)(`div`,{className:B,children:[(0,Z.jsxs)(`div`,{className:`flex w-full 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)(Nw,{ref:g,ariaLabel:V,placeholder:H,onEmptyChange:C,onContentChange:dw,onSubmit:I,initialDoc:_,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),G]}),n!==`existing-repo`&&w.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:w.map(e=>{let t=e.icon;return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>L(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)})}):null]})}function Vw(e){return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void oo(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(go,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(Oa,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function Hw(){return uw().doc??void 0}function Uw(){return Lw()}var Ww=3100,Gw=3;function Kw(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Gw;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var qw={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},Jw=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function Yw(e,t={}){let n=t.rng??Math.random,r=t.colors??Jw,i=qw[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var Xw=1.8,Zw=90,Qw=16,$w=380,eT=.025,tT=.1,nT=.18,rT=400,iT=9.2736,aT=18.1799,oT=14.5244,sT={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function cT(e,t){let{halfWidth:n,apexLift:r}=sT[t];return`M${e-n} ${oT+.3} Q${e} ${oT-r}, ${e+n} ${oT+.3}`}function lT(e){let t=1.5,n=.3;return`M${e-t} ${oT-n} Q${e} ${oT+1.4}, ${e+t} ${oT-n}`}var uT=15,dT=15;function fT(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function pT(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=Kw(g,t);_(n),y(_T),S(Yw(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Ww)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(gT),S(Yw(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Ww))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/$w)),C=-Math.max(-1,Math.min(1,b/$w))*Qw,w=S*Qw,T=0,E=0;if(x>=1){let e=Math.min(x/Zw,1)*Xw;T=y/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!m&&D)return;l(),r+=(C-r)*tT,i+=(w-i)*tT,u.style.transform=`perspective(${rT}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*nT,o+=(E-o)*nT;let O=i*eT,k=-r*eT,A=a+O,j=o+k;h.current.x=A,h.current.y=j,p.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=wi(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=wi(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=wi(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:iT,cy:oT,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let ee=(F||T)&&`ok-blob-eye-hidden`,te;t[26]===ee?te=t[27]:(te=wi(`ok-blob-eye ok-blob-eye-right`,ee),t[26]=ee,t[27]=te);let q;t[28]===te?q=t[29]:(q=(0,Z.jsx)(`ellipse`,{cx:aT,cy:oT,rx:1.2722,ry:1.9083,className:te}),t[28]=te,t[29]=q);let J;t[30]===I?J=t[31]:(J=cT(iT,I),t[30]=I,t[31]=J);let ne=(!F||T)&&`ok-blob-eye-hidden`,re;t[32]===ne?re=t[33]:(re=wi(`ok-blob-happy-eye`,ne),t[32]=ne,t[33]=re);let ie;t[34]!==J||t[35]!==re?(ie=(0,Z.jsx)(`path`,{d:J,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:re}),t[34]=J,t[35]=re,t[36]=ie):ie=t[36];let ae;t[37]===I?ae=t[38]:(ae=cT(aT,I),t[37]=I,t[38]=ae);let oe=(!F||T)&&`ok-blob-eye-hidden`,se;t[39]===oe?se=t[40]:(se=wi(`ok-blob-happy-eye`,oe),t[39]=oe,t[40]=se);let ce;t[41]!==ae||t[42]!==se?(ce=(0,Z.jsx)(`path`,{d:ae,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:se}),t[41]=ae,t[42]=se,t[43]=ce):ce=t[43];let le;t[44]===T?le=t[45]:(le=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:lT(iT),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:lT(aT),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=le);let ue;t[46]!==K||t[47]!==q||t[48]!==ie||t[49]!==ce||t[50]!==le?(ue=(0,Z.jsxs)(`g`,{ref:p,children:[K,q,ie,ce,le]}),t[46]=K,t[47]=q,t[48]=ie,t[49]=ce,t[50]=le,t[51]=ue):ue=t[51];let de;t[52]!==B||t[53]!==H||t[54]!==ue?(de=(0,Z.jsxs)(`g`,{className:H,children:[U,ue]},B),t[52]=B,t[53]=H,t[54]=ue,t[55]=de):de=t[55];let fe;t[56]===T?fe=t[57]:(fe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=fe);let pe;t[58]!==v||t[59]!==x?(pe=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(mT)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=pe):pe=t[60];let me;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==de||t[65]!==fe||t[66]!==pe?(me=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:hT,children:[de,fe,pe]}),t[61]=D,t[62]=s,t[63]=z,t[64]=de,t[65]=fe,t[66]=pe,t[67]=me):me=t[67];let he;return t[68]!==R||t[69]!==me?(he=(0,Z.jsx)(`span`,{ref:d,className:R,children:me}),t[68]=R,t[69]=me,t[70]=he):he=t[70],he}function mT(e){return(0,Z.jsx)(`circle`,{cx:uT+e.originDx,cy:dT+e.originDy,r:e.size,className:`ok-blob-firework`,style:fT(e)},e.id)}function hT(e){return e.preventDefault()}function gT(e){return e+1}function _T(e){return e+1}function vT(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(pT,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function yT({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 bT=`open-knowledge:create-top-level-file`;function xT(e={}){window.dispatchEvent(new CustomEvent(bT,{detail:e}))}function ST(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(bT,t),()=>window.removeEventListener(bT,t)}function CT(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=an(),a=bo(),{title:o,subtitle:s}=yT({isOnboarding:!1,isEmbedded:a}),c=pa(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p=vT,m=i(o),h=i(s),_;t[3]!==p||t[4]!==n||t[5]!==m||t[6]!==h?(_=(0,Z.jsx)(p,{title:m,subtitle:h,celebrateSignal:n}),t[3]=p,t[4]=n,t[5]=m,t[6]=h,t[7]=_):_=t[7];let v;t[8]===a?v=t[9]:(v=a?(0,Z.jsx)(QC,{scenario:`existing-repo`}):(0,Z.jsx)(Bw,{scenario:`existing-repo`}),t[8]=a,t[9]=v);let y;t[10]!==u||t[11]!==f||t[12]!==d?(y=d||f||u.length>0?(0,Z.jsx)(ET,{templates:u,loading:d,error:f,onSelect:TT}):null,t[10]=u,t[11]=f,t[12]=d,t[13]=y):y=t[13];let b,x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`size-3`}),x=(0,Z.jsx)(Y,{id:`IajAbS`}),t[14]=b,t[15]=x):(b=t[14],x=t[15]);let S;t[16]===r?S=t[17]:(S=(0,Z.jsxs)(X,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[b,x]}),t[16]=r,t[17]=S);let C;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(X,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:wT,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(g,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=C):C=t[18];let w;t[19]===S?w=t[20]:(w=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[S,C]}),t[19]=S,t[20]=w);let T;t[21]!==w||t[22]!==y?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[y,w]}),t[21]=w,t[22]=y,t[23]=T):T=t[23];let E;return t[24]!==T||t[25]!==_||t[26]!==v?(E=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[_,v,T]}),t[24]=T,t[25]=_,t[26]=v,t[27]=E):E=t[27],E}function wT(){return xT({initialDir:``})}function TT(e,t){return xT({template:{folder:e,name:t}})}function ET(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=an(),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)(ge,{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)(DT,{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 DT(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=an(),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 OT(e){let t=(0,$.c)(20),{terminalVisible:n}=e,r=n===void 0?!1:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let{ok:t,body:n}=await $a();if(e)return;let r=t?Hn.safeParse(n):null;r?.success?(l(jT(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=ks(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(p.current)}},h=[],t[0]=m,t[1]=h):(m=t[0],h=t[1]),(0,Q.useEffect)(m,h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){clearTimeout(p.current),p.current=setTimeout(()=>d(AT),500),$a().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=Hn.safeParse(n);r.success&&l(jT(r.data.documents))}).catch(kT)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r){let e;t[4]!==u||t[5]!==y||t[6]!==v?(e=v?(0,Z.jsx)(MT,{isOnboarding:y,celebrateSignal:u}):null,t[4]=u,t[5]=y,t[6]=v,t[7]=e):e=t[7];let n;return t[8]===e?n=t[9]:(n=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-end px-6 sm:px-12 md:px-16 pb-8 pt-10`,children:e}),t[8]=e,t[9]=n),n}let S;t[10]!==u||t[11]!==y||t[12]!==v?(S=v?y?(0,Z.jsx)(NT,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(CT,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[10]=u,t[11]=y,t[12]=v,t[13]=S):S=t[13];let C;t[14]!==o||t[15]!==i?(C=(0,Z.jsx)(Jv,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[14]=o,t[15]=i,t[16]=C):C=t[16];let w;return t[17]!==S||t[18]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6 sm:px-12 md:px-16 subtle-scrollbar`,children:[S,C]}),t[17]=S,t[18]=C,t[19]=w):w=t[19],w}function kT(){}function AT(e){return e+1}function jT(e){return rl(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function MT(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=an(),a=bo(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=yT({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=vT,s=i(e),c=i(r),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l}else o=t[3],s=t[4],c=t[5],l=t[6];let u;t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:r}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function NT(e){let t=(0,$.c)(28),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=an(),a=bo(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=yT({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=vT,s=i(e),c=i(n),t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l}else o=t[2],s=t[3],c=t[4],l=t[5];let u;t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:n}),t[6]=o,t[7]=n,t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;t[11]===a?d=t[12]:(d=a?(0,Z.jsx)(QC,{scenario:`new-project`}):(0,Z.jsx)(Bw,{scenario:`new-project`}),t[11]=a,t[12]=d);let f;t[13]!==i||t[14]!==a?(f=i(a?{id:`GubkSu`}:{id:`xeXS4P`}),t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(FT,{label:f}),t[16]=f,t[17]=p);let m;t[18]===r?m=t[19]:(m=(0,Z.jsx)(Vv,{onPackSelect:r,onCreateBlankFile:PT}),t[18]=r,t[19]=m);let h;t[20]!==p||t[21]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[p,m]}),t[20]=p,t[21]=m,t[22]=h):h=t[22];let g;return t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==h?(g=(0,Z.jsxs)(`div`,{className:l,children:[u,d,h]}),t[23]=l,t[24]=u,t[25]=d,t[26]=h,t[27]=g):g=t[27],g}function PT(){return xT()}function FT(e){let t=(0,$.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n})}),t[0]=n,t[1]=r),r}function IT(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function LT(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=an(),[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)(zT,{}),(0,Z.jsx)(Qi,{className:`h-7 w-full`}),(0,Z.jsx)(Qi,{className:`h-7 w-full`}),(0,Z.jsx)(Qi,{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=IT(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 Xo(n,{[e]:t});if(!r.ok){let{error:e}=r;Ss.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 Xo(n,{[e]:null});if(!t.ok){let{error:e}=t;Ss.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,Va(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):Ia[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(_r(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 Xo(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 Xo(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},t[32]=a,t[33]=n,t[34]=i,t[35]=p,t[36]=u,t[37]=R):R=t[37];let z=R,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){d(null)},t[38]=B):B=t[38];let V=B,H=!o,U;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>s(!e),t[39]=U):U=t[39];let W=`size-3 transition-transform ${o?``:`rotate-90`}`,G;t[40]===W?G=t[41]:(G=(0,Z.jsx)(Qa,{className:W,"aria-hidden":!0}),t[40]=W,t[41]=G);let K;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`vQIVHc`})}),t[42]=K):K=t[42];let ee;t[43]===G?ee=t[44]:(ee=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[G,K]}),t[43]=G,t[44]=ee);let te;t[45]===h?te=t[46]:(te=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:RT,children:h}),t[45]=h,t[46]=te);let q;t[47]!==ee||t[48]!==te?(q=(0,Z.jsxs)(cs,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[ee,te]}),t[47]=ee,t[48]=te,t[49]=q):q=t[49];let J;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hSBIG-`})}),t[50]=J):J=t[50];let ne;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(ne=_.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)(za,{keyName:e,value:t,declared:Pa(t,ur(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]=ne):ne=t[59];let re;t[60]!==c||t[61]!==N?(re=c?(0,Z.jsx)(La,{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)(Lt,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=re):re=t[62];let ie;t[63]!==ne||t[64]!==re?(ie=(0,Z.jsx)(ss,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[J,ne,re]})}),t[63]=ne,t[64]=re,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)(ls,{open:H,onOpenChange:U,children:[q,ie]})}),t[66]=H,t[67]=q,t[68]=ie,t[69]=ae):ae=t[69],ae}function RT(e){return e.stopPropagation()}function zT(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(kd,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function BT(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?Ms._({id:`xOTzt5`}):t<3600?Ms._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?Ms._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?Ms._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function VT(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function HT(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:ia,label:Ms._({id:`QR5SP1`}),detail:VT(i)};case`template-edit`:return{Icon:Wo,label:Ms._({id:`-LHLx7`}),detail:VT(i)};case`template-delete`:return{Icon:Ro,label:Ms._({id:`_gkGSK`}),detail:VT(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:id,label:Ms._({id:`KPW5WC`}),detail:`${VT(e??``)} → ${VT(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:kd,label:Ms._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:kd,label:Ms._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:kd,label:Ms._({id:`ZQLDTl`}),detail:``};default:return{Icon:Id,label:r.replace(/-/g,` `),detail:VT(i)}}}function UT(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?Ms._({id:`B2DrPb`}):e.author||Ms._({id:`Ef7StM`})}function WT(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=Es(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)(ge,{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)(Qi,{className:`h-8 w-full`}),(0,Z.jsx)(Qi,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(GT)})}),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 GT(e){let{Icon:t,label:n,detail:r}=HT(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)(Af,{className:`size-3`,"aria-hidden":!0}),UT(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:BT(e.timestamp)})]},e.sha)}function KT(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function qT(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=KT(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function JT(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function YT(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:qT(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:JT(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:qT(e,t.pageTitles),children:a}}function XT(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)(Qi,{className:`h-12 w-full`}),(0,Z.jsx)(Qi,{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)(ge,{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)(Lt,{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)(Da,{template:e,onCreate:()=>l(e.name),onEdit:()=>ns(V(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(Na,{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)(Oi,{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(ZT)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),ns(V(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)(Ui,{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)(wv,{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 ZT(e){return e.name}function QT(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=wi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=wi(`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 $T(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=wi(`[&_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 eE(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=wi(`[&_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 tE(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=wi(`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 nE(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=wi(`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 rE(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=wi(`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 iE(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Ms._({id:`xOTzt5`});if(r<60)return Ms._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Ms._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Ms._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function aE(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 oE(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)(y,{className:`ml-1 size-3`}):(0,Z.jsx)(rt,{className:`ml-1 size-3`}):(0,Z.jsx)(ad,{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 sE(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=an(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=to(),l=ya(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)(Qi,{className:`size-5 rounded`}),(0,Z.jsx)(Qi,{className:`h-7 w-48`})]}),(0,Z.jsx)(Qi,{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)(Qi,{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)(Qi,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(uE)]})]}),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=YT(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=aE(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?_(lE):(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)(Io,{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)(Lt,{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)(LT,{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)(XT,{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)(WT,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=QT;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)(oE,{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)(nE,{"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)(oE,{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)(nE,{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)($T,{children:(0,Z.jsxs)(tE,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=eE,b=a.length?a.map(cE):(0,Z.jsx)(tE,{children:(0,Z.jsx)(rE,{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)(wv,{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 cE(e){return(0,Z.jsxs)(tE,{children:[(0,Z.jsx)(rE,{children:(0,Z.jsxs)(`a`,{href:Jc(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(jd,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(dt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(rE,{className:`text-muted-foreground`,children:e.kind===`file`?iE(e.modified):`—`})]},e.path)}function lE(e){return e===`asc`?`desc`:`asc`}function uE(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)(Qi,{className:`size-4 rounded`}),(0,Z.jsx)(Qi,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Qi,{className:`h-4 w-16`})})]},e)}function dE(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l,u;t[0]===o?(l=t[1],u=t[2]):(l=()=>{o?s.current?.focus():c.current?.focus()},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Ed,{className:`size-9`,"aria-hidden":`true`})}),t[3]=d):d=t[3];let f=o?void 0:-1,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Y,{id:`P3hnm0`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsx)(`h2`,{ref:c,id:`large-file-title`,tabIndex:f,className:`text-2xl font-light text-balance outline-none`,children:p}),t[5]=f,t[6]=m);let h;t[7]===r?h=t[8]:(h=Er(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=Er(i),t[9]=i,t[10]=g);let _;t[11]!==n||t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`GJH-AT`,values:{0:h,1:g,docName:n}})}),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==o?(y=o?(0,Z.jsxs)(X,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(B,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=y):y=t[20];let b;return t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[d,v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function fE(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(pE),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>f(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(){L(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 pE(){return new Set}function mE(e){let t=(0,$.c)(24),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=bi(r).body;s=D,i=bt,a=!1,o=Pt().parseWithFallback(e),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={attributes:{class:`pt-4 pb-4`}},t[5]=c):c=t[5];let l;t[6]!==i||t[7]!==a||t[8]!==o?(l={extensions:i,editable:a,content:o,editorProps:c},t[6]=i,t[7]=a,t[8]=o,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=[r],t[10]=r,t[11]=u);let d=s(l,u),[f]=(0,Q.useState)(hE),p=(0,Q.useRef)(null),m,h;t[12]===f?(m=t[13],h=t[14]):(m=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},h=[f],t[12]=f,t[13]=m,t[14]=h),(0,Q.useLayoutEffect)(m,h);let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}})})}),t[15]=g):g=t[15];let _;t[16]===d?_=t[17]:(_=(0,Z.jsx)(ee,{editor:d,className:`tiptap-editor-portal-content h-full`}),t[16]=d,t[17]=_);let v;t[18]!==f||t[19]!==_?(v=(0,ld.createPortal)(_,f),t[18]=f,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==n||t[22]!==v?(y=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:[g,v]}),t[21]=n,t[22]=v,t[23]=y):y=t[23],y}function hE(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var gE=`data-skill-markdown`;function _E(e){let t=(0,$.c)(12),{scope:n,name:r,path:i,fileName:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==n?(o={loadText:e=>Ac({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=VC(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)(HC,{fileName:a,dataAttr:gE}),t[4]=a,t[5]=e),e}if(s.status===`error`){let e;return t[6]!==s.message||t[7]!==a?(e=(0,Z.jsx)(UC,{fileName:a,dataAttr:gE,message:s.message}),t[6]=s.message,t[7]=a,t[8]=e):e=t[8],e}let c;return t[9]!==s.content||t[10]!==a?(c=(0,Z.jsx)(mE,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var vE=new Set([`md`,`mdx`]);function yE(e){let t=(0,$.c)(19),{scope:n,name:r,path:i}=e,a;t[0]===i?a=t[1]:(a=i.split(`/`).pop()??i,t[0]=i,t[1]=a);let o=a,s=o.lastIndexOf(`.`),c,l;if(t[2]!==s||t[3]!==o?(c=s>=0?o.slice(s+1).toLowerCase():``,l=vE.has(c),t[2]=s,t[3]=o,t[4]=c,t[5]=l):(c=t[4],l=t[5]),l){let e;return t[6]!==o||t[7]!==r||t[8]!==i||t[9]!==n?(e=(0,Z.jsx)(_E,{scope:n,name:r,path:i,fileName:o}),t[6]=o,t[7]=r,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}let u;t[11]!==r||t[12]!==i||t[13]!==n?(u=e=>Ac({scope:n,name:r,path:i},e),t[11]=r,t[12]=i,t[13]=n,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==o||t[17]!==u?(d=(0,Z.jsx)(KC,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function bE(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var xE=bE(()=>n(()=>import(`./SettingsDialogBody-cotnwVMw.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([68,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,69,8,70,21,18,19,71,33,72,65,24,47,73]),import.meta.url));function SE(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=an(),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:CE,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 CE(){return window.location.reload()}function wE(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(h,{fallbackRender:EE,onError:TE,children:n}),t[0]=n,t[1]=r),r}function TE(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function EE(e){return(0,Z.jsx)(SE,{...e})}function DE(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function OE(e){let t=(0,$.c)(94),{open:n,onOpenChange:r}=e,{_:i}=an(),{collabUrl:a}=pt(),{userBinding:o,userSynced:s,okignoreBinding:c,okignoreSynced:l}=Bo(),{desktopPresent:u}=Hi(),[d,f]=(0,Q.useState)(`preferences`),p,m;t[0]===n?(p=t[1],m=t[2]):(p=()=>{n&&f(`preferences`)},m=[n],t[0]=n,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=a!==null,g=typeof window<`u`&&window.okDesktop!=null,_;t[3]===i?_=t[4]:(_=i({id:`7PzzBU`}),t[3]=i,t[4]=_);let v;t[5]===i?v=t[6]:(v=i({id:`Q6hhn8`}),t[5]=i,t[6]=v);let y;t[7]===v?y=t[8]:(y={id:`preferences`,label:v},t[7]=v,t[8]=y);let b;t[9]===i?b=t[10]:(b=i({id:`4KmEoC`}),t[9]=i,t[10]=b);let x;t[11]===b?x=t[12]:(x={id:`hotkeys`,label:b},t[11]=b,t[12]=x);let S;t[13]===i?S=t[14]:(S=i({id:`AeXO77`}),t[13]=i,t[14]=S);let C;t[15]===S?C=t[16]:(C={id:`account`,label:S},t[15]=S,t[16]=C);let w;t[17]!==y||t[18]!==x||t[19]!==C?(w=[y,x,C],t[17]=y,t[18]=x,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==_?(T={id:`user`,label:_,enabled:!0,items:w},t[21]=w,t[22]=_,t[23]=T):T=t[23];let E;t[24]===i?E=t[25]:(E=i({id:`ZWyHmq`}),t[24]=i,t[25]=E);let D;t[26]===i?D=t[27]:(D=i({id:`Nu4DdT`}),t[26]=i,t[27]=D);let O;t[28]===D?O=t[29]:(O={id:`sync`,label:D},t[28]=D,t[29]=O);let k;t[30]===i?k=t[31]:(k=i({id:`A1taO8`}),t[30]=i,t[31]=k);let A;t[32]===k?A=t[33]:(A={id:`search`,label:k},t[32]=k,t[33]=A);let j;t[34]===i?j=t[35]:(j=g?[{id:`terminal`,label:i({id:`ALhMYW`})}]:[],t[34]=i,t[35]=j);let M;t[36]===i?M=t[37]:(M=i({id:`iTylMl`}),t[36]=i,t[37]=M);let N;t[38]===M?N=t[39]:(N={id:`project-templates`,label:M},t[38]=M,t[39]=N);let P;t[40]===i?P=t[41]:(P=i({id:`PCSkw2`}),t[40]=i,t[41]=P);let F;t[42]===P?F=t[43]:(F={id:`skills`,label:P},t[42]=P,t[43]=F);let I;t[44]===i?I=t[45]:(I=i({id:`3zyg_A`}),t[44]=i,t[45]=I);let L;t[46]===I?L=t[47]:(L={id:`okignore`,label:I},t[46]=I,t[47]=L);let R;t[48]===i?R=t[49]:(R=i({id:`cs4mps`}),t[48]=i,t[49]=R);let z;t[50]===R?z=t[51]:(z={id:`sharing`,label:R},t[50]=R,t[51]=z);let B;t[52]!==O||t[53]!==A||t[54]!==j||t[55]!==N||t[56]!==F||t[57]!==L||t[58]!==z?(B=[O,A,...j,N,F,L,z],t[52]=O,t[53]=A,t[54]=j,t[55]=N,t[56]=F,t[57]=L,t[58]=z,t[59]=B):B=t[59];let V;t[60]!==h||t[61]!==E||t[62]!==B?(V={id:`project`,label:E,enabled:h,items:B},t[60]=h,t[61]=E,t[62]=B,t[63]=V):V=t[63];let H;t[64]===i?H=t[65]:(H=i({id:`nbfdhU`}),t[64]=i,t[65]=H);let U;t[66]!==i||t[67]!==u?(U=[],t[66]=i,t[67]=u,t[68]=U):U=t[68];let W;t[69]!==H||t[70]!==U?(W={id:`integrations`,label:H,enabled:!0,items:U},t[69]=H,t[70]=U,t[71]=W):W=t[71];let G;t[72]!==T||t[73]!==V||t[74]!==W?(G=[T,V,W],t[72]=T,t[73]=V,t[74]=W,t[75]=G):G=t[75];let K=G,ee;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Wa,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})}),t[76]=ee):ee=t[76];let te;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Ua,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`RDrXh4`})}),t[77]=te):te=t[77];let q;t[78]!==d||t[79]!==K?(q=(0,Z.jsx)(kE,{groups:K,activeId:d,onSelect:f}),t[78]=d,t[79]=K,t[80]=q):q=t[80];let J;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(ME,{}),t[81]=J):J=t[81];let ne=s?o:null,re;t[82]!==d||t[83]!==c||t[84]!==l||t[85]!==ne?(re=(0,Z.jsx)(`section`,{"aria-labelledby":`settings-dialog-title`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:(0,Z.jsx)(wE,{children:(0,Z.jsx)(Q.Suspense,{fallback:J,children:(0,Z.jsx)(xE,{activeId:d,userBinding:ne,okignoreBinding:c,okignoreSynced:l})})})}),t[82]=d,t[83]=c,t[84]=l,t[85]=ne,t[86]=re):re=t[86];let ie;t[87]!==q||t[88]!==re?(ie=(0,Z.jsxs)(Ga,{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:[ee,te,q,re]}),t[87]=q,t[88]=re,t[89]=ie):ie=t[89];let ae;return t[90]!==r||t[91]!==n||t[92]!==ie?(ae=(0,Z.jsx)(Ya,{open:n,onOpenChange:r,children:ie}),t[90]=r,t[91]=n,t[92]=ie,t[93]=ae):ae=t[93],ae}function kE(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:i}=e,{_:a}=an(),o;t[0]===a?o=t[1]:(o=a({id:`y1t8bQ`}),t[0]=a,t[1]=o);let s;if(t[2]!==r||t[3]!==n||t[4]!==i){let e;t[6]!==r||t[7]!==i?(e=e=>(0,Z.jsx)(jE,{group:e,activeId:r,onSelect:i},e.id),t[6]=r,t[7]=i,t[8]=e):e=t[8],s=n.map(e),t[2]=r,t[3]=n,t[4]=i,t[5]=s}else s=t[5];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(AE,{}),t[9]=c):c=t[9];let l;return t[10]!==o||t[11]!==s?(l=(0,Z.jsxs)(`nav`,{"aria-label":o,className:`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:flex-col sm:gap-0 sm:overflow-x-visible sm:overflow-y-auto sm:border-r sm:border-b-0 sm:py-4`,children:[s,c]}),t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function AE(){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=DE(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:wi(`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)(Oa,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function jE(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=wi(`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:wi(`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 ME(){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)(Qi,{className:`h-5 w-32`}),r=(0,Z.jsx)(Qi,{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)(Qi,{className:`h-9 w-full`}),(0,Z.jsx)(Qi,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function NE(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=wi(`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)(OC,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function PE(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)(MC,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function FE(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=wi(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(IC,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function IE(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=wi(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var LE=Ci(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function RE(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=wi(LE({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{"data-slot":`input-group-addon`,"data-align":a,className:o,onMouseDown:zE,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function zE(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Ci(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function BE(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=wi(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function VE(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=wi(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Vc,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function HE(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}=an(),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)(VE,{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)(fd,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(Aa,{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)(Hs,{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)(Ws,{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)(jf,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(Aa,{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)(Hs,{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)(Ws,{children:[V,H]}),t[44]=V,t[45]=U);let W;t[46]!==R||t[47]!==U?(W=(0,Z.jsxs)(RE,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=W):W=t[48];let G;t[49]!==W||t[50]!==N?(G=(0,Z.jsxs)(IE,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,W]}),t[49]=W,t[50]=N,t[51]=G):G=t[51];let K;t[52]===w?K=t[53]:(K=(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]=K);let ee;t[54]===b?ee=t[55]:(ee=b({id:`oqB2ez`}),t[54]=b,t[55]=ee);let te=!S,q;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Jt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=q):q=t[56];let J;t[57]!==g||t[58]!==ee||t[59]!==te?(J=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:te,onClick:g,children:q})}),t[57]=g,t[58]=ee,t[59]=te,t[60]=J):J=t[60];let ne;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`oqB2ez`})}),t[61]=ne):ne=t[61];let re;t[62]===J?re=t[63]:(re=(0,Z.jsxs)(Ws,{children:[J,ne]}),t[62]=J,t[63]=re);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)(Xa,{"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)(Vs,{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)(Hs,{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)(Ws,{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)(cf,{"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)(Vs,{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)(Hs,{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)(Ws,{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)(Vc,{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)(Ws,{children:[(0,Z.jsx)(Vs,{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)(cf,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`bS_boY`})})]}),(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{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)(sf,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Hs,{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)(Cs,{"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)(Vs,{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)(Hs,{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)(Ws,{children:[xe,Se]}),t[108]=xe,t[109]=Ce);let we;return t[110]!==G||t[111]!==K||t[112]!==re||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,G,K,re,le,_e,ve,Ce]}),t[110]=G,t[111]=K,t[112]=re,t[113]=le,t[114]=k,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var UE={current:0,total:0},WE=120,GE=100;function KE(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?pe(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(F,n,qE)}function qE(){return null}function JE(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,`
|
|
27
27
|
`,`
|
|
28
28
|
`).trim();return i.length===0||i.length>WE||i.includes(`
|
|
29
29
|
`)?null:i}function YE(e){let t=Ke(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function XE(e,t){return e.current===t.current&&e.total===t.total}function ZE(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(UE)}function QE(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=de(e);if(!t)return;let n=t.dom.querySelector(`.ok-find-match-active`);n instanceof HTMLElement&&n.scrollIntoView({block:`center`,inline:`nearest`,behavior:`auto`})})}function $E(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=KE(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)(UE),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(tD))},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(eD)},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(UE);return}if(!u.open||r){i.commands.clearFindMatches(),p(UE);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=YE(i);p(t=>XE(t,e)?t:e)},GE);return()=>window.clearTimeout(e)},T=[i,u.open,u.query,u.caseSensitive,u.wholeWord,r],t[17]=i,t[18]=u.caseSensitive,t[19]=u.open,t[20]=u.query,t[21]=u.wholeWord,t[22]=r,t[23]=w,t[24]=T):(w=t[23],T=t[24]),(0,Q.useEffect)(w,T);let E,D;t[25]!==i||t[26]!==u.open||t[27]!==r?(E=()=>{if(!i||i.isDestroyed||!u.open||r)return;let e=()=>{let e=Ke(i.state),t=YE(i);p(e=>XE(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=JE(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(El(t,`find`)){t.preventDefault(),u.open?ZE(i,d,p):e(!1);return}if(El(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=El(t,`find-next`),n=El(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&QE(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),ZE(i,d,p))}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},k=[n,i,u.open,r],t[30]=n,t[31]=i,t[32]=u.open,t[33]=r,t[34]=O,t[35]=k):(O=t[34],k=t[35]),(0,Q.useEffect)(O,k);let A;t[36]!==i||t[37]!==u.caseSensitive||t[38]!==u.query||t[39]!==u.wholeWord?(A=function(){return!i||i.isDestroyed?!1:(i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current}),!0)},t[36]=i,t[37]=u.caseSensitive,t[38]=u.query,t[39]=u.wholeWord,t[40]=A):A=t[40];let j=A,M;t[41]===i?M=t[42]:(M=function(){if(!i||i.isDestroyed)return;let e=Ke(i.state),t=YE(i);p(e=>XE(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(){ZE(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()&&QE(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()&&QE(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)&&QE(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)&&QE(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,K,ee,te;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),ee=e=>d(t=>({...t,caseSensitive:e})),te=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=ee,t[67]=te):(W=t[63],G=t[64],K=t[65],ee=t[66],te=t[67]);let q;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(q=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(HE,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:ee,onWholeWordChange:te,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=q):q=t[80],q}function eD(e){return{...e,open:!1,activeIndex:0}}function tD(e){return{...e,activeIndex:0}}var nD=300;function rD(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Yl),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Yl);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i($l(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,nD)};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 iD(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function aD(e){let t=(0,$.c)(8),{poolEntries:n}=pt(),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=()=>iD(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(iD(i));let t=()=>s(iD(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 oD(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>ru(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(iu,r)}var sD=`ok-doc-panel-width-v1`;function cD(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function lD(e){try{let t=(e??localStorage).getItem(sD);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?cD(n):320}catch{return 320}}function uD(e,t){try{(t??localStorage).setItem(sD,String(cD(e)))}catch{}}function dD(){try{return typeof localStorage>`u`?320:lD()}catch{return 320}}var fD=1024,pD=1280,mD={left:fD,right:pD};function hD(e,t,n){return e==null?t>=mD[n]?`above`:`below`:`embedded`}function gD(e){return e===`above`?`open`:`collapsed`}var _D=`ok-sidebar-pins-v2`;function vD(e){return e===`open`||e===`collapsed`}function yD(e){return e===`above`||e===`below`||e===`embedded`}function bD(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!yD(e)||!vD(t[e]))return!1;return!0}function xD(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return bD(n.left)&&(r.left=n.left),bD(n.right)&&(r.right=n.right),r}function SD(e){try{let t=(e??localStorage).getItem(_D);return t==null?{}:xD(t)}catch{return{}}}function CD(e,t){try{t.setItem(_D,JSON.stringify(e))}catch{}}function wD(e,t,n){return n[e]?.[t]??gD(t)}function TD(e,t,n,r){let i=r??localStorage,a=SD(i);return a[e]={...a[e],[t]:n},CD(a,i),a}var ED=`ok-terminal-width-v1`;function DD(e){return Number.isFinite(e)?e<320?320:e>900?900:Math.round(e):480}function OD(e){try{let t=(e??localStorage).getItem(ED);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?DD(n):480}catch{return 480}}function kD(e,t){try{(t??localStorage).setItem(ED,String(DD(e)))}catch{}}function AD(){try{return typeof localStorage>`u`?480:OD()}catch{return 480}}function jD(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(`connecting`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(`connecting`);return}let t=e.configuration.websocketProvider.status;e.isSynced?r(`synced`):r(t===`connected`?`connected`:t===`disconnected`?`disconnected`:`connecting`);let n=e=>{let{status:t}=e;r(t===`connected`?MD:t===`disconnected`?`disconnected`:`connecting`)},i=e=>{let{state:t}=e;r(t?`synced`:`connected`)},a=()=>r(`disconnected`);return e.on(`status`,n),e.on(`synced`,i),e.on(`disconnect`,a),()=>{e.off(`status`,n),e.off(`synced`,i),e.off(`disconnect`,a)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function MD(e){return e===`synced`?`synced`:`connected`}function ND(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function PD(e){let t=(0,$.c)(21),{path:n,onRemove:r}=e,{_:i}=an(),a,o;t[0]!==i||t[1]!==n?(a=ND(n),o=i({id:`hnq8fP`,values:{label:a}}),t[0]=i,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s=o,c=`composer-context-chip-file-${n}`,l;t[4]===r?l=t[5]:(l=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),r())},t[4]=r,t[5]=l);let u;t[6]===n?u=t[7]:(u=(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 inline-flex size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,children:(0,Z.jsx)(Bt,{path:n,className:`size-3`})}),t[6]=n,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Cs,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0}),t[8]=d):d=t[8];let f;t[9]!==r||t[10]!==s||t[11]!==l||t[12]!==u?(f=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s,onClick:r,onKeyDown:l,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[u,d]}),t[9]=r,t[10]=s,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===a?p=t[15]:(p=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:a}),t[14]=a,t[15]=p);let m;return t[16]!==n||t[17]!==c||t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`span`,{"data-testid":c,title:n,className:`group/chip inline-flex max-w-[14rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[f,p]}),t[16]=n,t[17]=c,t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function FD(e){let t=(0,$.c)(11),{files:n,onRemoveFile:r,className:i,children:a}=e;if(n.length===0&&a==null)return null;let o;t[0]===i?o=t[1]:(o=wi(`flex flex-wrap items-center gap-1`,i),t[0]=i,t[1]=o);let s;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,Z.jsx)(PD,{path:e,onRemove:()=>r(e)},e),t[5]=r,t[6]=e),s=n.map(e),t[2]=n,t[3]=r,t[4]=s}else s=t[4];let c;return t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsxs)(`div`,{className:o,"data-testid":`composer-context-chips`,children:[s,a]}),t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function ID(e){let t=(0,$.c)(35),{primary:n,onPrimary:r,primaryDisabled:i,installedTargets:a,selectedTargetId:o,onSelectTarget:s,terminal:c,terminals:l,menuEmptyState:u,onMenuOpenChange:d,menuAlign:f,triggerAriaLabel:p,testIds:m}=e,h=i===void 0?!1:i,g=f===void 0?`end`:f,{_}=an(),v=a.length>0,y=l&&l.length>0?l:null,b=y!=null||c!=null,x=v||b,S;t[0]===m?S=t[1]:(S=e=>typeof m.terminal==`function`?m.terminal(e):m.terminal,t[0]=m,t[1]=S);let C=S,w;t[2]!==r||t[3]!==n||t[4]!==h||t[5]!==m.primary?(w=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:h,onClick:r,"data-testid":m.primary,children:n}),t[2]=r,t[3]=n,t[4]=h,t[5]=m.primary,t[6]=w):w=t[6];let T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Xa,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=T):T=t[7];let E;t[8]!==m.trigger||t[9]!==p?(E=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon`,"aria-label":p,"data-testid":m.trigger,children:T})}),t[8]=m.trigger,t[9]=p,t[10]=E):E=t[10];let D;t[11]!==_||t[12]!==y||t[13]!==x||t[14]!==a||t[15]!==u||t[16]!==s||t[17]!==o||t[18]!==v||t[19]!==b||t[20]!==c||t[21]!==C||t[22]!==m?(D=x?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsxs)(wc,{"aria-label":_({id:`ALhMYW`}),children:[(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),y?y.map(e=>(0,Z.jsxs)(Cc,{onSelect:e.onSelect,"data-testid":C(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(go,{id:ho(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):c?(0,Z.jsxs)(Cc,{onSelect:c.onSelect,"data-testid":C(`claude`),"aria-label":_({id:`AcK_r0`}),children:[(0,Z.jsx)(go,{id:ho(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`fcgvCA`})}),c.selected?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,v?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsx)(Ic,{}):null,(0,Z.jsxs)(wc,{"aria-label":_({id:`BBqGS9`}),children:[(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(Cc,{onSelect:()=>s(e),"data-testid":m.option(e.id),children:[(0,Z.jsx)(go,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),o===e.id?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):u,t[11]=_,t[12]=y,t[13]=x,t[14]=a,t[15]=u,t[16]=s,t[17]=o,t[18]=v,t[19]=b,t[20]=c,t[21]=C,t[22]=m,t[23]=D):D=t[23];let O;t[24]!==g||t[25]!==D||t[26]!==m.menu?(O=(0,Z.jsx)(Tc,{align:g,className:`min-w-[200px]`,"data-testid":m.menu,children:D}),t[24]=g,t[25]=D,t[26]=m.menu,t[27]=O):O=t[27];let k;t[28]!==d||t[29]!==E||t[30]!==O?(k=(0,Z.jsxs)(jc,{onOpenChange:d,children:[E,O]}),t[28]=d,t[29]=E,t[30]=O,t[31]=k):k=t[31];let A;return t[32]!==w||t[33]!==k?(A=(0,Z.jsxs)(mw,{children:[w,k]}),t[32]=w,t[33]=k,t[34]=A):A=t[34],A}function LD(e){return rl(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function RD(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=Hn.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return LD(n.data.documents)}async function zD(e=ag){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await RD()>=1&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function BD(e=ag){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var VD=5200,HD=500;function UD(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function WD(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(GD),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`);n(e.matches);let t=e=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function GD(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function KD(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),VD);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(qD),o(!0)},HD);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 qD(e){return e+1}function JD(e){let t=(0,$.c)(153),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=an(),u=i!==void 0,d=u?null:n??null,f=r??`wysiwyg`,p=WD(),m=so(),{states:h}=So(),{dispatch:g}=Ao(),_=Oo(),[v]=(0,Q.useState)(aO),[y,b]=(0,Q.useState)(null),x=Jy(),[S,C]=(0,Q.useState)(!0),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),[O]=(0,Q.useState)(iO),k,A;t[0]!==c||t[1]!==n||t[2]!==u||t[3]!==r?(k=()=>{if(u||n==null)return;let e=document.documentElement,t=nO,i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{let e=pe(n),t=D.current;if(!(!e||e.isDestroyed||!t))try{let n=e.view,r=n.coordsAtPos(e.state.selection.head).bottom-(t.getBoundingClientRect().top-28);if(r<=0)return;let i=n.dom.closest(`.editor-doc-scroll`);i instanceof HTMLElement&&(i.scrollTop+=r)}catch{}})},a=D.current;if(c||!a){t(),e.style.removeProperty(`--ask-composer-height`);return}let o=()=>{t(),e.style.setProperty(`--ask-composer-height`,`${a.offsetHeight+56}px`)};o(),i();let s=new ResizeObserver(o);return s.observe(a),()=>{s.disconnect(),t(),e.style.removeProperty(`--ask-composer-height`)}},A=[c,r,n,u],t[0]=c,t[1]=n,t[2]=u,t[3]=r,t[4]=k,t[5]=A):(k=t[4],A=t[5]),(0,Q.useEffect)(k,A);let j=(0,Q.useRef)(c),M=(0,Q.useRef)(s),N;t[6]!==c||t[7]!==s?(N=()=>{j.current=c,M.current=s},t[6]=c,t[7]=s,t[8]=N):N=t[8],(0,Q.useEffect)(N);let P,F;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>eu(()=>{j.current?M.current?.():E.current?.focus()}),F=[],t[9]=P,t[10]=F):(P=t[9],F=t[10]),(0,Q.useEffect)(P,F);let I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=[],t[11]=I):I=t[11],(0,Q.useEffect)(eO,I);let L=(0,Q.useRef)(c),R,z;t[12]===c?(R=t[13],z=t[14]):(R=()=>{let e=L.current;L.current=c,e&&!c&&E.current?.focus()},z=[c],t[12]=c,t[13]=R,t[14]=z),(0,Q.useEffect)(R,z);let B;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(B=[],t[15]=B):B=t[15];let[V,H]=(0,Q.useState)(B),[U,W]=(0,Q.useState)($D),G;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(G=[],t[16]=G):G=t[16];let[K,ee]=(0,Q.useState)(G),te;t[17]!==n||t[18]!==u?(te=u||n==null?``:fo(n),t[17]=n,t[18]=u,t[19]=te):te=t[19];let q=te,J,ne;t[20]!==q||t[21]!==U||t[22]!==u||t[23]!==S?(J=()=>{u||S||H(e=>e.includes(q)||U.has(q)?e:[...e,q])},ne=[u,S,q,U],t[20]=q,t[21]=U,t[22]=u,t[23]=S,t[24]=J,t[25]=ne):(J=t[24],ne=t[25]),(0,Q.useEffect)(J,ne);let re;t[26]!==U||t[27]!==u||t[28]!==i||t[29]!==K||t[30]!==V?(re=u?i&&!U.has(i)&&!K.includes(i)?[i]:[]:V.filter(e=>!U.has(e)&&!K.includes(e)),t[26]=U,t[27]=u,t[28]=i,t[29]=K,t[30]=V,t[31]=re):re=t[31];let ie=re,ae=Ra(d,f),oe=Ra(d,`frontmatter`),[se,ce]=(0,Q.useState)(null),[le,ue]=(0,Q.useState)(!1),de,fe;t[32]===ae?(de=t[33],fe=t[34]):(de=()=>{ae&&ce(ae)},fe=[ae],t[32]=ae,t[33]=de,t[34]=fe),(0,Q.useEffect)(de,fe);let me,he;t[35]===oe?(me=t[36],he=t[37]):(me=()=>{oe&&ce(oe)},he=[oe],t[35]=oe,t[36]=me,t[37]=he),(0,Q.useEffect)(me,he);let ge=y??v,_e;t[38]!==ge||t[39]!==_?(_e=_===null?null:rb(ge),t[38]=ge,t[39]=_,t[40]=_e):_e=t[40];let ve=_e,ye;t[41]!==ge||t[42]!==x||t[43]!==_?(ye=_!==null&&ge===null?cb(null,x):null,t[41]=ge,t[42]=x,t[43]=_,t[44]=ye):ye=t[44];let be=ve??ye,xe=be!==null,Se;t[45]!==ge||t[46]!==xe||t[47]!==h?(Se=xe?null:sb(h,ge),t[45]=ge,t[46]=xe,t[47]=h,t[48]=Se):Se=t[48];let Ce=Se,we=!w&&(!S||se!==null)&&(xe||Ce!==null),Te;t[49]===h?Te=t[50]:(Te=lo.filter(e=>h[e.id]?.installed===!0),t[49]=h,t[50]=Te);let Ee=Te,De;t[51]===h?De=t[52]:(De=lo.some(e=>h[e.id]?.installed==null),t[51]=h,t[52]=De);let Oe=De,ke=_===null?void 0:vi.map(e=>{let{displayName:t}=Vn[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:be===e,onSelect:()=>Re(e)}}),Ae;t[53]===l?Ae=t[54]:(Ae=l({id:`KYSocE`}),t[53]=l,t[54]=Ae);let je;t[55]===l?je=t[56]:(je=l({id:`7Ongq0`}),t[55]=l,t[56]=je);let Me;t[57]===l?Me=t[58]:(Me=l({id:`HPTPGr`}),t[57]=l,t[58]=Me);let Ne;t[59]===l?Ne=t[60]:(Ne=l({id:`qiRoLb`}),t[59]=l,t[60]=Ne);let Pe;t[61]!==Ae||t[62]!==je||t[63]!==Me||t[64]!==Ne?(Pe=[Ae,je,Me,Ne],t[61]=Ae,t[62]=je,t[63]=Me,t[64]=Ne,t[65]=Pe):Pe=t[65];let Fe=KD(Pe,!p&&S&&!c),Ie;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>{b(e.id),ob(e.id)},t[66]=Ie):Ie=t[66];let Le=Ie,Re=e=>{let t=nb(e);b(t),ob(t)},ze;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>{E.current?.clear(),ce(null),ue(!1),H([]),W(new Set),fw()},t[67]=ze):ze=t[67];let Be=ze,Ve;t[68]!==l||t[69]!==g||t[70]!==Ce||t[71]!==be||t[72]!==_?(Ve=e=>{if(e===null){Ss.error(l({id:`y8B54M`}));return}if(be!==null&&_!==null){try{_.launchInTerminal(e,be)}catch{Ss.error(l({id:`jBVUXo`}));return}BD(),Be();return}Ce!==null&&(T(!0),g(Ce.id,e).then(QD).finally(()=>{T(!1),Be()}))},t[68]=l,t[69]=g,t[70]=Ce,t[71]=be,t[72]=_,t[73]=Ve):Ve=t[73];let He=Ve,Ue;t[74]!==q||t[75]!==we||t[76]!==He||t[77]!==n||t[78]!==ie||t[79]!==u||t[80]!==i||t[81]!==se||t[82]!==m?(Ue=()=>{if(!we)return;let{instruction:e,mentions:t}=E.current?.getContent()??{instruction:``,mentions:[]};if(u){He(vo({docName:null,folderRelativePath:i,workspace:m,instruction:e,mentions:[...new Set([...ie,...t])].filter(e=>e!==i)}));return}let r=se?cu(se):void 0,a=se?.docName??null,o=se?a:ie.includes(q)?n??null:null,s=o===null?null:fo(o);He(vo({docName:o,workspace:m,instruction:e,mentions:[...new Set([...ie,...t])].filter(e=>e!==s),selection:r}))},t[74]=q,t[75]=we,t[76]=He,t[77]=n,t[78]=ie,t[79]=u,t[80]=i,t[81]=se,t[82]=m,t[83]=Ue):Ue=t[83];let We=Ue;if(c)return null;let Ge=``,Ke=``;if(se){let e;t[84]===se?e=t[85]:(e=lu(se,fo(se.docName).split(`/`).pop()??``),t[84]=se,t[85]=e),Ge=e;let n;t[86]===se.markdown?n=t[87]:(n=uu(se.markdown),t[86]=se.markdown,t[87]=n),Ke=n}let qe;t[88]!==l||t[89]!==u||t[90]!==o?(qe=u?null:(0,Z.jsx)(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)(Xa,{className:`size-3.5`,"aria-hidden":!0})}),t[88]=l,t[89]=u,t[90]=o,t[91]=qe):qe=t[91];let Je;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Je=e=>W(t=>{let n=new Set(t);return n.add(e),n}),t[92]=Je):Je=t[92];let Ye;t[93]!==l||t[94]!==Ge||t[95]!==Ke||t[96]!==se||t[97]!==le?(Ye=se?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:Ge,className:`group/chip inline-flex max-w-[16rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l({id:`irrm_E`}),onClick:()=>{ce(null),ue(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(Ef,{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)(Cs,{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":le,"aria-label":l(le?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>ue(ZD),"data-testid":`composer-selection-peek`,className:`h-auto min-h-0 min-w-0 shrink justify-start px-0 py-0 text-left font-normal text-muted-foreground text-xs hover:bg-transparent hover:text-foreground`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:Ge})})]}),le&&Ke!==``?(0,Z.jsx)(`p`,{className:`max-h-24 w-full basis-full overflow-y-auto whitespace-pre-wrap text-2xs text-muted-foreground/80 subtle-scrollbar`,"data-testid":`composer-selection-preview`,children:Ke}):null]}):null,t[93]=l,t[94]=Ge,t[95]=Ke,t[96]=se,t[97]=le,t[98]=Ye):Ye=t[98];let Xe;t[99]!==ie||t[100]!==Ye?(Xe=(0,Z.jsx)(FD,{files:ie,onRemoveFile:Je,children:Ye}),t[99]=ie,t[100]=Ye,t[101]=Xe):Xe=t[101];let Ze;t[102]===l?Ze=t[103]:(Ze=l({id:`xWEvuo`}),t[102]=l,t[103]=Ze);let Qe;t[104]!==O||t[105]!==We||t[106]!==Ze?(Qe=(0,Z.jsx)(Nw,{ref:E,ariaLabel:Ze,onEmptyChange:C,onContentChange:dw,onMentionsChange:ee,onSubmit:We,initialDoc:O,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),t[104]=O,t[105]=We,t[106]=Ze,t[107]=Qe):Qe=t[107];let $e;t[108]!==S||t[109]!==p||t[110]!==Fe?($e=S?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:wi(`pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm`,!p&&`transition-opacity duration-500 ease-in-out`,Fe.visible?`opacity-100`:`opacity-0`),children:Fe.text}):null,t[108]=S,t[109]=p,t[110]=Fe,t[111]=$e):$e=t[111];let et;t[112]!==Qe||t[113]!==$e?(et=(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[Qe,$e]}),t[112]=Qe,t[113]=$e,t[114]=et):et=t[114];let tt;t[115]!==Ce||t[116]!==be?(tt=be===null?Ce?(0,Z.jsx)(go,{id:Ce.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(go,{id:ho(be),className:`size-4`,"aria-hidden":!0}),t[115]=Ce,t[116]=be,t[117]=tt):tt=t[117];let nt;t[118]!==Ce||t[119]!==be?(nt=(0,Z.jsx)(`span`,{children:be===null?Ce?(0,Z.jsx)(Y,{id:`nUNZL4`,values:{0:Ce.displayName}}):(0,Z.jsx)(Y,{id:`F-vBv0`}):(0,Z.jsx)(Y,{id:`ti6aF_`,values:{0:Vn[be].displayName}})}),t[118]=Ce,t[119]=be,t[120]=nt):nt=t[120];let rt;t[121]===w?rt=t[122]:(rt=w?(0,Z.jsx)(Fo,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[121]=w,t[122]=rt);let it;t[123]!==tt||t[124]!==nt||t[125]!==rt?(it=(0,Z.jsxs)(Z.Fragment,{children:[tt,nt,rt]}),t[123]=tt,t[124]=nt,t[125]=rt,t[126]=it):it=t[126];let at=!we,ot=xe?null:Ce?.id??null,st;t[127]===Oe?st=t[128]:(st=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:Oe?(0,Z.jsx)(Y,{id:`EcR0fl`}):(0,Z.jsx)(Y,{id:`l6OXqI`})}),t[127]=Oe,t[128]=st);let ct;t[129]===l?ct=t[130]:(ct=l({id:`nskygk`}),t[129]=l,t[130]=ct);let lt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(lt={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:XD,terminal:YD},t[131]=lt):lt=t[131];let ut;t[132]!==ke||t[133]!==Le||t[134]!==Ee||t[135]!==We||t[136]!==it||t[137]!==at||t[138]!==ot||t[139]!==st||t[140]!==ct?(ut=(0,Z.jsx)(ID,{primary:it,onPrimary:We,primaryDisabled:at,installedTargets:Ee,selectedTargetId:ot,onSelectTarget:Le,terminals:ke,menuEmptyState:st,triggerAriaLabel:ct,testIds:lt}),t[132]=ke,t[133]=Le,t[134]=Ee,t[135]=We,t[136]=it,t[137]=at,t[138]=ot,t[139]=st,t[140]=ct,t[141]=ut):ut=t[141];let dt;t[142]!==et||t[143]!==ut?(dt=(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[et,ut]}),t[142]=et,t[143]=ut,t[144]=dt):dt=t[144];let ft;t[145]!==qe||t[146]!==Xe||t[147]!==dt?(ft=(0,Z.jsxs)(`div`,{ref:D,className:`pointer-events-auto group relative flex flex-col gap-1.5 rounded-2xl border border-border/60 bg-card px-3 py-2 shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[qe,Xe,dt]}),t[145]=qe,t[146]=Xe,t[147]=dt,t[148]=ft):ft=t[148];let pt=ft;if(u){let e;return t[149]===pt?e=t[150]:(e=(0,Z.jsx)(`div`,{className:`shrink-0 pt-2 pb-3`,"data-testid":`bottom-composer`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-6`,children:pt})}),t[149]=pt,t[150]=e),e}let mt;return t[151]===pt?mt=t[152]:(mt=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-[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:pt}),t[151]=pt,t[152]=mt),mt}function YD(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function XD(e){return`ask-ai-agent-option-${e}`}function ZD(e){return!e}function QD(e){e.ok&&BD()}function $D(){return new Set}function eO(){let e=tO;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function tO(e){El(e,`open-ask-ai`)&&(UD(e.target)||(e.preventDefault(),au()))}function nO(){let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(rO);if(e.length===0)return;let t=!1,n=()=>{t=!0};window.addEventListener(`wheel`,n,{passive:!0}),window.addEventListener(`touchstart`,n,{passive:!0});let r=performance.now(),i=()=>{if(t||performance.now()-r>=300){window.removeEventListener(`wheel`,n),window.removeEventListener(`touchstart`,n);return}for(let t of e)t.scrollTop=t.scrollHeight-t.clientHeight;requestAnimationFrame(i)};requestAnimationFrame(i)}function rO(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function iO(){return uw().doc??void 0}function aO(){return ab()}function oO(e){return!e.terminalVisible&&!e.isEmbedded&&e.activeDocName!==null}function sO(e){return!e.terminalVisible&&!e.isEmbedded}function cO(e,t={}){let n=we(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var lO=200,uO=`Outside any block`;function dO(e){let t=(0,$.c)(5),{editor:n}=e,r=Qt(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?fO(n,r):o.current?uO:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},lO),()=>{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 fO(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=cO(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=cO(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}function pO(){let[e]=(0,Q.useState)(fr);return e}function mO({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:mi(e.display_name),color:Cr(e.id,Kn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Cr(e.id,Kn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function hO(e,t){return e>t}function gO(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 _O=3,vO=6e4;function yO(e,t){let n=0;for(let r of e)t-r<vO&&(n+=1);return n<_O}var bO=new Map;function xO(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 SO(e){let t=qt.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function CO(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=qt.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){vl.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=>{hO(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!hO(i,a)||l!==null&&SO(l.state))return;o=!0;let e=Date.now();for(let[t,n]of bO)n.every(t=>e-t>=vO)&&bO.delete(t);let t=(bO.get(n)??[]).filter(t=>e-t<vO);if(!yO(t,e)){bO.set(n,t),vl.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),bO.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,vl.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==qt&&xO(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new Rr({state:{init:()=>null,apply:e=>(gO(e.getMeta(qt))&&(a=i,o&&vl.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!hO(i,a)||SO(t)?!0:e.getMeta(qt)!==void 0,view:e=>{let r=t.doc;return r==null?(vl.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 wO(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 TO=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&&ui(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(tc(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Zs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push($s(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Qs(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ys(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ec(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ks(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(qs(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=si(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Pr){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof Yn){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():wO(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Xs(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()}},EO=e=>new Rr({key:typeof e.pluginKey==`string`?new ri(e.pluginKey):e.pluginKey,view:t=>new TO({view:t,...e})});vr.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[EO({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 DO=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return Sr(e,{textSerializers:Tr(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(tc(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Zs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push($s(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Qs(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ys(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ec(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ks(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(qs(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=si(this.view,e.from,e.to);Xs({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()}},OO=e=>new Rr({key:typeof e.pluginKey==`string`?new ri(e.pluginKey):e.pluginKey,view:t=>new DO({view:t,...e})});vr.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?[OO({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 kO(e,t){return e??new ri(t)}var AO=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,jO=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),MO=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),NO=new Set([`children`,`className`,`style`]),PO=new Set([`tabIndex`]),FO=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),IO={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function LO(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function RO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function zO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||FO.has(e)}function BO(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function VO(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:IO[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function HO(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 UO(e){return PO.has(e)}function WO(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function GO(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 KO(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||MO.has(e)?String(t):`${t}px`}function qO(e,t){jO.has(t)||e.style.removeProperty(BO(t))}function JO(e,t,n){jO.has(t)||e.style.setProperty(BO(t),KO(t,n))}function YO(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(NO.has(r)||!zO(r)||LO(r,t[r])||LO(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=RO(r);if(a==null||a===!1){UO(r)&&GO(e,r),e.removeAttribute(o);return}if(a===!0){UO(r)&&WO(e,r,!0),e.setAttribute(o,``);return}if(UO(r)){WO(e,r,a);return}e.setAttribute(o,String(a))})}function XO(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function ZO(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){qO(e,t);return}JO(e,t,a)}})}function QO(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(!LO(t,n))return;let{eventName:i,options:a}=VO(t),o=t=>{n(HO(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function $O(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);AO(()=>{let i=n.current;return XO(e,i.className,t.className),ZO(e,i.style,t.style),YO(e,i,t),r.current=QO(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 ek=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)(kO(e,`bubbleMenu`)).current;$O(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=le(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,Q.useRef)(h);g.current=h;let[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=EO({...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,ld.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)(kO(e,`floatingMenu`)).current;$O(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=le(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,Q.useRef)(m);h.current=m;let[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=OO({...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,ld.createPortal)(s,u.current)});var tk=[{name:`paragraph`,label:`Text`,icon:nf,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Pe,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Vt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:st,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:kt,isActive:e=>e.isActive(`list`,{ordered:!1})&&!e.isActive(`listItem`,{checked:!0})&&!e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleBulletList().run()},{name:`orderedList`,label:`Ordered List`,icon:Ce,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:$e,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:Le,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:mf,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function nk(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:rk},t[0]=n,t[1]=r);let{current:i,activeStates:a}=oe(r),o=i.icon,s;t[2]===o?s=t[3]:(s=(0,Z.jsx)(o,{className:`size-3.5`}),t[2]=o,t[3]=s);let c;t[4]===i.label?c=t[5]:(c=(0,Z.jsx)(`span`,{children:i.label}),t[4]=i.label,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Xa,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(xc,{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:[s,c,l]})}),t[7]=s,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n?(d=tk.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Cc,{className:r?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Z.jsx)(t,{className:`size-4`}),(0,Z.jsx)(`span`,{children:e.label})]},e.name)}),t[10]=a,t[11]=n,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,Z.jsx)(Tc,{align:`start`,sideOffset:8,className:`w-44 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto subtle-scrollbar`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==u||t[16]!==f?(p=(0,Z.jsxs)(jc,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function rk(e){let t=Object.fromEntries(tk.map(t=>[t.name,t.isActive(e.editor)]));return{current:tk.find(e=>t[e.name])??tk[0],activeStates:t}}var ik=`open-knowledge:active-terminal-input`;function ak(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(ik,{detail:e}))}function ok(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;typeof n==`string`&&e(n)};return t.addEventListener(ik,n),()=>t.removeEventListener(ik,n)}function sk(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function ck(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r;if(bo())return null;let a;return t[0]!==n||t[1]!==i?(a=(0,Z.jsx)(lk,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}function lk(e){let t=(0,$.c)(11),{editor:n,shortcutEnabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Lr(),t[0]=i):i=t[0];let a=i,o,s;t[1]===r?(o=t[2],s=t[3]):(o=()=>{if(!a)return;let e=e=>{r&&El(e,`edit-with-ai`)&&(sk(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),au()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},s=[r,a],t[1]=r,t[2]=o,t[3]=s),(0,Q.useEffect)(o,s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[4]=c):c=t[4];let l;t[5]===n?l=t[6]:(l=()=>{let e=ft(n),t=pu(n);requestAnimationFrame(()=>{if(e===null||t.trim()===``){au();return}ak($r({relativePath:fo(e),instruction:``,selectionMarkdown:t,target:`claude-code`}))})},t[5]=n,t[6]=l);let u,d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(us,{className:`size-3.5`,"aria-hidden":`true`}),d=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`xWEvuo`})}),t[7]=u,t[8]=d):(u=t[7],d=t[8]);let f;return t[9]===l?f=t[10]:(f=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,onClick:l,children:[u,d]})]}),t[9]=l,t[10]=f),f}function uk(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 dk(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:ct(typeof n.src==`string`?n.src:``)}function fk(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 pk(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=an(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:mk},t[0]=n,t[1]=i),oe(i)===null)return null;let a;t[2]===r?a=t[3]:(a=r({id:`WcWS__`}),t[2]=r,t[3]=a);let o;t[4]===n?o=t[5]:(o=e=>{e.preventDefault();let t=uk(n);t&&fk(t,dk(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(wa,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(Vs,{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)(Hs,{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)(Ws,{children:[c,l]})}),t[11]=c,t[12]=u),u}function mk(e){return uk(e.editor)}function hk(e){return uk(e)!==null}function gk(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function _k(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 vk(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function yk(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=an(),i;t[0]===n?i=t[1]:(i={editor:n,selector:bk},t[0]=n,t[1]=i);let a=oe(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!gk(n)||n.state.selection.empty||vk(n)||_k(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=di(wr(n.state.doc)),o=Vr(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(o,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=a,t[3]=n,t[4]=o):o=t[4];let s=o,c;t[5]===r?c=t[6]:(c=r({id:`sIGbBZ`}),t[5]=r,t[6]=c);let l;t[7]===s?l=t[8]:(l=e=>{e.preventDefault(),s()},t[7]=s,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(W,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==c||t[12]!==l?(d=(0,Z.jsx)(Vs,{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)(Hs,{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)(Ws,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function bk(e){let t=e.editor;return!!(!gk(t)||t.state.selection.empty||vk(t)||_k(t))}var xk=`img, .ok-embed, .ok-video`,Sk=220,Ck=`cubic-bezier(0.23, 1, 0.32, 1)`,wk=`ok-image-align-flip`,Tk=.5;function Ek(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Dk(){return typeof requestAnimationFrame==`function`}function Ok(e){return e?e.querySelector(xk):null}function kk(e,t){if(Ek()||!Dk()){t();return}let n=Ok(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=Ok(e);if(!t)return;for(let e of t.getAnimations())e.id===wk&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<Tk)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:Sk,easing:Ck,fill:`none`});i.id=wk})}var Ak=[{value:`left`,label:`Align left`,icon:Tf},{value:`center`,label:`Align center`,icon:Cf},{value:`right`,label:`Align right`,icon:wf}];function jk(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Ut.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function Mk(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Nk},t[0]=n,t[1]=r);let i=oe(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=Ak.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(!Ut.has(a)||i.attrs.kind!==`element`)return;let o=a===`CommonMarkImage`,s=r.from,c={...i.attrs.props??{},align:t},l=o?{...i.attrs,componentName:`img`,props:c,sourceDirty:!0}:{...i.attrs,props:c,sourceDirty:!0},u=n.state.tr.setNodeMarkup(s,null,l);u.setSelection(Pr.create(u.doc,s)),kk(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:r})]},t)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function Nk(e){return jk(e.editor)}function Pk(e){return jk(e)!==null}var Fk=[{name:`bold`,icon:sd,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:Ld,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Of,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:bf,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:Ee,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Fd,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function Ik(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Lk},t[0]=n,t[1]=r);let i=oe(r),a;t[2]!==i||t[3]!==n?(a=Fk.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{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)(Hs,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(wt,{"aria-label":Dl(e.shortcutId),children:Tl(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 Lk(e){return Object.fromEntries(Fk.map(t=>[t.name,t.isActive(e.editor)]))}function Rk(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=an(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),c=(0,Q.useRef)(null),{folderPaths:l,loading:u,pages:d}=to(),f;t[0]===n?f=t[1]:(f=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=n.getAttributes(`link`).href??``,t[2]=n,t[3]=m);let h=m,g;t[4]===n?g=t[5]:(g=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=g);let _=g,v,y;t[6]===n?(v=t[7],y=t[8]):(v=()=>{let e=function(){n.state.selection.empty&&a(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},y=[n],t[6]=n,t[7]=v,t[8]=y),(0,Q.useEffect)(v,y);let b,x;t[9]===i?(b=t[10],x=t[11]):(b=()=>{i&&requestAnimationFrame(()=>c.current?.focus())},x=[i],t[9]=i,t[10]=b,t[11]=x),(0,Q.useEffect)(b,x);let S;t[12]!==n||t[13]!==p||t[14]!==o?(S=function(){o.trim()?n.chain().focus().setLink({href:o.trim()}).run():p&&n.chain().focus().unsetLink().run(),a(!1)},t[12]=n,t[13]=p,t[14]=o,t[15]=S):S=t[15];let C=S,w;t[16]===n?w=t[17]:(w=function(){n.chain().focus().unsetLink().run(),a(!1)},t[16]=n,t[17]=w);let T=w,E;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){s(K(e.path,null))},t[18]=E):E=t[18];let D=E,O;t[19]!==C||t[20]!==n?(O=function(e){e.key===`Enter`&&(e.preventDefault(),C()),e.key===`Escape`&&(e.preventDefault(),a(!1),n.chain().focus().run())},t[19]=C,t[20]=n,t[21]=O):O=t[21];let k=O;if(i){let e;t[22]===r?e=t[23]:(e=r({id:`ZsGpr_`}),t[22]=r,t[23]=e);let n;t[24]===r?n=t[25]:(n=r({id:`roAe2K`}),t[24]=r,t[25]=n);let i;t[26]!==l||t[27]!==k||t[28]!==u||t[29]!==d||t[30]!==e||t[31]!==n||t[32]!==o?(i=(0,Z.jsx)(nt,{ref:c,type:`text`,placeholder:e,value:o,pages:d,folderPaths:l,loading:u,onValueChange:s,onSuggestionSelect:D,onKeyDown:k,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[26]=l,t[27]=k,t[28]=u,t[29]=d,t[30]=e,t[31]=n,t[32]=o,t[33]=i):i=t[33];let a;t[34]===r?a=t[35]:(a=r({id:`tP5DDk`}),t[34]=r,t[35]=a);let f;t[36]===C?f=t[37]:(f=()=>{C()},t[36]=C,t[37]=f);let m;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(bd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=m):m=t[38];let g;t[39]!==a||t[40]!==f?(g=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:f,children:m}),t[39]=a,t[40]=f,t[41]=g):g=t[41];let _;t[42]!==i||t[43]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[i,g]}),t[42]=i,t[43]=g,t[44]=_):_=t[44];let v;t[45]!==r||t[46]!==h||t[47]!==p||t[48]!==T?(v=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),tn(h)},children:(0,Z.jsx)(Oa,{className:`size-3.5`})})}),(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),T()},children:(0,Z.jsx)(Ro,{className:`size-3.5`})})}),(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`484LKL`})})]})]}),t[45]=r,t[46]=h,t[47]=p,t[48]=T,t[49]=v):v=t[49];let y;return t[50]!==_||t[51]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[_,v]}),t[50]=_,t[51]=v,t[52]=y):y=t[52],y}let A;t[53]===r?A=t[54]:(A=r({id:`p0Iq25`}),t[53]=r,t[54]=A);let j=p?`bg-accent text-primary`:`text-accent-foreground`,M;t[55]===_?M=t[56]:(M=e=>{e.preventDefault(),s(_()),a(!0)},t[55]=_,t[56]=M);let N;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(zd,{className:`size-3.5`}),t[57]=N):N=t[57];let P;t[58]!==A||t[59]!==j||t[60]!==M?(P=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":A,className:j,onMouseDown:M,children:N})}),t[58]=A,t[59]=j,t[60]=M,t[61]=P):P=t[61];let F;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Y,{id:`yzF66j`}),t[62]=F):F=t[62];let I;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsxs)(Hs,{side:`bottom`,sideOffset:8,children:[F,(0,Z.jsx)(wt,{children:Tl(`command-palette`)})]}),t[63]=I):I=t[63];let L;return t[64]===P?L=t[65]:(L=(0,Z.jsxs)(Ws,{children:[P,I]}),t[64]=P,t[65]=L),L}function zk({editor:e}){if(Ke(e.state).query||e.isActive(`codeBlock`))return!1;if(Pk(e)||hk(e))return!0;if(e.state.selection.empty)return!1;let{from:t,to:n}=e.state.selection;return!!e.state.doc.textBetween(t,n,` `).trim()}function Bk(e){let t=(0,$.c)(23),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:Gk},t[0]=n,t[1]=l);let u=oe(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:Wk},t[2]=n,t[3]=d);let f=oe(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return si(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=p):p=t[6];let m;if(t[7]!==n.view.dom||t[8]!==p){let e={getBoundingClientRect:p,contextElement:n.view.dom};m=()=>{let t=a.current;t&&(c.current?.(),c.current=Gs(e,t,()=>{Xs(e,t,{placement:`top`,strategy:`fixed`,middleware:[$s(8),tc(),Zs({padding:8})]}).then(e=>{let{x:n,y:r}=e;t.isConnected&&(t.style.position=`fixed`,t.style.left=`${n}px`,t.style.top=`${r}px`)}).catch(Uk)}))},t[7]=n.view.dom,t[8]=p,t[9]=m}else m=t[9];let h=m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{c.current?.(),c.current=null,s(Hk)},t[10]=g):g=t[10];let _=g,v;t[11]===h?v=t[12]:(v={onShow:h,onHide:_,strategy:`fixed`},t[11]=h,t[12]=v);let y;t[13]!==n||t[14]!==f||t[15]!==u||t[16]!==i||t[17]!==o?(y=u?(0,Z.jsx)(Mk,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(pk,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(nk,{editor:n}),(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(Ik,{editor:n},o),(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(Rk,{editor:n},`${o}-link`),(0,Z.jsx)(yk,{editor:n},`${o}-footnote`),(0,Z.jsx)(ck,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),t[13]=n,t[14]=f,t[15]=u,t[16]=i,t[17]=o,t[18]=y):y=t[18];let b;return t[19]!==n||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(ek,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:Vk,shouldShow:zk,updateDelay:250,options:v,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:y}),t[19]=n,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function Vk(){return document.body}function Hk(e){return e+1}function Uk(){}function Wk(e){return hk(e.editor)}function Gk(e){return Pk(e.editor)}var Kk=56,qk=`0 2px 4px rgba(0, 0, 0, 0.08)`,Jk=150,Yk=globalThis.ScrollTimeline;function Xk(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+Kk);return{startOffset:o,endOffset:o+a,maxShift:a}}var Zk=new WeakMap;function Qk(e){let t=Zk.get(e);if(t){for(let e of t.animations)e.cancel();Zk.delete(e)}}function $k(e){for(let t of Array.from(e.cells))Qk(t)}var eA=e=>e.cellIndex===0?`3`:`2`;function tA(e,t){return nA(e,t,e=>({transform:`translateY(${e}px)`}))}function nA(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 rA(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 iA(e,t,n){return rA(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:qk})}function aA(e,t){return rA(e,t,{opacity:`0`},{opacity:`1`})}function oA(e,t,n,r){let i=eA(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=Zk.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(tA(n,r),s),l=e.animate(iA(n,r,i),s),u=e.animate(aA(n,r),{...s,pseudoElement:`::before`});Zk.set(e,{key:a,animations:[c,l,u]})}function sA(e,t){let n=eA(e),r=`in|${t}|${n}`,i=Zk.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:qk}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});Zk.set(e,{key:r,animations:[a,o]})}function cA(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=Xk(a,i,c.top,c.height,l.height);if(!u){$k(s);continue}if(n){if(o<=0){$k(s);continue}for(let e of Array.from(s.cells))oA(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+Kk){$k(s);continue}for(let e of Array.from(s.cells))sA(e,d)}}var lA=vr.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new Rr({key:new ri(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||cA(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()},Jk);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&Yk)try{n=new Yk({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`))$k(t)}}}})]}});function uA(e,t){return(n,r)=>{let i=r,a=_u(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function dA(e,t){let n=hu(e);t(n.target,{tabBehavior:`append`}),Yc(n.hash)}function fA(e){return[...e?[{label:`Toggle header column`,icon:vd,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:B,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:g,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:Ro,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Md,run:e=>e.chain().focus().deleteTable().run()}]}function pA(e){return[...e?[{label:`Toggle header row`,icon:xf,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:y,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:rt,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:Ro,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Md,run:e=>e.chain().focus().deleteTable().run()}]}function mA(e){if(!e.isEditable||Ke(e.state).query)return null;let{state:t,view:n}=e,r=t.selection.$from,i=-1;for(let e=r.depth;e>0;e--){let t=r.node(e).type.spec.tableRole;if(t===`cell`||t===`header_cell`){i=r.before(e);break}}if(i<0)return null;let a=n.nodeDOM(i);if(!(a instanceof HTMLTableCellElement))return null;let o=a.closest(`table`),s=a.closest(`tr`),c=a.closest(`.ProseMirror`);if(!o||!s||!c)return null;let l=Array.prototype.indexOf.call(o.rows,s),u=a.cellIndex,d=o.rows[0]?.cells[u],f=o.rows[l]?.cells[0];return!d||!f?null:{columnAnchor:d,rowAnchor:f,isFirstColumn:u===0,isFirstRow:l===0}}function hA(e){let t=(0,$.c)(22),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),s,c;t[0]!==r||t[1]!==i?(s=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return Gs(r,e,()=>{Xs(r,e,{strategy:`absolute`,placement:t,middleware:[$s(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(gA)})},c=[r,i],t[0]=r,t[1]=i,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l=i===`column`?Sd:Yi,u=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`,d=i===`column`?`Column options`:`Row options`,f;t[4]===l?f=t[5]:(f=(0,Z.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),t[4]=l,t[5]=f);let p;t[6]!==u||t[7]!==d||t[8]!==f?(p=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(X,{variant:`secondary`,className:u,"aria-label":d,children:f})}),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m=i===`column`?`center`:`start`,h=i===`column`?`bottom`:`right`,g;if(t[10]!==n||t[11]!==a){let e;t[13]===n?e=t[14]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(Ic,{}),(0,Z.jsxs)(Cc,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[13]=n,t[14]=e),g=a.map(e),t[10]=n,t[11]=a,t[12]=g}else g=t[12];let _;t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Z.jsx)(Tc,{align:m,side:h,className:`w-auto min-w-44 whitespace-nowrap`,children:g}),t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==_||t[20]!==p?(v=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(jc,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function gA(){}function _A(e){let t=(0,$.c)(18),{editor:n}=e,[r,i]=(0,Q.useState)(null),a,o;if(t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=()=>i(e=>{let t=mA(n);return e&&t&&e.columnAnchor===t.columnAnchor&&e.rowAnchor===t.rowAnchor?e:t});return e(),n.on(`selectionUpdate`,e),n.on(`update`,e),()=>{n.off(`selectionUpdate`,e),n.off(`update`,e)}},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),!r)return null;let s=r.columnAnchor,c;t[3]===r.isFirstColumn?c=t[4]:(c=fA(r.isFirstColumn),t[3]=r.isFirstColumn,t[4]=c);let l;t[5]!==r.columnAnchor||t[6]!==n||t[7]!==c?(l=(0,Z.jsx)(hA,{editor:n,anchor:s,axis:`column`,items:c}),t[5]=r.columnAnchor,t[6]=n,t[7]=c,t[8]=l):l=t[8];let u=r.rowAnchor,d;t[9]===r.isFirstRow?d=t[10]:(d=pA(r.isFirstRow),t[9]=r.isFirstRow,t[10]=d);let f;t[11]!==r.rowAnchor||t[12]!==n||t[13]!==d?(f=(0,Z.jsx)(hA,{editor:n,anchor:u,axis:`row`,items:d}),t[11]=r.rowAnchor,t[12]=n,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Z.jsxs)(`div`,{className:`ok-table-cell-handle-layer`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function vA(e){let{fragment:t,docName:n}=e,r=!1,i=!1,a=!1,o=()=>{r=!0},s=e=>{console.warn(`[walk-currency] ${e} at view init — stale pre-warm cannot be invalidated: a remote edit that landed in the construct→mount gap will not render, and the first local transaction may silently erase it from the CRDT for every peer and disk (vendored y-tiptap contract change? re-verify y-tiptap.cjs:263-268)`)},c=()=>{i&&(i=!1,t.unobserveDeep(o))},l=e=>{let t=qt.getState(e.state)?.binding;if(!t){vl.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){vl.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}vl.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return vr.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new Rr({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var yA=new WeakMap;function bA(e){let t=document.createElement(`span`);t.classList.add(`collaboration-cursor__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-cursor__label`),n.style.backgroundColor=e.color,n.style.color=fi(e.color),n.textContent=e.name,t.append(n),t}var xA={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},SA=100,CA=100,wA=3,TA=250;function EA(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function DA(e,t){let n=de(e);if(!n||t.contains(n.dom))return!1;if(!EA(e))return console.warn(`[TiptapEditor] TipTap EditorContent binding fields missing; detached editor repair skipped`),!1;let r=e;if(r.contentComponent==null)return!1;try{n.setProps({nodeViews:{}})}catch{}return r.contentComponent=null,r.isEditorContentInitialized=!1,!0}function OA(){let e=new er({extensions:hi});return{mdManager:e,text:Rt({mdManager:e}),html:Re({mdManager:e}),paste:et({mdManager:e}),drop:At({mdManager:e})}}function kA(e,t){return t?{collaboration:tt.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[vA({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:tt.configure({document:e.document}),guard:[]}}function AA(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=kA(t,r);return[...bt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),hw.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,vr.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[He]}}),vr.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[p(e,{cursorBuilder:bA})]}}),vr.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[CO({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,lA]}function jA(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{yA.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=yA.get(e);if(yA.delete(e),r==null)return;let i=performance.now();vl(`ok/editor/create-tiptap`,{docName:t.configuration.name??`unknown`,ytextLength:t.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,r,i)=>{let a=n.mdManager.parse(e);return i.state.schema.nodeFromJSON(a).content},clipboardTextSerializer:(e,t)=>n.text(e,t),clipboardSerializer:n.html.serializer,handlePaste:(e,t)=>n.paste(e,t),handleDrop:uA(n.drop,e.onSidebarDrop)},extensions:Tg(AA(e))}}function MA(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=jA({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:c,onWedged:a,onSidebarDrop:o}),u=l.onBeforeCreate;return{...l,onBeforeCreate:e=>{u?.(e);let{editor:t}=e,{doc:n,mapping:r}=q(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var NA=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(xA),c=pO(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=pt(),p=n.configuration.name??``,[m]=(0,Q.useState)(OA),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new zn(MA({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;vl(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{dA(e,f)}})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=m,t[1]=p,t[2]=f,t[3]=r,t[4]=n,t[5]=d,t[6]=h):h=t[6];let[g]=(0,Q.useState)(h),_,v;if(t[7]!==g||t[8]!==p||t[9]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=O(p)??crypto.randomUUID();_=Q.use,v=rn({docName:p,mountId:r,construct:g,sizeStats:e}),t[7]=g,t[8]=p,t[9]=n.document,t[10]=_,t[11]=v}else _=t[10],v=t[11];let y=_(v),b=y.editor,x,S;t[12]===y?(x=t[13],S=t[14]):(x=()=>()=>{R(y)},S=[y],t[12]=y,t[13]=x,t[14]=S),(0,Q.useEffect)(x,S);let C;return t[15]!==u||t[16]!==p||t[17]!==b||t[18]!==c||t[19]!==i||t[20]!==a||t[21]!==l||t[22]!==n?(C=(0,Z.jsx)(PA,{provider:n,isSourceMode:i,docName:p,activeDocName:u,identity:c,principal:l,editor:b,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[15]=u,t[16]=p,t[17]=b,t[18]=c,t[19]=i,t[20]=a,t[21]=l,t[22]=n,t[23]=C):C=t[23],C},PA=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:u,flashStateRef:d,portalTarget:f}=e,p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(0),g,_;t[0]===f?(g=t[1],_=t[2]):(g=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},_=[f],t[0]=f,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_);let v,y;t[3]!==c||t[4]!==f?(v=()=>{DA(c,f)&&h(FA)},y=[c,f],t[3]=c,t[4]=f,t[5]=v,t[6]=y):(v=t[5],y=t[6]),(0,Q.useEffect)(v,y);let b;t[7]!==c||t[8]!==n.configuration.name?(b=()=>(Xe(c,n.configuration.name??null),()=>{Xe(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=b):b=t[9];let x;t[10]!==c||t[11]!==n?(x=[c,n],t[10]=c,t[11]=n,t[12]=x):x=t[12],(0,Q.useEffect)(b,x);let S;t[13]!==c||t[14]!==n.configuration.name?(S=()=>{let e=n.configuration.name;if(e)return T(e,c),()=>Et(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=S):S=t[15];let C;t[16]!==c||t[17]!==n?(C=[c,n],t[16]=c,t[17]=n,t[18]=C):C=t[18],(0,Q.useEffect)(S,C);let w;t[19]!==c||t[20]!==n.configuration.name?(w=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,Ql(e,`wysiwyg`,tu(c)),du(e,`wysiwyg`,fu(c,e))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),c.on(`selectionUpdate`,i),c.on(`update`,i),()=>{t&&clearTimeout(t),c.off(`selectionUpdate`,i),c.off(`update`,i),Ql(e,`wysiwyg`,null),du(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=w):w=t[21];let E;t[22]!==c||t[23]!==n?(E=[c,n],t[22]=c,t[23]=n,t[24]=E):E=t[24],(0,Q.useEffect)(w,E);let D;t[25]!==c||t[26]!==n.configuration.name?(D=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=D):D=t[27];let O;t[28]!==c||t[29]!==n?(O=[c,n],t[28]=c,t[29]=n,t[30]=O):O=t[30],(0,Q.useEffect)(D,O);let k,A;t[31]===c?(k=t[32],A=t[33]):(k=()=>{let e=IA,t=null,n=()=>{if(t||c.isDestroyed)return;let n=de(c);n&&(t=n.dom,t.addEventListener(`keydown`,e),t.addEventListener(`paste`,e),t.addEventListener(`drop`,e),t.addEventListener(`cut`,e))},r=()=>{t&&=(t.removeEventListener(`keydown`,e),t.removeEventListener(`paste`,e),t.removeEventListener(`drop`,e),t.removeEventListener(`cut`,e),null)};return de(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},A=[c],t[31]=c,t[32]=k,t[33]=A),(0,Q.useEffect)(k,A);let j,M;t[34]!==i||t[35]!==c?(j=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!de(c))return;e=!0;let t=H(i)?.selection??null;if(t)try{let e=c.state.doc.content.size;if(t.type===`text`){let n=Math.max(0,Math.min(t.anchor,e)),r=Math.max(0,Math.min(t.head,e));c.commands.setTextSelection({from:n,to:r})}else{let n=Math.max(0,Math.min(t.from,e));c.commands.setNodeSelection(n)}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(JSON.stringify({event:`ok-editor-selection-restore-failed`,docName:i,message:n})),vl(`ok/editor/selection-restore-failed`,{docName:i,message:n})}l(i)};if(de(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},M=[c,i],t[34]=i,t[35]=c,t[36]=j,t[37]=M):(j=t[36],M=t[37]),(0,Q.useEffect)(j,M);let N,P;t[38]!==d||t[39]!==n.document||t[40]!==u?(N=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{d.current=e;let t=u.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},l=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(d.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},Ln)};c(xA);let f=()=>{if(zr(e),!_i(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),l()},e)}return}r=n,l()};e.observe(f);let p=()=>{document.visibilityState===`visible`?_i(e,t)&&(t=Date.now(),r=Date.now(),l()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},P=[n.document,d,u],t[38]=d,t[39]=n.document,t[40]=u,t[41]=N,t[42]=P):(N=t[41],P=t[42]),(0,Q.useEffect)(N,P);let F,I;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(F=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<SA){e+=1,t=window.setTimeout(p,CA);return}r=null,o=null,e=0},u=function(e){let t=de(c);if(!t)return null;let n=CSS.escape(e);return t.dom.querySelector(`#${n}`)??t.dom.querySelector(`[data-mirror-source-id="${n}"]`)},d=function(e){let t=u(e);return t?(t.scrollIntoView({behavior:`smooth`,block:`start`}),!0):!1},f=function(e,n){let r=wA,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,TA)))};t=window.setTimeout(o,TA)};function p(){if(!r||i!==a)return;let t=r,n=o;if(!n){l();return}d(t)?(s=n,r=null,o=null,e=0,f(t,n)):l()}let m=function(){if(i!==a)return;let n=window.location.hash;if(!r&&s===n)return;let c=el(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},h=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,h),c.on(`transaction`,h),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,h),c.off(`transaction`,h),window.removeEventListener(`hashchange`,m)}},I=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=F,t[48]=I):(F=t[47],I=t[48]),(0,Q.useEffect)(F,I);let L,R;t[49]===c?(L=t[50],R=t[51]):(L=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=de(c);if(!n)return;let r=n.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`)[t.index];r&&r.scrollIntoView({behavior:`smooth`,block:`start`})};return window.addEventListener(Xl,e),()=>window.removeEventListener(Xl,e)},R=[c],t[49]=c,t[50]=L,t[51]=R),(0,Q.useEffect)(L,R);let z;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(z=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:mO({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[52]=a,t[53]=i,t[54]=o,t[55]=r,t[56]=s,t[57]=n.awareness,t[58]=z):z=t[58];let B;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(B=[n,i,a,o,s,r],t[59]=a,t[60]=i,t[61]=o,t[62]=r,t[63]=s,t[64]=n,t[65]=B):B=t[65],(0,Q.useEffect)(z,B);let V,U;t[66]!==c||t[67]!==r?(V=()=>($t(c,r),()=>{$t(c,!1)}),U=[c,r],t[66]=c,t[67]=r,t[68]=V,t[69]=U):(V=t[68],U=t[69]),(0,Q.useEffect)(V,U);let W;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(W=!r&&(0,Z.jsx)(Bk,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=W):W=t[74];let G;t[75]!==c||t[76]!==r?(G=!r&&(0,Z.jsx)(_A,{editor:c}),t[75]=c,t[76]=r,t[77]=G):G=t[77];let K;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[78]=K):K=t[78];let te;t[79]!==c||t[80]!==m?(te=(0,Z.jsx)(ee,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[79]=c,t[80]=m,t[81]=te):te=t[81];let q;t[82]!==f||t[83]!==te?(q=(0,ld.createPortal)(te,f),t[82]=f,t[83]=te,t[84]=q):q=t[84];let J;t[85]===c?J=t[86]:(J=(0,Z.jsx)(dO,{editor:c}),t[85]=c,t[86]=J);let ne;t[87]===c?ne=t[88]:(ne=Ht(c),t[87]=c,t[88]=ne);let re;t[89]===ne.store?re=t[90]:(re=(0,Z.jsx)(Fe,{store:ne.store}),t[89]=ne.store,t[90]=re);let ie;return t[91]!==W||t[92]!==G||t[93]!==q||t[94]!==J||t[95]!==re||t[96]!==u?(ie=(0,Z.jsxs)(`div`,{ref:u,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[W,G,K,q,J,re]}),t[91]=W,t[92]=G,t[93]=q,t[94]=J,t[95]=re,t[96]=u,t[97]=ie):ie=t[97],ie};function FA(e){return e+1}function IA(){return C()}var LA=null;function RA(e){let t=(0,$.c)(3),n=(0,Q.useRef)(null),r,i;return t[0]===e?(r=t[1],i=t[2]):(r=()=>{if(!e)return;let t=n.current;if(!t)return;let r={};LA=r;let i=document.documentElement,a=null,o=()=>{if(LA!==r)return;let e=`${t.offsetHeight}px`;e!==a&&(a=e,i.style.setProperty(`--conflict-footer-height`,e))};o();let s=new ResizeObserver(o);return s.observe(t),()=>{s.disconnect(),LA===r&&(LA=null,i.style.removeProperty(`--conflict-footer-height`))}},i=[e],t[0]=e,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i),n}var zA=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function BA(e,t,n,r,i,a){if(e==r)return[];let o=XA(e,t,n,r,i,a),s=ZA(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new zA(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new zA(t,t+o,i,i),new zA(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new zA(t,t,i,i+o),new zA(n,n,i+o+c,a)]}if(c==1||l==1)return[new zA(t,n,i,a)];let u=$A(e,t,n,r,i,a);if(u){let[o,s,c]=u;return BA(e,t,o,r,i,s).concat(BA(e,o+c,n,r,s+c,a))}return WA(e,t,n,r,i,a)}var VA=1e9,HA=0,UA=!1;function WA(e,t,n,r,i,a){let o=n-t,s=a-i;if(VA<1e9&&Math.min(o,s)>VA*16||HA>0&&Date.now()>HA)return Math.min(o,s)>VA*64?[new zA(t,n,i,a)]:ej(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);KA.reset(c),qA.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:qA,f=d?null:KA;for(let p=0;p<c;p++){if(p>VA||HA>0&&!(p&63)&&Date.now()>HA)return ej(e,t,n,r,i,a);let m=KA.advance(p,o,s,c,d,!1,l)||qA.advance(p,o,s,c,f,!0,u);if(m)return JA(e,t,n,t+m[0],r,i,a,i+m[1])}return[new zA(t,n,i,a)]}var GA=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1)if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}return null}},KA=new GA,qA=new GA;function JA(e,t,n,r,i,a,o,s){let c=!1;return!hj(e,r)&&++r==n&&(c=!0),!hj(i,s)&&++s==o&&(c=!0),c?[new zA(t,n,a,o)]:BA(e,t,r,i,a,s).concat(BA(e,r,n,i,s,o))}function YA(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function XA(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=YA(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!hj(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function ZA(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=YA(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!hj(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function QA(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){hj(e,s)||s++;let u=s+o;if(hj(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=XA(e,u,n,r,i+f+d.length,a),c=ZA(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function $A(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=$A(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:QA(e,t,n,r,i,a,Math.floor(o/4),-1)}function ej(e,t,n,r,i,a){UA=!0;let o=n-t,s=a-i,c;if(o<s){let s=QA(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=QA(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new zA(t,n,i,a)];let[l,u,d]=c;return BA(e,t,l,r,i,u).concat(BA(e,l+d,n,r,u+d,a))}function tj(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new zA(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function nj(e,t,n){for(;;){tj(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=XA(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new zA(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=ZA(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new zA(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new zA(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new zA(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function rj(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=uj(t,a.fromA,l),f=lj(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new zA(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=lj(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new zA(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=uj(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new zA(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=fj(n,a.fromB,a.toB),r,o=t<0?-1:dj(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=fj(t,a.fromA,a.toA),r,o=n<0?-1:dj(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return tj(e,3),e}var ij;try{ij=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function aj(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function oj(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!aj(n):ij?!pj(n)||t==e.length-1?+!!ij.test(String.fromCharCode(n)):ij.test(e.slice(t,t+2))?2:0:0}function sj(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!aj(n):ij?!mj(n)||t==1?+!!ij.test(String.fromCharCode(n)):ij.test(e.slice(t-2,t))?2:0:0}var cj=8;function lj(e,t,n){if(t==e.length||!sj(e,t))return t;for(let r=t,i=t+n,a=0;a<cj;a++){let t=oj(e,r);if(!t||r+t>i)return r;r+=t}return t}function uj(e,t,n){if(!t||!oj(e,t))return t;for(let r=t,i=t-n,a=0;a<cj;a++){let t=sj(e,r);if(!t||r-t<i)return r;r-=t}return t}function dj(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function fj(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var pj=e=>e>=55296&&e<=56319,mj=e=>e>=56320&&e<=57343;function hj(e,t){return!t||t==e.length||!pj(e.charCodeAt(t-1))||!mj(e.charCodeAt(t))}function gj(e,t,n){let r=n?.override;return r?r(e,t):(VA=(n?.scanLimit??1e9)>>1,HA=n?.timeout?Date.now()+n.timeout:0,UA=!1,nj(e,t,BA(e,0,e.length,t,0,t.length)))}function _j(){return!UA}function vj(e,t,n){return rj(gj(e,t,n),e,t)}var yj=Ll.define({combine:e=>e[0]}),bj=Rl.define(),xj=Ll.define(),Sj=Ml.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(bj)&&(e=n.value);for(let n of t.state.facet(xj))e=n(e,t);return e}});function Cj(e){let t=e.field(Sj,!1);if(!t)return null;let n=e.facet(yj);return{chunks:t,side:n?n.side:null}}var wj=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return Dj(vj(e.toString(),t.toString(),n),e,t,0,0,_j())}static updateA(e,t,n,r,i){return jj(Aj(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return jj(Aj(e,r,!1,t.length),e,t,n,i)}};function Tj(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function Ej(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function Dj(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Tj(c.fromA+r,c.fromB+i,t,n),[d,f]=Ej(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=Tj(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=Ej(a.toA+r,a.toB+i,t,n),s++}o.push(new wj(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Oj=1e3;function kj(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function Aj(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>Oj&&([l,d]=kj(e,a-Oj,n,!0)),o<t.length-Oj&&([u,f]=kj(e,o+Oj,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function jj(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=vj(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Dj(h,n,r,d,f,_j()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var Mj={scanLimit:500},Nj=zl.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Uj(e))}update(e){(e.docChanged||e.viewportChanged||Fj(e.startState,e.state)||Ij(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Uj(e.view))}},{decorations:e=>e.deco}),Pj=kl.low(Ul({class:`cm-changeGutter`,markers:e=>e.plugin(Nj)?.gutter||Gl.empty}));function Fj(e,t){return e.field(Sj,!1)!=t.field(Sj,!1)}function Ij(e,t){return e.facet(yj)!=t.facet(yj)}var Lj=Fl.line({class:`cm-changedLine`}),Rj=Fl.mark({class:`cm-changedText`}),zj=Fl.mark({tagName:`ins`,class:`cm-insertedLine`}),Bj=Fl.mark({tagName:`del`,class:`cm-deletedLine`}),Vj=new class extends Hl{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function Hj(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,Lj),i.add(o,s,n?Bj:zj),a&&a.add(o,o,Vj);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,Lj),a&&a.add(u,u,Vj);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,Rj),s<t)c++;else break}u=t}}}function Uj(e){let t=e.state.field(Sj),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(yj),o=n==`a`,s=new Il,c=i?new Il:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&Hj(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var Wj=class extends Ol{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},Gj=Rl.define({map:(e,t)=>e.map(t)}),Kj=Ml.define({create:()=>Fl.none,update:(e,t)=>{for(let e of t.effects)if(e.is(Gj))return e.value;return e.map(t.changes)},provide:e=>Vl.decorations.from(e)}),qj=.01;function Jj(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function Yj(e,t,n){let r=new Il,i=new Il,a=e.state.field(Kj).iter(),o=t.state.field(Kj).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-qj?(l-=n,r.add(s,s,Fl.widget({widget:new Wj(-n),block:!0,side:-1}))):n>qj&&(u+=n,i.add(c,c,Fl.widget({widget:new Wj(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<qj?r.add(e.state.doc.length,e.state.doc.length,Fl.widget({widget:new Wj(-p),block:!0,side:1})):p>qj&&i.add(t.state.doc.length,t.state.doc.length,Fl.widget({widget:new Wj(p),block:!0,side:1}));let m=r.finish(),h=i.finish();Jj(m,e.state.field(Kj))||e.dispatch({effects:Gj.of(m)}),Jj(h,t.state.field(Kj))||t.dispatch({effects:Gj.of(h)})}var Xj=Rl.define({map:(e,t)=>t.mapPos(e)}),Zj=class extends Ol{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:Xj.of(n)});let{side:r,sibling:i}=e.state.facet(yj);i&&i().dispatch({effects:Xj.of(Qj(n,e.state.field(Sj),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function Qj(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var $j=Ml.define({create(e){return Fl.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Xj)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Vl.decorations.from(e)});function eM({margin:e=3,minSize:t=4}){return $j.init(n=>tM(n,e,t))}function tM(e,t,n){let r=new Il,i=e.facet(yj).side==`a`,a=e.field(Sj),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,Fl.replace({widget:new Zj(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var nM=Vl.styleModule.of(new Wl({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),rM=Vl.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),iM=new Bl,aM=new Bl,oM=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Mj;let t=[kl.low(Nj),rM,nM,Kj,Vl.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(Gj)))&&this.measure()})],n=[yj.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Pj);let r=jl.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Vl.editorAttributes.of({class:`cm-merge-a`}),aM.of(n),t]}),i=[yj.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Pj);let a=jl.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Vl.editorAttributes.of({class:`cm-merge-b`}),aM.of(i),t]});this.chunks=wj.build(r.doc,a.doc,this.diffConf);let o=[Sj.init(()=>this.chunks),iM.of(e.collapseUnchanged?eM(e.collapseUnchanged):[])];r=r.update({effects:Rl.appendConfig.of(o)}).state,a=a.update({effects:Rl.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new Vl({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Vl({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),Al.empty(e[0].startState.doc.length));this.chunks=t==this.a?wj.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):wj.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:bj.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:bj.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(yj),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(aM.reconfigure([yj.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?Pj:[]])),a.push(aM.reconfigure([yj.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?Pj:[]]))}if(r){let t=iM.reconfigure(e.collapseUnchanged?eM(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){this.measuring<0&&(this.measuring=(this.dom.ownerDocument.defaultView||window).requestAnimationFrame(()=>{this.measuring=-1,this.measure()}))}measure(){Yj(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=sM(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=sM(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function sM(e){let t=e.nextSibling;return e.remove(),t}var cM=new class extends Hl{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},lM=kl.low(Ul({class:`cm-changeGutter`,markers:e=>e.plugin(Nj)?.gutter||Gl.empty,widgetMarker:(e,t)=>t instanceof mM?cM:null}));function uM(e){let t=typeof e.original==`string`?Pl.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Mj;return[kl.low(Nj),yM,rM,Vl.editorAttributes.of({class:`cm-merge-b`}),xj.of((e,t)=>{let r=t.effects.find(e=>e.is(dM));return r&&(e=wj.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=wj.updateB(e,t.state.field(fM),t.newDoc,t.changes,n)),e}),yj.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?TM:void 0,side:`b`}),fM.init(()=>t),e.gutter===!1?[]:lM,e.collapseUnchanged?eM(e.collapseUnchanged):[],Sj.init(e=>wj.build(t,e.doc,n))]}var dM=Rl.define(),fM=Ml.define({create:()=>Pl.empty,update(e,t){for(let n of t.effects)n.is(dM)&&(e=n.value.doc);return e}}),pM=new WeakMap,mM=class extends Ol{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function hM(e,t,n){let r=pM.get(t.changes);if(r)return r;let i=Fl.widget({block:!0,side:-1,widget:new mM(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(yj),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),gM(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),_M(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(fM).sliceString(t.fromA,t.endA),u=a&&e.facet(Kl),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
|
|
30
30
|
`){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
|
|
31
|
-
`,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Nl(t,{style:t=>ql(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return pM.set(t.changes,i),i}function gM(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Sj).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(fM);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Al.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:dM.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function _M(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Sj).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(fM).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function vM(e){let t=new Il;for(let n of e.field(Sj)){let r=e.facet(yj).overrideChunk&&xM(e,n);t.add(n.fromB,n.fromB,hM(e,n,!!r))}return t.finish()}var yM=Ml.define({create:e=>vM(e),update(e,t){return t.state.field(Sj,!1)==t.startState.field(Sj,!1)?e:vM(t.state)},provide:e=>Vl.decorations.from(e)}),bM=new WeakMap;function xM(e,t){let n=bM.get(t);if(n!==void 0)return n;n=null;let r=e.field(fM),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(Fl.widget({widget:new SM(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Rj.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return bM.set(t,n),n}var SM=class extends Ol{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},CM=new class extends Hl{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},wM=Fl.line({class:`cm-inlineChangedLine`});function TM(e,t,n,r){let i=xM(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,CM),n.add(o.from,o.from,wM);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var EM=ae({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),DM=E({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),OM=Vl.theme({".cm-deletedChunk .cm-chunkButtons":{display:`flex`,gap:`0.25rem`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button']":{margin:`0`,border:`1px solid transparent`,borderRadius:`min(var(--radius-md), 10px)`,color:`var(--primary-foreground)`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button'][data-variant='destructive']":{color:`var(--destructive)`}});function kM({addControl:e,nextId:t,removeControl:n,root:r}){return(i,a)=>{let o=document.createElement(`span`);o.className=`inline-flex`;let s=t();return e({id:s,host:o,type:i,action:a}),queueMicrotask(()=>{r.contains(o)||n(s)}),o}}function AM(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=an(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=tr(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C=RA(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?EM:DM,u=[Vl.editable.of(!1),jl.readOnly.of(!0)],g=[ou,Jl(),...u,l,Vl.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Vl({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=kM({addControl:e=>{r||(t.set(e.id,e.host),S(t=>[...t,e]))},nextId:()=>(m.current+=1,m.current),removeControl:s,root:e}),a=new Vl({doc:d,extensions:[ou,Jl(),Vl.editable.of(!1),l,OM,Vl.lineWrapping,uM({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Vl.updateListener.of(e=>{let t=Cj(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=Cj(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new oM({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Vl({doc:d,extensions:[...g,uM({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},E=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof Vl)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof Vl)||U(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):Ms._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,ld.createPortal)((0,Z.jsx)(X,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(Y,{id:`XyOUTJ`})}),(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(X,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(Y,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function jM(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function MM(e,t){return jM(e,`content`,t)}async function NM(e){return jM(e,`mine`)}async function PM(e){return jM(e,`theirs`)}async function FM(e){return jM(e,`delete`)}async function IM(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function LM(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=an(),{conflicts:i,loading:a}=Li(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>gl(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=RA(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),IM(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await MM(c,e);t.ok||Ss.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),Ss.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(AM,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(FM),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===w?u=t[36]:(u=()=>void w(PM),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(AM,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(NM),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(FM),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(AM,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function RM(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(zt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var zM=`__back-nav__`;function BM(e){return e instanceof Oe||e instanceof gt||e instanceof xe||e instanceof Ze||e instanceof jt||e instanceof A?e.docName:null}function VM(e){return e instanceof Oe||e instanceof gt}function HM(e){if(e instanceof Oe){let t=e.docName;return{title:Ms._({id:`Jejur6`}),summary:Ms._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof gt){let t=e.docName;return{title:Ms._({id:`V7QxyT`}),summary:Ms._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof xe){let t=e.docName;return{title:Ms._({id:`1di5fu`}),summary:Ms._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Ze){let t=e.docName;return{title:Ms._({id:`wvbc1r`}),summary:Ms._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof jt)return{title:Ms._({id:`Gfr4fu`}),summary:Ms._({id:`UW2Fg3`})};if(e instanceof A){let t=e.docName;return{title:Ms._({id:`vv7kpg`}),summary:Ms._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Ms._({id:`W5A0Ly`});return{title:Ms._({id:`29VNqC`}),summary:t}}function UM(e){let t=(0,$.c)(31),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=HM(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f=typeof window<`u`?window.okDesktop:void 0,p=f&&VM(n)?f:null,m,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{d.current?.focus()},h=[],t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(pT,{size:80,variant:`sleeping`}),t[4]=g):g=t[4];let _;t[5]===c?_=t[6]:(_=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=_);let v;t[7]===l?v=t[8]:(v=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=v);let y;t[9]!==_||t[10]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[12]=b):b=t[12];let x;t[13]===r?x=t[14]:(x=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:b}),t[13]=r,t[14]=x);let S;t[15]===p?S=t[16]:(S=p?(0,Z.jsx)(X,{variant:`secondary`,onClick:()=>{Oy(p).then(GM).catch(WM)},children:(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,t[15]=p,t[16]=S);let C;t[17]!==i||t[18]!==u||t[19]!==n||t[20]!==o||t[21]!==a||t[22]!==r?(C=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(at(BM(n)??i),o(a),r(zM))},children:(0,Z.jsx)(Y,{id:`CKyk7Q`})}):null,t[17]=i,t[18]=u,t[19]=n,t[20]=o,t[21]=a,t[22]=r,t[23]=C):C=t[23];let w;t[24]!==S||t[25]!==C||t[26]!==x?(w=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[x,S,C]}),t[24]=S,t[25]=C,t[26]=x,t[27]=w):w=t[27];let T;return t[28]!==w||t[29]!==y?(T=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[g,y,w]}),t[28]=w,t[29]=y,t[30]=T):T=t[30],T}function WM(){}function GM(e){e.ok||Ss.error(e.message,{id:`server-restart-error`,duration:1/0})}function KM(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(UM,{...e,activeDocName:n,previousDocName:r,onNavigateBack:i}),t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c;t[4]===n?c=t[5]:(c=[n],t[4]=n,t[5]=c);let l;t[6]!==n||t[7]!==a?(l=e=>{if(e.reason===`imperative-api`){if(Array.isArray(e.args)&&e.args[0]===zM){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=e=>{console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${HM(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(h,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function qM(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=ii(t);return{map:n,keys:Br(t),parseError:r}}function JM(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>qM(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=Xn(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=qe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=lt(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(YM,{cover:d}):null,t[9]=d,t[10]=f,t[11]=g):g=t[11];let _;t[12]!==f||t[13]!==p||t[14]!==l?(_=p?(0,Z.jsx)(XM,{icon:l,hasCover:f}):null,t[12]=f,t[13]=p,t[14]=l,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":m,"data-has-icon":h,"aria-hidden":`true`,"data-testid":`page-header`,children:[g,_]}),t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function YM(e){let t=(0,$.c)(2),{cover:n}=e,r;return t[0]===n.value?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`page-header-cover`,"data-testid":`page-header-cover`,children:(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`})}),t[0]=n.value,t[1]=r),r}function XM(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var ZM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-CRYWYGK4.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([74,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,69,70,21,75,8,76,77,47,24]),import.meta.url)).ManagedArtifactProperties})),QM=bl(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function $M(e){let t=e.threshold??QM;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function eN(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var tN=bl(`ACTIVITY_MOUNT_LIMIT`,3);function nN(){return n(()=>import(`./SourceEditor-CAUoNOTU.js`),__vite__mapDeps([78,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,79,34,77,73]),import.meta.url)}var rN=(0,Q.lazy)(async()=>({default:(await nN()).SourceEditor}));function iN(e,t,n){if(n<=0)return[];let r=e.filter(e=>!ze(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function aN(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Ms._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Ms._({id:`Sc1bKE`,values:{docName:e}}):Ms._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Ms._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Ms._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Ms._({id:`bmC18N`,values:{docName:e}}):Ms._({id:`pAgkuZ`,values:{docName:e}})}:null}function oN(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(yl,{name:`activity-pool`,children:(0,Z.jsx)(sN,{...e})}),t[0]=e,t[1]=n),n}function sN(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=pt(),{pages:u,loading:d}=to(),f=iN(c,n,tN),p=(0,Q.useRef)(``),m=f.map(cN).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)ue(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;se(e,t&&t.length>0?t:crypto.randomUUID())}vl(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,S(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(mN,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!br(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function cN(e){return e.docName}function lN(e){let t=(0,$.c)(8),{isActive:n,initialScrollTop:r,children:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(r??0),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=a.current;if(!e)return;let t=()=>{e.scrollTop>0&&(o.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>{if(!n)return;let e=a.current;if(!e)return;let t=o.current;if(t===0)return;let r=performance.now(),i=!1;e.scrollTop=t,e.scrollTop===t&&e.scrollHeight>t&&vl(`ok/scroll-restore/phase1-success`,{target:t,elapsedMs:performance.now()-r});let s=!1,c=0,l=()=>{s||(s=!0,cancelAnimationFrame(c),clearTimeout(f),e.removeEventListener(`wheel`,u),e.removeEventListener(`touchstart`,u))},u=()=>l();e.addEventListener(`wheel`,u,{passive:!0}),e.addEventListener(`touchstart`,u,{passive:!0});let d=()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&!i&&(vl(`ok/scroll-restore/phase2-success`,{target:t,elapsedMs:performance.now()-r}),i=!0)),c=requestAnimationFrame(d))};c=requestAnimationFrame(d);let f=setTimeout(()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&vl(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function uN(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(XC,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(rN,{docName:f,ytext:p,provider:n.provider,placeholder:a,isSourceModeActive:o})}),t[6]=a,t[7]=n.docName,t[8]=n.provider,t[9]=o,t[10]=p,t[11]=m):m=t[11],m}function dN(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(ao,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Fo,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(X,{type:`button`,onClick:fN,children:[(0,Z.jsx)(ao,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function fN(){return window.location.reload()}function pN(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function mN(e){let t=(0,$.c)(53),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=aN(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=aD(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[y,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==y?(S=()=>{i&&!_?v(!0):!i&&!y&&x(!0)},C=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=$M({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,k;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&vl(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},k=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=g,t[17]=D,t[18]=k):(D=t[17],k=t[18]),(0,Q.useEffect)(D,k);let A;t[19]===n.docName?A=t[20]:(A=()=>H(n.docName),t[19]=n.docName,t[20]=A);let[j]=(0,Q.useState)(A),M=j?.html??null,[N,P]=(0,Q.useState)(!1),F,I;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==N||t[26]!==i||t[27]!==g?(F=()=>{eN({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:N})&&(vl(`ok/cold/first-toggle`,{docName:n.docName,mountId:O(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),P(!0))},I=[N,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=w.isLarge,t[23]=w.renderSource,t[24]=w.renderVisual,t[25]=N,t[26]=i,t[27]=g,t[28]=F,t[29]=I):(F=t[28],I=t[29]),(0,Q.useEffect)(F,I);let L=r?`visible`:`hidden`,R=`editor:${n.docName}`,z=j?.scrollTop,B;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==M?(B=f?(0,Z.jsx)(dN,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(KM,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(pN,{html:M}):(0,Z.jsx)(XC,{}),children:(0,Z.jsx)(RM,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(LM,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(br(n.docName)||b(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(ZM,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(JM,{provider:n.provider}),(0,Z.jsx)(Ba,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[w.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(uN,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,w.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(NA,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=M,t[44]=B):B=t[44];let V;t[45]!==r||t[46]!==z||t[47]!==B?(V=(0,Z.jsx)(lN,{isActive:r,initialScrollTop:z,children:B}),t[45]=r,t[46]=z,t[47]=B,t[48]=V):V=t[48];let U;return t[49]!==L||t[50]!==R||t[51]!==V?(U=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[49]=L,t[50]=R,t[51]=V,t[52]=U):U=t[52],U}function hN(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function gN(e){let{value:t,unit:n}=hN(e);return n===`rem`?t*16:t}function _N(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var vN=3600*24*7;function yN(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?bN:m,O=g===void 0?vN:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let ee=gN(b),te;t[6]===x?te=t[7]:(te=gN(x),t[6]=x,t[7]=te);let q=te,J;t[8]!==E||t[9]!==k?(J=function(e){E&&(P.current=!0,j.current=H.current?0:gN(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=J):J=t[10];let ne=J,re,ie;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==q||t[18]!==ee||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(re=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=hN(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=ee*w;else if(e<=ee){let n=ee*(w-1);t=ee-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>ee*T){a();let t=n(r,M.current,j.current,s),c=Math.max(ee,Math.min(q,t)),u=_N(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(ee,Math.min(q,u)),f=_N(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ie=[i,a,D,ee,q,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=q,t[18]=ee,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=ie):(re=t[24],ie=t[25]),(0,Q.useEffect)(re,ie);let ae;return t[26]===ne?ae=t[27]:(ae={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ae),ae}function bN(){}var xN=3600*24*7,SN=`18rem`,CN=`3rem`,wN=`app-file-sidebar`,TN=`14.625rem`,EN=`32rem`,DN=`sidebar_width`,ON=/^\d+(?:\.\d+)?(?:rem|px)$/,kN=Q.createContext(null);function AN(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${DN}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return ON.test(n)?n:e}function jN(){let e=Q.use(kN);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function MN(e){let t=(0,$.c)(58),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?SN:c,[u]=Q.useState(PN),d;t[8]===u?d=t[9]:(d=()=>hD(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>AN(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=SD();return wD(`left`,hD(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),TD(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(NN)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${fD}px)`),t=()=>{let e=hD(u,window.innerWidth,`left`);p(e),C(wD(`left`,e,SD())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(wN)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||E(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{El(e,`toggle-files-sidebar`)&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":CN,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=wi(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let ee;return t[55]!==H||t[56]!==K?(ee=(0,Z.jsx)(kN.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=ee):ee=t[57],ee}function NN(e){return!e}function PN(){return Fr()}function FN(e){let t=(0,$.c)(39),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{_:d}=an(),{state:f,isDraggingRail:p}=jN();if(u===`none`){let e;t[7]===r?e=t[8]:(e=wi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[14]===h?g=t[15]:(g=wi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[20]!==r||t[21]!==y?(b=wi(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:wN,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function IN(e){let t=(0,$.c)(34),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=an(),{toggleSidebar:o,state:s}=jN(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Dl(`toggle-files-sidebar`);c=X,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=wN,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=wi(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(ht,{}):(0,Z.jsx)(Zd,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function LN(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{_:l}=an(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=jN(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:TN,maxResizeWidth:EN,setIsDraggingRail:m,widthCookieName:DN,widthCookieMaxAge:xN},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=yN(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=wi(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function RN(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=jN(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=wi(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function zN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function BN(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=wi(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function VN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function HN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function UN(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?Ti:`div`,o;t[4]===n?o=t[5]:(o=wi(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function WN(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?Ti:`button`,o;t[4]===n?o=t[5]:(o=wi(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-action`,"data-sidebar":`group-action`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function GN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function KN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var JN=Ci(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function YN(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?Ti:`button`,{state:m}=jN(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=wi(JN({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(Vs,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Hs,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(Ws,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function XN(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?Ti:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=wi(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function ZN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function QN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`group/menu-sub-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-sub-item`,"data-sidebar":`menu-sub-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $N(e){let t=(0,$.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:i,size:a,isActive:o,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?!1:i,c=a===void 0?`md`:a,l=o===void 0?!1:o,u=s?Ti:`a`,d;t[6]===n?d=t[7]:(d=wi(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,n),t[6]=n,t[7]=d);let f;return t[8]!==u||t[9]!==l||t[10]!==r||t[11]!==c||t[12]!==d?(f=(0,Z.jsx)(u,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":c,"data-active":l,className:d,...r}),t[8]=u,t[9]=l,t[10]=r,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function eP(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function tP(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Xr.safeParse(t);return n.success?n.data.currentBranch??null:null}var nP=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:eP({fetchBranch:tP,subscribeToEvent:Ts}),rP=nP.subscribe,iP=nP.getSnapshot;function aP(){return(0,Q.useSyncExternalStore)(rP,iP,iP)}function oP(){let e=(0,$.c)(6),t=aP(),n=so(),{state:r}=jN(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&Pi(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function sP(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:l}=an(),u=oP();if(!s&&u===null&&a==null)return null;let d=r??n,f=r!=null,{words:p,chars:m,tokens:h}=d,g;t[0]!==l||t[1]!==f||t[2]!==s?(g=l(s?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=s,t[3]=g):g=t[3];let _=c&&`pr-12`,v;t[4]===_?v=t[5]:(v=wi(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,_),t[4]=_,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[6]=y):y=t[6];let b;t[7]!==l||t[8]!==a?(b=a?(0,Z.jsxs)(X,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(us,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(Jt,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=l,t[8]=a,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u===null?null:(0,Z.jsx)(cP,{identity:u}),t[10]=u,t[11]=x);let S;t[12]===x?S=t[13]:(S=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:x}),t[12]=x,t[13]=S);let C;t[14]!==l||t[15]!==d.chars||t[16]!==d.tokens||t[17]!==d.words||t[18]!==m||t[19]!==f||t[20]!==s||t[21]!==h||t[22]!==p?(C=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:l({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.words.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`d5rK4X`,values:{chars:m}})]}),(0,Z.jsxs)(`span`,{children:[d.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.tokens.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[14]=l,t[15]=d.chars,t[16]=d.tokens,t[17]=d.words,t[18]=m,t[19]=f,t[20]=s,t[21]=h,t[22]=p,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==S?(w=(0,Z.jsxs)(`section`,{"aria-label":g,className:v,children:[y,b,S,C]}),t[24]=C,t[25]=g,t[26]=v,t[27]=b,t[28]=S,t[29]=w):w=t[29],w}function cP(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Hs,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function lP(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:i}=an(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=wi(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function uP(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=wi(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dP(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fP(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=wi(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function pP(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=wi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Qa,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var mP=1,hP=2,gP=4;function _P(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ni(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:ie(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>gP?[...u.slice(0,mP).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(mP,-hP)},...u.slice(-hP).map((e,t)=>d(e,u.length-hP+t))]:u.map((e,t)=>d(e,t));a=lP,t[8]===r?c=t[9]:(c=wi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=uP,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(vP)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function vP(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(pP,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(dP,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(Sd,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(dP,{className:`min-w-0`,children:(0,Z.jsx)(fP,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var yP={fill:`none`,height:24,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`},bP=e=>{let t=(0,$.c)(15),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({color:a,size:o,strokeWidth:s,absoluteStrokeWidth:n,className:c,children:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=a===void 0?`currentColor`:a,u=o===void 0?24:o,d=s===void 0?2:s,f=c===void 0?``:c,p=n?Number(d)*24/Number(u):d,m;return t[8]!==r||t[9]!==f||t[10]!==l||t[11]!==i||t[12]!==u||t[13]!==p?(m=(0,Z.jsx)(`svg`,{"aria-hidden":`true`,...yP,className:f,height:u,stroke:l,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:p,width:u,...i,children:r}),t[8]=r,t[9]=f,t[10]=l,t[11]=i,t[12]=u,t[13]=p,t[14]=m):m=t[14],m},xP=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Markdown`}),r=(0,Z.jsx)(`path`,{d:`M232,48H24A16,16,0,0,0,8,64V192a16,16,0,0,0,16,16H232a16,16,0,0,0,16-16V64A16,16,0,0,0,232,48Zm0,144H24V64H232V192ZM128,104v48a8,8,0,0,1-16,0V123.31L93.66,141.66a8,8,0,0,1-11.32,0L64,123.31V152a8,8,0,0,1-16,0V104a8,8,0,0,1,13.66-5.66L88,124.69l26.34-26.35A8,8,0,0,1,128,104Zm77.66,18.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L168,132.69V104a8,8,0,0,1,16,0v28.69l10.34-10.35A8,8,0,0,1,205.66,122.34Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(bP,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},SP=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Textbox`}),r=(0,Z.jsx)(`path`,{d:`M112,40a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80v96a16,16,0,0,0,16,16h80v16a8,8,0,0,0,16,0V48A8,8,0,0,0,112,40ZM24,176V80h80v96ZM248,80v96a16,16,0,0,1-16,16H144a8,8,0,0,1,0-16h88V80H144a8,8,0,0,1,0-16h88A16,16,0,0,1,248,80ZM88,112a8,8,0,0,1-8,8H72v24a8,8,0,0,1-16,0V120H48a8,8,0,0,1,0-16H80A8,8,0,0,1,88,112Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(bP,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function CP(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=an(),s=n?`source`:`wysiwyg`,c;t[0]===r?c=t[1]:(c=e=>{e&&r(e)},t[0]=r,t[1]=c);let l;t[2]===o?l=t[3]:(l=o({id:`n7aopT`}),t[2]=o,t[3]=l);let u;t[4]===o?u=t[5]:(u=o({id:`ur2XSb`}),t[4]=o,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Vs,{children:(0,Z.jsx)(SP,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(ka,{value:`wysiwyg`,"aria-label":u,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:d}),t[7]=u,t[8]=f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(Ws,{children:[f,p]}),t[10]=f,t[11]=m);let h;t[12]===o?h=t[13]:(h=o({id:`xbdtfY`}),t[12]=o,t[13]=h);let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(xP,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(ka,{value:`source`,"aria-label":h,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:g})})}),t[15]=a,t[16]=h,t[17]=_):_=t[17];let v;t[18]===a?v=t[19]:(v=(0,Z.jsx)(Hs,{side:`bottom`,children:a?(0,Z.jsx)(Y,{id:`G-JBA1`}):(0,Z.jsx)(Y,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(Ws,{children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==c||t[26]!==l||t[27]!==m?(b=(0,Z.jsxs)(ja,{type:`single`,value:s,onValueChange:c,"aria-label":l,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[m,y]}),t[23]=y,t[24]=s,t[25]=c,t[26]=l,t[27]=m,t[28]=b):b=t[28],b}var wP=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-Bfh-iuK_.js`);return{SkillEditorActions:e}},__vite__mapDeps([80,1,30,3,7,31,6,10,70,20,9,11,32,12,13,21,16,60,72,18,61,65,23]),import.meta.url)).SkillEditorActions}));function TP(e){let t=(0,$.c)(82),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=an(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Tl(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,x,S,C,w,T,E,D,O,k,A;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){let e=Dl(`toggle-document-panel`),u;t[26]===n?u=t[27]:(u=n?ni(n):null,t[26]=n,t[27]=u);let p=u,m;t[28]===n?m=t[29]:(m=n?b(n):null,t[28]=n,t[29]=m);let j=m,M;t[30]!==p||t[31]!==j?(M=p?.kind===`skill`?{scope:p.scope,name:p.name}:j?{scope:`project`,name:j}:null,t[30]=p,t[31]=j,t[32]=M):M=t[32];let N=M;x=`editor-toolbar`,S=`pointer-events-none absolute inset-x-0 top-0 z-10`;let P;t[33]!==n||t[34]!==N?(P=N?null:(0,Z.jsx)(_P,{docName:n}),t[33]=n,t[34]=N,t[35]=P):P=t[35];let F;t[36]===P?F=t[37]:(F=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:P}),t[36]=P,t[37]=F);let I;t[38]!==r||t[39]!==a||t[40]!==i?(I=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(CP,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[38]=r,t[39]=a,t[40]=i,t[41]=I):I=t[41],t[42]!==F||t[43]!==I?(C=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[F,I]})}),t[42]=F,t[43]=I,t[44]=C):C=t[44];let L=d&&`pr-9`;t[45]===L?_=t[46]:(_=wi(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,L),t[45]=L,t[46]=_),t[47]===N?v=t[48]:(v=N?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(wP,{scope:N.scope,name:N.name})}):null,t[47]=N,t[48]=v),t[49]!==f||t[50]!==s||t[51]!==o?(y=o&&(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Vs,{children:(0,Z.jsx)(Vd,{})})}),(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`81H_23`})})]}),t[49]=f,t[50]=s,t[51]=o,t[52]=y):y=t[52],g=Ws,h=X,w=``,T=`ghost`,E=`icon`,D=l,O=!c,k=`doc-panel`,A=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23],k=t[24],A=t[25];let j;t[53]===c?j=t[54]:(j=(0,Z.jsx)(Vs,{children:c?(0,Z.jsx)($d,{}):(0,Z.jsx)(Qd,{})}),t[53]=c,t[54]=j);let M;t[55]!==h||t[56]!==j||t[57]!==w||t[58]!==T||t[59]!==E||t[60]!==D||t[61]!==O||t[62]!==k||t[63]!==A?(M=(0,Z.jsx)(h,{"data-doc-panel-toggle":w,variant:T,size:E,onClick:D,"aria-expanded":O,"aria-controls":k,"aria-label":A,asChild:!0,children:j}),t[55]=h,t[56]=j,t[57]=w,t[58]=T,t[59]=E,t[60]=D,t[61]=O,t[62]=k,t[63]=A,t[64]=M):M=t[64];let N;t[65]===c?N=t[66]:(N=(0,Z.jsx)(Hs,{side:`bottom`,children:c?(0,Z.jsx)(Y,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(Y,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[65]=c,t[66]=N);let P;t[67]!==g||t[68]!==M||t[69]!==N?(P=(0,Z.jsxs)(g,{children:[M,N]}),t[67]=g,t[68]=M,t[69]=N,t[70]=P):P=t[70];let F;t[71]!==_||t[72]!==v||t[73]!==y||t[74]!==P?(F=(0,Z.jsxs)(`div`,{className:_,children:[v,y,P]}),t[71]=_,t[72]=v,t[73]=y,t[74]=P,t[75]=F):F=t[75];let I;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[76]=I):I=t[76];let L;return t[77]!==x||t[78]!==S||t[79]!==C||t[80]!==F?(L=(0,Z.jsxs)(`div`,{"data-testid":x,className:S,children:[C,F,I]}),t[77]=x,t[78]=S,t[79]=C,t[80]=F,t[81]=L):L=t[81],L}function EP(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function DP(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var OP=`ok-terminal-height-v1`,kP=1/3,AP=.5;function jP(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*AP))}function MP(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*kP)}function NP(e,t){let n=jP(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(MP(t),n)}function PP(){return typeof window>`u`?0:window.innerHeight}function FP(e,t){try{let n=e??localStorage,r=t??PP(),i=n.getItem(OP);if(i==null)return NP(MP(r),r);let a=Number.parseInt(i,10);return NP(Number.isFinite(a)?a:MP(r),r)}catch{return 240}}function IP(e,t,n){try{let r=t??localStorage,i=n??PP();r.setItem(OP,String(NP(e,i)))}catch{}}function LP(){try{return typeof localStorage>`u`?240:FP()}catch{return 240}}function RP(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=an(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`0SBTff`}),t[0]=a,t[1]=s);let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[2]!==i||t[3]!==l?(u=wi(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=o?(0,Z.jsx)(Za,{"aria-hidden":`true`}):(0,Z.jsx)(Jt,{"aria-hidden":`true`}),t[5]=o,t[6]=d);let f;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[7]=n,t[8]=c,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=o?`left`:`top`,m;t[13]!==c||t[14]!==p?(m=(0,Z.jsx)(Hs,{side:p,sideOffset:8,children:c}),t[13]=c,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(Ws,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}var zP=`terminal-dock-panel`;function BP(e){let t=(0,$.c)(44),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c}=e,l=a===void 0?`bottom`:a,{resolvedTheme:u}=tr(),d=PC(),[f,p]=(0,Q.useState)(!r),m;t[0]===u?m=t[1]:(m=yu(u),t[0]=u,t[1]=m);let h=m.background,g=r&&l===`bottom`,_=!r&&l===`bottom`&&c!=null,[v]=(0,Q.useState)(VP),y=(0,Q.useRef)(v),[b,x]=(0,Q.useState)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(e){C.current!=null&&clearTimeout(C.current),C.current=setTimeout(()=>{IP(e),C.current=null},100)},t[2]=w):w=t[2];let T=w,E=(0,Q.useRef)(null),D,O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{C.current!=null&&clearTimeout(C.current),E.current!=null&&(window.removeEventListener(`pointerup`,E.current),E.current=null)},O=[],t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,Q.useEffect)(D,O);let k,A;t[5]!==g||t[6]!==d?(k=()=>{let e=d.current;e!=null&&(g?e.resize(`${y.current}px`):e.collapse())},A=[g,d],t[5]=g,t[6]=d,t[7]=k,t[8]=A):(k=t[7],A=t[8]),(0,Q.useEffect)(k,A);let j=b||void 0,M;t[9]!==c||t[10]!==_?(M=_&&c?(0,Z.jsx)(RP,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[9]=c,t[10]=_,t[11]=M):M=t[11];let N;t[12]!==n||t[13]!==s||t[14]!==M?(N=(0,Z.jsx)(PE,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,M]})}),t[12]=n,t[13]=s,t[14]=M,t[15]=N):N=t[15];let P=!g,F;t[16]===g?F=t[17]:(F=()=>{if(!g)return;x(!0),S.current=!0;let e=()=>{x(!1),S.current=!1,window.removeEventListener(`pointerup`,e),E.current=null};E.current=e,window.addEventListener(`pointerup`,e)},t[16]=g,t[17]=F);let I;t[18]!==g||t[19]!==P||t[20]!==F?(I=(0,Z.jsx)(FE,{withHandle:g,disabled:P,onPointerDown:F}),t[18]=g,t[19]=P,t[20]=F,t[21]=I):I=t[21];let L;t[22]===h?L=t[23]:(L={backgroundColor:h},t[22]=h,t[23]=L);let R=g?`${v}px`:0,z;t[24]!==i||t[25]!==r?(z=e=>{let t=e.asPercentage===0;p(t),S.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(y.current=e.inPixels,T(e.inPixels)))},t[24]=i,t[25]=r,t[26]=z):z=t[26];let B=!b&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,V;t[27]===B?V=t[28]:(V=wi(`flex flex-col`,B),t[27]=B,t[28]=V);let H;t[29]===o?H=t[30]:(H=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[29]=o,t[30]=H);let U;t[31]!==f||t[32]!==d||t[33]!==L||t[34]!==R||t[35]!==z||t[36]!==V||t[37]!==H?(U=(0,Z.jsx)(PE,{id:zP,style:L,panelRef:d,defaultSize:R,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:z,inert:f,className:V,children:H}),t[31]=f,t[32]=d,t[33]=L,t[34]=R,t[35]=z,t[36]=V,t[37]=H,t[38]=U):U=t[38];let W;return t[39]!==N||t[40]!==I||t[41]!==U||t[42]!==j?(W=(0,Z.jsxs)(NE,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":j,children:[N,I,U]}),t[39]=N,t[40]=I,t[41]=U,t[42]=j,t[43]=W):W=t[43],W}function VP(){return LP()}var HP=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CNxdYTCc.js`),__vite__mapDeps([48,1,2,49,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,64,65]),import.meta.url)).ActivityModeContent})),UP=`300px`,WP=`600px`,GP=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function KP(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(JP,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(qP,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(yl,{name:`editor-area`,children:(0,Z.jsxs)(Fa,{children:[n,r]})}),t[3]=n,t[4]=i),i}function qP(){let e=(0,$.c)(5),t=Vi(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==n?(r=(0,Z.jsx)(OE,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function JP(e){let t=(0,$.c)(237),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,onTerminalPlacement:u,onRevealTerminal:d}=e,f=s===void 0?!1:s,p=l===void 0?`right`:l,{_:m}=an(),{resolvedTheme:h}=tr(),g;t[0]===h?g=t[1]:(g=yu(h),t[0]=h,t[1]=g);let _=g.background,{activeDocName:v,activeProvider:y,activeTarget:b,recycleDocument:x,docPanelMode:S,docPanelAgentId:C,docPanelExpandSignal:w}=pt(),{openDocumentTransition:T}=Dt(),{requestAddProperty:E}=Ma(),D=rD(y,v),O=oD(v,n===`source`?`source`:`wysiwyg`),k=jD(y),A=k===`connected`||k===`synced`,j=aD(v)===`conflict`,[M,N]=(0,Q.useState)(!1),P,F;t[2]!==y||t[3]!==M?(P=()=>{y!=null&&!M&&N(!0)},F=[y,M],t[2]=y,t[3]=M,t[4]=P,t[5]=F):(P=t[4],F=t[5]),(0,Q.useEffect)(P,F);let I=(0,Q.useDeferredValue)(v),L=b?.kind===`missing`,R=!!v&&b?.kind!==`folder`,z;t[6]!==m||t[7]!==L?(z=L?m({id:`K-a33w`}):void 0,t[6]=m,t[7]=L,t[8]=z):z=t[8];let B=z,[V]=(0,Q.useState)($P),H=V!==null,U;t[9]===V?U=t[10]:(U=()=>hD(V,window.innerWidth,`right`),t[9]=V,t[10]=U);let[W,G]=(0,Q.useState)(U),K=(0,Q.useRef)(W),ee,q;t[11]===W?(ee=t[12],q=t[13]):(ee=()=>{K.current=W},q=[W],t[11]=W,t[12]=ee,t[13]=q),(0,Q.useEffect)(ee,q);let J=PC(),ne=PC(),re;t[14]===W?re=t[15]:(re=()=>wD(`right`,W,SD())===`collapsed`,t[14]=W,t[15]=re);let[ie]=(0,Q.useState)(re),[ae,oe]=(0,Q.useState)(ie),se=(0,Q.useRef)(ae),[ce,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(null),me=p===`right`,he=me?`right`:`bottom`,ge=o!=null&&me&&f,_e=o!=null&&!f&&d!=null,ve=_e&&!me,ye=_e&&me,be=me&&f&&ce!=null,xe=be?ce:ue,Se=(me?be:f)&&xe!=null,Ce,we;t[16]!==xe||t[17]!==u||t[18]!==he||t[19]!==fe||t[20]!==Se?(Ce=()=>{u?.({container:xe,isShowing:Se,dockPosition:he,editorRegion:fe})},we=[u,xe,Se,he,fe],t[16]=xe,t[17]=u,t[18]=he,t[19]=fe,t[20]=Se,t[21]=Ce,t[22]=we):(Ce=t[21],we=t[22]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[23]===ae?(Te=t[24],Ee=t[25]):(Te=()=>{se.current=ae},Ee=[ae],t[23]=ae,t[24]=Te,t[25]=Ee),(0,Q.useEffect)(Te,Ee);let[De,Oe]=(0,Q.useState)(!1),ke=(0,Q.useRef)(!1),[Ae]=(0,Q.useState)(QP),je=(0,Q.useRef)(Ae),Ne=(0,Q.useRef)(null),Pe;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=function(e){Ne.current!=null&&clearTimeout(Ne.current),Ne.current=setTimeout(()=>{uD(e),Ne.current=null},100)},t[26]=Pe):Pe=t[26];let Fe=Pe,[Ie]=(0,Q.useState)(ZP),Le=(0,Q.useRef)(Ie),[Re,ze]=(0,Q.useState)(!1),Be=(0,Q.useRef)(!1),Ve=(0,Q.useRef)(null),He;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(He=function(e){Ve.current!=null&&clearTimeout(Ve.current),Ve.current=setTimeout(()=>{kD(e),Ve.current=null},100)},t[27]=He):He=t[27];let Ue=He,We,Ge;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(We=()=>()=>{Ne.current!=null&&clearTimeout(Ne.current),Ve.current!=null&&clearTimeout(Ve.current)},Ge=[],t[28]=We,t[29]=Ge):(We=t[28],Ge=t[29]),(0,Q.useEffect)(We,Ge);let[Ke,qe]=(0,Q.useState)(null),Je=(0,Q.useRef)(null),Ye=kC(),Xe=(0,Q.useRef)(ge),Ze,Qe;t[30]===ge?(Ze=t[31],Qe=t[32]):(Ze=()=>{Xe.current=ge},Qe=[ge],t[30]=ge,t[31]=Ze,t[32]=Qe),(0,Q.useEffect)(Ze,Qe);let $e;t[33]!==J||t[34]!==ne?($e=function(){for(let e of[J,ne]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=Je.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[33]=J,t[34]=ne,t[35]=$e):$e=t[35];let et=$e,tt;t[36]!==Ye||t[37]!==et?(tt=function(e){if(ke.current||Be.current)return;let t=Ye.current;if(t!=null)try{let n=et();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(XP);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:je.current),`terminal-column`in r&&(o[`terminal-column`]=Le.current),Object.keys(o).length===0)return;let s=DP({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[36]=Ye,t[37]=et,t[38]=tt):tt=t[38];let nt=tt,rt=(0,Q.useRef)(nt),it;t[39]===nt?it=t[40]:(it=()=>{rt.current=nt},t[39]=nt,t[40]=it),(0,Q.useEffect)(it);let at;t[41]!==nt||t[42]!==J?(at=function(){Xe.current?nt(!1):J.current?.expand()},t[41]=nt,t[42]=J,t[43]=at):at=t[43];let ot=at,st;t[44]!==nt||t[45]!==ae||t[46]!==J?(st=function(){if(J.current==null)return;let e=K.current;ae?(TD(`right`,e,`open`),Xe.current?nt(!1):J.current?.expand()):(TD(`right`,e,`collapsed`),Xe.current?nt(!0):J.current?.collapse())},t[44]=nt,t[45]=ae,t[46]=J,t[47]=st):st=t[47];let ct=st,lt,ut;t[48]!==nt||t[49]!==V||t[50]!==J?(lt=()=>{let e=window.matchMedia(`(min-width: ${pD}px)`),t=()=>{let e=hD(V,window.innerWidth,`right`);G(e);let t=wD(`right`,e,SD())===`collapsed`;oe(t),Xe.current?nt(t):t?J.current?.collapse():J.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ut=[V,J,nt],t[48]=nt,t[49]=V,t[50]=J,t[51]=lt,t[52]=ut):(lt=t[51],ut=t[52]),(0,Q.useEffect)(lt,ut);let dt,ft;t[53]!==Ke||t[54]!==H?(dt=()=>{if(Ke==null||H)return;let e=new ResizeObserver(()=>{rt.current(se.current)});return e.observe(Ke),()=>e.disconnect()},ft=[Ke,H],t[53]=Ke,t[54]=H,t[55]=dt,t[56]=ft):(dt=t[55],ft=t[56]),(0,Q.useEffect)(dt,ft);let mt,ht;t[57]!==ot||t[58]!==a?(mt=()=>{let e=e=>{a(e),ot()},t=dv();return t&&e(t),pv(t=>{dv(),e(t)})},ht=[a,ot],t[57]=ot,t[58]=a,t[59]=mt,t[60]=ht):(mt=t[59],ht=t[60]),(0,Q.useEffect)(mt,ht);let gt,_t;t[61]!==w||t[62]!==ot?(gt=()=>{w!==0&&ot()},_t=[w,ot],t[61]=w,t[62]=ot,t[63]=gt,t[64]=_t):(gt=t[63],_t=t[64]),(0,Q.useEffect)(gt,_t);let vt=(0,Q.useRef)(ge),yt,bt;t[65]!==ae||t[66]!==ge?(yt=()=>{if(vt.current===ge)return;vt.current=ge;let e=ae;queueMicrotask(()=>{rt.current(e)})},bt=[ge,ae],t[65]=ae,t[66]=ge,t[67]=yt,t[68]=bt):(yt=t[67],bt=t[68]),(0,Q.useLayoutEffect)(yt,bt);let xt,St;t[69]===ae?(xt=t[70],St=t[71]):(xt=()=>{if(!ae||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},St=[ae],t[69]=ae,t[70]=xt,t[71]=St),(0,Q.useLayoutEffect)(xt,St);let Ct,wt;t[72]===ae?(Ct=t[73],wt=t[74]):(Ct=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!ae})},wt=[ae],t[72]=ae,t[73]=Ct,t[74]=wt),(0,Q.useEffect)(Ct,wt);let Tt,Et;t[75]===ct?(Tt=t[76],Et=t[77]):(Tt=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&ct()})},Et=[ct],t[75]=ct,t[76]=Tt,t[77]=Et),(0,Q.useEffect)(Tt,Et);let Ot,kt;t[78]===ct?(Ot=t[79],kt=t[80]):(Ot=()=>{if(window.okDesktop!=null)return;let e=e=>{El(e,`toggle-document-panel`)&&(e.preventDefault(),ct())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},kt=[ct],t[78]=ct,t[79]=Ot,t[80]=kt),(0,Q.useEffect)(Ot,kt);let At=(0,Q.useRef)(null),[jt,Mt]=(0,Q.useState)(null),[Nt,Pt]=(0,Q.useState)(!1),Ft=b?.kind===`large-file`?b.docName:v,It,Lt;t[81]===Ft?(It=t[82],Lt=t[83]):(It=()=>{if(Ft&&Ft!==At.current){let e=At.current;At.current=Ft,Mt(e)}},Lt=[Ft],t[81]=Ft,t[82]=It,t[83]=Lt),(0,Q.useEffect)(It,Lt);let Rt;t[84]===T?Rt=t[85]:(Rt=function(e){let t=Jc(e);window.location.hash===t?T(e):window.location.hash=t},t[84]=T,t[85]=Rt);let zt=Rt,Bt,Vt=null;if(b?.kind===`large-file`){let e;t[86]!==zt||t[87]!==jt?(e=jt?{previousDocName:jt,onNavigateBack:zt}:void 0,t[86]=zt,t[87]=jt,t[88]=e):e=t[88];let n;t[89]!==b.docName||t[90]!==b.limit||t[91]!==b.size||t[92]!==e?(n=(0,Z.jsx)(dE,{docName:b.docName,size:b.size,limit:b.limit,backNav:e}),t[89]=b.docName,t[90]=b.limit,t[91]=b.size,t[92]=e,t[93]=n):n=t[93],Bt=n}else if(b?.kind===`folder`){let e;t[94]!==H||t[95]!==f?(e=sO({terminalVisible:f,isEmbedded:H}),t[94]=H,t[95]=f,t[96]=e):e=t[96];let n=e,r;t[97]===b.folderPath?r=t[98]:(r=(0,Z.jsx)(sE,{folderPath:b.folderPath}),t[97]=b.folderPath,t[98]=r);let i;t[99]!==b.folderPath||t[100]!==n?(i=n?(0,Z.jsx)(JD,{folderPath:b.folderPath}):null,t[99]=b.folderPath,t[100]=n,t[101]=i):i=t[101];let a;if(t[102]!==r||t[103]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[r,i]}),t[102]=r,t[103]=i,t[104]=a):a=t[104],Bt=a,S===`agent`&&C!==null){let e;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(FE,{withHandle:!0}),t[105]=e):e=t[105];let n;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(PE,{id:`agent-panel`,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(HP,{showBackButton:!1})})})]}),t[106]=n):n=t[106],Vt=n}}else if(b?.kind===`asset`){let e;t[107]!==b.assetPath||t[108]!==b.mediaKind?(e=(0,Z.jsx)(YC,{assetPath:b.assetPath,mediaKind:b.mediaKind},b.assetPath),t[107]=b.assetPath,t[108]=b.mediaKind,t[109]=e):e=t[109],Bt=e}else if(b?.kind===`skill-file`){let e=`${b.scope}/${b.name}/${b.path}`,n;t[110]!==b.name||t[111]!==b.path||t[112]!==b.scope||t[113]!==e?(n=(0,Z.jsx)(yE,{scope:b.scope,name:b.name,path:b.path},e),t[110]=b.name,t[111]=b.path,t[112]=b.scope,t[113]=e,t[114]=n):n=t[114],Bt=n}else if(!y||!v)if((typeof window<`u`?_l(window.location.hash):null)!==null)if(o!=null&&M){let e;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(XC,{}),t[115]=e):e=t[115],Bt=e;let n;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(FE,{withHandle:!0,disabled:!0}),t[116]=n):n=t[116];let r=ie?0:`${Ae}px`,i;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[117]=i):i=t[117];let a;t[118]===r?a=t[119]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(PE,{id:`doc-panel`,defaultSize:r,minSize:UP,maxSize:WP,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[118]=r,t[119]=a),Vt=a}else{let e;return t[120]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(XC,{}),t[120]=e):e=t[120],e}else{let e=f&&he===`bottom`,n;t[121]===e?n=t[122]:(n=(0,Z.jsx)(OT,{terminalVisible:e}),t[121]=e,t[122]=n),Bt=n}else{let e=n===`source`,o=!A,s=ae,c;t[123]!==v||t[124]!==E?(c=function(){v&&E(v)},t[123]=v,t[124]=E,t[125]=c):c=t[125];let l=c,u;t[126]!==v||t[127]!==H||t[128]!==f?(u=oO({terminalVisible:f,isEmbedded:H,activeDocName:v}),t[126]=v,t[127]=H,t[128]=f,t[129]=u):u=t[129];let d=u,p=I??v,m=jt??void 0,h;t[130]!==B||t[131]!==e||t[132]!==zt||t[133]!==x||t[134]!==p||t[135]!==m?(h=(0,Z.jsx)(oN,{activeDocName:p,isSourceMode:e,editorPlaceholder:B,previousDocName:m,onNavigateBack:zt,onRecycle:x}),t[130]=B,t[131]=e,t[132]=zt,t[133]=x,t[134]=p,t[135]=m,t[136]=h):h=t[136];let g;t[137]!==v||t[138]!==e?(g=(0,Z.jsx)($E,{activeDocName:v,isSourceMode:e}),t[137]=v,t[138]=e,t[139]=g):g=t[139];let _;t[140]!==v||t[141]!==I?(_=EP({activeDocName:v,deferredActiveDocName:I,mountResolved:v!==null&&te(v),syncResolved:v!==null&&Me(v)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(XC,{}),v===null?null:(0,Z.jsx)(fE,{docName:v})]}):null,t[140]=v,t[141]=I,t[142]=_):_=t[142];let y;t[143]!==h||t[144]!==g||t[145]!==_?(y=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,_]}),t[143]=h,t[144]=g,t[145]=_,t[146]=y):y=t[146];let b;t[147]!==v||t[148]!==j||t[149]!==s||t[150]!==e||t[151]!==r||t[152]!==l||t[153]!==ye||t[154]!==o||t[155]!==ct?(b=!j&&(0,Z.jsx)(TP,{activeDocName:v,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:ct,reserveRightGutter:ye&&s}),t[147]=v,t[148]=j,t[149]=s,t[150]=e,t[151]=r,t[152]=l,t[153]=ye,t[154]=o,t[155]=ct,t[156]=b):b=t[156];let C;t[157]!==v||t[158]!==Nt||t[159]!==e||t[160]!==d?(C=d?(0,Z.jsx)(JD,{docName:v,surface:e?`source`:`wysiwyg`,dismissed:Nt,onDismiss:()=>Pt(!0),onReopen:()=>Pt(!1)}):null,t[157]=v,t[158]=Nt,t[159]=e,t[160]=d,t[161]=C):C=t[161];let w;t[162]!==y||t[163]!==b||t[164]!==C?(w=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[y,b,C]}),t[162]=y,t[163]=b,t[164]=C,t[165]=w):w=t[165];let T;t[166]!==Nt||t[167]!==d?(T=d&&Nt?{onReopen:()=>Pt(!1)}:null,t[166]=Nt,t[167]=d,t[168]=T):T=t[168];let k;t[169]!==ve||t[170]!==O||t[171]!==R||t[172]!==D||t[173]!==T?(k=(0,Z.jsx)(sP,{stats:D,selectionStats:O,showStats:R,composerBadge:T,reserveRightGutter:ve}),t[169]=ve,t[170]=O,t[171]=R,t[172]=D,t[173]=T,t[174]=k):k=t[174];let M;t[175]!==w||t[176]!==k?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[w,k]}),t[175]=w,t[176]=k,t[177]=M):M=t[177],Bt=M;let N=ge&&ae,P=!ae,F;t[178]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{Oe(!0),ke.current=!0;let e=()=>{Oe(!1),ke.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[178]=F):F=t[178];let L;t[179]!==ae||t[180]!==P?(L=(0,Z.jsx)(FE,{withHandle:P,disabled:ae,onPointerDown:F}),t[179]=ae,t[180]=P,t[181]=L):L=t[181];let z=ie?0:`${Ae}px`,V=N?`0px`:UP,U;t[182]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{oe(e.asPercentage===0),e.inPixels>0&&ke.current&&(je.current=e.inPixels,Fe(e.inPixels))},t[182]=U):U=t[182];let W=!De&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,G;t[183]===W?G=t[184]:(G=wi(`flex flex-col bg-muted/20`,W),t[183]=W,t[184]=G);let K;t[185]!==v||t[186]!==i||t[187]!==S||t[188]!==e||t[189]!==a?(K=(0,Z.jsx)(zx,{docName:v,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:S}),t[185]=v,t[186]=i,t[187]=S,t[188]=e,t[189]=a,t[190]=K):K=t[190];let ee;t[191]!==N||t[192]!==ae||t[193]!==J||t[194]!==z||t[195]!==V||t[196]!==G||t[197]!==K?(ee=(0,Z.jsx)(PE,{id:`doc-panel`,panelRef:J,disabled:N,defaultSize:z,minSize:V,maxSize:WP,collapsible:!0,collapsedSize:0,onResize:U,inert:ae,className:G,children:K}),t[191]=N,t[192]=ae,t[193]=J,t[194]=z,t[195]=V,t[196]=G,t[197]=K,t[198]=ee):ee=t[198];let q;t[199]!==L||t[200]!==ee?(q=(0,Z.jsxs)(Z.Fragment,{children:[L,ee]}),t[199]=L,t[200]=ee,t[201]=q):q=t[201],Vt=q}let Ht;t[202]!==d||t[203]!==c||t[204]!==o||t[205]!==he||t[206]!==f||t[207]!==Bt?(Ht=o==null?Bt:(0,Z.jsx)(BP,{visible:f,onVisibleChange:c??YP,dockPosition:he,onBottomContainer:de,onEditorRegion:pe,onReveal:d,children:Bt}),t[202]=d,t[203]=c,t[204]=o,t[205]=he,t[206]=f,t[207]=Bt,t[208]=Ht):Ht=t[208];let Ut=Ht,Wt;t[209]!==Ie||t[210]!==Re||t[211]!==c||t[212]!==ne||t[213]!==ge||t[214]!==_?(Wt=ge?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(FE,{withHandle:!0,onPointerDown:()=>{ze(!0),Be.current=!0;let e=()=>{ze(!1),Be.current=!1,window.removeEventListener(`pointerup`,e),ne.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(PE,{id:`terminal-column`,panelRef:ne,style:{backgroundColor:_},defaultSize:`${Ie}px`,minSize:`320px`,maxSize:`900px`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&Be.current&&(Le.current=e.inPixels,Ue(e.inPixels))},className:wi(`flex flex-col`,!Re&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:le,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[209]=Ie,t[210]=Re,t[211]=c,t[212]=ne,t[213]=ge,t[214]=_,t[215]=Wt):Wt=t[215];let Gt=Wt,Kt=Vt!=null&&!ie||ge,qt;t[216]===Symbol.for(`react.memo_cache_sentinel`)?(qt=e=>{qe(e),Je.current=e},t[216]=qt):qt=t[216];let Jt=De||Re||void 0,Yt;t[217]===Kt?Yt=t[218]:(Yt=Kt?{}:{defaultSize:`100%`},t[217]=Kt,t[218]=Yt);let Xt=!(De||Re)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Zt;t[219]===Xt?Zt=t[220]:(Zt=wi(Xt),t[219]=Xt,t[220]=Zt);let Qt;t[221]!==Ut||t[222]!==Yt||t[223]!==Zt?(Qt=(0,Z.jsx)(PE,{minSize:`30%`,...Yt,className:Zt,children:Ut}),t[221]=Ut,t[222]=Yt,t[223]=Zt,t[224]=Qt):Qt=t[224];let $t;t[225]!==Ye||t[226]!==Vt||t[227]!==Jt||t[228]!==Qt||t[229]!==Gt?($t=(0,Z.jsxs)(NE,{orientation:`horizontal`,groupRef:Ye,"data-dragging":Jt,children:[Qt,Vt,Gt]}),t[225]=Ye,t[226]=Vt,t[227]=Jt,t[228]=Qt,t[229]=Gt,t[230]=$t):$t=t[230];let en;t[231]!==d||t[232]!==ye?(en=ye?(0,Z.jsx)(RP,{dockPosition:`right`,onReveal:d,className:`top-2.5 right-0`}):null,t[231]=d,t[232]=ye,t[233]=en):en=t[233];let tn;return t[234]!==$t||t[235]!==en?(tn=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:qt,children:[$t,en]}),t[234]=$t,t[235]=en,t[236]=tn):tn=t[236],tn}function YP(){}function XP(e){return!GP.has(e)}function ZP(){return AD()}function QP(){return dD()}function $P(){return Fr()}function eF(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function tF(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var nF=1e3,rF=!1;function iF(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function aF(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:xs(i)?a=i:(a=void 0,rF||(rF=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(iF({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=tF(i),{current:c,crossDoc:l}=a?_s(a,n,Date.now()):{current:[],crossDoc:[]},u=oF,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>eF(e.current,p)&&eF(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,nF);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function oF(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var sF=`sync-status`;async function cF(e){try{let t=await Oy(e);t.ok||Ss.error(t.message,{id:sF,duration:1/0})}catch{}}function lF(e,t){let n=(0,$.c)(6),{_:r}=an(),i=Ig(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){Ss.dismiss(sF);return}o.current=!0;let e=window.okDesktop;Ss.warning(r({id:`HGNCsl`}),{id:sF,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{cF(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,Ss.success(r({id:`GhjUB_`}),{id:sF,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var uF=4,dF=3,fF={Bird:od,Cat:pd,Dog:xd,Fish:Dd,Mouse:of,Rabbit:af,Shrimp:ff,Snail:pf,Squirrel:_f,Turtle:Df};Object.freeze(Object.keys(fF));function pF(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(fF,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var mF={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function hF(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=an(),o=pF(n),s=o.kind===`animal`?fF[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=Or(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=fi(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(Hs,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(Ws,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function gF(e){let t=mF[e.icon];return e.displayName||t||Ms._({id:`iEQQyu`})}function _F(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function vF(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=an(),{activeDocName:s}=pt(),{presence:c,agentId:l}=n,u=gF(c),d=_F(c.mode),f=!r&&d,p=c.currentDoc&&c.currentDoc!==`(connected)`?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(ys,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(ys,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(Vs,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(Hs,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(Ws,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function yF(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?Ms._({id:`9euN0m`,values:{count:n}}):Ms._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(hF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(vF,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(Tt,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(w,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function bF(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(hF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(vF,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function xF(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=pt(),{current:s,crossDoc:c}=aF(t,r,n);if(lF(jD(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,uF),n;e[6]===s?n=e[7]:(n=s.slice(uF),e[6]=s,e[7]=n);let r=n,u=c.slice(0,dF),d;e[8]===c?d=e[9]:(d=c.slice(dF),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>bF(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(yF,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>bF(e,p,!0,m)),f.length>0?(0,Z.jsx)(yF,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function SF(e,t){return t.trim()}function CF(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function wF(e,t){let n=SF(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function TF(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(dl(e)){let t=s.get(Iu(e.docName,e.docExt));if(t){let n=ol(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:qn(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(cl(e))return{...e,path:MF(e.path,n)};if(il(e)){let t=s.get(e.path);return t&&xl(t)?{kind:`document`,docName:Su(t),docExt:Cl(t),size:e.size,modified:e.modified}:{...e,path:t??MF(e.path,n)}}return e})}function EF(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>dl(e)?!i.has(e.docName)&&!IF(e.docName,n):cl(e)?!IF(e.path,n):il(e)?!a.has(e.path)&&!IF(e.path,n):!0)}function DF(e,t){if(e.kind!==`asset`||t.some(t=>il(t)&&t.path===e.path))return e;let n=zu(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function OF(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>NF(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>dl(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>cl(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(dl(i)){let e=FF(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(cl(i)){let e=PF(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function kF(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function AF(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function jF(e,t){let n=e.kind===`file`?Iu(e.path,e.docExt):e.path;return co(t.contentDir,n,t.pathSeparator)}function MF(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function NF(e,t){return dl(e)&&dl(t)?e.docName===t.docName:cl(e)&&cl(t)||il(e)&&il(t)?e.path===t.path:!1}function PF(e,t,n){return e===t?n:FF(e,t,n)}function FF(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function IF(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function LF(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)(Op,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function RF(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=wi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(kp,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zF(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(Mp,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function BF(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)(Rp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function VF(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=wi(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ap,{children:(0,Z.jsx)(jp,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function HF(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=wi(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(Pp,{"data-slot":`context-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function UF(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=wi(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Qa,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(zp,{"data-slot":`context-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function WF(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=wi(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Bp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function GF(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=wi(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(Ip,{children:(0,Z.jsx)(Ha,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,Z.jsxs)(Fp,{"data-slot":`context-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function KF(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=wi(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Np,{"data-slot":`context-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function qF(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=wi(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Lp,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var JF=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,YF=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,XF={start:[es.Space],cancel:[es.Esc],end:[es.Space,es.Enter]};function ZF(e){return wi(JF,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function QF(e){return e?void 0:-1}function $F({className:e,isDragging:t}){return wi(e,t&&YF)}function eI(e){return e.code===es.Enter&&e.target===e.currentTarget}function tI({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&eI(e)?`activate-tab`:`delegate-sortable`}function nI({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:as.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function rI(e){let t=e?.querySelectorAll(`[data-editor-tab-sortable]`)??[],n=1/0,r=-1/0;for(let e of t){let t=e.getBoundingClientRect();n=Math.min(n,t.left),r=Math.max(r,t.right)}return Number.isFinite(n)&&Number.isFinite(r)?{left:n,right:r}:null}function iI(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var aI=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return Jo(e)},oI=[`.md`,`.mdx`],sI=`group relative -mb-px flex h-10 min-w-28 max-w-64 shrink-0 cursor-pointer items-center overflow-hidden border border-transparent font-medium transition-colors`,cI=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,lI=wi(cI,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),uI=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function dI(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function fI(e){let t=Jc(e);window.location.hash!==t&&(window.location.hash=t)}function pI(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function mI(e,t){let n=[t,...oI].filter((e,t,n)=>e&&n.indexOf(e)===t),r=e.toLowerCase(),i=n.find(t=>e.length>t.length&&r.endsWith(t.toLowerCase()));return i?e.slice(0,-i.length):e}function hI(e){let t=(0,$.c)(37),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({activateFromKeyboard:n,className:r,tabId:l,disabled:i,onKeyDown:a,ref:o,style:s,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u;t[9]!==i||t[10]!==l?(u={id:l,disabled:i},t[9]=i,t[10]=l,t[11]=u):u=t[11];let{attributes:d,listeners:f,rect:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=rs(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=nI({activeWidth:v,isDragging:_,outerStyle:s,transform:h,transition:g}),t[12]=_,t[13]=s,t[14]=v,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=y,x;t[18]!==o||t[19]!==m?(x=function(e){m(e),typeof o==`function`?o(e):o&&`current`in o&&(o.current=e)},t[18]=o,t[19]=m,t[20]=x):x=t[20];let S=x,C=f?.onKeyDown,w;t[21]!==n||t[22]!==_||t[23]!==a||t[24]!==C?(w=function(e){a?.(e);let t=tI({event:e,hasKeyboardActivation:!!n,isDragging:_});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}C?.(e)}},t[21]=n,t[22]=_,t[23]=a,t[24]=C,t[25]=w):w=t[25];let T=w,E;t[26]!==r||t[27]!==_?(E=$F({className:r,isDragging:_}),t[26]=r,t[27]=_,t[28]=E):E=t[28];let D;return t[29]!==d||t[30]!==S||t[31]!==T||t[32]!==f||t[33]!==c||t[34]!==b||t[35]!==E?(D=(0,Z.jsx)(`div`,{ref:S,"data-editor-tab-sortable":``,className:E,style:b,...c,...d,...f,onKeyDown:T}),t[29]=d,t[30]=S,t[31]=T,t[32]=f,t[33]=c,t[34]=b,t[35]=E,t[36]=D):D=t[36],D}function gI(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=De(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=De(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y;t[13]===n?y=t[14]:(y=(0,Z.jsx)(RF,{asChild:!0,children:n}),t[13]=n,t[14]=y);let b;t[15]!==r||t[16]!==u?(b=()=>r(u),t[15]=r,t[16]=u,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Y,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(HF,{disabled:m,onSelect:b,children:x}),t[19]=m,t[20]=b,t[21]=S):S=t[21];let C=g.length===0,w;t[22]!==i||t[23]!==g?(w=()=>{i(g)},t[22]=i,t[23]=g,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Y,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(HF,{disabled:C,onSelect:w,children:T}),t[26]=C,t[27]=w,t[28]=E):E=t[28];let D=v.length===0,O;t[29]!==v||t[30]!==i?(O=()=>{i(v)},t[29]=v,t[30]=i,t[31]=O):O=t[31];let k;t[32]===l.length?k=t[33]:(k=l.length?(0,Z.jsx)(Y,{id:`U2Kx6T`}):(0,Z.jsx)(Y,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(HF,{disabled:D,"data-testid":`editor-tab-context-close-all`,onSelect:O,children:k}),t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==f||t[39]!==m||t[40]!==c||t[41]!==u||t[42]!==d?(j=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qF,{}),(0,Z.jsx)(HF,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(Y,{id:`SYfHmN`}):(0,Z.jsx)(Y,{id:`3pU8e-`})})]}),t[38]=f,t[39]=m,t[40]=c,t[41]=u,t[42]=d,t[43]=j):j=t[43];let M;t[44]!==E||t[45]!==A||t[46]!==j||t[47]!==S?(M=(0,Z.jsxs)(VF,{className:`min-w-40`,children:[S,E,A,j]}),t[44]=E,t[45]=A,t[46]=j,t[47]=S,t[48]=M):M=t[48];let N;return t[49]!==M||t[50]!==y?(N=(0,Z.jsxs)(LF,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function _I(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:i,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=an();if(a){let e;t[0]!==c||t[1]!==n?(e=c({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=c,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==o||t[4]!==s?(r=e=>{e.stopPropagation(),s(o)},t[3]=o,t[4]=s,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(rf,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let l;t[10]!==c||t[11]!==n?(l=c({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=c,t[11]=n,t[12]=l):l=t[12];let u;t[13]===i?u=t[14]:(u=ZF(i),t[13]=i,t[14]=u);let d;t[15]===i?d=t[16]:(d=QF(i),t[15]=i,t[16]=d);let f;t[17]!==r||t[18]!==o?(f=e=>{e.stopPropagation(),r(o)},t[17]=r,t[18]=o,t[19]=f):f=t[19];let p;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Cs,{"aria-hidden":`true`}),t[20]=p):p=t[20];let m;return t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f?(m=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:u,tabIndex:d,onClick:f,children:p}),t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=m):m=t[25],m}function vI(e){let t=(0,$.c)(1),{docName:n}=e;if(aD(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(eo,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function yI(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:c,closeNewTab:l,closeTab:u,closeTabs:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,newTabIds:h,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,remapTabsForRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:C}=pt(),{_:w}=an(),{pageMeta:T}=to(),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(t),H;e[0]!==n||e[1]!==t||e[2]!==i?(H=n??(i?Yt(i):t?en(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=H):H=e[3];let U=H,W;e[4]!==r||e[5]!==U||e[6]!==m||e[7]!==h||e[8]!==_?(W=m?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${h.join(`\0`)}`:U?`${U}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=U,e[6]=m,e[7]=h,e[8]=_,e[9]=W):W=e[9];let G=W,K,ee;e[10]===t?(K=e[11],ee=e[12]):(K=()=>{V.current=t},ee=[t],e[10]=t,e[11]=K,e[12]=ee),(0,Q.useEffect)(K,ee);let te,q;e[13]===G?(te=e[14],q=e[15]):(te=()=>{G&&(E.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},q=[G],e[13]=G,e[14]=te,e[15]=q),(0,Q.useEffect)(te,q);let J,re;e[16]===k?(J=e[17],re=e[18]):(J=()=>{k&&(L.current?.focus(),L.current?.select())},re=[k],e[16]=k,e[17]=J,e[18]=re),(0,Q.useEffect)(J,re);let ae,oe;e[19]!==_||e[20]!==k?(ae=()=>{!k||_.includes(k.tabId)||(z.current=!0,B.current=null,A(null),M(``),P(null),I(!1))},oe=[_,k],e[19]=_,e[20]=k,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);z.current=!1,B.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),P(null)},ce=function(){z.current=!0,B.current=null,A(null),M(``),P(null),I(!1)},le=async function(){if(z.current){z.current=!1;return}if(R.current)return;let e=k?.docName;if(!e){ce();return}let t=SF(`file`,mI(j,T.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===B.current){L.current?.focus();return}if(!CF(t)){P(w({id:`P8yDjG`})),L.current?.focus();return}let i=wF({kind:`file`,path:e,name:r},t);R.current=!0,I(!0),P(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(z.current){I(!1),R.current=!1;return}let r=await s(n,`Server error (HTTP ${n.status})`);if(!r.ok){P(r.title),I(!1),R.current=!1,B.current=t,L.current?.focus();return}let a=Ie(Nr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=V.current,l=kF(o,a);it(a);let u=!0;try{let e=AF(a,f(),p);await Promise.all(e.map(e=>c(e))),b(a),Os([`files`,`backlinks`,`graph`])}catch(n){let r=n;u=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),Ss.error(w({id:`MUBR8r`}))}z.current=!0,A(null),M(``),P(null),I(!1),R.current=!1,B.current=null,u&&l&&l!==o&&fI(l)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),P(w({id:`HIb0vl`})),I(!1),R.current=!1,B.current=t,L.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===h?de=e[24]:(de=new Set(h),e[23]=h,e[24]=de);let fe=de,pe;e[25]===D?pe=e[26]:(pe=iI(D),e[25]=D,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==l||e[30]!==d||e[31]!==fe?(ge=function(e){let t=[],n=[];for(let r of e)fe.has(r)?n.push(r):t.push(r);t.length>0&&d(t);for(let e of n)l(e)},e[29]=l,e[30]=d,e[31]=fe,e[32]=ge):ge=e[32];let _e=ge,ve;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ve={activationConstraint:{distance:8}},e[33]=ve):ve=e[33];let ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye={coordinateGetter:Zo,keyboardCodes:XF},e[34]=ye):ye=e[34];let be=is(Go(Yo,ve),Go(Qo,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){O(rI(E.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){O(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==x||e[39]!==C?(Te=function(e){we();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=C.indexOf(t),i=C.indexOf(n);r<0||i<0||r===i||x(ts([...C],r,i),t)},e[37]=we,e[38]=x,e[39]=C,e[40]=Te):Te=e[40];let Ee=Te,De=ue?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=wi(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,ue&&`[-webkit-app-region:drag]`),e[41]=Oe):Oe=e[41];let ke=pI,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=wi(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let je=qo,Me=aI,Ne;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={container:typeof document<`u`?document.body:void 0},e[43]=Ne):Ne=e[43];let Pe=$o,Fe;e[44]===C?Fe=e[45]:(Fe=[...C],e[44]=C,e[45]=Fe);let Le=Ko,Re=C.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(gI,{tabId:e,canPin:!1,openTabs:C,closeTab:l,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(hI,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:wi(sI,t?cI:lI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:uI,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(Y,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:ZF(t),tabIndex:QF(t),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(Cs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=ne(e),n=e===U,i=y.includes(e);if(t.kind===`folder`){let{baseName:r,label:o,prefix:s}=ie(t.folderPath,`/`),c=`${s}${o}`;return(0,Z.jsx)(gI,{tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(hI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:wi(sI,n?cI:lI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:uI,onClick:()=>{a(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:wi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:wi(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(_I,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}if(t.kind===`asset`||t.kind===`skill-file`){let{baseName:r,label:o,prefix:s}=ie(t.kind===`asset`?t.assetPath:t.path,``),c=`${s}${o}`;return(0,Z.jsx)(gI,{tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(hI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:wi(sI,n?cI:lI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:uI,onClick:()=>{a(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:wi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:wi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(_I,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}let s=t.docName,c=T.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=ie(s,c),h=`${m}${p}`,g=c===`.md`||c===`.mdx`,_=k?.tabId===e,b=`editor-tab-rename-error-${dI(s)}`;return(0,Z.jsx)(gI,{disabled:_,tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsx)(hI,{tabId:e,activateFromKeyboard:()=>a(e),disabled:_,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:wi(sI,n?cI:lI,_&&N&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(IE,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(VE,{ref:L,value:j,disabled:F,"aria-label":w({id:`Dw1T_W`,values:{label:p}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":N?!0:void 0,"aria-describedby":N?b:void 0,"aria-busy":F||void 0,title:N??s,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{M(mI(e.target.value,c)),P(null),B.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(RE,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(BE,{className:`text-muted-foreground/60 text-xs`,children:c})})]}),N?(0,Z.jsx)(`span`,{id:b,role:`alert`,className:`sr-only`,children:N}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":h,title:h,className:uI,onClick:()=>{a(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,s)},tabIndex:-1,children:[(0,Z.jsx)(vI,{docName:s}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),!g&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),(0,Z.jsx)(_I,{accessibleLabel:h,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})})},e)}),ze;e[46]!==Pe||e[47]!==Fe||e[48]!==Le||e[49]!==Re?(ze=(0,Z.jsx)(Pe,{items:Fe,strategy:Le,children:Re}),e[46]=Pe,e[47]=Fe,e[48]=Le,e[49]=Re,e[50]=ze):ze=e[50];let Be;e[51]!==je||e[52]!==we||e[53]!==Ee||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Me||e[58]!==Ne||e[59]!==ze||e[60]!==he?(Be=(0,Z.jsx)(je,{sensors:be,autoScroll:!1,collisionDetection:Me,modifiers:he,onDragStart:Se,onDragEnd:Ee,onDragCancel:we,accessibility:Ne,children:ze}),e[51]=je,e[52]=we,e[53]=Ee,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Me,e[58]=Ne,e[59]=ze,e[60]=he,e[61]=Be):Be=e[61];let Ve;e[62]===w?Ve=e[63]:(Ve=w({id:`3YvS-c`}),e[62]=w,e[63]=Ve);let He;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(Lt,{"aria-hidden":`true`}),e[64]=He):He=e[64];let Ue;e[65]!==g||e[66]!==Ve?(Ue=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:He})}),e[65]=g,e[66]=Ve,e[67]=Ue):Ue=e[67];let We;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`3YvS-c`})}),e[68]=We):We=e[68];let Ge;e[69]===Ue?Ge=e[70]:(Ge=(0,Z.jsxs)(Ws,{children:[Ue,We]}),e[69]=Ue,e[70]=Ge);let Ke;e[71]!==Ae||e[72]!==Be||e[73]!==Ge?(Ke=(0,Z.jsxs)(`div`,{className:Ae,children:[Be,Ge]}),e[71]=Ae,e[72]=Be,e[73]=Ge,e[74]=Ke):Ke=e[74];let qe;return e[75]!==De||e[76]!==Oe||e[77]!==ke||e[78]!==Ke?(qe=(0,Z.jsx)(`div`,{ref:E,"data-electron-drag":De,className:Oe,onWheel:ke,children:Ke}),e[75]=De,e[76]=Oe,e[77]=ke,e[78]=Ke,e[79]=qe):qe=e[79],qe}var bI=(e,t,n)=>{if(e&&`reportValidity`in e){let r=Ai(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},xI=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?bI(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>bI(t,n,e))}},SI=(e,t)=>{t.shouldUseNativeValidation&&xI(e,t);let n={};for(let r in e){let i=Ai(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(CI(t.names||Object.keys(e),r)){let e=Object.assign({},Ai(n,r));zi(e,`root`,a),zi(n,r,e)}else zi(n,r,a)}return n},CI=(e,t)=>{let n=wI(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>wI(e).match(`^${n}\\.\\d+`))};function wI(e){return e.replace(/[\[\]]/g,``)}function TI(){return TI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},TI.apply(null,arguments)}function EI(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function DI(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ji(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function OI(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(TI({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ji(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function kI(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(EI(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&xI({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:SI(DI(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(EI(function(){return Promise.resolve((n.mode===`sync`?Qn:hr)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&xI({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof yr}(e))return{values:{},errors:SI(OI(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var AI=`https://openknowledge.ai/api/subscribe`;async function jI(e,t){try{let n=await fetch(AI,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function MI(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=an(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let _,v;if(t[3]!==u){let e=Rn({email:lr({message:u({id:`Wq6Wcm`})})});v=ca,_=kI(e),t[3]=u,t[4]=_,t[5]=v}else _=t[4],v=t[5];let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y={email:``},t[6]=y):y=t[6];let b;t[7]===_?b=t[8]:(b={resolver:_,defaultValues:y},t[7]=_,t[8]=b);let x=v(b),{isSubmitting:S}=x.formState,C=x.formState.errors.email?.message??x.formState.errors.root?.message,w;t[9]!==u||t[10]!==x||t[11]!==a||t[12]!==n?(w=async function(e){x.clearErrors(`root`);let t=await jI(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){x.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){x.setError(`root`,{message:u({id:`4mLBx9`})});return}x.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=x,t[11]=a,t[12]=n,t[13]=w):w=t[13];let T=w,E;t[14]===l?E=t[15]:(E=wi(`flex flex-col gap-3`,l),t[14]=l,t[15]=E);let D=d?-1:void 0,O;t[16]!==d||t[17]!==r?(O=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Ha,{className:`size-4 text-primary`}),(0,Z.jsx)(Y,{id:`PIMM5l`})]}):r??(0,Z.jsx)(Y,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=O):O=t[18];let k;t[19]!==O||t[20]!==D?(k=(0,Z.jsx)(`p`,{ref:p,tabIndex:D,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:O}),t[19]=O,t[20]=D,t[21]=k):k=t[21];let A;t[22]!==i||t[23]!==d?(A=d?(0,Z.jsx)(Y,{id:`pBROkv`}):i??(0,Z.jsx)(Y,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=A):A=t[24];let j;t[25]===A?j=t[26]:(j=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:A}),t[25]=A,t[26]=j);let M;t[27]!==k||t[28]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[k,j]}),t[27]=k,t[28]=j,t[29]=M):M=t[29];let N;t[30]!==u||t[31]!==o?(N=o?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(Cs,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=N):N=t[32];let P;t[33]!==M||t[34]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[M,N]}),t[33]=M,t[34]=N,t[35]=P):P=t[35];let F;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==C||t[40]!==x||t[41]!==S||t[42]!==T||t[43]!==d?(F=d?null:(0,Z.jsxs)(`form`,{onSubmit:x.handleSubmit(T),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Ta,{control:x.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(IE,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(RE,{className:`pl-2.5`,children:(0,Z.jsx)(Wd,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(VE,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(X,{type:`submit`,disabled:S,size:c?`icon`:`default`,className:wi(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fo,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(g,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`EDl9kS`})})]}):(0,Z.jsx)(Y,{id:`EDl9kS`})})]})}}),C?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:C}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=C,t[40]=x,t[41]=S,t[42]=T,t[43]=d,t[44]=F):F=t[44];let I;return t[45]!==P||t[46]!==F||t[47]!==E?(I=(0,Z.jsxs)(`div`,{className:E,children:[P,F]}),t[45]=P,t[46]=F,t[47]=E,t[48]=I):I=t[48],I}var NI=`https://github.com/inkeep/open-knowledge`,PI=`https://discord.com/invite/YujKpFN49`,FI=`https://x.com/OpenKnowledgeAI`;function II(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function LI(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var RI=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:re},{label:{id:`PCNIuJ`},href:`${NI}/issues/new`,icon:hd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:no}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:PI,icon:II},{label:`X (Twitter)`,href:FI,icon:LI},{label:`GitHub`,href:NI,icon:Rm}]}],zI=`${NI}/releases`,BI=`group flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`;function VI(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var HI=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=an(),i,a,o,s;t[0]!==r||t[1]!==n?(i=VI(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(vf,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},UI=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=an(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>Ns(e,o),l=e=>Ns(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:BI,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},WI=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},GI=()=>{let e=(0,$.c)(28),{_:t}=an(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c,l;e[0]!==n||e[1]!==o?(c=()=>{if(!n||o!==null)return;let e=new AbortController;return kr({signal:e.signal}).then(e=>{e!==null&&s(e)}),()=>e.abort()},l=[n,o],e[0]=n,e[1]=o,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{r(e),e||a(!1)},e[4]=u):u=e[4];let d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{className:`size-4`}),e[5]=d):d=e[5];let f;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[d,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]})})}),e[6]=f):f=e[6];let p;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(Ws,{children:[f,(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]}),e[7]=p):p=e[7];let m;e[8]!==t||e[9]!==o?(m=RI.map((e,n)=>(0,Z.jsxs)(`div`,{className:wi(n>0&&`mt-3`),children:[(0,Z.jsx)(WI,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:e.links.map(e=>(0,Z.jsx)(UI,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&o!==null?(0,Z.jsx)(HI,{count:o}):void 0},e.href))})})]},e.key)),e[8]=t,e[9]=o,e[10]=m):m=e[10];let h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(WI,{children:(0,Z.jsx)(Y,{id:`arUUsK`})}),e[11]=h):h=e[11];let g;e[12]===t?g=e[13]:(g=t({id:`arUUsK`}),e[12]=t,e[13]=g);let _;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(UI,{link:{label:{id:`3ePd3I`},href:zI,icon:Kd}}),e[14]=_):_=e[14];let v;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:wi(BI,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(Wd,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(Y,{id:`EDl9kS`})]})}),e[15]=v):v=e[15];let y;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Tt,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(MI,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:KI})}),e[16]=y):y=e[16];let b;e[17]===i?b=e[18]:(b=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[_,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(w,{open:i,onOpenChange:a,children:[v,y]})})]}),e[17]=i,e[18]=b);let x;e[19]!==b||e[20]!==g?(x=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[h,(0,Z.jsx)(`nav`,{"aria-label":g,children:b})]}),e[19]=b,e[20]=g,e[21]=x):x=e[21];let S;e[22]!==x||e[23]!==m?(S=(0,Z.jsxs)(Tt,{align:`end`,className:`w-56 p-3`,children:[m,x]}),e[22]=x,e[23]=m,e[24]=S):S=e[24];let C;return e[25]!==n||e[26]!==S?(C=(0,Z.jsxs)(w,{open:n,onOpenChange:u,children:[p,S]}),e[25]=n,e[26]=S,e[27]=C):C=e[27],C};function KI(){return Yg.markSubscribed()}var qI=50,JI=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,xE.preload()},qI))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Gi)},l=(0,Z.jsx)(uf,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(Ws,{children:[u,(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},YI=`https://openknowledge.ai/docs/features/share`;function XI(e){let t=(0,$.c)(42),{input:n,onClickWhenNoRemote:r}=e,{_:i}=an(),{status:a}=Ki(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(h=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Mi({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:To,toastSuccess:iL,toastError:rL,logEvent:nL});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0})}catch{Ss.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=h):h=t[9];let g=h,_=c!==null,v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e||l(null)},t[10]=v):v=t[10];let y;t[11]!==i||t[12]!==n?.kind?(y=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=y):y=t[13];let b=o||m,x,S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(df,{className:`size-3.5`,"aria-hidden":!0}),S=(0,Z.jsx)(Y,{id:`Z8lGw6`}),t[14]=x,t[15]=S):(x=t[14],S=t[15]);let C;t[16]!==g||t[17]!==y||t[18]!==b?(C=(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":y,onClick:g,disabled:b,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[x,S]})}),t[16]=g,t[17]=y,t[18]=b,t[19]=C):C=t[19];let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`Z8lGw6`})}),t[20]=T):T=t[20];let E;t[21]===c?.autoCopyFailed?E=t[22]:(E=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ndeI89`})}):null,t[21]=c?.autoCopyFailed,t[22]=E);let D=c?.url??``,O;t[23]===i?O=t[24]:(O=i({id:`5-FeN2`}),t[23]=i,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,Z.jsx)(Vc,{ref:u,readOnly:!0,value:D,onFocus:tL,onClick:eL,onContextMenu:$I,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":O}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A=c?.url??``,j=c?.autoCopyFailed===!1,M;t[28]!==A||t[29]!==j?(M=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(z,{copyContent:A,clipboardWrite:To,initialCopied:j})})}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(`div`,{className:`relative`,children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(`a`,{href:YI,target:`_blank`,rel:`noopener noreferrer`,onClick:QI,onAuxClick:ZI,className:`mt-2 flex items-center gap-1.5 self-start text-xs text-muted-foreground transition-colors hover:text-primary`,children:[(0,Z.jsx)(J,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(Y,{id:`aByJ8j`})]}),t[34]=F):F=t[34];let I;t[35]!==E||t[36]!==N?(I=(0,Z.jsxs)(Tt,{align:`end`,className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-popover`,children:[T,E,N,F]}),t[35]=E,t[36]=N,t[37]=I):I=t[37];let L;return t[38]!==C||t[39]!==I||t[40]!==_?(L=(0,Z.jsxs)(w,{open:_,onOpenChange:v,children:[C,I]}),t[38]=C,t[39]=I,t[40]=_,t[41]=L):L=t[41],L}function ZI(e){return Ns(e,YI)}function QI(e){return Ns(e,YI)}function $I(e){return e.currentTarget.select()}function eL(e){return e.currentTarget.select()}function tL(e){return e.currentTarget.select()}function nL(e){return console.log(e)}function rL(e){e!==`Link ready but could not copy to clipboard.`&&Ss.error(e)}function iL(e){return Ss.success(e)}function aL(e){let t=(0,$.c)(35),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=an(),{activeDocName:s,activeTarget:c}=pt(),l=s?ni(s):null,{state:u,isDraggingRail:d}=jN(),f=uy(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Tl(`toggle-files-sidebar`),t[0]=p):p=t[0];let m=p,h=Tl(`command-palette`),[g,_]=(0,Q.useState)(!1),v;bb0:{if(c?.kind===`folder`){let e;t[1]===c.folderPath?e=t[2]:(e=Bi(c.folderPath),t[1]=c.folderPath,t[2]=e),v=e;break bb0}if(s&&!l){let e;t[3]===s?e=t[4]:(e=Ri(s),t[3]=s,t[4]=e),v=e;break bb0}if(!c&&!s){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=Bi(``),t[5]=e):e=t[5],v=e;break bb0}v=null}let y=v,b=typeof window<`u`&&window.okDesktop!=null,x=u===`collapsed`,S=b?``:void 0,C=b&&x&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,w=b&&!d&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,T;t[6]!==C||t[7]!==w?(T=wi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,b&&`[-webkit-app-region:drag]`,C,w),t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=!f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(IN,{className:wi(`-ml-1 shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Hs,{children:u===`expanded`?(0,Z.jsx)(Y,{id:`ZxXhLY`,values:{sidebarShortcut:m}}):(0,Z.jsx)(Y,{id:`Zz25kq`,values:{sidebarShortcut:m}})})]}),x&&i&&(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:h}}),"data-telemetry-event":`ok.editor_header.search.click`,className:wi(`shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(o,{"aria-hidden":`true`})})}),(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`IN4UX8`,values:{searchShortcut:h}})})]}),(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(yI,{})]}),D;t[9]===E?D=t[10]:(D=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:E}),t[9]=E,t[10]=D);let O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=wi(`flex shrink-0 items-center justify-end gap-2 px-3`,b&&`[&>*]:[-webkit-app-region:no-drag]`),t[11]=O):O=t[11];let k;t[12]!==g||t[13]!==_||t[14]!==y||t[15]!==f?(k=!f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(XI,{input:y,onClickWhenNoRemote:()=>_(!0)}),(0,Z.jsx)(ki,{open:g,onOpenChange:_})]}),t[12]=g,t[13]=_,t[14]=y,t[15]=f,t[16]=k):k=t[16];let A;t[17]!==r||t[18]!==n?(A=(0,Z.jsx)(Ca,{onSignIn:n,onSetIdentity:r}),t[17]=r,t[18]=n,t[19]=A):A=t[19];let j,M,N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(xF,{}),M=(0,Z.jsx)(Xi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),N=(0,Z.jsx)(cm,{}),t[20]=j,t[21]=M,t[22]=N):(j=t[20],M=t[21],N=t[22]);let P;t[23]===f?P=t[24]:(P=!f&&(0,Z.jsx)(JI,{}),t[23]=f,t[24]=P);let F;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(GI,{}),t[25]=F):F=t[25];let I;t[26]!==k||t[27]!==A||t[28]!==P?(I=(0,Z.jsxs)(`div`,{className:O,children:[k,A,j,M,N,P,F]}),t[26]=k,t[27]=A,t[28]=P,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==S||t[32]!==T||t[33]!==D?(L=(0,Z.jsxs)(`header`,{"data-electron-drag":S,className:T,children:[D,I]}),t[30]=I,t[31]=S,t[32]=T,t[33]=D,t[34]=L):L=t[34],L}var oL=`open-knowledge:terminal-launch`;function sL(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(oL,{detail:{prompt:e,cli:t}}))}function cL(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.prompt==`string`&&e(n.prompt,n.cli)};return t.addEventListener(oL,n),()=>t.removeEventListener(oL,n)}function lL(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=wi(`group/tabs flex gap-2 data-horizontal:flex-col`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(nm,{"data-slot":`tabs`,"data-orientation":a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var uL=Ci(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function dL(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=wi(uL({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(rm,{"data-slot":`tabs-list`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function fL(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=wi(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(im,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pL(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=wi(`flex-1 text-sm outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(am,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var mL=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-Ds-ev2-D.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([81,1,30,3,7,31,6,10,13,11,82,62,44,83]),import.meta.url));function hL(e){let t=(0,$.c)(14),{bridge:n,onClose:r,onTitleChange:i,launch:a,adoptPtyId:o,onPtyId:s}=e,c=a===void 0?null:a,l=o===void 0?null:o,{enabled:u,synced:d}=ra(),f=Ji(),{_:p}=an(),m=d&&u===!1,g;t[0]!==p||t[1]!==f?(g=function(){if(f===null){Ss.error(p({id:`V_6bJ4`}));return}let e=f(!0);e.ok||Ss.error(p({id:`jKd3AP`,values:{0:e.error}}))},t[0]=p,t[1]=f,t[2]=g):g=t[2];let _=g;if(d&&!m){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let a;return t[4]!==l||t[5]!==n||t[6]!==c||t[7]!==r||t[8]!==s||t[9]!==i?(a=(0,Z.jsx)(h,{fallbackRender:_L,onError:gL,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(mL,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:c,adoptPtyId:l,onPtyId:s})})}),t[4]=l,t[5]=n,t[6]=c,t[7]=r,t[8]=s,t[9]=i,t[10]=a):a=t[10],a}let v;return t[11]!==_||t[12]!==m?(v=m?(0,Z.jsx)(bL,{onEnable:_}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[11]=_,t[12]=m,t[13]=v):v=t[13],v}function gL(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function _L(e){return(0,Z.jsx)(vL,{...e})}function vL(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=an(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===r?o=t[4]:(o=r({id:`6MnZEC`}),t[3]=r,t[4]=o);let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[5]=a,t[6]=s);let c;t[7]===r?c=t[8]:(c=r({id:`HpK_8d`}),t[7]=r,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,Z.jsx)(X,{onClick:yL,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==o||t[12]!==s||t[13]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":o,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[s,l]}),t[11]=o,t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function yL(){return window.location.reload()}function bL(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=an(),i;t[0]===r?i=t[1]:(i=r({id:`_XWY2J`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`oYepHb`}),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=r({id:`v2ZW0K`}),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==s?(c=(0,Z.jsx)(X,{onClick:n,children:s}),t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;t[11]===r?l=t[12]:(l=r({id:`ICoNYz`}),t[11]=r,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;return t[15]!==i||t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":i,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[o,c,u]}),t[15]=i,t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function xL(e){let t=(0,$.c)(48),{selected:n,onLaunchSelected:r,onPickCli:i,onPickTerminal:a,className:o}=e,{_:s}=an(),c=n===`terminal`,l;t[0]!==s||t[1]!==c||t[2]!==n?(l=s(c?{id:`AB4qw9`}:{id:`nP-KFo`,values:{0:Vn[n].displayName}}),t[0]=s,t[1]=c,t[2]=n,t[3]=l):l=t[3];let u=l,d;t[4]===o?d=t[5]:(d=wi(`flex shrink-0 items-center`,o),t[4]=o,t[5]=d);let f;t[6]!==c||t[7]!==n?(f=c?(0,Z.jsx)(gf,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(go,{id:ho(n),className:`size-3.5`,"aria-hidden":`true`}),t[6]=c,t[7]=n,t[8]=f):f=t[8];let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`size-3`}),t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==u||t[12]!==f?(m=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":u,"data-testid":`terminal-new-chat`,className:`cursor-pointer gap-0.5 rounded-r-none px-1.5 text-muted-foreground hover:text-foreground`,onClick:r,children:[f,p]})}),t[10]=r,t[11]=u,t[12]=f,t[13]=m):m=t[13];let h;t[14]===u?h=t[15]:(h=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:u}),t[14]=u,t[15]=h);let g;t[16]!==m||t[17]!==h?(g=(0,Z.jsxs)(Ws,{children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18];let _;t[19]===s?_=t[20]:(_=s({id:`QJaG-9`}),t[19]=s,t[20]=_);let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Xa,{"aria-hidden":`true`,className:`size-3`}),t[21]=v):v=t[21];let y;t[22]===_?y=t[23]:(y=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,"data-testid":`terminal-new-chat-menu`,className:`cursor-pointer rounded-l-none text-muted-foreground hover:text-foreground`,children:v})}),t[22]=_,t[23]=y);let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`hIQkLb`})}),t[24]=b):b=t[24];let x;t[25]!==s||t[26]!==i||t[27]!==n?(x=Do.map(e=>{let{displayName:t}=Vn[e];return(0,Z.jsxs)(Cc,{onSelect:()=>i(e),"data-testid":`terminal-new-chat-cli-${e}`,"aria-label":s({id:`9mEZeD`,values:{name:t}}),"aria-current":n===e?`true`:void 0,children:[(0,Z.jsx)(go,{id:ho(e),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),n===e?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)}),t[25]=s,t[26]=i,t[27]=n,t[28]=x):x=t[28];let S;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Ic,{}),t[29]=S):S=t[29];let C=c?`true`:void 0,w;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(gf,{"aria-hidden":`true`,className:`size-4`}),t[30]=w):w=t[30];let T;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),t[31]=T):T=t[31];let E;t[32]===c?E=t[33]:(E=c?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null,t[32]=c,t[33]=E);let D;t[34]!==a||t[35]!==C||t[36]!==E?(D=(0,Z.jsxs)(Cc,{onSelect:a,"data-testid":`terminal-new-chat-terminal`,"aria-current":C,children:[w,T,E]}),t[34]=a,t[35]=C,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==x||t[39]!==D?(O=(0,Z.jsxs)(Tc,{align:`start`,className:`min-w-[180px]`,children:[b,x,S,D]}),t[38]=x,t[39]=D,t[40]=O):O=t[40];let k;t[41]!==y||t[42]!==O?(k=(0,Z.jsxs)(jc,{children:[y,O]}),t[41]=y,t[42]=O,t[43]=k):k=t[43];let A;return t[44]!==d||t[45]!==k||t[46]!==g?(A=(0,Z.jsxs)(`div`,{className:d,children:[g,k]}),t[44]=d,t[45]=k,t[46]=g,t[47]=A):A=t[47],A}function SL(e){let t=(0,$.c)(60),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,newChatSelected:o,onNewChatLaunch:s,onNewChatPickCli:c,onNewChatPickTerminal:l,onClose:u,dockPosition:d,onToggleDock:f,onCollapse:p,children:m,className:h}=e,{_:g}=an(),_=d===`right`,v;t[0]===h?v=t[1]:(v=wi(`flex min-h-0 min-w-0 flex-1 flex-col`,h),t[0]=h,t[1]=v);let y;t[2]===g?y=t[3]:(y=g({id:`1MGRQl`}),t[2]=g,t[3]=y);let b;if(t[4]!==g||t[5]!==r||t[6]!==u||t[7]!==a||t[8]!==n){let e;t[10]!==g||t[11]!==r||t[12]!==u||t[13]!==a?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:wi(`group flex shrink-0 cursor-default items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(fL,{value:e.id,onClick:()=>a?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})})}),(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:e.label})]}),(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":g({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:wi(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),u(e.id)},children:(0,Z.jsx)(Cs,{"aria-hidden":`true`})})]},e.id)},t[10]=g,t[11]=r,t[12]=u,t[13]=a,t[14]=e):e=t[14],b=n.map(e),t[4]=g,t[5]=r,t[6]=u,t[7]=a,t[8]=n,t[9]=b}else b=t[9];let x;t[15]!==y||t[16]!==b?(x=(0,Z.jsx)(dL,{variant:`line`,"aria-label":y,className:`flex h-auto min-w-0 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:b}),t[15]=y,t[16]=b,t[17]=x):x=t[17];let S;t[18]!==o||t[19]!==s||t[20]!==c||t[21]!==l?(S=(0,Z.jsx)(xL,{selected:o,onLaunchSelected:s,onPickCli:c,onPickTerminal:l,className:`shrink-0`}),t[18]=o,t[19]=s,t[20]=c,t[21]=l,t[22]=S):S=t[22];let C;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(`div`,{className:`flex-1`}),t[23]=C):C=t[23];let w;t[24]!==g||t[25]!==_?(w=g(_?{id:`rf6x3F`}:{id:`QNxpRm`}),t[24]=g,t[25]=_,t[26]=w):w=t[26];let T;t[27]===_?T=t[28]:(T=_?(0,Z.jsx)(Xd,{"aria-hidden":`true`}):(0,Z.jsx)(ef,{"aria-hidden":`true`}),t[27]=_,t[28]=T);let E;t[29]!==f||t[30]!==w||t[31]!==T?(E=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":w,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:f,children:T})}),t[29]=f,t[30]=w,t[31]=T,t[32]=E):E=t[32];let D;t[33]===_?D=t[34]:(D=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:_?(0,Z.jsx)(Y,{id:`rf6x3F`}):(0,Z.jsx)(Y,{id:`QNxpRm`})}),t[33]=_,t[34]=D);let O;t[35]!==D||t[36]!==E?(O=(0,Z.jsxs)(Ws,{children:[E,D]}),t[35]=D,t[36]=E,t[37]=O):O=t[37];let k;t[38]===g?k=t[39]:(k=g({id:`VZGGPK`}),t[38]=g,t[39]=k);let A;t[40]===_?A=t[41]:(A=_?(0,Z.jsx)(Qa,{"aria-hidden":`true`}):(0,Z.jsx)(Xa,{"aria-hidden":`true`}),t[40]=_,t[41]=A);let j;t[42]!==p||t[43]!==k||t[44]!==A?(j=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":k,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:p,children:A})}),t[42]=p,t[43]=k,t[44]=A,t[45]=j):j=t[45];let M;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`VZGGPK`})}),t[46]=M):M=t[46];let N;t[47]===j?N=t[48]:(N=(0,Z.jsxs)(Ws,{children:[j,M]}),t[47]=j,t[48]=N);let P;t[49]!==O||t[50]!==N||t[51]!==x||t[52]!==S?(P=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[x,S,C,O,N]}),t[49]=O,t[50]=N,t[51]=x,t[52]=S,t[53]=P):P=t[53];let F;return t[54]!==r||t[55]!==m||t[56]!==i||t[57]!==v||t[58]!==P?(F=(0,Z.jsxs)(lL,{value:r,onValueChange:i,className:v,children:[P,m]}),t[54]=r,t[55]=m,t[56]=i,t[57]=v,t[58]=P,t[59]=F):F=t[59],F}function CL(e){return`terminal-session-${e}`}function wL(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function TL(e){let t=(0,$.c)(77),{bridge:n,visible:r,onVisibleChange:i,launch:a,installedClis:o,container:s,isShowing:c,onRequestEditorFocus:l,dockPosition:u,onToggleDock:d,onHasSessionsChange:f}=e,p=a===void 0?null:a,{_:m}=an(),[h]=(0,Q.useState)(jL),g,_;t[0]!==s||t[1]!==h?(g=()=>{h==null||s==null||h.parentElement!==s&&s.appendChild(h)},_=[h,s],t[0]=s,t[1]=h,t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useLayoutEffect)(g,_);let v=typeof n.terminal?.list==`function`,y;t[4]!==v||t[5]!==p||t[6]!==r?(y=()=>!v&&r?[{id:CL(1),launch:p,title:null,adoptPtyId:null}]:[],t[4]=v,t[5]=p,t[6]=r,t[7]=y):y=t[7];let[b,x]=(0,Q.useState)(y),S;t[8]!==v||t[9]!==r?(S=()=>!v&&r?CL(1):``,t[8]=v,t[9]=r,t[10]=S):S=t[10];let[C,w]=(0,Q.useState)(S),[T,E]=(0,Q.useState)(!v),D=(0,Q.useRef)(!1),O=(0,Q.useRef)(C),k=(0,Q.useRef)(b),A=(0,Q.useRef)(!v&&r?1:0),j=(0,Q.useRef)(r&&p?p.nonce:null),M=(0,Q.useRef)(r),N=(0,Q.useRef)(new Map),P=function(e,t){t===null?N.current.delete(e):N.current.set(e,t)},F=(0,Q.useRef)(0),I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){A.current+=1;let t=CL(A.current);x(n=>[...n,{id:t,launch:e,title:null,adoptPtyId:null}]),w(t)},t[11]=I):I=t[11];let L=I,[R,z]=(0,Q.useState)(AL),[B,V]=(0,Q.useState)(kL),H;t[12]===o?H=t[13]:(H=o??{},t[12]=o,t[13]=H);let U;t[14]!==R||t[15]!==H?(U=cb(R,H),t[14]=R,t[15]=H,t[16]=U):U=t[16];let W=U,G=B?`terminal`:W,K;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e){F.current+=1,L({prompt:null,cli:e,nonce:F.current})},t[17]=K):K=t[17];let ee=K,te;t[18]!==W||t[19]!==B?(te=function(){B?L(null):ee(W)},t[18]=W,t[19]=B,t[20]=te):te=t[20];let q=te,J;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(J=function(e){V(!1),_b(!1);let t=nb(e);z(t),ob(t),ee(e)},t[21]=J):J=t[21];let ne=J,re;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){V(!0),_b(!0),L(null)},t[22]=re):re=t[22];let ie=re,ae;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e,t){let n=t.trim()===``?null:t.trim();x(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[23]=ae):ae=t[23];let oe=ae,se=(0,Q.useRef)(L),ce;t[24]!==C||t[25]!==l||t[26]!==i?(ce=function(e){let t=k.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===C){let e=(t[n-1]??t[n+1])?.id??``;w(e),e!==``&&queueMicrotask(()=>wL(e))}x(r),r.length===0&&(i(!1),l())},t[24]=C,t[25]=l,t[26]=i,t[27]=ce):ce=t[27];let le=ce,ue=(0,Q.useRef)(OL),de;t[28]!==C||t[29]!==le||t[30]!==b?(de=()=>{se.current=L,O.current=C,k.current=b,ue.current=()=>{C!==``&&le(C)}},t[28]=C,t[29]=le,t[30]=b,t[31]=de):de=t[31],(0,Q.useEffect)(de);let fe,pe;t[32]!==p||t[33]!==T||t[34]!==b.length||t[35]!==r?(fe=()=>{if(!T)return;let e=M.current;if(M.current=r,p!=null&&p.nonce!==j.current){j.current=p.nonce,se.current(p);return}r&&!e&&b.length===0&&se.current(null)},pe=[r,p,b.length,T],t[32]=p,t[33]=T,t[34]=b.length,t[35]=r,t[36]=fe,t[37]=pe):(fe=t[36],pe=t[37]),(0,Q.useEffect)(fe,pe);let me;t[38]===n.terminal?me=t[39]:(me=()=>{if(typeof n.terminal?.list!=`function`||D.current)return;D.current=!0;let e=!1;return(async()=>{let t;try{t=await n.terminal.list()??[]}catch(e){console.error(`[terminal] reload session list() failed; cold-starting:`,e),t=[]}if(!e){if(t.length>0){let e=t.map(DL);A.current=e.length,x(e),w(e[0]?.id??``)}E(!0)}})(),()=>{e=!0,D.current=!1}},t[38]=n.terminal,t[39]=me);let he;t[40]===n?he=t[41]:(he=[n],t[40]=n,t[41]=he),(0,Q.useEffect)(me,he);let ge;t[42]===n?ge=t[43]:(ge=[n],t[42]=n,t[43]=ge),(0,Q.useEffect)(()=>ok(e=>{let t=O.current,r=t===``?void 0:N.current.get(t);r==null?au():(n.terminal.input(r,e),queueMicrotask(()=>wL(t)))}),ge);let _e,ve;t[44]===n?(_e=t[45],ve=t[46]):(_e=()=>n.onMenuAction(e=>{e===`new-terminal`?se.current(null):e===`kill-terminal`&&ue.current()}),ve=[n],t[44]=n,t[45]=_e,t[46]=ve),(0,Q.useEffect)(_e,ve);let ye,be;t[47]===h?(ye=t[48],be=t[49]):(ye=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||h==null||!h.contains(document.activeElement))return;let t=k.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),w(t.id),queueMicrotask(()=>wL(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},be=[h],t[47]=h,t[48]=ye,t[49]=be),(0,Q.useEffect)(ye,be);let xe;t[50]!==n.editor||t[51]!==b.length?(xe=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:b.length>0})},t[50]=n.editor,t[51]=b.length,t[52]=xe):xe=t[52];let Se;t[53]!==n||t[54]!==b.length?(Se=[n,b.length],t[53]=n,t[54]=b.length,t[55]=Se):Se=t[55],(0,Q.useEffect)(xe,Se);let Ce,we;t[56]!==f||t[57]!==b.length?(Ce=()=>{f?.(b.length>0)},we=[f,b.length],t[56]=f,t[57]=b.length,t[58]=Ce,t[59]=we):(Ce=t[58],we=t[59]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[60]!==h||t[61]!==c||t[62]!==l||t[63]!==r?(Te=()=>{c||r||h==null||!h.contains(document.activeElement)||l()},Ee=[c,r,h,l],t[60]=h,t[61]=c,t[62]=l,t[63]=r,t[64]=Te,t[65]=Ee):(Te=t[64],Ee=t[65]),(0,Q.useLayoutEffect)(Te,Ee);let De,Oe;t[66]===c?(De=t[67],Oe=t[68]):(De=()=>{c&&wL(O.current)},Oe=[c],t[66]=c,t[67]=De,t[68]=Oe),(0,Q.useEffect)(De,Oe);let ke;if(t[69]!==m||t[70]!==b){let e;t[72]===m?e=t[73]:(e=(e,t)=>({id:e.id,label:e.title??m({id:`OVjNeX`,values:{0:t+1}})}),t[72]=m,t[73]=e),ke=b.map(e),t[69]=m,t[70]=b,t[71]=ke}else ke=t[71];let Ae=ke,je=b.length>0?(0,Z.jsx)(SL,{sessions:Ae,activeSessionId:C,onSelect:w,onTabActivate:EL,newChatSelected:G,onNewChatLaunch:q,onNewChatPickCli:ne,onNewChatPickTerminal:ie,onClose:le,dockPosition:u,onToggleDock:d,onCollapse:()=>i(!1),className:`h-full`,children:b.map(e=>(0,Z.jsx)(pL,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(hL,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onPtyId:t=>P(e.id,t),onTitleChange:t=>oe(e.id,t),onClose:()=>le(e.id)})},e.id))}):null,Me;return t[74]!==h||t[75]!==je?(Me=h==null?null:(0,ld.createPortal)(je,h),t[74]=h,t[75]=je,t[76]=Me):Me=t[76],Me}function EL(e){return queueMicrotask(()=>wL(e))}function DL(e,t){return{id:CL(t+1),launch:null,title:null,adoptPtyId:e.ptyId}}function OL(){}function kL(){return vb()}function AL(){return ab()}function jL(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.className=`flex min-h-0 flex-1 flex-col overflow-hidden`,e}function ML(e){let t=(0,$.c)(74),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=qy(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Px[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null,[v,y]=(0,Q.useState)(!1),b=Jy(),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(mb),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){k(e),pb(e),y(!0)},t[2]=A):A=t[2];let j=A,M;t[3]===O?M=t[4]:(M=function(){j(O===`right`?`bottom`:`right`)},t[3]=O,t[4]=M);let N=M,P;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(P={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=P):P=t[5];let[F,I]=(0,Q.useState)(P),L=(0,Q.useRef)(0),R;t[6]===b?R=t[7]:(R=function(e){let t=e??cb(ab(),b);y(!0),L.current+=1,D({prompt:null,cli:t,nonce:L.current})},t[6]=b,t[7]=R);let z=R,B;t[8]!==x||t[9]!==z?(B=function(){y(!0),!x&&!gb()&&z()},t[8]=x,t[9]=z,t[10]=B):B=t[10];let V=B,H=Fi(),{projectConfig:U,projectLocalConfig:W,projectLocalSynced:G,projectSynced:K}=Bo(),{activeDocName:ee}=pt(),te=H?.hasRemote,q=H?.pushPermission?.checkStatus,J;t[11]!==m||t[12]!==U||t[13]!==W||t[14]!==G||t[15]!==K||t[16]!==te||t[17]!==q?(J=xb({autoSyncOnboardingDismissed:m,hasRemote:te,projectLocalSynced:G,projectSynced:K,projectLocalConfig:W,projectConfig:U,pushPermissionCheckStatus:q}),t[11]=m,t[12]=U,t[13]=W,t[14]=G,t[15]=K,t[16]=te,t[17]=q,t[18]=J):J=t[18];let ne=J,re,ie;t[19]===ee?(re=t[20],ie=t[21]):(re=()=>{let e=function(e){let t=e.detail;t&&ee&&Zl(ee,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(zy,e),()=>window.removeEventListener(zy,e)},ie=[ee],t[19]=ee,t[20]=re,t[21]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?y(FL):e===`new-terminal`&&y(!0)})},oe=[],t[22]=ae,t[23]=oe):(ae=t[22],oe=t[23]),(0,Q.useEffect)(ae,oe);let se,ce;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{if(window.okDesktop!=null)return;let e=function(e){El(e,`toggle-terminal-panel`)&&(e.preventDefault(),y(PL))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ce=[],t[24]=se,t[25]=ce):(se=t[24],ce=t[25]),(0,Q.useEffect)(se,ce);let le,ue;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>cL((e,t)=>{y(!0),L.current+=1,D({prompt:e,cli:t,nonce:L.current})}),ue=[],t[26]=le,t[27]=ue):(le=t[26],ue=t[27]),(0,Q.useEffect)(le,ue);let de,fe;t[28]===v?(de=t[29],fe=t[30]):(de=()=>{v||D(null)},fe=[v],t[28]=v,t[29]=de,t[30]=fe),(0,Q.useEffect)(de,fe);let pe,me;t[31]!==C||t[32]!==v?(pe=()=>{window.okDesktop!=null&&C&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v})},me=[v,C],t[31]=C,t[32]=v,t[33]=pe,t[34]=me):(pe=t[33],me=t[34]),(0,Q.useEffect)(pe,me);let he,ge;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){w(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(T.current=!0,y(!0))}).catch(NL).finally(()=>{t||w(!0)}),()=>{t=!0}},ge=[],t[35]=he,t[36]=ge):(he=t[35],ge=t[36]),(0,Q.useEffect)(he,ge);let _e,ve;t[37]===v?(_e=t[38],ve=t[39]):(_e=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&ha()}},ve=[v],t[37]=v,t[38]=_e,t[39]=ve),(0,Q.useEffect)(_e,ve),Xy(H?.pausedReason),Zy();let ye;t[40]===a?ye=t[41]:(ye=function(e){s(e),a(e)},t[40]=a,t[41]=ye);let be=ye,xe,Se;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>{d(`auth`),l(!0)},Se=()=>{d(`identity`),l(!0)},t[42]=xe,t[43]=Se):(xe=t[42],Se=t[43]);let Ce;t[44]===r?Ce=t[45]:(Ce=(0,Z.jsx)(aL,{onSignIn:xe,onSetIdentity:Se,onOpenSearch:r}),t[44]=r,t[45]=Ce);let we=_?V:void 0,Te;t[46]!==f||t[47]!==o||t[48]!==be||t[49]!==we||t[50]!==O||t[51]!==v?(Te=(0,Z.jsx)(KP,{editorMode:o,onModeChange:be,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:O,onTerminalPlacement:I,onRevealTerminal:we}),t[46]=f,t[47]=o,t[48]=be,t[49]=we,t[50]=O,t[51]=v,t[52]=Te):Te=t[52];let Ee;t[53]!==b||t[54]!==O||t[55]!==E||t[56]!==F||t[57]!==v||t[58]!==N?(Ee=_&&g!=null?(0,Z.jsx)(TL,{bridge:g,visible:v,onVisibleChange:y,launch:E,installedClis:b,container:F.container,isShowing:F.isShowing,onRequestEditorFocus:()=>F.editorRegion?.focus(),dockPosition:O,onToggleDock:N,onHasSessionsChange:S}):null,t[53]=b,t[54]=O,t[55]=E,t[56]=F,t[57]=v,t[58]=N,t[59]=Ee):Ee=t[59];let De=u===`identity`,Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>{l(!1)},t[60]=Oe):Oe=t[60];let ke;t[61]!==c||t[62]!==De?(ke=(0,Z.jsx)($i,{open:c,onOpenChange:l,identityPrompt:De,onSuccess:Oe}),t[61]=c,t[62]=De,t[63]=ke):ke=t[63];let Ae;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=()=>h(!0),t[64]=Ae):Ae=t[64];let je;t[65]===ne?je=t[66]:(je=(0,Z.jsx)(yb,{open:ne,onResolved:Ae}),t[65]=ne,t[66]=je);let Me;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Z.jsx)(Iy,{}),t[67]=Me):Me=t[67];let Ne;return t[68]!==Ce||t[69]!==Te||t[70]!==Ee||t[71]!==ke||t[72]!==je?(Ne=(0,Z.jsxs)(Z.Fragment,{children:[Ce,Te,Ee,ke,je,Me]}),t[68]=Ce,t[69]=Te,t[70]=Ee,t[71]=ke,t[72]=je,t[73]=Ne):Ne=t[73],Ne}function NL(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function PL(e){return!e}function FL(e){return!e}function IL(e){let t=Jc(gl(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function LL(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Li();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(eo,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),`Couldn't load conflicts — reload to retry.`]})}),e[0]=t):t=e[0],t}if(t.length===0)return null;let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(eo,{"aria-hidden":`true`,className:`size-3`}),`Conflicts`]}),e[1]=i):i=e[1];let a;e[2]===t.length?a=e[3]:(a=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[i,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[2]=t.length,e[3]=a);let o;e[4]===t?o=e[5]:(o=t.map(RL),e[4]=t,e[5]=o);let s;e[6]===o?s=e[7]:(s=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:o}),e[6]=o,e[7]=s);let c;return e[8]!==a||e[9]!==s?(c=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[a,s]}),e[8]=a,e[9]=s,e[10]=c):c=e[10],c}function RL(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>IL(e.file),children:[(0,Z.jsx)(eo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var zL=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
31
|
+
`,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Nl(t,{style:t=>ql(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return pM.set(t.changes,i),i}function gM(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Sj).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(fM);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Al.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:dM.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function _M(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Sj).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(fM).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function vM(e){let t=new Il;for(let n of e.field(Sj)){let r=e.facet(yj).overrideChunk&&xM(e,n);t.add(n.fromB,n.fromB,hM(e,n,!!r))}return t.finish()}var yM=Ml.define({create:e=>vM(e),update(e,t){return t.state.field(Sj,!1)==t.startState.field(Sj,!1)?e:vM(t.state)},provide:e=>Vl.decorations.from(e)}),bM=new WeakMap;function xM(e,t){let n=bM.get(t);if(n!==void 0)return n;n=null;let r=e.field(fM),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(Fl.widget({widget:new SM(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Rj.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return bM.set(t,n),n}var SM=class extends Ol{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},CM=new class extends Hl{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},wM=Fl.line({class:`cm-inlineChangedLine`});function TM(e,t,n,r){let i=xM(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,CM),n.add(o.from,o.from,wM);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var EM=ae({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),DM=E({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),OM=Vl.theme({".cm-deletedChunk .cm-chunkButtons":{display:`flex`,gap:`0.25rem`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button']":{margin:`0`,border:`1px solid transparent`,borderRadius:`min(var(--radius-md), 10px)`,color:`var(--primary-foreground)`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button'][data-variant='destructive']":{color:`var(--destructive)`}});function kM({addControl:e,nextId:t,removeControl:n,root:r}){return(i,a)=>{let o=document.createElement(`span`);o.className=`inline-flex`;let s=t();return e({id:s,host:o,type:i,action:a}),queueMicrotask(()=>{r.contains(o)||n(s)}),o}}function AM(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=an(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=tr(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C=RA(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?EM:DM,u=[Vl.editable.of(!1),jl.readOnly.of(!0)],g=[ou,Jl(),...u,l,Vl.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Vl({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=kM({addControl:e=>{r||(t.set(e.id,e.host),S(t=>[...t,e]))},nextId:()=>(m.current+=1,m.current),removeControl:s,root:e}),a=new Vl({doc:d,extensions:[ou,Jl(),Vl.editable.of(!1),l,OM,Vl.lineWrapping,uM({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Vl.updateListener.of(e=>{let t=Cj(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=Cj(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new oM({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Vl({doc:d,extensions:[...g,uM({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},E=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof Vl)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof Vl)||U(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):Ms._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,ld.createPortal)((0,Z.jsx)(X,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(Y,{id:`XyOUTJ`})}),(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(X,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(Y,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function jM(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function MM(e,t){return jM(e,`content`,t)}async function NM(e){return jM(e,`mine`)}async function PM(e){return jM(e,`theirs`)}async function FM(e){return jM(e,`delete`)}async function IM(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function LM(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=an(),{conflicts:i,loading:a}=Li(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>gl(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=RA(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),IM(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await MM(c,e);t.ok||Ss.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),Ss.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(AM,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(FM),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===w?u=t[36]:(u=()=>void w(PM),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(AM,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(NM),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(FM),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(AM,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function RM(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(zt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var zM=`__back-nav__`;function BM(e){return e instanceof Oe||e instanceof gt||e instanceof xe||e instanceof Ze||e instanceof jt||e instanceof A?e.docName:null}function VM(e){return e instanceof Oe||e instanceof gt}function HM(e){if(e instanceof Oe){let t=e.docName;return{title:Ms._({id:`Jejur6`}),summary:Ms._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof gt){let t=e.docName;return{title:Ms._({id:`V7QxyT`}),summary:Ms._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof xe){let t=e.docName;return{title:Ms._({id:`1di5fu`}),summary:Ms._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Ze){let t=e.docName;return{title:Ms._({id:`wvbc1r`}),summary:Ms._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof jt)return{title:Ms._({id:`Gfr4fu`}),summary:Ms._({id:`UW2Fg3`})};if(e instanceof A){let t=e.docName;return{title:Ms._({id:`vv7kpg`}),summary:Ms._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Ms._({id:`W5A0Ly`});return{title:Ms._({id:`29VNqC`}),summary:t}}function UM(e){let t=(0,$.c)(31),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=HM(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f=typeof window<`u`?window.okDesktop:void 0,p=f&&VM(n)?f:null,m,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{d.current?.focus()},h=[],t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(pT,{size:80,variant:`sleeping`}),t[4]=g):g=t[4];let _;t[5]===c?_=t[6]:(_=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=_);let v;t[7]===l?v=t[8]:(v=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=v);let y;t[9]!==_||t[10]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[12]=b):b=t[12];let x;t[13]===r?x=t[14]:(x=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:b}),t[13]=r,t[14]=x);let S;t[15]===p?S=t[16]:(S=p?(0,Z.jsx)(X,{variant:`secondary`,onClick:()=>{Oy(p).then(GM).catch(WM)},children:(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,t[15]=p,t[16]=S);let C;t[17]!==i||t[18]!==u||t[19]!==n||t[20]!==o||t[21]!==a||t[22]!==r?(C=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(at(BM(n)??i),o(a),r(zM))},children:(0,Z.jsx)(Y,{id:`CKyk7Q`})}):null,t[17]=i,t[18]=u,t[19]=n,t[20]=o,t[21]=a,t[22]=r,t[23]=C):C=t[23];let w;t[24]!==S||t[25]!==C||t[26]!==x?(w=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[x,S,C]}),t[24]=S,t[25]=C,t[26]=x,t[27]=w):w=t[27];let T;return t[28]!==w||t[29]!==y?(T=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[g,y,w]}),t[28]=w,t[29]=y,t[30]=T):T=t[30],T}function WM(){}function GM(e){e.ok||Ss.error(e.message,{id:`server-restart-error`,duration:1/0})}function KM(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(UM,{...e,activeDocName:n,previousDocName:r,onNavigateBack:i}),t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c;t[4]===n?c=t[5]:(c=[n],t[4]=n,t[5]=c);let l;t[6]!==n||t[7]!==a?(l=e=>{if(e.reason===`imperative-api`){if(Array.isArray(e.args)&&e.args[0]===zM){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=e=>{console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${HM(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(h,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function qM(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=ii(t);return{map:n,keys:Br(t),parseError:r}}function JM(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>qM(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=Xn(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=qe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=lt(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(YM,{cover:d}):null,t[9]=d,t[10]=f,t[11]=g):g=t[11];let _;t[12]!==f||t[13]!==p||t[14]!==l?(_=p?(0,Z.jsx)(XM,{icon:l,hasCover:f}):null,t[12]=f,t[13]=p,t[14]=l,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":m,"data-has-icon":h,"aria-hidden":`true`,"data-testid":`page-header`,children:[g,_]}),t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function YM(e){let t=(0,$.c)(2),{cover:n}=e,r;return t[0]===n.value?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`page-header-cover`,"data-testid":`page-header-cover`,children:(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`})}),t[0]=n.value,t[1]=r),r}function XM(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var ZM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-OxkUY14x.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([74,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,69,70,21,75,8,76,77,47,24]),import.meta.url)).ManagedArtifactProperties})),QM=bl(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function $M(e){let t=e.threshold??QM;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function eN(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var tN=bl(`ACTIVITY_MOUNT_LIMIT`,3);function nN(){return n(()=>import(`./SourceEditor-BZ3cbLjs.js`),__vite__mapDeps([78,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,79,34,77,73]),import.meta.url)}var rN=(0,Q.lazy)(async()=>({default:(await nN()).SourceEditor}));function iN(e,t,n){if(n<=0)return[];let r=e.filter(e=>!ze(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function aN(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Ms._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Ms._({id:`Sc1bKE`,values:{docName:e}}):Ms._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Ms._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Ms._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Ms._({id:`bmC18N`,values:{docName:e}}):Ms._({id:`pAgkuZ`,values:{docName:e}})}:null}function oN(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(yl,{name:`activity-pool`,children:(0,Z.jsx)(sN,{...e})}),t[0]=e,t[1]=n),n}function sN(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=pt(),{pages:u,loading:d}=to(),f=iN(c,n,tN),p=(0,Q.useRef)(``),m=f.map(cN).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)ue(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;se(e,t&&t.length>0?t:crypto.randomUUID())}vl(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,S(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(mN,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!br(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function cN(e){return e.docName}function lN(e){let t=(0,$.c)(8),{isActive:n,initialScrollTop:r,children:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(r??0),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=a.current;if(!e)return;let t=()=>{e.scrollTop>0&&(o.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>{if(!n)return;let e=a.current;if(!e)return;let t=o.current;if(t===0)return;let r=performance.now(),i=!1;e.scrollTop=t,e.scrollTop===t&&e.scrollHeight>t&&vl(`ok/scroll-restore/phase1-success`,{target:t,elapsedMs:performance.now()-r});let s=!1,c=0,l=()=>{s||(s=!0,cancelAnimationFrame(c),clearTimeout(f),e.removeEventListener(`wheel`,u),e.removeEventListener(`touchstart`,u))},u=()=>l();e.addEventListener(`wheel`,u,{passive:!0}),e.addEventListener(`touchstart`,u,{passive:!0});let d=()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&!i&&(vl(`ok/scroll-restore/phase2-success`,{target:t,elapsedMs:performance.now()-r}),i=!0)),c=requestAnimationFrame(d))};c=requestAnimationFrame(d);let f=setTimeout(()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&vl(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function uN(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(XC,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(rN,{docName:f,ytext:p,provider:n.provider,placeholder:a,isSourceModeActive:o})}),t[6]=a,t[7]=n.docName,t[8]=n.provider,t[9]=o,t[10]=p,t[11]=m):m=t[11],m}function dN(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(ao,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Fo,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(X,{type:`button`,onClick:fN,children:[(0,Z.jsx)(ao,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function fN(){return window.location.reload()}function pN(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function mN(e){let t=(0,$.c)(53),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=aN(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=aD(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[y,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==y?(S=()=>{i&&!_?v(!0):!i&&!y&&x(!0)},C=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=$M({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,k;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&vl(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},k=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=g,t[17]=D,t[18]=k):(D=t[17],k=t[18]),(0,Q.useEffect)(D,k);let A;t[19]===n.docName?A=t[20]:(A=()=>H(n.docName),t[19]=n.docName,t[20]=A);let[j]=(0,Q.useState)(A),M=j?.html??null,[N,P]=(0,Q.useState)(!1),F,I;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==N||t[26]!==i||t[27]!==g?(F=()=>{eN({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:N})&&(vl(`ok/cold/first-toggle`,{docName:n.docName,mountId:O(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),P(!0))},I=[N,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=w.isLarge,t[23]=w.renderSource,t[24]=w.renderVisual,t[25]=N,t[26]=i,t[27]=g,t[28]=F,t[29]=I):(F=t[28],I=t[29]),(0,Q.useEffect)(F,I);let L=r?`visible`:`hidden`,R=`editor:${n.docName}`,z=j?.scrollTop,B;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==M?(B=f?(0,Z.jsx)(dN,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(KM,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(pN,{html:M}):(0,Z.jsx)(XC,{}),children:(0,Z.jsx)(RM,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(LM,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(br(n.docName)||b(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(ZM,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(JM,{provider:n.provider}),(0,Z.jsx)(Ba,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[w.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(uN,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,w.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(NA,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=M,t[44]=B):B=t[44];let V;t[45]!==r||t[46]!==z||t[47]!==B?(V=(0,Z.jsx)(lN,{isActive:r,initialScrollTop:z,children:B}),t[45]=r,t[46]=z,t[47]=B,t[48]=V):V=t[48];let U;return t[49]!==L||t[50]!==R||t[51]!==V?(U=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[49]=L,t[50]=R,t[51]=V,t[52]=U):U=t[52],U}function hN(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function gN(e){let{value:t,unit:n}=hN(e);return n===`rem`?t*16:t}function _N(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var vN=3600*24*7;function yN(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?bN:m,O=g===void 0?vN:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let ee=gN(b),te;t[6]===x?te=t[7]:(te=gN(x),t[6]=x,t[7]=te);let q=te,J;t[8]!==E||t[9]!==k?(J=function(e){E&&(P.current=!0,j.current=H.current?0:gN(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=J):J=t[10];let ne=J,re,ie;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==q||t[18]!==ee||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(re=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=hN(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=ee*w;else if(e<=ee){let n=ee*(w-1);t=ee-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>ee*T){a();let t=n(r,M.current,j.current,s),c=Math.max(ee,Math.min(q,t)),u=_N(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(ee,Math.min(q,u)),f=_N(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ie=[i,a,D,ee,q,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=q,t[18]=ee,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=ie):(re=t[24],ie=t[25]),(0,Q.useEffect)(re,ie);let ae;return t[26]===ne?ae=t[27]:(ae={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ae),ae}function bN(){}var xN=3600*24*7,SN=`18rem`,CN=`3rem`,wN=`app-file-sidebar`,TN=`14.625rem`,EN=`32rem`,DN=`sidebar_width`,ON=/^\d+(?:\.\d+)?(?:rem|px)$/,kN=Q.createContext(null);function AN(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${DN}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return ON.test(n)?n:e}function jN(){let e=Q.use(kN);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function MN(e){let t=(0,$.c)(58),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?SN:c,[u]=Q.useState(PN),d;t[8]===u?d=t[9]:(d=()=>hD(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>AN(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=SD();return wD(`left`,hD(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),TD(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(NN)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${fD}px)`),t=()=>{let e=hD(u,window.innerWidth,`left`);p(e),C(wD(`left`,e,SD())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(wN)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||E(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{El(e,`toggle-files-sidebar`)&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":CN,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=wi(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let ee;return t[55]!==H||t[56]!==K?(ee=(0,Z.jsx)(kN.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=ee):ee=t[57],ee}function NN(e){return!e}function PN(){return Fr()}function FN(e){let t=(0,$.c)(39),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{_:d}=an(),{state:f,isDraggingRail:p}=jN();if(u===`none`){let e;t[7]===r?e=t[8]:(e=wi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[14]===h?g=t[15]:(g=wi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[20]!==r||t[21]!==y?(b=wi(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:wN,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function IN(e){let t=(0,$.c)(34),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=an(),{toggleSidebar:o,state:s}=jN(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Dl(`toggle-files-sidebar`);c=X,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=wN,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=wi(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(ht,{}):(0,Z.jsx)(Zd,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function LN(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{_:l}=an(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=jN(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:TN,maxResizeWidth:EN,setIsDraggingRail:m,widthCookieName:DN,widthCookieMaxAge:xN},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=yN(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=wi(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function RN(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=jN(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=wi(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function zN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function BN(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=wi(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function VN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function HN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function UN(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?Ti:`div`,o;t[4]===n?o=t[5]:(o=wi(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function WN(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?Ti:`button`,o;t[4]===n?o=t[5]:(o=wi(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-action`,"data-sidebar":`group-action`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function GN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function KN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var JN=Ci(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function YN(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?Ti:`button`,{state:m}=jN(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=wi(JN({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(Vs,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Hs,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(Ws,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function XN(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?Ti:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=wi(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function ZN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function QN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`group/menu-sub-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-sub-item`,"data-sidebar":`menu-sub-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $N(e){let t=(0,$.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:i,size:a,isActive:o,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?!1:i,c=a===void 0?`md`:a,l=o===void 0?!1:o,u=s?Ti:`a`,d;t[6]===n?d=t[7]:(d=wi(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,n),t[6]=n,t[7]=d);let f;return t[8]!==u||t[9]!==l||t[10]!==r||t[11]!==c||t[12]!==d?(f=(0,Z.jsx)(u,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":c,"data-active":l,className:d,...r}),t[8]=u,t[9]=l,t[10]=r,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function eP(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function tP(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Xr.safeParse(t);return n.success?n.data.currentBranch??null:null}var nP=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:eP({fetchBranch:tP,subscribeToEvent:Ts}),rP=nP.subscribe,iP=nP.getSnapshot;function aP(){return(0,Q.useSyncExternalStore)(rP,iP,iP)}function oP(){let e=(0,$.c)(6),t=aP(),n=so(),{state:r}=jN(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&Pi(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function sP(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:l}=an(),u=oP();if(!s&&u===null&&a==null)return null;let d=r??n,f=r!=null,{words:p,chars:m,tokens:h}=d,g;t[0]!==l||t[1]!==f||t[2]!==s?(g=l(s?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=s,t[3]=g):g=t[3];let _=c&&`pr-12`,v;t[4]===_?v=t[5]:(v=wi(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,_),t[4]=_,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[6]=y):y=t[6];let b;t[7]!==l||t[8]!==a?(b=a?(0,Z.jsxs)(X,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(us,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(Jt,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=l,t[8]=a,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u===null?null:(0,Z.jsx)(cP,{identity:u}),t[10]=u,t[11]=x);let S;t[12]===x?S=t[13]:(S=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:x}),t[12]=x,t[13]=S);let C;t[14]!==l||t[15]!==d.chars||t[16]!==d.tokens||t[17]!==d.words||t[18]!==m||t[19]!==f||t[20]!==s||t[21]!==h||t[22]!==p?(C=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:l({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.words.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`d5rK4X`,values:{chars:m}})]}),(0,Z.jsxs)(`span`,{children:[d.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.tokens.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[14]=l,t[15]=d.chars,t[16]=d.tokens,t[17]=d.words,t[18]=m,t[19]=f,t[20]=s,t[21]=h,t[22]=p,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==S?(w=(0,Z.jsxs)(`section`,{"aria-label":g,className:v,children:[y,b,S,C]}),t[24]=C,t[25]=g,t[26]=v,t[27]=b,t[28]=S,t[29]=w):w=t[29],w}function cP(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Hs,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function lP(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:i}=an(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=wi(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function uP(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=wi(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dP(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=wi(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fP(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=wi(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function pP(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=wi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Qa,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var mP=1,hP=2,gP=4;function _P(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ni(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:ie(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>gP?[...u.slice(0,mP).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(mP,-hP)},...u.slice(-hP).map((e,t)=>d(e,u.length-hP+t))]:u.map((e,t)=>d(e,t));a=lP,t[8]===r?c=t[9]:(c=wi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=uP,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(vP)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function vP(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(pP,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(dP,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(Sd,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(dP,{className:`min-w-0`,children:(0,Z.jsx)(fP,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var yP={fill:`none`,height:24,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`},bP=e=>{let t=(0,$.c)(15),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({color:a,size:o,strokeWidth:s,absoluteStrokeWidth:n,className:c,children:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=a===void 0?`currentColor`:a,u=o===void 0?24:o,d=s===void 0?2:s,f=c===void 0?``:c,p=n?Number(d)*24/Number(u):d,m;return t[8]!==r||t[9]!==f||t[10]!==l||t[11]!==i||t[12]!==u||t[13]!==p?(m=(0,Z.jsx)(`svg`,{"aria-hidden":`true`,...yP,className:f,height:u,stroke:l,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:p,width:u,...i,children:r}),t[8]=r,t[9]=f,t[10]=l,t[11]=i,t[12]=u,t[13]=p,t[14]=m):m=t[14],m},xP=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Markdown`}),r=(0,Z.jsx)(`path`,{d:`M232,48H24A16,16,0,0,0,8,64V192a16,16,0,0,0,16,16H232a16,16,0,0,0,16-16V64A16,16,0,0,0,232,48Zm0,144H24V64H232V192ZM128,104v48a8,8,0,0,1-16,0V123.31L93.66,141.66a8,8,0,0,1-11.32,0L64,123.31V152a8,8,0,0,1-16,0V104a8,8,0,0,1,13.66-5.66L88,124.69l26.34-26.35A8,8,0,0,1,128,104Zm77.66,18.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L168,132.69V104a8,8,0,0,1,16,0v28.69l10.34-10.35A8,8,0,0,1,205.66,122.34Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(bP,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},SP=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Textbox`}),r=(0,Z.jsx)(`path`,{d:`M112,40a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80v96a16,16,0,0,0,16,16h80v16a8,8,0,0,0,16,0V48A8,8,0,0,0,112,40ZM24,176V80h80v96ZM248,80v96a16,16,0,0,1-16,16H144a8,8,0,0,1,0-16h88V80H144a8,8,0,0,1,0-16h88A16,16,0,0,1,248,80ZM88,112a8,8,0,0,1-8,8H72v24a8,8,0,0,1-16,0V120H48a8,8,0,0,1,0-16H80A8,8,0,0,1,88,112Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(bP,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function CP(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=an(),s=n?`source`:`wysiwyg`,c;t[0]===r?c=t[1]:(c=e=>{e&&r(e)},t[0]=r,t[1]=c);let l;t[2]===o?l=t[3]:(l=o({id:`n7aopT`}),t[2]=o,t[3]=l);let u;t[4]===o?u=t[5]:(u=o({id:`ur2XSb`}),t[4]=o,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Vs,{children:(0,Z.jsx)(SP,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(ka,{value:`wysiwyg`,"aria-label":u,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:d}),t[7]=u,t[8]=f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(Ws,{children:[f,p]}),t[10]=f,t[11]=m);let h;t[12]===o?h=t[13]:(h=o({id:`xbdtfY`}),t[12]=o,t[13]=h);let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(xP,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(ka,{value:`source`,"aria-label":h,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:g})})}),t[15]=a,t[16]=h,t[17]=_):_=t[17];let v;t[18]===a?v=t[19]:(v=(0,Z.jsx)(Hs,{side:`bottom`,children:a?(0,Z.jsx)(Y,{id:`G-JBA1`}):(0,Z.jsx)(Y,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(Ws,{children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==c||t[26]!==l||t[27]!==m?(b=(0,Z.jsxs)(ja,{type:`single`,value:s,onValueChange:c,"aria-label":l,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[m,y]}),t[23]=y,t[24]=s,t[25]=c,t[26]=l,t[27]=m,t[28]=b):b=t[28],b}var wP=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-BsGotb40.js`);return{SkillEditorActions:e}},__vite__mapDeps([80,1,30,3,7,31,6,10,70,20,9,11,32,12,13,21,16,60,72,18,61,65,23]),import.meta.url)).SkillEditorActions}));function TP(e){let t=(0,$.c)(82),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=an(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Tl(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,x,S,C,w,T,E,D,O,k,A;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){let e=Dl(`toggle-document-panel`),u;t[26]===n?u=t[27]:(u=n?ni(n):null,t[26]=n,t[27]=u);let p=u,m;t[28]===n?m=t[29]:(m=n?b(n):null,t[28]=n,t[29]=m);let j=m,M;t[30]!==p||t[31]!==j?(M=p?.kind===`skill`?{scope:p.scope,name:p.name}:j?{scope:`project`,name:j}:null,t[30]=p,t[31]=j,t[32]=M):M=t[32];let N=M;x=`editor-toolbar`,S=`pointer-events-none absolute inset-x-0 top-0 z-10`;let P;t[33]!==n||t[34]!==N?(P=N?null:(0,Z.jsx)(_P,{docName:n}),t[33]=n,t[34]=N,t[35]=P):P=t[35];let F;t[36]===P?F=t[37]:(F=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:P}),t[36]=P,t[37]=F);let I;t[38]!==r||t[39]!==a||t[40]!==i?(I=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(CP,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[38]=r,t[39]=a,t[40]=i,t[41]=I):I=t[41],t[42]!==F||t[43]!==I?(C=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[F,I]})}),t[42]=F,t[43]=I,t[44]=C):C=t[44];let L=d&&`pr-9`;t[45]===L?_=t[46]:(_=wi(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,L),t[45]=L,t[46]=_),t[47]===N?v=t[48]:(v=N?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(wP,{scope:N.scope,name:N.name})}):null,t[47]=N,t[48]=v),t[49]!==f||t[50]!==s||t[51]!==o?(y=o&&(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Vs,{children:(0,Z.jsx)(Vd,{})})}),(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`81H_23`})})]}),t[49]=f,t[50]=s,t[51]=o,t[52]=y):y=t[52],g=Ws,h=X,w=``,T=`ghost`,E=`icon`,D=l,O=!c,k=`doc-panel`,A=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23],k=t[24],A=t[25];let j;t[53]===c?j=t[54]:(j=(0,Z.jsx)(Vs,{children:c?(0,Z.jsx)($d,{}):(0,Z.jsx)(Qd,{})}),t[53]=c,t[54]=j);let M;t[55]!==h||t[56]!==j||t[57]!==w||t[58]!==T||t[59]!==E||t[60]!==D||t[61]!==O||t[62]!==k||t[63]!==A?(M=(0,Z.jsx)(h,{"data-doc-panel-toggle":w,variant:T,size:E,onClick:D,"aria-expanded":O,"aria-controls":k,"aria-label":A,asChild:!0,children:j}),t[55]=h,t[56]=j,t[57]=w,t[58]=T,t[59]=E,t[60]=D,t[61]=O,t[62]=k,t[63]=A,t[64]=M):M=t[64];let N;t[65]===c?N=t[66]:(N=(0,Z.jsx)(Hs,{side:`bottom`,children:c?(0,Z.jsx)(Y,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(Y,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[65]=c,t[66]=N);let P;t[67]!==g||t[68]!==M||t[69]!==N?(P=(0,Z.jsxs)(g,{children:[M,N]}),t[67]=g,t[68]=M,t[69]=N,t[70]=P):P=t[70];let F;t[71]!==_||t[72]!==v||t[73]!==y||t[74]!==P?(F=(0,Z.jsxs)(`div`,{className:_,children:[v,y,P]}),t[71]=_,t[72]=v,t[73]=y,t[74]=P,t[75]=F):F=t[75];let I;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[76]=I):I=t[76];let L;return t[77]!==x||t[78]!==S||t[79]!==C||t[80]!==F?(L=(0,Z.jsxs)(`div`,{"data-testid":x,className:S,children:[C,F,I]}),t[77]=x,t[78]=S,t[79]=C,t[80]=F,t[81]=L):L=t[81],L}function EP(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function DP(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var OP=`ok-terminal-height-v1`,kP=1/3,AP=.5;function jP(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*AP))}function MP(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*kP)}function NP(e,t){let n=jP(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(MP(t),n)}function PP(){return typeof window>`u`?0:window.innerHeight}function FP(e,t){try{let n=e??localStorage,r=t??PP(),i=n.getItem(OP);if(i==null)return NP(MP(r),r);let a=Number.parseInt(i,10);return NP(Number.isFinite(a)?a:MP(r),r)}catch{return 240}}function IP(e,t,n){try{let r=t??localStorage,i=n??PP();r.setItem(OP,String(NP(e,i)))}catch{}}function LP(){try{return typeof localStorage>`u`?240:FP()}catch{return 240}}function RP(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=an(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`0SBTff`}),t[0]=a,t[1]=s);let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[2]!==i||t[3]!==l?(u=wi(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=o?(0,Z.jsx)(Za,{"aria-hidden":`true`}):(0,Z.jsx)(Jt,{"aria-hidden":`true`}),t[5]=o,t[6]=d);let f;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[7]=n,t[8]=c,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=o?`left`:`top`,m;t[13]!==c||t[14]!==p?(m=(0,Z.jsx)(Hs,{side:p,sideOffset:8,children:c}),t[13]=c,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(Ws,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}var zP=`terminal-dock-panel`;function BP(e){let t=(0,$.c)(44),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c}=e,l=a===void 0?`bottom`:a,{resolvedTheme:u}=tr(),d=PC(),[f,p]=(0,Q.useState)(!r),m;t[0]===u?m=t[1]:(m=yu(u),t[0]=u,t[1]=m);let h=m.background,g=r&&l===`bottom`,_=!r&&l===`bottom`&&c!=null,[v]=(0,Q.useState)(VP),y=(0,Q.useRef)(v),[b,x]=(0,Q.useState)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(e){C.current!=null&&clearTimeout(C.current),C.current=setTimeout(()=>{IP(e),C.current=null},100)},t[2]=w):w=t[2];let T=w,E=(0,Q.useRef)(null),D,O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{C.current!=null&&clearTimeout(C.current),E.current!=null&&(window.removeEventListener(`pointerup`,E.current),E.current=null)},O=[],t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,Q.useEffect)(D,O);let k,A;t[5]!==g||t[6]!==d?(k=()=>{let e=d.current;e!=null&&(g?e.resize(`${y.current}px`):e.collapse())},A=[g,d],t[5]=g,t[6]=d,t[7]=k,t[8]=A):(k=t[7],A=t[8]),(0,Q.useEffect)(k,A);let j=b||void 0,M;t[9]!==c||t[10]!==_?(M=_&&c?(0,Z.jsx)(RP,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[9]=c,t[10]=_,t[11]=M):M=t[11];let N;t[12]!==n||t[13]!==s||t[14]!==M?(N=(0,Z.jsx)(PE,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,M]})}),t[12]=n,t[13]=s,t[14]=M,t[15]=N):N=t[15];let P=!g,F;t[16]===g?F=t[17]:(F=()=>{if(!g)return;x(!0),S.current=!0;let e=()=>{x(!1),S.current=!1,window.removeEventListener(`pointerup`,e),E.current=null};E.current=e,window.addEventListener(`pointerup`,e)},t[16]=g,t[17]=F);let I;t[18]!==g||t[19]!==P||t[20]!==F?(I=(0,Z.jsx)(FE,{withHandle:g,disabled:P,onPointerDown:F}),t[18]=g,t[19]=P,t[20]=F,t[21]=I):I=t[21];let L;t[22]===h?L=t[23]:(L={backgroundColor:h},t[22]=h,t[23]=L);let R=g?`${v}px`:0,z;t[24]!==i||t[25]!==r?(z=e=>{let t=e.asPercentage===0;p(t),S.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(y.current=e.inPixels,T(e.inPixels)))},t[24]=i,t[25]=r,t[26]=z):z=t[26];let B=!b&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,V;t[27]===B?V=t[28]:(V=wi(`flex flex-col`,B),t[27]=B,t[28]=V);let H;t[29]===o?H=t[30]:(H=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[29]=o,t[30]=H);let U;t[31]!==f||t[32]!==d||t[33]!==L||t[34]!==R||t[35]!==z||t[36]!==V||t[37]!==H?(U=(0,Z.jsx)(PE,{id:zP,style:L,panelRef:d,defaultSize:R,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:z,inert:f,className:V,children:H}),t[31]=f,t[32]=d,t[33]=L,t[34]=R,t[35]=z,t[36]=V,t[37]=H,t[38]=U):U=t[38];let W;return t[39]!==N||t[40]!==I||t[41]!==U||t[42]!==j?(W=(0,Z.jsxs)(NE,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":j,children:[N,I,U]}),t[39]=N,t[40]=I,t[41]=U,t[42]=j,t[43]=W):W=t[43],W}function VP(){return LP()}var HP=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-QvRIx_do.js`),__vite__mapDeps([48,1,2,49,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,64,65]),import.meta.url)).ActivityModeContent})),UP=`300px`,WP=`600px`,GP=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function KP(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(JP,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(qP,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(yl,{name:`editor-area`,children:(0,Z.jsxs)(Fa,{children:[n,r]})}),t[3]=n,t[4]=i),i}function qP(){let e=(0,$.c)(5),t=Vi(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==n?(r=(0,Z.jsx)(OE,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function JP(e){let t=(0,$.c)(237),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,onTerminalPlacement:u,onRevealTerminal:d}=e,f=s===void 0?!1:s,p=l===void 0?`right`:l,{_:m}=an(),{resolvedTheme:h}=tr(),g;t[0]===h?g=t[1]:(g=yu(h),t[0]=h,t[1]=g);let _=g.background,{activeDocName:v,activeProvider:y,activeTarget:b,recycleDocument:x,docPanelMode:S,docPanelAgentId:C,docPanelExpandSignal:w}=pt(),{openDocumentTransition:T}=Dt(),{requestAddProperty:E}=Ma(),D=rD(y,v),O=oD(v,n===`source`?`source`:`wysiwyg`),k=jD(y),A=k===`connected`||k===`synced`,j=aD(v)===`conflict`,[M,N]=(0,Q.useState)(!1),P,F;t[2]!==y||t[3]!==M?(P=()=>{y!=null&&!M&&N(!0)},F=[y,M],t[2]=y,t[3]=M,t[4]=P,t[5]=F):(P=t[4],F=t[5]),(0,Q.useEffect)(P,F);let I=(0,Q.useDeferredValue)(v),L=b?.kind===`missing`,R=!!v&&b?.kind!==`folder`,z;t[6]!==m||t[7]!==L?(z=L?m({id:`K-a33w`}):void 0,t[6]=m,t[7]=L,t[8]=z):z=t[8];let B=z,[V]=(0,Q.useState)($P),H=V!==null,U;t[9]===V?U=t[10]:(U=()=>hD(V,window.innerWidth,`right`),t[9]=V,t[10]=U);let[W,G]=(0,Q.useState)(U),K=(0,Q.useRef)(W),ee,q;t[11]===W?(ee=t[12],q=t[13]):(ee=()=>{K.current=W},q=[W],t[11]=W,t[12]=ee,t[13]=q),(0,Q.useEffect)(ee,q);let J=PC(),ne=PC(),re;t[14]===W?re=t[15]:(re=()=>wD(`right`,W,SD())===`collapsed`,t[14]=W,t[15]=re);let[ie]=(0,Q.useState)(re),[ae,oe]=(0,Q.useState)(ie),se=(0,Q.useRef)(ae),[ce,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(null),me=p===`right`,he=me?`right`:`bottom`,ge=o!=null&&me&&f,_e=o!=null&&!f&&d!=null,ve=_e&&!me,ye=_e&&me,be=me&&f&&ce!=null,xe=be?ce:ue,Se=(me?be:f)&&xe!=null,Ce,we;t[16]!==xe||t[17]!==u||t[18]!==he||t[19]!==fe||t[20]!==Se?(Ce=()=>{u?.({container:xe,isShowing:Se,dockPosition:he,editorRegion:fe})},we=[u,xe,Se,he,fe],t[16]=xe,t[17]=u,t[18]=he,t[19]=fe,t[20]=Se,t[21]=Ce,t[22]=we):(Ce=t[21],we=t[22]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[23]===ae?(Te=t[24],Ee=t[25]):(Te=()=>{se.current=ae},Ee=[ae],t[23]=ae,t[24]=Te,t[25]=Ee),(0,Q.useEffect)(Te,Ee);let[De,Oe]=(0,Q.useState)(!1),ke=(0,Q.useRef)(!1),[Ae]=(0,Q.useState)(QP),je=(0,Q.useRef)(Ae),Ne=(0,Q.useRef)(null),Pe;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=function(e){Ne.current!=null&&clearTimeout(Ne.current),Ne.current=setTimeout(()=>{uD(e),Ne.current=null},100)},t[26]=Pe):Pe=t[26];let Fe=Pe,[Ie]=(0,Q.useState)(ZP),Le=(0,Q.useRef)(Ie),[Re,ze]=(0,Q.useState)(!1),Be=(0,Q.useRef)(!1),Ve=(0,Q.useRef)(null),He;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(He=function(e){Ve.current!=null&&clearTimeout(Ve.current),Ve.current=setTimeout(()=>{kD(e),Ve.current=null},100)},t[27]=He):He=t[27];let Ue=He,We,Ge;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(We=()=>()=>{Ne.current!=null&&clearTimeout(Ne.current),Ve.current!=null&&clearTimeout(Ve.current)},Ge=[],t[28]=We,t[29]=Ge):(We=t[28],Ge=t[29]),(0,Q.useEffect)(We,Ge);let[Ke,qe]=(0,Q.useState)(null),Je=(0,Q.useRef)(null),Ye=kC(),Xe=(0,Q.useRef)(ge),Ze,Qe;t[30]===ge?(Ze=t[31],Qe=t[32]):(Ze=()=>{Xe.current=ge},Qe=[ge],t[30]=ge,t[31]=Ze,t[32]=Qe),(0,Q.useEffect)(Ze,Qe);let $e;t[33]!==J||t[34]!==ne?($e=function(){for(let e of[J,ne]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=Je.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[33]=J,t[34]=ne,t[35]=$e):$e=t[35];let et=$e,tt;t[36]!==Ye||t[37]!==et?(tt=function(e){if(ke.current||Be.current)return;let t=Ye.current;if(t!=null)try{let n=et();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(XP);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:je.current),`terminal-column`in r&&(o[`terminal-column`]=Le.current),Object.keys(o).length===0)return;let s=DP({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[36]=Ye,t[37]=et,t[38]=tt):tt=t[38];let nt=tt,rt=(0,Q.useRef)(nt),it;t[39]===nt?it=t[40]:(it=()=>{rt.current=nt},t[39]=nt,t[40]=it),(0,Q.useEffect)(it);let at;t[41]!==nt||t[42]!==J?(at=function(){Xe.current?nt(!1):J.current?.expand()},t[41]=nt,t[42]=J,t[43]=at):at=t[43];let ot=at,st;t[44]!==nt||t[45]!==ae||t[46]!==J?(st=function(){if(J.current==null)return;let e=K.current;ae?(TD(`right`,e,`open`),Xe.current?nt(!1):J.current?.expand()):(TD(`right`,e,`collapsed`),Xe.current?nt(!0):J.current?.collapse())},t[44]=nt,t[45]=ae,t[46]=J,t[47]=st):st=t[47];let ct=st,lt,ut;t[48]!==nt||t[49]!==V||t[50]!==J?(lt=()=>{let e=window.matchMedia(`(min-width: ${pD}px)`),t=()=>{let e=hD(V,window.innerWidth,`right`);G(e);let t=wD(`right`,e,SD())===`collapsed`;oe(t),Xe.current?nt(t):t?J.current?.collapse():J.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ut=[V,J,nt],t[48]=nt,t[49]=V,t[50]=J,t[51]=lt,t[52]=ut):(lt=t[51],ut=t[52]),(0,Q.useEffect)(lt,ut);let dt,ft;t[53]!==Ke||t[54]!==H?(dt=()=>{if(Ke==null||H)return;let e=new ResizeObserver(()=>{rt.current(se.current)});return e.observe(Ke),()=>e.disconnect()},ft=[Ke,H],t[53]=Ke,t[54]=H,t[55]=dt,t[56]=ft):(dt=t[55],ft=t[56]),(0,Q.useEffect)(dt,ft);let mt,ht;t[57]!==ot||t[58]!==a?(mt=()=>{let e=e=>{a(e),ot()},t=dv();return t&&e(t),pv(t=>{dv(),e(t)})},ht=[a,ot],t[57]=ot,t[58]=a,t[59]=mt,t[60]=ht):(mt=t[59],ht=t[60]),(0,Q.useEffect)(mt,ht);let gt,_t;t[61]!==w||t[62]!==ot?(gt=()=>{w!==0&&ot()},_t=[w,ot],t[61]=w,t[62]=ot,t[63]=gt,t[64]=_t):(gt=t[63],_t=t[64]),(0,Q.useEffect)(gt,_t);let vt=(0,Q.useRef)(ge),yt,bt;t[65]!==ae||t[66]!==ge?(yt=()=>{if(vt.current===ge)return;vt.current=ge;let e=ae;queueMicrotask(()=>{rt.current(e)})},bt=[ge,ae],t[65]=ae,t[66]=ge,t[67]=yt,t[68]=bt):(yt=t[67],bt=t[68]),(0,Q.useLayoutEffect)(yt,bt);let xt,St;t[69]===ae?(xt=t[70],St=t[71]):(xt=()=>{if(!ae||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},St=[ae],t[69]=ae,t[70]=xt,t[71]=St),(0,Q.useLayoutEffect)(xt,St);let Ct,wt;t[72]===ae?(Ct=t[73],wt=t[74]):(Ct=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!ae})},wt=[ae],t[72]=ae,t[73]=Ct,t[74]=wt),(0,Q.useEffect)(Ct,wt);let Tt,Et;t[75]===ct?(Tt=t[76],Et=t[77]):(Tt=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&ct()})},Et=[ct],t[75]=ct,t[76]=Tt,t[77]=Et),(0,Q.useEffect)(Tt,Et);let Ot,kt;t[78]===ct?(Ot=t[79],kt=t[80]):(Ot=()=>{if(window.okDesktop!=null)return;let e=e=>{El(e,`toggle-document-panel`)&&(e.preventDefault(),ct())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},kt=[ct],t[78]=ct,t[79]=Ot,t[80]=kt),(0,Q.useEffect)(Ot,kt);let At=(0,Q.useRef)(null),[jt,Mt]=(0,Q.useState)(null),[Nt,Pt]=(0,Q.useState)(!1),Ft=b?.kind===`large-file`?b.docName:v,It,Lt;t[81]===Ft?(It=t[82],Lt=t[83]):(It=()=>{if(Ft&&Ft!==At.current){let e=At.current;At.current=Ft,Mt(e)}},Lt=[Ft],t[81]=Ft,t[82]=It,t[83]=Lt),(0,Q.useEffect)(It,Lt);let Rt;t[84]===T?Rt=t[85]:(Rt=function(e){let t=Jc(e);window.location.hash===t?T(e):window.location.hash=t},t[84]=T,t[85]=Rt);let zt=Rt,Bt,Vt=null;if(b?.kind===`large-file`){let e;t[86]!==zt||t[87]!==jt?(e=jt?{previousDocName:jt,onNavigateBack:zt}:void 0,t[86]=zt,t[87]=jt,t[88]=e):e=t[88];let n;t[89]!==b.docName||t[90]!==b.limit||t[91]!==b.size||t[92]!==e?(n=(0,Z.jsx)(dE,{docName:b.docName,size:b.size,limit:b.limit,backNav:e}),t[89]=b.docName,t[90]=b.limit,t[91]=b.size,t[92]=e,t[93]=n):n=t[93],Bt=n}else if(b?.kind===`folder`){let e;t[94]!==H||t[95]!==f?(e=sO({terminalVisible:f,isEmbedded:H}),t[94]=H,t[95]=f,t[96]=e):e=t[96];let n=e,r;t[97]===b.folderPath?r=t[98]:(r=(0,Z.jsx)(sE,{folderPath:b.folderPath}),t[97]=b.folderPath,t[98]=r);let i;t[99]!==b.folderPath||t[100]!==n?(i=n?(0,Z.jsx)(JD,{folderPath:b.folderPath}):null,t[99]=b.folderPath,t[100]=n,t[101]=i):i=t[101];let a;if(t[102]!==r||t[103]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[r,i]}),t[102]=r,t[103]=i,t[104]=a):a=t[104],Bt=a,S===`agent`&&C!==null){let e;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(FE,{withHandle:!0}),t[105]=e):e=t[105];let n;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(PE,{id:`agent-panel`,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(HP,{showBackButton:!1})})})]}),t[106]=n):n=t[106],Vt=n}}else if(b?.kind===`asset`){let e;t[107]!==b.assetPath||t[108]!==b.mediaKind?(e=(0,Z.jsx)(YC,{assetPath:b.assetPath,mediaKind:b.mediaKind},b.assetPath),t[107]=b.assetPath,t[108]=b.mediaKind,t[109]=e):e=t[109],Bt=e}else if(b?.kind===`skill-file`){let e=`${b.scope}/${b.name}/${b.path}`,n;t[110]!==b.name||t[111]!==b.path||t[112]!==b.scope||t[113]!==e?(n=(0,Z.jsx)(yE,{scope:b.scope,name:b.name,path:b.path},e),t[110]=b.name,t[111]=b.path,t[112]=b.scope,t[113]=e,t[114]=n):n=t[114],Bt=n}else if(!y||!v)if((typeof window<`u`?_l(window.location.hash):null)!==null)if(o!=null&&M){let e;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(XC,{}),t[115]=e):e=t[115],Bt=e;let n;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(FE,{withHandle:!0,disabled:!0}),t[116]=n):n=t[116];let r=ie?0:`${Ae}px`,i;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[117]=i):i=t[117];let a;t[118]===r?a=t[119]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(PE,{id:`doc-panel`,defaultSize:r,minSize:UP,maxSize:WP,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[118]=r,t[119]=a),Vt=a}else{let e;return t[120]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(XC,{}),t[120]=e):e=t[120],e}else{let e=f&&he===`bottom`,n;t[121]===e?n=t[122]:(n=(0,Z.jsx)(OT,{terminalVisible:e}),t[121]=e,t[122]=n),Bt=n}else{let e=n===`source`,o=!A,s=ae,c;t[123]!==v||t[124]!==E?(c=function(){v&&E(v)},t[123]=v,t[124]=E,t[125]=c):c=t[125];let l=c,u;t[126]!==v||t[127]!==H||t[128]!==f?(u=oO({terminalVisible:f,isEmbedded:H,activeDocName:v}),t[126]=v,t[127]=H,t[128]=f,t[129]=u):u=t[129];let d=u,p=I??v,m=jt??void 0,h;t[130]!==B||t[131]!==e||t[132]!==zt||t[133]!==x||t[134]!==p||t[135]!==m?(h=(0,Z.jsx)(oN,{activeDocName:p,isSourceMode:e,editorPlaceholder:B,previousDocName:m,onNavigateBack:zt,onRecycle:x}),t[130]=B,t[131]=e,t[132]=zt,t[133]=x,t[134]=p,t[135]=m,t[136]=h):h=t[136];let g;t[137]!==v||t[138]!==e?(g=(0,Z.jsx)($E,{activeDocName:v,isSourceMode:e}),t[137]=v,t[138]=e,t[139]=g):g=t[139];let _;t[140]!==v||t[141]!==I?(_=EP({activeDocName:v,deferredActiveDocName:I,mountResolved:v!==null&&te(v),syncResolved:v!==null&&Me(v)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(XC,{}),v===null?null:(0,Z.jsx)(fE,{docName:v})]}):null,t[140]=v,t[141]=I,t[142]=_):_=t[142];let y;t[143]!==h||t[144]!==g||t[145]!==_?(y=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,_]}),t[143]=h,t[144]=g,t[145]=_,t[146]=y):y=t[146];let b;t[147]!==v||t[148]!==j||t[149]!==s||t[150]!==e||t[151]!==r||t[152]!==l||t[153]!==ye||t[154]!==o||t[155]!==ct?(b=!j&&(0,Z.jsx)(TP,{activeDocName:v,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:ct,reserveRightGutter:ye&&s}),t[147]=v,t[148]=j,t[149]=s,t[150]=e,t[151]=r,t[152]=l,t[153]=ye,t[154]=o,t[155]=ct,t[156]=b):b=t[156];let C;t[157]!==v||t[158]!==Nt||t[159]!==e||t[160]!==d?(C=d?(0,Z.jsx)(JD,{docName:v,surface:e?`source`:`wysiwyg`,dismissed:Nt,onDismiss:()=>Pt(!0),onReopen:()=>Pt(!1)}):null,t[157]=v,t[158]=Nt,t[159]=e,t[160]=d,t[161]=C):C=t[161];let w;t[162]!==y||t[163]!==b||t[164]!==C?(w=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[y,b,C]}),t[162]=y,t[163]=b,t[164]=C,t[165]=w):w=t[165];let T;t[166]!==Nt||t[167]!==d?(T=d&&Nt?{onReopen:()=>Pt(!1)}:null,t[166]=Nt,t[167]=d,t[168]=T):T=t[168];let k;t[169]!==ve||t[170]!==O||t[171]!==R||t[172]!==D||t[173]!==T?(k=(0,Z.jsx)(sP,{stats:D,selectionStats:O,showStats:R,composerBadge:T,reserveRightGutter:ve}),t[169]=ve,t[170]=O,t[171]=R,t[172]=D,t[173]=T,t[174]=k):k=t[174];let M;t[175]!==w||t[176]!==k?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[w,k]}),t[175]=w,t[176]=k,t[177]=M):M=t[177],Bt=M;let N=ge&&ae,P=!ae,F;t[178]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{Oe(!0),ke.current=!0;let e=()=>{Oe(!1),ke.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[178]=F):F=t[178];let L;t[179]!==ae||t[180]!==P?(L=(0,Z.jsx)(FE,{withHandle:P,disabled:ae,onPointerDown:F}),t[179]=ae,t[180]=P,t[181]=L):L=t[181];let z=ie?0:`${Ae}px`,V=N?`0px`:UP,U;t[182]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{oe(e.asPercentage===0),e.inPixels>0&&ke.current&&(je.current=e.inPixels,Fe(e.inPixels))},t[182]=U):U=t[182];let W=!De&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,G;t[183]===W?G=t[184]:(G=wi(`flex flex-col bg-muted/20`,W),t[183]=W,t[184]=G);let K;t[185]!==v||t[186]!==i||t[187]!==S||t[188]!==e||t[189]!==a?(K=(0,Z.jsx)(zx,{docName:v,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:S}),t[185]=v,t[186]=i,t[187]=S,t[188]=e,t[189]=a,t[190]=K):K=t[190];let ee;t[191]!==N||t[192]!==ae||t[193]!==J||t[194]!==z||t[195]!==V||t[196]!==G||t[197]!==K?(ee=(0,Z.jsx)(PE,{id:`doc-panel`,panelRef:J,disabled:N,defaultSize:z,minSize:V,maxSize:WP,collapsible:!0,collapsedSize:0,onResize:U,inert:ae,className:G,children:K}),t[191]=N,t[192]=ae,t[193]=J,t[194]=z,t[195]=V,t[196]=G,t[197]=K,t[198]=ee):ee=t[198];let q;t[199]!==L||t[200]!==ee?(q=(0,Z.jsxs)(Z.Fragment,{children:[L,ee]}),t[199]=L,t[200]=ee,t[201]=q):q=t[201],Vt=q}let Ht;t[202]!==d||t[203]!==c||t[204]!==o||t[205]!==he||t[206]!==f||t[207]!==Bt?(Ht=o==null?Bt:(0,Z.jsx)(BP,{visible:f,onVisibleChange:c??YP,dockPosition:he,onBottomContainer:de,onEditorRegion:pe,onReveal:d,children:Bt}),t[202]=d,t[203]=c,t[204]=o,t[205]=he,t[206]=f,t[207]=Bt,t[208]=Ht):Ht=t[208];let Ut=Ht,Wt;t[209]!==Ie||t[210]!==Re||t[211]!==c||t[212]!==ne||t[213]!==ge||t[214]!==_?(Wt=ge?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(FE,{withHandle:!0,onPointerDown:()=>{ze(!0),Be.current=!0;let e=()=>{ze(!1),Be.current=!1,window.removeEventListener(`pointerup`,e),ne.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(PE,{id:`terminal-column`,panelRef:ne,style:{backgroundColor:_},defaultSize:`${Ie}px`,minSize:`320px`,maxSize:`900px`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&Be.current&&(Le.current=e.inPixels,Ue(e.inPixels))},className:wi(`flex flex-col`,!Re&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:le,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[209]=Ie,t[210]=Re,t[211]=c,t[212]=ne,t[213]=ge,t[214]=_,t[215]=Wt):Wt=t[215];let Gt=Wt,Kt=Vt!=null&&!ie||ge,qt;t[216]===Symbol.for(`react.memo_cache_sentinel`)?(qt=e=>{qe(e),Je.current=e},t[216]=qt):qt=t[216];let Jt=De||Re||void 0,Yt;t[217]===Kt?Yt=t[218]:(Yt=Kt?{}:{defaultSize:`100%`},t[217]=Kt,t[218]=Yt);let Xt=!(De||Re)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Zt;t[219]===Xt?Zt=t[220]:(Zt=wi(Xt),t[219]=Xt,t[220]=Zt);let Qt;t[221]!==Ut||t[222]!==Yt||t[223]!==Zt?(Qt=(0,Z.jsx)(PE,{minSize:`30%`,...Yt,className:Zt,children:Ut}),t[221]=Ut,t[222]=Yt,t[223]=Zt,t[224]=Qt):Qt=t[224];let $t;t[225]!==Ye||t[226]!==Vt||t[227]!==Jt||t[228]!==Qt||t[229]!==Gt?($t=(0,Z.jsxs)(NE,{orientation:`horizontal`,groupRef:Ye,"data-dragging":Jt,children:[Qt,Vt,Gt]}),t[225]=Ye,t[226]=Vt,t[227]=Jt,t[228]=Qt,t[229]=Gt,t[230]=$t):$t=t[230];let en;t[231]!==d||t[232]!==ye?(en=ye?(0,Z.jsx)(RP,{dockPosition:`right`,onReveal:d,className:`top-2.5 right-0`}):null,t[231]=d,t[232]=ye,t[233]=en):en=t[233];let tn;return t[234]!==$t||t[235]!==en?(tn=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:qt,children:[$t,en]}),t[234]=$t,t[235]=en,t[236]=tn):tn=t[236],tn}function YP(){}function XP(e){return!GP.has(e)}function ZP(){return AD()}function QP(){return dD()}function $P(){return Fr()}function eF(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function tF(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var nF=1e3,rF=!1;function iF(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function aF(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:xs(i)?a=i:(a=void 0,rF||(rF=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(iF({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=tF(i),{current:c,crossDoc:l}=a?_s(a,n,Date.now()):{current:[],crossDoc:[]},u=oF,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>eF(e.current,p)&&eF(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,nF);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function oF(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var sF=`sync-status`;async function cF(e){try{let t=await Oy(e);t.ok||Ss.error(t.message,{id:sF,duration:1/0})}catch{}}function lF(e,t){let n=(0,$.c)(6),{_:r}=an(),i=Ig(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){Ss.dismiss(sF);return}o.current=!0;let e=window.okDesktop;Ss.warning(r({id:`HGNCsl`}),{id:sF,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{cF(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,Ss.success(r({id:`GhjUB_`}),{id:sF,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var uF=4,dF=3,fF={Bird:od,Cat:pd,Dog:xd,Fish:Dd,Mouse:of,Rabbit:af,Shrimp:ff,Snail:pf,Squirrel:_f,Turtle:Df};Object.freeze(Object.keys(fF));function pF(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(fF,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var mF={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function hF(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=an(),o=pF(n),s=o.kind===`animal`?fF[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=Or(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=fi(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(Hs,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(Ws,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function gF(e){let t=mF[e.icon];return e.displayName||t||Ms._({id:`iEQQyu`})}function _F(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function vF(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=an(),{activeDocName:s}=pt(),{presence:c,agentId:l}=n,u=gF(c),d=_F(c.mode),f=!r&&d,p=c.currentDoc&&c.currentDoc!==`(connected)`?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(ys,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(ys,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(Vs,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(Hs,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(Ws,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function yF(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?Ms._({id:`9euN0m`,values:{count:n}}):Ms._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(hF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(vF,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(Tt,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(w,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function bF(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(hF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(vF,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function xF(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=pt(),{current:s,crossDoc:c}=aF(t,r,n);if(lF(jD(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,uF),n;e[6]===s?n=e[7]:(n=s.slice(uF),e[6]=s,e[7]=n);let r=n,u=c.slice(0,dF),d;e[8]===c?d=e[9]:(d=c.slice(dF),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>bF(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(yF,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>bF(e,p,!0,m)),f.length>0?(0,Z.jsx)(yF,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function SF(e,t){return t.trim()}function CF(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function wF(e,t){let n=SF(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function TF(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(dl(e)){let t=s.get(Iu(e.docName,e.docExt));if(t){let n=ol(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:qn(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(cl(e))return{...e,path:MF(e.path,n)};if(il(e)){let t=s.get(e.path);return t&&xl(t)?{kind:`document`,docName:Su(t),docExt:Cl(t),size:e.size,modified:e.modified}:{...e,path:t??MF(e.path,n)}}return e})}function EF(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>dl(e)?!i.has(e.docName)&&!IF(e.docName,n):cl(e)?!IF(e.path,n):il(e)?!a.has(e.path)&&!IF(e.path,n):!0)}function DF(e,t){if(e.kind!==`asset`||t.some(t=>il(t)&&t.path===e.path))return e;let n=zu(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function OF(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>NF(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>dl(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>cl(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(dl(i)){let e=FF(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(cl(i)){let e=PF(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function kF(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function AF(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function jF(e,t){let n=e.kind===`file`?Iu(e.path,e.docExt):e.path;return co(t.contentDir,n,t.pathSeparator)}function MF(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function NF(e,t){return dl(e)&&dl(t)?e.docName===t.docName:cl(e)&&cl(t)||il(e)&&il(t)?e.path===t.path:!1}function PF(e,t,n){return e===t?n:FF(e,t,n)}function FF(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function IF(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function LF(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)(Op,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function RF(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=wi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(kp,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zF(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(Mp,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function BF(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)(Rp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function VF(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=wi(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ap,{children:(0,Z.jsx)(jp,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function HF(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=wi(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(Pp,{"data-slot":`context-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function UF(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=wi(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Qa,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(zp,{"data-slot":`context-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function WF(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=wi(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Bp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function GF(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=wi(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(Ip,{children:(0,Z.jsx)(Ha,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,Z.jsxs)(Fp,{"data-slot":`context-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function KF(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=wi(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Np,{"data-slot":`context-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function qF(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=wi(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Lp,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var JF=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,YF=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,XF={start:[es.Space],cancel:[es.Esc],end:[es.Space,es.Enter]};function ZF(e){return wi(JF,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function QF(e){return e?void 0:-1}function $F({className:e,isDragging:t}){return wi(e,t&&YF)}function eI(e){return e.code===es.Enter&&e.target===e.currentTarget}function tI({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&eI(e)?`activate-tab`:`delegate-sortable`}function nI({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:as.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function rI(e){let t=e?.querySelectorAll(`[data-editor-tab-sortable]`)??[],n=1/0,r=-1/0;for(let e of t){let t=e.getBoundingClientRect();n=Math.min(n,t.left),r=Math.max(r,t.right)}return Number.isFinite(n)&&Number.isFinite(r)?{left:n,right:r}:null}function iI(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var aI=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return Jo(e)},oI=[`.md`,`.mdx`],sI=`group relative -mb-px flex h-10 min-w-28 max-w-64 shrink-0 cursor-pointer items-center overflow-hidden border border-transparent font-medium transition-colors`,cI=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,lI=wi(cI,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),uI=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function dI(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function fI(e){let t=Jc(e);window.location.hash!==t&&(window.location.hash=t)}function pI(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function mI(e,t){let n=[t,...oI].filter((e,t,n)=>e&&n.indexOf(e)===t),r=e.toLowerCase(),i=n.find(t=>e.length>t.length&&r.endsWith(t.toLowerCase()));return i?e.slice(0,-i.length):e}function hI(e){let t=(0,$.c)(37),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({activateFromKeyboard:n,className:r,tabId:l,disabled:i,onKeyDown:a,ref:o,style:s,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u;t[9]!==i||t[10]!==l?(u={id:l,disabled:i},t[9]=i,t[10]=l,t[11]=u):u=t[11];let{attributes:d,listeners:f,rect:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=rs(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=nI({activeWidth:v,isDragging:_,outerStyle:s,transform:h,transition:g}),t[12]=_,t[13]=s,t[14]=v,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=y,x;t[18]!==o||t[19]!==m?(x=function(e){m(e),typeof o==`function`?o(e):o&&`current`in o&&(o.current=e)},t[18]=o,t[19]=m,t[20]=x):x=t[20];let S=x,C=f?.onKeyDown,w;t[21]!==n||t[22]!==_||t[23]!==a||t[24]!==C?(w=function(e){a?.(e);let t=tI({event:e,hasKeyboardActivation:!!n,isDragging:_});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}C?.(e)}},t[21]=n,t[22]=_,t[23]=a,t[24]=C,t[25]=w):w=t[25];let T=w,E;t[26]!==r||t[27]!==_?(E=$F({className:r,isDragging:_}),t[26]=r,t[27]=_,t[28]=E):E=t[28];let D;return t[29]!==d||t[30]!==S||t[31]!==T||t[32]!==f||t[33]!==c||t[34]!==b||t[35]!==E?(D=(0,Z.jsx)(`div`,{ref:S,"data-editor-tab-sortable":``,className:E,style:b,...c,...d,...f,onKeyDown:T}),t[29]=d,t[30]=S,t[31]=T,t[32]=f,t[33]=c,t[34]=b,t[35]=E,t[36]=D):D=t[36],D}function gI(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=De(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=De(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y;t[13]===n?y=t[14]:(y=(0,Z.jsx)(RF,{asChild:!0,children:n}),t[13]=n,t[14]=y);let b;t[15]!==r||t[16]!==u?(b=()=>r(u),t[15]=r,t[16]=u,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Y,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(HF,{disabled:m,onSelect:b,children:x}),t[19]=m,t[20]=b,t[21]=S):S=t[21];let C=g.length===0,w;t[22]!==i||t[23]!==g?(w=()=>{i(g)},t[22]=i,t[23]=g,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Y,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(HF,{disabled:C,onSelect:w,children:T}),t[26]=C,t[27]=w,t[28]=E):E=t[28];let D=v.length===0,O;t[29]!==v||t[30]!==i?(O=()=>{i(v)},t[29]=v,t[30]=i,t[31]=O):O=t[31];let k;t[32]===l.length?k=t[33]:(k=l.length?(0,Z.jsx)(Y,{id:`U2Kx6T`}):(0,Z.jsx)(Y,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(HF,{disabled:D,"data-testid":`editor-tab-context-close-all`,onSelect:O,children:k}),t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==f||t[39]!==m||t[40]!==c||t[41]!==u||t[42]!==d?(j=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qF,{}),(0,Z.jsx)(HF,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(Y,{id:`SYfHmN`}):(0,Z.jsx)(Y,{id:`3pU8e-`})})]}),t[38]=f,t[39]=m,t[40]=c,t[41]=u,t[42]=d,t[43]=j):j=t[43];let M;t[44]!==E||t[45]!==A||t[46]!==j||t[47]!==S?(M=(0,Z.jsxs)(VF,{className:`min-w-40`,children:[S,E,A,j]}),t[44]=E,t[45]=A,t[46]=j,t[47]=S,t[48]=M):M=t[48];let N;return t[49]!==M||t[50]!==y?(N=(0,Z.jsxs)(LF,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function _I(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:i,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=an();if(a){let e;t[0]!==c||t[1]!==n?(e=c({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=c,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==o||t[4]!==s?(r=e=>{e.stopPropagation(),s(o)},t[3]=o,t[4]=s,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(rf,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let l;t[10]!==c||t[11]!==n?(l=c({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=c,t[11]=n,t[12]=l):l=t[12];let u;t[13]===i?u=t[14]:(u=ZF(i),t[13]=i,t[14]=u);let d;t[15]===i?d=t[16]:(d=QF(i),t[15]=i,t[16]=d);let f;t[17]!==r||t[18]!==o?(f=e=>{e.stopPropagation(),r(o)},t[17]=r,t[18]=o,t[19]=f):f=t[19];let p;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Cs,{"aria-hidden":`true`}),t[20]=p):p=t[20];let m;return t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f?(m=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:u,tabIndex:d,onClick:f,children:p}),t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=m):m=t[25],m}function vI(e){let t=(0,$.c)(1),{docName:n}=e;if(aD(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(eo,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function yI(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:c,closeNewTab:l,closeTab:u,closeTabs:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,newTabIds:h,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,remapTabsForRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:C}=pt(),{_:w}=an(),{pageMeta:T}=to(),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(t),H;e[0]!==n||e[1]!==t||e[2]!==i?(H=n??(i?Yt(i):t?en(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=H):H=e[3];let U=H,W;e[4]!==r||e[5]!==U||e[6]!==m||e[7]!==h||e[8]!==_?(W=m?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${h.join(`\0`)}`:U?`${U}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=U,e[6]=m,e[7]=h,e[8]=_,e[9]=W):W=e[9];let G=W,K,ee;e[10]===t?(K=e[11],ee=e[12]):(K=()=>{V.current=t},ee=[t],e[10]=t,e[11]=K,e[12]=ee),(0,Q.useEffect)(K,ee);let te,q;e[13]===G?(te=e[14],q=e[15]):(te=()=>{G&&(E.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},q=[G],e[13]=G,e[14]=te,e[15]=q),(0,Q.useEffect)(te,q);let J,re;e[16]===k?(J=e[17],re=e[18]):(J=()=>{k&&(L.current?.focus(),L.current?.select())},re=[k],e[16]=k,e[17]=J,e[18]=re),(0,Q.useEffect)(J,re);let ae,oe;e[19]!==_||e[20]!==k?(ae=()=>{!k||_.includes(k.tabId)||(z.current=!0,B.current=null,A(null),M(``),P(null),I(!1))},oe=[_,k],e[19]=_,e[20]=k,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);z.current=!1,B.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),P(null)},ce=function(){z.current=!0,B.current=null,A(null),M(``),P(null),I(!1)},le=async function(){if(z.current){z.current=!1;return}if(R.current)return;let e=k?.docName;if(!e){ce();return}let t=SF(`file`,mI(j,T.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===B.current){L.current?.focus();return}if(!CF(t)){P(w({id:`P8yDjG`})),L.current?.focus();return}let i=wF({kind:`file`,path:e,name:r},t);R.current=!0,I(!0),P(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(z.current){I(!1),R.current=!1;return}let r=await s(n,`Server error (HTTP ${n.status})`);if(!r.ok){P(r.title),I(!1),R.current=!1,B.current=t,L.current?.focus();return}let a=Ie(Nr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=V.current,l=kF(o,a);it(a);let u=!0;try{let e=AF(a,f(),p);await Promise.all(e.map(e=>c(e))),b(a),Os([`files`,`backlinks`,`graph`])}catch(n){let r=n;u=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),Ss.error(w({id:`MUBR8r`}))}z.current=!0,A(null),M(``),P(null),I(!1),R.current=!1,B.current=null,u&&l&&l!==o&&fI(l)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),P(w({id:`HIb0vl`})),I(!1),R.current=!1,B.current=t,L.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===h?de=e[24]:(de=new Set(h),e[23]=h,e[24]=de);let fe=de,pe;e[25]===D?pe=e[26]:(pe=iI(D),e[25]=D,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==l||e[30]!==d||e[31]!==fe?(ge=function(e){let t=[],n=[];for(let r of e)fe.has(r)?n.push(r):t.push(r);t.length>0&&d(t);for(let e of n)l(e)},e[29]=l,e[30]=d,e[31]=fe,e[32]=ge):ge=e[32];let _e=ge,ve;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ve={activationConstraint:{distance:8}},e[33]=ve):ve=e[33];let ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye={coordinateGetter:Zo,keyboardCodes:XF},e[34]=ye):ye=e[34];let be=is(Go(Yo,ve),Go(Qo,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){O(rI(E.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){O(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==x||e[39]!==C?(Te=function(e){we();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=C.indexOf(t),i=C.indexOf(n);r<0||i<0||r===i||x(ts([...C],r,i),t)},e[37]=we,e[38]=x,e[39]=C,e[40]=Te):Te=e[40];let Ee=Te,De=ue?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=wi(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,ue&&`[-webkit-app-region:drag]`),e[41]=Oe):Oe=e[41];let ke=pI,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=wi(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let je=qo,Me=aI,Ne;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={container:typeof document<`u`?document.body:void 0},e[43]=Ne):Ne=e[43];let Pe=$o,Fe;e[44]===C?Fe=e[45]:(Fe=[...C],e[44]=C,e[45]=Fe);let Le=Ko,Re=C.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(gI,{tabId:e,canPin:!1,openTabs:C,closeTab:l,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(hI,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:wi(sI,t?cI:lI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:uI,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(Y,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:ZF(t),tabIndex:QF(t),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(Cs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=ne(e),n=e===U,i=y.includes(e);if(t.kind===`folder`){let{baseName:r,label:o,prefix:s}=ie(t.folderPath,`/`),c=`${s}${o}`;return(0,Z.jsx)(gI,{tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(hI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:wi(sI,n?cI:lI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:uI,onClick:()=>{a(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:wi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:wi(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(_I,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}if(t.kind===`asset`||t.kind===`skill-file`){let{baseName:r,label:o,prefix:s}=ie(t.kind===`asset`?t.assetPath:t.path,``),c=`${s}${o}`;return(0,Z.jsx)(gI,{tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(hI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:wi(sI,n?cI:lI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:uI,onClick:()=>{a(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:wi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:wi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(_I,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}let s=t.docName,c=T.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=ie(s,c),h=`${m}${p}`,g=c===`.md`||c===`.mdx`,_=k?.tabId===e,b=`editor-tab-rename-error-${dI(s)}`;return(0,Z.jsx)(gI,{disabled:_,tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsx)(hI,{tabId:e,activateFromKeyboard:()=>a(e),disabled:_,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:wi(sI,n?cI:lI,_&&N&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(IE,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(VE,{ref:L,value:j,disabled:F,"aria-label":w({id:`Dw1T_W`,values:{label:p}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":N?!0:void 0,"aria-describedby":N?b:void 0,"aria-busy":F||void 0,title:N??s,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{M(mI(e.target.value,c)),P(null),B.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(RE,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(BE,{className:`text-muted-foreground/60 text-xs`,children:c})})]}),N?(0,Z.jsx)(`span`,{id:b,role:`alert`,className:`sr-only`,children:N}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":h,title:h,className:uI,onClick:()=>{a(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,s)},tabIndex:-1,children:[(0,Z.jsx)(vI,{docName:s}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),!g&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),(0,Z.jsx)(_I,{accessibleLabel:h,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})})},e)}),ze;e[46]!==Pe||e[47]!==Fe||e[48]!==Le||e[49]!==Re?(ze=(0,Z.jsx)(Pe,{items:Fe,strategy:Le,children:Re}),e[46]=Pe,e[47]=Fe,e[48]=Le,e[49]=Re,e[50]=ze):ze=e[50];let Be;e[51]!==je||e[52]!==we||e[53]!==Ee||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Me||e[58]!==Ne||e[59]!==ze||e[60]!==he?(Be=(0,Z.jsx)(je,{sensors:be,autoScroll:!1,collisionDetection:Me,modifiers:he,onDragStart:Se,onDragEnd:Ee,onDragCancel:we,accessibility:Ne,children:ze}),e[51]=je,e[52]=we,e[53]=Ee,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Me,e[58]=Ne,e[59]=ze,e[60]=he,e[61]=Be):Be=e[61];let Ve;e[62]===w?Ve=e[63]:(Ve=w({id:`3YvS-c`}),e[62]=w,e[63]=Ve);let He;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(Lt,{"aria-hidden":`true`}),e[64]=He):He=e[64];let Ue;e[65]!==g||e[66]!==Ve?(Ue=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:He})}),e[65]=g,e[66]=Ve,e[67]=Ue):Ue=e[67];let We;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`3YvS-c`})}),e[68]=We):We=e[68];let Ge;e[69]===Ue?Ge=e[70]:(Ge=(0,Z.jsxs)(Ws,{children:[Ue,We]}),e[69]=Ue,e[70]=Ge);let Ke;e[71]!==Ae||e[72]!==Be||e[73]!==Ge?(Ke=(0,Z.jsxs)(`div`,{className:Ae,children:[Be,Ge]}),e[71]=Ae,e[72]=Be,e[73]=Ge,e[74]=Ke):Ke=e[74];let qe;return e[75]!==De||e[76]!==Oe||e[77]!==ke||e[78]!==Ke?(qe=(0,Z.jsx)(`div`,{ref:E,"data-electron-drag":De,className:Oe,onWheel:ke,children:Ke}),e[75]=De,e[76]=Oe,e[77]=ke,e[78]=Ke,e[79]=qe):qe=e[79],qe}var bI=(e,t,n)=>{if(e&&`reportValidity`in e){let r=Ai(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},xI=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?bI(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>bI(t,n,e))}},SI=(e,t)=>{t.shouldUseNativeValidation&&xI(e,t);let n={};for(let r in e){let i=Ai(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(CI(t.names||Object.keys(e),r)){let e=Object.assign({},Ai(n,r));zi(e,`root`,a),zi(n,r,e)}else zi(n,r,a)}return n},CI=(e,t)=>{let n=wI(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>wI(e).match(`^${n}\\.\\d+`))};function wI(e){return e.replace(/[\[\]]/g,``)}function TI(){return TI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},TI.apply(null,arguments)}function EI(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function DI(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ji(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function OI(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(TI({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ji(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function kI(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(EI(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&xI({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:SI(DI(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(EI(function(){return Promise.resolve((n.mode===`sync`?Qn:hr)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&xI({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof yr}(e))return{values:{},errors:SI(OI(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var AI=`https://openknowledge.ai/api/subscribe`;async function jI(e,t){try{let n=await fetch(AI,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function MI(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=an(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let _,v;if(t[3]!==u){let e=Rn({email:lr({message:u({id:`Wq6Wcm`})})});v=ca,_=kI(e),t[3]=u,t[4]=_,t[5]=v}else _=t[4],v=t[5];let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y={email:``},t[6]=y):y=t[6];let b;t[7]===_?b=t[8]:(b={resolver:_,defaultValues:y},t[7]=_,t[8]=b);let x=v(b),{isSubmitting:S}=x.formState,C=x.formState.errors.email?.message??x.formState.errors.root?.message,w;t[9]!==u||t[10]!==x||t[11]!==a||t[12]!==n?(w=async function(e){x.clearErrors(`root`);let t=await jI(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){x.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){x.setError(`root`,{message:u({id:`4mLBx9`})});return}x.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=x,t[11]=a,t[12]=n,t[13]=w):w=t[13];let T=w,E;t[14]===l?E=t[15]:(E=wi(`flex flex-col gap-3`,l),t[14]=l,t[15]=E);let D=d?-1:void 0,O;t[16]!==d||t[17]!==r?(O=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Ha,{className:`size-4 text-primary`}),(0,Z.jsx)(Y,{id:`PIMM5l`})]}):r??(0,Z.jsx)(Y,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=O):O=t[18];let k;t[19]!==O||t[20]!==D?(k=(0,Z.jsx)(`p`,{ref:p,tabIndex:D,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:O}),t[19]=O,t[20]=D,t[21]=k):k=t[21];let A;t[22]!==i||t[23]!==d?(A=d?(0,Z.jsx)(Y,{id:`pBROkv`}):i??(0,Z.jsx)(Y,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=A):A=t[24];let j;t[25]===A?j=t[26]:(j=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:A}),t[25]=A,t[26]=j);let M;t[27]!==k||t[28]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[k,j]}),t[27]=k,t[28]=j,t[29]=M):M=t[29];let N;t[30]!==u||t[31]!==o?(N=o?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(Cs,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=N):N=t[32];let P;t[33]!==M||t[34]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[M,N]}),t[33]=M,t[34]=N,t[35]=P):P=t[35];let F;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==C||t[40]!==x||t[41]!==S||t[42]!==T||t[43]!==d?(F=d?null:(0,Z.jsxs)(`form`,{onSubmit:x.handleSubmit(T),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Ta,{control:x.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(IE,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(RE,{className:`pl-2.5`,children:(0,Z.jsx)(Wd,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(VE,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(X,{type:`submit`,disabled:S,size:c?`icon`:`default`,className:wi(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fo,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(g,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`EDl9kS`})})]}):(0,Z.jsx)(Y,{id:`EDl9kS`})})]})}}),C?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:C}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=C,t[40]=x,t[41]=S,t[42]=T,t[43]=d,t[44]=F):F=t[44];let I;return t[45]!==P||t[46]!==F||t[47]!==E?(I=(0,Z.jsxs)(`div`,{className:E,children:[P,F]}),t[45]=P,t[46]=F,t[47]=E,t[48]=I):I=t[48],I}var NI=`https://github.com/inkeep/open-knowledge`,PI=`https://discord.com/invite/YujKpFN49`,FI=`https://x.com/OpenKnowledgeAI`;function II(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function LI(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var RI=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:re},{label:{id:`PCNIuJ`},href:`${NI}/issues/new`,icon:hd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:no}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:PI,icon:II},{label:`X (Twitter)`,href:FI,icon:LI},{label:`GitHub`,href:NI,icon:Rm}]}],zI=`${NI}/releases`,BI=`group flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`;function VI(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var HI=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=an(),i,a,o,s;t[0]!==r||t[1]!==n?(i=VI(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(vf,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},UI=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=an(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>Ns(e,o),l=e=>Ns(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:BI,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},WI=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},GI=()=>{let e=(0,$.c)(28),{_:t}=an(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c,l;e[0]!==n||e[1]!==o?(c=()=>{if(!n||o!==null)return;let e=new AbortController;return kr({signal:e.signal}).then(e=>{e!==null&&s(e)}),()=>e.abort()},l=[n,o],e[0]=n,e[1]=o,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{r(e),e||a(!1)},e[4]=u):u=e[4];let d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{className:`size-4`}),e[5]=d):d=e[5];let f;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[d,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]})})}),e[6]=f):f=e[6];let p;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(Ws,{children:[f,(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]}),e[7]=p):p=e[7];let m;e[8]!==t||e[9]!==o?(m=RI.map((e,n)=>(0,Z.jsxs)(`div`,{className:wi(n>0&&`mt-3`),children:[(0,Z.jsx)(WI,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:e.links.map(e=>(0,Z.jsx)(UI,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&o!==null?(0,Z.jsx)(HI,{count:o}):void 0},e.href))})})]},e.key)),e[8]=t,e[9]=o,e[10]=m):m=e[10];let h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(WI,{children:(0,Z.jsx)(Y,{id:`arUUsK`})}),e[11]=h):h=e[11];let g;e[12]===t?g=e[13]:(g=t({id:`arUUsK`}),e[12]=t,e[13]=g);let _;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(UI,{link:{label:{id:`3ePd3I`},href:zI,icon:Kd}}),e[14]=_):_=e[14];let v;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:wi(BI,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(Wd,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(Y,{id:`EDl9kS`})]})}),e[15]=v):v=e[15];let y;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Tt,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(MI,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:KI})}),e[16]=y):y=e[16];let b;e[17]===i?b=e[18]:(b=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[_,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(w,{open:i,onOpenChange:a,children:[v,y]})})]}),e[17]=i,e[18]=b);let x;e[19]!==b||e[20]!==g?(x=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[h,(0,Z.jsx)(`nav`,{"aria-label":g,children:b})]}),e[19]=b,e[20]=g,e[21]=x):x=e[21];let S;e[22]!==x||e[23]!==m?(S=(0,Z.jsxs)(Tt,{align:`end`,className:`w-56 p-3`,children:[m,x]}),e[22]=x,e[23]=m,e[24]=S):S=e[24];let C;return e[25]!==n||e[26]!==S?(C=(0,Z.jsxs)(w,{open:n,onOpenChange:u,children:[p,S]}),e[25]=n,e[26]=S,e[27]=C):C=e[27],C};function KI(){return Yg.markSubscribed()}var qI=50,JI=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,xE.preload()},qI))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Gi)},l=(0,Z.jsx)(uf,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(Ws,{children:[u,(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},YI=`https://openknowledge.ai/docs/features/share`;function XI(e){let t=(0,$.c)(42),{input:n,onClickWhenNoRemote:r}=e,{_:i}=an(),{status:a}=Ki(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(h=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Mi({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:To,toastSuccess:iL,toastError:rL,logEvent:nL});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0})}catch{Ss.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=h):h=t[9];let g=h,_=c!==null,v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e||l(null)},t[10]=v):v=t[10];let y;t[11]!==i||t[12]!==n?.kind?(y=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=y):y=t[13];let b=o||m,x,S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(df,{className:`size-3.5`,"aria-hidden":!0}),S=(0,Z.jsx)(Y,{id:`Z8lGw6`}),t[14]=x,t[15]=S):(x=t[14],S=t[15]);let C;t[16]!==g||t[17]!==y||t[18]!==b?(C=(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":y,onClick:g,disabled:b,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[x,S]})}),t[16]=g,t[17]=y,t[18]=b,t[19]=C):C=t[19];let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`Z8lGw6`})}),t[20]=T):T=t[20];let E;t[21]===c?.autoCopyFailed?E=t[22]:(E=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ndeI89`})}):null,t[21]=c?.autoCopyFailed,t[22]=E);let D=c?.url??``,O;t[23]===i?O=t[24]:(O=i({id:`5-FeN2`}),t[23]=i,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,Z.jsx)(Vc,{ref:u,readOnly:!0,value:D,onFocus:tL,onClick:eL,onContextMenu:$I,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":O}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A=c?.url??``,j=c?.autoCopyFailed===!1,M;t[28]!==A||t[29]!==j?(M=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(z,{copyContent:A,clipboardWrite:To,initialCopied:j})})}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(`div`,{className:`relative`,children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(`a`,{href:YI,target:`_blank`,rel:`noopener noreferrer`,onClick:QI,onAuxClick:ZI,className:`mt-2 flex items-center gap-1.5 self-start text-xs text-muted-foreground transition-colors hover:text-primary`,children:[(0,Z.jsx)(J,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(Y,{id:`aByJ8j`})]}),t[34]=F):F=t[34];let I;t[35]!==E||t[36]!==N?(I=(0,Z.jsxs)(Tt,{align:`end`,className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-popover`,children:[T,E,N,F]}),t[35]=E,t[36]=N,t[37]=I):I=t[37];let L;return t[38]!==C||t[39]!==I||t[40]!==_?(L=(0,Z.jsxs)(w,{open:_,onOpenChange:v,children:[C,I]}),t[38]=C,t[39]=I,t[40]=_,t[41]=L):L=t[41],L}function ZI(e){return Ns(e,YI)}function QI(e){return Ns(e,YI)}function $I(e){return e.currentTarget.select()}function eL(e){return e.currentTarget.select()}function tL(e){return e.currentTarget.select()}function nL(e){return console.log(e)}function rL(e){e!==`Link ready but could not copy to clipboard.`&&Ss.error(e)}function iL(e){return Ss.success(e)}function aL(e){let t=(0,$.c)(35),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=an(),{activeDocName:s,activeTarget:c}=pt(),l=s?ni(s):null,{state:u,isDraggingRail:d}=jN(),f=uy(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Tl(`toggle-files-sidebar`),t[0]=p):p=t[0];let m=p,h=Tl(`command-palette`),[g,_]=(0,Q.useState)(!1),v;bb0:{if(c?.kind===`folder`){let e;t[1]===c.folderPath?e=t[2]:(e=Bi(c.folderPath),t[1]=c.folderPath,t[2]=e),v=e;break bb0}if(s&&!l){let e;t[3]===s?e=t[4]:(e=Ri(s),t[3]=s,t[4]=e),v=e;break bb0}if(!c&&!s){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=Bi(``),t[5]=e):e=t[5],v=e;break bb0}v=null}let y=v,b=typeof window<`u`&&window.okDesktop!=null,x=u===`collapsed`,S=b?``:void 0,C=b&&x&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,w=b&&!d&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,T;t[6]!==C||t[7]!==w?(T=wi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,b&&`[-webkit-app-region:drag]`,C,w),t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=!f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(IN,{className:wi(`-ml-1 shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Hs,{children:u===`expanded`?(0,Z.jsx)(Y,{id:`ZxXhLY`,values:{sidebarShortcut:m}}):(0,Z.jsx)(Y,{id:`Zz25kq`,values:{sidebarShortcut:m}})})]}),x&&i&&(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:h}}),"data-telemetry-event":`ok.editor_header.search.click`,className:wi(`shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(o,{"aria-hidden":`true`})})}),(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`IN4UX8`,values:{searchShortcut:h}})})]}),(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(yI,{})]}),D;t[9]===E?D=t[10]:(D=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:E}),t[9]=E,t[10]=D);let O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=wi(`flex shrink-0 items-center justify-end gap-2 px-3`,b&&`[&>*]:[-webkit-app-region:no-drag]`),t[11]=O):O=t[11];let k;t[12]!==g||t[13]!==_||t[14]!==y||t[15]!==f?(k=!f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(XI,{input:y,onClickWhenNoRemote:()=>_(!0)}),(0,Z.jsx)(ki,{open:g,onOpenChange:_})]}),t[12]=g,t[13]=_,t[14]=y,t[15]=f,t[16]=k):k=t[16];let A;t[17]!==r||t[18]!==n?(A=(0,Z.jsx)(Ca,{onSignIn:n,onSetIdentity:r}),t[17]=r,t[18]=n,t[19]=A):A=t[19];let j,M,N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(xF,{}),M=(0,Z.jsx)(Xi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),N=(0,Z.jsx)(cm,{}),t[20]=j,t[21]=M,t[22]=N):(j=t[20],M=t[21],N=t[22]);let P;t[23]===f?P=t[24]:(P=!f&&(0,Z.jsx)(JI,{}),t[23]=f,t[24]=P);let F;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(GI,{}),t[25]=F):F=t[25];let I;t[26]!==k||t[27]!==A||t[28]!==P?(I=(0,Z.jsxs)(`div`,{className:O,children:[k,A,j,M,N,P,F]}),t[26]=k,t[27]=A,t[28]=P,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==S||t[32]!==T||t[33]!==D?(L=(0,Z.jsxs)(`header`,{"data-electron-drag":S,className:T,children:[D,I]}),t[30]=I,t[31]=S,t[32]=T,t[33]=D,t[34]=L):L=t[34],L}var oL=`open-knowledge:terminal-launch`;function sL(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(oL,{detail:{prompt:e,cli:t}}))}function cL(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.prompt==`string`&&e(n.prompt,n.cli)};return t.addEventListener(oL,n),()=>t.removeEventListener(oL,n)}function lL(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=wi(`group/tabs flex gap-2 data-horizontal:flex-col`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(nm,{"data-slot":`tabs`,"data-orientation":a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var uL=Ci(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function dL(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=wi(uL({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(rm,{"data-slot":`tabs-list`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function fL(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=wi(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(im,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pL(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=wi(`flex-1 text-sm outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(am,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var mL=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-XlICQw5o.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([81,1,30,3,7,31,6,10,13,11,82,62,44,83]),import.meta.url));function hL(e){let t=(0,$.c)(14),{bridge:n,onClose:r,onTitleChange:i,launch:a,adoptPtyId:o,onPtyId:s}=e,c=a===void 0?null:a,l=o===void 0?null:o,{enabled:u,synced:d}=ra(),f=Ji(),{_:p}=an(),m=d&&u===!1,g;t[0]!==p||t[1]!==f?(g=function(){if(f===null){Ss.error(p({id:`V_6bJ4`}));return}let e=f(!0);e.ok||Ss.error(p({id:`jKd3AP`,values:{0:e.error}}))},t[0]=p,t[1]=f,t[2]=g):g=t[2];let _=g;if(d&&!m){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let a;return t[4]!==l||t[5]!==n||t[6]!==c||t[7]!==r||t[8]!==s||t[9]!==i?(a=(0,Z.jsx)(h,{fallbackRender:_L,onError:gL,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(mL,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:c,adoptPtyId:l,onPtyId:s})})}),t[4]=l,t[5]=n,t[6]=c,t[7]=r,t[8]=s,t[9]=i,t[10]=a):a=t[10],a}let v;return t[11]!==_||t[12]!==m?(v=m?(0,Z.jsx)(bL,{onEnable:_}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[11]=_,t[12]=m,t[13]=v):v=t[13],v}function gL(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function _L(e){return(0,Z.jsx)(vL,{...e})}function vL(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=an(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===r?o=t[4]:(o=r({id:`6MnZEC`}),t[3]=r,t[4]=o);let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[5]=a,t[6]=s);let c;t[7]===r?c=t[8]:(c=r({id:`HpK_8d`}),t[7]=r,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,Z.jsx)(X,{onClick:yL,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==o||t[12]!==s||t[13]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":o,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[s,l]}),t[11]=o,t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function yL(){return window.location.reload()}function bL(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=an(),i;t[0]===r?i=t[1]:(i=r({id:`_XWY2J`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`oYepHb`}),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=r({id:`v2ZW0K`}),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==s?(c=(0,Z.jsx)(X,{onClick:n,children:s}),t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;t[11]===r?l=t[12]:(l=r({id:`ICoNYz`}),t[11]=r,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;return t[15]!==i||t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":i,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[o,c,u]}),t[15]=i,t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function xL(e){let t=(0,$.c)(48),{selected:n,onLaunchSelected:r,onPickCli:i,onPickTerminal:a,className:o}=e,{_:s}=an(),c=n===`terminal`,l;t[0]!==s||t[1]!==c||t[2]!==n?(l=s(c?{id:`AB4qw9`}:{id:`nP-KFo`,values:{0:Vn[n].displayName}}),t[0]=s,t[1]=c,t[2]=n,t[3]=l):l=t[3];let u=l,d;t[4]===o?d=t[5]:(d=wi(`flex shrink-0 items-center`,o),t[4]=o,t[5]=d);let f;t[6]!==c||t[7]!==n?(f=c?(0,Z.jsx)(gf,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(go,{id:ho(n),className:`size-3.5`,"aria-hidden":`true`}),t[6]=c,t[7]=n,t[8]=f):f=t[8];let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`size-3`}),t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==u||t[12]!==f?(m=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":u,"data-testid":`terminal-new-chat`,className:`cursor-pointer gap-0.5 rounded-r-none px-1.5 text-muted-foreground hover:text-foreground`,onClick:r,children:[f,p]})}),t[10]=r,t[11]=u,t[12]=f,t[13]=m):m=t[13];let h;t[14]===u?h=t[15]:(h=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:u}),t[14]=u,t[15]=h);let g;t[16]!==m||t[17]!==h?(g=(0,Z.jsxs)(Ws,{children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18];let _;t[19]===s?_=t[20]:(_=s({id:`QJaG-9`}),t[19]=s,t[20]=_);let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Xa,{"aria-hidden":`true`,className:`size-3`}),t[21]=v):v=t[21];let y;t[22]===_?y=t[23]:(y=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,"data-testid":`terminal-new-chat-menu`,className:`cursor-pointer rounded-l-none text-muted-foreground hover:text-foreground`,children:v})}),t[22]=_,t[23]=y);let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`hIQkLb`})}),t[24]=b):b=t[24];let x;t[25]!==s||t[26]!==i||t[27]!==n?(x=Do.map(e=>{let{displayName:t}=Vn[e];return(0,Z.jsxs)(Cc,{onSelect:()=>i(e),"data-testid":`terminal-new-chat-cli-${e}`,"aria-label":s({id:`9mEZeD`,values:{name:t}}),"aria-current":n===e?`true`:void 0,children:[(0,Z.jsx)(go,{id:ho(e),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),n===e?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)}),t[25]=s,t[26]=i,t[27]=n,t[28]=x):x=t[28];let S;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Ic,{}),t[29]=S):S=t[29];let C=c?`true`:void 0,w;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(gf,{"aria-hidden":`true`,className:`size-4`}),t[30]=w):w=t[30];let T;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),t[31]=T):T=t[31];let E;t[32]===c?E=t[33]:(E=c?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null,t[32]=c,t[33]=E);let D;t[34]!==a||t[35]!==C||t[36]!==E?(D=(0,Z.jsxs)(Cc,{onSelect:a,"data-testid":`terminal-new-chat-terminal`,"aria-current":C,children:[w,T,E]}),t[34]=a,t[35]=C,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==x||t[39]!==D?(O=(0,Z.jsxs)(Tc,{align:`start`,className:`min-w-[180px]`,children:[b,x,S,D]}),t[38]=x,t[39]=D,t[40]=O):O=t[40];let k;t[41]!==y||t[42]!==O?(k=(0,Z.jsxs)(jc,{children:[y,O]}),t[41]=y,t[42]=O,t[43]=k):k=t[43];let A;return t[44]!==d||t[45]!==k||t[46]!==g?(A=(0,Z.jsxs)(`div`,{className:d,children:[g,k]}),t[44]=d,t[45]=k,t[46]=g,t[47]=A):A=t[47],A}function SL(e){let t=(0,$.c)(60),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,newChatSelected:o,onNewChatLaunch:s,onNewChatPickCli:c,onNewChatPickTerminal:l,onClose:u,dockPosition:d,onToggleDock:f,onCollapse:p,children:m,className:h}=e,{_:g}=an(),_=d===`right`,v;t[0]===h?v=t[1]:(v=wi(`flex min-h-0 min-w-0 flex-1 flex-col`,h),t[0]=h,t[1]=v);let y;t[2]===g?y=t[3]:(y=g({id:`1MGRQl`}),t[2]=g,t[3]=y);let b;if(t[4]!==g||t[5]!==r||t[6]!==u||t[7]!==a||t[8]!==n){let e;t[10]!==g||t[11]!==r||t[12]!==u||t[13]!==a?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:wi(`group flex shrink-0 cursor-default items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(fL,{value:e.id,onClick:()=>a?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})})}),(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:e.label})]}),(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":g({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:wi(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),u(e.id)},children:(0,Z.jsx)(Cs,{"aria-hidden":`true`})})]},e.id)},t[10]=g,t[11]=r,t[12]=u,t[13]=a,t[14]=e):e=t[14],b=n.map(e),t[4]=g,t[5]=r,t[6]=u,t[7]=a,t[8]=n,t[9]=b}else b=t[9];let x;t[15]!==y||t[16]!==b?(x=(0,Z.jsx)(dL,{variant:`line`,"aria-label":y,className:`flex h-auto min-w-0 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:b}),t[15]=y,t[16]=b,t[17]=x):x=t[17];let S;t[18]!==o||t[19]!==s||t[20]!==c||t[21]!==l?(S=(0,Z.jsx)(xL,{selected:o,onLaunchSelected:s,onPickCli:c,onPickTerminal:l,className:`shrink-0`}),t[18]=o,t[19]=s,t[20]=c,t[21]=l,t[22]=S):S=t[22];let C;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(`div`,{className:`flex-1`}),t[23]=C):C=t[23];let w;t[24]!==g||t[25]!==_?(w=g(_?{id:`rf6x3F`}:{id:`QNxpRm`}),t[24]=g,t[25]=_,t[26]=w):w=t[26];let T;t[27]===_?T=t[28]:(T=_?(0,Z.jsx)(Xd,{"aria-hidden":`true`}):(0,Z.jsx)(ef,{"aria-hidden":`true`}),t[27]=_,t[28]=T);let E;t[29]!==f||t[30]!==w||t[31]!==T?(E=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":w,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:f,children:T})}),t[29]=f,t[30]=w,t[31]=T,t[32]=E):E=t[32];let D;t[33]===_?D=t[34]:(D=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:_?(0,Z.jsx)(Y,{id:`rf6x3F`}):(0,Z.jsx)(Y,{id:`QNxpRm`})}),t[33]=_,t[34]=D);let O;t[35]!==D||t[36]!==E?(O=(0,Z.jsxs)(Ws,{children:[E,D]}),t[35]=D,t[36]=E,t[37]=O):O=t[37];let k;t[38]===g?k=t[39]:(k=g({id:`VZGGPK`}),t[38]=g,t[39]=k);let A;t[40]===_?A=t[41]:(A=_?(0,Z.jsx)(Qa,{"aria-hidden":`true`}):(0,Z.jsx)(Xa,{"aria-hidden":`true`}),t[40]=_,t[41]=A);let j;t[42]!==p||t[43]!==k||t[44]!==A?(j=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":k,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:p,children:A})}),t[42]=p,t[43]=k,t[44]=A,t[45]=j):j=t[45];let M;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`VZGGPK`})}),t[46]=M):M=t[46];let N;t[47]===j?N=t[48]:(N=(0,Z.jsxs)(Ws,{children:[j,M]}),t[47]=j,t[48]=N);let P;t[49]!==O||t[50]!==N||t[51]!==x||t[52]!==S?(P=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[x,S,C,O,N]}),t[49]=O,t[50]=N,t[51]=x,t[52]=S,t[53]=P):P=t[53];let F;return t[54]!==r||t[55]!==m||t[56]!==i||t[57]!==v||t[58]!==P?(F=(0,Z.jsxs)(lL,{value:r,onValueChange:i,className:v,children:[P,m]}),t[54]=r,t[55]=m,t[56]=i,t[57]=v,t[58]=P,t[59]=F):F=t[59],F}function CL(e){return`terminal-session-${e}`}function wL(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function TL(e){let t=(0,$.c)(77),{bridge:n,visible:r,onVisibleChange:i,launch:a,installedClis:o,container:s,isShowing:c,onRequestEditorFocus:l,dockPosition:u,onToggleDock:d,onHasSessionsChange:f}=e,p=a===void 0?null:a,{_:m}=an(),[h]=(0,Q.useState)(jL),g,_;t[0]!==s||t[1]!==h?(g=()=>{h==null||s==null||h.parentElement!==s&&s.appendChild(h)},_=[h,s],t[0]=s,t[1]=h,t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useLayoutEffect)(g,_);let v=typeof n.terminal?.list==`function`,y;t[4]!==v||t[5]!==p||t[6]!==r?(y=()=>!v&&r?[{id:CL(1),launch:p,title:null,adoptPtyId:null}]:[],t[4]=v,t[5]=p,t[6]=r,t[7]=y):y=t[7];let[b,x]=(0,Q.useState)(y),S;t[8]!==v||t[9]!==r?(S=()=>!v&&r?CL(1):``,t[8]=v,t[9]=r,t[10]=S):S=t[10];let[C,w]=(0,Q.useState)(S),[T,E]=(0,Q.useState)(!v),D=(0,Q.useRef)(!1),O=(0,Q.useRef)(C),k=(0,Q.useRef)(b),A=(0,Q.useRef)(!v&&r?1:0),j=(0,Q.useRef)(r&&p?p.nonce:null),M=(0,Q.useRef)(r),N=(0,Q.useRef)(new Map),P=function(e,t){t===null?N.current.delete(e):N.current.set(e,t)},F=(0,Q.useRef)(0),I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){A.current+=1;let t=CL(A.current);x(n=>[...n,{id:t,launch:e,title:null,adoptPtyId:null}]),w(t)},t[11]=I):I=t[11];let L=I,[R,z]=(0,Q.useState)(AL),[B,V]=(0,Q.useState)(kL),H;t[12]===o?H=t[13]:(H=o??{},t[12]=o,t[13]=H);let U;t[14]!==R||t[15]!==H?(U=cb(R,H),t[14]=R,t[15]=H,t[16]=U):U=t[16];let W=U,G=B?`terminal`:W,K;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e){F.current+=1,L({prompt:null,cli:e,nonce:F.current})},t[17]=K):K=t[17];let ee=K,te;t[18]!==W||t[19]!==B?(te=function(){B?L(null):ee(W)},t[18]=W,t[19]=B,t[20]=te):te=t[20];let q=te,J;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(J=function(e){V(!1),_b(!1);let t=nb(e);z(t),ob(t),ee(e)},t[21]=J):J=t[21];let ne=J,re;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){V(!0),_b(!0),L(null)},t[22]=re):re=t[22];let ie=re,ae;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e,t){let n=t.trim()===``?null:t.trim();x(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[23]=ae):ae=t[23];let oe=ae,se=(0,Q.useRef)(L),ce;t[24]!==C||t[25]!==l||t[26]!==i?(ce=function(e){let t=k.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===C){let e=(t[n-1]??t[n+1])?.id??``;w(e),e!==``&&queueMicrotask(()=>wL(e))}x(r),r.length===0&&(i(!1),l())},t[24]=C,t[25]=l,t[26]=i,t[27]=ce):ce=t[27];let le=ce,ue=(0,Q.useRef)(OL),de;t[28]!==C||t[29]!==le||t[30]!==b?(de=()=>{se.current=L,O.current=C,k.current=b,ue.current=()=>{C!==``&&le(C)}},t[28]=C,t[29]=le,t[30]=b,t[31]=de):de=t[31],(0,Q.useEffect)(de);let fe,pe;t[32]!==p||t[33]!==T||t[34]!==b.length||t[35]!==r?(fe=()=>{if(!T)return;let e=M.current;if(M.current=r,p!=null&&p.nonce!==j.current){j.current=p.nonce,se.current(p);return}r&&!e&&b.length===0&&se.current(null)},pe=[r,p,b.length,T],t[32]=p,t[33]=T,t[34]=b.length,t[35]=r,t[36]=fe,t[37]=pe):(fe=t[36],pe=t[37]),(0,Q.useEffect)(fe,pe);let me;t[38]===n.terminal?me=t[39]:(me=()=>{if(typeof n.terminal?.list!=`function`||D.current)return;D.current=!0;let e=!1;return(async()=>{let t;try{t=await n.terminal.list()??[]}catch(e){console.error(`[terminal] reload session list() failed; cold-starting:`,e),t=[]}if(!e){if(t.length>0){let e=t.map(DL);A.current=e.length,x(e),w(e[0]?.id??``)}E(!0)}})(),()=>{e=!0,D.current=!1}},t[38]=n.terminal,t[39]=me);let he;t[40]===n?he=t[41]:(he=[n],t[40]=n,t[41]=he),(0,Q.useEffect)(me,he);let ge;t[42]===n?ge=t[43]:(ge=[n],t[42]=n,t[43]=ge),(0,Q.useEffect)(()=>ok(e=>{let t=O.current,r=t===``?void 0:N.current.get(t);r==null?au():(n.terminal.input(r,e),queueMicrotask(()=>wL(t)))}),ge);let _e,ve;t[44]===n?(_e=t[45],ve=t[46]):(_e=()=>n.onMenuAction(e=>{e===`new-terminal`?se.current(null):e===`kill-terminal`&&ue.current()}),ve=[n],t[44]=n,t[45]=_e,t[46]=ve),(0,Q.useEffect)(_e,ve);let ye,be;t[47]===h?(ye=t[48],be=t[49]):(ye=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||h==null||!h.contains(document.activeElement))return;let t=k.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),w(t.id),queueMicrotask(()=>wL(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},be=[h],t[47]=h,t[48]=ye,t[49]=be),(0,Q.useEffect)(ye,be);let xe;t[50]!==n.editor||t[51]!==b.length?(xe=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:b.length>0})},t[50]=n.editor,t[51]=b.length,t[52]=xe):xe=t[52];let Se;t[53]!==n||t[54]!==b.length?(Se=[n,b.length],t[53]=n,t[54]=b.length,t[55]=Se):Se=t[55],(0,Q.useEffect)(xe,Se);let Ce,we;t[56]!==f||t[57]!==b.length?(Ce=()=>{f?.(b.length>0)},we=[f,b.length],t[56]=f,t[57]=b.length,t[58]=Ce,t[59]=we):(Ce=t[58],we=t[59]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[60]!==h||t[61]!==c||t[62]!==l||t[63]!==r?(Te=()=>{c||r||h==null||!h.contains(document.activeElement)||l()},Ee=[c,r,h,l],t[60]=h,t[61]=c,t[62]=l,t[63]=r,t[64]=Te,t[65]=Ee):(Te=t[64],Ee=t[65]),(0,Q.useLayoutEffect)(Te,Ee);let De,Oe;t[66]===c?(De=t[67],Oe=t[68]):(De=()=>{c&&wL(O.current)},Oe=[c],t[66]=c,t[67]=De,t[68]=Oe),(0,Q.useEffect)(De,Oe);let ke;if(t[69]!==m||t[70]!==b){let e;t[72]===m?e=t[73]:(e=(e,t)=>({id:e.id,label:e.title??m({id:`OVjNeX`,values:{0:t+1}})}),t[72]=m,t[73]=e),ke=b.map(e),t[69]=m,t[70]=b,t[71]=ke}else ke=t[71];let Ae=ke,je=b.length>0?(0,Z.jsx)(SL,{sessions:Ae,activeSessionId:C,onSelect:w,onTabActivate:EL,newChatSelected:G,onNewChatLaunch:q,onNewChatPickCli:ne,onNewChatPickTerminal:ie,onClose:le,dockPosition:u,onToggleDock:d,onCollapse:()=>i(!1),className:`h-full`,children:b.map(e=>(0,Z.jsx)(pL,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(hL,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onPtyId:t=>P(e.id,t),onTitleChange:t=>oe(e.id,t),onClose:()=>le(e.id)})},e.id))}):null,Me;return t[74]!==h||t[75]!==je?(Me=h==null?null:(0,ld.createPortal)(je,h),t[74]=h,t[75]=je,t[76]=Me):Me=t[76],Me}function EL(e){return queueMicrotask(()=>wL(e))}function DL(e,t){return{id:CL(t+1),launch:null,title:null,adoptPtyId:e.ptyId}}function OL(){}function kL(){return vb()}function AL(){return ab()}function jL(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.className=`flex min-h-0 flex-1 flex-col overflow-hidden`,e}function ML(e){let t=(0,$.c)(74),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=qy(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Px[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null,[v,y]=(0,Q.useState)(!1),b=Jy(),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(mb),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){k(e),pb(e),y(!0)},t[2]=A):A=t[2];let j=A,M;t[3]===O?M=t[4]:(M=function(){j(O===`right`?`bottom`:`right`)},t[3]=O,t[4]=M);let N=M,P;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(P={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=P):P=t[5];let[F,I]=(0,Q.useState)(P),L=(0,Q.useRef)(0),R;t[6]===b?R=t[7]:(R=function(e){let t=e??cb(ab(),b);y(!0),L.current+=1,D({prompt:null,cli:t,nonce:L.current})},t[6]=b,t[7]=R);let z=R,B;t[8]!==x||t[9]!==z?(B=function(){y(!0),!x&&!gb()&&z()},t[8]=x,t[9]=z,t[10]=B):B=t[10];let V=B,H=Fi(),{projectConfig:U,projectLocalConfig:W,projectLocalSynced:G,projectSynced:K}=Bo(),{activeDocName:ee}=pt(),te=H?.hasRemote,q=H?.pushPermission?.checkStatus,J;t[11]!==m||t[12]!==U||t[13]!==W||t[14]!==G||t[15]!==K||t[16]!==te||t[17]!==q?(J=xb({autoSyncOnboardingDismissed:m,hasRemote:te,projectLocalSynced:G,projectSynced:K,projectLocalConfig:W,projectConfig:U,pushPermissionCheckStatus:q}),t[11]=m,t[12]=U,t[13]=W,t[14]=G,t[15]=K,t[16]=te,t[17]=q,t[18]=J):J=t[18];let ne=J,re,ie;t[19]===ee?(re=t[20],ie=t[21]):(re=()=>{let e=function(e){let t=e.detail;t&&ee&&Zl(ee,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(zy,e),()=>window.removeEventListener(zy,e)},ie=[ee],t[19]=ee,t[20]=re,t[21]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?y(FL):e===`new-terminal`&&y(!0)})},oe=[],t[22]=ae,t[23]=oe):(ae=t[22],oe=t[23]),(0,Q.useEffect)(ae,oe);let se,ce;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{if(window.okDesktop!=null)return;let e=function(e){El(e,`toggle-terminal-panel`)&&(e.preventDefault(),y(PL))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ce=[],t[24]=se,t[25]=ce):(se=t[24],ce=t[25]),(0,Q.useEffect)(se,ce);let le,ue;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>cL((e,t)=>{y(!0),L.current+=1,D({prompt:e,cli:t,nonce:L.current})}),ue=[],t[26]=le,t[27]=ue):(le=t[26],ue=t[27]),(0,Q.useEffect)(le,ue);let de,fe;t[28]===v?(de=t[29],fe=t[30]):(de=()=>{v||D(null)},fe=[v],t[28]=v,t[29]=de,t[30]=fe),(0,Q.useEffect)(de,fe);let pe,me;t[31]!==C||t[32]!==v?(pe=()=>{window.okDesktop!=null&&C&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v})},me=[v,C],t[31]=C,t[32]=v,t[33]=pe,t[34]=me):(pe=t[33],me=t[34]),(0,Q.useEffect)(pe,me);let he,ge;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){w(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(T.current=!0,y(!0))}).catch(NL).finally(()=>{t||w(!0)}),()=>{t=!0}},ge=[],t[35]=he,t[36]=ge):(he=t[35],ge=t[36]),(0,Q.useEffect)(he,ge);let _e,ve;t[37]===v?(_e=t[38],ve=t[39]):(_e=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&ha()}},ve=[v],t[37]=v,t[38]=_e,t[39]=ve),(0,Q.useEffect)(_e,ve),Xy(H?.pausedReason),Zy();let ye;t[40]===a?ye=t[41]:(ye=function(e){s(e),a(e)},t[40]=a,t[41]=ye);let be=ye,xe,Se;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>{d(`auth`),l(!0)},Se=()=>{d(`identity`),l(!0)},t[42]=xe,t[43]=Se):(xe=t[42],Se=t[43]);let Ce;t[44]===r?Ce=t[45]:(Ce=(0,Z.jsx)(aL,{onSignIn:xe,onSetIdentity:Se,onOpenSearch:r}),t[44]=r,t[45]=Ce);let we=_?V:void 0,Te;t[46]!==f||t[47]!==o||t[48]!==be||t[49]!==we||t[50]!==O||t[51]!==v?(Te=(0,Z.jsx)(KP,{editorMode:o,onModeChange:be,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:O,onTerminalPlacement:I,onRevealTerminal:we}),t[46]=f,t[47]=o,t[48]=be,t[49]=we,t[50]=O,t[51]=v,t[52]=Te):Te=t[52];let Ee;t[53]!==b||t[54]!==O||t[55]!==E||t[56]!==F||t[57]!==v||t[58]!==N?(Ee=_&&g!=null?(0,Z.jsx)(TL,{bridge:g,visible:v,onVisibleChange:y,launch:E,installedClis:b,container:F.container,isShowing:F.isShowing,onRequestEditorFocus:()=>F.editorRegion?.focus(),dockPosition:O,onToggleDock:N,onHasSessionsChange:S}):null,t[53]=b,t[54]=O,t[55]=E,t[56]=F,t[57]=v,t[58]=N,t[59]=Ee):Ee=t[59];let De=u===`identity`,Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>{l(!1)},t[60]=Oe):Oe=t[60];let ke;t[61]!==c||t[62]!==De?(ke=(0,Z.jsx)($i,{open:c,onOpenChange:l,identityPrompt:De,onSuccess:Oe}),t[61]=c,t[62]=De,t[63]=ke):ke=t[63];let Ae;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=()=>h(!0),t[64]=Ae):Ae=t[64];let je;t[65]===ne?je=t[66]:(je=(0,Z.jsx)(yb,{open:ne,onResolved:Ae}),t[65]=ne,t[66]=je);let Me;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Z.jsx)(Iy,{}),t[67]=Me):Me=t[67];let Ne;return t[68]!==Ce||t[69]!==Te||t[70]!==Ee||t[71]!==ke||t[72]!==je?(Ne=(0,Z.jsxs)(Z.Fragment,{children:[Ce,Te,Ee,ke,je,Me]}),t[68]=Ce,t[69]=Te,t[70]=Ee,t[71]=ke,t[72]=je,t[73]=Ne):Ne=t[73],Ne}function NL(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function PL(e){return!e}function FL(e){return!e}function IL(e){let t=Jc(gl(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function LL(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Li();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(eo,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),`Couldn't load conflicts — reload to retry.`]})}),e[0]=t):t=e[0],t}if(t.length===0)return null;let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(eo,{"aria-hidden":`true`,className:`size-3`}),`Conflicts`]}),e[1]=i):i=e[1];let a;e[2]===t.length?a=e[3]:(a=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[i,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[2]=t.length,e[3]=a);let o;e[4]===t?o=e[5]:(o=t.map(RL),e[4]=t,e[5]=o);let s;e[6]===o?s=e[7]:(s=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:o}),e[6]=o,e[7]=s);let c;return e[8]!==a||e[9]!==s?(c=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[a,s]}),e[8]=a,e[9]=s,e[10]=c):c=e[10],c}function RL(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>IL(e.file),children:[(0,Z.jsx)(eo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var zL=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
32
32
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
33
33
|
<path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
|
|
34
34
|
</symbol>
|