@inkeep/open-knowledge 0.16.2-beta.1 → 0.16.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +6 -6
  4. package/dist/constants-B461FxYz.mjs +2 -0
  5. package/dist/{dist-efiL3BFY.mjs → dist-DyAf4V0Q.mjs} +1 -1
  6. package/dist/{dist-BzHmx0j2.mjs → dist-Dycch3Bo.mjs} +4 -4
  7. package/dist/index.mjs +1 -1
  8. package/dist/{init-BYdoF--0.mjs → init-C2yDCEIE.mjs} +4 -4
  9. package/dist/init-CgWgGdiM.mjs +1 -0
  10. package/dist/{loader-B7QHW7Ue.mjs → loader-CKtbR-bM.mjs} +2 -2
  11. package/dist/loader-DvukIT0V.mjs +1 -0
  12. package/dist/preview-8Cv15cse.mjs +1 -0
  13. package/dist/{preview-C2dRY7Qb.mjs → preview-D4qMlagJ.mjs} +2 -2
  14. package/dist/public/assets/{ActivityModeContent-BuhneEc6.js → ActivityModeContent-B_XgaNq-.js} +1 -1
  15. package/dist/public/assets/{DocumentContext-t9WdquEH.js → DocumentContext-DF3M_8MC.js} +8 -8
  16. package/dist/public/assets/{OpenInAgentMenuRequestContext-CNXaKDiQ.js → OpenInAgentMenuRequestContext-C9uc_ySc.js} +1 -1
  17. package/dist/public/assets/{SettingsDialogBody-D72wOi4X.js → SettingsDialogBody-cJG0IN1L.js} +1 -1
  18. package/dist/public/assets/{SourceEditor-B7nlmRui.js → SourceEditor-BUtcGwkC.js} +1 -1
  19. package/dist/public/assets/{config-validation-events-anSxz1Ii.js → config-validation-events-BNW5mvhI.js} +1 -1
  20. package/dist/public/assets/{index-Bnn_cez_.js → index-DuyOCh76.js} +4 -4
  21. package/dist/public/index.html +4 -4
  22. package/dist/{repair-launch-json-CAmIDc2W.mjs → repair-launch-json-B-UIGrMl.mjs} +2 -2
  23. package/dist/{repair-mcp-configs-B4TBnmZ6.mjs → repair-mcp-configs-B5rqI3Es.mjs} +2 -2
  24. package/dist/repair-skills-Dg0iNFNA.mjs +1 -0
  25. package/dist/{repair-skills-jo4AybIC.mjs → repair-skills-kKWWiqBy.mjs} +2 -2
  26. package/dist/{src-pXiLChlR.mjs → src-BfaZbqDD.mjs} +2 -2
  27. package/dist/start-Bd2C_T8g.mjs +1 -0
  28. package/dist/{start-C5swQ4jj.mjs → start-DuzP_Jya.mjs} +2 -2
  29. package/dist/{write-project-skill-tdiiU2YY.mjs → write-project-skill-9crem9HB.mjs} +2 -2
  30. package/package.json +1 -1
  31. package/dist/constants-B3KWiCai.mjs +0 -2
  32. package/dist/init-61bnnnKO.mjs +0 -1
  33. package/dist/loader-BkT4WZRw.mjs +0 -1
  34. package/dist/preview-5zwEz9qc.mjs +0 -1
  35. package/dist/repair-skills-CIH8rngG.mjs +0 -1
  36. package/dist/start-DOJUkxqD.mjs +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-BXM3YshC.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-DPMyR1_m.js","./propagation-api-qAYD7s-v.js","./ConsentDialogBody-DOf6_QiW.js","./compiler-runtime-Cs91PcD2.js","./checkbox-BlEgF5ZV.js","./dist-CSynDsuh.js","./button-CmLxDlCv.js","./dialog-uOgi9SAD.js","./dist-DuNRfJxD.js","./collapsible-BzkAcCLq.js","./textarea-DV1qaluU.js","./tooltip-DjrmDp0P.js","./dist-C_giuVsx.js","./project-paths-lA0ULe1F.js","./McpConsentDialogBody-stteh15-.js","./mcp-consent-store-BmlKYN7O.js","./ActivityPanelDiffView-InYkbArk.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-Vj2cdFDc.js","./dist-CYnX9zTz.js","./w3c-keyname-nBRha8PK.js","./prop-types-DS25JQVI.js","./toggle-group-oSLn0Q3B.js","./panel-BQ1weDcE.js","./min-C7ZjdWf5.js","./src-DXWvEiD2.js","./colors-CzI3Rf3d.js","./ordinal-C2dFitP3.js","./init-Cvjgvi8K.js","./isObjectLike-BWNDxuxw.js","./now-F1RJRIcM.js","./isSymbol-W-l9JIco.js","./target-navigation-intent-D14fYAPV.js","./ActivityModeContent-BuhneEc6.js","./DocumentContext-t9WdquEH.js","./dist-Mxq-zflt.js","./dist-C0jOOVYt.js","./dist-B-IVhlJQ.js","./dist-Bn0QvNGs.js","./dist-Bui1BhSw.js","./dist-j3LJSXW6.js","./dist-Debx6b6u.js","./dist-B9B58-J_.js","./dist-pSQcUvmU.js","./stex-CGHNatva.js","./DocumentContext-B0sQn39F.css","./agent-presence-DYKkeiBZ.js","./dist-D1rVZYi52.js","./dist-CjXb6uie.js","./SettingsDialogBody-D72wOi4X.js","./config-validation-events-anSxz1Ii.js","./keyboard-shortcuts-Chx3IvC6.js","./SourceEditor-B7nlmRui.js","./OpenInAgentMenuRequestContext-CNXaKDiQ.js","./TerminalPanel-FU0wWCd1.js","./terminal-theme-BhdZI3O9.js","./TerminalPanel-BrP-ENHg.css"])))=>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{a as r,i,n as a,o,r as s,t as c}from"./compiler-runtime-Cs91PcD2.js";import{$ as l,$n as u,$t as d,A as f,An as p,At as m,Bn as h,Bt as g,C as _,Cn as v,Ct as y,Dn as b,Dt as x,En as S,Et as C,F as w,Fn as T,Ft as E,Gn as D,Gt as O,Hn as k,Ht as A,I as j,In as M,It as N,J as P,Jn as F,Jt as I,K as L,Kn as R,Kt as z,L as B,Ln as V,Lt as H,M as U,Mt as W,N as G,Nn as K,Nt as q,On as J,Ot as ee,P as Y,Pn as te,Pt as ne,Q as X,Qn as re,Qt as ie,R as ae,Rn as oe,Rt as se,S as ce,Sn as le,St as ue,T as de,Tn as fe,Tt as pe,Un as me,Ut as he,Vn as ge,Vt as _e,W as ve,Wn as ye,Wt as be,X as xe,Xn as Se,Xt as Ce,Y as we,Yn as Te,Yt as Ee,Z as De,Zn as Oe,Zt as ke,_n as Ae,_t as je,a as Me,an as Ne,ar as Pe,at as Fe,bn as Ie,c as Le,cr as Re,ct as ze,d as Be,dr as Ve,dt as He,en as Ue,er as We,et as Ge,f as Ke,fr as qe,ft as Je,g as Ye,gt as Xe,h as Ze,hr as Qe,ht as $e,i as et,ir as tt,it as nt,j as rt,jn as it,jt as at,k as ot,kn as st,kt as ct,l as lt,lt as ut,m as dt,mr as ft,mt as pt,n as mt,nn as ht,nr as gt,nt as _t,o as vt,or as yt,ot as bt,p as xt,pr as St,pt as Ct,q as wt,qn as Tt,qt as Et,r as Dt,rn as Ot,rt as kt,s as At,st as jt,t as Mt,tn as Nt,tt as Pt,u as Ft,ur as It,ut as Lt,v as Rt,vn as zt,vt as Bt,w as Vt,wn as Ht,wt as Ut,xn as Wt,y as Gt,yn as Kt,yt as qt,z as Jt,zn as Yt,zt as Xt}from"./DocumentContext-t9WdquEH.js";import{A as Zt,C as Qt,D as $t,E as en,O as tn,S as nn,T as rn,_ as an,a as on,b as sn,c as cn,d as ln,f as un,g as dn,h as fn,i as pn,k as mn,l as hn,m as gn,n as _n,o as vn,p as yn,r as bn,s as xn,t as Sn,u as Cn,v as wn,w as Tn,x as En,y as Dn}from"./panel-BQ1weDcE.js";import{$n as On,A as kn,An,Ar as jn,At as Mn,B as Nn,C as Pn,Dn as Fn,Dt as In,F as Ln,Fr as Rn,Ft as zn,Gn as Bn,Gr as Vn,Gt as Hn,Hr as Un,Jt as Wn,Kr as Gn,Kt as Kn,Lr as qn,Lt as Jn,M as Yn,N as Xn,Nn as Zn,Nt as Qn,O as $n,Pr as er,Pt as tr,Qt as nr,Sr as rr,St as ir,Un as ar,Wr as or,Wt as sr,X as cr,Xn as lr,Xt as ur,Yt as dr,Zt as fr,an as pr,ar as mr,at as hr,b as gr,c as _r,cn as vr,dn as yr,er as br,fn as xr,fr as Sr,gn as Cr,gr as wr,hr as Tr,i as Er,in as Dr,ir as Or,j as kr,jn as Ar,jr,li as Mr,ln as Nr,lr as Pr,mn as Fr,mt as Ir,n as Lr,nn as Rr,or as zr,pr as Br,pt as Vr,qt as Hr,ri as Ur,rn as Wr,rr as Gr,sr as Kr,t as qr,tn as Jr,ui as Yr,un as Xr,ut as Zr,vn as Qr,w as $r,xr as ei,xt as ti,z as ni,zt as ri}from"./dist-CYnX9zTz.js";import{c as ii,d as ai,l as oi,r as si,t as ci,u as li}from"./button-CmLxDlCv.js";import{a as ui,c as di,d as fi,f as pi,i as mi,l as hi,m as gi,n as _i,o as vi,p as yi,r as bi,s as xi,t as Si,u as Ci}from"./agent-presence-DYKkeiBZ.js";import{$ as wi,$t as Ti,A as Ei,At as Di,B as Oi,Bt as ki,C as Ai,Ct as ji,D as Mi,Dt as Ni,E as Pi,Et as Fi,F as Ii,Ft as Li,G as Ri,Gt as zi,H as Bi,Ht as Vi,I as Hi,It as Ui,J as Wi,Jt as Gi,K as Ki,Kt as qi,L as Ji,Lt as Yi,M as Xi,Mt as Zi,N as Qi,Nt as $i,O as ea,Ot as ta,P as na,Pt as ra,Q as ia,Qt as aa,R as oa,Rt as sa,S as ca,St as la,T as ua,Tt as da,U as fa,Ut as pa,V as ma,Vt as ha,W as ga,Wt as _a,X as va,Xt as ya,Y as ba,Yt as xa,Z as Sa,Zt as Ca,_t as wa,an as Ta,at as Ea,b as Da,bt as Oa,cn as ka,ct as Aa,dt as ja,en as Ma,et as Na,ft as Pa,gt as Fa,ht as Ia,it as La,j as Ra,jt as za,k as Ba,kt as Va,lt as Ha,m as Ua,nn as Wa,nt as Ga,o as Ka,on as qa,ot as Ja,p as Ya,q as Xa,qt as Za,r as Qa,rn as $a,rt as eo,sn as to,st as no,t as ro,tn as io,tt as ao,u as oo,ut as so,vt as co,w as lo,wt as uo,x as fo,xt as po,y as mo,yt as ho,z as go,zt as _o}from"./config-validation-events-anSxz1Ii.js";import{i as vo,n as yo,r as bo,t as xo}from"./toggle-group-oSLn0Q3B.js";import{a as So,c as Co,i as wo,n as To,o as Eo,s as Do,t as Oo,v as ko}from"./dialog-uOgi9SAD.js";import{a as Ao,i as jo,n as Mo,o as No,r as Po,t as Fo}from"./collapsible-BzkAcCLq.js";import{A as Io,B as Lo,C as Ro,D as zo,E as Bo,F as Vo,H as Ho,I as Uo,L as Wo,M as Go,N as Ko,O as qo,P as Jo,R as Yo,S as Xo,T as Zo,V as Qo,_ as $o,a as es,c as ts,g as ns,i as rs,j as is,k as as,l as os,m as ss,n as cs,o as ls,s as us,v as ds,w as fs,x as ps,z as ms}from"./prop-types-DS25JQVI.js";import{n as hs,r as gs,t as _s}from"./dist-DuNRfJxD.js";import{a as vs,d as ys,f as bs,i as xs,l as Ss,o as Cs,s as ws}from"./dist-CSynDsuh.js";import{_ as Ts,b as Es,d as Ds,f as Os,g as ks,h as As,i as js,m as Ms,n as Ns,p as Ps,r as Fs,t as Is,u as Ls,v as Rs,y as zs}from"./tooltip-DjrmDp0P.js";import{n as Bs,t as Vs}from"./checkbox-BlEgF5ZV.js";import{n as Hs,r as Us,t as Ws}from"./dist-C_giuVsx.js";import{n as Gs,r as Ks,t as qs}from"./textarea-DV1qaluU.js";import{a as Js,i as Ys,n as Xs,r as Zs}from"./project-paths-lA0ULe1F.js";import{n as Qs,t as $s}from"./mcp-consent-store-BmlKYN7O.js";import{c as ec,i as tc,l as nc,o as rc}from"./keyboard-shortcuts-Chx3IvC6.js";import{$ as ic,At as ac,Ct as oc,Dt as sc,Ft as cc,I as lc,It as uc,J as dc,Mt as fc,Ot as pc,Pt as mc,Q as hc,Tt as gc,X as _c,Z as vc,at as yc,bt as bc,jt as xc,k as Sc,w as Cc}from"./dist-C0jOOVYt.js";import{n as wc}from"./dist-B9B58-J_.js";import{c as Tc,d as Ec,f as Dc,h as Oc,i as kc,l as Ac,o as jc,r as Mc,s as Nc,t as Pc,u as Fc}from"./OpenInAgentMenuRequestContext-CNXaKDiQ.js";import{t as Ic}from"./target-navigation-intent-D14fYAPV.js";import{t as Lc}from"./terminal-theme-BhdZI3O9.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 Rc(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.16.1`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-BXM3YshC.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function zc(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=>{dn(e,()=>t.signal,()=>n=!0)},u=Dn(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?wn:an;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Vc:Bc,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:Bc(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 Bc(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 Vc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Hc=class extends un{#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||Uc(),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=yn({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),fn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Uc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Wc=class extends Zt{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 Hc({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=Gc(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=Gc(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=Gc(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=Gc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){fn.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=>Qt(t,e))}findAll(e={}){return this.getAll().filter(t=>Qt(e,t))}notify(e){fn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return fn.batch(()=>Promise.all(e.map(e=>e.continue().catch(rn))))}};function Gc(e){return e.options.scope?.id}var Kc=class extends Zt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??nn(r,t),a=this.get(i);return a||(a=new ln({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(){fn.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=>Tn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Tn(e,t)):t}notify(e){fn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){fn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){fn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},qc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Kc,this.#t=e.mutationCache||new Wc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=mn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=gn.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($t(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=sn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return fn.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;fn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return fn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=fn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(rn).catch(rn)}invalidateQueries(e,t={}){return fn.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=fn.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(rn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(rn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime($t(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(rn).catch(rn)}fetchInfiniteQuery(e){return e.behavior=zc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rn).catch(rn)}ensureInfiniteQueryData(e){return e.behavior=zc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return gn.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(En(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{en(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(En(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{en(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||=nn(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===tn&&(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()}},Jc=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}}}})),Yc=t(((e,t)=>{t.exports=Jc()})),Xc=t((e=>{var t=Yc(),n=r(),i=ai();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 q(){B(H),B(U),B(W)}function J(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 ee(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var Y,te;function ne(e){if(Y===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Y=t&&t[1]||``,te=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-BXM3YshC.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-DPMyR1_m.js","./propagation-api-qAYD7s-v.js","./ConsentDialogBody-DOf6_QiW.js","./compiler-runtime-Cs91PcD2.js","./checkbox-BlEgF5ZV.js","./dist-CSynDsuh.js","./button-CmLxDlCv.js","./dialog-uOgi9SAD.js","./dist-DuNRfJxD.js","./collapsible-BzkAcCLq.js","./textarea-DV1qaluU.js","./tooltip-DjrmDp0P.js","./dist-C_giuVsx.js","./project-paths-lA0ULe1F.js","./McpConsentDialogBody-stteh15-.js","./mcp-consent-store-BmlKYN7O.js","./ActivityPanelDiffView-InYkbArk.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-Vj2cdFDc.js","./dist-CYnX9zTz.js","./w3c-keyname-nBRha8PK.js","./prop-types-DS25JQVI.js","./toggle-group-oSLn0Q3B.js","./panel-BQ1weDcE.js","./min-C7ZjdWf5.js","./src-DXWvEiD2.js","./colors-CzI3Rf3d.js","./ordinal-C2dFitP3.js","./init-Cvjgvi8K.js","./isObjectLike-BWNDxuxw.js","./now-F1RJRIcM.js","./isSymbol-W-l9JIco.js","./target-navigation-intent-D14fYAPV.js","./ActivityModeContent-B_XgaNq-.js","./DocumentContext-DF3M_8MC.js","./dist-Mxq-zflt.js","./dist-C0jOOVYt.js","./dist-B-IVhlJQ.js","./dist-Bn0QvNGs.js","./dist-Bui1BhSw.js","./dist-j3LJSXW6.js","./dist-Debx6b6u.js","./dist-B9B58-J_.js","./dist-pSQcUvmU.js","./stex-CGHNatva.js","./DocumentContext-B0sQn39F.css","./agent-presence-DYKkeiBZ.js","./dist-D1rVZYi52.js","./dist-CjXb6uie.js","./SettingsDialogBody-cJG0IN1L.js","./config-validation-events-BNW5mvhI.js","./keyboard-shortcuts-Chx3IvC6.js","./SourceEditor-BUtcGwkC.js","./OpenInAgentMenuRequestContext-C9uc_ySc.js","./TerminalPanel-FU0wWCd1.js","./terminal-theme-BhdZI3O9.js","./TerminalPanel-BrP-ENHg.css"])))=>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{a as r,i,n as a,o,r as s,t as c}from"./compiler-runtime-Cs91PcD2.js";import{$ as l,$n as u,$t as d,A as f,An as p,At as m,Bn as h,Bt as g,C as _,Cn as v,Ct as y,Dn as b,Dt as x,En as S,Et as C,F as w,Fn as T,Ft as E,Gn as D,Gt as O,Hn as k,Ht as A,I as j,In as M,It as N,J as P,Jn as F,Jt as I,K as L,Kn as R,Kt as z,L as B,Ln as V,Lt as H,M as U,Mt as W,N as G,Nn as K,Nt as q,On as J,Ot as ee,P as Y,Pn as te,Pt as ne,Q as X,Qn as re,Qt as ie,R as ae,Rn as oe,Rt as se,S as ce,Sn as le,St as ue,T as de,Tn as fe,Tt as pe,Un as me,Ut as he,Vn as ge,Vt as _e,W as ve,Wn as ye,Wt as be,X as xe,Xn as Se,Xt as Ce,Y as we,Yn as Te,Yt as Ee,Z as De,Zn as Oe,Zt as ke,_n as Ae,_t as je,a as Me,an as Ne,ar as Pe,at as Fe,bn as Ie,c as Le,cr as Re,ct as ze,d as Be,dr as Ve,dt as He,en as Ue,er as We,et as Ge,f as Ke,fr as qe,ft as Je,g as Ye,gt as Xe,h as Ze,hr as Qe,ht as $e,i as et,ir as tt,it as nt,j as rt,jn as it,jt as at,k as ot,kn as st,kt as ct,l as lt,lt as ut,m as dt,mr as ft,mt as pt,n as mt,nn as ht,nr as gt,nt as _t,o as vt,or as yt,ot as bt,p as xt,pr as St,pt as Ct,q as wt,qn as Tt,qt as Et,r as Dt,rn as Ot,rt as kt,s as At,st as jt,t as Mt,tn as Nt,tt as Pt,u as Ft,ur as It,ut as Lt,v as Rt,vn as zt,vt as Bt,w as Vt,wn as Ht,wt as Ut,xn as Wt,y as Gt,yn as Kt,yt as qt,z as Jt,zn as Yt,zt as Xt}from"./DocumentContext-DF3M_8MC.js";import{A as Zt,C as Qt,D as $t,E as en,O as tn,S as nn,T as rn,_ as an,a as on,b as sn,c as cn,d as ln,f as un,g as dn,h as fn,i as pn,k as mn,l as hn,m as gn,n as _n,o as vn,p as yn,r as bn,s as xn,t as Sn,u as Cn,v as wn,w as Tn,x as En,y as Dn}from"./panel-BQ1weDcE.js";import{$n as On,A as kn,An,Ar as jn,At as Mn,B as Nn,C as Pn,Dn as Fn,Dt as In,F as Ln,Fr as Rn,Ft as zn,Gn as Bn,Gr as Vn,Gt as Hn,Hr as Un,Jt as Wn,Kr as Gn,Kt as Kn,Lr as qn,Lt as Jn,M as Yn,N as Xn,Nn as Zn,Nt as Qn,O as $n,Pr as er,Pt as tr,Qt as nr,Sr as rr,St as ir,Un as ar,Wr as or,Wt as sr,X as cr,Xn as lr,Xt as ur,Yt as dr,Zt as fr,an as pr,ar as mr,at as hr,b as gr,c as _r,cn as vr,dn as yr,er as br,fn as xr,fr as Sr,gn as Cr,gr as wr,hr as Tr,i as Er,in as Dr,ir as Or,j as kr,jn as Ar,jr,li as Mr,ln as Nr,lr as Pr,mn as Fr,mt as Ir,n as Lr,nn as Rr,or as zr,pr as Br,pt as Vr,qt as Hr,ri as Ur,rn as Wr,rr as Gr,sr as Kr,t as qr,tn as Jr,ui as Yr,un as Xr,ut as Zr,vn as Qr,w as $r,xr as ei,xt as ti,z as ni,zt as ri}from"./dist-CYnX9zTz.js";import{c as ii,d as ai,l as oi,r as si,t as ci,u as li}from"./button-CmLxDlCv.js";import{a as ui,c as di,d as fi,f as pi,i as mi,l as hi,m as gi,n as _i,o as vi,p as yi,r as bi,s as xi,t as Si,u as Ci}from"./agent-presence-DYKkeiBZ.js";import{$ as wi,$t as Ti,A as Ei,At as Di,B as Oi,Bt as ki,C as Ai,Ct as ji,D as Mi,Dt as Ni,E as Pi,Et as Fi,F as Ii,Ft as Li,G as Ri,Gt as zi,H as Bi,Ht as Vi,I as Hi,It as Ui,J as Wi,Jt as Gi,K as Ki,Kt as qi,L as Ji,Lt as Yi,M as Xi,Mt as Zi,N as Qi,Nt as $i,O as ea,Ot as ta,P as na,Pt as ra,Q as ia,Qt as aa,R as oa,Rt as sa,S as ca,St as la,T as ua,Tt as da,U as fa,Ut as pa,V as ma,Vt as ha,W as ga,Wt as _a,X as va,Xt as ya,Y as ba,Yt as xa,Z as Sa,Zt as Ca,_t as wa,an as Ta,at as Ea,b as Da,bt as Oa,cn as ka,ct as Aa,dt as ja,en as Ma,et as Na,ft as Pa,gt as Fa,ht as Ia,it as La,j as Ra,jt as za,k as Ba,kt as Va,lt as Ha,m as Ua,nn as Wa,nt as Ga,o as Ka,on as qa,ot as Ja,p as Ya,q as Xa,qt as Za,r as Qa,rn as $a,rt as eo,sn as to,st as no,t as ro,tn as io,tt as ao,u as oo,ut as so,vt as co,w as lo,wt as uo,x as fo,xt as po,y as mo,yt as ho,z as go,zt as _o}from"./config-validation-events-BNW5mvhI.js";import{i as vo,n as yo,r as bo,t as xo}from"./toggle-group-oSLn0Q3B.js";import{a as So,c as Co,i as wo,n as To,o as Eo,s as Do,t as Oo,v as ko}from"./dialog-uOgi9SAD.js";import{a as Ao,i as jo,n as Mo,o as No,r as Po,t as Fo}from"./collapsible-BzkAcCLq.js";import{A as Io,B as Lo,C as Ro,D as zo,E as Bo,F as Vo,H as Ho,I as Uo,L as Wo,M as Go,N as Ko,O as qo,P as Jo,R as Yo,S as Xo,T as Zo,V as Qo,_ as $o,a as es,c as ts,g as ns,i as rs,j as is,k as as,l as os,m as ss,n as cs,o as ls,s as us,v as ds,w as fs,x as ps,z as ms}from"./prop-types-DS25JQVI.js";import{n as hs,r as gs,t as _s}from"./dist-DuNRfJxD.js";import{a as vs,d as ys,f as bs,i as xs,l as Ss,o as Cs,s as ws}from"./dist-CSynDsuh.js";import{_ as Ts,b as Es,d as Ds,f as Os,g as ks,h as As,i as js,m as Ms,n as Ns,p as Ps,r as Fs,t as Is,u as Ls,v as Rs,y as zs}from"./tooltip-DjrmDp0P.js";import{n as Bs,t as Vs}from"./checkbox-BlEgF5ZV.js";import{n as Hs,r as Us,t as Ws}from"./dist-C_giuVsx.js";import{n as Gs,r as Ks,t as qs}from"./textarea-DV1qaluU.js";import{a as Js,i as Ys,n as Xs,r as Zs}from"./project-paths-lA0ULe1F.js";import{n as Qs,t as $s}from"./mcp-consent-store-BmlKYN7O.js";import{c as ec,i as tc,l as nc,o as rc}from"./keyboard-shortcuts-Chx3IvC6.js";import{$ as ic,At as ac,Ct as oc,Dt as sc,Ft as cc,I as lc,It as uc,J as dc,Mt as fc,Ot as pc,Pt as mc,Q as hc,Tt as gc,X as _c,Z as vc,at as yc,bt as bc,jt as xc,k as Sc,w as Cc}from"./dist-C0jOOVYt.js";import{n as wc}from"./dist-B9B58-J_.js";import{c as Tc,d as Ec,f as Dc,h as Oc,i as kc,l as Ac,o as jc,r as Mc,s as Nc,t as Pc,u as Fc}from"./OpenInAgentMenuRequestContext-C9uc_ySc.js";import{t as Ic}from"./target-navigation-intent-D14fYAPV.js";import{t as Lc}from"./terminal-theme-BhdZI3O9.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 Rc(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.16.1`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-BXM3YshC.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function zc(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=>{dn(e,()=>t.signal,()=>n=!0)},u=Dn(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?wn:an;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Vc:Bc,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:Bc(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 Bc(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 Vc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Hc=class extends un{#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||Uc(),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=yn({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),fn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Uc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Wc=class extends Zt{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 Hc({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=Gc(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=Gc(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=Gc(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=Gc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){fn.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=>Qt(t,e))}findAll(e={}){return this.getAll().filter(t=>Qt(e,t))}notify(e){fn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return fn.batch(()=>Promise.all(e.map(e=>e.continue().catch(rn))))}};function Gc(e){return e.options.scope?.id}var Kc=class extends Zt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??nn(r,t),a=this.get(i);return a||(a=new ln({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(){fn.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=>Tn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Tn(e,t)):t}notify(e){fn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){fn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){fn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},qc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Kc,this.#t=e.mutationCache||new Wc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=mn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=gn.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($t(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=sn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return fn.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;fn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return fn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=fn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(rn).catch(rn)}invalidateQueries(e,t={}){return fn.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=fn.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(rn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(rn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime($t(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(rn).catch(rn)}fetchInfiniteQuery(e){return e.behavior=zc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rn).catch(rn)}ensureInfiniteQueryData(e){return e.behavior=zc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return gn.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(En(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{en(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(En(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{en(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||=nn(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===tn&&(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()}},Jc=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}}}})),Yc=t(((e,t)=>{t.exports=Jc()})),Xc=t((e=>{var t=Yc(),n=r(),i=ai();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 q(){B(H),B(U),B(W)}function J(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 ee(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var Y,te;function ne(e){if(Y===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Y=t&&t[1]||``,te=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+Y+e+te}var X=!1;function re(e,t){if(!e||X)return``;X=!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,12 +21,12 @@ Error generating stack: `+e.message+`
21
21
  `}function Qv(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Xv(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Zv(e,o.headerOptions):void 0)}}))}else{let s=Xv(e,t,n,r,i,a,o);return s?Zv(s,o?.headerOptions):void 0}}function $v(e,t,n,r,i,a){return Qv(e,e,t,n,r,i,a)}function ey(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 ty(e,t){return`${e}\u0000${t}`}function ny(e,t,n){let r=zr(e).body,i=zr(t).body;return r===i?``:$v(n,r,i,``,``,{context:3})}function ry(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=mt(),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=ty(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=ny(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 iy=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-InYkbArk.js`),__vite__mapDeps([19,1,6,20]),import.meta.url)).ActivityPanelDiffView})),ay=1e4,oy=6e4;async function sy(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 cy(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 ly(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function uy(e){return e.slice(0,7)}function dy(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 fy(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)(fi,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(vi,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ui,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(hi,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Ci,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(xi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(yi,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function py(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)(Oe,{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=Qr(i),t[1]=i,t[2]=a);let o=a,s=r?Lr[o]??qr[o]:qr[o],c;t[3]!==s||t[4]!==i?(c=s??Kn(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)(fy,{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)(El,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`Open Knowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Qc,{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)(hu,{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)(yi,{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)(Qc,{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)(hu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function my(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function hy(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,c;t[0]===n?(o=t[1],c=t[2]):([o,...c]=n,t[0]=n,t[1]=o,t[2]=c);let l=c.length,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=u):u=t[3];let d;t[4]===o?d=t[5]:(d=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[u,o]}),t[4]=o,t[5]=d);let f;t[6]!==r||t[7]!==c?(f=r&&c.map(_y),t[6]=r,t[7]=c,t[8]=f):f=t[8];let p;t[9]!==a||t[10]!==d||t[11]!==f?(p=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[d,f]}),t[9]=a,t[10]=d,t[11]=f,t[12]=p):p=t[12];let m;t[13]!==r||t[14]!==l||t[15]!==a||t[16]!==c.length?(m=c.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(gy)},children:[r?(0,Z.jsx)(Ve,{className:`size-3`}):(0,Z.jsx)(No,{className:`size-3`}),r?(0,Z.jsx)(s,{id:`vLyv1R`}):(0,Z.jsx)(s,{id:`ZptNUh`,values:{hidden:l}})]}),t[13]=r,t[14]=l,t[15]=a,t[16]=c.length,t[17]=m):m=t[17];let h;return t[18]!==p||t[19]!==m?(h=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function gy(e){return!e}function _y(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 vy(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=ry(n,r,i),l;t[0]===c.status?l=t[1]:(l=c.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(h,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`38foVZ`})]}),t[0]=c.status,t[1]=l);let u;t[2]===c.status?u=t[3]:(u=c.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(s,{id:`vvWZnu`})}),t[2]=c.status,t[3]=u);let d;t[4]!==a||t[5]!==c.diff||t[6]!==c.status?(d=c.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)(h,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(iy,{diff:c.diff,viewType:a})}),t[4]=a,t[5]=c.diff,t[6]=c.status,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==l||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[l,u,d]}),t[8]=o,t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function yy(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:a,cache:o,docName:c,expanded:l,onToggleExpanded:u,onRestoreSuccess:d}=e,{_:f}=i(),p;t[0]===n.timestamp?p=t[1]:(p=cy(n.timestamp),t[0]=n.timestamp,t[1]=p);let m=p,g;t[2]===n?g=t[3]:(g=dy(n),t[2]=n,t[3]=g);let _=g,v;t[4]===n.timestamp?v=t[5]:(v=ly(n.timestamp),t[4]=n.timestamp,t[5]=v);let y=v,b;t[6]===n.sha?b=t[7]:(b=uy(n.sha),t[6]=n.sha,t[7]=b);let x=b,S=n.contributors.flatMap(by),C;t[8]===n?C=t[9]:(C=my(n),t[8]=n,t[9]=C);let w=C,[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(null),A=(0,Q.useId)(),j,M;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>k.current?.abort(),M=[],t[10]=j,t[11]=M):(j=t[10],M=t[11]),(0,Q.useEffect)(j,M);let N;t[12]!==n.sha||t[13]!==u?(N=()=>u(n.sha),t[12]=n.sha,t[13]=u,t[14]=N):N=t[14];let P=N,F;t[15]===E?F=t[16]:(F=function(){k.current?.abort(),k.current=null,O(!1),E(!1)},t[15]=E,t[16]=F);let I=F,L;t[17]!==f||t[18]!==c||t[19]!==n.sha||t[20]!==d||t[21]!==E?(L=async function(){O(!0);let e=new AbortController;k.current=e;let t=function(){e.signal.aborted||O(!1),k.current===e&&(k.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:c,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:c,sha:n.sha,err:i}),hs.error(f({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)E(!1),d();else{let e=`HTTP ${r.status}`;try{let t=hr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:c,sha:n.sha,status:r.status,detail:e}),hs.error(f({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=f,t[18]=c,t[19]=n.sha,t[20]=d,t[21]=E,t[22]=L):L=t[22];let R=L,z;t[23]!==n||t[24]!==r?(z=(0,Z.jsx)(py,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=z):z=t[25];let B=z,V=l?A:void 0,H=l?`bg-muted`:`hover:bg-muted/80`,U;t[26]===H?U=t[27]:(U=[`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`,H],t[26]=H,t[27]=U);let W=U.join(` `),G;t[28]===P?G=t[29]:(G=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[28]=P,t[29]=G);let K;t[30]===B?K=t[31]:(K=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[30]=B,t[31]=K);let q;t[32]===_?q=t[33]:(q=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:_}),t[32]=_,t[33]=q);let J;t[34]!==n.timestamp||t[35]!==m?(J=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:m}),t[34]=n.timestamp,t[35]=m,t[36]=J):J=t[36];let ee;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=ee):ee=t[37];let Y;t[38]===f?Y=t[39]:(Y=f({id:`Yea-K5`}),t[38]=f,t[39]=Y);let te;t[40]===E?te=t[41]:(te=e=>{e.stopPropagation(),E(!0)},t[40]=E,t[41]=te);let ne;t[42]===D?ne=t[43]:(ne=D?(0,Z.jsx)(h,{className:`size-3 animate-spin`}):(0,Z.jsx)(pi,{className:`size-3`}),t[42]=D,t[43]=ne);let X;t[44]!==D||t[45]!==Y||t[46]!==te||t[47]!==ne?(X=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":Y,disabled:D,onClick:te,children:ne})}),t[44]=D,t[45]=Y,t[46]=te,t[47]=ne,t[48]=X):X=t[48];let re;t[49]===f?re=t[50]:(re=f({id:`Yea-K5`}),t[49]=f,t[50]=re);let ie;t[51]===re?ie=t[52]:(ie=(0,Z.jsx)(Ns,{side:`top`,children:re}),t[51]=re,t[52]=ie);let ae;t[53]!==X||t[54]!==ie?(ae=(0,Z.jsxs)(Is,{children:[X,ie]}),t[53]=X,t[54]=ie,t[55]=ae):ae=t[55];let oe;t[56]!==q||t[57]!==J||t[58]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[q,J,ee,ae]}),t[56]=q,t[57]=J,t[58]=ae,t[59]=oe):oe=t[59];let se;t[60]===w?se=t[61]:(se=w.length>0&&(0,Z.jsx)(hy,{summaries:w}),t[60]=w,t[61]=se);let ce=S.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:S.join(`, `),children:S.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),le;t[62]!==oe||t[63]!==se||t[64]!==ce?(le=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[oe,se,ce]}),t[62]=oe,t[63]=se,t[64]=ce,t[65]=le):le=t[65];let ue;t[66]!==l||t[67]!==P||t[68]!==V||t[69]!==W||t[70]!==G||t[71]!==K||t[72]!==le?(ue=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":l,"aria-controls":V,"data-testid":`timeline-entry-expand`,className:W,onClick:P,onKeyDown:G,children:[K,le]}),t[66]=l,t[67]=P,t[68]=V,t[69]=W,t[70]=G,t[71]=K,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==o||t[75]!==a||t[76]!==A||t[77]!==c||t[78]!==n.sha||t[79]!==l?(de=l&&(0,Z.jsx)(vy,{sha:n.sha,docName:c,cache:o,diffLayout:a,panelId:A}),t[74]=o,t[75]=a,t[76]=A,t[77]=c,t[78]=n.sha,t[79]=l,t[80]=de):de=t[80];let fe;t[81]!==ue||t[82]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[ue,de]}),t[81]=ue,t[82]=de,t[83]=fe):fe=t[83];let pe;t[84]!==I||t[85]!==E?(pe=e=>{e?E(!0):I()},t[84]=I,t[85]=E,t[86]=pe):pe=t[86];let me;t[87]===f?me=t[88]:(me=f({id:`Pyp1NA`}),t[87]=f,t[88]=me);let he;t[89]===me?he=t[90]:(he=(0,Z.jsx)(Co,{children:me}),t[89]=me,t[90]=he);let ge;t[91]!==y||t[92]!==_||t[93]!==x||t[94]!==m?(ge={relative:m,absoluteTime:y,entrySha:x,authorName:_},t[91]=y,t[92]=_,t[93]=x,t[94]=m,t[95]=ge):ge=t[95];let _e;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(_e={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[96]=_e):_e=t[96];let ve;t[97]===ge?ve=t[98]:(ve=(0,Z.jsx)(So,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:ge,components:_e})}),t[97]=ge,t[98]=ve);let ye;t[99]!==he||t[100]!==ve?(ye=(0,Z.jsxs)(Do,{children:[he,ve]}),t[99]=he,t[100]=ve,t[101]=ye):ye=t[101];let be;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(s,{id:`dEgA5A`}),t[102]=be):be=t[102];let xe;t[103]===I?xe=t[104]:(xe=(0,Z.jsx)(ci,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:I,children:be}),t[103]=I,t[104]=xe);let Se;t[105]===R?Se=t[106]:(Se=()=>R(),t[105]=R,t[106]=Se);let Ce;t[107]===D?Ce=t[108]:(Ce=D?(0,Z.jsx)(h,{className:`mr-2 size-4 animate-spin`}):null,t[107]=D,t[108]=Ce);let we;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[109]=we):we=t[109];let Te;t[110]!==D||t[111]!==Se||t[112]!==Ce?(Te=(0,Z.jsxs)(ci,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:D,onClick:Se,children:[Ce,we]}),t[110]=D,t[111]=Se,t[112]=Ce,t[113]=Te):Te=t[113];let Ee;t[114]!==xe||t[115]!==Te?(Ee=(0,Z.jsxs)(Eo,{children:[xe,Te]}),t[114]=xe,t[115]=Te,t[116]=Ee):Ee=t[116];let De;t[117]!==ye||t[118]!==Ee?(De=(0,Z.jsxs)(wo,{children:[ye,Ee]}),t[117]=ye,t[118]=Ee,t[119]=De):De=t[119];let Oe;t[120]!==T||t[121]!==pe||t[122]!==De?(Oe=(0,Z.jsx)(Oo,{open:T,onOpenChange:pe,children:De}),t[120]=T,t[121]=pe,t[122]=De,t[123]=Oe):Oe=t[123];let ke;return t[124]!==fe||t[125]!==Oe?(ke=(0,Z.jsxs)(Z.Fragment,{children:[fe,Oe]}),t[124]=fe,t[125]=Oe,t[126]=ke):ke=t[126],ke}function by(e){return e.docs}function xy(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:a}=e,{_:o}=i(),{resolvedTheme:c}=Yr(),l=c===`dark`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[0]=u):u=t[0];let[d,f]=(0,Q.useState)(u),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_]=(0,Q.useState)(Ty),[v,y]=(0,Q.useState)(wy),b;t[1]===_?b=t[2]:(b=()=>{y(new Set),_.clear()},t[1]=_,t[2]=b);let x;t[3]===n?x=t[4]:(x=[n],t[3]=n,t[4]=x),(0,Q.useEffect)(b,x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=S):S=t[5];let C=S,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){y(new Set)},t[6]=w):w=t[6];let T=w,E,D;t[7]!==o||t[8]!==n?(E=()=>{if(!n){f([]);return}m(!0);let e=Dv({baseMs:ay,maxBackoffMs:oy,isPaused:Cy,poll:e=>sy(n,e,{setEntries:f,setError:g,setLoading:m,unavailableMessage:o({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)}},D=[n,o],t[7]=o,t[8]=n,t[9]=E,t[10]=D):(E=t[9],D=t[10]),(0,Q.useEffect)(E,D);let O=!p&&!h&&d.length>0,k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(xn,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[11]=k):k=t[11];let A;t[12]!==o||t[13]!==r||t[14]!==O||t[15]!==a?(A=O&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(xo,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":o({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)(yo,{value:`unified`,"aria-label":o({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(Xl,{className:`size-3.5`})}),(0,Z.jsx)(yo,{value:`split`,"aria-label":o({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(ul,{className:`size-3.5`})})]})}),(0,Z.jsx)(Ns,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[12]=o,t[13]=r,t[14]=O,t[15]=a,t[16]=A):A=t[16];let j;t[17]===A?j=t[18]:(j=(0,Z.jsxs)(vn,{children:[k,A]}),t[17]=A,t[18]=j);let M;t[19]!==o||t[20]!==p?(M=p&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":o({id:`o49mDZ`}),children:[1,2,3].map(Sy)}),t[19]=o,t[20]=p,t[21]=M):M=t[21];let N;t[22]!==h||t[23]!==p?(N=!p&&h&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:h})}),t[22]=h,t[23]=p,t[24]=N):N=t[24];let P;t[25]!==d||t[26]!==h||t[27]!==p?(P=!p&&!h&&d.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)(s,{id:`Ta25TG`})})}),t[25]=d,t[26]=h,t[27]=p,t[28]=P):P=t[28];let F;t[29]!==_||t[30]!==r||t[31]!==n||t[32]!==d||t[33]!==h||t[34]!==v||t[35]!==l||t[36]!==p?(F=!p&&!h&&d.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:d.map(e=>(0,Z.jsx)(yy,{entry:e,isDark:l,diffLayout:r,cache:_,docName:n,expanded:v.has(e.sha),onToggleExpanded:C,onRestoreSuccess:T},e.sha))}),t[29]=_,t[30]=r,t[31]=n,t[32]=d,t[33]=h,t[34]=v,t[35]=l,t[36]=p,t[37]=F):F=t[37];let I;t[38]!==M||t[39]!==N||t[40]!==P||t[41]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[M,N,P,F]}),t[38]=M,t[39]=N,t[40]=P,t[41]=F,t[42]=I):I=t[42];let L;return t[43]!==j||t[44]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[j,I]}),t[43]=j,t[44]=I,t[45]=L):L=t[45],L}function Sy(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(za,{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)(za,{className:`h-3 w-28`}),(0,Z.jsx)(za,{className:`h-3 w-40`})]})]},e)}function Cy(){return typeof document<`u`&&document.visibilityState===`hidden`}function wy(){return new Set}function Ty(){return new mi(32)}var Ey=[{id:`outline`,icon:Pl},{id:`links`,icon:ye},{id:`graph`,icon:Ll},{id:`timeline`,icon:ll}];function Dy(e){return e===`outline`?ms._({id:`dD7NPy`}):e===`links`?ms._({id:`Rj01Fz`}):e===`graph`?ms._({id:`x2fr_j`}):ms._({id:`cklVjM`})}function Oy(){return n(()=>import(`./GraphPanel-Vj2cdFDc.js`),__vite__mapDeps([21,1,14,6,8,9,22,3,23,24,25,15,26,27,28,29,30,31,32,33,34,35]),import.meta.url)}var ky=(0,Q.lazy)(async()=>({default:(await Oy()).GraphPanel})),Ay=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BuhneEc6.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent}));function jy(e){let t=(0,$.c)(18),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(`unified`),f=Sg(),p,m,h;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==o||t[4]!==f){let e=f?Ey.filter(Ny):Ey;p=e.some(e=>e.id===a)?a:`outline`,m=c===`doc`&&e.length>1,h=m?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(xo,{type:`single`,variant:`outline`,value:p,onValueChange:e=>{e&&o(e)},"aria-label":l({id:`SrOuyg`}),children:e.map(My)})}):null,t[0]=l,t[1]=a,t[2]=c,t[3]=o,t[4]=f,t[5]=p,t[6]=m,t[7]=h}else p=t[5],m=t[6],h=t[7];let g;t[8]!==u||t[9]!==n||t[10]!==p||t[11]!==r||t[12]!==c||t[13]!==m?(g=c===`doc`?(0,Z.jsxs)(`div`,{...m?{role:`tabpanel`,id:`panel-${p}`,"aria-labelledby":`tab-${p}`}:{},className:`min-h-0 flex-1`,children:[p===`outline`&&(0,Z.jsx)(Dc,{docName:n,isSourceMode:r}),p===`links`&&(0,Z.jsx)(Ev,{docName:n}),p===`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)(s,{id:`-lCAuQ`})}),children:(0,Z.jsx)(ky,{activeDocName:n})}),p===`timeline`&&(0,Z.jsx)(xy,{docName:n,diffLayout:u,onDiffLayoutChange:d})]}):(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)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(Ay,{})})}),t[8]=u,t[9]=n,t[10]=p,t[11]=r,t[12]=c,t[13]=m,t[14]=g):g=t[14];let _;return t[15]!==h||t[16]!==g?(_=(0,Z.jsxs)(Z.Fragment,{children:[h,g]}),t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function My(e){let{id:t,icon:n}=e,r=Dy(t);return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(yo,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:r})]},t)}function Ny(e){return e.id===`outline`}function Py(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Fy(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Iy(e){return e/100*window.innerHeight}function Ly(e){return e/100*window.innerWidth}function Ry(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function zy({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Ry(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Fy(t,i);break;case`em`:r=Py(t,i);break;case`vh`:r=Iy(i);break;case`vw`:r=Ly(i);break}return r}function By(e){return parseFloat(e.toFixed(3))}function Vy({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 Hy(e){let{panels:t}=e,n=Vy({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=By(zy({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=By(zy({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=By(zy({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=By(zy({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 Uy(e,t=`Assertion error`){if(!e)throw Error(t)}function Wy(e,t){return Array.from(t).sort(e===`horizontal`?Gy:Ky)}function Gy(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Ky(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function qy(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Jy(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 Yy({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}=Jy(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Uy(i,`No rect found`),i}var Xy;function Zy(){return Xy===void 0&&(Xy=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Xy}function Qy(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Wy(n,Array.from(t.children).filter(qy).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,Yy({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=Zy()?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:Vy({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 $y=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)}}},eb=new Map,tb=new $y;function nb(e){eb=new Map(eb),eb.delete(e)}function rb(e,t){for(let[t]of eb)if(t.id===e)return t}function ib(e,t){for(let[t,n]of eb)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function ab(){return eb}function ob(e,t){return tb.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function sb(e,t){let n=eb.get(e);eb=new Map(eb),eb.set(e,t),tb.emit(`groupChange`,{group:e,prev:n,next:t})}function cb(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Jy(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 lb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ub(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:gb(e),b:gb(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Uy(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:hb(mb(n.a)),b:hb(mb(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 db=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function fb(e){let t=getComputedStyle(_b(e)??e).display;return t===`flex`||t===`inline-flex`}function pb(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||fb(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`||db.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function mb(e){let t=e.length;for(;t--;){let n=e[t];if(Uy(n,`Missing node`),pb(n))return n}return null}function hb(e){return e&&Number(getComputedStyle(e).zIndex)||0}function gb(e){let t=[];for(;e;)t.push(e),e=_b(e);return t}function _b(e){let{parentNode:t}=e;return lb(t)?t.host:t}function vb(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 yb({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!qy(n)||n.contains(e)||e.contains(n))return!0;if(ub(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(vb(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function bb(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Qy(r),a=cb(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&yb({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function xb(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 Sb(e,t,n=0){return Math.abs(By(e)-By(t))<=n}function Cb(e,t){return Sb(e,t)?0:e>t?1:-1}function wb({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(Cb(r,c)<0)if(a){let e=(i+c)/2;r=Cb(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=By(r),r}function Tb({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Sb(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Uy(u!=null,`Invalid first pivot index`),Uy(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Uy(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(Uy(n!=null,`Previous layout not found for panel index ${t}`),Sb(n,i)){let t=o-n;Cb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Uy(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(Uy(n!=null,`Previous layout not found for panel index ${t}`),Sb(n,o)){let t=n-i;Cb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Uy(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Cb(i,c)<0)if(e>0){let t=c-o,n=t/2;Cb(i+e,c)<0&&(e=Cb(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Cb(i-e,c)<0&&(e=Cb(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];Uy(e!=null,`Previous layout not found for panel index ${r}`);let a=wb({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];Uy(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=wb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Sb(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(xb(c,l))return i;{let t=e<0?d:u,r=s[t];Uy(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=wb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Sb(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Uy(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=wb({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Sb(i,s)||(t-=s-i,l[r]=s),Sb(t,0))break;e>0?r--:r++}}}if(!Sb(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 Eb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Cb(e[n],t[n])!==0)return!1;return!0}function Db({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(!Sb(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Uy(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];Uy(i!=null,`No layout data found for index ${e}`);let o=r[e];Uy(o!=null,`No layout data found for index ${e}`);let s=wb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Sb(a,0))for(let e=0;e<t.length;e++){let n=r[e];Uy(n!=null,`No layout data found for index ${e}`);let i=n+a,o=wb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Sb(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Ob({groupId:e,panelId:t}){let n=()=>{let t=ab();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=Db({layout:Tb({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});Eb(l,p)||sb(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&&Sb(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Vy({group:t});o(By(zy({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function kb(e){e.defaultPrevented||bb(e,ab()).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=Ob({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Ab(e){let t=ab();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 jb({groupId:e}){let t=()=>{let t=ab();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=Db({layout:e,panelConstraints:r});return n?o:(Eb(o,c)||sb(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Mb(e,t){let n=Ab(e),r=ib(n.id,!0),i=n.separators.find(t=>t.element===e);Uy(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Uy(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=jb({groupId:n.id}).getLayout(),c=Db({layout:Tb({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Eb(s,c)||sb(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Nb(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Ab(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Mb(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Mb(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Mb(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Mb(t,-5);break;case`End`:e.preventDefault(),Mb(t,100);break;case`Enter`:{e.preventDefault();let n=Ab(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=ib(n.id,!0),o=n.separators.find(e=>e.element===t);Uy(o,`Matching separator not found`);let s=a.get(o);Uy(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Uy(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Mb(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Ab(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Uy(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(),Mb(t,-100);break}}var Pb={cursorFlags:0,state:`inactive`},Fb=new $y;function Ib(){return Pb}function Lb(e){return Fb.addListener(`change`,e)}function Rb(e){let t=Pb,n={...Pb};n.cursorFlags=e,Pb=n,Fb.emit(`change`,{prev:t,next:n})}function zb(e){let t=Pb;Pb=e,Fb.emit(`change`,{prev:t,next:e})}function Bb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=ab(),n=bb(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)}),zb({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Vb=e=>e,Hb=()=>{},Ub=1,Wb=2,Gb=4,Kb=8,qb=3,Jb=12,Yb;function Xb(){return Yb===void 0&&(Yb=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Yb=!0)),Yb}function Zb({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&&Xb()){let t=(e&Ub)!==0,n=(e&Wb)!==0,r=(e&Gb)!==0,i=(e&Kb)!==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 Xb()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Qb=new WeakMap;function $b(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Qb.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Ib();switch(r.state){case`active`:case`hover`:{let e=Zb({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}Qb.set(e,{prevStyle:t,styleSheet:n})}function ex({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=Tb({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Eb(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ub:Wb;break;case`vertical`:s|=d<0?Gb:Kb;break}}else sb(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&qb:c|=s&qb,t.movementY===0?c|=o&Jb:c|=s&Jb,Rb(c),$b(e)}function tx(e){let t=ab(),n=Ib();switch(n.state){case`active`:ex({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function nx(e){if(e.defaultPrevented)return;let t=Ib(),n=ab();switch(t.state){case`active`:if(e.buttons===0){zb({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=ib(e.group.id,!0);sb(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)}ex({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=bb(e,n);r.length===0?t.state!==`inactive`&&zb({cursorFlags:0,state:`inactive`}):zb({cursorFlags:0,hitRegions:r,state:`hover`}),$b(e.currentTarget);break}}}function rx(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ib().state){case`hover`:zb({cursorFlags:0,state:`inactive`})}}function ix(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Ib();switch(t.state){case`active`:zb({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&($b(e.currentTarget),t.hitRegions.forEach(e=>{let t=ib(e.group.id,!0);sb(e.group,t)}),e.preventDefault())}}function ax(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=By(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=By((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function ox(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Vy({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:By(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function sx(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 cx({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=By(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]=By((r[e]??0)/a*l);else{let e=By(l/c.length);for(let t of c)u[t]=e}return u}function lx(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 ux=new Map;function dx(e){let t=!0;Uy(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=Vy({group:e});if(t===0)return;let n=ib(e.id);if(!n)return;let r=Hy(e),i=n.defaultLayoutDeferred?ax(r):n.layout,a=Db({layout:cx({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Eb(n.layout,a)&&sx(n.derivedPanelConstraints,r)&&n.groupSize===t)return;sb(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else ox(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Uy(!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=Vy({group:e}),s=Hy(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(lx(e.panels,l)||(l=void 0));let u=Db({layout:e.mutableState.layouts[c]??l??ax(s),panelConstraints:s}),d=e.element.ownerDocument;ux.set(d,(ux.get(d)??0)+1);let f=new Map;return Qy(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),sb(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Uy(!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`,Nb)}),ux.get(d)===1&&(d.addEventListener(`dblclick`,kb,!0),d.addEventListener(`pointerdown`,Bb,!0),d.addEventListener(`pointerleave`,tx),d.addEventListener(`pointermove`,nx),d.addEventListener(`pointerout`,rx),d.addEventListener(`pointerup`,ix,!0)),function(){t=!1,ux.set(d,Math.max(0,(ux.get(d)??0)-1)),nb(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Nb)}),ux.get(d)||(d.removeEventListener(`dblclick`,kb,!0),d.removeEventListener(`pointerdown`,Bb,!0),d.removeEventListener(`pointerleave`,tx),d.removeEventListener(`pointermove`,nx),d.removeEventListener(`pointerout`,rx),d.removeEventListener(`pointerup`,ix,!0)),a.disconnect()}}function fx(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function px(e){let t=(0,Q.useId)();return`${e??t}`}var mx=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function hx(e){let t=(0,Q.useRef)(e);return mx(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function gx(...e){return hx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function _x(e){let t=(0,Q.useRef)({...e});return mx(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var vx=(0,Q.createContext)(null);function yx(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Vb});(0,Q.useImperativeHandle)(t,()=>n.current,[]),mx(()=>{Object.assign(n.current,jb({groupId:e}))})}function bx({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=hx(e=>{Eb(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=hx(e=>{Eb(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=px(s),v=(0,Q.useRef)(null),[y,b]=fx(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=gx(v,a);yx(_,o);let C=hx((e,t)=>{let r=Ib(),i=rb(e),a=ib(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=_x({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=Wy(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Wy(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=rb(_),i=ib(_);r&&i&&sb(r,{...i,derivedPanelConstraints:Hy(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 mx(()=>{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=dx(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=ib(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=ob(_,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=Sb(t.collapsedSize,i[t.panelId]),a=Sb(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Ib().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)(vx.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})})}bx.displayName=`Group`;function xx(){let e=(0,Q.useContext)(vx);return Uy(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Sx(e,t){let{id:n}=xx(),r=(0,Q.useRef)({collapse:Hb,expand:Hb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Hb});(0,Q.useImperativeHandle)(t,()=>r.current,[]),mx(()=>{Object.assign(r.current,Ob({groupId:n,panelId:e}))})}function Cx({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=px(c),_=_x({disabled:a}),v=(0,Q.useRef)(null),y=gx(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=xx(),T=d!==null,E=hx((e,t,n)=>{d?.(e,c,n)});mx(()=>{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]),Sx(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>ob(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:{...wx,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})})}Cx.displayName=`Panel`;var wx={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Tx(){return(0,Q.useRef)(null)}function Ex({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=Db({layout:Tb({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Db({layout:Tb({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Dx({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=px(a),l=_x({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=gx(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=xx(),x=v===`horizontal`?`vertical`:`horizontal`;mx(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=Lb(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=ob(_,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(Ex({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})}Dx.displayName=`Separator`;var Ox=new Map;function kx(e){let t=Ox.get(e);if(t)return t;let n=Ax(e);return Ox.set(e,n),n}async function Ax(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-CpYUNWOc.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-DrSwTBuw.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-DrSwTBuw.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-DrSwTBuw.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-Mxq-zflt.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([38,1,39,23,40]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-D0_HBszs.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-DdpCnkcu.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-4lW4ME5D.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-DrSwTBuw.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-Bui1BhSw.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([42,1,43,39,23,40]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-Debx6b6u.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([44,1,39,23,40]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-DrSwTBuw.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-BrsGSRvH.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-B9B58-J_.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([45,1,43,39,23,41,38,40,42]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-DrSwTBuw.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-BvKrvbRb.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-D1rVZYi52.js`);return{python:e}},__vite__mapDeps([50,43,39,1,23,40]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r-CfD_nMxU.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-CEHR0ONp.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-CjXb6uie.js`);return{rust:e}},__vite__mapDeps([51,39,1,23,40]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-m6QogzU7.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-CmJiKyqD.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-Bui1BhSw.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([42,1,43,39,23,40]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-Bn0QvNGs.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([41,1,38,39,23,40,42,43]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-pSQcUvmU.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([46,1,39,23,40]),import.meta.url)).yaml().language;default:return null}}async function jx(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-Debx6b6u.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([44,1,39,23,40]),import.meta.url)).json().language;if(t){let e=await kx(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-CSZcBb2g.js`);return{toml:e}},[],import.meta.url)).toml):null}var Mx=Y({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Nx=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Px(e){let t=(0,$.c)(5),{_:n}=i(),r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`loading`},t[0]=r):r=t[0];let[a,o]=(0,Q.useState)(r),s,c;return t[1]!==n||t[2]!==e?(s=()=>{let t=!1,r=new AbortController;return o({status:`loading`}),fetch(e,{credentials:`same-origin`,signal:r.signal}).then(async e=>{if(!e.ok){let t=e.status;throw Error(n(t===413?{id:`C_WGy8`}:t===404?{id:`s0IDhW`}:t===400?{id:`N1mdmS`}:{id:`96w9hU`,values:{status:t}}))}return e.text()}).then(e=>{t||o({status:`loaded`,content:e})}).catch(e=>{t||e instanceof Error&&e.name===`AbortError`||o({status:`error`,message:e instanceof Error?e.message:n({id:`ig5vUe`})})}),()=>{t=!0,r.abort()}},c=[e,n],t[1]=n,t[2]=e,t[3]=s,t[4]=c):(s=t[3],c=t[4]),(0,Q.useEffect)(s,c),a}function Fx(e){let t=(0,$.c)(28),{src:n,fileName:r,extension:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:c}=Yr(),l=Px(n),u=l.status===`loaded`?l.content:null,d,f;if(t[0]!==i||t[1]!==u||t[2]!==c?(d=()=>{if(!a.current||u===null)return;let e=i.toLowerCase(),t=sr(e),n=c===`dark`?Mx:Nx,r=!1,s=null;return jx(e,t).then(e=>{if(r||!a.current)return;let t=[Fc,...e?[e]:[],_c.editable.of(!0),sc.readOnly.of(!0),_c.lineWrapping,n];s=new _c({state:sc.create({doc:u,extensions:t}),parent:a.current}),o.current=s}),()=>{r=!0,s?.destroy(),o.current=null}},f=[u,i,c],t[0]=i,t[1]=u,t[2]=c,t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f),l.status===`loading`){let e;t[5]===r?e=t[6]:(e=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`Md709y`,values:{fileName:r}})}),t[5]=r,t[6]=e);let n;return t[7]!==i||t[8]!==r||t[9]!==e?(n=(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":r,"data-text-viewer":``,"data-text-viewer-state":`loading`,"data-text-viewer-extension":i,children:e}),t[7]=i,t[8]=r,t[9]=e,t[10]=n):n=t[10],n}if(l.status===`error`){let e;t[11]===r?e=t[12]:(e=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(s,{id:`qdBUHP`,values:{fileName:r}})}),t[11]=r,t[12]=e);let a;t[13]===l.message?a=t[14]:(a=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:l.message}),t[13]=l.message,t[14]=a);let o;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`9npOH9`}),t[15]=o):o=t[15];let c;t[16]===n?c=t[17]:(c=(0,Z.jsx)(`a`,{href:n,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:o}),t[16]=n,t[17]=c);let u;return t[18]!==i||t[19]!==r||t[20]!==e||t[21]!==a||t[22]!==c?(u=(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":r,"data-text-viewer":``,"data-text-viewer-state":`error`,"data-text-viewer-extension":i,children:[e,a,c]}),t[18]=i,t[19]=r,t[20]=e,t[21]=a,t[22]=c,t[23]=u):u=t[23],u}let p;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[24]=p):p=t[24];let m;return t[25]!==i||t[26]!==r?(m=(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":i,children:p}),t[25]=i,t[26]=r,t[27]=m):m=t[27],m}function Ix(e){return Kr(`/api/asset?path=${encodeURIComponent(e)}`)}function Lx(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function Rx(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=Ix(n),t[0]=n,t[1]=o);let c=o,l;t[2]===n?l=t[3]:(l=n.split(`/`).pop()??n,t[2]=n,t[3]=l);let u=l,d,f,p,m;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){m=Symbol.for(`react.early_return_sentinel`);bb0:{if(p=u.includes(`.`)?u.split(`.`).pop()??``:``,f=p.length>0?p.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[13]!==u||t[14]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(X,{src:c,title:u,fillContainer:!0})}),t[13]=u,t[14]=c,t[15]=e):e=t[15];let n;t[16]!==u||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[16]=u,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=Lx(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(Fx,{src:e,fileName:u,extension:p.toLowerCase()},n);break bb0}}t[4]=n,t[5]=u,t[6]=i,t[7]=r,t[8]=c,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]!==u||t[25]!==p||t[26]!==c?(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)(Ge,{src:c,alt:u,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:c,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:c,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:u})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(ci,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(s,{id:`qFWMl-`})}),(0,Z.jsx)(ci,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{rt({url:c,projectRelPath:n,ext:p.toLowerCase(),title:u,forceOsDelegation:!1})},children:(0,Z.jsx)(s,{id:`9npOH9`})})]})]})}),t[21]=n,t[22]=d,t[23]=f,t[24]=u,t[25]=p,t[26]=c,t[27]=h):h=t[27];let g;return t[28]!==u||t[29]!==h?(g=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:h}),t[28]=u,t[29]=h,t[30]=g):g=t[30],g}function zx(){let e=(0,$.c)(5),{_:t}=i(),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)(za,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(za,{className:`h-4 w-full`}),(0,Z.jsx)(za,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function Bx(e){let{_:t}=i();return e===`existing-repo`?[{id:`draft-spec`,icon:_l,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Pl,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:Ll,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:cu,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:_l,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:tl,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function Vx(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:a}=i(),o=Bx(n),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(void 0),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>clearTimeout(l.current),d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,Q.useEffect)(u,d);let f,p;if(t[2]!==a||t[3]!==r||t[4]!==s||t[5]!==o){let e=function(e,t){Pa(t).then(()=>{c(e),clearTimeout(l.current),l.current=setTimeout(()=>c(null),1600)}).catch(Hx)};t[8]===r?f=t[9]:(f=oi(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=f),p=o.map(t=>{let n=t.icon,r=s===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)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":a(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:oi(`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)(ko,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(tt,{className:`size-3.5`,"aria-hidden":`true`}),a(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=a,t[3]=r,t[4]=s,t[5]=o,t[6]=f,t[7]=p}else f=t[6],p=t[7];let m;return t[10]!==f||t[11]!==p?(m=(0,Z.jsx)(`ul`,{className:f,children:p}),t[10]=f,t[11]=p,t[12]=m):m=t[12],m}function Hx(){}var Ux={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Wx(e){let t=(0,$.c)(23),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=Yr(),s=Ux[r],c=s?(o===`dark`?Lr[s]:void 0)??qr[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=oi(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,Z.jsx)(fi,{style:u,className:p,...i}),t[11]=p,t[12]=u,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==p||t[16]!==u||t[17]!==i?(e=(0,Z.jsx)(di,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,Z.jsx)(vi,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}var Gx=(0,Q.createContext)(null);function Kx(e){let t=(0,$.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(Gx,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function qx(){return(0,Q.use)(Gx)}var Jx=ii(`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 Yx(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=oi(Jx({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 Xx=`ok-preferred-agent-v1`,Zx=new Set(_g.map(e=>e.id));function Qx(e){return typeof e==`string`&&Zx.has(e)}function $x(e){try{let t=(e??localStorage).getItem(Xx);return Qx(t)?t:null}catch{return null}}function eS(e,t){try{(t??localStorage).setItem(Xx,e)}catch{}}function tS(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:_g.find(e=>n[e.id]?.installed===!0)?.id??null}function nS(e){let t=(0,$.c)(52),{scenario:n,className:r}=e,{_:a}=i(),{states:o,refresh:c}=O_(),{dispatch:l}=__(),u=po(),d=qx(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(iS),g=(0,Q.useRef)(!1),[_,v]=(0,Q.useState)(!1),y=_&&d!==null,b=(0,Q.useRef)(null),x=Bx(n),S;t[0]===o?S=t[1]:(S=e=>o[e.id]?.installed===!0,t[0]=o,t[1]=S);let C=_g.filter(S),w;t[2]===o?w=t[3]:(w=_g.every(e=>o[e.id]?.installed!=null),t[2]=o,t[3]=w);let T=w,E=T&&C.length===0,D,O;t[4]!==T||t[5]!==o?(D=()=>{if(!T||g.current)return;let e=tS({lastUsed:$x(),states:o});h(t=>e===t?t:e)},O=[T,o],t[4]=T,t[5]=o,t[6]=D,t[7]=O):(D=t[6],O=t[7]),(0,Q.useEffect)(D,O);let k=function(e){g.current=!0,v(!1),h(e),eS(e)},A;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){g.current=!0,v(!0)},t[8]=A):A=t[8];let j=A,M;t[9]!==f||t[10]!==n||t[11]!==d||t[12]!==u?(M=function(){if(d===null)return;let e=n_({workspace:u,description:f.trim(),scenario:n});e!==null&&d.launchInTerminal(e)},t[9]=f,t[10]=n,t[11]=d,t[12]=u,t[13]=M):M=t[13];let N=M,P;t[14]!==f||t[15]!==l||t[16]!==n||t[17]!==u?(P=function(e){let t=f.trim();eS(e);let r=n_({workspace:u,description:t,scenario:n});r!==null&&l(e,r)},t[14]=f,t[15]=l,t[16]=n,t[17]=u,t[18]=P):P=t[18];let F=P,I;t[19]!==y||t[20]!==F||t[21]!==N||t[22]!==m?(I=function(e){(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),y?N():m!==null&&F(m))},t[19]=y,t[20]=F,t[21]=N,t[22]=m,t[23]=I):I=t[23];let L=I,R=function(e){p(e),b.current?.focus()};if(E){let e;t[24]===r?e=t[25]:(e=oi(`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[24]=r,t[25]=e);let n;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(yi,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[26]=n):n=t[26];let i;t[27]===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)(s,{id:`3IseAk`})})]}),t[27]=i):i=t[27];let a;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:_g.map(rS)}),t[28]=a):a=t[28];let o;return t[29]===e?o=t[30]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[29]=e,t[30]=o),o}let z=C.length>0,B=d!==null,V;t[31]===r?V=t[32]:(V=oi(`flex w-full flex-col gap-3`,r),t[31]=r,t[32]=V);let H;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>p(e.target.value),t[33]=H):H=t[33];let U;t[34]===a?U=t[35]:(U=a({id:`0jD-Gn`}),t[34]=a,t[35]=U);let W;t[36]===a?W=t[37]:(W=a({id:`7hctf2`}),t[36]=a,t[37]=W);let G;t[38]!==f||t[39]!==L||t[40]!==U||t[41]!==W?(G=(0,Z.jsx)(qs,{ref:b,value:f,onChange:H,onKeyDown:L,rows:4,placeholder:U,"aria-label":W,className:`min-h-12 resize-none rounded-2xl border-0 bg-transparent dark:bg-transparent px-4 py-3.5 text-sm leading-relaxed shadow-none focus-visible:border-0 focus-visible:ring-0 max-h-96 subtle-scrollbar`}),t[38]=f,t[39]=L,t[40]=U,t[41]=W,t[42]=G):G=t[42];let K=m===null?(0,Z.jsx)(ci,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(s,{id:`hYgDIe`})}):(0,Z.jsxs)(Yx,{children:[(0,Z.jsx)(ci,{type:`button`,onClick:()=>y?N():F(m),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ru,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`hozzkE`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wx,{id:m,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`9dw5bW`,values:{0:m_(m)}})]})}),(0,Z.jsxs)(ao,{onOpenChange:e=>{e&&c()},children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,"aria-label":a({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(Ve,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(eo,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(La,{"aria-label":a({id:`BBqGS9`}),children:[(0,Z.jsx)(Ja,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),C.map(e=>(0,Z.jsxs)(Ea,{onSelect:()=>k(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!y&&e.id===m?(0,Z.jsx)(ko,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]}):null,B?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(no,{}):null,(0,Z.jsxs)(La,{"aria-label":a({id:`ALhMYW`}),children:[(0,Z.jsx)(Ja,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(Ea,{onSelect:()=>j(),"data-testid":`create-with-claude-cli`,"aria-label":a({id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),y?(0,Z.jsx)(ko,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]})]})]}):null]})]})]}),q;t[43]===K?q=t[44]:(q=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 px-3 pb-3`,children:K}),t[43]=K,t[44]=q);let J;t[45]!==G||t[46]!==q?(J=(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:[G,q]}),t[45]=G,t[46]=q,t[47]=J):J=t[47];let ee=n!==`existing-repo`&&x.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:x.map(e=>{let t=e.icon;return(0,Z.jsxs)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>R(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,Y;return t[48]!==J||t[49]!==ee||t[50]!==V?(Y=(0,Z.jsxs)(`div`,{className:V,children:[J,ee]}),t[48]=J,t[49]=ee,t[50]=V,t[51]=Y):Y=t[51],Y}function rS(e){return(0,Z.jsxs)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r_(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(vo,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function iS(){return $x()}var aS=3100,oS=3;function sS(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??oS;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var cS={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}},lS=[`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 uS(e,t={}){let n=t.rng??Math.random,r=t.colors??lS,i=cS[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 dS=1.8,fS=90,pS=16,mS=380,hS=.025,gS=.1,_S=.18,vS=400,yS=9.2736,bS=18.1799,xS=14.5244,SS={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function CS(e,t){let{halfWidth:n,apexLift:r}=SS[t];return`M${e-n} ${xS+.3} Q${e} ${xS-r}, ${e+n} ${xS+.3}`}function wS(e){let t=1.5,n=.3;return`M${e-t} ${xS-n} Q${e} ${xS+1.4}, ${e+t} ${xS-n}`}var TS=15,ES=15;function DS(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 OS(e){let t=(0,$.c)(72),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o,gaze:s}=e,c=n===void 0?48:n,l=i===void 0?!0:i,u=a===void 0?`default`:a,d=o===void 0?0:o,f=s===void 0?`cursor`:s,p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g={x:0,y:0},t[0]=g):g=t[0];let _=(0,Q.useRef)(g),[v,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(0),S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[1]=S):S=t[1];let[C,w]=(0,Q.useState)(S),T=(0,Q.useRef)(0),E=(0,Q.useRef)(void 0),D=u===`sleeping`,O;t[2]!==v||t[3]!==D?(O=function(){if(D)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=T.current===0?1/0:e-T.current;T.current=e;let n=sS(v,t);y(n),x(MS),w(uS(n)),clearTimeout(E.current),E.current=setTimeout(()=>{y(0),w([])},aS)},t[2]=v,t[3]=D,t[4]=O):O=t[4];let k=O,A,j;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>clearTimeout(E.current),A=[],t[5]=A,t[6]=j):(A=t[5],j=t[6]),(0,Q.useEffect)(j,A);let M,N;t[7]!==d||t[8]!==D?(M=()=>{d===0||D||(y(3),x(jS),w(uS(3)),clearTimeout(E.current),E.current=setTimeout(()=>{y(0),w([])},aS))},N=[d,D],t[7]=d,t[8]=D,t[9]=M,t[10]=N):(M=t[9],N=t[10]),(0,Q.useEffect)(M,N);let P,F;t[11]!==f||t[12]!==D||t[13]!==l?(P=()=>{if(!l||D)return;let e=f===`down`;if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=0,n=0,r=!1,i=0,a=0,o=0,s=0,c=0,u=function(){c===0&&(c=requestAnimationFrame(g))},d=function(e){t=e.clientX,n=e.clientY,r=!0,u()};function g(){c=0;let l=m.current,d=p.current;if(!l||!d){u();return}let f=r;r=!1;let g=l.getBoundingClientRect(),v=g.left+g.width/2,y=g.top+g.height*.48,b=t-v,x=n-y,S=Math.hypot(b,x),C,w,T=0,E=0;if(e)w=0,C=-pS*.8,E=dS;else{let e=Math.max(-1,Math.min(1,b/mS)),t=Math.max(-1,Math.min(1,x/mS));if(w=e*pS,C=-t*pS,S>=1){let e=Math.min(S/fS,1)*dS;T=b/S*e,E=x/S*e}}let D=Math.abs(C-i)<.01&&Math.abs(w-a)<.01&&Math.abs(T-o)<.01&&Math.abs(E-s)<.01;if(!f&&D)return;u(),i+=(C-i)*gS,a+=(w-a)*gS,d.style.transform=`perspective(${vS}px) rotateX(${i.toFixed(3)}deg) rotateY(${a.toFixed(3)}deg)`,o+=(T-o)*_S,s+=(E-s)*_S;let O=a*hS,k=-i*hS,A=o+O,j=s+k;_.current.x=A,_.current.y=j,h.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,d,{passive:!0}),u(),()=>{document.removeEventListener(`mousemove`,d),c!==0&&cancelAnimationFrame(c),c=0,p.current&&(p.current.style.transform=``),_.current={x:0,y:0},h.current?.removeAttribute(`transform`)}},F=[l,D,f],t[11]=f,t[12]=D,t[13]=l,t[14]=P,t[15]=F):(P=t[14],F=t[15]),(0,Q.useEffect)(P,F);let I;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{let e=h.current;if(!e)return;let{x:t,y:n}=_.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[16]=I):I=t[16],(0,Q.useLayoutEffect)(I);let L=v>0,R=L?v:1,z=L?`ok-blob-clicked-${v}`:null,B;t[17]===r?B=t[18]:(B=oi(`ok-blob-3d-wrapper`,r),t[17]=r,t[18]=B);let V=D?`cursor-default`:`cursor-pointer`,H=`body-${b}`,U=D&&`ok-blob-sleeping`,W;t[19]!==z||t[20]!==U?(W=oi(`ok-blob-group`,U,z),t[19]=z,t[20]=U,t[21]=W):W=t[21];let G;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(G=(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[22]=G):G=t[22];let K=(L||D)&&`ok-blob-eye-hidden`,q;t[23]===K?q=t[24]:(q=oi(`ok-blob-eye`,K),t[23]=K,t[24]=q);let J;t[25]===q?J=t[26]:(J=(0,Z.jsx)(`ellipse`,{cx:yS,cy:xS,rx:1.2722,ry:1.9083,className:q}),t[25]=q,t[26]=J);let ee=(L||D)&&`ok-blob-eye-hidden`,Y;t[27]===ee?Y=t[28]:(Y=oi(`ok-blob-eye ok-blob-eye-right`,ee),t[27]=ee,t[28]=Y);let te;t[29]===Y?te=t[30]:(te=(0,Z.jsx)(`ellipse`,{cx:bS,cy:xS,rx:1.2722,ry:1.9083,className:Y}),t[29]=Y,t[30]=te);let ne;t[31]===R?ne=t[32]:(ne=CS(yS,R),t[31]=R,t[32]=ne);let X=(!L||D)&&`ok-blob-eye-hidden`,re;t[33]===X?re=t[34]:(re=oi(`ok-blob-happy-eye`,X),t[33]=X,t[34]=re);let ie;t[35]!==ne||t[36]!==re?(ie=(0,Z.jsx)(`path`,{d:ne,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:re}),t[35]=ne,t[36]=re,t[37]=ie):ie=t[37];let ae;t[38]===R?ae=t[39]:(ae=CS(bS,R),t[38]=R,t[39]=ae);let oe=(!L||D)&&`ok-blob-eye-hidden`,se;t[40]===oe?se=t[41]:(se=oi(`ok-blob-happy-eye`,oe),t[40]=oe,t[41]=se);let ce;t[42]!==ae||t[43]!==se?(ce=(0,Z.jsx)(`path`,{d:ae,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:se}),t[42]=ae,t[43]=se,t[44]=ce):ce=t[44];let le;t[45]===D?le=t[46]:(le=D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:wS(yS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:wS(bS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[45]=D,t[46]=le);let ue;t[47]!==J||t[48]!==te||t[49]!==ie||t[50]!==ce||t[51]!==le?(ue=(0,Z.jsxs)(`g`,{ref:h,children:[J,te,ie,ce,le]}),t[47]=J,t[48]=te,t[49]=ie,t[50]=ce,t[51]=le,t[52]=ue):ue=t[52];let de;t[53]!==H||t[54]!==W||t[55]!==ue?(de=(0,Z.jsxs)(`g`,{className:W,children:[G,ue]},H),t[53]=H,t[54]=W,t[55]=ue,t[56]=de):de=t[56];let fe;t[57]===D?fe=t[58]:(fe=D?(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[57]=D,t[58]=fe);let pe;t[59]!==b||t[60]!==C?(pe=C.length>0&&(0,Z.jsx)(`g`,{children:C.map(kS)},`firework-${b}`),t[59]=b,t[60]=C,t[61]=pe):pe=t[61];let me;t[62]!==k||t[63]!==c||t[64]!==V||t[65]!==de||t[66]!==fe||t[67]!==pe?(me=(0,Z.jsxs)(`svg`,{ref:m,width:c,height:c,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:V,"aria-hidden":`true`,onClick:k,onMouseDown:AS,children:[de,fe,pe]}),t[62]=k,t[63]=c,t[64]=V,t[65]=de,t[66]=fe,t[67]=pe,t[68]=me):me=t[68];let he;return t[69]!==B||t[70]!==me?(he=(0,Z.jsx)(`span`,{ref:p,className:B,children:me}),t[69]=B,t[70]=me,t[71]=he):he=t[71],he}function kS(e){return(0,Z.jsx)(`circle`,{cx:TS+e.originDx,cy:ES+e.originDy,r:e.size,className:`ok-blob-firework`,style:DS(e)},e.id)}function AS(e){return e.preventDefault()}function jS(e){return e+1}function MS(e){return e+1}function NS(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(OS,{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}var PS=`open-knowledge:create-top-level-file`;function FS(e={}){window.dispatchEvent(new CustomEvent(PS,{detail:e}))}function IS(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(PS,t),()=>window.removeEventListener(PS,t)}function LS(e){let t=(0,$.c)(32),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o=mg(),c=Va(),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;t[3]===a?p=t[4]:(p=a({id:`FOGD7m`}),t[3]=a,t[4]=p);let m;t[5]!==a||t[6]!==o?(m=a(o?{id:`3DTatP`}:{id:`MqQoV-`}),t[5]=a,t[6]=o,t[7]=m):m=t[7];let h;t[8]!==n||t[9]!==p||t[10]!==m?(h=(0,Z.jsx)(NS,{title:p,subtitle:m,celebrateSignal:n}),t[8]=n,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===o?g=t[13]:(g=o?(0,Z.jsx)(Vx,{scenario:`existing-repo`}):(0,Z.jsx)(nS,{scenario:`existing-repo`}),t[12]=o,t[13]=g);let _;t[14]!==u||t[15]!==f||t[16]!==d?(_=d||f||u.length>0?(0,Z.jsx)(BS,{templates:u,loading:d,error:f,onSelect:zS}):null,t[14]=u,t[15]=f,t[16]=d,t[17]=_):_=t[17];let v,y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(V,{"aria-hidden":`true`,className:`size-3`}),y=(0,Z.jsx)(s,{id:`IajAbS`}),t[18]=v,t[19]=y):(v=t[18],y=t[19]);let b;t[20]===r?b=t[21]:(b=(0,Z.jsxs)(ci,{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:[v,y]}),t[20]=r,t[21]=b);let x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(ci,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:RS,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(ka,{"aria-hidden":`true`,className:`size-3`})}})}),t[22]=x):x=t[22];let S;t[23]===b?S=t[24]:(S=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[b,x]}),t[23]=b,t[24]=S);let C;t[25]!==S||t[26]!==_?(C=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[_,S]}),t[25]=S,t[26]=_,t[27]=C):C=t[27];let w;return t[28]!==C||t[29]!==h||t[30]!==g?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[h,g,C]}),t[28]=C,t[29]=h,t[30]=g,t[31]=w):w=t[31],w}function RS(){return FS({initialDir:``})}function zS(e,t){return FS({template:{folder:e,name:t}})}function BS(e){let t=(0,$.c)(25),{templates:n,loading:r,error:a,onSelect:o}=e,{_:c}=i(),l;t[0]===c?l=t[1]:(l=c({id:`_8quCH`}),t[0]=c,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`_8quCH`})}),t[2]=u):u=t[2];let d;t[3]!==c||t[4]!==a||t[5]!==r||t[6]!==n?(d=r||a?null:(0,Z.jsx)(st,{className:`text-2xs`,variant:`gray`,"aria-label":c({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=c,t[4]=a,t[5]=r,t[6]=n,t[7]=d):d=t[7];let f;t[8]===d?f=t[9]:(f=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[u,d]}),t[8]=d,t[9]=f);let p;t[10]===c?p=t[11]:(p=c({id:`irFGwu`}),t[10]=c,t[11]=p);let m;t[12]!==a||t[13]!==r||t[14]!==o||t[15]!==n?(m=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Hl89Qd`})}):a?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(s,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(VS,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>o(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=a,t[13]=r,t[14]=o,t[15]=n,t[16]=m):m=t[16];let h;t[17]!==r||t[18]!==p||t[19]!==m?(h=(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":p,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:m})}),t[17]=r,t[18]=p,t[19]=m,t[20]=h):h=t[20];let g;return t[21]!==l||t[22]!==f||t[23]!==h?(g=(0,Z.jsxs)(`section`,{"aria-label":l,className:`flex w-full flex-col gap-3`,children:[f,h]}),t[21]=l,t[22]=f,t[23]=h,t[24]=g):g=t[24],g}function VS(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:a}=e,{_:o}=i(),s;t[0]!==n.name||t[1]!==n.title?(s=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=s):s=t[2];let c=s,l=`${n.name}.md`,u=n.source_folder===``,d;t[3]!==o||t[4]!==c||t[5]!==l||t[6]!==u||t[7]!==r?(d=o(u?{id:`89TtiD`,values:{displayTitle:c,fileName:l}}:{id:`0_J12R`,values:{displayTitle:c,fileName:l,targetLabel:r}}),t[3]=o,t[4]=c,t[5]=l,t[6]=u,t[7]=r,t[8]=d):d=t[8];let f=d,p;t[9]===c?p=t[10]:(p=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:c}),t[9]=c,t[10]=p);let m;t[11]===l?m=t[12]:(m=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g=`shrink-0 font-mono text-1sm ${u?`text-muted-foreground/70`:`text-muted-foreground`}`,_;t[16]!==g||t[17]!==r?(_=(0,Z.jsx)(`span`,{className:g,children:r}),t[16]=g,t[17]=r,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==a||t[21]!==h||t[22]!==_?(v=(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,onClick:a,"aria-label":f,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:[h,_]}),t[19]=f,t[20]=a,t[21]=h,t[22]=_,t[23]=v):v=t[23],v}function HS(e){let t=(0,$.c)(15),{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 t=await fetch(`/api/documents`),n=await t.json().catch(KS);if(e)return;let r=t.ok?kr.safeParse(n):null;r?.success?(l(qS(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=$o(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(GS),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(WS);if(!e.ok)return;let n=kr.safeParse(t);n.success&&l(qS(n.data.documents))}).catch(US)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-end px-6 pb-8 pt-10`,children:(0,Z.jsx)(OS,{size:64,gaze:`down`})}),t[4]=e):e=t[4],e}let S;t[5]!==u||t[6]!==y||t[7]!==v?(S=v?y?(0,Z.jsx)(JS,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(LS,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[5]=u,t[6]=y,t[7]=v,t[8]=S):S=t[8];let C;t[9]!==o||t[10]!==i?(C=(0,Z.jsx)(lg,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[9]=o,t[10]=i,t[11]=C):C=t[11];let w;return t[12]!==S||t[13]!==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[12]=S,t[13]=C,t[14]=w):w=t[14],w}function US(){}function WS(){return null}function GS(e){return e+1}function KS(){return null}function qS(e){return Xo(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function JS(e){let t=(0,$.c)(25),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o=mg(),s;t[0]===a?s=t[1]:(s=a({id:`6h4zVU`}),t[0]=a,t[1]=s);let c;t[2]!==a||t[3]!==o?(c=a(o?{id:`vGeNNQ`}:{id:`qpQwGC`}),t[2]=a,t[3]=o,t[4]=c):c=t[4];let l;t[5]!==n||t[6]!==s||t[7]!==c?(l=(0,Z.jsx)(NS,{title:s,subtitle:c,celebrateSignal:n}),t[5]=n,t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===o?u=t[10]:(u=o?(0,Z.jsx)(Vx,{scenario:`new-project`}):(0,Z.jsx)(nS,{scenario:`new-project`}),t[9]=o,t[10]=u);let d;t[11]!==a||t[12]!==o?(d=a(o?{id:`GubkSu`}:{id:`xeXS4P`}),t[11]=a,t[12]=o,t[13]=d):d=t[13];let f;t[14]===d?f=t[15]:(f=(0,Z.jsx)(XS,{label:d}),t[14]=d,t[15]=f);let p;t[16]===r?p=t[17]:(p=(0,Z.jsx)(ng,{onPackSelect:r,onCreateBlankFile:YS}),t[16]=r,t[17]=p);let m;t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[f,p]}),t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==l||t[22]!==u||t[23]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,u,m]}),t[21]=l,t[22]=u,t[23]=m,t[24]=h):h=t[24],h}function YS(){return FS()}function XS(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 ZS(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function QS(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:a}=e,{_:o}=i(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(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)(eC,{}),(0,Z.jsx)(za,{className:`h-7 w-full`}),(0,Z.jsx)(za,{className:`h-7 w-full`}),(0,Z.jsx)(za,{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)(s,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let m;t[3]===r.data.frontmatterLocal?m=t[4]:(m=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=m);let h=m,g;t[5]===r.data.folder.path?g=t[6]:(g=ZS(r.data.folder.path),t[5]=r.data.folder.path,t[6]=g);let _=g,v;t[7]===h?v=t[8]:(v=Object.keys(h),t[7]=h,t[8]=v);let y=v,b;t[9]!==o||t[10]!==n||t[11]!==a?(b=async function(e,t){let r=await Qi(n,{[e]:t});if(!r.ok){let{error:e}=r;hs.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},t[9]=o,t[10]=n,t[11]=a,t[12]=b):b=t[12];let x=b,S;t[13]!==o||t[14]!==n||t[15]!==a?(S=async function(e){let t=await Qi(n,{[e]:null});if(!t.ok){let{error:e}=t;hs.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},t[13]=o,t[14]=n,t[15]=a,t[16]=S):S=t[16];let C=S,w;t[17]!==x||t[18]!==h?(w=function(e,t){let n=h[e];x(e,oa(n,t))},t[17]=x,t[18]=h,t[19]=w):w=t[19];let T=w,E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){d({name:``,type:`text`,value:``,error:null}),l(!1)},t[20]=E):E=t[20];let D=E,O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Ji[e];return{...t,type:e,value:n,error:null}})},t[21]=O):O=t[21];let k=O,A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){d(t=>t&&{...t,value:e})},t[22]=A):A=t[22];let j=A,M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e){d(t=>t&&{...t,name:e,error:null})},t[23]=M):M=t[23];let N=M,P;t[24]!==o||t[25]!==u||t[26]!==n||t[27]!==a||t[28]!==h?(P=async function(e){if(!u)return;let t=e??u.value,r=u.name.trim();if(!r){d({...u,value:t,error:o({id:`8_brI5`})});return}if(Zn(t)){d({...u,value:t,error:o({id:`hXUWyd`})});return}if(Object.hasOwn(h,r)){d({...u,value:t,error:o({id:`CTJLpz`,values:{trimmed:r}})});return}let i=await Qi(n,{[r]:t});if(!i.ok){d({...u,value:t,error:i.error});return}d(null),a()},t[24]=o,t[25]=u,t[26]=n,t[27]=a,t[28]=h,t[29]=P):P=t[29];let F=P,I;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){p({key:e,draft:e,error:null})},t[30]=I):I=t[30];let L=I,R;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(t=>t&&{...t,draft:e,error:null})},t[31]=R):R=t[31];let z=R,B;t[32]!==o||t[33]!==n||t[34]!==a||t[35]!==h||t[36]!==f?(B=async function(){if(!f)return;let e=f.draft.trim();if(!e){p({...f,error:o({id:`8_brI5`})});return}if(e===f.key){p(null);return}if(Object.hasOwn(h,e)){p({...f,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}let t=h[f.key],r=await Qi(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},t[32]=o,t[33]=n,t[34]=a,t[35]=h,t[36]=f,t[37]=B):B=t[37];let H=B,U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=function(){p(null)},t[38]=U):U=t[38];let W=U,G=!c,K;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>l(!e),t[39]=K):K=t[39];let q=`size-3 transition-transform ${c?``:`rotate-90`}`,J;t[40]===q?J=t[41]:(J=(0,Z.jsx)(No,{className:q,"aria-hidden":!0}),t[40]=q,t[41]=J);let ee;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[42]=ee):ee=t[42];let Y;t[43]===J?Y=t[44]:(Y=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[J,ee]}),t[43]=J,t[44]=Y);let te;t[45]===_?te=t[46]:(te=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:$S,children:_}),t[45]=_,t[46]=te);let ne;t[47]!==Y||t[48]!==te?(ne=(0,Z.jsxs)(Po,{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:[Y,te]}),t[47]=Y,t[48]=te,t[49]=ne):ne=t[49];let X;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`hSBIG-`})}),t[50]=X):X=t[50];let re;t[51]!==u||t[52]!==x||t[53]!==H||t[54]!==y||t[55]!==h||t[56]!==C||t[57]!==f||t[58]!==T?(re=y.length===0&&!u?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`4c_a6S`})}):y.map(e=>{let t=h[e];return(0,Z.jsx)(Ii,{keyName:e,value:t,declared:go(t,An(t)),rename:{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:z,onCommit:H,onCancel:W},badge:null,onCommit:t=>void x(e,t),onChangeType:t=>T(e,t),onRemove:()=>void C(e)},e)}),t[51]=u,t[52]=x,t[53]=H,t[54]=y,t[55]=h,t[56]=C,t[57]=f,t[58]=T,t[59]=re):re=t[59];let ie;t[60]!==u||t[61]!==F?(ie=u?(0,Z.jsx)(na,{draft:u,onChangeName:N,onChangeType:k,onChangeValue:j,onCommit:e=>void F(e),onCancel:()=>d(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>D(),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)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`G8t9NN`})})]})}),t[60]=u,t[61]=F,t[62]=ie):ie=t[62];let ae;t[63]!==re||t[64]!==ie?(ae=(0,Z.jsx)(Mo,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[X,re,ie]})}),t[63]=re,t[64]=ie,t[65]=ae):ae=t[65];let oe;return t[66]!==G||t[67]!==ne||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Fo,{open:G,onOpenChange:K,children:[ne,ae]})}),t[66]=G,t[67]=ne,t[68]=ae,t[69]=oe):oe=t[69],oe}function $S(e){return e.stopPropagation()}function eC(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Sl,{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)(s,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function tC(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 nC(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function rC(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:Ta,label:ms._({id:`QR5SP1`}),detail:nC(i)};case`template-edit`:return{Icon:oe,label:ms._({id:`-LHLx7`}),detail:nC(i)};case`template-delete`:return{Icon:K,label:ms._({id:`_gkGSK`}),detail:nC(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:$c,label:ms._({id:`KPW5WC`}),detail:`${nC(e??``)} → ${nC(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Sl,label:ms._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Sl,label:ms._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Sl,label:ms._({id:`ZQLDTl`}),detail:``};default:return{Icon:Ol,label:r.replace(/-/g,` `),detail:nC(i)}}}function iC(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 aC(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,c]=(0,Q.useState)(!0),[l,u]=(0,Q.useState)(!1),d,f;if(t[1]===n?(d=t[2],f=t[3]):(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){u(!0),c(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),u(!1),c(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),u(!0),c(!1))}};c(!0),t();let r=ds(t);return()=>{e=!0,r()}},f=[n],t[1]=n,t[2]=d,t[3]=f),(0,Q.useEffect)(d,f),l||!o&&i.length===0)return null;let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XJOV1Y`})}),t[4]=p):p=t[4];let m;t[5]===i.length?m=t[6]:(m=i.length>0?(0,Z.jsx)(st,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=m);let h;t[7]===m?h=t[8]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[p,m]}),t[7]=m,t[8]=h);let g;t[9]!==i||t[10]!==o?(g=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(za,{className:`h-8 w-full`}),(0,Z.jsx)(za,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(oC)})}),t[9]=i,t[10]=o,t[11]=g):g=t[11];let _;return t[12]!==h||t[13]!==g?(_=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14],_}function oC(e){let{Icon:t,label:n,detail:r}=rC(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)(hu,{className:`size-3`,"aria-hidden":!0}),iC(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:tC(e.timestamp)})]},e.sha)}function sC(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function cC(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=sC(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function lC(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function uC(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:cC(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:lC(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:cC(e,t.pageTitles),children:a}}function dC(e){let t=(0,$.c)(44),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(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)(s,{id:`-QCLWk`})})}),(0,Z.jsx)(za,{className:`h-12 w-full`}),(0,Z.jsx)(za,{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)(s,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let h;t[3]===r.data.folder.templates_available?h=t[4]:(h=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=h);let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})}),t[5]=_):_=t[5];let v;t[6]===g.length?v=t[7]:(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,(0,Z.jsx)(st,{className:`text-xs`,variant:`secondary`,children:g.length})]}),t[6]=g.length,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(ci,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(s,{id:`G1Gw0v`})]}),t[8]=y):y=t[8];let b;t[9]===v?b=t[10]:(b=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[v,y]}),t[9]=v,t[10]=b);let x;t[11]===g?x=t[12]:(x=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:g.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:g.map(e=>(0,Z.jsx)(ea,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Hi,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=g,t[12]=x);let S;t[13]!==b||t[14]!==x?(S=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[b,x]}),t[13]=b,t[14]=x,t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e||c(null)},t[16]=C):C=t[16];let w;t[17]!==o||t[18]!==n||t[19]!==i?(w=(0,Z.jsx)(Ba,{folderPath:n,template:o,onOpenChange:C,onSaved:i}),t[17]=o,t[18]=n,t[19]=i,t[20]=w):w=t[20];let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||u(null)},t[21]=T):T=t[21];let E;t[22]!==l||t[23]!==i?(E=(0,Z.jsx)(Ei,{template:l,onOpenChange:T,onDeleted:i}),t[22]=l,t[23]=i,t[24]=E):E=t[24];let D;t[25]===g?D=t[26]:(D=new Set(g.map(fC)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(Xi,{folderPath:n,existingNames:D,open:p,onOpenChange:m,onCreated:i}),t[27]=n,t[28]=p,t[29]=i,t[30]=D,t[31]=O):O=t[31];let k=d!==null,A;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||f(null)},t[32]=A):A=t[32];let j=d??void 0,M;t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j?(M=(0,Z.jsx)(zh,{open:k,onOpenChange:A,kind:`file`,initialDir:n,initialTemplate:j,folderConfig:a}),t[33]=a,t[34]=n,t[35]=k,t[36]=j,t[37]=M):M=t[37];let N;return t[38]!==E||t[39]!==O||t[40]!==M||t[41]!==S||t[42]!==w?(N=(0,Z.jsxs)(Z.Fragment,{children:[S,w,E,O,M]}),t[38]=E,t[39]=O,t[40]=M,t[41]=S,t[42]=w,t[43]=N):N=t[43],N}function fC(e){return e.name}function pC(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=oi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=oi(`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 mC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`[&_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 hC(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=oi(`[&_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 gC(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=oi(`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 _C(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=oi(`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 vC(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=oi(`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 yC(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 bC(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 xC(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)(ft,{className:`ml-1 size-3`}):(0,Z.jsx)(Qe,{className:`ml-1 size-3`}):(0,Z.jsx)(el,{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)(ci,{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 SC(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=rs(),d=Di(n),{state:f,refresh:p}=d,[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(`name`),[v,y]=(0,Q.useState)(`asc`);if(o){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)(za,{className:`size-5 rounded`}),(0,Z.jsx)(za,{className:`h-7 w-48`})]}),(0,Z.jsx)(za,{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)(za,{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)(za,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(TC)]})]}),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 b,x,S,C,w,T,E,D,O,k,A;if(t[7]!==r||t[8]!==f||t[9]!==d||t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==l||t[14]!==c||t[15]!==p||t[16]!==v||t[17]!==g){let e=uC(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=bC(e.children,g,v),o=e.title||(n===``?r({id:`3aeN7X`}):e.title),m;t[29]===g?m=t[30]:(m=function(e){e===g?y(wC):(_(e),y(`asc`))},t[29]=g,t[30]=m);let j=m;A=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,T=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(re,{className:`size-5 text-muted-foreground`}),t[31]=M):M=t[31];let N=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[M,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:o})]}),P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(ci,{onClick:()=>h(!0),children:[(0,Z.jsx)(V,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[32]=P):P=t[32],t[33]===N?E=t[34]:(E=(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:[N,P]})}),t[33]=N,t[34]=E),t[35]!==f||t[36]!==n||t[37]!==p?(D=(0,Z.jsx)(QS,{folderPath:n,state:f,onChange:p}),t[35]=f,t[36]=n,t[37]=p,t[38]=D):D=t[38],t[39]!==f||t[40]!==d||t[41]!==n||t[42]!==p?(O=(0,Z.jsx)(dC,{folderPath:n,state:f,onChange:p,folderConfigHandle:d}),t[39]=f,t[40]=d,t[41]=n,t[42]=p,t[43]=O):O=t[43],t[44]===n?k=t[45]:(k=(0,Z.jsx)(aC,{folderPath:n}),t[44]=n,t[45]=k),w=`rounded-lg border`,x=pC;let F=g===`name`?v===`asc`?`ascending`:`descending`:`none`,I;t[46]===r?I=t[47]:(I=r({id:`6YtxFj`}),t[46]=r,t[47]=I);let L;t[48]!==j||t[49]!==v||t[50]!==g||t[51]!==I?(L=(0,Z.jsx)(xC,{label:I,sortKey:`name`,activeKey:g,activeDir:v,onSort:j}),t[48]=j,t[49]=v,t[50]=g,t[51]=I,t[52]=L):L=t[52];let R;t[53]!==F||t[54]!==L?(R=(0,Z.jsx)(_C,{"aria-sort":F,children:L}),t[53]=F,t[54]=L,t[55]=R):R=t[55];let z=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,B;t[56]===r?B=t[57]:(B=r({id:`tgWuMB`}),t[56]=r,t[57]=B);let H;t[58]!==j||t[59]!==v||t[60]!==g||t[61]!==B?(H=(0,Z.jsx)(xC,{label:B,sortKey:`modified`,activeKey:g,activeDir:v,onSort:j}),t[58]=j,t[59]=v,t[60]=g,t[61]=B,t[62]=H):H=t[62];let U;t[63]!==z||t[64]!==H?(U=(0,Z.jsx)(_C,{className:`w-32`,"aria-sort":z,children:H}),t[63]=z,t[64]=H,t[65]=U):U=t[65],t[66]!==R||t[67]!==U?(C=(0,Z.jsx)(mC,{children:(0,Z.jsxs)(gC,{children:[R,U]})}),t[66]=R,t[67]=U,t[68]=C):C=t[68],b=hC,S=i.length?i.map(CC):(0,Z.jsx)(gC,{children:(0,Z.jsx)(vC,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Pkw7J9`})})}),t[7]=r,t[8]=f,t[9]=d,t[10]=n,t[11]=a,t[12]=u,t[13]=l,t[14]=c,t[15]=p,t[16]=v,t[17]=g,t[18]=b,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k,t[28]=A}else b=t[18],x=t[19],S=t[20],C=t[21],w=t[22],T=t[23],E=t[24],D=t[25],O=t[26],k=t[27],A=t[28];let j;t[69]!==b||t[70]!==S?(j=(0,Z.jsx)(b,{children:S}),t[69]=b,t[70]=S,t[71]=j):j=t[71];let M;t[72]!==x||t[73]!==j||t[74]!==C?(M=(0,Z.jsxs)(x,{children:[C,j]}),t[72]=x,t[73]=j,t[74]=C,t[75]=M):M=t[75];let N;t[76]!==M||t[77]!==w?(N=(0,Z.jsx)(`div`,{className:w,children:M}),t[76]=M,t[77]=w,t[78]=N):N=t[78];let P;t[79]!==N||t[80]!==T||t[81]!==E||t[82]!==D||t[83]!==O||t[84]!==k?(P=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,k,N]}),t[79]=N,t[80]=T,t[81]=E,t[82]=D,t[83]=O,t[84]=k,t[85]=P):P=t[85];let F;t[86]!==P||t[87]!==A?(F=(0,Z.jsx)(`div`,{className:A,children:P}),t[86]=P,t[87]=A,t[88]=F):F=t[88];let I;t[89]!==m||t[90]!==d||t[91]!==n?(I=(0,Z.jsx)(zh,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[89]=m,t[90]=d,t[91]=n,t[92]=I):I=t[92];let L;return t[93]!==F||t[94]!==I?(L=(0,Z.jsxs)(Z.Fragment,{children:[F,I]}),t[93]=F,t[94]=I,t[95]=L):L=t[95],L}function CC(e){return(0,Z.jsxs)(gC,{children:[(0,Z.jsx)(vC,{children:(0,Z.jsxs)(`a`,{href:Vo(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)(wl,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(u,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(vC,{className:`text-muted-foreground`,children:e.kind===`file`?yC(e.modified):`—`})]},e.path)}function wC(e){return e===`asc`?`desc`:`asc`}function TC(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)(za,{className:`size-4 rounded`}),(0,Z.jsx)(za,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(za,{className:`h-4 w-16`})})]},e)}function EC(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?c.current?.focus():l.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(vl,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(s,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]===p?h=t[6]:(h=(0,Z.jsx)(`h2`,{ref:l,id:`large-file-title`,tabIndex:p,className:`text-2xl font-light text-balance outline-none`,children:m}),t[5]=p,t[6]=h);let g;t[7]===r?g=t[8]:(g=Xr(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Xr(i),t[9]=i,t[10]=_);let v;t[11]!==n||t[12]!==g||t[13]!==_?(v=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_GBioJ`,values:{0:g,1:_,docName:n}})}),t[11]=n,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,v]}),t[15]=h,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==a||t[19]!==o?(b=o?(0,Z.jsxs)(ci,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(gi,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(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:[f,y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function DC(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(OC),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ct(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 c;t[2]===n?c=t[3]:(c=function(){C(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]=c);let l=c,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A67Uwj`})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(s,{id:`dEgA5A`}),t[5]=d):d=t[5];let f;return t[6]===l?f=t[7]:(f=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[u,(0,Z.jsx)(ci,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:l,children:d})]}),t[6]=l,t[7]=f),f}function OC(){return new Set}var kC=(0,Q.createContext)(null);function AC(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(jC),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>{i(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},t[0]=a):a=t[0];let o=a,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{i(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},t[1]=s):s=t[1];let c=s,l;t[2]===r?l=t[3]:(l={addPropertySignal:r,requestAddProperty:o,clearAddProperty:c},t[2]=r,t[3]=l);let u=l,d;return t[4]!==n||t[5]!==u?(d=(0,Z.jsx)(kC,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function jC(){return new Map}function MC(){let e=(0,Q.use)(kC);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function NC(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var PC=NC(()=>n(()=>import(`./SettingsDialogBody-D72wOi4X.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([52,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,53,7,13,15,25,54]),import.meta.url));function FC(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=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]=a):a=t[2];let o=a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(s,{id:`hwFOFD`})}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:o})]}),t[4]=o,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ci,{variant:`default`,onClick:IC,children:(0,Z.jsx)(s,{id:`HpK_8d`})}),t[6]=u):u=t[6];let d;return t[7]===l?d=t[8]:(d=(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:[l,u]}),t[7]=l,t[8]=d),d}function IC(){return window.location.reload()}function LC(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(ce,{fallbackRender:zC,onError:RC,children:n}),t[0]=n,t[1]=r),r}function RC(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function zC(e){return(0,Z.jsx)(FC,{...e})}function BC(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function VC(e){let t=(0,$.c)(89),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=mt(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=ae(),{desktopPresent:f}=Mi(),[p,m]=(0,Q.useState)(`preferences`),h,g;t[0]===n?(h=t[1],g=t[2]):(h=()=>{n&&m(`preferences`)},g=[n],t[0]=n,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=o!==null,v=typeof window<`u`&&window.okDesktop!=null,y;t[3]===a?y=t[4]:(y=a({id:`7PzzBU`}),t[3]=a,t[4]=y);let b;t[5]===a?b=t[6]:(b=a({id:`Q6hhn8`}),t[5]=a,t[6]=b);let x;t[7]===b?x=t[8]:(x={id:`preferences`,label:b},t[7]=b,t[8]=x);let S;t[9]===a?S=t[10]:(S=a({id:`4KmEoC`}),t[9]=a,t[10]=S);let C;t[11]===S?C=t[12]:(C={id:`hotkeys`,label:S},t[11]=S,t[12]=C);let w;t[13]===a?w=t[14]:(w=a({id:`AeXO77`}),t[13]=a,t[14]=w);let T;t[15]===w?T=t[16]:(T={id:`account`,label:w},t[15]=w,t[16]=T);let E;t[17]!==x||t[18]!==C||t[19]!==T?(E=[x,C,T],t[17]=x,t[18]=C,t[19]=T,t[20]=E):E=t[20];let D;t[21]!==E||t[22]!==y?(D={id:`user`,label:y,enabled:!0,items:E},t[21]=E,t[22]=y,t[23]=D):D=t[23];let O;t[24]===a?O=t[25]:(O=a({id:`ZWyHmq`}),t[24]=a,t[25]=O);let k;t[26]===a?k=t[27]:(k=a({id:`Nu4DdT`}),t[26]=a,t[27]=k);let A;t[28]===k?A=t[29]:(A={id:`sync`,label:k},t[28]=k,t[29]=A);let j;t[30]===a?j=t[31]:(j=a({id:`A1taO8`}),t[30]=a,t[31]=j);let M;t[32]===j?M=t[33]:(M={id:`search`,label:j},t[32]=j,t[33]=M);let N;t[34]===a?N=t[35]:(N=v?[{id:`terminal`,label:a({id:`ALhMYW`})}]:[],t[34]=a,t[35]=N);let P;t[36]===a?P=t[37]:(P=a({id:`iTylMl`}),t[36]=a,t[37]=P);let F;t[38]===P?F=t[39]:(F={id:`project-templates`,label:P},t[38]=P,t[39]=F);let I;t[40]===a?I=t[41]:(I=a({id:`3zyg_A`}),t[40]=a,t[41]=I);let L;t[42]===I?L=t[43]:(L={id:`okignore`,label:I},t[42]=I,t[43]=L);let R;t[44]===a?R=t[45]:(R=a({id:`cs4mps`}),t[44]=a,t[45]=R);let z;t[46]===R?z=t[47]:(z={id:`sharing`,label:R},t[46]=R,t[47]=z);let B;t[48]!==A||t[49]!==M||t[50]!==N||t[51]!==F||t[52]!==L||t[53]!==z?(B=[A,M,...N,F,L,z],t[48]=A,t[49]=M,t[50]=N,t[51]=F,t[52]=L,t[53]=z,t[54]=B):B=t[54];let V;t[55]!==_||t[56]!==O||t[57]!==B?(V={id:`project`,label:O,enabled:_,items:B},t[55]=_,t[56]=O,t[57]=B,t[58]=V):V=t[58];let H;t[59]===a?H=t[60]:(H=a({id:`nbfdhU`}),t[59]=a,t[60]=H);let U;t[61]!==a||t[62]!==f?(U=[],t[61]=a,t[62]=f,t[63]=U):U=t[63];let W;t[64]!==H||t[65]!==U?(W={id:`integrations`,label:H,enabled:!0,items:U},t[64]=H,t[65]=U,t[66]=W):W=t[66];let G;t[67]!==D||t[68]!==V||t[69]!==W?(G=[D,V,W],t[67]=D,t[68]=V,t[69]=W,t[70]=G):G=t[70];let K=G,q;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Co,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[71]=q):q=t[71];let J;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(So,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[72]=J):J=t[72];let ee;t[73]!==p||t[74]!==K?(ee=(0,Z.jsx)(HC,{groups:K,activeId:p,onSelect:m}),t[73]=p,t[74]=K,t[75]=ee):ee=t[75];let Y;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(GC,{}),t[76]=Y):Y=t[76];let te=l?c:null,ne;t[77]!==p||t[78]!==u||t[79]!==d||t[80]!==te?(ne=(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)(LC,{children:(0,Z.jsx)(Q.Suspense,{fallback:Y,children:(0,Z.jsx)(PC,{activeId:p,userBinding:te,okignoreBinding:u,okignoreSynced:d})})})}),t[77]=p,t[78]=u,t[79]=d,t[80]=te,t[81]=ne):ne=t[81];let X;t[82]!==ee||t[83]!==ne?(X=(0,Z.jsxs)(wo,{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:[q,J,ee,ne]}),t[82]=ee,t[83]=ne,t[84]=X):X=t[84];let re;return t[85]!==r||t[86]!==n||t[87]!==X?(re=(0,Z.jsx)(Oo,{open:n,onOpenChange:r,children:X}),t[85]=r,t[86]=n,t[87]=X,t[88]=re):re=t[88],re}function HC(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:a}=e,{_:o}=i(),s;t[0]===o?s=t[1]:(s=o({id:`y1t8bQ`}),t[0]=o,t[1]=s);let c;if(t[2]!==r||t[3]!==n||t[4]!==a){let e;t[6]!==r||t[7]!==a?(e=e=>(0,Z.jsx)(WC,{group:e,activeId:r,onSelect:a},e.id),t[6]=r,t[7]=a,t[8]=e):e=t[8],c=n.map(e),t[2]=r,t[3]=n,t[4]=a,t[5]=c}else c=t[5];let l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(UC,{}),t[9]=l):l=t[9];let u;return t[10]!==s||t[11]!==c?(u=(0,Z.jsxs)(`nav`,{"aria-label":s,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:[c,l]}),t[10]=s,t[11]=c,t[12]=u):u=t[12],u}function UC(){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=BC(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 c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(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:oi(`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)(s,{id:`_PACVa`}),(0,Z.jsx)(vo,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function WC(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`,c=n.enabled?void 0:o,l=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,u;t[0]===l?u=t[1]:(u=oi(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,l),t[0]=l,t[1]=u);let d;t[2]!==n.label||t[3]!==a||t[4]!==c||t[5]!==u?(d=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":c,className:u,children:n.label}),t[2]=n.label,t[3]=a,t[4]=c,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.enabled?(f=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)(s,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=f):f=t[9];let p;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:oi(`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],p=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=p}else p=t[15];let m;t[21]!==a||t[22]!==p?(m=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:p}),t[21]=a,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==d||t[25]!==f||t[26]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[d,f,m]}),t[24]=d,t[25]=f,t[26]=m,t[27]=h):h=t[27],h}function GC(){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)(s,{id:`GsBUCk`})}),n=(0,Z.jsx)(za,{className:`h-5 w-32`}),r=(0,Z.jsx)(za,{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)(za,{className:`h-9 w-full`}),(0,Z.jsx)(za,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function KC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`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)(bx,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qC(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)(Cx,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function JC(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=oi(`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)(Dx,{"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 YC(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=oi(`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 XC=ii(`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 ZC(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=oi(XC({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:QC,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function QC(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}ii(`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 $C(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`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 ew(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=oi(`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)(jo,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tw(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:a,replaceOpen:o,caseSensitive:c,wholeWord:l,current:u,total:d,onQueryChange:f,onReplacementChange:p,onReplaceOpenChange:m,onCaseSensitiveChange:h,onWholeWordChange:g,onNext:_,onPrevious:v,onReplaceCurrent:y,onReplaceAll:b,onClose:x}=e,{_:S}=i(),C=r.length>0,w=d>0,T;t[0]!==S||t[1]!==u||t[2]!==w||t[3]!==C||t[4]!==d?(T=C?w?`${u} / ${d}`:S({id:`Ev2r9A`}):``,t[0]=S,t[1]=u,t[2]=w,t[3]=C,t[4]=d,t[5]=T):T=t[5];let E=T,D;t[6]!==x||t[7]!==_||t[8]!==v?(D=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?v():_()):e.key===`Escape`&&(e.preventDefault(),x())},t[6]=x,t[7]=_,t[8]=v,t[9]=D):D=t[9];let O=D,k;t[10]!==x||t[11]!==y?(k=function(e){e.key===`Enter`?(e.preventDefault(),y()):e.key===`Escape`&&(e.preventDefault(),x())},t[10]=x,t[11]=y,t[12]=k):k=t[12];let A=k,j;t[13]===S?j=t[14]:(j=S({id:`MVxpbf`}),t[13]=S,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(s,{id:`KujtjC`})}),t[15]=M):M=t[15];let N;t[16]===f?N=t[17]:(N=e=>f(e.target.value),t[16]=f,t[17]=N);let P;t[18]===S?P=t[19]:(P=S({id:`KujtjC`}),t[18]=S,t[19]=P);let F;t[20]!==n||t[21]!==O||t[22]!==r||t[23]!==N||t[24]!==P?(F=(0,Z.jsx)(ew,{ref:n,id:`ok-find-input`,value:r,onChange:N,onKeyDown:O,placeholder:P,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=O,t[22]=r,t[23]=N,t[24]=P,t[25]=F):F=t[25];let I;t[26]===S?I=t[27]:(I=S({id:`-8PP0T`}),t[26]=S,t[27]=I);let L;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(ol,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(bo,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":I,pressed:c,onPressedChange:h,className:`size-6 min-w-6 px-0`,children:L})}),t[29]=c,t[30]=h,t[31]=I,t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`-8PP0T`})}),t[33]=z):z=t[33];let B;t[34]===R?B=t[35]:(B=(0,Z.jsxs)(Is,{children:[R,z]}),t[34]=R,t[35]=B);let V;t[36]===S?V=t[37]:(V=S({id:`_7UQ7y`}),t[36]=S,t[37]=V);let H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(gu,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(bo,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":V,pressed:l,onPressedChange:g,className:`size-6 min-w-6 px-0`,children:H})}),t[39]=g,t[40]=V,t[41]=l,t[42]=U):U=t[42];let W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`_7UQ7y`})}),t[43]=W):W=t[43];let G;t[44]===U?G=t[45]:(G=(0,Z.jsxs)(Is,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(ZC,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=K):K=t[48];let q;t[49]!==K||t[50]!==F?(q=(0,Z.jsxs)(YC,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,K]}),t[49]=K,t[50]=F,t[51]=q):q=t[51];let J;t[52]===E?J=t[53]:(J=(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:E}),t[52]=E,t[53]=J);let ee;t[54]===S?ee=t[55]:(ee=S({id:`oqB2ez`}),t[54]=S,t[55]=ee);let Y=!w,te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(It,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=te):te=t[56];let ne;t[57]!==v||t[58]!==ee||t[59]!==Y?(ne=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:Y,onClick:v,children:te})}),t[57]=v,t[58]=ee,t[59]=Y,t[60]=ne):ne=t[60];let X;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=X):X=t[61];let re;t[62]===ne?re=t[63]:(re=(0,Z.jsxs)(Is,{children:[ne,X]}),t[62]=ne,t[63]=re);let ie;t[64]===S?ie=t[65]:(ie=S({id:`SiUUCS`}),t[64]=S,t[65]=ie);let ae=!w,oe;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Ve,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=oe):oe=t[66];let se;t[67]!==_||t[68]!==ie||t[69]!==ae?(se=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ie,disabled:ae,onClick:_,children:oe})}),t[67]=_,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)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=ce):ce=t[71];let le;t[72]===se?le=t[73]:(le=(0,Z.jsxs)(Is,{children:[se,ce]}),t[72]=se,t[73]=le);let ue=o?`secondary`:`ghost`,de;t[74]!==S||t[75]!==o?(de=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=de):de=t[76];let fe=o?`ok-replace-input`:void 0,pe;t[77]!==m||t[78]!==o?(pe=()=>m(!o),t[77]=m,t[78]=o,t[79]=pe):pe=t[79];let me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(Yl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=me):me=t[80];let he;t[81]!==o||t[82]!==ue||t[83]!==de||t[84]!==fe||t[85]!==pe?(he=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:ue,size:`icon-sm`,"aria-label":de,"aria-expanded":o,"aria-controls":fe,onClick:pe,children:me})}),t[81]=o,t[82]=ue,t[83]=de,t[84]=fe,t[85]=pe,t[86]=he):he=t[86];let ge;t[87]===o?ge=t[88]:(ge=(0,Z.jsx)(Ns,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=ge);let _e;t[89]!==he||t[90]!==ge?(_e=(0,Z.jsxs)(Is,{children:[he,ge]}),t[89]=he,t[90]=ge,t[91]=_e):_e=t[91];let ve;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(ve=o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(s,{id:`fqSfXY`})}),(0,Z.jsx)(jo,{id:`ok-replace-input`,value:a,onChange:e=>p(e.target.value),onKeyDown:A,placeholder:S({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)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Yl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Jl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`dr1vFs`})})]})]}):null,t[92]=S,t[93]=A,t[94]=w,t[95]=b,t[96]=y,t[97]=p,t[98]=o,t[99]=a,t[100]=ve):ve=t[100];let ye;t[101]===S?ye=t[102]:(ye=S({id:`wJo9oS`}),t[101]=S,t[102]=ye);let be;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(gs,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=be):be=t[103];let xe;t[104]!==x||t[105]!==ye?(xe=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ye,onClick:x,children:be})}),t[104]=x,t[105]=ye,t[106]=xe):xe=t[106];let Se;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Se):Se=t[107];let Ce;t[108]===xe?Ce=t[109]:(Ce=(0,Z.jsxs)(Is,{children:[xe,Se]}),t[108]=xe,t[109]=Ce);let we;return t[110]!==q||t[111]!==J||t[112]!==re||t[113]!==le||t[114]!==j||t[115]!==_e||t[116]!==ve||t[117]!==Ce?(we=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":j,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:[M,q,J,re,le,_e,ve,Ce]}),t[110]=q,t[111]=J,t[112]=re,t[113]=le,t[114]=j,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var nw={current:0,total:0},rw=120,iw=100;function aw(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?q(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(E,n,ow)}function ow(){return null}function sw(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
24
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function ty(e,t){return`${e}\u0000${t}`}function ny(e,t,n){let r=zr(e).body,i=zr(t).body;return r===i?``:$v(n,r,i,``,``,{context:3})}function ry(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=mt(),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=ty(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=ny(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 iy=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-InYkbArk.js`),__vite__mapDeps([19,1,6,20]),import.meta.url)).ActivityPanelDiffView})),ay=1e4,oy=6e4;async function sy(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 cy(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 ly(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function uy(e){return e.slice(0,7)}function dy(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 fy(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)(fi,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(vi,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ui,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(hi,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Ci,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(xi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(yi,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function py(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)(Oe,{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=Qr(i),t[1]=i,t[2]=a);let o=a,s=r?Lr[o]??qr[o]:qr[o],c;t[3]!==s||t[4]!==i?(c=s??Kn(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)(fy,{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)(El,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`Open Knowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Qc,{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)(hu,{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)(yi,{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)(Qc,{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)(hu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function my(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function hy(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,c;t[0]===n?(o=t[1],c=t[2]):([o,...c]=n,t[0]=n,t[1]=o,t[2]=c);let l=c.length,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=u):u=t[3];let d;t[4]===o?d=t[5]:(d=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[u,o]}),t[4]=o,t[5]=d);let f;t[6]!==r||t[7]!==c?(f=r&&c.map(_y),t[6]=r,t[7]=c,t[8]=f):f=t[8];let p;t[9]!==a||t[10]!==d||t[11]!==f?(p=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[d,f]}),t[9]=a,t[10]=d,t[11]=f,t[12]=p):p=t[12];let m;t[13]!==r||t[14]!==l||t[15]!==a||t[16]!==c.length?(m=c.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(gy)},children:[r?(0,Z.jsx)(Ve,{className:`size-3`}):(0,Z.jsx)(No,{className:`size-3`}),r?(0,Z.jsx)(s,{id:`vLyv1R`}):(0,Z.jsx)(s,{id:`ZptNUh`,values:{hidden:l}})]}),t[13]=r,t[14]=l,t[15]=a,t[16]=c.length,t[17]=m):m=t[17];let h;return t[18]!==p||t[19]!==m?(h=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function gy(e){return!e}function _y(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 vy(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=ry(n,r,i),l;t[0]===c.status?l=t[1]:(l=c.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(h,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`38foVZ`})]}),t[0]=c.status,t[1]=l);let u;t[2]===c.status?u=t[3]:(u=c.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(s,{id:`vvWZnu`})}),t[2]=c.status,t[3]=u);let d;t[4]!==a||t[5]!==c.diff||t[6]!==c.status?(d=c.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)(h,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(iy,{diff:c.diff,viewType:a})}),t[4]=a,t[5]=c.diff,t[6]=c.status,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==l||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[l,u,d]}),t[8]=o,t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function yy(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:a,cache:o,docName:c,expanded:l,onToggleExpanded:u,onRestoreSuccess:d}=e,{_:f}=i(),p;t[0]===n.timestamp?p=t[1]:(p=cy(n.timestamp),t[0]=n.timestamp,t[1]=p);let m=p,g;t[2]===n?g=t[3]:(g=dy(n),t[2]=n,t[3]=g);let _=g,v;t[4]===n.timestamp?v=t[5]:(v=ly(n.timestamp),t[4]=n.timestamp,t[5]=v);let y=v,b;t[6]===n.sha?b=t[7]:(b=uy(n.sha),t[6]=n.sha,t[7]=b);let x=b,S=n.contributors.flatMap(by),C;t[8]===n?C=t[9]:(C=my(n),t[8]=n,t[9]=C);let w=C,[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(null),A=(0,Q.useId)(),j,M;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>k.current?.abort(),M=[],t[10]=j,t[11]=M):(j=t[10],M=t[11]),(0,Q.useEffect)(j,M);let N;t[12]!==n.sha||t[13]!==u?(N=()=>u(n.sha),t[12]=n.sha,t[13]=u,t[14]=N):N=t[14];let P=N,F;t[15]===E?F=t[16]:(F=function(){k.current?.abort(),k.current=null,O(!1),E(!1)},t[15]=E,t[16]=F);let I=F,L;t[17]!==f||t[18]!==c||t[19]!==n.sha||t[20]!==d||t[21]!==E?(L=async function(){O(!0);let e=new AbortController;k.current=e;let t=function(){e.signal.aborted||O(!1),k.current===e&&(k.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:c,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:c,sha:n.sha,err:i}),hs.error(f({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)E(!1),d();else{let e=`HTTP ${r.status}`;try{let t=hr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:c,sha:n.sha,status:r.status,detail:e}),hs.error(f({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=f,t[18]=c,t[19]=n.sha,t[20]=d,t[21]=E,t[22]=L):L=t[22];let R=L,z;t[23]!==n||t[24]!==r?(z=(0,Z.jsx)(py,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=z):z=t[25];let B=z,V=l?A:void 0,H=l?`bg-muted`:`hover:bg-muted/80`,U;t[26]===H?U=t[27]:(U=[`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`,H],t[26]=H,t[27]=U);let W=U.join(` `),G;t[28]===P?G=t[29]:(G=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[28]=P,t[29]=G);let K;t[30]===B?K=t[31]:(K=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[30]=B,t[31]=K);let q;t[32]===_?q=t[33]:(q=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:_}),t[32]=_,t[33]=q);let J;t[34]!==n.timestamp||t[35]!==m?(J=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:m}),t[34]=n.timestamp,t[35]=m,t[36]=J):J=t[36];let ee;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=ee):ee=t[37];let Y;t[38]===f?Y=t[39]:(Y=f({id:`Yea-K5`}),t[38]=f,t[39]=Y);let te;t[40]===E?te=t[41]:(te=e=>{e.stopPropagation(),E(!0)},t[40]=E,t[41]=te);let ne;t[42]===D?ne=t[43]:(ne=D?(0,Z.jsx)(h,{className:`size-3 animate-spin`}):(0,Z.jsx)(pi,{className:`size-3`}),t[42]=D,t[43]=ne);let X;t[44]!==D||t[45]!==Y||t[46]!==te||t[47]!==ne?(X=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":Y,disabled:D,onClick:te,children:ne})}),t[44]=D,t[45]=Y,t[46]=te,t[47]=ne,t[48]=X):X=t[48];let re;t[49]===f?re=t[50]:(re=f({id:`Yea-K5`}),t[49]=f,t[50]=re);let ie;t[51]===re?ie=t[52]:(ie=(0,Z.jsx)(Ns,{side:`top`,children:re}),t[51]=re,t[52]=ie);let ae;t[53]!==X||t[54]!==ie?(ae=(0,Z.jsxs)(Is,{children:[X,ie]}),t[53]=X,t[54]=ie,t[55]=ae):ae=t[55];let oe;t[56]!==q||t[57]!==J||t[58]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[q,J,ee,ae]}),t[56]=q,t[57]=J,t[58]=ae,t[59]=oe):oe=t[59];let se;t[60]===w?se=t[61]:(se=w.length>0&&(0,Z.jsx)(hy,{summaries:w}),t[60]=w,t[61]=se);let ce=S.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:S.join(`, `),children:S.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),le;t[62]!==oe||t[63]!==se||t[64]!==ce?(le=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[oe,se,ce]}),t[62]=oe,t[63]=se,t[64]=ce,t[65]=le):le=t[65];let ue;t[66]!==l||t[67]!==P||t[68]!==V||t[69]!==W||t[70]!==G||t[71]!==K||t[72]!==le?(ue=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":l,"aria-controls":V,"data-testid":`timeline-entry-expand`,className:W,onClick:P,onKeyDown:G,children:[K,le]}),t[66]=l,t[67]=P,t[68]=V,t[69]=W,t[70]=G,t[71]=K,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==o||t[75]!==a||t[76]!==A||t[77]!==c||t[78]!==n.sha||t[79]!==l?(de=l&&(0,Z.jsx)(vy,{sha:n.sha,docName:c,cache:o,diffLayout:a,panelId:A}),t[74]=o,t[75]=a,t[76]=A,t[77]=c,t[78]=n.sha,t[79]=l,t[80]=de):de=t[80];let fe;t[81]!==ue||t[82]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[ue,de]}),t[81]=ue,t[82]=de,t[83]=fe):fe=t[83];let pe;t[84]!==I||t[85]!==E?(pe=e=>{e?E(!0):I()},t[84]=I,t[85]=E,t[86]=pe):pe=t[86];let me;t[87]===f?me=t[88]:(me=f({id:`Pyp1NA`}),t[87]=f,t[88]=me);let he;t[89]===me?he=t[90]:(he=(0,Z.jsx)(Co,{children:me}),t[89]=me,t[90]=he);let ge;t[91]!==y||t[92]!==_||t[93]!==x||t[94]!==m?(ge={relative:m,absoluteTime:y,entrySha:x,authorName:_},t[91]=y,t[92]=_,t[93]=x,t[94]=m,t[95]=ge):ge=t[95];let _e;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(_e={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[96]=_e):_e=t[96];let ve;t[97]===ge?ve=t[98]:(ve=(0,Z.jsx)(So,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:ge,components:_e})}),t[97]=ge,t[98]=ve);let ye;t[99]!==he||t[100]!==ve?(ye=(0,Z.jsxs)(Do,{children:[he,ve]}),t[99]=he,t[100]=ve,t[101]=ye):ye=t[101];let be;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(s,{id:`dEgA5A`}),t[102]=be):be=t[102];let xe;t[103]===I?xe=t[104]:(xe=(0,Z.jsx)(ci,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:I,children:be}),t[103]=I,t[104]=xe);let Se;t[105]===R?Se=t[106]:(Se=()=>R(),t[105]=R,t[106]=Se);let Ce;t[107]===D?Ce=t[108]:(Ce=D?(0,Z.jsx)(h,{className:`mr-2 size-4 animate-spin`}):null,t[107]=D,t[108]=Ce);let we;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[109]=we):we=t[109];let Te;t[110]!==D||t[111]!==Se||t[112]!==Ce?(Te=(0,Z.jsxs)(ci,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:D,onClick:Se,children:[Ce,we]}),t[110]=D,t[111]=Se,t[112]=Ce,t[113]=Te):Te=t[113];let Ee;t[114]!==xe||t[115]!==Te?(Ee=(0,Z.jsxs)(Eo,{children:[xe,Te]}),t[114]=xe,t[115]=Te,t[116]=Ee):Ee=t[116];let De;t[117]!==ye||t[118]!==Ee?(De=(0,Z.jsxs)(wo,{children:[ye,Ee]}),t[117]=ye,t[118]=Ee,t[119]=De):De=t[119];let Oe;t[120]!==T||t[121]!==pe||t[122]!==De?(Oe=(0,Z.jsx)(Oo,{open:T,onOpenChange:pe,children:De}),t[120]=T,t[121]=pe,t[122]=De,t[123]=Oe):Oe=t[123];let ke;return t[124]!==fe||t[125]!==Oe?(ke=(0,Z.jsxs)(Z.Fragment,{children:[fe,Oe]}),t[124]=fe,t[125]=Oe,t[126]=ke):ke=t[126],ke}function by(e){return e.docs}function xy(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:a}=e,{_:o}=i(),{resolvedTheme:c}=Yr(),l=c===`dark`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[0]=u):u=t[0];let[d,f]=(0,Q.useState)(u),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_]=(0,Q.useState)(Ty),[v,y]=(0,Q.useState)(wy),b;t[1]===_?b=t[2]:(b=()=>{y(new Set),_.clear()},t[1]=_,t[2]=b);let x;t[3]===n?x=t[4]:(x=[n],t[3]=n,t[4]=x),(0,Q.useEffect)(b,x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=S):S=t[5];let C=S,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){y(new Set)},t[6]=w):w=t[6];let T=w,E,D;t[7]!==o||t[8]!==n?(E=()=>{if(!n){f([]);return}m(!0);let e=Dv({baseMs:ay,maxBackoffMs:oy,isPaused:Cy,poll:e=>sy(n,e,{setEntries:f,setError:g,setLoading:m,unavailableMessage:o({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)}},D=[n,o],t[7]=o,t[8]=n,t[9]=E,t[10]=D):(E=t[9],D=t[10]),(0,Q.useEffect)(E,D);let O=!p&&!h&&d.length>0,k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(xn,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[11]=k):k=t[11];let A;t[12]!==o||t[13]!==r||t[14]!==O||t[15]!==a?(A=O&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(xo,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":o({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)(yo,{value:`unified`,"aria-label":o({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(Xl,{className:`size-3.5`})}),(0,Z.jsx)(yo,{value:`split`,"aria-label":o({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(ul,{className:`size-3.5`})})]})}),(0,Z.jsx)(Ns,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[12]=o,t[13]=r,t[14]=O,t[15]=a,t[16]=A):A=t[16];let j;t[17]===A?j=t[18]:(j=(0,Z.jsxs)(vn,{children:[k,A]}),t[17]=A,t[18]=j);let M;t[19]!==o||t[20]!==p?(M=p&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":o({id:`o49mDZ`}),children:[1,2,3].map(Sy)}),t[19]=o,t[20]=p,t[21]=M):M=t[21];let N;t[22]!==h||t[23]!==p?(N=!p&&h&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:h})}),t[22]=h,t[23]=p,t[24]=N):N=t[24];let P;t[25]!==d||t[26]!==h||t[27]!==p?(P=!p&&!h&&d.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)(s,{id:`Ta25TG`})})}),t[25]=d,t[26]=h,t[27]=p,t[28]=P):P=t[28];let F;t[29]!==_||t[30]!==r||t[31]!==n||t[32]!==d||t[33]!==h||t[34]!==v||t[35]!==l||t[36]!==p?(F=!p&&!h&&d.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:d.map(e=>(0,Z.jsx)(yy,{entry:e,isDark:l,diffLayout:r,cache:_,docName:n,expanded:v.has(e.sha),onToggleExpanded:C,onRestoreSuccess:T},e.sha))}),t[29]=_,t[30]=r,t[31]=n,t[32]=d,t[33]=h,t[34]=v,t[35]=l,t[36]=p,t[37]=F):F=t[37];let I;t[38]!==M||t[39]!==N||t[40]!==P||t[41]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[M,N,P,F]}),t[38]=M,t[39]=N,t[40]=P,t[41]=F,t[42]=I):I=t[42];let L;return t[43]!==j||t[44]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[j,I]}),t[43]=j,t[44]=I,t[45]=L):L=t[45],L}function Sy(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(za,{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)(za,{className:`h-3 w-28`}),(0,Z.jsx)(za,{className:`h-3 w-40`})]})]},e)}function Cy(){return typeof document<`u`&&document.visibilityState===`hidden`}function wy(){return new Set}function Ty(){return new mi(32)}var Ey=[{id:`outline`,icon:Pl},{id:`links`,icon:ye},{id:`graph`,icon:Ll},{id:`timeline`,icon:ll}];function Dy(e){return e===`outline`?ms._({id:`dD7NPy`}):e===`links`?ms._({id:`Rj01Fz`}):e===`graph`?ms._({id:`x2fr_j`}):ms._({id:`cklVjM`})}function Oy(){return n(()=>import(`./GraphPanel-Vj2cdFDc.js`),__vite__mapDeps([21,1,14,6,8,9,22,3,23,24,25,15,26,27,28,29,30,31,32,33,34,35]),import.meta.url)}var ky=(0,Q.lazy)(async()=>({default:(await Oy()).GraphPanel})),Ay=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-B_XgaNq-.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent}));function jy(e){let t=(0,$.c)(18),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(`unified`),f=Sg(),p,m,h;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==o||t[4]!==f){let e=f?Ey.filter(Ny):Ey;p=e.some(e=>e.id===a)?a:`outline`,m=c===`doc`&&e.length>1,h=m?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(xo,{type:`single`,variant:`outline`,value:p,onValueChange:e=>{e&&o(e)},"aria-label":l({id:`SrOuyg`}),children:e.map(My)})}):null,t[0]=l,t[1]=a,t[2]=c,t[3]=o,t[4]=f,t[5]=p,t[6]=m,t[7]=h}else p=t[5],m=t[6],h=t[7];let g;t[8]!==u||t[9]!==n||t[10]!==p||t[11]!==r||t[12]!==c||t[13]!==m?(g=c===`doc`?(0,Z.jsxs)(`div`,{...m?{role:`tabpanel`,id:`panel-${p}`,"aria-labelledby":`tab-${p}`}:{},className:`min-h-0 flex-1`,children:[p===`outline`&&(0,Z.jsx)(Dc,{docName:n,isSourceMode:r}),p===`links`&&(0,Z.jsx)(Ev,{docName:n}),p===`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)(s,{id:`-lCAuQ`})}),children:(0,Z.jsx)(ky,{activeDocName:n})}),p===`timeline`&&(0,Z.jsx)(xy,{docName:n,diffLayout:u,onDiffLayoutChange:d})]}):(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)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(Ay,{})})}),t[8]=u,t[9]=n,t[10]=p,t[11]=r,t[12]=c,t[13]=m,t[14]=g):g=t[14];let _;return t[15]!==h||t[16]!==g?(_=(0,Z.jsxs)(Z.Fragment,{children:[h,g]}),t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function My(e){let{id:t,icon:n}=e,r=Dy(t);return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(yo,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:r})]},t)}function Ny(e){return e.id===`outline`}function Py(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Fy(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Iy(e){return e/100*window.innerHeight}function Ly(e){return e/100*window.innerWidth}function Ry(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function zy({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Ry(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Fy(t,i);break;case`em`:r=Py(t,i);break;case`vh`:r=Iy(i);break;case`vw`:r=Ly(i);break}return r}function By(e){return parseFloat(e.toFixed(3))}function Vy({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 Hy(e){let{panels:t}=e,n=Vy({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=By(zy({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=By(zy({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=By(zy({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=By(zy({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 Uy(e,t=`Assertion error`){if(!e)throw Error(t)}function Wy(e,t){return Array.from(t).sort(e===`horizontal`?Gy:Ky)}function Gy(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Ky(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function qy(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Jy(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 Yy({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}=Jy(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Uy(i,`No rect found`),i}var Xy;function Zy(){return Xy===void 0&&(Xy=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Xy}function Qy(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Wy(n,Array.from(t.children).filter(qy).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,Yy({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=Zy()?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:Vy({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 $y=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)}}},eb=new Map,tb=new $y;function nb(e){eb=new Map(eb),eb.delete(e)}function rb(e,t){for(let[t]of eb)if(t.id===e)return t}function ib(e,t){for(let[t,n]of eb)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function ab(){return eb}function ob(e,t){return tb.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function sb(e,t){let n=eb.get(e);eb=new Map(eb),eb.set(e,t),tb.emit(`groupChange`,{group:e,prev:n,next:t})}function cb(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Jy(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 lb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ub(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:gb(e),b:gb(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Uy(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:hb(mb(n.a)),b:hb(mb(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 db=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function fb(e){let t=getComputedStyle(_b(e)??e).display;return t===`flex`||t===`inline-flex`}function pb(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||fb(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`||db.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function mb(e){let t=e.length;for(;t--;){let n=e[t];if(Uy(n,`Missing node`),pb(n))return n}return null}function hb(e){return e&&Number(getComputedStyle(e).zIndex)||0}function gb(e){let t=[];for(;e;)t.push(e),e=_b(e);return t}function _b(e){let{parentNode:t}=e;return lb(t)?t.host:t}function vb(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 yb({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!qy(n)||n.contains(e)||e.contains(n))return!0;if(ub(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(vb(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function bb(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Qy(r),a=cb(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&yb({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function xb(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 Sb(e,t,n=0){return Math.abs(By(e)-By(t))<=n}function Cb(e,t){return Sb(e,t)?0:e>t?1:-1}function wb({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(Cb(r,c)<0)if(a){let e=(i+c)/2;r=Cb(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=By(r),r}function Tb({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Sb(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Uy(u!=null,`Invalid first pivot index`),Uy(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Uy(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(Uy(n!=null,`Previous layout not found for panel index ${t}`),Sb(n,i)){let t=o-n;Cb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Uy(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(Uy(n!=null,`Previous layout not found for panel index ${t}`),Sb(n,o)){let t=n-i;Cb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Uy(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Cb(i,c)<0)if(e>0){let t=c-o,n=t/2;Cb(i+e,c)<0&&(e=Cb(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Cb(i-e,c)<0&&(e=Cb(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];Uy(e!=null,`Previous layout not found for panel index ${r}`);let a=wb({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];Uy(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=wb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Sb(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(xb(c,l))return i;{let t=e<0?d:u,r=s[t];Uy(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=wb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Sb(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Uy(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=wb({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Sb(i,s)||(t-=s-i,l[r]=s),Sb(t,0))break;e>0?r--:r++}}}if(!Sb(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 Eb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Cb(e[n],t[n])!==0)return!1;return!0}function Db({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(!Sb(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Uy(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];Uy(i!=null,`No layout data found for index ${e}`);let o=r[e];Uy(o!=null,`No layout data found for index ${e}`);let s=wb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Sb(a,0))for(let e=0;e<t.length;e++){let n=r[e];Uy(n!=null,`No layout data found for index ${e}`);let i=n+a,o=wb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Sb(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Ob({groupId:e,panelId:t}){let n=()=>{let t=ab();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=Db({layout:Tb({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});Eb(l,p)||sb(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&&Sb(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Vy({group:t});o(By(zy({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function kb(e){e.defaultPrevented||bb(e,ab()).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=Ob({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Ab(e){let t=ab();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 jb({groupId:e}){let t=()=>{let t=ab();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=Db({layout:e,panelConstraints:r});return n?o:(Eb(o,c)||sb(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Mb(e,t){let n=Ab(e),r=ib(n.id,!0),i=n.separators.find(t=>t.element===e);Uy(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Uy(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=jb({groupId:n.id}).getLayout(),c=Db({layout:Tb({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Eb(s,c)||sb(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Nb(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Ab(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Mb(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Mb(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Mb(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Mb(t,-5);break;case`End`:e.preventDefault(),Mb(t,100);break;case`Enter`:{e.preventDefault();let n=Ab(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=ib(n.id,!0),o=n.separators.find(e=>e.element===t);Uy(o,`Matching separator not found`);let s=a.get(o);Uy(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Uy(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Mb(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Ab(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Uy(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(),Mb(t,-100);break}}var Pb={cursorFlags:0,state:`inactive`},Fb=new $y;function Ib(){return Pb}function Lb(e){return Fb.addListener(`change`,e)}function Rb(e){let t=Pb,n={...Pb};n.cursorFlags=e,Pb=n,Fb.emit(`change`,{prev:t,next:n})}function zb(e){let t=Pb;Pb=e,Fb.emit(`change`,{prev:t,next:e})}function Bb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=ab(),n=bb(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)}),zb({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Vb=e=>e,Hb=()=>{},Ub=1,Wb=2,Gb=4,Kb=8,qb=3,Jb=12,Yb;function Xb(){return Yb===void 0&&(Yb=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Yb=!0)),Yb}function Zb({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&&Xb()){let t=(e&Ub)!==0,n=(e&Wb)!==0,r=(e&Gb)!==0,i=(e&Kb)!==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 Xb()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Qb=new WeakMap;function $b(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Qb.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Ib();switch(r.state){case`active`:case`hover`:{let e=Zb({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}Qb.set(e,{prevStyle:t,styleSheet:n})}function ex({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=Tb({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Eb(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ub:Wb;break;case`vertical`:s|=d<0?Gb:Kb;break}}else sb(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&qb:c|=s&qb,t.movementY===0?c|=o&Jb:c|=s&Jb,Rb(c),$b(e)}function tx(e){let t=ab(),n=Ib();switch(n.state){case`active`:ex({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function nx(e){if(e.defaultPrevented)return;let t=Ib(),n=ab();switch(t.state){case`active`:if(e.buttons===0){zb({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=ib(e.group.id,!0);sb(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)}ex({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=bb(e,n);r.length===0?t.state!==`inactive`&&zb({cursorFlags:0,state:`inactive`}):zb({cursorFlags:0,hitRegions:r,state:`hover`}),$b(e.currentTarget);break}}}function rx(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ib().state){case`hover`:zb({cursorFlags:0,state:`inactive`})}}function ix(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Ib();switch(t.state){case`active`:zb({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&($b(e.currentTarget),t.hitRegions.forEach(e=>{let t=ib(e.group.id,!0);sb(e.group,t)}),e.preventDefault())}}function ax(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=By(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=By((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function ox(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Vy({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:By(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function sx(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 cx({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=By(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]=By((r[e]??0)/a*l);else{let e=By(l/c.length);for(let t of c)u[t]=e}return u}function lx(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 ux=new Map;function dx(e){let t=!0;Uy(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=Vy({group:e});if(t===0)return;let n=ib(e.id);if(!n)return;let r=Hy(e),i=n.defaultLayoutDeferred?ax(r):n.layout,a=Db({layout:cx({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Eb(n.layout,a)&&sx(n.derivedPanelConstraints,r)&&n.groupSize===t)return;sb(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else ox(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Uy(!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=Vy({group:e}),s=Hy(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(lx(e.panels,l)||(l=void 0));let u=Db({layout:e.mutableState.layouts[c]??l??ax(s),panelConstraints:s}),d=e.element.ownerDocument;ux.set(d,(ux.get(d)??0)+1);let f=new Map;return Qy(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),sb(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Uy(!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`,Nb)}),ux.get(d)===1&&(d.addEventListener(`dblclick`,kb,!0),d.addEventListener(`pointerdown`,Bb,!0),d.addEventListener(`pointerleave`,tx),d.addEventListener(`pointermove`,nx),d.addEventListener(`pointerout`,rx),d.addEventListener(`pointerup`,ix,!0)),function(){t=!1,ux.set(d,Math.max(0,(ux.get(d)??0)-1)),nb(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Nb)}),ux.get(d)||(d.removeEventListener(`dblclick`,kb,!0),d.removeEventListener(`pointerdown`,Bb,!0),d.removeEventListener(`pointerleave`,tx),d.removeEventListener(`pointermove`,nx),d.removeEventListener(`pointerout`,rx),d.removeEventListener(`pointerup`,ix,!0)),a.disconnect()}}function fx(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function px(e){let t=(0,Q.useId)();return`${e??t}`}var mx=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function hx(e){let t=(0,Q.useRef)(e);return mx(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function gx(...e){return hx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function _x(e){let t=(0,Q.useRef)({...e});return mx(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var vx=(0,Q.createContext)(null);function yx(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Vb});(0,Q.useImperativeHandle)(t,()=>n.current,[]),mx(()=>{Object.assign(n.current,jb({groupId:e}))})}function bx({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=hx(e=>{Eb(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=hx(e=>{Eb(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=px(s),v=(0,Q.useRef)(null),[y,b]=fx(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=gx(v,a);yx(_,o);let C=hx((e,t)=>{let r=Ib(),i=rb(e),a=ib(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=_x({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=Wy(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Wy(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=rb(_),i=ib(_);r&&i&&sb(r,{...i,derivedPanelConstraints:Hy(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 mx(()=>{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=dx(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=ib(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=ob(_,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=Sb(t.collapsedSize,i[t.panelId]),a=Sb(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Ib().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)(vx.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})})}bx.displayName=`Group`;function xx(){let e=(0,Q.useContext)(vx);return Uy(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Sx(e,t){let{id:n}=xx(),r=(0,Q.useRef)({collapse:Hb,expand:Hb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Hb});(0,Q.useImperativeHandle)(t,()=>r.current,[]),mx(()=>{Object.assign(r.current,Ob({groupId:n,panelId:e}))})}function Cx({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=px(c),_=_x({disabled:a}),v=(0,Q.useRef)(null),y=gx(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=xx(),T=d!==null,E=hx((e,t,n)=>{d?.(e,c,n)});mx(()=>{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]),Sx(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>ob(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:{...wx,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})})}Cx.displayName=`Panel`;var wx={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Tx(){return(0,Q.useRef)(null)}function Ex({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=Db({layout:Tb({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Db({layout:Tb({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Dx({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=px(a),l=_x({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=gx(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=xx(),x=v===`horizontal`?`vertical`:`horizontal`;mx(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=Lb(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=ob(_,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(Ex({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})}Dx.displayName=`Separator`;var Ox=new Map;function kx(e){let t=Ox.get(e);if(t)return t;let n=Ax(e);return Ox.set(e,n),n}async function Ax(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-CpYUNWOc.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-DrSwTBuw.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-DrSwTBuw.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-DrSwTBuw.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-Mxq-zflt.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([38,1,39,23,40]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-D0_HBszs.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-DdpCnkcu.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-4lW4ME5D.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-DrSwTBuw.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-Bui1BhSw.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([42,1,43,39,23,40]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-Debx6b6u.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([44,1,39,23,40]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-DrSwTBuw.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-BrsGSRvH.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-B9B58-J_.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([45,1,43,39,23,41,38,40,42]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-DrSwTBuw.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-BvKrvbRb.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-D1rVZYi52.js`);return{python:e}},__vite__mapDeps([50,43,39,1,23,40]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r-CfD_nMxU.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-CEHR0ONp.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-CjXb6uie.js`);return{rust:e}},__vite__mapDeps([51,39,1,23,40]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-m6QogzU7.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-CmJiKyqD.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-Bui1BhSw.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([42,1,43,39,23,40]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-Bn0QvNGs.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([41,1,38,39,23,40,42,43]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-pSQcUvmU.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([46,1,39,23,40]),import.meta.url)).yaml().language;default:return null}}async function jx(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-Debx6b6u.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([44,1,39,23,40]),import.meta.url)).json().language;if(t){let e=await kx(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-CSZcBb2g.js`);return{toml:e}},[],import.meta.url)).toml):null}var Mx=Y({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Nx=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Px(e){let t=(0,$.c)(5),{_:n}=i(),r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`loading`},t[0]=r):r=t[0];let[a,o]=(0,Q.useState)(r),s,c;return t[1]!==n||t[2]!==e?(s=()=>{let t=!1,r=new AbortController;return o({status:`loading`}),fetch(e,{credentials:`same-origin`,signal:r.signal}).then(async e=>{if(!e.ok){let t=e.status;throw Error(n(t===413?{id:`C_WGy8`}:t===404?{id:`s0IDhW`}:t===400?{id:`N1mdmS`}:{id:`96w9hU`,values:{status:t}}))}return e.text()}).then(e=>{t||o({status:`loaded`,content:e})}).catch(e=>{t||e instanceof Error&&e.name===`AbortError`||o({status:`error`,message:e instanceof Error?e.message:n({id:`ig5vUe`})})}),()=>{t=!0,r.abort()}},c=[e,n],t[1]=n,t[2]=e,t[3]=s,t[4]=c):(s=t[3],c=t[4]),(0,Q.useEffect)(s,c),a}function Fx(e){let t=(0,$.c)(28),{src:n,fileName:r,extension:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:c}=Yr(),l=Px(n),u=l.status===`loaded`?l.content:null,d,f;if(t[0]!==i||t[1]!==u||t[2]!==c?(d=()=>{if(!a.current||u===null)return;let e=i.toLowerCase(),t=sr(e),n=c===`dark`?Mx:Nx,r=!1,s=null;return jx(e,t).then(e=>{if(r||!a.current)return;let t=[Fc,...e?[e]:[],_c.editable.of(!0),sc.readOnly.of(!0),_c.lineWrapping,n];s=new _c({state:sc.create({doc:u,extensions:t}),parent:a.current}),o.current=s}),()=>{r=!0,s?.destroy(),o.current=null}},f=[u,i,c],t[0]=i,t[1]=u,t[2]=c,t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f),l.status===`loading`){let e;t[5]===r?e=t[6]:(e=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`Md709y`,values:{fileName:r}})}),t[5]=r,t[6]=e);let n;return t[7]!==i||t[8]!==r||t[9]!==e?(n=(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":r,"data-text-viewer":``,"data-text-viewer-state":`loading`,"data-text-viewer-extension":i,children:e}),t[7]=i,t[8]=r,t[9]=e,t[10]=n):n=t[10],n}if(l.status===`error`){let e;t[11]===r?e=t[12]:(e=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(s,{id:`qdBUHP`,values:{fileName:r}})}),t[11]=r,t[12]=e);let a;t[13]===l.message?a=t[14]:(a=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:l.message}),t[13]=l.message,t[14]=a);let o;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`9npOH9`}),t[15]=o):o=t[15];let c;t[16]===n?c=t[17]:(c=(0,Z.jsx)(`a`,{href:n,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:o}),t[16]=n,t[17]=c);let u;return t[18]!==i||t[19]!==r||t[20]!==e||t[21]!==a||t[22]!==c?(u=(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":r,"data-text-viewer":``,"data-text-viewer-state":`error`,"data-text-viewer-extension":i,children:[e,a,c]}),t[18]=i,t[19]=r,t[20]=e,t[21]=a,t[22]=c,t[23]=u):u=t[23],u}let p;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[24]=p):p=t[24];let m;return t[25]!==i||t[26]!==r?(m=(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":i,children:p}),t[25]=i,t[26]=r,t[27]=m):m=t[27],m}function Ix(e){return Kr(`/api/asset?path=${encodeURIComponent(e)}`)}function Lx(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function Rx(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=Ix(n),t[0]=n,t[1]=o);let c=o,l;t[2]===n?l=t[3]:(l=n.split(`/`).pop()??n,t[2]=n,t[3]=l);let u=l,d,f,p,m;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){m=Symbol.for(`react.early_return_sentinel`);bb0:{if(p=u.includes(`.`)?u.split(`.`).pop()??``:``,f=p.length>0?p.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[13]!==u||t[14]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(X,{src:c,title:u,fillContainer:!0})}),t[13]=u,t[14]=c,t[15]=e):e=t[15];let n;t[16]!==u||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[16]=u,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=Lx(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(Fx,{src:e,fileName:u,extension:p.toLowerCase()},n);break bb0}}t[4]=n,t[5]=u,t[6]=i,t[7]=r,t[8]=c,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]!==u||t[25]!==p||t[26]!==c?(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)(Ge,{src:c,alt:u,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:c,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:c,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:u})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(ci,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(s,{id:`qFWMl-`})}),(0,Z.jsx)(ci,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{rt({url:c,projectRelPath:n,ext:p.toLowerCase(),title:u,forceOsDelegation:!1})},children:(0,Z.jsx)(s,{id:`9npOH9`})})]})]})}),t[21]=n,t[22]=d,t[23]=f,t[24]=u,t[25]=p,t[26]=c,t[27]=h):h=t[27];let g;return t[28]!==u||t[29]!==h?(g=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:h}),t[28]=u,t[29]=h,t[30]=g):g=t[30],g}function zx(){let e=(0,$.c)(5),{_:t}=i(),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)(za,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(za,{className:`h-4 w-full`}),(0,Z.jsx)(za,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function Bx(e){let{_:t}=i();return e===`existing-repo`?[{id:`draft-spec`,icon:_l,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Pl,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:Ll,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:cu,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:_l,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:tl,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function Vx(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:a}=i(),o=Bx(n),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(void 0),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>clearTimeout(l.current),d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,Q.useEffect)(u,d);let f,p;if(t[2]!==a||t[3]!==r||t[4]!==s||t[5]!==o){let e=function(e,t){Pa(t).then(()=>{c(e),clearTimeout(l.current),l.current=setTimeout(()=>c(null),1600)}).catch(Hx)};t[8]===r?f=t[9]:(f=oi(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=f),p=o.map(t=>{let n=t.icon,r=s===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)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":a(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:oi(`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)(ko,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(tt,{className:`size-3.5`,"aria-hidden":`true`}),a(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=a,t[3]=r,t[4]=s,t[5]=o,t[6]=f,t[7]=p}else f=t[6],p=t[7];let m;return t[10]!==f||t[11]!==p?(m=(0,Z.jsx)(`ul`,{className:f,children:p}),t[10]=f,t[11]=p,t[12]=m):m=t[12],m}function Hx(){}var Ux={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Wx(e){let t=(0,$.c)(23),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=Yr(),s=Ux[r],c=s?(o===`dark`?Lr[s]:void 0)??qr[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=oi(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,Z.jsx)(fi,{style:u,className:p,...i}),t[11]=p,t[12]=u,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==p||t[16]!==u||t[17]!==i?(e=(0,Z.jsx)(di,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,Z.jsx)(vi,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}var Gx=(0,Q.createContext)(null);function Kx(e){let t=(0,$.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(Gx,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function qx(){return(0,Q.use)(Gx)}var Jx=ii(`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 Yx(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=oi(Jx({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 Xx=`ok-preferred-agent-v1`,Zx=new Set(_g.map(e=>e.id));function Qx(e){return typeof e==`string`&&Zx.has(e)}function $x(e){try{let t=(e??localStorage).getItem(Xx);return Qx(t)?t:null}catch{return null}}function eS(e,t){try{(t??localStorage).setItem(Xx,e)}catch{}}function tS(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:_g.find(e=>n[e.id]?.installed===!0)?.id??null}function nS(e){let t=(0,$.c)(52),{scenario:n,className:r}=e,{_:a}=i(),{states:o,refresh:c}=O_(),{dispatch:l}=__(),u=po(),d=qx(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(iS),g=(0,Q.useRef)(!1),[_,v]=(0,Q.useState)(!1),y=_&&d!==null,b=(0,Q.useRef)(null),x=Bx(n),S;t[0]===o?S=t[1]:(S=e=>o[e.id]?.installed===!0,t[0]=o,t[1]=S);let C=_g.filter(S),w;t[2]===o?w=t[3]:(w=_g.every(e=>o[e.id]?.installed!=null),t[2]=o,t[3]=w);let T=w,E=T&&C.length===0,D,O;t[4]!==T||t[5]!==o?(D=()=>{if(!T||g.current)return;let e=tS({lastUsed:$x(),states:o});h(t=>e===t?t:e)},O=[T,o],t[4]=T,t[5]=o,t[6]=D,t[7]=O):(D=t[6],O=t[7]),(0,Q.useEffect)(D,O);let k=function(e){g.current=!0,v(!1),h(e),eS(e)},A;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){g.current=!0,v(!0)},t[8]=A):A=t[8];let j=A,M;t[9]!==f||t[10]!==n||t[11]!==d||t[12]!==u?(M=function(){if(d===null)return;let e=n_({workspace:u,description:f.trim(),scenario:n});e!==null&&d.launchInTerminal(e)},t[9]=f,t[10]=n,t[11]=d,t[12]=u,t[13]=M):M=t[13];let N=M,P;t[14]!==f||t[15]!==l||t[16]!==n||t[17]!==u?(P=function(e){let t=f.trim();eS(e);let r=n_({workspace:u,description:t,scenario:n});r!==null&&l(e,r)},t[14]=f,t[15]=l,t[16]=n,t[17]=u,t[18]=P):P=t[18];let F=P,I;t[19]!==y||t[20]!==F||t[21]!==N||t[22]!==m?(I=function(e){(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),y?N():m!==null&&F(m))},t[19]=y,t[20]=F,t[21]=N,t[22]=m,t[23]=I):I=t[23];let L=I,R=function(e){p(e),b.current?.focus()};if(E){let e;t[24]===r?e=t[25]:(e=oi(`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[24]=r,t[25]=e);let n;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(yi,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[26]=n):n=t[26];let i;t[27]===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)(s,{id:`3IseAk`})})]}),t[27]=i):i=t[27];let a;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:_g.map(rS)}),t[28]=a):a=t[28];let o;return t[29]===e?o=t[30]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[29]=e,t[30]=o),o}let z=C.length>0,B=d!==null,V;t[31]===r?V=t[32]:(V=oi(`flex w-full flex-col gap-3`,r),t[31]=r,t[32]=V);let H;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>p(e.target.value),t[33]=H):H=t[33];let U;t[34]===a?U=t[35]:(U=a({id:`0jD-Gn`}),t[34]=a,t[35]=U);let W;t[36]===a?W=t[37]:(W=a({id:`7hctf2`}),t[36]=a,t[37]=W);let G;t[38]!==f||t[39]!==L||t[40]!==U||t[41]!==W?(G=(0,Z.jsx)(qs,{ref:b,value:f,onChange:H,onKeyDown:L,rows:4,placeholder:U,"aria-label":W,className:`min-h-12 resize-none rounded-2xl border-0 bg-transparent dark:bg-transparent px-4 py-3.5 text-sm leading-relaxed shadow-none focus-visible:border-0 focus-visible:ring-0 max-h-96 subtle-scrollbar`}),t[38]=f,t[39]=L,t[40]=U,t[41]=W,t[42]=G):G=t[42];let K=m===null?(0,Z.jsx)(ci,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(s,{id:`hYgDIe`})}):(0,Z.jsxs)(Yx,{children:[(0,Z.jsx)(ci,{type:`button`,onClick:()=>y?N():F(m),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ru,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`hozzkE`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wx,{id:m,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`9dw5bW`,values:{0:m_(m)}})]})}),(0,Z.jsxs)(ao,{onOpenChange:e=>{e&&c()},children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,"aria-label":a({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(Ve,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(eo,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(La,{"aria-label":a({id:`BBqGS9`}),children:[(0,Z.jsx)(Ja,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),C.map(e=>(0,Z.jsxs)(Ea,{onSelect:()=>k(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!y&&e.id===m?(0,Z.jsx)(ko,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]}):null,B?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(no,{}):null,(0,Z.jsxs)(La,{"aria-label":a({id:`ALhMYW`}),children:[(0,Z.jsx)(Ja,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(Ea,{onSelect:()=>j(),"data-testid":`create-with-claude-cli`,"aria-label":a({id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),y?(0,Z.jsx)(ko,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]})]})]}):null]})]})]}),q;t[43]===K?q=t[44]:(q=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 px-3 pb-3`,children:K}),t[43]=K,t[44]=q);let J;t[45]!==G||t[46]!==q?(J=(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:[G,q]}),t[45]=G,t[46]=q,t[47]=J):J=t[47];let ee=n!==`existing-repo`&&x.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:x.map(e=>{let t=e.icon;return(0,Z.jsxs)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>R(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,Y;return t[48]!==J||t[49]!==ee||t[50]!==V?(Y=(0,Z.jsxs)(`div`,{className:V,children:[J,ee]}),t[48]=J,t[49]=ee,t[50]=V,t[51]=Y):Y=t[51],Y}function rS(e){return(0,Z.jsxs)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r_(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(vo,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function iS(){return $x()}var aS=3100,oS=3;function sS(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??oS;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var cS={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}},lS=[`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 uS(e,t={}){let n=t.rng??Math.random,r=t.colors??lS,i=cS[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 dS=1.8,fS=90,pS=16,mS=380,hS=.025,gS=.1,_S=.18,vS=400,yS=9.2736,bS=18.1799,xS=14.5244,SS={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function CS(e,t){let{halfWidth:n,apexLift:r}=SS[t];return`M${e-n} ${xS+.3} Q${e} ${xS-r}, ${e+n} ${xS+.3}`}function wS(e){let t=1.5,n=.3;return`M${e-t} ${xS-n} Q${e} ${xS+1.4}, ${e+t} ${xS-n}`}var TS=15,ES=15;function DS(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 OS(e){let t=(0,$.c)(72),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o,gaze:s}=e,c=n===void 0?48:n,l=i===void 0?!0:i,u=a===void 0?`default`:a,d=o===void 0?0:o,f=s===void 0?`cursor`:s,p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g={x:0,y:0},t[0]=g):g=t[0];let _=(0,Q.useRef)(g),[v,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(0),S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[1]=S):S=t[1];let[C,w]=(0,Q.useState)(S),T=(0,Q.useRef)(0),E=(0,Q.useRef)(void 0),D=u===`sleeping`,O;t[2]!==v||t[3]!==D?(O=function(){if(D)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=T.current===0?1/0:e-T.current;T.current=e;let n=sS(v,t);y(n),x(MS),w(uS(n)),clearTimeout(E.current),E.current=setTimeout(()=>{y(0),w([])},aS)},t[2]=v,t[3]=D,t[4]=O):O=t[4];let k=O,A,j;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>clearTimeout(E.current),A=[],t[5]=A,t[6]=j):(A=t[5],j=t[6]),(0,Q.useEffect)(j,A);let M,N;t[7]!==d||t[8]!==D?(M=()=>{d===0||D||(y(3),x(jS),w(uS(3)),clearTimeout(E.current),E.current=setTimeout(()=>{y(0),w([])},aS))},N=[d,D],t[7]=d,t[8]=D,t[9]=M,t[10]=N):(M=t[9],N=t[10]),(0,Q.useEffect)(M,N);let P,F;t[11]!==f||t[12]!==D||t[13]!==l?(P=()=>{if(!l||D)return;let e=f===`down`;if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=0,n=0,r=!1,i=0,a=0,o=0,s=0,c=0,u=function(){c===0&&(c=requestAnimationFrame(g))},d=function(e){t=e.clientX,n=e.clientY,r=!0,u()};function g(){c=0;let l=m.current,d=p.current;if(!l||!d){u();return}let f=r;r=!1;let g=l.getBoundingClientRect(),v=g.left+g.width/2,y=g.top+g.height*.48,b=t-v,x=n-y,S=Math.hypot(b,x),C,w,T=0,E=0;if(e)w=0,C=-pS*.8,E=dS;else{let e=Math.max(-1,Math.min(1,b/mS)),t=Math.max(-1,Math.min(1,x/mS));if(w=e*pS,C=-t*pS,S>=1){let e=Math.min(S/fS,1)*dS;T=b/S*e,E=x/S*e}}let D=Math.abs(C-i)<.01&&Math.abs(w-a)<.01&&Math.abs(T-o)<.01&&Math.abs(E-s)<.01;if(!f&&D)return;u(),i+=(C-i)*gS,a+=(w-a)*gS,d.style.transform=`perspective(${vS}px) rotateX(${i.toFixed(3)}deg) rotateY(${a.toFixed(3)}deg)`,o+=(T-o)*_S,s+=(E-s)*_S;let O=a*hS,k=-i*hS,A=o+O,j=s+k;_.current.x=A,_.current.y=j,h.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,d,{passive:!0}),u(),()=>{document.removeEventListener(`mousemove`,d),c!==0&&cancelAnimationFrame(c),c=0,p.current&&(p.current.style.transform=``),_.current={x:0,y:0},h.current?.removeAttribute(`transform`)}},F=[l,D,f],t[11]=f,t[12]=D,t[13]=l,t[14]=P,t[15]=F):(P=t[14],F=t[15]),(0,Q.useEffect)(P,F);let I;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{let e=h.current;if(!e)return;let{x:t,y:n}=_.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[16]=I):I=t[16],(0,Q.useLayoutEffect)(I);let L=v>0,R=L?v:1,z=L?`ok-blob-clicked-${v}`:null,B;t[17]===r?B=t[18]:(B=oi(`ok-blob-3d-wrapper`,r),t[17]=r,t[18]=B);let V=D?`cursor-default`:`cursor-pointer`,H=`body-${b}`,U=D&&`ok-blob-sleeping`,W;t[19]!==z||t[20]!==U?(W=oi(`ok-blob-group`,U,z),t[19]=z,t[20]=U,t[21]=W):W=t[21];let G;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(G=(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[22]=G):G=t[22];let K=(L||D)&&`ok-blob-eye-hidden`,q;t[23]===K?q=t[24]:(q=oi(`ok-blob-eye`,K),t[23]=K,t[24]=q);let J;t[25]===q?J=t[26]:(J=(0,Z.jsx)(`ellipse`,{cx:yS,cy:xS,rx:1.2722,ry:1.9083,className:q}),t[25]=q,t[26]=J);let ee=(L||D)&&`ok-blob-eye-hidden`,Y;t[27]===ee?Y=t[28]:(Y=oi(`ok-blob-eye ok-blob-eye-right`,ee),t[27]=ee,t[28]=Y);let te;t[29]===Y?te=t[30]:(te=(0,Z.jsx)(`ellipse`,{cx:bS,cy:xS,rx:1.2722,ry:1.9083,className:Y}),t[29]=Y,t[30]=te);let ne;t[31]===R?ne=t[32]:(ne=CS(yS,R),t[31]=R,t[32]=ne);let X=(!L||D)&&`ok-blob-eye-hidden`,re;t[33]===X?re=t[34]:(re=oi(`ok-blob-happy-eye`,X),t[33]=X,t[34]=re);let ie;t[35]!==ne||t[36]!==re?(ie=(0,Z.jsx)(`path`,{d:ne,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:re}),t[35]=ne,t[36]=re,t[37]=ie):ie=t[37];let ae;t[38]===R?ae=t[39]:(ae=CS(bS,R),t[38]=R,t[39]=ae);let oe=(!L||D)&&`ok-blob-eye-hidden`,se;t[40]===oe?se=t[41]:(se=oi(`ok-blob-happy-eye`,oe),t[40]=oe,t[41]=se);let ce;t[42]!==ae||t[43]!==se?(ce=(0,Z.jsx)(`path`,{d:ae,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:se}),t[42]=ae,t[43]=se,t[44]=ce):ce=t[44];let le;t[45]===D?le=t[46]:(le=D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:wS(yS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:wS(bS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[45]=D,t[46]=le);let ue;t[47]!==J||t[48]!==te||t[49]!==ie||t[50]!==ce||t[51]!==le?(ue=(0,Z.jsxs)(`g`,{ref:h,children:[J,te,ie,ce,le]}),t[47]=J,t[48]=te,t[49]=ie,t[50]=ce,t[51]=le,t[52]=ue):ue=t[52];let de;t[53]!==H||t[54]!==W||t[55]!==ue?(de=(0,Z.jsxs)(`g`,{className:W,children:[G,ue]},H),t[53]=H,t[54]=W,t[55]=ue,t[56]=de):de=t[56];let fe;t[57]===D?fe=t[58]:(fe=D?(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[57]=D,t[58]=fe);let pe;t[59]!==b||t[60]!==C?(pe=C.length>0&&(0,Z.jsx)(`g`,{children:C.map(kS)},`firework-${b}`),t[59]=b,t[60]=C,t[61]=pe):pe=t[61];let me;t[62]!==k||t[63]!==c||t[64]!==V||t[65]!==de||t[66]!==fe||t[67]!==pe?(me=(0,Z.jsxs)(`svg`,{ref:m,width:c,height:c,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:V,"aria-hidden":`true`,onClick:k,onMouseDown:AS,children:[de,fe,pe]}),t[62]=k,t[63]=c,t[64]=V,t[65]=de,t[66]=fe,t[67]=pe,t[68]=me):me=t[68];let he;return t[69]!==B||t[70]!==me?(he=(0,Z.jsx)(`span`,{ref:p,className:B,children:me}),t[69]=B,t[70]=me,t[71]=he):he=t[71],he}function kS(e){return(0,Z.jsx)(`circle`,{cx:TS+e.originDx,cy:ES+e.originDy,r:e.size,className:`ok-blob-firework`,style:DS(e)},e.id)}function AS(e){return e.preventDefault()}function jS(e){return e+1}function MS(e){return e+1}function NS(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(OS,{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}var PS=`open-knowledge:create-top-level-file`;function FS(e={}){window.dispatchEvent(new CustomEvent(PS,{detail:e}))}function IS(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(PS,t),()=>window.removeEventListener(PS,t)}function LS(e){let t=(0,$.c)(32),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o=mg(),c=Va(),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;t[3]===a?p=t[4]:(p=a({id:`FOGD7m`}),t[3]=a,t[4]=p);let m;t[5]!==a||t[6]!==o?(m=a(o?{id:`3DTatP`}:{id:`MqQoV-`}),t[5]=a,t[6]=o,t[7]=m):m=t[7];let h;t[8]!==n||t[9]!==p||t[10]!==m?(h=(0,Z.jsx)(NS,{title:p,subtitle:m,celebrateSignal:n}),t[8]=n,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===o?g=t[13]:(g=o?(0,Z.jsx)(Vx,{scenario:`existing-repo`}):(0,Z.jsx)(nS,{scenario:`existing-repo`}),t[12]=o,t[13]=g);let _;t[14]!==u||t[15]!==f||t[16]!==d?(_=d||f||u.length>0?(0,Z.jsx)(BS,{templates:u,loading:d,error:f,onSelect:zS}):null,t[14]=u,t[15]=f,t[16]=d,t[17]=_):_=t[17];let v,y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(V,{"aria-hidden":`true`,className:`size-3`}),y=(0,Z.jsx)(s,{id:`IajAbS`}),t[18]=v,t[19]=y):(v=t[18],y=t[19]);let b;t[20]===r?b=t[21]:(b=(0,Z.jsxs)(ci,{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:[v,y]}),t[20]=r,t[21]=b);let x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(ci,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:RS,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(ka,{"aria-hidden":`true`,className:`size-3`})}})}),t[22]=x):x=t[22];let S;t[23]===b?S=t[24]:(S=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[b,x]}),t[23]=b,t[24]=S);let C;t[25]!==S||t[26]!==_?(C=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[_,S]}),t[25]=S,t[26]=_,t[27]=C):C=t[27];let w;return t[28]!==C||t[29]!==h||t[30]!==g?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[h,g,C]}),t[28]=C,t[29]=h,t[30]=g,t[31]=w):w=t[31],w}function RS(){return FS({initialDir:``})}function zS(e,t){return FS({template:{folder:e,name:t}})}function BS(e){let t=(0,$.c)(25),{templates:n,loading:r,error:a,onSelect:o}=e,{_:c}=i(),l;t[0]===c?l=t[1]:(l=c({id:`_8quCH`}),t[0]=c,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`_8quCH`})}),t[2]=u):u=t[2];let d;t[3]!==c||t[4]!==a||t[5]!==r||t[6]!==n?(d=r||a?null:(0,Z.jsx)(st,{className:`text-2xs`,variant:`gray`,"aria-label":c({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=c,t[4]=a,t[5]=r,t[6]=n,t[7]=d):d=t[7];let f;t[8]===d?f=t[9]:(f=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[u,d]}),t[8]=d,t[9]=f);let p;t[10]===c?p=t[11]:(p=c({id:`irFGwu`}),t[10]=c,t[11]=p);let m;t[12]!==a||t[13]!==r||t[14]!==o||t[15]!==n?(m=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Hl89Qd`})}):a?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(s,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(VS,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>o(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=a,t[13]=r,t[14]=o,t[15]=n,t[16]=m):m=t[16];let h;t[17]!==r||t[18]!==p||t[19]!==m?(h=(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":p,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:m})}),t[17]=r,t[18]=p,t[19]=m,t[20]=h):h=t[20];let g;return t[21]!==l||t[22]!==f||t[23]!==h?(g=(0,Z.jsxs)(`section`,{"aria-label":l,className:`flex w-full flex-col gap-3`,children:[f,h]}),t[21]=l,t[22]=f,t[23]=h,t[24]=g):g=t[24],g}function VS(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:a}=e,{_:o}=i(),s;t[0]!==n.name||t[1]!==n.title?(s=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=s):s=t[2];let c=s,l=`${n.name}.md`,u=n.source_folder===``,d;t[3]!==o||t[4]!==c||t[5]!==l||t[6]!==u||t[7]!==r?(d=o(u?{id:`89TtiD`,values:{displayTitle:c,fileName:l}}:{id:`0_J12R`,values:{displayTitle:c,fileName:l,targetLabel:r}}),t[3]=o,t[4]=c,t[5]=l,t[6]=u,t[7]=r,t[8]=d):d=t[8];let f=d,p;t[9]===c?p=t[10]:(p=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:c}),t[9]=c,t[10]=p);let m;t[11]===l?m=t[12]:(m=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g=`shrink-0 font-mono text-1sm ${u?`text-muted-foreground/70`:`text-muted-foreground`}`,_;t[16]!==g||t[17]!==r?(_=(0,Z.jsx)(`span`,{className:g,children:r}),t[16]=g,t[17]=r,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==a||t[21]!==h||t[22]!==_?(v=(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,onClick:a,"aria-label":f,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:[h,_]}),t[19]=f,t[20]=a,t[21]=h,t[22]=_,t[23]=v):v=t[23],v}function HS(e){let t=(0,$.c)(15),{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 t=await fetch(`/api/documents`),n=await t.json().catch(KS);if(e)return;let r=t.ok?kr.safeParse(n):null;r?.success?(l(qS(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=$o(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(GS),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(WS);if(!e.ok)return;let n=kr.safeParse(t);n.success&&l(qS(n.data.documents))}).catch(US)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-end px-6 pb-8 pt-10`,children:(0,Z.jsx)(OS,{size:64,gaze:`down`})}),t[4]=e):e=t[4],e}let S;t[5]!==u||t[6]!==y||t[7]!==v?(S=v?y?(0,Z.jsx)(JS,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(LS,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[5]=u,t[6]=y,t[7]=v,t[8]=S):S=t[8];let C;t[9]!==o||t[10]!==i?(C=(0,Z.jsx)(lg,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[9]=o,t[10]=i,t[11]=C):C=t[11];let w;return t[12]!==S||t[13]!==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[12]=S,t[13]=C,t[14]=w):w=t[14],w}function US(){}function WS(){return null}function GS(e){return e+1}function KS(){return null}function qS(e){return Xo(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function JS(e){let t=(0,$.c)(25),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o=mg(),s;t[0]===a?s=t[1]:(s=a({id:`6h4zVU`}),t[0]=a,t[1]=s);let c;t[2]!==a||t[3]!==o?(c=a(o?{id:`vGeNNQ`}:{id:`qpQwGC`}),t[2]=a,t[3]=o,t[4]=c):c=t[4];let l;t[5]!==n||t[6]!==s||t[7]!==c?(l=(0,Z.jsx)(NS,{title:s,subtitle:c,celebrateSignal:n}),t[5]=n,t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===o?u=t[10]:(u=o?(0,Z.jsx)(Vx,{scenario:`new-project`}):(0,Z.jsx)(nS,{scenario:`new-project`}),t[9]=o,t[10]=u);let d;t[11]!==a||t[12]!==o?(d=a(o?{id:`GubkSu`}:{id:`xeXS4P`}),t[11]=a,t[12]=o,t[13]=d):d=t[13];let f;t[14]===d?f=t[15]:(f=(0,Z.jsx)(XS,{label:d}),t[14]=d,t[15]=f);let p;t[16]===r?p=t[17]:(p=(0,Z.jsx)(ng,{onPackSelect:r,onCreateBlankFile:YS}),t[16]=r,t[17]=p);let m;t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[f,p]}),t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==l||t[22]!==u||t[23]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,u,m]}),t[21]=l,t[22]=u,t[23]=m,t[24]=h):h=t[24],h}function YS(){return FS()}function XS(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 ZS(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function QS(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:a}=e,{_:o}=i(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(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)(eC,{}),(0,Z.jsx)(za,{className:`h-7 w-full`}),(0,Z.jsx)(za,{className:`h-7 w-full`}),(0,Z.jsx)(za,{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)(s,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let m;t[3]===r.data.frontmatterLocal?m=t[4]:(m=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=m);let h=m,g;t[5]===r.data.folder.path?g=t[6]:(g=ZS(r.data.folder.path),t[5]=r.data.folder.path,t[6]=g);let _=g,v;t[7]===h?v=t[8]:(v=Object.keys(h),t[7]=h,t[8]=v);let y=v,b;t[9]!==o||t[10]!==n||t[11]!==a?(b=async function(e,t){let r=await Qi(n,{[e]:t});if(!r.ok){let{error:e}=r;hs.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},t[9]=o,t[10]=n,t[11]=a,t[12]=b):b=t[12];let x=b,S;t[13]!==o||t[14]!==n||t[15]!==a?(S=async function(e){let t=await Qi(n,{[e]:null});if(!t.ok){let{error:e}=t;hs.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},t[13]=o,t[14]=n,t[15]=a,t[16]=S):S=t[16];let C=S,w;t[17]!==x||t[18]!==h?(w=function(e,t){let n=h[e];x(e,oa(n,t))},t[17]=x,t[18]=h,t[19]=w):w=t[19];let T=w,E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){d({name:``,type:`text`,value:``,error:null}),l(!1)},t[20]=E):E=t[20];let D=E,O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Ji[e];return{...t,type:e,value:n,error:null}})},t[21]=O):O=t[21];let k=O,A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){d(t=>t&&{...t,value:e})},t[22]=A):A=t[22];let j=A,M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e){d(t=>t&&{...t,name:e,error:null})},t[23]=M):M=t[23];let N=M,P;t[24]!==o||t[25]!==u||t[26]!==n||t[27]!==a||t[28]!==h?(P=async function(e){if(!u)return;let t=e??u.value,r=u.name.trim();if(!r){d({...u,value:t,error:o({id:`8_brI5`})});return}if(Zn(t)){d({...u,value:t,error:o({id:`hXUWyd`})});return}if(Object.hasOwn(h,r)){d({...u,value:t,error:o({id:`CTJLpz`,values:{trimmed:r}})});return}let i=await Qi(n,{[r]:t});if(!i.ok){d({...u,value:t,error:i.error});return}d(null),a()},t[24]=o,t[25]=u,t[26]=n,t[27]=a,t[28]=h,t[29]=P):P=t[29];let F=P,I;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){p({key:e,draft:e,error:null})},t[30]=I):I=t[30];let L=I,R;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(t=>t&&{...t,draft:e,error:null})},t[31]=R):R=t[31];let z=R,B;t[32]!==o||t[33]!==n||t[34]!==a||t[35]!==h||t[36]!==f?(B=async function(){if(!f)return;let e=f.draft.trim();if(!e){p({...f,error:o({id:`8_brI5`})});return}if(e===f.key){p(null);return}if(Object.hasOwn(h,e)){p({...f,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}let t=h[f.key],r=await Qi(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},t[32]=o,t[33]=n,t[34]=a,t[35]=h,t[36]=f,t[37]=B):B=t[37];let H=B,U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=function(){p(null)},t[38]=U):U=t[38];let W=U,G=!c,K;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>l(!e),t[39]=K):K=t[39];let q=`size-3 transition-transform ${c?``:`rotate-90`}`,J;t[40]===q?J=t[41]:(J=(0,Z.jsx)(No,{className:q,"aria-hidden":!0}),t[40]=q,t[41]=J);let ee;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[42]=ee):ee=t[42];let Y;t[43]===J?Y=t[44]:(Y=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[J,ee]}),t[43]=J,t[44]=Y);let te;t[45]===_?te=t[46]:(te=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:$S,children:_}),t[45]=_,t[46]=te);let ne;t[47]!==Y||t[48]!==te?(ne=(0,Z.jsxs)(Po,{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:[Y,te]}),t[47]=Y,t[48]=te,t[49]=ne):ne=t[49];let X;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`hSBIG-`})}),t[50]=X):X=t[50];let re;t[51]!==u||t[52]!==x||t[53]!==H||t[54]!==y||t[55]!==h||t[56]!==C||t[57]!==f||t[58]!==T?(re=y.length===0&&!u?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`4c_a6S`})}):y.map(e=>{let t=h[e];return(0,Z.jsx)(Ii,{keyName:e,value:t,declared:go(t,An(t)),rename:{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:z,onCommit:H,onCancel:W},badge:null,onCommit:t=>void x(e,t),onChangeType:t=>T(e,t),onRemove:()=>void C(e)},e)}),t[51]=u,t[52]=x,t[53]=H,t[54]=y,t[55]=h,t[56]=C,t[57]=f,t[58]=T,t[59]=re):re=t[59];let ie;t[60]!==u||t[61]!==F?(ie=u?(0,Z.jsx)(na,{draft:u,onChangeName:N,onChangeType:k,onChangeValue:j,onCommit:e=>void F(e),onCancel:()=>d(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>D(),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)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`G8t9NN`})})]})}),t[60]=u,t[61]=F,t[62]=ie):ie=t[62];let ae;t[63]!==re||t[64]!==ie?(ae=(0,Z.jsx)(Mo,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[X,re,ie]})}),t[63]=re,t[64]=ie,t[65]=ae):ae=t[65];let oe;return t[66]!==G||t[67]!==ne||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Fo,{open:G,onOpenChange:K,children:[ne,ae]})}),t[66]=G,t[67]=ne,t[68]=ae,t[69]=oe):oe=t[69],oe}function $S(e){return e.stopPropagation()}function eC(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Sl,{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)(s,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function tC(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 nC(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function rC(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:Ta,label:ms._({id:`QR5SP1`}),detail:nC(i)};case`template-edit`:return{Icon:oe,label:ms._({id:`-LHLx7`}),detail:nC(i)};case`template-delete`:return{Icon:K,label:ms._({id:`_gkGSK`}),detail:nC(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:$c,label:ms._({id:`KPW5WC`}),detail:`${nC(e??``)} → ${nC(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Sl,label:ms._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Sl,label:ms._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Sl,label:ms._({id:`ZQLDTl`}),detail:``};default:return{Icon:Ol,label:r.replace(/-/g,` `),detail:nC(i)}}}function iC(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 aC(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,c]=(0,Q.useState)(!0),[l,u]=(0,Q.useState)(!1),d,f;if(t[1]===n?(d=t[2],f=t[3]):(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){u(!0),c(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),u(!1),c(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),u(!0),c(!1))}};c(!0),t();let r=ds(t);return()=>{e=!0,r()}},f=[n],t[1]=n,t[2]=d,t[3]=f),(0,Q.useEffect)(d,f),l||!o&&i.length===0)return null;let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XJOV1Y`})}),t[4]=p):p=t[4];let m;t[5]===i.length?m=t[6]:(m=i.length>0?(0,Z.jsx)(st,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=m);let h;t[7]===m?h=t[8]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[p,m]}),t[7]=m,t[8]=h);let g;t[9]!==i||t[10]!==o?(g=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(za,{className:`h-8 w-full`}),(0,Z.jsx)(za,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(oC)})}),t[9]=i,t[10]=o,t[11]=g):g=t[11];let _;return t[12]!==h||t[13]!==g?(_=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14],_}function oC(e){let{Icon:t,label:n,detail:r}=rC(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)(hu,{className:`size-3`,"aria-hidden":!0}),iC(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:tC(e.timestamp)})]},e.sha)}function sC(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function cC(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=sC(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function lC(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function uC(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:cC(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:lC(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:cC(e,t.pageTitles),children:a}}function dC(e){let t=(0,$.c)(44),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(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)(s,{id:`-QCLWk`})})}),(0,Z.jsx)(za,{className:`h-12 w-full`}),(0,Z.jsx)(za,{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)(s,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let h;t[3]===r.data.folder.templates_available?h=t[4]:(h=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=h);let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})}),t[5]=_):_=t[5];let v;t[6]===g.length?v=t[7]:(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,(0,Z.jsx)(st,{className:`text-xs`,variant:`secondary`,children:g.length})]}),t[6]=g.length,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(ci,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(s,{id:`G1Gw0v`})]}),t[8]=y):y=t[8];let b;t[9]===v?b=t[10]:(b=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[v,y]}),t[9]=v,t[10]=b);let x;t[11]===g?x=t[12]:(x=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:g.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:g.map(e=>(0,Z.jsx)(ea,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Hi,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=g,t[12]=x);let S;t[13]!==b||t[14]!==x?(S=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[b,x]}),t[13]=b,t[14]=x,t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e||c(null)},t[16]=C):C=t[16];let w;t[17]!==o||t[18]!==n||t[19]!==i?(w=(0,Z.jsx)(Ba,{folderPath:n,template:o,onOpenChange:C,onSaved:i}),t[17]=o,t[18]=n,t[19]=i,t[20]=w):w=t[20];let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||u(null)},t[21]=T):T=t[21];let E;t[22]!==l||t[23]!==i?(E=(0,Z.jsx)(Ei,{template:l,onOpenChange:T,onDeleted:i}),t[22]=l,t[23]=i,t[24]=E):E=t[24];let D;t[25]===g?D=t[26]:(D=new Set(g.map(fC)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(Xi,{folderPath:n,existingNames:D,open:p,onOpenChange:m,onCreated:i}),t[27]=n,t[28]=p,t[29]=i,t[30]=D,t[31]=O):O=t[31];let k=d!==null,A;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||f(null)},t[32]=A):A=t[32];let j=d??void 0,M;t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j?(M=(0,Z.jsx)(zh,{open:k,onOpenChange:A,kind:`file`,initialDir:n,initialTemplate:j,folderConfig:a}),t[33]=a,t[34]=n,t[35]=k,t[36]=j,t[37]=M):M=t[37];let N;return t[38]!==E||t[39]!==O||t[40]!==M||t[41]!==S||t[42]!==w?(N=(0,Z.jsxs)(Z.Fragment,{children:[S,w,E,O,M]}),t[38]=E,t[39]=O,t[40]=M,t[41]=S,t[42]=w,t[43]=N):N=t[43],N}function fC(e){return e.name}function pC(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=oi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=oi(`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 mC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`[&_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 hC(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=oi(`[&_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 gC(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=oi(`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 _C(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=oi(`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 vC(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=oi(`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 yC(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 bC(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 xC(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)(ft,{className:`ml-1 size-3`}):(0,Z.jsx)(Qe,{className:`ml-1 size-3`}):(0,Z.jsx)(el,{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)(ci,{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 SC(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=rs(),d=Di(n),{state:f,refresh:p}=d,[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(`name`),[v,y]=(0,Q.useState)(`asc`);if(o){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)(za,{className:`size-5 rounded`}),(0,Z.jsx)(za,{className:`h-7 w-48`})]}),(0,Z.jsx)(za,{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)(za,{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)(za,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(TC)]})]}),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 b,x,S,C,w,T,E,D,O,k,A;if(t[7]!==r||t[8]!==f||t[9]!==d||t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==l||t[14]!==c||t[15]!==p||t[16]!==v||t[17]!==g){let e=uC(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=bC(e.children,g,v),o=e.title||(n===``?r({id:`3aeN7X`}):e.title),m;t[29]===g?m=t[30]:(m=function(e){e===g?y(wC):(_(e),y(`asc`))},t[29]=g,t[30]=m);let j=m;A=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,T=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(re,{className:`size-5 text-muted-foreground`}),t[31]=M):M=t[31];let N=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[M,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:o})]}),P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(ci,{onClick:()=>h(!0),children:[(0,Z.jsx)(V,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[32]=P):P=t[32],t[33]===N?E=t[34]:(E=(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:[N,P]})}),t[33]=N,t[34]=E),t[35]!==f||t[36]!==n||t[37]!==p?(D=(0,Z.jsx)(QS,{folderPath:n,state:f,onChange:p}),t[35]=f,t[36]=n,t[37]=p,t[38]=D):D=t[38],t[39]!==f||t[40]!==d||t[41]!==n||t[42]!==p?(O=(0,Z.jsx)(dC,{folderPath:n,state:f,onChange:p,folderConfigHandle:d}),t[39]=f,t[40]=d,t[41]=n,t[42]=p,t[43]=O):O=t[43],t[44]===n?k=t[45]:(k=(0,Z.jsx)(aC,{folderPath:n}),t[44]=n,t[45]=k),w=`rounded-lg border`,x=pC;let F=g===`name`?v===`asc`?`ascending`:`descending`:`none`,I;t[46]===r?I=t[47]:(I=r({id:`6YtxFj`}),t[46]=r,t[47]=I);let L;t[48]!==j||t[49]!==v||t[50]!==g||t[51]!==I?(L=(0,Z.jsx)(xC,{label:I,sortKey:`name`,activeKey:g,activeDir:v,onSort:j}),t[48]=j,t[49]=v,t[50]=g,t[51]=I,t[52]=L):L=t[52];let R;t[53]!==F||t[54]!==L?(R=(0,Z.jsx)(_C,{"aria-sort":F,children:L}),t[53]=F,t[54]=L,t[55]=R):R=t[55];let z=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,B;t[56]===r?B=t[57]:(B=r({id:`tgWuMB`}),t[56]=r,t[57]=B);let H;t[58]!==j||t[59]!==v||t[60]!==g||t[61]!==B?(H=(0,Z.jsx)(xC,{label:B,sortKey:`modified`,activeKey:g,activeDir:v,onSort:j}),t[58]=j,t[59]=v,t[60]=g,t[61]=B,t[62]=H):H=t[62];let U;t[63]!==z||t[64]!==H?(U=(0,Z.jsx)(_C,{className:`w-32`,"aria-sort":z,children:H}),t[63]=z,t[64]=H,t[65]=U):U=t[65],t[66]!==R||t[67]!==U?(C=(0,Z.jsx)(mC,{children:(0,Z.jsxs)(gC,{children:[R,U]})}),t[66]=R,t[67]=U,t[68]=C):C=t[68],b=hC,S=i.length?i.map(CC):(0,Z.jsx)(gC,{children:(0,Z.jsx)(vC,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Pkw7J9`})})}),t[7]=r,t[8]=f,t[9]=d,t[10]=n,t[11]=a,t[12]=u,t[13]=l,t[14]=c,t[15]=p,t[16]=v,t[17]=g,t[18]=b,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k,t[28]=A}else b=t[18],x=t[19],S=t[20],C=t[21],w=t[22],T=t[23],E=t[24],D=t[25],O=t[26],k=t[27],A=t[28];let j;t[69]!==b||t[70]!==S?(j=(0,Z.jsx)(b,{children:S}),t[69]=b,t[70]=S,t[71]=j):j=t[71];let M;t[72]!==x||t[73]!==j||t[74]!==C?(M=(0,Z.jsxs)(x,{children:[C,j]}),t[72]=x,t[73]=j,t[74]=C,t[75]=M):M=t[75];let N;t[76]!==M||t[77]!==w?(N=(0,Z.jsx)(`div`,{className:w,children:M}),t[76]=M,t[77]=w,t[78]=N):N=t[78];let P;t[79]!==N||t[80]!==T||t[81]!==E||t[82]!==D||t[83]!==O||t[84]!==k?(P=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,k,N]}),t[79]=N,t[80]=T,t[81]=E,t[82]=D,t[83]=O,t[84]=k,t[85]=P):P=t[85];let F;t[86]!==P||t[87]!==A?(F=(0,Z.jsx)(`div`,{className:A,children:P}),t[86]=P,t[87]=A,t[88]=F):F=t[88];let I;t[89]!==m||t[90]!==d||t[91]!==n?(I=(0,Z.jsx)(zh,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[89]=m,t[90]=d,t[91]=n,t[92]=I):I=t[92];let L;return t[93]!==F||t[94]!==I?(L=(0,Z.jsxs)(Z.Fragment,{children:[F,I]}),t[93]=F,t[94]=I,t[95]=L):L=t[95],L}function CC(e){return(0,Z.jsxs)(gC,{children:[(0,Z.jsx)(vC,{children:(0,Z.jsxs)(`a`,{href:Vo(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)(wl,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(u,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(vC,{className:`text-muted-foreground`,children:e.kind===`file`?yC(e.modified):`—`})]},e.path)}function wC(e){return e===`asc`?`desc`:`asc`}function TC(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)(za,{className:`size-4 rounded`}),(0,Z.jsx)(za,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(za,{className:`h-4 w-16`})})]},e)}function EC(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?c.current?.focus():l.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(vl,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(s,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]===p?h=t[6]:(h=(0,Z.jsx)(`h2`,{ref:l,id:`large-file-title`,tabIndex:p,className:`text-2xl font-light text-balance outline-none`,children:m}),t[5]=p,t[6]=h);let g;t[7]===r?g=t[8]:(g=Xr(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Xr(i),t[9]=i,t[10]=_);let v;t[11]!==n||t[12]!==g||t[13]!==_?(v=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_GBioJ`,values:{0:g,1:_,docName:n}})}),t[11]=n,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,v]}),t[15]=h,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==a||t[19]!==o?(b=o?(0,Z.jsxs)(ci,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(gi,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(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:[f,y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function DC(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(OC),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ct(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 c;t[2]===n?c=t[3]:(c=function(){C(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]=c);let l=c,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A67Uwj`})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(s,{id:`dEgA5A`}),t[5]=d):d=t[5];let f;return t[6]===l?f=t[7]:(f=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[u,(0,Z.jsx)(ci,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:l,children:d})]}),t[6]=l,t[7]=f),f}function OC(){return new Set}var kC=(0,Q.createContext)(null);function AC(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(jC),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>{i(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},t[0]=a):a=t[0];let o=a,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{i(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},t[1]=s):s=t[1];let c=s,l;t[2]===r?l=t[3]:(l={addPropertySignal:r,requestAddProperty:o,clearAddProperty:c},t[2]=r,t[3]=l);let u=l,d;return t[4]!==n||t[5]!==u?(d=(0,Z.jsx)(kC,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function jC(){return new Map}function MC(){let e=(0,Q.use)(kC);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function NC(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var PC=NC(()=>n(()=>import(`./SettingsDialogBody-cJG0IN1L.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([52,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,53,7,13,15,25,54]),import.meta.url));function FC(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=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]=a):a=t[2];let o=a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(s,{id:`hwFOFD`})}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:o})]}),t[4]=o,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ci,{variant:`default`,onClick:IC,children:(0,Z.jsx)(s,{id:`HpK_8d`})}),t[6]=u):u=t[6];let d;return t[7]===l?d=t[8]:(d=(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:[l,u]}),t[7]=l,t[8]=d),d}function IC(){return window.location.reload()}function LC(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(ce,{fallbackRender:zC,onError:RC,children:n}),t[0]=n,t[1]=r),r}function RC(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function zC(e){return(0,Z.jsx)(FC,{...e})}function BC(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function VC(e){let t=(0,$.c)(89),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=mt(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=ae(),{desktopPresent:f}=Mi(),[p,m]=(0,Q.useState)(`preferences`),h,g;t[0]===n?(h=t[1],g=t[2]):(h=()=>{n&&m(`preferences`)},g=[n],t[0]=n,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=o!==null,v=typeof window<`u`&&window.okDesktop!=null,y;t[3]===a?y=t[4]:(y=a({id:`7PzzBU`}),t[3]=a,t[4]=y);let b;t[5]===a?b=t[6]:(b=a({id:`Q6hhn8`}),t[5]=a,t[6]=b);let x;t[7]===b?x=t[8]:(x={id:`preferences`,label:b},t[7]=b,t[8]=x);let S;t[9]===a?S=t[10]:(S=a({id:`4KmEoC`}),t[9]=a,t[10]=S);let C;t[11]===S?C=t[12]:(C={id:`hotkeys`,label:S},t[11]=S,t[12]=C);let w;t[13]===a?w=t[14]:(w=a({id:`AeXO77`}),t[13]=a,t[14]=w);let T;t[15]===w?T=t[16]:(T={id:`account`,label:w},t[15]=w,t[16]=T);let E;t[17]!==x||t[18]!==C||t[19]!==T?(E=[x,C,T],t[17]=x,t[18]=C,t[19]=T,t[20]=E):E=t[20];let D;t[21]!==E||t[22]!==y?(D={id:`user`,label:y,enabled:!0,items:E},t[21]=E,t[22]=y,t[23]=D):D=t[23];let O;t[24]===a?O=t[25]:(O=a({id:`ZWyHmq`}),t[24]=a,t[25]=O);let k;t[26]===a?k=t[27]:(k=a({id:`Nu4DdT`}),t[26]=a,t[27]=k);let A;t[28]===k?A=t[29]:(A={id:`sync`,label:k},t[28]=k,t[29]=A);let j;t[30]===a?j=t[31]:(j=a({id:`A1taO8`}),t[30]=a,t[31]=j);let M;t[32]===j?M=t[33]:(M={id:`search`,label:j},t[32]=j,t[33]=M);let N;t[34]===a?N=t[35]:(N=v?[{id:`terminal`,label:a({id:`ALhMYW`})}]:[],t[34]=a,t[35]=N);let P;t[36]===a?P=t[37]:(P=a({id:`iTylMl`}),t[36]=a,t[37]=P);let F;t[38]===P?F=t[39]:(F={id:`project-templates`,label:P},t[38]=P,t[39]=F);let I;t[40]===a?I=t[41]:(I=a({id:`3zyg_A`}),t[40]=a,t[41]=I);let L;t[42]===I?L=t[43]:(L={id:`okignore`,label:I},t[42]=I,t[43]=L);let R;t[44]===a?R=t[45]:(R=a({id:`cs4mps`}),t[44]=a,t[45]=R);let z;t[46]===R?z=t[47]:(z={id:`sharing`,label:R},t[46]=R,t[47]=z);let B;t[48]!==A||t[49]!==M||t[50]!==N||t[51]!==F||t[52]!==L||t[53]!==z?(B=[A,M,...N,F,L,z],t[48]=A,t[49]=M,t[50]=N,t[51]=F,t[52]=L,t[53]=z,t[54]=B):B=t[54];let V;t[55]!==_||t[56]!==O||t[57]!==B?(V={id:`project`,label:O,enabled:_,items:B},t[55]=_,t[56]=O,t[57]=B,t[58]=V):V=t[58];let H;t[59]===a?H=t[60]:(H=a({id:`nbfdhU`}),t[59]=a,t[60]=H);let U;t[61]!==a||t[62]!==f?(U=[],t[61]=a,t[62]=f,t[63]=U):U=t[63];let W;t[64]!==H||t[65]!==U?(W={id:`integrations`,label:H,enabled:!0,items:U},t[64]=H,t[65]=U,t[66]=W):W=t[66];let G;t[67]!==D||t[68]!==V||t[69]!==W?(G=[D,V,W],t[67]=D,t[68]=V,t[69]=W,t[70]=G):G=t[70];let K=G,q;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Co,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[71]=q):q=t[71];let J;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(So,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[72]=J):J=t[72];let ee;t[73]!==p||t[74]!==K?(ee=(0,Z.jsx)(HC,{groups:K,activeId:p,onSelect:m}),t[73]=p,t[74]=K,t[75]=ee):ee=t[75];let Y;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(GC,{}),t[76]=Y):Y=t[76];let te=l?c:null,ne;t[77]!==p||t[78]!==u||t[79]!==d||t[80]!==te?(ne=(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)(LC,{children:(0,Z.jsx)(Q.Suspense,{fallback:Y,children:(0,Z.jsx)(PC,{activeId:p,userBinding:te,okignoreBinding:u,okignoreSynced:d})})})}),t[77]=p,t[78]=u,t[79]=d,t[80]=te,t[81]=ne):ne=t[81];let X;t[82]!==ee||t[83]!==ne?(X=(0,Z.jsxs)(wo,{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:[q,J,ee,ne]}),t[82]=ee,t[83]=ne,t[84]=X):X=t[84];let re;return t[85]!==r||t[86]!==n||t[87]!==X?(re=(0,Z.jsx)(Oo,{open:n,onOpenChange:r,children:X}),t[85]=r,t[86]=n,t[87]=X,t[88]=re):re=t[88],re}function HC(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:a}=e,{_:o}=i(),s;t[0]===o?s=t[1]:(s=o({id:`y1t8bQ`}),t[0]=o,t[1]=s);let c;if(t[2]!==r||t[3]!==n||t[4]!==a){let e;t[6]!==r||t[7]!==a?(e=e=>(0,Z.jsx)(WC,{group:e,activeId:r,onSelect:a},e.id),t[6]=r,t[7]=a,t[8]=e):e=t[8],c=n.map(e),t[2]=r,t[3]=n,t[4]=a,t[5]=c}else c=t[5];let l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(UC,{}),t[9]=l):l=t[9];let u;return t[10]!==s||t[11]!==c?(u=(0,Z.jsxs)(`nav`,{"aria-label":s,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:[c,l]}),t[10]=s,t[11]=c,t[12]=u):u=t[12],u}function UC(){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=BC(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 c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(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:oi(`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)(s,{id:`_PACVa`}),(0,Z.jsx)(vo,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function WC(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`,c=n.enabled?void 0:o,l=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,u;t[0]===l?u=t[1]:(u=oi(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,l),t[0]=l,t[1]=u);let d;t[2]!==n.label||t[3]!==a||t[4]!==c||t[5]!==u?(d=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":c,className:u,children:n.label}),t[2]=n.label,t[3]=a,t[4]=c,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.enabled?(f=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)(s,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=f):f=t[9];let p;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:oi(`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],p=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=p}else p=t[15];let m;t[21]!==a||t[22]!==p?(m=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:p}),t[21]=a,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==d||t[25]!==f||t[26]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[d,f,m]}),t[24]=d,t[25]=f,t[26]=m,t[27]=h):h=t[27],h}function GC(){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)(s,{id:`GsBUCk`})}),n=(0,Z.jsx)(za,{className:`h-5 w-32`}),r=(0,Z.jsx)(za,{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)(za,{className:`h-9 w-full`}),(0,Z.jsx)(za,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function KC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`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)(bx,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qC(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)(Cx,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function JC(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=oi(`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)(Dx,{"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 YC(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=oi(`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 XC=ii(`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 ZC(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=oi(XC({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:QC,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function QC(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}ii(`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 $C(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`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 ew(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=oi(`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)(jo,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tw(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:a,replaceOpen:o,caseSensitive:c,wholeWord:l,current:u,total:d,onQueryChange:f,onReplacementChange:p,onReplaceOpenChange:m,onCaseSensitiveChange:h,onWholeWordChange:g,onNext:_,onPrevious:v,onReplaceCurrent:y,onReplaceAll:b,onClose:x}=e,{_:S}=i(),C=r.length>0,w=d>0,T;t[0]!==S||t[1]!==u||t[2]!==w||t[3]!==C||t[4]!==d?(T=C?w?`${u} / ${d}`:S({id:`Ev2r9A`}):``,t[0]=S,t[1]=u,t[2]=w,t[3]=C,t[4]=d,t[5]=T):T=t[5];let E=T,D;t[6]!==x||t[7]!==_||t[8]!==v?(D=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?v():_()):e.key===`Escape`&&(e.preventDefault(),x())},t[6]=x,t[7]=_,t[8]=v,t[9]=D):D=t[9];let O=D,k;t[10]!==x||t[11]!==y?(k=function(e){e.key===`Enter`?(e.preventDefault(),y()):e.key===`Escape`&&(e.preventDefault(),x())},t[10]=x,t[11]=y,t[12]=k):k=t[12];let A=k,j;t[13]===S?j=t[14]:(j=S({id:`MVxpbf`}),t[13]=S,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(s,{id:`KujtjC`})}),t[15]=M):M=t[15];let N;t[16]===f?N=t[17]:(N=e=>f(e.target.value),t[16]=f,t[17]=N);let P;t[18]===S?P=t[19]:(P=S({id:`KujtjC`}),t[18]=S,t[19]=P);let F;t[20]!==n||t[21]!==O||t[22]!==r||t[23]!==N||t[24]!==P?(F=(0,Z.jsx)(ew,{ref:n,id:`ok-find-input`,value:r,onChange:N,onKeyDown:O,placeholder:P,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=O,t[22]=r,t[23]=N,t[24]=P,t[25]=F):F=t[25];let I;t[26]===S?I=t[27]:(I=S({id:`-8PP0T`}),t[26]=S,t[27]=I);let L;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(ol,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(bo,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":I,pressed:c,onPressedChange:h,className:`size-6 min-w-6 px-0`,children:L})}),t[29]=c,t[30]=h,t[31]=I,t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`-8PP0T`})}),t[33]=z):z=t[33];let B;t[34]===R?B=t[35]:(B=(0,Z.jsxs)(Is,{children:[R,z]}),t[34]=R,t[35]=B);let V;t[36]===S?V=t[37]:(V=S({id:`_7UQ7y`}),t[36]=S,t[37]=V);let H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(gu,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(bo,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":V,pressed:l,onPressedChange:g,className:`size-6 min-w-6 px-0`,children:H})}),t[39]=g,t[40]=V,t[41]=l,t[42]=U):U=t[42];let W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`_7UQ7y`})}),t[43]=W):W=t[43];let G;t[44]===U?G=t[45]:(G=(0,Z.jsxs)(Is,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(ZC,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=K):K=t[48];let q;t[49]!==K||t[50]!==F?(q=(0,Z.jsxs)(YC,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,K]}),t[49]=K,t[50]=F,t[51]=q):q=t[51];let J;t[52]===E?J=t[53]:(J=(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:E}),t[52]=E,t[53]=J);let ee;t[54]===S?ee=t[55]:(ee=S({id:`oqB2ez`}),t[54]=S,t[55]=ee);let Y=!w,te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(It,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=te):te=t[56];let ne;t[57]!==v||t[58]!==ee||t[59]!==Y?(ne=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:Y,onClick:v,children:te})}),t[57]=v,t[58]=ee,t[59]=Y,t[60]=ne):ne=t[60];let X;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=X):X=t[61];let re;t[62]===ne?re=t[63]:(re=(0,Z.jsxs)(Is,{children:[ne,X]}),t[62]=ne,t[63]=re);let ie;t[64]===S?ie=t[65]:(ie=S({id:`SiUUCS`}),t[64]=S,t[65]=ie);let ae=!w,oe;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Ve,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=oe):oe=t[66];let se;t[67]!==_||t[68]!==ie||t[69]!==ae?(se=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ie,disabled:ae,onClick:_,children:oe})}),t[67]=_,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)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=ce):ce=t[71];let le;t[72]===se?le=t[73]:(le=(0,Z.jsxs)(Is,{children:[se,ce]}),t[72]=se,t[73]=le);let ue=o?`secondary`:`ghost`,de;t[74]!==S||t[75]!==o?(de=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=de):de=t[76];let fe=o?`ok-replace-input`:void 0,pe;t[77]!==m||t[78]!==o?(pe=()=>m(!o),t[77]=m,t[78]=o,t[79]=pe):pe=t[79];let me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(Yl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=me):me=t[80];let he;t[81]!==o||t[82]!==ue||t[83]!==de||t[84]!==fe||t[85]!==pe?(he=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:ue,size:`icon-sm`,"aria-label":de,"aria-expanded":o,"aria-controls":fe,onClick:pe,children:me})}),t[81]=o,t[82]=ue,t[83]=de,t[84]=fe,t[85]=pe,t[86]=he):he=t[86];let ge;t[87]===o?ge=t[88]:(ge=(0,Z.jsx)(Ns,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=ge);let _e;t[89]!==he||t[90]!==ge?(_e=(0,Z.jsxs)(Is,{children:[he,ge]}),t[89]=he,t[90]=ge,t[91]=_e):_e=t[91];let ve;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(ve=o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(s,{id:`fqSfXY`})}),(0,Z.jsx)(jo,{id:`ok-replace-input`,value:a,onChange:e=>p(e.target.value),onKeyDown:A,placeholder:S({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)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Yl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Jl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`dr1vFs`})})]})]}):null,t[92]=S,t[93]=A,t[94]=w,t[95]=b,t[96]=y,t[97]=p,t[98]=o,t[99]=a,t[100]=ve):ve=t[100];let ye;t[101]===S?ye=t[102]:(ye=S({id:`wJo9oS`}),t[101]=S,t[102]=ye);let be;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(gs,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=be):be=t[103];let xe;t[104]!==x||t[105]!==ye?(xe=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ye,onClick:x,children:be})}),t[104]=x,t[105]=ye,t[106]=xe):xe=t[106];let Se;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Se):Se=t[107];let Ce;t[108]===xe?Ce=t[109]:(Ce=(0,Z.jsxs)(Is,{children:[xe,Se]}),t[108]=xe,t[109]=Ce);let we;return t[110]!==q||t[111]!==J||t[112]!==re||t[113]!==le||t[114]!==j||t[115]!==_e||t[116]!==ve||t[117]!==Ce?(we=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":j,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:[M,q,J,re,le,_e,ve,Ce]}),t[110]=q,t[111]=J,t[112]=re,t[113]=le,t[114]=j,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var nw={current:0,total:0},rw=120,iw=100;function aw(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?q(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(E,n,ow)}function ow(){return null}function sw(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
25
25
  `,`
26
26
  `).trim();return i.length===0||i.length>rw||i.includes(`
27
27
  `)?null:i}function cw(e){let t=ze(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function lw(e,t){return e.current===t.current&&e.total===t.total}function uw(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(nw)}function dw(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=w(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 fw(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=aw(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)(nw),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(mw))},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(pw)},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(nw);return}if(!u.open||r){i.commands.clearFindMatches(),p(nw);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=cw(i);p(t=>lw(t,e)?t:e)},iw);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=ze(i.state),t=cw(i);p(e=>lw(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=sw(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(nc(t,`find`)){t.preventDefault(),u.open?uw(i,d,p):e(!1);return}if(nc(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=nc(t,`find-next`),n=nc(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&dw(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),uw(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=ze(i.state),t=cw(i);p(e=>lw(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(){uw(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()&&dw(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()&&dw(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)&&dw(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)&&dw(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,q,J;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})),q=e=>d(t=>({...t,caseSensitive:e})),J=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=q,t[67]=J):(W=t[63],G=t[64],K=t[65],q=t[66],J=t[67]);let ee;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?(ee=(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)(tw,{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:q,onWholeWordChange:J,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]=ee):ee=t[80],ee}function pw(e){return{...e,open:!1,activeIndex:0}}function mw(e){return{...e,activeIndex:0}}var hw=300;function gw(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Tc),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Tc);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Ac(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,hw)};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 _w(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function vw(e){let t=(0,$.c)(8),{poolEntries:n}=mt(),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=()=>_w(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(_w(i));let t=()=>s(_w(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 yw(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>Mc(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(Nc,r)}var bw=`ok-doc-panel-width-v1`;function xw(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function Sw(e){try{let t=(e??localStorage).getItem(bw);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?xw(n):320}catch{return 320}}function Cw(e,t){try{(t??localStorage).setItem(bw,String(xw(e)))}catch{}}function ww(){try{return typeof localStorage>`u`?320:Sw()}catch{return 320}}var Tw=1024,Ew=1280,Dw={left:Tw,right:Ew};function Ow(e,t,n){return e==null?t>=Dw[n]?`above`:`below`:`embedded`}function kw(e){return e===`above`?`open`:`collapsed`}var Aw=`ok-sidebar-pins-v2`;function jw(e){return e===`open`||e===`collapsed`}function Mw(e){return e===`above`||e===`below`||e===`embedded`}function Nw(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!Mw(e)||!jw(t[e]))return!1;return!0}function Pw(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return Nw(n.left)&&(r.left=n.left),Nw(n.right)&&(r.right=n.right),r}function Fw(e){try{let t=(e??localStorage).getItem(Aw);return t==null?{}:Pw(t)}catch{return{}}}function Iw(e,t){try{t.setItem(Aw,JSON.stringify(e))}catch{}}function Lw(e,t,n){return n[e]?.[t]??kw(t)}function Rw(e,t,n,r){let i=r??localStorage,a=Fw(i);return a[e]={...a[e],[t]:n},Iw(a,i),a}function zw(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`?Bw: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 Bw(e){return e===`synced`?`synced`:`connected`}var Vw=Tr;function Hw(e,t={}){let n=De(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var Uw=200,Ww=`Outside any block`;function Gw(e){let t=(0,$.c)(5),{editor:n}=e,r=Gt(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?Kw(n,r):o.current?Ww:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},Uw),()=>{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 Kw(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=Hw(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=Hw(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 qw(){let[e]=(0,Q.useState)(Fr);return e}function Jw({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:yr(e.display_name),color:Kn(e.id,Nn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Kn(e.id,Nn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function Yw(e,t){return e>t}function Xw(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 Zw=3,Qw=6e4;function $w(e,t){let n=0;for(let r of e)t-r<Qw&&(n+=1);return n<Zw}var eT=new Map;function tT(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 nT(e){let t=Ot.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function rT(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=Ot.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){le.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=>{Yw(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!Yw(i,a)||l!==null&&nT(l.state))return;o=!0;let e=Date.now();for(let[t,n]of eT)n.every(t=>e-t>=Qw)&&eT.delete(t);let t=(eT.get(n)??[]).filter(t=>e-t<Qw);if(!$w(t,e)){eT.set(n,t),le.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),eT.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,le.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==Ot&&tT(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new Vn({state:{init:()=>null,apply:e=>(Xw(e.getMeta(Ot))&&(a=i,o&&le.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!Yw(i,a)||nT(t)?!0:e.getMeta(Ot)!==void 0,view:e=>{let r=t.doc;return r==null?(le.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 iT(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 aT=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&&Rn(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(Ms(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Rs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ts(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ls(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(zs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ds(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(As(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ks(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=qn(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof or){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 wr){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():iT(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Ps(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()}},oT=e=>new Vn({key:typeof e.pluginKey==`string`?new Gn(e.pluginKey):e.pluginKey,view:t=>new aT({view:t,...e})});rr.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[oT({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 sT=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 jn(e,{textSerializers:jr(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Ms(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Rs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ts(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ls(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(zs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ds(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(As(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ks(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=qn(this.view,e.from,e.to);Ps({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()}},cT=e=>new Vn({key:typeof e.pluginKey==`string`?new Gn(e.pluginKey):e.pluginKey,view:t=>new sT({view:t,...e})});rr.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?[cT({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 lT(e,t){return e??new Gn(t)}var uT=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,dT=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),fT=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(`.`)),pT=new Set([`children`,`className`,`style`]),mT=new Set([`tabIndex`]),hT=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),gT={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function _T(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function vT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function yT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||hT.has(e)}function bT(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function xT(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:gT[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function ST(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 CT(e){return mT.has(e)}function wT(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function TT(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 ET(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||fT.has(e)?String(t):`${t}px`}function DT(e,t){dT.has(t)||e.style.removeProperty(bT(t))}function OT(e,t,n){dT.has(t)||e.style.setProperty(bT(t),ET(t,n))}function kT(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(pT.has(r)||!yT(r)||_T(r,t[r])||_T(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=vT(r);if(a==null||a===!1){CT(r)&&TT(e,r),e.removeAttribute(o);return}if(a===!0){CT(r)&&wT(e,r,!0),e.setAttribute(o,``);return}if(CT(r)){wT(e,r,a);return}e.setAttribute(o,String(a))})}function AT(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function jT(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){DT(e,t);return}OT(e,t,a)}})}function MT(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(!_T(t,n))return;let{eventName:i,options:a}=xT(t),o=t=>{n(ST(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function NT(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);uT(()=>{let i=n.current;return AT(e,i.className,t.className),jT(e,i.style,t.style),kT(e,i,t),r.current=MT(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 PT=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)(lT(e,`bubbleMenu`)).current;NT(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Kt(),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=oT({...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,rl.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)(lT(e,`floatingMenu`)).current;NT(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Kt(),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=cT({...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,rl.createPortal)(s,u.current)});var FT=[{name:`paragraph`,label:`Text`,icon:Wl,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Te,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:F,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:Tt,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:ge,isActive:e=>e.isActive(`list`,{ordered:!1})&&!e.isActive(`listItem`,{checked:!0})&&!e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleBulletList().run()},{name:`orderedList`,label:`Ordered List`,icon:me,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:k,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:M,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:tu,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function IT(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:LT},t[0]=n,t[1]=r);let{current:i,activeStates:a}=Ie(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)(Ve,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`sm`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[s,c,l]})}),t[7]=s,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n?(d=FT.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Ea,{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)(eo,{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)(ao,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function LT(e){let t=Object.fromEntries(FT.map(t=>[t.name,t.isActive(e.editor)]));return{current:FT.find(e=>t[e.name])??FT[0],activeStates:t}}function RT(e){let t=(0,$.c)(17),{installStates:n,onPick:r}=e,{_:a}=i(),[o,c]=(0,Q.useState)(``),l;if(t[0]!==a||t[1]!==n||t[2]!==o||t[3]!==r){let e;t[5]===n?e=t[6]:(e=e=>n[e.id]?.installed===!0,t[5]=n,t[6]=e);let i=_g.filter(e),u=_g.some(e=>n[e.id]?.installed==null),d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`font-mono text-xs uppercase tracking-wide text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EVnzPs`})}),t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>c(e.target.value),t[8]=f):f=t[8];let p;t[9]===a?p=t[10]:(p=a({id:`Rah7yq`}),t[9]=a,t[10]=p);let m;t[11]===a?m=t[12]:(m=a({id:`ZBt4rI`}),t[11]=a,t[12]=m);let h;t[13]!==o||t[14]!==p||t[15]!==m?(h=(0,Z.jsx)(jo,{value:o,onChange:f,placeholder:p,"aria-label":m,"data-testid":`edit-with-ai-instruction`}),t[13]=o,t[14]=p,t[15]=m,t[16]=h):h=t[16],l=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,h,i.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,"data-testid":`edit-with-ai-send-label`,children:(0,Z.jsx)(s,{id:`C37Zkt`})}),(0,Z.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:i.map(e=>(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,"data-testid":`edit-with-ai-target-${e.id}`,onClick:()=>r(e,o),children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:e.displayName})]},e.id))})]}):(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`edit-with-ai-empty`,"aria-live":`polite`,children:u?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=a,t[1]=n,t[2]=o,t[3]=r,t[4]=l}else l=t[4];return l}function zT(e){let t=(0,$.c)(27),{open:n,onOpenChange:r,snapshot:a,children:o}=e,{_:s}=i(),{states:c,refresh:l}=O_(),{dispatch:u}=__(),d;t[0]===l?d=t[1]:(d=()=>{l()},t[0]=l,t[1]=d);let f=(0,Q.useEffectEvent)(d),p;t[2]!==n||t[3]!==f?(p=()=>{n&&f()},t[2]=n,t[3]=f,t[4]=p):p=t[4];let m;t[5]===n?m=t[6]:(m=[n],t[5]=n,t[6]=m),(0,Q.useEffect)(p,m);let h;t[7]!==s||t[8]!==u||t[9]!==r||t[10]!==a?(h=(e,t)=>{if(a!==null){let n=o_({docName:a.docName,workspace:a.workspace,instruction:t,selectionMarkdown:a.selectionMarkdown});n===null?hs.error(s({id:`_VRtd7`})):u(e.id,n)}r(!1)},t[7]=s,t[8]=u,t[9]=r,t[10]=a,t[11]=h):h=t[11];let g=h,_;t[12]===o?_=t[13]:(_=(0,Z.jsx)(J,{asChild:!0,children:o}),t[12]=o,t[13]=_);let v;t[14]===s?v=t[15]:(v=s({id:`EVnzPs`}),t[14]=s,t[15]=v);let y;t[16]!==g||t[17]!==c?(y=(0,Z.jsx)(RT,{installStates:c,onPick:g}),t[16]=g,t[17]=c,t[18]=y):y=t[18];let x;t[19]!==v||t[20]!==y?(x=(0,Z.jsx)(b,{align:`start`,"aria-label":v,"data-testid":`edit-with-ai-popover`,children:y}),t[19]=v,t[20]=y,t[21]=x):x=t[21];let S;return t[22]!==r||t[23]!==n||t[24]!==_||t[25]!==x?(S=(0,Z.jsxs)(fe,{open:n,onOpenChange:r,children:[_,x]}),t[22]=r,t[23]=n,t[24]=_,t[25]=x,t[26]=S):S=t[26],S}function BT(e){let t=P(e.state.selection.content(),e.state.schema);return l().serialize(t).trim()}function VT(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function HT(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,a=er(),o=mg();if(!a||o)return null;let s;return t[0]!==n||t[1]!==i?(s=(0,Z.jsx)(UT,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=s):s=t[2],s}function UT(e){let t=(0,$.c)(19),{editor:n,shortcutEnabled:r}=e,{_:a}=i(),o=po(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f;if(t[0]!==a||t[1]!==n||t[2]!==o){let e=()=>{let e;try{e=BT(n)}catch(e){return console.error(`Edit with AI: could not read the selection`,e),hs.error(a({id:`-RXIMO`})),null}return{docName:bt(n),workspace:o,selectionMarkdown:e}};f=()=>{let t=e();t!==null&&(d(t),l(!0))},t[0]=a,t[1]=n,t[2]=o,t[3]=f}else f=t[3];let p=f,m;t[4]===p?m=t[5]:(m=e=>{if(e){p();return}l(!1),d(null)},t[4]=p,t[5]=m);let h=m,g;t[6]===p?g=t[7]:(g=()=>{p()},t[6]=p,t[7]=g);let _=(0,Q.useEffectEvent)(g),v;t[8]!==_||t[9]!==r?(v=()=>{let e=e=>{r&&nc(e,`edit-with-ai`)&&(VT(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[8]=_,t[9]=r,t[10]=v):v=t[10];let y;t[11]===r?y=t[12]:(y=[r],t[11]=r,t[12]=y),(0,Q.useEffect)(v,y);let b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ta,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[13]=b):b=t[13];let x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[(0,Z.jsx)(yi,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`EVnzPs`})})]}),t[14]=x):x=t[14];let S;return t[15]!==h||t[16]!==c||t[17]!==u?(S=(0,Z.jsxs)(Z.Fragment,{children:[b,(0,Z.jsx)(zT,{open:c,onOpenChange:h,snapshot:u,children:x})]}),t[15]=h,t[16]=c,t[17]=u,t[18]=S):S=t[18],S}function WT(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 GT(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:Pt(typeof n.src==`string`?n.src:``)}function KT(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 qT(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:JT},t[0]=n,t[1]=a),Ie(a)===null)return null;let o;t[2]===r?o=t[3]:(o=r({id:`WcWS__`}),t[2]=r,t[3]=o);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault();let t=WT(n);t&&KT(t,GT(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(to,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":o,className:`text-accent-foreground`,onMouseDown:c,children:l})}),t[7]=o,t[8]=c,t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`WcWS__`})}),t[10]=d):d=t[10];let f;return t[11]===u?f=t[12]:(f=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(Is,{children:[u,d]})}),t[11]=u,t[12]=f),f}function JT(e){return WT(e.editor)}function YT(e){return WT(e)!==null}function XT(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function ZT(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 QT(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function $T(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=i(),a;t[0]===n?a=t[1]:(a={editor:n,selector:eE},t[0]=n,t[1]=a);let o=Ie(a),s;t[2]!==o||t[3]!==n?(s=()=>{if(o||!XT(n)||n.state.selection.empty||QT(n)||ZT(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=Bn(Hn(n.state.doc)),a=Nr(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(a,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=o,t[3]=n,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=r({id:`sIGbBZ`}),t[5]=r,t[6]=l);let u;t[7]===c?u=t[8]:(u=e=>{e.preventDefault(),c()},t[7]=c,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(te,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=d):d=t[9];let f;t[10]!==o||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":l,onMouseDown:u,disabled:o,children:d})}),t[10]=o,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===r?p=t[15]:(p=r({id:`sIGbBZ`}),t[14]=r,t[15]=p);let m;t[16]===p?m=t[17]:(m=(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:p}),t[16]=p,t[17]=m);let h;return t[18]!==f||t[19]!==m?(h=(0,Z.jsxs)(Is,{children:[f,m]}),t[18]=f,t[19]=m,t[20]=h):h=t[20],h}function eE(e){let t=e.editor;return!!(!XT(t)||t.state.selection.empty||QT(t)||ZT(t))}var tE=`img, .ok-embed, .ok-video`,nE=220,rE=`cubic-bezier(0.23, 1, 0.32, 1)`,iE=`ok-image-align-flip`,aE=.5;function oE(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function sE(){return typeof requestAnimationFrame==`function`}function cE(e){return e?e.querySelector(tE):null}function lE(e,t){if(oE()||!sE()){t();return}let n=cE(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=cE(e);if(!t)return;for(let e of t.getAnimations())e.id===iE&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<aE)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:nE,easing:rE,fill:`none`});i.id=iE})}var uE=[{value:`left`,label:`Align left`,icon:du},{value:`center`,label:`Align center`,icon:lu},{value:`right`,label:`Align right`,icon:uu}];function dE(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Rt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function fE(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:pE},t[0]=n,t[1]=r);let i=Ie(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=uE.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(!Rt.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(or.create(u.doc,s)),lE(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{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 pE(e){return dE(e.editor)}function mE(e){return dE(e)!==null}var hE=[{name:`bold`,icon:nl,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:kl,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:pu,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:ou,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:yt,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Dl,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function gE(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:_E},t[0]=n,t[1]=r);let i=Ie(r),a;t[2]!==i||t[3]!==n?(a=hE.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":e.name,className:r?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:t=>{t.preventDefault(),e.command(n)},children:(0,Z.jsx)(t,{className:`size-3.5`})})}),(0,Z.jsxs)(Ns,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(Jt,{"aria-label":rc(e.shortcutId),children:tc(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 _E(e){return Object.fromEntries(hE.map(t=>[t.name,t.isActive(e.editor)]))}function vE(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:p,pages:m}=rs(),h;t[0]===n?h=t[1]:(h=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=h);let g=h,v;t[2]===n?v=t[3]:(v=n.getAttributes(`link`).href??``,t[2]=n,t[3]=v);let y=v,b;t[4]===n?b=t[5]:(b=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=b);let x=b,S,C;t[6]===n?(S=t[7],C=t[8]):(S=()=>{let e=function(){n.state.selection.empty&&o(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},C=[n],t[6]=n,t[7]=S,t[8]=C),(0,Q.useEffect)(S,C);let w,T;t[9]===a?(w=t[10],T=t[11]):(w=()=>{a&&requestAnimationFrame(()=>u.current?.focus())},T=[a],t[9]=a,t[10]=w,t[11]=T),(0,Q.useEffect)(w,T);let E;t[12]!==n||t[13]!==g||t[14]!==c?(E=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():g&&n.chain().focus().unsetLink().run(),o(!1)},t[12]=n,t[13]=g,t[14]=c,t[15]=E):E=t[15];let D=E,O;t[16]===n?O=t[17]:(O=function(){n.chain().focus().unsetLink().run(),o(!1)},t[16]=n,t[17]=O);let k=O,A;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(ot(e.path,null))},t[18]=A):A=t[18];let j=A,M;t[19]!==D||t[20]!==n?(M=function(e){e.key===`Enter`&&(e.preventDefault(),D()),e.key===`Escape`&&(e.preventDefault(),o(!1),n.chain().focus().run())},t[19]=D,t[20]=n,t[21]=M):M=t[21];let N=M;if(a){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]!==d||t[27]!==N||t[28]!==p||t[29]!==m||t[30]!==e||t[31]!==n||t[32]!==c?(i=(0,Z.jsx)(_,{ref:u,type:`text`,placeholder:e,value:c,pages:m,folderPaths:d,loading:p,onValueChange:l,onSuggestionSelect:j,onKeyDown:N,"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]=d,t[27]=N,t[28]=p,t[29]=m,t[30]=e,t[31]=n,t[32]=c,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 o;t[36]===D?o=t[37]:(o=()=>{D()},t[36]=D,t[37]=o);let h;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(pl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=h):h=t[38];let v;t[39]!==a||t[40]!==o?(v=(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:o,children:h}),t[39]=a,t[40]=o,t[41]=v):v=t[41];let b;t[42]!==i||t[43]!==v?(b=(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,v]}),t[42]=i,t[43]=v,t[44]=b):b=t[44];let x;t[45]!==r||t[46]!==y||t[47]!==g||t[48]!==k?(x=g&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),f(y)},children:(0,Z.jsx)(vo,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),k()},children:(0,Z.jsx)(K,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`484LKL`})})]})]}),t[45]=r,t[46]=y,t[47]=g,t[48]=k,t[49]=x):x=t[49];let S;return t[50]!==b||t[51]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[b,x]}),t[50]=b,t[51]=x,t[52]=S):S=t[52],S}let P;t[53]===r?P=t[54]:(P=r({id:`p0Iq25`}),t[53]=r,t[54]=P);let F=g?`bg-accent text-primary`:`text-accent-foreground`,I;t[55]===x?I=t[56]:(I=e=>{e.preventDefault(),l(x()),o(!0)},t[55]=x,t[56]=I);let L;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(jl,{className:`size-3.5`}),t[57]=L):L=t[57];let R;t[58]!==P||t[59]!==F||t[60]!==I?(R=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":P,className:F,onMouseDown:I,children:L})}),t[58]=P,t[59]=F,t[60]=I,t[61]=R):R=t[61];let z;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(s,{id:`yzF66j`}),t[62]=z):z=t[62];let B;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(Ns,{side:`bottom`,sideOffset:8,children:[z,(0,Z.jsx)(Jt,{children:tc(`command-palette`)})]}),t[63]=B):B=t[63];let V;return t[64]===R?V=t[65]:(V=(0,Z.jsxs)(Is,{children:[R,B]}),t[64]=R,t[65]=V),V}function yE({editor:e}){if(ze(e.state).query||e.isActive(`codeBlock`))return!1;if(mE(e)||YT(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 bE(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:TE},t[0]=n,t[1]=l);let u=Ie(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:wE},t[2]=n,t[3]=d);let f=Ie(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return qn(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=Os(e,t,()=>{Ps(e,t,{placement:`top`,strategy:`fixed`,middleware:[Ts(8),Ms(),Rs({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(CE)}))},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(SE)},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)(fE,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(qT,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(IT,{editor:n}),(0,Z.jsx)(ta,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(gE,{editor:n},o),(0,Z.jsx)(ta,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(vE,{editor:n},`${o}-link`),(0,Z.jsx)($T,{editor:n},`${o}-footnote`),(0,Z.jsx)(HT,{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)(PT,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:xE,shouldShow:yE,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 xE(){return document.body}function SE(e){return e+1}function CE(){}function wE(e){return YT(e.editor)}function TE(e){return mE(e.editor)}var EE=56,DE=`0 2px 4px rgba(0, 0, 0, 0.08)`,OE=150,kE=globalThis.ScrollTimeline;function AE(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+EE);return{startOffset:o,endOffset:o+a,maxShift:a}}var jE=new WeakMap;function ME(e){let t=jE.get(e);if(t){for(let e of t.animations)e.cancel();jE.delete(e)}}function NE(e){for(let t of Array.from(e.cells))ME(t)}var PE=e=>e.cellIndex===0?`3`:`2`;function FE(e,t){return IE(e,t,e=>({transform:`translateY(${e}px)`}))}function IE(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 LE(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 RE(e,t,n){return LE(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:DE})}function zE(e,t){return LE(e,t,{opacity:`0`},{opacity:`1`})}function BE(e,t,n,r){let i=PE(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=jE.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(FE(n,r),s),l=e.animate(RE(n,r,i),s),u=e.animate(zE(n,r),{...s,pseudoElement:`::before`});jE.set(e,{key:a,animations:[c,l,u]})}function VE(e,t){let n=PE(e),r=`in|${t}|${n}`,i=jE.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:DE}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});jE.set(e,{key:r,animations:[a,o]})}function HE(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=AE(a,i,c.top,c.height,l.height);if(!u){NE(s);continue}if(n){if(o<=0){NE(s);continue}for(let e of Array.from(s.cells))BE(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+EE){NE(s);continue}for(let e of Array.from(s.cells))VE(e,d)}}var UE=rr.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new Vn({key:new Gn(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||HE(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()},OE);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&kE)try{n=new kE({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`))NE(t)}}}})]}}),WE=`application/x-open-knowledge-sidebar-item+json`,GE={image:!0,video:!0,audio:!0,pdf:!0,text:!0};function KE(e){return JSON.stringify(e)}function qE(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:Uo(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:Jo(e.assetPath)}:{target:us(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:Vo(e.docName)}}function JE(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(WE);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!YE(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!XE(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function YE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function XE(e){return typeof e==`string`&&Object.hasOwn(GE,e)}function ZE(e,t){return(n,r)=>{let i=r,a=JE(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function QE(e,t){let n=qE(e);t(n.target,{tabBehavior:`append`}),Yo(n.hash)}function $E(e){return[...e?[{label:`Toggle header column`,icon:dl,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:gi,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:ka,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:K,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Tl,run:e=>e.chain().focus().deleteTable().run()}]}function eD(e){return[...e?[{label:`Toggle header row`,icon:su,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:ft,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:Qe,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:K,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Tl,run:e=>e.chain().focus().deleteTable().run()}]}function tD(e){if(!e.isEditable||ze(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 nD(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 Os(r,e,()=>{Ps(r,e,{strategy:`absolute`,placement:t,middleware:[Ts(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(rD)})},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`?hl:qa,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)(ja,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`secondary`,className:u,"aria-label":d,children:f})}),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m=i===`column`?`center`:`start`,h=i===`column`?`bottom`:`right`,g;if(t[10]!==n||t[11]!==a){let e;t[13]===n?e=t[14]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(no,{}),(0,Z.jsxs)(Ea,{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)(eo,{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)(ao,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function rD(){}function iD(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=tD(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=$E(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)(nD,{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=eD(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)(nD,{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 aD(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=Ot.getState(e.state)?.binding;if(!t){le.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){le.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}le.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return rr.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new Vn({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var oD=new WeakMap;function sD(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=Wr(e.color),n.textContent=e.name,t.append(n),t}var cD={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},lD=100,uD=100,dD=3,fD=250;function pD(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function mD(e,t){let n=w(e);if(!n||t.contains(n.dom))return!1;if(!pD(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 hD(){let e=new cr({extensions:mr});return{mdManager:e,text:wt({mdManager:e}),html:L({mdManager:e}),paste:xe({mdManager:e}),drop:we({mdManager:e})}}function gD(e,t){return t?{collaboration:de.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[aD({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:de.configure({document:e.document}),guard:[]}}function _D(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=gD(t,r);return[...xt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),Vw.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,rr.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[nt]}}),rr.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[ht(e,{cursorBuilder:sD})]}}),rr.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[rT({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,UE]}function vD(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{oD.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=oD.get(e);if(oD.delete(e),r==null)return;let i=performance.now();le(`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:ZE(n.drop,e.onSidebarDrop)},extensions:Zp(_D(e))}}function yD(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=vD({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}=Nt(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var bD=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(cD),c=qw(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=mt(),p=n.configuration.name??``,[m]=(0,Q.useState)(hD),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new ei(yD({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;le(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{QE(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=at(p)??crypto.randomUUID();_=Q.use,v=ee({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=()=>()=>{ue(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)(xD,{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},xD=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget: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,b;t[3]!==c||t[4]!==f?(v=()=>{mD(c,f)&&h(SD)},b=[c,f],t[3]=c,t[4]=f,t[5]=v,t[6]=b):(v=t[5],b=t[6]),(0,Q.useEffect)(v,b);let x;t[7]!==c||t[8]!==n.configuration.name?(x=()=>(jt(c,n.configuration.name??null),()=>{jt(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=x):x=t[9];let S;t[10]!==c||t[11]!==n?(S=[c,n],t[10]=c,t[11]=n,t[12]=S):S=t[12],(0,Q.useEffect)(x,S);let C;t[13]!==c||t[14]!==n.configuration.name?(C=()=>{let e=n.configuration.name;if(e)return ne(e,c),()=>N(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=C):C=t[15];let T;t[16]!==c||t[17]!==n?(T=[c,n],t[16]=c,t[17]=n,t[18]=T):T=t[18],(0,Q.useEffect)(C,T);let E;t[19]!==c||t[20]!==n.configuration.name?(E=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,kc(e,`wysiwyg`,jc(c))},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),kc(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=E):E=t[21];let D;t[22]!==c||t[23]!==n?(D=[c,n],t[22]=c,t[23]=n,t[24]=D):D=t[24],(0,Q.useEffect)(E,D);let O;t[25]!==c||t[26]!==n.configuration.name?(O=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=O):O=t[27];let k;t[28]!==c||t[29]!==n?(k=[c,n],t[28]=c,t[29]=n,t[30]=k):k=t[30],(0,Q.useEffect)(O,k);let A,j;t[31]===c?(A=t[32],j=t[33]):(A=()=>{let e=CD,t=null,n=()=>{if(t||c.isDestroyed)return;let n=w(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 w(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},j=[c],t[31]=c,t[32]=A,t[33]=j),(0,Q.useEffect)(A,j);let M,P;t[34]!==i||t[35]!==c?(M=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!w(c))return;e=!0;let t=y(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})),le(`ok/editor/selection-restore-failed`,{docName:i,message:n})}qt(i)};if(w(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},P=[c,i],t[34]=i,t[35]=c,t[36]=M,t[37]=P):(M=t[36],P=t[37]),(0,Q.useEffect)(M,P);let F,I;t[38]!==u||t[39]!==n.document||t[40]!==l?(F=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},Ln)};c(cD);let f=()=>{if(pr(e),!Cr(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?Cr(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},I=[n.document,u,l],t[38]=u,t[39]=n.document,t[40]=l,t[41]=F,t[42]=I):(F=t[41],I=t[42]),(0,Q.useEffect)(F,I);let L,R;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(L=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<lD){e+=1,t=window.setTimeout(p,uD);return}r=null,o=null,e=0},u=function(e){let t=w(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=dD,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,fD)))};t=window.setTimeout(o,fD)};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=as(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)}},R=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=L,t[48]=R):(L=t[47],R=t[48]),(0,Q.useEffect)(L,R);let z,B;t[49]===c?(z=t[50],B=t[51]):(z=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=w(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(Ec,e),()=>window.removeEventListener(Ec,e)},B=[c],t[49]=c,t[50]=z,t[51]=B),(0,Q.useEffect)(z,B);let V;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(V=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:Jw({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]=V):V=t[58];let H;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(H=[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]=H):H=t[65],(0,Q.useEffect)(V,H);let U,W;t[66]!==c||t[67]!==r?(U=()=>(d(c,r),()=>{d(c,!1)}),W=[c,r],t[66]=c,t[67]=r,t[68]=U,t[69]=W):(U=t[68],W=t[69]),(0,Q.useEffect)(U,W);let G;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(G=!r&&(0,Z.jsx)(bE,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=G):G=t[74];let K;t[75]!==c||t[76]!==r?(K=!r&&(0,Z.jsx)(iD,{editor:c}),t[75]=c,t[76]=r,t[77]=K):K=t[77];let q;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[78]=q):q=t[78];let J;t[79]!==c||t[80]!==m?(J=(0,Z.jsx)(Ae,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[79]=c,t[80]=m,t[81]=J):J=t[81];let ee;t[82]!==f||t[83]!==J?(ee=(0,rl.createPortal)(J,f),t[82]=f,t[83]=J,t[84]=ee):ee=t[84];let Y;t[85]===c?Y=t[86]:(Y=(0,Z.jsx)(Gw,{editor:c}),t[85]=c,t[86]=Y);let te;t[87]===c?te=t[88]:(te=_t(c),t[87]=c,t[88]=te);let X;t[89]===te.store?X=t[90]:(X=(0,Z.jsx)(kt,{store:te.store}),t[89]=te.store,t[90]=X);let re;return t[91]!==G||t[92]!==K||t[93]!==ee||t[94]!==Y||t[95]!==X||t[96]!==l?(re=(0,Z.jsxs)(`div`,{ref:l,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[G,K,q,ee,Y,X]}),t[91]=G,t[92]=K,t[93]=ee,t[94]=Y,t[95]=X,t[96]=l,t[97]=re):re=t[97],re};function SD(e){return e+1}function CD(){return j()}var wD=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 TD(e,t,n,r,i,a){if(e==r)return[];let o=FD(e,t,n,r,i,a),s=ID(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 wD(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new wD(t,t+o,i,i),new wD(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 wD(t,t,i,i+o),new wD(n,n,i+o+c,a)]}if(c==1||l==1)return[new wD(t,n,i,a)];let u=RD(e,t,n,r,i,a);if(u){let[o,s,c]=u;return TD(e,t,o,r,i,s).concat(TD(e,o+c,n,r,s+c,a))}return kD(e,t,n,r,i,a)}var ED=1e9,DD=0,OD=!1;function kD(e,t,n,r,i,a){let o=n-t,s=a-i;if(ED<1e9&&Math.min(o,s)>ED*16||DD>0&&Date.now()>DD)return Math.min(o,s)>ED*64?[new wD(t,n,i,a)]:zD(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);jD.reset(c),MD.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:MD,f=d?null:jD;for(let p=0;p<c;p++){if(p>ED||DD>0&&!(p&63)&&Date.now()>DD)return zD(e,t,n,r,i,a);let m=jD.advance(p,o,s,c,d,!1,l)||MD.advance(p,o,s,c,f,!0,u);if(m)return ND(e,t,n,t+m[0],r,i,a,i+m[1])}return[new wD(t,n,i,a)]}var AD=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}},jD=new AD,MD=new AD;function ND(e,t,n,r,i,a,o,s){let c=!1;return!eO(e,r)&&++r==n&&(c=!0),!eO(i,s)&&++s==o&&(c=!0),c?[new wD(t,n,a,o)]:TD(e,t,r,i,a,s).concat(TD(e,r,n,i,s,o))}function PD(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function FD(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=PD(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-+!eO(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function ID(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=PD(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-+!eO(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function LD(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;;){eO(e,s)||s++;let u=s+o;if(eO(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=FD(e,u,n,r,i+f+d.length,a),c=ID(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 RD(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=RD(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:LD(e,t,n,r,i,a,Math.floor(o/4),-1)}function zD(e,t,n,r,i,a){OD=!0;let o=n-t,s=a-i,c;if(o<s){let s=LD(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=LD(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new wD(t,n,i,a)];let[l,u,d]=c;return TD(e,t,l,r,i,u).concat(TD(e,l+d,n,r,u+d,a))}function BD(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 wD(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function VD(e,t,n){for(;;){BD(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=FD(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new wD(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=ID(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new wD(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 wD(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 wD(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function HD(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=YD(t,a.fromA,l),f=JD(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 wD(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=JD(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new wD(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=YD(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new wD(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=ZD(n,a.fromB,a.toB),r,o=t<0?-1:XD(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=ZD(t,a.fromA,a.toA),r,o=n<0?-1:XD(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 BD(e,3),e}var UD;try{UD=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function WD(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function GD(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!WD(n):UD?!QD(n)||t==e.length-1?+!!UD.test(String.fromCharCode(n)):UD.test(e.slice(t,t+2))?2:0:0}function KD(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!WD(n):UD?!$D(n)||t==1?+!!UD.test(String.fromCharCode(n)):UD.test(e.slice(t-2,t))?2:0:0}var qD=8;function JD(e,t,n){if(t==e.length||!KD(e,t))return t;for(let r=t,i=t+n,a=0;a<qD;a++){let t=GD(e,r);if(!t||r+t>i)return r;r+=t}return t}function YD(e,t,n){if(!t||!GD(e,t))return t;for(let r=t,i=t-n,a=0;a<qD;a++){let t=KD(e,r);if(!t||r-t<i)return r;r-=t}return t}function XD(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function ZD(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var QD=e=>e>=55296&&e<=56319,$D=e=>e>=56320&&e<=57343;function eO(e,t){return!t||t==e.length||!QD(e.charCodeAt(t-1))||!$D(e.charCodeAt(t))}function tO(e,t,n){let r=n?.override;return r?r(e,t):(ED=(n?.scanLimit??1e9)>>1,DD=n?.timeout?Date.now()+n.timeout:0,OD=!1,VD(e,t,TD(e,0,e.length,t,0,t.length)))}function nO(){return!OD}function rO(e,t,n){return HD(tO(e,t,n),e,t)}var iO=pc.define({combine:e=>e[0]}),aO=mc.define(),oO=pc.define(),sO=cc.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(aO)&&(e=n.value);for(let n of t.state.facet(oO))e=n(e,t);return e}});function cO(e){let t=e.field(sO,!1);if(!t)return null;let n=e.facet(iO);return{chunks:t,side:n?n.side:null}}var lO=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 fO(rO(e.toString(),t.toString(),n),e,t,0,0,nO())}static updateA(e,t,n,r,i){return gO(hO(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return gO(hO(e,r,!1,t.length),e,t,n,i)}};function uO(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 dO(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 fO(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=uO(c.fromA+r,c.fromB+i,t,n),[d,f]=dO(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]=uO(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]=dO(a.toA+r,a.toB+i,t,n),s++}o.push(new lO(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var pO=1e3;function mO(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 hO(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>pO&&([l,d]=mO(e,a-pO,n,!0)),o<t.length-pO&&([u,f]=mO(e,o+pO,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 gO(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=rO(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of fO(h,n,r,d,f,nO()))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 _O={scanLimit:500},vO=hc.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=OO(e))}update(e){(e.docChanged||e.viewportChanged||bO(e.startState,e.state)||xO(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=OO(e.view))}},{decorations:e=>e.deco}),yO=ac.low(yc({class:`cm-changeGutter`,markers:e=>e.plugin(vO)?.gutter||xc.empty}));function bO(e,t){return e.field(sO,!1)!=t.field(sO,!1)}function xO(e,t){return e.facet(iO)!=t.facet(iO)}var SO=dc.line({class:`cm-changedLine`}),CO=dc.mark({class:`cm-changedText`}),wO=dc.mark({tagName:`ins`,class:`cm-insertedLine`}),TO=dc.mark({tagName:`del`,class:`cm-deletedLine`}),EO=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function DO(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,SO),i.add(o,s,n?TO:wO),a&&a.add(o,o,EO);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,SO),a&&a.add(u,u,EO);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,CO),s<t)c++;else break}u=t}}}function OO(e){let t=e.state.field(sO),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(iO),o=n==`a`,s=new fc,c=i?new fc: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))&&DO(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var kO=class extends ic{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}},AO=mc.define({map:(e,t)=>e.map(t)}),jO=cc.define({create:()=>dc.none,update:(e,t)=>{for(let e of t.effects)if(e.is(AO))return e.value;return e.map(t.changes)},provide:e=>_c.decorations.from(e)}),MO=.01;function NO(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 PO(e,t,n){let r=new fc,i=new fc,a=e.state.field(jO).iter(),o=t.state.field(jO).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<-MO?(l-=n,r.add(s,s,dc.widget({widget:new kO(-n),block:!0,side:-1}))):n>MO&&(u+=n,i.add(c,c,dc.widget({widget:new kO(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<MO?r.add(e.state.doc.length,e.state.doc.length,dc.widget({widget:new kO(-p),block:!0,side:1})):p>MO&&i.add(t.state.doc.length,t.state.doc.length,dc.widget({widget:new kO(p),block:!0,side:1}));let m=r.finish(),h=i.finish();NO(m,e.state.field(jO))||e.dispatch({effects:AO.of(m)}),NO(h,t.state.field(jO))||t.dispatch({effects:AO.of(h)})}var FO=mc.define({map:(e,t)=>t.mapPos(e)}),IO=class extends ic{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:FO.of(n)});let{side:r,sibling:i}=e.state.facet(iO);i&&i().dispatch({effects:FO.of(LO(n,e.state.field(sO),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function LO(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 RO=cc.define({create(e){return dc.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(FO)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>_c.decorations.from(e)});function zO({margin:e=3,minSize:t=4}){return RO.init(n=>BO(n,e,t))}function BO(e,t,n){let r=new fc,i=e.facet(iO).side==`a`,a=e.field(sO),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,dc.replace({widget:new IO(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var VO=_c.styleModule.of(new bc({".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`}})),HO=_c.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`}}),UO=new gc,WO=new gc,GO=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||_O;let t=[ac.low(vO),HO,VO,jO,_c.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(AO)))&&this.measure()})],n=[iO.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(yO);let r=sc.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],_c.editorAttributes.of({class:`cm-merge-a`}),WO.of(n),t]}),i=[iO.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(yO);let a=sc.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],_c.editorAttributes.of({class:`cm-merge-b`}),WO.of(i),t]});this.chunks=lO.build(r.doc,a.doc,this.diffConf);let o=[sO.init(()=>this.chunks),UO.of(e.collapseUnchanged?zO(e.collapseUnchanged):[])];r=r.update({effects:mc.appendConfig.of(o)}).state,a=a.update({effects:mc.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 _c({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new _c({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),oc.empty(e[0].startState.doc.length));this.chunks=t==this.a?lO.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):lO.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:aO.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:aO.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(iO),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(WO.reconfigure([iO.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?yO:[]])),a.push(WO.reconfigure([iO.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?yO:[]]))}if(r){let t=UO.reconfigure(e.collapseUnchanged?zO(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(){PO(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=KO(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=KO(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 KO(e){let t=e.nextSibling;return e.remove(),t}var qO=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},JO=ac.low(yc({class:`cm-changeGutter`,markers:e=>e.plugin(vO)?.gutter||xc.empty,widgetMarker:(e,t)=>t instanceof $O?qO:null}));function YO(e){let t=typeof e.original==`string`?uc.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||_O;return[ac.low(vO),ik,HO,_c.editorAttributes.of({class:`cm-merge-b`}),oO.of((e,t)=>{let r=t.effects.find(e=>e.is(XO));return r&&(e=lO.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=lO.updateB(e,t.state.field(ZO),t.newDoc,t.changes,n)),e}),iO.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?uk:void 0,side:`b`}),ZO.init(()=>t),e.gutter===!1?[]:JO,e.collapseUnchanged?zO(e.collapseUnchanged):[],sO.init(e=>lO.build(t,e.doc,n))]}var XO=mc.define(),ZO=cc.define({create:()=>uc.empty,update(e,t){for(let n of t.effects)n.is(XO)&&(e=n.value.doc);return e}}),QO=new WeakMap,$O=class extends ic{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 ek(e,t,n){let r=QO.get(t.changes);if(r)return r;let i=dc.widget({block:!0,side:-1,widget:new $O(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(iO),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(),tk(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),nk(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(ZO).sliceString(t.fromA,t.endA),u=a&&e.facet(Sc),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
28
28
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
29
- `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;lc(t,{style:t=>Cc(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 QO.set(t.changes,i),i}function tk(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(sO).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(ZO);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=oc.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:XO.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function nk(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(sO).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(ZO).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 rk(e){let t=new fc;for(let n of e.field(sO)){let r=e.facet(iO).overrideChunk&&ok(e,n);t.add(n.fromB,n.fromB,ek(e,n,!!r))}return t.finish()}var ik=cc.define({create:e=>rk(e),update(e,t){return t.state.field(sO,!1)==t.startState.field(sO,!1)?e:rk(t.state)},provide:e=>_c.decorations.from(e)}),ak=new WeakMap;function ok(e,t){let n=ak.get(t);if(n!==void 0)return n;n=null;let r=e.field(ZO),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(dc.widget({widget:new sk(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(CO.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return ak.set(t,n),n}var sk=class extends ic{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}},ck=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},lk=dc.line({class:`cm-inlineChangedLine`});function uk(e,t,n,r){let i=ok(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,ck),n.add(o.from,o.from,lk);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 dk=Y({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),fk=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),pk=_c.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 mk({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 hk(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:a,conflictMode:o,previewMode:c,oursOverride:l,onResolve:u,onAbort:d}=e,{_:f}=i(),p=l??r,m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),{resolvedTheme:_}=Yr(),v=(0,Q.useRef)(u),y=(0,Q.useRef)(d),[b,x]=(0,Q.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[C,w]=(0,Q.useState)(S),T;t[1]!==d||t[2]!==u?(T=()=>{v.current=u,y.current=d},t[1]=d,t[2]=u,t[3]=T):T=t[3],(0,Q.useEffect)(T);let E,D;t[4]!==o||t[5]!==p||t[6]!==a||t[7]!==n||t[8]!==c||t[9]!==_?(E=()=>{let e=m.current;if(!e)return;w([]);let t=new Map,r=!1,i=e=>{r||!t.delete(e)||w(t=>t.filter(t=>t.id!==e))},s=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||i(n)});s.observe(e,{childList:!0,subtree:!0});let l=_===`dark`?dk:fk,u=[_c.editable.of(!1),sc.readOnly.of(!0)],d=[Fc,wc(),...u,l,_c.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new _c({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=mk({addControl:e=>{r||(t.set(e.id,e.host),w(t=>[...t,e]))},nextId:()=>(g.current+=1,g.current),removeControl:i,root:e}),o=new _c({doc:p,extensions:[Fc,wc(),_c.editable.of(!1),l,pk,_c.lineWrapping,YO({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),_c.updateListener.of(e=>{let t=cO(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=cO(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new GO({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new _c({doc:p,extensions:[...d,YO({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,s.disconnect(),h.current&&=(h.current.destroy(),null)}},D=[n,p,a,_,o,c],t[4]=o,t[5]=p,t[6]=a,t[7]=n,t[8]=c,t[9]=_,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=h.current;!e||!(e instanceof _c)||v.current?.(e.state.doc.toString())},t[12]=O):O=t[12];let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){let e=h.current;!e||!(e instanceof _c)||ve(e)},t[13]=A):A=t[13];let j=A,M=b===0,N;t[14]!==f||t[15]!==b?(N=b===null?``:b===0?f({id:`lPzyrU`}):ms._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=N):N=t[16];let P=N,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=F):F=t[17];let I;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,rl.createPortal)((0,Z.jsx)(ci,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?f({id:`g3UF2V`}):f({id:`1t_NnN`})}),e.host,e.id),t[21]=f,t[22]=e),I=C.map(e),t[18]=f,t[19]=C,t[20]=I}else I=t[20];let L;t[23]!==M||t[24]!==o||t[25]!==P||t[26]!==d||t[27]!==u?(L=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${M?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:P}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(ci,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(ci,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(ci,{variant:`default`,size:`sm`,disabled:!M,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=M,t[24]=o,t[25]=P,t[26]=d,t[27]=u,t[28]=L):L=t[28];let R;return t[29]!==L||t[30]!==I?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,I,L]}),t[29]=L,t[30]=I,t[31]=R):R=t[31],R}async function gk(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 _k(e,t){return gk(e,`content`,t)}async function vk(e){return gk(e,`mine`)}async function yk(e){return gk(e,`theirs`)}async function bk(e){return gk(e,`delete`)}async function xk(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 Sk(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=Pi(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Ko(e.file)===n,t[3]=n,t[4]=e),c=a.find(e),t[0]=a,t[1]=n,t[2]=c}else c=t[2];let l=c,u=l?.file??`${n}.md`,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>(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}))}),v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Q.useEffect)(_,v);let y=o||l===void 0,b,x;t[8]!==y||t[9]!==u?(b=()=>{if(y)return;let e=!1;return f(null),m(!1),xk(u).then(t=>{e||(t===null?m(!0):f(t))}),()=>{e=!0}},x=[u,y],t[8]=y,t[9]=u,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S;t[12]!==r||t[13]!==u?(S=async function(e){let t=await _k(u,e);t.ok||hs.error(r({id:`K-h9cT`,values:{filePath:u}}),{description:t.detail})},t[12]=r,t[13]=u,t[14]=S):S=t[14];let C=S,w;t[15]!==r||t[16]!==u?(w=async function(e){g(!0);let t=await e(u);t.ok||(g(!1),hs.error(r({id:`jPUPvG`,values:{filePath:u}}),{description:t.detail}))},t[15]=r,t[16]=u,t[17]=w):w=t[17];let T=w;if(p){let e;return t[18]===u?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)(s,{id:`ajz9F8`,values:{filePath:u}})}),t[18]=u,t[19]=e),e}if(d===null){let e;return t[20]===u?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)(s,{id:`DF1MtZ`,values:{filePath:u}})}),t[20]=u,t[21]=e),e}if(d.kind===`delete-modify`){let e;t[22]===d.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(hk,{oldContent:``,newContent:d.theirs,layout:`unified`,previewMode:!0})}),t[22]=d.theirs,t[23]=e);let n;t[24]===u?n=t[25]:(n={filePath:u},t[24]=u,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)(s,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===T?a=t[30]:(a=()=>void T(bk),t[29]=T,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`Vlc75q`}),t[31]=o):o=t[31];let c;t[32]!==h||t[33]!==a?(c=(0,Z.jsx)(ci,{type:`button`,variant:`destructive`,disabled:h,onClick:a,children:o}),t[32]=h,t[33]=a,t[34]=c):c=t[34];let l;t[35]===T?l=t[36]:(l=()=>void T(yk),t[35]=T,t[36]=l);let f;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`3mFsc3`}),t[37]=f):f=t[37];let p;t[38]!==h||t[39]!==l?(p=(0,Z.jsx)(ci,{type:`button`,variant:`default`,disabled:h,onClick:l,children:f}),t[38]=h,t[39]=l,t[40]=p):p=t[40];let m;t[41]!==c||t[42]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[41]=c,t[42]=p,t[43]=m):m=t[43];let g;t[44]!==i||t[45]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=g):g=t[46];let _;return t[47]!==g||t[48]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[47]=g,t[48]=e,t[49]=_):_=t[49],_}if(d.kind===`modify-delete`){let e;t[50]===d.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(hk,{oldContent:``,newContent:d.ours,layout:`unified`,previewMode:!0})}),t[50]=d.ours,t[51]=e);let n;t[52]===u?n=t[53]:(n={filePath:u},t[52]=u,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===T?a=t[58]:(a=()=>void T(vk),t[57]=T,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`0NA4b3`}),t[59]=o):o=t[59];let c;t[60]!==h||t[61]!==a?(c=(0,Z.jsx)(ci,{type:`button`,variant:`default`,disabled:h,onClick:a,children:o}),t[60]=h,t[61]=a,t[62]=c):c=t[62];let l;t[63]===T?l=t[64]:(l=()=>void T(bk),t[63]=T,t[64]=l);let f;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`qSxaOz`}),t[65]=f):f=t[65];let p;t[66]!==h||t[67]!==l?(p=(0,Z.jsx)(ci,{type:`button`,variant:`destructive`,disabled:h,onClick:l,children:f}),t[66]=h,t[67]=l,t[68]=p):p=t[68];let m;t[69]!==c||t[70]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[69]=c,t[70]=p,t[71]=m):m=t[71];let g;t[72]!==i||t[73]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=g):g=t[74];let _;return t[75]!==g||t[76]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[75]=g,t[76]=e,t[77]=_):_=t[77],_}let E;t[78]===C?E=t[79]:(E=e=>void C(e),t[78]=C,t[79]=E);let D;return t[80]!==d.ours||t[81]!==d.theirs||t[82]!==E?(D=(0,Z.jsx)(hk,{oldContent:d.theirs,newContent:d.ours,layout:`unified`,conflictMode:!0,onResolve:E}),t[80]=d.ours,t[81]=d.theirs,t[82]=E,t[83]=D):D=t[83],D}function Ck(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Ft(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 wk=`__back-nav__`;function Tk(e){return e instanceof Le||e instanceof vt||e instanceof Me||e instanceof et||e instanceof At||e instanceof pe?e.docName:null}function Ek(e){if(e instanceof Le){let t=e.docName;return{title:ms._({id:`Jejur6`}),summary:ms._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof vt){let t=e.docName;return{title:ms._({id:`V7QxyT`}),summary:ms._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Me){let t=e.docName;return{title:ms._({id:`1di5fu`}),summary:ms._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof et){let t=e.docName;return{title:ms._({id:`wvbc1r`}),summary:ms._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof At)return{title:ms._({id:`Gfr4fu`}),summary:ms._({id:`j6LB7S`})};if(e instanceof pe){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 Dk(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=Ek(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(OS,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(ci,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(ci,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(lt(Tk(n)??i),o(a),r(wk))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(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:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function Ok(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)(Dk,{...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]===wk){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}: ${Ek(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)(ce,{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 kk(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=br(t);return{map:n,keys:On(t),parseError:r}}function Ak(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>kk(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=Mn(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=Ze(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=dt(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)(jk,{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)(Mk,{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 jk(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 Mk(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}function Nk(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=br(t);return{map:n,keys:On(t),parseError:r}}function Pk(e){let t=(0,$.c)(127),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>Nk(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=Mn(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]!==r||t[9]!==a?(M=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=vr(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=a,t[10]=M):M=t[10];let N=M,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=P):P=t[11];let F=P,I;t[12]===r?I=t[13]:(I=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[12]=r,t[13]=I);let L=I,R;t[14]!==N||t[15]!==L?(R=function(e,t){F(e),L(N({[e]:t}),[e])},t[14]=N,t[15]=L,t[16]=R):R=t[16];let z=R,B;t[17]!==N||t[18]!==L?(B=function(e){F(e),L(N({[e]:null}),[e])},t[17]=N,t[18]=L,t[19]=B):B=t[19];let H=B,U;t[20]!==r||t[21]!==a?(U=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=vr(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[20]=r,t[21]=a,t[22]=U):U=t[22];let W=U,G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=function(e,t){return`${e} ${t}`},t[23]=G):G=t[23];let K=G,q;t[24]!==a||t[25]!==m?(q=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>K(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[24]=a,t[25]=m,t[26]=q):q=t[26];let J=q,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee={activationConstraint:{distance:4}},t[27]=ee):ee=t[27];let Y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y={coordinateGetter:ga},t[28]=Y):Y=t[28];let te=wi(ia(va,ee),ia(ba,Y)),ne;t[29]!==z||t[30]!==p?(ne=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=oa(n,t);(!Object.hasOwn(p,e)||!xr(n,r))&&z(e,r)},t[29]=z,t[30]=p,t[31]=ne):ne=t[31];let X=ne,re;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=re):re=t[32];let ie=re,{addPropertySignal:ae,clearAddProperty:oe}=MC(),se;t[33]!==ae||t[34]!==j?(se=ae.get(j)??0,t[33]=ae,t[34]=j,t[35]=se):se=t[35];let ce=se,le,ue;t[36]===ce?(le=t[37],ue=t[38]):(le=()=>{ce>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},ue=[ce],t[36]=ce,t[37]=le,t[38]=ue),(0,Q.useEffect)(le,ue);let de,fe;t[39]!==oe||t[40]!==j?(de=()=>()=>oe(j),fe=[j,oe],t[39]=oe,t[40]=j,t[41]=de,t[42]=fe):(de=t[41],fe=t[42]),(0,Q.useEffect)(de,fe);let pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Ji[e];return{...t,type:e,value:n,error:null}})},t[43]=pe):pe=t[43];let me=pe,he;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e){S(t=>t&&{...t,value:e})},t[44]=he):he=t[44];let ge=he,_e;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=_e):_e=t[45];let ve=_e,ye;t[46]!==r||t[47]!==x||t[48]!==N||t[49]!==p?(ye=function(e){if(!x)return;let t=e??x.value,n=x.name.trim();if(!n){S({...x,value:t,error:r({id:`8_brI5`})});return}if(Zn(t)){S({...x,value:t,error:r({id:`hXUWyd`})});return}if(n===`frontmatter`){S({...x,value:t,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,n)){S({...x,value:t,error:r({id:`njU86j`,values:{trimmed:n}})});return}let i=N({[n]:t});if(i.ok){S(null);return}let a=i.fieldErrors?.[n],o=i.error??r({id:`OJeiSH`});S({...x,value:t,error:a??o})},t[46]=r,t[47]=x,t[48]=N,t[49]=p,t[50]=ye):ye=t[50];let be=ye,xe;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){S(null)},t[51]=xe):xe=t[51];let Se=xe,Ce;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){w({key:e,draft:e,error:null})},t[52]=Ce):Ce=t[52];let we=Ce,Te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Te):Te=t[53];let Ee=Te,De;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(){w(null)},t[54]=De):De=t[54];let Oe=De,ke;t[55]!==r||t[56]!==p||t[57]!==W||t[58]!==C?(ke=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=W(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),F(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[55]=r,t[56]=p,t[57]=W,t[58]=C,t[59]=ke):ke=t[59];let Ae=ke,je;t[60]!==p||t[61]!==m?(je=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=je):je=t[62];let Me=je,Ne;if(t[63]!==Me){Ne=new Map;for(let e of Me)Ne.set(e,(Ne.get(e)??0)+1);t[63]=Me,t[64]=Ne}else Ne=t[64];if(Me.length===0&&!x&&!h)return null;let Pe=!g,Fe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=e=>_(!e),t[65]=Fe):Fe=t[65];let Ie=!g,Le;t[66]===Ie?Le=t[67]:(Le=(0,Z.jsx)(No,{"data-expanded":Ie,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Ie,t[67]=Le);let Re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=Re):Re=t[68];let ze;t[69]===Le?ze=t[70]:(ze=(0,Z.jsx)(Po,{asChild:!0,children:(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[Le,Re]})}),t[69]=Le,t[70]=ze);let Be;t[71]===h?Be=t[72]:(Be=h?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(Lo,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[71]=h,t[72]=Be);let Ve;if(t[73]!==Me){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>K(e,t),t[75]=e):e=t[75],Ve=Me.map(e),t[73]=Me,t[74]=Ve}else Ve=t[74];let He;if(t[76]!==z||t[77]!==Ae||t[78]!==Ne||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==H||t[83]!==C||t[84]!==Me||t[85]!==k||t[86]!==X){let e;t[88]!==z||t[89]!==Ae||t[90]!==Ne||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==H||t[95]!==C||t[96]!==k||t[97]!==X?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??An(n),i=C?.key===e?C:null,a=(Ne.get(e)??0)>1;return(0,Z.jsx)(Ii,{sortableId:K(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>we(e),onChangeDraft:Ee,onCommit:Ae,onCancel:Oe},onCommit:t=>z(e,t),onChangeType:t=>X(e,t),onRemove:()=>H(e)},`${e}-${t}`)},t[88]=z,t[89]=Ae,t[90]=Ne,t[91]=E,t[92]=p,t[93]=y,t[94]=H,t[95]=C,t[96]=k,t[97]=X,t[98]=e):e=t[98],He=Me.map(e),t[76]=z,t[77]=Ae,t[78]=Ne,t[79]=E,t[80]=p,t[81]=y,t[82]=H,t[83]=C,t[84]=Me,t[85]=k,t[86]=X,t[87]=He}else He=t[87];let Ue;t[99]!==Ve||t[100]!==He?(Ue=(0,Z.jsx)(ma,{items:Ve,strategy:Ki,children:He}),t[99]=Ve,t[100]=He,t[101]=Ue):Ue=t[101];let We;t[102]!==J||t[103]!==te||t[104]!==Ue?(We=(0,Z.jsx)(Xa,{sensors:te,collisionDetection:Sa,onDragEnd:J,children:Ue}),t[102]=J,t[103]=te,t[104]=Ue,t[105]=We):We=t[105];let Ge;t[106]!==z||t[107]!==E||t[108]!==p||t[109]!==k?(Ge=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(Ii,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>z(`tags`,e),onChangeType:Fk},`virtual-tags`),t[106]=z,t[107]=E,t[108]=p,t[109]=k,t[110]=Ge):Ge=t[110];let Ke;t[111]!==r||t[112]!==x||t[113]!==be?(Ke=x?(0,Z.jsx)(na,{draft:x,onChangeName:ve,onChangeType:me,onChangeValue:ge,onCommit:be,onCancel:Se}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ie,"aria-label":r({id:`F-NRCj`}),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)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=be,t[114]=Ke):Ke=t[114];let qe;t[115]!==Be||t[116]!==We||t[117]!==Ge||t[118]!==Ke?(qe=(0,Z.jsxs)(Mo,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Be,We,Ge,Ke]}),t[115]=Be,t[116]=We,t[117]=Ge,t[118]=Ke,t[119]=qe):qe=t[119];let Je;t[120]!==Pe||t[121]!==ze||t[122]!==qe?(Je=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(Fo,{open:Pe,onOpenChange:Fe,children:[ze,qe]})}),t[120]=Pe,t[121]=ze,t[122]=qe,t[123]=Je):Je=t[123];let Ye;return t[124]!==a||t[125]!==Je?(Ye=(0,Z.jsx)(Oi,{binding:a,children:Je}),t[124]=a,t[125]=Je,t[126]=Ye):Ye=t[126],Ye}function Fk(){}var Ik=v(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function Lk(e){let t=e.threshold??Ik;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Rk(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var zk=v(`ACTIVITY_MOUNT_LIMIT`,3);function Bk(){return n(()=>import(`./SourceEditor-B7nlmRui.js`),__vite__mapDeps([55,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,56,26,54]),import.meta.url)}var Vk=(0,Q.lazy)(async()=>({default:(await Bk()).SourceEditor}));function Hk(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ke(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function Uk(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 Wk(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Wt,{name:`activity-pool`,children:(0,Z.jsx)(Gk,{...e})}),t[0]=e,t[1]=n),n}function Gk(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=mt(),{pages:u,loading:d}=rs(),f=Hk(c,n,zk),p=(0,Q.useRef)(``),h=f.map(Kk).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)m(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;W(e,t&&t.length>0?t:crypto.randomUUID())}le(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,Ut(t)},[h,n]);let y;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(y=e=>(0,Z.jsx)(Qk,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let b=f.map(y),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function Kk(e){return e.docName}function qk(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&&le(`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&&(le(`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&&le(`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:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function Jk(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)(zx,{}),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)(Vk,{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 Yk(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)($a,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(h,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(ci,{type:`button`,onClick:Xk,children:[(0,Z.jsx)($a,{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 Xk(){return window.location.reload()}function Zk(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 Qk(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=Uk(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=vw(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),[b,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==b?(S=()=>{i&&!_?v(!0):!i&&!b&&x(!0)},C=[i,_,b],t[5]=i,t[6]=_,t[7]=b,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=Lk({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:b}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,O;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&&le(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[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]=O):(D=t[17],O=t[18]),(0,Q.useEffect)(D,O);let k;t[19]===n.docName?k=t[20]:(k=()=>y(n.docName),t[19]=n.docName,t[20]=k);let[A]=(0,Q.useState)(k),j=A?.html??null,[M,N]=(0,Q.useState)(!1),P,F;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==M||t[26]!==i||t[27]!==g?(P=()=>{Rk({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(le(`ok/cold/first-toggle`,{docName:n.docName,mountId:at(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,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]=M,t[26]=i,t[27]=g,t[28]=P,t[29]=F):(P=t[28],F=t[29]),(0,Q.useEffect)(P,F);let I=r?`visible`:`hidden`,L=`editor:${n.docName}`,R=A?.scrollTop,z;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]!==j?(z=f?(0,Z.jsx)(Yk,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Ok,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(Zk,{html:j}):(0,Z.jsx)(zx,{}),children:(0,Z.jsx)(Ck,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(Sk,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(Ak,{provider:n.provider}),!i&&(0,Z.jsx)(Pk,{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)(Jk,{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)(bD,{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]=j,t[44]=z):z=t[44];let B;t[45]!==r||t[46]!==R||t[47]!==z?(B=(0,Z.jsx)(qk,{isActive:r,initialScrollTop:R,children:z}),t[45]=r,t[46]=R,t[47]=z,t[48]=B):B=t[48];let V;return t[49]!==I||t[50]!==L||t[51]!==B?(V=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:B}),t[49]=I,t[50]=L,t[51]=B,t[52]=V):V=t[52],V}function $k(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function eA(e){let{value:t,unit:n}=$k(e);return n===`rem`?t*16:t}function tA(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var nA=3600*24*7;function rA(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?iA:m,O=g===void 0?nA: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 q=eA(b),J;t[6]===x?J=t[7]:(J=eA(x),t[6]=x,t[7]=J);let ee=J,Y;t[8]!==E||t[9]!==k?(Y=function(e){E&&(P.current=!0,j.current=H.current?0:eA(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]=Y):Y=t[10];let te=Y,ne,X;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ee||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ne=()=>{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}=$k(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<=q*w;else if(e<=q){let n=q*(w-1);t=q-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>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(ee,t)),u=tA(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(q,Math.min(ee,u)),f=tA(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)}},X=[i,a,D,q,ee,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]=ee,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ne,t[25]=X):(ne=t[24],X=t[25]),(0,Q.useEffect)(ne,X);let re;return t[26]===te?re=t[27]:(re={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=re),re}function iA(){}var aA=3600*24*7,oA=`18rem`,sA=`3rem`,cA=`app-file-sidebar`,lA=`14.625rem`,uA=`32rem`,dA=`sidebar_width`,fA=/^\d+(?:\.\d+)?(?:rem|px)$/,pA=Q.createContext(null);function mA(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${dA}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return fA.test(n)?n:e}function hA(){let e=Q.use(pA);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function gA(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?oA:c,[u]=Q.useState(vA),d;t[8]===u?d=t[9]:(d=()=>Ow(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>mA(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=Fw();return Lw(`left`,Ow(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),Rw(`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(_A)},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: ${Tw}px)`),t=()=>{let e=Ow(u,window.innerWidth,`left`);p(e),C(Lw(`left`,e,Fw())===`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(cA)?.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=>{nc(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":sA,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=oi(`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 q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(pA.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function _A(e){return!e}function vA(){return Dr()}function yA(e){let t=(0,$.c)(39),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{state:p,isDraggingRail:m}=hA();if(d===`none`){let e;t[7]===r?e=t[8]:(e=oi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}let h=p===`collapsed`?d:``,g=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[14]===g?_=t[15]:(_=oi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[16]=_,t[17]=v);let y;t[18]===f?y=t[19]:(y=f({id:`07q4Qk`}),t[18]=f,t[19]=y);let b=u===`floating`||u===`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`,x;t[20]!==r||t[21]!==b?(x=oi(`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)]`,b,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=b,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=(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]=S);let C;t[25]!==a||t[26]!==l||t[27]!==x||t[28]!==S||t[29]!==y?(C=(0,Z.jsx)(`nav`,{id:cA,"aria-label":y,"data-slot":`sidebar-container`,"data-side":l,className:x,...a,children:S}),t[25]=a,t[26]=l,t[27]=x,t[28]=S,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==m||t[32]!==l||t[33]!==p||t[34]!==C||t[35]!==h||t[36]!==v||t[37]!==u?(w=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":p,"data-collapsible":h,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":m,children:[v,C]}),t[31]=m,t[32]=l,t[33]=p,t[34]=C,t[35]=h,t[36]=v,t[37]=u,t[38]=w):w=t[38],w}function bA(e){let t=(0,$.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=hA(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=rc(`toggle-files-sidebar`);l=ci,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=cA,g=o(c===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=o,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[14]===n?_=t[15]:(_=oi(n),t[14]=n,t[15]=_);let v;t[16]!==r||t[17]!==s?(v=e=>{r?.(e),s()},t[16]=r,t[17]=s,t[18]=v):v=t[18];let y;t[19]===c?y=t[20]:(y=c===`expanded`?(0,Z.jsx)(Yt,{}):(0,Z.jsx)(Bl,{}),t[19]=c,t[20]=y);let b;return t[21]!==l||t[22]!==a||t[23]!==u||t[24]!==y||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(b=(0,Z.jsx)(l,{"data-sidebar":u,"data-slot":d,variant:f,size:p,"aria-expanded":m,"aria-controls":h,"aria-label":g,className:_,onClick:v,...a,children:y}),t[21]=l,t[22]=a,t[23]=u,t[24]=y,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=b):b=t[33],b}function xA(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=hA(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:lA,maxResizeWidth:uA,setIsDraggingRail:h,widthCookieName:dA,widthCookieMaxAge:aA},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=rA(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=oi(`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]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function SA(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}=hA(),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=oi(`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 CA(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=oi(`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 wA(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=oi(`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 TA(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=oi(`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 EA(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=oi(`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 DA(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=oi(`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 OA=ii(`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 kA(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?si:`button`,{state:m}=hA(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=oi(OA({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)(js,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Ns,{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)(Is,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function AA(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 jA(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Ir.safeParse(t);return n.success?n.data.currentBranch??null:null}var MA=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:AA({fetchBranch:jA,subscribeToEvent:ns}),NA=MA.subscribe,PA=MA.getSnapshot;function FA(){return(0,Q.useSyncExternalStore)(NA,PA,PA)}function IA(){let e=(0,$.c)(6),t=FA(),n=po(),{state:r}=hA(),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&&ua(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 LA(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=IA();if(!o&&l===null)return null;let u=r??n,d=r!=null,{words:f,chars:p,tokens:m}=u,h;t[0]!==c||t[1]!==d||t[2]!==o?(h=c(o?d?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=c,t[1]=d,t[2]=o,t[3]=h):h=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=g):g=t[4];let _;t[5]===l?_=t[6]:(_=l===null?null:(0,Z.jsx)(RA,{identity:l}),t[5]=l,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[7]=_,t[8]=v);let y;t[9]!==c||t[10]!==u.chars||t[11]!==u.tokens||t[12]!==u.words||t[13]!==p||t[14]!==d||t[15]!==o||t[16]!==m||t[17]!==f?(y=o?(0,Z.jsxs)(`span`,{className:`flex items-center shrink-0 gap-3`,children:[d?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:c({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.words.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`gljvbT`,values:{words:f}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:p}})]}),(0,Z.jsxs)(`span`,{children:[u.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.tokens.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:m}})]})]}):null,t[9]=c,t[10]=u.chars,t[11]=u.tokens,t[12]=u.words,t[13]=p,t[14]=d,t[15]=o,t[16]=m,t[17]=f,t[18]=y):y=t[18];let b;return t[19]!==h||t[20]!==v||t[21]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":h,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[g,v,y]}),t[19]=h,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function RA(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)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Ns,{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)(Oe,{"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 zA(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{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=oi(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function BA(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=oi(`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 VA(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=oi(`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 HA(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=oi(`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 UA(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=oi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(No,{}),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 WA=1,GA=2,KA=4;function qA(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{prefix:e}=je(n,``);if(!e){l=null;break bb0}let u=e.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>KA?[...u.slice(0,WA).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(WA,-GA)},...u.slice(-GA).map((e,t)=>d(e,u.length-GA+t))]:u.map((e,t)=>d(e,t));a=zA,t[8]===r?c=t[9]:(c=oi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=BA,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(JA)}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 JA(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(UA,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(VA,{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)(hl,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(VA,{className:`min-w-0`,children:(0,Z.jsx)(HA,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var YA={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`},XA=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`,...YA,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},ZA=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)(XA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},QA=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)(XA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function $A(e){let t=(0,$.c)(90),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=tc(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[1]!==f||t[2]!==n||t[3]!==u||t[4]!==r||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==c||t[9]!==a){let e=rc(`toggle-document-panel`);v=`editor-toolbar`,y=`pointer-events-none absolute inset-x-0 top-0 z-10`;let i;t[24]===n?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(qA,{docName:n})}),t[24]=n,t[25]=i);let p=r?`source`:`wysiwyg`,m;t[26]===o?m=t[27]:(m=e=>{e&&o(e)},t[26]=o,t[27]=m);let k;t[28]===f?k=t[29]:(k=f({id:`n7aopT`}),t[28]=f,t[29]=k);let A;t[30]===f?A=t[31]:(A=f({id:`ur2XSb`}),t[30]=f,t[31]=A);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(js,{children:(0,Z.jsx)(QA,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(yo,{value:`wysiwyg`,"aria-label":A,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:j}),t[33]=A,t[34]=M);let N;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[35]=N):N=t[35];let P;t[36]===M?P=t[37]:(P=(0,Z.jsxs)(Is,{children:[M,N]}),t[36]=M,t[37]=P);let F;t[38]===f?F=t[39]:(F=f({id:`xbdtfY`}),t[38]=f,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(ZA,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(yo,{value:`source`,"aria-label":F,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:I})})}),t[41]=a,t[42]=F,t[43]=L):L=t[43];let R;t[44]===a?R=t[45]:(R=(0,Z.jsx)(Ns,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[44]=a,t[45]=R);let z;t[46]!==L||t[47]!==R?(z=(0,Z.jsxs)(Is,{children:[L,R]}),t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;t[49]!==p||t[50]!==m||t[51]!==k||t[52]!==P||t[53]!==z?(B=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(xo,{type:`single`,value:p,onValueChange:m,"aria-label":k,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[P,z]})}),t[49]=p,t[50]=m,t[51]=k,t[52]=P,t[53]=z,t[54]=B):B=t[54],t[55]!==i||t[56]!==B?(b=(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:[i,B]})}),t[55]=i,t[56]=B,t[57]=b):b=t[57],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[58]!==f||t[59]!==l||t[60]!==c?(_=c&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(ci,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(Nl,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=Is,h=ci,x=``,S=`ghost`,C=`icon`,w=d,T=!u,E=`doc-panel`,D=f(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=u,t[4]=r,t[5]=l,t[6]=o,t[7]=d,t[8]=c,t[9]=a,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O}else h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=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];let k;t[62]===u?k=t[63]:(k=(0,Z.jsx)(js,{children:u?(0,Z.jsx)(Hl,{}):(0,Z.jsx)(Vl,{})}),t[62]=u,t[63]=k);let A;t[64]!==h||t[65]!==k||t[66]!==x||t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==T||t[71]!==E||t[72]!==D?(A=(0,Z.jsx)(h,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[64]=h,t[65]=k,t[66]=x,t[67]=S,t[68]=C,t[69]=w,t[70]=T,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;t[74]===u?j=t[75]:(j=(0,Z.jsx)(Ns,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(s,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[74]=u,t[75]=j);let M;t[76]!==g||t[77]!==A||t[78]!==j?(M=(0,Z.jsxs)(g,{children:[A,j]}),t[76]=g,t[77]=A,t[78]=j,t[79]=M):M=t[79];let N;t[80]!==_||t[81]!==M||t[82]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[_,M]}),t[80]=_,t[81]=M,t[82]=O,t[83]=N):N=t[83];let P;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[84]=P):P=t[84];let F;return t[85]!==v||t[86]!==y||t[87]!==b||t[88]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":v,className:y,children:[b,N,P]}),t[85]=v,t[86]=y,t[87]=b,t[88]=N,t[89]=F):F=t[89],F}function ej(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function tj(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=oi(`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)(Vd,{"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 nj=ii(`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 rj(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=oi(nj({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)(Hd,{"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 ij(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=oi(`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)(Ud,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function aj(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=oi(`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)(Wd,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var oj=`ok-terminal-height-v1`,sj=.5;function cj(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*sj))}function lj(e,t){let n=cj(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(240,n)}function uj(){return typeof window>`u`?0:window.innerHeight}function dj(e,t){try{let n=e??localStorage,r=t??uj(),i=n.getItem(oj);if(i==null)return lj(240,r);let a=Number.parseInt(i,10);return lj(Number.isFinite(a)?a:240,r)}catch{return 240}}function fj(e,t,n){try{let r=t??localStorage,i=n??uj();r.setItem(oj,String(lj(e,i)))}catch{}}function pj(){try{return typeof localStorage>`u`?240:dj()}catch{return 240}}var mj=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-FU0wWCd1.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([57,1,22,6,3,23,9,11,58,59]),import.meta.url));function hj(e){let t=(0,$.c)(11),{bridge:n,onClose:r,launch:a}=e,o=a===void 0?null:a,{enabled:s,synced:c}=Ai(),l=lo(),{_:u}=i(),d=c&&s===!1,f;t[0]!==u||t[1]!==l?(f=function(){if(l===null){hs.error(u({id:`V_6bJ4`}));return}let e=l(!0);e.ok||hs.error(u({id:`jKd3AP`,values:{0:e.error}}))},t[0]=u,t[1]=l,t[2]=f):f=t[2];let p=f;if(c&&!d){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 i;return t[4]!==n||t[5]!==o||t[6]!==r?(i=(0,Z.jsx)(ce,{fallbackRender:_j,onError:gj,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(mj,{bridge:n,className:`h-full`,onClose:r,launch:o})})}),t[4]=n,t[5]=o,t[6]=r,t[7]=i):i=t[7],i}let m;return t[8]!==p||t[9]!==d?(m=d?(0,Z.jsx)(bj,{onEnable:p}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[8]=p,t[9]=d,t[10]=m):m=t[10],m}function gj(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function _j(e){return(0,Z.jsx)(vj,{...e})}function vj(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=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]=a):a=t[2];let o=a,s;t[3]===r?s=t[4]:(s=r({id:`6MnZEC`}),t[3]=r,t[4]=s);let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[5]=o,t[6]=c);let l;t[7]===r?l=t[8]:(l=r({id:`HpK_8d`}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(ci,{onClick:yj,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function yj(){return window.location.reload()}function bj(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=i(),a;t[0]===r?a=t[1]:(a=r({id:`_XWY2J`}),t[0]=r,t[1]=a);let o;t[2]===r?o=t[3]:(o=r({id:`oYepHb`}),t[2]=r,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[4]=o,t[5]=s);let c;t[6]===r?c=t[7]:(c=r({id:`v2ZW0K`}),t[6]=r,t[7]=c);let l;t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(ci,{onClick:n,children:c}),t[8]=n,t[9]=c,t[10]=l):l=t[10];let u;t[11]===r?u=t[12]:(u=r({id:`ICoNYz`}),t[11]=r,t[12]=u);let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),t[13]=u,t[14]=d);let f;return t[15]!==a||t[16]!==s||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{"aria-label":a,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[s,l,d]}),t[15]=a,t[16]=s,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function xj(e){let t=(0,$.c)(36),{sessions:n,activeSessionId:r,onSelect:a,onTabActivate:o,onNew:c,onClose:l,children:u,className:d}=e,{_:f}=i(),p;t[0]===d?p=t[1]:(p=oi(`flex min-h-0 min-w-0 flex-1 flex-col`,d),t[0]=d,t[1]=p);let m;t[2]===f?m=t[3]:(m=f({id:`1MGRQl`}),t[2]=f,t[3]=m);let h;if(t[4]!==f||t[5]!==r||t[6]!==l||t[7]!==o||t[8]!==n){let e;t[10]!==f||t[11]!==r||t[12]!==l||t[13]!==o?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:oi(`group flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(ij,{value:e.id,onClick:()=>o?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":f({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:oi(`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(),l(e.id)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`})})]},e.id)},t[10]=f,t[11]=r,t[12]=l,t[13]=o,t[14]=e):e=t[14],h=n.map(e),t[4]=f,t[5]=r,t[6]=l,t[7]=o,t[8]=n,t[9]=h}else h=t[9];let g;t[15]!==m||t[16]!==h?(g=(0,Z.jsx)(rj,{variant:`line`,"aria-label":m,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:h}),t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;t[18]===f?_=t[19]:(_=f({id:`AB4qw9`}),t[18]=f,t[19]=_);let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(V,{"aria-hidden":`true`}),t[20]=v):v=t[20];let y;t[21]!==c||t[22]!==_?(y=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:c,children:v})}),t[21]=c,t[22]=_,t[23]=y):y=t[23];let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`AB4qw9`})}),t[24]=b):b=t[24];let x;t[25]===y?x=t[26]:(x=(0,Z.jsxs)(Is,{children:[y,b]}),t[25]=y,t[26]=x);let S;t[27]!==g||t[28]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[g,x]}),t[27]=g,t[28]=x,t[29]=S):S=t[29];let C;return t[30]!==r||t[31]!==u||t[32]!==a||t[33]!==p||t[34]!==S?(C=(0,Z.jsxs)(tj,{value:r,onValueChange:a,className:p,children:[S,u]}),t[30]=r,t[31]=u,t[32]=a,t[33]=p,t[34]=S,t[35]=C):C=t[35],C}var Sj=`terminal-dock-panel`;function Cj(e){return`terminal-session-${e}`}function wj(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function Tj(e){let t=(0,$.c)(77),{bridge:n,children:r,visible:a,onVisibleChange:o,launch:s}=e,c=s===void 0?null:s,{_:l}=i(),{resolvedTheme:u}=Yr(),d=Tx(),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(!a),h;t[0]!==c||t[1]!==a?(h=()=>a?[{id:Cj(1),launch:c}]:[],t[0]=c,t[1]=a,t[2]=h):h=t[2];let[g,_]=(0,Q.useState)(h),v;t[3]===a?v=t[4]:(v=()=>a?Cj(1):``,t[3]=a,t[4]=v);let[y,b]=(0,Q.useState)(v),x=(0,Q.useRef)(y),S=(0,Q.useRef)(g),C=(0,Q.useRef)(+!!a),w=(0,Q.useRef)(a&&c?c.nonce:null),T=(0,Q.useRef)(a),E;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){C.current+=1;let t=Cj(C.current);_(n=>[...n,{id:t,launch:e}]),b(t)},t[5]=E):E=t[5];let D=E,O=(0,Q.useRef)(D),k;t[6]!==y||t[7]!==o?(k=function(e){let t=S.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===y){let e=(t[n-1]??t[n+1])?.id??``;b(e),e!==``&&queueMicrotask(()=>wj(e))}_(r),r.length===0&&(o(!1),f.current?.focus())},t[6]=y,t[7]=o,t[8]=k):k=t[8];let A=k,j=(0,Q.useRef)(Oj),M;t[9]!==y||t[10]!==A||t[11]!==g?(M=()=>{O.current=D,x.current=y,S.current=g,j.current=()=>{y!==``&&A(y)}},t[9]=y,t[10]=A,t[11]=g,t[12]=M):M=t[12],(0,Q.useEffect)(M);let[N]=(0,Q.useState)(Dj),P=(0,Q.useRef)(N),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){R.current!=null&&clearTimeout(R.current),R.current=setTimeout(()=>{fj(e),R.current=null},100)},t[13]=z):z=t[13];let B=z,V=(0,Q.useRef)(null),H,U;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>()=>{R.current!=null&&clearTimeout(R.current),V.current!=null&&(window.removeEventListener(`pointerup`,V.current),V.current=null)},U=[],t[14]=H,t[15]=U):(H=t[14],U=t[15]),(0,Q.useEffect)(H,U);let W,G;t[16]!==c||t[17]!==g.length||t[18]!==a?(W=()=>{let e=T.current;if(T.current=a,c!=null&&c.nonce!==w.current){w.current=c.nonce,O.current(c);return}a&&!e&&g.length===0&&O.current(null)},G=[a,c,g.length],t[16]=c,t[17]=g.length,t[18]=a,t[19]=W,t[20]=G):(W=t[19],G=t[20]),(0,Q.useEffect)(W,G);let K,q;t[21]===n?(K=t[22],q=t[23]):(K=()=>n.onMenuAction(e=>{e===`new-terminal`?O.current(null):e===`kill-terminal`&&j.current()}),q=[n],t[21]=n,t[22]=K,t[23]=q),(0,Q.useEffect)(K,q);let J,ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(Sj)?.contains(document.activeElement))return;let t=S.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),b(t.id),queueMicrotask(()=>wj(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ee=[],t[24]=J,t[25]=ee):(J=t[24],ee=t[25]),(0,Q.useEffect)(J,ee);let Y;t[26]!==n.editor||t[27]!==g.length?(Y=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:g.length>0})},t[26]=n.editor,t[27]=g.length,t[28]=Y):Y=t[28];let te;t[29]!==n||t[30]!==g.length?(te=[n,g.length],t[29]=n,t[30]=g.length,t[31]=te):te=t[31],(0,Q.useEffect)(Y,te);let ne,X;t[32]!==d||t[33]!==a?(ne=()=>{let e=d.current;e!=null&&(a?e.resize(`${P.current}px`):e.collapse())},X=[a,d],t[32]=d,t[33]=a,t[34]=ne,t[35]=X):(ne=t[34],X=t[35]),(0,Q.useEffect)(ne,X);let re,ie;t[36]===p?(re=t[37],ie=t[38]):(re=()=>{p&&document.getElementById(Sj)?.contains(document.activeElement)&&f.current?.focus()},ie=[p],t[36]=p,t[37]=re,t[38]=ie),(0,Q.useLayoutEffect)(re,ie);let ae,oe;t[39]===p?(ae=t[40],oe=t[41]):(ae=()=>{p||wj(x.current)},oe=[p],t[39]=p,t[40]=ae,t[41]=oe),(0,Q.useEffect)(ae,oe);let se;if(t[42]!==l||t[43]!==g){let e;t[45]===l?e=t[46]:(e=(e,t)=>({id:e.id,label:l({id:`OVjNeX`,values:{0:t+1}})}),t[45]=l,t[46]=e),se=g.map(e),t[42]=l,t[43]=g,t[44]=se}else se=t[44];let ce=se,le=F||void 0,ue;t[47]===r?ue=t[48]:(ue=(0,Z.jsx)(qC,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:f,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[47]=r,t[48]=ue);let de;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(JC,{withHandle:!0,onPointerDown:()=>{I(!0),L.current=!0;let e=()=>{I(!1),L.current=!1,window.removeEventListener(`pointerup`,e),V.current=null};V.current=e,window.addEventListener(`pointerup`,e)}}),t[49]=de):de=t[49];let fe;t[50]===u?fe=t[51]:(fe=Lc(u),t[50]=u,t[51]=fe);let pe;t[52]===fe.background?pe=t[53]:(pe={backgroundColor:fe.background},t[52]=fe.background,t[53]=pe);let me=a?`${N}px`:0,he;t[54]!==o||t[55]!==a?(he=e=>{let t=e.asPercentage===0;m(t),L.current&&(t&&a?o(!1):!t&&!a&&o(!0),e.inPixels>0&&(P.current=e.inPixels,B(e.inPixels)))},t[54]=o,t[55]=a,t[56]=he):he=t[56];let ge=!F&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,_e;t[57]===ge?_e=t[58]:(_e=oi(`flex flex-col`,ge),t[57]=ge,t[58]=_e);let ve;t[59]!==y||t[60]!==n||t[61]!==A||t[62]!==g||t[63]!==ce?(ve=g.length>0?(0,Z.jsx)(xj,{sessions:ce,activeSessionId:y,onSelect:b,onTabActivate:Ej,onNew:()=>D(null),onClose:A,className:`h-full`,children:g.map(e=>(0,Z.jsx)(aj,{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)(hj,{bridge:n,launch:e.launch,onClose:()=>A(e.id)})},e.id))}):null,t[59]=y,t[60]=n,t[61]=A,t[62]=g,t[63]=ce,t[64]=ve):ve=t[64];let ye;t[65]!==p||t[66]!==d||t[67]!==pe||t[68]!==me||t[69]!==he||t[70]!==_e||t[71]!==ve?(ye=(0,Z.jsx)(qC,{id:Sj,style:pe,panelRef:d,defaultSize:me,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:he,inert:p,className:_e,children:ve}),t[65]=p,t[66]=d,t[67]=pe,t[68]=me,t[69]=he,t[70]=_e,t[71]=ve,t[72]=ye):ye=t[72];let be;return t[73]!==le||t[74]!==ue||t[75]!==ye?(be=(0,Z.jsxs)(KC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":le,children:[ue,de,ye]}),t[73]=le,t[74]=ue,t[75]=ye,t[76]=be):be=t[76],be}function Ej(e){return queueMicrotask(()=>wj(e))}function Dj(){return pj()}function Oj(){}var kj=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BuhneEc6.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent})),Aj=`300px`,jj=`600px`;function Mj(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(Pj,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Nj,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Wt,{name:`editor-area`,children:(0,Z.jsxs)(AC,{children:[n,r]})}),t[3]=n,t[4]=i),i}function Nj(){let e=(0,$.c)(5),t=Dg(),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)(VC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function Pj(e){let t=(0,$.c)(157),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,terminalBridge:c,terminalVisible:l,onTerminalVisibleChange:u,terminalLaunch:d}=e,f=l===void 0?!1:l,p=d===void 0?null:d,{_:m}=i(),{activeDocName:h,activeProvider:g,activeTarget:_,recycleDocument:v,docPanelMode:y,docPanelAgentId:b,docPanelExpandSignal:S}=mt(),{openDocumentTransition:C}=Dt(),{requestAddProperty:w}=MC(),T=gw(g,h),E=yw(h,n===`source`?`source`:`wysiwyg`),D=zw(g),O=D===`connected`||D===`synced`,k=vw(h)===`conflict`,[A,j]=(0,Q.useState)(!1),M,N;t[0]!==g||t[1]!==A?(M=()=>{g!=null&&!A&&j(!0)},N=[g,A],t[0]=g,t[1]=A,t[2]=M,t[3]=N):(M=t[2],N=t[3]),(0,Q.useEffect)(M,N);let P=(0,Q.useDeferredValue)(h),F=_?.kind===`missing`,I=!!h&&_?.kind!==`folder`,L;t[4]!==m||t[5]!==F?(L=F?m({id:`K-a33w`}):void 0,t[4]=m,t[5]=F,t[6]=L):L=t[6];let R=L,[z]=(0,Q.useState)(Lj),B=z!==null,V;t[7]===z?V=t[8]:(V=()=>Ow(z,window.innerWidth,`right`),t[7]=z,t[8]=V);let[H,U]=(0,Q.useState)(V),W=(0,Q.useRef)(H),G,K;t[9]===H?(G=t[10],K=t[11]):(G=()=>{W.current=H},K=[H],t[9]=H,t[10]=G,t[11]=K),(0,Q.useEffect)(G,K);let q=Tx(),J;t[12]===H?J=t[13]:(J=()=>Lw(`right`,H,Fw())===`collapsed`,t[12]=H,t[13]=J);let[ee]=(0,Q.useState)(J),[Y,te]=(0,Q.useState)(ee),ne=(0,Q.useRef)(Y),X,re;t[14]===Y?(X=t[15],re=t[16]):(X=()=>{ne.current=Y},re=[Y],t[14]=Y,t[15]=X,t[16]=re),(0,Q.useEffect)(X,re);let[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(!1),[se]=(0,Q.useState)(Ij),ce=(0,Q.useRef)(se),le=(0,Q.useRef)(null),ue;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(e){le.current!=null&&clearTimeout(le.current),le.current=setTimeout(()=>{Cw(e),le.current=null},100)},t[17]=ue):ue=t[17];let de=ue,fe,pe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>()=>{le.current!=null&&clearTimeout(le.current)},pe=[],t[18]=fe,t[19]=pe):(fe=t[18],pe=t[19]),(0,Q.useEffect)(fe,pe);let[me,he]=(0,Q.useState)(null),ge;t[20]!==Y||t[21]!==q?(ge=function(){if(q.current==null)return;let e=W.current;Y?(Rw(`right`,e,`open`),q.current?.expand()):(Rw(`right`,e,`collapsed`),q.current?.collapse())},t[20]=Y,t[21]=q,t[22]=ge):ge=t[22];let _e=ge,ve,ye;t[23]!==z||t[24]!==q?(ve=()=>{let e=window.matchMedia(`(min-width: ${Ew}px)`),t=()=>{let e=Ow(z,window.innerWidth,`right`);U(e);let t=Lw(`right`,e,Fw())===`collapsed`;te(t),t?q.current?.collapse():q.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ye=[z,q],t[23]=z,t[24]=q,t[25]=ve,t[26]=ye):(ve=t[25],ye=t[26]),(0,Q.useEffect)(ve,ye);let be,xe;t[27]!==me||t[28]!==B||t[29]!==q?(be=()=>{if(me==null||B)return;let e=new ResizeObserver(()=>{ne.current||oe.current||q.current?.resize(`${ce.current}px`)});return e.observe(me),()=>e.disconnect()},xe=[me,B,q],t[27]=me,t[28]=B,t[29]=q,t[30]=be,t[31]=xe):(be=t[30],xe=t[31]),(0,Q.useEffect)(be,xe);let Se,Ce;t[32]!==o||t[33]!==q?(Se=()=>{let e=e=>{o(e),q.current?.expand()},t=Eh();return t&&e(t),Oh(t=>{Eh(),e(t)})},Ce=[o,q],t[32]=o,t[33]=q,t[34]=Se,t[35]=Ce):(Se=t[34],Ce=t[35]),(0,Q.useEffect)(Se,Ce);let we,Te;t[36]!==S||t[37]!==q?(we=()=>{S!==0&&q.current?.expand()},Te=[S,q],t[36]=S,t[37]=q,t[38]=we,t[39]=Te):(we=t[38],Te=t[39]),(0,Q.useEffect)(we,Te);let Ee,De;t[40]===Y?(Ee=t[41],De=t[42]):(Ee=()=>{if(!Y||!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()},De=[Y],t[40]=Y,t[41]=Ee,t[42]=De),(0,Q.useLayoutEffect)(Ee,De);let Oe,ke;t[43]===Y?(Oe=t[44],ke=t[45]):(Oe=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Y})},ke=[Y],t[43]=Y,t[44]=Oe,t[45]=ke),(0,Q.useEffect)(Oe,ke);let Ae,je;t[46]===_e?(Ae=t[47],je=t[48]):(Ae=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&_e()})},je=[_e],t[46]=_e,t[47]=Ae,t[48]=je),(0,Q.useEffect)(Ae,je);let Me,Ne;t[49]===_e?(Me=t[50],Ne=t[51]):(Me=()=>{if(window.okDesktop!=null)return;let e=e=>{nc(e,`toggle-document-panel`)&&(e.preventDefault(),_e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ne=[_e],t[49]=_e,t[50]=Me,t[51]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=(0,Q.useRef)(null),[Fe,Ie]=(0,Q.useState)(null),Le=_?.kind===`large-file`?_.docName:h,Re,ze;t[52]===Le?(Re=t[53],ze=t[54]):(Re=()=>{if(Le&&Le!==Pe.current){let e=Pe.current;Pe.current=Le,Ie(e)}},ze=[Le],t[52]=Le,t[53]=Re,t[54]=ze),(0,Q.useEffect)(Re,ze);let Ve;t[55]===C?Ve=t[56]:(Ve=function(e){let t=Vo(e);window.location.hash===t?C(e):window.location.hash=t},t[55]=C,t[56]=Ve);let He=Ve,Ue,We=null;if(_?.kind===`large-file`){let e;t[57]!==He||t[58]!==Fe?(e=Fe?{previousDocName:Fe,onNavigateBack:He}:void 0,t[57]=He,t[58]=Fe,t[59]=e):e=t[59];let n;t[60]!==_.docName||t[61]!==_.limit||t[62]!==_.size||t[63]!==e?(n=(0,Z.jsx)(EC,{docName:_.docName,size:_.size,limit:_.limit,backNav:e}),t[60]=_.docName,t[61]=_.limit,t[62]=_.size,t[63]=e,t[64]=n):n=t[64],Ue=n}else if(_?.kind===`folder`){let e;if(t[65]===_.folderPath?e=t[66]:(e=(0,Z.jsx)(SC,{folderPath:_.folderPath}),t[65]=_.folderPath,t[66]=e),Ue=e,y===`agent`&&b!==null){let e;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(JC,{withHandle:!0}),t[67]=e):e=t[67];let n;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(qC,{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)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(kj,{showBackButton:!1})})})]}),t[68]=n):n=t[68],We=n}}else if(_?.kind===`asset`){let e;t[69]!==_.assetPath||t[70]!==_.mediaKind?(e=(0,Z.jsx)(Rx,{assetPath:_.assetPath,mediaKind:_.mediaKind},_.assetPath),t[69]=_.assetPath,t[70]=_.mediaKind,t[71]=e):e=t[71],Ue=e}else if(!g||!h)if((typeof window<`u`?is(window.location.hash):null)!==null)if(c!=null&&A){let e;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zx,{}),t[72]=e):e=t[72],Ue=e;let n;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(JC,{withHandle:!0,disabled:!0}),t[73]=n):n=t[73];let r=ee?0:`${se}px`,i;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[74]=i):i=t[74];let a;t[75]===r?a=t[76]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(qC,{id:`doc-panel`,defaultSize:r,minSize:Aj,maxSize:jj,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[75]=r,t[76]=a),We=a}else{let e;return t[77]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zx,{}),t[77]=e):e=t[77],e}else{let e;t[78]===f?e=t[79]:(e=(0,Z.jsx)(HS,{terminalVisible:f}),t[78]=f,t[79]=e),Ue=e}else{let e=n===`source`,i=!O,s=Y,c;t[80]!==h||t[81]!==w?(c=function(){h&&w(h)},t[80]=h,t[81]=w,t[82]=c):c=t[82];let l=c,u=P??h,d=Fe??void 0,f;t[83]!==R||t[84]!==e||t[85]!==He||t[86]!==v||t[87]!==u||t[88]!==d?(f=(0,Z.jsx)(Wk,{activeDocName:u,isSourceMode:e,editorPlaceholder:R,previousDocName:d,onNavigateBack:He,onRecycle:v}),t[83]=R,t[84]=e,t[85]=He,t[86]=v,t[87]=u,t[88]=d,t[89]=f):f=t[89];let p;t[90]!==h||t[91]!==e?(p=(0,Z.jsx)(fw,{activeDocName:h,isSourceMode:e}),t[90]=h,t[91]=e,t[92]=p):p=t[92];let m;t[93]!==h||t[94]!==P?(m=ej({activeDocName:h,deferredActiveDocName:P,mountResolved:h!==null&&x(h),syncResolved:h!==null&&Be(h)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(zx,{}),h===null?null:(0,Z.jsx)(DC,{docName:h})]}):null,t[93]=h,t[94]=P,t[95]=m):m=t[95];let g;t[96]!==f||t[97]!==p||t[98]!==m?(g=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[f,p,m]}),t[96]=f,t[97]=p,t[98]=m,t[99]=g):g=t[99];let _;t[100]!==h||t[101]!==k||t[102]!==s||t[103]!==e||t[104]!==r||t[105]!==l||t[106]!==i||t[107]!==_e?(_=!k&&(0,Z.jsx)($A,{activeDocName:h,isSourceMode:e,sourceDisabled:i,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:_e}),t[100]=h,t[101]=k,t[102]=s,t[103]=e,t[104]=r,t[105]=l,t[106]=i,t[107]=_e,t[108]=_):_=t[108];let b;t[109]!==g||t[110]!==_?(b=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[g,_]}),t[109]=g,t[110]=_,t[111]=b):b=t[111];let S;t[112]!==E||t[113]!==I||t[114]!==T?(S=(0,Z.jsx)(LA,{stats:T,selectionStats:E,showStats:I}),t[112]=E,t[113]=I,t[114]=T,t[115]=S):S=t[115];let C;t[116]!==b||t[117]!==S?(C=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[b,S]}),t[116]=b,t[117]=S,t[118]=C):C=t[118],Ue=C;let D=B&&Y,A;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{ae(!0),oe.current=!0;let e=()=>{ae(!1),oe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[119]=A):A=t[119];let j;t[120]===D?j=t[121]:(j=(0,Z.jsx)(JC,{withHandle:!0,disabled:D,onPointerDown:A}),t[120]=D,t[121]=j);let M=ee?0:`${se}px`,N;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{te(e.asPercentage===0),e.inPixels>0&&oe.current&&(ce.current=e.inPixels,de(e.inPixels))},t[122]=N):N=t[122];let F=!ie&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,L;t[123]===F?L=t[124]:(L=oi(`flex flex-col bg-muted/20`,F),t[123]=F,t[124]=L);let z;t[125]!==h||t[126]!==a||t[127]!==y||t[128]!==e||t[129]!==o?(z=(0,Z.jsx)(jy,{docName:h,isSourceMode:e,activeTab:a,onActiveTabChange:o,mode:y}),t[125]=h,t[126]=a,t[127]=y,t[128]=e,t[129]=o,t[130]=z):z=t[130];let V;t[131]!==Y||t[132]!==q||t[133]!==M||t[134]!==L||t[135]!==z?(V=(0,Z.jsx)(qC,{id:`doc-panel`,panelRef:q,defaultSize:M,minSize:Aj,maxSize:jj,collapsible:!0,collapsedSize:0,onResize:N,inert:Y,className:L,children:z}),t[131]=Y,t[132]=q,t[133]=M,t[134]=L,t[135]=z,t[136]=V):V=t[136];let H;t[137]!==j||t[138]!==V?(H=(0,Z.jsxs)(Z.Fragment,{children:[j,V]}),t[137]=j,t[138]=V,t[139]=H):H=t[139],We=H}let Ge;t[140]!==u||t[141]!==c||t[142]!==p||t[143]!==f||t[144]!==Ue?(Ge=c==null?Ue:(0,Z.jsx)(Tj,{bridge:c,visible:f,onVisibleChange:u??Fj,launch:p,children:Ue}),t[140]=u,t[141]=c,t[142]=p,t[143]=f,t[144]=Ue,t[145]=Ge):Ge=t[145];let Ke=Ge,qe=ie||void 0,Je;t[146]!==ee||t[147]!==We?(Je=We!=null&&!ee?{}:{defaultSize:`100%`},t[146]=ee,t[147]=We,t[148]=Je):Je=t[148];let Ye=ie?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Xe;t[149]!==Ke||t[150]!==Je||t[151]!==Ye?(Xe=(0,Z.jsx)(qC,{minSize:`30%`,...Je,className:Ye,children:Ke}),t[149]=Ke,t[150]=Je,t[151]=Ye,t[152]=Xe):Xe=t[152];let Ze;return t[153]!==We||t[154]!==qe||t[155]!==Xe?(Ze=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:he,children:(0,Z.jsxs)(KC,{orientation:`horizontal`,"data-dragging":qe,children:[Xe,We]})}),t[153]=We,t[154]=qe,t[155]=Xe,t[156]=Ze):Ze=t[156],Ze}function Fj(){}function Ij(){return ww()}function Lj(){return Dr()}function Rj(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 zj(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 Bj=1e3,Vj=!1;function Hj(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function Uj(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:Si(i)?a=i:(a=void 0,Vj||(Vj=!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`&&(Hj({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=zj(i),{current:c,crossDoc:l}=a?_i(a,n,Date.now()):{current:[],crossDoc:[]},u=Wj,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Rj(e.current,p)&&Rj(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,Bj);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 Wj(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Gj=`sync-status`;function Kj(e,t){let n=(0,$.c)(6),{_:r}=i(),a=cm(),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(t),l,u;n[0]!==r||n[1]!==t||n[2]!==a||n[3]!==e?(l=()=>{if(c.current!==t&&(c.current=t,o.current=!1,s.current=!1),t)if(e===`synced`&&(o.current=!0),e===`disconnected`&&o.current){if(a){hs.dismiss(Gj);return}s.current=!0,hs.warning(r({id:`HGNCsl`}),{id:Gj,duration:1/0})}else s.current&&e===`synced`&&(s.current=!1,hs.success(r({id:`GhjUB_`}),{id:Gj,duration:3e3}))},u=[e,t,r,a],n[0]=r,n[1]=t,n[2]=a,n[3]=e,n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,Q.useEffect)(l,u)}var qj=4,Jj=3,Yj={Bird:tl,Cat:sl,Dog:ml,Fish:bl,Mouse:ql,Rabbit:Kl,Shrimp:$l,Snail:eu,Squirrel:iu,Turtle:fu};Object.freeze(Object.keys(Yj));function Xj(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(Yj,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var Zj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function Qj(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=Xj(n),c=s.kind===`animal`?Yj[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=nr(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Wr(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(Ns,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Is,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function $j(e){let t=Zj[e.icon];return e.displayName||t||ms._({id:`iEQQyu`})}function eM(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 tM(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=mt(),{presence:u,agentId:d}=n,f=$j(u),p=eM(u.mode),m=!r&&p,h=u.currentDoc&&u.currentDoc!==`(connected)`?u.currentDoc:null,g=l!==null||h!==null,_=g?`cursor-pointer`:`cursor-default opacity-50`,v=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,y=m&&!a?`ring-primary/40 animate-pulse`:``,b;t[0]!==_||t[1]!==v||t[2]!==y?(b=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,_,v,y].filter(Boolean),t[0]=_,t[1]=v,t[2]=y,t[3]=b):b=t[3];let x=b.join(` `),S=r?`true`:void 0,C=a?`true`:void 0,w=g?void 0:`true`,T;t[4]!==u.mode||t[5]!==S||t[6]!==C||t[7]!==w?(T={"data-presence-badge":`agent`,"data-presence-mode":u.mode,"data-presence-crossdoc":S,"data-presence-scoped":C,"data-presence-inert":w},t[4]=u.mode,t[5]=S,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=T,D=c(r&&h?{id:`b4AQFK`,values:{tooltipName:f,realCurrentDoc:h}}:{id:`RfHNf8`,values:{tooltipName:f}}),O;t[9]!==d||t[10]!==D||t[11]!==E||t[12]!==g||t[13]!==o||t[14]!==u.color||t[15]!==u.icon||t[16]!==h||t[17]!==x||t[18]!==f?(O=g?(0,Z.jsx)(`button`,{type:`button`,...E,"aria-label":D,className:x,style:{backgroundColor:u.color},onClick:()=>o(d,h),children:(0,Z.jsx)(bi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...E,role:`img`,"aria-label":f,className:x,style:{backgroundColor:u.color},children:(0,Z.jsx)(bi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=d,t[10]=D,t[11]=E,t[12]=g,t[13]=o,t[14]=u.color,t[15]=u.icon,t[16]=h,t[17]=x,t[18]=f,t[19]=O):O=t[19];let k=O,A;t[20]===k?A=t[21]:(A=(0,Z.jsx)(js,{asChild:!0,children:k}),t[20]=k,t[21]=A);let j;t[22]===f?j=t[23]:(j=(0,Z.jsx)(`span`,{className:`font-medium`,children:f}),t[22]=f,t[23]=j);let M;t[24]!==r||t[25]!==h?(M=r&&h?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:h}})}):null,t[24]=r,t[25]=h,t[26]=M):M=t[26];let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsxs)(Ns,{className:`flex flex-col gap-0.5`,children:[j,M]}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;return t[30]!==A||t[31]!==N?(P=(0,Z.jsxs)(Is,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function nM(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)(Qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(tM,{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)(b,{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)(fe,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function rM(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(Qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(tM,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function iM(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=mt(),{current:s,crossDoc:c}=Uj(t,r,n);if(Kj(zw(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,qj),n;e[6]===s?n=e[7]:(n=s.slice(qj),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Jj),d;e[8]===c?d=e[9]:(d=c.slice(Jj),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=>rM(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)(nM,{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=>rM(e,p,!0,m)),f.length>0?(0,Z.jsx)(nM,{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}var aM=new Set([`.md`,`.mdx`]);function oM(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function sM(e,t){let n=e.lastIndexOf(`/`),r=n<0?``:e.slice(0,n+1),i=n<0?e:e.slice(n+1),a=i.lastIndexOf(`.`);return`${r}${a<=0?i:i.slice(0,a)}${t}`}function cM(e){return aM.has(oM(e).toLowerCase())}function lM(e,t,n){if(n)return{kind:`allow`,destinationPath:t};let r=oM(e);return r===``?{kind:`allow`,destinationPath:t}:{kind:`allow`,destinationPath:oM(t)?t:sM(t,r)}}var uM=`.md`,dM=/\.(md|mdx)$/i;function fM(e,t=uM){return`${e}${t}`}function pM(e){return BM(e).replace(dM,``)}function mM(e){return Zo(e)?_M(e.path):Ro(e)?e.path:fM(e.docName,e.docExt)}function hM(e){let t=BM(e).match(dM);return t?`.${t[1].toLowerCase()}`:void 0}function gM(e){return BM(e)}function _M(e){let t=BM(e.trim());return t?`${t}/`:``}function vM(e){return e.endsWith(`/`)?gM(e):pM(e)}function yM(e){return e.map(mM)}function bM(e){return[...e].sort().join(`\0`)}function xM(e){return bM(yM(e))}function SM(e){let t=new Set;for(let n of e){if(Zo(n)){let e=_M(n.path);e&&t.add(e)}let e=(Zo(n)||Ro(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Zo(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function CM(e){if(!e)return[];let t=BM(e.replace(dM,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function wM(e,t,n){let r=hM(e);if(r)return r;let i=n.find(e=>fs(e)&&e.docName===t);return i?i.docExt??uM:zM(e).includes(`.`)?void 0:uM}function TM(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!Ro(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function EM(e,t,n){if(hM(e))return null;let r=n.find(e=>Ro(e)&&e.path===t);return r?r.path:zM(e).includes(`.`)?t:TM(t,n)}function DM(e,t){let n=e.kind===`directory`,r=n?gM(e.path):pM(e.path);if(n)return{kind:`folder`,name:BM(zM(e.path)).replace(dM,``),path:r,treePath:kM(e.path,!0)};let i=EM(e.path,r,t);if(i)return{kind:`asset`,name:BM(zM(i)),path:i,treePath:i};let a=wM(e.path,r,t);return{kind:`file`,name:BM(zM(e.path)).replace(dM,``),path:r,treePath:kM(e.path,!1),docExt:a}}function OM(e){return e.kind===`directory`?gM(e.path):e.path}function kM(e,t){return t?_M(e):dM.test(e)?e:`${e}${uM}`}function AM(e,t,n){let r=_M(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${uM}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function jM(e,t){return e===`file`?kM(t,!1):`${gM(t)}/index${uM}`}function MM(e,t){return t.kind===`root`||t.directoryPath==null?zM(e):`${t.directoryPath}${zM(e)}`}function NM(e,t){if(t)return gM(_M(e));let n=pM(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function PM(e,t){let n=gM(_M(e));return n?`${n}/${t}`:t}function FM(e,t){return(t.path??PM(e,t.src)).replace(/^\/+/,``)}function IM(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function LM(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function RM(e,t){let n=oM(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:pM(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:ar(i),modified:r,size:t.size}}function zM(e){let t=BM(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function BM(e){return e.endsWith(`/`)?e.slice(0,-1):e}function VM(e,t){return t.trim()}function HM(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function UM(e,t){let n=VM(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function WM(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(fs(e)){let t=s.get(fM(e.docName,e.docExt));if(t){let n=Bo(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:ar(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(Zo(e))return{...e,path:ZM(e.path,n)};if(Ro(e)){let t=s.get(e.path);return t&&cM(t)?{kind:`document`,docName:pM(t),docExt:oM(t),size:e.size,modified:e.modified}:{...e,path:t??ZM(e.path,n)}}return e})}function GM(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=>fs(e)?!i.has(e.docName)&&!tN(e.docName,n):Zo(e)?!tN(e.path,n):Ro(e)?!a.has(e.path)&&!tN(e.path,n):!0)}function KM(e,t){if(e.kind!==`asset`||t.some(t=>Ro(t)&&t.path===e.path))return e;let n=TM(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function qM(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>QM(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>fs(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=>Zo(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(fs(i)){let e=eN(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Zo(i)){let e=$M(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function JM(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function YM(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function XM(e,t){let n=e.kind===`file`?fM(e.path,e.docExt):e.path;return Qg(t.contentDir,n,t.pathSeparator)}function ZM(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 QM(e,t){return fs(e)&&fs(t)?e.docName===t.docName:Zo(e)&&Zo(t)||Ro(e)&&Ro(t)?e.path===t.path:!1}function $M(e,t,n){return e===t?n:eN(e,t,n)}function eN(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function tN(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function nN(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)(pd,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function rN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(md,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function iN(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)(_d,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function aN(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)(Cd,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function oN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`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)(hd,{children:(0,Z.jsx)(gd,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function sN(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=oi(`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)(yd,{"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 cN(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=oi(`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)(No,{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)(wd,{"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 lN(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=oi(`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)(Td,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function uN(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=oi(`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)(xd,{children:(0,Z.jsx)(ko,{})})}),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)(bd,{"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 dN(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=oi(`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)(vd,{"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 fN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`-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)(Sd,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var pN=`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`,mN=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,hN={start:[Wi.Space],cancel:[Wi.Esc],end:[Wi.Space,Wi.Enter]};function gN(e){return oi(pN,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function _N(e){return e?void 0:-1}function vN({className:e,isDragging:t}){return oi(e,t&&mN)}function yN(e){return e.code===Wi.Enter&&e.target===e.currentTarget}function bN({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&yN(e)?`activate-tab`:`delegate-sortable`}function xN({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Na.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 SN(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 CN(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 wN=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 Sa(e)},TN=[`.md`,`.mdx`],EN=`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`,DN=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,ON=oi(DN,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),kN=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function AN(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function jN(e){let t=Vo(e);window.location.hash!==t&&(window.location.hash=t)}function MN(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function NN(e,t){let n=[t,...TN].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 PN(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:_}=Ri(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=xN({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=bN({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=vN({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 FN(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=Je(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=Je(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(rN,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(sN,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(sN,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(sN,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(fN,{}),(0,Z.jsx)(sN,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(oN,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(nN,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function IN(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:a,isPinned:o,tabId:s,unpinTab:c}=e,{_:l}=i();if(o){let e;t[0]!==l||t[1]!==n?(e=l({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=l,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==s||t[4]!==c?(r=e=>{e.stopPropagation(),c(s)},t[3]=s,t[4]=c,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Gl,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let u;t[10]!==l||t[11]!==n?(u=l({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=l,t[11]=n,t[12]=u):u=t[12];let d;t[13]===a?d=t[14]:(d=gN(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=_N(a),t[15]=a,t[16]=f);let p;t[17]!==r||t[18]!==s?(p=e=>{e.stopPropagation(),r(s)},t[17]=r,t[18]=s,t[19]=p):p=t[19];let m;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(gs,{"aria-hidden":`true`}),t[20]=m):m=t[20];let h;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p?(h=(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u,"data-testid":`editor-tab-close-button`,className:d,tabIndex:f,onClick:p,children:m}),t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=h):h=t[25],h}function LN(e){let t=(0,$.c)(1),{docName:n}=e;if(vw(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Lo,{"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 RN(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=mt(),{_:T}=i(),{pageMeta:E}=rs(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G;e[0]!==n||e[1]!==t||e[2]!==a?(G=n??(a?Xe(a):t?He(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=G):G=e[3];let K=G,q;e[4]!==r||e[5]!==K||e[6]!==h||e[7]!==g||e[8]!==v?(q=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:K?`${K}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=K,e[6]=h,e[7]=g,e[8]=v,e[9]=q):q=e[9];let J=q,ee,Y;e[10]===t?(ee=e[11],Y=e[12]):(ee=()=>{W.current=t},Y=[t],e[10]=t,e[11]=ee,e[12]=Y),(0,Q.useEffect)(ee,Y);let te,ne;e[13]===J?(te=e[14],ne=e[15]):(te=()=>{J&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},ne=[J],e[13]=J,e[14]=te,e[15]=ne),(0,Q.useEffect)(te,ne);let X,re;e[16]===j?(X=e[17],re=e[18]):(X=()=>{j&&(z.current?.focus(),z.current?.select())},re=[j],e[16]=j,e[17]=X,e[18]=re),(0,Q.useEffect)(X,re);let ie,ae;e[19]!==v||e[20]!==j?(ie=()=>{!j||v.includes(j.tabId)||(H.current=!0,U.current=null,M(null),P(``),I(null),R(!1))},ae=[v,j],e[19]=v,e[20]=j,e[21]=ie,e[22]=ae):(ie=e[21],ae=e[22]),(0,Q.useEffect)(ie,ae);let oe=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,M({docName:t,tabId:e}),P(n[n.length-1]),I(null)},se=function(){H.current=!0,U.current=null,M(null),P(``),I(null),R(!1)},ce=async function(){if(H.current){H.current=!1;return}if(B.current)return;let e=j?.docName;if(!e){se();return}let t=VM(`file`,NN(N,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){se();return}if(t===U.current){z.current?.focus();return}if(!HM(t)){I(T({id:`P8yDjG`})),z.current?.focus();return}let i=UM({kind:`file`,path:e,name:r},t);B.current=!0,R(!0),I(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(H.current){R(!1),B.current=!1;return}let r=await _e(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),R(!1),B.current=!1,U.current=t,z.current?.focus();return}let a=A(Zr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,s=JM(o,a);Bt(a);let c=!0;try{let e=YM(a,p(),m);await Promise.all(e.map(e=>l(e))),x(a),ss([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),hs.error(T({id:`MUBR8r`}))}H.current=!0,M(null),P(``),I(null),R(!1),B.current=!1,U.current=null,c&&s&&s!==o&&jN(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(T({id:`HIb0vl`})),R(!1),B.current=!1,U.current=t,z.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===g?ue=e[24]:(ue=new Set(g),e[23]=g,e[24]=ue);let de=ue,fe;e[25]===O?fe=e[26]:(fe=CN(O),e[25]=O,e[26]=fe);let pe;e[27]===fe?pe=e[28]:(pe=[fe],e[27]=fe,e[28]=pe);let me=pe,he;e[29]!==u||e[30]!==f||e[31]!==de?(he=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[29]=u,e[30]=f,e[31]=de,e[32]=he):he=e[32];let ge=he,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:ga,keyboardCodes:hN},e[34]=ye):ye=e[34];let be=wi(ia(va,ve),ia(ba,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){k(SN(D.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){k(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==S||e[39]!==w?(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=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Bi([...w],r,i),t)},e[37]=we,e[38]=S,e[39]=w,e[40]=Te):Te=e[40];let Ee=Te,De=le?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=oi(`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]`,le&&`[-webkit-app-region:drag]`),e[41]=Oe):Oe=e[41];let ke=MN,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=oi(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let Me=Xa,Ne=wN,Pe;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Pe={container:typeof document<`u`?document.body:void 0},e[43]=Pe):Pe=e[43];let Fe=ma,Ie;e[44]===w?Ie=e[45]:(Ie=[...w],e[44]=w,e[45]=Ie);let Le=fa,Re=w.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(FN,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PN,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:oi(EN,t?DN:ON),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:kN,onClick:()=>c(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:gN(t),tabIndex:_N(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=pt(e),n=e===K,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=je(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(FN,{tabId:e,openTabs:w,closeTab:d,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:oi(EN,n?DN:ON),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:kN,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:oi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:oi(`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)(IN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=je(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(FN,{tabId:e,openTabs:w,closeTab:d,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:oi(EN,n?DN:ON),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:kN,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:oi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:oi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(IN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}let a=t.docName,l=E.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=je(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=j?.tabId===e,x=`editor-tab-rename-error-${AN(a)}`;return(0,Z.jsx)(FN,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(PN,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:oi(EN,n?DN:ON,v&&F&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(YC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(ew,{ref:z,value:N,disabled:L,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?x:void 0,"aria-busy":L||void 0,title:F??a,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=>{P(NN(e.target.value,l)),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),se())},onBlur:ce}),(0,Z.jsx)(ZC,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)($C,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),F?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:F}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:kN,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e,a)},tabIndex:-1,children:[(0,Z.jsx)(LN,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(IN,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),ze;e[46]!==Fe||e[47]!==Ie||e[48]!==Le||e[49]!==Re?(ze=(0,Z.jsx)(Fe,{items:Ie,strategy:Le,children:Re}),e[46]=Fe,e[47]=Ie,e[48]=Le,e[49]=Re,e[50]=ze):ze=e[50];let Be;e[51]!==Me||e[52]!==we||e[53]!==Ee||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Ne||e[58]!==Pe||e[59]!==ze||e[60]!==me?(Be=(0,Z.jsx)(Me,{sensors:be,autoScroll:!1,collisionDetection:Ne,modifiers:me,onDragStart:Se,onDragEnd:Ee,onDragCancel:we,accessibility:Pe,children:ze}),e[51]=Me,e[52]=we,e[53]=Ee,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Ne,e[58]=Pe,e[59]=ze,e[60]=me,e[61]=Be):Be=e[61];let Ve;e[62]===T?Ve=e[63]:(Ve=T({id:`3YvS-c`}),e[62]=T,e[63]=Ve);let Ue;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsx)(V,{"aria-hidden":`true`}),e[64]=Ue):Ue=e[64];let We;e[65]!==_||e[66]!==Ve?(We=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Ue})}),e[65]=_,e[66]=Ve,e[67]=We):We=e[67];let Ge;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=Ge):Ge=e[68];let Ke;e[69]===We?Ke=e[70]:(Ke=(0,Z.jsxs)(Is,{children:[We,Ge]}),e[69]=We,e[70]=Ke);let qe;e[71]!==Ae||e[72]!==Be||e[73]!==Ke?(qe=(0,Z.jsxs)(`div`,{className:Ae,children:[Be,Ke]}),e[71]=Ae,e[72]=Be,e[73]=Ke,e[74]=qe):qe=e[74];let Je;return e[75]!==De||e[76]!==Oe||e[77]!==ke||e[78]!==qe?(Je=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":De,className:Oe,onWheel:ke,children:qe}),e[75]=De,e[76]=Oe,e[77]=ke,e[78]=qe,e[79]=Je):Je=e[79],Je}function zN(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 BN(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 VN=[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:St},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:wf},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:zN},{label:`X`,href:`https://x.com/OpenKnowledgeAI`,icon:BN},{label:`Open Knowledge`,href:`https://openknowledge.ai/`,icon:Tf,iconClassName:`scale-125 grayscale transition-[filter] group-hover:grayscale-0`}],HN=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Re,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(Is,{children:[o,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=VN.map(e=>{let{label:n,href:r,icon:i,iconClassName:a}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>aa(e,r),onAuxClick:e=>aa(e,r),className:`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`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:oi(`size-4 shrink-0`,a)}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(b,{align:`end`,className:`w-48 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(fe,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function UN(e){let t=(0,$.c)(19),{installStates:n,terminalLaunch:r,disabled:a,onPick:o,onLaunchTerminal:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(``),f;if(t[0]!==l||t[1]!==a||t[2]!==n||t[3]!==u||t[4]!==c||t[5]!==o||t[6]!==r){let e;t[8]===n?e=t[9]:(e=e=>n[e.id]?.installed===!0,t[8]=n,t[9]=e);let i=_g.filter(e),p=_g.some(e=>n[e.id]?.installed==null),m=i.length>0,h=r!==null,g=m||h,_;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>d(e.target.value),t[10]=_):_=t[10];let v;t[11]===l?v=t[12]:(v=l({id:`Rah7yq`}),t[11]=l,t[12]=v);let y;t[13]===l?y=t[14]:(y=l({id:`ZBt4rI`}),t[13]=l,t[14]=y);let b;t[15]!==u||t[16]!==v||t[17]!==y?(b=(0,Z.jsx)(`div`,{className:`px-2 pt-2 pb-1.5`,children:(0,Z.jsx)(jo,{value:u,onChange:_,placeholder:v,"aria-label":y,"data-testid":`open-in-agent-instruction`})}),t[15]=u,t[16]=v,t[17]=y,t[18]=b):b=t[18],f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[b,g?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[m?(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-desktop-label`,children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(e=>{let{displayName:t}=e;return(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:a,"data-testid":`open-in-agent-item-${e.id}`,"aria-label":l({id:`WqLq6M`,values:{displayName:t}}),onClick:()=>o(e,u),children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t})]},e.id)})]}):null,h?(0,Z.jsxs)(Z.Fragment,{children:[m?(0,Z.jsx)(ta,{className:`my-1`}):null,(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-terminal-label`,children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:a,"data-testid":`open-in-agent-terminal`,"aria-label":l({id:`AcK_r0`}),onClick:()=>c(u),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`fcgvCA`})})]})]})]}):null]}):(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`open-in-agent-empty`,"aria-live":`polite`,children:p?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=l,t[1]=a,t[2]=n,t[3]=u,t[4]=c,t[5]=o,t[6]=r,t[7]=f}else f=t[7];return f}function WN(e){let t=(0,$.c)(44),{input:n,open:r,onOpenChange:a}=e,{_:o}=i(),{states:c,refresh:l}=O_(),{dispatch:u}=__(),d=qx(),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(!1),h=mg(),g=r??f,_;t[0]===l?_=t[1]:(_=()=>{l()},t[0]=l,t[1]=_);let v=(0,Q.useEffectEvent)(_),y;t[2]!==g||t[3]!==v?(y=()=>{g&&v()},t[2]=g,t[3]=v,t[4]=y):y=t[4];let x;if(t[5]===g?x=t[6]:(x=[g],t[5]=g,t[6]=x),(0,Q.useEffect)(y,x),h)return null;let S=typeof window<`u`&&window.okDesktop!=null,C;t[7]!==a||t[8]!==r?(C=e=>{r===void 0&&p(e),a?.(e)},t[7]=a,t[8]=r,t[9]=C):C=t[9];let w=C,T=n===null,E;t[10]===n?E=t[11]:(E=e=>{if(n===null)return null;let t=e.trim();return t?{...n,instruction:t}:n},t[10]=n,t[11]=E);let D=E,O;t[12]!==u||t[13]!==w||t[14]!==D?(O=(e,t)=>{let n=D(t);n!==null&&(u(e.id,n),w(!1))},t[12]=u,t[13]=w,t[14]=D,t[15]=O):O=t[15];let k=O,A;t[16]!==w||t[17]!==D||t[18]!==d?(A=e=>{let t=D(e);t===null||d===null||(d.launchInTerminal(t),w(!1))},t[16]=w,t[17]=D,t[18]=d,t[19]=A):A=t[19];let j=A,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=S?()=>{m.current=!0}:void 0,t[20]=M):M=t[20];let N;t[21]===w?N=t[22]:(N=S?()=>{if(m.current){m.current=!1;return}w(!0)}:void 0,t[21]=w,t[22]=N);let P,F;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(yi,{className:`size-3.5`,"aria-hidden":`true`}),F=(0,Z.jsx)(s,{id:`O7_W_a`}),t[23]=P,t[24]=F):(P=t[23],F=t[24]);let I;t[25]!==N||t[26]!==T?(I=(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`sm`,disabled:T,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:M,onClick:N,children:[P,F]})}),t[25]=N,t[26]=T,t[27]=I):I=t[27];let L;t[28]===o?L=t[29]:(L=o({id:`O7_W_a`}),t[28]=o,t[29]=L);let R=n===null,z;t[30]!==j||t[31]!==k||t[32]!==c||t[33]!==R||t[34]!==d?(z=(0,Z.jsx)(UN,{installStates:c,terminalLaunch:d,disabled:R,onPick:k,onLaunchTerminal:j}),t[30]=j,t[31]=k,t[32]=c,t[33]=R,t[34]=d,t[35]=z):z=t[35];let B;t[36]!==L||t[37]!==z?(B=(0,Z.jsx)(b,{align:`end`,className:`p-1`,"aria-label":L,"data-testid":`open-in-agent-menu`,children:z}),t[36]=L,t[37]=z,t[38]=B):B=t[38];let V;return t[39]!==w||t[40]!==g||t[41]!==I||t[42]!==B?(V=(0,Z.jsxs)(fe,{open:g,onOpenChange:w,children:[I,B]}),t[39]=w,t[40]=g,t[41]=I,t[42]=B,t[43]=V):V=t[43],V}var GN=50,KN=()=>{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,PC.preload()},GN))},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,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Cg)},u=(0,Z.jsx)(Zl,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(Is,{children:[d,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function qN(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=Oa(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),p,m;t[0]===u?(p=t[1],m=t[2]):(p=()=>{!u||!f.current||(f.current.focus(),f.current.select())},m=[u],t[0]=u,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=o?.hasRemote===!0,g=n===null,_;t[3]!==a||t[4]!==c||t[5]!==h||t[6]!==n||t[7]!==r?(_=async function(){if(!c&&n!==null){l(!0),d(null);try{let e=await ca({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:Pa,toastSuccess:$N,toastError:QN,logEvent:ZN});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{hs.error(a({id:`u3YnKw`}))}l(!1)}},t[3]=a,t[4]=c,t[5]=h,t[6]=n,t[7]=r,t[8]=_):_=t[8];let v=_,y=u!==null,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||d(null)},t[9]=x):x=t[9];let C;t[10]!==a||t[11]!==n?.kind?(C=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[10]=a,t[11]=n?.kind,t[12]=C):C=t[12];let w=c||g,T,E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Ql,{className:`size-3.5`,"aria-hidden":!0}),E=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[13]=T,t[14]=E):(T=t[13],E=t[14]);let D;t[15]!==v||t[16]!==C||t[17]!==w?(D=(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`sm`,"aria-label":C,onClick:v,disabled:w,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[T,E]})}),t[15]=v,t[16]=C,t[17]=w,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[20]=k):k=t[20];let A=u??``,j;t[21]===a?j=t[22]:(j=a({id:`5-FeN2`}),t[21]=a,t[22]=j);let M;t[23]!==A||t[24]!==j?(M=(0,Z.jsxs)(b,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[O,k,(0,Z.jsx)(jo,{ref:f,readOnly:!0,value:A,onFocus:XN,onClick:YN,onContextMenu:JN,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":j})]}),t[23]=A,t[24]=j,t[25]=M):M=t[25];let N;return t[26]!==D||t[27]!==M||t[28]!==y?(N=(0,Z.jsxs)(fe,{open:y,onOpenChange:x,children:[D,M]}),t[26]=D,t[27]=M,t[28]=y,t[29]=N):N=t[29],N}function JN(e){return e.currentTarget.select()}function YN(e){return e.currentTarget.select()}function XN(e){return e.currentTarget.select()}function ZN(e){return console.log(e)}function QN(e){e!==`Link ready but could not copy to clipboard.`&&hs.error(e)}function $N(e){return hs.success(e)}function eP(e){let t=(0,$.c)(45),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=mt(),{state:p,isDraggingRail:m}=hA(),h=Sg(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=tc(`toggle-files-sidebar`),t[0]=g):g=t[0];let _=g,v=tc(`command-palette`),y=po(),[b,x]=(0,Q.useState)(!1),S;bb0:{if(f===null){let e;t[1]===y?e=t[2]:(e=t_({workspace:y}),t[1]=y,t[2]=e),S=e;break bb0}if(f.kind===`folder`){if(!y){S=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==y?(e=i_({folderRelativePath:f.folderPath,workspace:y}),t[3]=f.folderPath,t[4]=y,t[5]=e):e=t[5],S=e;break bb0}let e;t[6]!==d||t[7]!==y?(e=e_({docName:d,workspace:y}),t[6]=d,t[7]=y,t[8]=e):e=t[8],S=e}let C=c??S,w;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=fo(f.folderPath),t[9]=f.folderPath,t[10]=e),w=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=Da(d),t[11]=d,t[12]=e),w=e;break bb1}w=null}let E=w,D=typeof window<`u`&&window.okDesktop!=null,O=p===`collapsed`,k=D?``:void 0,A=D&&O&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,j=D&&!m&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,M;t[13]!==A||t[14]!==j?(M=oi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,D&&`[-webkit-app-region:drag]`,A,j),t[13]=A,t[14]=j,t[15]=M):M=t[15];let N=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(bA,{className:oi(`-ml-1 shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Ns,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:_}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:_}})})]}),O&&a&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:v}}),"data-telemetry-event":`ok.editor_header.search.click`,className:oi(`shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(T,{"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:v}})})]}),(0,Z.jsx)(ta,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(RN,{})]}),P;t[16]===N?P=t[17]:(P=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:N}),t[16]=N,t[17]=P);let F;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=oi(`flex shrink-0 items-center justify-end gap-2 px-3`,D&&`[&>*]:[-webkit-app-region:no-drag]`),t[18]=F):F=t[18];let I;t[19]!==C||t[20]!==l||t[21]!==o||t[22]!==b||t[23]!==x||t[24]!==E||t[25]!==h?(I=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(WN,{input:C,open:o,onOpenChange:l}),(0,Z.jsx)(qN,{input:E,onClickWhenNoRemote:()=>x(!0)}),(0,Z.jsx)(mo,{open:b,onOpenChange:x})]}),t[19]=C,t[20]=l,t[21]=o,t[22]=b,t[23]=x,t[24]=E,t[25]=h,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==n?(L=(0,Z.jsx)(Ua,{onSignIn:n,onSetIdentity:r}),t[27]=r,t[28]=n,t[29]=L):L=t[29];let R,z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(iM,{}),z=(0,Z.jsx)(ta,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),B=(0,Z.jsx)(qd,{}),t[30]=R,t[31]=z,t[32]=B):(R=t[30],z=t[31],B=t[32]);let V;t[33]===h?V=t[34]:(V=!h&&(0,Z.jsx)(KN,{}),t[33]=h,t[34]=V);let H;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(HN,{}),t[35]=H):H=t[35];let U;t[36]!==I||t[37]!==L||t[38]!==V?(U=(0,Z.jsxs)(`div`,{className:F,children:[I,L,R,z,B,V,H]}),t[36]=I,t[37]=L,t[38]=V,t[39]=U):U=t[39];let W;return t[40]!==P||t[41]!==U||t[42]!==k||t[43]!==M?(W=(0,Z.jsxs)(`header`,{"data-electron-drag":k,className:M,children:[P,U]}),t[40]=P,t[41]=U,t[42]=k,t[43]=M,t[44]=W):W=t[44],W}var tP=`open-knowledge:terminal-launch`;function nP(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(tP,{detail:{prompt:e}}))}function rP(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.prompt:void 0;typeof n==`string`&&e(n)};return t.addEventListener(tP,n),()=>t.removeEventListener(tP,n)}function iP(e){let t=(0,$.c)(63),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,{_:a}=i(),[o,s]=lv(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(Ey[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S=typeof window<`u`?window.okDesktop??null:null,[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),D=(0,Q.useRef)(0),O=ho(),{projectConfig:k,projectLocalConfig:A,projectLocalSynced:j,projectSynced:M}=ae(),N=po(),{activeDocName:P}=mt(),F=O?.hasRemote,I=O?.pushPermission?.checkStatus,L;t[2]!==g||t[3]!==k||t[4]!==A||t[5]!==j||t[6]!==M||t[7]!==F||t[8]!==I?(L=pv({autoSyncOnboardingDismissed:g,hasRemote:F,projectLocalSynced:j,projectSynced:M,projectLocalConfig:A,projectConfig:k,pushPermissionCheckStatus:I}),t[2]=g,t[3]=k,t[4]=A,t[5]=j,t[6]=M,t[7]=F,t[8]=I,t[9]=L):L=t[9];let R=L,z,B;t[10]===P?(z=t[11],B=t[12]):(z=()=>{let e=function(e){let t=e.detail;t&&P&&Oc(P,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(tv,e),()=>window.removeEventListener(tv,e)},B=[P],t[10]=P,t[11]=z,t[12]=B),(0,Q.useEffect)(z,B);let V,H;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?w(oP):e===`new-terminal`&&w(!0)})},H=[],t[13]=V,t[14]=H):(V=t[13],H=t[14]),(0,Q.useEffect)(V,H);let U,W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{if(window.okDesktop!=null)return;let e=function(e){nc(e,`toggle-terminal-panel`)&&(e.preventDefault(),w(aP))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},U=[],t[15]=U,t[16]=W):(U=t[15],W=t[16]),(0,Q.useEffect)(W,U);let G,K;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>rP(e=>{w(!0),D.current+=1,E({prompt:e,nonce:D.current})}),K=[],t[17]=G,t[18]=K):(G=t[17],K=t[18]),(0,Q.useEffect)(G,K);let q,J;t[19]===C?(q=t[20],J=t[21]):(q=()=>{C||E(null)},J=[C],t[19]=C,t[20]=q,t[21]=J),(0,Q.useEffect)(q,J);let ee,Y;t[22]===C?(ee=t[23],Y=t[24]):(ee=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:C})},Y=[C],t[22]=C,t[23]=ee,t[24]=Y),(0,Q.useEffect)(ee,Y);let te,ne;t[25]===C?(te=t[26],ne=t[27]):(te=()=>{window.okDesktop!=null&&C&&co()},ne=[C],t[25]=C,t[26]=te,t[27]=ne),(0,Q.useEffect)(te,ne),uv(O?.pausedReason);let X;t[28]===s?X=t[29]:(X=function(e){l(e),s(e)},t[28]=s,t[29]=X);let re=X,ie;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e){y(e),e||x(null)},t[30]=ie):ie=t[30];let oe=ie,se;t[31]!==a||t[32]!==P||t[33]!==N?(se={openSelection(e){let t=o_({docName:e.docName??P,workspace:N,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown});return t===null?(hs.error(a({id:`_VRtd7`})),!1):(x(t),y(!0),!0)}},t[31]=a,t[32]=P,t[33]=N,t[34]=se):se=t[34];let ce,le;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>{p(`auth`),d(!0)},le=()=>{p(`identity`),d(!0)},t[35]=ce,t[36]=le):(ce=t[35],le=t[36]);let ue;t[37]!==r||t[38]!==b||t[39]!==v?(ue=(0,Z.jsx)(eP,{onSignIn:ce,onSetIdentity:le,onOpenSearch:r,openInAgentMenuOpen:v,openInAgentMenuInput:b,onOpenInAgentMenuOpenChange:oe}),t[37]=r,t[38]=b,t[39]=v,t[40]=ue):ue=t[40];let de;t[41]!==m||t[42]!==c||t[43]!==re||t[44]!==T||t[45]!==C?(de=(0,Z.jsx)(Mj,{editorMode:c,onModeChange:re,activeTab:m,onActiveTabChange:h,terminalBridge:S,terminalVisible:C,onTerminalVisibleChange:w,terminalLaunch:T}),t[41]=m,t[42]=c,t[43]=re,t[44]=T,t[45]=C,t[46]=de):de=t[46];let fe;t[47]!==se||t[48]!==ue||t[49]!==de?(fe=(0,Z.jsxs)(Pc,{value:se,children:[ue,de]}),t[47]=se,t[48]=ue,t[49]=de,t[50]=fe):fe=t[50];let pe=f===`identity`,me;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(me=()=>{d(!1)},t[51]=me):me=t[51];let he;t[52]!==u||t[53]!==pe?(he=(0,Z.jsx)(ra,{open:u,onOpenChange:d,identityPrompt:pe,onSuccess:me}),t[52]=u,t[53]=pe,t[54]=he):he=t[54];let ge;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>_(!0),t[55]=ge):ge=t[55];let _e;t[56]===R?_e=t[57]:(_e=(0,Z.jsx)(dv,{open:R,onResolved:ge}),t[56]=R,t[57]=_e);let ve;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Z.jsx)(Q_,{}),t[58]=ve):ve=t[58];let ye;return t[59]!==fe||t[60]!==he||t[61]!==_e?(ye=(0,Z.jsxs)(Z.Fragment,{children:[fe,he,_e,ve]}),t[59]=fe,t[60]=he,t[61]=_e,t[62]=ye):ye=t[62],ye}function aP(e){return!e}function oP(e){return!e}function sP(e){let t=Vo(Ko(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function cP(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Pi();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)(Lo,{"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)(Lo,{"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(lP),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 lP(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>sP(e.file),children:[(0,Z.jsx)(Lo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var uP=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
29
+ `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;lc(t,{style:t=>Cc(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 QO.set(t.changes,i),i}function tk(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(sO).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(ZO);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=oc.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:XO.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function nk(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(sO).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(ZO).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 rk(e){let t=new fc;for(let n of e.field(sO)){let r=e.facet(iO).overrideChunk&&ok(e,n);t.add(n.fromB,n.fromB,ek(e,n,!!r))}return t.finish()}var ik=cc.define({create:e=>rk(e),update(e,t){return t.state.field(sO,!1)==t.startState.field(sO,!1)?e:rk(t.state)},provide:e=>_c.decorations.from(e)}),ak=new WeakMap;function ok(e,t){let n=ak.get(t);if(n!==void 0)return n;n=null;let r=e.field(ZO),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(dc.widget({widget:new sk(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(CO.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return ak.set(t,n),n}var sk=class extends ic{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}},ck=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},lk=dc.line({class:`cm-inlineChangedLine`});function uk(e,t,n,r){let i=ok(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,ck),n.add(o.from,o.from,lk);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 dk=Y({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),fk=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),pk=_c.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 mk({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 hk(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:a,conflictMode:o,previewMode:c,oursOverride:l,onResolve:u,onAbort:d}=e,{_:f}=i(),p=l??r,m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),{resolvedTheme:_}=Yr(),v=(0,Q.useRef)(u),y=(0,Q.useRef)(d),[b,x]=(0,Q.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[C,w]=(0,Q.useState)(S),T;t[1]!==d||t[2]!==u?(T=()=>{v.current=u,y.current=d},t[1]=d,t[2]=u,t[3]=T):T=t[3],(0,Q.useEffect)(T);let E,D;t[4]!==o||t[5]!==p||t[6]!==a||t[7]!==n||t[8]!==c||t[9]!==_?(E=()=>{let e=m.current;if(!e)return;w([]);let t=new Map,r=!1,i=e=>{r||!t.delete(e)||w(t=>t.filter(t=>t.id!==e))},s=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||i(n)});s.observe(e,{childList:!0,subtree:!0});let l=_===`dark`?dk:fk,u=[_c.editable.of(!1),sc.readOnly.of(!0)],d=[Fc,wc(),...u,l,_c.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new _c({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=mk({addControl:e=>{r||(t.set(e.id,e.host),w(t=>[...t,e]))},nextId:()=>(g.current+=1,g.current),removeControl:i,root:e}),o=new _c({doc:p,extensions:[Fc,wc(),_c.editable.of(!1),l,pk,_c.lineWrapping,YO({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),_c.updateListener.of(e=>{let t=cO(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=cO(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new GO({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new _c({doc:p,extensions:[...d,YO({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,s.disconnect(),h.current&&=(h.current.destroy(),null)}},D=[n,p,a,_,o,c],t[4]=o,t[5]=p,t[6]=a,t[7]=n,t[8]=c,t[9]=_,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=h.current;!e||!(e instanceof _c)||v.current?.(e.state.doc.toString())},t[12]=O):O=t[12];let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){let e=h.current;!e||!(e instanceof _c)||ve(e)},t[13]=A):A=t[13];let j=A,M=b===0,N;t[14]!==f||t[15]!==b?(N=b===null?``:b===0?f({id:`lPzyrU`}):ms._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=N):N=t[16];let P=N,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=F):F=t[17];let I;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,rl.createPortal)((0,Z.jsx)(ci,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?f({id:`g3UF2V`}):f({id:`1t_NnN`})}),e.host,e.id),t[21]=f,t[22]=e),I=C.map(e),t[18]=f,t[19]=C,t[20]=I}else I=t[20];let L;t[23]!==M||t[24]!==o||t[25]!==P||t[26]!==d||t[27]!==u?(L=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${M?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:P}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(ci,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(ci,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(ci,{variant:`default`,size:`sm`,disabled:!M,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=M,t[24]=o,t[25]=P,t[26]=d,t[27]=u,t[28]=L):L=t[28];let R;return t[29]!==L||t[30]!==I?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,I,L]}),t[29]=L,t[30]=I,t[31]=R):R=t[31],R}async function gk(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 _k(e,t){return gk(e,`content`,t)}async function vk(e){return gk(e,`mine`)}async function yk(e){return gk(e,`theirs`)}async function bk(e){return gk(e,`delete`)}async function xk(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 Sk(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=Pi(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Ko(e.file)===n,t[3]=n,t[4]=e),c=a.find(e),t[0]=a,t[1]=n,t[2]=c}else c=t[2];let l=c,u=l?.file??`${n}.md`,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>(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}))}),v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Q.useEffect)(_,v);let y=o||l===void 0,b,x;t[8]!==y||t[9]!==u?(b=()=>{if(y)return;let e=!1;return f(null),m(!1),xk(u).then(t=>{e||(t===null?m(!0):f(t))}),()=>{e=!0}},x=[u,y],t[8]=y,t[9]=u,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S;t[12]!==r||t[13]!==u?(S=async function(e){let t=await _k(u,e);t.ok||hs.error(r({id:`K-h9cT`,values:{filePath:u}}),{description:t.detail})},t[12]=r,t[13]=u,t[14]=S):S=t[14];let C=S,w;t[15]!==r||t[16]!==u?(w=async function(e){g(!0);let t=await e(u);t.ok||(g(!1),hs.error(r({id:`jPUPvG`,values:{filePath:u}}),{description:t.detail}))},t[15]=r,t[16]=u,t[17]=w):w=t[17];let T=w;if(p){let e;return t[18]===u?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)(s,{id:`ajz9F8`,values:{filePath:u}})}),t[18]=u,t[19]=e),e}if(d===null){let e;return t[20]===u?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)(s,{id:`DF1MtZ`,values:{filePath:u}})}),t[20]=u,t[21]=e),e}if(d.kind===`delete-modify`){let e;t[22]===d.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(hk,{oldContent:``,newContent:d.theirs,layout:`unified`,previewMode:!0})}),t[22]=d.theirs,t[23]=e);let n;t[24]===u?n=t[25]:(n={filePath:u},t[24]=u,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)(s,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===T?a=t[30]:(a=()=>void T(bk),t[29]=T,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`Vlc75q`}),t[31]=o):o=t[31];let c;t[32]!==h||t[33]!==a?(c=(0,Z.jsx)(ci,{type:`button`,variant:`destructive`,disabled:h,onClick:a,children:o}),t[32]=h,t[33]=a,t[34]=c):c=t[34];let l;t[35]===T?l=t[36]:(l=()=>void T(yk),t[35]=T,t[36]=l);let f;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`3mFsc3`}),t[37]=f):f=t[37];let p;t[38]!==h||t[39]!==l?(p=(0,Z.jsx)(ci,{type:`button`,variant:`default`,disabled:h,onClick:l,children:f}),t[38]=h,t[39]=l,t[40]=p):p=t[40];let m;t[41]!==c||t[42]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[41]=c,t[42]=p,t[43]=m):m=t[43];let g;t[44]!==i||t[45]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=g):g=t[46];let _;return t[47]!==g||t[48]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[47]=g,t[48]=e,t[49]=_):_=t[49],_}if(d.kind===`modify-delete`){let e;t[50]===d.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(hk,{oldContent:``,newContent:d.ours,layout:`unified`,previewMode:!0})}),t[50]=d.ours,t[51]=e);let n;t[52]===u?n=t[53]:(n={filePath:u},t[52]=u,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===T?a=t[58]:(a=()=>void T(vk),t[57]=T,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`0NA4b3`}),t[59]=o):o=t[59];let c;t[60]!==h||t[61]!==a?(c=(0,Z.jsx)(ci,{type:`button`,variant:`default`,disabled:h,onClick:a,children:o}),t[60]=h,t[61]=a,t[62]=c):c=t[62];let l;t[63]===T?l=t[64]:(l=()=>void T(bk),t[63]=T,t[64]=l);let f;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`qSxaOz`}),t[65]=f):f=t[65];let p;t[66]!==h||t[67]!==l?(p=(0,Z.jsx)(ci,{type:`button`,variant:`destructive`,disabled:h,onClick:l,children:f}),t[66]=h,t[67]=l,t[68]=p):p=t[68];let m;t[69]!==c||t[70]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[69]=c,t[70]=p,t[71]=m):m=t[71];let g;t[72]!==i||t[73]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=g):g=t[74];let _;return t[75]!==g||t[76]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[75]=g,t[76]=e,t[77]=_):_=t[77],_}let E;t[78]===C?E=t[79]:(E=e=>void C(e),t[78]=C,t[79]=E);let D;return t[80]!==d.ours||t[81]!==d.theirs||t[82]!==E?(D=(0,Z.jsx)(hk,{oldContent:d.theirs,newContent:d.ours,layout:`unified`,conflictMode:!0,onResolve:E}),t[80]=d.ours,t[81]=d.theirs,t[82]=E,t[83]=D):D=t[83],D}function Ck(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Ft(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 wk=`__back-nav__`;function Tk(e){return e instanceof Le||e instanceof vt||e instanceof Me||e instanceof et||e instanceof At||e instanceof pe?e.docName:null}function Ek(e){if(e instanceof Le){let t=e.docName;return{title:ms._({id:`Jejur6`}),summary:ms._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof vt){let t=e.docName;return{title:ms._({id:`V7QxyT`}),summary:ms._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Me){let t=e.docName;return{title:ms._({id:`1di5fu`}),summary:ms._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof et){let t=e.docName;return{title:ms._({id:`wvbc1r`}),summary:ms._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof At)return{title:ms._({id:`Gfr4fu`}),summary:ms._({id:`j6LB7S`})};if(e instanceof pe){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 Dk(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=Ek(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(OS,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(ci,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(ci,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(lt(Tk(n)??i),o(a),r(wk))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(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:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function Ok(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)(Dk,{...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]===wk){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}: ${Ek(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)(ce,{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 kk(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=br(t);return{map:n,keys:On(t),parseError:r}}function Ak(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>kk(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=Mn(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=Ze(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=dt(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)(jk,{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)(Mk,{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 jk(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 Mk(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}function Nk(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=br(t);return{map:n,keys:On(t),parseError:r}}function Pk(e){let t=(0,$.c)(127),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>Nk(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=Mn(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]!==r||t[9]!==a?(M=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=vr(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=a,t[10]=M):M=t[10];let N=M,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=P):P=t[11];let F=P,I;t[12]===r?I=t[13]:(I=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[12]=r,t[13]=I);let L=I,R;t[14]!==N||t[15]!==L?(R=function(e,t){F(e),L(N({[e]:t}),[e])},t[14]=N,t[15]=L,t[16]=R):R=t[16];let z=R,B;t[17]!==N||t[18]!==L?(B=function(e){F(e),L(N({[e]:null}),[e])},t[17]=N,t[18]=L,t[19]=B):B=t[19];let H=B,U;t[20]!==r||t[21]!==a?(U=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=vr(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[20]=r,t[21]=a,t[22]=U):U=t[22];let W=U,G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=function(e,t){return`${e} ${t}`},t[23]=G):G=t[23];let K=G,q;t[24]!==a||t[25]!==m?(q=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>K(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[24]=a,t[25]=m,t[26]=q):q=t[26];let J=q,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee={activationConstraint:{distance:4}},t[27]=ee):ee=t[27];let Y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y={coordinateGetter:ga},t[28]=Y):Y=t[28];let te=wi(ia(va,ee),ia(ba,Y)),ne;t[29]!==z||t[30]!==p?(ne=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=oa(n,t);(!Object.hasOwn(p,e)||!xr(n,r))&&z(e,r)},t[29]=z,t[30]=p,t[31]=ne):ne=t[31];let X=ne,re;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=re):re=t[32];let ie=re,{addPropertySignal:ae,clearAddProperty:oe}=MC(),se;t[33]!==ae||t[34]!==j?(se=ae.get(j)??0,t[33]=ae,t[34]=j,t[35]=se):se=t[35];let ce=se,le,ue;t[36]===ce?(le=t[37],ue=t[38]):(le=()=>{ce>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},ue=[ce],t[36]=ce,t[37]=le,t[38]=ue),(0,Q.useEffect)(le,ue);let de,fe;t[39]!==oe||t[40]!==j?(de=()=>()=>oe(j),fe=[j,oe],t[39]=oe,t[40]=j,t[41]=de,t[42]=fe):(de=t[41],fe=t[42]),(0,Q.useEffect)(de,fe);let pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Ji[e];return{...t,type:e,value:n,error:null}})},t[43]=pe):pe=t[43];let me=pe,he;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e){S(t=>t&&{...t,value:e})},t[44]=he):he=t[44];let ge=he,_e;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=_e):_e=t[45];let ve=_e,ye;t[46]!==r||t[47]!==x||t[48]!==N||t[49]!==p?(ye=function(e){if(!x)return;let t=e??x.value,n=x.name.trim();if(!n){S({...x,value:t,error:r({id:`8_brI5`})});return}if(Zn(t)){S({...x,value:t,error:r({id:`hXUWyd`})});return}if(n===`frontmatter`){S({...x,value:t,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,n)){S({...x,value:t,error:r({id:`njU86j`,values:{trimmed:n}})});return}let i=N({[n]:t});if(i.ok){S(null);return}let a=i.fieldErrors?.[n],o=i.error??r({id:`OJeiSH`});S({...x,value:t,error:a??o})},t[46]=r,t[47]=x,t[48]=N,t[49]=p,t[50]=ye):ye=t[50];let be=ye,xe;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){S(null)},t[51]=xe):xe=t[51];let Se=xe,Ce;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){w({key:e,draft:e,error:null})},t[52]=Ce):Ce=t[52];let we=Ce,Te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Te):Te=t[53];let Ee=Te,De;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(){w(null)},t[54]=De):De=t[54];let Oe=De,ke;t[55]!==r||t[56]!==p||t[57]!==W||t[58]!==C?(ke=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=W(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),F(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[55]=r,t[56]=p,t[57]=W,t[58]=C,t[59]=ke):ke=t[59];let Ae=ke,je;t[60]!==p||t[61]!==m?(je=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=je):je=t[62];let Me=je,Ne;if(t[63]!==Me){Ne=new Map;for(let e of Me)Ne.set(e,(Ne.get(e)??0)+1);t[63]=Me,t[64]=Ne}else Ne=t[64];if(Me.length===0&&!x&&!h)return null;let Pe=!g,Fe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=e=>_(!e),t[65]=Fe):Fe=t[65];let Ie=!g,Le;t[66]===Ie?Le=t[67]:(Le=(0,Z.jsx)(No,{"data-expanded":Ie,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Ie,t[67]=Le);let Re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=Re):Re=t[68];let ze;t[69]===Le?ze=t[70]:(ze=(0,Z.jsx)(Po,{asChild:!0,children:(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[Le,Re]})}),t[69]=Le,t[70]=ze);let Be;t[71]===h?Be=t[72]:(Be=h?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(Lo,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[71]=h,t[72]=Be);let Ve;if(t[73]!==Me){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>K(e,t),t[75]=e):e=t[75],Ve=Me.map(e),t[73]=Me,t[74]=Ve}else Ve=t[74];let He;if(t[76]!==z||t[77]!==Ae||t[78]!==Ne||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==H||t[83]!==C||t[84]!==Me||t[85]!==k||t[86]!==X){let e;t[88]!==z||t[89]!==Ae||t[90]!==Ne||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==H||t[95]!==C||t[96]!==k||t[97]!==X?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??An(n),i=C?.key===e?C:null,a=(Ne.get(e)??0)>1;return(0,Z.jsx)(Ii,{sortableId:K(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>we(e),onChangeDraft:Ee,onCommit:Ae,onCancel:Oe},onCommit:t=>z(e,t),onChangeType:t=>X(e,t),onRemove:()=>H(e)},`${e}-${t}`)},t[88]=z,t[89]=Ae,t[90]=Ne,t[91]=E,t[92]=p,t[93]=y,t[94]=H,t[95]=C,t[96]=k,t[97]=X,t[98]=e):e=t[98],He=Me.map(e),t[76]=z,t[77]=Ae,t[78]=Ne,t[79]=E,t[80]=p,t[81]=y,t[82]=H,t[83]=C,t[84]=Me,t[85]=k,t[86]=X,t[87]=He}else He=t[87];let Ue;t[99]!==Ve||t[100]!==He?(Ue=(0,Z.jsx)(ma,{items:Ve,strategy:Ki,children:He}),t[99]=Ve,t[100]=He,t[101]=Ue):Ue=t[101];let We;t[102]!==J||t[103]!==te||t[104]!==Ue?(We=(0,Z.jsx)(Xa,{sensors:te,collisionDetection:Sa,onDragEnd:J,children:Ue}),t[102]=J,t[103]=te,t[104]=Ue,t[105]=We):We=t[105];let Ge;t[106]!==z||t[107]!==E||t[108]!==p||t[109]!==k?(Ge=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(Ii,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>z(`tags`,e),onChangeType:Fk},`virtual-tags`),t[106]=z,t[107]=E,t[108]=p,t[109]=k,t[110]=Ge):Ge=t[110];let Ke;t[111]!==r||t[112]!==x||t[113]!==be?(Ke=x?(0,Z.jsx)(na,{draft:x,onChangeName:ve,onChangeType:me,onChangeValue:ge,onCommit:be,onCancel:Se}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ie,"aria-label":r({id:`F-NRCj`}),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)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=be,t[114]=Ke):Ke=t[114];let qe;t[115]!==Be||t[116]!==We||t[117]!==Ge||t[118]!==Ke?(qe=(0,Z.jsxs)(Mo,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Be,We,Ge,Ke]}),t[115]=Be,t[116]=We,t[117]=Ge,t[118]=Ke,t[119]=qe):qe=t[119];let Je;t[120]!==Pe||t[121]!==ze||t[122]!==qe?(Je=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(Fo,{open:Pe,onOpenChange:Fe,children:[ze,qe]})}),t[120]=Pe,t[121]=ze,t[122]=qe,t[123]=Je):Je=t[123];let Ye;return t[124]!==a||t[125]!==Je?(Ye=(0,Z.jsx)(Oi,{binding:a,children:Je}),t[124]=a,t[125]=Je,t[126]=Ye):Ye=t[126],Ye}function Fk(){}var Ik=v(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function Lk(e){let t=e.threshold??Ik;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Rk(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var zk=v(`ACTIVITY_MOUNT_LIMIT`,3);function Bk(){return n(()=>import(`./SourceEditor-BUtcGwkC.js`),__vite__mapDeps([55,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,56,26,54]),import.meta.url)}var Vk=(0,Q.lazy)(async()=>({default:(await Bk()).SourceEditor}));function Hk(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ke(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function Uk(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 Wk(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Wt,{name:`activity-pool`,children:(0,Z.jsx)(Gk,{...e})}),t[0]=e,t[1]=n),n}function Gk(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=mt(),{pages:u,loading:d}=rs(),f=Hk(c,n,zk),p=(0,Q.useRef)(``),h=f.map(Kk).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)m(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;W(e,t&&t.length>0?t:crypto.randomUUID())}le(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,Ut(t)},[h,n]);let y;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(y=e=>(0,Z.jsx)(Qk,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let b=f.map(y),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function Kk(e){return e.docName}function qk(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&&le(`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&&(le(`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&&le(`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:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function Jk(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)(zx,{}),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)(Vk,{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 Yk(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)($a,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(h,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(ci,{type:`button`,onClick:Xk,children:[(0,Z.jsx)($a,{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 Xk(){return window.location.reload()}function Zk(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 Qk(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=Uk(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=vw(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),[b,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==b?(S=()=>{i&&!_?v(!0):!i&&!b&&x(!0)},C=[i,_,b],t[5]=i,t[6]=_,t[7]=b,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=Lk({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:b}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,O;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&&le(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[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]=O):(D=t[17],O=t[18]),(0,Q.useEffect)(D,O);let k;t[19]===n.docName?k=t[20]:(k=()=>y(n.docName),t[19]=n.docName,t[20]=k);let[A]=(0,Q.useState)(k),j=A?.html??null,[M,N]=(0,Q.useState)(!1),P,F;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==M||t[26]!==i||t[27]!==g?(P=()=>{Rk({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(le(`ok/cold/first-toggle`,{docName:n.docName,mountId:at(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,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]=M,t[26]=i,t[27]=g,t[28]=P,t[29]=F):(P=t[28],F=t[29]),(0,Q.useEffect)(P,F);let I=r?`visible`:`hidden`,L=`editor:${n.docName}`,R=A?.scrollTop,z;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]!==j?(z=f?(0,Z.jsx)(Yk,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Ok,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(Zk,{html:j}):(0,Z.jsx)(zx,{}),children:(0,Z.jsx)(Ck,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(Sk,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(Ak,{provider:n.provider}),!i&&(0,Z.jsx)(Pk,{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)(Jk,{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)(bD,{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]=j,t[44]=z):z=t[44];let B;t[45]!==r||t[46]!==R||t[47]!==z?(B=(0,Z.jsx)(qk,{isActive:r,initialScrollTop:R,children:z}),t[45]=r,t[46]=R,t[47]=z,t[48]=B):B=t[48];let V;return t[49]!==I||t[50]!==L||t[51]!==B?(V=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:B}),t[49]=I,t[50]=L,t[51]=B,t[52]=V):V=t[52],V}function $k(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function eA(e){let{value:t,unit:n}=$k(e);return n===`rem`?t*16:t}function tA(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var nA=3600*24*7;function rA(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?iA:m,O=g===void 0?nA: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 q=eA(b),J;t[6]===x?J=t[7]:(J=eA(x),t[6]=x,t[7]=J);let ee=J,Y;t[8]!==E||t[9]!==k?(Y=function(e){E&&(P.current=!0,j.current=H.current?0:eA(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]=Y):Y=t[10];let te=Y,ne,X;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ee||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ne=()=>{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}=$k(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<=q*w;else if(e<=q){let n=q*(w-1);t=q-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>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(ee,t)),u=tA(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(q,Math.min(ee,u)),f=tA(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)}},X=[i,a,D,q,ee,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]=ee,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ne,t[25]=X):(ne=t[24],X=t[25]),(0,Q.useEffect)(ne,X);let re;return t[26]===te?re=t[27]:(re={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=re),re}function iA(){}var aA=3600*24*7,oA=`18rem`,sA=`3rem`,cA=`app-file-sidebar`,lA=`14.625rem`,uA=`32rem`,dA=`sidebar_width`,fA=/^\d+(?:\.\d+)?(?:rem|px)$/,pA=Q.createContext(null);function mA(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${dA}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return fA.test(n)?n:e}function hA(){let e=Q.use(pA);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function gA(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?oA:c,[u]=Q.useState(vA),d;t[8]===u?d=t[9]:(d=()=>Ow(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>mA(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=Fw();return Lw(`left`,Ow(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),Rw(`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(_A)},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: ${Tw}px)`),t=()=>{let e=Ow(u,window.innerWidth,`left`);p(e),C(Lw(`left`,e,Fw())===`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(cA)?.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=>{nc(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":sA,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=oi(`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 q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(pA.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function _A(e){return!e}function vA(){return Dr()}function yA(e){let t=(0,$.c)(39),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{state:p,isDraggingRail:m}=hA();if(d===`none`){let e;t[7]===r?e=t[8]:(e=oi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}let h=p===`collapsed`?d:``,g=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[14]===g?_=t[15]:(_=oi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[16]=_,t[17]=v);let y;t[18]===f?y=t[19]:(y=f({id:`07q4Qk`}),t[18]=f,t[19]=y);let b=u===`floating`||u===`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`,x;t[20]!==r||t[21]!==b?(x=oi(`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)]`,b,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=b,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=(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]=S);let C;t[25]!==a||t[26]!==l||t[27]!==x||t[28]!==S||t[29]!==y?(C=(0,Z.jsx)(`nav`,{id:cA,"aria-label":y,"data-slot":`sidebar-container`,"data-side":l,className:x,...a,children:S}),t[25]=a,t[26]=l,t[27]=x,t[28]=S,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==m||t[32]!==l||t[33]!==p||t[34]!==C||t[35]!==h||t[36]!==v||t[37]!==u?(w=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":p,"data-collapsible":h,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":m,children:[v,C]}),t[31]=m,t[32]=l,t[33]=p,t[34]=C,t[35]=h,t[36]=v,t[37]=u,t[38]=w):w=t[38],w}function bA(e){let t=(0,$.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=hA(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=rc(`toggle-files-sidebar`);l=ci,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=cA,g=o(c===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=o,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[14]===n?_=t[15]:(_=oi(n),t[14]=n,t[15]=_);let v;t[16]!==r||t[17]!==s?(v=e=>{r?.(e),s()},t[16]=r,t[17]=s,t[18]=v):v=t[18];let y;t[19]===c?y=t[20]:(y=c===`expanded`?(0,Z.jsx)(Yt,{}):(0,Z.jsx)(Bl,{}),t[19]=c,t[20]=y);let b;return t[21]!==l||t[22]!==a||t[23]!==u||t[24]!==y||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(b=(0,Z.jsx)(l,{"data-sidebar":u,"data-slot":d,variant:f,size:p,"aria-expanded":m,"aria-controls":h,"aria-label":g,className:_,onClick:v,...a,children:y}),t[21]=l,t[22]=a,t[23]=u,t[24]=y,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=b):b=t[33],b}function xA(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=hA(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:lA,maxResizeWidth:uA,setIsDraggingRail:h,widthCookieName:dA,widthCookieMaxAge:aA},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=rA(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=oi(`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]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function SA(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}=hA(),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=oi(`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 CA(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=oi(`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 wA(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=oi(`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 TA(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=oi(`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 EA(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=oi(`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 DA(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=oi(`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 OA=ii(`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 kA(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?si:`button`,{state:m}=hA(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=oi(OA({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)(js,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Ns,{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)(Is,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function AA(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 jA(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Ir.safeParse(t);return n.success?n.data.currentBranch??null:null}var MA=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:AA({fetchBranch:jA,subscribeToEvent:ns}),NA=MA.subscribe,PA=MA.getSnapshot;function FA(){return(0,Q.useSyncExternalStore)(NA,PA,PA)}function IA(){let e=(0,$.c)(6),t=FA(),n=po(),{state:r}=hA(),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&&ua(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 LA(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=IA();if(!o&&l===null)return null;let u=r??n,d=r!=null,{words:f,chars:p,tokens:m}=u,h;t[0]!==c||t[1]!==d||t[2]!==o?(h=c(o?d?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=c,t[1]=d,t[2]=o,t[3]=h):h=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=g):g=t[4];let _;t[5]===l?_=t[6]:(_=l===null?null:(0,Z.jsx)(RA,{identity:l}),t[5]=l,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[7]=_,t[8]=v);let y;t[9]!==c||t[10]!==u.chars||t[11]!==u.tokens||t[12]!==u.words||t[13]!==p||t[14]!==d||t[15]!==o||t[16]!==m||t[17]!==f?(y=o?(0,Z.jsxs)(`span`,{className:`flex items-center shrink-0 gap-3`,children:[d?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:c({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.words.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`gljvbT`,values:{words:f}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:p}})]}),(0,Z.jsxs)(`span`,{children:[u.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.tokens.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:m}})]})]}):null,t[9]=c,t[10]=u.chars,t[11]=u.tokens,t[12]=u.words,t[13]=p,t[14]=d,t[15]=o,t[16]=m,t[17]=f,t[18]=y):y=t[18];let b;return t[19]!==h||t[20]!==v||t[21]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":h,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[g,v,y]}),t[19]=h,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function RA(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)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Ns,{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)(Oe,{"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 zA(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{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=oi(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function BA(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=oi(`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 VA(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=oi(`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 HA(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=oi(`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 UA(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=oi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(No,{}),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 WA=1,GA=2,KA=4;function qA(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{prefix:e}=je(n,``);if(!e){l=null;break bb0}let u=e.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>KA?[...u.slice(0,WA).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(WA,-GA)},...u.slice(-GA).map((e,t)=>d(e,u.length-GA+t))]:u.map((e,t)=>d(e,t));a=zA,t[8]===r?c=t[9]:(c=oi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=BA,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(JA)}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 JA(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(UA,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(VA,{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)(hl,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(VA,{className:`min-w-0`,children:(0,Z.jsx)(HA,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var YA={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`},XA=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`,...YA,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},ZA=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)(XA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},QA=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)(XA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function $A(e){let t=(0,$.c)(90),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=tc(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[1]!==f||t[2]!==n||t[3]!==u||t[4]!==r||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==c||t[9]!==a){let e=rc(`toggle-document-panel`);v=`editor-toolbar`,y=`pointer-events-none absolute inset-x-0 top-0 z-10`;let i;t[24]===n?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(qA,{docName:n})}),t[24]=n,t[25]=i);let p=r?`source`:`wysiwyg`,m;t[26]===o?m=t[27]:(m=e=>{e&&o(e)},t[26]=o,t[27]=m);let k;t[28]===f?k=t[29]:(k=f({id:`n7aopT`}),t[28]=f,t[29]=k);let A;t[30]===f?A=t[31]:(A=f({id:`ur2XSb`}),t[30]=f,t[31]=A);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(js,{children:(0,Z.jsx)(QA,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(yo,{value:`wysiwyg`,"aria-label":A,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:j}),t[33]=A,t[34]=M);let N;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[35]=N):N=t[35];let P;t[36]===M?P=t[37]:(P=(0,Z.jsxs)(Is,{children:[M,N]}),t[36]=M,t[37]=P);let F;t[38]===f?F=t[39]:(F=f({id:`xbdtfY`}),t[38]=f,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(ZA,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(yo,{value:`source`,"aria-label":F,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:I})})}),t[41]=a,t[42]=F,t[43]=L):L=t[43];let R;t[44]===a?R=t[45]:(R=(0,Z.jsx)(Ns,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[44]=a,t[45]=R);let z;t[46]!==L||t[47]!==R?(z=(0,Z.jsxs)(Is,{children:[L,R]}),t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;t[49]!==p||t[50]!==m||t[51]!==k||t[52]!==P||t[53]!==z?(B=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(xo,{type:`single`,value:p,onValueChange:m,"aria-label":k,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[P,z]})}),t[49]=p,t[50]=m,t[51]=k,t[52]=P,t[53]=z,t[54]=B):B=t[54],t[55]!==i||t[56]!==B?(b=(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:[i,B]})}),t[55]=i,t[56]=B,t[57]=b):b=t[57],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[58]!==f||t[59]!==l||t[60]!==c?(_=c&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(ci,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(Nl,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=Is,h=ci,x=``,S=`ghost`,C=`icon`,w=d,T=!u,E=`doc-panel`,D=f(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=u,t[4]=r,t[5]=l,t[6]=o,t[7]=d,t[8]=c,t[9]=a,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O}else h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=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];let k;t[62]===u?k=t[63]:(k=(0,Z.jsx)(js,{children:u?(0,Z.jsx)(Hl,{}):(0,Z.jsx)(Vl,{})}),t[62]=u,t[63]=k);let A;t[64]!==h||t[65]!==k||t[66]!==x||t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==T||t[71]!==E||t[72]!==D?(A=(0,Z.jsx)(h,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[64]=h,t[65]=k,t[66]=x,t[67]=S,t[68]=C,t[69]=w,t[70]=T,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;t[74]===u?j=t[75]:(j=(0,Z.jsx)(Ns,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(s,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[74]=u,t[75]=j);let M;t[76]!==g||t[77]!==A||t[78]!==j?(M=(0,Z.jsxs)(g,{children:[A,j]}),t[76]=g,t[77]=A,t[78]=j,t[79]=M):M=t[79];let N;t[80]!==_||t[81]!==M||t[82]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[_,M]}),t[80]=_,t[81]=M,t[82]=O,t[83]=N):N=t[83];let P;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[84]=P):P=t[84];let F;return t[85]!==v||t[86]!==y||t[87]!==b||t[88]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":v,className:y,children:[b,N,P]}),t[85]=v,t[86]=y,t[87]=b,t[88]=N,t[89]=F):F=t[89],F}function ej(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function tj(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=oi(`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)(Vd,{"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 nj=ii(`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 rj(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=oi(nj({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)(Hd,{"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 ij(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=oi(`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)(Ud,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function aj(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=oi(`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)(Wd,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var oj=`ok-terminal-height-v1`,sj=.5;function cj(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*sj))}function lj(e,t){let n=cj(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(240,n)}function uj(){return typeof window>`u`?0:window.innerHeight}function dj(e,t){try{let n=e??localStorage,r=t??uj(),i=n.getItem(oj);if(i==null)return lj(240,r);let a=Number.parseInt(i,10);return lj(Number.isFinite(a)?a:240,r)}catch{return 240}}function fj(e,t,n){try{let r=t??localStorage,i=n??uj();r.setItem(oj,String(lj(e,i)))}catch{}}function pj(){try{return typeof localStorage>`u`?240:dj()}catch{return 240}}var mj=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-FU0wWCd1.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([57,1,22,6,3,23,9,11,58,59]),import.meta.url));function hj(e){let t=(0,$.c)(11),{bridge:n,onClose:r,launch:a}=e,o=a===void 0?null:a,{enabled:s,synced:c}=Ai(),l=lo(),{_:u}=i(),d=c&&s===!1,f;t[0]!==u||t[1]!==l?(f=function(){if(l===null){hs.error(u({id:`V_6bJ4`}));return}let e=l(!0);e.ok||hs.error(u({id:`jKd3AP`,values:{0:e.error}}))},t[0]=u,t[1]=l,t[2]=f):f=t[2];let p=f;if(c&&!d){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 i;return t[4]!==n||t[5]!==o||t[6]!==r?(i=(0,Z.jsx)(ce,{fallbackRender:_j,onError:gj,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(mj,{bridge:n,className:`h-full`,onClose:r,launch:o})})}),t[4]=n,t[5]=o,t[6]=r,t[7]=i):i=t[7],i}let m;return t[8]!==p||t[9]!==d?(m=d?(0,Z.jsx)(bj,{onEnable:p}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[8]=p,t[9]=d,t[10]=m):m=t[10],m}function gj(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function _j(e){return(0,Z.jsx)(vj,{...e})}function vj(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=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]=a):a=t[2];let o=a,s;t[3]===r?s=t[4]:(s=r({id:`6MnZEC`}),t[3]=r,t[4]=s);let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[5]=o,t[6]=c);let l;t[7]===r?l=t[8]:(l=r({id:`HpK_8d`}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(ci,{onClick:yj,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function yj(){return window.location.reload()}function bj(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=i(),a;t[0]===r?a=t[1]:(a=r({id:`_XWY2J`}),t[0]=r,t[1]=a);let o;t[2]===r?o=t[3]:(o=r({id:`oYepHb`}),t[2]=r,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[4]=o,t[5]=s);let c;t[6]===r?c=t[7]:(c=r({id:`v2ZW0K`}),t[6]=r,t[7]=c);let l;t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(ci,{onClick:n,children:c}),t[8]=n,t[9]=c,t[10]=l):l=t[10];let u;t[11]===r?u=t[12]:(u=r({id:`ICoNYz`}),t[11]=r,t[12]=u);let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),t[13]=u,t[14]=d);let f;return t[15]!==a||t[16]!==s||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{"aria-label":a,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[s,l,d]}),t[15]=a,t[16]=s,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function xj(e){let t=(0,$.c)(36),{sessions:n,activeSessionId:r,onSelect:a,onTabActivate:o,onNew:c,onClose:l,children:u,className:d}=e,{_:f}=i(),p;t[0]===d?p=t[1]:(p=oi(`flex min-h-0 min-w-0 flex-1 flex-col`,d),t[0]=d,t[1]=p);let m;t[2]===f?m=t[3]:(m=f({id:`1MGRQl`}),t[2]=f,t[3]=m);let h;if(t[4]!==f||t[5]!==r||t[6]!==l||t[7]!==o||t[8]!==n){let e;t[10]!==f||t[11]!==r||t[12]!==l||t[13]!==o?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:oi(`group flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(ij,{value:e.id,onClick:()=>o?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":f({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:oi(`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(),l(e.id)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`})})]},e.id)},t[10]=f,t[11]=r,t[12]=l,t[13]=o,t[14]=e):e=t[14],h=n.map(e),t[4]=f,t[5]=r,t[6]=l,t[7]=o,t[8]=n,t[9]=h}else h=t[9];let g;t[15]!==m||t[16]!==h?(g=(0,Z.jsx)(rj,{variant:`line`,"aria-label":m,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:h}),t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;t[18]===f?_=t[19]:(_=f({id:`AB4qw9`}),t[18]=f,t[19]=_);let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(V,{"aria-hidden":`true`}),t[20]=v):v=t[20];let y;t[21]!==c||t[22]!==_?(y=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:c,children:v})}),t[21]=c,t[22]=_,t[23]=y):y=t[23];let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`AB4qw9`})}),t[24]=b):b=t[24];let x;t[25]===y?x=t[26]:(x=(0,Z.jsxs)(Is,{children:[y,b]}),t[25]=y,t[26]=x);let S;t[27]!==g||t[28]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[g,x]}),t[27]=g,t[28]=x,t[29]=S):S=t[29];let C;return t[30]!==r||t[31]!==u||t[32]!==a||t[33]!==p||t[34]!==S?(C=(0,Z.jsxs)(tj,{value:r,onValueChange:a,className:p,children:[S,u]}),t[30]=r,t[31]=u,t[32]=a,t[33]=p,t[34]=S,t[35]=C):C=t[35],C}var Sj=`terminal-dock-panel`;function Cj(e){return`terminal-session-${e}`}function wj(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function Tj(e){let t=(0,$.c)(77),{bridge:n,children:r,visible:a,onVisibleChange:o,launch:s}=e,c=s===void 0?null:s,{_:l}=i(),{resolvedTheme:u}=Yr(),d=Tx(),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(!a),h;t[0]!==c||t[1]!==a?(h=()=>a?[{id:Cj(1),launch:c}]:[],t[0]=c,t[1]=a,t[2]=h):h=t[2];let[g,_]=(0,Q.useState)(h),v;t[3]===a?v=t[4]:(v=()=>a?Cj(1):``,t[3]=a,t[4]=v);let[y,b]=(0,Q.useState)(v),x=(0,Q.useRef)(y),S=(0,Q.useRef)(g),C=(0,Q.useRef)(+!!a),w=(0,Q.useRef)(a&&c?c.nonce:null),T=(0,Q.useRef)(a),E;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){C.current+=1;let t=Cj(C.current);_(n=>[...n,{id:t,launch:e}]),b(t)},t[5]=E):E=t[5];let D=E,O=(0,Q.useRef)(D),k;t[6]!==y||t[7]!==o?(k=function(e){let t=S.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===y){let e=(t[n-1]??t[n+1])?.id??``;b(e),e!==``&&queueMicrotask(()=>wj(e))}_(r),r.length===0&&(o(!1),f.current?.focus())},t[6]=y,t[7]=o,t[8]=k):k=t[8];let A=k,j=(0,Q.useRef)(Oj),M;t[9]!==y||t[10]!==A||t[11]!==g?(M=()=>{O.current=D,x.current=y,S.current=g,j.current=()=>{y!==``&&A(y)}},t[9]=y,t[10]=A,t[11]=g,t[12]=M):M=t[12],(0,Q.useEffect)(M);let[N]=(0,Q.useState)(Dj),P=(0,Q.useRef)(N),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){R.current!=null&&clearTimeout(R.current),R.current=setTimeout(()=>{fj(e),R.current=null},100)},t[13]=z):z=t[13];let B=z,V=(0,Q.useRef)(null),H,U;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>()=>{R.current!=null&&clearTimeout(R.current),V.current!=null&&(window.removeEventListener(`pointerup`,V.current),V.current=null)},U=[],t[14]=H,t[15]=U):(H=t[14],U=t[15]),(0,Q.useEffect)(H,U);let W,G;t[16]!==c||t[17]!==g.length||t[18]!==a?(W=()=>{let e=T.current;if(T.current=a,c!=null&&c.nonce!==w.current){w.current=c.nonce,O.current(c);return}a&&!e&&g.length===0&&O.current(null)},G=[a,c,g.length],t[16]=c,t[17]=g.length,t[18]=a,t[19]=W,t[20]=G):(W=t[19],G=t[20]),(0,Q.useEffect)(W,G);let K,q;t[21]===n?(K=t[22],q=t[23]):(K=()=>n.onMenuAction(e=>{e===`new-terminal`?O.current(null):e===`kill-terminal`&&j.current()}),q=[n],t[21]=n,t[22]=K,t[23]=q),(0,Q.useEffect)(K,q);let J,ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(Sj)?.contains(document.activeElement))return;let t=S.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),b(t.id),queueMicrotask(()=>wj(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ee=[],t[24]=J,t[25]=ee):(J=t[24],ee=t[25]),(0,Q.useEffect)(J,ee);let Y;t[26]!==n.editor||t[27]!==g.length?(Y=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:g.length>0})},t[26]=n.editor,t[27]=g.length,t[28]=Y):Y=t[28];let te;t[29]!==n||t[30]!==g.length?(te=[n,g.length],t[29]=n,t[30]=g.length,t[31]=te):te=t[31],(0,Q.useEffect)(Y,te);let ne,X;t[32]!==d||t[33]!==a?(ne=()=>{let e=d.current;e!=null&&(a?e.resize(`${P.current}px`):e.collapse())},X=[a,d],t[32]=d,t[33]=a,t[34]=ne,t[35]=X):(ne=t[34],X=t[35]),(0,Q.useEffect)(ne,X);let re,ie;t[36]===p?(re=t[37],ie=t[38]):(re=()=>{p&&document.getElementById(Sj)?.contains(document.activeElement)&&f.current?.focus()},ie=[p],t[36]=p,t[37]=re,t[38]=ie),(0,Q.useLayoutEffect)(re,ie);let ae,oe;t[39]===p?(ae=t[40],oe=t[41]):(ae=()=>{p||wj(x.current)},oe=[p],t[39]=p,t[40]=ae,t[41]=oe),(0,Q.useEffect)(ae,oe);let se;if(t[42]!==l||t[43]!==g){let e;t[45]===l?e=t[46]:(e=(e,t)=>({id:e.id,label:l({id:`OVjNeX`,values:{0:t+1}})}),t[45]=l,t[46]=e),se=g.map(e),t[42]=l,t[43]=g,t[44]=se}else se=t[44];let ce=se,le=F||void 0,ue;t[47]===r?ue=t[48]:(ue=(0,Z.jsx)(qC,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:f,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[47]=r,t[48]=ue);let de;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(JC,{withHandle:!0,onPointerDown:()=>{I(!0),L.current=!0;let e=()=>{I(!1),L.current=!1,window.removeEventListener(`pointerup`,e),V.current=null};V.current=e,window.addEventListener(`pointerup`,e)}}),t[49]=de):de=t[49];let fe;t[50]===u?fe=t[51]:(fe=Lc(u),t[50]=u,t[51]=fe);let pe;t[52]===fe.background?pe=t[53]:(pe={backgroundColor:fe.background},t[52]=fe.background,t[53]=pe);let me=a?`${N}px`:0,he;t[54]!==o||t[55]!==a?(he=e=>{let t=e.asPercentage===0;m(t),L.current&&(t&&a?o(!1):!t&&!a&&o(!0),e.inPixels>0&&(P.current=e.inPixels,B(e.inPixels)))},t[54]=o,t[55]=a,t[56]=he):he=t[56];let ge=!F&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,_e;t[57]===ge?_e=t[58]:(_e=oi(`flex flex-col`,ge),t[57]=ge,t[58]=_e);let ve;t[59]!==y||t[60]!==n||t[61]!==A||t[62]!==g||t[63]!==ce?(ve=g.length>0?(0,Z.jsx)(xj,{sessions:ce,activeSessionId:y,onSelect:b,onTabActivate:Ej,onNew:()=>D(null),onClose:A,className:`h-full`,children:g.map(e=>(0,Z.jsx)(aj,{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)(hj,{bridge:n,launch:e.launch,onClose:()=>A(e.id)})},e.id))}):null,t[59]=y,t[60]=n,t[61]=A,t[62]=g,t[63]=ce,t[64]=ve):ve=t[64];let ye;t[65]!==p||t[66]!==d||t[67]!==pe||t[68]!==me||t[69]!==he||t[70]!==_e||t[71]!==ve?(ye=(0,Z.jsx)(qC,{id:Sj,style:pe,panelRef:d,defaultSize:me,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:he,inert:p,className:_e,children:ve}),t[65]=p,t[66]=d,t[67]=pe,t[68]=me,t[69]=he,t[70]=_e,t[71]=ve,t[72]=ye):ye=t[72];let be;return t[73]!==le||t[74]!==ue||t[75]!==ye?(be=(0,Z.jsxs)(KC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":le,children:[ue,de,ye]}),t[73]=le,t[74]=ue,t[75]=ye,t[76]=be):be=t[76],be}function Ej(e){return queueMicrotask(()=>wj(e))}function Dj(){return pj()}function Oj(){}var kj=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-B_XgaNq-.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent})),Aj=`300px`,jj=`600px`;function Mj(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(Pj,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Nj,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Wt,{name:`editor-area`,children:(0,Z.jsxs)(AC,{children:[n,r]})}),t[3]=n,t[4]=i),i}function Nj(){let e=(0,$.c)(5),t=Dg(),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)(VC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function Pj(e){let t=(0,$.c)(157),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,terminalBridge:c,terminalVisible:l,onTerminalVisibleChange:u,terminalLaunch:d}=e,f=l===void 0?!1:l,p=d===void 0?null:d,{_:m}=i(),{activeDocName:h,activeProvider:g,activeTarget:_,recycleDocument:v,docPanelMode:y,docPanelAgentId:b,docPanelExpandSignal:S}=mt(),{openDocumentTransition:C}=Dt(),{requestAddProperty:w}=MC(),T=gw(g,h),E=yw(h,n===`source`?`source`:`wysiwyg`),D=zw(g),O=D===`connected`||D===`synced`,k=vw(h)===`conflict`,[A,j]=(0,Q.useState)(!1),M,N;t[0]!==g||t[1]!==A?(M=()=>{g!=null&&!A&&j(!0)},N=[g,A],t[0]=g,t[1]=A,t[2]=M,t[3]=N):(M=t[2],N=t[3]),(0,Q.useEffect)(M,N);let P=(0,Q.useDeferredValue)(h),F=_?.kind===`missing`,I=!!h&&_?.kind!==`folder`,L;t[4]!==m||t[5]!==F?(L=F?m({id:`K-a33w`}):void 0,t[4]=m,t[5]=F,t[6]=L):L=t[6];let R=L,[z]=(0,Q.useState)(Lj),B=z!==null,V;t[7]===z?V=t[8]:(V=()=>Ow(z,window.innerWidth,`right`),t[7]=z,t[8]=V);let[H,U]=(0,Q.useState)(V),W=(0,Q.useRef)(H),G,K;t[9]===H?(G=t[10],K=t[11]):(G=()=>{W.current=H},K=[H],t[9]=H,t[10]=G,t[11]=K),(0,Q.useEffect)(G,K);let q=Tx(),J;t[12]===H?J=t[13]:(J=()=>Lw(`right`,H,Fw())===`collapsed`,t[12]=H,t[13]=J);let[ee]=(0,Q.useState)(J),[Y,te]=(0,Q.useState)(ee),ne=(0,Q.useRef)(Y),X,re;t[14]===Y?(X=t[15],re=t[16]):(X=()=>{ne.current=Y},re=[Y],t[14]=Y,t[15]=X,t[16]=re),(0,Q.useEffect)(X,re);let[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(!1),[se]=(0,Q.useState)(Ij),ce=(0,Q.useRef)(se),le=(0,Q.useRef)(null),ue;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(e){le.current!=null&&clearTimeout(le.current),le.current=setTimeout(()=>{Cw(e),le.current=null},100)},t[17]=ue):ue=t[17];let de=ue,fe,pe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>()=>{le.current!=null&&clearTimeout(le.current)},pe=[],t[18]=fe,t[19]=pe):(fe=t[18],pe=t[19]),(0,Q.useEffect)(fe,pe);let[me,he]=(0,Q.useState)(null),ge;t[20]!==Y||t[21]!==q?(ge=function(){if(q.current==null)return;let e=W.current;Y?(Rw(`right`,e,`open`),q.current?.expand()):(Rw(`right`,e,`collapsed`),q.current?.collapse())},t[20]=Y,t[21]=q,t[22]=ge):ge=t[22];let _e=ge,ve,ye;t[23]!==z||t[24]!==q?(ve=()=>{let e=window.matchMedia(`(min-width: ${Ew}px)`),t=()=>{let e=Ow(z,window.innerWidth,`right`);U(e);let t=Lw(`right`,e,Fw())===`collapsed`;te(t),t?q.current?.collapse():q.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ye=[z,q],t[23]=z,t[24]=q,t[25]=ve,t[26]=ye):(ve=t[25],ye=t[26]),(0,Q.useEffect)(ve,ye);let be,xe;t[27]!==me||t[28]!==B||t[29]!==q?(be=()=>{if(me==null||B)return;let e=new ResizeObserver(()=>{ne.current||oe.current||q.current?.resize(`${ce.current}px`)});return e.observe(me),()=>e.disconnect()},xe=[me,B,q],t[27]=me,t[28]=B,t[29]=q,t[30]=be,t[31]=xe):(be=t[30],xe=t[31]),(0,Q.useEffect)(be,xe);let Se,Ce;t[32]!==o||t[33]!==q?(Se=()=>{let e=e=>{o(e),q.current?.expand()},t=Eh();return t&&e(t),Oh(t=>{Eh(),e(t)})},Ce=[o,q],t[32]=o,t[33]=q,t[34]=Se,t[35]=Ce):(Se=t[34],Ce=t[35]),(0,Q.useEffect)(Se,Ce);let we,Te;t[36]!==S||t[37]!==q?(we=()=>{S!==0&&q.current?.expand()},Te=[S,q],t[36]=S,t[37]=q,t[38]=we,t[39]=Te):(we=t[38],Te=t[39]),(0,Q.useEffect)(we,Te);let Ee,De;t[40]===Y?(Ee=t[41],De=t[42]):(Ee=()=>{if(!Y||!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()},De=[Y],t[40]=Y,t[41]=Ee,t[42]=De),(0,Q.useLayoutEffect)(Ee,De);let Oe,ke;t[43]===Y?(Oe=t[44],ke=t[45]):(Oe=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Y})},ke=[Y],t[43]=Y,t[44]=Oe,t[45]=ke),(0,Q.useEffect)(Oe,ke);let Ae,je;t[46]===_e?(Ae=t[47],je=t[48]):(Ae=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&_e()})},je=[_e],t[46]=_e,t[47]=Ae,t[48]=je),(0,Q.useEffect)(Ae,je);let Me,Ne;t[49]===_e?(Me=t[50],Ne=t[51]):(Me=()=>{if(window.okDesktop!=null)return;let e=e=>{nc(e,`toggle-document-panel`)&&(e.preventDefault(),_e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ne=[_e],t[49]=_e,t[50]=Me,t[51]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=(0,Q.useRef)(null),[Fe,Ie]=(0,Q.useState)(null),Le=_?.kind===`large-file`?_.docName:h,Re,ze;t[52]===Le?(Re=t[53],ze=t[54]):(Re=()=>{if(Le&&Le!==Pe.current){let e=Pe.current;Pe.current=Le,Ie(e)}},ze=[Le],t[52]=Le,t[53]=Re,t[54]=ze),(0,Q.useEffect)(Re,ze);let Ve;t[55]===C?Ve=t[56]:(Ve=function(e){let t=Vo(e);window.location.hash===t?C(e):window.location.hash=t},t[55]=C,t[56]=Ve);let He=Ve,Ue,We=null;if(_?.kind===`large-file`){let e;t[57]!==He||t[58]!==Fe?(e=Fe?{previousDocName:Fe,onNavigateBack:He}:void 0,t[57]=He,t[58]=Fe,t[59]=e):e=t[59];let n;t[60]!==_.docName||t[61]!==_.limit||t[62]!==_.size||t[63]!==e?(n=(0,Z.jsx)(EC,{docName:_.docName,size:_.size,limit:_.limit,backNav:e}),t[60]=_.docName,t[61]=_.limit,t[62]=_.size,t[63]=e,t[64]=n):n=t[64],Ue=n}else if(_?.kind===`folder`){let e;if(t[65]===_.folderPath?e=t[66]:(e=(0,Z.jsx)(SC,{folderPath:_.folderPath}),t[65]=_.folderPath,t[66]=e),Ue=e,y===`agent`&&b!==null){let e;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(JC,{withHandle:!0}),t[67]=e):e=t[67];let n;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(qC,{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)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(kj,{showBackButton:!1})})})]}),t[68]=n):n=t[68],We=n}}else if(_?.kind===`asset`){let e;t[69]!==_.assetPath||t[70]!==_.mediaKind?(e=(0,Z.jsx)(Rx,{assetPath:_.assetPath,mediaKind:_.mediaKind},_.assetPath),t[69]=_.assetPath,t[70]=_.mediaKind,t[71]=e):e=t[71],Ue=e}else if(!g||!h)if((typeof window<`u`?is(window.location.hash):null)!==null)if(c!=null&&A){let e;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zx,{}),t[72]=e):e=t[72],Ue=e;let n;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(JC,{withHandle:!0,disabled:!0}),t[73]=n):n=t[73];let r=ee?0:`${se}px`,i;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[74]=i):i=t[74];let a;t[75]===r?a=t[76]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(qC,{id:`doc-panel`,defaultSize:r,minSize:Aj,maxSize:jj,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[75]=r,t[76]=a),We=a}else{let e;return t[77]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zx,{}),t[77]=e):e=t[77],e}else{let e;t[78]===f?e=t[79]:(e=(0,Z.jsx)(HS,{terminalVisible:f}),t[78]=f,t[79]=e),Ue=e}else{let e=n===`source`,i=!O,s=Y,c;t[80]!==h||t[81]!==w?(c=function(){h&&w(h)},t[80]=h,t[81]=w,t[82]=c):c=t[82];let l=c,u=P??h,d=Fe??void 0,f;t[83]!==R||t[84]!==e||t[85]!==He||t[86]!==v||t[87]!==u||t[88]!==d?(f=(0,Z.jsx)(Wk,{activeDocName:u,isSourceMode:e,editorPlaceholder:R,previousDocName:d,onNavigateBack:He,onRecycle:v}),t[83]=R,t[84]=e,t[85]=He,t[86]=v,t[87]=u,t[88]=d,t[89]=f):f=t[89];let p;t[90]!==h||t[91]!==e?(p=(0,Z.jsx)(fw,{activeDocName:h,isSourceMode:e}),t[90]=h,t[91]=e,t[92]=p):p=t[92];let m;t[93]!==h||t[94]!==P?(m=ej({activeDocName:h,deferredActiveDocName:P,mountResolved:h!==null&&x(h),syncResolved:h!==null&&Be(h)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(zx,{}),h===null?null:(0,Z.jsx)(DC,{docName:h})]}):null,t[93]=h,t[94]=P,t[95]=m):m=t[95];let g;t[96]!==f||t[97]!==p||t[98]!==m?(g=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[f,p,m]}),t[96]=f,t[97]=p,t[98]=m,t[99]=g):g=t[99];let _;t[100]!==h||t[101]!==k||t[102]!==s||t[103]!==e||t[104]!==r||t[105]!==l||t[106]!==i||t[107]!==_e?(_=!k&&(0,Z.jsx)($A,{activeDocName:h,isSourceMode:e,sourceDisabled:i,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:_e}),t[100]=h,t[101]=k,t[102]=s,t[103]=e,t[104]=r,t[105]=l,t[106]=i,t[107]=_e,t[108]=_):_=t[108];let b;t[109]!==g||t[110]!==_?(b=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[g,_]}),t[109]=g,t[110]=_,t[111]=b):b=t[111];let S;t[112]!==E||t[113]!==I||t[114]!==T?(S=(0,Z.jsx)(LA,{stats:T,selectionStats:E,showStats:I}),t[112]=E,t[113]=I,t[114]=T,t[115]=S):S=t[115];let C;t[116]!==b||t[117]!==S?(C=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[b,S]}),t[116]=b,t[117]=S,t[118]=C):C=t[118],Ue=C;let D=B&&Y,A;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{ae(!0),oe.current=!0;let e=()=>{ae(!1),oe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[119]=A):A=t[119];let j;t[120]===D?j=t[121]:(j=(0,Z.jsx)(JC,{withHandle:!0,disabled:D,onPointerDown:A}),t[120]=D,t[121]=j);let M=ee?0:`${se}px`,N;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{te(e.asPercentage===0),e.inPixels>0&&oe.current&&(ce.current=e.inPixels,de(e.inPixels))},t[122]=N):N=t[122];let F=!ie&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,L;t[123]===F?L=t[124]:(L=oi(`flex flex-col bg-muted/20`,F),t[123]=F,t[124]=L);let z;t[125]!==h||t[126]!==a||t[127]!==y||t[128]!==e||t[129]!==o?(z=(0,Z.jsx)(jy,{docName:h,isSourceMode:e,activeTab:a,onActiveTabChange:o,mode:y}),t[125]=h,t[126]=a,t[127]=y,t[128]=e,t[129]=o,t[130]=z):z=t[130];let V;t[131]!==Y||t[132]!==q||t[133]!==M||t[134]!==L||t[135]!==z?(V=(0,Z.jsx)(qC,{id:`doc-panel`,panelRef:q,defaultSize:M,minSize:Aj,maxSize:jj,collapsible:!0,collapsedSize:0,onResize:N,inert:Y,className:L,children:z}),t[131]=Y,t[132]=q,t[133]=M,t[134]=L,t[135]=z,t[136]=V):V=t[136];let H;t[137]!==j||t[138]!==V?(H=(0,Z.jsxs)(Z.Fragment,{children:[j,V]}),t[137]=j,t[138]=V,t[139]=H):H=t[139],We=H}let Ge;t[140]!==u||t[141]!==c||t[142]!==p||t[143]!==f||t[144]!==Ue?(Ge=c==null?Ue:(0,Z.jsx)(Tj,{bridge:c,visible:f,onVisibleChange:u??Fj,launch:p,children:Ue}),t[140]=u,t[141]=c,t[142]=p,t[143]=f,t[144]=Ue,t[145]=Ge):Ge=t[145];let Ke=Ge,qe=ie||void 0,Je;t[146]!==ee||t[147]!==We?(Je=We!=null&&!ee?{}:{defaultSize:`100%`},t[146]=ee,t[147]=We,t[148]=Je):Je=t[148];let Ye=ie?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Xe;t[149]!==Ke||t[150]!==Je||t[151]!==Ye?(Xe=(0,Z.jsx)(qC,{minSize:`30%`,...Je,className:Ye,children:Ke}),t[149]=Ke,t[150]=Je,t[151]=Ye,t[152]=Xe):Xe=t[152];let Ze;return t[153]!==We||t[154]!==qe||t[155]!==Xe?(Ze=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:he,children:(0,Z.jsxs)(KC,{orientation:`horizontal`,"data-dragging":qe,children:[Xe,We]})}),t[153]=We,t[154]=qe,t[155]=Xe,t[156]=Ze):Ze=t[156],Ze}function Fj(){}function Ij(){return ww()}function Lj(){return Dr()}function Rj(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 zj(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 Bj=1e3,Vj=!1;function Hj(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function Uj(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:Si(i)?a=i:(a=void 0,Vj||(Vj=!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`&&(Hj({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=zj(i),{current:c,crossDoc:l}=a?_i(a,n,Date.now()):{current:[],crossDoc:[]},u=Wj,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Rj(e.current,p)&&Rj(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,Bj);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 Wj(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Gj=`sync-status`;function Kj(e,t){let n=(0,$.c)(6),{_:r}=i(),a=cm(),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(t),l,u;n[0]!==r||n[1]!==t||n[2]!==a||n[3]!==e?(l=()=>{if(c.current!==t&&(c.current=t,o.current=!1,s.current=!1),t)if(e===`synced`&&(o.current=!0),e===`disconnected`&&o.current){if(a){hs.dismiss(Gj);return}s.current=!0,hs.warning(r({id:`HGNCsl`}),{id:Gj,duration:1/0})}else s.current&&e===`synced`&&(s.current=!1,hs.success(r({id:`GhjUB_`}),{id:Gj,duration:3e3}))},u=[e,t,r,a],n[0]=r,n[1]=t,n[2]=a,n[3]=e,n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,Q.useEffect)(l,u)}var qj=4,Jj=3,Yj={Bird:tl,Cat:sl,Dog:ml,Fish:bl,Mouse:ql,Rabbit:Kl,Shrimp:$l,Snail:eu,Squirrel:iu,Turtle:fu};Object.freeze(Object.keys(Yj));function Xj(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(Yj,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var Zj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function Qj(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=Xj(n),c=s.kind===`animal`?Yj[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=nr(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Wr(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(Ns,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Is,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function $j(e){let t=Zj[e.icon];return e.displayName||t||ms._({id:`iEQQyu`})}function eM(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 tM(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=mt(),{presence:u,agentId:d}=n,f=$j(u),p=eM(u.mode),m=!r&&p,h=u.currentDoc&&u.currentDoc!==`(connected)`?u.currentDoc:null,g=l!==null||h!==null,_=g?`cursor-pointer`:`cursor-default opacity-50`,v=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,y=m&&!a?`ring-primary/40 animate-pulse`:``,b;t[0]!==_||t[1]!==v||t[2]!==y?(b=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,_,v,y].filter(Boolean),t[0]=_,t[1]=v,t[2]=y,t[3]=b):b=t[3];let x=b.join(` `),S=r?`true`:void 0,C=a?`true`:void 0,w=g?void 0:`true`,T;t[4]!==u.mode||t[5]!==S||t[6]!==C||t[7]!==w?(T={"data-presence-badge":`agent`,"data-presence-mode":u.mode,"data-presence-crossdoc":S,"data-presence-scoped":C,"data-presence-inert":w},t[4]=u.mode,t[5]=S,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=T,D=c(r&&h?{id:`b4AQFK`,values:{tooltipName:f,realCurrentDoc:h}}:{id:`RfHNf8`,values:{tooltipName:f}}),O;t[9]!==d||t[10]!==D||t[11]!==E||t[12]!==g||t[13]!==o||t[14]!==u.color||t[15]!==u.icon||t[16]!==h||t[17]!==x||t[18]!==f?(O=g?(0,Z.jsx)(`button`,{type:`button`,...E,"aria-label":D,className:x,style:{backgroundColor:u.color},onClick:()=>o(d,h),children:(0,Z.jsx)(bi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...E,role:`img`,"aria-label":f,className:x,style:{backgroundColor:u.color},children:(0,Z.jsx)(bi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=d,t[10]=D,t[11]=E,t[12]=g,t[13]=o,t[14]=u.color,t[15]=u.icon,t[16]=h,t[17]=x,t[18]=f,t[19]=O):O=t[19];let k=O,A;t[20]===k?A=t[21]:(A=(0,Z.jsx)(js,{asChild:!0,children:k}),t[20]=k,t[21]=A);let j;t[22]===f?j=t[23]:(j=(0,Z.jsx)(`span`,{className:`font-medium`,children:f}),t[22]=f,t[23]=j);let M;t[24]!==r||t[25]!==h?(M=r&&h?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:h}})}):null,t[24]=r,t[25]=h,t[26]=M):M=t[26];let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsxs)(Ns,{className:`flex flex-col gap-0.5`,children:[j,M]}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;return t[30]!==A||t[31]!==N?(P=(0,Z.jsxs)(Is,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function nM(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)(Qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(tM,{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)(b,{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)(fe,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function rM(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(Qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(tM,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function iM(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=mt(),{current:s,crossDoc:c}=Uj(t,r,n);if(Kj(zw(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,qj),n;e[6]===s?n=e[7]:(n=s.slice(qj),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Jj),d;e[8]===c?d=e[9]:(d=c.slice(Jj),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=>rM(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)(nM,{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=>rM(e,p,!0,m)),f.length>0?(0,Z.jsx)(nM,{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}var aM=new Set([`.md`,`.mdx`]);function oM(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function sM(e,t){let n=e.lastIndexOf(`/`),r=n<0?``:e.slice(0,n+1),i=n<0?e:e.slice(n+1),a=i.lastIndexOf(`.`);return`${r}${a<=0?i:i.slice(0,a)}${t}`}function cM(e){return aM.has(oM(e).toLowerCase())}function lM(e,t,n){if(n)return{kind:`allow`,destinationPath:t};let r=oM(e);return r===``?{kind:`allow`,destinationPath:t}:{kind:`allow`,destinationPath:oM(t)?t:sM(t,r)}}var uM=`.md`,dM=/\.(md|mdx)$/i;function fM(e,t=uM){return`${e}${t}`}function pM(e){return BM(e).replace(dM,``)}function mM(e){return Zo(e)?_M(e.path):Ro(e)?e.path:fM(e.docName,e.docExt)}function hM(e){let t=BM(e).match(dM);return t?`.${t[1].toLowerCase()}`:void 0}function gM(e){return BM(e)}function _M(e){let t=BM(e.trim());return t?`${t}/`:``}function vM(e){return e.endsWith(`/`)?gM(e):pM(e)}function yM(e){return e.map(mM)}function bM(e){return[...e].sort().join(`\0`)}function xM(e){return bM(yM(e))}function SM(e){let t=new Set;for(let n of e){if(Zo(n)){let e=_M(n.path);e&&t.add(e)}let e=(Zo(n)||Ro(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Zo(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function CM(e){if(!e)return[];let t=BM(e.replace(dM,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function wM(e,t,n){let r=hM(e);if(r)return r;let i=n.find(e=>fs(e)&&e.docName===t);return i?i.docExt??uM:zM(e).includes(`.`)?void 0:uM}function TM(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!Ro(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function EM(e,t,n){if(hM(e))return null;let r=n.find(e=>Ro(e)&&e.path===t);return r?r.path:zM(e).includes(`.`)?t:TM(t,n)}function DM(e,t){let n=e.kind===`directory`,r=n?gM(e.path):pM(e.path);if(n)return{kind:`folder`,name:BM(zM(e.path)).replace(dM,``),path:r,treePath:kM(e.path,!0)};let i=EM(e.path,r,t);if(i)return{kind:`asset`,name:BM(zM(i)),path:i,treePath:i};let a=wM(e.path,r,t);return{kind:`file`,name:BM(zM(e.path)).replace(dM,``),path:r,treePath:kM(e.path,!1),docExt:a}}function OM(e){return e.kind===`directory`?gM(e.path):e.path}function kM(e,t){return t?_M(e):dM.test(e)?e:`${e}${uM}`}function AM(e,t,n){let r=_M(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${uM}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function jM(e,t){return e===`file`?kM(t,!1):`${gM(t)}/index${uM}`}function MM(e,t){return t.kind===`root`||t.directoryPath==null?zM(e):`${t.directoryPath}${zM(e)}`}function NM(e,t){if(t)return gM(_M(e));let n=pM(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function PM(e,t){let n=gM(_M(e));return n?`${n}/${t}`:t}function FM(e,t){return(t.path??PM(e,t.src)).replace(/^\/+/,``)}function IM(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function LM(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function RM(e,t){let n=oM(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:pM(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:ar(i),modified:r,size:t.size}}function zM(e){let t=BM(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function BM(e){return e.endsWith(`/`)?e.slice(0,-1):e}function VM(e,t){return t.trim()}function HM(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function UM(e,t){let n=VM(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function WM(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(fs(e)){let t=s.get(fM(e.docName,e.docExt));if(t){let n=Bo(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:ar(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(Zo(e))return{...e,path:ZM(e.path,n)};if(Ro(e)){let t=s.get(e.path);return t&&cM(t)?{kind:`document`,docName:pM(t),docExt:oM(t),size:e.size,modified:e.modified}:{...e,path:t??ZM(e.path,n)}}return e})}function GM(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=>fs(e)?!i.has(e.docName)&&!tN(e.docName,n):Zo(e)?!tN(e.path,n):Ro(e)?!a.has(e.path)&&!tN(e.path,n):!0)}function KM(e,t){if(e.kind!==`asset`||t.some(t=>Ro(t)&&t.path===e.path))return e;let n=TM(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function qM(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>QM(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>fs(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=>Zo(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(fs(i)){let e=eN(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Zo(i)){let e=$M(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function JM(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function YM(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function XM(e,t){let n=e.kind===`file`?fM(e.path,e.docExt):e.path;return Qg(t.contentDir,n,t.pathSeparator)}function ZM(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 QM(e,t){return fs(e)&&fs(t)?e.docName===t.docName:Zo(e)&&Zo(t)||Ro(e)&&Ro(t)?e.path===t.path:!1}function $M(e,t,n){return e===t?n:eN(e,t,n)}function eN(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function tN(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function nN(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)(pd,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function rN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(md,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function iN(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)(_d,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function aN(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)(Cd,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function oN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`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)(hd,{children:(0,Z.jsx)(gd,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function sN(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=oi(`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)(yd,{"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 cN(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=oi(`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)(No,{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)(wd,{"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 lN(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=oi(`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)(Td,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function uN(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=oi(`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)(xd,{children:(0,Z.jsx)(ko,{})})}),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)(bd,{"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 dN(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=oi(`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)(vd,{"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 fN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`-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)(Sd,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var pN=`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`,mN=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,hN={start:[Wi.Space],cancel:[Wi.Esc],end:[Wi.Space,Wi.Enter]};function gN(e){return oi(pN,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function _N(e){return e?void 0:-1}function vN({className:e,isDragging:t}){return oi(e,t&&mN)}function yN(e){return e.code===Wi.Enter&&e.target===e.currentTarget}function bN({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&yN(e)?`activate-tab`:`delegate-sortable`}function xN({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Na.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 SN(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 CN(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 wN=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 Sa(e)},TN=[`.md`,`.mdx`],EN=`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`,DN=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,ON=oi(DN,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),kN=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function AN(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function jN(e){let t=Vo(e);window.location.hash!==t&&(window.location.hash=t)}function MN(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function NN(e,t){let n=[t,...TN].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 PN(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:_}=Ri(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=xN({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=bN({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=vN({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 FN(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=Je(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=Je(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(rN,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(sN,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(sN,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(sN,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(fN,{}),(0,Z.jsx)(sN,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(oN,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(nN,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function IN(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:a,isPinned:o,tabId:s,unpinTab:c}=e,{_:l}=i();if(o){let e;t[0]!==l||t[1]!==n?(e=l({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=l,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==s||t[4]!==c?(r=e=>{e.stopPropagation(),c(s)},t[3]=s,t[4]=c,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Gl,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let u;t[10]!==l||t[11]!==n?(u=l({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=l,t[11]=n,t[12]=u):u=t[12];let d;t[13]===a?d=t[14]:(d=gN(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=_N(a),t[15]=a,t[16]=f);let p;t[17]!==r||t[18]!==s?(p=e=>{e.stopPropagation(),r(s)},t[17]=r,t[18]=s,t[19]=p):p=t[19];let m;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(gs,{"aria-hidden":`true`}),t[20]=m):m=t[20];let h;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p?(h=(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u,"data-testid":`editor-tab-close-button`,className:d,tabIndex:f,onClick:p,children:m}),t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=h):h=t[25],h}function LN(e){let t=(0,$.c)(1),{docName:n}=e;if(vw(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Lo,{"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 RN(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=mt(),{_:T}=i(),{pageMeta:E}=rs(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G;e[0]!==n||e[1]!==t||e[2]!==a?(G=n??(a?Xe(a):t?He(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=G):G=e[3];let K=G,q;e[4]!==r||e[5]!==K||e[6]!==h||e[7]!==g||e[8]!==v?(q=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:K?`${K}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=K,e[6]=h,e[7]=g,e[8]=v,e[9]=q):q=e[9];let J=q,ee,Y;e[10]===t?(ee=e[11],Y=e[12]):(ee=()=>{W.current=t},Y=[t],e[10]=t,e[11]=ee,e[12]=Y),(0,Q.useEffect)(ee,Y);let te,ne;e[13]===J?(te=e[14],ne=e[15]):(te=()=>{J&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},ne=[J],e[13]=J,e[14]=te,e[15]=ne),(0,Q.useEffect)(te,ne);let X,re;e[16]===j?(X=e[17],re=e[18]):(X=()=>{j&&(z.current?.focus(),z.current?.select())},re=[j],e[16]=j,e[17]=X,e[18]=re),(0,Q.useEffect)(X,re);let ie,ae;e[19]!==v||e[20]!==j?(ie=()=>{!j||v.includes(j.tabId)||(H.current=!0,U.current=null,M(null),P(``),I(null),R(!1))},ae=[v,j],e[19]=v,e[20]=j,e[21]=ie,e[22]=ae):(ie=e[21],ae=e[22]),(0,Q.useEffect)(ie,ae);let oe=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,M({docName:t,tabId:e}),P(n[n.length-1]),I(null)},se=function(){H.current=!0,U.current=null,M(null),P(``),I(null),R(!1)},ce=async function(){if(H.current){H.current=!1;return}if(B.current)return;let e=j?.docName;if(!e){se();return}let t=VM(`file`,NN(N,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){se();return}if(t===U.current){z.current?.focus();return}if(!HM(t)){I(T({id:`P8yDjG`})),z.current?.focus();return}let i=UM({kind:`file`,path:e,name:r},t);B.current=!0,R(!0),I(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(H.current){R(!1),B.current=!1;return}let r=await _e(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),R(!1),B.current=!1,U.current=t,z.current?.focus();return}let a=A(Zr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,s=JM(o,a);Bt(a);let c=!0;try{let e=YM(a,p(),m);await Promise.all(e.map(e=>l(e))),x(a),ss([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),hs.error(T({id:`MUBR8r`}))}H.current=!0,M(null),P(``),I(null),R(!1),B.current=!1,U.current=null,c&&s&&s!==o&&jN(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(T({id:`HIb0vl`})),R(!1),B.current=!1,U.current=t,z.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===g?ue=e[24]:(ue=new Set(g),e[23]=g,e[24]=ue);let de=ue,fe;e[25]===O?fe=e[26]:(fe=CN(O),e[25]=O,e[26]=fe);let pe;e[27]===fe?pe=e[28]:(pe=[fe],e[27]=fe,e[28]=pe);let me=pe,he;e[29]!==u||e[30]!==f||e[31]!==de?(he=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[29]=u,e[30]=f,e[31]=de,e[32]=he):he=e[32];let ge=he,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:ga,keyboardCodes:hN},e[34]=ye):ye=e[34];let be=wi(ia(va,ve),ia(ba,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){k(SN(D.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){k(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==S||e[39]!==w?(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=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Bi([...w],r,i),t)},e[37]=we,e[38]=S,e[39]=w,e[40]=Te):Te=e[40];let Ee=Te,De=le?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=oi(`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]`,le&&`[-webkit-app-region:drag]`),e[41]=Oe):Oe=e[41];let ke=MN,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=oi(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let Me=Xa,Ne=wN,Pe;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Pe={container:typeof document<`u`?document.body:void 0},e[43]=Pe):Pe=e[43];let Fe=ma,Ie;e[44]===w?Ie=e[45]:(Ie=[...w],e[44]=w,e[45]=Ie);let Le=fa,Re=w.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(FN,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PN,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:oi(EN,t?DN:ON),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:kN,onClick:()=>c(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:gN(t),tabIndex:_N(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=pt(e),n=e===K,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=je(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(FN,{tabId:e,openTabs:w,closeTab:d,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:oi(EN,n?DN:ON),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:kN,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:oi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:oi(`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)(IN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=je(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(FN,{tabId:e,openTabs:w,closeTab:d,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:oi(EN,n?DN:ON),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:kN,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:oi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:oi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(IN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}let a=t.docName,l=E.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=je(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=j?.tabId===e,x=`editor-tab-rename-error-${AN(a)}`;return(0,Z.jsx)(FN,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(PN,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:oi(EN,n?DN:ON,v&&F&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(YC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(ew,{ref:z,value:N,disabled:L,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?x:void 0,"aria-busy":L||void 0,title:F??a,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=>{P(NN(e.target.value,l)),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),se())},onBlur:ce}),(0,Z.jsx)(ZC,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)($C,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),F?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:F}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:kN,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e,a)},tabIndex:-1,children:[(0,Z.jsx)(LN,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(IN,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),ze;e[46]!==Fe||e[47]!==Ie||e[48]!==Le||e[49]!==Re?(ze=(0,Z.jsx)(Fe,{items:Ie,strategy:Le,children:Re}),e[46]=Fe,e[47]=Ie,e[48]=Le,e[49]=Re,e[50]=ze):ze=e[50];let Be;e[51]!==Me||e[52]!==we||e[53]!==Ee||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Ne||e[58]!==Pe||e[59]!==ze||e[60]!==me?(Be=(0,Z.jsx)(Me,{sensors:be,autoScroll:!1,collisionDetection:Ne,modifiers:me,onDragStart:Se,onDragEnd:Ee,onDragCancel:we,accessibility:Pe,children:ze}),e[51]=Me,e[52]=we,e[53]=Ee,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Ne,e[58]=Pe,e[59]=ze,e[60]=me,e[61]=Be):Be=e[61];let Ve;e[62]===T?Ve=e[63]:(Ve=T({id:`3YvS-c`}),e[62]=T,e[63]=Ve);let Ue;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsx)(V,{"aria-hidden":`true`}),e[64]=Ue):Ue=e[64];let We;e[65]!==_||e[66]!==Ve?(We=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Ue})}),e[65]=_,e[66]=Ve,e[67]=We):We=e[67];let Ge;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=Ge):Ge=e[68];let Ke;e[69]===We?Ke=e[70]:(Ke=(0,Z.jsxs)(Is,{children:[We,Ge]}),e[69]=We,e[70]=Ke);let qe;e[71]!==Ae||e[72]!==Be||e[73]!==Ke?(qe=(0,Z.jsxs)(`div`,{className:Ae,children:[Be,Ke]}),e[71]=Ae,e[72]=Be,e[73]=Ke,e[74]=qe):qe=e[74];let Je;return e[75]!==De||e[76]!==Oe||e[77]!==ke||e[78]!==qe?(Je=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":De,className:Oe,onWheel:ke,children:qe}),e[75]=De,e[76]=Oe,e[77]=ke,e[78]=qe,e[79]=Je):Je=e[79],Je}function zN(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 BN(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 VN=[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:St},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:wf},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:zN},{label:`X`,href:`https://x.com/OpenKnowledgeAI`,icon:BN},{label:`Open Knowledge`,href:`https://openknowledge.ai/`,icon:Tf,iconClassName:`scale-125 grayscale transition-[filter] group-hover:grayscale-0`}],HN=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Re,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(Is,{children:[o,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=VN.map(e=>{let{label:n,href:r,icon:i,iconClassName:a}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>aa(e,r),onAuxClick:e=>aa(e,r),className:`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`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:oi(`size-4 shrink-0`,a)}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(b,{align:`end`,className:`w-48 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(fe,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function UN(e){let t=(0,$.c)(19),{installStates:n,terminalLaunch:r,disabled:a,onPick:o,onLaunchTerminal:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(``),f;if(t[0]!==l||t[1]!==a||t[2]!==n||t[3]!==u||t[4]!==c||t[5]!==o||t[6]!==r){let e;t[8]===n?e=t[9]:(e=e=>n[e.id]?.installed===!0,t[8]=n,t[9]=e);let i=_g.filter(e),p=_g.some(e=>n[e.id]?.installed==null),m=i.length>0,h=r!==null,g=m||h,_;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>d(e.target.value),t[10]=_):_=t[10];let v;t[11]===l?v=t[12]:(v=l({id:`Rah7yq`}),t[11]=l,t[12]=v);let y;t[13]===l?y=t[14]:(y=l({id:`ZBt4rI`}),t[13]=l,t[14]=y);let b;t[15]!==u||t[16]!==v||t[17]!==y?(b=(0,Z.jsx)(`div`,{className:`px-2 pt-2 pb-1.5`,children:(0,Z.jsx)(jo,{value:u,onChange:_,placeholder:v,"aria-label":y,"data-testid":`open-in-agent-instruction`})}),t[15]=u,t[16]=v,t[17]=y,t[18]=b):b=t[18],f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[b,g?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[m?(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-desktop-label`,children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(e=>{let{displayName:t}=e;return(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:a,"data-testid":`open-in-agent-item-${e.id}`,"aria-label":l({id:`WqLq6M`,values:{displayName:t}}),onClick:()=>o(e,u),children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t})]},e.id)})]}):null,h?(0,Z.jsxs)(Z.Fragment,{children:[m?(0,Z.jsx)(ta,{className:`my-1`}):null,(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-terminal-label`,children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:a,"data-testid":`open-in-agent-terminal`,"aria-label":l({id:`AcK_r0`}),onClick:()=>c(u),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`fcgvCA`})})]})]})]}):null]}):(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`open-in-agent-empty`,"aria-live":`polite`,children:p?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=l,t[1]=a,t[2]=n,t[3]=u,t[4]=c,t[5]=o,t[6]=r,t[7]=f}else f=t[7];return f}function WN(e){let t=(0,$.c)(44),{input:n,open:r,onOpenChange:a}=e,{_:o}=i(),{states:c,refresh:l}=O_(),{dispatch:u}=__(),d=qx(),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(!1),h=mg(),g=r??f,_;t[0]===l?_=t[1]:(_=()=>{l()},t[0]=l,t[1]=_);let v=(0,Q.useEffectEvent)(_),y;t[2]!==g||t[3]!==v?(y=()=>{g&&v()},t[2]=g,t[3]=v,t[4]=y):y=t[4];let x;if(t[5]===g?x=t[6]:(x=[g],t[5]=g,t[6]=x),(0,Q.useEffect)(y,x),h)return null;let S=typeof window<`u`&&window.okDesktop!=null,C;t[7]!==a||t[8]!==r?(C=e=>{r===void 0&&p(e),a?.(e)},t[7]=a,t[8]=r,t[9]=C):C=t[9];let w=C,T=n===null,E;t[10]===n?E=t[11]:(E=e=>{if(n===null)return null;let t=e.trim();return t?{...n,instruction:t}:n},t[10]=n,t[11]=E);let D=E,O;t[12]!==u||t[13]!==w||t[14]!==D?(O=(e,t)=>{let n=D(t);n!==null&&(u(e.id,n),w(!1))},t[12]=u,t[13]=w,t[14]=D,t[15]=O):O=t[15];let k=O,A;t[16]!==w||t[17]!==D||t[18]!==d?(A=e=>{let t=D(e);t===null||d===null||(d.launchInTerminal(t),w(!1))},t[16]=w,t[17]=D,t[18]=d,t[19]=A):A=t[19];let j=A,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=S?()=>{m.current=!0}:void 0,t[20]=M):M=t[20];let N;t[21]===w?N=t[22]:(N=S?()=>{if(m.current){m.current=!1;return}w(!0)}:void 0,t[21]=w,t[22]=N);let P,F;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(yi,{className:`size-3.5`,"aria-hidden":`true`}),F=(0,Z.jsx)(s,{id:`O7_W_a`}),t[23]=P,t[24]=F):(P=t[23],F=t[24]);let I;t[25]!==N||t[26]!==T?(I=(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`sm`,disabled:T,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:M,onClick:N,children:[P,F]})}),t[25]=N,t[26]=T,t[27]=I):I=t[27];let L;t[28]===o?L=t[29]:(L=o({id:`O7_W_a`}),t[28]=o,t[29]=L);let R=n===null,z;t[30]!==j||t[31]!==k||t[32]!==c||t[33]!==R||t[34]!==d?(z=(0,Z.jsx)(UN,{installStates:c,terminalLaunch:d,disabled:R,onPick:k,onLaunchTerminal:j}),t[30]=j,t[31]=k,t[32]=c,t[33]=R,t[34]=d,t[35]=z):z=t[35];let B;t[36]!==L||t[37]!==z?(B=(0,Z.jsx)(b,{align:`end`,className:`p-1`,"aria-label":L,"data-testid":`open-in-agent-menu`,children:z}),t[36]=L,t[37]=z,t[38]=B):B=t[38];let V;return t[39]!==w||t[40]!==g||t[41]!==I||t[42]!==B?(V=(0,Z.jsxs)(fe,{open:g,onOpenChange:w,children:[I,B]}),t[39]=w,t[40]=g,t[41]=I,t[42]=B,t[43]=V):V=t[43],V}var GN=50,KN=()=>{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,PC.preload()},GN))},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,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Cg)},u=(0,Z.jsx)(Zl,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(Is,{children:[d,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function qN(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=Oa(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),p,m;t[0]===u?(p=t[1],m=t[2]):(p=()=>{!u||!f.current||(f.current.focus(),f.current.select())},m=[u],t[0]=u,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=o?.hasRemote===!0,g=n===null,_;t[3]!==a||t[4]!==c||t[5]!==h||t[6]!==n||t[7]!==r?(_=async function(){if(!c&&n!==null){l(!0),d(null);try{let e=await ca({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:Pa,toastSuccess:$N,toastError:QN,logEvent:ZN});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{hs.error(a({id:`u3YnKw`}))}l(!1)}},t[3]=a,t[4]=c,t[5]=h,t[6]=n,t[7]=r,t[8]=_):_=t[8];let v=_,y=u!==null,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||d(null)},t[9]=x):x=t[9];let C;t[10]!==a||t[11]!==n?.kind?(C=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[10]=a,t[11]=n?.kind,t[12]=C):C=t[12];let w=c||g,T,E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Ql,{className:`size-3.5`,"aria-hidden":!0}),E=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[13]=T,t[14]=E):(T=t[13],E=t[14]);let D;t[15]!==v||t[16]!==C||t[17]!==w?(D=(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`sm`,"aria-label":C,onClick:v,disabled:w,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[T,E]})}),t[15]=v,t[16]=C,t[17]=w,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[20]=k):k=t[20];let A=u??``,j;t[21]===a?j=t[22]:(j=a({id:`5-FeN2`}),t[21]=a,t[22]=j);let M;t[23]!==A||t[24]!==j?(M=(0,Z.jsxs)(b,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[O,k,(0,Z.jsx)(jo,{ref:f,readOnly:!0,value:A,onFocus:XN,onClick:YN,onContextMenu:JN,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":j})]}),t[23]=A,t[24]=j,t[25]=M):M=t[25];let N;return t[26]!==D||t[27]!==M||t[28]!==y?(N=(0,Z.jsxs)(fe,{open:y,onOpenChange:x,children:[D,M]}),t[26]=D,t[27]=M,t[28]=y,t[29]=N):N=t[29],N}function JN(e){return e.currentTarget.select()}function YN(e){return e.currentTarget.select()}function XN(e){return e.currentTarget.select()}function ZN(e){return console.log(e)}function QN(e){e!==`Link ready but could not copy to clipboard.`&&hs.error(e)}function $N(e){return hs.success(e)}function eP(e){let t=(0,$.c)(45),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=mt(),{state:p,isDraggingRail:m}=hA(),h=Sg(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=tc(`toggle-files-sidebar`),t[0]=g):g=t[0];let _=g,v=tc(`command-palette`),y=po(),[b,x]=(0,Q.useState)(!1),S;bb0:{if(f===null){let e;t[1]===y?e=t[2]:(e=t_({workspace:y}),t[1]=y,t[2]=e),S=e;break bb0}if(f.kind===`folder`){if(!y){S=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==y?(e=i_({folderRelativePath:f.folderPath,workspace:y}),t[3]=f.folderPath,t[4]=y,t[5]=e):e=t[5],S=e;break bb0}let e;t[6]!==d||t[7]!==y?(e=e_({docName:d,workspace:y}),t[6]=d,t[7]=y,t[8]=e):e=t[8],S=e}let C=c??S,w;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=fo(f.folderPath),t[9]=f.folderPath,t[10]=e),w=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=Da(d),t[11]=d,t[12]=e),w=e;break bb1}w=null}let E=w,D=typeof window<`u`&&window.okDesktop!=null,O=p===`collapsed`,k=D?``:void 0,A=D&&O&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,j=D&&!m&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,M;t[13]!==A||t[14]!==j?(M=oi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,D&&`[-webkit-app-region:drag]`,A,j),t[13]=A,t[14]=j,t[15]=M):M=t[15];let N=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(bA,{className:oi(`-ml-1 shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Ns,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:_}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:_}})})]}),O&&a&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:v}}),"data-telemetry-event":`ok.editor_header.search.click`,className:oi(`shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(T,{"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:v}})})]}),(0,Z.jsx)(ta,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(RN,{})]}),P;t[16]===N?P=t[17]:(P=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:N}),t[16]=N,t[17]=P);let F;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=oi(`flex shrink-0 items-center justify-end gap-2 px-3`,D&&`[&>*]:[-webkit-app-region:no-drag]`),t[18]=F):F=t[18];let I;t[19]!==C||t[20]!==l||t[21]!==o||t[22]!==b||t[23]!==x||t[24]!==E||t[25]!==h?(I=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(WN,{input:C,open:o,onOpenChange:l}),(0,Z.jsx)(qN,{input:E,onClickWhenNoRemote:()=>x(!0)}),(0,Z.jsx)(mo,{open:b,onOpenChange:x})]}),t[19]=C,t[20]=l,t[21]=o,t[22]=b,t[23]=x,t[24]=E,t[25]=h,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==n?(L=(0,Z.jsx)(Ua,{onSignIn:n,onSetIdentity:r}),t[27]=r,t[28]=n,t[29]=L):L=t[29];let R,z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(iM,{}),z=(0,Z.jsx)(ta,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),B=(0,Z.jsx)(qd,{}),t[30]=R,t[31]=z,t[32]=B):(R=t[30],z=t[31],B=t[32]);let V;t[33]===h?V=t[34]:(V=!h&&(0,Z.jsx)(KN,{}),t[33]=h,t[34]=V);let H;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(HN,{}),t[35]=H):H=t[35];let U;t[36]!==I||t[37]!==L||t[38]!==V?(U=(0,Z.jsxs)(`div`,{className:F,children:[I,L,R,z,B,V,H]}),t[36]=I,t[37]=L,t[38]=V,t[39]=U):U=t[39];let W;return t[40]!==P||t[41]!==U||t[42]!==k||t[43]!==M?(W=(0,Z.jsxs)(`header`,{"data-electron-drag":k,className:M,children:[P,U]}),t[40]=P,t[41]=U,t[42]=k,t[43]=M,t[44]=W):W=t[44],W}var tP=`open-knowledge:terminal-launch`;function nP(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(tP,{detail:{prompt:e}}))}function rP(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.prompt:void 0;typeof n==`string`&&e(n)};return t.addEventListener(tP,n),()=>t.removeEventListener(tP,n)}function iP(e){let t=(0,$.c)(63),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,{_:a}=i(),[o,s]=lv(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(Ey[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S=typeof window<`u`?window.okDesktop??null:null,[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),D=(0,Q.useRef)(0),O=ho(),{projectConfig:k,projectLocalConfig:A,projectLocalSynced:j,projectSynced:M}=ae(),N=po(),{activeDocName:P}=mt(),F=O?.hasRemote,I=O?.pushPermission?.checkStatus,L;t[2]!==g||t[3]!==k||t[4]!==A||t[5]!==j||t[6]!==M||t[7]!==F||t[8]!==I?(L=pv({autoSyncOnboardingDismissed:g,hasRemote:F,projectLocalSynced:j,projectSynced:M,projectLocalConfig:A,projectConfig:k,pushPermissionCheckStatus:I}),t[2]=g,t[3]=k,t[4]=A,t[5]=j,t[6]=M,t[7]=F,t[8]=I,t[9]=L):L=t[9];let R=L,z,B;t[10]===P?(z=t[11],B=t[12]):(z=()=>{let e=function(e){let t=e.detail;t&&P&&Oc(P,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(tv,e),()=>window.removeEventListener(tv,e)},B=[P],t[10]=P,t[11]=z,t[12]=B),(0,Q.useEffect)(z,B);let V,H;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?w(oP):e===`new-terminal`&&w(!0)})},H=[],t[13]=V,t[14]=H):(V=t[13],H=t[14]),(0,Q.useEffect)(V,H);let U,W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{if(window.okDesktop!=null)return;let e=function(e){nc(e,`toggle-terminal-panel`)&&(e.preventDefault(),w(aP))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},U=[],t[15]=U,t[16]=W):(U=t[15],W=t[16]),(0,Q.useEffect)(W,U);let G,K;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>rP(e=>{w(!0),D.current+=1,E({prompt:e,nonce:D.current})}),K=[],t[17]=G,t[18]=K):(G=t[17],K=t[18]),(0,Q.useEffect)(G,K);let q,J;t[19]===C?(q=t[20],J=t[21]):(q=()=>{C||E(null)},J=[C],t[19]=C,t[20]=q,t[21]=J),(0,Q.useEffect)(q,J);let ee,Y;t[22]===C?(ee=t[23],Y=t[24]):(ee=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:C})},Y=[C],t[22]=C,t[23]=ee,t[24]=Y),(0,Q.useEffect)(ee,Y);let te,ne;t[25]===C?(te=t[26],ne=t[27]):(te=()=>{window.okDesktop!=null&&C&&co()},ne=[C],t[25]=C,t[26]=te,t[27]=ne),(0,Q.useEffect)(te,ne),uv(O?.pausedReason);let X;t[28]===s?X=t[29]:(X=function(e){l(e),s(e)},t[28]=s,t[29]=X);let re=X,ie;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e){y(e),e||x(null)},t[30]=ie):ie=t[30];let oe=ie,se;t[31]!==a||t[32]!==P||t[33]!==N?(se={openSelection(e){let t=o_({docName:e.docName??P,workspace:N,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown});return t===null?(hs.error(a({id:`_VRtd7`})),!1):(x(t),y(!0),!0)}},t[31]=a,t[32]=P,t[33]=N,t[34]=se):se=t[34];let ce,le;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>{p(`auth`),d(!0)},le=()=>{p(`identity`),d(!0)},t[35]=ce,t[36]=le):(ce=t[35],le=t[36]);let ue;t[37]!==r||t[38]!==b||t[39]!==v?(ue=(0,Z.jsx)(eP,{onSignIn:ce,onSetIdentity:le,onOpenSearch:r,openInAgentMenuOpen:v,openInAgentMenuInput:b,onOpenInAgentMenuOpenChange:oe}),t[37]=r,t[38]=b,t[39]=v,t[40]=ue):ue=t[40];let de;t[41]!==m||t[42]!==c||t[43]!==re||t[44]!==T||t[45]!==C?(de=(0,Z.jsx)(Mj,{editorMode:c,onModeChange:re,activeTab:m,onActiveTabChange:h,terminalBridge:S,terminalVisible:C,onTerminalVisibleChange:w,terminalLaunch:T}),t[41]=m,t[42]=c,t[43]=re,t[44]=T,t[45]=C,t[46]=de):de=t[46];let fe;t[47]!==se||t[48]!==ue||t[49]!==de?(fe=(0,Z.jsxs)(Pc,{value:se,children:[ue,de]}),t[47]=se,t[48]=ue,t[49]=de,t[50]=fe):fe=t[50];let pe=f===`identity`,me;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(me=()=>{d(!1)},t[51]=me):me=t[51];let he;t[52]!==u||t[53]!==pe?(he=(0,Z.jsx)(ra,{open:u,onOpenChange:d,identityPrompt:pe,onSuccess:me}),t[52]=u,t[53]=pe,t[54]=he):he=t[54];let ge;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>_(!0),t[55]=ge):ge=t[55];let _e;t[56]===R?_e=t[57]:(_e=(0,Z.jsx)(dv,{open:R,onResolved:ge}),t[56]=R,t[57]=_e);let ve;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Z.jsx)(Q_,{}),t[58]=ve):ve=t[58];let ye;return t[59]!==fe||t[60]!==he||t[61]!==_e?(ye=(0,Z.jsxs)(Z.Fragment,{children:[fe,he,_e,ve]}),t[59]=fe,t[60]=he,t[61]=_e,t[62]=ye):ye=t[62],ye}function aP(e){return!e}function oP(e){return!e}function sP(e){let t=Vo(Ko(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function cP(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Pi();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)(Lo,{"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)(Lo,{"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(lP),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 lP(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>sP(e.file),children:[(0,Z.jsx)(Lo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var uP=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
30
30
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
31
31
  <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
32
32
  </symbol>