@inkeep/open-knowledge 0.15.1-beta.5 → 0.15.1-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +2 -2
- package/dist/cli.mjs +39 -39
- package/dist/constants-Bobe-usB.mjs +2 -0
- package/dist/dist-By70vg0t.mjs +1 -0
- package/dist/{dist-Bl_tym1Z.mjs → dist-CTSVLMDV.mjs} +9 -9
- package/dist/{gh-detect-DRHds4VZ.mjs → gh-detect-wbzQ2Z5B.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{init-BonJ-IAe.mjs → init-Cm5GW5mh.mjs} +4 -4
- package/dist/init-D-d4SGw0.mjs +1 -0
- package/dist/loader-DGNS5l_B.mjs +1 -0
- package/dist/{loader-CCpAbH3Q.mjs → loader-Dkfxwsah.mjs} +3 -3
- package/dist/{preview-CRiXRLbs.mjs → preview-B-cCcCju.mjs} +2 -2
- package/dist/preview-tihHY5hY.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-CcoGE_xm.js → ActivityModeContent-DYW6IyGe.js} +1 -1
- package/dist/public/assets/{DocumentContext-BYFYD2OR.js → DocumentContext-FDflxKx1.js} +1 -1
- package/dist/public/assets/{GraphPanel-B-5AaMRg.js → GraphPanel-BgmjHl8X.js} +1 -1
- package/dist/public/assets/{OpenInAgentMenuRequestContext-Df4A0AvJ.js → OpenInAgentMenuRequestContext-DbnEO7GU.js} +1 -1
- package/dist/public/assets/SettingsDialogBody-Cw9UBlHN.js +7 -0
- package/dist/public/assets/{SourceEditor-DLdOP88L.js → SourceEditor-Dt3ubo6_.js} +1 -1
- package/dist/public/assets/{TerminalPanel-yOVM28DS.js → TerminalPanel-Cs1MTR-8.js} +1 -1
- package/dist/public/assets/{config-validation-events-CRgM6DHS.js → config-validation-events-fxmQuSvc.js} +1 -1
- package/dist/public/assets/{dist-CVCWWNPG.js → dist-BRazL6Zi.js} +48 -48
- package/dist/public/assets/{index-D4QEBjBo.js → index-DnhI2qSt.js} +4 -4
- package/dist/public/assets/{keyboard-shortcuts-Bg9IdvnR.js → keyboard-shortcuts-73a1LeH2.js} +1 -1
- package/dist/public/assets/{prop-types-BSgyUl9p.js → prop-types-C2NMu-PZ.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-BMIQLSDV.js → target-navigation-intent-xCp4fypZ.js} +1 -1
- package/dist/public/index.html +8 -8
- package/dist/{repair-launch-json-Dmuu1LHk.mjs → repair-launch-json-CV5266VW.mjs} +2 -2
- package/dist/{repair-mcp-configs-CrcMR9JY.mjs → repair-mcp-configs-CHXzSTzV.mjs} +2 -2
- package/dist/repair-skills-BQnVB088.mjs +1 -0
- package/dist/{repair-skills-GcwKI4g2.mjs → repair-skills-M719vrZS.mjs} +2 -2
- package/dist/{server-lock-BpjJj3OD-CrZDl-wH.mjs → server-lock-BpjJj3OD-DlYx_Xz-.mjs} +26 -26
- package/dist/server-lock-CyhBidkz-DUTkjNDG.mjs +1 -0
- package/dist/{src-DohMomTr.mjs → src-DKbIfvR1.mjs} +2 -2
- package/dist/start-BPtlwTTP.mjs +1 -0
- package/dist/{start-DdlZT4lz.mjs → start-CY65wpTR.mjs} +2 -2
- package/dist/{write-project-skill-DyOqNMyv.mjs → write-project-skill-CD8uXqFq.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-CIS7nw8e.mjs +0 -2
- package/dist/dist-CPY1U8Js.mjs +0 -1
- package/dist/init-oJSTuUt2.mjs +0 -1
- package/dist/loader-C8rIR1tC.mjs +0 -1
- package/dist/preview-BPQHyFKc.mjs +0 -1
- package/dist/public/assets/SettingsDialogBody-BZCF6qQz.js +0 -7
- package/dist/repair-skills-B4UCaBBt.mjs +0 -1
- package/dist/server-lock-CyhBidkz-DXuuHDkK.mjs +0 -1
- package/dist/start-CmxWLg0Y.mjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DoqF2oxU.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CbLDdnQA.js","./propagation-api-CuTE-jIt.js","./ConsentDialogBody-B1OWvzyk.js","./compiler-runtime-Cs91PcD2.js","./checkbox-xiDPPQX2.js","./dist-FC83wUOI.js","./button-CNAPefQE.js","./dialog-DAnNTn2Z.js","./dist-QyEeuecv.js","./collapsible-T5wuIIwr.js","./textarea-BuWgZ9oe.js","./tooltip-DhvUSgK7.js","./dist-DANsqx2U.js","./project-paths-BocrcwYE.js","./McpConsentDialogBody-CtLqSrfK.js","./mcp-consent-store-DWTjYi5_.js","./ActivityPanelDiffView-InYkbArk.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-
|
|
2
|
-
import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{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 Y,P as ee,Pn as te,Pt as ne,Q as re,Qn as ie,Qt as ae,R as oe,Rn as se,Rt as ce,S as le,Sn as ue,St as de,T as fe,Tn as pe,Tt as me,Un as he,Ut as ge,Vn as _e,Vt as ve,W as ye,Wn as be,Wt as xe,X as Se,Xn as Ce,Xt as we,Y as Te,Yn as Ee,Yt as De,Z as Oe,Zn as ke,Zt as Ae,_n as je,_t as Me,a as Ne,an as Pe,ar as Fe,at as Ie,bn as Le,c as Re,ct as ze,d as Be,dr as Ve,dt as He,en as Ue,et as We,f as Ge,fr as Ke,ft as qe,g as Je,gt as Ye,h as Xe,ht as Ze,i as Qe,ir as $e,it as et,j as tt,jn as nt,jt as rt,k as it,kn as at,kt as ot,l as st,lr as ct,lt,m as ut,mr as dt,mt as ft,n as pt,nn as mt,nt as ht,o as gt,ot as _t,p as vt,pr as yt,pt as bt,q as xt,qn as St,qt as Ct,r as wt,rn as Tt,rr as Et,rt as Dt,s as Ot,sr as kt,st as At,t as jt,tn as Mt,tr 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-BYFYD2OR.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-B_EgE6h3.js";import{$n as On,A as kn,An,At as jn,B as Mn,Br as Nn,C as Pn,Dn as Fn,Dt as In,F as Ln,Fr as Rn,Ft as zn,Gn as Bn,Gt as Vn,Hr as Hn,Jt as Un,Kt as Wn,Lt as Gn,M as Kn,Mr as qn,N as Jn,Nn as Yn,Nr as Xn,Nt as Zn,O as Qn,Or as $n,Pt as er,Qt as tr,St as nr,Un as rr,Ur as ir,Wr as ar,Wt as or,X as sr,Xn as cr,Xt as lr,Yt as ur,Zt as dr,an as fr,ar as pr,at as mr,b as hr,br as gr,c as _r,ci as vr,cn as yr,dn as br,dr as xr,er as Sr,fn as Cr,gn as wr,i as Tr,in as Er,ir as Dr,j as Or,jn as kr,kr as Ar,ln as jr,lr as Mr,mn as Nr,mr as Pr,mt as Fr,n as Ir,nn as Lr,or as Rr,pr as zr,pt as Br,qt as Vr,rn as Hr,rr as Ur,si as Wr,sr as Gr,t as Kr,ti as qr,tn as Jr,un as Yr,ut as Xr,vn as Zr,w as Qr,xt as $r,yr as ei,z as ti,zt as ni}from"./dist-CVCWWNPG.js";import{c as ri,d as ii,l as ai,r as oi,t as si,u as ci}from"./button-CNAPefQE.js";import{a as li,c as ui,d as di,f as fi,i as pi,l as mi,m as hi,n as gi,o as _i,p as vi,r as yi,s as bi,t as xi,u as Si}from"./agent-presence-CarzuseD.js";import{$ as Ci,$t as wi,A as Ti,At as Ei,B as Di,Bt as Oi,C as ki,Ct as Ai,D as ji,Dt as Mi,E as Ni,Et as Pi,F as Fi,Ft as Ii,G as Li,Gt as Ri,H as zi,Ht as Bi,I as Vi,It as Hi,J as Ui,Jt as Wi,K as Gi,Kt as Ki,L as qi,Lt as Ji,M as Yi,Mt as Xi,N as Zi,Nt as Qi,O as $i,Ot as ea,P as ta,Pt as na,Q as ra,Qt as ia,R as aa,Rt as oa,S as sa,St as ca,T as la,Tt as ua,U as da,Ut as fa,V as pa,Vt as ma,W as ha,Wt as ga,X as _a,Xt as va,Y as ya,Yt as ba,Z as xa,Zt as Sa,_t as Ca,an as wa,at as Ta,b as Ea,bt as Da,ct as Oa,dt as ka,en as Aa,et as ja,gt as Ma,ht as Na,in as Pa,it as Fa,j as Ia,jt as La,k as Ra,kt as za,lt as Ba,m as Va,mt as Ha,nt as Ua,o as Wa,on as Ga,ot as Ka,p as qa,pt as Ja,q as Ya,qt as Xa,r as Za,rn as Qa,rt as $a,st as eo,t as to,tn as no,tt as ro,u as io,ut as ao,vt as oo,w as so,wt as co,x as lo,xt as uo,y as fo,yt as po,z as mo,zt as ho}from"./config-validation-events-CRgM6DHS.js";import{i as go,n as _o,r as vo,t as yo}from"./toggle-group-DsOyo0jm.js";import{a as bo,c as xo,i as So,n as Co,o as wo,s as To,t as Eo,v as Do}from"./dialog-DAnNTn2Z.js";import{a as Oo,i as ko,n as Ao,o as jo,r as Mo,t as No}from"./collapsible-T5wuIIwr.js";import{A as Po,B as Fo,C as Io,D as Lo,E as Ro,F as zo,I as Bo,L as Vo,M as Ho,N as Uo,O as Wo,P as Go,R as Ko,S as qo,T as Jo,V as Yo,_ as Xo,a as Zo,c as Qo,g as $o,i as es,j as ts,k as ns,l as rs,m as is,n as as,o as os,s as ss,v as cs,w as ls,x as us,z as ds}from"./prop-types-BSgyUl9p.js";import{t as fs}from"./trash-2-C957VvQL.js";import{n as X,r as ps,t as ms}from"./dist-QyEeuecv.js";import{d as hs,f as gs,i as _s,l as vs,s as ys}from"./dist-FC83wUOI.js";import{_ as bs,d as xs,f as Ss,g as Cs,h as ws,i as Ts,m as Es,n as Ds,p as Os,r as ks,t as As,u as js,v as Ms,y as Ns}from"./tooltip-DhvUSgK7.js";import{n as Ps,t as Fs}from"./checkbox-xiDPPQX2.js";import{n as Is,r as Ls,t as Rs}from"./textarea-BuWgZ9oe.js";import{a as zs,i as Bs,n as Vs,r as Hs}from"./project-paths-BocrcwYE.js";import{n as Us,t as Ws}from"./mcp-consent-store-DWTjYi5_.js";import{c as Gs,i as Ks,l as qs,o as Js}from"./keyboard-shortcuts-Bg9IdvnR.js";import{$ as Ys,At as Xs,Ct as Zs,Dt as Qs,Ft as $s,I as ec,It as tc,J as nc,Mt as rc,Ot as ic,Pt as ac,Q as oc,Tt as sc,X as cc,Z as lc,at as uc,bt as dc,jt as fc,k as pc,w as mc}from"./dist--WFXzgaP.js";import{n as hc}from"./dist-0kDsAKH1.js";import{c as gc,d as _c,f as vc,h as yc,i as bc,l as xc,o as Sc,r as Cc,s as wc,t as Tc,u as Ec}from"./OpenInAgentMenuRequestContext-Df4A0AvJ.js";import{t as Dc}from"./target-navigation-intent-BMIQLSDV.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 Oc(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.15.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DoqF2oxU.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function kc(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?jc:Ac,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:Ac(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 Ac(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 jc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Mc=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||Nc(),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 Nc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Pc=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 Mc({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=Fc(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=Fc(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=Fc(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=Fc(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 Fc(e){return e.options.scope?.id}var Ic=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()})})}},Lc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ic,this.#t=e.mutationCache||new Pc,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=kc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rn).catch(rn)}ensureInfiniteQueryData(e){return e.behavior=kc(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()}},Rc=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}}}})),zc=t(((e,t)=>{t.exports=Rc()})),Bc=t((e=>{var t=zc(),n=r(),i=ii();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 Y(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ee,te;function ne(e){if(ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ee=t&&t[1]||``,te=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DoqF2oxU.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CbLDdnQA.js","./propagation-api-CuTE-jIt.js","./ConsentDialogBody-B1OWvzyk.js","./compiler-runtime-Cs91PcD2.js","./checkbox-xiDPPQX2.js","./dist-FC83wUOI.js","./button-CNAPefQE.js","./dialog-DAnNTn2Z.js","./dist-QyEeuecv.js","./collapsible-T5wuIIwr.js","./textarea-BuWgZ9oe.js","./tooltip-DhvUSgK7.js","./dist-DANsqx2U.js","./project-paths-BocrcwYE.js","./McpConsentDialogBody-CtLqSrfK.js","./mcp-consent-store-DWTjYi5_.js","./ActivityPanelDiffView-InYkbArk.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-BgmjHl8X.js","./dist-BRazL6Zi.js","./w3c-keyname-CIO0QKme.js","./prop-types-C2NMu-PZ.js","./toggle-group-DsOyo0jm.js","./panel-B_EgE6h3.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-xCp4fypZ.js","./ActivityModeContent-DYW6IyGe.js","./DocumentContext-FDflxKx1.js","./dist-B5LD73X3.js","./dist--WFXzgaP.js","./dist-rGiGXpRA.js","./dist-DZpmpDA6.js","./dist-De7_06z9.js","./dist-3YNajely.js","./dist-ChSeukn9.js","./dist-0kDsAKH1.js","./dist-C7u3xI_X.js","./stex-CKKDmQmi.js","./trash-2-C957VvQL.js","./DocumentContext-B0sQn39F.css","./agent-presence-CarzuseD.js","./dist-CLIXxF0N.js","./dist-D2xbbdaz2.js","./SettingsDialogBody-Cw9UBlHN.js","./config-validation-events-fxmQuSvc.js","./keyboard-shortcuts-73a1LeH2.js","./SourceEditor-Dt3ubo6_.js","./OpenInAgentMenuRequestContext-DbnEO7GU.js","./TerminalPanel-Cs1MTR-8.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 Y,P as ee,Pn as te,Pt as ne,Q as re,Qn as ie,Qt as ae,R as oe,Rn as se,Rt as ce,S as le,Sn as ue,St as de,T as fe,Tn as pe,Tt as me,Un as he,Ut as ge,Vn as _e,Vt as ve,W as ye,Wn as be,Wt as xe,X as Se,Xn as Ce,Xt as we,Y as Te,Yn as Ee,Yt as De,Z as Oe,Zn as ke,Zt as Ae,_n as je,_t as Me,a as Ne,an as Pe,ar as Fe,at as Ie,bn as Le,c as Re,ct as ze,d as Be,dr as Ve,dt as He,en as Ue,et as We,f as Ge,fr as Ke,ft as qe,g as Je,gt as Ye,h as Xe,ht as Ze,i as Qe,ir as $e,it as et,j as tt,jn as nt,jt as rt,k as it,kn as at,kt as ot,l as st,lr as ct,lt,m as ut,mr as dt,mt as ft,n as pt,nn as mt,nt as ht,o as gt,ot as _t,p as vt,pr as yt,pt as bt,q as xt,qn as St,qt as Ct,r as wt,rn as Tt,rr as Et,rt as Dt,s as Ot,sr as kt,st as At,t as jt,tn as Mt,tr 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-FDflxKx1.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-B_EgE6h3.js";import{$n as On,A as kn,An,At as jn,B as Mn,Br as Nn,C as Pn,Dn as Fn,Dt as In,F as Ln,Fr as Rn,Ft as zn,Gn as Bn,Gt as Vn,Hr as Hn,Jt as Un,Kt as Wn,Lt as Gn,M as Kn,Mr as qn,N as Jn,Nn as Yn,Nr as Xn,Nt as Zn,O as Qn,Or as $n,Pt as er,Qt as tr,St as nr,Un as rr,Ur as ir,Wr as ar,Wt as or,X as sr,Xn as cr,Xt as lr,Yt as ur,Zt as dr,an as fr,ar as pr,at as mr,b as hr,br as gr,c as _r,ci as vr,cn as yr,dn as br,dr as xr,er as Sr,fn as Cr,gn as wr,i as Tr,in as Er,ir as Dr,j as Or,jn as kr,kr as Ar,ln as jr,lr as Mr,mn as Nr,mr as Pr,mt as Fr,n as Ir,nn as Lr,or as Rr,pr as zr,pt as Br,qt as Vr,rn as Hr,rr as Ur,si as Wr,sr as Gr,t as Kr,ti as qr,tn as Jr,un as Yr,ut as Xr,vn as Zr,w as Qr,xt as $r,yr as ei,z as ti,zt as ni}from"./dist-BRazL6Zi.js";import{c as ri,d as ii,l as ai,r as oi,t as si,u as ci}from"./button-CNAPefQE.js";import{a as li,c as ui,d as di,f as fi,i as pi,l as mi,m as hi,n as gi,o as _i,p as vi,r as yi,s as bi,t as xi,u as Si}from"./agent-presence-CarzuseD.js";import{$ as Ci,$t as wi,A as Ti,At as Ei,B as Di,Bt as Oi,C as ki,Ct as Ai,D as ji,Dt as Mi,E as Ni,Et as Pi,F as Fi,Ft as Ii,G as Li,Gt as Ri,H as zi,Ht as Bi,I as Vi,It as Hi,J as Ui,Jt as Wi,K as Gi,Kt as Ki,L as qi,Lt as Ji,M as Yi,Mt as Xi,N as Zi,Nt as Qi,O as $i,Ot as ea,P as ta,Pt as na,Q as ra,Qt as ia,R as aa,Rt as oa,S as sa,St as ca,T as la,Tt as ua,U as da,Ut as fa,V as pa,Vt as ma,W as ha,Wt as ga,X as _a,Xt as va,Y as ya,Yt as ba,Z as xa,Zt as Sa,_t as Ca,an as wa,at as Ta,b as Ea,bt as Da,ct as Oa,dt as ka,en as Aa,et as ja,gt as Ma,ht as Na,in as Pa,it as Fa,j as Ia,jt as La,k as Ra,kt as za,lt as Ba,m as Va,mt as Ha,nt as Ua,o as Wa,on as Ga,ot as Ka,p as qa,pt as Ja,q as Ya,qt as Xa,r as Za,rn as Qa,rt as $a,st as eo,t as to,tn as no,tt as ro,u as io,ut as ao,vt as oo,w as so,wt as co,x as lo,xt as uo,y as fo,yt as po,z as mo,zt as ho}from"./config-validation-events-fxmQuSvc.js";import{i as go,n as _o,r as vo,t as yo}from"./toggle-group-DsOyo0jm.js";import{a as bo,c as xo,i as So,n as Co,o as wo,s as To,t as Eo,v as Do}from"./dialog-DAnNTn2Z.js";import{a as Oo,i as ko,n as Ao,o as jo,r as Mo,t as No}from"./collapsible-T5wuIIwr.js";import{A as Po,B as Fo,C as Io,D as Lo,E as Ro,F as zo,I as Bo,L as Vo,M as Ho,N as Uo,O as Wo,P as Go,R as Ko,S as qo,T as Jo,V as Yo,_ as Xo,a as Zo,c as Qo,g as $o,i as es,j as ts,k as ns,l as rs,m as is,n as as,o as os,s as ss,v as cs,w as ls,x as us,z as ds}from"./prop-types-C2NMu-PZ.js";import{t as fs}from"./trash-2-C957VvQL.js";import{n as X,r as ps,t as ms}from"./dist-QyEeuecv.js";import{d as hs,f as gs,i as _s,l as vs,s as ys}from"./dist-FC83wUOI.js";import{_ as bs,d as xs,f as Ss,g as Cs,h as ws,i as Ts,m as Es,n as Ds,p as Os,r as ks,t as As,u as js,v as Ms,y as Ns}from"./tooltip-DhvUSgK7.js";import{n as Ps,t as Fs}from"./checkbox-xiDPPQX2.js";import{n as Is,r as Ls,t as Rs}from"./textarea-BuWgZ9oe.js";import{a as zs,i as Bs,n as Vs,r as Hs}from"./project-paths-BocrcwYE.js";import{n as Us,t as Ws}from"./mcp-consent-store-DWTjYi5_.js";import{c as Gs,i as Ks,l as qs,o as Js}from"./keyboard-shortcuts-73a1LeH2.js";import{$ as Ys,At as Xs,Ct as Zs,Dt as Qs,Ft as $s,I as ec,It as tc,J as nc,Mt as rc,Ot as ic,Pt as ac,Q as oc,Tt as sc,X as cc,Z as lc,at as uc,bt as dc,jt as fc,k as pc,w as mc}from"./dist--WFXzgaP.js";import{n as hc}from"./dist-0kDsAKH1.js";import{c as gc,d as _c,f as vc,h as yc,i as bc,l as xc,o as Sc,r as Cc,s as wc,t as Tc,u as Ec}from"./OpenInAgentMenuRequestContext-DbnEO7GU.js";import{t as Dc}from"./target-navigation-intent-xCp4fypZ.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 Oc(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.15.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DoqF2oxU.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function kc(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?jc:Ac,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:Ac(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 Ac(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 jc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Mc=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||Nc(),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 Nc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Pc=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 Mc({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=Fc(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=Fc(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=Fc(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=Fc(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 Fc(e){return e.options.scope?.id}var Ic=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()})})}},Lc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ic,this.#t=e.mutationCache||new Pc,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=kc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rn).catch(rn)}ensureInfiniteQueryData(e){return e.behavior=kc(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()}},Rc=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}}}})),zc=t(((e,t)=>{t.exports=Rc()})),Bc=t((e=>{var t=zc(),n=r(),i=ii();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 Y(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ee,te;function ne(e){if(ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ee=t&&t[1]||``,te=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+ee+e+te}var re=!1;function ie(e,t){if(!e||re)return``;re=!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 mv(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;fv(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?pv(e,o.headerOptions):void 0)}}))}else{let s=fv(e,t,n,r,i,a,o);return s?pv(s,o?.headerOptions):void 0}}function hv(e,t,n,r,i,a){return mv(e,e,t,n,r,i,a)}function gv(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 _v(e,t){return`${e}\u0000${t}`}function vv(e,t,n){let r=Rr(e).body,i=Rr(t).body;return r===i?``:hv(n,r,i,``,``,{context:3})}function yv(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=pt(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=_v(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=vv(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 bv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-InYkbArk.js`),__vite__mapDeps([19,1,6,20]),import.meta.url)).ActivityPanelDiffView})),xv=1e4,Sv=6e4;async function Cv(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 wv(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Ko._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Ko._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Ko._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Ko._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Ko._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function Tv(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Ev(e){return e.slice(0,7)}function Dv(e){return e.type===`upstream`?Ko._({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`?Ko._({id:`B2DrPb`}):e.author}function Ov(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)(di,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(_i,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(li,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(mi,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Si,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(bi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(vi,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function kv(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)(Ce,{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=Zr(i),t[1]=i,t[2]=a);let o=a,s=r?Ir[o]??Kr[o]:Kr[o],c;t[3]!==s||t[4]!==i?(c=s??Wn(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)(Ov,{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)(hl,{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)(Hc,{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)(iu,{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)(vi,{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)(Hc,{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)(iu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Av(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function jv(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(Nv),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(Mv)},children:[r?(0,Z.jsx)(It,{className:`size-3`}):(0,Z.jsx)(jo,{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 Mv(e){return!e}function Nv(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 Pv(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=yv(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)(Yt,{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)(Yt,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(bv,{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 Fv(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=wv(n.timestamp),t[0]=n.timestamp,t[1]=p);let m=p,h;t[2]===n?h=t[3]:(h=Dv(n),t[2]=n,t[3]=h);let g=h,_;t[4]===n.timestamp?_=t[5]:(_=Tv(n.timestamp),t[4]=n.timestamp,t[5]=_);let v=_,y;t[6]===n.sha?y=t[7]:(y=Ev(n.sha),t[6]=n.sha,t[7]=y);let b=y,x=n.contributors.flatMap(Iv),S;t[8]===n?S=t[9]:(S=Av(n),t[8]=n,t[9]=S);let C=S,[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(null),k=(0,Q.useId)(),A,j;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>()=>O.current?.abort(),j=[],t[10]=A,t[11]=j):(A=t[10],j=t[11]),(0,Q.useEffect)(A,j);let M;t[12]!==n.sha||t[13]!==u?(M=()=>u(n.sha),t[12]=n.sha,t[13]=u,t[14]=M):M=t[14];let N=M,P;t[15]===T?P=t[16]:(P=function(){O.current?.abort(),O.current=null,D(!1),T(!1)},t[15]=T,t[16]=P);let F=P,I;t[17]!==f||t[18]!==c||t[19]!==n.sha||t[20]!==d||t[21]!==T?(I=async function(){D(!0);let e=new AbortController;O.current=e;let t=function(){e.signal.aborted||D(!1),O.current===e&&(O.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName: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}),X.error(f({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)T(!1),d();else{let e=`HTTP ${r.status}`;try{let t=mr.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}),X.error(f({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=f,t[18]=c,t[19]=n.sha,t[20]=d,t[21]=T,t[22]=I):I=t[22];let L=I,R;t[23]!==n||t[24]!==r?(R=(0,Z.jsx)(kv,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=R):R=t[25];let z=R,B=l?k:void 0,V=l?`bg-muted`:`hover:bg-muted/80`,H;t[26]===V?H=t[27]:(H=[`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`,V],t[26]=V,t[27]=H);let U=H.join(` `),W;t[28]===N?W=t[29]:(W=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),N())},t[28]=N,t[29]=W);let G;t[30]===z?G=t[31]:(G=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:z}),t[30]=z,t[31]=G);let K;t[32]===g?K=t[33]:(K=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:g}),t[32]=g,t[33]=K);let q;t[34]!==n.timestamp||t[35]!==m?(q=(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]=q):q=t[36];let J;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=J):J=t[37];let Y;t[38]===f?Y=t[39]:(Y=f({id:`Yea-K5`}),t[38]=f,t[39]=Y);let ee;t[40]===T?ee=t[41]:(ee=e=>{e.stopPropagation(),T(!0)},t[40]=T,t[41]=ee);let te;t[42]===E?te=t[43]:(te=E?(0,Z.jsx)(Yt,{className:`size-3 animate-spin`}):(0,Z.jsx)(fi,{className:`size-3`}),t[42]=E,t[43]=te);let ne;t[44]!==E||t[45]!==Y||t[46]!==ee||t[47]!==te?(ne=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":Y,disabled:E,onClick:ee,children:te})}),t[44]=E,t[45]=Y,t[46]=ee,t[47]=te,t[48]=ne):ne=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)(Ds,{side:`top`,children:re}),t[51]=re,t[52]=ie);let ae;t[53]!==ne||t[54]!==ie?(ae=(0,Z.jsxs)(As,{children:[ne,ie]}),t[53]=ne,t[54]=ie,t[55]=ae):ae=t[55];let oe;t[56]!==K||t[57]!==q||t[58]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[K,q,J,ae]}),t[56]=K,t[57]=q,t[58]=ae,t[59]=oe):oe=t[59];let se;t[60]===C?se=t[61]:(se=C.length>0&&(0,Z.jsx)(jv,{summaries:C}),t[60]=C,t[61]=se);let ce=x.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:x.join(`, `),children:x.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]!==N||t[68]!==B||t[69]!==U||t[70]!==W||t[71]!==G||t[72]!==le?(ue=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":l,"aria-controls":B,"data-testid":`timeline-entry-expand`,className:U,onClick:N,onKeyDown:W,children:[G,le]}),t[66]=l,t[67]=N,t[68]=B,t[69]=U,t[70]=W,t[71]=G,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==o||t[75]!==a||t[76]!==k||t[77]!==c||t[78]!==n.sha||t[79]!==l?(de=l&&(0,Z.jsx)(Pv,{sha:n.sha,docName:c,cache:o,diffLayout:a,panelId:k}),t[74]=o,t[75]=a,t[76]=k,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]!==F||t[85]!==T?(pe=e=>{e?T(!0):F()},t[84]=F,t[85]=T,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)(xo,{children:me}),t[89]=me,t[90]=he);let ge;t[91]!==v||t[92]!==g||t[93]!==b||t[94]!==m?(ge={relative:m,absoluteTime:v,entrySha:b,authorName:g},t[91]=v,t[92]=g,t[93]=b,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)(bo,{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)(To,{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]===F?xe=t[104]:(xe=(0,Z.jsx)(si,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:F,children:be}),t[103]=F,t[104]=xe);let Se;t[105]===L?Se=t[106]:(Se=()=>L(),t[105]=L,t[106]=Se);let Ce;t[107]===E?Ce=t[108]:(Ce=E?(0,Z.jsx)(Yt,{className:`mr-2 size-4 animate-spin`}):null,t[107]=E,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]!==E||t[111]!==Se||t[112]!==Ce?(Te=(0,Z.jsxs)(si,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:E,onClick:Se,children:[Ce,we]}),t[110]=E,t[111]=Se,t[112]=Ce,t[113]=Te):Te=t[113];let Ee;t[114]!==xe||t[115]!==Te?(Ee=(0,Z.jsxs)(wo,{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)(So,{children:[ye,Ee]}),t[117]=ye,t[118]=Ee,t[119]=De):De=t[119];let Oe;t[120]!==w||t[121]!==pe||t[122]!==De?(Oe=(0,Z.jsx)(Eo,{open:w,onOpenChange:pe,children:De}),t[120]=w,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 Iv(e){return e.docs}function Lv(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:a}=e,{_:o}=i(),{resolvedTheme:c}=vr(),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)(Vv),[v,y]=(0,Q.useState)(Bv),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=U_({baseMs:xv,maxBackoffMs:Sv,isPaused:zv,poll:e=>Cv(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)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsxs)(yo,{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)(_o,{value:`unified`,"aria-label":o({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(zl,{className:`size-3.5`})}),(0,Z.jsx)(_o,{value:`split`,"aria-label":o({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(el,{className:`size-3.5`})})]})}),(0,Z.jsx)(Ds,{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(Rv)}),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)(Fv,{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 Rv(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 zv(){return typeof document<`u`&&document.visibilityState===`hidden`}function Bv(){return new Set}function Vv(){return new pi(32)}var Hv=[{id:`outline`,icon:Cl},{id:`links`,icon:he},{id:`graph`,icon:El},{id:`timeline`,icon:$c}];function Uv(e){return e===`outline`?Ko._({id:`dD7NPy`}):e===`links`?Ko._({id:`Rj01Fz`}):e===`graph`?Ko._({id:`x2fr_j`}):Ko._({id:`cklVjM`})}function Wv(){return n(()=>import(`./GraphPanel-B-5AaMRg.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 Gv=(0,Q.lazy)(async()=>({default:(await Wv()).GraphPanel})),Kv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CcoGE_xm.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,50]),import.meta.url)).ActivityModeContent}));function qv(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=Bh(),p,m,h;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==o||t[4]!==f){let e=f?Hv.filter(Yv):Hv;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)(yo,{type:`single`,variant:`outline`,value:p,onValueChange:e=>{e&&o(e)},"aria-label":l({id:`SrOuyg`}),children:e.map(Jv)})}):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)(vc,{docName:n,isSourceMode:r}),p===`links`&&(0,Z.jsx)(H_,{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)(Gv,{activeDocName:n})}),p===`timeline`&&(0,Z.jsx)(Lv,{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)(Kv,{})})}),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 Jv(e){let{id:t,icon:n}=e,r=Uv(t);return(0,Z.jsxs)(As,{children:[(0,Z.jsx)(_o,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(Ts,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Ds,{side:`bottom`,children:r})]},t)}function Yv(e){return e.id===`outline`}function Xv(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Zv(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Qv(e){return e/100*window.innerHeight}function $v(e){return e/100*window.innerWidth}function ey(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 ty({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=ey(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Zv(t,i);break;case`em`:r=Xv(t,i);break;case`vh`:r=Qv(i);break;case`vw`:r=$v(i);break}return r}function ny(e){return parseFloat(e.toFixed(3))}function ry({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 iy(e){let{panels:t}=e,n=ry({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=ny(ty({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=ny(ty({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=ny(ty({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=ny(ty({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 ay(e,t=`Assertion error`){if(!e)throw Error(t)}function oy(e,t){return Array.from(t).sort(e===`horizontal`?sy:cy)}function sy(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function cy(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function ly(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function uy(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 dy({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}=uy(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return ay(i,`No rect found`),i}var fy;function py(){return fy===void 0&&(fy=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),fy}function my(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=oy(n,Array.from(t.children).filter(ly).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,dy({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=py()?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:ry({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 hy=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)}}},gy=new Map,_y=new hy;function vy(e){gy=new Map(gy),gy.delete(e)}function yy(e,t){for(let[t]of gy)if(t.id===e)return t}function by(e,t){for(let[t,n]of gy)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function xy(){return gy}function Sy(e,t){return _y.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Cy(e,t){let n=gy.get(e);gy=new Map(gy),gy.set(e,t),_y.emit(`groupChange`,{group:e,prev:n,next:t})}function wy(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=uy(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 Ty(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ey(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:My(e),b:My(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();ay(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:jy(Ay(n.a)),b:jy(Ay(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 Dy=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Oy(e){let t=getComputedStyle(Ny(e)??e).display;return t===`flex`||t===`inline-flex`}function ky(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Oy(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`||Dy.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Ay(e){let t=e.length;for(;t--;){let n=e[t];if(ay(n,`Missing node`),ky(n))return n}return null}function jy(e){return e&&Number(getComputedStyle(e).zIndex)||0}function My(e){let t=[];for(;e;)t.push(e),e=Ny(e);return t}function Ny(e){let{parentNode:t}=e;return Ty(t)?t.host:t}function Py(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 Fy({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!ly(n)||n.contains(e)||e.contains(n))return!0;if(Ey(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Py(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Iy(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=my(r),a=wy(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Fy({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Ly(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 Ry(e,t,n=0){return Math.abs(ny(e)-ny(t))<=n}function zy(e,t){return Ry(e,t)?0:e>t?1:-1}function By({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(zy(r,c)<0)if(a){let e=(i+c)/2;r=zy(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=ny(r),r}function Vy({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ry(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;ay(u!=null,`Invalid first pivot index`),ay(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];ay(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(ay(n!=null,`Previous layout not found for panel index ${t}`),Ry(n,i)){let t=o-n;zy(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];ay(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(ay(n!=null,`Previous layout not found for panel index ${t}`),Ry(n,o)){let t=n-i;zy(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];ay(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&zy(i,c)<0)if(e>0){let t=c-o,n=t/2;zy(i+e,c)<0&&(e=zy(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;zy(i-e,c)<0&&(e=zy(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];ay(e!=null,`Previous layout not found for panel index ${r}`);let a=By({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];ay(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=By({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Ry(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(Ly(c,l))return i;{let t=e<0?d:u,r=s[t];ay(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=By({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Ry(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];ay(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=By({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Ry(i,s)||(t-=s-i,l[r]=s),Ry(t,0))break;e>0?r--:r++}}}if(!Ry(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 Hy(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||zy(e[n],t[n])!==0)return!1;return!0}function Uy({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(!Ry(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];ay(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];ay(i!=null,`No layout data found for index ${e}`);let o=r[e];ay(o!=null,`No layout data found for index ${e}`);let s=By({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Ry(a,0))for(let e=0;e<t.length;e++){let n=r[e];ay(n!=null,`No layout data found for index ${e}`);let i=n+a,o=By({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Ry(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Wy({groupId:e,panelId:t}){let n=()=>{let t=xy();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=Uy({layout:Vy({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});Hy(l,p)||Cy(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&&Ry(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=ry({group:t});o(ny(ty({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Gy(e){e.defaultPrevented||Iy(e,xy()).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=Wy({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Ky(e){let t=xy();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 qy({groupId:e}){let t=()=>{let t=xy();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=Uy({layout:e,panelConstraints:r});return n?o:(Hy(o,c)||Cy(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Jy(e,t){let n=Ky(e),r=by(n.id,!0),i=n.separators.find(t=>t.element===e);ay(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);ay(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=qy({groupId:n.id}).getLayout(),c=Uy({layout:Vy({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Hy(s,c)||Cy(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Yy(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Ky(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Jy(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Jy(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Jy(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Jy(t,-5);break;case`End`:e.preventDefault(),Jy(t,100);break;case`Enter`:{e.preventDefault();let n=Ky(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=by(n.id,!0),o=n.separators.find(e=>e.element===t);ay(o,`Matching separator not found`);let s=a.get(o);ay(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(ay(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Jy(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Ky(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);ay(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(),Jy(t,-100);break}}var Xy={cursorFlags:0,state:`inactive`},Zy=new hy;function Qy(){return Xy}function $y(e){return Zy.addListener(`change`,e)}function eb(e){let t=Xy,n={...Xy};n.cursorFlags=e,Xy=n,Zy.emit(`change`,{prev:t,next:n})}function tb(e){let t=Xy;Xy=e,Zy.emit(`change`,{prev:t,next:e})}function nb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=xy(),n=Iy(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)}),tb({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var rb=e=>e,ib=()=>{},ab=1,ob=2,sb=4,cb=8,lb=3,ub=12,db;function fb(){return db===void 0&&(db=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(db=!0)),db}function pb({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&&fb()){let t=(e&ab)!==0,n=(e&ob)!==0,r=(e&sb)!==0,i=(e&cb)!==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 fb()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var mb=new WeakMap;function hb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=mb.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Qy();switch(r.state){case`active`:case`hover`:{let e=pb({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}mb.set(e,{prevStyle:t,styleSheet:n})}function gb({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=Vy({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Hy(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?ab:ob;break;case`vertical`:s|=d<0?sb:cb;break}}else Cy(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&lb:c|=s&lb,t.movementY===0?c|=o&ub:c|=s&ub,eb(c),hb(e)}function _b(e){let t=xy(),n=Qy();switch(n.state){case`active`:gb({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function vb(e){if(e.defaultPrevented)return;let t=Qy(),n=xy();switch(t.state){case`active`:if(e.buttons===0){tb({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=by(e.group.id,!0);Cy(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)}gb({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Iy(e,n);r.length===0?t.state!==`inactive`&&tb({cursorFlags:0,state:`inactive`}):tb({cursorFlags:0,hitRegions:r,state:`hover`}),hb(e.currentTarget);break}}}function yb(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Qy().state){case`hover`:tb({cursorFlags:0,state:`inactive`})}}function bb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Qy();switch(t.state){case`active`:tb({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(hb(e.currentTarget),t.hitRegions.forEach(e=>{let t=by(e.group.id,!0);Cy(e.group,t)}),e.preventDefault())}}function xb(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=ny(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=ny((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Sb(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=ry({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:ny(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Cb(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 wb({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=ny(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]=ny((r[e]??0)/a*l);else{let e=ny(l/c.length);for(let t of c)u[t]=e}return u}function Tb(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 Eb=new Map;function Db(e){let t=!0;ay(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=ry({group:e});if(t===0)return;let n=by(e.id);if(!n)return;let r=iy(e),i=n.defaultLayoutDeferred?xb(r):n.layout,a=Uy({layout:wb({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Hy(n.layout,a)&&Cb(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Cy(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Sb(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{ay(!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=ry({group:e}),s=iy(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Tb(e.panels,l)||(l=void 0));let u=Uy({layout:e.mutableState.layouts[c]??l??xb(s),panelConstraints:s}),d=e.element.ownerDocument;Eb.set(d,(Eb.get(d)??0)+1);let f=new Map;return my(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Cy(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{ay(!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`,Yy)}),Eb.get(d)===1&&(d.addEventListener(`dblclick`,Gy,!0),d.addEventListener(`pointerdown`,nb,!0),d.addEventListener(`pointerleave`,_b),d.addEventListener(`pointermove`,vb),d.addEventListener(`pointerout`,yb),d.addEventListener(`pointerup`,bb,!0)),function(){t=!1,Eb.set(d,Math.max(0,(Eb.get(d)??0)-1)),vy(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Yy)}),Eb.get(d)||(d.removeEventListener(`dblclick`,Gy,!0),d.removeEventListener(`pointerdown`,nb,!0),d.removeEventListener(`pointerleave`,_b),d.removeEventListener(`pointermove`,vb),d.removeEventListener(`pointerout`,yb),d.removeEventListener(`pointerup`,bb,!0)),a.disconnect()}}function Ob(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function kb(e){let t=(0,Q.useId)();return`${e??t}`}var Ab=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function jb(e){let t=(0,Q.useRef)(e);return Ab(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Mb(...e){return jb(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Nb(e){let t=(0,Q.useRef)({...e});return Ab(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Pb=(0,Q.createContext)(null);function Fb(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:rb});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Ab(()=>{Object.assign(n.current,qy({groupId:e}))})}function Ib({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=jb(e=>{Hy(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=jb(e=>{Hy(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=kb(s),v=(0,Q.useRef)(null),[y,b]=Ob(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Mb(v,a);Fb(_,o);let C=jb((e,t)=>{let r=Qy(),i=yy(e),a=by(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=Nb({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=oy(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=oy(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=yy(_),i=by(_);r&&i&&Cy(r,{...i,derivedPanelConstraints:iy(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 Ab(()=>{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=Db(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=by(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Sy(_,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=Ry(t.collapsedSize,i[t.panelId]),a=Ry(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Qy().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)(Pb.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})})}Ib.displayName=`Group`;function Lb(){let e=(0,Q.useContext)(Pb);return ay(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Rb(e,t){let{id:n}=Lb(),r=(0,Q.useRef)({collapse:ib,expand:ib,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ib});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Ab(()=>{Object.assign(r.current,Wy({groupId:n,panelId:e}))})}function zb({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=kb(c),_=Nb({disabled:a}),v=(0,Q.useRef)(null),y=Mb(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Lb(),T=d!==null,E=jb((e,t,n)=>{d?.(e,c,n)});Ab(()=>{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]),Rb(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Sy(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:{...Bb,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})})}zb.displayName=`Panel`;var Bb={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Vb(){return(0,Q.useRef)(null)}function Hb({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=Uy({layout:Vy({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Uy({layout:Vy({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Ub({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=kb(a),l=Nb({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=Mb(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Lb(),x=v===`horizontal`?`vertical`:`horizontal`;Ab(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=$y(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Sy(_,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(Hb({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})}Ub.displayName=`Separator`;var Wb=new Map;function Gb(e){let t=Wb.get(e);if(t)return t;let n=Kb(e);return Wb.set(e,n),n}async function Kb(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist--WFXzgaP.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--WFXzgaP.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--WFXzgaP.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--WFXzgaP.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-B5LD73X3.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--WFXzgaP.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--WFXzgaP.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--WFXzgaP.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--WFXzgaP.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-De7_06z9.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-ChSeukn9.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--WFXzgaP.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--WFXzgaP.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-0kDsAKH1.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--WFXzgaP.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--WFXzgaP.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-CLIXxF0N.js`);return{python:e}},__vite__mapDeps([51,43,39,1,23,40]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist--WFXzgaP.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--WFXzgaP.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-D2xbbdaz2.js`);return{rust:e}},__vite__mapDeps([52,39,1,23,40]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist--WFXzgaP.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--WFXzgaP.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-De7_06z9.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-DZpmpDA6.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-C7u3xI_X.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 qb(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-ChSeukn9.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 Gb(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist--WFXzgaP.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 Jb=ee({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Yb=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Xb(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 Zb(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}=vr(),l=Xb(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=or(e),n=c===`dark`?Jb:Yb,r=!1,s=null;return qb(e,t).then(e=>{if(r||!a.current)return;let t=[Ec,...e?[e]:[],cc.editable.of(!0),Qs.readOnly.of(!0),cc.lineWrapping,n];s=new cc({state:Qs.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 Qb(e){return Gr(`/api/asset?path=${encodeURIComponent(e)}`)}function $b(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function ex(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=Qb(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)(re,{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=$b(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(Zb,{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)(We,{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)(si,{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)(si,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{tt({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 tx(){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 nx(e){let{_:t}=i();return e===`existing-repo`?[{id:`draft-spec`,icon:ol,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Cl,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:El,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:Zl,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:ol,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:Gc,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function rx(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:a}=i(),o=nx(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){ka(t).then(()=>{c(e),clearTimeout(l.current),l.current=setTimeout(()=>c(null),1600)}).catch(ix)};t[8]===r?f=t[9]:(f=ai(`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)(si,{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:ai(`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)(Do,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(Et,{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 ix(){}var ax={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function ox(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}=vr(),s=ax[r],c=s?(o===`dark`?Ir[s]:void 0)??Kr[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=ai(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)(di,{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)(ui,{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)(_i,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function sx(e){let{installState:t}=e;return t.installed===null?Ko._({id:`IA6JW2`}):t.installed===!1?Ko._({id:`5SwVv1`}):null}function cx(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:Ko._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:Ko._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl}}}}return{enabled:!0,tooltip:null}}function lx(e){let t=(0,$.c)(66),{_:n}=i(),{target:r,installState:a,isElectronHost:o,onSelect:s}=e,c=e.openExternal??pg,{displayName:l}=r,u;t[0]!==a||t[1]!==o||t[2]!==r?(u=cx({target:r,installState:a,isElectronHost:o}),t[0]=a,t[1]=o,t[2]=r,t[3]=u):u=t[3];let d=u,f,p,m,h;if(t[4]!==n||t[5]!==a||t[6]!==o||t[7]!==s||t[8]!==c||t[9]!==d.enabled||t[10]!==d.tooltip||t[11]!==r||t[12]!==l){h=Symbol.for(`react.early_return_sentinel`);bb0:{p=sx({target:r,installState:a,isElectronHost:o});let e;if(t[17]!==c||t[18]!==d.tooltip?(e=()=>{d.tooltip&&c(d.tooltip.installAction.url)},t[17]=c,t[18]=d.tooltip,t[19]=e):e=t[19],f=e,d.enabled){let e=`open-in-agent-item-${r.id}`,i;t[20]!==n||t[21]!==l?(i=n({id:`NnQapF`,values:{targetDisplayName:l}}),t[20]=n,t[21]=l,t[22]=i):i=t[22];let a;t[23]===r.id?a=t[24]:(a=(0,Z.jsx)(ox,{id:r.id,"aria-hidden":`true`}),t[23]=r.id,t[24]=a);let o;t[25]===r.displayName?o=t[26]:(o=(0,Z.jsx)(`span`,{children:r.displayName}),t[25]=r.displayName,t[26]=o);let c;t[27]!==s||t[28]!==e||t[29]!==i||t[30]!==a||t[31]!==o?(c=(0,Z.jsxs)(Fa,{onSelect:s,"data-testid":e,"aria-label":i,children:[a,o]}),t[27]=s,t[28]=e,t[29]=i,t[30]=a,t[31]=o,t[32]=c):c=t[32],h=c;break bb0}if(!d.tooltip){let e=n(p?{id:`If0crP`,values:{targetDisplayName:l,hint:p}}:{id:`NnQapF`,values:{targetDisplayName:l}}),i;t[33]===r.id?i=t[34]:(i=(0,Z.jsx)(ox,{id:r.id,"aria-hidden":`true`}),t[33]=r.id,t[34]=i);let a;t[35]===r.displayName?a=t[36]:(a=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[35]=r.displayName,t[36]=a),h=(0,Z.jsxs)(Fa,{disabled:!0,"data-testid":`open-in-agent-item-${r.id}`,"aria-label":e,children:[i,a,p?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null]});break bb0}m=n(p?{id:`If0crP`,values:{targetDisplayName:l,hint:p}}:{id:`NnQapF`,values:{targetDisplayName:l}})}t[4]=n,t[5]=a,t[6]=o,t[7]=s,t[8]=c,t[9]=d.enabled,t[10]=d.tooltip,t[11]=r,t[12]=l,t[13]=f,t[14]=p,t[15]=m,t[16]=h}else f=t[13],p=t[14],m=t[15],h=t[16];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g=m,_=`open-in-agent-item-${r.id}`,v;t[37]===r.id?v=t[38]:(v=(0,Z.jsx)(ox,{id:r.id,"aria-hidden":`true`,className:`mr-2`}),t[37]=r.id,t[38]=v);let y;t[39]===r.displayName?y=t[40]:(y=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[39]=r.displayName,t[40]=y);let b;t[41]===p?b=t[42]:(b=p?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[41]=p,t[42]=b);let x;t[43]!==g||t[44]!==_||t[45]!==v||t[46]!==y||t[47]!==b?(x=(0,Z.jsxs)(Ba,{"data-testid":_,"data-row-disabled":``,"aria-label":g,children:[v,y,b]}),t[43]=g,t[44]=_,t[45]=v,t[46]=y,t[47]=b,t[48]=x):x=t[48];let S=`open-in-agent-submenu-${r.id}`,C=`open-in-agent-message-${r.id}`,w;t[49]!==d.tooltip.message||t[50]!==C?(w=(0,Z.jsx)(Ta,{className:`font-normal text-muted-foreground text-xs`,"data-testid":C,children:d.tooltip.message}),t[49]=d.tooltip.message,t[50]=C,t[51]=w):w=t[51];let T;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Ka,{}),t[52]=T):T=t[52];let E=`open-in-agent-install-${r.id}`,D;t[53]===d.tooltip.installAction.label?D=t[54]:(D=(0,Z.jsx)(`span`,{children:d.tooltip.installAction.label}),t[53]=d.tooltip.installAction.label,t[54]=D);let O;t[55]!==f||t[56]!==E||t[57]!==D?(O=(0,Z.jsx)(Fa,{onSelect:f,"data-testid":E,children:D}),t[55]=f,t[56]=E,t[57]=D,t[58]=O):O=t[58];let k;t[59]!==w||t[60]!==O||t[61]!==S?(k=(0,Z.jsxs)(Oa,{className:`min-w-[260px]`,"data-testid":S,children:[w,T,O]}),t[59]=w,t[60]=O,t[61]=S,t[62]=k):k=t[62];let A;return t[63]!==k||t[64]!==x?(A=(0,Z.jsxs)(eo,{children:[x,k]}),t[63]=k,t[64]=x,t[65]=A):A=t[65],A}var ux=ri(`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 dx(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=ai(ux({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 fx=`ok-preferred-agent-v1`,px=new Set(Fh.map(e=>e.id));function mx(e){return typeof e==`string`&&px.has(e)}function hx(e){try{let t=(e??localStorage).getItem(fx);return mx(t)?t:null}catch{return null}}function gx(e,t){try{(t??localStorage).setItem(fx,e)}catch{}}function _x(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:Fh.find(e=>n[e.id]?.installed===!0)?.id??null}function vx(e){let t=(0,$.c)(58),{scenario:n,className:r}=e,{_:a}=i(),{states:o,refresh:c}=Kg(),{dispatch:l}=Fg(),u=po(),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(bx),h=(0,Q.useRef)(!1),g=(0,Q.useRef)(null),_=nx(n),v;t[0]===o?v=t[1]:(v=e=>o[e.id]?.installed===!0,t[0]=o,t[1]=v);let y=Fh.filter(v),b;t[2]===o?b=t[3]:(b=Fh.every(e=>o[e.id]?.installed!=null),t[2]=o,t[3]=b);let x=b,S=x&&y.length===0,C,w;t[4]!==x||t[5]!==o?(C=()=>{if(!x||h.current)return;let e=_x({lastUsed:hx(),states:o});m(t=>e===t?t:e)},w=[x,o],t[4]=x,t[5]=o,t[6]=C,t[7]=w):(C=t[6],w=t[7]),(0,Q.useEffect)(C,w);let T=function(e){h.current=!0,m(e),gx(e)},E;t[8]!==d||t[9]!==l||t[10]!==n||t[11]!==u?(E=function(e){let t=d.trim();gx(e);let r=bg({workspace:u,description:t,scenario:n});r!==null&&l(e,r)},t[8]=d,t[9]=l,t[10]=n,t[11]=u,t[12]=E):E=t[12];let D=E,O;t[13]!==D||t[14]!==p?(O=function(e){(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),p!==null&&D(p))},t[13]=D,t[14]=p,t[15]=O):O=t[15];let k=O,A,j,M,N,P,F;if(t[16]!==a||t[17]!==r||t[18]!==d||t[19]!==k||t[20]!==S||t[21]!==_){M=Symbol.for(`react.early_return_sentinel`);bb0:{let e=function(e){f(e),g.current?.focus()};if(S){let e;t[28]===r?e=t[29]:(e=ai(`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[28]=r,t[29]=e);let n;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(vi,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[30]=n):n=t[30];let i;t[31]===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[31]=i):i=t[31];let a;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:Fh.map(yx)}),t[32]=a):a=t[32];let o;t[33]===e?o=t[34]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[33]=e,t[34]=o),M=o;break bb0}t[35]===r?A=t[36]:(A=ai(`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`,r),t[35]=r,t[36]=A);let n;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(n=e=>f(e.target.value),t[37]=n):n=t[37];let i;t[38]===a?i=t[39]:(i=a({id:`0jD-Gn`}),t[38]=a,t[39]=i);let o;t[40]===a?o=t[41]:(o=a({id:`7hctf2`}),t[40]=a,t[41]=o),t[42]!==d||t[43]!==k||t[44]!==i||t[45]!==o?(j=(0,Z.jsx)(Rs,{ref:g,value:d,onChange:n,onKeyDown:k,rows:4,placeholder:i,"aria-label":o,className:`min-h-[112px] 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`}),t[42]=d,t[43]=k,t[44]=i,t[45]=o,t[46]=j):j=t[46],F=`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,N=`flex min-w-0 flex-wrap items-center gap-2`,P=_.map(t=>{let n=t.icon;return(0,Z.jsxs)(si,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${t.id}`,children:[(0,Z.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),t.label]},t.id)})}t[16]=a,t[17]=r,t[18]=d,t[19]=k,t[20]=S,t[21]=_,t[22]=A,t[23]=j,t[24]=M,t[25]=N,t[26]=P,t[27]=F}else A=t[22],j=t[23],M=t[24],N=t[25],P=t[26],F=t[27];if(M!==Symbol.for(`react.early_return_sentinel`))return M;let I;t[47]!==N||t[48]!==P?(I=(0,Z.jsx)(`div`,{className:N,children:P}),t[47]=N,t[48]=P,t[49]=I):I=t[49];let L=p===null?(0,Z.jsx)(si,{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)(dx,{children:[(0,Z.jsxs)(si,{type:`button`,onClick:()=>D(p),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:[(0,Z.jsx)(ox,{id:p,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`9dw5bW`,values:{0:Mg(p)}})]}),(0,Z.jsxs)(ro,{onOpenChange:e=>{e&&c()},children:[(0,Z.jsx)(ao,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,"aria-label":a({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(It,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsx)($a,{align:`end`,className:`min-w-[200px]`,children:y.map(e=>(0,Z.jsxs)(Fa,{onSelect:()=>T(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(ox,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),e.id===p?(0,Z.jsx)(Do,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))})]})]}),R;t[50]!==I||t[51]!==L||t[52]!==F?(R=(0,Z.jsxs)(`div`,{className:F,children:[I,L]}),t[50]=I,t[51]=L,t[52]=F,t[53]=R):R=t[53];let z;return t[54]!==A||t[55]!==j||t[56]!==R?(z=(0,Z.jsxs)(`div`,{className:A,children:[j,R]}),t[54]=A,t[55]=j,t[56]=R,t[57]=z):z=t[57],z}function yx(e){return(0,Z.jsxs)(si,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void xg(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(ox,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(go,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function bx(){return hx()}var xx=3100,Sx=3;function Cx(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Sx;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var wx={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}},Tx=[`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 Ex(e,t={}){let n=t.rng??Math.random,r=t.colors??Tx,i=wx[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 Dx=1.8,Ox=90,kx=16,Ax=380,jx=.025,Mx=.1,Nx=.18,Px=400,Fx=9.2736,Ix=18.1799,Lx=14.5244,Rx={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function zx(e,t){let{halfWidth:n,apexLift:r}=Rx[t];return`M${e-n} ${Lx+.3} Q${e} ${Lx-r}, ${e+n} ${Lx+.3}`}function Bx(e){let t=1.5,n=.3;return`M${e-t} ${Lx-n} Q${e} ${Lx+1.4}, ${e+t} ${Lx-n}`}var Vx=15,Hx=15;function Ux(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 Wx(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=Cx(g,t);_(n),y(Jx),S(Ex(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},xx)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(qx),S(Ex(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},xx))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/Ax)),C=Math.max(-1,Math.min(1,b/Ax)),w=S*kx,T=-C*kx,E=0,D=0;if(x>=1){let e=Math.min(x/Ox,1)*Dx;E=y/x*e,D=b/x*e}let O=Math.abs(T-r)<.01&&Math.abs(w-i)<.01&&Math.abs(E-a)<.01&&Math.abs(D-o)<.01;if(!m&&O)return;l(),r+=(T-r)*Mx,i+=(w-i)*Mx,u.style.transform=`perspective(${Px}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*Nx,o+=(D-o)*Nx;let k=i*jx,A=-r*jx,j=a+k,M=o+A;h.current.x=j,h.current.y=M,p.current?.setAttribute(`transform`,`translate(${j.toFixed(3)} ${M.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=ai(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=ai(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=ai(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:Fx,cy:Lx,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let q=(F||T)&&`ok-blob-eye-hidden`,J;t[26]===q?J=t[27]:(J=ai(`ok-blob-eye ok-blob-eye-right`,q),t[26]=q,t[27]=J);let Y;t[28]===J?Y=t[29]:(Y=(0,Z.jsx)(`ellipse`,{cx:Ix,cy:Lx,rx:1.2722,ry:1.9083,className:J}),t[28]=J,t[29]=Y);let ee;t[30]===I?ee=t[31]:(ee=zx(Fx,I),t[30]=I,t[31]=ee);let te=(!F||T)&&`ok-blob-eye-hidden`,ne;t[32]===te?ne=t[33]:(ne=ai(`ok-blob-happy-eye`,te),t[32]=te,t[33]=ne);let re;t[34]!==ee||t[35]!==ne?(re=(0,Z.jsx)(`path`,{d:ee,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ne}),t[34]=ee,t[35]=ne,t[36]=re):re=t[36];let ie;t[37]===I?ie=t[38]:(ie=zx(Ix,I),t[37]=I,t[38]=ie);let ae=(!F||T)&&`ok-blob-eye-hidden`,oe;t[39]===ae?oe=t[40]:(oe=ai(`ok-blob-happy-eye`,ae),t[39]=ae,t[40]=oe);let se;t[41]!==ie||t[42]!==oe?(se=(0,Z.jsx)(`path`,{d:ie,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:oe}),t[41]=ie,t[42]=oe,t[43]=se):se=t[43];let ce;t[44]===T?ce=t[45]:(ce=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:Bx(Fx),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:Bx(Ix),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ce);let le;t[46]!==K||t[47]!==Y||t[48]!==re||t[49]!==se||t[50]!==ce?(le=(0,Z.jsxs)(`g`,{ref:p,children:[K,Y,re,se,ce]}),t[46]=K,t[47]=Y,t[48]=re,t[49]=se,t[50]=ce,t[51]=le):le=t[51];let ue;t[52]!==B||t[53]!==H||t[54]!==le?(ue=(0,Z.jsxs)(`g`,{className:H,children:[U,le]},B),t[52]=B,t[53]=H,t[54]=le,t[55]=ue):ue=t[55];let de;t[56]===T?de=t[57]:(de=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=de);let fe;t[58]!==v||t[59]!==x?(fe=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(Gx)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=fe):fe=t[60];let pe;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==ue||t[65]!==de||t[66]!==fe?(pe=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:Kx,children:[ue,de,fe]}),t[61]=D,t[62]=s,t[63]=z,t[64]=ue,t[65]=de,t[66]=fe,t[67]=pe):pe=t[67];let me;return t[68]!==R||t[69]!==pe?(me=(0,Z.jsx)(`span`,{ref:d,className:R,children:pe}),t[68]=R,t[69]=pe,t[70]=me):me=t[70],me}function Gx(e){return(0,Z.jsx)(`circle`,{cx:Vx+e.originDx,cy:Hx+e.originDy,r:e.size,className:`ok-blob-firework`,style:Ux(e)},e.id)}function Kx(e){return e.preventDefault()}function qx(e){return e+1}function Jx(e){return e+1}function Yx(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(Wx,{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 Xx=`open-knowledge:create-top-level-file`;function Zx(e={}){window.dispatchEvent(new CustomEvent(Xx,{detail:e}))}function Qx(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(Xx,t),()=>window.removeEventListener(Xx,t)}function $x(e){let t=(0,$.c)(32),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o=Mh(),c=Mi(),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)(Yx,{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)(rx,{scenario:`existing-repo`}):(0,Z.jsx)(vx,{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)(nS,{templates:u,loading:d,error:f,onSelect:tS}):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)(M,{"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)(si,{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)(si,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:eS,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Ga,{"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:`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-10 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 eS(){return Zx({initialDir:``})}function tS(e,t){return Zx({template:{folder:e,name:t}})}function nS(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)(at,{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)(rS,{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 rS(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)(si,{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 iS(){let e=(0,$.c)(14),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(void 0),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(0),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(void 0),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(cS);if(e)return;let r=t.ok?Or.safeParse(n):null;r?.success?(o(lS(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=Xo(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(u.current)}},f=[],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(){clearTimeout(u.current),u.current=setTimeout(()=>c(sS),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(oS);if(!e.ok)return;let n=Or.safeParse(t);n.success&&o(lS(n.data.documents))}).catch(aS)},e[2]=p):p=e[2];let m=p,h=a!==null,g=a===0,_;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){n(e),e||i(void 0)},e[3]=_):_=e[3];let v=_,y;e[4]!==s||e[5]!==g||e[6]!==h?(y=h?g?(0,Z.jsx)(uS,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)($x,{celebrateSignal:s,onAddStarterPack:()=>{n(!0)}}):null,e[4]=s,e[5]=g,e[6]=h,e[7]=y):y=e[7];let b;e[8]!==r||e[9]!==t?(b=(0,Z.jsx)(Dh,{open:t,onOpenChange:v,onSeedApplied:m,initialPackId:r}),e[8]=r,e[9]=t,e[10]=b):b=e[10];let x;return e[11]!==y||e[12]!==b?(x=(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:[y,b]}),e[11]=y,e[12]=b,e[13]=x):x=e[13],x}function aS(){}function oS(){return null}function sS(e){return e+1}function cS(){return null}function lS(e){return qo(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function uS(e){let t=(0,$.c)(26),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o=Mh(),c;t[0]===a?c=t[1]:(c=a({id:`6h4zVU`}),t[0]=a,t[1]=c);let l;t[2]!==a||t[3]!==o?(l=a(o?{id:`vGeNNQ`}:{id:`qpQwGC`}),t[2]=a,t[3]=o,t[4]=l):l=t[4];let u;t[5]!==n||t[6]!==c||t[7]!==l?(u=(0,Z.jsx)(Yx,{title:c,subtitle:l,celebrateSignal:n}),t[5]=n,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===o?d=t[10]:(d=o?(0,Z.jsx)(rx,{scenario:`new-project`}):(0,Z.jsx)(vx,{scenario:`new-project`}),t[9]=o,t[10]=d);let f;t[11]!==a||t[12]!==o?(f=a(o?{id:`GubkSu`}:{id:`xeXS4P`}),t[11]=a,t[12]=o,t[13]=f):f=t[13];let p;t[14]===f?p=t[15]:(p=(0,Z.jsx)(fS,{label:f}),t[14]=f,t[15]=p);let m;t[16]===r?m=t[17]:(m=(0,Z.jsx)(xh,{onPackSelect:r}),t[16]=r,t[17]=m);let h;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(si,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:dS,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Ga,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=h):h=t[18];let g;t[19]!==p||t[20]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[p,m,h]}),t[19]=p,t[20]=m,t[21]=g):g=t[21];let _;return t[22]!==u||t[23]!==d||t[24]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[u,d,g]}),t[22]=u,t[23]=d,t[24]=g,t[25]=_):_=t[25],_}function dS(){return Zx()}function fS(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 pS(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function mS(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)(gS,{}),(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=pS(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 Zi(n,{[e]:t});if(!r.ok){let{error:e}=r;X.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 Zi(n,{[e]:null});if(!t.ok){let{error:e}=t;X.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,aa(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):qi[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,N;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){d(t=>t&&{...t,name:e,error:null})},t[23]=N):N=t[23];let P=N,F;t[24]!==o||t[25]!==u||t[26]!==n||t[27]!==a||t[28]!==h?(F=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(Yn(u.value)){d({...u,error:o({id:`hXUWyd`})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}let t=await Zi(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[24]=o,t[25]=u,t[26]=n,t[27]=a,t[28]=h,t[29]=F):F=t[29];let I=F,L;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){p({key:e,draft:e,error:null})},t[30]=L):L=t[30];let R=L,z;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){p(t=>t&&{...t,draft:e,error:null})},t[31]=z):z=t[31];let B=z,V;t[32]!==o||t[33]!==n||t[34]!==a||t[35]!==h||t[36]!==f?(V=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 Zi(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]=V):V=t[37];let H=V,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)(jo,{className:q,"aria-hidden":!0}),t[40]=q,t[41]=J);let Y;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[42]=Y):Y=t[42];let ee;t[43]===J?ee=t[44]:(ee=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[J,Y]}),t[43]=J,t[44]=ee);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:hS,children:_}),t[45]=_,t[46]=te);let ne;t[47]!==ee||t[48]!==te?(ne=(0,Z.jsxs)(Mo,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[ee,te]}),t[47]=ee,t[48]=te,t[49]=ne):ne=t[49];let re;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`hSBIG-`})}),t[50]=re):re=t[50];let ie;t[51]!==u||t[52]!==x||t[53]!==H||t[54]!==y||t[55]!==h||t[56]!==C||t[57]!==f||t[58]!==T?(ie=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)(Fi,{keyName:e,value:t,declared:mo(t,An(t)),rename:{state:f?.key===e?f:null,onBegin:()=>R(e),onChangeDraft:B,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]=ie):ie=t[59];let ae;t[60]!==u||t[61]!==I?(ae=u?(0,Z.jsx)(ta,{draft:u,onChangeName:P,onChangeType:k,onChangeValue:j,onCommit:()=>void I(),onCancel:()=>d(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(si,{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)(M,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`G8t9NN`})})]})}),t[60]=u,t[61]=I,t[62]=ae):ae=t[62];let oe;t[63]!==ie||t[64]!==ae?(oe=(0,Z.jsx)(Ao,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[re,ie,ae]})}),t[63]=ie,t[64]=ae,t[65]=oe):oe=t[65];let se;return t[66]!==G||t[67]!==ne||t[68]!==oe?(se=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(No,{open:G,onOpenChange:K,children:[ne,oe]})}),t[66]=G,t[67]=ne,t[68]=oe,t[69]=se):se=t[69],se}function hS(e){return e.stopPropagation()}function gS(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(dl,{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 _S(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?Ko._({id:`xOTzt5`}):t<3600?Ko._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?Ko._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?Ko._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function vS(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function yS(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:Qa,label:Ko._({id:`QR5SP1`}),detail:vS(i)};case`template-edit`:return{Icon:V,label:Ko._({id:`-LHLx7`}),detail:vS(i)};case`template-delete`:return{Icon:fs,label:Ko._({id:`_gkGSK`}),detail:vS(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:Uc,label:Ko._({id:`KPW5WC`}),detail:`${vS(e??``)} → ${vS(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:dl,label:Ko._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:dl,label:Ko._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:dl,label:Ko._({id:`ZQLDTl`}),detail:``};default:return{Icon:_l,label:r.replace(/-/g,` `),detail:vS(i)}}}function bS(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?Ko._({id:`B2DrPb`}):e.author||Ko._({id:`Ef7StM`})}function xS(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=cs(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)(at,{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(SS)})}),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 SS(e){let{Icon:t,label:n,detail:r}=yS(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)(iu,{className:`size-3`,"aria-hidden":!0}),bS(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:_S(e.timestamp)})]},e.sha)}function CS(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function wS(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=CS(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function TS(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function ES(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:wS(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:TS(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:wS(e,t.pageTitles),children:a}}function DS(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)(at,{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)(si,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(M,{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)($i,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Vi,{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)(Ra,{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)(Ti,{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(OS)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(Yi,{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,N;t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j?(N=(0,Z.jsx)(ih,{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]=N):N=t[37];let P;return t[38]!==E||t[39]!==O||t[40]!==N||t[41]!==S||t[42]!==w?(P=(0,Z.jsxs)(Z.Fragment,{children:[S,w,E,O,N]}),t[38]=E,t[39]=O,t[40]=N,t[41]=S,t[42]=w,t[43]=P):P=t[43],P}function OS(e){return e.name}function kS(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=ai(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=ai(`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 AS(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=ai(`[&_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 jS(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=ai(`[&_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 MS(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=ai(`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 NS(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=ai(`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 PS(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=ai(`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 FS(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Ko._({id:`xOTzt5`});if(r<60)return Ko._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Ko._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Ko._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function IS(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 LS(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)(yt,{className:`ml-1 size-3`}):(0,Z.jsx)(dt,{className:`ml-1 size-3`}):(0,Z.jsx)(Wc,{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)(si,{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 RS(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=es(),d=ea(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(VS)]})]}),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=ES(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=IS(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(BS):(_(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 N;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(ke,{className:`size-5 text-muted-foreground`}),t[31]=N):N=t[31];let P=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[N,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:o})]}),F;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(si,{onClick:()=>h(!0),children:[(0,Z.jsx)(M,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[32]=F):F=t[32],t[33]===P?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:[P,F]})}),t[33]=P,t[34]=E),t[35]!==f||t[36]!==n||t[37]!==p?(D=(0,Z.jsx)(mS,{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)(DS,{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)(xS,{folderPath:n}),t[44]=n,t[45]=k),w=`rounded-lg border`,x=kS;let I=g===`name`?v===`asc`?`ascending`:`descending`:`none`,L;t[46]===r?L=t[47]:(L=r({id:`6YtxFj`}),t[46]=r,t[47]=L);let R;t[48]!==j||t[49]!==v||t[50]!==g||t[51]!==L?(R=(0,Z.jsx)(LS,{label:L,sortKey:`name`,activeKey:g,activeDir:v,onSort:j}),t[48]=j,t[49]=v,t[50]=g,t[51]=L,t[52]=R):R=t[52];let z;t[53]!==I||t[54]!==R?(z=(0,Z.jsx)(NS,{"aria-sort":I,children:R}),t[53]=I,t[54]=R,t[55]=z):z=t[55];let B=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,V;t[56]===r?V=t[57]:(V=r({id:`tgWuMB`}),t[56]=r,t[57]=V);let H;t[58]!==j||t[59]!==v||t[60]!==g||t[61]!==V?(H=(0,Z.jsx)(LS,{label:V,sortKey:`modified`,activeKey:g,activeDir:v,onSort:j}),t[58]=j,t[59]=v,t[60]=g,t[61]=V,t[62]=H):H=t[62];let U;t[63]!==B||t[64]!==H?(U=(0,Z.jsx)(NS,{className:`w-32`,"aria-sort":B,children:H}),t[63]=B,t[64]=H,t[65]=U):U=t[65],t[66]!==z||t[67]!==U?(C=(0,Z.jsx)(AS,{children:(0,Z.jsxs)(MS,{children:[z,U]})}),t[66]=z,t[67]=U,t[68]=C):C=t[68],b=jS,S=i.length?i.map(zS):(0,Z.jsx)(MS,{children:(0,Z.jsx)(PS,{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 N;t[72]!==x||t[73]!==j||t[74]!==C?(N=(0,Z.jsxs)(x,{children:[C,j]}),t[72]=x,t[73]=j,t[74]=C,t[75]=N):N=t[75];let P;t[76]!==N||t[77]!==w?(P=(0,Z.jsx)(`div`,{className:w,children:N}),t[76]=N,t[77]=w,t[78]=P):P=t[78];let F;t[79]!==P||t[80]!==T||t[81]!==E||t[82]!==D||t[83]!==O||t[84]!==k?(F=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,k,P]}),t[79]=P,t[80]=T,t[81]=E,t[82]=D,t[83]=O,t[84]=k,t[85]=F):F=t[85];let I;t[86]!==F||t[87]!==A?(I=(0,Z.jsx)(`div`,{className:A,children:F}),t[86]=F,t[87]=A,t[88]=I):I=t[88];let L;t[89]!==m||t[90]!==d||t[91]!==n?(L=(0,Z.jsx)(ih,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[89]=m,t[90]=d,t[91]=n,t[92]=L):L=t[92];let R;return t[93]!==I||t[94]!==L?(R=(0,Z.jsxs)(Z.Fragment,{children:[I,L]}),t[93]=I,t[94]=L,t[95]=R):R=t[95],R}function zS(e){return(0,Z.jsxs)(MS,{children:[(0,Z.jsx)(PS,{children:(0,Z.jsxs)(`a`,{href:Go(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)(pl,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(ie,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(PS,{className:`text-muted-foreground`,children:e.kind===`file`?FS(e.modified):`—`})]},e.path)}function BS(e){return e===`asc`?`desc`:`asc`}function VS(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 HS(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)(sl,{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=Yr(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Yr(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)(si,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(hi,{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 US(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(WS),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ot(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)(si,{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 WS(){return new Set}var GS=(0,Q.createContext)(null);function KS(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(qS),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)(GS,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function qS(){return new Map}function JS(){let e=(0,Q.use)(GS);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function YS(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var XS=YS(()=>n(()=>import(`./SettingsDialogBody-BZCF6qQz.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([53,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,49,54,7,13,15,25,55]),import.meta.url));function ZS(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)(si,{variant:`default`,onClick:QS,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 QS(){return window.location.reload()}function $S(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(le,{fallbackRender:tC,onError:eC,children:n}),t[0]=n,t[1]=r),r}function eC(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function tC(e){return(0,Z.jsx)(ZS,{...e})}function nC(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function rC(e){let t=(0,$.c)(89),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=pt(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=oe(),{desktopPresent:f}=ji(),[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)(xo,{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)(bo,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[72]=J):J=t[72];let Y;t[73]!==p||t[74]!==K?(Y=(0,Z.jsx)(iC,{groups:K,activeId:p,onSelect:m}),t[73]=p,t[74]=K,t[75]=Y):Y=t[75];let ee;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(sC,{}),t[76]=ee):ee=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)($S,{children:(0,Z.jsx)(Q.Suspense,{fallback:ee,children:(0,Z.jsx)(XS,{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 re;t[82]!==Y||t[83]!==ne?(re=(0,Z.jsxs)(So,{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,Y,ne]}),t[82]=Y,t[83]=ne,t[84]=re):re=t[84];let ie;return t[85]!==r||t[86]!==n||t[87]!==re?(ie=(0,Z.jsx)(Eo,{open:n,onOpenChange:r,children:re}),t[85]=r,t[86]=n,t[87]=re,t[88]=ie):ie=t[88],ie}function iC(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)(oC,{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)(aC,{}),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 aC(){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=nC(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:ai(`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)(go,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function oC(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=ai(`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:ai(`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 sC(){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 cC(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=ai(`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)(Ib,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function lC(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)(zb,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function uC(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=ai(`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)(Ub,{"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 dC(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=ai(`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 fC=ri(`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 pC(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=ai(fC({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:mC,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function mC(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}ri(`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 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=ai(`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 gC(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=ai(`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)(ko,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _C(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)(gC,{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)(Xc,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(vo,{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)(Ds,{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)(As,{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)(au,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(vo,{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)(Ds,{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)(As,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(pC,{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)(dC,{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 Y;t[54]===S?Y=t[55]:(Y=S({id:`oqB2ez`}),t[54]=S,t[55]=Y);let ee=!w,te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(ct,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=te):te=t[56];let ne;t[57]!==v||t[58]!==Y||t[59]!==ee?(ne=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Y,disabled:ee,onClick:v,children:te})}),t[57]=v,t[58]=Y,t[59]=ee,t[60]=ne):ne=t[60];let re;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(Ds,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=re):re=t[61];let ie;t[62]===ne?ie=t[63]:(ie=(0,Z.jsxs)(As,{children:[ne,re]}),t[62]=ne,t[63]=ie);let ae;t[64]===S?ae=t[65]:(ae=S({id:`SiUUCS`}),t[64]=S,t[65]=ae);let oe=!w,se;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(It,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=se):se=t[66];let ce;t[67]!==_||t[68]!==ae||t[69]!==oe?(ce=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ae,disabled:oe,onClick:_,children:se})}),t[67]=_,t[68]=ae,t[69]=oe,t[70]=ce):ce=t[70];let le;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(Ds,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=le):le=t[71];let ue;t[72]===ce?ue=t[73]:(ue=(0,Z.jsxs)(As,{children:[ce,le]}),t[72]=ce,t[73]=ue);let de=o?`secondary`:`ghost`,fe;t[74]!==S||t[75]!==o?(fe=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=fe):fe=t[76];let pe=o?`ok-replace-input`:void 0,me;t[77]!==m||t[78]!==o?(me=()=>m(!o),t[77]=m,t[78]=o,t[79]=me):me=t[79];let he;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(Rl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=he):he=t[80];let ge;t[81]!==o||t[82]!==de||t[83]!==fe||t[84]!==pe||t[85]!==me?(ge=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,variant:de,size:`icon-sm`,"aria-label":fe,"aria-expanded":o,"aria-controls":pe,onClick:me,children:he})}),t[81]=o,t[82]=de,t[83]=fe,t[84]=pe,t[85]=me,t[86]=ge):ge=t[86];let _e;t[87]===o?_e=t[88]:(_e=(0,Z.jsx)(Ds,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=_e);let ve;t[89]!==ge||t[90]!==_e?(ve=(0,Z.jsxs)(As,{children:[ge,_e]}),t[89]=ge,t[90]=_e,t[91]=ve):ve=t[91];let ye;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(ye=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)(ko,{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)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Rl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ds,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Ll,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ds,{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]=ye):ye=t[100];let be;t[101]===S?be=t[102]:(be=S({id:`wJo9oS`}),t[101]=S,t[102]=be);let xe;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(ps,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=xe):xe=t[103];let Se;t[104]!==x||t[105]!==be?(Se=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":be,onClick:x,children:xe})}),t[104]=x,t[105]=be,t[106]=Se):Se=t[106];let Ce;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(Ds,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Ce):Ce=t[107];let we;t[108]===Se?we=t[109]:(we=(0,Z.jsxs)(As,{children:[Se,Ce]}),t[108]=Se,t[109]=we);let Te;return t[110]!==q||t[111]!==J||t[112]!==ie||t[113]!==ue||t[114]!==j||t[115]!==ve||t[116]!==ye||t[117]!==we?(Te=(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,ie,ue,ve,ye,we]}),t[110]=q,t[111]=J,t[112]=ie,t[113]=ue,t[114]=j,t[115]=ve,t[116]=ye,t[117]=we,t[118]=Te):Te=t[118],Te}var vC={current:0,total:0},yC=120,bC=100;function xC(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,SC)}function SC(){return null}function CC(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 _v(e,t){return`${e}\u0000${t}`}function vv(e,t,n){let r=Rr(e).body,i=Rr(t).body;return r===i?``:hv(n,r,i,``,``,{context:3})}function yv(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=pt(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=_v(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=vv(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 bv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-InYkbArk.js`),__vite__mapDeps([19,1,6,20]),import.meta.url)).ActivityPanelDiffView})),xv=1e4,Sv=6e4;async function Cv(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 wv(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Ko._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Ko._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Ko._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Ko._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Ko._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function Tv(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Ev(e){return e.slice(0,7)}function Dv(e){return e.type===`upstream`?Ko._({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`?Ko._({id:`B2DrPb`}):e.author}function Ov(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)(di,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(_i,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(li,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(mi,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Si,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(bi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(vi,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function kv(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)(Ce,{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=Zr(i),t[1]=i,t[2]=a);let o=a,s=r?Ir[o]??Kr[o]:Kr[o],c;t[3]!==s||t[4]!==i?(c=s??Wn(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)(Ov,{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)(hl,{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)(Hc,{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)(iu,{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)(vi,{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)(Hc,{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)(iu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Av(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function jv(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(Nv),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(Mv)},children:[r?(0,Z.jsx)(It,{className:`size-3`}):(0,Z.jsx)(jo,{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 Mv(e){return!e}function Nv(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 Pv(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=yv(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)(Yt,{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)(Yt,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(bv,{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 Fv(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=wv(n.timestamp),t[0]=n.timestamp,t[1]=p);let m=p,h;t[2]===n?h=t[3]:(h=Dv(n),t[2]=n,t[3]=h);let g=h,_;t[4]===n.timestamp?_=t[5]:(_=Tv(n.timestamp),t[4]=n.timestamp,t[5]=_);let v=_,y;t[6]===n.sha?y=t[7]:(y=Ev(n.sha),t[6]=n.sha,t[7]=y);let b=y,x=n.contributors.flatMap(Iv),S;t[8]===n?S=t[9]:(S=Av(n),t[8]=n,t[9]=S);let C=S,[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(null),k=(0,Q.useId)(),A,j;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>()=>O.current?.abort(),j=[],t[10]=A,t[11]=j):(A=t[10],j=t[11]),(0,Q.useEffect)(A,j);let M;t[12]!==n.sha||t[13]!==u?(M=()=>u(n.sha),t[12]=n.sha,t[13]=u,t[14]=M):M=t[14];let N=M,P;t[15]===T?P=t[16]:(P=function(){O.current?.abort(),O.current=null,D(!1),T(!1)},t[15]=T,t[16]=P);let F=P,I;t[17]!==f||t[18]!==c||t[19]!==n.sha||t[20]!==d||t[21]!==T?(I=async function(){D(!0);let e=new AbortController;O.current=e;let t=function(){e.signal.aborted||D(!1),O.current===e&&(O.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName: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}),X.error(f({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)T(!1),d();else{let e=`HTTP ${r.status}`;try{let t=mr.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}),X.error(f({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=f,t[18]=c,t[19]=n.sha,t[20]=d,t[21]=T,t[22]=I):I=t[22];let L=I,R;t[23]!==n||t[24]!==r?(R=(0,Z.jsx)(kv,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=R):R=t[25];let z=R,B=l?k:void 0,V=l?`bg-muted`:`hover:bg-muted/80`,H;t[26]===V?H=t[27]:(H=[`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`,V],t[26]=V,t[27]=H);let U=H.join(` `),W;t[28]===N?W=t[29]:(W=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),N())},t[28]=N,t[29]=W);let G;t[30]===z?G=t[31]:(G=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:z}),t[30]=z,t[31]=G);let K;t[32]===g?K=t[33]:(K=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:g}),t[32]=g,t[33]=K);let q;t[34]!==n.timestamp||t[35]!==m?(q=(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]=q):q=t[36];let J;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=J):J=t[37];let Y;t[38]===f?Y=t[39]:(Y=f({id:`Yea-K5`}),t[38]=f,t[39]=Y);let ee;t[40]===T?ee=t[41]:(ee=e=>{e.stopPropagation(),T(!0)},t[40]=T,t[41]=ee);let te;t[42]===E?te=t[43]:(te=E?(0,Z.jsx)(Yt,{className:`size-3 animate-spin`}):(0,Z.jsx)(fi,{className:`size-3`}),t[42]=E,t[43]=te);let ne;t[44]!==E||t[45]!==Y||t[46]!==ee||t[47]!==te?(ne=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":Y,disabled:E,onClick:ee,children:te})}),t[44]=E,t[45]=Y,t[46]=ee,t[47]=te,t[48]=ne):ne=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)(Ds,{side:`top`,children:re}),t[51]=re,t[52]=ie);let ae;t[53]!==ne||t[54]!==ie?(ae=(0,Z.jsxs)(As,{children:[ne,ie]}),t[53]=ne,t[54]=ie,t[55]=ae):ae=t[55];let oe;t[56]!==K||t[57]!==q||t[58]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[K,q,J,ae]}),t[56]=K,t[57]=q,t[58]=ae,t[59]=oe):oe=t[59];let se;t[60]===C?se=t[61]:(se=C.length>0&&(0,Z.jsx)(jv,{summaries:C}),t[60]=C,t[61]=se);let ce=x.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:x.join(`, `),children:x.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]!==N||t[68]!==B||t[69]!==U||t[70]!==W||t[71]!==G||t[72]!==le?(ue=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":l,"aria-controls":B,"data-testid":`timeline-entry-expand`,className:U,onClick:N,onKeyDown:W,children:[G,le]}),t[66]=l,t[67]=N,t[68]=B,t[69]=U,t[70]=W,t[71]=G,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==o||t[75]!==a||t[76]!==k||t[77]!==c||t[78]!==n.sha||t[79]!==l?(de=l&&(0,Z.jsx)(Pv,{sha:n.sha,docName:c,cache:o,diffLayout:a,panelId:k}),t[74]=o,t[75]=a,t[76]=k,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]!==F||t[85]!==T?(pe=e=>{e?T(!0):F()},t[84]=F,t[85]=T,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)(xo,{children:me}),t[89]=me,t[90]=he);let ge;t[91]!==v||t[92]!==g||t[93]!==b||t[94]!==m?(ge={relative:m,absoluteTime:v,entrySha:b,authorName:g},t[91]=v,t[92]=g,t[93]=b,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)(bo,{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)(To,{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]===F?xe=t[104]:(xe=(0,Z.jsx)(si,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:F,children:be}),t[103]=F,t[104]=xe);let Se;t[105]===L?Se=t[106]:(Se=()=>L(),t[105]=L,t[106]=Se);let Ce;t[107]===E?Ce=t[108]:(Ce=E?(0,Z.jsx)(Yt,{className:`mr-2 size-4 animate-spin`}):null,t[107]=E,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]!==E||t[111]!==Se||t[112]!==Ce?(Te=(0,Z.jsxs)(si,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:E,onClick:Se,children:[Ce,we]}),t[110]=E,t[111]=Se,t[112]=Ce,t[113]=Te):Te=t[113];let Ee;t[114]!==xe||t[115]!==Te?(Ee=(0,Z.jsxs)(wo,{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)(So,{children:[ye,Ee]}),t[117]=ye,t[118]=Ee,t[119]=De):De=t[119];let Oe;t[120]!==w||t[121]!==pe||t[122]!==De?(Oe=(0,Z.jsx)(Eo,{open:w,onOpenChange:pe,children:De}),t[120]=w,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 Iv(e){return e.docs}function Lv(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:a}=e,{_:o}=i(),{resolvedTheme:c}=vr(),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)(Vv),[v,y]=(0,Q.useState)(Bv),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=U_({baseMs:xv,maxBackoffMs:Sv,isPaused:zv,poll:e=>Cv(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)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsxs)(yo,{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)(_o,{value:`unified`,"aria-label":o({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(zl,{className:`size-3.5`})}),(0,Z.jsx)(_o,{value:`split`,"aria-label":o({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(el,{className:`size-3.5`})})]})}),(0,Z.jsx)(Ds,{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(Rv)}),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)(Fv,{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 Rv(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 zv(){return typeof document<`u`&&document.visibilityState===`hidden`}function Bv(){return new Set}function Vv(){return new pi(32)}var Hv=[{id:`outline`,icon:Cl},{id:`links`,icon:he},{id:`graph`,icon:El},{id:`timeline`,icon:$c}];function Uv(e){return e===`outline`?Ko._({id:`dD7NPy`}):e===`links`?Ko._({id:`Rj01Fz`}):e===`graph`?Ko._({id:`x2fr_j`}):Ko._({id:`cklVjM`})}function Wv(){return n(()=>import(`./GraphPanel-BgmjHl8X.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 Gv=(0,Q.lazy)(async()=>({default:(await Wv()).GraphPanel})),Kv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DYW6IyGe.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,50]),import.meta.url)).ActivityModeContent}));function qv(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=Bh(),p,m,h;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==o||t[4]!==f){let e=f?Hv.filter(Yv):Hv;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)(yo,{type:`single`,variant:`outline`,value:p,onValueChange:e=>{e&&o(e)},"aria-label":l({id:`SrOuyg`}),children:e.map(Jv)})}):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)(vc,{docName:n,isSourceMode:r}),p===`links`&&(0,Z.jsx)(H_,{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)(Gv,{activeDocName:n})}),p===`timeline`&&(0,Z.jsx)(Lv,{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)(Kv,{})})}),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 Jv(e){let{id:t,icon:n}=e,r=Uv(t);return(0,Z.jsxs)(As,{children:[(0,Z.jsx)(_o,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(Ts,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Ds,{side:`bottom`,children:r})]},t)}function Yv(e){return e.id===`outline`}function Xv(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Zv(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Qv(e){return e/100*window.innerHeight}function $v(e){return e/100*window.innerWidth}function ey(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 ty({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=ey(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Zv(t,i);break;case`em`:r=Xv(t,i);break;case`vh`:r=Qv(i);break;case`vw`:r=$v(i);break}return r}function ny(e){return parseFloat(e.toFixed(3))}function ry({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 iy(e){let{panels:t}=e,n=ry({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=ny(ty({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=ny(ty({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=ny(ty({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=ny(ty({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 ay(e,t=`Assertion error`){if(!e)throw Error(t)}function oy(e,t){return Array.from(t).sort(e===`horizontal`?sy:cy)}function sy(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function cy(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function ly(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function uy(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 dy({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}=uy(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return ay(i,`No rect found`),i}var fy;function py(){return fy===void 0&&(fy=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),fy}function my(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=oy(n,Array.from(t.children).filter(ly).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,dy({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=py()?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:ry({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 hy=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)}}},gy=new Map,_y=new hy;function vy(e){gy=new Map(gy),gy.delete(e)}function yy(e,t){for(let[t]of gy)if(t.id===e)return t}function by(e,t){for(let[t,n]of gy)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function xy(){return gy}function Sy(e,t){return _y.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Cy(e,t){let n=gy.get(e);gy=new Map(gy),gy.set(e,t),_y.emit(`groupChange`,{group:e,prev:n,next:t})}function wy(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=uy(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 Ty(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ey(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:My(e),b:My(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();ay(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:jy(Ay(n.a)),b:jy(Ay(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 Dy=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Oy(e){let t=getComputedStyle(Ny(e)??e).display;return t===`flex`||t===`inline-flex`}function ky(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Oy(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`||Dy.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Ay(e){let t=e.length;for(;t--;){let n=e[t];if(ay(n,`Missing node`),ky(n))return n}return null}function jy(e){return e&&Number(getComputedStyle(e).zIndex)||0}function My(e){let t=[];for(;e;)t.push(e),e=Ny(e);return t}function Ny(e){let{parentNode:t}=e;return Ty(t)?t.host:t}function Py(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 Fy({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!ly(n)||n.contains(e)||e.contains(n))return!0;if(Ey(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Py(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Iy(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=my(r),a=wy(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Fy({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Ly(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 Ry(e,t,n=0){return Math.abs(ny(e)-ny(t))<=n}function zy(e,t){return Ry(e,t)?0:e>t?1:-1}function By({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(zy(r,c)<0)if(a){let e=(i+c)/2;r=zy(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=ny(r),r}function Vy({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ry(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;ay(u!=null,`Invalid first pivot index`),ay(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];ay(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(ay(n!=null,`Previous layout not found for panel index ${t}`),Ry(n,i)){let t=o-n;zy(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];ay(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(ay(n!=null,`Previous layout not found for panel index ${t}`),Ry(n,o)){let t=n-i;zy(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];ay(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&zy(i,c)<0)if(e>0){let t=c-o,n=t/2;zy(i+e,c)<0&&(e=zy(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;zy(i-e,c)<0&&(e=zy(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];ay(e!=null,`Previous layout not found for panel index ${r}`);let a=By({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];ay(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=By({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Ry(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(Ly(c,l))return i;{let t=e<0?d:u,r=s[t];ay(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=By({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Ry(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];ay(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=By({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Ry(i,s)||(t-=s-i,l[r]=s),Ry(t,0))break;e>0?r--:r++}}}if(!Ry(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 Hy(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||zy(e[n],t[n])!==0)return!1;return!0}function Uy({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(!Ry(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];ay(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];ay(i!=null,`No layout data found for index ${e}`);let o=r[e];ay(o!=null,`No layout data found for index ${e}`);let s=By({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Ry(a,0))for(let e=0;e<t.length;e++){let n=r[e];ay(n!=null,`No layout data found for index ${e}`);let i=n+a,o=By({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Ry(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Wy({groupId:e,panelId:t}){let n=()=>{let t=xy();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=Uy({layout:Vy({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});Hy(l,p)||Cy(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&&Ry(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=ry({group:t});o(ny(ty({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Gy(e){e.defaultPrevented||Iy(e,xy()).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=Wy({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Ky(e){let t=xy();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 qy({groupId:e}){let t=()=>{let t=xy();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=Uy({layout:e,panelConstraints:r});return n?o:(Hy(o,c)||Cy(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Jy(e,t){let n=Ky(e),r=by(n.id,!0),i=n.separators.find(t=>t.element===e);ay(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);ay(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=qy({groupId:n.id}).getLayout(),c=Uy({layout:Vy({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Hy(s,c)||Cy(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Yy(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Ky(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Jy(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Jy(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Jy(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Jy(t,-5);break;case`End`:e.preventDefault(),Jy(t,100);break;case`Enter`:{e.preventDefault();let n=Ky(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=by(n.id,!0),o=n.separators.find(e=>e.element===t);ay(o,`Matching separator not found`);let s=a.get(o);ay(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(ay(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Jy(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Ky(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);ay(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(),Jy(t,-100);break}}var Xy={cursorFlags:0,state:`inactive`},Zy=new hy;function Qy(){return Xy}function $y(e){return Zy.addListener(`change`,e)}function eb(e){let t=Xy,n={...Xy};n.cursorFlags=e,Xy=n,Zy.emit(`change`,{prev:t,next:n})}function tb(e){let t=Xy;Xy=e,Zy.emit(`change`,{prev:t,next:e})}function nb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=xy(),n=Iy(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)}),tb({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var rb=e=>e,ib=()=>{},ab=1,ob=2,sb=4,cb=8,lb=3,ub=12,db;function fb(){return db===void 0&&(db=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(db=!0)),db}function pb({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&&fb()){let t=(e&ab)!==0,n=(e&ob)!==0,r=(e&sb)!==0,i=(e&cb)!==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 fb()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var mb=new WeakMap;function hb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=mb.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Qy();switch(r.state){case`active`:case`hover`:{let e=pb({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}mb.set(e,{prevStyle:t,styleSheet:n})}function gb({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=Vy({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Hy(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?ab:ob;break;case`vertical`:s|=d<0?sb:cb;break}}else Cy(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&lb:c|=s&lb,t.movementY===0?c|=o&ub:c|=s&ub,eb(c),hb(e)}function _b(e){let t=xy(),n=Qy();switch(n.state){case`active`:gb({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function vb(e){if(e.defaultPrevented)return;let t=Qy(),n=xy();switch(t.state){case`active`:if(e.buttons===0){tb({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=by(e.group.id,!0);Cy(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)}gb({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Iy(e,n);r.length===0?t.state!==`inactive`&&tb({cursorFlags:0,state:`inactive`}):tb({cursorFlags:0,hitRegions:r,state:`hover`}),hb(e.currentTarget);break}}}function yb(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Qy().state){case`hover`:tb({cursorFlags:0,state:`inactive`})}}function bb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Qy();switch(t.state){case`active`:tb({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(hb(e.currentTarget),t.hitRegions.forEach(e=>{let t=by(e.group.id,!0);Cy(e.group,t)}),e.preventDefault())}}function xb(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=ny(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=ny((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Sb(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=ry({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:ny(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Cb(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 wb({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=ny(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]=ny((r[e]??0)/a*l);else{let e=ny(l/c.length);for(let t of c)u[t]=e}return u}function Tb(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 Eb=new Map;function Db(e){let t=!0;ay(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=ry({group:e});if(t===0)return;let n=by(e.id);if(!n)return;let r=iy(e),i=n.defaultLayoutDeferred?xb(r):n.layout,a=Uy({layout:wb({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Hy(n.layout,a)&&Cb(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Cy(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Sb(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{ay(!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=ry({group:e}),s=iy(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Tb(e.panels,l)||(l=void 0));let u=Uy({layout:e.mutableState.layouts[c]??l??xb(s),panelConstraints:s}),d=e.element.ownerDocument;Eb.set(d,(Eb.get(d)??0)+1);let f=new Map;return my(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Cy(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{ay(!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`,Yy)}),Eb.get(d)===1&&(d.addEventListener(`dblclick`,Gy,!0),d.addEventListener(`pointerdown`,nb,!0),d.addEventListener(`pointerleave`,_b),d.addEventListener(`pointermove`,vb),d.addEventListener(`pointerout`,yb),d.addEventListener(`pointerup`,bb,!0)),function(){t=!1,Eb.set(d,Math.max(0,(Eb.get(d)??0)-1)),vy(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Yy)}),Eb.get(d)||(d.removeEventListener(`dblclick`,Gy,!0),d.removeEventListener(`pointerdown`,nb,!0),d.removeEventListener(`pointerleave`,_b),d.removeEventListener(`pointermove`,vb),d.removeEventListener(`pointerout`,yb),d.removeEventListener(`pointerup`,bb,!0)),a.disconnect()}}function Ob(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function kb(e){let t=(0,Q.useId)();return`${e??t}`}var Ab=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function jb(e){let t=(0,Q.useRef)(e);return Ab(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Mb(...e){return jb(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Nb(e){let t=(0,Q.useRef)({...e});return Ab(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Pb=(0,Q.createContext)(null);function Fb(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:rb});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Ab(()=>{Object.assign(n.current,qy({groupId:e}))})}function Ib({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=jb(e=>{Hy(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=jb(e=>{Hy(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=kb(s),v=(0,Q.useRef)(null),[y,b]=Ob(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Mb(v,a);Fb(_,o);let C=jb((e,t)=>{let r=Qy(),i=yy(e),a=by(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=Nb({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=oy(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=oy(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=yy(_),i=by(_);r&&i&&Cy(r,{...i,derivedPanelConstraints:iy(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 Ab(()=>{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=Db(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=by(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Sy(_,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=Ry(t.collapsedSize,i[t.panelId]),a=Ry(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Qy().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)(Pb.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})})}Ib.displayName=`Group`;function Lb(){let e=(0,Q.useContext)(Pb);return ay(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Rb(e,t){let{id:n}=Lb(),r=(0,Q.useRef)({collapse:ib,expand:ib,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ib});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Ab(()=>{Object.assign(r.current,Wy({groupId:n,panelId:e}))})}function zb({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=kb(c),_=Nb({disabled:a}),v=(0,Q.useRef)(null),y=Mb(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Lb(),T=d!==null,E=jb((e,t,n)=>{d?.(e,c,n)});Ab(()=>{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]),Rb(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Sy(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:{...Bb,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})})}zb.displayName=`Panel`;var Bb={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Vb(){return(0,Q.useRef)(null)}function Hb({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=Uy({layout:Vy({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Uy({layout:Vy({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Ub({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=kb(a),l=Nb({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=Mb(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Lb(),x=v===`horizontal`?`vertical`:`horizontal`;Ab(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=$y(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Sy(_,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(Hb({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})}Ub.displayName=`Separator`;var Wb=new Map;function Gb(e){let t=Wb.get(e);if(t)return t;let n=Kb(e);return Wb.set(e,n),n}async function Kb(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist--WFXzgaP.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--WFXzgaP.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--WFXzgaP.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--WFXzgaP.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-B5LD73X3.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--WFXzgaP.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--WFXzgaP.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--WFXzgaP.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--WFXzgaP.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-De7_06z9.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-ChSeukn9.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--WFXzgaP.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--WFXzgaP.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-0kDsAKH1.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--WFXzgaP.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--WFXzgaP.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-CLIXxF0N.js`);return{python:e}},__vite__mapDeps([51,43,39,1,23,40]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist--WFXzgaP.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--WFXzgaP.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-D2xbbdaz2.js`);return{rust:e}},__vite__mapDeps([52,39,1,23,40]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist--WFXzgaP.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--WFXzgaP.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-De7_06z9.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-DZpmpDA6.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-C7u3xI_X.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 qb(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-ChSeukn9.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 Gb(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist--WFXzgaP.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 Jb=ee({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Yb=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Xb(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 Zb(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}=vr(),l=Xb(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=or(e),n=c===`dark`?Jb:Yb,r=!1,s=null;return qb(e,t).then(e=>{if(r||!a.current)return;let t=[Ec,...e?[e]:[],cc.editable.of(!0),Qs.readOnly.of(!0),cc.lineWrapping,n];s=new cc({state:Qs.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 Qb(e){return Gr(`/api/asset?path=${encodeURIComponent(e)}`)}function $b(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function ex(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=Qb(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)(re,{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=$b(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(Zb,{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)(We,{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)(si,{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)(si,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{tt({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 tx(){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 nx(e){let{_:t}=i();return e===`existing-repo`?[{id:`draft-spec`,icon:ol,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Cl,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:El,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:Zl,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:ol,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:Gc,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function rx(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:a}=i(),o=nx(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){ka(t).then(()=>{c(e),clearTimeout(l.current),l.current=setTimeout(()=>c(null),1600)}).catch(ix)};t[8]===r?f=t[9]:(f=ai(`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)(si,{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:ai(`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)(Do,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(Et,{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 ix(){}var ax={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function ox(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}=vr(),s=ax[r],c=s?(o===`dark`?Ir[s]:void 0)??Kr[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=ai(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)(di,{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)(ui,{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)(_i,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function sx(e){let{installState:t}=e;return t.installed===null?Ko._({id:`IA6JW2`}):t.installed===!1?Ko._({id:`5SwVv1`}):null}function cx(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:Ko._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:Ko._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl}}}}return{enabled:!0,tooltip:null}}function lx(e){let t=(0,$.c)(66),{_:n}=i(),{target:r,installState:a,isElectronHost:o,onSelect:s}=e,c=e.openExternal??pg,{displayName:l}=r,u;t[0]!==a||t[1]!==o||t[2]!==r?(u=cx({target:r,installState:a,isElectronHost:o}),t[0]=a,t[1]=o,t[2]=r,t[3]=u):u=t[3];let d=u,f,p,m,h;if(t[4]!==n||t[5]!==a||t[6]!==o||t[7]!==s||t[8]!==c||t[9]!==d.enabled||t[10]!==d.tooltip||t[11]!==r||t[12]!==l){h=Symbol.for(`react.early_return_sentinel`);bb0:{p=sx({target:r,installState:a,isElectronHost:o});let e;if(t[17]!==c||t[18]!==d.tooltip?(e=()=>{d.tooltip&&c(d.tooltip.installAction.url)},t[17]=c,t[18]=d.tooltip,t[19]=e):e=t[19],f=e,d.enabled){let e=`open-in-agent-item-${r.id}`,i;t[20]!==n||t[21]!==l?(i=n({id:`NnQapF`,values:{targetDisplayName:l}}),t[20]=n,t[21]=l,t[22]=i):i=t[22];let a;t[23]===r.id?a=t[24]:(a=(0,Z.jsx)(ox,{id:r.id,"aria-hidden":`true`}),t[23]=r.id,t[24]=a);let o;t[25]===r.displayName?o=t[26]:(o=(0,Z.jsx)(`span`,{children:r.displayName}),t[25]=r.displayName,t[26]=o);let c;t[27]!==s||t[28]!==e||t[29]!==i||t[30]!==a||t[31]!==o?(c=(0,Z.jsxs)(Fa,{onSelect:s,"data-testid":e,"aria-label":i,children:[a,o]}),t[27]=s,t[28]=e,t[29]=i,t[30]=a,t[31]=o,t[32]=c):c=t[32],h=c;break bb0}if(!d.tooltip){let e=n(p?{id:`If0crP`,values:{targetDisplayName:l,hint:p}}:{id:`NnQapF`,values:{targetDisplayName:l}}),i;t[33]===r.id?i=t[34]:(i=(0,Z.jsx)(ox,{id:r.id,"aria-hidden":`true`}),t[33]=r.id,t[34]=i);let a;t[35]===r.displayName?a=t[36]:(a=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[35]=r.displayName,t[36]=a),h=(0,Z.jsxs)(Fa,{disabled:!0,"data-testid":`open-in-agent-item-${r.id}`,"aria-label":e,children:[i,a,p?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null]});break bb0}m=n(p?{id:`If0crP`,values:{targetDisplayName:l,hint:p}}:{id:`NnQapF`,values:{targetDisplayName:l}})}t[4]=n,t[5]=a,t[6]=o,t[7]=s,t[8]=c,t[9]=d.enabled,t[10]=d.tooltip,t[11]=r,t[12]=l,t[13]=f,t[14]=p,t[15]=m,t[16]=h}else f=t[13],p=t[14],m=t[15],h=t[16];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g=m,_=`open-in-agent-item-${r.id}`,v;t[37]===r.id?v=t[38]:(v=(0,Z.jsx)(ox,{id:r.id,"aria-hidden":`true`,className:`mr-2`}),t[37]=r.id,t[38]=v);let y;t[39]===r.displayName?y=t[40]:(y=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[39]=r.displayName,t[40]=y);let b;t[41]===p?b=t[42]:(b=p?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[41]=p,t[42]=b);let x;t[43]!==g||t[44]!==_||t[45]!==v||t[46]!==y||t[47]!==b?(x=(0,Z.jsxs)(Ba,{"data-testid":_,"data-row-disabled":``,"aria-label":g,children:[v,y,b]}),t[43]=g,t[44]=_,t[45]=v,t[46]=y,t[47]=b,t[48]=x):x=t[48];let S=`open-in-agent-submenu-${r.id}`,C=`open-in-agent-message-${r.id}`,w;t[49]!==d.tooltip.message||t[50]!==C?(w=(0,Z.jsx)(Ta,{className:`font-normal text-muted-foreground text-xs`,"data-testid":C,children:d.tooltip.message}),t[49]=d.tooltip.message,t[50]=C,t[51]=w):w=t[51];let T;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Ka,{}),t[52]=T):T=t[52];let E=`open-in-agent-install-${r.id}`,D;t[53]===d.tooltip.installAction.label?D=t[54]:(D=(0,Z.jsx)(`span`,{children:d.tooltip.installAction.label}),t[53]=d.tooltip.installAction.label,t[54]=D);let O;t[55]!==f||t[56]!==E||t[57]!==D?(O=(0,Z.jsx)(Fa,{onSelect:f,"data-testid":E,children:D}),t[55]=f,t[56]=E,t[57]=D,t[58]=O):O=t[58];let k;t[59]!==w||t[60]!==O||t[61]!==S?(k=(0,Z.jsxs)(Oa,{className:`min-w-[260px]`,"data-testid":S,children:[w,T,O]}),t[59]=w,t[60]=O,t[61]=S,t[62]=k):k=t[62];let A;return t[63]!==k||t[64]!==x?(A=(0,Z.jsxs)(eo,{children:[x,k]}),t[63]=k,t[64]=x,t[65]=A):A=t[65],A}var ux=ri(`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 dx(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=ai(ux({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 fx=`ok-preferred-agent-v1`,px=new Set(Fh.map(e=>e.id));function mx(e){return typeof e==`string`&&px.has(e)}function hx(e){try{let t=(e??localStorage).getItem(fx);return mx(t)?t:null}catch{return null}}function gx(e,t){try{(t??localStorage).setItem(fx,e)}catch{}}function _x(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:Fh.find(e=>n[e.id]?.installed===!0)?.id??null}function vx(e){let t=(0,$.c)(58),{scenario:n,className:r}=e,{_:a}=i(),{states:o,refresh:c}=Kg(),{dispatch:l}=Fg(),u=po(),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(bx),h=(0,Q.useRef)(!1),g=(0,Q.useRef)(null),_=nx(n),v;t[0]===o?v=t[1]:(v=e=>o[e.id]?.installed===!0,t[0]=o,t[1]=v);let y=Fh.filter(v),b;t[2]===o?b=t[3]:(b=Fh.every(e=>o[e.id]?.installed!=null),t[2]=o,t[3]=b);let x=b,S=x&&y.length===0,C,w;t[4]!==x||t[5]!==o?(C=()=>{if(!x||h.current)return;let e=_x({lastUsed:hx(),states:o});m(t=>e===t?t:e)},w=[x,o],t[4]=x,t[5]=o,t[6]=C,t[7]=w):(C=t[6],w=t[7]),(0,Q.useEffect)(C,w);let T=function(e){h.current=!0,m(e),gx(e)},E;t[8]!==d||t[9]!==l||t[10]!==n||t[11]!==u?(E=function(e){let t=d.trim();gx(e);let r=bg({workspace:u,description:t,scenario:n});r!==null&&l(e,r)},t[8]=d,t[9]=l,t[10]=n,t[11]=u,t[12]=E):E=t[12];let D=E,O;t[13]!==D||t[14]!==p?(O=function(e){(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),p!==null&&D(p))},t[13]=D,t[14]=p,t[15]=O):O=t[15];let k=O,A,j,M,N,P,F;if(t[16]!==a||t[17]!==r||t[18]!==d||t[19]!==k||t[20]!==S||t[21]!==_){M=Symbol.for(`react.early_return_sentinel`);bb0:{let e=function(e){f(e),g.current?.focus()};if(S){let e;t[28]===r?e=t[29]:(e=ai(`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[28]=r,t[29]=e);let n;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(vi,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[30]=n):n=t[30];let i;t[31]===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[31]=i):i=t[31];let a;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:Fh.map(yx)}),t[32]=a):a=t[32];let o;t[33]===e?o=t[34]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[33]=e,t[34]=o),M=o;break bb0}t[35]===r?A=t[36]:(A=ai(`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`,r),t[35]=r,t[36]=A);let n;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(n=e=>f(e.target.value),t[37]=n):n=t[37];let i;t[38]===a?i=t[39]:(i=a({id:`0jD-Gn`}),t[38]=a,t[39]=i);let o;t[40]===a?o=t[41]:(o=a({id:`7hctf2`}),t[40]=a,t[41]=o),t[42]!==d||t[43]!==k||t[44]!==i||t[45]!==o?(j=(0,Z.jsx)(Rs,{ref:g,value:d,onChange:n,onKeyDown:k,rows:4,placeholder:i,"aria-label":o,className:`min-h-[112px] 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`}),t[42]=d,t[43]=k,t[44]=i,t[45]=o,t[46]=j):j=t[46],F=`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,N=`flex min-w-0 flex-wrap items-center gap-2`,P=_.map(t=>{let n=t.icon;return(0,Z.jsxs)(si,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${t.id}`,children:[(0,Z.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),t.label]},t.id)})}t[16]=a,t[17]=r,t[18]=d,t[19]=k,t[20]=S,t[21]=_,t[22]=A,t[23]=j,t[24]=M,t[25]=N,t[26]=P,t[27]=F}else A=t[22],j=t[23],M=t[24],N=t[25],P=t[26],F=t[27];if(M!==Symbol.for(`react.early_return_sentinel`))return M;let I;t[47]!==N||t[48]!==P?(I=(0,Z.jsx)(`div`,{className:N,children:P}),t[47]=N,t[48]=P,t[49]=I):I=t[49];let L=p===null?(0,Z.jsx)(si,{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)(dx,{children:[(0,Z.jsxs)(si,{type:`button`,onClick:()=>D(p),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:[(0,Z.jsx)(ox,{id:p,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`9dw5bW`,values:{0:Mg(p)}})]}),(0,Z.jsxs)(ro,{onOpenChange:e=>{e&&c()},children:[(0,Z.jsx)(ao,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,"aria-label":a({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(It,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsx)($a,{align:`end`,className:`min-w-[200px]`,children:y.map(e=>(0,Z.jsxs)(Fa,{onSelect:()=>T(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(ox,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),e.id===p?(0,Z.jsx)(Do,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))})]})]}),R;t[50]!==I||t[51]!==L||t[52]!==F?(R=(0,Z.jsxs)(`div`,{className:F,children:[I,L]}),t[50]=I,t[51]=L,t[52]=F,t[53]=R):R=t[53];let z;return t[54]!==A||t[55]!==j||t[56]!==R?(z=(0,Z.jsxs)(`div`,{className:A,children:[j,R]}),t[54]=A,t[55]=j,t[56]=R,t[57]=z):z=t[57],z}function yx(e){return(0,Z.jsxs)(si,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void xg(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(ox,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(go,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function bx(){return hx()}var xx=3100,Sx=3;function Cx(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Sx;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var wx={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}},Tx=[`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 Ex(e,t={}){let n=t.rng??Math.random,r=t.colors??Tx,i=wx[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 Dx=1.8,Ox=90,kx=16,Ax=380,jx=.025,Mx=.1,Nx=.18,Px=400,Fx=9.2736,Ix=18.1799,Lx=14.5244,Rx={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function zx(e,t){let{halfWidth:n,apexLift:r}=Rx[t];return`M${e-n} ${Lx+.3} Q${e} ${Lx-r}, ${e+n} ${Lx+.3}`}function Bx(e){let t=1.5,n=.3;return`M${e-t} ${Lx-n} Q${e} ${Lx+1.4}, ${e+t} ${Lx-n}`}var Vx=15,Hx=15;function Ux(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 Wx(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=Cx(g,t);_(n),y(Jx),S(Ex(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},xx)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(qx),S(Ex(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},xx))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/Ax)),C=Math.max(-1,Math.min(1,b/Ax)),w=S*kx,T=-C*kx,E=0,D=0;if(x>=1){let e=Math.min(x/Ox,1)*Dx;E=y/x*e,D=b/x*e}let O=Math.abs(T-r)<.01&&Math.abs(w-i)<.01&&Math.abs(E-a)<.01&&Math.abs(D-o)<.01;if(!m&&O)return;l(),r+=(T-r)*Mx,i+=(w-i)*Mx,u.style.transform=`perspective(${Px}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*Nx,o+=(D-o)*Nx;let k=i*jx,A=-r*jx,j=a+k,M=o+A;h.current.x=j,h.current.y=M,p.current?.setAttribute(`transform`,`translate(${j.toFixed(3)} ${M.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=ai(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=ai(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=ai(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:Fx,cy:Lx,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let q=(F||T)&&`ok-blob-eye-hidden`,J;t[26]===q?J=t[27]:(J=ai(`ok-blob-eye ok-blob-eye-right`,q),t[26]=q,t[27]=J);let Y;t[28]===J?Y=t[29]:(Y=(0,Z.jsx)(`ellipse`,{cx:Ix,cy:Lx,rx:1.2722,ry:1.9083,className:J}),t[28]=J,t[29]=Y);let ee;t[30]===I?ee=t[31]:(ee=zx(Fx,I),t[30]=I,t[31]=ee);let te=(!F||T)&&`ok-blob-eye-hidden`,ne;t[32]===te?ne=t[33]:(ne=ai(`ok-blob-happy-eye`,te),t[32]=te,t[33]=ne);let re;t[34]!==ee||t[35]!==ne?(re=(0,Z.jsx)(`path`,{d:ee,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ne}),t[34]=ee,t[35]=ne,t[36]=re):re=t[36];let ie;t[37]===I?ie=t[38]:(ie=zx(Ix,I),t[37]=I,t[38]=ie);let ae=(!F||T)&&`ok-blob-eye-hidden`,oe;t[39]===ae?oe=t[40]:(oe=ai(`ok-blob-happy-eye`,ae),t[39]=ae,t[40]=oe);let se;t[41]!==ie||t[42]!==oe?(se=(0,Z.jsx)(`path`,{d:ie,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:oe}),t[41]=ie,t[42]=oe,t[43]=se):se=t[43];let ce;t[44]===T?ce=t[45]:(ce=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:Bx(Fx),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:Bx(Ix),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ce);let le;t[46]!==K||t[47]!==Y||t[48]!==re||t[49]!==se||t[50]!==ce?(le=(0,Z.jsxs)(`g`,{ref:p,children:[K,Y,re,se,ce]}),t[46]=K,t[47]=Y,t[48]=re,t[49]=se,t[50]=ce,t[51]=le):le=t[51];let ue;t[52]!==B||t[53]!==H||t[54]!==le?(ue=(0,Z.jsxs)(`g`,{className:H,children:[U,le]},B),t[52]=B,t[53]=H,t[54]=le,t[55]=ue):ue=t[55];let de;t[56]===T?de=t[57]:(de=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=de);let fe;t[58]!==v||t[59]!==x?(fe=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(Gx)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=fe):fe=t[60];let pe;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==ue||t[65]!==de||t[66]!==fe?(pe=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:Kx,children:[ue,de,fe]}),t[61]=D,t[62]=s,t[63]=z,t[64]=ue,t[65]=de,t[66]=fe,t[67]=pe):pe=t[67];let me;return t[68]!==R||t[69]!==pe?(me=(0,Z.jsx)(`span`,{ref:d,className:R,children:pe}),t[68]=R,t[69]=pe,t[70]=me):me=t[70],me}function Gx(e){return(0,Z.jsx)(`circle`,{cx:Vx+e.originDx,cy:Hx+e.originDy,r:e.size,className:`ok-blob-firework`,style:Ux(e)},e.id)}function Kx(e){return e.preventDefault()}function qx(e){return e+1}function Jx(e){return e+1}function Yx(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(Wx,{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 Xx=`open-knowledge:create-top-level-file`;function Zx(e={}){window.dispatchEvent(new CustomEvent(Xx,{detail:e}))}function Qx(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(Xx,t),()=>window.removeEventListener(Xx,t)}function $x(e){let t=(0,$.c)(32),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o=Mh(),c=Mi(),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)(Yx,{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)(rx,{scenario:`existing-repo`}):(0,Z.jsx)(vx,{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)(nS,{templates:u,loading:d,error:f,onSelect:tS}):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)(M,{"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)(si,{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)(si,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:eS,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Ga,{"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:`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-10 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 eS(){return Zx({initialDir:``})}function tS(e,t){return Zx({template:{folder:e,name:t}})}function nS(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)(at,{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)(rS,{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 rS(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)(si,{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 iS(){let e=(0,$.c)(14),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(void 0),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(0),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(void 0),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(cS);if(e)return;let r=t.ok?Or.safeParse(n):null;r?.success?(o(lS(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=Xo(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(u.current)}},f=[],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(){clearTimeout(u.current),u.current=setTimeout(()=>c(sS),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(oS);if(!e.ok)return;let n=Or.safeParse(t);n.success&&o(lS(n.data.documents))}).catch(aS)},e[2]=p):p=e[2];let m=p,h=a!==null,g=a===0,_;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){n(e),e||i(void 0)},e[3]=_):_=e[3];let v=_,y;e[4]!==s||e[5]!==g||e[6]!==h?(y=h?g?(0,Z.jsx)(uS,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)($x,{celebrateSignal:s,onAddStarterPack:()=>{n(!0)}}):null,e[4]=s,e[5]=g,e[6]=h,e[7]=y):y=e[7];let b;e[8]!==r||e[9]!==t?(b=(0,Z.jsx)(Dh,{open:t,onOpenChange:v,onSeedApplied:m,initialPackId:r}),e[8]=r,e[9]=t,e[10]=b):b=e[10];let x;return e[11]!==y||e[12]!==b?(x=(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:[y,b]}),e[11]=y,e[12]=b,e[13]=x):x=e[13],x}function aS(){}function oS(){return null}function sS(e){return e+1}function cS(){return null}function lS(e){return qo(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function uS(e){let t=(0,$.c)(26),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o=Mh(),c;t[0]===a?c=t[1]:(c=a({id:`6h4zVU`}),t[0]=a,t[1]=c);let l;t[2]!==a||t[3]!==o?(l=a(o?{id:`vGeNNQ`}:{id:`qpQwGC`}),t[2]=a,t[3]=o,t[4]=l):l=t[4];let u;t[5]!==n||t[6]!==c||t[7]!==l?(u=(0,Z.jsx)(Yx,{title:c,subtitle:l,celebrateSignal:n}),t[5]=n,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===o?d=t[10]:(d=o?(0,Z.jsx)(rx,{scenario:`new-project`}):(0,Z.jsx)(vx,{scenario:`new-project`}),t[9]=o,t[10]=d);let f;t[11]!==a||t[12]!==o?(f=a(o?{id:`GubkSu`}:{id:`xeXS4P`}),t[11]=a,t[12]=o,t[13]=f):f=t[13];let p;t[14]===f?p=t[15]:(p=(0,Z.jsx)(fS,{label:f}),t[14]=f,t[15]=p);let m;t[16]===r?m=t[17]:(m=(0,Z.jsx)(xh,{onPackSelect:r}),t[16]=r,t[17]=m);let h;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(si,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:dS,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Ga,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=h):h=t[18];let g;t[19]!==p||t[20]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[p,m,h]}),t[19]=p,t[20]=m,t[21]=g):g=t[21];let _;return t[22]!==u||t[23]!==d||t[24]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[u,d,g]}),t[22]=u,t[23]=d,t[24]=g,t[25]=_):_=t[25],_}function dS(){return Zx()}function fS(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 pS(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function mS(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)(gS,{}),(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=pS(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 Zi(n,{[e]:t});if(!r.ok){let{error:e}=r;X.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 Zi(n,{[e]:null});if(!t.ok){let{error:e}=t;X.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,aa(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):qi[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,N;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){d(t=>t&&{...t,name:e,error:null})},t[23]=N):N=t[23];let P=N,F;t[24]!==o||t[25]!==u||t[26]!==n||t[27]!==a||t[28]!==h?(F=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(Yn(u.value)){d({...u,error:o({id:`hXUWyd`})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}let t=await Zi(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[24]=o,t[25]=u,t[26]=n,t[27]=a,t[28]=h,t[29]=F):F=t[29];let I=F,L;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){p({key:e,draft:e,error:null})},t[30]=L):L=t[30];let R=L,z;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){p(t=>t&&{...t,draft:e,error:null})},t[31]=z):z=t[31];let B=z,V;t[32]!==o||t[33]!==n||t[34]!==a||t[35]!==h||t[36]!==f?(V=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 Zi(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]=V):V=t[37];let H=V,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)(jo,{className:q,"aria-hidden":!0}),t[40]=q,t[41]=J);let Y;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[42]=Y):Y=t[42];let ee;t[43]===J?ee=t[44]:(ee=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[J,Y]}),t[43]=J,t[44]=ee);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:hS,children:_}),t[45]=_,t[46]=te);let ne;t[47]!==ee||t[48]!==te?(ne=(0,Z.jsxs)(Mo,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[ee,te]}),t[47]=ee,t[48]=te,t[49]=ne):ne=t[49];let re;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`hSBIG-`})}),t[50]=re):re=t[50];let ie;t[51]!==u||t[52]!==x||t[53]!==H||t[54]!==y||t[55]!==h||t[56]!==C||t[57]!==f||t[58]!==T?(ie=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)(Fi,{keyName:e,value:t,declared:mo(t,An(t)),rename:{state:f?.key===e?f:null,onBegin:()=>R(e),onChangeDraft:B,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]=ie):ie=t[59];let ae;t[60]!==u||t[61]!==I?(ae=u?(0,Z.jsx)(ta,{draft:u,onChangeName:P,onChangeType:k,onChangeValue:j,onCommit:()=>void I(),onCancel:()=>d(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(si,{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)(M,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`G8t9NN`})})]})}),t[60]=u,t[61]=I,t[62]=ae):ae=t[62];let oe;t[63]!==ie||t[64]!==ae?(oe=(0,Z.jsx)(Ao,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[re,ie,ae]})}),t[63]=ie,t[64]=ae,t[65]=oe):oe=t[65];let se;return t[66]!==G||t[67]!==ne||t[68]!==oe?(se=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(No,{open:G,onOpenChange:K,children:[ne,oe]})}),t[66]=G,t[67]=ne,t[68]=oe,t[69]=se):se=t[69],se}function hS(e){return e.stopPropagation()}function gS(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(dl,{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 _S(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?Ko._({id:`xOTzt5`}):t<3600?Ko._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?Ko._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?Ko._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function vS(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function yS(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:Qa,label:Ko._({id:`QR5SP1`}),detail:vS(i)};case`template-edit`:return{Icon:V,label:Ko._({id:`-LHLx7`}),detail:vS(i)};case`template-delete`:return{Icon:fs,label:Ko._({id:`_gkGSK`}),detail:vS(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:Uc,label:Ko._({id:`KPW5WC`}),detail:`${vS(e??``)} → ${vS(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:dl,label:Ko._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:dl,label:Ko._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:dl,label:Ko._({id:`ZQLDTl`}),detail:``};default:return{Icon:_l,label:r.replace(/-/g,` `),detail:vS(i)}}}function bS(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?Ko._({id:`B2DrPb`}):e.author||Ko._({id:`Ef7StM`})}function xS(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=cs(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)(at,{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(SS)})}),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 SS(e){let{Icon:t,label:n,detail:r}=yS(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)(iu,{className:`size-3`,"aria-hidden":!0}),bS(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:_S(e.timestamp)})]},e.sha)}function CS(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function wS(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=CS(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function TS(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function ES(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:wS(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:TS(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:wS(e,t.pageTitles),children:a}}function DS(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)(at,{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)(si,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(M,{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)($i,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Vi,{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)(Ra,{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)(Ti,{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(OS)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(Yi,{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,N;t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j?(N=(0,Z.jsx)(ih,{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]=N):N=t[37];let P;return t[38]!==E||t[39]!==O||t[40]!==N||t[41]!==S||t[42]!==w?(P=(0,Z.jsxs)(Z.Fragment,{children:[S,w,E,O,N]}),t[38]=E,t[39]=O,t[40]=N,t[41]=S,t[42]=w,t[43]=P):P=t[43],P}function OS(e){return e.name}function kS(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=ai(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=ai(`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 AS(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=ai(`[&_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 jS(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=ai(`[&_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 MS(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=ai(`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 NS(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=ai(`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 PS(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=ai(`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 FS(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Ko._({id:`xOTzt5`});if(r<60)return Ko._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Ko._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Ko._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function IS(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 LS(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)(yt,{className:`ml-1 size-3`}):(0,Z.jsx)(dt,{className:`ml-1 size-3`}):(0,Z.jsx)(Wc,{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)(si,{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 RS(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=es(),d=ea(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(VS)]})]}),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=ES(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=IS(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(BS):(_(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 N;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(ke,{className:`size-5 text-muted-foreground`}),t[31]=N):N=t[31];let P=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[N,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:o})]}),F;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(si,{onClick:()=>h(!0),children:[(0,Z.jsx)(M,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[32]=F):F=t[32],t[33]===P?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:[P,F]})}),t[33]=P,t[34]=E),t[35]!==f||t[36]!==n||t[37]!==p?(D=(0,Z.jsx)(mS,{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)(DS,{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)(xS,{folderPath:n}),t[44]=n,t[45]=k),w=`rounded-lg border`,x=kS;let I=g===`name`?v===`asc`?`ascending`:`descending`:`none`,L;t[46]===r?L=t[47]:(L=r({id:`6YtxFj`}),t[46]=r,t[47]=L);let R;t[48]!==j||t[49]!==v||t[50]!==g||t[51]!==L?(R=(0,Z.jsx)(LS,{label:L,sortKey:`name`,activeKey:g,activeDir:v,onSort:j}),t[48]=j,t[49]=v,t[50]=g,t[51]=L,t[52]=R):R=t[52];let z;t[53]!==I||t[54]!==R?(z=(0,Z.jsx)(NS,{"aria-sort":I,children:R}),t[53]=I,t[54]=R,t[55]=z):z=t[55];let B=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,V;t[56]===r?V=t[57]:(V=r({id:`tgWuMB`}),t[56]=r,t[57]=V);let H;t[58]!==j||t[59]!==v||t[60]!==g||t[61]!==V?(H=(0,Z.jsx)(LS,{label:V,sortKey:`modified`,activeKey:g,activeDir:v,onSort:j}),t[58]=j,t[59]=v,t[60]=g,t[61]=V,t[62]=H):H=t[62];let U;t[63]!==B||t[64]!==H?(U=(0,Z.jsx)(NS,{className:`w-32`,"aria-sort":B,children:H}),t[63]=B,t[64]=H,t[65]=U):U=t[65],t[66]!==z||t[67]!==U?(C=(0,Z.jsx)(AS,{children:(0,Z.jsxs)(MS,{children:[z,U]})}),t[66]=z,t[67]=U,t[68]=C):C=t[68],b=jS,S=i.length?i.map(zS):(0,Z.jsx)(MS,{children:(0,Z.jsx)(PS,{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 N;t[72]!==x||t[73]!==j||t[74]!==C?(N=(0,Z.jsxs)(x,{children:[C,j]}),t[72]=x,t[73]=j,t[74]=C,t[75]=N):N=t[75];let P;t[76]!==N||t[77]!==w?(P=(0,Z.jsx)(`div`,{className:w,children:N}),t[76]=N,t[77]=w,t[78]=P):P=t[78];let F;t[79]!==P||t[80]!==T||t[81]!==E||t[82]!==D||t[83]!==O||t[84]!==k?(F=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,k,P]}),t[79]=P,t[80]=T,t[81]=E,t[82]=D,t[83]=O,t[84]=k,t[85]=F):F=t[85];let I;t[86]!==F||t[87]!==A?(I=(0,Z.jsx)(`div`,{className:A,children:F}),t[86]=F,t[87]=A,t[88]=I):I=t[88];let L;t[89]!==m||t[90]!==d||t[91]!==n?(L=(0,Z.jsx)(ih,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[89]=m,t[90]=d,t[91]=n,t[92]=L):L=t[92];let R;return t[93]!==I||t[94]!==L?(R=(0,Z.jsxs)(Z.Fragment,{children:[I,L]}),t[93]=I,t[94]=L,t[95]=R):R=t[95],R}function zS(e){return(0,Z.jsxs)(MS,{children:[(0,Z.jsx)(PS,{children:(0,Z.jsxs)(`a`,{href:Go(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)(pl,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(ie,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(PS,{className:`text-muted-foreground`,children:e.kind===`file`?FS(e.modified):`—`})]},e.path)}function BS(e){return e===`asc`?`desc`:`asc`}function VS(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 HS(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)(sl,{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=Yr(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Yr(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)(si,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(hi,{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 US(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(WS),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ot(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)(si,{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 WS(){return new Set}var GS=(0,Q.createContext)(null);function KS(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(qS),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)(GS,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function qS(){return new Map}function JS(){let e=(0,Q.use)(GS);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function YS(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var XS=YS(()=>n(()=>import(`./SettingsDialogBody-Cw9UBlHN.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([53,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,49,54,7,13,15,25,55]),import.meta.url));function ZS(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)(si,{variant:`default`,onClick:QS,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 QS(){return window.location.reload()}function $S(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(le,{fallbackRender:tC,onError:eC,children:n}),t[0]=n,t[1]=r),r}function eC(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function tC(e){return(0,Z.jsx)(ZS,{...e})}function nC(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function rC(e){let t=(0,$.c)(89),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=pt(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=oe(),{desktopPresent:f}=ji(),[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)(xo,{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)(bo,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[72]=J):J=t[72];let Y;t[73]!==p||t[74]!==K?(Y=(0,Z.jsx)(iC,{groups:K,activeId:p,onSelect:m}),t[73]=p,t[74]=K,t[75]=Y):Y=t[75];let ee;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(sC,{}),t[76]=ee):ee=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)($S,{children:(0,Z.jsx)(Q.Suspense,{fallback:ee,children:(0,Z.jsx)(XS,{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 re;t[82]!==Y||t[83]!==ne?(re=(0,Z.jsxs)(So,{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,Y,ne]}),t[82]=Y,t[83]=ne,t[84]=re):re=t[84];let ie;return t[85]!==r||t[86]!==n||t[87]!==re?(ie=(0,Z.jsx)(Eo,{open:n,onOpenChange:r,children:re}),t[85]=r,t[86]=n,t[87]=re,t[88]=ie):ie=t[88],ie}function iC(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)(oC,{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)(aC,{}),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 aC(){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=nC(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:ai(`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)(go,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function oC(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=ai(`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:ai(`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 sC(){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 cC(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=ai(`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)(Ib,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function lC(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)(zb,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function uC(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=ai(`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)(Ub,{"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 dC(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=ai(`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 fC=ri(`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 pC(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=ai(fC({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:mC,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function mC(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}ri(`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 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=ai(`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 gC(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=ai(`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)(ko,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _C(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)(gC,{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)(Xc,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(vo,{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)(Ds,{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)(As,{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)(au,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(vo,{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)(Ds,{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)(As,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(pC,{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)(dC,{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 Y;t[54]===S?Y=t[55]:(Y=S({id:`oqB2ez`}),t[54]=S,t[55]=Y);let ee=!w,te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(ct,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=te):te=t[56];let ne;t[57]!==v||t[58]!==Y||t[59]!==ee?(ne=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Y,disabled:ee,onClick:v,children:te})}),t[57]=v,t[58]=Y,t[59]=ee,t[60]=ne):ne=t[60];let re;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(Ds,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=re):re=t[61];let ie;t[62]===ne?ie=t[63]:(ie=(0,Z.jsxs)(As,{children:[ne,re]}),t[62]=ne,t[63]=ie);let ae;t[64]===S?ae=t[65]:(ae=S({id:`SiUUCS`}),t[64]=S,t[65]=ae);let oe=!w,se;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(It,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=se):se=t[66];let ce;t[67]!==_||t[68]!==ae||t[69]!==oe?(ce=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ae,disabled:oe,onClick:_,children:se})}),t[67]=_,t[68]=ae,t[69]=oe,t[70]=ce):ce=t[70];let le;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(Ds,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=le):le=t[71];let ue;t[72]===ce?ue=t[73]:(ue=(0,Z.jsxs)(As,{children:[ce,le]}),t[72]=ce,t[73]=ue);let de=o?`secondary`:`ghost`,fe;t[74]!==S||t[75]!==o?(fe=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=fe):fe=t[76];let pe=o?`ok-replace-input`:void 0,me;t[77]!==m||t[78]!==o?(me=()=>m(!o),t[77]=m,t[78]=o,t[79]=me):me=t[79];let he;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(Rl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=he):he=t[80];let ge;t[81]!==o||t[82]!==de||t[83]!==fe||t[84]!==pe||t[85]!==me?(ge=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,variant:de,size:`icon-sm`,"aria-label":fe,"aria-expanded":o,"aria-controls":pe,onClick:me,children:he})}),t[81]=o,t[82]=de,t[83]=fe,t[84]=pe,t[85]=me,t[86]=ge):ge=t[86];let _e;t[87]===o?_e=t[88]:(_e=(0,Z.jsx)(Ds,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=_e);let ve;t[89]!==ge||t[90]!==_e?(ve=(0,Z.jsxs)(As,{children:[ge,_e]}),t[89]=ge,t[90]=_e,t[91]=ve):ve=t[91];let ye;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(ye=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)(ko,{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)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Rl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ds,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Ll,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ds,{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]=ye):ye=t[100];let be;t[101]===S?be=t[102]:(be=S({id:`wJo9oS`}),t[101]=S,t[102]=be);let xe;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(ps,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=xe):xe=t[103];let Se;t[104]!==x||t[105]!==be?(Se=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":be,onClick:x,children:xe})}),t[104]=x,t[105]=be,t[106]=Se):Se=t[106];let Ce;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(Ds,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Ce):Ce=t[107];let we;t[108]===Se?we=t[109]:(we=(0,Z.jsxs)(As,{children:[Se,Ce]}),t[108]=Se,t[109]=we);let Te;return t[110]!==q||t[111]!==J||t[112]!==ie||t[113]!==ue||t[114]!==j||t[115]!==ve||t[116]!==ye||t[117]!==we?(Te=(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,ie,ue,ve,ye,we]}),t[110]=q,t[111]=J,t[112]=ie,t[113]=ue,t[114]=j,t[115]=ve,t[116]=ye,t[117]=we,t[118]=Te):Te=t[118],Te}var vC={current:0,total:0},yC=120,bC=100;function xC(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,SC)}function SC(){return null}function CC(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>yC||i.includes(`
|
|
27
27
|
`)?null:i}function wC(e){let t=ze(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function TC(e,t){return e.current===t.current&&e.total===t.total}function EC(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(vC)}function DC(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 OC(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=xC(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)(vC),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(AC))},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(kC)},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(vC);return}if(!u.open||r){i.commands.clearFindMatches(),p(vC);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=wC(i);p(t=>TC(t,e)?t:e)},bC);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=wC(i);p(e=>TC(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=CC(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(qs(t,`find`)){t.preventDefault(),u.open?EC(i,d,p):e(!1);return}if(qs(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=qs(t,`find-next`),n=qs(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&DC(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),EC(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=wC(i);p(e=>TC(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(){EC(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()&&DC(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()&&DC(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)&&DC(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)&&DC(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 Y;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?(Y=(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)(_C,{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]=Y):Y=t[80],Y}function kC(e){return{...e,open:!1,activeIndex:0}}function AC(e){return{...e,activeIndex:0}}var jC=300;function MC(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(gc),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(gc);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(xc(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,jC)};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 NC(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function PC(e){let t=(0,$.c)(8),{poolEntries:n}=pt(),r;t[0]!==e||t[1]!==n?(r=e?n.find(t=>t.docName===e)??null:null,t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r?.provider??null,a;t[3]===i?a=t[4]:(a=()=>NC(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(NC(i));let t=()=>s(NC(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 FC(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>Cc(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(wc,r)}var IC=`ok-doc-panel-width-v1`;function LC(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function RC(e){try{let t=(e??localStorage).getItem(IC);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?LC(n):320}catch{return 320}}function zC(e,t){try{(t??localStorage).setItem(IC,String(LC(e)))}catch{}}function BC(){try{return typeof localStorage>`u`?320:RC()}catch{return 320}}var VC=1024,HC=1280,UC={left:VC,right:HC};function WC(e,t,n){return e==null?t>=UC[n]?`above`:`below`:`embedded`}function GC(e){return e===`above`?`open`:`collapsed`}var KC=`ok-sidebar-pins-v2`;function qC(e){return e===`open`||e===`collapsed`}function JC(e){return e===`above`||e===`below`||e===`embedded`}function YC(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!JC(e)||!qC(t[e]))return!1;return!0}function XC(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return YC(n.left)&&(r.left=n.left),YC(n.right)&&(r.right=n.right),r}function ZC(e){try{let t=(e??localStorage).getItem(KC);return t==null?{}:XC(t)}catch{return{}}}function QC(e,t){try{t.setItem(KC,JSON.stringify(e))}catch{}}function $C(e,t,n){return n[e]?.[t]??GC(t)}function ew(e,t,n,r){let i=r??localStorage,a=ZC(i);return a[e]={...a[e],[t]:n},QC(a,i),a}function tw(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`?nw: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 nw(e){return e===`synced`?`synced`:`connected`}var rw=zr;function iw(e,t={}){let n=Oe(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var aw=200,ow=`Outside any block`;function sw(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?cw(n,r):o.current?ow:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},aw),()=>{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 cw(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=iw(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=iw(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 lw(){let[e]=(0,Q.useState)(Nr);return e}function uw({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:br(e.display_name),color:Wn(e.id,Mn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Wn(e.id,Mn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function dw(e,t){return e>t}function fw(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 pw=3,mw=6e4;function hw(e,t){let n=0;for(let r of e)t-r<mw&&(n+=1);return n<pw}var gw=new Map;function _w(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 vw(e){let t=Tt.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function yw(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=Tt.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){ue.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=>{dw(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!dw(i,a)||l!==null&&vw(l.state))return;o=!0;let e=Date.now();for(let[t,n]of gw)n.every(t=>e-t>=mw)&&gw.delete(t);let t=(gw.get(n)??[]).filter(t=>e-t<mw);if(!hw(t,e)){gw.set(n,t),ue.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),gw.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,ue.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==Tt&&_w(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new ir({state:{init:()=>null,apply:e=>(fw(e.getMeta(Tt))&&(a=i,o&&ue.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!dw(i,a)||vw(t)?!0:e.getMeta(Tt)!==void 0,view:e=>{let r=t.doc;return r==null?(ue.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 bw(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 xw=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&&Xn(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(Es(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Ms(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(bs(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(js(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ns(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(xs(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(ws(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Cs(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=Rn(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Hn){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 Pr){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():bw(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Os(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()}},Sw=e=>new ir({key:typeof e.pluginKey==`string`?new ar(e.pluginKey):e.pluginKey,view:t=>new xw({view:t,...e})});gr.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Sw({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 Cw=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 $n(e,{textSerializers:Ar(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Es(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Ms(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(bs(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(js(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ns(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(xs(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(ws(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Cs(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=Rn(this.view,e.from,e.to);Os({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()}},ww=e=>new ir({key:typeof e.pluginKey==`string`?new ar(e.pluginKey):e.pluginKey,view:t=>new Cw({view:t,...e})});gr.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?[ww({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 Tw(e,t){return e??new ar(t)}var Ew=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,Dw=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),Ow=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(`.`)),kw=new Set([`children`,`className`,`style`]),Aw=new Set([`tabIndex`]),jw=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),Mw={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function Nw(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function Pw(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function Fw(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||jw.has(e)}function Iw(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Lw(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:Mw[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function Rw(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 zw(e){return Aw.has(e)}function Bw(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function Vw(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 Hw(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||Ow.has(e)?String(t):`${t}px`}function Uw(e,t){Dw.has(t)||e.style.removeProperty(Iw(t))}function Ww(e,t,n){Dw.has(t)||e.style.setProperty(Iw(t),Hw(t,n))}function Gw(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(kw.has(r)||!Fw(r)||Nw(r,t[r])||Nw(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=Pw(r);if(a==null||a===!1){zw(r)&&Vw(e,r),e.removeAttribute(o);return}if(a===!0){zw(r)&&Bw(e,r,!0),e.setAttribute(o,``);return}if(zw(r)){Bw(e,r,a);return}e.setAttribute(o,String(a))})}function Kw(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function qw(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){Uw(e,t);return}Ww(e,t,a)}})}function Jw(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(!Nw(t,n))return;let{eventName:i,options:a}=Lw(t),o=t=>{n(Rw(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function Yw(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);Ew(()=>{let i=n.current;return Kw(e,i.className,t.className),qw(e,i.style,t.style),Gw(e,i,t),r.current=Jw(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 Xw=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)(Tw(e,`bubbleMenu`)).current;Yw(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=Sw({...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,qc.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)(Tw(e,`floatingMenu`)).current;Yw(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=ww({...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,qc.createPortal)(s,u.current)});var Zw=[{name:`paragraph`,label:`Text`,icon:Nl,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:F,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:St,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:R,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:h,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:k,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:_e,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:T,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:Wl,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function Qw(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:$w},t[0]=n,t[1]=r);let{current:i,activeStates:a}=Le(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)(It,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(ao,{asChild:!0,children:(0,Z.jsxs)(si,{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=Zw.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Fa,{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)($a,{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)(ro,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function $w(e){let t=Object.fromEntries(Zw.map(t=>[t.name,t.isActive(e.editor)]));return{current:Zw.find(e=>t[e.name])??Zw[0],activeStates:t}}function eT(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=Fh.filter(e),u=Fh.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)(ko,{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.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:i.map(e=>(0,Z.jsxs)(si,{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)(ox,{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 tT(e){let t=(0,$.c)(27),{open:n,onOpenChange:r,snapshot:a,children:o}=e,{_:s}=i(),{states:c,refresh:l}=Kg(),{dispatch:u}=Fg(),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=wg({docName:a.docName,workspace:a.workspace,instruction:t,selectionMarkdown:a.selectionMarkdown});n===null?X.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)(eT,{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)(pe,{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 nT(e){let t=P(e.state.selection.content(),e.state.schema);return l().serialize(t).trim()}function rT(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function iT(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,a=qn(),o=Mh();if(!a||o)return null;let s;return t[0]!==n||t[1]!==i?(s=(0,Z.jsx)(aT,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=s):s=t[2],s}function aT(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=nT(n)}catch(e){return console.error(`Edit with AI: could not read the selection`,e),X.error(a({id:`-RXIMO`})),null}return{docName:_t(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&&qs(e,`edit-with-ai`)&&(rT(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)(Pi,{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)(si,{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)(vi,{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)(tT,{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 oT(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 sT(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 cT(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 lT(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:uT},t[0]=n,t[1]=a),Le(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=oT(n);t&&cT(t,sT(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(wa,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{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)(Ds,{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)(As,{children:[u,d]})}),t[11]=u,t[12]=f),f}function uT(e){return oT(e.editor)}function dT(e){return oT(e)!==null}function fT(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function pT(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 mT(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function hT(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=i(),a;t[0]===n?a=t[1]:(a={editor:n,selector:gT},t[0]=n,t[1]=a);let o=Le(a),s;t[2]!==o||t[3]!==n?(s=()=>{if(o||!fT(n)||n.state.selection.empty||mT(n)||pT(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=Bn(Vn(n.state.doc)),a=jr(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)(K,{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)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{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)(Ds,{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)(As,{children:[f,m]}),t[18]=f,t[19]=m,t[20]=h):h=t[20],h}function gT(e){let t=e.editor;return!!(!fT(t)||t.state.selection.empty||mT(t)||pT(t))}var _T=`img, .ok-embed, .ok-video`,vT=220,yT=`cubic-bezier(0.23, 1, 0.32, 1)`,bT=`ok-image-align-flip`,xT=.5;function ST(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function CT(){return typeof requestAnimationFrame==`function`}function wT(e){return e?e.querySelector(_T):null}function TT(e,t){if(ST()||!CT()){t();return}let n=wT(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=wT(e);if(!t)return;for(let e of t.getAnimations())e.id===bT&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<xT)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:vT,easing:yT,fill:`none`});i.id=bT})}var ET=[{value:`left`,label:`Align left`,icon:eu},{value:`center`,label:`Align center`,icon:Ql},{value:`right`,label:`Align right`,icon:$l}];function DT(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 OT(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:kT},t[0]=n,t[1]=r);let i=Le(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=ET.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{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(Hn.create(u.doc,s)),TT(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Ds,{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 kT(e){return DT(e.editor)}function AT(e){return DT(e)!==null}var jT=[{name:`bold`,icon:Kc,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:vl,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:nu,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:Yl,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:Fe,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:gl,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function MT(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:NT},t[0]=n,t[1]=r);let i=Le(r),a;t[2]!==i||t[3]!==n?(a=jT.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{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)(Ds,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(Jt,{"aria-label":Js(e.shortcutId),children:Ks(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 NT(e){return Object.fromEntries(jT.map(t=>[t.name,t.isActive(e.editor)]))}function PT(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}=es(),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(it(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)(rl,{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)(si,{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)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),f(y)},children:(0,Z.jsx)(go,{className:`size-3.5`})})}),(0,Z.jsx)(Ds,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),k()},children:(0,Z.jsx)(fs,{className:`size-3.5`})})}),(0,Z.jsx)(Ds,{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)(bl,{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)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{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)(Ds,{side:`bottom`,sideOffset:8,children:[z,(0,Z.jsx)(Jt,{children:Ks(`command-palette`)})]}),t[63]=B):B=t[63];let V;return t[64]===R?V=t[65]:(V=(0,Z.jsxs)(As,{children:[R,B]}),t[64]=R,t[65]=V),V}function FT({editor:e}){if(ze(e.state).query||e.isActive(`codeBlock`))return!1;if(AT(e)||dT(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 IT(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:VT},t[0]=n,t[1]=l);let u=Le(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:BT},t[2]=n,t[3]=d);let f=Le(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Rn(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=Ss(e,t,()=>{Os(e,t,{placement:`top`,strategy:`fixed`,middleware:[bs(8),Es(),Ms({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(zT)}))},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(RT)},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)(OT,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(lT,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Qw,{editor:n}),(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(MT,{editor:n},o),(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(PT,{editor:n},`${o}-link`),(0,Z.jsx)(hT,{editor:n},`${o}-footnote`),(0,Z.jsx)(iT,{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)(Xw,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:LT,shouldShow:FT,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 LT(){return document.body}function RT(e){return e+1}function zT(){}function BT(e){return dT(e.editor)}function VT(e){return AT(e.editor)}var HT=56,UT=`0 2px 4px rgba(0, 0, 0, 0.08)`,WT=150,GT=globalThis.ScrollTimeline;function KT(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+HT);return{startOffset:o,endOffset:o+a,maxShift:a}}var qT=new WeakMap;function JT(e){let t=qT.get(e);if(t){for(let e of t.animations)e.cancel();qT.delete(e)}}function YT(e){for(let t of Array.from(e.cells))JT(t)}var XT=e=>e.cellIndex===0?`3`:`2`;function ZT(e,t){return QT(e,t,e=>({transform:`translateY(${e}px)`}))}function QT(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 $T(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 eE(e,t,n){return $T(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:UT})}function tE(e,t){return $T(e,t,{opacity:`0`},{opacity:`1`})}function nE(e,t,n,r){let i=XT(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=qT.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(ZT(n,r),s),l=e.animate(eE(n,r,i),s),u=e.animate(tE(n,r),{...s,pseudoElement:`::before`});qT.set(e,{key:a,animations:[c,l,u]})}function rE(e,t){let n=XT(e),r=`in|${t}|${n}`,i=qT.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:UT}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});qT.set(e,{key:r,animations:[a,o]})}function iE(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=KT(a,i,c.top,c.height,l.height);if(!u){YT(s);continue}if(n){if(o<=0){YT(s);continue}for(let e of Array.from(s.cells))nE(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+HT){YT(s);continue}for(let e of Array.from(s.cells))rE(e,d)}}var aE=gr.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new ir({key:new ar(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||iE(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()},WT);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&>)try{n=new GT({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`))YT(t)}}}})]}}),oE=`application/x-open-knowledge-sidebar-item+json`,sE={image:!0,video:!0,audio:!0,pdf:!0,text:!0};function cE(e){return JSON.stringify(e)}function lE(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:zo(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:Uo(e.assetPath)}:{target:ss(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:Go(e.docName)}}function uE(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(oE);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!dE(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&&!fE(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function dE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fE(e){return typeof e==`string`&&Object.hasOwn(sE,e)}function pE(e,t){return(n,r)=>{let i=r,a=uE(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function mE(e,t){let n=lE(e);t(n.target,{tabBehavior:`append`}),Vo(n.hash)}function hE(e){return[...e?[{label:`Toggle header column`,icon:tl,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:hi,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:Ga,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:fs,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:ml,run:e=>e.chain().focus().deleteTable().run()}]}function gE(e){return[...e?[{label:`Toggle header row`,icon:Xl,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:yt,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:dt,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:fs,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:ml,run:e=>e.chain().focus().deleteTable().run()}]}function _E(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 vE(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 Ss(r,e,()=>{Os(r,e,{strategy:`absolute`,placement:t,middleware:[bs(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(yE)})},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`?al:Pa,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)(ao,{asChild:!0,children:(0,Z.jsx)(si,{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)(Ka,{}),(0,Z.jsxs)(Fa,{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)($a,{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)(ro,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function yE(){}function bE(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=_E(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=hE(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)(vE,{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=gE(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)(vE,{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 xE(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=Tt.getState(e.state)?.binding;if(!t){ue.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){ue.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}ue.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return gr.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new ir({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var SE=new WeakMap;function CE(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=Hr(e.color),n.textContent=e.name,t.append(n),t}var wE={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},TE=100,EE=100,DE=3,OE=250;function kE(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function AE(e,t){let n=w(e);if(!n||t.contains(n.dom))return!1;if(!kE(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 jE(){let e=new sr({extensions:pr});return{mdManager:e,text:xt({mdManager:e}),html:L({mdManager:e}),paste:Se({mdManager:e}),drop:Te({mdManager:e})}}function ME(e,t){return t?{collaboration:fe.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[xE({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:fe.configure({document:e.document}),guard:[]}}function NE(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=ME(t,r);return[...vt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),rw.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,gr.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[et]}}),gr.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[mt(e,{cursorBuilder:CE})]}}),gr.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[yw({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,aE]}function PE(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{SE.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=SE.get(e);if(SE.delete(e),r==null)return;let i=performance.now();ue(`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:pE(n.drop,e.onSidebarDrop)},extensions:yp(NE(e))}}function FE(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=PE({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}=Mt(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var IE=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(wE),c=lw(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=pt(),p=n.configuration.name??``,[m]=(0,Q.useState)(jE),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new ei(FE({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;ue(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{mE(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=rt(p)??crypto.randomUUID();_=Q.use,v=Y({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=()=>()=>{de(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)(LE,{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},LE=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=()=>{AE(c,f)&&h(RE)},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=()=>(At(c,n.configuration.name??null),()=>{At(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,bc(e,`wysiwyg`,Sc(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),bc(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=zE,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})),ue(`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(wE);let f=()=>{if(fr(e),!wr(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`?wr(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<TE){e+=1,t=window.setTimeout(p,EE);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=DE,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,OE)))};t=window.setTimeout(o,OE)};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=Wo(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(_c,e),()=>window.removeEventListener(_c,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:uw({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)(IT,{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)(bE,{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)(je,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[79]=c,t[80]=m,t[81]=J):J=t[81];let Y;t[82]!==f||t[83]!==J?(Y=(0,qc.createPortal)(J,f),t[82]=f,t[83]=J,t[84]=Y):Y=t[84];let ee;t[85]===c?ee=t[86]:(ee=(0,Z.jsx)(sw,{editor:c}),t[85]=c,t[86]=ee);let te;t[87]===c?te=t[88]:(te=ht(c),t[87]=c,t[88]=te);let re;t[89]===te.store?re=t[90]:(re=(0,Z.jsx)(Dt,{store:te.store}),t[89]=te.store,t[90]=re);let ie;return t[91]!==G||t[92]!==K||t[93]!==Y||t[94]!==ee||t[95]!==re||t[96]!==l?(ie=(0,Z.jsxs)(`div`,{ref:l,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[G,K,q,Y,ee,re]}),t[91]=G,t[92]=K,t[93]=Y,t[94]=ee,t[95]=re,t[96]=l,t[97]=ie):ie=t[97],ie};function RE(e){return e+1}function zE(){return j()}var BE=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 VE(e,t,n,r,i,a){if(e==r)return[];let o=ZE(e,t,n,r,i,a),s=QE(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 BE(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new BE(t,t+o,i,i),new BE(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 BE(t,t,i,i+o),new BE(n,n,i+o+c,a)]}if(c==1||l==1)return[new BE(t,n,i,a)];let u=eD(e,t,n,r,i,a);if(u){let[o,s,c]=u;return VE(e,t,o,r,i,s).concat(VE(e,o+c,n,r,s+c,a))}return GE(e,t,n,r,i,a)}var HE=1e9,UE=0,WE=!1;function GE(e,t,n,r,i,a){let o=n-t,s=a-i;if(HE<1e9&&Math.min(o,s)>HE*16||UE>0&&Date.now()>UE)return Math.min(o,s)>HE*64?[new BE(t,n,i,a)]:tD(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);qE.reset(c),JE.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:JE,f=d?null:qE;for(let p=0;p<c;p++){if(p>HE||UE>0&&!(p&63)&&Date.now()>UE)return tD(e,t,n,r,i,a);let m=qE.advance(p,o,s,c,d,!1,l)||JE.advance(p,o,s,c,f,!0,u);if(m)return YE(e,t,n,t+m[0],r,i,a,i+m[1])}return[new BE(t,n,i,a)]}var KE=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}},qE=new KE,JE=new KE;function YE(e,t,n,r,i,a,o,s){let c=!1;return!gD(e,r)&&++r==n&&(c=!0),!gD(i,s)&&++s==o&&(c=!0),c?[new BE(t,n,a,o)]:VE(e,t,r,i,a,s).concat(VE(e,r,n,i,s,o))}function XE(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function ZE(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=XE(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-+!gD(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function QE(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=XE(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-+!gD(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function $E(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;;){gD(e,s)||s++;let u=s+o;if(gD(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=ZE(e,u,n,r,i+f+d.length,a),c=QE(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 eD(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=eD(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:$E(e,t,n,r,i,a,Math.floor(o/4),-1)}function tD(e,t,n,r,i,a){WE=!0;let o=n-t,s=a-i,c;if(o<s){let s=$E(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=$E(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new BE(t,n,i,a)];let[l,u,d]=c;return VE(e,t,l,r,i,u).concat(VE(e,l+d,n,r,u+d,a))}function nD(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 BE(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function rD(e,t,n){for(;;){nD(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=ZE(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new BE(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=QE(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new BE(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 BE(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 BE(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function iD(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=dD(t,a.fromA,l),f=uD(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 BE(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=uD(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new BE(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=dD(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new BE(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=pD(n,a.fromB,a.toB),r,o=t<0?-1:fD(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=pD(t,a.fromA,a.toA),r,o=n<0?-1:fD(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 nD(e,3),e}var aD;try{aD=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function oD(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function sD(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!oD(n):aD?!mD(n)||t==e.length-1?+!!aD.test(String.fromCharCode(n)):aD.test(e.slice(t,t+2))?2:0:0}function cD(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!oD(n):aD?!hD(n)||t==1?+!!aD.test(String.fromCharCode(n)):aD.test(e.slice(t-2,t))?2:0:0}var lD=8;function uD(e,t,n){if(t==e.length||!cD(e,t))return t;for(let r=t,i=t+n,a=0;a<lD;a++){let t=sD(e,r);if(!t||r+t>i)return r;r+=t}return t}function dD(e,t,n){if(!t||!sD(e,t))return t;for(let r=t,i=t-n,a=0;a<lD;a++){let t=cD(e,r);if(!t||r-t<i)return r;r-=t}return t}function fD(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function pD(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var mD=e=>e>=55296&&e<=56319,hD=e=>e>=56320&&e<=57343;function gD(e,t){return!t||t==e.length||!mD(e.charCodeAt(t-1))||!hD(e.charCodeAt(t))}function _D(e,t,n){let r=n?.override;return r?r(e,t):(HE=(n?.scanLimit??1e9)>>1,UE=n?.timeout?Date.now()+n.timeout:0,WE=!1,rD(e,t,VE(e,0,e.length,t,0,t.length)))}function vD(){return!WE}function yD(e,t,n){return iD(_D(e,t,n),e,t)}var bD=ic.define({combine:e=>e[0]}),xD=ac.define(),SD=ic.define(),CD=$s.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(xD)&&(e=n.value);for(let n of t.state.facet(SD))e=n(e,t);return e}});function wD(e){let t=e.field(CD,!1);if(!t)return null;let n=e.facet(bD);return{chunks:t,side:n?n.side:null}}var TD=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 OD(yD(e.toString(),t.toString(),n),e,t,0,0,vD())}static updateA(e,t,n,r,i){return MD(jD(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return MD(jD(e,r,!1,t.length),e,t,n,i)}};function ED(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 DD(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 OD(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=ED(c.fromA+r,c.fromB+i,t,n),[d,f]=DD(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]=ED(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]=DD(a.toA+r,a.toB+i,t,n),s++}o.push(new TD(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var kD=1e3;function AD(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 jD(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>kD&&([l,d]=AD(e,a-kD,n,!0)),o<t.length-kD&&([u,f]=AD(e,o+kD,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 MD(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=yD(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of OD(h,n,r,d,f,vD()))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 ND={scanLimit:500},PD=oc.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=WD(e))}update(e){(e.docChanged||e.viewportChanged||ID(e.startState,e.state)||LD(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=WD(e.view))}},{decorations:e=>e.deco}),FD=Xs.low(uc({class:`cm-changeGutter`,markers:e=>e.plugin(PD)?.gutter||fc.empty}));function ID(e,t){return e.field(CD,!1)!=t.field(CD,!1)}function LD(e,t){return e.facet(bD)!=t.facet(bD)}var RD=nc.line({class:`cm-changedLine`}),zD=nc.mark({class:`cm-changedText`}),BD=nc.mark({tagName:`ins`,class:`cm-insertedLine`}),VD=nc.mark({tagName:`del`,class:`cm-deletedLine`}),HD=new class extends lc{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function UD(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,RD),i.add(o,s,n?VD:BD),a&&a.add(o,o,HD);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,RD),a&&a.add(u,u,HD);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,zD),s<t)c++;else break}u=t}}}function WD(e){let t=e.state.field(CD),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(bD),o=n==`a`,s=new rc,c=i?new rc: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))&&UD(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var GD=class extends Ys{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}},KD=ac.define({map:(e,t)=>e.map(t)}),qD=$s.define({create:()=>nc.none,update:(e,t)=>{for(let e of t.effects)if(e.is(KD))return e.value;return e.map(t.changes)},provide:e=>cc.decorations.from(e)}),JD=.01;function YD(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 XD(e,t,n){let r=new rc,i=new rc,a=e.state.field(qD).iter(),o=t.state.field(qD).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<-JD?(l-=n,r.add(s,s,nc.widget({widget:new GD(-n),block:!0,side:-1}))):n>JD&&(u+=n,i.add(c,c,nc.widget({widget:new GD(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<JD?r.add(e.state.doc.length,e.state.doc.length,nc.widget({widget:new GD(-p),block:!0,side:1})):p>JD&&i.add(t.state.doc.length,t.state.doc.length,nc.widget({widget:new GD(p),block:!0,side:1}));let m=r.finish(),h=i.finish();YD(m,e.state.field(qD))||e.dispatch({effects:KD.of(m)}),YD(h,t.state.field(qD))||t.dispatch({effects:KD.of(h)})}var ZD=ac.define({map:(e,t)=>t.mapPos(e)}),QD=class extends Ys{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:ZD.of(n)});let{side:r,sibling:i}=e.state.facet(bD);i&&i().dispatch({effects:ZD.of($D(n,e.state.field(CD),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function $D(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 eO=$s.define({create(e){return nc.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(ZD)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>cc.decorations.from(e)});function tO({margin:e=3,minSize:t=4}){return eO.init(n=>nO(n,e,t))}function nO(e,t,n){let r=new rc,i=e.facet(bD).side==`a`,a=e.field(CD),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,nc.replace({widget:new QD(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var rO=cc.styleModule.of(new dc({".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`}})),iO=cc.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`}}),aO=new sc,oO=new sc,sO=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||ND;let t=[Xs.low(PD),iO,rO,qD,cc.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(KD)))&&this.measure()})],n=[bD.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(FD);let r=Qs.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],cc.editorAttributes.of({class:`cm-merge-a`}),oO.of(n),t]}),i=[bD.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(FD);let a=Qs.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],cc.editorAttributes.of({class:`cm-merge-b`}),oO.of(i),t]});this.chunks=TD.build(r.doc,a.doc,this.diffConf);let o=[CD.init(()=>this.chunks),aO.of(e.collapseUnchanged?tO(e.collapseUnchanged):[])];r=r.update({effects:ac.appendConfig.of(o)}).state,a=a.update({effects:ac.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 cc({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new cc({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),Zs.empty(e[0].startState.doc.length));this.chunks=t==this.a?TD.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):TD.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:xD.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:xD.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(bD),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(oO.reconfigure([bD.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?FD:[]])),a.push(oO.reconfigure([bD.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?FD:[]]))}if(r){let t=aO.reconfigure(e.collapseUnchanged?tO(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(){XD(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=cO(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=cO(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 cO(e){let t=e.nextSibling;return e.remove(),t}var lO=new class extends lc{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},uO=Xs.low(uc({class:`cm-changeGutter`,markers:e=>e.plugin(PD)?.gutter||fc.empty,widgetMarker:(e,t)=>t instanceof hO?lO:null}));function dO(e){let t=typeof e.original==`string`?tc.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||ND;return[Xs.low(PD),bO,iO,cc.editorAttributes.of({class:`cm-merge-b`}),SD.of((e,t)=>{let r=t.effects.find(e=>e.is(fO));return r&&(e=TD.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=TD.updateB(e,t.state.field(pO),t.newDoc,t.changes,n)),e}),bD.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?EO:void 0,side:`b`}),pO.init(()=>t),e.gutter===!1?[]:uO,e.collapseUnchanged?tO(e.collapseUnchanged):[],CD.init(e=>TD.build(t,e.doc,n))]}var fO=ac.define(),pO=$s.define({create:()=>tc.empty,update(e,t){for(let n of t.effects)n.is(fO)&&(e=n.value.doc);return e}}),mO=new WeakMap,hO=class extends Ys{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 gO(e,t,n){let r=mO.get(t.changes);if(r)return r;let i=nc.widget({block:!0,side:-1,widget:new hO(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(bD),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(),_O(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),vO(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(pO).sliceString(t.fromA,t.endA),u=a&&e.facet(pc),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;ec(t,{style:t=>mc(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 mO.set(t.changes,i),i}function _O(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(CD).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(pO);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Zs.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:fO.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function vO(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(CD).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(pO).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 yO(e){let t=new rc;for(let n of e.field(CD)){let r=e.facet(bD).overrideChunk&&SO(e,n);t.add(n.fromB,n.fromB,gO(e,n,!!r))}return t.finish()}var bO=$s.define({create:e=>yO(e),update(e,t){return t.state.field(CD,!1)==t.startState.field(CD,!1)?e:yO(t.state)},provide:e=>cc.decorations.from(e)}),xO=new WeakMap;function SO(e,t){let n=xO.get(t);if(n!==void 0)return n;n=null;let r=e.field(pO),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(nc.widget({widget:new CO(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(zD.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return xO.set(t,n),n}var CO=class extends Ys{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}},wO=new class extends lc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},TO=nc.line({class:`cm-inlineChangedLine`});function EO(e,t,n,r){let i=SO(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,wO),n.add(o.from,o.from,TO);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 DO=ee({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),OO=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),kO=cc.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 AO({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 jO(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:_}=vr(),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`?DO:OO,u=[cc.editable.of(!1),Qs.readOnly.of(!0)],d=[Ec,hc(),...u,l,cc.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new cc({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=AO({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 cc({doc:p,extensions:[Ec,hc(),cc.editable.of(!1),l,kO,cc.lineWrapping,dO({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),cc.updateListener.of(e=>{let t=wD(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=wD(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new sO({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new cc({doc:p,extensions:[...d,dO({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 cc)||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 cc)||ye(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`}):Ko._({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,qc.createPortal)((0,Z.jsx)(si,{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)(si,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(si,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(si,{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 MO(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 NO(e,t){return MO(e,`content`,t)}async function PO(e){return MO(e,`mine`)}async function FO(e){return MO(e,`theirs`)}async function IO(e){return MO(e,`delete`)}async function LO(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 RO(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=Ni(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Ho(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),LO(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 NO(u,e);t.ok||X.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),X.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)(jO,{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(IO),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)(si,{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(FO),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)(si,{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)(jO,{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(PO),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)(si,{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(IO),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)(si,{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)(jO,{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 zO(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 BO=`__back-nav__`;function VO(e){return e instanceof Re||e instanceof gt||e instanceof Ne||e instanceof Qe||e instanceof Ot||e instanceof me?e.docName:null}function HO(e){if(e instanceof Re){let t=e.docName;return{title:Ko._({id:`Jejur6`}),summary:Ko._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof gt){let t=e.docName;return{title:Ko._({id:`V7QxyT`}),summary:Ko._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Ne){let t=e.docName;return{title:Ko._({id:`1di5fu`}),summary:Ko._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Qe){let t=e.docName;return{title:Ko._({id:`wvbc1r`}),summary:Ko._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Ot)return{title:Ko._({id:`Gfr4fu`}),summary:Ko._({id:`j6LB7S`})};if(e instanceof me){let t=e.docName;return{title:Ko._({id:`vv7kpg`}),summary:Ko._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Ko._({id:`W5A0Ly`});return{title:Ko._({id:`29VNqC`}),summary:t}}function UO(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=HO(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)(Wx,{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)(si,{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)(si,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(st(VO(n)??i),o(a),r(BO))},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 WO(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)(UO,{...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]===BO){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}: ${HO(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)(le,{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 GO(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Sr(t);return{map:n,keys:On(t),parseError:r}}function KO(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>GO(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=jn(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Xe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ut(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)(qO,{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)(JO,{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 qO(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 JO(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 YO(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Sr(t);return{map:n,keys:On(t),parseError:r}}function XO(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=()=>YO(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=jn(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??``,N;t[8]!==r||t[9]!==a?(N=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=yr(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]=N):N=t[10];let P=N,F;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=F):F=t[11];let I=F,L;t[12]===r?L=t[13]:(L=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]=L);let R=L,z;t[14]!==P||t[15]!==R?(z=function(e,t){I(e),R(P({[e]:t}),[e])},t[14]=P,t[15]=R,t[16]=z):z=t[16];let B=z,V;t[17]!==P||t[18]!==R?(V=function(e){I(e),R(P({[e]:null}),[e])},t[17]=P,t[18]=R,t[19]=V):V=t[19];let H=V,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=yr(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,Y;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Y={activationConstraint:{distance:4}},t[27]=Y):Y=t[27];let ee;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ee={coordinateGetter:ha},t[28]=ee):ee=t[28];let te=Ci(ra(_a,Y),ra(ya,ee)),ne;t[29]!==B||t[30]!==p?(ne=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=aa(n,t);(!Object.hasOwn(p,e)||!Cr(n,r))&&B(e,r)},t[29]=B,t[30]=p,t[31]=ne):ne=t[31];let re=ne,ie;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=ie):ie=t[32];let ae=ie,{addPropertySignal:oe,clearAddProperty:se}=JS(),ce;t[33]!==oe||t[34]!==j?(ce=oe.get(j)??0,t[33]=oe,t[34]=j,t[35]=ce):ce=t[35];let le=ce,ue,de;t[36]===le?(ue=t[37],de=t[38]):(ue=()=>{le>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},de=[le],t[36]=le,t[37]=ue,t[38]=de),(0,Q.useEffect)(ue,de);let fe,pe;t[39]!==se||t[40]!==j?(fe=()=>()=>se(j),pe=[j,se],t[39]=se,t[40]=j,t[41]=fe,t[42]=pe):(fe=t[41],pe=t[42]),(0,Q.useEffect)(fe,pe);let me;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):qi[e];return{...t,type:e,value:n,error:null}})},t[43]=me):me=t[43];let he=me,ge;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ge=function(e){S(t=>t&&{...t,value:e})},t[44]=ge):ge=t[44];let _e=ge,ve;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=ve):ve=t[45];let ye=ve,be;t[46]!==r||t[47]!==x||t[48]!==P||t[49]!==p?(be=function(){if(!x)return;let e=x.name.trim();if(!e){S({...x,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){S({...x,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){S({...x,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=P({[e]:x.value});if(t.ok){S(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});S({...x,error:n??i})},t[46]=r,t[47]=x,t[48]=P,t[49]=p,t[50]=be):be=t[50];let xe=be,Se;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){S(null)},t[51]=Se):Se=t[51];let Ce=Se,we;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){w({key:e,draft:e,error:null})},t[52]=we):we=t[52];let Te=we,Ee;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Ee):Ee=t[53];let De=Ee,Oe;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(){w(null)},t[54]=Oe):Oe=t[54];let ke=Oe,Ae;t[55]!==r||t[56]!==p||t[57]!==W||t[58]!==C?(Ae=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}),I(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]=Ae):Ae=t[59];let je=Ae,Me;t[60]!==p||t[61]!==m?(Me=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=Me):Me=t[62];let Ne=Me,Pe;if(t[63]!==Ne){Pe=new Map;for(let e of Ne)Pe.set(e,(Pe.get(e)??0)+1);t[63]=Ne,t[64]=Pe}else Pe=t[64];if(Ne.length===0&&!x&&!h)return null;let Fe=!g,Ie;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>_(!e),t[65]=Ie):Ie=t[65];let Le=!g,Re;t[66]===Le?Re=t[67]:(Re=(0,Z.jsx)(jo,{"data-expanded":Le,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Le,t[67]=Re);let ze;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=ze):ze=t[68];let Be;t[69]===Re?Be=t[70]:(Be=(0,Z.jsx)(Mo,{asChild:!0,children:(0,Z.jsxs)(si,{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:[Re,ze]})}),t[69]=Re,t[70]=Be);let Ve;t[71]===h?Ve=t[72]:(Ve=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)(ds,{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]=Ve);let He;if(t[73]!==Ne){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>K(e,t),t[75]=e):e=t[75],He=Ne.map(e),t[73]=Ne,t[74]=He}else He=t[74];let Ue;if(t[76]!==B||t[77]!==je||t[78]!==Pe||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==H||t[83]!==C||t[84]!==Ne||t[85]!==k||t[86]!==re){let e;t[88]!==B||t[89]!==je||t[90]!==Pe||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==H||t[95]!==C||t[96]!==k||t[97]!==re?(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=(Pe.get(e)??0)>1;return(0,Z.jsx)(Fi,{sortableId:K(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Te(e),onChangeDraft:De,onCommit:je,onCancel:ke},onCommit:t=>B(e,t),onChangeType:t=>re(e,t),onRemove:()=>H(e)},`${e}-${t}`)},t[88]=B,t[89]=je,t[90]=Pe,t[91]=E,t[92]=p,t[93]=y,t[94]=H,t[95]=C,t[96]=k,t[97]=re,t[98]=e):e=t[98],Ue=Ne.map(e),t[76]=B,t[77]=je,t[78]=Pe,t[79]=E,t[80]=p,t[81]=y,t[82]=H,t[83]=C,t[84]=Ne,t[85]=k,t[86]=re,t[87]=Ue}else Ue=t[87];let We;t[99]!==He||t[100]!==Ue?(We=(0,Z.jsx)(pa,{items:He,strategy:Gi,children:Ue}),t[99]=He,t[100]=Ue,t[101]=We):We=t[101];let Ge;t[102]!==J||t[103]!==te||t[104]!==We?(Ge=(0,Z.jsx)(Ya,{sensors:te,collisionDetection:xa,onDragEnd:J,children:We}),t[102]=J,t[103]=te,t[104]=We,t[105]=Ge):Ge=t[105];let Ke;t[106]!==B||t[107]!==E||t[108]!==p||t[109]!==k?(Ke=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(Fi,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>B(`tags`,e),onChangeType:ZO},`virtual-tags`),t[106]=B,t[107]=E,t[108]=p,t[109]=k,t[110]=Ke):Ke=t[110];let qe;t[111]!==r||t[112]!==x||t[113]!==xe?(qe=x?(0,Z.jsx)(ta,{draft:x,onChangeName:ye,onChangeType:he,onChangeValue:_e,onCommit:xe,onCancel:Ce}):(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)(si,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ae,"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)(M,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=xe,t[114]=qe):qe=t[114];let Je;t[115]!==Ve||t[116]!==Ge||t[117]!==Ke||t[118]!==qe?(Je=(0,Z.jsxs)(Ao,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Ve,Ge,Ke,qe]}),t[115]=Ve,t[116]=Ge,t[117]=Ke,t[118]=qe,t[119]=Je):Je=t[119];let Ye;t[120]!==Fe||t[121]!==Be||t[122]!==Je?(Ye=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(No,{open:Fe,onOpenChange:Ie,children:[Be,Je]})}),t[120]=Fe,t[121]=Be,t[122]=Je,t[123]=Ye):Ye=t[123];let Xe;return t[124]!==a||t[125]!==Ye?(Xe=(0,Z.jsx)(Di,{binding:a,children:Ye}),t[124]=a,t[125]=Ye,t[126]=Xe):Xe=t[126],Xe}function ZO(){}var QO=v(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function $O(e){let t=e.threshold??QO;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function ek(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var tk=v(`ACTIVITY_MOUNT_LIMIT`,3);function nk(){return n(()=>import(`./SourceEditor-DLdOP88L.js`),__vite__mapDeps([56,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,49,57,26,55]),import.meta.url)}var rk=(0,Q.lazy)(async()=>({default:(await nk()).SourceEditor}));function ik(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ge(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 ak(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Ko._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Ko._({id:`Sc1bKE`,values:{docName:e}}):Ko._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Ko._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Ko._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Ko._({id:`bmC18N`,values:{docName:e}}):Ko._({id:`pAgkuZ`,values:{docName:e}})}:null}function ok(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)(sk,{...e})}),t[0]=e,t[1]=n),n}function sk(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=pt(),{pages:u,loading:d}=es(),f=ik(c,n,tk),p=(0,Q.useRef)(``),h=f.map(ck).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())}ue(`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)(mk,{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 ck(e){return e.docName}function lk(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&&ue(`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&&(ue(`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&&ue(`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 uk(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)(tx,{}),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)(rk,{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 dk(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)(no,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Yt,{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)(si,{type:`button`,onClick:fk,children:[(0,Z.jsx)(no,{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 fk(){return window.location.reload()}function pk(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 mk(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=ak(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=PC(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=$O({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&&ue(`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=()=>{ek({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(ue(`ok/cold/first-toggle`,{docName:n.docName,mountId:rt(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)(dk,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(WO,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(pk,{html:j}):(0,Z.jsx)(tx,{}),children:(0,Z.jsx)(zO,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(RO,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(KO,{provider:n.provider}),!i&&(0,Z.jsx)(XO,{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)(uk,{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)(IE,{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)(lk,{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 hk(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function gk(e){let{value:t,unit:n}=hk(e);return n===`rem`?t*16:t}function _k(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var vk=3600*24*7;function yk(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?bk:m,O=g===void 0?vk: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=gk(b),J;t[6]===x?J=t[7]:(J=gk(x),t[6]=x,t[7]=J);let Y=J,ee;t[8]!==E||t[9]!==k?(ee=function(e){E&&(P.current=!0,j.current=H.current?0:gk(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]=ee):ee=t[10];let te=ee,ne,re;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==Y||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}=hk(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(Y,t)),u=_k(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(Y,u)),f=_k(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)}},re=[i,a,D,q,Y,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]=Y,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ne,t[25]=re):(ne=t[24],re=t[25]),(0,Q.useEffect)(ne,re);let ie;return t[26]===te?ie=t[27]:(ie={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=ie),ie}function bk(){}var xk=3600*24*7,Sk=`18rem`,Ck=`3rem`,wk=`app-file-sidebar`,Tk=`14.625rem`,Ek=`32rem`,Dk=`sidebar_width`,Ok=/^\d+(?:\.\d+)?(?:rem|px)$/,kk=Q.createContext(null);function Ak(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${Dk}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return Ok.test(n)?n:e}function jk(){let e=Q.use(kk);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Mk(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?Sk:c,[u]=Q.useState(Pk),d;t[8]===u?d=t[9]:(d=()=>WC(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>Ak(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=ZC();return $C(`left`,WC(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),ew(`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(Nk)},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: ${VC}px)`),t=()=>{let e=WC(u,window.innerWidth,`left`);p(e),C($C(`left`,e,ZC())===`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(wk)?.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=>{qs(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":Ck,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=ai(`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)(kk.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function Nk(e){return!e}function Pk(){return Er()}function Fk(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}=jk();if(d===`none`){let e;t[7]===r?e=t[8]:(e=ai(`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]:(_=ai(`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=ai(`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:wk,"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 Ik(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}=jk(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=Js(`toggle-files-sidebar`);l=si,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=wk,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]:(_=ai(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)(se,{}):(0,Z.jsx)(kl,{}),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 Lk(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}=jk(),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:Tk,maxResizeWidth:Ek,setIsDraggingRail:h,widthCookieName:Dk,widthCookieMaxAge:xk},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}=yk(_),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=ai(`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 Rk(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}=jk(),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=ai(`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 zk(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=ai(`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 Bk(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=ai(`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 Vk(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=ai(`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 Hk(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=ai(`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 Uk(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=ai(`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 Wk=ri(`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 Gk(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?oi:`button`,{state:m}=jk(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=ai(Wk({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(Ts,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Ds,{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)(As,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function Kk(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 qk(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Fr.safeParse(t);return n.success?n.data.currentBranch??null:null}var Jk=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:Kk({fetchBranch:qk,subscribeToEvent:$o}),Yk=Jk.subscribe,Xk=Jk.getSnapshot;function Zk(){return(0,Q.useSyncExternalStore)(Yk,Xk,Xk)}function Qk(){let e=(0,$.c)(6),t=Zk(),n=po(),{state:r}=jk(),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&&la(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 $k(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=Qk();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)(eA,{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 eA(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)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Ds,{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)(Ce,{"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 tA(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=ai(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 nA(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=ai(`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 rA(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=ai(`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 iA(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=ai(`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 aA(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=ai(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(jo,{}),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 oA=1,sA=2,cA=4;function lA(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}=Me(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>cA?[...u.slice(0,oA).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(oA,-sA)},...u.slice(-sA).map((e,t)=>d(e,u.length-sA+t))]:u.map((e,t)=>d(e,t));a=tA,t[8]===r?c=t[9]:(c=ai(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=nA,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(uA)}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 uA(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(aA,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(rA,{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)(al,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(rA,{className:`min-w-0`,children:(0,Z.jsx)(iA,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var dA={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`},fA=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`,...dA,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},pA=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)(fA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},mA=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)(fA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function hA(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=Ks(`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=Js(`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)(lA,{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)(Ts,{children:(0,Z.jsx)(mA,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(_o,{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)(Ds,{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)(As,{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)(pA,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(_o,{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)(Ds,{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)(As,{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)(yo,{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)(As,{children:[(0,Z.jsx)(si,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Ts,{children:(0,Z.jsx)(Sl,{})})}),(0,Z.jsx)(Ds,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=As,h=si,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)(Ts,{children:u?(0,Z.jsx)(jl,{}):(0,Z.jsx)(Al,{})}),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)(Ds,{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 gA(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var _A=`ok-terminal-height-v1`,vA=.5;function yA(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*vA))}function bA(e,t){let n=yA(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(240,n)}function xA(){return typeof window>`u`?0:window.innerHeight}function SA(e,t){try{let n=e??localStorage,r=t??xA(),i=n.getItem(_A);if(i==null)return bA(240,r);let a=Number.parseInt(i,10);return bA(Number.isFinite(a)?a:240,r)}catch{return 240}}function CA(e,t,n){try{let r=t??localStorage,i=n??xA();r.setItem(_A,String(bA(e,i)))}catch{}}function wA(){try{return typeof localStorage>`u`?240:SA()}catch{return 240}}var TA=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-yOVM28DS.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([58,1,22,6,3,23,9,48,11,59]),import.meta.url));function EA(e){let t=(0,$.c)(12),{bridge:n,onClose:r,onKill:a,launch:o}=e,s=o===void 0?null:o,{enabled:c,synced:l}=ki(),u=so(),{_:d}=i(),f=l&&c===!1,p;t[0]!==d||t[1]!==u?(p=function(){if(u===null){X.error(d({id:`V_6bJ4`}));return}let e=u(!0);e.ok||X.error(d({id:`jKd3AP`,values:{0:e.error}}))},t[0]=d,t[1]=u,t[2]=p):p=t[2];let m=p;if(l&&!f){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]!==s||t[6]!==r||t[7]!==a?(i=(0,Z.jsx)(le,{fallbackRender:OA,onError:DA,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(TA,{bridge:n,className:`h-full`,onClose:r,onKill:a,launch:s})})}),t[4]=n,t[5]=s,t[6]=r,t[7]=a,t[8]=i):i=t[8],i}let h;return t[9]!==m||t[10]!==f?(h=f?(0,Z.jsx)(jA,{onEnable:m}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[9]=m,t[10]=f,t[11]=h):h=t[11],h}function DA(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function OA(e){return(0,Z.jsx)(kA,{...e})}function kA(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)(si,{onClick:AA,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 AA(){return window.location.reload()}function jA(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)(si,{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}var MA=`terminal-dock-panel`;function NA(e){let t=(0,$.c)(54),{bridge:n,children:r,visible:i,onVisibleChange:a,launch:o}=e,s=o===void 0?null:o,c=Vb(),l=(0,Q.useRef)(null),[u,d]=(0,Q.useState)(!i),[f,p]=(0,Q.useState)(i),[m]=(0,Q.useState)(PA),h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!1),y=(0,Q.useRef)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{CA(e),y.current=null},100)},t[0]=b):b=t[0];let x=b,S=(0,Q.useRef)(null),C,w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>()=>{y.current!=null&&clearTimeout(y.current),S.current!=null&&(window.removeEventListener(`pointerup`,S.current),S.current=null)},w=[],t[1]=C,t[2]=w):(C=t[1],w=t[2]),(0,Q.useEffect)(C,w);let T,E;t[3]===i?(T=t[4],E=t[5]):(T=()=>{i&&p(!0)},E=[i],t[3]=i,t[4]=T,t[5]=E),(0,Q.useEffect)(T,E);let D;t[6]===a?D=t[7]:(D=function(){p(!1),a(!1),l.current?.focus()},t[6]=a,t[7]=D);let O=D,k=(0,Q.useRef)(O),A;t[8]===O?A=t[9]:(A=()=>{k.current=O},t[8]=O,t[9]=A),(0,Q.useEffect)(A);let j,M;t[10]===n?(j=t[11],M=t[12]):(M=()=>n.onMenuAction(e=>{e===`kill-terminal`&&k.current()}),j=[n],t[10]=n,t[11]=j,t[12]=M),(0,Q.useEffect)(M,j);let N;t[13]!==n.editor||t[14]!==f?(N=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:f})},t[13]=n.editor,t[14]=f,t[15]=N):N=t[15];let P;t[16]!==n||t[17]!==f?(P=[n,f],t[16]=n,t[17]=f,t[18]=P):P=t[18],(0,Q.useEffect)(N,P);let F,I;t[19]!==c||t[20]!==i?(F=()=>{let e=c.current;e!=null&&(i?e.resize(`${h.current}px`):e.collapse())},I=[i,c],t[19]=c,t[20]=i,t[21]=F,t[22]=I):(F=t[21],I=t[22]),(0,Q.useEffect)(F,I);let L,R;t[23]===u?(L=t[24],R=t[25]):(L=()=>{u&&document.getElementById(MA)?.contains(document.activeElement)&&l.current?.focus()},R=[u],t[23]=u,t[24]=L,t[25]=R),(0,Q.useLayoutEffect)(L,R);let z,B;t[26]===u?(z=t[27],B=t[28]):(z=()=>{u||document.getElementById(MA)?.querySelector(`.xterm-helper-textarea`)?.focus()},B=[u],t[26]=u,t[27]=z,t[28]=B),(0,Q.useLayoutEffect)(z,B);let V=g||void 0,H;t[29]===r?H=t[30]:(H=(0,Z.jsx)(lC,{minSize:`20%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:l,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[29]=r,t[30]=H);let U;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(uC,{withHandle:!0,onPointerDown:()=>{_(!0),v.current=!0;let e=()=>{_(!1),v.current=!1,window.removeEventListener(`pointerup`,e),S.current=null};S.current=e,window.addEventListener(`pointerup`,e)}}),t[31]=U):U=t[31];let W=i?`${m}px`:0,G;t[32]!==a||t[33]!==i?(G=e=>{let t=e.asPercentage===0;d(t),v.current&&(t&&i?a(!1):!t&&!i&&a(!0),e.inPixels>0&&(h.current=e.inPixels,x(e.inPixels)))},t[32]=a,t[33]=i,t[34]=G):G=t[34];let K=!g&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,q;t[35]===K?q=t[36]:(q=ai(`flex flex-col`,K),t[35]=K,t[36]=q);let J;t[37]!==n||t[38]!==O||t[39]!==s||t[40]!==f||t[41]!==a?(J=f?(0,Z.jsx)(EA,{bridge:n,launch:s,onClose:()=>{a(!1),l.current?.focus()},onKill:O}):null,t[37]=n,t[38]=O,t[39]=s,t[40]=f,t[41]=a,t[42]=J):J=t[42];let Y;t[43]!==u||t[44]!==c||t[45]!==W||t[46]!==G||t[47]!==q||t[48]!==J?(Y=(0,Z.jsx)(lC,{id:MA,panelRef:c,defaultSize:W,minSize:`120px`,maxSize:`50%`,collapsible:!0,collapsedSize:0,onResize:G,inert:u,className:q,children:J}),t[43]=u,t[44]=c,t[45]=W,t[46]=G,t[47]=q,t[48]=J,t[49]=Y):Y=t[49];let ee;return t[50]!==V||t[51]!==H||t[52]!==Y?(ee=(0,Z.jsxs)(cC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":V,children:[H,U,Y]}),t[50]=V,t[51]=H,t[52]=Y,t[53]=ee):ee=t[53],ee}function PA(){return wA()}var FA=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CcoGE_xm.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,50]),import.meta.url)).ActivityModeContent}));function IA(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(RA,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(LA,{}),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)(KS,{children:[n,r]})}),t[3]=n,t[4]=i),i}function LA(){let e=(0,$.c)(5),t=Gh(),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)(rC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function RA(e){let t=(0,$.c)(148),{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}=pt(),{openDocumentTransition:C}=wt(),{requestAddProperty:w}=JS(),T=MC(g,h),E=FC(h,n===`source`?`source`:`wysiwyg`),D=tw(g),O=D===`connected`||D===`synced`,k=PC(h)===`conflict`,A=(0,Q.useDeferredValue)(h),j=_?.kind===`missing`,M=!!h&&_?.kind!==`folder`,N;t[0]!==m||t[1]!==j?(N=j?m({id:`K-a33w`}):void 0,t[0]=m,t[1]=j,t[2]=N):N=t[2];let P=N,[F]=(0,Q.useState)(VA),I=F!==null,L;t[3]===F?L=t[4]:(L=()=>WC(F,window.innerWidth,`right`),t[3]=F,t[4]=L);let[R,z]=(0,Q.useState)(L),B=(0,Q.useRef)(R),V,H;t[5]===R?(V=t[6],H=t[7]):(V=()=>{B.current=R},H=[R],t[5]=R,t[6]=V,t[7]=H),(0,Q.useEffect)(V,H);let U=Vb(),W;t[8]===R?W=t[9]:(W=()=>$C(`right`,R,ZC())===`collapsed`,t[8]=R,t[9]=W);let[G]=(0,Q.useState)(W),[K,q]=(0,Q.useState)(G),J=(0,Q.useRef)(K),Y,ee;t[10]===K?(Y=t[11],ee=t[12]):(Y=()=>{J.current=K},ee=[K],t[10]=K,t[11]=Y,t[12]=ee),(0,Q.useEffect)(Y,ee);let[te,ne]=(0,Q.useState)(!1),re=(0,Q.useRef)(!1),[ie]=(0,Q.useState)(BA),ae=(0,Q.useRef)(ie),oe=(0,Q.useRef)(null),se;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(se=function(e){oe.current!=null&&clearTimeout(oe.current),oe.current=setTimeout(()=>{zC(e),oe.current=null},100)},t[13]=se):se=t[13];let ce=se,le,ue;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>()=>{oe.current!=null&&clearTimeout(oe.current)},ue=[],t[14]=le,t[15]=ue):(le=t[14],ue=t[15]),(0,Q.useEffect)(le,ue);let[de,fe]=(0,Q.useState)(null),pe;t[16]!==K||t[17]!==U?(pe=function(){if(U.current==null)return;let e=B.current;K?(ew(`right`,e,`open`),U.current?.expand()):(ew(`right`,e,`collapsed`),U.current?.collapse())},t[16]=K,t[17]=U,t[18]=pe):pe=t[18];let me=pe,he,ge;t[19]!==F||t[20]!==U?(he=()=>{let e=window.matchMedia(`(min-width: ${HC}px)`),t=()=>{let e=WC(F,window.innerWidth,`right`);z(e);let t=$C(`right`,e,ZC())===`collapsed`;q(t),t?U.current?.collapse():U.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ge=[F,U],t[19]=F,t[20]=U,t[21]=he,t[22]=ge):(he=t[21],ge=t[22]),(0,Q.useEffect)(he,ge);let _e,ve;t[23]!==de||t[24]!==I||t[25]!==U?(_e=()=>{if(de==null||I)return;let e=new ResizeObserver(()=>{J.current||re.current||U.current?.resize(`${ae.current}px`)});return e.observe(de),()=>e.disconnect()},ve=[de,I,U],t[23]=de,t[24]=I,t[25]=U,t[26]=_e,t[27]=ve):(_e=t[26],ve=t[27]),(0,Q.useEffect)(_e,ve);let ye,be;t[28]!==o||t[29]!==U?(ye=()=>{let e=e=>{o(e),U.current?.expand()},t=Gm();return t&&e(t),qm(t=>{Gm(),e(t)})},be=[o,U],t[28]=o,t[29]=U,t[30]=ye,t[31]=be):(ye=t[30],be=t[31]),(0,Q.useEffect)(ye,be);let xe,Se;t[32]!==S||t[33]!==U?(xe=()=>{S!==0&&U.current?.expand()},Se=[S,U],t[32]=S,t[33]=U,t[34]=xe,t[35]=Se):(xe=t[34],Se=t[35]),(0,Q.useEffect)(xe,Se);let Ce,we;t[36]===K?(Ce=t[37],we=t[38]):(Ce=()=>{if(!K||!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()},we=[K],t[36]=K,t[37]=Ce,t[38]=we),(0,Q.useLayoutEffect)(Ce,we);let Te,Ee;t[39]===K?(Te=t[40],Ee=t[41]):(Te=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!K})},Ee=[K],t[39]=K,t[40]=Te,t[41]=Ee),(0,Q.useEffect)(Te,Ee);let De,Oe;t[42]===me?(De=t[43],Oe=t[44]):(De=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&me()})},Oe=[me],t[42]=me,t[43]=De,t[44]=Oe),(0,Q.useEffect)(De,Oe);let ke,Ae;t[45]===me?(ke=t[46],Ae=t[47]):(ke=()=>{if(window.okDesktop!=null)return;let e=e=>{qs(e,`toggle-document-panel`)&&(e.preventDefault(),me())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ae=[me],t[45]=me,t[46]=ke,t[47]=Ae),(0,Q.useEffect)(ke,Ae);let je=(0,Q.useRef)(null),[Me,Ne]=(0,Q.useState)(null),Pe=_?.kind===`large-file`?_.docName:h,Fe,Ie;t[48]===Pe?(Fe=t[49],Ie=t[50]):(Fe=()=>{if(Pe&&Pe!==je.current){let e=je.current;je.current=Pe,Ne(e)}},Ie=[Pe],t[48]=Pe,t[49]=Fe,t[50]=Ie),(0,Q.useEffect)(Fe,Ie);let Le;t[51]===C?Le=t[52]:(Le=function(e){let t=Go(e);window.location.hash===t?C(e):window.location.hash=t},t[51]=C,t[52]=Le);let Re=Le;if(_?.kind===`large-file`){let e;t[53]!==Re||t[54]!==Me?(e=Me?{previousDocName:Me,onNavigateBack:Re}:void 0,t[53]=Re,t[54]=Me,t[55]=e):e=t[55];let n;return t[56]!==_.docName||t[57]!==_.limit||t[58]!==_.size||t[59]!==e?(n=(0,Z.jsx)(HS,{docName:_.docName,size:_.size,limit:_.limit,backNav:e}),t[56]=_.docName,t[57]=_.limit,t[58]=_.size,t[59]=e,t[60]=n):n=t[60],n}if(_?.kind===`folder`){if(!(y===`agent`&&b!==null)){let e;return t[61]===_.folderPath?e=t[62]:(e=(0,Z.jsx)(RS,{folderPath:_.folderPath}),t[61]=_.folderPath,t[62]=e),e}let e;t[63]===_.folderPath?e=t[64]:(e=(0,Z.jsx)(lC,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(RS,{folderPath:_.folderPath})}),t[63]=_.folderPath,t[64]=e);let n;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(uC,{withHandle:!0}),t[65]=n):n=t[65];let r;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(lC,{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)(FA,{showBackButton:!1})})}),t[66]=r):r=t[66];let i;return t[67]===e?i=t[68]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(cC,{orientation:`horizontal`,children:[e,n,r]})}),t[67]=e,t[68]=i),i}if(_?.kind===`asset`){let e;return t[69]!==_.assetPath||t[70]!==_.mediaKind?(e=(0,Z.jsx)(ex,{assetPath:_.assetPath,mediaKind:_.mediaKind},_.assetPath),t[69]=_.assetPath,t[70]=_.mediaKind,t[71]=e):e=t[71],e}if(!g||!h){if((typeof window<`u`?Po(window.location.hash):null)!==null){let e;return t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(tx,{}),t[72]=e):e=t[72],e}let e;return t[73]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(iS,{}),t[73]=e):e=t[73],e}let ze=n===`source`,Ve=!O,He=K,Ue;t[74]!==h||t[75]!==w?(Ue=function(){h&&w(h)},t[74]=h,t[75]=w,t[76]=Ue):Ue=t[76];let We=Ue,Ge=A??h,Ke=Me??void 0,qe;t[77]!==P||t[78]!==ze||t[79]!==Re||t[80]!==v||t[81]!==Ge||t[82]!==Ke?(qe=(0,Z.jsx)(ok,{activeDocName:Ge,isSourceMode:ze,editorPlaceholder:P,previousDocName:Ke,onNavigateBack:Re,onRecycle:v}),t[77]=P,t[78]=ze,t[79]=Re,t[80]=v,t[81]=Ge,t[82]=Ke,t[83]=qe):qe=t[83];let Je;t[84]!==h||t[85]!==ze?(Je=(0,Z.jsx)(OC,{activeDocName:h,isSourceMode:ze}),t[84]=h,t[85]=ze,t[86]=Je):Je=t[86];let Ye;t[87]!==h||t[88]!==A?(Ye=gA({activeDocName:h,deferredActiveDocName:A,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)(tx,{}),h===null?null:(0,Z.jsx)(US,{docName:h})]}):null,t[87]=h,t[88]=A,t[89]=Ye):Ye=t[89];let Xe;t[90]!==qe||t[91]!==Je||t[92]!==Ye?(Xe=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[qe,Je,Ye]}),t[90]=qe,t[91]=Je,t[92]=Ye,t[93]=Xe):Xe=t[93];let Ze;t[94]!==h||t[95]!==k||t[96]!==He||t[97]!==ze||t[98]!==r||t[99]!==We||t[100]!==Ve||t[101]!==me?(Ze=!k&&(0,Z.jsx)(hA,{activeDocName:h,isSourceMode:ze,sourceDisabled:Ve,onModeChange:r,showAddPropertyButton:!ze,onAddProperty:We,isPanelCollapsed:He,onTogglePanel:me}),t[94]=h,t[95]=k,t[96]=He,t[97]=ze,t[98]=r,t[99]=We,t[100]=Ve,t[101]=me,t[102]=Ze):Ze=t[102];let Qe;t[103]!==Xe||t[104]!==Ze?(Qe=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[Xe,Ze]}),t[103]=Xe,t[104]=Ze,t[105]=Qe):Qe=t[105];let $e;t[106]!==E||t[107]!==M||t[108]!==T?($e=(0,Z.jsx)($k,{stats:T,selectionStats:E,showStats:M}),t[106]=E,t[107]=M,t[108]=T,t[109]=$e):$e=t[109];let et;t[110]!==Qe||t[111]!==$e?(et=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[Qe,$e]}),t[110]=Qe,t[111]=$e,t[112]=et):et=t[112];let tt=et,nt;t[113]!==tt||t[114]!==u||t[115]!==c||t[116]!==p||t[117]!==f?(nt=c==null?tt:(0,Z.jsx)(NA,{bridge:c,visible:f,onVisibleChange:u??zA,launch:p,children:tt}),t[113]=tt,t[114]=u,t[115]=c,t[116]=p,t[117]=f,t[118]=nt):nt=t[118];let rt=nt,it=te||void 0,at;t[119]===G?at=t[120]:(at=G?{defaultSize:`100%`}:{},t[119]=G,t[120]=at);let ot=te?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,st;t[121]!==rt||t[122]!==at||t[123]!==ot?(st=(0,Z.jsx)(lC,{minSize:`30%`,...at,className:ot,children:rt}),t[121]=rt,t[122]=at,t[123]=ot,t[124]=st):st=t[124];let ct=I&&K,lt;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(lt=()=>{ne(!0),re.current=!0;let e=()=>{ne(!1),re.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[125]=lt):lt=t[125];let ut;t[126]===ct?ut=t[127]:(ut=(0,Z.jsx)(uC,{withHandle:!0,disabled:ct,onPointerDown:lt}),t[126]=ct,t[127]=ut);let dt=G?0:`${ie}px`,ft;t[128]===Symbol.for(`react.memo_cache_sentinel`)?(ft=e=>{q(e.asPercentage===0),e.inPixels>0&&re.current&&(ae.current=e.inPixels,ce(e.inPixels))},t[128]=ft):ft=t[128];let mt=!te&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ht;t[129]===mt?ht=t[130]:(ht=ai(`flex flex-col bg-muted/20`,mt),t[129]=mt,t[130]=ht);let gt;t[131]!==h||t[132]!==a||t[133]!==y||t[134]!==ze||t[135]!==o?(gt=(0,Z.jsx)(qv,{docName:h,isSourceMode:ze,activeTab:a,onActiveTabChange:o,mode:y}),t[131]=h,t[132]=a,t[133]=y,t[134]=ze,t[135]=o,t[136]=gt):gt=t[136];let _t;t[137]!==K||t[138]!==U||t[139]!==dt||t[140]!==ht||t[141]!==gt?(_t=(0,Z.jsx)(lC,{id:`doc-panel`,panelRef:U,defaultSize:dt,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:ft,inert:K,className:ht,children:gt}),t[137]=K,t[138]=U,t[139]=dt,t[140]=ht,t[141]=gt,t[142]=_t):_t=t[142];let vt;return t[143]!==it||t[144]!==st||t[145]!==ut||t[146]!==_t?(vt=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:fe,children:(0,Z.jsxs)(cC,{orientation:`horizontal`,"data-dragging":it,children:[st,ut,_t]})}),t[143]=it,t[144]=st,t[145]=ut,t[146]=_t,t[147]=vt):vt=t[147],vt}function zA(){}function BA(){return BC()}function VA(){return Er()}function HA(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 UA(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 WA=1e3,GA=!1;function KA(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function qA(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:xi(i)?a=i:(a=void 0,GA||(GA=!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`&&(KA({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=UA(i),{current:c,crossDoc:l}=a?gi(a,n,Date.now()):{current:[],crossDoc:[]},u=JA,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>HA(e.current,p)&&HA(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,WA);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 JA(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var YA=`sync-status`;function XA(e,t){let n=(0,$.c)(6),{_:r}=i(),a=Ap(),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){X.dismiss(YA);return}s.current=!0,X.warning(r({id:`HGNCsl`}),{id:YA,duration:1/0})}else s.current&&e===`synced`&&(s.current=!1,X.success(r({id:`GhjUB_`}),{id:YA,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 ZA=4,QA=3,$A={Bird:Gc,Cat:Zc,Dog:il,Fish:ll,Mouse:Il,Rabbit:Fl,Shrimp:Hl,Snail:Ul,Squirrel:ql,Turtle:tu};Object.freeze(Object.keys($A));function ej(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn($A,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var tj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function nj(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=ej(n),c=s.kind===`animal`?$A[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=tr(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Hr(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)(Ts,{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)(Ds,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(As,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function rj(e){let t=tj[e.icon];return e.displayName||t||Ko._({id:`iEQQyu`})}function ij(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 aj(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=pt(),{presence:u,agentId:d}=n,f=rj(u),p=ij(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)(yi,{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)(yi,{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)(Ts,{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)(Ds,{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)(As,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function oj(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?Ko._({id:`9euN0m`,values:{count:n}}):Ko._({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)(nj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(aj,{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)(pe,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function sj(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(nj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(aj,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function cj(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=pt(),{current:s,crossDoc:c}=qA(t,r,n);if(XA(tw(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,ZA),n;e[6]===s?n=e[7]:(n=s.slice(ZA),e[6]=s,e[7]=n);let r=n,u=c.slice(0,QA),d;e[8]===c?d=e[9]:(d=c.slice(QA),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=>sj(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)(oj,{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=>sj(e,p,!0,m)),f.length>0?(0,Z.jsx)(oj,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function lj(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function uj(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 dj(e,t,n,r=!1){if(n)return{kind:`allow`,destinationPath:t};let i=lj(e);if(i===``)return{kind:`allow`,destinationPath:t};let a=lj(t);return r?{kind:`allow`,destinationPath:a?t:uj(t,i)}:a&&a.toLowerCase()!==i.toLowerCase()?{kind:`block`}:{kind:`allow`,destinationPath:uj(t,i)}}var fj=`.md`,pj=/\.(md|mdx)$/i;function mj(e,t=fj){return`${e}${t}`}function hj(e){return Hj(e).replace(pj,``)}function gj(e){return Jo(e)?yj(e.path):Io(e)?e.path:mj(e.docName,e.docExt)}function _j(e){let t=Hj(e).match(pj);return t?`.${t[1].toLowerCase()}`:void 0}function vj(e){return Hj(e)}function yj(e){let t=Hj(e.trim());return t?`${t}/`:``}function bj(e){return e.endsWith(`/`)?vj(e):hj(e)}function xj(e){return e.map(gj)}function Sj(e){return[...e].sort().join(`\0`)}function Cj(e){return Sj(xj(e))}function wj(e){let t=new Set;for(let n of e){if(Jo(n)){let e=yj(n.path);e&&t.add(e)}let e=(Jo(n)||Io(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Jo(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function Tj(e){if(!e)return[];let t=Hj(e.replace(pj,``)).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 Ej(e,t,n){let r=_j(e);if(r)return r;let i=n.find(e=>ls(e)&&e.docName===t);return i?i.docExt??fj:Vj(e).includes(`.`)?void 0:fj}function Dj(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(!Io(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 Oj(e,t,n){if(_j(e))return null;let r=n.find(e=>Io(e)&&e.path===t);return r?r.path:Vj(e).includes(`.`)?t:Dj(t,n)}function kj(e,t){let n=e.kind===`directory`,r=n?vj(e.path):hj(e.path);if(n)return{kind:`folder`,name:Hj(Vj(e.path)).replace(pj,``),path:r,treePath:jj(e.path,!0)};let i=Oj(e.path,r,t);if(i)return{kind:`asset`,name:Hj(Vj(i)),path:i,treePath:i};let a=Ej(e.path,r,t);return{kind:`file`,name:Hj(Vj(e.path)).replace(pj,``),path:r,treePath:jj(e.path,!1),docExt:a}}function Aj(e){return e.kind===`directory`?vj(e.path):e.path}function jj(e,t){return t?yj(e):pj.test(e)?e:`${e}${fj}`}function Mj(e,t,n){let r=yj(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}${fj}`;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 Nj(e,t){return e===`file`?jj(t,!1):`${vj(t)}/index${fj}`}function Pj(e,t){return t.kind===`root`||t.directoryPath==null?Vj(e):`${t.directoryPath}${Vj(e)}`}function Fj(e,t){if(t)return vj(yj(e));let n=hj(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function Ij(e,t){let n=vj(yj(e));return n?`${n}/${t}`:t}function Lj(e,t){return(t.path??Ij(e,t.src)).replace(/^\/+/,``)}function Rj(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 zj(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function Bj(e,t){let n=lj(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:hj(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:rr(i),modified:r,size:t.size}}function Vj(e){let t=Hj(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Hj(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Uj(e,t){return t.trim()}function Wj(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function Gj(e,t){let n=Uj(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function Kj(e,t,n=[],r=[]){if(t.length===0&&n.length===0&&r.length===0)return e;let i=new Map(t.map(e=>[e.fromDocName,e.toDocName])),a=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>ls(e)?{...e,docName:i.get(e.docName)??e.docName}:Jo(e)?{...e,path:$j(e.path,n)}:Io(e)?{...e,path:a.get(e.path)??$j(e.path,n)}:e)}function qj(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=>ls(e)?!i.has(e.docName)&&!rM(e.docName,n):Jo(e)?!rM(e.path,n):Io(e)?!a.has(e.path)&&!rM(e.path,n):!0)}function Jj(e,t){if(e.kind!==`asset`||t.some(t=>Io(t)&&t.path===e.path))return e;let n=Dj(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function Yj(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>eM(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>ls(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=>Jo(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(ls(i)){let e=nM(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Jo(i)){let e=tM(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function Xj(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function Zj(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function Qj(e,t){let n=e.kind===`file`?mj(e.path,e.docExt):e.path;return gg(t.contentDir,n,t.pathSeparator)}function $j(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 eM(e,t){return ls(e)&&ls(t)?e.docName===t.docName:Jo(e)&&Jo(t)||Io(e)&&Io(t)?e.path===t.path:!1}function tM(e,t,n){return e===t?n:nM(e,t,n)}function nM(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function rM(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function iM(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)(nd,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function aM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=ai(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(rd,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function oM(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)(ud,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function sM(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=ai(`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)(id,{children:(0,Z.jsx)(ad,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function cM(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=ai(`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)(od,{"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 lM(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=ai(`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)(jo,{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)(dd,{"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 uM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=ai(`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)(fd,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dM(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=ai(`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)(cd,{children:(0,Z.jsx)(Do,{})})}),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)(sd,{"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 fM(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=ai(`-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)(ld,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var pM=`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`,mM=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,hM={start:[Ui.Space],cancel:[Ui.Esc],end:[Ui.Space,Ui.Enter]};function gM(e){return ai(pM,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function _M(e){return e?void 0:-1}function vM({className:e,isDragging:t}){return ai(e,t&&mM)}function yM(e){return e.code===Ui.Enter&&e.target===e.currentTarget}function bM({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&yM(e)?`activate-tab`:`delegate-sortable`}function xM({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:ja.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 SM(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 CM(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 wM=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 xa(e)},TM=[`.md`,`.mdx`],EM=`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`,DM=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,OM=ai(DM,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),kM=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function AM(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function jM(e){let t=Go(e);window.location.hash!==t&&(window.location.hash=t)}function MM(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function NM(e,t){let n=[t,...TM].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 PM(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:_}=Li(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=xM({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=bM({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=vM({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 FM(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=qe(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=qe(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)(aM,{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)(cM,{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)(cM,{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)(cM,{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)(fM,{}),(0,Z.jsx)(cM,{"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)(sM,{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)(iM,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function IM(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)(Pl,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(si,{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=gM(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=_M(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)(ps,{"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)(si,{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 LM(e){let t=(0,$.c)(1),{docName:n}=e;if(PC(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(ds,{"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 RM(){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}=pt(),{_:T}=i(),{pageMeta:E}=es(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[j,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G;e[0]!==n||e[1]!==t||e[2]!==a?(G=n??(a?Ye(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,Y,ee;e[10]===t?(Y=e[11],ee=e[12]):(Y=()=>{W.current=t},ee=[t],e[10]=t,e[11]=Y,e[12]=ee),(0,Q.useEffect)(Y,ee);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 re,ie;e[16]===j?(re=e[17],ie=e[18]):(re=()=>{j&&(B.current?.focus(),B.current?.select())},ie=[j],e[16]=j,e[17]=re,e[18]=ie),(0,Q.useEffect)(re,ie);let ae,oe;e[19]!==v||e[20]!==j?(ae=()=>{!j||v.includes(j.tabId)||(H.current=!0,U.current=null,N(null),F(``),L(null),z(!1))},oe=[v,j],e[19]=v,e[20]=j,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,N({docName:t,tabId:e}),F(n[n.length-1]),L(null)},ce=function(){H.current=!0,U.current=null,N(null),F(``),L(null),z(!1)},le=async function(){if(H.current){H.current=!1;return}if(V.current)return;let e=j?.docName;if(!e){ce();return}let t=Uj(`file`,NM(P,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===U.current){B.current?.focus();return}if(!Wj(t)){L(T({id:`P8yDjG`})),B.current?.focus();return}let i=Gj({kind:`file`,path:e,name:r},t);V.current=!0,z(!0),L(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){z(!1),V.current=!1;return}let r=await ve(n,`Server error (HTTP ${n.status})`);if(!r.ok){L(r.title),z(!1),V.current=!1,U.current=t,B.current?.focus();return}let a=A(Xr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,s=Xj(o,a);Bt(a);let c=!0;try{let e=Zj(a,p(),m);await Promise.all(e.map(e=>l(e))),x(a),is([`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}),X.error(T({id:`MUBR8r`}))}H.current=!0,N(null),F(``),L(null),z(!1),V.current=!1,U.current=null,c&&s&&s!==o&&jM(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),L(T({id:`HIb0vl`})),z(!1),V.current=!1,U.current=t,B.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===g?de=e[24]:(de=new Set(g),e[23]=g,e[24]=de);let fe=de,pe;e[25]===O?pe=e[26]:(pe=CM(O),e[25]=O,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==u||e[30]!==f||e[31]!==fe?(ge=function(e){let t=[],n=[];for(let r of e)fe.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[29]=u,e[30]=f,e[31]=fe,e[32]=ge):ge=e[32];let _e=ge,ye;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ye={activationConstraint:{distance:8}},e[33]=ye):ye=e[33];let be;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(be={coordinateGetter:ha,keyboardCodes:hM},e[34]=be):be=e[34];let xe=Ci(ra(_a,ye),ra(ya,be)),Se;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){k(SM(D.current))},e[35]=Se):Se=e[35];let Ce=Se,we;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(){k(null)},e[36]=we):we=e[36];let Te=we,Ee;e[37]!==Te||e[38]!==S||e[39]!==w?(Ee=function(e){Te();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(zi([...w],r,i),t)},e[37]=Te,e[38]=S,e[39]=w,e[40]=Ee):Ee=e[40];let De=Ee,Oe=ue?``:void 0,ke;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(ke=ai(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,ue&&`[-webkit-app-region:drag]`),e[41]=ke):ke=e[41];let Ae=MM,je;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(je=ai(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=je):je=e[42];let Ne=Ya,Pe=wM,Fe;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Fe={container:typeof document<`u`?document.body:void 0},e[43]=Fe):Fe=e[43];let Ie=pa,Le;e[44]===w?Le=e[45]:(Le=[...w],e[44]=w,e[45]=Le);let Re=da,ze=w.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(FM,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PM,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:ai(EM,t?DM:OM),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:kM,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:gM(t),tabIndex:_M(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(ps,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=ft(e),n=e===K,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=Me(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(FM,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PM,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:ai(EM,n?DM:OM),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:kM,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:ai(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:ai(`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)(IM,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=Me(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(FM,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PM,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:ai(EM,n?DM:OM),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:kM,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:ai(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:ai(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(IM,{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}=Me(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=j?.tabId===e,x=`editor-tab-rename-error-${AM(a)}`;return(0,Z.jsx)(FM,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(PM,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:ai(EM,n?DM:OM,v&&I&&`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)(dC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(gC,{ref:B,value:P,disabled:R,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":I?!0:void 0,"aria-describedby":I?x:void 0,"aria-busy":R||void 0,title:I??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=>{F(NM(e.target.value,l)),L(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(pC,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(hC,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),I?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:I}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:kM,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,a)},tabIndex:-1,children:[(0,Z.jsx)(LM,{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)(IM,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),Be;e[46]!==Ie||e[47]!==Le||e[48]!==Re||e[49]!==ze?(Be=(0,Z.jsx)(Ie,{items:Le,strategy:Re,children:ze}),e[46]=Ie,e[47]=Le,e[48]=Re,e[49]=ze,e[50]=Be):Be=e[50];let Ve;e[51]!==Ne||e[52]!==Te||e[53]!==De||e[54]!==Ce||e[55]!==xe||e[56]!==!1||e[57]!==Pe||e[58]!==Fe||e[59]!==Be||e[60]!==he?(Ve=(0,Z.jsx)(Ne,{sensors:xe,autoScroll:!1,collisionDetection:Pe,modifiers:he,onDragStart:Ce,onDragEnd:De,onDragCancel:Te,accessibility:Fe,children:Be}),e[51]=Ne,e[52]=Te,e[53]=De,e[54]=Ce,e[55]=xe,e[56]=!1,e[57]=Pe,e[58]=Fe,e[59]=Be,e[60]=he,e[61]=Ve):Ve=e[61];let Ue;e[62]===T?Ue=e[63]:(Ue=T({id:`3YvS-c`}),e[62]=T,e[63]=Ue);let We;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(M,{"aria-hidden":`true`}),e[64]=We):We=e[64];let Ge;e[65]!==_||e[66]!==Ue?(Ge=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ue,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:We})}),e[65]=_,e[66]=Ue,e[67]=Ge):Ge=e[67];let Ke;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Z.jsx)(Ds,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=Ke):Ke=e[68];let qe;e[69]===Ge?qe=e[70]:(qe=(0,Z.jsxs)(As,{children:[Ge,Ke]}),e[69]=Ge,e[70]=qe);let Je;e[71]!==je||e[72]!==Ve||e[73]!==qe?(Je=(0,Z.jsxs)(`div`,{className:je,children:[Ve,qe]}),e[71]=je,e[72]=Ve,e[73]=qe,e[74]=Je):Je=e[74];let Xe;return e[75]!==Oe||e[76]!==ke||e[77]!==Ae||e[78]!==Je?(Xe=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":Oe,className:ke,onWheel:Ae,children:Je}),e[75]=Oe,e[76]=ke,e[77]=Ae,e[78]=Je,e[79]=Xe):Xe=e[79],Xe}function zM(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 BM(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 VM=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:Ke},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:Gd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:Fo},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:zM},{label:`Twitter`,href:`https://x.com/inkeep`,icon:BM}],HM=()=>{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)(kt,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(si,{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)(As,{children:[o,(0,Z.jsx)(Ds,{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=VM.map(e=>{let{label:n,href:r,icon:i}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>va(e,r),onAuxClick:e=>va(e,r),className:`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:`size-4 shrink-0`}),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-64 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)(pe,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m},UM=(0,Q.createContext)(null);function WM(e){let t=(0,$.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(UM,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function GM(){return(0,Q.use)(UM)}function KM(e){let t=(0,$.c)(39),{input:n,states:r,dispatch:a,isElectronHost:o,align:c,className:l}=e,u=c===void 0?`end`:c,d=l===void 0?`min-w-[220px]`:l,{_:f}=i(),p=GM(),m;t[0]!==a||t[1]!==n?(m=e=>{n!==null&&a(e.id,n)},t[0]=a,t[1]=n,t[2]=m):m=t[2];let h=m,g,_,v,y,b,x,S;if(t[3]!==u||t[4]!==d||t[5]!==h||t[6]!==o||t[7]!==r||t[8]!==p){let e;t[16]===r?e=t[17]:(e=e=>r[e.id]?.installed===!0,t[16]=r,t[17]=e);let n=Fh.filter(e),i;t[18]===r?i=t[19]:(i=Fh.some(e=>r[e.id]?.installed==null),t[18]=r,t[19]=i),_=i,v=n.length===0&&p===null,g=$a,y=u,b=d,x=`open-in-agent-menu`;let a;t[20]!==h||t[21]!==o||t[22]!==r?(a=e=>{let t=r[e.id];return(0,Z.jsx)(lx,{target:e,installState:t,isElectronHost:o,onSelect:()=>h(e)},e.id)},t[20]=h,t[21]=o,t[22]=r,t[23]=a):a=t[23],S=n.map(a),t[3]=u,t[4]=d,t[5]=h,t[6]=o,t[7]=r,t[8]=p,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S}else g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15];let C;t[24]!==_||t[25]!==v?(C=v?(0,Z.jsx)(Fa,{disabled:!0,"data-testid":`open-in-agent-empty`,children:_?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})}):null,t[24]=_,t[25]=v,t[26]=C):C=t[26];let w;t[27]!==f||t[28]!==n||t[29]!==p?(w=p===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ka,{}),(0,Z.jsxs)(Fa,{onSelect:()=>{n!==null&&p.launchInTerminal(n)},disabled:n===null,"data-testid":`open-in-agent-terminal`,"aria-label":f({id:`AcK_r0`}),children:[(0,Z.jsx)(Kl,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`AcK_r0`})})]})]}),t[27]=f,t[28]=n,t[29]=p,t[30]=w):w=t[30];let T;return t[31]!==g||t[32]!==y||t[33]!==b||t[34]!==x||t[35]!==S||t[36]!==C||t[37]!==w?(T=(0,Z.jsxs)(g,{align:y,className:b,"data-testid":x,children:[S,C,w]}),t[31]=g,t[32]=y,t[33]=b,t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T):T=t[38],T}function qM(e){let t=(0,$.c)(21),{input:n,open:r,onOpenChange:i}=e,{states:a,refresh:o}=Kg(),{dispatch:c}=Fg(),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(!1);if(Mh())return null;let f=typeof window<`u`&&window.okDesktop!=null,p=r??l,m;t[0]!==i||t[1]!==r||t[2]!==o?(m=e=>{r===void 0&&u(e),i?.(e),e&&o()},t[0]=i,t[1]=r,t[2]=o,t[3]=m):m=t[3];let h=m,g=n===null,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=f?()=>{d.current=!0}:void 0,t[4]=_):_=t[4];let v;t[5]===h?v=t[6]:(v=f?()=>{if(d.current){d.current=!1;return}h(!0)}:void 0,t[5]=h,t[6]=v);let y,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(vi,{className:`size-3.5`,"aria-hidden":`true`}),b=(0,Z.jsx)(s,{id:`O7_W_a`}),t[7]=y,t[8]=b):(y=t[7],b=t[8]);let x;t[9]!==v||t[10]!==g?(x=(0,Z.jsx)(ao,{asChild:!0,children:(0,Z.jsxs)(si,{variant:`ghost`,size:`sm`,disabled:g,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:_,onClick:v,children:[y,b]})}),t[9]=v,t[10]=g,t[11]=x):x=t[11];let S;t[12]!==c||t[13]!==n||t[14]!==a?(S=(0,Z.jsx)(KM,{input:n,states:a,dispatch:c,isElectronHost:f}),t[12]=c,t[13]=n,t[14]=a,t[15]=S):S=t[15];let C;return t[16]!==h||t[17]!==p||t[18]!==x||t[19]!==S?(C=(0,Z.jsxs)(ro,{open:p,onOpenChange:h,modal:!1,children:[x,S]}),t[16]=h,t[17]=p,t[18]=x,t[19]=S,t[20]=C):C=t[20],C}var JM=50,YM=()=>{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,XS.preload()},JM))},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=Vh)},u=(0,Z.jsx)(Bl,{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)(Ts,{asChild:!0,children:(0,Z.jsxs)(si,{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)(As,{children:[d,(0,Z.jsx)(Ds,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function XM(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=oo(),[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 sa({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:ka,toastSuccess:nN,toastError:tN,logEvent:eN});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{X.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)(Vl,{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)(si,{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)(ko,{ref:f,readOnly:!0,value:A,onFocus:$M,onClick:QM,onContextMenu:ZM,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)(pe,{open:y,onOpenChange:x,children:[D,M]}),t[26]=D,t[27]=M,t[28]=y,t[29]=N):N=t[29],N}function ZM(e){return e.currentTarget.select()}function QM(e){return e.currentTarget.select()}function $M(e){return e.currentTarget.select()}function eN(e){return console.log(e)}function tN(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function nN(e){return X.success(e)}function rN(e){let t=(0,$.c)(44),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=pt(),{state:p}=jk(),m=Bh(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=Ks(`toggle-files-sidebar`),t[0]=h):h=t[0];let g=h,_=Ks(`command-palette`),v=po(),[y,b]=(0,Q.useState)(!1),x;bb0:{if(f===null){let e;t[1]===v?e=t[2]:(e=yg({workspace:v}),t[1]=v,t[2]=e),x=e;break bb0}if(f.kind===`folder`){if(!v){x=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==v?(e=Sg({folderRelativePath:f.folderPath,workspace:v}),t[3]=f.folderPath,t[4]=v,t[5]=e):e=t[5],x=e;break bb0}let e;t[6]!==d||t[7]!==v?(e=vg({docName:d,workspace:v}),t[6]=d,t[7]=v,t[8]=e):e=t[8],x=e}let S=c??x,C;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=lo(f.folderPath),t[9]=f.folderPath,t[10]=e),C=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=Ea(d),t[11]=d,t[12]=e),C=e;break bb1}C=null}let w=C,T=typeof window<`u`&&window.okDesktop!=null,E=p===`collapsed`,D=T?``:void 0,O=T&&E&&`pl-[78px]`,k;t[13]===O?k=t[14]:(k=ai(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,T&&`[-webkit-app-region:drag]`,O,T&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[13]=O,t[14]=k);let A=!m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Ik,{className:ai(`-ml-1 shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Ds,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:g}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:g}})})]}),E&&a&&(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:_}}),"data-telemetry-event":`ok.editor_header.search.click`,className:ai(`shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(te,{"aria-hidden":`true`})})}),(0,Z.jsx)(Ds,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:_}})})]}),(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(RM,{})]}),j;t[15]===A?j=t[16]:(j=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:A}),t[15]=A,t[16]=j);let M;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(M=ai(`flex shrink-0 items-center justify-end gap-2 px-3`,T&&`[&>*]:[-webkit-app-region:no-drag]`),t[17]=M):M=t[17];let N;t[18]!==S||t[19]!==l||t[20]!==o||t[21]!==y||t[22]!==b||t[23]!==w||t[24]!==m?(N=!m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qM,{input:S,open:o,onOpenChange:l}),(0,Z.jsx)(XM,{input:w,onClickWhenNoRemote:()=>b(!0)}),(0,Z.jsx)(fo,{open:y,onOpenChange:b})]}),t[18]=S,t[19]=l,t[20]=o,t[21]=y,t[22]=b,t[23]=w,t[24]=m,t[25]=N):N=t[25];let P;t[26]!==r||t[27]!==n?(P=(0,Z.jsx)(Va,{onSignIn:n,onSetIdentity:r}),t[26]=r,t[27]=n,t[28]=P):P=t[28];let F,I,L;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(cj,{}),I=(0,Z.jsx)(Pi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),L=(0,Z.jsx)(hd,{}),t[29]=F,t[30]=I,t[31]=L):(F=t[29],I=t[30],L=t[31]);let R;t[32]===m?R=t[33]:(R=!m&&(0,Z.jsx)(YM,{}),t[32]=m,t[33]=R);let z;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(HM,{}),t[34]=z):z=t[34];let B;t[35]!==N||t[36]!==P||t[37]!==R?(B=(0,Z.jsxs)(`div`,{className:M,children:[N,P,F,I,L,R,z]}),t[35]=N,t[36]=P,t[37]=R,t[38]=B):B=t[38];let V;return t[39]!==B||t[40]!==D||t[41]!==k||t[42]!==j?(V=(0,Z.jsxs)(`header`,{"data-electron-drag":D,className:k,children:[j,B]}),t[39]=B,t[40]=D,t[41]=k,t[42]=j,t[43]=V):V=t[43],V}var iN=`open-knowledge:terminal-launch`;function aN(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(iN,{detail:{prompt:e}}))}function oN(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(iN,n),()=>t.removeEventListener(iN,n)}function sN(e){let t=(0,$.c)(61),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]=T_(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(Hv[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=Ca(),{projectLocalConfig:O,projectLocalSynced:k}=oe(),A=po(),{activeDocName:j}=pt(),M=D?.hasRemote,N=D?.pushPermission?.checkStatus,P;t[2]!==g||t[3]!==O||t[4]!==k||t[5]!==M||t[6]!==N?(P=k_({autoSyncOnboardingDismissed:g,hasRemote:M,projectLocalSynced:k,projectLocalConfig:O,pushPermissionCheckStatus:N}),t[2]=g,t[3]=O,t[4]=k,t[5]=M,t[6]=N,t[7]=P):P=t[7];let F=P,I,L;t[8]===j?(I=t[9],L=t[10]):(I=()=>{let e=function(e){let t=e.detail;t&&j&&yc(j,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(__,e),()=>window.removeEventListener(__,e)},L=[j],t[8]=j,t[9]=I,t[10]=L),(0,Q.useEffect)(I,L);let R,z;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?w(lN):e===`new-terminal`&&w(!0)})},z=[],t[11]=R,t[12]=z):(R=t[11],z=t[12]),(0,Q.useEffect)(R,z);let B,V;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{if(window.okDesktop!=null)return;let e=function(e){qs(e,`toggle-terminal-panel`)&&(e.preventDefault(),w(cN))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},B=[],t[13]=B,t[14]=V):(B=t[13],V=t[14]),(0,Q.useEffect)(V,B);let H,U;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>oN(e=>{w(!0),E(t=>({prompt:e,nonce:(t?.nonce??0)+1}))}),U=[],t[15]=H,t[16]=U):(H=t[15],U=t[16]),(0,Q.useEffect)(H,U);let W,G;t[17]===C?(W=t[18],G=t[19]):(W=()=>{C||E(null)},G=[C],t[17]=C,t[18]=W,t[19]=G),(0,Q.useEffect)(W,G);let K,q;t[20]===C?(K=t[21],q=t[22]):(K=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:C})},q=[C],t[20]=C,t[21]=K,t[22]=q),(0,Q.useEffect)(K,q);let J,Y;t[23]===C?(J=t[24],Y=t[25]):(J=()=>{window.okDesktop!=null&&C&&Ma()},Y=[C],t[23]=C,t[24]=J,t[25]=Y),(0,Q.useEffect)(J,Y),E_(D?.pausedReason);let ee;t[26]===s?ee=t[27]:(ee=function(e){l(e),s(e)},t[26]=s,t[27]=ee);let te=ee,ne;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){y(e),e||x(null)},t[28]=ne):ne=t[28];let re=ne,ie;t[29]!==a||t[30]!==j||t[31]!==A?(ie={openSelection(e){let t=wg({docName:e.docName??j,workspace:A,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown});return t===null?(X.error(a({id:`_VRtd7`})),!1):(x(t),y(!0),!0)}},t[29]=a,t[30]=j,t[31]=A,t[32]=ie):ie=t[32];let ae,se;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{p(`auth`),d(!0)},se=()=>{p(`identity`),d(!0)},t[33]=ae,t[34]=se):(ae=t[33],se=t[34]);let ce;t[35]!==r||t[36]!==b||t[37]!==v?(ce=(0,Z.jsx)(rN,{onSignIn:ae,onSetIdentity:se,onOpenSearch:r,openInAgentMenuOpen:v,openInAgentMenuInput:b,onOpenInAgentMenuOpenChange:re}),t[35]=r,t[36]=b,t[37]=v,t[38]=ce):ce=t[38];let le;t[39]!==m||t[40]!==c||t[41]!==te||t[42]!==T||t[43]!==C?(le=(0,Z.jsx)(IA,{editorMode:c,onModeChange:te,activeTab:m,onActiveTabChange:h,terminalBridge:S,terminalVisible:C,onTerminalVisibleChange:w,terminalLaunch:T}),t[39]=m,t[40]=c,t[41]=te,t[42]=T,t[43]=C,t[44]=le):le=t[44];let ue;t[45]!==ie||t[46]!==ce||t[47]!==le?(ue=(0,Z.jsxs)(Tc,{value:ie,children:[ce,le]}),t[45]=ie,t[46]=ce,t[47]=le,t[48]=ue):ue=t[48];let de=f===`identity`,fe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>{d(!1)},t[49]=fe):fe=t[49];let pe;t[50]!==u||t[51]!==de?(pe=(0,Z.jsx)(Xi,{open:u,onOpenChange:d,identityPrompt:de,onSuccess:fe}),t[50]=u,t[51]=de,t[52]=pe):pe=t[52];let me;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(me=()=>_(!0),t[53]=me):me=t[53];let he;t[54]===F?he=t[55]:(he=(0,Z.jsx)(D_,{open:F,onResolved:me}),t[54]=F,t[55]=he);let ge;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(m_,{}),t[56]=ge):ge=t[56];let _e;return t[57]!==ue||t[58]!==pe||t[59]!==he?(_e=(0,Z.jsxs)(Z.Fragment,{children:[ue,pe,he,ge]}),t[57]=ue,t[58]=pe,t[59]=he,t[60]=_e):_e=t[60],_e}function cN(e){return!e}function lN(e){return!e}function uN(e){let t=Go(Ho(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function dN(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Ni();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)(ds,{"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)(ds,{"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(fN),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 fN(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(si,{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:()=>uN(e.file),children:[(0,Z.jsx)(ds,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var pN=`<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;ec(t,{style:t=>mc(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 mO.set(t.changes,i),i}function _O(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(CD).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(pO);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Zs.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:fO.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function vO(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(CD).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(pO).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 yO(e){let t=new rc;for(let n of e.field(CD)){let r=e.facet(bD).overrideChunk&&SO(e,n);t.add(n.fromB,n.fromB,gO(e,n,!!r))}return t.finish()}var bO=$s.define({create:e=>yO(e),update(e,t){return t.state.field(CD,!1)==t.startState.field(CD,!1)?e:yO(t.state)},provide:e=>cc.decorations.from(e)}),xO=new WeakMap;function SO(e,t){let n=xO.get(t);if(n!==void 0)return n;n=null;let r=e.field(pO),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(nc.widget({widget:new CO(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(zD.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return xO.set(t,n),n}var CO=class extends Ys{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}},wO=new class extends lc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},TO=nc.line({class:`cm-inlineChangedLine`});function EO(e,t,n,r){let i=SO(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,wO),n.add(o.from,o.from,TO);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 DO=ee({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),OO=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),kO=cc.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 AO({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 jO(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:_}=vr(),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`?DO:OO,u=[cc.editable.of(!1),Qs.readOnly.of(!0)],d=[Ec,hc(),...u,l,cc.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new cc({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=AO({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 cc({doc:p,extensions:[Ec,hc(),cc.editable.of(!1),l,kO,cc.lineWrapping,dO({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),cc.updateListener.of(e=>{let t=wD(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=wD(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new sO({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new cc({doc:p,extensions:[...d,dO({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 cc)||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 cc)||ye(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`}):Ko._({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,qc.createPortal)((0,Z.jsx)(si,{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)(si,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(si,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(si,{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 MO(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 NO(e,t){return MO(e,`content`,t)}async function PO(e){return MO(e,`mine`)}async function FO(e){return MO(e,`theirs`)}async function IO(e){return MO(e,`delete`)}async function LO(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 RO(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=Ni(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Ho(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),LO(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 NO(u,e);t.ok||X.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),X.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)(jO,{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(IO),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)(si,{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(FO),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)(si,{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)(jO,{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(PO),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)(si,{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(IO),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)(si,{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)(jO,{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 zO(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 BO=`__back-nav__`;function VO(e){return e instanceof Re||e instanceof gt||e instanceof Ne||e instanceof Qe||e instanceof Ot||e instanceof me?e.docName:null}function HO(e){if(e instanceof Re){let t=e.docName;return{title:Ko._({id:`Jejur6`}),summary:Ko._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof gt){let t=e.docName;return{title:Ko._({id:`V7QxyT`}),summary:Ko._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Ne){let t=e.docName;return{title:Ko._({id:`1di5fu`}),summary:Ko._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Qe){let t=e.docName;return{title:Ko._({id:`wvbc1r`}),summary:Ko._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Ot)return{title:Ko._({id:`Gfr4fu`}),summary:Ko._({id:`j6LB7S`})};if(e instanceof me){let t=e.docName;return{title:Ko._({id:`vv7kpg`}),summary:Ko._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Ko._({id:`W5A0Ly`});return{title:Ko._({id:`29VNqC`}),summary:t}}function UO(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=HO(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)(Wx,{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)(si,{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)(si,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(st(VO(n)??i),o(a),r(BO))},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 WO(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)(UO,{...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]===BO){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}: ${HO(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)(le,{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 GO(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Sr(t);return{map:n,keys:On(t),parseError:r}}function KO(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>GO(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=jn(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Xe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ut(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)(qO,{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)(JO,{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 qO(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 JO(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 YO(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Sr(t);return{map:n,keys:On(t),parseError:r}}function XO(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=()=>YO(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=jn(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??``,N;t[8]!==r||t[9]!==a?(N=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=yr(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]=N):N=t[10];let P=N,F;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=F):F=t[11];let I=F,L;t[12]===r?L=t[13]:(L=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]=L);let R=L,z;t[14]!==P||t[15]!==R?(z=function(e,t){I(e),R(P({[e]:t}),[e])},t[14]=P,t[15]=R,t[16]=z):z=t[16];let B=z,V;t[17]!==P||t[18]!==R?(V=function(e){I(e),R(P({[e]:null}),[e])},t[17]=P,t[18]=R,t[19]=V):V=t[19];let H=V,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=yr(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,Y;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Y={activationConstraint:{distance:4}},t[27]=Y):Y=t[27];let ee;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ee={coordinateGetter:ha},t[28]=ee):ee=t[28];let te=Ci(ra(_a,Y),ra(ya,ee)),ne;t[29]!==B||t[30]!==p?(ne=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=aa(n,t);(!Object.hasOwn(p,e)||!Cr(n,r))&&B(e,r)},t[29]=B,t[30]=p,t[31]=ne):ne=t[31];let re=ne,ie;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=ie):ie=t[32];let ae=ie,{addPropertySignal:oe,clearAddProperty:se}=JS(),ce;t[33]!==oe||t[34]!==j?(ce=oe.get(j)??0,t[33]=oe,t[34]=j,t[35]=ce):ce=t[35];let le=ce,ue,de;t[36]===le?(ue=t[37],de=t[38]):(ue=()=>{le>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},de=[le],t[36]=le,t[37]=ue,t[38]=de),(0,Q.useEffect)(ue,de);let fe,pe;t[39]!==se||t[40]!==j?(fe=()=>()=>se(j),pe=[j,se],t[39]=se,t[40]=j,t[41]=fe,t[42]=pe):(fe=t[41],pe=t[42]),(0,Q.useEffect)(fe,pe);let me;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):qi[e];return{...t,type:e,value:n,error:null}})},t[43]=me):me=t[43];let he=me,ge;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ge=function(e){S(t=>t&&{...t,value:e})},t[44]=ge):ge=t[44];let _e=ge,ve;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=ve):ve=t[45];let ye=ve,be;t[46]!==r||t[47]!==x||t[48]!==P||t[49]!==p?(be=function(){if(!x)return;let e=x.name.trim();if(!e){S({...x,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){S({...x,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){S({...x,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=P({[e]:x.value});if(t.ok){S(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});S({...x,error:n??i})},t[46]=r,t[47]=x,t[48]=P,t[49]=p,t[50]=be):be=t[50];let xe=be,Se;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){S(null)},t[51]=Se):Se=t[51];let Ce=Se,we;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){w({key:e,draft:e,error:null})},t[52]=we):we=t[52];let Te=we,Ee;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Ee):Ee=t[53];let De=Ee,Oe;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(){w(null)},t[54]=Oe):Oe=t[54];let ke=Oe,Ae;t[55]!==r||t[56]!==p||t[57]!==W||t[58]!==C?(Ae=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}),I(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]=Ae):Ae=t[59];let je=Ae,Me;t[60]!==p||t[61]!==m?(Me=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=Me):Me=t[62];let Ne=Me,Pe;if(t[63]!==Ne){Pe=new Map;for(let e of Ne)Pe.set(e,(Pe.get(e)??0)+1);t[63]=Ne,t[64]=Pe}else Pe=t[64];if(Ne.length===0&&!x&&!h)return null;let Fe=!g,Ie;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>_(!e),t[65]=Ie):Ie=t[65];let Le=!g,Re;t[66]===Le?Re=t[67]:(Re=(0,Z.jsx)(jo,{"data-expanded":Le,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Le,t[67]=Re);let ze;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=ze):ze=t[68];let Be;t[69]===Re?Be=t[70]:(Be=(0,Z.jsx)(Mo,{asChild:!0,children:(0,Z.jsxs)(si,{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:[Re,ze]})}),t[69]=Re,t[70]=Be);let Ve;t[71]===h?Ve=t[72]:(Ve=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)(ds,{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]=Ve);let He;if(t[73]!==Ne){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>K(e,t),t[75]=e):e=t[75],He=Ne.map(e),t[73]=Ne,t[74]=He}else He=t[74];let Ue;if(t[76]!==B||t[77]!==je||t[78]!==Pe||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==H||t[83]!==C||t[84]!==Ne||t[85]!==k||t[86]!==re){let e;t[88]!==B||t[89]!==je||t[90]!==Pe||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==H||t[95]!==C||t[96]!==k||t[97]!==re?(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=(Pe.get(e)??0)>1;return(0,Z.jsx)(Fi,{sortableId:K(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Te(e),onChangeDraft:De,onCommit:je,onCancel:ke},onCommit:t=>B(e,t),onChangeType:t=>re(e,t),onRemove:()=>H(e)},`${e}-${t}`)},t[88]=B,t[89]=je,t[90]=Pe,t[91]=E,t[92]=p,t[93]=y,t[94]=H,t[95]=C,t[96]=k,t[97]=re,t[98]=e):e=t[98],Ue=Ne.map(e),t[76]=B,t[77]=je,t[78]=Pe,t[79]=E,t[80]=p,t[81]=y,t[82]=H,t[83]=C,t[84]=Ne,t[85]=k,t[86]=re,t[87]=Ue}else Ue=t[87];let We;t[99]!==He||t[100]!==Ue?(We=(0,Z.jsx)(pa,{items:He,strategy:Gi,children:Ue}),t[99]=He,t[100]=Ue,t[101]=We):We=t[101];let Ge;t[102]!==J||t[103]!==te||t[104]!==We?(Ge=(0,Z.jsx)(Ya,{sensors:te,collisionDetection:xa,onDragEnd:J,children:We}),t[102]=J,t[103]=te,t[104]=We,t[105]=Ge):Ge=t[105];let Ke;t[106]!==B||t[107]!==E||t[108]!==p||t[109]!==k?(Ke=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(Fi,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>B(`tags`,e),onChangeType:ZO},`virtual-tags`),t[106]=B,t[107]=E,t[108]=p,t[109]=k,t[110]=Ke):Ke=t[110];let qe;t[111]!==r||t[112]!==x||t[113]!==xe?(qe=x?(0,Z.jsx)(ta,{draft:x,onChangeName:ye,onChangeType:he,onChangeValue:_e,onCommit:xe,onCancel:Ce}):(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)(si,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ae,"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)(M,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=xe,t[114]=qe):qe=t[114];let Je;t[115]!==Ve||t[116]!==Ge||t[117]!==Ke||t[118]!==qe?(Je=(0,Z.jsxs)(Ao,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Ve,Ge,Ke,qe]}),t[115]=Ve,t[116]=Ge,t[117]=Ke,t[118]=qe,t[119]=Je):Je=t[119];let Ye;t[120]!==Fe||t[121]!==Be||t[122]!==Je?(Ye=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(No,{open:Fe,onOpenChange:Ie,children:[Be,Je]})}),t[120]=Fe,t[121]=Be,t[122]=Je,t[123]=Ye):Ye=t[123];let Xe;return t[124]!==a||t[125]!==Ye?(Xe=(0,Z.jsx)(Di,{binding:a,children:Ye}),t[124]=a,t[125]=Ye,t[126]=Xe):Xe=t[126],Xe}function ZO(){}var QO=v(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function $O(e){let t=e.threshold??QO;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function ek(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var tk=v(`ACTIVITY_MOUNT_LIMIT`,3);function nk(){return n(()=>import(`./SourceEditor-Dt3ubo6_.js`),__vite__mapDeps([56,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,49,57,26,55]),import.meta.url)}var rk=(0,Q.lazy)(async()=>({default:(await nk()).SourceEditor}));function ik(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ge(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 ak(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Ko._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Ko._({id:`Sc1bKE`,values:{docName:e}}):Ko._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Ko._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Ko._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Ko._({id:`bmC18N`,values:{docName:e}}):Ko._({id:`pAgkuZ`,values:{docName:e}})}:null}function ok(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)(sk,{...e})}),t[0]=e,t[1]=n),n}function sk(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=pt(),{pages:u,loading:d}=es(),f=ik(c,n,tk),p=(0,Q.useRef)(``),h=f.map(ck).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())}ue(`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)(mk,{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 ck(e){return e.docName}function lk(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&&ue(`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&&(ue(`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&&ue(`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 uk(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)(tx,{}),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)(rk,{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 dk(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)(no,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Yt,{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)(si,{type:`button`,onClick:fk,children:[(0,Z.jsx)(no,{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 fk(){return window.location.reload()}function pk(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 mk(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=ak(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=PC(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=$O({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&&ue(`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=()=>{ek({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(ue(`ok/cold/first-toggle`,{docName:n.docName,mountId:rt(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)(dk,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(WO,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(pk,{html:j}):(0,Z.jsx)(tx,{}),children:(0,Z.jsx)(zO,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(RO,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(KO,{provider:n.provider}),!i&&(0,Z.jsx)(XO,{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)(uk,{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)(IE,{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)(lk,{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 hk(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function gk(e){let{value:t,unit:n}=hk(e);return n===`rem`?t*16:t}function _k(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var vk=3600*24*7;function yk(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?bk:m,O=g===void 0?vk: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=gk(b),J;t[6]===x?J=t[7]:(J=gk(x),t[6]=x,t[7]=J);let Y=J,ee;t[8]!==E||t[9]!==k?(ee=function(e){E&&(P.current=!0,j.current=H.current?0:gk(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]=ee):ee=t[10];let te=ee,ne,re;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==Y||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}=hk(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(Y,t)),u=_k(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(Y,u)),f=_k(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)}},re=[i,a,D,q,Y,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]=Y,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ne,t[25]=re):(ne=t[24],re=t[25]),(0,Q.useEffect)(ne,re);let ie;return t[26]===te?ie=t[27]:(ie={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=ie),ie}function bk(){}var xk=3600*24*7,Sk=`18rem`,Ck=`3rem`,wk=`app-file-sidebar`,Tk=`14.625rem`,Ek=`32rem`,Dk=`sidebar_width`,Ok=/^\d+(?:\.\d+)?(?:rem|px)$/,kk=Q.createContext(null);function Ak(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${Dk}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return Ok.test(n)?n:e}function jk(){let e=Q.use(kk);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Mk(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?Sk:c,[u]=Q.useState(Pk),d;t[8]===u?d=t[9]:(d=()=>WC(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>Ak(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=ZC();return $C(`left`,WC(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),ew(`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(Nk)},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: ${VC}px)`),t=()=>{let e=WC(u,window.innerWidth,`left`);p(e),C($C(`left`,e,ZC())===`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(wk)?.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=>{qs(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":Ck,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=ai(`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)(kk.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function Nk(e){return!e}function Pk(){return Er()}function Fk(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}=jk();if(d===`none`){let e;t[7]===r?e=t[8]:(e=ai(`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]:(_=ai(`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=ai(`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:wk,"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 Ik(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}=jk(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=Js(`toggle-files-sidebar`);l=si,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=wk,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]:(_=ai(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)(se,{}):(0,Z.jsx)(kl,{}),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 Lk(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}=jk(),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:Tk,maxResizeWidth:Ek,setIsDraggingRail:h,widthCookieName:Dk,widthCookieMaxAge:xk},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}=yk(_),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=ai(`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 Rk(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}=jk(),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=ai(`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 zk(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=ai(`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 Bk(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=ai(`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 Vk(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=ai(`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 Hk(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=ai(`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 Uk(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=ai(`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 Wk=ri(`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 Gk(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?oi:`button`,{state:m}=jk(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=ai(Wk({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(Ts,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Ds,{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)(As,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function Kk(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 qk(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Fr.safeParse(t);return n.success?n.data.currentBranch??null:null}var Jk=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:Kk({fetchBranch:qk,subscribeToEvent:$o}),Yk=Jk.subscribe,Xk=Jk.getSnapshot;function Zk(){return(0,Q.useSyncExternalStore)(Yk,Xk,Xk)}function Qk(){let e=(0,$.c)(6),t=Zk(),n=po(),{state:r}=jk(),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&&la(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 $k(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=Qk();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)(eA,{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 eA(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)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Ds,{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)(Ce,{"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 tA(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=ai(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 nA(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=ai(`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 rA(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=ai(`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 iA(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=ai(`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 aA(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=ai(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(jo,{}),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 oA=1,sA=2,cA=4;function lA(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}=Me(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>cA?[...u.slice(0,oA).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(oA,-sA)},...u.slice(-sA).map((e,t)=>d(e,u.length-sA+t))]:u.map((e,t)=>d(e,t));a=tA,t[8]===r?c=t[9]:(c=ai(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=nA,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(uA)}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 uA(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(aA,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(rA,{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)(al,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(rA,{className:`min-w-0`,children:(0,Z.jsx)(iA,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var dA={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`},fA=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`,...dA,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},pA=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)(fA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},mA=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)(fA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function hA(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=Ks(`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=Js(`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)(lA,{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)(Ts,{children:(0,Z.jsx)(mA,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(_o,{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)(Ds,{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)(As,{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)(pA,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(_o,{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)(Ds,{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)(As,{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)(yo,{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)(As,{children:[(0,Z.jsx)(si,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Ts,{children:(0,Z.jsx)(Sl,{})})}),(0,Z.jsx)(Ds,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=As,h=si,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)(Ts,{children:u?(0,Z.jsx)(jl,{}):(0,Z.jsx)(Al,{})}),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)(Ds,{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 gA(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var _A=`ok-terminal-height-v1`,vA=.5;function yA(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*vA))}function bA(e,t){let n=yA(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(240,n)}function xA(){return typeof window>`u`?0:window.innerHeight}function SA(e,t){try{let n=e??localStorage,r=t??xA(),i=n.getItem(_A);if(i==null)return bA(240,r);let a=Number.parseInt(i,10);return bA(Number.isFinite(a)?a:240,r)}catch{return 240}}function CA(e,t,n){try{let r=t??localStorage,i=n??xA();r.setItem(_A,String(bA(e,i)))}catch{}}function wA(){try{return typeof localStorage>`u`?240:SA()}catch{return 240}}var TA=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-Cs1MTR-8.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([58,1,22,6,3,23,9,48,11,59]),import.meta.url));function EA(e){let t=(0,$.c)(12),{bridge:n,onClose:r,onKill:a,launch:o}=e,s=o===void 0?null:o,{enabled:c,synced:l}=ki(),u=so(),{_:d}=i(),f=l&&c===!1,p;t[0]!==d||t[1]!==u?(p=function(){if(u===null){X.error(d({id:`V_6bJ4`}));return}let e=u(!0);e.ok||X.error(d({id:`jKd3AP`,values:{0:e.error}}))},t[0]=d,t[1]=u,t[2]=p):p=t[2];let m=p;if(l&&!f){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]!==s||t[6]!==r||t[7]!==a?(i=(0,Z.jsx)(le,{fallbackRender:OA,onError:DA,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(TA,{bridge:n,className:`h-full`,onClose:r,onKill:a,launch:s})})}),t[4]=n,t[5]=s,t[6]=r,t[7]=a,t[8]=i):i=t[8],i}let h;return t[9]!==m||t[10]!==f?(h=f?(0,Z.jsx)(jA,{onEnable:m}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[9]=m,t[10]=f,t[11]=h):h=t[11],h}function DA(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function OA(e){return(0,Z.jsx)(kA,{...e})}function kA(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)(si,{onClick:AA,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 AA(){return window.location.reload()}function jA(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)(si,{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}var MA=`terminal-dock-panel`;function NA(e){let t=(0,$.c)(54),{bridge:n,children:r,visible:i,onVisibleChange:a,launch:o}=e,s=o===void 0?null:o,c=Vb(),l=(0,Q.useRef)(null),[u,d]=(0,Q.useState)(!i),[f,p]=(0,Q.useState)(i),[m]=(0,Q.useState)(PA),h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!1),y=(0,Q.useRef)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{CA(e),y.current=null},100)},t[0]=b):b=t[0];let x=b,S=(0,Q.useRef)(null),C,w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>()=>{y.current!=null&&clearTimeout(y.current),S.current!=null&&(window.removeEventListener(`pointerup`,S.current),S.current=null)},w=[],t[1]=C,t[2]=w):(C=t[1],w=t[2]),(0,Q.useEffect)(C,w);let T,E;t[3]===i?(T=t[4],E=t[5]):(T=()=>{i&&p(!0)},E=[i],t[3]=i,t[4]=T,t[5]=E),(0,Q.useEffect)(T,E);let D;t[6]===a?D=t[7]:(D=function(){p(!1),a(!1),l.current?.focus()},t[6]=a,t[7]=D);let O=D,k=(0,Q.useRef)(O),A;t[8]===O?A=t[9]:(A=()=>{k.current=O},t[8]=O,t[9]=A),(0,Q.useEffect)(A);let j,M;t[10]===n?(j=t[11],M=t[12]):(M=()=>n.onMenuAction(e=>{e===`kill-terminal`&&k.current()}),j=[n],t[10]=n,t[11]=j,t[12]=M),(0,Q.useEffect)(M,j);let N;t[13]!==n.editor||t[14]!==f?(N=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:f})},t[13]=n.editor,t[14]=f,t[15]=N):N=t[15];let P;t[16]!==n||t[17]!==f?(P=[n,f],t[16]=n,t[17]=f,t[18]=P):P=t[18],(0,Q.useEffect)(N,P);let F,I;t[19]!==c||t[20]!==i?(F=()=>{let e=c.current;e!=null&&(i?e.resize(`${h.current}px`):e.collapse())},I=[i,c],t[19]=c,t[20]=i,t[21]=F,t[22]=I):(F=t[21],I=t[22]),(0,Q.useEffect)(F,I);let L,R;t[23]===u?(L=t[24],R=t[25]):(L=()=>{u&&document.getElementById(MA)?.contains(document.activeElement)&&l.current?.focus()},R=[u],t[23]=u,t[24]=L,t[25]=R),(0,Q.useLayoutEffect)(L,R);let z,B;t[26]===u?(z=t[27],B=t[28]):(z=()=>{u||document.getElementById(MA)?.querySelector(`.xterm-helper-textarea`)?.focus()},B=[u],t[26]=u,t[27]=z,t[28]=B),(0,Q.useLayoutEffect)(z,B);let V=g||void 0,H;t[29]===r?H=t[30]:(H=(0,Z.jsx)(lC,{minSize:`20%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:l,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[29]=r,t[30]=H);let U;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(uC,{withHandle:!0,onPointerDown:()=>{_(!0),v.current=!0;let e=()=>{_(!1),v.current=!1,window.removeEventListener(`pointerup`,e),S.current=null};S.current=e,window.addEventListener(`pointerup`,e)}}),t[31]=U):U=t[31];let W=i?`${m}px`:0,G;t[32]!==a||t[33]!==i?(G=e=>{let t=e.asPercentage===0;d(t),v.current&&(t&&i?a(!1):!t&&!i&&a(!0),e.inPixels>0&&(h.current=e.inPixels,x(e.inPixels)))},t[32]=a,t[33]=i,t[34]=G):G=t[34];let K=!g&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,q;t[35]===K?q=t[36]:(q=ai(`flex flex-col`,K),t[35]=K,t[36]=q);let J;t[37]!==n||t[38]!==O||t[39]!==s||t[40]!==f||t[41]!==a?(J=f?(0,Z.jsx)(EA,{bridge:n,launch:s,onClose:()=>{a(!1),l.current?.focus()},onKill:O}):null,t[37]=n,t[38]=O,t[39]=s,t[40]=f,t[41]=a,t[42]=J):J=t[42];let Y;t[43]!==u||t[44]!==c||t[45]!==W||t[46]!==G||t[47]!==q||t[48]!==J?(Y=(0,Z.jsx)(lC,{id:MA,panelRef:c,defaultSize:W,minSize:`120px`,maxSize:`50%`,collapsible:!0,collapsedSize:0,onResize:G,inert:u,className:q,children:J}),t[43]=u,t[44]=c,t[45]=W,t[46]=G,t[47]=q,t[48]=J,t[49]=Y):Y=t[49];let ee;return t[50]!==V||t[51]!==H||t[52]!==Y?(ee=(0,Z.jsxs)(cC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":V,children:[H,U,Y]}),t[50]=V,t[51]=H,t[52]=Y,t[53]=ee):ee=t[53],ee}function PA(){return wA()}var FA=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DYW6IyGe.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,50]),import.meta.url)).ActivityModeContent}));function IA(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(RA,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(LA,{}),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)(KS,{children:[n,r]})}),t[3]=n,t[4]=i),i}function LA(){let e=(0,$.c)(5),t=Gh(),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)(rC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function RA(e){let t=(0,$.c)(148),{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}=pt(),{openDocumentTransition:C}=wt(),{requestAddProperty:w}=JS(),T=MC(g,h),E=FC(h,n===`source`?`source`:`wysiwyg`),D=tw(g),O=D===`connected`||D===`synced`,k=PC(h)===`conflict`,A=(0,Q.useDeferredValue)(h),j=_?.kind===`missing`,M=!!h&&_?.kind!==`folder`,N;t[0]!==m||t[1]!==j?(N=j?m({id:`K-a33w`}):void 0,t[0]=m,t[1]=j,t[2]=N):N=t[2];let P=N,[F]=(0,Q.useState)(VA),I=F!==null,L;t[3]===F?L=t[4]:(L=()=>WC(F,window.innerWidth,`right`),t[3]=F,t[4]=L);let[R,z]=(0,Q.useState)(L),B=(0,Q.useRef)(R),V,H;t[5]===R?(V=t[6],H=t[7]):(V=()=>{B.current=R},H=[R],t[5]=R,t[6]=V,t[7]=H),(0,Q.useEffect)(V,H);let U=Vb(),W;t[8]===R?W=t[9]:(W=()=>$C(`right`,R,ZC())===`collapsed`,t[8]=R,t[9]=W);let[G]=(0,Q.useState)(W),[K,q]=(0,Q.useState)(G),J=(0,Q.useRef)(K),Y,ee;t[10]===K?(Y=t[11],ee=t[12]):(Y=()=>{J.current=K},ee=[K],t[10]=K,t[11]=Y,t[12]=ee),(0,Q.useEffect)(Y,ee);let[te,ne]=(0,Q.useState)(!1),re=(0,Q.useRef)(!1),[ie]=(0,Q.useState)(BA),ae=(0,Q.useRef)(ie),oe=(0,Q.useRef)(null),se;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(se=function(e){oe.current!=null&&clearTimeout(oe.current),oe.current=setTimeout(()=>{zC(e),oe.current=null},100)},t[13]=se):se=t[13];let ce=se,le,ue;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>()=>{oe.current!=null&&clearTimeout(oe.current)},ue=[],t[14]=le,t[15]=ue):(le=t[14],ue=t[15]),(0,Q.useEffect)(le,ue);let[de,fe]=(0,Q.useState)(null),pe;t[16]!==K||t[17]!==U?(pe=function(){if(U.current==null)return;let e=B.current;K?(ew(`right`,e,`open`),U.current?.expand()):(ew(`right`,e,`collapsed`),U.current?.collapse())},t[16]=K,t[17]=U,t[18]=pe):pe=t[18];let me=pe,he,ge;t[19]!==F||t[20]!==U?(he=()=>{let e=window.matchMedia(`(min-width: ${HC}px)`),t=()=>{let e=WC(F,window.innerWidth,`right`);z(e);let t=$C(`right`,e,ZC())===`collapsed`;q(t),t?U.current?.collapse():U.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ge=[F,U],t[19]=F,t[20]=U,t[21]=he,t[22]=ge):(he=t[21],ge=t[22]),(0,Q.useEffect)(he,ge);let _e,ve;t[23]!==de||t[24]!==I||t[25]!==U?(_e=()=>{if(de==null||I)return;let e=new ResizeObserver(()=>{J.current||re.current||U.current?.resize(`${ae.current}px`)});return e.observe(de),()=>e.disconnect()},ve=[de,I,U],t[23]=de,t[24]=I,t[25]=U,t[26]=_e,t[27]=ve):(_e=t[26],ve=t[27]),(0,Q.useEffect)(_e,ve);let ye,be;t[28]!==o||t[29]!==U?(ye=()=>{let e=e=>{o(e),U.current?.expand()},t=Gm();return t&&e(t),qm(t=>{Gm(),e(t)})},be=[o,U],t[28]=o,t[29]=U,t[30]=ye,t[31]=be):(ye=t[30],be=t[31]),(0,Q.useEffect)(ye,be);let xe,Se;t[32]!==S||t[33]!==U?(xe=()=>{S!==0&&U.current?.expand()},Se=[S,U],t[32]=S,t[33]=U,t[34]=xe,t[35]=Se):(xe=t[34],Se=t[35]),(0,Q.useEffect)(xe,Se);let Ce,we;t[36]===K?(Ce=t[37],we=t[38]):(Ce=()=>{if(!K||!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()},we=[K],t[36]=K,t[37]=Ce,t[38]=we),(0,Q.useLayoutEffect)(Ce,we);let Te,Ee;t[39]===K?(Te=t[40],Ee=t[41]):(Te=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!K})},Ee=[K],t[39]=K,t[40]=Te,t[41]=Ee),(0,Q.useEffect)(Te,Ee);let De,Oe;t[42]===me?(De=t[43],Oe=t[44]):(De=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&me()})},Oe=[me],t[42]=me,t[43]=De,t[44]=Oe),(0,Q.useEffect)(De,Oe);let ke,Ae;t[45]===me?(ke=t[46],Ae=t[47]):(ke=()=>{if(window.okDesktop!=null)return;let e=e=>{qs(e,`toggle-document-panel`)&&(e.preventDefault(),me())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ae=[me],t[45]=me,t[46]=ke,t[47]=Ae),(0,Q.useEffect)(ke,Ae);let je=(0,Q.useRef)(null),[Me,Ne]=(0,Q.useState)(null),Pe=_?.kind===`large-file`?_.docName:h,Fe,Ie;t[48]===Pe?(Fe=t[49],Ie=t[50]):(Fe=()=>{if(Pe&&Pe!==je.current){let e=je.current;je.current=Pe,Ne(e)}},Ie=[Pe],t[48]=Pe,t[49]=Fe,t[50]=Ie),(0,Q.useEffect)(Fe,Ie);let Le;t[51]===C?Le=t[52]:(Le=function(e){let t=Go(e);window.location.hash===t?C(e):window.location.hash=t},t[51]=C,t[52]=Le);let Re=Le;if(_?.kind===`large-file`){let e;t[53]!==Re||t[54]!==Me?(e=Me?{previousDocName:Me,onNavigateBack:Re}:void 0,t[53]=Re,t[54]=Me,t[55]=e):e=t[55];let n;return t[56]!==_.docName||t[57]!==_.limit||t[58]!==_.size||t[59]!==e?(n=(0,Z.jsx)(HS,{docName:_.docName,size:_.size,limit:_.limit,backNav:e}),t[56]=_.docName,t[57]=_.limit,t[58]=_.size,t[59]=e,t[60]=n):n=t[60],n}if(_?.kind===`folder`){if(!(y===`agent`&&b!==null)){let e;return t[61]===_.folderPath?e=t[62]:(e=(0,Z.jsx)(RS,{folderPath:_.folderPath}),t[61]=_.folderPath,t[62]=e),e}let e;t[63]===_.folderPath?e=t[64]:(e=(0,Z.jsx)(lC,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(RS,{folderPath:_.folderPath})}),t[63]=_.folderPath,t[64]=e);let n;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(uC,{withHandle:!0}),t[65]=n):n=t[65];let r;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(lC,{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)(FA,{showBackButton:!1})})}),t[66]=r):r=t[66];let i;return t[67]===e?i=t[68]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(cC,{orientation:`horizontal`,children:[e,n,r]})}),t[67]=e,t[68]=i),i}if(_?.kind===`asset`){let e;return t[69]!==_.assetPath||t[70]!==_.mediaKind?(e=(0,Z.jsx)(ex,{assetPath:_.assetPath,mediaKind:_.mediaKind},_.assetPath),t[69]=_.assetPath,t[70]=_.mediaKind,t[71]=e):e=t[71],e}if(!g||!h){if((typeof window<`u`?Po(window.location.hash):null)!==null){let e;return t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(tx,{}),t[72]=e):e=t[72],e}let e;return t[73]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(iS,{}),t[73]=e):e=t[73],e}let ze=n===`source`,Ve=!O,He=K,Ue;t[74]!==h||t[75]!==w?(Ue=function(){h&&w(h)},t[74]=h,t[75]=w,t[76]=Ue):Ue=t[76];let We=Ue,Ge=A??h,Ke=Me??void 0,qe;t[77]!==P||t[78]!==ze||t[79]!==Re||t[80]!==v||t[81]!==Ge||t[82]!==Ke?(qe=(0,Z.jsx)(ok,{activeDocName:Ge,isSourceMode:ze,editorPlaceholder:P,previousDocName:Ke,onNavigateBack:Re,onRecycle:v}),t[77]=P,t[78]=ze,t[79]=Re,t[80]=v,t[81]=Ge,t[82]=Ke,t[83]=qe):qe=t[83];let Je;t[84]!==h||t[85]!==ze?(Je=(0,Z.jsx)(OC,{activeDocName:h,isSourceMode:ze}),t[84]=h,t[85]=ze,t[86]=Je):Je=t[86];let Ye;t[87]!==h||t[88]!==A?(Ye=gA({activeDocName:h,deferredActiveDocName:A,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)(tx,{}),h===null?null:(0,Z.jsx)(US,{docName:h})]}):null,t[87]=h,t[88]=A,t[89]=Ye):Ye=t[89];let Xe;t[90]!==qe||t[91]!==Je||t[92]!==Ye?(Xe=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[qe,Je,Ye]}),t[90]=qe,t[91]=Je,t[92]=Ye,t[93]=Xe):Xe=t[93];let Ze;t[94]!==h||t[95]!==k||t[96]!==He||t[97]!==ze||t[98]!==r||t[99]!==We||t[100]!==Ve||t[101]!==me?(Ze=!k&&(0,Z.jsx)(hA,{activeDocName:h,isSourceMode:ze,sourceDisabled:Ve,onModeChange:r,showAddPropertyButton:!ze,onAddProperty:We,isPanelCollapsed:He,onTogglePanel:me}),t[94]=h,t[95]=k,t[96]=He,t[97]=ze,t[98]=r,t[99]=We,t[100]=Ve,t[101]=me,t[102]=Ze):Ze=t[102];let Qe;t[103]!==Xe||t[104]!==Ze?(Qe=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[Xe,Ze]}),t[103]=Xe,t[104]=Ze,t[105]=Qe):Qe=t[105];let $e;t[106]!==E||t[107]!==M||t[108]!==T?($e=(0,Z.jsx)($k,{stats:T,selectionStats:E,showStats:M}),t[106]=E,t[107]=M,t[108]=T,t[109]=$e):$e=t[109];let et;t[110]!==Qe||t[111]!==$e?(et=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[Qe,$e]}),t[110]=Qe,t[111]=$e,t[112]=et):et=t[112];let tt=et,nt;t[113]!==tt||t[114]!==u||t[115]!==c||t[116]!==p||t[117]!==f?(nt=c==null?tt:(0,Z.jsx)(NA,{bridge:c,visible:f,onVisibleChange:u??zA,launch:p,children:tt}),t[113]=tt,t[114]=u,t[115]=c,t[116]=p,t[117]=f,t[118]=nt):nt=t[118];let rt=nt,it=te||void 0,at;t[119]===G?at=t[120]:(at=G?{defaultSize:`100%`}:{},t[119]=G,t[120]=at);let ot=te?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,st;t[121]!==rt||t[122]!==at||t[123]!==ot?(st=(0,Z.jsx)(lC,{minSize:`30%`,...at,className:ot,children:rt}),t[121]=rt,t[122]=at,t[123]=ot,t[124]=st):st=t[124];let ct=I&&K,lt;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(lt=()=>{ne(!0),re.current=!0;let e=()=>{ne(!1),re.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[125]=lt):lt=t[125];let ut;t[126]===ct?ut=t[127]:(ut=(0,Z.jsx)(uC,{withHandle:!0,disabled:ct,onPointerDown:lt}),t[126]=ct,t[127]=ut);let dt=G?0:`${ie}px`,ft;t[128]===Symbol.for(`react.memo_cache_sentinel`)?(ft=e=>{q(e.asPercentage===0),e.inPixels>0&&re.current&&(ae.current=e.inPixels,ce(e.inPixels))},t[128]=ft):ft=t[128];let mt=!te&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ht;t[129]===mt?ht=t[130]:(ht=ai(`flex flex-col bg-muted/20`,mt),t[129]=mt,t[130]=ht);let gt;t[131]!==h||t[132]!==a||t[133]!==y||t[134]!==ze||t[135]!==o?(gt=(0,Z.jsx)(qv,{docName:h,isSourceMode:ze,activeTab:a,onActiveTabChange:o,mode:y}),t[131]=h,t[132]=a,t[133]=y,t[134]=ze,t[135]=o,t[136]=gt):gt=t[136];let _t;t[137]!==K||t[138]!==U||t[139]!==dt||t[140]!==ht||t[141]!==gt?(_t=(0,Z.jsx)(lC,{id:`doc-panel`,panelRef:U,defaultSize:dt,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:ft,inert:K,className:ht,children:gt}),t[137]=K,t[138]=U,t[139]=dt,t[140]=ht,t[141]=gt,t[142]=_t):_t=t[142];let vt;return t[143]!==it||t[144]!==st||t[145]!==ut||t[146]!==_t?(vt=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:fe,children:(0,Z.jsxs)(cC,{orientation:`horizontal`,"data-dragging":it,children:[st,ut,_t]})}),t[143]=it,t[144]=st,t[145]=ut,t[146]=_t,t[147]=vt):vt=t[147],vt}function zA(){}function BA(){return BC()}function VA(){return Er()}function HA(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 UA(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 WA=1e3,GA=!1;function KA(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function qA(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:xi(i)?a=i:(a=void 0,GA||(GA=!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`&&(KA({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=UA(i),{current:c,crossDoc:l}=a?gi(a,n,Date.now()):{current:[],crossDoc:[]},u=JA,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>HA(e.current,p)&&HA(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,WA);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 JA(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var YA=`sync-status`;function XA(e,t){let n=(0,$.c)(6),{_:r}=i(),a=Ap(),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){X.dismiss(YA);return}s.current=!0,X.warning(r({id:`HGNCsl`}),{id:YA,duration:1/0})}else s.current&&e===`synced`&&(s.current=!1,X.success(r({id:`GhjUB_`}),{id:YA,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 ZA=4,QA=3,$A={Bird:Gc,Cat:Zc,Dog:il,Fish:ll,Mouse:Il,Rabbit:Fl,Shrimp:Hl,Snail:Ul,Squirrel:ql,Turtle:tu};Object.freeze(Object.keys($A));function ej(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn($A,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var tj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function nj(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=ej(n),c=s.kind===`animal`?$A[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=tr(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Hr(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)(Ts,{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)(Ds,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(As,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function rj(e){let t=tj[e.icon];return e.displayName||t||Ko._({id:`iEQQyu`})}function ij(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 aj(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=pt(),{presence:u,agentId:d}=n,f=rj(u),p=ij(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)(yi,{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)(yi,{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)(Ts,{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)(Ds,{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)(As,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function oj(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?Ko._({id:`9euN0m`,values:{count:n}}):Ko._({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)(nj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(aj,{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)(pe,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function sj(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(nj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(aj,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function cj(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=pt(),{current:s,crossDoc:c}=qA(t,r,n);if(XA(tw(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,ZA),n;e[6]===s?n=e[7]:(n=s.slice(ZA),e[6]=s,e[7]=n);let r=n,u=c.slice(0,QA),d;e[8]===c?d=e[9]:(d=c.slice(QA),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=>sj(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)(oj,{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=>sj(e,p,!0,m)),f.length>0?(0,Z.jsx)(oj,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function lj(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function uj(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 dj(e,t,n,r=!1){if(n)return{kind:`allow`,destinationPath:t};let i=lj(e);if(i===``)return{kind:`allow`,destinationPath:t};let a=lj(t);return r?{kind:`allow`,destinationPath:a?t:uj(t,i)}:a&&a.toLowerCase()!==i.toLowerCase()?{kind:`block`}:{kind:`allow`,destinationPath:uj(t,i)}}var fj=`.md`,pj=/\.(md|mdx)$/i;function mj(e,t=fj){return`${e}${t}`}function hj(e){return Hj(e).replace(pj,``)}function gj(e){return Jo(e)?yj(e.path):Io(e)?e.path:mj(e.docName,e.docExt)}function _j(e){let t=Hj(e).match(pj);return t?`.${t[1].toLowerCase()}`:void 0}function vj(e){return Hj(e)}function yj(e){let t=Hj(e.trim());return t?`${t}/`:``}function bj(e){return e.endsWith(`/`)?vj(e):hj(e)}function xj(e){return e.map(gj)}function Sj(e){return[...e].sort().join(`\0`)}function Cj(e){return Sj(xj(e))}function wj(e){let t=new Set;for(let n of e){if(Jo(n)){let e=yj(n.path);e&&t.add(e)}let e=(Jo(n)||Io(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Jo(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function Tj(e){if(!e)return[];let t=Hj(e.replace(pj,``)).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 Ej(e,t,n){let r=_j(e);if(r)return r;let i=n.find(e=>ls(e)&&e.docName===t);return i?i.docExt??fj:Vj(e).includes(`.`)?void 0:fj}function Dj(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(!Io(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 Oj(e,t,n){if(_j(e))return null;let r=n.find(e=>Io(e)&&e.path===t);return r?r.path:Vj(e).includes(`.`)?t:Dj(t,n)}function kj(e,t){let n=e.kind===`directory`,r=n?vj(e.path):hj(e.path);if(n)return{kind:`folder`,name:Hj(Vj(e.path)).replace(pj,``),path:r,treePath:jj(e.path,!0)};let i=Oj(e.path,r,t);if(i)return{kind:`asset`,name:Hj(Vj(i)),path:i,treePath:i};let a=Ej(e.path,r,t);return{kind:`file`,name:Hj(Vj(e.path)).replace(pj,``),path:r,treePath:jj(e.path,!1),docExt:a}}function Aj(e){return e.kind===`directory`?vj(e.path):e.path}function jj(e,t){return t?yj(e):pj.test(e)?e:`${e}${fj}`}function Mj(e,t,n){let r=yj(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}${fj}`;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 Nj(e,t){return e===`file`?jj(t,!1):`${vj(t)}/index${fj}`}function Pj(e,t){return t.kind===`root`||t.directoryPath==null?Vj(e):`${t.directoryPath}${Vj(e)}`}function Fj(e,t){if(t)return vj(yj(e));let n=hj(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function Ij(e,t){let n=vj(yj(e));return n?`${n}/${t}`:t}function Lj(e,t){return(t.path??Ij(e,t.src)).replace(/^\/+/,``)}function Rj(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 zj(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function Bj(e,t){let n=lj(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:hj(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:rr(i),modified:r,size:t.size}}function Vj(e){let t=Hj(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Hj(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Uj(e,t){return t.trim()}function Wj(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function Gj(e,t){let n=Uj(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function Kj(e,t,n=[],r=[]){if(t.length===0&&n.length===0&&r.length===0)return e;let i=new Map(t.map(e=>[e.fromDocName,e.toDocName])),a=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>ls(e)?{...e,docName:i.get(e.docName)??e.docName}:Jo(e)?{...e,path:$j(e.path,n)}:Io(e)?{...e,path:a.get(e.path)??$j(e.path,n)}:e)}function qj(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=>ls(e)?!i.has(e.docName)&&!rM(e.docName,n):Jo(e)?!rM(e.path,n):Io(e)?!a.has(e.path)&&!rM(e.path,n):!0)}function Jj(e,t){if(e.kind!==`asset`||t.some(t=>Io(t)&&t.path===e.path))return e;let n=Dj(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function Yj(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>eM(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>ls(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=>Jo(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(ls(i)){let e=nM(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Jo(i)){let e=tM(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function Xj(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function Zj(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function Qj(e,t){let n=e.kind===`file`?mj(e.path,e.docExt):e.path;return gg(t.contentDir,n,t.pathSeparator)}function $j(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 eM(e,t){return ls(e)&&ls(t)?e.docName===t.docName:Jo(e)&&Jo(t)||Io(e)&&Io(t)?e.path===t.path:!1}function tM(e,t,n){return e===t?n:nM(e,t,n)}function nM(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function rM(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function iM(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)(nd,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function aM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=ai(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(rd,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function oM(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)(ud,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function sM(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=ai(`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)(id,{children:(0,Z.jsx)(ad,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function cM(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=ai(`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)(od,{"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 lM(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=ai(`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)(jo,{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)(dd,{"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 uM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=ai(`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)(fd,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dM(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=ai(`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)(cd,{children:(0,Z.jsx)(Do,{})})}),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)(sd,{"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 fM(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=ai(`-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)(ld,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var pM=`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`,mM=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,hM={start:[Ui.Space],cancel:[Ui.Esc],end:[Ui.Space,Ui.Enter]};function gM(e){return ai(pM,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function _M(e){return e?void 0:-1}function vM({className:e,isDragging:t}){return ai(e,t&&mM)}function yM(e){return e.code===Ui.Enter&&e.target===e.currentTarget}function bM({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&yM(e)?`activate-tab`:`delegate-sortable`}function xM({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:ja.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 SM(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 CM(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 wM=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 xa(e)},TM=[`.md`,`.mdx`],EM=`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`,DM=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,OM=ai(DM,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),kM=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function AM(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function jM(e){let t=Go(e);window.location.hash!==t&&(window.location.hash=t)}function MM(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function NM(e,t){let n=[t,...TM].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 PM(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:_}=Li(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=xM({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=bM({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=vM({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 FM(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=qe(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=qe(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)(aM,{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)(cM,{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)(cM,{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)(cM,{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)(fM,{}),(0,Z.jsx)(cM,{"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)(sM,{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)(iM,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function IM(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)(Pl,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(si,{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=gM(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=_M(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)(ps,{"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)(si,{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 LM(e){let t=(0,$.c)(1),{docName:n}=e;if(PC(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(ds,{"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 RM(){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}=pt(),{_:T}=i(),{pageMeta:E}=es(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[j,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G;e[0]!==n||e[1]!==t||e[2]!==a?(G=n??(a?Ye(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,Y,ee;e[10]===t?(Y=e[11],ee=e[12]):(Y=()=>{W.current=t},ee=[t],e[10]=t,e[11]=Y,e[12]=ee),(0,Q.useEffect)(Y,ee);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 re,ie;e[16]===j?(re=e[17],ie=e[18]):(re=()=>{j&&(B.current?.focus(),B.current?.select())},ie=[j],e[16]=j,e[17]=re,e[18]=ie),(0,Q.useEffect)(re,ie);let ae,oe;e[19]!==v||e[20]!==j?(ae=()=>{!j||v.includes(j.tabId)||(H.current=!0,U.current=null,N(null),F(``),L(null),z(!1))},oe=[v,j],e[19]=v,e[20]=j,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,N({docName:t,tabId:e}),F(n[n.length-1]),L(null)},ce=function(){H.current=!0,U.current=null,N(null),F(``),L(null),z(!1)},le=async function(){if(H.current){H.current=!1;return}if(V.current)return;let e=j?.docName;if(!e){ce();return}let t=Uj(`file`,NM(P,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===U.current){B.current?.focus();return}if(!Wj(t)){L(T({id:`P8yDjG`})),B.current?.focus();return}let i=Gj({kind:`file`,path:e,name:r},t);V.current=!0,z(!0),L(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){z(!1),V.current=!1;return}let r=await ve(n,`Server error (HTTP ${n.status})`);if(!r.ok){L(r.title),z(!1),V.current=!1,U.current=t,B.current?.focus();return}let a=A(Xr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,s=Xj(o,a);Bt(a);let c=!0;try{let e=Zj(a,p(),m);await Promise.all(e.map(e=>l(e))),x(a),is([`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}),X.error(T({id:`MUBR8r`}))}H.current=!0,N(null),F(``),L(null),z(!1),V.current=!1,U.current=null,c&&s&&s!==o&&jM(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),L(T({id:`HIb0vl`})),z(!1),V.current=!1,U.current=t,B.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===g?de=e[24]:(de=new Set(g),e[23]=g,e[24]=de);let fe=de,pe;e[25]===O?pe=e[26]:(pe=CM(O),e[25]=O,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==u||e[30]!==f||e[31]!==fe?(ge=function(e){let t=[],n=[];for(let r of e)fe.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[29]=u,e[30]=f,e[31]=fe,e[32]=ge):ge=e[32];let _e=ge,ye;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ye={activationConstraint:{distance:8}},e[33]=ye):ye=e[33];let be;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(be={coordinateGetter:ha,keyboardCodes:hM},e[34]=be):be=e[34];let xe=Ci(ra(_a,ye),ra(ya,be)),Se;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){k(SM(D.current))},e[35]=Se):Se=e[35];let Ce=Se,we;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(){k(null)},e[36]=we):we=e[36];let Te=we,Ee;e[37]!==Te||e[38]!==S||e[39]!==w?(Ee=function(e){Te();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(zi([...w],r,i),t)},e[37]=Te,e[38]=S,e[39]=w,e[40]=Ee):Ee=e[40];let De=Ee,Oe=ue?``:void 0,ke;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(ke=ai(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,ue&&`[-webkit-app-region:drag]`),e[41]=ke):ke=e[41];let Ae=MM,je;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(je=ai(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=je):je=e[42];let Ne=Ya,Pe=wM,Fe;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Fe={container:typeof document<`u`?document.body:void 0},e[43]=Fe):Fe=e[43];let Ie=pa,Le;e[44]===w?Le=e[45]:(Le=[...w],e[44]=w,e[45]=Le);let Re=da,ze=w.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(FM,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PM,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:ai(EM,t?DM:OM),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:kM,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:gM(t),tabIndex:_M(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(ps,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=ft(e),n=e===K,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=Me(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(FM,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PM,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:ai(EM,n?DM:OM),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:kM,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:ai(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:ai(`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)(IM,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=Me(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(FM,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PM,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:ai(EM,n?DM:OM),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:kM,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:ai(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:ai(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(IM,{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}=Me(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=j?.tabId===e,x=`editor-tab-rename-error-${AM(a)}`;return(0,Z.jsx)(FM,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(PM,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:ai(EM,n?DM:OM,v&&I&&`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)(dC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(gC,{ref:B,value:P,disabled:R,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":I?!0:void 0,"aria-describedby":I?x:void 0,"aria-busy":R||void 0,title:I??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=>{F(NM(e.target.value,l)),L(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(pC,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(hC,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),I?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:I}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:kM,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,a)},tabIndex:-1,children:[(0,Z.jsx)(LM,{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)(IM,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),Be;e[46]!==Ie||e[47]!==Le||e[48]!==Re||e[49]!==ze?(Be=(0,Z.jsx)(Ie,{items:Le,strategy:Re,children:ze}),e[46]=Ie,e[47]=Le,e[48]=Re,e[49]=ze,e[50]=Be):Be=e[50];let Ve;e[51]!==Ne||e[52]!==Te||e[53]!==De||e[54]!==Ce||e[55]!==xe||e[56]!==!1||e[57]!==Pe||e[58]!==Fe||e[59]!==Be||e[60]!==he?(Ve=(0,Z.jsx)(Ne,{sensors:xe,autoScroll:!1,collisionDetection:Pe,modifiers:he,onDragStart:Ce,onDragEnd:De,onDragCancel:Te,accessibility:Fe,children:Be}),e[51]=Ne,e[52]=Te,e[53]=De,e[54]=Ce,e[55]=xe,e[56]=!1,e[57]=Pe,e[58]=Fe,e[59]=Be,e[60]=he,e[61]=Ve):Ve=e[61];let Ue;e[62]===T?Ue=e[63]:(Ue=T({id:`3YvS-c`}),e[62]=T,e[63]=Ue);let We;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(M,{"aria-hidden":`true`}),e[64]=We):We=e[64];let Ge;e[65]!==_||e[66]!==Ue?(Ge=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ue,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:We})}),e[65]=_,e[66]=Ue,e[67]=Ge):Ge=e[67];let Ke;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Z.jsx)(Ds,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=Ke):Ke=e[68];let qe;e[69]===Ge?qe=e[70]:(qe=(0,Z.jsxs)(As,{children:[Ge,Ke]}),e[69]=Ge,e[70]=qe);let Je;e[71]!==je||e[72]!==Ve||e[73]!==qe?(Je=(0,Z.jsxs)(`div`,{className:je,children:[Ve,qe]}),e[71]=je,e[72]=Ve,e[73]=qe,e[74]=Je):Je=e[74];let Xe;return e[75]!==Oe||e[76]!==ke||e[77]!==Ae||e[78]!==Je?(Xe=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":Oe,className:ke,onWheel:Ae,children:Je}),e[75]=Oe,e[76]=ke,e[77]=Ae,e[78]=Je,e[79]=Xe):Xe=e[79],Xe}function zM(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 BM(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 VM=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:Ke},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:Gd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:Fo},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:zM},{label:`Twitter`,href:`https://x.com/inkeep`,icon:BM}],HM=()=>{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)(kt,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(si,{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)(As,{children:[o,(0,Z.jsx)(Ds,{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=VM.map(e=>{let{label:n,href:r,icon:i}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>va(e,r),onAuxClick:e=>va(e,r),className:`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:`size-4 shrink-0`}),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-64 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)(pe,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m},UM=(0,Q.createContext)(null);function WM(e){let t=(0,$.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(UM,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function GM(){return(0,Q.use)(UM)}function KM(e){let t=(0,$.c)(39),{input:n,states:r,dispatch:a,isElectronHost:o,align:c,className:l}=e,u=c===void 0?`end`:c,d=l===void 0?`min-w-[220px]`:l,{_:f}=i(),p=GM(),m;t[0]!==a||t[1]!==n?(m=e=>{n!==null&&a(e.id,n)},t[0]=a,t[1]=n,t[2]=m):m=t[2];let h=m,g,_,v,y,b,x,S;if(t[3]!==u||t[4]!==d||t[5]!==h||t[6]!==o||t[7]!==r||t[8]!==p){let e;t[16]===r?e=t[17]:(e=e=>r[e.id]?.installed===!0,t[16]=r,t[17]=e);let n=Fh.filter(e),i;t[18]===r?i=t[19]:(i=Fh.some(e=>r[e.id]?.installed==null),t[18]=r,t[19]=i),_=i,v=n.length===0&&p===null,g=$a,y=u,b=d,x=`open-in-agent-menu`;let a;t[20]!==h||t[21]!==o||t[22]!==r?(a=e=>{let t=r[e.id];return(0,Z.jsx)(lx,{target:e,installState:t,isElectronHost:o,onSelect:()=>h(e)},e.id)},t[20]=h,t[21]=o,t[22]=r,t[23]=a):a=t[23],S=n.map(a),t[3]=u,t[4]=d,t[5]=h,t[6]=o,t[7]=r,t[8]=p,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S}else g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15];let C;t[24]!==_||t[25]!==v?(C=v?(0,Z.jsx)(Fa,{disabled:!0,"data-testid":`open-in-agent-empty`,children:_?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})}):null,t[24]=_,t[25]=v,t[26]=C):C=t[26];let w;t[27]!==f||t[28]!==n||t[29]!==p?(w=p===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ka,{}),(0,Z.jsxs)(Fa,{onSelect:()=>{n!==null&&p.launchInTerminal(n)},disabled:n===null,"data-testid":`open-in-agent-terminal`,"aria-label":f({id:`AcK_r0`}),children:[(0,Z.jsx)(Kl,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`AcK_r0`})})]})]}),t[27]=f,t[28]=n,t[29]=p,t[30]=w):w=t[30];let T;return t[31]!==g||t[32]!==y||t[33]!==b||t[34]!==x||t[35]!==S||t[36]!==C||t[37]!==w?(T=(0,Z.jsxs)(g,{align:y,className:b,"data-testid":x,children:[S,C,w]}),t[31]=g,t[32]=y,t[33]=b,t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T):T=t[38],T}function qM(e){let t=(0,$.c)(21),{input:n,open:r,onOpenChange:i}=e,{states:a,refresh:o}=Kg(),{dispatch:c}=Fg(),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(!1);if(Mh())return null;let f=typeof window<`u`&&window.okDesktop!=null,p=r??l,m;t[0]!==i||t[1]!==r||t[2]!==o?(m=e=>{r===void 0&&u(e),i?.(e),e&&o()},t[0]=i,t[1]=r,t[2]=o,t[3]=m):m=t[3];let h=m,g=n===null,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=f?()=>{d.current=!0}:void 0,t[4]=_):_=t[4];let v;t[5]===h?v=t[6]:(v=f?()=>{if(d.current){d.current=!1;return}h(!0)}:void 0,t[5]=h,t[6]=v);let y,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(vi,{className:`size-3.5`,"aria-hidden":`true`}),b=(0,Z.jsx)(s,{id:`O7_W_a`}),t[7]=y,t[8]=b):(y=t[7],b=t[8]);let x;t[9]!==v||t[10]!==g?(x=(0,Z.jsx)(ao,{asChild:!0,children:(0,Z.jsxs)(si,{variant:`ghost`,size:`sm`,disabled:g,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:_,onClick:v,children:[y,b]})}),t[9]=v,t[10]=g,t[11]=x):x=t[11];let S;t[12]!==c||t[13]!==n||t[14]!==a?(S=(0,Z.jsx)(KM,{input:n,states:a,dispatch:c,isElectronHost:f}),t[12]=c,t[13]=n,t[14]=a,t[15]=S):S=t[15];let C;return t[16]!==h||t[17]!==p||t[18]!==x||t[19]!==S?(C=(0,Z.jsxs)(ro,{open:p,onOpenChange:h,modal:!1,children:[x,S]}),t[16]=h,t[17]=p,t[18]=x,t[19]=S,t[20]=C):C=t[20],C}var JM=50,YM=()=>{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,XS.preload()},JM))},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=Vh)},u=(0,Z.jsx)(Bl,{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)(Ts,{asChild:!0,children:(0,Z.jsxs)(si,{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)(As,{children:[d,(0,Z.jsx)(Ds,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function XM(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=oo(),[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 sa({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:ka,toastSuccess:nN,toastError:tN,logEvent:eN});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{X.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)(Vl,{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)(si,{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)(ko,{ref:f,readOnly:!0,value:A,onFocus:$M,onClick:QM,onContextMenu:ZM,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)(pe,{open:y,onOpenChange:x,children:[D,M]}),t[26]=D,t[27]=M,t[28]=y,t[29]=N):N=t[29],N}function ZM(e){return e.currentTarget.select()}function QM(e){return e.currentTarget.select()}function $M(e){return e.currentTarget.select()}function eN(e){return console.log(e)}function tN(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function nN(e){return X.success(e)}function rN(e){let t=(0,$.c)(44),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=pt(),{state:p}=jk(),m=Bh(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=Ks(`toggle-files-sidebar`),t[0]=h):h=t[0];let g=h,_=Ks(`command-palette`),v=po(),[y,b]=(0,Q.useState)(!1),x;bb0:{if(f===null){let e;t[1]===v?e=t[2]:(e=yg({workspace:v}),t[1]=v,t[2]=e),x=e;break bb0}if(f.kind===`folder`){if(!v){x=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==v?(e=Sg({folderRelativePath:f.folderPath,workspace:v}),t[3]=f.folderPath,t[4]=v,t[5]=e):e=t[5],x=e;break bb0}let e;t[6]!==d||t[7]!==v?(e=vg({docName:d,workspace:v}),t[6]=d,t[7]=v,t[8]=e):e=t[8],x=e}let S=c??x,C;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=lo(f.folderPath),t[9]=f.folderPath,t[10]=e),C=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=Ea(d),t[11]=d,t[12]=e),C=e;break bb1}C=null}let w=C,T=typeof window<`u`&&window.okDesktop!=null,E=p===`collapsed`,D=T?``:void 0,O=T&&E&&`pl-[78px]`,k;t[13]===O?k=t[14]:(k=ai(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,T&&`[-webkit-app-region:drag]`,O,T&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[13]=O,t[14]=k);let A=!m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Ik,{className:ai(`-ml-1 shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Ds,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:g}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:g}})})]}),E&&a&&(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(si,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:_}}),"data-telemetry-event":`ok.editor_header.search.click`,className:ai(`shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(te,{"aria-hidden":`true`})})}),(0,Z.jsx)(Ds,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:_}})})]}),(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(RM,{})]}),j;t[15]===A?j=t[16]:(j=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:A}),t[15]=A,t[16]=j);let M;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(M=ai(`flex shrink-0 items-center justify-end gap-2 px-3`,T&&`[&>*]:[-webkit-app-region:no-drag]`),t[17]=M):M=t[17];let N;t[18]!==S||t[19]!==l||t[20]!==o||t[21]!==y||t[22]!==b||t[23]!==w||t[24]!==m?(N=!m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qM,{input:S,open:o,onOpenChange:l}),(0,Z.jsx)(XM,{input:w,onClickWhenNoRemote:()=>b(!0)}),(0,Z.jsx)(fo,{open:y,onOpenChange:b})]}),t[18]=S,t[19]=l,t[20]=o,t[21]=y,t[22]=b,t[23]=w,t[24]=m,t[25]=N):N=t[25];let P;t[26]!==r||t[27]!==n?(P=(0,Z.jsx)(Va,{onSignIn:n,onSetIdentity:r}),t[26]=r,t[27]=n,t[28]=P):P=t[28];let F,I,L;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(cj,{}),I=(0,Z.jsx)(Pi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),L=(0,Z.jsx)(hd,{}),t[29]=F,t[30]=I,t[31]=L):(F=t[29],I=t[30],L=t[31]);let R;t[32]===m?R=t[33]:(R=!m&&(0,Z.jsx)(YM,{}),t[32]=m,t[33]=R);let z;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(HM,{}),t[34]=z):z=t[34];let B;t[35]!==N||t[36]!==P||t[37]!==R?(B=(0,Z.jsxs)(`div`,{className:M,children:[N,P,F,I,L,R,z]}),t[35]=N,t[36]=P,t[37]=R,t[38]=B):B=t[38];let V;return t[39]!==B||t[40]!==D||t[41]!==k||t[42]!==j?(V=(0,Z.jsxs)(`header`,{"data-electron-drag":D,className:k,children:[j,B]}),t[39]=B,t[40]=D,t[41]=k,t[42]=j,t[43]=V):V=t[43],V}var iN=`open-knowledge:terminal-launch`;function aN(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(iN,{detail:{prompt:e}}))}function oN(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(iN,n),()=>t.removeEventListener(iN,n)}function sN(e){let t=(0,$.c)(61),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]=T_(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(Hv[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=Ca(),{projectLocalConfig:O,projectLocalSynced:k}=oe(),A=po(),{activeDocName:j}=pt(),M=D?.hasRemote,N=D?.pushPermission?.checkStatus,P;t[2]!==g||t[3]!==O||t[4]!==k||t[5]!==M||t[6]!==N?(P=k_({autoSyncOnboardingDismissed:g,hasRemote:M,projectLocalSynced:k,projectLocalConfig:O,pushPermissionCheckStatus:N}),t[2]=g,t[3]=O,t[4]=k,t[5]=M,t[6]=N,t[7]=P):P=t[7];let F=P,I,L;t[8]===j?(I=t[9],L=t[10]):(I=()=>{let e=function(e){let t=e.detail;t&&j&&yc(j,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(__,e),()=>window.removeEventListener(__,e)},L=[j],t[8]=j,t[9]=I,t[10]=L),(0,Q.useEffect)(I,L);let R,z;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?w(lN):e===`new-terminal`&&w(!0)})},z=[],t[11]=R,t[12]=z):(R=t[11],z=t[12]),(0,Q.useEffect)(R,z);let B,V;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{if(window.okDesktop!=null)return;let e=function(e){qs(e,`toggle-terminal-panel`)&&(e.preventDefault(),w(cN))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},B=[],t[13]=B,t[14]=V):(B=t[13],V=t[14]),(0,Q.useEffect)(V,B);let H,U;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>oN(e=>{w(!0),E(t=>({prompt:e,nonce:(t?.nonce??0)+1}))}),U=[],t[15]=H,t[16]=U):(H=t[15],U=t[16]),(0,Q.useEffect)(H,U);let W,G;t[17]===C?(W=t[18],G=t[19]):(W=()=>{C||E(null)},G=[C],t[17]=C,t[18]=W,t[19]=G),(0,Q.useEffect)(W,G);let K,q;t[20]===C?(K=t[21],q=t[22]):(K=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:C})},q=[C],t[20]=C,t[21]=K,t[22]=q),(0,Q.useEffect)(K,q);let J,Y;t[23]===C?(J=t[24],Y=t[25]):(J=()=>{window.okDesktop!=null&&C&&Ma()},Y=[C],t[23]=C,t[24]=J,t[25]=Y),(0,Q.useEffect)(J,Y),E_(D?.pausedReason);let ee;t[26]===s?ee=t[27]:(ee=function(e){l(e),s(e)},t[26]=s,t[27]=ee);let te=ee,ne;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){y(e),e||x(null)},t[28]=ne):ne=t[28];let re=ne,ie;t[29]!==a||t[30]!==j||t[31]!==A?(ie={openSelection(e){let t=wg({docName:e.docName??j,workspace:A,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown});return t===null?(X.error(a({id:`_VRtd7`})),!1):(x(t),y(!0),!0)}},t[29]=a,t[30]=j,t[31]=A,t[32]=ie):ie=t[32];let ae,se;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{p(`auth`),d(!0)},se=()=>{p(`identity`),d(!0)},t[33]=ae,t[34]=se):(ae=t[33],se=t[34]);let ce;t[35]!==r||t[36]!==b||t[37]!==v?(ce=(0,Z.jsx)(rN,{onSignIn:ae,onSetIdentity:se,onOpenSearch:r,openInAgentMenuOpen:v,openInAgentMenuInput:b,onOpenInAgentMenuOpenChange:re}),t[35]=r,t[36]=b,t[37]=v,t[38]=ce):ce=t[38];let le;t[39]!==m||t[40]!==c||t[41]!==te||t[42]!==T||t[43]!==C?(le=(0,Z.jsx)(IA,{editorMode:c,onModeChange:te,activeTab:m,onActiveTabChange:h,terminalBridge:S,terminalVisible:C,onTerminalVisibleChange:w,terminalLaunch:T}),t[39]=m,t[40]=c,t[41]=te,t[42]=T,t[43]=C,t[44]=le):le=t[44];let ue;t[45]!==ie||t[46]!==ce||t[47]!==le?(ue=(0,Z.jsxs)(Tc,{value:ie,children:[ce,le]}),t[45]=ie,t[46]=ce,t[47]=le,t[48]=ue):ue=t[48];let de=f===`identity`,fe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>{d(!1)},t[49]=fe):fe=t[49];let pe;t[50]!==u||t[51]!==de?(pe=(0,Z.jsx)(Xi,{open:u,onOpenChange:d,identityPrompt:de,onSuccess:fe}),t[50]=u,t[51]=de,t[52]=pe):pe=t[52];let me;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(me=()=>_(!0),t[53]=me):me=t[53];let he;t[54]===F?he=t[55]:(he=(0,Z.jsx)(D_,{open:F,onResolved:me}),t[54]=F,t[55]=he);let ge;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(m_,{}),t[56]=ge):ge=t[56];let _e;return t[57]!==ue||t[58]!==pe||t[59]!==he?(_e=(0,Z.jsxs)(Z.Fragment,{children:[ue,pe,he,ge]}),t[57]=ue,t[58]=pe,t[59]=he,t[60]=_e):_e=t[60],_e}function cN(e){return!e}function lN(e){return!e}function uN(e){let t=Go(Ho(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function dN(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Ni();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)(ds,{"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)(ds,{"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(fN),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 fN(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(si,{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:()=>uN(e.file),children:[(0,Z.jsx)(ds,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var pN=`<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>
|