@inkeep/open-knowledge 0.9.0-beta.30 → 0.9.0-beta.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +32 -32
  4. package/dist/constants-mptAAyp9.mjs +2 -0
  5. package/dist/{dist-DFlSVgXA.mjs → dist-C4I-b8-m.mjs} +1 -1
  6. package/dist/{dist-DpfmiCV4.mjs → dist-CA-yDHEq.mjs} +10 -10
  7. package/dist/{gh-detect-B32mymgh.mjs → gh-detect-BZ1nPNKy.mjs} +2 -2
  8. package/dist/index.mjs +1 -1
  9. package/dist/init-6FMYGQaY.mjs +1 -0
  10. package/dist/{init-BnZOMZQO.mjs → init-Dt8uSjge.mjs} +6 -6
  11. package/dist/loader-ClwCZw8O.mjs +1 -0
  12. package/dist/{loader-DDiDxthB.mjs → loader-DWCsV2Sz.mjs} +3 -3
  13. package/dist/preview-C59RI9mp.mjs +1 -0
  14. package/dist/{preview-CSNkLWHD.mjs → preview-Ddp3FH-6.mjs} +2 -2
  15. package/dist/public/assets/{ActivityModeContent-BDyf1132.js → ActivityModeContent-DjLptssw.js} +1 -1
  16. package/dist/public/assets/{DocumentContext-B8UGtk6l.js → DocumentContext-BzUdezp1.js} +1 -1
  17. package/dist/public/assets/{GraphPanel-C1O9mJAk.js → GraphPanel-D2ZWMZHw.js} +1 -1
  18. package/dist/public/assets/{SettingsDialogBody-DcBkN-yS.js → SettingsDialogBody-Y7msJVE9.js} +1 -1
  19. package/dist/public/assets/{SourceEditor-BgMXvzLz.js → SourceEditor-ztotrWnx.js} +1 -1
  20. package/dist/public/assets/{config-validation-events-EIXjKoxp.js → config-validation-events-lBcb_6bi.js} +1 -1
  21. package/dist/public/assets/{index-CCYpQTHa.js → index-BzVbhruC.js} +4 -4
  22. package/dist/public/assets/{prop-types-BwZmdnc0.js → prop-types-DhUmqQsM.js} +98 -98
  23. package/dist/public/assets/{target-navigation-intent-CPYp4bg0.js → target-navigation-intent-DZxquxsX.js} +1 -1
  24. package/dist/public/assets/{typing-burst-detector-B1s9ulvg.js → typing-burst-detector-DWPni1ys.js} +1 -1
  25. package/dist/public/index.html +6 -6
  26. package/dist/{repair-launch-json-D2yuZ2m2.mjs → repair-launch-json-CpHkwEQe.mjs} +2 -2
  27. package/dist/{repair-mcp-configs-BoZZdQfe.mjs → repair-mcp-configs-DTo4wxei.mjs} +2 -2
  28. package/dist/repair-skills-DthZy9gs.mjs +1 -0
  29. package/dist/{repair-skills-BSxYtEdR.mjs → repair-skills-dYAzCUrj.mjs} +2 -2
  30. package/dist/{server-lock-BpjJj3OD-dXtN3YgR.mjs → server-lock-BpjJj3OD-D8yiVjLU.mjs} +20 -20
  31. package/dist/server-lock-CyhBidkz-K4Rq177O.mjs +1 -0
  32. package/dist/{src-DlZY1w-G.mjs → src-DQzHDEzB.mjs} +2 -2
  33. package/dist/start-DntS9VW0.mjs +1 -0
  34. package/dist/{start-Gdo8a38H.mjs → start-k1rm0C8J.mjs} +2 -2
  35. package/dist/{write-project-skill-PXFMiJn0.mjs → write-project-skill-CD2-O-zT.mjs} +2 -2
  36. package/package.json +1 -1
  37. package/dist/constants-nygsGL1t.mjs +0 -2
  38. package/dist/init-D1mwIDbj.mjs +0 -1
  39. package/dist/loader-C_bcUreu.mjs +0 -1
  40. package/dist/preview-CirVU2JW.mjs +0 -1
  41. package/dist/repair-skills-BwSKUIVg.mjs +0 -1
  42. package/dist/server-lock-CyhBidkz-B9YGymFa.mjs +0 -1
  43. package/dist/start-Cenma9Sz.mjs +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-CuUV_174.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-Jk72eOkX.js","./compiler-runtime-Cs91PcD2.js","./button-DenIdY-r.js","./checkbox-Co7Tjlri.js","./dialog-B1es0EvU.js","./collapsible-BhpeB6tu.js","./textarea-luaT-nOK.js","./dist-DicqJavT.js","./dist-P7DYrfOB.js","./project-paths-CsGHlmFh.js","./McpConsentDialogBody-w45-uKw5.js","./label-DwEePOBC.js","./mcp-consent-store-CijO54Jd.js","./ActivityPanelDiffView-BNQupLE1.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-C1O9mJAk.js","./prop-types-BwZmdnc0.js","./w3c-keyname-B5t0fahT.js","./toggle-group-Cs-1L92l.js","./panel-BNBODYwB.js","./min-VayDM1tY.js","./src-BYmEUJ3I.js","./colors-BbIH8S-B.js","./ordinal-C6wHcby9.js","./init-gbiKrEzm.js","./isObjectLike-BNNgtFA6.js","./now--RAZR_wd.js","./isSymbol-CiN6ou2H.js","./target-navigation-intent-CPYp4bg0.js","./ActivityModeContent-BDyf1132.js","./DocumentContext-B8UGtk6l.js","./dist-Cp-iTcML.js","./dist-D2RGH7XO.js","./dist-BiYnsAMa.js","./dist-B3L7cm0M.js","./dist-CATLRngz.js","./stex-J8UMaf7u.js","./DocumentContext-B0sQn39F.css","./agent-presence-DxGcS3q2.js","./SettingsDialogBody-DcBkN-yS.js","./config-validation-events-EIXjKoxp.js","./SourceEditor-BgMXvzLz.js","./typing-burst-detector-B1s9ulvg.js"])))=>i.map(i=>d[i]);
2
- import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{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,B as h,Bn as g,Bt as _,Cn as v,Ct as y,Dn as b,En as x,F as S,Fn as C,Ft as w,Gn as T,Gt as E,H as D,Hn as O,Ht as k,I as A,It as j,J as M,Jn as N,Jt as P,Kn as F,Kt as I,L,Ln as R,Lt as z,Mn as B,Mt as V,Nn as H,Nt as U,O as W,On as G,Ot as ee,Pn as te,Pt as K,Q as q,Qn as ne,Qt as re,R as ie,Rn as ae,Rt as oe,Sn as se,St as ce,Tn as le,Tt as ue,U as de,Un as fe,Ut as pe,V as me,Vn as he,Vt as ge,Wn as _e,Wt as ve,X as ye,Xn as be,Xt as xe,Yn as Se,Yt as Ce,Z as we,Zn as Te,Zt as Ee,_r as De,_t as Oe,a as ke,an as Ae,ar as je,at as Me,b as Ne,br as Pe,bt as Fe,c as Ie,cn as Le,cr as Re,ct as ze,d as Be,dr as Ve,dt as He,en as Ue,er as We,et as Ge,f as Ke,fr as qe,ft as Je,g as Ye,gr as J,gt as Xe,h as Ze,ht as Qe,i as $e,in as et,ir as tt,it as nt,j as rt,jn as it,jt as at,k as ot,kn as st,kt as ct,l as lt,lr as ut,lt as dt,m as ft,mr as pt,mt,n as ht,nn as gt,nr as _t,nt as vt,o as yt,on as bt,or as xt,ot as St,p as Ct,pt as wt,qn as Tt,qt as Et,r as Dt,rn as Ot,rr as kt,rt as At,s as jt,sn as Mt,sr as Nt,st as Pt,t as Ft,tn as It,tr as Lt,tt as Rt,u as zt,un as Bt,ur as Vt,ut as Ht,v as Ut,vr as Wt,vt as Gt,wn as Kt,wt as qt,xr as Jt,xt as Yt,y as Xt,yr as Zt,yt as Qt,z as $t,zn as en,zt as tn}from"./DocumentContext-B8UGtk6l.js";import{A as nn,C as rn,D as an,E as on,O as sn,S as cn,T as ln,_ as un,a as dn,b as fn,c as pn,d as mn,f as hn,g as gn,h as _n,i as vn,k as yn,l as bn,m as xn,n as Sn,o as Cn,p as wn,r as Tn,s as En,t as Dn,u as On,v as kn,w as An,x as jn,y as Mn}from"./panel-BNBODYwB.js";import{$ as Nn,$n as Pn,A as Fn,Ar as In,C as Ln,Cn as Rn,D as zn,Di as Bn,Dt as Vn,Ei as Hn,En as Un,Et as Wn,F as Gn,Fn as Kn,Ft as qn,G as Jn,Gi as Yn,Gn as Xn,Gr as Zn,H as Qn,Hn as $n,Hr as er,I as tr,In as nr,Ir as rr,J as ir,Ji as ar,K as or,Ki as sr,Kn as cr,Ln as lr,M as ur,N as dr,O as fr,Oi as pr,On as mr,Ot as hr,P as gr,Pn as _r,Pt as vr,Qr as yr,Qt as br,Rn as xr,Rr as Sr,S as Cr,St as wr,Tn as Tr,Tt as Er,U as Dr,Ui as Y,Un as Or,Ur as kr,Ut as Ar,Vr as jr,W as Mr,Wi as Nr,Wn as Pr,Wr as Fr,X as Ir,Xn as Lr,Y as Rr,Yn as zr,Yr as Br,Z as Vr,Zn as Hr,Zr as Ur,_i as Wr,_r as Gr,a as Kr,an as qr,b as Jr,c as Yr,d as Xr,di as Zr,et as Qr,f as $r,fi as ei,fn as ti,gi as ni,gr as ri,h as ii,i as ai,ii as oi,ir as si,j as ci,jt as li,k as ui,kt as di,l as fi,m as pi,n as mi,nn as hi,nt as gi,o as _i,on as vi,ot as yi,p as bi,pi as xi,pr as Si,q as Ci,qi as wi,qr as Ti,r as Ei,ri as Di,rr as Oi,s as ki,tr as Ai,u as ji,vn as Mi,vt as Ni,wi as Pi,wn as Fi,xn as Ii,xt as Li,yi as Ri,yr as zi,zn as Bi,zr as Vi}from"./prop-types-BwZmdnc0.js";import{C as Hi,S as Ui,d as Wi,g as Gi,l as Ki,m as qi,o as Ji,p as Yi,t as Xi,w as Zi,x as Qi}from"./button-DenIdY-r.js";import{a as $i,c as ea,d as ta,f as na,i as ra,l as ia,m as aa,n as oa,o as sa,p as ca,r as la,s as ua,t as da,u as fa}from"./agent-presence-DxGcS3q2.js";import{$ as pa,$t as ma,A as ha,At as ga,B as _a,Bt as va,C as ya,D as ba,E as xa,Et as Sa,F as Ca,Ft as wa,G as Ta,Gt as Ea,H as Da,Ht as Oa,I as ka,It as Aa,J as ja,Jt as Ma,K as Na,Kt as Pa,L as Fa,Lt as Ia,M as La,Mt as Ra,N as za,Nt as Ba,O as Va,Ot as Ha,P as Ua,Pt as Wa,Q as Ga,Qt as Ka,R as qa,Rt as Ja,S as Ya,T as Xa,U as Za,Ut as Qa,V as $a,Vt as eo,W as to,Wt as no,X as ro,Xt as io,Y as ao,Yt as oo,Z as so,Zt as co,_t as lo,an as uo,at as fo,b as po,bt as mo,cn as ho,dt as go,en as _o,et as vo,ft as yo,gt as bo,ht as xo,it as So,j as Co,jt as wo,k as To,kt as Eo,lt as Do,m as Oo,mt as ko,nn as Ao,nt as jo,o as Mo,on as No,ot as Po,p as Fo,pt as Io,q as Lo,qt as Ro,r as zo,rn as Bo,rt as Vo,sn as Ho,st as Uo,t as Wo,tn as Go,tt as Ko,u as qo,ut as Jo,vt as Yo,w as Xo,wt as Zo,x as Qo,y as $o,yt as es,z as ts,zt as ns}from"./config-validation-events-EIXjKoxp.js";import{i as rs,n as is,r as as,t as os}from"./toggle-group-Cs-1L92l.js";import{a as ss,b as cs,c as ls,i as us,n as ds,o as fs,s as ps,t as ms,v as hs,x as gs,y as X}from"./dialog-B1es0EvU.js";import{a as _s,i as vs,n as ys,r as bs,t as xs}from"./collapsible-BhpeB6tu.js";import{t as Ss}from"./checkbox-Co7Tjlri.js";import{t as Cs}from"./label-DwEePOBC.js";import{n as ws,r as Ts}from"./textarea-luaT-nOK.js";import{i as Es,n as Ds,r as Os}from"./project-paths-CsGHlmFh.js";import{n as ks,t as As}from"./mcp-consent-store-CijO54Jd.js";import{$ as js,At as Ms,Ct as Ns,Dt as Ps,Ft as Fs,I as Is,It as Ls,J as Rs,Mt as zs,Ot as Bs,Pt as Vs,Q as Hs,Tt as Us,X as Ws,Z as Gs,at as Ks,bt as qs,c as Js,jt as Ys,k as Xs,w as Zs}from"./dist-D2RGH7XO.js";import{n as Qs}from"./dist-BiYnsAMa.js";import{n as $s,o as ec,r as tc,t as nc}from"./typing-burst-detector-B1s9ulvg.js";import{t as rc}from"./target-navigation-intent-CPYp4bg0.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 ic(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.8.1`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-CuUV_174.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function ac(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=>{gn(e,()=>t.signal,()=>n=!0)},u=Mn(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?kn:un;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?sc:oc,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:oc(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 oc(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 sc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var cc=class extends hn{#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||lc(),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=wn({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),_n.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function lc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var uc=class extends nn{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 cc({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=dc(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=dc(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=dc(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=dc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){_n.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=>rn(t,e))}findAll(e={}){return this.getAll().filter(t=>rn(e,t))}notify(e){_n.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return _n.batch(()=>Promise.all(e.map(e=>e.continue().catch(ln))))}};function dc(e){return e.options.scope?.id}var fc=class extends nn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??cn(r,t),a=this.get(i);return a||(a=new mn({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(){_n.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=>An(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>An(e,t)):t}notify(e){_n.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){_n.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){_n.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},pc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new fc,this.#t=e.mutationCache||new uc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=yn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=xn.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(an(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=fn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return _n.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;_n.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return _n.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=_n.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ln).catch(ln)}invalidateQueries(e,t={}){return _n.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=_n.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(ln)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(ln)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(an(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ln).catch(ln)}fetchInfiniteQuery(e){return e.behavior=ac(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ln).catch(ln)}ensureInfiniteQueryData(e){return e.behavior=ac(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return xn.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(jn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{on(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(jn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{on(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||=cn(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===sn&&(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()}},mc=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}}}})),hc=t(((e,t)=>{t.exports=mc()})),gc=t((e=>{var t=hc(),n=r(),i=Zi();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 ee(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 te(){B(H),B(U),B(W)}function K(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function q(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ne,re;function ie(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``,re=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-CuUV_174.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-Jk72eOkX.js","./compiler-runtime-Cs91PcD2.js","./button-DenIdY-r.js","./checkbox-Co7Tjlri.js","./dialog-B1es0EvU.js","./collapsible-BhpeB6tu.js","./textarea-luaT-nOK.js","./dist-DicqJavT.js","./dist-P7DYrfOB.js","./project-paths-CsGHlmFh.js","./McpConsentDialogBody-w45-uKw5.js","./label-DwEePOBC.js","./mcp-consent-store-CijO54Jd.js","./ActivityPanelDiffView-BNQupLE1.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-D2ZWMZHw.js","./prop-types-DhUmqQsM.js","./w3c-keyname-B5t0fahT.js","./toggle-group-Cs-1L92l.js","./panel-BNBODYwB.js","./min-VayDM1tY.js","./src-BYmEUJ3I.js","./colors-BbIH8S-B.js","./ordinal-C6wHcby9.js","./init-gbiKrEzm.js","./isObjectLike-BNNgtFA6.js","./now--RAZR_wd.js","./isSymbol-CiN6ou2H.js","./target-navigation-intent-DZxquxsX.js","./ActivityModeContent-DjLptssw.js","./DocumentContext-BzUdezp1.js","./dist-Cp-iTcML.js","./dist-D2RGH7XO.js","./dist-BiYnsAMa.js","./dist-B3L7cm0M.js","./dist-CATLRngz.js","./stex-J8UMaf7u.js","./DocumentContext-B0sQn39F.css","./agent-presence-DxGcS3q2.js","./SettingsDialogBody-Y7msJVE9.js","./config-validation-events-lBcb_6bi.js","./SourceEditor-ztotrWnx.js","./typing-burst-detector-DWPni1ys.js"])))=>i.map(i=>d[i]);
2
+ import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{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,B as h,Bn as g,Bt as _,Cn as v,Ct as y,Dn as b,En as x,F as S,Fn as C,Ft as w,Gn as T,Gt as E,H as D,Hn as O,Ht as k,I as A,It as j,J as M,Jn as N,Jt as P,Kn as F,Kt as I,L,Ln as R,Lt as z,Mn as B,Mt as V,Nn as H,Nt as U,O as W,On as G,Ot as ee,Pn as te,Pt as K,Q as q,Qn as ne,Qt as re,R as ie,Rn as ae,Rt as oe,Sn as se,St as ce,Tn as le,Tt as ue,U as de,Un as fe,Ut as pe,V as me,Vn as he,Vt as ge,Wn as _e,Wt as ve,X as ye,Xn as be,Xt as xe,Yn as Se,Yt as Ce,Z as we,Zn as Te,Zt as Ee,_r as De,_t as Oe,a as ke,an as Ae,ar as je,at as Me,b as Ne,br as Pe,bt as Fe,c as Ie,cn as Le,cr as Re,ct as ze,d as Be,dr as Ve,dt as He,en as Ue,er as We,et as Ge,f as Ke,fr as qe,ft as Je,g as Ye,gr as J,gt as Xe,h as Ze,ht as Qe,i as $e,in as et,ir as tt,it as nt,j as rt,jn as it,jt as at,k as ot,kn as st,kt as ct,l as lt,lr as ut,lt as dt,m as ft,mr as pt,mt,n as ht,nn as gt,nr as _t,nt as vt,o as yt,on as bt,or as xt,ot as St,p as Ct,pt as wt,qn as Tt,qt as Et,r as Dt,rn as Ot,rr as kt,rt as At,s as jt,sn as Mt,sr as Nt,st as Pt,t as Ft,tn as It,tr as Lt,tt as Rt,u as zt,un as Bt,ur as Vt,ut as Ht,v as Ut,vr as Wt,vt as Gt,wn as Kt,wt as qt,xr as Jt,xt as Yt,y as Xt,yr as Zt,yt as Qt,z as $t,zn as en,zt as tn}from"./DocumentContext-BzUdezp1.js";import{A as nn,C as rn,D as an,E as on,O as sn,S as cn,T as ln,_ as un,a as dn,b as fn,c as pn,d as mn,f as hn,g as gn,h as _n,i as vn,k as yn,l as bn,m as xn,n as Sn,o as Cn,p as wn,r as Tn,s as En,t as Dn,u as On,v as kn,w as An,x as jn,y as Mn}from"./panel-BNBODYwB.js";import{$ as Nn,$n as Pn,A as Fn,Ar as In,C as Ln,Cn as Rn,D as zn,Di as Bn,Dt as Vn,Ei as Hn,En as Un,Et as Wn,F as Gn,Fn as Kn,Ft as qn,G as Jn,Gi as Yn,Gn as Xn,Gr as Zn,H as Qn,Hn as $n,Hr as er,I as tr,In as nr,Ir as rr,J as ir,Ji as ar,K as or,Ki as sr,Kn as cr,Ln as lr,M as ur,N as dr,O as fr,Oi as pr,On as mr,Ot as hr,P as gr,Pn as _r,Pt as vr,Qr as yr,Qt as br,Rn as xr,Rr as Sr,S as Cr,St as wr,Tn as Tr,Tt as Er,U as Dr,Ui as Y,Un as Or,Ur as kr,Ut as Ar,Vr as jr,W as Mr,Wi as Nr,Wn as Pr,Wr as Fr,X as Ir,Xn as Lr,Y as Rr,Yn as zr,Yr as Br,Z as Vr,Zn as Hr,Zr as Ur,_i as Wr,_r as Gr,a as Kr,an as qr,b as Jr,c as Yr,d as Xr,di as Zr,et as Qr,f as $r,fi as ei,fn as ti,gi as ni,gr as ri,h as ii,i as ai,ii as oi,ir as si,j as ci,jt as li,k as ui,kt as di,l as fi,m as pi,n as mi,nn as hi,nt as gi,o as _i,on as vi,ot as yi,p as bi,pi as xi,pr as Si,q as Ci,qi as wi,qr as Ti,r as Ei,ri as Di,rr as Oi,s as ki,tr as Ai,u as ji,vn as Mi,vt as Ni,wi as Pi,wn as Fi,xn as Ii,xt as Li,yi as Ri,yr as zi,zn as Bi,zr as Vi}from"./prop-types-DhUmqQsM.js";import{C as Hi,S as Ui,d as Wi,g as Gi,l as Ki,m as qi,o as Ji,p as Yi,t as Xi,w as Zi,x as Qi}from"./button-DenIdY-r.js";import{a as $i,c as ea,d as ta,f as na,i as ra,l as ia,m as aa,n as oa,o as sa,p as ca,r as la,s as ua,t as da,u as fa}from"./agent-presence-DxGcS3q2.js";import{$ as pa,$t as ma,A as ha,At as ga,B as _a,Bt as va,C as ya,D as ba,E as xa,Et as Sa,F as Ca,Ft as wa,G as Ta,Gt as Ea,H as Da,Ht as Oa,I as ka,It as Aa,J as ja,Jt as Ma,K as Na,Kt as Pa,L as Fa,Lt as Ia,M as La,Mt as Ra,N as za,Nt as Ba,O as Va,Ot as Ha,P as Ua,Pt as Wa,Q as Ga,Qt as Ka,R as qa,Rt as Ja,S as Ya,T as Xa,U as Za,Ut as Qa,V as $a,Vt as eo,W as to,Wt as no,X as ro,Xt as io,Y as ao,Yt as oo,Z as so,Zt as co,_t as lo,an as uo,at as fo,b as po,bt as mo,cn as ho,dt as go,en as _o,et as vo,ft as yo,gt as bo,ht as xo,it as So,j as Co,jt as wo,k as To,kt as Eo,lt as Do,m as Oo,mt as ko,nn as Ao,nt as jo,o as Mo,on as No,ot as Po,p as Fo,pt as Io,q as Lo,qt as Ro,r as zo,rn as Bo,rt as Vo,sn as Ho,st as Uo,t as Wo,tn as Go,tt as Ko,u as qo,ut as Jo,vt as Yo,w as Xo,wt as Zo,x as Qo,y as $o,yt as es,z as ts,zt as ns}from"./config-validation-events-lBcb_6bi.js";import{i as rs,n as is,r as as,t as os}from"./toggle-group-Cs-1L92l.js";import{a as ss,b as cs,c as ls,i as us,n as ds,o as fs,s as ps,t as ms,v as hs,x as gs,y as X}from"./dialog-B1es0EvU.js";import{a as _s,i as vs,n as ys,r as bs,t as xs}from"./collapsible-BhpeB6tu.js";import{t as Ss}from"./checkbox-Co7Tjlri.js";import{t as Cs}from"./label-DwEePOBC.js";import{n as ws,r as Ts}from"./textarea-luaT-nOK.js";import{i as Es,n as Ds,r as Os}from"./project-paths-CsGHlmFh.js";import{n as ks,t as As}from"./mcp-consent-store-CijO54Jd.js";import{$ as js,At as Ms,Ct as Ns,Dt as Ps,Ft as Fs,I as Is,It as Ls,J as Rs,Mt as zs,Ot as Bs,Pt as Vs,Q as Hs,Tt as Us,X as Ws,Z as Gs,at as Ks,bt as qs,c as Js,jt as Ys,k as Xs,w as Zs}from"./dist-D2RGH7XO.js";import{n as Qs}from"./dist-BiYnsAMa.js";import{n as $s,o as ec,r as tc,t as nc}from"./typing-burst-detector-DWPni1ys.js";import{t as rc}from"./target-navigation-intent-DZxquxsX.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 ic(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.8.1`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-CuUV_174.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function ac(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=>{gn(e,()=>t.signal,()=>n=!0)},u=Mn(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?kn:un;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?sc:oc,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:oc(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 oc(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 sc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var cc=class extends hn{#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||lc(),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=wn({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),_n.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function lc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var uc=class extends nn{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 cc({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=dc(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=dc(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=dc(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=dc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){_n.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=>rn(t,e))}findAll(e={}){return this.getAll().filter(t=>rn(e,t))}notify(e){_n.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return _n.batch(()=>Promise.all(e.map(e=>e.continue().catch(ln))))}};function dc(e){return e.options.scope?.id}var fc=class extends nn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??cn(r,t),a=this.get(i);return a||(a=new mn({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(){_n.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=>An(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>An(e,t)):t}notify(e){_n.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){_n.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){_n.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},pc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new fc,this.#t=e.mutationCache||new uc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=yn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=xn.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(an(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=fn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return _n.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;_n.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return _n.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=_n.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ln).catch(ln)}invalidateQueries(e,t={}){return _n.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=_n.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(ln)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(ln)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(an(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ln).catch(ln)}fetchInfiniteQuery(e){return e.behavior=ac(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ln).catch(ln)}ensureInfiniteQueryData(e){return e.behavior=ac(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return xn.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(jn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{on(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(jn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{on(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||=cn(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===sn&&(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()}},mc=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}}}})),hc=t(((e,t)=>{t.exports=mc()})),gc=t((e=>{var t=hc(),n=r(),i=Zi();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 ee(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 te(){B(H),B(U),B(W)}function K(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function q(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ne,re;function ie(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``,re=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ne+e+re}var ae=!1;function oe(e,t){if(!e||ae)return``;ae=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -20,7 +20,7 @@ Error generating stack: `+e.message+`
20
20
  `}function h_(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;p_(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?m_(e,o.headerOptions):void 0)}}))}else{let s=p_(e,t,n,r,i,a,o);return s?m_(s,o?.headerOptions):void 0}}function g_(e,t,n,r,i,a){return h_(e,e,t,n,r,i,a)}function __(e){let t=e.endsWith(`
21
21
  `),n=e.split(`
22
22
  `).map(e=>e+`
23
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function v_(e,t){return`${e}\u0000${t}`}function y_(e,t,n){let r=Fr(e).body,i=Fr(t).body;return r===i?``:g_(n,r,i,``,``,{context:3})}function b_(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=ht(),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=y_(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 x_=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-BNQupLE1.js`),__vite__mapDeps([18,1,6,19]),import.meta.url)).ActivityPanelDiffView}));function S_(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Y._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Y._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Y._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Y._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Y._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function C_(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function w_(e){return e.slice(0,7)}function T_(e){return e.type===`upstream`?Y._({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`?Y._({id:`B2DrPb`}):e.author}function E_(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)(ta,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(sa,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)($i,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(ia,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(fa,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(ua,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(ca,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function D_(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)(tt,{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=si(i),t[1]=i,t[2]=a);let o=a,s=r?Qr[o]??Nn[o]:Nn[o],c;t[3]!==s||t[4]!==i?(c=s??_r(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)(E_,{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)(Gc,{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)(vc,{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)(Al,{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)(ca,{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)(vc,{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)(Al,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function O_(e){let t=(0,$.c)(23),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:l,onRestoreSuccess:u}=e,[d,f]=(0,Q.useState)(r),p=n.length;if(n.length===0)return null;let m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>f(k_),t[0]=m):m=t[0];let h;t[1]===d?h=t[2]:(h=d?(0,Z.jsx)(De,{className:`size-3`}):(0,Z.jsx)(_s,{className:`size-3`}),t[1]=d,t[2]=h);let g;t[3]!==p||t[4]!==d?(g=d?Y._({id:`OKQe56`,values:{entryCount:p}}):Y._({id:`k9jDvw`,values:{entryCount:p}}),t[3]=p,t[4]=d,t[5]=g):g=t[5];let _;t[6]!==d||t[7]!==h||t[8]!==g?(_=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:m,children:[h,g]}),t[6]=d,t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]!==o||t[11]!==a||t[12]!==s||t[13]!==n||t[14]!==d||t[15]!==c||t[16]!==i||t[17]!==u||t[18]!==l?(v=d&&n.map(e=>(0,Z.jsx)(V_,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:l,onRestoreSuccess:u},e.sha)),t[10]=o,t[11]=a,t[12]=s,t[13]=n,t[14]=d,t[15]=c,t[16]=i,t[17]=u,t[18]=l,t[19]=v):v=t[19];let y;return t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22],y}function k_(e){return!e}function A_(e){return e.checkpoint?e.checkpoint.kind:`save`}function j_(e){let t=A_(e);if(t===`save`)return Y._({id:`gsePqm`});let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${M_(n)})`:``;return t===`bridge-merge-loss`?Y._({id:`uZAG7T`,values:{sizeSuffix:r}}):Y._({id:`_4rAQI`,values:{sizeSuffix:r}})}function M_(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function N_(e){return e.type===`checkpoint`?A_(e)===`save`?`version`:`auto-save`:`wip`}function P_(e){let t=N_(e);return t===`version`?Y._({id:`RFQ1Yx`}):t===`auto-save`?Y._({id:`9Uv1CD`}):Y._({id:`Yea-K5`})}function F_(e){let t=N_(e);return t===`version`?Y._({id:`gg3Rpy`}):t===`auto-save`?Y._({id:`PXXeW8`}):Y._({id:`Pyp1NA`})}function I_(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function L_(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(z_),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(R_)},children:[r?(0,Z.jsx)(De,{className:`size-3`}):(0,Z.jsx)(_s,{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 R_(e){return!e}function z_(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 B_(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=b_(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)(F,{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)(F,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(x_,{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 V_(e){let t=(0,$.c)(130),{entry:n,prominent:r,isDark:a,diffLayout:o,cache:c,docName:l,expanded:u,onToggleExpanded:d,onRestoreSuccess:f}=e,p=r===void 0?!1:r,{_:m}=i(),h;t[0]===n.timestamp?h=t[1]:(h=S_(n.timestamp),t[0]=n.timestamp,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=T_(n),t[2]=n,t[3]=_);let v=_,y;t[4]===n.timestamp?y=t[5]:(y=C_(n.timestamp),t[4]=n.timestamp,t[5]=y);let b=y,x;t[6]===n.sha?x=t[7]:(x=w_(n.sha),t[6]=n.sha,t[7]=x);let S=x,C=n.contributors.flatMap(H_),w;t[8]===n?w=t[9]:(w=I_(n),t[8]=n,t[9]=w);let T=w,[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),A=(0,Q.useRef)(null),j=(0,Q.useId)(),M,N;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>A.current?.abort(),N=[],t[10]=M,t[11]=N):(M=t[10],N=t[11]),(0,Q.useEffect)(M,N);let P;t[12]!==n.sha||t[13]!==d?(P=()=>d(n.sha),t[12]=n.sha,t[13]=d,t[14]=P):P=t[14];let I=P,L;t[15]===D?L=t[16]:(L=function(){A.current?.abort(),A.current=null,k(!1),D(!1)},t[15]=D,t[16]=L);let R=L,z;t[17]!==m||t[18]!==l||t[19]!==n.sha||t[20]!==f||t[21]!==D?(z=async function(){k(!0);let e=new AbortController;A.current=e;let t=function(){e.signal.aborted||k(!1),A.current===e&&(A.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:l,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:l,sha:n.sha,err:i}),X.error(m({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)D(!1),f();else{let e=`HTTP ${r.status}`;try{let t=br.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:l,sha:n.sha,status:r.status,detail:e}),X.error(m({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=m,t[18]=l,t[19]=n.sha,t[20]=f,t[21]=D,t[22]=z):z=t[22];let B=z,V;t[23]!==n||t[24]!==a||t[25]!==p?(V=p?(()=>{let e=A_(n);return e===`bridge-merge-loss`?(0,Z.jsx)(Nr,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(Ic,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(Nc,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(D_,{entry:n,isDark:a}),t[23]=n,t[24]=a,t[25]=p,t[26]=V):V=t[26];let H=V,U=u?j:void 0,W=u?`bg-muted`:`hover:bg-muted/80`,G;t[27]===W?G=t[28]:(G=[`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`,W],t[27]=W,t[28]=G);let ee=G.join(` `),te;t[29]===I?te=t[30]:(te=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),I())},t[29]=I,t[30]=te);let K;t[31]===H?K=t[32]:(K=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:H}),t[31]=H,t[32]=K);let q;t[33]!==v||t[34]!==n||t[35]!==p?(q=p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:j_(n)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,children:`·`}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:v})]}):(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:v}),t[33]=v,t[34]=n,t[35]=p,t[36]=q):q=t[36];let ne;t[37]!==n.timestamp||t[38]!==g?(ne=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:g}),t[37]=n.timestamp,t[38]=g,t[39]=ne):ne=t[39];let re;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[40]=re):re=t[40];let ie;t[41]===n?ie=t[42]:(ie=P_(n),t[41]=n,t[42]=ie);let ae;t[43]===D?ae=t[44]:(ae=e=>{e.stopPropagation(),D(!0)},t[43]=D,t[44]=ae);let oe;t[45]===O?oe=t[46]:(oe=O?(0,Z.jsx)(F,{className:`size-3 animate-spin`}):(0,Z.jsx)(na,{className:`size-3`}),t[45]=O,t[46]=oe);let se;t[47]!==O||t[48]!==ie||t[49]!==ae||t[50]!==oe?(se=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":ie,disabled:O,onClick:ae,children:oe})}),t[47]=O,t[48]=ie,t[49]=ae,t[50]=oe,t[51]=se):se=t[51];let ce;t[52]===n?ce=t[53]:(ce=P_(n),t[52]=n,t[53]=ce);let le;t[54]===ce?le=t[55]:(le=(0,Z.jsx)(gr,{side:`top`,children:ce}),t[54]=ce,t[55]=le);let ue;t[56]!==se||t[57]!==le?(ue=(0,Z.jsxs)(dr,{children:[se,le]}),t[56]=se,t[57]=le,t[58]=ue):ue=t[58];let de;t[59]!==q||t[60]!==ne||t[61]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[q,ne,re,ue]}),t[59]=q,t[60]=ne,t[61]=ue,t[62]=de):de=t[62];let fe;t[63]===T?fe=t[64]:(fe=T.length>0&&(0,Z.jsx)(L_,{summaries:T}),t[63]=T,t[64]=fe);let pe=C.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:C.join(`, `),children:C.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),me;t[65]!==de||t[66]!==fe||t[67]!==pe?(me=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[de,fe,pe]}),t[65]=de,t[66]=fe,t[67]=pe,t[68]=me):me=t[68];let he;t[69]!==u||t[70]!==I||t[71]!==U||t[72]!==ee||t[73]!==te||t[74]!==K||t[75]!==me?(he=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":u,"aria-controls":U,"data-testid":`timeline-entry-expand`,className:ee,onClick:I,onKeyDown:te,children:[K,me]}),t[69]=u,t[70]=I,t[71]=U,t[72]=ee,t[73]=te,t[74]=K,t[75]=me,t[76]=he):he=t[76];let ge;t[77]!==c||t[78]!==o||t[79]!==j||t[80]!==l||t[81]!==n.sha||t[82]!==u?(ge=u&&(0,Z.jsx)(B_,{sha:n.sha,docName:l,cache:c,diffLayout:o,panelId:j}),t[77]=c,t[78]=o,t[79]=j,t[80]=l,t[81]=n.sha,t[82]=u,t[83]=ge):ge=t[83];let _e;t[84]!==he||t[85]!==ge?(_e=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[he,ge]}),t[84]=he,t[85]=ge,t[86]=_e):_e=t[86];let ve;t[87]!==R||t[88]!==D?(ve=e=>{e?D(!0):R()},t[87]=R,t[88]=D,t[89]=ve):ve=t[89];let ye;t[90]===n?ye=t[91]:(ye=F_(n),t[90]=n,t[91]=ye);let be;t[92]===ye?be=t[93]:(be=(0,Z.jsx)(ls,{children:ye}),t[92]=ye,t[93]=be);let xe;t[94]!==b||t[95]!==v||t[96]!==S||t[97]!==g?(xe={relative:g,absoluteTime:b,entrySha:S,authorName:v},t[94]=b,t[95]=v,t[96]=S,t[97]=g,t[98]=xe):xe=t[98];let Se;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(Se={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[99]=Se):Se=t[99];let Ce;t[100]===xe?Ce=t[101]:(Ce=(0,Z.jsx)(ss,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:xe,components:Se})}),t[100]=xe,t[101]=Ce);let we;t[102]!==be||t[103]!==Ce?(we=(0,Z.jsxs)(ps,{children:[be,Ce]}),t[102]=be,t[103]=Ce,t[104]=we):we=t[104];let Te;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(s,{id:`dEgA5A`}),t[105]=Te):Te=t[105];let Ee;t[106]===R?Ee=t[107]:(Ee=(0,Z.jsx)(Xi,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:R,children:Te}),t[106]=R,t[107]=Ee);let De;t[108]===B?De=t[109]:(De=()=>B(),t[108]=B,t[109]=De);let Oe;t[110]===O?Oe=t[111]:(Oe=O?(0,Z.jsx)(F,{className:`mr-2 size-4 animate-spin`}):null,t[110]=O,t[111]=Oe);let ke;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[112]=ke):ke=t[112];let Ae;t[113]!==O||t[114]!==De||t[115]!==Oe?(Ae=(0,Z.jsxs)(Xi,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:O,onClick:De,children:[Oe,ke]}),t[113]=O,t[114]=De,t[115]=Oe,t[116]=Ae):Ae=t[116];let je;t[117]!==Ee||t[118]!==Ae?(je=(0,Z.jsxs)(fs,{children:[Ee,Ae]}),t[117]=Ee,t[118]=Ae,t[119]=je):je=t[119];let Me;t[120]!==we||t[121]!==je?(Me=(0,Z.jsxs)(us,{children:[we,je]}),t[120]=we,t[121]=je,t[122]=Me):Me=t[122];let Ne;t[123]!==E||t[124]!==ve||t[125]!==Me?(Ne=(0,Z.jsx)(ms,{open:E,onOpenChange:ve,children:Me}),t[123]=E,t[124]=ve,t[125]=Me,t[126]=Ne):Ne=t[126];let Pe;return t[127]!==_e||t[128]!==Ne?(Pe=(0,Z.jsxs)(Z.Fragment,{children:[_e,Ne]}),t[127]=_e,t[128]=Ne,t[129]=Pe):Pe=t[129],Pe}function H_(e){return e.docs}function U_(e){let t=(0,$.c)(87),{docName:n,diffLayout:r,onDiffLayoutChange:a,onSaveVersion:o,saving:c}=e,{_:l}=i(),{resolvedTheme:u}=ar(),d=u===`dark`,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(null),[b]=(0,Q.useState)(q_),[x,S]=(0,Q.useState)(K_),C;t[1]===b?C=t[2]:(C=()=>{S(new Set),b.clear()},t[1]=b,t[2]=C);let w;t[3]===n?w=t[4]:(w=[n],t[3]=n,t[4]=w),(0,Q.useEffect)(C,w);let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){S(new Set)},t[6]=D):D=t[6];let O=D,k,A;t[7]!==l||t[8]!==n?(k=()=>{if(!n){m([]);return}let e=!1,t=async function(){if(n)try{let t=await fetch(`/api/history?docName=${encodeURIComponent(n)}&limit=100`);if(e)return;if(!t.ok){v(l({id:`brCtGB`}));return}let r=await t.json();if(e)return;m(r.entries??[]),v(null)}catch(t){let n=t;if(e)return;v(l({id:`brCtGB`})),console.error(`[timeline]`,n)}};return g(!0),t().finally(()=>{e||g(!1)}),y.current=setInterval(t,1e4),()=>{e=!0,y.current&&clearInterval(y.current)}},A=[n,l],t[7]=l,t[8]=n,t[9]=k,t[10]=A):(k=t[9],A=t[10]),(0,Q.useEffect)(k,A);let j,M,N,P,I,L,R,z;if(t[11]!==l||t[12]!==b||t[13]!==r||t[14]!==n||t[15]!==p||t[16]!==_||t[17]!==x||t[18]!==d||t[19]!==h||t[20]!==a||t[21]!==o||t[22]!==c){let e=[],i=[],u=!1;for(let t of p)t.type===`checkpoint`?(i.length>0&&(e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u}),i=[]),e.push({kind:`checkpoint`,entry:t}),u=!0):i.push(t);i.length>0&&e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u});let f;t[31]===p?f=t[32]:(f=p.some(G_),t[31]=p,t[32]=f);let m=!f,g=!h&&!_&&p.length>0;I=`flex h-full flex-col`;let v;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(En,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[33]=v):v=t[33];let y;t[34]!==l||t[35]!==r||t[36]!==g||t[37]!==a?(y=g&&(0,Z.jsxs)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsxs)(os,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":l({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)(is,{value:`unified`,"aria-label":l({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(ml,{className:`size-3.5`})}),(0,Z.jsx)(is,{value:`split`,"aria-label":l({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(kc,{className:`size-3.5`})})]})}),(0,Z.jsx)(gr,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[34]=l,t[35]=r,t[36]=g,t[37]=a,t[38]=y):y=t[38];let S;t[39]===l?S=t[40]:(S=l({id:`IrYrzq`}),t[39]=l,t[40]=S);let C;t[41]===c?C=t[42]:(C=c?(0,Z.jsx)(F,{className:`size-4 animate-spin`}):(0,Z.jsx)(hl,{className:`size-4`}),t[41]=c,t[42]=C);let w;t[43]!==o||t[44]!==c||t[45]!==S||t[46]!==C?(w=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon-sm`,onClick:o,disabled:c,"aria-label":S,className:`text-muted-foreground`,"data-testid":`timeline-save-version`,children:C})}),t[43]=o,t[44]=c,t[45]=S,t[46]=C,t[47]=w):w=t[47];let T;t[48]===c?T=t[49]:(T=(0,Z.jsx)(gr,{children:c?(0,Z.jsx)(s,{id:`uF9ruK`}):(0,Z.jsx)(s,{id:`IrYrzq`})}),t[48]=c,t[49]=T);let D;t[50]!==w||t[51]!==T?(D=(0,Z.jsxs)(dr,{children:[w,T]}),t[50]=w,t[51]=T,t[52]=D):D=t[52],t[53]!==y||t[54]!==D?(L=(0,Z.jsxs)(Cn,{children:[v,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,D]})]}),t[53]=y,t[54]=D,t[55]=L):L=t[55],R=`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,t[56]!==l||t[57]!==h?(z=h&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":l({id:`o49mDZ`}),children:[1,2,3].map(W_)}),t[56]=l,t[57]=h,t[58]=z):z=t[58],t[59]!==_||t[60]!==h?(j=!h&&_&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:_})}),t[59]=_,t[60]=h,t[61]=j):j=t[61],t[62]!==p.length||t[63]!==_||t[64]!==h?(M=!h&&!_&&p.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[62]=p.length,t[63]=_,t[64]=h,t[65]=M):M=t[65],t[66]!==b||t[67]!==r||t[68]!==n||t[69]!==p||t[70]!==_||t[71]!==x||t[72]!==m||t[73]!==d||t[74]!==h?(N=!h&&!_&&m&&p.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:p.map(e=>(0,Z.jsx)(V_,{entry:e,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.sha),onToggleExpanded:E,onRestoreSuccess:O},e.sha))}),t[66]=b,t[67]=r,t[68]=n,t[69]=p,t[70]=_,t[71]=x,t[72]=m,t[73]=d,t[74]=h,t[75]=N):N=t[75],P=!h&&!_&&!m&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:e.map((e,t)=>e.kind===`checkpoint`?(0,Z.jsx)(V_,{entry:e.entry,prominent:!0,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.entry.sha),onToggleExpanded:E,onRestoreSuccess:O},e.entry.sha):(0,Z.jsx)(O_,{entries:e.entries,defaultExpanded:e.isPreCheckpoint,isDark:d,diffLayout:r,cache:b,docName:n,expandedShas:x,onToggleExpanded:E,onRestoreSuccess:O},e.entries[0]?.sha??`wip-${t}`))}),t[11]=l,t[12]=b,t[13]=r,t[14]=n,t[15]=p,t[16]=_,t[17]=x,t[18]=d,t[19]=h,t[20]=a,t[21]=o,t[22]=c,t[23]=j,t[24]=M,t[25]=N,t[26]=P,t[27]=I,t[28]=L,t[29]=R,t[30]=z}else j=t[23],M=t[24],N=t[25],P=t[26],I=t[27],L=t[28],R=t[29],z=t[30];let B;t[76]!==j||t[77]!==M||t[78]!==N||t[79]!==P||t[80]!==R||t[81]!==z?(B=(0,Z.jsxs)(`div`,{className:R,children:[z,j,M,N,P]}),t[76]=j,t[77]=M,t[78]=N,t[79]=P,t[80]=R,t[81]=z,t[82]=B):B=t[82];let V;return t[83]!==I||t[84]!==L||t[85]!==B?(V=(0,Z.jsxs)(`div`,{className:I,children:[L,B]}),t[83]=I,t[84]=L,t[85]=B,t[86]=V):V=t[86],V}function W_(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(wo,{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)(wo,{className:`h-3 w-28`}),(0,Z.jsx)(wo,{className:`h-3 w-40`})]})]},e)}function G_(e){return e.type===`checkpoint`}function K_(){return new Set}function q_(){return new ra(32)}var J_=[{id:`outline`,icon:Qc},{id:`links`,icon:be},{id:`graph`,icon:tl},{id:`timeline`,icon:Oc}];function Y_(e){return e===`outline`?Y._({id:`dD7NPy`}):e===`links`?Y._({id:`Rj01Fz`}):e===`graph`?Y._({id:`x2fr_j`}):Y._({id:`cklVjM`})}function X_(){return n(()=>import(`./GraphPanel-C1O9mJAk.js`),__vite__mapDeps([20,1,21,6,3,7,22,23,12,13,24,25,26,27,28,29,30,31,32,33]),import.meta.url)}var Z_=(0,Q.lazy)(async()=>({default:(await X_()).GraphPanel})),Q_=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BDyf1132.js`),__vite__mapDeps([34,1,2,35,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,43]),import.meta.url)).ActivityModeContent}));function $_(e){let t=(0,$.c)(16),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c,onSaveVersion:l,saving:u}=e,{_:d}=i(),[f,p]=(0,Q.useState)(`unified`),m;t[0]!==d||t[1]!==a||t[2]!==c||t[3]!==o?(m=c===`doc`?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(os,{type:`single`,variant:`outline`,value:a,onValueChange:e=>{e&&o(e)},"aria-label":d({id:`SrOuyg`}),children:J_.map(ev)})}):null,t[0]=d,t[1]=a,t[2]=c,t[3]=o,t[4]=m):m=t[4];let h;t[5]!==a||t[6]!==f||t[7]!==n||t[8]!==r||t[9]!==c||t[10]!==l||t[11]!==u?(h=c===`doc`?(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-${a}`,"aria-labelledby":`tab-${a}`,className:`min-h-0 flex-1`,children:[a===`outline`&&(0,Z.jsx)(tc,{docName:n,isSourceMode:r}),a===`links`&&(0,Z.jsx)(Wg,{docName:n}),a===`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)(Z_,{activeDocName:n})}),a===`timeline`&&(0,Z.jsx)(U_,{docName:n,diffLayout:f,onDiffLayoutChange:p,onSaveVersion:l,saving:u})]}):(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)(Q_,{})})}),t[5]=a,t[6]=f,t[7]=n,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(Z.Fragment,{children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15],g}function ev(e){let{id:t,icon:n}=e,r=Y_(t);return(0,Z.jsxs)(dr,{children:[(0,Z.jsx)(is,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(tr,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(gr,{side:`bottom`,children:r})]},t)}function tv(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function nv(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function rv(e){return e/100*window.innerHeight}function iv(e){return e/100*window.innerWidth}function av(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 ov({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=av(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=nv(t,i);break;case`em`:r=tv(t,i);break;case`vh`:r=rv(i);break;case`vw`:r=iv(i);break}return r}function sv(e){return parseFloat(e.toFixed(3))}function cv({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 lv(e){let{panels:t}=e,n=cv({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=sv(ov({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=sv(ov({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=sv(ov({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=sv(ov({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 uv(e,t=`Assertion error`){if(!e)throw Error(t)}function dv(e,t){return Array.from(t).sort(e===`horizontal`?fv:pv)}function fv(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function pv(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function mv(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function hv(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 gv({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}=hv(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return uv(i,`No rect found`),i}var _v;function vv(){return _v===void 0&&(_v=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),_v}function yv(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=dv(n,Array.from(t.children).filter(mv).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,gv({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=vv()?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:cv({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 bv=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)}}},xv=new Map,Sv=new bv;function Cv(e){xv=new Map(xv),xv.delete(e)}function wv(e,t){for(let[t]of xv)if(t.id===e)return t}function Tv(e,t){for(let[t,n]of xv)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Ev(){return xv}function Dv(e,t){return Sv.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Ov(e,t){let n=xv.get(e);xv=new Map(xv),xv.set(e,t),Sv.emit(`groupChange`,{group:e,prev:n,next:t})}function kv(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=hv(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 Av(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function jv(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Lv(e),b:Lv(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();uv(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Iv(Fv(n.a)),b:Iv(Fv(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 Mv=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Nv(e){let t=getComputedStyle(Rv(e)??e).display;return t===`flex`||t===`inline-flex`}function Pv(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Nv(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`||Mv.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Fv(e){let t=e.length;for(;t--;){let n=e[t];if(uv(n,`Missing node`),Pv(n))return n}return null}function Iv(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Lv(e){let t=[];for(;e;)t.push(e),e=Rv(e);return t}function Rv(e){let{parentNode:t}=e;return Av(t)?t.host:t}function zv(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 Bv({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!mv(n)||n.contains(e)||e.contains(n))return!0;if(jv(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(zv(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Vv(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=yv(r),a=kv(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Bv({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Hv(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 Uv(e,t,n=0){return Math.abs(sv(e)-sv(t))<=n}function Wv(e,t){return Uv(e,t)?0:e>t?1:-1}function Gv({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(Wv(r,c)<0)if(a){let e=(i+c)/2;r=Wv(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=sv(r),r}function Kv({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Uv(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;uv(u!=null,`Invalid first pivot index`),uv(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];uv(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(uv(n!=null,`Previous layout not found for panel index ${t}`),Uv(n,i)){let t=o-n;Wv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];uv(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(uv(n!=null,`Previous layout not found for panel index ${t}`),Uv(n,o)){let t=n-i;Wv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];uv(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Wv(i,c)<0)if(e>0){let t=c-o,n=t/2;Wv(i+e,c)<0&&(e=Wv(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Wv(i-e,c)<0&&(e=Wv(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];uv(e!=null,`Previous layout not found for panel index ${r}`);let a=Gv({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];uv(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Gv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Uv(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(Hv(c,l))return i;{let t=e<0?d:u,r=s[t];uv(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Gv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Uv(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];uv(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Gv({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Uv(i,s)||(t-=s-i,l[r]=s),Uv(t,0))break;e>0?r--:r++}}}if(!Uv(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 qv(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Wv(e[n],t[n])!==0)return!1;return!0}function Jv({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(!Uv(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];uv(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];uv(i!=null,`No layout data found for index ${e}`);let o=r[e];uv(o!=null,`No layout data found for index ${e}`);let s=Gv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Uv(a,0))for(let e=0;e<t.length;e++){let n=r[e];uv(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Gv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Uv(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Yv({groupId:e,panelId:t}){let n=()=>{let t=Ev();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=Jv({layout:Kv({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});qv(l,p)||Ov(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&&Uv(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=cv({group:t});o(sv(ov({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Xv(e){e.defaultPrevented||Vv(e,Ev()).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=Yv({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Zv(e){let t=Ev();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 Qv({groupId:e}){let t=()=>{let t=Ev();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=Jv({layout:e,panelConstraints:r});return n?o:(qv(o,c)||Ov(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function $v(e,t){let n=Zv(e),r=Tv(n.id,!0),i=n.separators.find(t=>t.element===e);uv(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);uv(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Qv({groupId:n.id}).getLayout(),c=Jv({layout:Kv({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});qv(s,c)||Ov(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function ey(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Zv(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&$v(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&$v(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&$v(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&$v(t,-5);break;case`End`:e.preventDefault(),$v(t,100);break;case`Enter`:{e.preventDefault();let n=Zv(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Tv(n.id,!0),o=n.separators.find(e=>e.element===t);uv(o,`Matching separator not found`);let s=a.get(o);uv(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(uv(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];$v(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Zv(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);uv(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(),$v(t,-100);break}}var ty={cursorFlags:0,state:`inactive`},ny=new bv;function ry(){return ty}function iy(e){return ny.addListener(`change`,e)}function ay(e){let t=ty,n={...ty};n.cursorFlags=e,ty=n,ny.emit(`change`,{prev:t,next:n})}function oy(e){let t=ty;ty=e,ny.emit(`change`,{prev:t,next:e})}function sy(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Ev(),n=Vv(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)}),oy({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var cy=e=>e,ly=()=>{},uy=1,dy=2,fy=4,py=8,my=3,hy=12,gy;function _y(){return gy===void 0&&(gy=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(gy=!0)),gy}function vy({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&&_y()){let t=(e&uy)!==0,n=(e&dy)!==0,r=(e&fy)!==0,i=(e&py)!==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 _y()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var yy=new WeakMap;function by(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=yy.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=ry();switch(r.state){case`active`:case`hover`:{let e=vy({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}yy.set(e,{prevStyle:t,styleSheet:n})}function xy({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=Kv({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(qv(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?uy:dy;break;case`vertical`:s|=d<0?fy:py;break}}else Ov(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&my:c|=s&my,t.movementY===0?c|=o&hy:c|=s&hy,ay(c),by(e)}function Sy(e){let t=Ev(),n=ry();switch(n.state){case`active`:xy({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Cy(e){if(e.defaultPrevented)return;let t=ry(),n=Ev();switch(t.state){case`active`:if(e.buttons===0){oy({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Tv(e.group.id,!0);Ov(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)}xy({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Vv(e,n);r.length===0?t.state!==`inactive`&&oy({cursorFlags:0,state:`inactive`}):oy({cursorFlags:0,hitRegions:r,state:`hover`}),by(e.currentTarget);break}}}function wy(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(ry().state){case`hover`:oy({cursorFlags:0,state:`inactive`})}}function Ty(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=ry();switch(t.state){case`active`:oy({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(by(e.currentTarget),t.hitRegions.forEach(e=>{let t=Tv(e.group.id,!0);Ov(e.group,t)}),e.preventDefault())}}function Ey(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=sv(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=sv((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Dy(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=cv({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:sv(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Oy(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 ky({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=sv(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]=sv((r[e]??0)/a*l);else{let e=sv(l/c.length);for(let t of c)u[t]=e}return u}function Ay(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 jy=new Map;function My(e){let t=!0;uv(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=cv({group:e});if(t===0)return;let n=Tv(e.id);if(!n)return;let r=lv(e),i=n.defaultLayoutDeferred?Ey(r):n.layout,a=Jv({layout:ky({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&qv(n.layout,a)&&Oy(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Ov(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Dy(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{uv(!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=cv({group:e}),s=lv(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Ay(e.panels,l)||(l=void 0));let u=Jv({layout:e.mutableState.layouts[c]??l??Ey(s),panelConstraints:s}),d=e.element.ownerDocument;jy.set(d,(jy.get(d)??0)+1);let f=new Map;return yv(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Ov(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{uv(!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`,ey)}),jy.get(d)===1&&(d.addEventListener(`dblclick`,Xv,!0),d.addEventListener(`pointerdown`,sy,!0),d.addEventListener(`pointerleave`,Sy),d.addEventListener(`pointermove`,Cy),d.addEventListener(`pointerout`,wy),d.addEventListener(`pointerup`,Ty,!0)),function(){t=!1,jy.set(d,Math.max(0,(jy.get(d)??0)-1)),Cv(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,ey)}),jy.get(d)||(d.removeEventListener(`dblclick`,Xv,!0),d.removeEventListener(`pointerdown`,sy,!0),d.removeEventListener(`pointerleave`,Sy),d.removeEventListener(`pointermove`,Cy),d.removeEventListener(`pointerout`,wy),d.removeEventListener(`pointerup`,Ty,!0)),a.disconnect()}}function Ny(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Py(e){let t=(0,Q.useId)();return`${e??t}`}var Fy=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function Iy(e){let t=(0,Q.useRef)(e);return Fy(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Ly(...e){return Iy(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Ry(e){let t=(0,Q.useRef)({...e});return Fy(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var zy=(0,Q.createContext)(null);function By(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:cy});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Fy(()=>{Object.assign(n.current,Qv({groupId:e}))})}function Vy({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=Iy(e=>{qv(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Iy(e=>{qv(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Py(s),v=(0,Q.useRef)(null),[y,b]=Ny(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Ly(v,a);By(_,o);let C=Iy((e,t)=>{let r=ry(),i=wv(e),a=Tv(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=Ry({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=dv(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=dv(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=wv(_),i=Tv(_);r&&i&&Ov(r,{...i,derivedPanelConstraints:lv(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 Fy(()=>{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=My(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Tv(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Dv(_,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=Uv(t.collapsedSize,i[t.panelId]),a=Uv(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=ry().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)(zy.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})})}Vy.displayName=`Group`;function Hy(){let e=(0,Q.useContext)(zy);return uv(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Uy(e,t){let{id:n}=Hy(),r=(0,Q.useRef)({collapse:ly,expand:ly,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ly});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Fy(()=>{Object.assign(r.current,Yv({groupId:n,panelId:e}))})}function Wy({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=Py(c),_=Ry({disabled:a}),v=(0,Q.useRef)(null),y=Ly(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Hy(),T=d!==null,E=Iy((e,t,n)=>{d?.(e,c,n)});Fy(()=>{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]),Uy(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Dv(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:{...Gy,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})})}Wy.displayName=`Panel`;var Gy={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Ky(){return(0,Q.useRef)(null)}function qy({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=Jv({layout:Kv({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Jv({layout:Kv({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Jy({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Py(a),l=Ry({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=Ly(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Hy(),x=v===`horizontal`?`vertical`:`horizontal`;Fy(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=iy(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Dv(_,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(qy({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})}Jy.displayName=`Separator`;var Yy={name:`toml`,startState:function(){return{inString:!1,stringType:``,lhs:!0,inArray:0}},token:function(e,t){let n;if(!t.inString&&(n=e.match(/^('''|"""|'|")/))&&(t.stringType=n[0],t.inString=!0),e.sol()&&!t.inString&&t.inArray===0&&(t.lhs=!0),t.inString){for(;t.inString;)if(e.match(t.stringType))t.inString=!1;else if(e.peek()===`\\`)e.next(),e.next();else if(e.eol())break;else e.match(/^.[^\\\"\']*/);return t.lhs?`property`:`string`}else if(t.inArray&&e.peek()===`]`)return e.next(),t.inArray--,`bracket`;else if(t.lhs&&e.peek()===`[`&&e.skipTo(`]`))return e.next(),e.peek()===`]`&&e.next(),`atom`;else if(e.peek()===`#`)return e.skipToEnd(),`comment`;else if(e.eatSpace())return null;else if(t.lhs&&e.eatWhile(function(e){return e!=`=`&&e!=` `}))return`property`;else if(t.lhs&&e.peek()===`=`)return e.next(),t.lhs=!1,null;else if(!t.lhs&&e.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return`atom`;else if(!t.lhs&&(e.match(`true`)||e.match(`false`)))return`atom`;else if(!t.lhs&&e.peek()===`[`)return t.inArray++,e.next(),`bracket`;else if(!t.lhs&&e.match(/^\-?\d+(?:\.\d+)?/))return`number`;else e.eatSpace()||e.next();return null},languageData:{commentTokens:{line:`#`}}},Xy=$t({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Zy=ie({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Qy(e){switch(e.toLowerCase()){case`json`:return Qs().language;case`toml`:return Js.define(Yy);default:return null}}function $y(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({id:`PauP7d`,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 eb(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}=ar(),l=$y(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=Qy(i),t=c===`dark`?Xy:Zy,n=[nc,...e?[e]:[],Ws.editable.of(!0),Ps.readOnly.of(!0),Ws.lineWrapping,t],r=new Ws({state:Ps.create({doc:u,extensions:n}),parent:a.current});return o.current=r,()=>{r.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 tb(e){return Zn(`/api/asset?path=${encodeURIComponent(e)}`)}function nb(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function rb(e){let t=(0,$.c)(28),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=tb(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;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=u.includes(`.`)?u.split(`.`).pop()??``:``;if(f=e.length>0?e.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[12]!==u||t[13]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(nt,{src:c,title:u,fillContainer:!0})}),t[12]=u,t[13]=c,t[14]=e):e=t[14];let n;t[15]!==u||t[16]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[15]=u,t[16]=e,t[17]=n):n=t[17],p=n;break bb0}if(d===`text`){let r;t[18]===n?r=t[19]:(r=nb(n),t[18]=n,t[19]=r),p=(0,Z.jsx)(eb,{src:r,fileName:u,extension:e.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}else d=t[9],f=t[10],p=t[11];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[20]!==d||t[21]!==f||t[22]!==u||t[23]!==c?(m=(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)(St,{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-3 text-center`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-md border bg-muted font-medium text-muted-foreground text-sm`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:u}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(Xi,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Z.jsx)(`a`,{href:c,children:(0,Z.jsx)(s,{id:`9npOH9`})})}),(0,Z.jsx)(Xi,{variant:`outline`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,children:(0,Z.jsx)(s,{id:`Ruuu3v`})})]})]})}),t[20]=d,t[21]=f,t[22]=u,t[23]=c,t[24]=m):m=t[24];let h;return t[25]!==u||t[26]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:m}),t[25]=u,t[26]=m,t[27]=h):h=t[27],h}function ib(){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)(wo,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(wo,{className:`h-4 w-full`}),(0,Z.jsx)(wo,{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}var ab={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function ob(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}=ar(),s=ab[r],c=s?(o===`dark`?Qr[s]:void 0)??Nn[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=Ui(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)(ta,{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)(ea,{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)(sa,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function sb(e){let{installState:t}=e;return t.installed===null?Y._({id:`IA6JW2`}):t.installed===!1?Y._({id:`5SwVv1`}):null}function cb(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:Y._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:Y._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl},...t.hasWebFallback?{webFallback:{label:Y._({id:`0S9PW_`}),url:``}}:{}}}}return{enabled:!0,tooltip:null}}function lb(e){return Rn(e)}function ub(e){return Y._({id:`h_HYHD`,values:{displayName:e}})}var db=`claude.ai`;async function fb(e,t=bh){(await t(Rn(e))).ok?X.success(ub(db)):X.error(Y._({id:`9NC_MT`,values:{CLAUDE_WEB_FALLBACK_LABEL:db}}))}function pb(e){let t=(0,$.c)(68),{_:n}=i(),{target:r,installState:a,isElectronHost:o,prompt:s,onSelect:c}=e,l=e.openExternal??bh,u=e.onWebFallbackSuccess??hb,d=e.onWebFallbackError??mb,{displayName:f}=r,p,m,h,g,_,v,y,b,x,S;if(t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==c||t[4]!==d||t[5]!==u||t[6]!==l||t[7]!==s||t[8]!==r||t[9]!==f){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=cb({target:r,installState:a,isElectronHost:o}),i=sb({target:r,installState:a,isElectronHost:o}),C=()=>{e.tooltip&&l(e.tooltip.installAction.url)},w;t[20]!==d||t[21]!==u||t[22]!==l||t[23]!==s||t[24]!==r?(w=()=>{(async()=>{let e=await l(lb(s));e.ok?u(r):d(r,e.detail??e.reason)})()},t[20]=d,t[21]=u,t[22]=l,t[23]=s,t[24]=r,t[25]=w):w=t[25];let T=w;if(e.enabled){let e=`open-in-agent-item-${r.id}`,i;t[26]!==n||t[27]!==f?(i=n({id:`NnQapF`,values:{targetDisplayName:f}}),t[26]=n,t[27]=f,t[28]=i):i=t[28];let a;t[29]===r.id?a=t[30]:(a=(0,Z.jsx)(ob,{id:r.id,"aria-hidden":`true`}),t[29]=r.id,t[30]=a);let o;t[31]===r.displayName?o=t[32]:(o=(0,Z.jsx)(`span`,{children:r.displayName}),t[31]=r.displayName,t[32]=o);let s;t[33]!==c||t[34]!==i||t[35]!==a||t[36]!==o||t[37]!==e?(s=(0,Z.jsxs)(Ko,{onSelect:c,"data-testid":e,"aria-label":i,children:[a,o]}),t[33]=c,t[34]=i,t[35]=a,t[36]=o,t[37]=e,t[38]=s):s=t[38],S=s;break bb0}if(!e.tooltip){let e=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),a;t[39]===r.id?a=t[40]:(a=(0,Z.jsx)(ob,{id:r.id,"aria-hidden":`true`}),t[39]=r.id,t[40]=a);let o;t[41]===r.displayName?o=t[42]:(o=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[41]=r.displayName,t[42]=o),S=(0,Z.jsxs)(Ko,{disabled:!0,"data-testid":`open-in-agent-item-${r.id}`,"aria-label":e,children:[a,o,i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null]});break bb0}let E=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),D=e.tooltip.webFallback?.label??``;m=So;let O=`open-in-agent-item-${r.id}`,k;t[43]===r.id?k=t[44]:(k=(0,Z.jsx)(ob,{id:r.id,"aria-hidden":`true`,className:`mr-2`}),t[43]=r.id,t[44]=k);let A;t[45]===r.displayName?A=t[46]:(A=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[45]=r.displayName,t[46]=A);let j;t[47]===i?j=t[48]:(j=i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null,t[47]=i,t[48]=j),t[49]!==E||t[50]!==k||t[51]!==A||t[52]!==j||t[53]!==O?(x=(0,Z.jsxs)(Po,{"data-testid":O,"data-row-disabled":``,"aria-label":E,children:[k,A,j]}),t[49]=E,t[50]=k,t[51]=A,t[52]=j,t[53]=O,t[54]=x):x=t[54],p=fo,h=`min-w-[260px]`,g=`open-in-agent-submenu-${r.id}`,_=(0,Z.jsx)(jo,{className:`font-normal text-muted-foreground text-xs`,"data-testid":`open-in-agent-message-${r.id}`,children:e.tooltip.message}),t[55]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Vo,{}),t[55]=v):v=t[55],y=(0,Z.jsx)(Ko,{onSelect:C,"data-testid":`open-in-agent-install-${r.id}`,children:(0,Z.jsx)(`span`,{children:e.tooltip.installAction.label})}),b=e.tooltip.webFallback?(0,Z.jsxs)(Ko,{onSelect:T,"data-testid":`open-in-agent-web-fallback-${r.id}`,"aria-label":n({id:`lsOFZR`,values:{webFallbackLabel:D}}),children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:e.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:n({id:`Z9BoIy`})})]}):null}t[0]=n,t[1]=a,t[2]=o,t[3]=c,t[4]=d,t[5]=u,t[6]=l,t[7]=s,t[8]=r,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S}else p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18],S=t[19];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[56]!==p||t[57]!==h||t[58]!==g||t[59]!==_||t[60]!==v||t[61]!==y||t[62]!==b?(C=(0,Z.jsxs)(p,{className:h,"data-testid":g,children:[_,v,y,b]}),t[56]=p,t[57]=h,t[58]=g,t[59]=_,t[60]=v,t[61]=y,t[62]=b,t[63]=C):C=t[63];let w;return t[64]!==m||t[65]!==x||t[66]!==C?(w=(0,Z.jsxs)(m,{children:[x,C]}),t[64]=m,t[65]=x,t[66]=C,t[67]=w):w=t[67],w}function mb(){}function hb(){}function gb(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=Xh(),{dispatch:a}=zh(),o=ko(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=Eh({workspace:o});t[7]===n?s=t[8]:(s=Ui(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=qm.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(_b,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{kh(t),i()}},t.id)}),t[0]=n,t[1]=a,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=c}else s=t[5],c=t[6];let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`div`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function _b(e){let t=(0,$.c)(22),{target:n,status:r,onOpen:i,onInstall:a}=e,o=r===`installed`?i:r===`missing`?a:void 0,s=r===`pending`||r===`installed`&&i===void 0,c=r===`installed`?`Open`:r===`missing`?`Install`:`Checking`,l;t[0]===n.id?l=t[1]:(l=(0,Z.jsx)(ob,{id:n.id,"aria-hidden":`true`,className:`size-4`}),t[0]=n.id,t[1]=l);let u;t[2]===n.displayName?u=t[3]:(u=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.displayName}),t[2]=n.displayName,t[3]=u);let d;t[4]!==l||t[5]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[l,u]}),t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===n.tagline?f=t[8]:(f=n.tagline?(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.tagline}):null,t[7]=n.tagline,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===r?m=t[13]:(m=r===`missing`?(0,Z.jsx)(rs,{"aria-hidden":`true`,className:`size-3`}):null,t[12]=r,t[13]=m);let h;t[14]!==c||t[15]!==m?(h=(0,Z.jsxs)(`p`,{className:`mt-auto inline-flex items-center gap-1 pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==s||t[18]!==o||t[19]!==p||t[20]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:cursor-not-allowed disabled:opacity-60`,children:[p,h]}),t[17]=s,t[18]=o,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}var vb=3100,yb=3;function bb(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??yb;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var xb={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}},Sb=[`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 Cb(e,t={}){let n=t.rng??Math.random,r=t.colors??Sb,i=xb[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 wb=1.8,Tb=90,Eb=16,Db=380,Ob=.025,kb=.1,Ab=.18,jb=400,Mb=9.2736,Nb=18.1799,Pb=14.5244,Fb={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Ib(e,t){let{halfWidth:n,apexLift:r}=Fb[t];return`M${e-n} ${Pb+.3} Q${e} ${Pb-r}, ${e+n} ${Pb+.3}`}function Lb(e){let t=1.5,n=.3;return`M${e-t} ${Pb-n} Q${e} ${Pb+1.4}, ${e+t} ${Pb-n}`}var Rb=15,zb=15;function Bb(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 Vb(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=bb(g,t);_(n),y(Gb),S(Cb(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},vb)},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(Wb),S(Cb(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},vb))},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/Db)),C=Math.max(-1,Math.min(1,b/Db)),w=S*Eb,T=-C*Eb,E=0,D=0;if(x>=1){let e=Math.min(x/Tb,1)*wb;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)*kb,i+=(w-i)*kb,u.style.transform=`perspective(${jb}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*Ab,o+=(D-o)*Ab;let k=i*Ob,A=-r*Ob,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=Ui(`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=Ui(`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=Ui(`ok-blob-eye`,W),t[22]=W,t[23]=G);let ee;t[24]===G?ee=t[25]:(ee=(0,Z.jsx)(`ellipse`,{cx:Mb,cy:Pb,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=ee);let te=(F||T)&&`ok-blob-eye-hidden`,K;t[26]===te?K=t[27]:(K=Ui(`ok-blob-eye ok-blob-eye-right`,te),t[26]=te,t[27]=K);let q;t[28]===K?q=t[29]:(q=(0,Z.jsx)(`ellipse`,{cx:Nb,cy:Pb,rx:1.2722,ry:1.9083,className:K}),t[28]=K,t[29]=q);let ne;t[30]===I?ne=t[31]:(ne=Ib(Mb,I),t[30]=I,t[31]=ne);let re=(!F||T)&&`ok-blob-eye-hidden`,ie;t[32]===re?ie=t[33]:(ie=Ui(`ok-blob-happy-eye`,re),t[32]=re,t[33]=ie);let ae;t[34]!==ne||t[35]!==ie?(ae=(0,Z.jsx)(`path`,{d:ne,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ie}),t[34]=ne,t[35]=ie,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=Ib(Nb,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=Ui(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:Lb(Mb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:Lb(Nb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==ee||t[47]!==q||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[ee,q,ae,le,ue]}),t[46]=ee,t[47]=q,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(Hb)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:Ub,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function Hb(e){return(0,Z.jsx)(`circle`,{cx:Rb+e.originDx,cy:zb+e.originDy,r:e.size,className:`ok-blob-firework`,style:Bb(e)},e.id)}function Ub(e){return e.preventDefault()}function Wb(e){return e+1}function Gb(e){return e+1}function Kb(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(Vb,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function qb(){let e=(0,$.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=Zo(`command-palette`),e[0]=t):t=e[0];let n=t,r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(D,{children:n}),e[1]=r):r=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`p`,{className:`text-1sm text-muted-foreground`,children:[r,` `,(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A1taO8`})})]}),e[2]=i):i=e[2],i}var Jb=`open-knowledge:create-top-level-file`;function Yb(){window.dispatchEvent(new CustomEvent(Jb))}function Xb(e){let t=()=>e();return window.addEventListener(Jb,t),()=>window.removeEventListener(Jb,t)}function Zb(){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(tx);if(e)return;let r=t.ok?Vn.safeParse(n):null;r?.success?(o(nx(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=Ln(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(ex),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch($b);if(!e.ok)return;let n=Vn.safeParse(t);n.success&&o(nx(n.data.documents))}).catch(Qb)},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)(rx,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(ix,{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)(zm,{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 Qb(){}function $b(){return null}function ex(e){return e+1}function tx(){return null}function nx(e){return fr(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function rx(e){let t=(0,$.c)(16),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o;t[0]===a?o=t[1]:(o=a({id:`ZmGmNh`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`W8uemY`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(Kb,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===r?u=t[9]:(u=(0,Z.jsx)(Mm,{onPackSelect:r}),t[8]=r,t[9]=u);let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Xi,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:Yb,children:(0,Z.jsx)(s,{id:`ensWZc`,components:{0:(0,Z.jsx)(ho,{"aria-hidden":`true`,className:`size-3`})}})}),t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[u,d]}),t[11]=u,t[12]=f);let p;return t[13]!==l||t[14]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,f]}),t[13]=l,t[14]=f,t[15]=p):p=t[15],p}function ix(e){let t=(0,$.c)(19),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i();if(Wm())return null;let o;t[0]===a?o=t[1]:(o=a({id:`8XS8nG`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`GjElCU`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(Kb,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(gb,{}),t[8]=u):u=t[8];let d,f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`size-3`}),f=(0,Z.jsx)(s,{id:`IajAbS`}),t[9]=d,t[10]=f):(d=t[9],f=t[10]);let p;t[11]===r?p=t[12]:(p=(0,Z.jsxs)(Xi,{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:[d,f]}),t[11]=r,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(qb,{}),t[13]=m):m=t[13];let h;t[14]===p?h=t[15]:(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[u,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[p,m]})]}),t[14]=p,t[15]=h);let g;return t[16]!==l||t[17]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,h]}),t[16]=l,t[17]=h,t[18]=g):g=t[18],g}function ax(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function ox(e){let t=(0,$.c)(83),{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)(lx,{}),(0,Z.jsx)(wo,{className:`h-7 w-full`}),(0,Z.jsx)(wo,{className:`h-7 w-full`}),(0,Z.jsx)(wo,{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.folder.frontmatter_defaults?m=t[4]:(m=r.data.folder.frontmatter_defaults??{},t[3]=r.data.folder.frontmatter_defaults,t[4]=m);let h=m,g;t[5]===r.data.frontmatterLocal?g=t[6]:(g=r.data.frontmatterLocal??{},t[5]=r.data.frontmatterLocal,t[6]=g);let _=g,v=r.data.frontmatterSources,y;t[7]===r.data.folder.path?y=t[8]:(y=ax(r.data.folder.path),t[7]=r.data.folder.path,t[8]=y);let b=y,x,S,C,w,T,E,D,O,k,A,j,M,N,P;if(t[9]!==o||t[10]!==u||t[11]!==c||t[12]!==b||t[13]!==n||t[14]!==_||t[15]!==h||t[16]!==a||t[17]!==f||t[18]!==v||t[19]!==r.data.schemaDeclarations||t[20]!==r.data.schemaLocal||t[21]!==r.data.schemaSources){let e=Object.keys(h),i=r.data.schemaDeclarations,m=r.data.schemaLocal??{},g=r.data.schemaSources,y=Object.keys(i).filter(e=>!Object.hasOwn(h,e)),F=async function(e,t){let r=await ha(n,{[e]:t});if(!r.ok){let{error:e}=r;X.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},I=async function(e){let t=await ha(n,{[e]:null});if(!t.ok){let{error:e}=t;X.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},L=function(e,t){let n=h[e];F(e,Fa(n,t))},R;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){d({name:``,type:`text`,value:``,error:null,mode:e===void 0?`value`:e}),l(!1)},t[36]=R):R=t[36],C=R;let z;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):ka[e];return{...t,type:e,value:n,error:null}})},t[37]=z):z=t[37],T=z;let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){d(t=>t&&{...t,value:e})},t[38]=B):B=t[38],E=B;let V;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e){d(t=>t&&{...t,name:e,error:null})},t[39]=V):V=t[39],w=V;let H;t[40]!==o||t[41]!==u||t[42]!==i||t[43]!==n||t[44]!==h||t[45]!==a?(H=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(u.mode===`declaration`){if(Object.hasOwn(i,e)){d({...u,error:o({id:`7-KLnW`,values:{trimmed:e}})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`mcWHC0`,values:{trimmed:e}})});return}let t=await Co(n,{[e]:{type:u.type}});if(!t.ok){d({...u,error:t.error});return}d(null),a();return}if(zi(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 ha(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[40]=o,t[41]=u,t[42]=i,t[43]=n,t[44]=h,t[45]=a,t[46]=H):H=t[46],D=H;let U=async function(e){let t=await Co(n,{[e]:null});if(!t.ok){X.error(t.error);return}a()},W=function(e){p({key:e,draft:e,error:null})},G=function(e){p(t=>t&&{...t,draft:e,error:null})},ee=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}if(Object.hasOwn(i,e)){p({...f,error:o({id:`3IKxHW`,values:{trimmed:e}})});return}let t=h[f.key],r=await ha(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},te=function(){p(null)};O=`rounded-lg border bg-card`,S=xs,M=!c,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>l(!e),t[47]=N):N=t[47];let K=`size-3 transition-transform ${c?``:`rotate-90`}`,q;t[48]===K?q=t[49]:(q=(0,Z.jsx)(_s,{className:K,"aria-hidden":!0}),t[48]=K,t[49]=q);let ne;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[50]=ne):ne=t[50];let re;t[51]===q?re=t[52]:(re=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[q,ne]}),t[51]=q,t[52]=re);let ie;t[53]===b?ie=t[54]:(ie=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:cx,children:b}),t[53]=b,t[54]=ie),t[55]!==re||t[56]!==ie?(P=(0,Z.jsxs)(bs,{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:[re,ie]}),t[55]=re,t[56]=ie,t[57]=P):P=t[57],x=ys,k=`px-2 py-2`,t[58]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DnYq8I`})}),t[58]=A):A=t[58],j=e.length===0&&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`})}):(0,Z.jsxs)(Z.Fragment,{children:[e.map(e=>{let t=h[e],n=Object.hasOwn(_,e);return(0,Z.jsx)(Ua,{keyName:e,value:t,declared:qa(t,ri(t)),rename:n?{state:f?.key===e?f:null,onBegin:()=>W(e),onChangeDraft:G,onCommit:ee,onCancel:te}:void 0,badge:n?null:(0,Z.jsx)(Ca,{source:v[e]??``}),isInherited:!n,onCommit:t=>void F(e,t),onChangeType:t=>L(e,t),onRemove:n?()=>void I(e):void 0},e)}),y.length>0&&e.length>0?(0,Z.jsx)(`div`,{className:`my-1 border-t border-dashed border-border`,"aria-hidden":!0}):null,y.map(e=>{let t=i[e],r=Object.hasOwn(m,e),o=t.type;return(0,Z.jsx)(Ua,{keyName:e,value:``,declared:o,badge:(0,Z.jsx)(za,{source:g[e]??``,inlineSource:!r,icon:(0,Z.jsx)(ca,{className:`size-2.5`,"aria-hidden":!0})}),isInherited:!r,valueHint:(0,Z.jsx)(`div`,{className:`flex h-7 items-center px-2 text-xs italic text-muted-foreground`,children:(0,Z.jsx)(s,{id:`E62FLF`})}),onCommit:sx,onChangeType:t=>{r&&Co(n,{[e]:{type:t}}).then(e=>{e.ok?a():X.error(e.error)})},onRemove:r?()=>void U(e):void 0},`__decl__${e}`)})]}),t[9]=o,t[10]=u,t[11]=c,t[12]=b,t[13]=n,t[14]=_,t[15]=h,t[16]=a,t[17]=f,t[18]=v,t[19]=r.data.schemaDeclarations,t[20]=r.data.schemaLocal,t[21]=r.data.schemaSources,t[22]=x,t[23]=S,t[24]=C,t[25]=w,t[26]=T,t[27]=E,t[28]=D,t[29]=O,t[30]=k,t[31]=A,t[32]=j,t[33]=M,t[34]=N,t[35]=P}else x=t[22],S=t[23],C=t[24],w=t[25],T=t[26],E=t[27],D=t[28],O=t[29],k=t[30],A=t[31],j=t[32],M=t[33],N=t[34],P=t[35];let F;t[59]!==u||t[60]!==C||t[61]!==w||t[62]!==T||t[63]!==E||t[64]!==D?(F=u?(0,Z.jsx)(La,{draft:u,onChangeName:w,onChangeType:T,onChangeValue:E,onCommit:()=>void D(),onCancel:()=>d(null)}):(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:[(0,Z.jsxs)(Xi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>C(`value`),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)(fe,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`7IcK2R`})})]}),(0,Z.jsxs)(Xi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`declare-field-trigger`,onClick:()=>C(`declaration`),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)(ca,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`dZHyu7`})})]})]}),t[59]=u,t[60]=C,t[61]=w,t[62]=T,t[63]=E,t[64]=D,t[65]=F):F=t[65];let I;t[66]!==F||t[67]!==k||t[68]!==A||t[69]!==j?(I=(0,Z.jsxs)(`div`,{className:k,children:[A,j,F]}),t[66]=F,t[67]=k,t[68]=A,t[69]=j,t[70]=I):I=t[70];let L;t[71]!==x||t[72]!==I?(L=(0,Z.jsx)(x,{children:I}),t[71]=x,t[72]=I,t[73]=L):L=t[73];let R;t[74]!==S||t[75]!==L||t[76]!==M||t[77]!==N||t[78]!==P?(R=(0,Z.jsxs)(S,{open:M,onOpenChange:N,children:[P,L]}),t[74]=S,t[75]=L,t[76]=M,t[77]=N,t[78]=P,t[79]=R):R=t[79];let z;return t[80]!==O||t[81]!==R?(z=(0,Z.jsx)(`section`,{className:O,children:R}),t[80]=O,t[81]=R,t[82]=z):z=t[82],z}function sx(){}function cx(e){return e.stopPropagation()}function lx(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Vc,{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 ux(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function dx(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=ux(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function fx(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function px(e,t){let n=`${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:dx(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:fx(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:dx(e,t.pageTitles),children:a}}function mx(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)(wo,{className:`h-12 w-full`}),(0,Z.jsx)(wo,{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)(te,{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)(Xi,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(fe,{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)(Xa,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Ca,{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)(xa,{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)(ba,{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(hx)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(To,{folderPath:n,existingNames:D,open:p,onOpenChange:m,onCreated:i}),t[27]=n,t[28]=p,t[29]=i,t[30]=D,t[31]=O):O=t[31];let k=d!==null,A;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||f(null)},t[32]=A):A=t[32];let j=d??void 0,M;t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j?(M=(0,Z.jsx)(hm,{open:k,onOpenChange:A,kind:`file`,initialDir:n,initialTemplate:j,folderConfig:a}),t[33]=a,t[34]=n,t[35]=k,t[36]=j,t[37]=M):M=t[37];let N;return t[38]!==E||t[39]!==O||t[40]!==M||t[41]!==S||t[42]!==w?(N=(0,Z.jsxs)(Z.Fragment,{children:[S,w,E,O,M]}),t[38]=E,t[39]=O,t[40]=M,t[41]=S,t[42]=w,t[43]=N):N=t[43],N}function hx(e){return e.name}function gx(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=Ui(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Ui(`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 _x(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=Ui(`[&_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 vx(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=Ui(`[&_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 yx(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=Ui(`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 bx(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=Ui(`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 xx(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=Ui(`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 Sx(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Y._({id:`xOTzt5`});if(r<60)return Y._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Y._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Y._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Cx(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 wx(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)(Pe,{className:`ml-1 size-3`}):(0,Z.jsx)(Jt,{className:`ml-1 size-3`}):(0,Z.jsx)(yc,{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)(Xi,{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 Tx(e){let t=(0,$.c)(92),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=ji(),d=ga(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)(wo,{className:`size-5 rounded`}),(0,Z.jsx)(wo,{className:`h-7 w-48`})]}),(0,Z.jsx)(wo,{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)(wo,{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)(wo,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Ox)]})]}),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;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=px(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=Cx(e.children,g,v),o;t[28]===g?o=t[29]:(o=function(e){e===g?y(Dx):(_(e),y(`asc`))},t[28]=g,t[29]=o);let m=o;k=`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 A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(je,{className:`size-5 text-muted-foreground`}),t[30]=A):A=t[30];let j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:e.title})]}),M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(Xi,{onClick:()=>h(!0),children:[(0,Z.jsx)(fe,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[31]=M):M=t[31],t[32]===j?E=t[33]:(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:[j,M]})}),t[32]=j,t[33]=E),t[34]!==f||t[35]!==n||t[36]!==p?(D=(0,Z.jsx)(ox,{folderPath:n,state:f,onChange:p}),t[34]=f,t[35]=n,t[36]=p,t[37]=D):D=t[37],t[38]!==f||t[39]!==d||t[40]!==n||t[41]!==p?(O=(0,Z.jsx)(mx,{folderPath:n,state:f,onChange:p,folderConfigHandle:d}),t[38]=f,t[39]=d,t[40]=n,t[41]=p,t[42]=O):O=t[42],w=`rounded-lg border`,x=gx;let N=g===`name`?v===`asc`?`ascending`:`descending`:`none`,P;t[43]===r?P=t[44]:(P=r({id:`6YtxFj`}),t[43]=r,t[44]=P);let F;t[45]!==m||t[46]!==v||t[47]!==g||t[48]!==P?(F=(0,Z.jsx)(wx,{label:P,sortKey:`name`,activeKey:g,activeDir:v,onSort:m}),t[45]=m,t[46]=v,t[47]=g,t[48]=P,t[49]=F):F=t[49];let I;t[50]!==N||t[51]!==F?(I=(0,Z.jsx)(bx,{"aria-sort":N,children:F}),t[50]=N,t[51]=F,t[52]=I):I=t[52];let L=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,R;t[53]===r?R=t[54]:(R=r({id:`tgWuMB`}),t[53]=r,t[54]=R);let z;t[55]!==m||t[56]!==v||t[57]!==g||t[58]!==R?(z=(0,Z.jsx)(wx,{label:R,sortKey:`modified`,activeKey:g,activeDir:v,onSort:m}),t[55]=m,t[56]=v,t[57]=g,t[58]=R,t[59]=z):z=t[59];let B;t[60]!==L||t[61]!==z?(B=(0,Z.jsx)(bx,{className:`w-32`,"aria-sort":L,children:z}),t[60]=L,t[61]=z,t[62]=B):B=t[62],t[63]!==I||t[64]!==B?(C=(0,Z.jsx)(_x,{children:(0,Z.jsxs)(yx,{children:[I,B]})}),t[63]=I,t[64]=B,t[65]=C):C=t[65],b=vx,S=i.length?i.map(Ex):(0,Z.jsx)(yx,{children:(0,Z.jsx)(xx,{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}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];let A;t[66]!==b||t[67]!==S?(A=(0,Z.jsx)(b,{children:S}),t[66]=b,t[67]=S,t[68]=A):A=t[68];let j;t[69]!==x||t[70]!==C||t[71]!==A?(j=(0,Z.jsxs)(x,{children:[C,A]}),t[69]=x,t[70]=C,t[71]=A,t[72]=j):j=t[72];let M;t[73]!==j||t[74]!==w?(M=(0,Z.jsx)(`div`,{className:w,children:j}),t[73]=j,t[74]=w,t[75]=M):M=t[75];let N;t[76]!==M||t[77]!==T||t[78]!==E||t[79]!==D||t[80]!==O?(N=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,M]}),t[76]=M,t[77]=T,t[78]=E,t[79]=D,t[80]=O,t[81]=N):N=t[81];let P;t[82]!==N||t[83]!==k?(P=(0,Z.jsx)(`div`,{className:k,children:N}),t[82]=N,t[83]=k,t[84]=P):P=t[84];let F;t[85]!==m||t[86]!==d||t[87]!==n?(F=(0,Z.jsx)(hm,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[85]=m,t[86]=d,t[87]=n,t[88]=F):F=t[88];let I;return t[89]!==P||t[90]!==F?(I=(0,Z.jsxs)(Z.Fragment,{children:[P,F]}),t[89]=P,t[90]=F,t[91]=I):I=t[91],I}function Ex(e){return(0,Z.jsxs)(yx,{children:[(0,Z.jsx)(xx,{children:(0,Z.jsxs)(`a`,{href:ki(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)(Uc,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(xt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(xx,{className:`text-muted-foreground`,children:e.kind===`file`?Sx(e.modified):`—`})]},e.path)}function Dx(e){return e===`asc`?`desc`:`asc`}function Ox(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)(wo,{className:`size-4 rounded`}),(0,Z.jsx)(wo,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(wo,{className:`h-4 w-16`})})]},e)}function kx(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)(Lc,{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=Lr(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Lr(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)(Xi,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(aa,{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 Ax(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(jx),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>w(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(){V(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)(Xi,{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 jx(){return new Set}var Mx=(0,Q.createContext)(null);function Nx(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(Px),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)(Mx,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function Px(){return new Map}function Fx(){let e=(0,Q.use)(Mx);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function Ix(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var Lx=Ix(()=>n(()=>import(`./SettingsDialogBody-DcBkN-yS.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([44,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,45,8,16,11,13,23]),import.meta.url));function Rx(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)(Xi,{variant:`default`,onClick:zx,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 zx(){return window.location.reload()}function Bx(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(W,{fallbackRender:Hx,onError:Vx,children:n}),t[0]=n,t[1]=r),r}function Vx(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function Hx(e){return(0,Z.jsx)(Rx,{...e})}function Ux(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function Wx(e){let t=(0,$.c)(81),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=ht(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=vt(),{desktopPresent:f}=Xo(),[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;t[3]===a?v=t[4]:(v=a({id:`7PzzBU`}),t[3]=a,t[4]=v);let y;t[5]===a?y=t[6]:(y=a({id:`Q6hhn8`}),t[5]=a,t[6]=y);let b;t[7]===y?b=t[8]:(b={id:`preferences`,label:y},t[7]=y,t[8]=b);let x;t[9]===a?x=t[10]:(x=a({id:`4KmEoC`}),t[9]=a,t[10]=x);let S;t[11]===x?S=t[12]:(S={id:`hotkeys`,label:x},t[11]=x,t[12]=S);let C;t[13]===a?C=t[14]:(C=a({id:`AeXO77`}),t[13]=a,t[14]=C);let w;t[15]===C?w=t[16]:(w={id:`account`,label:C},t[15]=C,t[16]=w);let T;t[17]!==b||t[18]!==S||t[19]!==w?(T=[b,S,w],t[17]=b,t[18]=S,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==T||t[22]!==v?(E={id:`user`,label:v,enabled:!0,items:T},t[21]=T,t[22]=v,t[23]=E):E=t[23];let D;t[24]===a?D=t[25]:(D=a({id:`ZWyHmq`}),t[24]=a,t[25]=D);let O;t[26]===a?O=t[27]:(O=a({id:`Nu4DdT`}),t[26]=a,t[27]=O);let k;t[28]===O?k=t[29]:(k={id:`sync`,label:O},t[28]=O,t[29]=k);let A;t[30]===a?A=t[31]:(A=a({id:`iTylMl`}),t[30]=a,t[31]=A);let j;t[32]===A?j=t[33]:(j={id:`project-templates`,label:A},t[32]=A,t[33]=j);let M;t[34]===a?M=t[35]:(M=a({id:`3zyg_A`}),t[34]=a,t[35]=M);let N;t[36]===M?N=t[37]:(N={id:`okignore`,label:M},t[36]=M,t[37]=N);let P;t[38]===a?P=t[39]:(P=a({id:`cs4mps`}),t[38]=a,t[39]=P);let F;t[40]===P?F=t[41]:(F={id:`sharing`,label:P},t[40]=P,t[41]=F);let I;t[42]!==k||t[43]!==j||t[44]!==N||t[45]!==F?(I=[k,j,N,F],t[42]=k,t[43]=j,t[44]=N,t[45]=F,t[46]=I):I=t[46];let L;t[47]!==_||t[48]!==D||t[49]!==I?(L={id:`project`,label:D,enabled:_,items:I},t[47]=_,t[48]=D,t[49]=I,t[50]=L):L=t[50];let R;t[51]===a?R=t[52]:(R=a({id:`nbfdhU`}),t[51]=a,t[52]=R);let z;t[53]!==a||t[54]!==f?(z=[],t[53]=a,t[54]=f,t[55]=z):z=t[55];let B;t[56]!==R||t[57]!==z?(B={id:`integrations`,label:R,enabled:!0,items:z},t[56]=R,t[57]=z,t[58]=B):B=t[58];let V;t[59]!==E||t[60]!==L||t[61]!==B?(V=[E,L,B],t[59]=E,t[60]=L,t[61]=B,t[62]=V):V=t[62];let H=V,U;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(ls,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[63]=U):U=t[63];let W;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(ss,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[64]=W):W=t[64];let G;t[65]!==p||t[66]!==H?(G=(0,Z.jsx)(Gx,{groups:H,activeId:p,onSelect:m}),t[65]=p,t[66]=H,t[67]=G):G=t[67];let ee;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Jx,{}),t[68]=ee):ee=t[68];let te=l?c:null,K;t[69]!==p||t[70]!==u||t[71]!==d||t[72]!==te?(K=(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)(Bx,{children:(0,Z.jsx)(Q.Suspense,{fallback:ee,children:(0,Z.jsx)(Lx,{activeId:p,userBinding:te,okignoreBinding:u,okignoreSynced:d})})})}),t[69]=p,t[70]=u,t[71]=d,t[72]=te,t[73]=K):K=t[73];let q;t[74]!==G||t[75]!==K?(q=(0,Z.jsxs)(us,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[U,W,G,K]}),t[74]=G,t[75]=K,t[76]=q):q=t[76];let ne;return t[77]!==r||t[78]!==n||t[79]!==q?(ne=(0,Z.jsx)(ms,{open:n,onOpenChange:r,children:q}),t[77]=r,t[78]=n,t[79]=q,t[80]=ne):ne=t[80],ne}function Gx(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)(qx,{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)(Kx,{}),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 Kx(){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=Ux(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:Ui(`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)(rs,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function qx(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=Ui(`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:Ui(`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 Jx(){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)(wo,{className:`h-5 w-32`}),r=(0,Z.jsx)(wo,{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)(wo,{className:`h-9 w-full`}),(0,Z.jsx)(wo,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function Yx(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=Ui(`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)(Vy,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Xx(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)(Wy,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function Zx(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=Ui(`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)(Jy,{"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 Qx(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=Ui(`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 $x=Qi(`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 eS(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=Ui($x({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:tS,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function tS(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Qi(`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 nS(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=Ui(`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 rS(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=Ui(`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)(vs,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function iS(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)(rS,{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)(Tc,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(as,{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)(gr,{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)(dr,{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)(jl,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(as,{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)(gr,{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)(dr,{children:[U,W]}),t[44]=U,t[45]=G);let ee;t[46]!==B||t[47]!==G?(ee=(0,Z.jsxs)(eS,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=ee):ee=t[48];let te;t[49]!==ee||t[50]!==F?(te=(0,Z.jsxs)(Qx,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,ee]}),t[49]=ee,t[50]=F,t[51]=te):te=t[51];let K;t[52]===E?K=t[53]:(K=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:E}),t[52]=E,t[53]=K);let q;t[54]===S?q=t[55]:(q=S({id:`oqB2ez`}),t[54]=S,t[55]=q);let ne=!w,re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(J,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=re):re=t[56];let ie;t[57]!==v||t[58]!==q||t[59]!==ne?(ie=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":q,disabled:ne,onClick:v,children:re})}),t[57]=v,t[58]=q,t[59]=ne,t[60]=ie):ie=t[60];let ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(gr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=ae):ae=t[61];let oe;t[62]===ie?oe=t[63]:(oe=(0,Z.jsxs)(dr,{children:[ie,ae]}),t[62]=ie,t[63]=oe);let se;t[64]===S?se=t[65]:(se=S({id:`SiUUCS`}),t[64]=S,t[65]=se);let ce=!w,le;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(De,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=le):le=t[66];let ue;t[67]!==_||t[68]!==se||t[69]!==ce?(ue=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":se,disabled:ce,onClick:_,children:le})}),t[67]=_,t[68]=se,t[69]=ce,t[70]=ue):ue=t[70];let de;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(gr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=de):de=t[71];let fe;t[72]===ue?fe=t[73]:(fe=(0,Z.jsxs)(dr,{children:[ue,de]}),t[72]=ue,t[73]=fe);let pe=o?`secondary`:`ghost`,me;t[74]!==S||t[75]!==o?(me=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=me):me=t[76];let he=o?`ok-replace-input`:void 0,ge;t[77]!==m||t[78]!==o?(ge=()=>m(!o),t[77]=m,t[78]=o,t[79]=ge):ge=t[79];let _e;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(pl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=_e):_e=t[80];let ve;t[81]!==o||t[82]!==pe||t[83]!==me||t[84]!==he||t[85]!==ge?(ve=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,variant:pe,size:`icon-sm`,"aria-label":me,"aria-expanded":o,"aria-controls":he,onClick:ge,children:_e})}),t[81]=o,t[82]=pe,t[83]=me,t[84]=he,t[85]=ge,t[86]=ve):ve=t[86];let ye;t[87]===o?ye=t[88]:(ye=(0,Z.jsx)(gr,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=ye);let be;t[89]!==ve||t[90]!==ye?(be=(0,Z.jsxs)(dr,{children:[ve,ye]}),t[89]=ve,t[90]=ye,t[91]=be):be=t[91];let xe;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(xe=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)(vs,{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)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(pl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(gr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(fl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(gr,{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]=xe):xe=t[100];let Se;t[101]===S?Se=t[102]:(Se=S({id:`wJo9oS`}),t[101]=S,t[102]=Se);let Ce;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(cs,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Ce):Ce=t[103];let we;t[104]!==x||t[105]!==Se?(we=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Se,onClick:x,children:Ce})}),t[104]=x,t[105]=Se,t[106]=we):we=t[106];let Te;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(gr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Te):Te=t[107];let Ee;t[108]===we?Ee=t[109]:(Ee=(0,Z.jsxs)(dr,{children:[we,Te]}),t[108]=we,t[109]=Ee);let Oe;return t[110]!==te||t[111]!==K||t[112]!==oe||t[113]!==fe||t[114]!==j||t[115]!==be||t[116]!==xe||t[117]!==Ee?(Oe=(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,te,K,oe,fe,be,xe,Ee]}),t[110]=te,t[111]=K,t[112]=oe,t[113]=fe,t[114]=j,t[115]=be,t[116]=xe,t[117]=Ee,t[118]=Oe):Oe=t[118],Oe}var aS={current:0,total:0},oS=120,sS=100;function cS(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?tn(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(ge,n,lS)}function lS(){return null}function uS(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,`
23
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function v_(e,t){return`${e}\u0000${t}`}function y_(e,t,n){let r=Fr(e).body,i=Fr(t).body;return r===i?``:g_(n,r,i,``,``,{context:3})}function b_(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=ht(),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=y_(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 x_=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-BNQupLE1.js`),__vite__mapDeps([18,1,6,19]),import.meta.url)).ActivityPanelDiffView}));function S_(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Y._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Y._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Y._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Y._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Y._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function C_(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function w_(e){return e.slice(0,7)}function T_(e){return e.type===`upstream`?Y._({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`?Y._({id:`B2DrPb`}):e.author}function E_(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)(ta,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(sa,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)($i,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(ia,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(fa,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(ua,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(ca,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function D_(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)(tt,{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=si(i),t[1]=i,t[2]=a);let o=a,s=r?Qr[o]??Nn[o]:Nn[o],c;t[3]!==s||t[4]!==i?(c=s??_r(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)(E_,{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)(Gc,{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)(vc,{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)(Al,{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)(ca,{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)(vc,{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)(Al,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function O_(e){let t=(0,$.c)(23),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:l,onRestoreSuccess:u}=e,[d,f]=(0,Q.useState)(r),p=n.length;if(n.length===0)return null;let m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>f(k_),t[0]=m):m=t[0];let h;t[1]===d?h=t[2]:(h=d?(0,Z.jsx)(De,{className:`size-3`}):(0,Z.jsx)(_s,{className:`size-3`}),t[1]=d,t[2]=h);let g;t[3]!==p||t[4]!==d?(g=d?Y._({id:`OKQe56`,values:{entryCount:p}}):Y._({id:`k9jDvw`,values:{entryCount:p}}),t[3]=p,t[4]=d,t[5]=g):g=t[5];let _;t[6]!==d||t[7]!==h||t[8]!==g?(_=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:m,children:[h,g]}),t[6]=d,t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]!==o||t[11]!==a||t[12]!==s||t[13]!==n||t[14]!==d||t[15]!==c||t[16]!==i||t[17]!==u||t[18]!==l?(v=d&&n.map(e=>(0,Z.jsx)(V_,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:l,onRestoreSuccess:u},e.sha)),t[10]=o,t[11]=a,t[12]=s,t[13]=n,t[14]=d,t[15]=c,t[16]=i,t[17]=u,t[18]=l,t[19]=v):v=t[19];let y;return t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22],y}function k_(e){return!e}function A_(e){return e.checkpoint?e.checkpoint.kind:`save`}function j_(e){let t=A_(e);if(t===`save`)return Y._({id:`gsePqm`});let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${M_(n)})`:``;return t===`bridge-merge-loss`?Y._({id:`uZAG7T`,values:{sizeSuffix:r}}):Y._({id:`_4rAQI`,values:{sizeSuffix:r}})}function M_(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function N_(e){return e.type===`checkpoint`?A_(e)===`save`?`version`:`auto-save`:`wip`}function P_(e){let t=N_(e);return t===`version`?Y._({id:`RFQ1Yx`}):t===`auto-save`?Y._({id:`9Uv1CD`}):Y._({id:`Yea-K5`})}function F_(e){let t=N_(e);return t===`version`?Y._({id:`gg3Rpy`}):t===`auto-save`?Y._({id:`PXXeW8`}):Y._({id:`Pyp1NA`})}function I_(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function L_(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(z_),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(R_)},children:[r?(0,Z.jsx)(De,{className:`size-3`}):(0,Z.jsx)(_s,{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 R_(e){return!e}function z_(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 B_(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=b_(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)(F,{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)(F,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(x_,{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 V_(e){let t=(0,$.c)(130),{entry:n,prominent:r,isDark:a,diffLayout:o,cache:c,docName:l,expanded:u,onToggleExpanded:d,onRestoreSuccess:f}=e,p=r===void 0?!1:r,{_:m}=i(),h;t[0]===n.timestamp?h=t[1]:(h=S_(n.timestamp),t[0]=n.timestamp,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=T_(n),t[2]=n,t[3]=_);let v=_,y;t[4]===n.timestamp?y=t[5]:(y=C_(n.timestamp),t[4]=n.timestamp,t[5]=y);let b=y,x;t[6]===n.sha?x=t[7]:(x=w_(n.sha),t[6]=n.sha,t[7]=x);let S=x,C=n.contributors.flatMap(H_),w;t[8]===n?w=t[9]:(w=I_(n),t[8]=n,t[9]=w);let T=w,[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),A=(0,Q.useRef)(null),j=(0,Q.useId)(),M,N;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>A.current?.abort(),N=[],t[10]=M,t[11]=N):(M=t[10],N=t[11]),(0,Q.useEffect)(M,N);let P;t[12]!==n.sha||t[13]!==d?(P=()=>d(n.sha),t[12]=n.sha,t[13]=d,t[14]=P):P=t[14];let I=P,L;t[15]===D?L=t[16]:(L=function(){A.current?.abort(),A.current=null,k(!1),D(!1)},t[15]=D,t[16]=L);let R=L,z;t[17]!==m||t[18]!==l||t[19]!==n.sha||t[20]!==f||t[21]!==D?(z=async function(){k(!0);let e=new AbortController;A.current=e;let t=function(){e.signal.aborted||k(!1),A.current===e&&(A.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:l,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:l,sha:n.sha,err:i}),X.error(m({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)D(!1),f();else{let e=`HTTP ${r.status}`;try{let t=br.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:l,sha:n.sha,status:r.status,detail:e}),X.error(m({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=m,t[18]=l,t[19]=n.sha,t[20]=f,t[21]=D,t[22]=z):z=t[22];let B=z,V;t[23]!==n||t[24]!==a||t[25]!==p?(V=p?(()=>{let e=A_(n);return e===`bridge-merge-loss`?(0,Z.jsx)(Nr,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(Ic,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(Nc,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(D_,{entry:n,isDark:a}),t[23]=n,t[24]=a,t[25]=p,t[26]=V):V=t[26];let H=V,U=u?j:void 0,W=u?`bg-muted`:`hover:bg-muted/80`,G;t[27]===W?G=t[28]:(G=[`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`,W],t[27]=W,t[28]=G);let ee=G.join(` `),te;t[29]===I?te=t[30]:(te=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),I())},t[29]=I,t[30]=te);let K;t[31]===H?K=t[32]:(K=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:H}),t[31]=H,t[32]=K);let q;t[33]!==v||t[34]!==n||t[35]!==p?(q=p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:j_(n)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,children:`·`}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:v})]}):(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:v}),t[33]=v,t[34]=n,t[35]=p,t[36]=q):q=t[36];let ne;t[37]!==n.timestamp||t[38]!==g?(ne=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:g}),t[37]=n.timestamp,t[38]=g,t[39]=ne):ne=t[39];let re;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[40]=re):re=t[40];let ie;t[41]===n?ie=t[42]:(ie=P_(n),t[41]=n,t[42]=ie);let ae;t[43]===D?ae=t[44]:(ae=e=>{e.stopPropagation(),D(!0)},t[43]=D,t[44]=ae);let oe;t[45]===O?oe=t[46]:(oe=O?(0,Z.jsx)(F,{className:`size-3 animate-spin`}):(0,Z.jsx)(na,{className:`size-3`}),t[45]=O,t[46]=oe);let se;t[47]!==O||t[48]!==ie||t[49]!==ae||t[50]!==oe?(se=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":ie,disabled:O,onClick:ae,children:oe})}),t[47]=O,t[48]=ie,t[49]=ae,t[50]=oe,t[51]=se):se=t[51];let ce;t[52]===n?ce=t[53]:(ce=P_(n),t[52]=n,t[53]=ce);let le;t[54]===ce?le=t[55]:(le=(0,Z.jsx)(gr,{side:`top`,children:ce}),t[54]=ce,t[55]=le);let ue;t[56]!==se||t[57]!==le?(ue=(0,Z.jsxs)(dr,{children:[se,le]}),t[56]=se,t[57]=le,t[58]=ue):ue=t[58];let de;t[59]!==q||t[60]!==ne||t[61]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[q,ne,re,ue]}),t[59]=q,t[60]=ne,t[61]=ue,t[62]=de):de=t[62];let fe;t[63]===T?fe=t[64]:(fe=T.length>0&&(0,Z.jsx)(L_,{summaries:T}),t[63]=T,t[64]=fe);let pe=C.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:C.join(`, `),children:C.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),me;t[65]!==de||t[66]!==fe||t[67]!==pe?(me=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[de,fe,pe]}),t[65]=de,t[66]=fe,t[67]=pe,t[68]=me):me=t[68];let he;t[69]!==u||t[70]!==I||t[71]!==U||t[72]!==ee||t[73]!==te||t[74]!==K||t[75]!==me?(he=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":u,"aria-controls":U,"data-testid":`timeline-entry-expand`,className:ee,onClick:I,onKeyDown:te,children:[K,me]}),t[69]=u,t[70]=I,t[71]=U,t[72]=ee,t[73]=te,t[74]=K,t[75]=me,t[76]=he):he=t[76];let ge;t[77]!==c||t[78]!==o||t[79]!==j||t[80]!==l||t[81]!==n.sha||t[82]!==u?(ge=u&&(0,Z.jsx)(B_,{sha:n.sha,docName:l,cache:c,diffLayout:o,panelId:j}),t[77]=c,t[78]=o,t[79]=j,t[80]=l,t[81]=n.sha,t[82]=u,t[83]=ge):ge=t[83];let _e;t[84]!==he||t[85]!==ge?(_e=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[he,ge]}),t[84]=he,t[85]=ge,t[86]=_e):_e=t[86];let ve;t[87]!==R||t[88]!==D?(ve=e=>{e?D(!0):R()},t[87]=R,t[88]=D,t[89]=ve):ve=t[89];let ye;t[90]===n?ye=t[91]:(ye=F_(n),t[90]=n,t[91]=ye);let be;t[92]===ye?be=t[93]:(be=(0,Z.jsx)(ls,{children:ye}),t[92]=ye,t[93]=be);let xe;t[94]!==b||t[95]!==v||t[96]!==S||t[97]!==g?(xe={relative:g,absoluteTime:b,entrySha:S,authorName:v},t[94]=b,t[95]=v,t[96]=S,t[97]=g,t[98]=xe):xe=t[98];let Se;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(Se={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[99]=Se):Se=t[99];let Ce;t[100]===xe?Ce=t[101]:(Ce=(0,Z.jsx)(ss,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:xe,components:Se})}),t[100]=xe,t[101]=Ce);let we;t[102]!==be||t[103]!==Ce?(we=(0,Z.jsxs)(ps,{children:[be,Ce]}),t[102]=be,t[103]=Ce,t[104]=we):we=t[104];let Te;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(s,{id:`dEgA5A`}),t[105]=Te):Te=t[105];let Ee;t[106]===R?Ee=t[107]:(Ee=(0,Z.jsx)(Xi,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:R,children:Te}),t[106]=R,t[107]=Ee);let De;t[108]===B?De=t[109]:(De=()=>B(),t[108]=B,t[109]=De);let Oe;t[110]===O?Oe=t[111]:(Oe=O?(0,Z.jsx)(F,{className:`mr-2 size-4 animate-spin`}):null,t[110]=O,t[111]=Oe);let ke;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[112]=ke):ke=t[112];let Ae;t[113]!==O||t[114]!==De||t[115]!==Oe?(Ae=(0,Z.jsxs)(Xi,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:O,onClick:De,children:[Oe,ke]}),t[113]=O,t[114]=De,t[115]=Oe,t[116]=Ae):Ae=t[116];let je;t[117]!==Ee||t[118]!==Ae?(je=(0,Z.jsxs)(fs,{children:[Ee,Ae]}),t[117]=Ee,t[118]=Ae,t[119]=je):je=t[119];let Me;t[120]!==we||t[121]!==je?(Me=(0,Z.jsxs)(us,{children:[we,je]}),t[120]=we,t[121]=je,t[122]=Me):Me=t[122];let Ne;t[123]!==E||t[124]!==ve||t[125]!==Me?(Ne=(0,Z.jsx)(ms,{open:E,onOpenChange:ve,children:Me}),t[123]=E,t[124]=ve,t[125]=Me,t[126]=Ne):Ne=t[126];let Pe;return t[127]!==_e||t[128]!==Ne?(Pe=(0,Z.jsxs)(Z.Fragment,{children:[_e,Ne]}),t[127]=_e,t[128]=Ne,t[129]=Pe):Pe=t[129],Pe}function H_(e){return e.docs}function U_(e){let t=(0,$.c)(87),{docName:n,diffLayout:r,onDiffLayoutChange:a,onSaveVersion:o,saving:c}=e,{_:l}=i(),{resolvedTheme:u}=ar(),d=u===`dark`,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(null),[b]=(0,Q.useState)(q_),[x,S]=(0,Q.useState)(K_),C;t[1]===b?C=t[2]:(C=()=>{S(new Set),b.clear()},t[1]=b,t[2]=C);let w;t[3]===n?w=t[4]:(w=[n],t[3]=n,t[4]=w),(0,Q.useEffect)(C,w);let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){S(new Set)},t[6]=D):D=t[6];let O=D,k,A;t[7]!==l||t[8]!==n?(k=()=>{if(!n){m([]);return}let e=!1,t=async function(){if(n)try{let t=await fetch(`/api/history?docName=${encodeURIComponent(n)}&limit=100`);if(e)return;if(!t.ok){v(l({id:`brCtGB`}));return}let r=await t.json();if(e)return;m(r.entries??[]),v(null)}catch(t){let n=t;if(e)return;v(l({id:`brCtGB`})),console.error(`[timeline]`,n)}};return g(!0),t().finally(()=>{e||g(!1)}),y.current=setInterval(t,1e4),()=>{e=!0,y.current&&clearInterval(y.current)}},A=[n,l],t[7]=l,t[8]=n,t[9]=k,t[10]=A):(k=t[9],A=t[10]),(0,Q.useEffect)(k,A);let j,M,N,P,I,L,R,z;if(t[11]!==l||t[12]!==b||t[13]!==r||t[14]!==n||t[15]!==p||t[16]!==_||t[17]!==x||t[18]!==d||t[19]!==h||t[20]!==a||t[21]!==o||t[22]!==c){let e=[],i=[],u=!1;for(let t of p)t.type===`checkpoint`?(i.length>0&&(e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u}),i=[]),e.push({kind:`checkpoint`,entry:t}),u=!0):i.push(t);i.length>0&&e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u});let f;t[31]===p?f=t[32]:(f=p.some(G_),t[31]=p,t[32]=f);let m=!f,g=!h&&!_&&p.length>0;I=`flex h-full flex-col`;let v;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(En,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[33]=v):v=t[33];let y;t[34]!==l||t[35]!==r||t[36]!==g||t[37]!==a?(y=g&&(0,Z.jsxs)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsxs)(os,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":l({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)(is,{value:`unified`,"aria-label":l({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(ml,{className:`size-3.5`})}),(0,Z.jsx)(is,{value:`split`,"aria-label":l({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(kc,{className:`size-3.5`})})]})}),(0,Z.jsx)(gr,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[34]=l,t[35]=r,t[36]=g,t[37]=a,t[38]=y):y=t[38];let S;t[39]===l?S=t[40]:(S=l({id:`IrYrzq`}),t[39]=l,t[40]=S);let C;t[41]===c?C=t[42]:(C=c?(0,Z.jsx)(F,{className:`size-4 animate-spin`}):(0,Z.jsx)(hl,{className:`size-4`}),t[41]=c,t[42]=C);let w;t[43]!==o||t[44]!==c||t[45]!==S||t[46]!==C?(w=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon-sm`,onClick:o,disabled:c,"aria-label":S,className:`text-muted-foreground`,"data-testid":`timeline-save-version`,children:C})}),t[43]=o,t[44]=c,t[45]=S,t[46]=C,t[47]=w):w=t[47];let T;t[48]===c?T=t[49]:(T=(0,Z.jsx)(gr,{children:c?(0,Z.jsx)(s,{id:`uF9ruK`}):(0,Z.jsx)(s,{id:`IrYrzq`})}),t[48]=c,t[49]=T);let D;t[50]!==w||t[51]!==T?(D=(0,Z.jsxs)(dr,{children:[w,T]}),t[50]=w,t[51]=T,t[52]=D):D=t[52],t[53]!==y||t[54]!==D?(L=(0,Z.jsxs)(Cn,{children:[v,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,D]})]}),t[53]=y,t[54]=D,t[55]=L):L=t[55],R=`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,t[56]!==l||t[57]!==h?(z=h&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":l({id:`o49mDZ`}),children:[1,2,3].map(W_)}),t[56]=l,t[57]=h,t[58]=z):z=t[58],t[59]!==_||t[60]!==h?(j=!h&&_&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:_})}),t[59]=_,t[60]=h,t[61]=j):j=t[61],t[62]!==p.length||t[63]!==_||t[64]!==h?(M=!h&&!_&&p.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[62]=p.length,t[63]=_,t[64]=h,t[65]=M):M=t[65],t[66]!==b||t[67]!==r||t[68]!==n||t[69]!==p||t[70]!==_||t[71]!==x||t[72]!==m||t[73]!==d||t[74]!==h?(N=!h&&!_&&m&&p.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:p.map(e=>(0,Z.jsx)(V_,{entry:e,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.sha),onToggleExpanded:E,onRestoreSuccess:O},e.sha))}),t[66]=b,t[67]=r,t[68]=n,t[69]=p,t[70]=_,t[71]=x,t[72]=m,t[73]=d,t[74]=h,t[75]=N):N=t[75],P=!h&&!_&&!m&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:e.map((e,t)=>e.kind===`checkpoint`?(0,Z.jsx)(V_,{entry:e.entry,prominent:!0,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.entry.sha),onToggleExpanded:E,onRestoreSuccess:O},e.entry.sha):(0,Z.jsx)(O_,{entries:e.entries,defaultExpanded:e.isPreCheckpoint,isDark:d,diffLayout:r,cache:b,docName:n,expandedShas:x,onToggleExpanded:E,onRestoreSuccess:O},e.entries[0]?.sha??`wip-${t}`))}),t[11]=l,t[12]=b,t[13]=r,t[14]=n,t[15]=p,t[16]=_,t[17]=x,t[18]=d,t[19]=h,t[20]=a,t[21]=o,t[22]=c,t[23]=j,t[24]=M,t[25]=N,t[26]=P,t[27]=I,t[28]=L,t[29]=R,t[30]=z}else j=t[23],M=t[24],N=t[25],P=t[26],I=t[27],L=t[28],R=t[29],z=t[30];let B;t[76]!==j||t[77]!==M||t[78]!==N||t[79]!==P||t[80]!==R||t[81]!==z?(B=(0,Z.jsxs)(`div`,{className:R,children:[z,j,M,N,P]}),t[76]=j,t[77]=M,t[78]=N,t[79]=P,t[80]=R,t[81]=z,t[82]=B):B=t[82];let V;return t[83]!==I||t[84]!==L||t[85]!==B?(V=(0,Z.jsxs)(`div`,{className:I,children:[L,B]}),t[83]=I,t[84]=L,t[85]=B,t[86]=V):V=t[86],V}function W_(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(wo,{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)(wo,{className:`h-3 w-28`}),(0,Z.jsx)(wo,{className:`h-3 w-40`})]})]},e)}function G_(e){return e.type===`checkpoint`}function K_(){return new Set}function q_(){return new ra(32)}var J_=[{id:`outline`,icon:Qc},{id:`links`,icon:be},{id:`graph`,icon:tl},{id:`timeline`,icon:Oc}];function Y_(e){return e===`outline`?Y._({id:`dD7NPy`}):e===`links`?Y._({id:`Rj01Fz`}):e===`graph`?Y._({id:`x2fr_j`}):Y._({id:`cklVjM`})}function X_(){return n(()=>import(`./GraphPanel-D2ZWMZHw.js`),__vite__mapDeps([20,1,21,6,3,7,22,23,12,13,24,25,26,27,28,29,30,31,32,33]),import.meta.url)}var Z_=(0,Q.lazy)(async()=>({default:(await X_()).GraphPanel})),Q_=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DjLptssw.js`),__vite__mapDeps([34,1,2,35,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,43]),import.meta.url)).ActivityModeContent}));function $_(e){let t=(0,$.c)(16),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c,onSaveVersion:l,saving:u}=e,{_:d}=i(),[f,p]=(0,Q.useState)(`unified`),m;t[0]!==d||t[1]!==a||t[2]!==c||t[3]!==o?(m=c===`doc`?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(os,{type:`single`,variant:`outline`,value:a,onValueChange:e=>{e&&o(e)},"aria-label":d({id:`SrOuyg`}),children:J_.map(ev)})}):null,t[0]=d,t[1]=a,t[2]=c,t[3]=o,t[4]=m):m=t[4];let h;t[5]!==a||t[6]!==f||t[7]!==n||t[8]!==r||t[9]!==c||t[10]!==l||t[11]!==u?(h=c===`doc`?(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-${a}`,"aria-labelledby":`tab-${a}`,className:`min-h-0 flex-1`,children:[a===`outline`&&(0,Z.jsx)(tc,{docName:n,isSourceMode:r}),a===`links`&&(0,Z.jsx)(Wg,{docName:n}),a===`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)(Z_,{activeDocName:n})}),a===`timeline`&&(0,Z.jsx)(U_,{docName:n,diffLayout:f,onDiffLayoutChange:p,onSaveVersion:l,saving:u})]}):(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)(Q_,{})})}),t[5]=a,t[6]=f,t[7]=n,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(Z.Fragment,{children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15],g}function ev(e){let{id:t,icon:n}=e,r=Y_(t);return(0,Z.jsxs)(dr,{children:[(0,Z.jsx)(is,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(tr,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(gr,{side:`bottom`,children:r})]},t)}function tv(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function nv(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function rv(e){return e/100*window.innerHeight}function iv(e){return e/100*window.innerWidth}function av(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 ov({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=av(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=nv(t,i);break;case`em`:r=tv(t,i);break;case`vh`:r=rv(i);break;case`vw`:r=iv(i);break}return r}function sv(e){return parseFloat(e.toFixed(3))}function cv({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 lv(e){let{panels:t}=e,n=cv({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=sv(ov({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=sv(ov({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=sv(ov({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=sv(ov({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 uv(e,t=`Assertion error`){if(!e)throw Error(t)}function dv(e,t){return Array.from(t).sort(e===`horizontal`?fv:pv)}function fv(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function pv(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function mv(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function hv(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 gv({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}=hv(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return uv(i,`No rect found`),i}var _v;function vv(){return _v===void 0&&(_v=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),_v}function yv(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=dv(n,Array.from(t.children).filter(mv).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,gv({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=vv()?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:cv({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 bv=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)}}},xv=new Map,Sv=new bv;function Cv(e){xv=new Map(xv),xv.delete(e)}function wv(e,t){for(let[t]of xv)if(t.id===e)return t}function Tv(e,t){for(let[t,n]of xv)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Ev(){return xv}function Dv(e,t){return Sv.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Ov(e,t){let n=xv.get(e);xv=new Map(xv),xv.set(e,t),Sv.emit(`groupChange`,{group:e,prev:n,next:t})}function kv(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=hv(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 Av(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function jv(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Lv(e),b:Lv(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();uv(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Iv(Fv(n.a)),b:Iv(Fv(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 Mv=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Nv(e){let t=getComputedStyle(Rv(e)??e).display;return t===`flex`||t===`inline-flex`}function Pv(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Nv(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`||Mv.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Fv(e){let t=e.length;for(;t--;){let n=e[t];if(uv(n,`Missing node`),Pv(n))return n}return null}function Iv(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Lv(e){let t=[];for(;e;)t.push(e),e=Rv(e);return t}function Rv(e){let{parentNode:t}=e;return Av(t)?t.host:t}function zv(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 Bv({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!mv(n)||n.contains(e)||e.contains(n))return!0;if(jv(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(zv(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Vv(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=yv(r),a=kv(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Bv({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Hv(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 Uv(e,t,n=0){return Math.abs(sv(e)-sv(t))<=n}function Wv(e,t){return Uv(e,t)?0:e>t?1:-1}function Gv({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(Wv(r,c)<0)if(a){let e=(i+c)/2;r=Wv(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=sv(r),r}function Kv({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Uv(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;uv(u!=null,`Invalid first pivot index`),uv(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];uv(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(uv(n!=null,`Previous layout not found for panel index ${t}`),Uv(n,i)){let t=o-n;Wv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];uv(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(uv(n!=null,`Previous layout not found for panel index ${t}`),Uv(n,o)){let t=n-i;Wv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];uv(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Wv(i,c)<0)if(e>0){let t=c-o,n=t/2;Wv(i+e,c)<0&&(e=Wv(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Wv(i-e,c)<0&&(e=Wv(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];uv(e!=null,`Previous layout not found for panel index ${r}`);let a=Gv({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];uv(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Gv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Uv(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(Hv(c,l))return i;{let t=e<0?d:u,r=s[t];uv(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Gv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Uv(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];uv(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Gv({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Uv(i,s)||(t-=s-i,l[r]=s),Uv(t,0))break;e>0?r--:r++}}}if(!Uv(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 qv(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Wv(e[n],t[n])!==0)return!1;return!0}function Jv({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(!Uv(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];uv(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];uv(i!=null,`No layout data found for index ${e}`);let o=r[e];uv(o!=null,`No layout data found for index ${e}`);let s=Gv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Uv(a,0))for(let e=0;e<t.length;e++){let n=r[e];uv(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Gv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Uv(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Yv({groupId:e,panelId:t}){let n=()=>{let t=Ev();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=Jv({layout:Kv({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});qv(l,p)||Ov(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&&Uv(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=cv({group:t});o(sv(ov({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Xv(e){e.defaultPrevented||Vv(e,Ev()).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=Yv({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Zv(e){let t=Ev();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 Qv({groupId:e}){let t=()=>{let t=Ev();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=Jv({layout:e,panelConstraints:r});return n?o:(qv(o,c)||Ov(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function $v(e,t){let n=Zv(e),r=Tv(n.id,!0),i=n.separators.find(t=>t.element===e);uv(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);uv(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Qv({groupId:n.id}).getLayout(),c=Jv({layout:Kv({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});qv(s,c)||Ov(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function ey(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Zv(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&$v(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&$v(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&$v(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&$v(t,-5);break;case`End`:e.preventDefault(),$v(t,100);break;case`Enter`:{e.preventDefault();let n=Zv(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Tv(n.id,!0),o=n.separators.find(e=>e.element===t);uv(o,`Matching separator not found`);let s=a.get(o);uv(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(uv(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];$v(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Zv(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);uv(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(),$v(t,-100);break}}var ty={cursorFlags:0,state:`inactive`},ny=new bv;function ry(){return ty}function iy(e){return ny.addListener(`change`,e)}function ay(e){let t=ty,n={...ty};n.cursorFlags=e,ty=n,ny.emit(`change`,{prev:t,next:n})}function oy(e){let t=ty;ty=e,ny.emit(`change`,{prev:t,next:e})}function sy(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Ev(),n=Vv(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)}),oy({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var cy=e=>e,ly=()=>{},uy=1,dy=2,fy=4,py=8,my=3,hy=12,gy;function _y(){return gy===void 0&&(gy=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(gy=!0)),gy}function vy({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&&_y()){let t=(e&uy)!==0,n=(e&dy)!==0,r=(e&fy)!==0,i=(e&py)!==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 _y()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var yy=new WeakMap;function by(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=yy.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=ry();switch(r.state){case`active`:case`hover`:{let e=vy({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}yy.set(e,{prevStyle:t,styleSheet:n})}function xy({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=Kv({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(qv(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?uy:dy;break;case`vertical`:s|=d<0?fy:py;break}}else Ov(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&my:c|=s&my,t.movementY===0?c|=o&hy:c|=s&hy,ay(c),by(e)}function Sy(e){let t=Ev(),n=ry();switch(n.state){case`active`:xy({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Cy(e){if(e.defaultPrevented)return;let t=ry(),n=Ev();switch(t.state){case`active`:if(e.buttons===0){oy({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Tv(e.group.id,!0);Ov(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)}xy({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Vv(e,n);r.length===0?t.state!==`inactive`&&oy({cursorFlags:0,state:`inactive`}):oy({cursorFlags:0,hitRegions:r,state:`hover`}),by(e.currentTarget);break}}}function wy(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(ry().state){case`hover`:oy({cursorFlags:0,state:`inactive`})}}function Ty(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=ry();switch(t.state){case`active`:oy({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(by(e.currentTarget),t.hitRegions.forEach(e=>{let t=Tv(e.group.id,!0);Ov(e.group,t)}),e.preventDefault())}}function Ey(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=sv(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=sv((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Dy(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=cv({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:sv(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Oy(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 ky({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=sv(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]=sv((r[e]??0)/a*l);else{let e=sv(l/c.length);for(let t of c)u[t]=e}return u}function Ay(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 jy=new Map;function My(e){let t=!0;uv(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=cv({group:e});if(t===0)return;let n=Tv(e.id);if(!n)return;let r=lv(e),i=n.defaultLayoutDeferred?Ey(r):n.layout,a=Jv({layout:ky({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&qv(n.layout,a)&&Oy(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Ov(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Dy(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{uv(!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=cv({group:e}),s=lv(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Ay(e.panels,l)||(l=void 0));let u=Jv({layout:e.mutableState.layouts[c]??l??Ey(s),panelConstraints:s}),d=e.element.ownerDocument;jy.set(d,(jy.get(d)??0)+1);let f=new Map;return yv(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Ov(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{uv(!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`,ey)}),jy.get(d)===1&&(d.addEventListener(`dblclick`,Xv,!0),d.addEventListener(`pointerdown`,sy,!0),d.addEventListener(`pointerleave`,Sy),d.addEventListener(`pointermove`,Cy),d.addEventListener(`pointerout`,wy),d.addEventListener(`pointerup`,Ty,!0)),function(){t=!1,jy.set(d,Math.max(0,(jy.get(d)??0)-1)),Cv(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,ey)}),jy.get(d)||(d.removeEventListener(`dblclick`,Xv,!0),d.removeEventListener(`pointerdown`,sy,!0),d.removeEventListener(`pointerleave`,Sy),d.removeEventListener(`pointermove`,Cy),d.removeEventListener(`pointerout`,wy),d.removeEventListener(`pointerup`,Ty,!0)),a.disconnect()}}function Ny(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Py(e){let t=(0,Q.useId)();return`${e??t}`}var Fy=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function Iy(e){let t=(0,Q.useRef)(e);return Fy(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Ly(...e){return Iy(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Ry(e){let t=(0,Q.useRef)({...e});return Fy(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var zy=(0,Q.createContext)(null);function By(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:cy});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Fy(()=>{Object.assign(n.current,Qv({groupId:e}))})}function Vy({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=Iy(e=>{qv(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Iy(e=>{qv(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Py(s),v=(0,Q.useRef)(null),[y,b]=Ny(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Ly(v,a);By(_,o);let C=Iy((e,t)=>{let r=ry(),i=wv(e),a=Tv(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=Ry({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=dv(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=dv(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=wv(_),i=Tv(_);r&&i&&Ov(r,{...i,derivedPanelConstraints:lv(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 Fy(()=>{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=My(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Tv(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Dv(_,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=Uv(t.collapsedSize,i[t.panelId]),a=Uv(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=ry().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)(zy.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})})}Vy.displayName=`Group`;function Hy(){let e=(0,Q.useContext)(zy);return uv(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Uy(e,t){let{id:n}=Hy(),r=(0,Q.useRef)({collapse:ly,expand:ly,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ly});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Fy(()=>{Object.assign(r.current,Yv({groupId:n,panelId:e}))})}function Wy({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=Py(c),_=Ry({disabled:a}),v=(0,Q.useRef)(null),y=Ly(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Hy(),T=d!==null,E=Iy((e,t,n)=>{d?.(e,c,n)});Fy(()=>{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]),Uy(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Dv(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:{...Gy,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})})}Wy.displayName=`Panel`;var Gy={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Ky(){return(0,Q.useRef)(null)}function qy({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=Jv({layout:Kv({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Jv({layout:Kv({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Jy({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Py(a),l=Ry({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=Ly(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Hy(),x=v===`horizontal`?`vertical`:`horizontal`;Fy(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=iy(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Dv(_,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(qy({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})}Jy.displayName=`Separator`;var Yy={name:`toml`,startState:function(){return{inString:!1,stringType:``,lhs:!0,inArray:0}},token:function(e,t){let n;if(!t.inString&&(n=e.match(/^('''|"""|'|")/))&&(t.stringType=n[0],t.inString=!0),e.sol()&&!t.inString&&t.inArray===0&&(t.lhs=!0),t.inString){for(;t.inString;)if(e.match(t.stringType))t.inString=!1;else if(e.peek()===`\\`)e.next(),e.next();else if(e.eol())break;else e.match(/^.[^\\\"\']*/);return t.lhs?`property`:`string`}else if(t.inArray&&e.peek()===`]`)return e.next(),t.inArray--,`bracket`;else if(t.lhs&&e.peek()===`[`&&e.skipTo(`]`))return e.next(),e.peek()===`]`&&e.next(),`atom`;else if(e.peek()===`#`)return e.skipToEnd(),`comment`;else if(e.eatSpace())return null;else if(t.lhs&&e.eatWhile(function(e){return e!=`=`&&e!=` `}))return`property`;else if(t.lhs&&e.peek()===`=`)return e.next(),t.lhs=!1,null;else if(!t.lhs&&e.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return`atom`;else if(!t.lhs&&(e.match(`true`)||e.match(`false`)))return`atom`;else if(!t.lhs&&e.peek()===`[`)return t.inArray++,e.next(),`bracket`;else if(!t.lhs&&e.match(/^\-?\d+(?:\.\d+)?/))return`number`;else e.eatSpace()||e.next();return null},languageData:{commentTokens:{line:`#`}}},Xy=$t({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Zy=ie({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Qy(e){switch(e.toLowerCase()){case`json`:return Qs().language;case`toml`:return Js.define(Yy);default:return null}}function $y(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({id:`PauP7d`,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 eb(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}=ar(),l=$y(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=Qy(i),t=c===`dark`?Xy:Zy,n=[nc,...e?[e]:[],Ws.editable.of(!0),Ps.readOnly.of(!0),Ws.lineWrapping,t],r=new Ws({state:Ps.create({doc:u,extensions:n}),parent:a.current});return o.current=r,()=>{r.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 tb(e){return Zn(`/api/asset?path=${encodeURIComponent(e)}`)}function nb(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function rb(e){let t=(0,$.c)(28),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=tb(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;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=u.includes(`.`)?u.split(`.`).pop()??``:``;if(f=e.length>0?e.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[12]!==u||t[13]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(nt,{src:c,title:u,fillContainer:!0})}),t[12]=u,t[13]=c,t[14]=e):e=t[14];let n;t[15]!==u||t[16]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[15]=u,t[16]=e,t[17]=n):n=t[17],p=n;break bb0}if(d===`text`){let r;t[18]===n?r=t[19]:(r=nb(n),t[18]=n,t[19]=r),p=(0,Z.jsx)(eb,{src:r,fileName:u,extension:e.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}else d=t[9],f=t[10],p=t[11];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[20]!==d||t[21]!==f||t[22]!==u||t[23]!==c?(m=(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)(St,{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-3 text-center`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-md border bg-muted font-medium text-muted-foreground text-sm`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:u}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(Xi,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Z.jsx)(`a`,{href:c,children:(0,Z.jsx)(s,{id:`9npOH9`})})}),(0,Z.jsx)(Xi,{variant:`outline`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,children:(0,Z.jsx)(s,{id:`Ruuu3v`})})]})]})}),t[20]=d,t[21]=f,t[22]=u,t[23]=c,t[24]=m):m=t[24];let h;return t[25]!==u||t[26]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:m}),t[25]=u,t[26]=m,t[27]=h):h=t[27],h}function ib(){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)(wo,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(wo,{className:`h-4 w-full`}),(0,Z.jsx)(wo,{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}var ab={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function ob(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}=ar(),s=ab[r],c=s?(o===`dark`?Qr[s]:void 0)??Nn[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=Ui(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)(ta,{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)(ea,{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)(sa,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function sb(e){let{installState:t}=e;return t.installed===null?Y._({id:`IA6JW2`}):t.installed===!1?Y._({id:`5SwVv1`}):null}function cb(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:Y._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:Y._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl},...t.hasWebFallback?{webFallback:{label:Y._({id:`0S9PW_`}),url:``}}:{}}}}return{enabled:!0,tooltip:null}}function lb(e){return Rn(e)}function ub(e){return Y._({id:`h_HYHD`,values:{displayName:e}})}var db=`claude.ai`;async function fb(e,t=bh){(await t(Rn(e))).ok?X.success(ub(db)):X.error(Y._({id:`9NC_MT`,values:{CLAUDE_WEB_FALLBACK_LABEL:db}}))}function pb(e){let t=(0,$.c)(68),{_:n}=i(),{target:r,installState:a,isElectronHost:o,prompt:s,onSelect:c}=e,l=e.openExternal??bh,u=e.onWebFallbackSuccess??hb,d=e.onWebFallbackError??mb,{displayName:f}=r,p,m,h,g,_,v,y,b,x,S;if(t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==c||t[4]!==d||t[5]!==u||t[6]!==l||t[7]!==s||t[8]!==r||t[9]!==f){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=cb({target:r,installState:a,isElectronHost:o}),i=sb({target:r,installState:a,isElectronHost:o}),C=()=>{e.tooltip&&l(e.tooltip.installAction.url)},w;t[20]!==d||t[21]!==u||t[22]!==l||t[23]!==s||t[24]!==r?(w=()=>{(async()=>{let e=await l(lb(s));e.ok?u(r):d(r,e.detail??e.reason)})()},t[20]=d,t[21]=u,t[22]=l,t[23]=s,t[24]=r,t[25]=w):w=t[25];let T=w;if(e.enabled){let e=`open-in-agent-item-${r.id}`,i;t[26]!==n||t[27]!==f?(i=n({id:`NnQapF`,values:{targetDisplayName:f}}),t[26]=n,t[27]=f,t[28]=i):i=t[28];let a;t[29]===r.id?a=t[30]:(a=(0,Z.jsx)(ob,{id:r.id,"aria-hidden":`true`}),t[29]=r.id,t[30]=a);let o;t[31]===r.displayName?o=t[32]:(o=(0,Z.jsx)(`span`,{children:r.displayName}),t[31]=r.displayName,t[32]=o);let s;t[33]!==c||t[34]!==i||t[35]!==a||t[36]!==o||t[37]!==e?(s=(0,Z.jsxs)(Ko,{onSelect:c,"data-testid":e,"aria-label":i,children:[a,o]}),t[33]=c,t[34]=i,t[35]=a,t[36]=o,t[37]=e,t[38]=s):s=t[38],S=s;break bb0}if(!e.tooltip){let e=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),a;t[39]===r.id?a=t[40]:(a=(0,Z.jsx)(ob,{id:r.id,"aria-hidden":`true`}),t[39]=r.id,t[40]=a);let o;t[41]===r.displayName?o=t[42]:(o=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[41]=r.displayName,t[42]=o),S=(0,Z.jsxs)(Ko,{disabled:!0,"data-testid":`open-in-agent-item-${r.id}`,"aria-label":e,children:[a,o,i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null]});break bb0}let E=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),D=e.tooltip.webFallback?.label??``;m=So;let O=`open-in-agent-item-${r.id}`,k;t[43]===r.id?k=t[44]:(k=(0,Z.jsx)(ob,{id:r.id,"aria-hidden":`true`,className:`mr-2`}),t[43]=r.id,t[44]=k);let A;t[45]===r.displayName?A=t[46]:(A=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[45]=r.displayName,t[46]=A);let j;t[47]===i?j=t[48]:(j=i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null,t[47]=i,t[48]=j),t[49]!==E||t[50]!==k||t[51]!==A||t[52]!==j||t[53]!==O?(x=(0,Z.jsxs)(Po,{"data-testid":O,"data-row-disabled":``,"aria-label":E,children:[k,A,j]}),t[49]=E,t[50]=k,t[51]=A,t[52]=j,t[53]=O,t[54]=x):x=t[54],p=fo,h=`min-w-[260px]`,g=`open-in-agent-submenu-${r.id}`,_=(0,Z.jsx)(jo,{className:`font-normal text-muted-foreground text-xs`,"data-testid":`open-in-agent-message-${r.id}`,children:e.tooltip.message}),t[55]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Vo,{}),t[55]=v):v=t[55],y=(0,Z.jsx)(Ko,{onSelect:C,"data-testid":`open-in-agent-install-${r.id}`,children:(0,Z.jsx)(`span`,{children:e.tooltip.installAction.label})}),b=e.tooltip.webFallback?(0,Z.jsxs)(Ko,{onSelect:T,"data-testid":`open-in-agent-web-fallback-${r.id}`,"aria-label":n({id:`lsOFZR`,values:{webFallbackLabel:D}}),children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:e.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:n({id:`Z9BoIy`})})]}):null}t[0]=n,t[1]=a,t[2]=o,t[3]=c,t[4]=d,t[5]=u,t[6]=l,t[7]=s,t[8]=r,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S}else p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18],S=t[19];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[56]!==p||t[57]!==h||t[58]!==g||t[59]!==_||t[60]!==v||t[61]!==y||t[62]!==b?(C=(0,Z.jsxs)(p,{className:h,"data-testid":g,children:[_,v,y,b]}),t[56]=p,t[57]=h,t[58]=g,t[59]=_,t[60]=v,t[61]=y,t[62]=b,t[63]=C):C=t[63];let w;return t[64]!==m||t[65]!==x||t[66]!==C?(w=(0,Z.jsxs)(m,{children:[x,C]}),t[64]=m,t[65]=x,t[66]=C,t[67]=w):w=t[67],w}function mb(){}function hb(){}function gb(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=Xh(),{dispatch:a}=zh(),o=ko(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=Eh({workspace:o});t[7]===n?s=t[8]:(s=Ui(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=qm.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(_b,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{kh(t),i()}},t.id)}),t[0]=n,t[1]=a,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=c}else s=t[5],c=t[6];let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`div`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function _b(e){let t=(0,$.c)(22),{target:n,status:r,onOpen:i,onInstall:a}=e,o=r===`installed`?i:r===`missing`?a:void 0,s=r===`pending`||r===`installed`&&i===void 0,c=r===`installed`?`Open`:r===`missing`?`Install`:`Checking`,l;t[0]===n.id?l=t[1]:(l=(0,Z.jsx)(ob,{id:n.id,"aria-hidden":`true`,className:`size-4`}),t[0]=n.id,t[1]=l);let u;t[2]===n.displayName?u=t[3]:(u=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.displayName}),t[2]=n.displayName,t[3]=u);let d;t[4]!==l||t[5]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[l,u]}),t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===n.tagline?f=t[8]:(f=n.tagline?(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.tagline}):null,t[7]=n.tagline,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===r?m=t[13]:(m=r===`missing`?(0,Z.jsx)(rs,{"aria-hidden":`true`,className:`size-3`}):null,t[12]=r,t[13]=m);let h;t[14]!==c||t[15]!==m?(h=(0,Z.jsxs)(`p`,{className:`mt-auto inline-flex items-center gap-1 pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==s||t[18]!==o||t[19]!==p||t[20]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:cursor-not-allowed disabled:opacity-60`,children:[p,h]}),t[17]=s,t[18]=o,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}var vb=3100,yb=3;function bb(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??yb;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var xb={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}},Sb=[`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 Cb(e,t={}){let n=t.rng??Math.random,r=t.colors??Sb,i=xb[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 wb=1.8,Tb=90,Eb=16,Db=380,Ob=.025,kb=.1,Ab=.18,jb=400,Mb=9.2736,Nb=18.1799,Pb=14.5244,Fb={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Ib(e,t){let{halfWidth:n,apexLift:r}=Fb[t];return`M${e-n} ${Pb+.3} Q${e} ${Pb-r}, ${e+n} ${Pb+.3}`}function Lb(e){let t=1.5,n=.3;return`M${e-t} ${Pb-n} Q${e} ${Pb+1.4}, ${e+t} ${Pb-n}`}var Rb=15,zb=15;function Bb(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 Vb(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=bb(g,t);_(n),y(Gb),S(Cb(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},vb)},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(Wb),S(Cb(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},vb))},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/Db)),C=Math.max(-1,Math.min(1,b/Db)),w=S*Eb,T=-C*Eb,E=0,D=0;if(x>=1){let e=Math.min(x/Tb,1)*wb;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)*kb,i+=(w-i)*kb,u.style.transform=`perspective(${jb}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*Ab,o+=(D-o)*Ab;let k=i*Ob,A=-r*Ob,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=Ui(`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=Ui(`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=Ui(`ok-blob-eye`,W),t[22]=W,t[23]=G);let ee;t[24]===G?ee=t[25]:(ee=(0,Z.jsx)(`ellipse`,{cx:Mb,cy:Pb,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=ee);let te=(F||T)&&`ok-blob-eye-hidden`,K;t[26]===te?K=t[27]:(K=Ui(`ok-blob-eye ok-blob-eye-right`,te),t[26]=te,t[27]=K);let q;t[28]===K?q=t[29]:(q=(0,Z.jsx)(`ellipse`,{cx:Nb,cy:Pb,rx:1.2722,ry:1.9083,className:K}),t[28]=K,t[29]=q);let ne;t[30]===I?ne=t[31]:(ne=Ib(Mb,I),t[30]=I,t[31]=ne);let re=(!F||T)&&`ok-blob-eye-hidden`,ie;t[32]===re?ie=t[33]:(ie=Ui(`ok-blob-happy-eye`,re),t[32]=re,t[33]=ie);let ae;t[34]!==ne||t[35]!==ie?(ae=(0,Z.jsx)(`path`,{d:ne,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ie}),t[34]=ne,t[35]=ie,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=Ib(Nb,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=Ui(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:Lb(Mb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:Lb(Nb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==ee||t[47]!==q||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[ee,q,ae,le,ue]}),t[46]=ee,t[47]=q,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(Hb)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:Ub,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function Hb(e){return(0,Z.jsx)(`circle`,{cx:Rb+e.originDx,cy:zb+e.originDy,r:e.size,className:`ok-blob-firework`,style:Bb(e)},e.id)}function Ub(e){return e.preventDefault()}function Wb(e){return e+1}function Gb(e){return e+1}function Kb(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(Vb,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function qb(){let e=(0,$.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=Zo(`command-palette`),e[0]=t):t=e[0];let n=t,r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(D,{children:n}),e[1]=r):r=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`p`,{className:`text-1sm text-muted-foreground`,children:[r,` `,(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A1taO8`})})]}),e[2]=i):i=e[2],i}var Jb=`open-knowledge:create-top-level-file`;function Yb(){window.dispatchEvent(new CustomEvent(Jb))}function Xb(e){let t=()=>e();return window.addEventListener(Jb,t),()=>window.removeEventListener(Jb,t)}function Zb(){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(tx);if(e)return;let r=t.ok?Vn.safeParse(n):null;r?.success?(o(nx(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=Ln(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(ex),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch($b);if(!e.ok)return;let n=Vn.safeParse(t);n.success&&o(nx(n.data.documents))}).catch(Qb)},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)(rx,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(ix,{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)(zm,{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 Qb(){}function $b(){return null}function ex(e){return e+1}function tx(){return null}function nx(e){return fr(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function rx(e){let t=(0,$.c)(16),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o;t[0]===a?o=t[1]:(o=a({id:`ZmGmNh`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`W8uemY`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(Kb,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===r?u=t[9]:(u=(0,Z.jsx)(Mm,{onPackSelect:r}),t[8]=r,t[9]=u);let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Xi,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:Yb,children:(0,Z.jsx)(s,{id:`ensWZc`,components:{0:(0,Z.jsx)(ho,{"aria-hidden":`true`,className:`size-3`})}})}),t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[u,d]}),t[11]=u,t[12]=f);let p;return t[13]!==l||t[14]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,f]}),t[13]=l,t[14]=f,t[15]=p):p=t[15],p}function ix(e){let t=(0,$.c)(19),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i();if(Wm())return null;let o;t[0]===a?o=t[1]:(o=a({id:`8XS8nG`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`GjElCU`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(Kb,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(gb,{}),t[8]=u):u=t[8];let d,f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`size-3`}),f=(0,Z.jsx)(s,{id:`IajAbS`}),t[9]=d,t[10]=f):(d=t[9],f=t[10]);let p;t[11]===r?p=t[12]:(p=(0,Z.jsxs)(Xi,{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:[d,f]}),t[11]=r,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(qb,{}),t[13]=m):m=t[13];let h;t[14]===p?h=t[15]:(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[u,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[p,m]})]}),t[14]=p,t[15]=h);let g;return t[16]!==l||t[17]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,h]}),t[16]=l,t[17]=h,t[18]=g):g=t[18],g}function ax(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function ox(e){let t=(0,$.c)(83),{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)(lx,{}),(0,Z.jsx)(wo,{className:`h-7 w-full`}),(0,Z.jsx)(wo,{className:`h-7 w-full`}),(0,Z.jsx)(wo,{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.folder.frontmatter_defaults?m=t[4]:(m=r.data.folder.frontmatter_defaults??{},t[3]=r.data.folder.frontmatter_defaults,t[4]=m);let h=m,g;t[5]===r.data.frontmatterLocal?g=t[6]:(g=r.data.frontmatterLocal??{},t[5]=r.data.frontmatterLocal,t[6]=g);let _=g,v=r.data.frontmatterSources,y;t[7]===r.data.folder.path?y=t[8]:(y=ax(r.data.folder.path),t[7]=r.data.folder.path,t[8]=y);let b=y,x,S,C,w,T,E,D,O,k,A,j,M,N,P;if(t[9]!==o||t[10]!==u||t[11]!==c||t[12]!==b||t[13]!==n||t[14]!==_||t[15]!==h||t[16]!==a||t[17]!==f||t[18]!==v||t[19]!==r.data.schemaDeclarations||t[20]!==r.data.schemaLocal||t[21]!==r.data.schemaSources){let e=Object.keys(h),i=r.data.schemaDeclarations,m=r.data.schemaLocal??{},g=r.data.schemaSources,y=Object.keys(i).filter(e=>!Object.hasOwn(h,e)),F=async function(e,t){let r=await ha(n,{[e]:t});if(!r.ok){let{error:e}=r;X.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},I=async function(e){let t=await ha(n,{[e]:null});if(!t.ok){let{error:e}=t;X.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},L=function(e,t){let n=h[e];F(e,Fa(n,t))},R;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){d({name:``,type:`text`,value:``,error:null,mode:e===void 0?`value`:e}),l(!1)},t[36]=R):R=t[36],C=R;let z;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):ka[e];return{...t,type:e,value:n,error:null}})},t[37]=z):z=t[37],T=z;let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){d(t=>t&&{...t,value:e})},t[38]=B):B=t[38],E=B;let V;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e){d(t=>t&&{...t,name:e,error:null})},t[39]=V):V=t[39],w=V;let H;t[40]!==o||t[41]!==u||t[42]!==i||t[43]!==n||t[44]!==h||t[45]!==a?(H=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(u.mode===`declaration`){if(Object.hasOwn(i,e)){d({...u,error:o({id:`7-KLnW`,values:{trimmed:e}})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`mcWHC0`,values:{trimmed:e}})});return}let t=await Co(n,{[e]:{type:u.type}});if(!t.ok){d({...u,error:t.error});return}d(null),a();return}if(zi(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 ha(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[40]=o,t[41]=u,t[42]=i,t[43]=n,t[44]=h,t[45]=a,t[46]=H):H=t[46],D=H;let U=async function(e){let t=await Co(n,{[e]:null});if(!t.ok){X.error(t.error);return}a()},W=function(e){p({key:e,draft:e,error:null})},G=function(e){p(t=>t&&{...t,draft:e,error:null})},ee=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}if(Object.hasOwn(i,e)){p({...f,error:o({id:`3IKxHW`,values:{trimmed:e}})});return}let t=h[f.key],r=await ha(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},te=function(){p(null)};O=`rounded-lg border bg-card`,S=xs,M=!c,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>l(!e),t[47]=N):N=t[47];let K=`size-3 transition-transform ${c?``:`rotate-90`}`,q;t[48]===K?q=t[49]:(q=(0,Z.jsx)(_s,{className:K,"aria-hidden":!0}),t[48]=K,t[49]=q);let ne;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[50]=ne):ne=t[50];let re;t[51]===q?re=t[52]:(re=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[q,ne]}),t[51]=q,t[52]=re);let ie;t[53]===b?ie=t[54]:(ie=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:cx,children:b}),t[53]=b,t[54]=ie),t[55]!==re||t[56]!==ie?(P=(0,Z.jsxs)(bs,{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:[re,ie]}),t[55]=re,t[56]=ie,t[57]=P):P=t[57],x=ys,k=`px-2 py-2`,t[58]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DnYq8I`})}),t[58]=A):A=t[58],j=e.length===0&&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`})}):(0,Z.jsxs)(Z.Fragment,{children:[e.map(e=>{let t=h[e],n=Object.hasOwn(_,e);return(0,Z.jsx)(Ua,{keyName:e,value:t,declared:qa(t,ri(t)),rename:n?{state:f?.key===e?f:null,onBegin:()=>W(e),onChangeDraft:G,onCommit:ee,onCancel:te}:void 0,badge:n?null:(0,Z.jsx)(Ca,{source:v[e]??``}),isInherited:!n,onCommit:t=>void F(e,t),onChangeType:t=>L(e,t),onRemove:n?()=>void I(e):void 0},e)}),y.length>0&&e.length>0?(0,Z.jsx)(`div`,{className:`my-1 border-t border-dashed border-border`,"aria-hidden":!0}):null,y.map(e=>{let t=i[e],r=Object.hasOwn(m,e),o=t.type;return(0,Z.jsx)(Ua,{keyName:e,value:``,declared:o,badge:(0,Z.jsx)(za,{source:g[e]??``,inlineSource:!r,icon:(0,Z.jsx)(ca,{className:`size-2.5`,"aria-hidden":!0})}),isInherited:!r,valueHint:(0,Z.jsx)(`div`,{className:`flex h-7 items-center px-2 text-xs italic text-muted-foreground`,children:(0,Z.jsx)(s,{id:`E62FLF`})}),onCommit:sx,onChangeType:t=>{r&&Co(n,{[e]:{type:t}}).then(e=>{e.ok?a():X.error(e.error)})},onRemove:r?()=>void U(e):void 0},`__decl__${e}`)})]}),t[9]=o,t[10]=u,t[11]=c,t[12]=b,t[13]=n,t[14]=_,t[15]=h,t[16]=a,t[17]=f,t[18]=v,t[19]=r.data.schemaDeclarations,t[20]=r.data.schemaLocal,t[21]=r.data.schemaSources,t[22]=x,t[23]=S,t[24]=C,t[25]=w,t[26]=T,t[27]=E,t[28]=D,t[29]=O,t[30]=k,t[31]=A,t[32]=j,t[33]=M,t[34]=N,t[35]=P}else x=t[22],S=t[23],C=t[24],w=t[25],T=t[26],E=t[27],D=t[28],O=t[29],k=t[30],A=t[31],j=t[32],M=t[33],N=t[34],P=t[35];let F;t[59]!==u||t[60]!==C||t[61]!==w||t[62]!==T||t[63]!==E||t[64]!==D?(F=u?(0,Z.jsx)(La,{draft:u,onChangeName:w,onChangeType:T,onChangeValue:E,onCommit:()=>void D(),onCancel:()=>d(null)}):(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:[(0,Z.jsxs)(Xi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>C(`value`),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)(fe,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`7IcK2R`})})]}),(0,Z.jsxs)(Xi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`declare-field-trigger`,onClick:()=>C(`declaration`),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)(ca,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`dZHyu7`})})]})]}),t[59]=u,t[60]=C,t[61]=w,t[62]=T,t[63]=E,t[64]=D,t[65]=F):F=t[65];let I;t[66]!==F||t[67]!==k||t[68]!==A||t[69]!==j?(I=(0,Z.jsxs)(`div`,{className:k,children:[A,j,F]}),t[66]=F,t[67]=k,t[68]=A,t[69]=j,t[70]=I):I=t[70];let L;t[71]!==x||t[72]!==I?(L=(0,Z.jsx)(x,{children:I}),t[71]=x,t[72]=I,t[73]=L):L=t[73];let R;t[74]!==S||t[75]!==L||t[76]!==M||t[77]!==N||t[78]!==P?(R=(0,Z.jsxs)(S,{open:M,onOpenChange:N,children:[P,L]}),t[74]=S,t[75]=L,t[76]=M,t[77]=N,t[78]=P,t[79]=R):R=t[79];let z;return t[80]!==O||t[81]!==R?(z=(0,Z.jsx)(`section`,{className:O,children:R}),t[80]=O,t[81]=R,t[82]=z):z=t[82],z}function sx(){}function cx(e){return e.stopPropagation()}function lx(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Vc,{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 ux(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function dx(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=ux(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function fx(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function px(e,t){let n=`${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:dx(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:fx(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:dx(e,t.pageTitles),children:a}}function mx(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)(wo,{className:`h-12 w-full`}),(0,Z.jsx)(wo,{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)(te,{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)(Xi,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(fe,{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)(Xa,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Ca,{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)(xa,{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)(ba,{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(hx)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(To,{folderPath:n,existingNames:D,open:p,onOpenChange:m,onCreated:i}),t[27]=n,t[28]=p,t[29]=i,t[30]=D,t[31]=O):O=t[31];let k=d!==null,A;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||f(null)},t[32]=A):A=t[32];let j=d??void 0,M;t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j?(M=(0,Z.jsx)(hm,{open:k,onOpenChange:A,kind:`file`,initialDir:n,initialTemplate:j,folderConfig:a}),t[33]=a,t[34]=n,t[35]=k,t[36]=j,t[37]=M):M=t[37];let N;return t[38]!==E||t[39]!==O||t[40]!==M||t[41]!==S||t[42]!==w?(N=(0,Z.jsxs)(Z.Fragment,{children:[S,w,E,O,M]}),t[38]=E,t[39]=O,t[40]=M,t[41]=S,t[42]=w,t[43]=N):N=t[43],N}function hx(e){return e.name}function gx(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=Ui(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Ui(`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 _x(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=Ui(`[&_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 vx(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=Ui(`[&_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 yx(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=Ui(`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 bx(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=Ui(`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 xx(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=Ui(`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 Sx(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Y._({id:`xOTzt5`});if(r<60)return Y._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Y._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Y._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Cx(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 wx(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)(Pe,{className:`ml-1 size-3`}):(0,Z.jsx)(Jt,{className:`ml-1 size-3`}):(0,Z.jsx)(yc,{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)(Xi,{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 Tx(e){let t=(0,$.c)(92),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=ji(),d=ga(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)(wo,{className:`size-5 rounded`}),(0,Z.jsx)(wo,{className:`h-7 w-48`})]}),(0,Z.jsx)(wo,{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)(wo,{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)(wo,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Ox)]})]}),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;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=px(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=Cx(e.children,g,v),o;t[28]===g?o=t[29]:(o=function(e){e===g?y(Dx):(_(e),y(`asc`))},t[28]=g,t[29]=o);let m=o;k=`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 A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(je,{className:`size-5 text-muted-foreground`}),t[30]=A):A=t[30];let j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:e.title})]}),M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(Xi,{onClick:()=>h(!0),children:[(0,Z.jsx)(fe,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[31]=M):M=t[31],t[32]===j?E=t[33]:(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:[j,M]})}),t[32]=j,t[33]=E),t[34]!==f||t[35]!==n||t[36]!==p?(D=(0,Z.jsx)(ox,{folderPath:n,state:f,onChange:p}),t[34]=f,t[35]=n,t[36]=p,t[37]=D):D=t[37],t[38]!==f||t[39]!==d||t[40]!==n||t[41]!==p?(O=(0,Z.jsx)(mx,{folderPath:n,state:f,onChange:p,folderConfigHandle:d}),t[38]=f,t[39]=d,t[40]=n,t[41]=p,t[42]=O):O=t[42],w=`rounded-lg border`,x=gx;let N=g===`name`?v===`asc`?`ascending`:`descending`:`none`,P;t[43]===r?P=t[44]:(P=r({id:`6YtxFj`}),t[43]=r,t[44]=P);let F;t[45]!==m||t[46]!==v||t[47]!==g||t[48]!==P?(F=(0,Z.jsx)(wx,{label:P,sortKey:`name`,activeKey:g,activeDir:v,onSort:m}),t[45]=m,t[46]=v,t[47]=g,t[48]=P,t[49]=F):F=t[49];let I;t[50]!==N||t[51]!==F?(I=(0,Z.jsx)(bx,{"aria-sort":N,children:F}),t[50]=N,t[51]=F,t[52]=I):I=t[52];let L=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,R;t[53]===r?R=t[54]:(R=r({id:`tgWuMB`}),t[53]=r,t[54]=R);let z;t[55]!==m||t[56]!==v||t[57]!==g||t[58]!==R?(z=(0,Z.jsx)(wx,{label:R,sortKey:`modified`,activeKey:g,activeDir:v,onSort:m}),t[55]=m,t[56]=v,t[57]=g,t[58]=R,t[59]=z):z=t[59];let B;t[60]!==L||t[61]!==z?(B=(0,Z.jsx)(bx,{className:`w-32`,"aria-sort":L,children:z}),t[60]=L,t[61]=z,t[62]=B):B=t[62],t[63]!==I||t[64]!==B?(C=(0,Z.jsx)(_x,{children:(0,Z.jsxs)(yx,{children:[I,B]})}),t[63]=I,t[64]=B,t[65]=C):C=t[65],b=vx,S=i.length?i.map(Ex):(0,Z.jsx)(yx,{children:(0,Z.jsx)(xx,{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}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];let A;t[66]!==b||t[67]!==S?(A=(0,Z.jsx)(b,{children:S}),t[66]=b,t[67]=S,t[68]=A):A=t[68];let j;t[69]!==x||t[70]!==C||t[71]!==A?(j=(0,Z.jsxs)(x,{children:[C,A]}),t[69]=x,t[70]=C,t[71]=A,t[72]=j):j=t[72];let M;t[73]!==j||t[74]!==w?(M=(0,Z.jsx)(`div`,{className:w,children:j}),t[73]=j,t[74]=w,t[75]=M):M=t[75];let N;t[76]!==M||t[77]!==T||t[78]!==E||t[79]!==D||t[80]!==O?(N=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,M]}),t[76]=M,t[77]=T,t[78]=E,t[79]=D,t[80]=O,t[81]=N):N=t[81];let P;t[82]!==N||t[83]!==k?(P=(0,Z.jsx)(`div`,{className:k,children:N}),t[82]=N,t[83]=k,t[84]=P):P=t[84];let F;t[85]!==m||t[86]!==d||t[87]!==n?(F=(0,Z.jsx)(hm,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[85]=m,t[86]=d,t[87]=n,t[88]=F):F=t[88];let I;return t[89]!==P||t[90]!==F?(I=(0,Z.jsxs)(Z.Fragment,{children:[P,F]}),t[89]=P,t[90]=F,t[91]=I):I=t[91],I}function Ex(e){return(0,Z.jsxs)(yx,{children:[(0,Z.jsx)(xx,{children:(0,Z.jsxs)(`a`,{href:ki(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)(Uc,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(xt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(xx,{className:`text-muted-foreground`,children:e.kind===`file`?Sx(e.modified):`—`})]},e.path)}function Dx(e){return e===`asc`?`desc`:`asc`}function Ox(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)(wo,{className:`size-4 rounded`}),(0,Z.jsx)(wo,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(wo,{className:`h-4 w-16`})})]},e)}function kx(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)(Lc,{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=Lr(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Lr(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)(Xi,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(aa,{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 Ax(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(jx),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>w(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(){V(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)(Xi,{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 jx(){return new Set}var Mx=(0,Q.createContext)(null);function Nx(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(Px),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)(Mx,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function Px(){return new Map}function Fx(){let e=(0,Q.use)(Mx);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function Ix(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var Lx=Ix(()=>n(()=>import(`./SettingsDialogBody-Y7msJVE9.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([44,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,45,8,16,11,13,23]),import.meta.url));function Rx(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)(Xi,{variant:`default`,onClick:zx,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 zx(){return window.location.reload()}function Bx(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(W,{fallbackRender:Hx,onError:Vx,children:n}),t[0]=n,t[1]=r),r}function Vx(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function Hx(e){return(0,Z.jsx)(Rx,{...e})}function Ux(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function Wx(e){let t=(0,$.c)(81),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=ht(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=vt(),{desktopPresent:f}=Xo(),[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;t[3]===a?v=t[4]:(v=a({id:`7PzzBU`}),t[3]=a,t[4]=v);let y;t[5]===a?y=t[6]:(y=a({id:`Q6hhn8`}),t[5]=a,t[6]=y);let b;t[7]===y?b=t[8]:(b={id:`preferences`,label:y},t[7]=y,t[8]=b);let x;t[9]===a?x=t[10]:(x=a({id:`4KmEoC`}),t[9]=a,t[10]=x);let S;t[11]===x?S=t[12]:(S={id:`hotkeys`,label:x},t[11]=x,t[12]=S);let C;t[13]===a?C=t[14]:(C=a({id:`AeXO77`}),t[13]=a,t[14]=C);let w;t[15]===C?w=t[16]:(w={id:`account`,label:C},t[15]=C,t[16]=w);let T;t[17]!==b||t[18]!==S||t[19]!==w?(T=[b,S,w],t[17]=b,t[18]=S,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==T||t[22]!==v?(E={id:`user`,label:v,enabled:!0,items:T},t[21]=T,t[22]=v,t[23]=E):E=t[23];let D;t[24]===a?D=t[25]:(D=a({id:`ZWyHmq`}),t[24]=a,t[25]=D);let O;t[26]===a?O=t[27]:(O=a({id:`Nu4DdT`}),t[26]=a,t[27]=O);let k;t[28]===O?k=t[29]:(k={id:`sync`,label:O},t[28]=O,t[29]=k);let A;t[30]===a?A=t[31]:(A=a({id:`iTylMl`}),t[30]=a,t[31]=A);let j;t[32]===A?j=t[33]:(j={id:`project-templates`,label:A},t[32]=A,t[33]=j);let M;t[34]===a?M=t[35]:(M=a({id:`3zyg_A`}),t[34]=a,t[35]=M);let N;t[36]===M?N=t[37]:(N={id:`okignore`,label:M},t[36]=M,t[37]=N);let P;t[38]===a?P=t[39]:(P=a({id:`cs4mps`}),t[38]=a,t[39]=P);let F;t[40]===P?F=t[41]:(F={id:`sharing`,label:P},t[40]=P,t[41]=F);let I;t[42]!==k||t[43]!==j||t[44]!==N||t[45]!==F?(I=[k,j,N,F],t[42]=k,t[43]=j,t[44]=N,t[45]=F,t[46]=I):I=t[46];let L;t[47]!==_||t[48]!==D||t[49]!==I?(L={id:`project`,label:D,enabled:_,items:I},t[47]=_,t[48]=D,t[49]=I,t[50]=L):L=t[50];let R;t[51]===a?R=t[52]:(R=a({id:`nbfdhU`}),t[51]=a,t[52]=R);let z;t[53]!==a||t[54]!==f?(z=[],t[53]=a,t[54]=f,t[55]=z):z=t[55];let B;t[56]!==R||t[57]!==z?(B={id:`integrations`,label:R,enabled:!0,items:z},t[56]=R,t[57]=z,t[58]=B):B=t[58];let V;t[59]!==E||t[60]!==L||t[61]!==B?(V=[E,L,B],t[59]=E,t[60]=L,t[61]=B,t[62]=V):V=t[62];let H=V,U;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(ls,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[63]=U):U=t[63];let W;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(ss,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[64]=W):W=t[64];let G;t[65]!==p||t[66]!==H?(G=(0,Z.jsx)(Gx,{groups:H,activeId:p,onSelect:m}),t[65]=p,t[66]=H,t[67]=G):G=t[67];let ee;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Jx,{}),t[68]=ee):ee=t[68];let te=l?c:null,K;t[69]!==p||t[70]!==u||t[71]!==d||t[72]!==te?(K=(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)(Bx,{children:(0,Z.jsx)(Q.Suspense,{fallback:ee,children:(0,Z.jsx)(Lx,{activeId:p,userBinding:te,okignoreBinding:u,okignoreSynced:d})})})}),t[69]=p,t[70]=u,t[71]=d,t[72]=te,t[73]=K):K=t[73];let q;t[74]!==G||t[75]!==K?(q=(0,Z.jsxs)(us,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[U,W,G,K]}),t[74]=G,t[75]=K,t[76]=q):q=t[76];let ne;return t[77]!==r||t[78]!==n||t[79]!==q?(ne=(0,Z.jsx)(ms,{open:n,onOpenChange:r,children:q}),t[77]=r,t[78]=n,t[79]=q,t[80]=ne):ne=t[80],ne}function Gx(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)(qx,{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)(Kx,{}),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 Kx(){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=Ux(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:Ui(`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)(rs,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function qx(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=Ui(`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:Ui(`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 Jx(){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)(wo,{className:`h-5 w-32`}),r=(0,Z.jsx)(wo,{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)(wo,{className:`h-9 w-full`}),(0,Z.jsx)(wo,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function Yx(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=Ui(`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)(Vy,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Xx(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)(Wy,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function Zx(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=Ui(`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)(Jy,{"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 Qx(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=Ui(`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 $x=Qi(`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 eS(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=Ui($x({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:tS,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function tS(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Qi(`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 nS(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=Ui(`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 rS(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=Ui(`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)(vs,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function iS(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)(rS,{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)(Tc,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(as,{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)(gr,{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)(dr,{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)(jl,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(as,{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)(gr,{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)(dr,{children:[U,W]}),t[44]=U,t[45]=G);let ee;t[46]!==B||t[47]!==G?(ee=(0,Z.jsxs)(eS,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=ee):ee=t[48];let te;t[49]!==ee||t[50]!==F?(te=(0,Z.jsxs)(Qx,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,ee]}),t[49]=ee,t[50]=F,t[51]=te):te=t[51];let K;t[52]===E?K=t[53]:(K=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:E}),t[52]=E,t[53]=K);let q;t[54]===S?q=t[55]:(q=S({id:`oqB2ez`}),t[54]=S,t[55]=q);let ne=!w,re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(J,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=re):re=t[56];let ie;t[57]!==v||t[58]!==q||t[59]!==ne?(ie=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":q,disabled:ne,onClick:v,children:re})}),t[57]=v,t[58]=q,t[59]=ne,t[60]=ie):ie=t[60];let ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(gr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=ae):ae=t[61];let oe;t[62]===ie?oe=t[63]:(oe=(0,Z.jsxs)(dr,{children:[ie,ae]}),t[62]=ie,t[63]=oe);let se;t[64]===S?se=t[65]:(se=S({id:`SiUUCS`}),t[64]=S,t[65]=se);let ce=!w,le;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(De,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=le):le=t[66];let ue;t[67]!==_||t[68]!==se||t[69]!==ce?(ue=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":se,disabled:ce,onClick:_,children:le})}),t[67]=_,t[68]=se,t[69]=ce,t[70]=ue):ue=t[70];let de;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(gr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=de):de=t[71];let fe;t[72]===ue?fe=t[73]:(fe=(0,Z.jsxs)(dr,{children:[ue,de]}),t[72]=ue,t[73]=fe);let pe=o?`secondary`:`ghost`,me;t[74]!==S||t[75]!==o?(me=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=me):me=t[76];let he=o?`ok-replace-input`:void 0,ge;t[77]!==m||t[78]!==o?(ge=()=>m(!o),t[77]=m,t[78]=o,t[79]=ge):ge=t[79];let _e;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(pl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=_e):_e=t[80];let ve;t[81]!==o||t[82]!==pe||t[83]!==me||t[84]!==he||t[85]!==ge?(ve=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,variant:pe,size:`icon-sm`,"aria-label":me,"aria-expanded":o,"aria-controls":he,onClick:ge,children:_e})}),t[81]=o,t[82]=pe,t[83]=me,t[84]=he,t[85]=ge,t[86]=ve):ve=t[86];let ye;t[87]===o?ye=t[88]:(ye=(0,Z.jsx)(gr,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=ye);let be;t[89]!==ve||t[90]!==ye?(be=(0,Z.jsxs)(dr,{children:[ve,ye]}),t[89]=ve,t[90]=ye,t[91]=be):be=t[91];let xe;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(xe=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)(vs,{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)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(pl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(gr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(fl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(gr,{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]=xe):xe=t[100];let Se;t[101]===S?Se=t[102]:(Se=S({id:`wJo9oS`}),t[101]=S,t[102]=Se);let Ce;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(cs,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Ce):Ce=t[103];let we;t[104]!==x||t[105]!==Se?(we=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Se,onClick:x,children:Ce})}),t[104]=x,t[105]=Se,t[106]=we):we=t[106];let Te;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(gr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Te):Te=t[107];let Ee;t[108]===we?Ee=t[109]:(Ee=(0,Z.jsxs)(dr,{children:[we,Te]}),t[108]=we,t[109]=Ee);let Oe;return t[110]!==te||t[111]!==K||t[112]!==oe||t[113]!==fe||t[114]!==j||t[115]!==be||t[116]!==xe||t[117]!==Ee?(Oe=(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,te,K,oe,fe,be,xe,Ee]}),t[110]=te,t[111]=K,t[112]=oe,t[113]=fe,t[114]=j,t[115]=be,t[116]=xe,t[117]=Ee,t[118]=Oe):Oe=t[118],Oe}var aS={current:0,total:0},oS=120,sS=100;function cS(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?tn(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(ge,n,lS)}function lS(){return null}function uS(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
24
  `,`
25
25
  `).trim();return i.length===0||i.length>oS||i.includes(`
26
26
  `)?null:i}function dS(e){let t=mt(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function fS(e,t){return e.current===t.current&&e.total===t.total}function pS(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(aS)}function mS(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=h(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 hS(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=cS(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)(aS),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(_S))},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(gS)},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(aS);return}if(!u.open||r){i.commands.clearFindMatches(),p(aS);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=dS(i);p(t=>fS(t,e)?t:e)},sS);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=mt(i.state),t=dS(i);p(e=>fS(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=uS(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(Eo(t,`find`)){t.preventDefault(),u.open?pS(i,d,p):e(!1);return}if(Eo(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=Eo(t,`find-next`),n=Eo(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&mS(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),pS(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=mt(i.state),t=dS(i);p(e=>fS(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(){pS(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()&&mS(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()&&mS(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)&&mS(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)&&mS(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,ee,te,K;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),ee=e=>d(t=>({...t,replaceOpen:e})),te=e=>d(t=>({...t,caseSensitive:e})),K=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=ee,t[66]=te,t[67]=K):(W=t[63],G=t[64],ee=t[65],te=t[66],K=t[67]);let q;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(q=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(iS,{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:ee,onCaseSensitiveChange:te,onWholeWordChange:K,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=q):q=t[80],q}function gS(e){return{...e,open:!1,activeIndex:0}}function _S(e){return{...e,activeIndex:0}}var vS={words:0,chars:0,tokens:0},yS=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,bS=/[\p{L}\p{N}]/u,xS=new Set([`text`,`inlineCode`,`code`,`tag`]),SS=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),CS=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function wS(e,t){if(!e)return;let n=e.type;if(!SS.has(n)){if(xS.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
@@ -28,7 +28,7 @@ Error generating stack: `+e.message+`
28
28
  `)&&t.push(`
29
29
  `)}}}}function TS(e){try{let t=Me().parseToMdast(e),n=[];return wS(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function ES(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))bS.test(n)&&t++;return t}function DS(e){let t=globalThis.Intl.Segmenter;if(!t)return ES(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function OS(e){let t=yS.test(e)?1.5:4;return Math.ceil(e.length/t)}function kS(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=Fr(e);if(!t.trim())return{words:0,chars:0,tokens:0};let n=TS(t);return n?{words:yS.test(n)?DS(n):ES(n),chars:n.length,tokens:OS(n)}:{words:0,chars:0,tokens:0}}var AS=300;function jS(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(vS),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(vS);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(kS(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,AS)};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 MS(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function NS(e){let t=(0,$.c)(8),{poolEntries:n}=ht(),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=()=>MS(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(MS(i));let t=()=>s(MS(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}var PS=`ok-doc-panel-width-v1`;function FS(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function IS(e){try{let t=(e??localStorage).getItem(PS);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?FS(n):320}catch{return 320}}function LS(e,t){try{(t??localStorage).setItem(PS,String(FS(e)))}catch{}}function RS(){try{return typeof localStorage>`u`?320:IS()}catch{return 320}}var zS=1024,BS=1280,VS={left:zS,right:BS};function HS(e,t,n){return e==null?t>=VS[n]?`above`:`below`:`embedded`}function US(e){return e===`above`?`open`:`collapsed`}var WS=`ok-sidebar-pins-v2`;function GS(e){return e===`open`||e===`collapsed`}function KS(e){return e===`above`||e===`below`||e===`embedded`}function qS(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!KS(e)||!GS(t[e]))return!1;return!0}function JS(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return qS(n.left)&&(r.left=n.left),qS(n.right)&&(r.right=n.right),r}function YS(e){try{let t=(e??localStorage).getItem(WS);return t==null?{}:JS(t)}catch{return{}}}function XS(e,t){try{t.setItem(WS,JSON.stringify(e))}catch{}}function ZS(e,t,n){return n[e]?.[t]??US(t)}function QS(e,t,n,r){let i=r??localStorage,a=YS(i);return a[e]={...a[e],[t]:n},XS(a,i),a}function $S(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`?eC: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 eC(e){return e===`synced`?`synced`:`connected`}var tC=Ur;function nC(e,t={}){let n=At(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var rC=200,iC=`Outside any block`;function aC(e){let t=(0,$.c)(5),{editor:n}=e,r=Ne(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?oC(n,r):o.current?iC:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},rC),()=>{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 oC(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=nC(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=nC(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 sC(){let[e]=(0,Q.useState)(Pn);return e}function cC({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Hr(e.display_name),color:_r(e.id,qn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:_r(e.id,qn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function lC(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 uC=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&&Wr(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(or(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Ir(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Rr(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Qn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Vr(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Dr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ci(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ir(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=Ri(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 yr){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():lC(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Jn(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()}},dC=e=>new Bn({key:typeof e.pluginKey==`string`?new pr(e.pluginKey):e.pluginKey,view:t=>new uC({view:t,...e})});oi.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[dC({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 fC=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 ei(e,{textSerializers:xi(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(or(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Ir(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Rr(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Qn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Vr(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Dr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ci(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ir(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=Ri(this.view,e.from,e.to);Jn({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()}},pC=e=>new Bn({key:typeof e.pluginKey==`string`?new pr(e.pluginKey):e.pluginKey,view:t=>new fC({view:t,...e})});oi.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?[pC({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 mC(e,t){return e??new pr(t)}var hC=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,gC=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),_C=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(`.`)),vC=new Set([`children`,`className`,`style`]),yC=new Set([`tabIndex`]),bC=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),xC={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function SC(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function CC(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function wC(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||bC.has(e)}function TC(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function EC(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:xC[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function DC(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 OC(e){return yC.has(e)}function kC(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function AC(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 jC(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||_C.has(e)?String(t):`${t}px`}function MC(e,t){gC.has(t)||e.style.removeProperty(TC(t))}function NC(e,t,n){gC.has(t)||e.style.setProperty(TC(t),jC(t,n))}function PC(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(vC.has(r)||!wC(r)||SC(r,t[r])||SC(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=CC(r);if(a==null||a===!1){OC(r)&&AC(e,r),e.removeAttribute(o);return}if(a===!0){OC(r)&&kC(e,r,!0),e.setAttribute(o,``);return}if(OC(r)){kC(e,r,a);return}e.setAttribute(o,String(a))})}function FC(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function IC(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){MC(e,t);return}NC(e,t,a)}})}function LC(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(!SC(t,n))return;let{eventName:i,options:a}=EC(t),o=t=>{n(DC(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function RC(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);hC(()=>{let i=n.current;return FC(e,i.className,t.className),IC(e,i.style,t.style),PC(e,i,t),r.current=LC(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 zC=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)(mC(e,`bubbleMenu`)).current;RC(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=dC({...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,Sc.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)(mC(e,`floatingMenu`)).current;RC(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=pC({...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,Sc.createPortal)(s,u.current)});var BC=[{name:`paragraph`,label:`Text`,icon:cl,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:_t,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Lt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:We,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:Tt,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:Se,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:N,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:O,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:bl,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function VC(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:HC},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)(De,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Uo,{asChild:!0,children:(0,Z.jsxs)(Xi,{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=BC.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Ko,{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)(vo,{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)(Ga,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function HC(e){let t=Object.fromEntries(BC.map(t=>[t.name,t.isActive(e.editor)]));return{current:BC.find(e=>t[e.name])??BC[0],activeStates:t}}function UC(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=qm.filter(e),u=qm.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)(vs,{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)(Xi,{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)(ob,{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 WC(e){let t=(0,$.c)(23),{resolveSelection:n,children:r}=e,{_:a}=i(),{states:o,refresh:s}=Xh(),{dispatch:c}=zh(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),m;t[0]!==a||t[1]!==s||t[2]!==n?(m=e=>{if(e){let e;try{e=n()}catch(e){console.error(`Edit with AI: could not read the selection`,e),X.error(a({id:`-RXIMO`}));return}f(e),s()}u(e)},t[0]=a,t[1]=s,t[2]=n,t[3]=m):m=t[3];let h=m,g;t[4]!==a||t[5]!==c||t[6]!==d?(g=(e,t)=>{if(d!==null){let n=Oh({docName:d.docName,workspace:d.workspace,instruction:t,selectionMarkdown:d.selectionMarkdown});n===null?X.error(a({id:`_VRtd7`})):c(e.id,n)}u(!1)},t[4]=a,t[5]=c,t[6]=d,t[7]=g):g=t[7];let _=g,v;t[8]===r?v=t[9]:(v=(0,Z.jsx)(H,{asChild:!0,children:r}),t[8]=r,t[9]=v);let y;t[10]===a?y=t[11]:(y=a({id:`EVnzPs`}),t[10]=a,t[11]=y);let b;t[12]!==_||t[13]!==o?(b=(0,Z.jsx)(UC,{installStates:o,onPick:_}),t[12]=_,t[13]=o,t[14]=b):b=t[14];let x;t[15]!==y||t[16]!==b?(x=(0,Z.jsx)(B,{align:`start`,"aria-label":y,"data-testid":`edit-with-ai-popover`,children:b}),t[15]=y,t[16]=b,t[17]=x):x=t[17];let S;return t[18]!==h||t[19]!==l||t[20]!==v||t[21]!==x?(S=(0,Z.jsxs)(p,{open:l,onOpenChange:h,children:[v,x]}),t[18]=h,t[19]=l,t[20]=v,t[21]=x,t[22]=S):S=t[22],S}function GC(e){let t=q(e.state.selection.content(),e.state.schema);return Me().serialize(t).trim()}function KC(e){let t=(0,$.c)(7),{editor:n}=e,r=ko();if(!ni())return null;let i;t[0]!==n||t[1]!==r?(i=()=>({docName:Je(n),workspace:r,selectionMarkdown:GC(n)}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(mo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[3]=o):o=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(Xi,{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)(ca,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`EVnzPs`})})]}),t[4]=c):c=t[4];let l;return t[5]===a?l=t[6]:(l=(0,Z.jsxs)(Z.Fragment,{children:[o,(0,Z.jsx)(WC,{resolveSelection:a,children:c})]}),t[5]=a,t[6]=l),l}function qC(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 JC(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 YC(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 XC(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:ZC},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=qC(n);t&&YC(t,JC(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Ho,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{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)(gr,{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)(dr,{children:[u,d]})}),t[11]=u,t[12]=f),f}function ZC(e){return qC(e.editor)}function QC(e){return qC(e)!==null}var $C=[{value:`left`,label:`Align left`,icon:ae},{value:`center`,label:`Align center`,icon:g},{value:`right`,label:`Align right`,icon:en}];function ew(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Xt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function tw(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:nw},t[0]=n,t[1]=r);let i=le(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=$C.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{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(!Xt.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)),Ut(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(gr,{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 nw(e){return ew(e.editor)}function rw(e){return ew(e)!==null}var iw=[{name:`bold`,icon:xc,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:qc,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Ol,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:wl,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:qe,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Kc,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function aw(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:ow},t[0]=n,t[1]=r);let i=le(r),a;t[2]!==i||t[3]!==n?(a=iw.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{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)(gr,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(D,{"aria-label":Sa(e.shortcutId),children:Zo(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 ow(e){return Object.fromEntries(iw.map(t=>[t.name,t.isActive(e.editor)]))}function sw(e){let t=(0,$.c)(63),{editor:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:f,pages:p}=ji(),m;t[0]===n?m=t[1]:(m=n.isActive(`link`),t[0]=n,t[1]=m);let h=m,g;t[2]===n?g=t[3]:(g=n.getAttributes(`link`).href??``,t[2]=n,t[3]=g);let _=g,v,y;t[4]===n?(v=t[5],y=t[6]):(v=()=>{let e=function(){n.state.selection.empty&&o(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},y=[n],t[4]=n,t[5]=v,t[6]=y),(0,Q.useEffect)(v,y);let b,x;t[7]!==_||t[8]!==a?(b=()=>{a&&(l(_),requestAnimationFrame(()=>u.current?.focus()))},x=[a,_],t[7]=_,t[8]=a,t[9]=b,t[10]=x):(b=t[9],x=t[10]),(0,Q.useEffect)(b,x);let C;t[11]!==n||t[12]!==h||t[13]!==c?(C=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():h&&n.chain().focus().unsetLink().run(),o(!1)},t[11]=n,t[12]=h,t[13]=c,t[14]=C):C=t[14];let w=C,T;t[15]===n?T=t[16]:(T=function(){n.chain().focus().unsetLink().run(),o(!1)},t[15]=n,t[16]=T);let E=T,O;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){l(S(e.path,null))},t[17]=O):O=t[17];let k=O,j;t[18]!==w||t[19]!==n?(j=function(e){e.key===`Enter`&&(e.preventDefault(),w()),e.key===`Escape`&&(e.preventDefault(),o(!1),n.chain().focus().run())},t[18]=w,t[19]=n,t[20]=j):j=t[20];let M=j;if(a){let e;t[21]===r?e=t[22]:(e=r({id:`ZsGpr_`}),t[21]=r,t[22]=e);let n;t[23]===r?n=t[24]:(n=r({id:`roAe2K`}),t[23]=r,t[24]=n);let i;t[25]!==d||t[26]!==M||t[27]!==f||t[28]!==p||t[29]!==e||t[30]!==n||t[31]!==c?(i=(0,Z.jsx)(ot,{ref:u,type:`text`,placeholder:e,value:c,pages:p,folderPaths:d,loading:f,onValueChange:l,onSuggestionSelect:k,onKeyDown:M,"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[25]=d,t[26]=M,t[27]=f,t[28]=p,t[29]=e,t[30]=n,t[31]=c,t[32]=i):i=t[32];let a;t[33]===r?a=t[34]:(a=r({id:`tP5DDk`}),t[33]=r,t[34]=a);let o;t[35]===w?o=t[36]:(o=()=>{w()},t[35]=w,t[36]=o);let m;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Mc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[37]=m):m=t[37];let g;t[38]!==a||t[39]!==o?(g=(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:o,children:m}),t[38]=a,t[39]=o,t[40]=g):g=t[40];let v;t[41]!==i||t[42]!==g?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[i,g]}),t[41]=i,t[42]=g,t[43]=v):v=t[43];let y;t[44]!==r||t[45]!==_||t[46]!==h||t[47]!==E?(y=h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),A(_)},children:(0,Z.jsx)(rs,{className:`size-3.5`})})}),(0,Z.jsx)(gr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),E()},children:(0,Z.jsx)(R,{className:`size-3.5`})})}),(0,Z.jsx)(gr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`484LKL`})})]})]}),t[44]=r,t[45]=_,t[46]=h,t[47]=E,t[48]=y):y=t[48];let b;return t[49]!==v||t[50]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[v,y]}),t[49]=v,t[50]=y,t[51]=b):b=t[51],b}let N;t[52]===r?N=t[53]:(N=r({id:`p0Iq25`}),t[52]=r,t[53]=N);let P=h?`bg-accent text-primary`:`text-accent-foreground`,F,I;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{e.preventDefault(),o(!0)},I=(0,Z.jsx)(Yc,{className:`size-3.5`}),t[54]=F,t[55]=I):(F=t[54],I=t[55]);let L;t[56]!==N||t[57]!==P?(L=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon-xs`,"aria-label":N,className:P,onMouseDown:F,children:I})}),t[56]=N,t[57]=P,t[58]=L):L=t[58];let z;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(s,{id:`yzF66j`}),t[59]=z):z=t[59];let B;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(gr,{side:`bottom`,sideOffset:8,children:[z,(0,Z.jsx)(D,{children:Zo(`command-palette`)})]}),t[60]=B):B=t[60];let V;return t[61]===L?V=t[62]:(V=(0,Z.jsxs)(dr,{children:[L,B]}),t[61]=L,t[62]=V),V}function cw({editor:e}){if(mt(e.state).query||e.isActive(`codeBlock`))return!1;if(rw(e)||QC(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 lw(e){let t=(0,$.c)(22),{editor:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(0),o=(0,Q.useRef)(null),s;t[0]===n?s=t[1]:(s={editor:n,selector:mw},t[0]=n,t[1]=s);let c=le(s),l;t[2]===n?l=t[3]:(l={editor:n,selector:pw},t[2]=n,t[3]=l);let u=le(l),d;t[4]!==n.state||t[5]!==n.view?(d=()=>{try{let{from:e,to:t}=n.state.selection;return Ri(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=d):d=t[6];let f;if(t[7]!==n.view.dom||t[8]!==d){let e={getBoundingClientRect:d,contextElement:n.view.dom};f=()=>{let t=r.current;t&&(o.current?.(),o.current=Mr(e,t,()=>{Jn(e,t,{placement:`top`,strategy:`fixed`,middleware:[Rr(8),or(),Ir({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(fw)}))},t[7]=n.view.dom,t[8]=d,t[9]=f}else f=t[9];let p=f,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{o.current?.(),o.current=null,a(dw)},t[10]=m):m=t[10];let h=m,g;t[11]===p?g=t[12]:(g={onShow:p,onHide:h,strategy:`fixed`},t[11]=p,t[12]=g);let _;t[13]!==n||t[14]!==u||t[15]!==c||t[16]!==i?(_=c?(0,Z.jsx)(tw,{editor:n},`${i}-img-align`):u?(0,Z.jsx)(XC,{editor:n},`${i}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(VC,{editor:n}),(0,Z.jsx)(mo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(aw,{editor:n},i),(0,Z.jsx)(mo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(sw,{editor:n},`${i}-link`),(0,Z.jsx)(KC,{editor:n},`${i}-edit-ai`)]}),t[13]=n,t[14]=u,t[15]=c,t[16]=i,t[17]=_):_=t[17];let v;return t[18]!==n||t[19]!==g||t[20]!==_?(v=(0,Z.jsx)(zC,{ref:r,editor:n,"data-testid":`bubble-menu-bar`,appendTo:uw,shouldShow:cw,updateDelay:250,options:g,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:_}),t[18]=n,t[19]=g,t[20]=_,t[21]=v):v=t[21],v}function uw(){return document.body}function dw(e){return e+1}function fw(){}function pw(e){return QC(e.editor)}function mw(e){return rw(e.editor)}function hw(e){return[...e?[{label:`Toggle header column`,icon:Ac,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:aa,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:ho,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:R,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Wc,run:e=>e.chain().focus().deleteTable().run()}]}function gw(e){return[...e?[{label:`Toggle header row`,icon:Tl,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:Pe,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:Jt,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:R,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Wc,run:e=>e.chain().focus().deleteTable().run()}]}function _w(e){if(!e.isEditable||mt(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 vw(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 Mr(r,e,()=>{Jn(r,e,{strategy:`absolute`,placement:t,middleware:[Rr(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(yw)})},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`?Fc:No,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)(Uo,{asChild:!0,children:(0,Z.jsx)(Xi,{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)(Vo,{}),(0,Z.jsxs)(Ko,{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)(vo,{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)(Ga,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function yw(){}function bw(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=_w(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=hw(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)(vw,{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=gw(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)(vw,{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}var xw=new WeakMap;function Sw(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=Pr(e.color),n.textContent=e.name,t.append(n),t}var Cw={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},ww=100,Tw=100,Ew=3,Dw=250;function Ow(){let e=new Ar({extensions:kr});return{mdManager:e,text:we({mdManager:e}),html:ye({mdManager:e}),paste:Ge({mdManager:e}),drop:l({mdManager:e})}}function kw(e){let{provider:t,placeholder:n,prebuiltMapping:r}=e;return[...Ct.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),tC.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),rt.configure({document:t.document,...r?{ySyncOptions:{mapping:r}}:{}}),oi.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[Ht]}}),oi.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[Le(e,{cursorBuilder:Sw})]}})]}function Aw(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{xw.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=xw.get(e);if(xw.delete(e),r==null)return;let i=performance.now();b(`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:(e,t)=>n.drop(e,t)},extensions:Kf(kw(e))}}function jw(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i}=e,a=Zr(kw({provider:t,placeholder:n,clipboard:r,ctorStart:i})),{doc:o,mapping:s}=Mt(t.document.getXmlFragment(`default`),a);return{...Aw({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s}),content:o.toJSON(),element:null}}var Mw=e=>{let t=(0,$.c)(21),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(Cw),c=sC(),{principal:l,activeDocName:u}=ht(),d=n.configuration.name??``,[f]=(0,Q.useState)(Ow),p;t[0]!==f||t[1]!==r||t[2]!==n?(p=()=>()=>({editor:new Di(jw({provider:n,placeholder:r,clipboard:f,ctorStart:performance.now()})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=f,t[1]=r,t[2]=n,t[3]=p):p=t[3];let[m]=(0,Q.useState)(p),h,g;if(t[4]!==m||t[5]!==d||t[6]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=z(d)??crypto.randomUUID();h=Q.use,g=K({docName:d,mountId:r,construct:m,sizeStats:e}),t[4]=m,t[5]=d,t[6]=n.document,t[7]=h,t[8]=g}else h=t[7],g=t[8];let _=h(g),v=_.editor,y,b;t[9]===_?(y=t[10],b=t[11]):(y=()=>()=>{ee(_)},b=[_],t[9]=_,t[10]=y,t[11]=b),(0,Q.useEffect)(y,b);let x;return t[12]!==u||t[13]!==d||t[14]!==v||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==l||t[19]!==n?(x=(0,Z.jsx)(Nw,{provider:n,isSourceMode:i,docName:d,activeDocName:u,identity:c,principal:l,editor:v,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[12]=u,t[13]=d,t[14]=v,t[15]=c,t[16]=i,t[17]=a,t[18]=l,t[19]=n,t[20]=x):x=t[20],x},Nw=e=>{let t=(0,$.c)(85),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:d}=e,f=(0,Q.useRef)(null),p,m;t[0]===d?(p=t[1],m=t[2]):(p=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},m=[d],t[0]=d,t[1]=p,t[2]=m),(0,Q.useLayoutEffect)(p,m);let g;t[3]!==c||t[4]!==n.configuration.name?(g=()=>(wt(c,n.configuration.name??null),()=>{wt(c,null)}),t[3]=c,t[4]=n.configuration.name,t[5]=g):g=t[5];let v;t[6]!==c||t[7]!==n?(v=[c,n],t[6]=c,t[7]=n,t[8]=v):v=t[8],(0,Q.useEffect)(g,v);let y;t[9]!==c||t[10]!==n.configuration.name?(y=()=>{let e=n.configuration.name;if(e)return _(e,c),()=>k(e,c)},t[9]=c,t[10]=n.configuration.name,t[11]=y):y=t[11];let x;t[12]!==c||t[13]!==n?(x=[c,n],t[12]=c,t[13]=n,t[14]=x):x=t[14],(0,Q.useEffect)(y,x);let S;t[15]!==c||t[16]!==n.configuration.name?(S=()=>{},t[15]=c,t[16]=n.configuration.name,t[17]=S):S=t[17];let C;t[18]!==c||t[19]!==n?(C=[c,n],t[18]=c,t[19]=n,t[20]=C):C=t[20],(0,Q.useEffect)(S,C);let w,T;t[21]===c?(w=t[22],T=t[23]):(T=()=>{let e=Pw,t=null,n=()=>{if(t||c.isDestroyed)return;let n=h(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 h(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},w=[c],t[21]=c,t[22]=w,t[23]=T),(0,Q.useEffect)(T,w);let E,D;t[24]!==i||t[25]!==c?(E=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!h(c))return;e=!0;let t=ct(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})),b(`ok/editor/selection-restore-failed`,{docName:i,message:n})}ue(i)};if(h(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},D=[c,i],t[24]=i,t[25]=c,t[26]=E,t[27]=D):(E=t[26],D=t[27]),(0,Q.useEffect)(E,D);let O,A;t[28]!==u||t[29]!==n.document||t[30]!==l?(O=()=>{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)},li)};c(Cw);let f=()=>{if(cr(e),!Ai(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`?Ai(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)}},A=[n.document,u,l],t[28]=u,t[29]=n.document,t[30]=l,t[31]=O,t[32]=A):(O=t[31],A=t[32]),(0,Q.useEffect)(O,A);let j,M;t[33]!==a||t[34]!==i||t[35]!==c||t[36]!==n?(j=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<ww){e+=1,t=window.setTimeout(p,Tw);return}r=null,o=null,e=0},u=function(e){let t=h(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=Ew,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,Dw)))};t=window.setTimeout(o,Dw)};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=mi(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},g=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,g),c.on(`transaction`,g),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,g),c.off(`transaction`,g),window.removeEventListener(`hashchange`,m)}},M=[n,c,i,a],t[33]=a,t[34]=i,t[35]=c,t[36]=n,t[37]=j,t[38]=M):(j=t[37],M=t[38]),(0,Q.useEffect)(j,M);let N,P;t[39]===c?(N=t[40],P=t[41]):(N=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=h(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($s,e),()=>window.removeEventListener($s,e)},P=[c],t[39]=c,t[40]=N,t[41]=P),(0,Q.useEffect)(N,P);let F;t[42]!==a||t[43]!==i||t[44]!==o||t[45]!==r||t[46]!==s||t[47]!==n.awareness?(F=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:cC({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[42]=a,t[43]=i,t[44]=o,t[45]=r,t[46]=s,t[47]=n.awareness,t[48]=F):F=t[48];let I;t[49]!==a||t[50]!==i||t[51]!==o||t[52]!==r||t[53]!==s||t[54]!==n?(I=[n,i,a,o,s,r],t[49]=a,t[50]=i,t[51]=o,t[52]=r,t[53]=s,t[54]=n,t[55]=I):I=t[55],(0,Q.useEffect)(F,I);let L,R;t[56]!==c||t[57]!==r?(L=()=>(Ae(c,r),()=>{Ae(c,!1)}),R=[c,r],t[56]=c,t[57]=r,t[58]=L,t[59]=R):(L=t[58],R=t[59]),(0,Q.useEffect)(L,R);let z;t[60]!==c||t[61]!==r?(z=!r&&(0,Z.jsx)(lw,{editor:c}),t[60]=c,t[61]=r,t[62]=z):z=t[62];let B;t[63]!==c||t[64]!==r?(B=!r&&(0,Z.jsx)(bw,{editor:c}),t[63]=c,t[64]=r,t[65]=B):B=t[65];let V;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[66]=V):V=t[66];let H;t[67]===c?H=t[68]:(H=(0,Z.jsx)(se,{editor:c,className:`tiptap-editor-portal-content h-full`}),t[67]=c,t[68]=H);let U;t[69]!==d||t[70]!==H?(U=(0,Sc.createPortal)(H,d),t[69]=d,t[70]=H,t[71]=U):U=t[71];let W;t[72]===c?W=t[73]:(W=(0,Z.jsx)(aC,{editor:c}),t[72]=c,t[73]=W);let G;t[74]===c?G=t[75]:(G=ze(c),t[74]=c,t[75]=G);let ee;t[76]===G.store?ee=t[77]:(ee=(0,Z.jsx)(dt,{store:G.store}),t[76]=G.store,t[77]=ee);let te;return t[78]!==z||t[79]!==B||t[80]!==U||t[81]!==W||t[82]!==ee||t[83]!==l?(te=(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:[z,B,V,U,W,ee]}),t[78]=z,t[79]=B,t[80]=U,t[81]=W,t[82]=ee,t[83]=l,t[84]=te):te=t[84],te};function Pw(){return me()}var Fw=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 Iw(e,t,n,r,i,a){if(e==r)return[];let o=Kw(e,t,n,r,i,a),s=qw(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 Fw(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new Fw(t,t+o,i,i),new Fw(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 Fw(t,t,i,i+o),new Fw(n,n,i+o+c,a)]}if(c==1||l==1)return[new Fw(t,n,i,a)];let u=Yw(e,t,n,r,i,a);if(u){let[o,s,c]=u;return Iw(e,t,o,r,i,s).concat(Iw(e,o+c,n,r,s+c,a))}return Bw(e,t,n,r,i,a)}var Lw=1e9,Rw=0,zw=!1;function Bw(e,t,n,r,i,a){let o=n-t,s=a-i;if(Lw<1e9&&Math.min(o,s)>Lw*16||Rw>0&&Date.now()>Rw)return Math.min(o,s)>Lw*64?[new Fw(t,n,i,a)]:Xw(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);Hw.reset(c),Uw.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:Uw,f=d?null:Hw;for(let p=0;p<c;p++){if(p>Lw||Rw>0&&!(p&63)&&Date.now()>Rw)return Xw(e,t,n,r,i,a);let m=Hw.advance(p,o,s,c,d,!1,l)||Uw.advance(p,o,s,c,f,!0,u);if(m)return Ww(e,t,n,t+m[0],r,i,a,i+m[1])}return[new Fw(t,n,i,a)]}var Vw=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}},Hw=new Vw,Uw=new Vw;function Ww(e,t,n,r,i,a,o,s){let c=!1;return!dT(e,r)&&++r==n&&(c=!0),!dT(i,s)&&++s==o&&(c=!0),c?[new Fw(t,n,a,o)]:Iw(e,t,r,i,a,s).concat(Iw(e,r,n,i,s,o))}function Gw(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function Kw(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=Gw(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-+!dT(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function qw(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=Gw(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-+!dT(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function Jw(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;;){dT(e,s)||s++;let u=s+o;if(dT(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=Kw(e,u,n,r,i+f+d.length,a),c=qw(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 Yw(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=Yw(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:Jw(e,t,n,r,i,a,Math.floor(o/4),-1)}function Xw(e,t,n,r,i,a){zw=!0;let o=n-t,s=a-i,c;if(o<s){let s=Jw(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=Jw(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new Fw(t,n,i,a)];let[l,u,d]=c;return Iw(e,t,l,r,i,u).concat(Iw(e,l+d,n,r,u+d,a))}function Zw(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 Fw(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function Qw(e,t,n){for(;;){Zw(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=Kw(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Fw(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=qw(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Fw(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 Fw(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 Fw(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function $w(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=oT(t,a.fromA,l),f=aT(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 Fw(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=aT(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new Fw(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=oT(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new Fw(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=cT(n,a.fromB,a.toB),r,o=t<0?-1:sT(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=cT(t,a.fromA,a.toA),r,o=n<0?-1:sT(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 Zw(e,3),e}var eT;try{eT=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function tT(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function nT(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!tT(n):eT?!lT(n)||t==e.length-1?+!!eT.test(String.fromCharCode(n)):eT.test(e.slice(t,t+2))?2:0:0}function rT(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!tT(n):eT?!uT(n)||t==1?+!!eT.test(String.fromCharCode(n)):eT.test(e.slice(t-2,t))?2:0:0}var iT=8;function aT(e,t,n){if(t==e.length||!rT(e,t))return t;for(let r=t,i=t+n,a=0;a<iT;a++){let t=nT(e,r);if(!t||r+t>i)return r;r+=t}return t}function oT(e,t,n){if(!t||!nT(e,t))return t;for(let r=t,i=t-n,a=0;a<iT;a++){let t=rT(e,r);if(!t||r-t<i)return r;r-=t}return t}function sT(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function cT(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var lT=e=>e>=55296&&e<=56319,uT=e=>e>=56320&&e<=57343;function dT(e,t){return!t||t==e.length||!lT(e.charCodeAt(t-1))||!uT(e.charCodeAt(t))}function fT(e,t,n){let r=n?.override;return r?r(e,t):(Lw=(n?.scanLimit??1e9)>>1,Rw=n?.timeout?Date.now()+n.timeout:0,zw=!1,Qw(e,t,Iw(e,0,e.length,t,0,t.length)))}function pT(){return!zw}function mT(e,t,n){return $w(fT(e,t,n),e,t)}var hT=Bs.define({combine:e=>e[0]}),gT=Vs.define(),_T=Bs.define(),vT=Fs.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(gT)&&(e=n.value);for(let n of t.state.facet(_T))e=n(e,t);return e}});function yT(e){let t=e.field(vT,!1);if(!t)return null;let n=e.facet(hT);return{chunks:t,side:n?n.side:null}}var bT=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 CT(mT(e.toString(),t.toString(),n),e,t,0,0,pT())}static updateA(e,t,n,r,i){return DT(ET(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return DT(ET(e,r,!1,t.length),e,t,n,i)}};function xT(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 ST(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 CT(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=xT(c.fromA+r,c.fromB+i,t,n),[d,f]=ST(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]=xT(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]=ST(a.toA+r,a.toB+i,t,n),s++}o.push(new bT(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var wT=1e3;function TT(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 ET(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>wT&&([l,d]=TT(e,a-wT,n,!0)),o<t.length-wT&&([u,f]=TT(e,o+wT,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 DT(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=mT(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of CT(h,n,r,d,f,pT()))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 OT={scanLimit:500},kT=Hs.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=zT(e))}update(e){(e.docChanged||e.viewportChanged||jT(e.startState,e.state)||MT(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=zT(e.view))}},{decorations:e=>e.deco}),AT=Ms.low(Ks({class:`cm-changeGutter`,markers:e=>e.plugin(kT)?.gutter||Ys.empty}));function jT(e,t){return e.field(vT,!1)!=t.field(vT,!1)}function MT(e,t){return e.facet(hT)!=t.facet(hT)}var NT=Rs.line({class:`cm-changedLine`}),PT=Rs.mark({class:`cm-changedText`}),FT=Rs.mark({tagName:`ins`,class:`cm-insertedLine`}),IT=Rs.mark({tagName:`del`,class:`cm-deletedLine`}),LT=new class extends Gs{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function RT(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,NT),i.add(o,s,n?IT:FT),a&&a.add(o,o,LT);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,NT),a&&a.add(u,u,LT);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,PT),s<t)c++;else break}u=t}}}function zT(e){let t=e.state.field(vT),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(hT),o=n==`a`,s=new zs,c=i?new zs: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))&&RT(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var BT=class extends js{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}},VT=Vs.define({map:(e,t)=>e.map(t)}),HT=Fs.define({create:()=>Rs.none,update:(e,t)=>{for(let e of t.effects)if(e.is(VT))return e.value;return e.map(t.changes)},provide:e=>Ws.decorations.from(e)}),UT=.01;function WT(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 GT(e,t,n){let r=new zs,i=new zs,a=e.state.field(HT).iter(),o=t.state.field(HT).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<-UT?(l-=n,r.add(s,s,Rs.widget({widget:new BT(-n),block:!0,side:-1}))):n>UT&&(u+=n,i.add(c,c,Rs.widget({widget:new BT(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<UT?r.add(e.state.doc.length,e.state.doc.length,Rs.widget({widget:new BT(-p),block:!0,side:1})):p>UT&&i.add(t.state.doc.length,t.state.doc.length,Rs.widget({widget:new BT(p),block:!0,side:1}));let m=r.finish(),h=i.finish();WT(m,e.state.field(HT))||e.dispatch({effects:VT.of(m)}),WT(h,t.state.field(HT))||t.dispatch({effects:VT.of(h)})}var KT=Vs.define({map:(e,t)=>t.mapPos(e)}),qT=class extends js{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:KT.of(n)});let{side:r,sibling:i}=e.state.facet(hT);i&&i().dispatch({effects:KT.of(JT(n,e.state.field(vT),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function JT(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 YT=Fs.define({create(e){return Rs.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(KT)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Ws.decorations.from(e)});function XT({margin:e=3,minSize:t=4}){return YT.init(n=>ZT(n,e,t))}function ZT(e,t,n){let r=new zs,i=e.facet(hT).side==`a`,a=e.field(vT),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,Rs.replace({widget:new qT(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var QT=Ws.styleModule.of(new qs({".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`}})),$T=Ws.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`}}),eE=new Us,tE=new Us,nE=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||OT;let t=[Ms.low(kT),$T,QT,HT,Ws.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(VT)))&&this.measure()})],n=[hT.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(AT);let r=Ps.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Ws.editorAttributes.of({class:`cm-merge-a`}),tE.of(n),t]}),i=[hT.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(AT);let a=Ps.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Ws.editorAttributes.of({class:`cm-merge-b`}),tE.of(i),t]});this.chunks=bT.build(r.doc,a.doc,this.diffConf);let o=[vT.init(()=>this.chunks),eE.of(e.collapseUnchanged?XT(e.collapseUnchanged):[])];r=r.update({effects:Vs.appendConfig.of(o)}).state,a=a.update({effects:Vs.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 Ws({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Ws({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),Ns.empty(e[0].startState.doc.length));this.chunks=t==this.a?bT.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):bT.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:gT.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:gT.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(hT),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(tE.reconfigure([hT.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?AT:[]])),a.push(tE.reconfigure([hT.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?AT:[]]))}if(r){let t=eE.reconfigure(e.collapseUnchanged?XT(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(){GT(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=rE(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=rE(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 rE(e){let t=e.nextSibling;return e.remove(),t}var iE=new class extends Gs{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},aE=Ms.low(Ks({class:`cm-changeGutter`,markers:e=>e.plugin(kT)?.gutter||Ys.empty,widgetMarker:(e,t)=>t instanceof uE?iE:null}));function oE(e){let t=typeof e.original==`string`?Ls.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||OT;return[Ms.low(kT),hE,$T,Ws.editorAttributes.of({class:`cm-merge-b`}),_T.of((e,t)=>{let r=t.effects.find(e=>e.is(sE));return r&&(e=bT.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=bT.updateB(e,t.state.field(cE),t.newDoc,t.changes,n)),e}),hT.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?xE:void 0,side:`b`}),cE.init(()=>t),e.gutter===!1?[]:aE,e.collapseUnchanged?XT(e.collapseUnchanged):[],vT.init(e=>bT.build(t,e.doc,n))]}var sE=Vs.define(),cE=Fs.define({create:()=>Ls.empty,update(e,t){for(let n of t.effects)n.is(sE)&&(e=n.value.doc);return e}}),lE=new WeakMap,uE=class extends js{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 dE(e,t,n){let r=lE.get(t.changes);if(r)return r;let i=Rs.widget({block:!0,side:-1,widget:new uE(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(hT),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(),fE(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),pE(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(cE).sliceString(t.fromA,t.endA),u=a&&e.facet(Xs),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
30
30
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
31
- `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Is(t,{style:t=>Zs(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 lE.set(t.changes,i),i}function fE(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(vT).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(cE);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Ns.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:sE.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function pE(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(vT).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(cE).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 mE(e){let t=new zs;for(let n of e.field(vT)){let r=e.facet(hT).overrideChunk&&_E(e,n);t.add(n.fromB,n.fromB,dE(e,n,!!r))}return t.finish()}var hE=Fs.define({create:e=>mE(e),update(e,t){return t.state.field(vT,!1)==t.startState.field(vT,!1)?e:mE(t.state)},provide:e=>Ws.decorations.from(e)}),gE=new WeakMap;function _E(e,t){let n=gE.get(t);if(n!==void 0)return n;n=null;let r=e.field(cE),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(Rs.widget({widget:new vE(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(PT.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return gE.set(t,n),n}var vE=class extends js{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}},yE=new class extends Gs{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},bE=Rs.line({class:`cm-inlineChangedLine`});function xE(e,t,n,r){let i=_E(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,yE),n.add(o.from,o.from,bE);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 SE=$t({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),CE=ie({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),wE=Ws.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 TE({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 EE(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:_}=ar(),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`?SE:CE,u=[Ws.editable.of(!1),Ps.readOnly.of(!0)],d=[nc,de(),...u,l,Ws.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new Ws({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=TE({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 Ws({doc:p,extensions:[nc,de(),Ws.editable.of(!1),l,wE,Ws.lineWrapping,oE({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),Ws.updateListener.of(e=>{let t=yT(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=yT(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new nE({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new Ws({doc:p,extensions:[...d,oE({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 Ws)||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 Ws)||M(e)},t[13]=A):A=t[13];let j=A,N=b===0,P;t[14]!==f||t[15]!==b?(P=b===null?``:b===0?f({id:`lPzyrU`}):Y._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=P):P=t[16];let F=P,I;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=I):I=t[17];let L;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,Sc.createPortal)((0,Z.jsx)(Xi,{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),L=C.map(e),t[18]=f,t[19]=C,t[20]=L}else L=t[20];let R;t[23]!==N||t[24]!==o||t[25]!==F||t[26]!==d||t[27]!==u?(R=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 ${N?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:F}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(Xi,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(Xi,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(Xi,{variant:`default`,size:`sm`,disabled:!N,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=N,t[24]=o,t[25]=F,t[26]=d,t[27]=u,t[28]=R):R=t[28];let z;return t[29]!==R||t[30]!==L?(z=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[I,L,R]}),t[29]=R,t[30]=L,t[31]=z):z=t[31],z}async function DE(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 OE(e,t){return DE(e,`content`,t)}async function kE(e){return DE(e,`mine`)}async function AE(e){return DE(e,`theirs`)}async function jE(e){return DE(e,`delete`)}async function ME(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 NE(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=ya(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Kr(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),ME(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 OE(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)(EE,{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(jE),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)(Xi,{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(AE),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)(Xi,{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)(EE,{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(kE),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)(Xi,{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(jE),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)(Xi,{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)(EE,{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 PE(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(zt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var FE=`__back-nav__`;function IE(e){return e instanceof Ie||e instanceof yt||e instanceof ke||e instanceof $e||e instanceof jt||e instanceof at?e.docName:null}function LE(e){if(e instanceof Ie){let t=e.docName;return{title:Y._({id:`Jejur6`}),summary:Y._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof yt){let t=e.docName;return{title:Y._({id:`V7QxyT`}),summary:Y._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof ke){let t=e.docName;return{title:Y._({id:`1di5fu`}),summary:Y._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof $e){let t=e.docName;return{title:Y._({id:`wvbc1r`}),summary:Y._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof jt)return{title:Y._({id:`Gfr4fu`}),summary:Y._({id:`j6LB7S`})};if(e instanceof at){let t=e.docName;return{title:Y._({id:`vv7kpg`}),summary:Y._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Y._({id:`W5A0Ly`});return{title:Y._({id:`29VNqC`}),summary:t}}function RE(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=LE(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)(Vb,{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)(Xi,{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)(Xi,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(lt(IE(n)??i),o(a),r(FE))},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 zE(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)(RE,{...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]===FE){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}: ${LE(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)(W,{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 BE(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Vi(t);return{map:n,keys:Sr(t),parseError:r}}function VE(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>BE(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=Ii(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Ze(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ft(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)(HE,{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)(UE,{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 HE(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 UE(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 WE(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Vi(t);return{map:n,keys:Sr(t),parseError:r}}function GE(e){let t=(0,$.c)(199),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>WE(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=Ii(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]===j?M=t[9]:(M=ZE(j),t[8]=j,t[9]=M);let N=M,P;t[10]===j?P=t[11]:(P=YE(j),t[10]=j,t[11]=P);let F=ga(N?null:P),I;t[12]!==F||t[13]!==N?(I=!N&&F.state.status===`ready`?F.state.data.folder.frontmatter_defaults??{}:{},t[12]=F,t[13]=N,t[14]=I):I=t[14];let L=I,R;t[15]!==F||t[16]!==N?(R=!N&&F.state.status===`ready`?F.state.data.frontmatterSources:{},t[15]=F,t[16]=N,t[17]=R):R=t[17];let z=R,B;t[18]!==F||t[19]!==N?(B=!N&&F.state.status===`ready`?F.state.data.schemaDeclarations:{},t[18]=F,t[19]=N,t[20]=B):B=t[20];let V=B,H;t[21]!==F||t[22]!==N?(H=!N&&F.state.status===`ready`?F.state.data.schemaSources:{},t[21]=F,t[22]=N,t[23]=H):H=t[23];let U=H,W;t[24]!==r||t[25]!==a?(W=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=zr(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[24]=r,t[25]=a,t[26]=W):W=t[26];let G=W,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[27]=ee):ee=t[27];let te=ee,K;t[28]===r?K=t[29]:(K=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[28]=r,t[29]=K);let q=K,ne;t[30]!==G||t[31]!==q?(ne=function(e,t){te(e),q(G({[e]:t}),[e])},t[30]=G,t[31]=q,t[32]=ne):ne=t[32];let re=ne,ie;t[33]!==G||t[34]!==q?(ie=function(e){te(e),q(G({[e]:null}),[e])},t[33]=G,t[34]=q,t[35]=ie):ie=t[35];let ae=ie,oe;t[36]!==r||t[37]!==a?(oe=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=zr(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[36]=r,t[37]=a,t[38]=oe):oe=t[38];let se=oe,ce;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(ce=function(e,t){return`${e} ${t}`},t[39]=ce):ce=t[39];let le=ce,ue;t[40]!==a||t[41]!==m?(ue=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)=>le(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[40]=a,t[41]=m,t[42]=ue):ue=t[42];let de=ue,pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe={activationConstraint:{distance:4}},t[43]=pe):pe=t[43];let me;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(me={coordinateGetter:Da},t[44]=me):me=t[44];let he=ro(ao(Lo,pe),ao(Na,me)),ge;t[45]!==L||t[46]!==re||t[47]!==p?(ge=function(e,t){let n=p[e]??QE(L[e]);if(n===void 0)return;b(n=>({...n,[e]:t}));let r=Fa(n,t);(!Object.hasOwn(p,e)||!JE(n,r))&&re(e,r)},t[45]=L,t[46]=re,t[47]=p,t[48]=ge):ge=t[48];let _e=ge,ve;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[49]=ve):ve=t[49];let ye=ve,{addPropertySignal:be,clearAddProperty:xe}=Fx(),Se;t[50]!==be||t[51]!==j?(Se=be.get(j)??0,t[50]=be,t[51]=j,t[52]=Se):Se=t[52];let Ce=Se,we,Te;t[53]===Ce?(we=t[54],Te=t[55]):(we=()=>{Ce>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},Te=[Ce],t[53]=Ce,t[54]=we,t[55]=Te),(0,Q.useEffect)(we,Te);let Ee,De;t[56]!==xe||t[57]!==j?(Ee=()=>()=>xe(j),De=[j,xe],t[56]=xe,t[57]=j,t[58]=Ee,t[59]=De):(Ee=t[58],De=t[59]),(0,Q.useEffect)(Ee,De);let Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):ka[e];return{...t,type:e,value:n,error:null}})},t[60]=Oe):Oe=t[60];let ke=Oe,Ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=function(e){S(t=>t&&{...t,value:e})},t[61]=Ae):Ae=t[61];let je=Ae,Me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Me=function(e){S(t=>t&&{...t,name:e,error:null})},t[62]=Me):Me=t[62];let Ne=Me,Pe;t[63]!==r||t[64]!==x||t[65]!==G||t[66]!==p?(Pe=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=G({[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[63]=r,t[64]=x,t[65]=G,t[66]=p,t[67]=Pe):Pe=t[67];let Fe=Pe,Ie;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=function(){S(null)},t[68]=Ie):Ie=t[68];let Le=Ie,Re;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Re=function(e){w({key:e,draft:e,error:null})},t[69]=Re):Re=t[69];let ze=Re,Be;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Be=function(e){w(t=>t&&{...t,draft:e,error:null})},t[70]=Be):Be=t[70];let Ve=Be,He;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(He=function(){w(null)},t[71]=He):He=t[71];let Ue=He,We;t[72]!==r||t[73]!==p||t[74]!==se||t[75]!==C?(We=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=se(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}),te(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[72]=r,t[73]=p,t[74]=se,t[75]=C,t[76]=We):We=t[76];let Ge=We,Ke;t[77]!==p||t[78]!==m?(Ke=m.length>0?m:Object.keys(p),t[77]=p,t[78]=m,t[79]=Ke):Ke=t[79];let qe=Ke,Je;if(t[80]!==qe){Je=new Map;for(let e of qe)Je.set(e,(Je.get(e)??0)+1);t[80]=qe,t[81]=Je}else Je=t[81];let Ye,J,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot;if(t[82]!==x||t[83]!==L||t[84]!==z||t[85]!==g||t[86]!==re||t[87]!==Ge||t[88]!==Je||t[89]!==E||t[90]!==de||t[91]!==p||t[92]!==y||t[93]!==h||t[94]!==ae||t[95]!==C||t[96]!==qe||t[97]!==k||t[98]!==V||t[99]!==U||t[100]!==he||t[101]!==_e){ot=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Object.keys(L).filter(e=>!Object.hasOwn(p,e)).sort(),n=Object.keys(V).filter(e=>!Object.hasOwn(p,e)&&!Object.hasOwn(L,e)).sort();if(qe.length===0&&e.length===0&&n.length===0&&!x&&!h){ot=null;break bb0}it=`property-panel editor-content-aligned pt-4 pb-4 text-sm`,at=`property-panel`,J=xs,tt=!g,t[115]===Symbol.for(`react.memo_cache_sentinel`)?(nt=e=>_(!e),t[115]=nt):nt=t[115];let r=!g,i;t[116]===r?i=t[117]:(i=(0,Z.jsx)(_s,{"data-expanded":r,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[116]=r,t[117]=i);let a;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[118]=a):a=t[118],t[119]===i?rt=t[120]:(rt=(0,Z.jsx)(bs,{asChild:!0,children:(0,Z.jsxs)(Xi,{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:[i,a]})}),t[119]=i,t[120]=rt),Ye=ys,Xe=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[121]===h?Ze=t[122]:(Ze=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)(Nr,{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[121]=h,t[122]=Ze);let o;if(t[123]!==qe){let e;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>le(e,t),t[125]=e):e=t[125],o=qe.map(e),t[123]=qe,t[124]=o}else o=t[124];let c;if(t[126]!==re||t[127]!==Ge||t[128]!==Je||t[129]!==E||t[130]!==p||t[131]!==y||t[132]!==ae||t[133]!==C||t[134]!==qe||t[135]!==k||t[136]!==_e){let e;t[138]!==re||t[139]!==Ge||t[140]!==Je||t[141]!==E||t[142]!==p||t[143]!==y||t[144]!==ae||t[145]!==C||t[146]!==k||t[147]!==_e?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??ri(n),i=C?.key===e?C:null,a=(Je.get(e)??0)>1;return(0,Z.jsx)(Ua,{sortableId:le(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>ze(e),onChangeDraft:Ve,onCommit:Ge,onCancel:Ue},onCommit:t=>re(e,t),onChangeType:t=>_e(e,t),onRemove:()=>ae(e)},`${e}-${t}`)},t[138]=re,t[139]=Ge,t[140]=Je,t[141]=E,t[142]=p,t[143]=y,t[144]=ae,t[145]=C,t[146]=k,t[147]=_e,t[148]=e):e=t[148],c=qe.map(e),t[126]=re,t[127]=Ge,t[128]=Je,t[129]=E,t[130]=p,t[131]=y,t[132]=ae,t[133]=C,t[134]=qe,t[135]=k,t[136]=_e,t[137]=c}else c=t[137];let l;t[149]!==o||t[150]!==c?(l=(0,Z.jsx)(ts,{items:o,strategy:to,children:c}),t[149]=o,t[150]=c,t[151]=l):l=t[151],t[152]!==de||t[153]!==he||t[154]!==l?(Qe=(0,Z.jsx)(Ta,{sensors:he,collisionDetection:ja,onDragEnd:de,children:l}),t[152]=de,t[153]=he,t[154]=l,t[155]=Qe):Qe=t[155];let u;t[156]!==L||t[157]!==z||t[158]!==re||t[159]!==E||t[160]!==k||t[161]!==_e?(u=e=>{let t=L[e],n=QE(t),r=ri(n),i=z[e]??``;return(0,Z.jsx)(Ua,{keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isInherited:!0,badge:(0,Z.jsx)(Ca,{source:i}),onCommit:t=>re(e,t),onChangeType:t=>_e(e,t)},`inherited-${e}`)},t[156]=L,t[157]=z,t[158]=re,t[159]=E,t[160]=k,t[161]=_e,t[162]=u):u=t[162],$e=e.map(u);let d;t[163]!==re||t[164]!==E||t[165]!==k||t[166]!==V||t[167]!==U?(d=e=>{let t=V[e].type,n=U[e]??``;return(0,Z.jsx)(Ua,{keyName:e,value:t===`date`?``:ka[t],declared:t,error:E[e]??null,resetCounter:k[e]??0,badge:(0,Z.jsx)(za,{source:n}),onCommit:t=>re(e,t),onChangeType:qE,typeReadOnly:!0},`declared-${e}`)},t[163]=re,t[164]=E,t[165]=k,t[166]=V,t[167]=U,t[168]=d):d=t[168],et=n.map(d)}t[82]=x,t[83]=L,t[84]=z,t[85]=g,t[86]=re,t[87]=Ge,t[88]=Je,t[89]=E,t[90]=de,t[91]=p,t[92]=y,t[93]=h,t[94]=ae,t[95]=C,t[96]=qe,t[97]=k,t[98]=V,t[99]=U,t[100]=he,t[101]=_e,t[102]=Ye,t[103]=J,t[104]=Xe,t[105]=Ze,t[106]=Qe,t[107]=$e,t[108]=et,t[109]=tt,t[110]=nt,t[111]=rt,t[112]=it,t[113]=at,t[114]=ot}else Ye=t[102],J=t[103],Xe=t[104],Ze=t[105],Qe=t[106],$e=t[107],et=t[108],tt=t[109],nt=t[110],rt=t[111],it=t[112],at=t[113],ot=t[114];if(ot!==Symbol.for(`react.early_return_sentinel`))return ot;let st;t[169]!==L||t[170]!==re||t[171]!==E||t[172]!==p||t[173]!==k||t[174]!==V?(st=!Object.hasOwn(p,`tags`)&&!Object.hasOwn(L,`tags`)&&!Object.hasOwn(V,`tags`)?(0,Z.jsx)(Ua,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>re(`tags`,e),onChangeType:KE},`virtual-tags`):null,t[169]=L,t[170]=re,t[171]=E,t[172]=p,t[173]=k,t[174]=V,t[175]=st):st=t[175];let ct;t[176]!==r||t[177]!==x||t[178]!==Fe?(ct=x?(0,Z.jsx)(La,{draft:x,onChangeName:Ne,onChangeType:ke,onChangeValue:je,onCommit:Fe,onCancel:Le}):(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)(Xi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ye,"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)(fe,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[176]=r,t[177]=x,t[178]=Fe,t[179]=ct):ct=t[179];let lt;t[180]!==Ye||t[181]!==Xe||t[182]!==Ze||t[183]!==Qe||t[184]!==$e||t[185]!==et||t[186]!==st||t[187]!==ct?(lt=(0,Z.jsxs)(Ye,{className:Xe,children:[Ze,Qe,$e,et,st,ct]}),t[180]=Ye,t[181]=Xe,t[182]=Ze,t[183]=Qe,t[184]=$e,t[185]=et,t[186]=st,t[187]=ct,t[188]=lt):lt=t[188];let ut;t[189]!==J||t[190]!==tt||t[191]!==nt||t[192]!==rt||t[193]!==lt?(ut=(0,Z.jsxs)(J,{open:tt,onOpenChange:nt,children:[rt,lt]}),t[189]=J,t[190]=tt,t[191]=nt,t[192]=rt,t[193]=lt,t[194]=ut):ut=t[194];let dt;return t[195]!==it||t[196]!==at||t[197]!==ut?(dt=(0,Z.jsx)(`div`,{className:it,"data-testid":at,children:ut}),t[195]=it,t[196]=at,t[197]=ut,t[198]=dt):dt=t[198],dt}function KE(){}function qE(){}function JE(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function YE(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var XE=/(^|\/)\.ok\/templates\//;function ZE(e){return XE.test(e)}function QE(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>typeof e==`string`?e:JSON.stringify(e)):e==null?``:JSON.stringify(e)}var $E=G(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function eD(e){let t=e.threshold??$E;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function tD(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var nD=G(`ACTIVITY_MOUNT_LIMIT`,3);function rD(){return n(()=>import(`./SourceEditor-BgMXvzLz.js`),__vite__mapDeps([46,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,47,24]),import.meta.url)}var iD=(0,Q.lazy)(async()=>({default:(await rD()).SourceEditor}));function aD(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ke(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function oD(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Y._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Y._({id:`Sc1bKE`,values:{docName:e}}):Y._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Y._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Y._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Y._({id:`bmC18N`,values:{docName:e}}):Y._({id:`pAgkuZ`,values:{docName:e}})}:null}function sD(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(x,{name:`activity-pool`,children:(0,Z.jsx)(cD,{...e})}),t[0]=e,t[1]=n),n}function cD(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ht(),{pages:u,loading:d}=ji(),f=aD(c,n,nD),p=(0,Q.useRef)(``),h=f.map(lD).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)j(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;oe(e,t&&t.length>0?t:crypto.randomUUID())}b(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,m(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)(hD,{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 x=f.map(y),S;return t[13]===x?S=t[14]:(S=(0,Z.jsx)(Z.Fragment,{children:x}),t[13]=x,t[14]=S),S}function lD(e){return e.docName}function uD(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&&b(`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&&(b(`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&&b(`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 dD(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)(ib,{}),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)(iD,{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 fD(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)(Bo,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(F,{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)(Xi,{type:`button`,onClick:pD,children:[(0,Z.jsx)(Bo,{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 pD(){return window.location.reload()}function mD(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 hD(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=oD(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=NS(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[y,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==y?(S=()=>{i&&!_?v(!0):!i&&!y&&x(!0)},C=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=eD({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),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&&b(`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=()=>ct(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=()=>{tD({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(b(`ok/cold/first-toggle`,{docName:n.docName,mountId:z(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,B;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==j?(B=f?(0,Z.jsx)(fD,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(zE,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(mD,{html:j}):(0,Z.jsx)(ib,{}),children:(0,Z.jsx)(PE,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(NE,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(VE,{provider:n.provider}),!i&&(0,Z.jsx)(GE,{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)(dD,{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)(Mw,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}`)}):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]=B):B=t[44];let V;t[45]!==r||t[46]!==R||t[47]!==B?(V=(0,Z.jsx)(uD,{isActive:r,initialScrollTop:R,children:B}),t[45]=r,t[46]=R,t[47]=B,t[48]=V):V=t[48];let H;return t[49]!==I||t[50]!==L||t[51]!==V?(H=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:V}),t[49]=I,t[50]=L,t[51]=V,t[52]=H):H=t[52],H}function gD(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function _D(e){let{value:t,unit:n}=gD(e);return n===`rem`?t*16:t}function vD(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var yD=3600*24*7;function bD(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?xD:m,O=g===void 0?yD: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,ee;t[3]===y?(G=t[4],ee=t[5]):(G=()=>{H.current=y},ee=[y],t[3]=y,t[4]=G,t[5]=ee),(0,Q.useEffect)(G,ee);let te=_D(b),K;t[6]===x?K=t[7]:(K=_D(x),t[6]=x,t[7]=K);let q=K,ne;t[8]!==E||t[9]!==k?(ne=function(e){E&&(P.current=!0,j.current=H.current?0:_D(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]=ne):ne=t[10];let re=ne,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==q||t[18]!==te||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{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}=gD(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<=te*w;else if(e<=te){let n=te*(w-1);t=te-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>te*T){a();let t=n(r,M.current,j.current,s),c=Math.max(te,Math.min(q,t)),u=vD(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(te,Math.min(q,u)),f=vD(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,te,q,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=q,t[18]=te,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function xD(){}var SD=3600*24*7,CD=`18rem`,wD=`3rem`,TD=`app-file-sidebar`,ED=`14.625rem`,DD=`32rem`,OD=`sidebar_width`,kD=/^\d+(?:\.\d+)?(?:rem|px)$/,AD=Q.createContext(null);function jD(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${OD}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return kD.test(n)?n:e}function MD(){let e=Q.use(AD);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function ND(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?CD:c,[u]=Q.useState(FD),d;t[8]===u?d=t[9]:(d=()=>HS(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>jD(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=YS();return ZS(`left`,HS(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),QS(`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(PD)},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: ${zS}px)`),t=()=>{let e=HS(u,window.innerWidth,`left`);p(e),C(ZS(`left`,e,YS())===`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(TD)?.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=>{Eo(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":wD,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=Ui(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let ee;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(ee=(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]=ee):ee=t[54];let te;return t[55]!==H||t[56]!==ee?(te=(0,Z.jsx)(AD.Provider,{value:H,children:ee}),t[55]=H,t[56]=ee,t[57]=te):te=t[57],te}function PD(e){return!e}function FD(){return Xn()}function ID(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}=MD();if(d===`none`){let e;t[7]===r?e=t[8]:(e=Ui(`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]:(_=Ui(`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=Ui(`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:TD,"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 LD(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}=MD(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=Sa(`toggle-files-sidebar`);l=Xi,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=TD,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]:(_=Ui(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)(T,{}):(0,Z.jsx)(il,{}),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 RD(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}=MD(),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:ED,maxResizeWidth:DD,setIsDraggingRail:h,widthCookieName:OD,widthCookieMaxAge:SD},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}=bD(_),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=Ui(`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 zD(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}=MD(),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=Ui(`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 BD(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=Ui(`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 VD(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=Ui(`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 HD(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=Ui(`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 UD(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=Ui(`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 WD(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=Ui(`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 GD=Qi(`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 KD(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?Gi:`button`,{state:m}=MD(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Ui(GD({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)(tr,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(gr,{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)(dr,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function qD(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 JD(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=vi.safeParse(t);return n.success?n.data.currentBranch??null:null}var YD=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:qD({fetchBranch:JD,subscribeToEvent:Cr}),XD=YD.subscribe,ZD=YD.getSnapshot;function QD(){return(0,Q.useSyncExternalStore)(XD,ZD,ZD)}function $D(){let e=(0,$.c)(6),t=QD(),n=ko(),{state:r}=MD(),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&&Ya(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 eO(e){let t=(0,$.c)(20),{stats:n,showStats:r}=e,a=r===void 0?!0:r,{_:o}=i(),c=$D();if(!a&&c===null)return null;let{words:l,chars:u,tokens:d}=n,f;t[0]!==o||t[1]!==a?(f=o(a?{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=o,t[1]=a,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(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[3]=p):p=t[3];let m;t[4]===c?m=t[5]:(m=c===null?null:(0,Z.jsx)(tO,{identity:c}),t[4]=c,t[5]=m);let h;t[6]===m?h=t[7]:(h=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:m}),t[6]=m,t[7]=h);let g;t[8]!==u||t[9]!==a||t[10]!==n.chars||t[11]!==n.tokens||t[12]!==n.words||t[13]!==d||t[14]!==l?(g=a?(0,Z.jsxs)(`span`,{className:`flex items-center shrink-0 gap-3`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:n.words.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`gljvbT`,values:{words:l}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:n.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:u}})]}),(0,Z.jsxs)(`span`,{children:[n.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:n.tokens.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:d}})]})]}):null,t[8]=u,t[9]=a,t[10]=n.chars,t[11]=n.tokens,t[12]=n.words,t[13]=d,t[14]=l,t[15]=g):g=t[15];let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(`section`,{"aria-label":f,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[p,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tO(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)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(gr,{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)(tt,{"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 nO(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=Ui(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 rO(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=Ui(`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 iO(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=Ui(`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 aO(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=Ui(`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 oO(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=Ui(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(_s,{}),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 sO=1,cO=2,lO=4;function uO(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}=y(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>lO?[...u.slice(0,sO).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(sO,-cO)},...u.slice(-cO).map((e,t)=>d(e,u.length-cO+t))]:u.map((e,t)=>d(e,t));a=nO,t[8]===r?c=t[9]:(c=Ui(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=rO,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(dO)}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 dO(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(oO,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(iO,{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)(Fc,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(iO,{className:`min-w-0`,children:(0,Z.jsx)(aO,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var fO={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`},pO=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`,...fO,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},mO=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)(pO,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},hO=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)(pO,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function gO(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=Zo(`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=Sa(`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)(uO,{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)(tr,{children:(0,Z.jsx)(hO,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(is,{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)(gr,{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)(dr,{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)(mO,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(is,{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)(gr,{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)(dr,{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)(os,{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)(dr,{children:[(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(tr,{children:(0,Z.jsx)(Zc,{})})}),(0,Z.jsx)(gr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=dr,h=Xi,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)(tr,{children:u?(0,Z.jsx)(ol,{}):(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)(gr,{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 _O(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var vO=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BDyf1132.js`),__vite__mapDeps([34,1,2,35,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,43]),import.meta.url)).ActivityModeContent}));function yO(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(xO,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(bO,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(x,{name:`editor-area`,children:(0,Z.jsxs)(Nx,{children:[n,r]})}),t[3]=n,t[4]=i),i}function bO(){let e=(0,$.c)(5),t=Qm(),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)(Wx,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function xO(e){let t=(0,$.c)(143),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,onSaveVersion:c,saving:l}=e,{_:u}=i(),{activeDocName:d,activeProvider:f,activeTarget:p,recycleDocument:m,docPanelMode:h,docPanelAgentId:g,docPanelExpandSignal:_}=ht(),{openDocumentTransition:v}=Dt(),{requestAddProperty:y}=Fx(),b=jS(f,d),x=$S(f),S=x===`connected`||x===`synced`,C=NS(d)===`conflict`,w=(0,Q.useDeferredValue)(d),T=p?.kind===`missing`,E=!!d&&p?.kind!==`folder`,D;t[0]!==u||t[1]!==T?(D=T?u({id:`K-a33w`}):void 0,t[0]=u,t[1]=T,t[2]=D):D=t[2];let O=D,[k]=(0,Q.useState)(CO),A=k!==null,j;t[3]===k?j=t[4]:(j=()=>HS(k,window.innerWidth,`right`),t[3]=k,t[4]=j);let[M,N]=(0,Q.useState)(j),P=(0,Q.useRef)(M),F,I;t[5]===M?(F=t[6],I=t[7]):(F=()=>{P.current=M},I=[M],t[5]=M,t[6]=F,t[7]=I),(0,Q.useEffect)(F,I);let L=Ky(),R;t[8]===M?R=t[9]:(R=()=>ZS(`right`,M,YS())===`collapsed`,t[8]=M,t[9]=R);let[z]=(0,Q.useState)(R),[B,V]=(0,Q.useState)(z),H=(0,Q.useRef)(B),W,G;t[10]===B?(W=t[11],G=t[12]):(W=()=>{H.current=B},G=[B],t[10]=B,t[11]=W,t[12]=G),(0,Q.useEffect)(W,G);let[ee,te]=(0,Q.useState)(!1),K=(0,Q.useRef)(!1),[q]=(0,Q.useState)(SO),ne=(0,Q.useRef)(q),re=(0,Q.useRef)(null),ie;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e){re.current!=null&&clearTimeout(re.current),re.current=setTimeout(()=>{LS(e),re.current=null},100)},t[13]=ie):ie=t[13];let ae=ie,oe,se;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>()=>{re.current!=null&&clearTimeout(re.current)},oe=[],t[14]=oe,t[15]=se):(oe=t[14],se=t[15]),(0,Q.useEffect)(se,oe);let[ce,le]=(0,Q.useState)(null),ue;t[16]!==B||t[17]!==L?(ue=function(){if(L.current==null)return;let e=P.current;B?(QS(`right`,e,`open`),L.current?.expand()):(QS(`right`,e,`collapsed`),L.current?.collapse())},t[16]=B,t[17]=L,t[18]=ue):ue=t[18];let de=ue,fe,pe;t[19]!==k||t[20]!==L?(fe=()=>{let e=window.matchMedia(`(min-width: ${BS}px)`),t=()=>{let e=HS(k,window.innerWidth,`right`);N(e);let t=ZS(`right`,e,YS())===`collapsed`;V(t),t?L.current?.collapse():L.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},pe=[k,L],t[19]=k,t[20]=L,t[21]=fe,t[22]=pe):(fe=t[21],pe=t[22]),(0,Q.useEffect)(fe,pe);let me,he;t[23]!==ce||t[24]!==A||t[25]!==L?(me=()=>{if(ce==null||A)return;let e=new ResizeObserver(()=>{H.current||K.current||L.current?.resize(`${ne.current}px`)});return e.observe(ce),()=>e.disconnect()},he=[ce,A,L],t[23]=ce,t[24]=A,t[25]=L,t[26]=me,t[27]=he):(me=t[26],he=t[27]),(0,Q.useEffect)(me,he);let ge,_e;t[28]!==o||t[29]!==L?(ge=()=>{let e=e=>{o(e),L.current?.expand()},t=nm();return t&&e(t),im(t=>{nm(),e(t)})},_e=[o,L],t[28]=o,t[29]=L,t[30]=ge,t[31]=_e):(ge=t[30],_e=t[31]),(0,Q.useEffect)(ge,_e);let ve,ye;t[32]!==_||t[33]!==L?(ve=()=>{_!==0&&L.current?.expand()},ye=[_,L],t[32]=_,t[33]=L,t[34]=ve,t[35]=ye):(ve=t[34],ye=t[35]),(0,Q.useEffect)(ve,ye);let be,xe;t[36]===B?(be=t[37],xe=t[38]):(be=()=>{if(!B||!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()},xe=[B],t[36]=B,t[37]=be,t[38]=xe),(0,Q.useLayoutEffect)(be,xe);let Se,Ce;t[39]===B?(Se=t[40],Ce=t[41]):(Se=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!B})},Ce=[B],t[39]=B,t[40]=Se,t[41]=Ce),(0,Q.useEffect)(Se,Ce);let we,Te;t[42]===de?(we=t[43],Te=t[44]):(we=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&de()})},Te=[de],t[42]=de,t[43]=we,t[44]=Te),(0,Q.useEffect)(we,Te);let Ee,De;t[45]===de?(Ee=t[46],De=t[47]):(Ee=()=>{if(window.okDesktop!=null)return;let e=e=>{Eo(e,`toggle-document-panel`)&&(e.preventDefault(),de())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},De=[de],t[45]=de,t[46]=Ee,t[47]=De),(0,Q.useEffect)(Ee,De);let Oe=(0,Q.useRef)(null),[ke,Ae]=(0,Q.useState)(null),je=p?.kind===`large-file`?p.docName:d,Me,Ne;t[48]===je?(Me=t[49],Ne=t[50]):(Me=()=>{if(je&&je!==Oe.current){let e=Oe.current;Oe.current=je,Ae(e)}},Ne=[je],t[48]=je,t[49]=Me,t[50]=Ne),(0,Q.useEffect)(Me,Ne);let Pe;t[51]===v?Pe=t[52]:(Pe=function(e){let t=ki(e);window.location.hash===t?v(e):window.location.hash=t},t[51]=v,t[52]=Pe);let Fe=Pe;if(p?.kind===`large-file`){let e;t[53]!==Fe||t[54]!==ke?(e=ke?{previousDocName:ke,onNavigateBack:Fe}:void 0,t[53]=Fe,t[54]=ke,t[55]=e):e=t[55];let n;return t[56]!==p.docName||t[57]!==p.limit||t[58]!==p.size||t[59]!==e?(n=(0,Z.jsx)(kx,{docName:p.docName,size:p.size,limit:p.limit,backNav:e}),t[56]=p.docName,t[57]=p.limit,t[58]=p.size,t[59]=e,t[60]=n):n=t[60],n}if(p?.kind===`folder`){if(!(h===`agent`&&g!==null)){let e;return t[61]===p.folderPath?e=t[62]:(e=(0,Z.jsx)(Tx,{folderPath:p.folderPath}),t[61]=p.folderPath,t[62]=e),e}let e;t[63]===p.folderPath?e=t[64]:(e=(0,Z.jsx)(Xx,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(Tx,{folderPath:p.folderPath})}),t[63]=p.folderPath,t[64]=e);let n;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Zx,{withHandle:!0}),t[65]=n):n=t[65];let r;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Xx,{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)(vO,{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)(Yx,{orientation:`horizontal`,children:[e,n,r]})}),t[67]=e,t[68]=i),i}if(p?.kind===`asset`){let e;return t[69]!==p.assetPath||t[70]!==p.mediaKind?(e=(0,Z.jsx)(rb,{assetPath:p.assetPath,mediaKind:p.mediaKind},p.assetPath),t[69]=p.assetPath,t[70]=p.mediaKind,t[71]=e):e=t[71],e}if(!f||!d){if((typeof window<`u`?ai(window.location.hash):null)!==null){let e;return t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ib,{}),t[72]=e):e=t[72],e}let e;return t[73]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Zb,{}),t[73]=e):e=t[73],e}let Ie=n===`source`,Le=!S,Re=B,ze;t[74]!==d||t[75]!==y?(ze=function(){d&&y(d)},t[74]=d,t[75]=y,t[76]=ze):ze=t[76];let Ve=ze,He=w??d,Ue=ke??void 0,We;t[77]!==O||t[78]!==Ie||t[79]!==Fe||t[80]!==m||t[81]!==He||t[82]!==Ue?(We=(0,Z.jsx)(sD,{activeDocName:He,isSourceMode:Ie,editorPlaceholder:O,previousDocName:Ue,onNavigateBack:Fe,onRecycle:m}),t[77]=O,t[78]=Ie,t[79]=Fe,t[80]=m,t[81]=He,t[82]=Ue,t[83]=We):We=t[83];let Ge;t[84]!==d||t[85]!==Ie?(Ge=(0,Z.jsx)(hS,{activeDocName:d,isSourceMode:Ie}),t[84]=d,t[85]=Ie,t[86]=Ge):Ge=t[86];let Ke;t[87]!==d||t[88]!==w?(Ke=_O({activeDocName:d,deferredActiveDocName:w,mountResolved:d!==null&&U(d),syncResolved:d!==null&&Be(d)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(ib,{}),d===null?null:(0,Z.jsx)(Ax,{docName:d})]}):null,t[87]=d,t[88]=w,t[89]=Ke):Ke=t[89];let qe;t[90]!==We||t[91]!==Ge||t[92]!==Ke?(qe=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[We,Ge,Ke]}),t[90]=We,t[91]=Ge,t[92]=Ke,t[93]=qe):qe=t[93];let Je;t[94]!==d||t[95]!==C||t[96]!==Re||t[97]!==Ie||t[98]!==r||t[99]!==Ve||t[100]!==Le||t[101]!==de?(Je=!C&&(0,Z.jsx)(gO,{activeDocName:d,isSourceMode:Ie,sourceDisabled:Le,onModeChange:r,showAddPropertyButton:!Ie,onAddProperty:Ve,isPanelCollapsed:Re,onTogglePanel:de}),t[94]=d,t[95]=C,t[96]=Re,t[97]=Ie,t[98]=r,t[99]=Ve,t[100]=Le,t[101]=de,t[102]=Je):Je=t[102];let Ye;t[103]!==qe||t[104]!==Je?(Ye=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[qe,Je]}),t[103]=qe,t[104]=Je,t[105]=Ye):Ye=t[105];let J;t[106]!==E||t[107]!==b?(J=(0,Z.jsx)(eO,{stats:b,showStats:E}),t[106]=E,t[107]=b,t[108]=J):J=t[108];let Xe;t[109]!==Ye||t[110]!==J?(Xe=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[Ye,J]}),t[109]=Ye,t[110]=J,t[111]=Xe):Xe=t[111];let Ze=Xe,Qe=ee||void 0,$e;t[112]===z?$e=t[113]:($e=z?{defaultSize:`100%`}:{},t[112]=z,t[113]=$e);let et=ee?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,tt;t[114]!==Ze||t[115]!==$e||t[116]!==et?(tt=(0,Z.jsx)(Xx,{minSize:`30%`,...$e,className:et,children:Ze}),t[114]=Ze,t[115]=$e,t[116]=et,t[117]=tt):tt=t[117];let nt=A&&B,rt;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(rt=()=>{te(!0),K.current=!0;let e=()=>{te(!1),K.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[118]=rt):rt=t[118];let it;t[119]===nt?it=t[120]:(it=(0,Z.jsx)(Zx,{withHandle:!0,disabled:nt,onPointerDown:rt}),t[119]=nt,t[120]=it);let at=z?0:`${q}px`,ot;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(ot=e=>{V(e.asPercentage===0),e.inPixels>0&&K.current&&(ne.current=e.inPixels,ae(e.inPixels))},t[121]=ot):ot=t[121];let st=!ee&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ct;t[122]===st?ct=t[123]:(ct=Ui(`flex flex-col bg-muted/20`,st),t[122]=st,t[123]=ct);let lt;t[124]!==d||t[125]!==a||t[126]!==h||t[127]!==Ie||t[128]!==o||t[129]!==c||t[130]!==l?(lt=(0,Z.jsx)($_,{docName:d,isSourceMode:Ie,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l}),t[124]=d,t[125]=a,t[126]=h,t[127]=Ie,t[128]=o,t[129]=c,t[130]=l,t[131]=lt):lt=t[131];let ut;t[132]!==B||t[133]!==L||t[134]!==at||t[135]!==ct||t[136]!==lt?(ut=(0,Z.jsx)(Xx,{id:`doc-panel`,panelRef:L,defaultSize:at,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:ot,inert:B,className:ct,children:lt}),t[132]=B,t[133]=L,t[134]=at,t[135]=ct,t[136]=lt,t[137]=ut):ut=t[137];let dt;return t[138]!==Qe||t[139]!==tt||t[140]!==it||t[141]!==ut?(dt=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:le,children:(0,Z.jsxs)(Yx,{orientation:`horizontal`,"data-dragging":Qe,children:[tt,it,ut]})}),t[138]=Qe,t[139]=tt,t[140]=it,t[141]=ut,t[142]=dt):dt=t[142],dt}function SO(){return RS()}function CO(){return Xn()}function wO(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 TO(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 EO=1e3,DO=!1;function OO(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function kO(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:da(i)?a=i:(a=void 0,DO||(DO=!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`&&(OO({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=TO(i),{current:c,crossDoc:l}=a?oa(a,n,Date.now()):{current:[],crossDoc:[]},u=AO,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>wO(e.current,p)&&wO(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,EO);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 AO(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var jO=`sync-status`;function MO(e,t){let n=(0,$.c)(5),{_:r}=i(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==e?(c=()=>{s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t&&(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current?(o.current=!0,X.warning(r({id:`HGNCsl`}),{id:jO,duration:1/0})):o.current&&e===`synced`&&(o.current=!1,X.success(r({id:`GhjUB_`}),{id:jO,duration:3e3})))},l=[e,t,r],n[0]=r,n[1]=t,n[2]=e,n[3]=c,n[4]=l):(c=n[3],l=n[4]),(0,Q.useEffect)(c,l)}var NO=4,PO=3,FO={Bird:bc,Cat:Ec,Dog:Pc,Fish:zc,Mouse:dl,Rabbit:ul,Shrimp:vl,Snail:yl,Squirrel:Sl,Turtle:Dl};Object.freeze(Object.keys(FO));function IO(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(FO,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var LO={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function RO(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=IO(n),c=s.kind===`animal`?FO[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=Bi(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Pr(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)(tr,{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)(gr,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(dr,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function zO(e){let t=LO[e.icon];return e.displayName||t||Y._({id:`iEQQyu`})}function BO(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 VO(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=ht(),{presence:u,agentId:d}=n,f=zO(u),p=BO(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)(la,{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)(la,{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)(tr,{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)(gr,{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)(dr,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function HO(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?Y._({id:`9euN0m`,values:{count:n}}):Y._({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)(H,{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)(RO,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(VO,{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 m;return t[18]!==u||t[19]!==f?(m=(0,Z.jsxs)(p,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=m):m=t[20],m}function UO(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(RO,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(VO,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function WO(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ht(),{current:s,crossDoc:c}=kO(t,r,n);if(MO($S(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,NO),n;e[6]===s?n=e[7]:(n=s.slice(NO),e[6]=s,e[7]=n);let r=n,u=c.slice(0,PO),d;e[8]===c?d=e[9]:(d=c.slice(PO),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=>UO(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)(HO,{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=>UO(e,p,!0,m)),f.length>0?(0,Z.jsx)(HO,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var GO=`.md`,KO=/\.(md|mdx)$/i;function qO(e,t=GO){return`${e}${t}`}function JO(e){return hk(e).replace(KO,``)}function YO(e){return ci(e)?QO(e.path):ui(e)?e.path:qO(e.docName,e.docExt)}function XO(e){let t=hk(e).match(KO);return t?`.${t[1].toLowerCase()}`:void 0}function ZO(e){return hk(e)}function QO(e){let t=hk(e.trim());return t?`${t}/`:``}function $O(e){return e.endsWith(`/`)?ZO(e):JO(e)}function ek(e){return e.map(YO)}function tk(e){return[...e].sort().join(`\0`)}function nk(e){return tk(ek(e))}function rk(e){let t=new Set;for(let n of e){if(ci(n)){let e=QO(n.path);e&&t.add(e)}let e=(ci(n)||ui(n)?n.path:n.docName).split(`/`).filter(Boolean),r=ci(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function ik(e){if(!e)return[];let t=hk(e.replace(KO,``)).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 ak(e,t,n){let r=XO(e);if(r)return r;let i=n.find(e=>Fn(e)&&e.docName===t);return i?i.docExt??GO:mk(e).includes(`.`)?void 0:GO}function ok(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(!ui(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 sk(e,t,n){if(XO(e))return null;let r=n.find(e=>ui(e)&&e.path===t);return r?r.path:mk(e).includes(`.`)?t:ok(t,n)}function ck(e,t){let n=e.kind===`directory`,r=n?ZO(e.path):JO(e.path);if(n)return{kind:`folder`,name:hk(mk(e.path)).replace(KO,``),path:r,treePath:uk(e.path,!0)};let i=sk(e.path,r,t);if(i)return{kind:`asset`,name:hk(mk(i)),path:i,treePath:i};let a=ak(e.path,r,t);return{kind:`file`,name:hk(mk(e.path)).replace(KO,``),path:r,treePath:uk(e.path,!1),docExt:a}}function lk(e){return e.kind===`directory`?ZO(e.path):e.path}function uk(e,t){return t?QO(e):KO.test(e)?e:`${e}${GO}`}function dk(e,t,n){let r=QO(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}${GO}`;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 fk(e,t){return e===`file`?uk(t,!1):`${ZO(t)}/index${GO}`}function pk(e,t){return t.kind===`root`||t.directoryPath==null?mk(e):`${t.directoryPath}${mk(e)}`}function mk(e){let t=hk(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function hk(e){return e.endsWith(`/`)?e.slice(0,-1):e}function gk(e,t){return t.trim()}function _k(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function vk(e,t){let n=gk(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function yk(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=>Fn(e)?{...e,docName:i.get(e.docName)??e.docName}:ci(e)?{...e,path:Ek(e.path,n)}:ui(e)?{...e,path:a.get(e.path)??Ek(e.path,n)}:e)}function bk(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=>Fn(e)?!i.has(e.docName)&&!Ak(e.docName,n):ci(e)?!Ak(e.path,n):ui(e)?!a.has(e.path)&&!Ak(e.path,n):!0)}function xk(e,t){if(e.kind!==`asset`||t.some(t=>ui(t)&&t.path===e.path))return e;let n=ok(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function Sk(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>Dk(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Fn(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=>ci(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(Fn(i)){let e=kk(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(ci(i)){let e=Ok(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function Ck(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function wk(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function Tk(e,t){let n=e.kind===`file`?qO(e.path,e.docExt):e.path;return Ch(t.contentDir,n,t.pathSeparator)}function Ek(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 Dk(e,t){return Fn(e)&&Fn(t)?e.docName===t.docName:ci(e)&&ci(t)||ui(e)&&ui(t)?e.path===t.path:!1}function Ok(e,t,n){return e===t?n:kk(e,t,n)}function kk(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function Ak(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function jk(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)(Du,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function Mk(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=Ui(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ou,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nk(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)(Fu,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function Pk(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=Ui(`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)(ku,{children:(0,Z.jsx)(Au,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fk(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=Ui(`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)(ju,{"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 Ik(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=Ui(`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)(_s,{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)(Iu,{"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 Lk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Ui(`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)(Lu,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Rk(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=Ui(`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)(Nu,{children:(0,Z.jsx)(gs,{})})}),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)(Mu,{"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 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=Ui(`-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)(Pu,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Bk=[`.md`,`.mdx`],Vk=`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`,Hk=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,Uk=Ui(Hk,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),Wk=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,Gk=`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 focus-visible:opacity-100`;function Kk(e){return Ui(Gk,e?`opacity-100`:`pointer-events-none opacity-0 group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100`)}function qk(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function Jk(e){let t=ki(e);window.location.hash!==t&&(window.location.hash=t)}function Yk(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function Xk(e,t){let n=[t,...Bk].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 Zk(e){let t=(0,$.c)(26),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({tabId:o,disabled:n,ref:r,style:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]!==n||t[7]!==o?(s={id:o,disabled:n},t[6]=n,t[7]=o,t[8]=s):s=t[8];let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=Za(s),m;t[9]===d?m=t[10]:(m=so.Transform.toString(d),t[9]=d,t[10]=m);let h=p?.5:i?.opacity,g=p?1:i?.zIndex,_;t[11]!==i||t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==f?(_={...i,transform:m,transition:f,opacity:h,zIndex:g},t[11]=i,t[12]=m,t[13]=h,t[14]=g,t[15]=f,t[16]=_):_=t[16];let v=_,y;t[17]!==r||t[18]!==u?(y=function(e){u(e),typeof r==`function`?r(e):r&&`current`in r&&(r.current=e)},t[17]=r,t[18]=u,t[19]=y):y=t[19];let b=y,x;return t[20]!==c||t[21]!==b||t[22]!==l||t[23]!==a||t[24]!==v?(x=(0,Z.jsx)(`div`,{ref:b,style:v,...a,...c,...l}),t[20]=c,t[21]=b,t[22]=l,t[23]=a,t[24]=v,t[25]=x):x=t[25],x}function Qk(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=Gt(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=Gt(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)(Mk,{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)(Fk,{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)(Fk,{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)(Fk,{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)(zk,{}),(0,Z.jsx)(Fk,{"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)(Pk,{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)(jk,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function $k(e){let t=(0,$.c)(20),{accessibleLabel:n,closeTab:r,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=i();if(a){let e;t[0]!==c||t[1]!==n?(e=c({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=c,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==o||t[4]!==s?(r=e=>{e.stopPropagation(),s(o)},t[3]=o,t[4]=s,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(ll,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let l;t[10]!==c||t[11]!==n?(l=c({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=c,t[11]=n,t[12]=l):l=t[12];let u;t[13]!==r||t[14]!==o?(u=e=>{e.stopPropagation(),r(o)},t[13]=r,t[14]=o,t[15]=u):u=t[15];let d;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(cs,{"aria-hidden":`true`}),t[16]=d):d=t[16];let f;return t[17]!==l||t[18]!==u?(f=(0,Z.jsx)(Xi,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:`mr-1.5`,onClick:u,children:d}),t[17]=l,t[18]=u,t[19]=f):f=t[19],f}function eA(e){let t=(0,$.c)(1),{docName:n}=e;if(NS(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Nr,{"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 tA(){let e=(0,$.c)(69),{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:b,pinnedTabIds:x,remapTabsForRename:S,reorderTabs:C,unpinTab:w,visibleTabIds:T}=ht(),{_:E}=i(),{pageMeta:D}=ji(),O=(0,Q.useRef)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(null),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(null),H=(0,Q.useRef)(t),U;e[0]!==n||e[1]!==t||e[2]!==a?(U=n??(a?ce(a):t?Oe(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=U):U=e[3];let W=U,G;e[4]!==r||e[5]!==W||e[6]!==h||e[7]!==g||e[8]!==v?(G=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:W?`${W}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=W,e[6]=h,e[7]=g,e[8]=v,e[9]=G):G=e[9];let ee=G,te,K;e[10]===t?(te=e[11],K=e[12]):(te=()=>{H.current=t},K=[t],e[10]=t,e[11]=te,e[12]=K),(0,Q.useEffect)(te,K);let q,ne;e[13]===ee?(q=e[14],ne=e[15]):(q=()=>{ee&&(O.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},ne=[ee],e[13]=ee,e[14]=q,e[15]=ne),(0,Q.useEffect)(q,ne);let re,ie;e[16]===k?(re=e[17],ie=e[18]):(re=()=>{k&&(R.current?.focus(),R.current?.select())},ie=[k],e[16]=k,e[17]=re,e[18]=ie),(0,Q.useEffect)(re,ie);let ae,oe;e[19]!==v||e[20]!==k?(ae=()=>{!k||v.includes(k.tabId)||(B.current=!0,V.current=null,A(null),M(``),F(null),L(!1))},oe=[v,k],e[19]=v,e[20]=k,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);B.current=!1,V.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),F(null)},le=function(){B.current=!0,V.current=null,A(null),M(``),F(null),L(!1)},ue=async function(){if(B.current){B.current=!1;return}if(z.current)return;let e=k?.docName;if(!e){le();return}let t=gk(`file`,Xk(j,D.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){le();return}if(t===V.current){R.current?.focus();return}if(!_k(t)){F(E({id:`P8yDjG`})),R.current?.focus();return}let i=vk({kind:`file`,path:e,name:r},t);z.current=!0,L(!0),F(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(B.current){L(!1),z.current=!1;return}let r=await Et(n,`Server error (HTTP ${n.status})`);if(!r.ok){F(r.title),L(!1),z.current=!1,V.current=t,R.current?.focus();return}let a=P(hi,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=H.current,s=Ck(o,a);qt(a);let c=!0;try{let e=wk(a,p(),m);await Promise.all(e.map(e=>l(e))),S(a),Jr([`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(E({id:`MUBR8r`}))}B.current=!0,A(null),M(``),F(null),L(!1),z.current=!1,V.current=null,c&&s&&s!==o&&Jk(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),F(E({id:`HIb0vl`})),L(!1),z.current=!1,V.current=t,R.current?.focus()}},de=typeof window<`u`&&window.okDesktop!=null,pe;e[23]===g?pe=e[24]:(pe=new Set(g),e[23]=g,e[24]=pe);let me=pe,he;e[25]!==u||e[26]!==f||e[27]!==me?(he=function(e){let t=[],n=[];for(let r of e)me.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[25]=u,e[26]=f,e[27]=me,e[28]=he):he=e[28];let ge=he,_e;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(_e={activationConstraint:{distance:8}},e[29]=_e):_e=e[29];let ve;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(ve={coordinateGetter:Da},e[30]=ve):ve=e[30];let ye=ro(ao(Lo,_e),ao(Na,ve)),be;e[31]!==C||e[32]!==T?(be=function(e){let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=T.indexOf(t),i=T.indexOf(n);r<0||i<0||r===i||C(_a([...T],r,i),t)},e[31]=C,e[32]=T,e[33]=be):be=e[33];let xe=be,Se=de?``:void 0,Ce;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=Ui(`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]`,de&&`[-webkit-app-region:drag]`),e[34]=Ce):Ce=e[34];let we=Yk,Te;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Te=Ui(`flex items-end gap-1`,de&&`[-webkit-app-region:no-drag]`),e[35]=Te):Te=e[35];let Ee=Ta,De=ja,ke;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(ke={container:typeof document<`u`?document.body:void 0},e[36]=ke):ke=e[36];let Ae=ts,je;e[37]===T?je=e[38]:(je=[...T],e[37]=T,e[38]=je);let Me=$a,Ne=T.map(e=>{if(me.has(e)){let t=e===r;return(0,Z.jsx)(Qk,{tabId:e,canPin:!1,openTabs:T,closeTab:u,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(Zk,{tabId:e,"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Ui(Vk,t?Hk:Uk),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":E({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:Wk,onClick:()=>c(e),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":E({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:Kk(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(cs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=Fe(e),n=e===W,i=x.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=y(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(Qk,{tabId:e,openTabs:T,closeTab:d,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(Zk,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ui(Vk,n?Hk:Uk),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:Wk,onClick:()=>{o(e)},children:[s&&(0,Z.jsx)(`span`,{className:Ui(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Ui(`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)($k,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=y(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(Qk,{tabId:e,openTabs:T,closeTab:d,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(Zk,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ui(Vk,n?Hk:Uk),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:Wk,onClick:()=>{o(e)},children:[s?(0,Z.jsx)(`span`,{className:Ui(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Ui(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)($k,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})},e)}let a=t.docName,l=D.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=y(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=k?.tabId===e,S=`editor-tab-rename-error-${qk(a)}`;return(0,Z.jsx)(Qk,{disabled:v,tabId:e,openTabs:T,closeTab:d,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsx)(Zk,{tabId:e,disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ui(Vk,n?Hk:Uk,v&&N&&`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)(Qx,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(rS,{ref:R,value:j,disabled:I,"aria-label":E({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":N?!0:void 0,"aria-describedby":N?S:void 0,"aria-busy":I||void 0,title:N??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=>{M(Xk(e.target.value,l)),F(null),V.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ue()):e.key===`Escape`&&(e.preventDefault(),le())},onBlur:ue}),(0,Z.jsx)(eS,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(nS,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),N?(0,Z.jsx)(`span`,{id:S,role:`alert`,className:`sr-only`,children:N}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:Wk,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,a)},children:[(0,Z.jsx)(eA,{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)($k,{accessibleLabel:g,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})})},e)}),Pe;e[39]!==Ae||e[40]!==je||e[41]!==Me||e[42]!==Ne?(Pe=(0,Z.jsx)(Ae,{items:je,strategy:Me,children:Ne}),e[39]=Ae,e[40]=je,e[41]=Me,e[42]=Ne,e[43]=Pe):Pe=e[43];let Ie;e[44]!==Ee||e[45]!==xe||e[46]!==ye||e[47]!==De||e[48]!==ke||e[49]!==Pe?(Ie=(0,Z.jsx)(Ee,{sensors:ye,collisionDetection:De,onDragEnd:xe,accessibility:ke,children:Pe}),e[44]=Ee,e[45]=xe,e[46]=ye,e[47]=De,e[48]=ke,e[49]=Pe,e[50]=Ie):Ie=e[50];let Le;e[51]===E?Le=e[52]:(Le=E({id:`3YvS-c`}),e[51]=E,e[52]=Le);let Re;e[53]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(fe,{"aria-hidden":`true`}),e[53]=Re):Re=e[53];let ze;e[54]!==_||e[55]!==Le?(ze=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Le,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Re})}),e[54]=_,e[55]=Le,e[56]=ze):ze=e[56];let Be;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsx)(gr,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[57]=Be):Be=e[57];let Ve;e[58]===ze?Ve=e[59]:(Ve=(0,Z.jsxs)(dr,{children:[ze,Be]}),e[58]=ze,e[59]=Ve);let He;e[60]!==Te||e[61]!==Ie||e[62]!==Ve?(He=(0,Z.jsxs)(`div`,{className:Te,children:[Ie,Ve]}),e[60]=Te,e[61]=Ie,e[62]=Ve,e[63]=He):He=e[63];let Ue;return e[64]!==Se||e[65]!==Ce||e[66]!==we||e[67]!==He?(Ue=(0,Z.jsx)(`div`,{ref:O,"data-electron-drag":Se,className:Ce,onWheel:we,children:He}),e[64]=Se,e[65]=Ce,e[66]=we,e[67]=He,e[68]=Ue):Ue=e[68],Ue}function nA(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 rA(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 iA=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:Zt},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:_d},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:Yn},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:nA},{label:`Twitter`,href:`https://x.com/inkeep`,icon:rA}],aA=()=>{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)(pt,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(H,{asChild:!0,children:(0,Z.jsxs)(Xi,{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)(dr,{children:[o,(0,Z.jsx)(gr,{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=iA.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=>Ka(e,r),onAuxClick:e=>Ka(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 m;e[10]!==u||e[11]!==f?(m=(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]=m):m=e[12];let h;return e[13]!==n||e[14]!==m?(h=(0,Z.jsxs)(p,{open:n,onOpenChange:r,children:[c,m]}),e[13]=n,e[14]=m,e[15]=h):h=e[15],h};function oA(e){let t=(0,$.c)(63),{input:n}=e,{_:r}=i(),{states:a,refresh:o}=Xh(),{dispatch:c}=zh(),{merged:l}=vt(),u=l?.appearance?.preview?.autoOpen??!0,[d,f]=(0,Q.useState)(!1);if(Wm())return null;let p=typeof window<`u`&&window.okDesktop!=null,m;t[0]===o?m=t[1]:(m=e=>{f(e),e&&o()},t[0]=o,t[1]=m);let h=m,g=n===null,_;t[2]!==u||t[3]!==n?(_=n!==null&&n.docContext!==null?nr(n.docContext.relativePath,u):``,t[2]=u,t[3]=n,t[4]=_):_=t[4];let v=_,y;t[5]!==c||t[6]!==n?(y=e=>{n!==null&&c(e.id,n)},t[5]=c,t[6]=n,t[7]=y):y=t[7];let b=y,x,S,C,w,T,E,D,O,k,A,j,M;if(t[8]!==h||t[9]!==b||t[10]!==n||t[11]!==d||t[12]!==v||t[13]!==a||t[14]!==g){let e;t[27]===a?e=t[28]:(e=e=>a[e.id]?.installed===!0,t[27]=a,t[28]=e);let r=qm.filter(e);C=a[`claude-code`]?.installed===!0;let i;t[29]!==n||t[30]!==v?(i=()=>{n!==null&&fb(v)},t[29]=n,t[30]=v,t[31]=i):i=t[31],w=i,S=Ga,M=d,T=h;let o,c;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ca,{className:`size-3.5`}),c=(0,Z.jsx)(s,{id:`xWEvuo`}),t[32]=o,t[33]=c):(o=t[32],c=t[33]);let l;t[34]===g?l=t[35]:(l=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Uo,{asChild:!0,children:(0,Z.jsxs)(Xi,{variant:`ghost`,size:`sm`,disabled:g,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,children:[o,c]})})}),t[34]=g,t[35]=l);let u;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(gr,{children:(0,Z.jsx)(s,{id:`xWEvuo`})}),t[36]=u):u=t[36],t[37]===l?E=t[38]:(E=(0,Z.jsxs)(dr,{children:[l,u]}),t[37]=l,t[38]=E),x=vo,D=`end`,O=`min-w-[220px]`,k=`open-in-agent-menu`,t[39]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(jo,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`O7_W_a`})}),t[39]=A):A=t[39];let f;t[40]!==b||t[41]!==v||t[42]!==a?(f=e=>{let t=a[e.id];return(0,Z.jsx)(pb,{target:e,installState:t,isElectronHost:p,prompt:v,onSelect:()=>b(e)},e.id)},t[40]=b,t[41]=v,t[42]=a,t[43]=f):f=t[43],j=r.map(f),t[8]=h,t[9]=b,t[10]=n,t[11]=d,t[12]=v,t[13]=a,t[14]=g,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E,t[21]=D,t[22]=O,t[23]=k,t[24]=A,t[25]=j,t[26]=M}else x=t[15],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20],D=t[21],O=t[22],k=t[23],A=t[24],j=t[25],M=t[26];let N;t[44]!==r||t[45]!==C||t[46]!==w||t[47]!==n?(N=C?null:(0,Z.jsxs)(Ko,{onSelect:w,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":r({id:`aA51jP`}),children:[(0,Z.jsx)(ut,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}),t[44]=r,t[45]=C,t[46]=w,t[47]=n,t[48]=N):N=t[48];let P;t[49]!==x||t[50]!==N||t[51]!==D||t[52]!==O||t[53]!==k||t[54]!==A||t[55]!==j?(P=(0,Z.jsxs)(x,{align:D,className:O,"data-testid":k,children:[A,j,N]}),t[49]=x,t[50]=N,t[51]=D,t[52]=O,t[53]=k,t[54]=A,t[55]=j,t[56]=P):P=t[56];let F;return t[57]!==S||t[58]!==T||t[59]!==E||t[60]!==P||t[61]!==M?(F=(0,Z.jsxs)(S,{open:M,onOpenChange:T,children:[E,P]}),t[57]=S,t[58]=T,t[59]=E,t[60]=P,t[61]=M,t[62]=F):F=t[62],F}var sA=50,cA=()=>{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,Lx.preload()},sA))},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=Jm)},u=(0,Z.jsx)(gl,{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)(tr,{asChild:!0,children:(0,Z.jsxs)(Xi,{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)(dr,{children:[d,(0,Z.jsx)(gr,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function lA(e){let t=(0,$.c)(32),{onClickWhenNoRemote:n}=e,{_:r}=i(),{activeDocName:a}=ht(),{status:o}=Io(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),m,h;if(t[0]===u?(m=t[1],h=t[2]):(m=()=>{!u||!f.current||(f.current.focus(),f.current.select())},h=[u],t[0]=u,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h),!a)return null;let g=o?.hasRemote===!0,_;t[3]!==r||t[4]!==a||t[5]!==c||t[6]!==g||t[7]!==n?(_=async function(){if(!c&&a){l(!0),d(null);try{let e=await po({docName:a,hasRemote:g,onClickWhenNoRemote:n},{clipboardWrite:Qo,toastSuccess:mA,toastError:pA,logEvent:fA});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{X.error(r({id:`u3YnKw`}))}l(!1)}},t[3]=r,t[4]=a,t[5]=c,t[6]=g,t[7]=n,t[8]=_):_=t[8];let v=_,y=u!==null,b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||d(null)},t[9]=b):b=t[9];let x;t[10]===r?x=t[11]:(x=r({id:`F4IYWe`}),t[10]=r,t[11]=x);let S,C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(_l,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[12]=S,t[13]=C):(S=t[12],C=t[13]);let w;t[14]!==c||t[15]!==v||t[16]!==x?(w=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(it,{asChild:!0,children:(0,Z.jsxs)(Xi,{variant:`ghost`,size:`sm`,"aria-label":x,onClick:v,disabled:c,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})})}),t[14]=c,t[15]=v,t[16]=x,t[17]=w):w=t[17];let T;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(gr,{children:(0,Z.jsx)(s,{id:`Z8lGw6`})}),t[18]=T):T=t[18];let E;t[19]===w?E=t[20]:(E=(0,Z.jsxs)(dr,{children:[w,T]}),t[19]=w,t[20]=E);let D;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[21]=D):D=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[22]=O):O=t[22];let k=u??``,A;t[23]===r?A=t[24]:(A=r({id:`5-FeN2`}),t[23]=r,t[24]=A);let j;t[25]!==k||t[26]!==A?(j=(0,Z.jsxs)(B,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[D,O,(0,Z.jsx)(vs,{ref:f,readOnly:!0,value:k,onFocus:dA,onClick:uA,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":A})]}),t[25]=k,t[26]=A,t[27]=j):j=t[27];let M;return t[28]!==E||t[29]!==j||t[30]!==y?(M=(0,Z.jsxs)(p,{open:y,onOpenChange:b,children:[E,j]}),t[28]=E,t[29]=j,t[30]=y,t[31]=M):M=t[31],M}function uA(e){return e.currentTarget.select()}function dA(e){return e.currentTarget.select()}function fA(e){return console.log(e)}function pA(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function mA(e){return X.success(e)}function hA(e){let t=(0,$.c)(45),{onSignIn:n,onSetIdentity:r,onOpenSearch:a}=e,{_:o}=i(),{activeDocName:c,activeTarget:l}=ht(),{state:u}=MD(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=Zo(`toggle-files-sidebar`),t[0]=d):d=t[0];let f=d,p=Zo(`command-palette`),m=ko(),[h,g]=(0,Q.useState)(!1),_;bb0:{if(l===null){let e;t[1]===m?e=t[2]:(e=Eh({workspace:m}),t[1]=m,t[2]=e),_=e;break bb0}if(l.kind===`folder`){if(!m){_=null;break bb0}let e;t[3]!==l.folderPath||t[4]!==m?(e=Dh({folderRelativePath:l.folderPath,workspace:m}),t[3]=l.folderPath,t[4]=m,t[5]=e):e=t[5],_=e;break bb0}let e;t[6]!==c||t[7]!==m?(e=Th({docName:c,workspace:m}),t[6]=c,t[7]=m,t[8]=e):e=t[8],_=e}let v=_,y=typeof window<`u`&&window.okDesktop!=null,b=u===`collapsed`,x=y?``:void 0,S=y&&b&&`pl-[78px]`,C;t[9]===S?C=t[10]:(C=Ui(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,y&&`[-webkit-app-region:drag]`,S,y&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[9]=S,t[10]=C);let w;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(LD,{className:Ui(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),t[11]=w):w=t[11];let T;t[12]===u?T=t[13]:(T=(0,Z.jsxs)(dr,{children:[w,(0,Z.jsx)(gr,{children:u===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:f}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:f}})})]}),t[12]=u,t[13]=T);let E=b&&a&&(0,Z.jsxs)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":o({id:`IN4UX8`,values:{searchShortcut:p}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Ui(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(he,{"aria-hidden":`true`})})}),(0,Z.jsx)(gr,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:p}})})]}),D,O;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(mo,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),O=(0,Z.jsx)(tA,{}),t[14]=D,t[15]=O):(D=t[14],O=t[15]);let k;t[16]!==T||t[17]!==E?(k=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[T,E,D,O]}),t[16]=T,t[17]=E,t[18]=k):k=t[18];let A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(A=Ui(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`),t[19]=A):A=t[19];let j;t[20]===v?j=t[21]:(j=(0,Z.jsx)(oA,{input:v}),t[20]=v,t[21]=j);let M;t[22]===g?M=t[23]:(M=(0,Z.jsx)(lA,{onClickWhenNoRemote:()=>g(!0)}),t[22]=g,t[23]=M);let N;t[24]!==h||t[25]!==g?(N=(0,Z.jsx)($o,{open:h,onOpenChange:g}),t[24]=h,t[25]=g,t[26]=N):N=t[26];let P;t[27]!==r||t[28]!==n?(P=(0,Z.jsx)(Oo,{onSignIn:n,onSetIdentity:r}),t[27]=r,t[28]=n,t[29]=P):P=t[29];let F,I,L,R,z;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(WO,{}),I=(0,Z.jsx)(mo,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),L=(0,Z.jsx)(Bu,{}),R=(0,Z.jsx)(cA,{}),z=(0,Z.jsx)(aA,{}),t[30]=F,t[31]=I,t[32]=L,t[33]=R,t[34]=z):(F=t[30],I=t[31],L=t[32],R=t[33],z=t[34]);let B;t[35]!==j||t[36]!==M||t[37]!==N||t[38]!==P?(B=(0,Z.jsxs)(`div`,{className:A,children:[j,M,N,P,F,I,L,R,z]}),t[35]=j,t[36]=M,t[37]=N,t[38]=P,t[39]=B):B=t[39];let V;return t[40]!==k||t[41]!==B||t[42]!==x||t[43]!==C?(V=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:C,children:[k,B]}),t[40]=k,t[41]=B,t[42]=x,t[43]=C,t[44]=V):V=t[44],V}function gA(e){let t=(0,$.c)(38),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]=Dg(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(J_[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),b=yo(),{projectLocalConfig:x,projectLocalSynced:S}=vt(),{activeDocName:C}=ht(),w=b?.hasRemote,T=b?.pushPermission?.checkStatus,E;t[2]!==v||t[3]!==x||t[4]!==S||t[5]!==w||t[6]!==T?(E=jg({autoSyncOnboardingDismissed:v,hasRemote:w,projectLocalSynced:S,projectLocalConfig:x,pushPermissionCheckStatus:T}),t[2]=v,t[3]=x,t[4]=S,t[5]=w,t[6]=T,t[7]=E):E=t[7];let D=E,O,k;t[8]===C?(O=t[9],k=t[10]):(O=()=>{let e=function(e){let t=e.detail;t&&C&&ec(C,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(yg,e),()=>window.removeEventListener(yg,e)},k=[C],t[8]=C,t[9]=O,t[10]=k),(0,Q.useEffect)(O,k),Og(b?.pausedReason);let A;t[11]===s?A=t[12]:(A=function(e){l(e),s(e)},t[11]=s,t[12]=A);let j=A,M;t[13]===a?M=t[14]:(M=async function(){_(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?X.success(a({id:`rdE6_3`})):(console.error(`[save-version] failed:`,await e.text()),X.error(a({id:`q7zsRM`})))}catch(e){console.error(`[save-version] failed:`,e),X.error(a({id:`q7zsRM`}))}_(!1)},t[13]=a,t[14]=M);let N=M,P,F;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{p(`auth`),d(!0)},P=()=>{p(`identity`),d(!0)},t[15]=P,t[16]=F):(P=t[15],F=t[16]);let I;t[17]===r?I=t[18]:(I=(0,Z.jsx)(hA,{onSignIn:F,onSetIdentity:P,onOpenSearch:r}),t[17]=r,t[18]=I);let L;t[19]!==m||t[20]!==c||t[21]!==j||t[22]!==N||t[23]!==g?(L=(0,Z.jsx)(yO,{editorMode:c,onModeChange:j,activeTab:m,onActiveTabChange:h,onSaveVersion:N,saving:g}),t[19]=m,t[20]=c,t[21]=j,t[22]=N,t[23]=g,t[24]=L):L=t[24];let R=f===`identity`,z;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{d(!1)},t[25]=z):z=t[25];let B;t[26]!==u||t[27]!==R?(B=(0,Z.jsx)(Wa,{open:u,onOpenChange:d,identityPrompt:R,onSuccess:z}),t[26]=u,t[27]=R,t[28]=B):B=t[28];let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>y(!0),t[29]=V):V=t[29];let H;t[30]===D?H=t[31]:(H=(0,Z.jsx)(kg,{open:D,onResolved:V}),t[30]=D,t[31]=H);let U;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(gg,{}),t[32]=U):U=t[32];let W;return t[33]!==I||t[34]!==L||t[35]!==B||t[36]!==H?(W=(0,Z.jsxs)(Z.Fragment,{children:[I,L,B,H,U]}),t[33]=I,t[34]=L,t[35]=B,t[36]=H,t[37]=W):W=t[37],W}function _A(e){let t=ki(Kr(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function vA(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=ya();if(n)return null;if(r!==null){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)(Nr,{"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)(Nr,{"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(yA),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 yA(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Xi,{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:()=>_A(e.file),children:[(0,Z.jsx)(Nr,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var bA=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
31
+ `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Is(t,{style:t=>Zs(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 lE.set(t.changes,i),i}function fE(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(vT).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(cE);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Ns.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:sE.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function pE(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(vT).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(cE).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 mE(e){let t=new zs;for(let n of e.field(vT)){let r=e.facet(hT).overrideChunk&&_E(e,n);t.add(n.fromB,n.fromB,dE(e,n,!!r))}return t.finish()}var hE=Fs.define({create:e=>mE(e),update(e,t){return t.state.field(vT,!1)==t.startState.field(vT,!1)?e:mE(t.state)},provide:e=>Ws.decorations.from(e)}),gE=new WeakMap;function _E(e,t){let n=gE.get(t);if(n!==void 0)return n;n=null;let r=e.field(cE),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(Rs.widget({widget:new vE(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(PT.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return gE.set(t,n),n}var vE=class extends js{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}},yE=new class extends Gs{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},bE=Rs.line({class:`cm-inlineChangedLine`});function xE(e,t,n,r){let i=_E(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,yE),n.add(o.from,o.from,bE);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 SE=$t({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),CE=ie({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),wE=Ws.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 TE({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 EE(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:_}=ar(),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`?SE:CE,u=[Ws.editable.of(!1),Ps.readOnly.of(!0)],d=[nc,de(),...u,l,Ws.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new Ws({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=TE({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 Ws({doc:p,extensions:[nc,de(),Ws.editable.of(!1),l,wE,Ws.lineWrapping,oE({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),Ws.updateListener.of(e=>{let t=yT(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=yT(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new nE({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new Ws({doc:p,extensions:[...d,oE({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 Ws)||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 Ws)||M(e)},t[13]=A):A=t[13];let j=A,N=b===0,P;t[14]!==f||t[15]!==b?(P=b===null?``:b===0?f({id:`lPzyrU`}):Y._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=P):P=t[16];let F=P,I;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=I):I=t[17];let L;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,Sc.createPortal)((0,Z.jsx)(Xi,{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),L=C.map(e),t[18]=f,t[19]=C,t[20]=L}else L=t[20];let R;t[23]!==N||t[24]!==o||t[25]!==F||t[26]!==d||t[27]!==u?(R=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 ${N?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:F}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(Xi,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(Xi,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(Xi,{variant:`default`,size:`sm`,disabled:!N,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=N,t[24]=o,t[25]=F,t[26]=d,t[27]=u,t[28]=R):R=t[28];let z;return t[29]!==R||t[30]!==L?(z=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[I,L,R]}),t[29]=R,t[30]=L,t[31]=z):z=t[31],z}async function DE(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 OE(e,t){return DE(e,`content`,t)}async function kE(e){return DE(e,`mine`)}async function AE(e){return DE(e,`theirs`)}async function jE(e){return DE(e,`delete`)}async function ME(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 NE(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=ya(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Kr(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),ME(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 OE(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)(EE,{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(jE),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)(Xi,{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(AE),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)(Xi,{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)(EE,{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(kE),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)(Xi,{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(jE),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)(Xi,{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)(EE,{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 PE(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(zt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var FE=`__back-nav__`;function IE(e){return e instanceof Ie||e instanceof yt||e instanceof ke||e instanceof $e||e instanceof jt||e instanceof at?e.docName:null}function LE(e){if(e instanceof Ie){let t=e.docName;return{title:Y._({id:`Jejur6`}),summary:Y._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof yt){let t=e.docName;return{title:Y._({id:`V7QxyT`}),summary:Y._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof ke){let t=e.docName;return{title:Y._({id:`1di5fu`}),summary:Y._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof $e){let t=e.docName;return{title:Y._({id:`wvbc1r`}),summary:Y._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof jt)return{title:Y._({id:`Gfr4fu`}),summary:Y._({id:`j6LB7S`})};if(e instanceof at){let t=e.docName;return{title:Y._({id:`vv7kpg`}),summary:Y._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Y._({id:`W5A0Ly`});return{title:Y._({id:`29VNqC`}),summary:t}}function RE(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=LE(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)(Vb,{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)(Xi,{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)(Xi,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(lt(IE(n)??i),o(a),r(FE))},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 zE(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)(RE,{...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]===FE){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}: ${LE(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)(W,{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 BE(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Vi(t);return{map:n,keys:Sr(t),parseError:r}}function VE(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>BE(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=Ii(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Ze(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ft(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)(HE,{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)(UE,{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 HE(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 UE(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 WE(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Vi(t);return{map:n,keys:Sr(t),parseError:r}}function GE(e){let t=(0,$.c)(199),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>WE(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=Ii(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]===j?M=t[9]:(M=ZE(j),t[8]=j,t[9]=M);let N=M,P;t[10]===j?P=t[11]:(P=YE(j),t[10]=j,t[11]=P);let F=ga(N?null:P),I;t[12]!==F||t[13]!==N?(I=!N&&F.state.status===`ready`?F.state.data.folder.frontmatter_defaults??{}:{},t[12]=F,t[13]=N,t[14]=I):I=t[14];let L=I,R;t[15]!==F||t[16]!==N?(R=!N&&F.state.status===`ready`?F.state.data.frontmatterSources:{},t[15]=F,t[16]=N,t[17]=R):R=t[17];let z=R,B;t[18]!==F||t[19]!==N?(B=!N&&F.state.status===`ready`?F.state.data.schemaDeclarations:{},t[18]=F,t[19]=N,t[20]=B):B=t[20];let V=B,H;t[21]!==F||t[22]!==N?(H=!N&&F.state.status===`ready`?F.state.data.schemaSources:{},t[21]=F,t[22]=N,t[23]=H):H=t[23];let U=H,W;t[24]!==r||t[25]!==a?(W=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=zr(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[24]=r,t[25]=a,t[26]=W):W=t[26];let G=W,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[27]=ee):ee=t[27];let te=ee,K;t[28]===r?K=t[29]:(K=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[28]=r,t[29]=K);let q=K,ne;t[30]!==G||t[31]!==q?(ne=function(e,t){te(e),q(G({[e]:t}),[e])},t[30]=G,t[31]=q,t[32]=ne):ne=t[32];let re=ne,ie;t[33]!==G||t[34]!==q?(ie=function(e){te(e),q(G({[e]:null}),[e])},t[33]=G,t[34]=q,t[35]=ie):ie=t[35];let ae=ie,oe;t[36]!==r||t[37]!==a?(oe=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=zr(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[36]=r,t[37]=a,t[38]=oe):oe=t[38];let se=oe,ce;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(ce=function(e,t){return`${e} ${t}`},t[39]=ce):ce=t[39];let le=ce,ue;t[40]!==a||t[41]!==m?(ue=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)=>le(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[40]=a,t[41]=m,t[42]=ue):ue=t[42];let de=ue,pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe={activationConstraint:{distance:4}},t[43]=pe):pe=t[43];let me;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(me={coordinateGetter:Da},t[44]=me):me=t[44];let he=ro(ao(Lo,pe),ao(Na,me)),ge;t[45]!==L||t[46]!==re||t[47]!==p?(ge=function(e,t){let n=p[e]??QE(L[e]);if(n===void 0)return;b(n=>({...n,[e]:t}));let r=Fa(n,t);(!Object.hasOwn(p,e)||!JE(n,r))&&re(e,r)},t[45]=L,t[46]=re,t[47]=p,t[48]=ge):ge=t[48];let _e=ge,ve;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[49]=ve):ve=t[49];let ye=ve,{addPropertySignal:be,clearAddProperty:xe}=Fx(),Se;t[50]!==be||t[51]!==j?(Se=be.get(j)??0,t[50]=be,t[51]=j,t[52]=Se):Se=t[52];let Ce=Se,we,Te;t[53]===Ce?(we=t[54],Te=t[55]):(we=()=>{Ce>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},Te=[Ce],t[53]=Ce,t[54]=we,t[55]=Te),(0,Q.useEffect)(we,Te);let Ee,De;t[56]!==xe||t[57]!==j?(Ee=()=>()=>xe(j),De=[j,xe],t[56]=xe,t[57]=j,t[58]=Ee,t[59]=De):(Ee=t[58],De=t[59]),(0,Q.useEffect)(Ee,De);let Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):ka[e];return{...t,type:e,value:n,error:null}})},t[60]=Oe):Oe=t[60];let ke=Oe,Ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=function(e){S(t=>t&&{...t,value:e})},t[61]=Ae):Ae=t[61];let je=Ae,Me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Me=function(e){S(t=>t&&{...t,name:e,error:null})},t[62]=Me):Me=t[62];let Ne=Me,Pe;t[63]!==r||t[64]!==x||t[65]!==G||t[66]!==p?(Pe=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=G({[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[63]=r,t[64]=x,t[65]=G,t[66]=p,t[67]=Pe):Pe=t[67];let Fe=Pe,Ie;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=function(){S(null)},t[68]=Ie):Ie=t[68];let Le=Ie,Re;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Re=function(e){w({key:e,draft:e,error:null})},t[69]=Re):Re=t[69];let ze=Re,Be;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Be=function(e){w(t=>t&&{...t,draft:e,error:null})},t[70]=Be):Be=t[70];let Ve=Be,He;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(He=function(){w(null)},t[71]=He):He=t[71];let Ue=He,We;t[72]!==r||t[73]!==p||t[74]!==se||t[75]!==C?(We=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=se(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}),te(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[72]=r,t[73]=p,t[74]=se,t[75]=C,t[76]=We):We=t[76];let Ge=We,Ke;t[77]!==p||t[78]!==m?(Ke=m.length>0?m:Object.keys(p),t[77]=p,t[78]=m,t[79]=Ke):Ke=t[79];let qe=Ke,Je;if(t[80]!==qe){Je=new Map;for(let e of qe)Je.set(e,(Je.get(e)??0)+1);t[80]=qe,t[81]=Je}else Je=t[81];let Ye,J,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot;if(t[82]!==x||t[83]!==L||t[84]!==z||t[85]!==g||t[86]!==re||t[87]!==Ge||t[88]!==Je||t[89]!==E||t[90]!==de||t[91]!==p||t[92]!==y||t[93]!==h||t[94]!==ae||t[95]!==C||t[96]!==qe||t[97]!==k||t[98]!==V||t[99]!==U||t[100]!==he||t[101]!==_e){ot=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Object.keys(L).filter(e=>!Object.hasOwn(p,e)).sort(),n=Object.keys(V).filter(e=>!Object.hasOwn(p,e)&&!Object.hasOwn(L,e)).sort();if(qe.length===0&&e.length===0&&n.length===0&&!x&&!h){ot=null;break bb0}it=`property-panel editor-content-aligned pt-4 pb-4 text-sm`,at=`property-panel`,J=xs,tt=!g,t[115]===Symbol.for(`react.memo_cache_sentinel`)?(nt=e=>_(!e),t[115]=nt):nt=t[115];let r=!g,i;t[116]===r?i=t[117]:(i=(0,Z.jsx)(_s,{"data-expanded":r,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[116]=r,t[117]=i);let a;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[118]=a):a=t[118],t[119]===i?rt=t[120]:(rt=(0,Z.jsx)(bs,{asChild:!0,children:(0,Z.jsxs)(Xi,{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:[i,a]})}),t[119]=i,t[120]=rt),Ye=ys,Xe=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[121]===h?Ze=t[122]:(Ze=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)(Nr,{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[121]=h,t[122]=Ze);let o;if(t[123]!==qe){let e;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>le(e,t),t[125]=e):e=t[125],o=qe.map(e),t[123]=qe,t[124]=o}else o=t[124];let c;if(t[126]!==re||t[127]!==Ge||t[128]!==Je||t[129]!==E||t[130]!==p||t[131]!==y||t[132]!==ae||t[133]!==C||t[134]!==qe||t[135]!==k||t[136]!==_e){let e;t[138]!==re||t[139]!==Ge||t[140]!==Je||t[141]!==E||t[142]!==p||t[143]!==y||t[144]!==ae||t[145]!==C||t[146]!==k||t[147]!==_e?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??ri(n),i=C?.key===e?C:null,a=(Je.get(e)??0)>1;return(0,Z.jsx)(Ua,{sortableId:le(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>ze(e),onChangeDraft:Ve,onCommit:Ge,onCancel:Ue},onCommit:t=>re(e,t),onChangeType:t=>_e(e,t),onRemove:()=>ae(e)},`${e}-${t}`)},t[138]=re,t[139]=Ge,t[140]=Je,t[141]=E,t[142]=p,t[143]=y,t[144]=ae,t[145]=C,t[146]=k,t[147]=_e,t[148]=e):e=t[148],c=qe.map(e),t[126]=re,t[127]=Ge,t[128]=Je,t[129]=E,t[130]=p,t[131]=y,t[132]=ae,t[133]=C,t[134]=qe,t[135]=k,t[136]=_e,t[137]=c}else c=t[137];let l;t[149]!==o||t[150]!==c?(l=(0,Z.jsx)(ts,{items:o,strategy:to,children:c}),t[149]=o,t[150]=c,t[151]=l):l=t[151],t[152]!==de||t[153]!==he||t[154]!==l?(Qe=(0,Z.jsx)(Ta,{sensors:he,collisionDetection:ja,onDragEnd:de,children:l}),t[152]=de,t[153]=he,t[154]=l,t[155]=Qe):Qe=t[155];let u;t[156]!==L||t[157]!==z||t[158]!==re||t[159]!==E||t[160]!==k||t[161]!==_e?(u=e=>{let t=L[e],n=QE(t),r=ri(n),i=z[e]??``;return(0,Z.jsx)(Ua,{keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isInherited:!0,badge:(0,Z.jsx)(Ca,{source:i}),onCommit:t=>re(e,t),onChangeType:t=>_e(e,t)},`inherited-${e}`)},t[156]=L,t[157]=z,t[158]=re,t[159]=E,t[160]=k,t[161]=_e,t[162]=u):u=t[162],$e=e.map(u);let d;t[163]!==re||t[164]!==E||t[165]!==k||t[166]!==V||t[167]!==U?(d=e=>{let t=V[e].type,n=U[e]??``;return(0,Z.jsx)(Ua,{keyName:e,value:t===`date`?``:ka[t],declared:t,error:E[e]??null,resetCounter:k[e]??0,badge:(0,Z.jsx)(za,{source:n}),onCommit:t=>re(e,t),onChangeType:qE,typeReadOnly:!0},`declared-${e}`)},t[163]=re,t[164]=E,t[165]=k,t[166]=V,t[167]=U,t[168]=d):d=t[168],et=n.map(d)}t[82]=x,t[83]=L,t[84]=z,t[85]=g,t[86]=re,t[87]=Ge,t[88]=Je,t[89]=E,t[90]=de,t[91]=p,t[92]=y,t[93]=h,t[94]=ae,t[95]=C,t[96]=qe,t[97]=k,t[98]=V,t[99]=U,t[100]=he,t[101]=_e,t[102]=Ye,t[103]=J,t[104]=Xe,t[105]=Ze,t[106]=Qe,t[107]=$e,t[108]=et,t[109]=tt,t[110]=nt,t[111]=rt,t[112]=it,t[113]=at,t[114]=ot}else Ye=t[102],J=t[103],Xe=t[104],Ze=t[105],Qe=t[106],$e=t[107],et=t[108],tt=t[109],nt=t[110],rt=t[111],it=t[112],at=t[113],ot=t[114];if(ot!==Symbol.for(`react.early_return_sentinel`))return ot;let st;t[169]!==L||t[170]!==re||t[171]!==E||t[172]!==p||t[173]!==k||t[174]!==V?(st=!Object.hasOwn(p,`tags`)&&!Object.hasOwn(L,`tags`)&&!Object.hasOwn(V,`tags`)?(0,Z.jsx)(Ua,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>re(`tags`,e),onChangeType:KE},`virtual-tags`):null,t[169]=L,t[170]=re,t[171]=E,t[172]=p,t[173]=k,t[174]=V,t[175]=st):st=t[175];let ct;t[176]!==r||t[177]!==x||t[178]!==Fe?(ct=x?(0,Z.jsx)(La,{draft:x,onChangeName:Ne,onChangeType:ke,onChangeValue:je,onCommit:Fe,onCancel:Le}):(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)(Xi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ye,"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)(fe,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[176]=r,t[177]=x,t[178]=Fe,t[179]=ct):ct=t[179];let lt;t[180]!==Ye||t[181]!==Xe||t[182]!==Ze||t[183]!==Qe||t[184]!==$e||t[185]!==et||t[186]!==st||t[187]!==ct?(lt=(0,Z.jsxs)(Ye,{className:Xe,children:[Ze,Qe,$e,et,st,ct]}),t[180]=Ye,t[181]=Xe,t[182]=Ze,t[183]=Qe,t[184]=$e,t[185]=et,t[186]=st,t[187]=ct,t[188]=lt):lt=t[188];let ut;t[189]!==J||t[190]!==tt||t[191]!==nt||t[192]!==rt||t[193]!==lt?(ut=(0,Z.jsxs)(J,{open:tt,onOpenChange:nt,children:[rt,lt]}),t[189]=J,t[190]=tt,t[191]=nt,t[192]=rt,t[193]=lt,t[194]=ut):ut=t[194];let dt;return t[195]!==it||t[196]!==at||t[197]!==ut?(dt=(0,Z.jsx)(`div`,{className:it,"data-testid":at,children:ut}),t[195]=it,t[196]=at,t[197]=ut,t[198]=dt):dt=t[198],dt}function KE(){}function qE(){}function JE(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function YE(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var XE=/(^|\/)\.ok\/templates\//;function ZE(e){return XE.test(e)}function QE(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>typeof e==`string`?e:JSON.stringify(e)):e==null?``:JSON.stringify(e)}var $E=G(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function eD(e){let t=e.threshold??$E;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function tD(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var nD=G(`ACTIVITY_MOUNT_LIMIT`,3);function rD(){return n(()=>import(`./SourceEditor-ztotrWnx.js`),__vite__mapDeps([46,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,47,24]),import.meta.url)}var iD=(0,Q.lazy)(async()=>({default:(await rD()).SourceEditor}));function aD(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ke(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function oD(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Y._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Y._({id:`Sc1bKE`,values:{docName:e}}):Y._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Y._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Y._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Y._({id:`bmC18N`,values:{docName:e}}):Y._({id:`pAgkuZ`,values:{docName:e}})}:null}function sD(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(x,{name:`activity-pool`,children:(0,Z.jsx)(cD,{...e})}),t[0]=e,t[1]=n),n}function cD(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ht(),{pages:u,loading:d}=ji(),f=aD(c,n,nD),p=(0,Q.useRef)(``),h=f.map(lD).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)j(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;oe(e,t&&t.length>0?t:crypto.randomUUID())}b(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,m(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)(hD,{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 x=f.map(y),S;return t[13]===x?S=t[14]:(S=(0,Z.jsx)(Z.Fragment,{children:x}),t[13]=x,t[14]=S),S}function lD(e){return e.docName}function uD(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&&b(`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&&(b(`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&&b(`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 dD(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)(ib,{}),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)(iD,{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 fD(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)(Bo,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(F,{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)(Xi,{type:`button`,onClick:pD,children:[(0,Z.jsx)(Bo,{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 pD(){return window.location.reload()}function mD(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 hD(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=oD(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=NS(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[y,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==y?(S=()=>{i&&!_?v(!0):!i&&!y&&x(!0)},C=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=eD({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),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&&b(`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=()=>ct(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=()=>{tD({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(b(`ok/cold/first-toggle`,{docName:n.docName,mountId:z(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,B;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==j?(B=f?(0,Z.jsx)(fD,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(zE,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(mD,{html:j}):(0,Z.jsx)(ib,{}),children:(0,Z.jsx)(PE,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(NE,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(VE,{provider:n.provider}),!i&&(0,Z.jsx)(GE,{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)(dD,{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)(Mw,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}`)}):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]=B):B=t[44];let V;t[45]!==r||t[46]!==R||t[47]!==B?(V=(0,Z.jsx)(uD,{isActive:r,initialScrollTop:R,children:B}),t[45]=r,t[46]=R,t[47]=B,t[48]=V):V=t[48];let H;return t[49]!==I||t[50]!==L||t[51]!==V?(H=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:V}),t[49]=I,t[50]=L,t[51]=V,t[52]=H):H=t[52],H}function gD(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function _D(e){let{value:t,unit:n}=gD(e);return n===`rem`?t*16:t}function vD(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var yD=3600*24*7;function bD(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?xD:m,O=g===void 0?yD: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,ee;t[3]===y?(G=t[4],ee=t[5]):(G=()=>{H.current=y},ee=[y],t[3]=y,t[4]=G,t[5]=ee),(0,Q.useEffect)(G,ee);let te=_D(b),K;t[6]===x?K=t[7]:(K=_D(x),t[6]=x,t[7]=K);let q=K,ne;t[8]!==E||t[9]!==k?(ne=function(e){E&&(P.current=!0,j.current=H.current?0:_D(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]=ne):ne=t[10];let re=ne,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==q||t[18]!==te||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{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}=gD(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<=te*w;else if(e<=te){let n=te*(w-1);t=te-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>te*T){a();let t=n(r,M.current,j.current,s),c=Math.max(te,Math.min(q,t)),u=vD(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(te,Math.min(q,u)),f=vD(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,te,q,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=q,t[18]=te,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function xD(){}var SD=3600*24*7,CD=`18rem`,wD=`3rem`,TD=`app-file-sidebar`,ED=`14.625rem`,DD=`32rem`,OD=`sidebar_width`,kD=/^\d+(?:\.\d+)?(?:rem|px)$/,AD=Q.createContext(null);function jD(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${OD}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return kD.test(n)?n:e}function MD(){let e=Q.use(AD);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function ND(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?CD:c,[u]=Q.useState(FD),d;t[8]===u?d=t[9]:(d=()=>HS(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>jD(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=YS();return ZS(`left`,HS(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),QS(`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(PD)},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: ${zS}px)`),t=()=>{let e=HS(u,window.innerWidth,`left`);p(e),C(ZS(`left`,e,YS())===`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(TD)?.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=>{Eo(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":wD,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=Ui(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let ee;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(ee=(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]=ee):ee=t[54];let te;return t[55]!==H||t[56]!==ee?(te=(0,Z.jsx)(AD.Provider,{value:H,children:ee}),t[55]=H,t[56]=ee,t[57]=te):te=t[57],te}function PD(e){return!e}function FD(){return Xn()}function ID(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}=MD();if(d===`none`){let e;t[7]===r?e=t[8]:(e=Ui(`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]:(_=Ui(`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=Ui(`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:TD,"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 LD(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}=MD(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=Sa(`toggle-files-sidebar`);l=Xi,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=TD,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]:(_=Ui(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)(T,{}):(0,Z.jsx)(il,{}),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 RD(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}=MD(),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:ED,maxResizeWidth:DD,setIsDraggingRail:h,widthCookieName:OD,widthCookieMaxAge:SD},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}=bD(_),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=Ui(`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 zD(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}=MD(),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=Ui(`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 BD(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=Ui(`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 VD(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=Ui(`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 HD(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=Ui(`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 UD(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=Ui(`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 WD(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=Ui(`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 GD=Qi(`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 KD(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?Gi:`button`,{state:m}=MD(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Ui(GD({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)(tr,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(gr,{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)(dr,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function qD(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 JD(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=vi.safeParse(t);return n.success?n.data.currentBranch??null:null}var YD=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:qD({fetchBranch:JD,subscribeToEvent:Cr}),XD=YD.subscribe,ZD=YD.getSnapshot;function QD(){return(0,Q.useSyncExternalStore)(XD,ZD,ZD)}function $D(){let e=(0,$.c)(6),t=QD(),n=ko(),{state:r}=MD(),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&&Ya(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 eO(e){let t=(0,$.c)(20),{stats:n,showStats:r}=e,a=r===void 0?!0:r,{_:o}=i(),c=$D();if(!a&&c===null)return null;let{words:l,chars:u,tokens:d}=n,f;t[0]!==o||t[1]!==a?(f=o(a?{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=o,t[1]=a,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(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[3]=p):p=t[3];let m;t[4]===c?m=t[5]:(m=c===null?null:(0,Z.jsx)(tO,{identity:c}),t[4]=c,t[5]=m);let h;t[6]===m?h=t[7]:(h=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:m}),t[6]=m,t[7]=h);let g;t[8]!==u||t[9]!==a||t[10]!==n.chars||t[11]!==n.tokens||t[12]!==n.words||t[13]!==d||t[14]!==l?(g=a?(0,Z.jsxs)(`span`,{className:`flex items-center shrink-0 gap-3`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:n.words.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`gljvbT`,values:{words:l}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:n.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:u}})]}),(0,Z.jsxs)(`span`,{children:[n.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:n.tokens.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:d}})]})]}):null,t[8]=u,t[9]=a,t[10]=n.chars,t[11]=n.tokens,t[12]=n.words,t[13]=d,t[14]=l,t[15]=g):g=t[15];let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(`section`,{"aria-label":f,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[p,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tO(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)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(gr,{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)(tt,{"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 nO(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=Ui(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 rO(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=Ui(`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 iO(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=Ui(`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 aO(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=Ui(`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 oO(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=Ui(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(_s,{}),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 sO=1,cO=2,lO=4;function uO(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}=y(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>lO?[...u.slice(0,sO).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(sO,-cO)},...u.slice(-cO).map((e,t)=>d(e,u.length-cO+t))]:u.map((e,t)=>d(e,t));a=nO,t[8]===r?c=t[9]:(c=Ui(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=rO,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(dO)}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 dO(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(oO,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(iO,{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)(Fc,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(iO,{className:`min-w-0`,children:(0,Z.jsx)(aO,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var fO={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`},pO=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`,...fO,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},mO=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)(pO,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},hO=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)(pO,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function gO(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=Zo(`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=Sa(`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)(uO,{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)(tr,{children:(0,Z.jsx)(hO,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(is,{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)(gr,{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)(dr,{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)(mO,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(is,{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)(gr,{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)(dr,{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)(os,{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)(dr,{children:[(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(tr,{children:(0,Z.jsx)(Zc,{})})}),(0,Z.jsx)(gr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=dr,h=Xi,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)(tr,{children:u?(0,Z.jsx)(ol,{}):(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)(gr,{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 _O(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var vO=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DjLptssw.js`),__vite__mapDeps([34,1,2,35,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,43]),import.meta.url)).ActivityModeContent}));function yO(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(xO,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(bO,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(x,{name:`editor-area`,children:(0,Z.jsxs)(Nx,{children:[n,r]})}),t[3]=n,t[4]=i),i}function bO(){let e=(0,$.c)(5),t=Qm(),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)(Wx,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function xO(e){let t=(0,$.c)(143),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,onSaveVersion:c,saving:l}=e,{_:u}=i(),{activeDocName:d,activeProvider:f,activeTarget:p,recycleDocument:m,docPanelMode:h,docPanelAgentId:g,docPanelExpandSignal:_}=ht(),{openDocumentTransition:v}=Dt(),{requestAddProperty:y}=Fx(),b=jS(f,d),x=$S(f),S=x===`connected`||x===`synced`,C=NS(d)===`conflict`,w=(0,Q.useDeferredValue)(d),T=p?.kind===`missing`,E=!!d&&p?.kind!==`folder`,D;t[0]!==u||t[1]!==T?(D=T?u({id:`K-a33w`}):void 0,t[0]=u,t[1]=T,t[2]=D):D=t[2];let O=D,[k]=(0,Q.useState)(CO),A=k!==null,j;t[3]===k?j=t[4]:(j=()=>HS(k,window.innerWidth,`right`),t[3]=k,t[4]=j);let[M,N]=(0,Q.useState)(j),P=(0,Q.useRef)(M),F,I;t[5]===M?(F=t[6],I=t[7]):(F=()=>{P.current=M},I=[M],t[5]=M,t[6]=F,t[7]=I),(0,Q.useEffect)(F,I);let L=Ky(),R;t[8]===M?R=t[9]:(R=()=>ZS(`right`,M,YS())===`collapsed`,t[8]=M,t[9]=R);let[z]=(0,Q.useState)(R),[B,V]=(0,Q.useState)(z),H=(0,Q.useRef)(B),W,G;t[10]===B?(W=t[11],G=t[12]):(W=()=>{H.current=B},G=[B],t[10]=B,t[11]=W,t[12]=G),(0,Q.useEffect)(W,G);let[ee,te]=(0,Q.useState)(!1),K=(0,Q.useRef)(!1),[q]=(0,Q.useState)(SO),ne=(0,Q.useRef)(q),re=(0,Q.useRef)(null),ie;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e){re.current!=null&&clearTimeout(re.current),re.current=setTimeout(()=>{LS(e),re.current=null},100)},t[13]=ie):ie=t[13];let ae=ie,oe,se;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>()=>{re.current!=null&&clearTimeout(re.current)},oe=[],t[14]=oe,t[15]=se):(oe=t[14],se=t[15]),(0,Q.useEffect)(se,oe);let[ce,le]=(0,Q.useState)(null),ue;t[16]!==B||t[17]!==L?(ue=function(){if(L.current==null)return;let e=P.current;B?(QS(`right`,e,`open`),L.current?.expand()):(QS(`right`,e,`collapsed`),L.current?.collapse())},t[16]=B,t[17]=L,t[18]=ue):ue=t[18];let de=ue,fe,pe;t[19]!==k||t[20]!==L?(fe=()=>{let e=window.matchMedia(`(min-width: ${BS}px)`),t=()=>{let e=HS(k,window.innerWidth,`right`);N(e);let t=ZS(`right`,e,YS())===`collapsed`;V(t),t?L.current?.collapse():L.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},pe=[k,L],t[19]=k,t[20]=L,t[21]=fe,t[22]=pe):(fe=t[21],pe=t[22]),(0,Q.useEffect)(fe,pe);let me,he;t[23]!==ce||t[24]!==A||t[25]!==L?(me=()=>{if(ce==null||A)return;let e=new ResizeObserver(()=>{H.current||K.current||L.current?.resize(`${ne.current}px`)});return e.observe(ce),()=>e.disconnect()},he=[ce,A,L],t[23]=ce,t[24]=A,t[25]=L,t[26]=me,t[27]=he):(me=t[26],he=t[27]),(0,Q.useEffect)(me,he);let ge,_e;t[28]!==o||t[29]!==L?(ge=()=>{let e=e=>{o(e),L.current?.expand()},t=nm();return t&&e(t),im(t=>{nm(),e(t)})},_e=[o,L],t[28]=o,t[29]=L,t[30]=ge,t[31]=_e):(ge=t[30],_e=t[31]),(0,Q.useEffect)(ge,_e);let ve,ye;t[32]!==_||t[33]!==L?(ve=()=>{_!==0&&L.current?.expand()},ye=[_,L],t[32]=_,t[33]=L,t[34]=ve,t[35]=ye):(ve=t[34],ye=t[35]),(0,Q.useEffect)(ve,ye);let be,xe;t[36]===B?(be=t[37],xe=t[38]):(be=()=>{if(!B||!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()},xe=[B],t[36]=B,t[37]=be,t[38]=xe),(0,Q.useLayoutEffect)(be,xe);let Se,Ce;t[39]===B?(Se=t[40],Ce=t[41]):(Se=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!B})},Ce=[B],t[39]=B,t[40]=Se,t[41]=Ce),(0,Q.useEffect)(Se,Ce);let we,Te;t[42]===de?(we=t[43],Te=t[44]):(we=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&de()})},Te=[de],t[42]=de,t[43]=we,t[44]=Te),(0,Q.useEffect)(we,Te);let Ee,De;t[45]===de?(Ee=t[46],De=t[47]):(Ee=()=>{if(window.okDesktop!=null)return;let e=e=>{Eo(e,`toggle-document-panel`)&&(e.preventDefault(),de())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},De=[de],t[45]=de,t[46]=Ee,t[47]=De),(0,Q.useEffect)(Ee,De);let Oe=(0,Q.useRef)(null),[ke,Ae]=(0,Q.useState)(null),je=p?.kind===`large-file`?p.docName:d,Me,Ne;t[48]===je?(Me=t[49],Ne=t[50]):(Me=()=>{if(je&&je!==Oe.current){let e=Oe.current;Oe.current=je,Ae(e)}},Ne=[je],t[48]=je,t[49]=Me,t[50]=Ne),(0,Q.useEffect)(Me,Ne);let Pe;t[51]===v?Pe=t[52]:(Pe=function(e){let t=ki(e);window.location.hash===t?v(e):window.location.hash=t},t[51]=v,t[52]=Pe);let Fe=Pe;if(p?.kind===`large-file`){let e;t[53]!==Fe||t[54]!==ke?(e=ke?{previousDocName:ke,onNavigateBack:Fe}:void 0,t[53]=Fe,t[54]=ke,t[55]=e):e=t[55];let n;return t[56]!==p.docName||t[57]!==p.limit||t[58]!==p.size||t[59]!==e?(n=(0,Z.jsx)(kx,{docName:p.docName,size:p.size,limit:p.limit,backNav:e}),t[56]=p.docName,t[57]=p.limit,t[58]=p.size,t[59]=e,t[60]=n):n=t[60],n}if(p?.kind===`folder`){if(!(h===`agent`&&g!==null)){let e;return t[61]===p.folderPath?e=t[62]:(e=(0,Z.jsx)(Tx,{folderPath:p.folderPath}),t[61]=p.folderPath,t[62]=e),e}let e;t[63]===p.folderPath?e=t[64]:(e=(0,Z.jsx)(Xx,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(Tx,{folderPath:p.folderPath})}),t[63]=p.folderPath,t[64]=e);let n;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Zx,{withHandle:!0}),t[65]=n):n=t[65];let r;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Xx,{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)(vO,{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)(Yx,{orientation:`horizontal`,children:[e,n,r]})}),t[67]=e,t[68]=i),i}if(p?.kind===`asset`){let e;return t[69]!==p.assetPath||t[70]!==p.mediaKind?(e=(0,Z.jsx)(rb,{assetPath:p.assetPath,mediaKind:p.mediaKind},p.assetPath),t[69]=p.assetPath,t[70]=p.mediaKind,t[71]=e):e=t[71],e}if(!f||!d){if((typeof window<`u`?ai(window.location.hash):null)!==null){let e;return t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ib,{}),t[72]=e):e=t[72],e}let e;return t[73]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Zb,{}),t[73]=e):e=t[73],e}let Ie=n===`source`,Le=!S,Re=B,ze;t[74]!==d||t[75]!==y?(ze=function(){d&&y(d)},t[74]=d,t[75]=y,t[76]=ze):ze=t[76];let Ve=ze,He=w??d,Ue=ke??void 0,We;t[77]!==O||t[78]!==Ie||t[79]!==Fe||t[80]!==m||t[81]!==He||t[82]!==Ue?(We=(0,Z.jsx)(sD,{activeDocName:He,isSourceMode:Ie,editorPlaceholder:O,previousDocName:Ue,onNavigateBack:Fe,onRecycle:m}),t[77]=O,t[78]=Ie,t[79]=Fe,t[80]=m,t[81]=He,t[82]=Ue,t[83]=We):We=t[83];let Ge;t[84]!==d||t[85]!==Ie?(Ge=(0,Z.jsx)(hS,{activeDocName:d,isSourceMode:Ie}),t[84]=d,t[85]=Ie,t[86]=Ge):Ge=t[86];let Ke;t[87]!==d||t[88]!==w?(Ke=_O({activeDocName:d,deferredActiveDocName:w,mountResolved:d!==null&&U(d),syncResolved:d!==null&&Be(d)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(ib,{}),d===null?null:(0,Z.jsx)(Ax,{docName:d})]}):null,t[87]=d,t[88]=w,t[89]=Ke):Ke=t[89];let qe;t[90]!==We||t[91]!==Ge||t[92]!==Ke?(qe=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[We,Ge,Ke]}),t[90]=We,t[91]=Ge,t[92]=Ke,t[93]=qe):qe=t[93];let Je;t[94]!==d||t[95]!==C||t[96]!==Re||t[97]!==Ie||t[98]!==r||t[99]!==Ve||t[100]!==Le||t[101]!==de?(Je=!C&&(0,Z.jsx)(gO,{activeDocName:d,isSourceMode:Ie,sourceDisabled:Le,onModeChange:r,showAddPropertyButton:!Ie,onAddProperty:Ve,isPanelCollapsed:Re,onTogglePanel:de}),t[94]=d,t[95]=C,t[96]=Re,t[97]=Ie,t[98]=r,t[99]=Ve,t[100]=Le,t[101]=de,t[102]=Je):Je=t[102];let Ye;t[103]!==qe||t[104]!==Je?(Ye=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[qe,Je]}),t[103]=qe,t[104]=Je,t[105]=Ye):Ye=t[105];let J;t[106]!==E||t[107]!==b?(J=(0,Z.jsx)(eO,{stats:b,showStats:E}),t[106]=E,t[107]=b,t[108]=J):J=t[108];let Xe;t[109]!==Ye||t[110]!==J?(Xe=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[Ye,J]}),t[109]=Ye,t[110]=J,t[111]=Xe):Xe=t[111];let Ze=Xe,Qe=ee||void 0,$e;t[112]===z?$e=t[113]:($e=z?{defaultSize:`100%`}:{},t[112]=z,t[113]=$e);let et=ee?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,tt;t[114]!==Ze||t[115]!==$e||t[116]!==et?(tt=(0,Z.jsx)(Xx,{minSize:`30%`,...$e,className:et,children:Ze}),t[114]=Ze,t[115]=$e,t[116]=et,t[117]=tt):tt=t[117];let nt=A&&B,rt;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(rt=()=>{te(!0),K.current=!0;let e=()=>{te(!1),K.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[118]=rt):rt=t[118];let it;t[119]===nt?it=t[120]:(it=(0,Z.jsx)(Zx,{withHandle:!0,disabled:nt,onPointerDown:rt}),t[119]=nt,t[120]=it);let at=z?0:`${q}px`,ot;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(ot=e=>{V(e.asPercentage===0),e.inPixels>0&&K.current&&(ne.current=e.inPixels,ae(e.inPixels))},t[121]=ot):ot=t[121];let st=!ee&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ct;t[122]===st?ct=t[123]:(ct=Ui(`flex flex-col bg-muted/20`,st),t[122]=st,t[123]=ct);let lt;t[124]!==d||t[125]!==a||t[126]!==h||t[127]!==Ie||t[128]!==o||t[129]!==c||t[130]!==l?(lt=(0,Z.jsx)($_,{docName:d,isSourceMode:Ie,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l}),t[124]=d,t[125]=a,t[126]=h,t[127]=Ie,t[128]=o,t[129]=c,t[130]=l,t[131]=lt):lt=t[131];let ut;t[132]!==B||t[133]!==L||t[134]!==at||t[135]!==ct||t[136]!==lt?(ut=(0,Z.jsx)(Xx,{id:`doc-panel`,panelRef:L,defaultSize:at,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:ot,inert:B,className:ct,children:lt}),t[132]=B,t[133]=L,t[134]=at,t[135]=ct,t[136]=lt,t[137]=ut):ut=t[137];let dt;return t[138]!==Qe||t[139]!==tt||t[140]!==it||t[141]!==ut?(dt=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:le,children:(0,Z.jsxs)(Yx,{orientation:`horizontal`,"data-dragging":Qe,children:[tt,it,ut]})}),t[138]=Qe,t[139]=tt,t[140]=it,t[141]=ut,t[142]=dt):dt=t[142],dt}function SO(){return RS()}function CO(){return Xn()}function wO(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 TO(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 EO=1e3,DO=!1;function OO(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function kO(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:da(i)?a=i:(a=void 0,DO||(DO=!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`&&(OO({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=TO(i),{current:c,crossDoc:l}=a?oa(a,n,Date.now()):{current:[],crossDoc:[]},u=AO,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>wO(e.current,p)&&wO(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,EO);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 AO(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var jO=`sync-status`;function MO(e,t){let n=(0,$.c)(5),{_:r}=i(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==e?(c=()=>{s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t&&(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current?(o.current=!0,X.warning(r({id:`HGNCsl`}),{id:jO,duration:1/0})):o.current&&e===`synced`&&(o.current=!1,X.success(r({id:`GhjUB_`}),{id:jO,duration:3e3})))},l=[e,t,r],n[0]=r,n[1]=t,n[2]=e,n[3]=c,n[4]=l):(c=n[3],l=n[4]),(0,Q.useEffect)(c,l)}var NO=4,PO=3,FO={Bird:bc,Cat:Ec,Dog:Pc,Fish:zc,Mouse:dl,Rabbit:ul,Shrimp:vl,Snail:yl,Squirrel:Sl,Turtle:Dl};Object.freeze(Object.keys(FO));function IO(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(FO,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var LO={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function RO(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=IO(n),c=s.kind===`animal`?FO[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=Bi(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Pr(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)(tr,{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)(gr,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(dr,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function zO(e){let t=LO[e.icon];return e.displayName||t||Y._({id:`iEQQyu`})}function BO(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 VO(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=ht(),{presence:u,agentId:d}=n,f=zO(u),p=BO(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)(la,{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)(la,{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)(tr,{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)(gr,{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)(dr,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function HO(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?Y._({id:`9euN0m`,values:{count:n}}):Y._({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)(H,{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)(RO,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(VO,{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 m;return t[18]!==u||t[19]!==f?(m=(0,Z.jsxs)(p,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=m):m=t[20],m}function UO(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(RO,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(VO,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function WO(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ht(),{current:s,crossDoc:c}=kO(t,r,n);if(MO($S(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,NO),n;e[6]===s?n=e[7]:(n=s.slice(NO),e[6]=s,e[7]=n);let r=n,u=c.slice(0,PO),d;e[8]===c?d=e[9]:(d=c.slice(PO),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=>UO(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)(HO,{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=>UO(e,p,!0,m)),f.length>0?(0,Z.jsx)(HO,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var GO=`.md`,KO=/\.(md|mdx)$/i;function qO(e,t=GO){return`${e}${t}`}function JO(e){return hk(e).replace(KO,``)}function YO(e){return ci(e)?QO(e.path):ui(e)?e.path:qO(e.docName,e.docExt)}function XO(e){let t=hk(e).match(KO);return t?`.${t[1].toLowerCase()}`:void 0}function ZO(e){return hk(e)}function QO(e){let t=hk(e.trim());return t?`${t}/`:``}function $O(e){return e.endsWith(`/`)?ZO(e):JO(e)}function ek(e){return e.map(YO)}function tk(e){return[...e].sort().join(`\0`)}function nk(e){return tk(ek(e))}function rk(e){let t=new Set;for(let n of e){if(ci(n)){let e=QO(n.path);e&&t.add(e)}let e=(ci(n)||ui(n)?n.path:n.docName).split(`/`).filter(Boolean),r=ci(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function ik(e){if(!e)return[];let t=hk(e.replace(KO,``)).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 ak(e,t,n){let r=XO(e);if(r)return r;let i=n.find(e=>Fn(e)&&e.docName===t);return i?i.docExt??GO:mk(e).includes(`.`)?void 0:GO}function ok(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(!ui(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 sk(e,t,n){if(XO(e))return null;let r=n.find(e=>ui(e)&&e.path===t);return r?r.path:mk(e).includes(`.`)?t:ok(t,n)}function ck(e,t){let n=e.kind===`directory`,r=n?ZO(e.path):JO(e.path);if(n)return{kind:`folder`,name:hk(mk(e.path)).replace(KO,``),path:r,treePath:uk(e.path,!0)};let i=sk(e.path,r,t);if(i)return{kind:`asset`,name:hk(mk(i)),path:i,treePath:i};let a=ak(e.path,r,t);return{kind:`file`,name:hk(mk(e.path)).replace(KO,``),path:r,treePath:uk(e.path,!1),docExt:a}}function lk(e){return e.kind===`directory`?ZO(e.path):e.path}function uk(e,t){return t?QO(e):KO.test(e)?e:`${e}${GO}`}function dk(e,t,n){let r=QO(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}${GO}`;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 fk(e,t){return e===`file`?uk(t,!1):`${ZO(t)}/index${GO}`}function pk(e,t){return t.kind===`root`||t.directoryPath==null?mk(e):`${t.directoryPath}${mk(e)}`}function mk(e){let t=hk(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function hk(e){return e.endsWith(`/`)?e.slice(0,-1):e}function gk(e,t){return t.trim()}function _k(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function vk(e,t){let n=gk(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function yk(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=>Fn(e)?{...e,docName:i.get(e.docName)??e.docName}:ci(e)?{...e,path:Ek(e.path,n)}:ui(e)?{...e,path:a.get(e.path)??Ek(e.path,n)}:e)}function bk(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=>Fn(e)?!i.has(e.docName)&&!Ak(e.docName,n):ci(e)?!Ak(e.path,n):ui(e)?!a.has(e.path)&&!Ak(e.path,n):!0)}function xk(e,t){if(e.kind!==`asset`||t.some(t=>ui(t)&&t.path===e.path))return e;let n=ok(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function Sk(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>Dk(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Fn(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=>ci(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(Fn(i)){let e=kk(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(ci(i)){let e=Ok(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function Ck(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function wk(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function Tk(e,t){let n=e.kind===`file`?qO(e.path,e.docExt):e.path;return Ch(t.contentDir,n,t.pathSeparator)}function Ek(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 Dk(e,t){return Fn(e)&&Fn(t)?e.docName===t.docName:ci(e)&&ci(t)||ui(e)&&ui(t)?e.path===t.path:!1}function Ok(e,t,n){return e===t?n:kk(e,t,n)}function kk(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function Ak(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function jk(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)(Du,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function Mk(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=Ui(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ou,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nk(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)(Fu,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function Pk(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=Ui(`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)(ku,{children:(0,Z.jsx)(Au,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fk(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=Ui(`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)(ju,{"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 Ik(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=Ui(`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)(_s,{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)(Iu,{"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 Lk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Ui(`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)(Lu,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Rk(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=Ui(`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)(Nu,{children:(0,Z.jsx)(gs,{})})}),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)(Mu,{"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 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=Ui(`-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)(Pu,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Bk=[`.md`,`.mdx`],Vk=`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`,Hk=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,Uk=Ui(Hk,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),Wk=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,Gk=`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 focus-visible:opacity-100`;function Kk(e){return Ui(Gk,e?`opacity-100`:`pointer-events-none opacity-0 group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100`)}function qk(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function Jk(e){let t=ki(e);window.location.hash!==t&&(window.location.hash=t)}function Yk(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function Xk(e,t){let n=[t,...Bk].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 Zk(e){let t=(0,$.c)(26),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({tabId:o,disabled:n,ref:r,style:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]!==n||t[7]!==o?(s={id:o,disabled:n},t[6]=n,t[7]=o,t[8]=s):s=t[8];let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=Za(s),m;t[9]===d?m=t[10]:(m=so.Transform.toString(d),t[9]=d,t[10]=m);let h=p?.5:i?.opacity,g=p?1:i?.zIndex,_;t[11]!==i||t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==f?(_={...i,transform:m,transition:f,opacity:h,zIndex:g},t[11]=i,t[12]=m,t[13]=h,t[14]=g,t[15]=f,t[16]=_):_=t[16];let v=_,y;t[17]!==r||t[18]!==u?(y=function(e){u(e),typeof r==`function`?r(e):r&&`current`in r&&(r.current=e)},t[17]=r,t[18]=u,t[19]=y):y=t[19];let b=y,x;return t[20]!==c||t[21]!==b||t[22]!==l||t[23]!==a||t[24]!==v?(x=(0,Z.jsx)(`div`,{ref:b,style:v,...a,...c,...l}),t[20]=c,t[21]=b,t[22]=l,t[23]=a,t[24]=v,t[25]=x):x=t[25],x}function Qk(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=Gt(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=Gt(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)(Mk,{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)(Fk,{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)(Fk,{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)(Fk,{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)(zk,{}),(0,Z.jsx)(Fk,{"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)(Pk,{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)(jk,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function $k(e){let t=(0,$.c)(20),{accessibleLabel:n,closeTab:r,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=i();if(a){let e;t[0]!==c||t[1]!==n?(e=c({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=c,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==o||t[4]!==s?(r=e=>{e.stopPropagation(),s(o)},t[3]=o,t[4]=s,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(ll,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let l;t[10]!==c||t[11]!==n?(l=c({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=c,t[11]=n,t[12]=l):l=t[12];let u;t[13]!==r||t[14]!==o?(u=e=>{e.stopPropagation(),r(o)},t[13]=r,t[14]=o,t[15]=u):u=t[15];let d;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(cs,{"aria-hidden":`true`}),t[16]=d):d=t[16];let f;return t[17]!==l||t[18]!==u?(f=(0,Z.jsx)(Xi,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:`mr-1.5`,onClick:u,children:d}),t[17]=l,t[18]=u,t[19]=f):f=t[19],f}function eA(e){let t=(0,$.c)(1),{docName:n}=e;if(NS(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Nr,{"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 tA(){let e=(0,$.c)(69),{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:b,pinnedTabIds:x,remapTabsForRename:S,reorderTabs:C,unpinTab:w,visibleTabIds:T}=ht(),{_:E}=i(),{pageMeta:D}=ji(),O=(0,Q.useRef)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(null),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(null),H=(0,Q.useRef)(t),U;e[0]!==n||e[1]!==t||e[2]!==a?(U=n??(a?ce(a):t?Oe(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=U):U=e[3];let W=U,G;e[4]!==r||e[5]!==W||e[6]!==h||e[7]!==g||e[8]!==v?(G=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:W?`${W}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=W,e[6]=h,e[7]=g,e[8]=v,e[9]=G):G=e[9];let ee=G,te,K;e[10]===t?(te=e[11],K=e[12]):(te=()=>{H.current=t},K=[t],e[10]=t,e[11]=te,e[12]=K),(0,Q.useEffect)(te,K);let q,ne;e[13]===ee?(q=e[14],ne=e[15]):(q=()=>{ee&&(O.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},ne=[ee],e[13]=ee,e[14]=q,e[15]=ne),(0,Q.useEffect)(q,ne);let re,ie;e[16]===k?(re=e[17],ie=e[18]):(re=()=>{k&&(R.current?.focus(),R.current?.select())},ie=[k],e[16]=k,e[17]=re,e[18]=ie),(0,Q.useEffect)(re,ie);let ae,oe;e[19]!==v||e[20]!==k?(ae=()=>{!k||v.includes(k.tabId)||(B.current=!0,V.current=null,A(null),M(``),F(null),L(!1))},oe=[v,k],e[19]=v,e[20]=k,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);B.current=!1,V.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),F(null)},le=function(){B.current=!0,V.current=null,A(null),M(``),F(null),L(!1)},ue=async function(){if(B.current){B.current=!1;return}if(z.current)return;let e=k?.docName;if(!e){le();return}let t=gk(`file`,Xk(j,D.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){le();return}if(t===V.current){R.current?.focus();return}if(!_k(t)){F(E({id:`P8yDjG`})),R.current?.focus();return}let i=vk({kind:`file`,path:e,name:r},t);z.current=!0,L(!0),F(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(B.current){L(!1),z.current=!1;return}let r=await Et(n,`Server error (HTTP ${n.status})`);if(!r.ok){F(r.title),L(!1),z.current=!1,V.current=t,R.current?.focus();return}let a=P(hi,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=H.current,s=Ck(o,a);qt(a);let c=!0;try{let e=wk(a,p(),m);await Promise.all(e.map(e=>l(e))),S(a),Jr([`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(E({id:`MUBR8r`}))}B.current=!0,A(null),M(``),F(null),L(!1),z.current=!1,V.current=null,c&&s&&s!==o&&Jk(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),F(E({id:`HIb0vl`})),L(!1),z.current=!1,V.current=t,R.current?.focus()}},de=typeof window<`u`&&window.okDesktop!=null,pe;e[23]===g?pe=e[24]:(pe=new Set(g),e[23]=g,e[24]=pe);let me=pe,he;e[25]!==u||e[26]!==f||e[27]!==me?(he=function(e){let t=[],n=[];for(let r of e)me.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[25]=u,e[26]=f,e[27]=me,e[28]=he):he=e[28];let ge=he,_e;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(_e={activationConstraint:{distance:8}},e[29]=_e):_e=e[29];let ve;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(ve={coordinateGetter:Da},e[30]=ve):ve=e[30];let ye=ro(ao(Lo,_e),ao(Na,ve)),be;e[31]!==C||e[32]!==T?(be=function(e){let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=T.indexOf(t),i=T.indexOf(n);r<0||i<0||r===i||C(_a([...T],r,i),t)},e[31]=C,e[32]=T,e[33]=be):be=e[33];let xe=be,Se=de?``:void 0,Ce;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=Ui(`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]`,de&&`[-webkit-app-region:drag]`),e[34]=Ce):Ce=e[34];let we=Yk,Te;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Te=Ui(`flex items-end gap-1`,de&&`[-webkit-app-region:no-drag]`),e[35]=Te):Te=e[35];let Ee=Ta,De=ja,ke;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(ke={container:typeof document<`u`?document.body:void 0},e[36]=ke):ke=e[36];let Ae=ts,je;e[37]===T?je=e[38]:(je=[...T],e[37]=T,e[38]=je);let Me=$a,Ne=T.map(e=>{if(me.has(e)){let t=e===r;return(0,Z.jsx)(Qk,{tabId:e,canPin:!1,openTabs:T,closeTab:u,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(Zk,{tabId:e,"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Ui(Vk,t?Hk:Uk),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":E({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:Wk,onClick:()=>c(e),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":E({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:Kk(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(cs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=Fe(e),n=e===W,i=x.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=y(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(Qk,{tabId:e,openTabs:T,closeTab:d,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(Zk,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ui(Vk,n?Hk:Uk),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:Wk,onClick:()=>{o(e)},children:[s&&(0,Z.jsx)(`span`,{className:Ui(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Ui(`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)($k,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=y(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(Qk,{tabId:e,openTabs:T,closeTab:d,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(Zk,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ui(Vk,n?Hk:Uk),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:Wk,onClick:()=>{o(e)},children:[s?(0,Z.jsx)(`span`,{className:Ui(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Ui(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)($k,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})},e)}let a=t.docName,l=D.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=y(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=k?.tabId===e,S=`editor-tab-rename-error-${qk(a)}`;return(0,Z.jsx)(Qk,{disabled:v,tabId:e,openTabs:T,closeTab:d,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsx)(Zk,{tabId:e,disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ui(Vk,n?Hk:Uk,v&&N&&`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)(Qx,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(rS,{ref:R,value:j,disabled:I,"aria-label":E({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":N?!0:void 0,"aria-describedby":N?S:void 0,"aria-busy":I||void 0,title:N??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=>{M(Xk(e.target.value,l)),F(null),V.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ue()):e.key===`Escape`&&(e.preventDefault(),le())},onBlur:ue}),(0,Z.jsx)(eS,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(nS,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),N?(0,Z.jsx)(`span`,{id:S,role:`alert`,className:`sr-only`,children:N}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:Wk,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,a)},children:[(0,Z.jsx)(eA,{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)($k,{accessibleLabel:g,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})})},e)}),Pe;e[39]!==Ae||e[40]!==je||e[41]!==Me||e[42]!==Ne?(Pe=(0,Z.jsx)(Ae,{items:je,strategy:Me,children:Ne}),e[39]=Ae,e[40]=je,e[41]=Me,e[42]=Ne,e[43]=Pe):Pe=e[43];let Ie;e[44]!==Ee||e[45]!==xe||e[46]!==ye||e[47]!==De||e[48]!==ke||e[49]!==Pe?(Ie=(0,Z.jsx)(Ee,{sensors:ye,collisionDetection:De,onDragEnd:xe,accessibility:ke,children:Pe}),e[44]=Ee,e[45]=xe,e[46]=ye,e[47]=De,e[48]=ke,e[49]=Pe,e[50]=Ie):Ie=e[50];let Le;e[51]===E?Le=e[52]:(Le=E({id:`3YvS-c`}),e[51]=E,e[52]=Le);let Re;e[53]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(fe,{"aria-hidden":`true`}),e[53]=Re):Re=e[53];let ze;e[54]!==_||e[55]!==Le?(ze=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Le,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Re})}),e[54]=_,e[55]=Le,e[56]=ze):ze=e[56];let Be;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsx)(gr,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[57]=Be):Be=e[57];let Ve;e[58]===ze?Ve=e[59]:(Ve=(0,Z.jsxs)(dr,{children:[ze,Be]}),e[58]=ze,e[59]=Ve);let He;e[60]!==Te||e[61]!==Ie||e[62]!==Ve?(He=(0,Z.jsxs)(`div`,{className:Te,children:[Ie,Ve]}),e[60]=Te,e[61]=Ie,e[62]=Ve,e[63]=He):He=e[63];let Ue;return e[64]!==Se||e[65]!==Ce||e[66]!==we||e[67]!==He?(Ue=(0,Z.jsx)(`div`,{ref:O,"data-electron-drag":Se,className:Ce,onWheel:we,children:He}),e[64]=Se,e[65]=Ce,e[66]=we,e[67]=He,e[68]=Ue):Ue=e[68],Ue}function nA(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 rA(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 iA=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:Zt},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:_d},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:Yn},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:nA},{label:`Twitter`,href:`https://x.com/inkeep`,icon:rA}],aA=()=>{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)(pt,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(H,{asChild:!0,children:(0,Z.jsxs)(Xi,{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)(dr,{children:[o,(0,Z.jsx)(gr,{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=iA.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=>Ka(e,r),onAuxClick:e=>Ka(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 m;e[10]!==u||e[11]!==f?(m=(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]=m):m=e[12];let h;return e[13]!==n||e[14]!==m?(h=(0,Z.jsxs)(p,{open:n,onOpenChange:r,children:[c,m]}),e[13]=n,e[14]=m,e[15]=h):h=e[15],h};function oA(e){let t=(0,$.c)(63),{input:n}=e,{_:r}=i(),{states:a,refresh:o}=Xh(),{dispatch:c}=zh(),{merged:l}=vt(),u=l?.appearance?.preview?.autoOpen??!0,[d,f]=(0,Q.useState)(!1);if(Wm())return null;let p=typeof window<`u`&&window.okDesktop!=null,m;t[0]===o?m=t[1]:(m=e=>{f(e),e&&o()},t[0]=o,t[1]=m);let h=m,g=n===null,_;t[2]!==u||t[3]!==n?(_=n!==null&&n.docContext!==null?nr(n.docContext.relativePath,u):``,t[2]=u,t[3]=n,t[4]=_):_=t[4];let v=_,y;t[5]!==c||t[6]!==n?(y=e=>{n!==null&&c(e.id,n)},t[5]=c,t[6]=n,t[7]=y):y=t[7];let b=y,x,S,C,w,T,E,D,O,k,A,j,M;if(t[8]!==h||t[9]!==b||t[10]!==n||t[11]!==d||t[12]!==v||t[13]!==a||t[14]!==g){let e;t[27]===a?e=t[28]:(e=e=>a[e.id]?.installed===!0,t[27]=a,t[28]=e);let r=qm.filter(e);C=a[`claude-code`]?.installed===!0;let i;t[29]!==n||t[30]!==v?(i=()=>{n!==null&&fb(v)},t[29]=n,t[30]=v,t[31]=i):i=t[31],w=i,S=Ga,M=d,T=h;let o,c;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ca,{className:`size-3.5`}),c=(0,Z.jsx)(s,{id:`xWEvuo`}),t[32]=o,t[33]=c):(o=t[32],c=t[33]);let l;t[34]===g?l=t[35]:(l=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Uo,{asChild:!0,children:(0,Z.jsxs)(Xi,{variant:`ghost`,size:`sm`,disabled:g,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,children:[o,c]})})}),t[34]=g,t[35]=l);let u;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(gr,{children:(0,Z.jsx)(s,{id:`xWEvuo`})}),t[36]=u):u=t[36],t[37]===l?E=t[38]:(E=(0,Z.jsxs)(dr,{children:[l,u]}),t[37]=l,t[38]=E),x=vo,D=`end`,O=`min-w-[220px]`,k=`open-in-agent-menu`,t[39]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(jo,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`O7_W_a`})}),t[39]=A):A=t[39];let f;t[40]!==b||t[41]!==v||t[42]!==a?(f=e=>{let t=a[e.id];return(0,Z.jsx)(pb,{target:e,installState:t,isElectronHost:p,prompt:v,onSelect:()=>b(e)},e.id)},t[40]=b,t[41]=v,t[42]=a,t[43]=f):f=t[43],j=r.map(f),t[8]=h,t[9]=b,t[10]=n,t[11]=d,t[12]=v,t[13]=a,t[14]=g,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E,t[21]=D,t[22]=O,t[23]=k,t[24]=A,t[25]=j,t[26]=M}else x=t[15],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20],D=t[21],O=t[22],k=t[23],A=t[24],j=t[25],M=t[26];let N;t[44]!==r||t[45]!==C||t[46]!==w||t[47]!==n?(N=C?null:(0,Z.jsxs)(Ko,{onSelect:w,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":r({id:`aA51jP`}),children:[(0,Z.jsx)(ut,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}),t[44]=r,t[45]=C,t[46]=w,t[47]=n,t[48]=N):N=t[48];let P;t[49]!==x||t[50]!==N||t[51]!==D||t[52]!==O||t[53]!==k||t[54]!==A||t[55]!==j?(P=(0,Z.jsxs)(x,{align:D,className:O,"data-testid":k,children:[A,j,N]}),t[49]=x,t[50]=N,t[51]=D,t[52]=O,t[53]=k,t[54]=A,t[55]=j,t[56]=P):P=t[56];let F;return t[57]!==S||t[58]!==T||t[59]!==E||t[60]!==P||t[61]!==M?(F=(0,Z.jsxs)(S,{open:M,onOpenChange:T,children:[E,P]}),t[57]=S,t[58]=T,t[59]=E,t[60]=P,t[61]=M,t[62]=F):F=t[62],F}var sA=50,cA=()=>{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,Lx.preload()},sA))},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=Jm)},u=(0,Z.jsx)(gl,{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)(tr,{asChild:!0,children:(0,Z.jsxs)(Xi,{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)(dr,{children:[d,(0,Z.jsx)(gr,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function lA(e){let t=(0,$.c)(32),{onClickWhenNoRemote:n}=e,{_:r}=i(),{activeDocName:a}=ht(),{status:o}=Io(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),m,h;if(t[0]===u?(m=t[1],h=t[2]):(m=()=>{!u||!f.current||(f.current.focus(),f.current.select())},h=[u],t[0]=u,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h),!a)return null;let g=o?.hasRemote===!0,_;t[3]!==r||t[4]!==a||t[5]!==c||t[6]!==g||t[7]!==n?(_=async function(){if(!c&&a){l(!0),d(null);try{let e=await po({docName:a,hasRemote:g,onClickWhenNoRemote:n},{clipboardWrite:Qo,toastSuccess:mA,toastError:pA,logEvent:fA});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{X.error(r({id:`u3YnKw`}))}l(!1)}},t[3]=r,t[4]=a,t[5]=c,t[6]=g,t[7]=n,t[8]=_):_=t[8];let v=_,y=u!==null,b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||d(null)},t[9]=b):b=t[9];let x;t[10]===r?x=t[11]:(x=r({id:`F4IYWe`}),t[10]=r,t[11]=x);let S,C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(_l,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[12]=S,t[13]=C):(S=t[12],C=t[13]);let w;t[14]!==c||t[15]!==v||t[16]!==x?(w=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(it,{asChild:!0,children:(0,Z.jsxs)(Xi,{variant:`ghost`,size:`sm`,"aria-label":x,onClick:v,disabled:c,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})})}),t[14]=c,t[15]=v,t[16]=x,t[17]=w):w=t[17];let T;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(gr,{children:(0,Z.jsx)(s,{id:`Z8lGw6`})}),t[18]=T):T=t[18];let E;t[19]===w?E=t[20]:(E=(0,Z.jsxs)(dr,{children:[w,T]}),t[19]=w,t[20]=E);let D;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[21]=D):D=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[22]=O):O=t[22];let k=u??``,A;t[23]===r?A=t[24]:(A=r({id:`5-FeN2`}),t[23]=r,t[24]=A);let j;t[25]!==k||t[26]!==A?(j=(0,Z.jsxs)(B,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[D,O,(0,Z.jsx)(vs,{ref:f,readOnly:!0,value:k,onFocus:dA,onClick:uA,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":A})]}),t[25]=k,t[26]=A,t[27]=j):j=t[27];let M;return t[28]!==E||t[29]!==j||t[30]!==y?(M=(0,Z.jsxs)(p,{open:y,onOpenChange:b,children:[E,j]}),t[28]=E,t[29]=j,t[30]=y,t[31]=M):M=t[31],M}function uA(e){return e.currentTarget.select()}function dA(e){return e.currentTarget.select()}function fA(e){return console.log(e)}function pA(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function mA(e){return X.success(e)}function hA(e){let t=(0,$.c)(45),{onSignIn:n,onSetIdentity:r,onOpenSearch:a}=e,{_:o}=i(),{activeDocName:c,activeTarget:l}=ht(),{state:u}=MD(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=Zo(`toggle-files-sidebar`),t[0]=d):d=t[0];let f=d,p=Zo(`command-palette`),m=ko(),[h,g]=(0,Q.useState)(!1),_;bb0:{if(l===null){let e;t[1]===m?e=t[2]:(e=Eh({workspace:m}),t[1]=m,t[2]=e),_=e;break bb0}if(l.kind===`folder`){if(!m){_=null;break bb0}let e;t[3]!==l.folderPath||t[4]!==m?(e=Dh({folderRelativePath:l.folderPath,workspace:m}),t[3]=l.folderPath,t[4]=m,t[5]=e):e=t[5],_=e;break bb0}let e;t[6]!==c||t[7]!==m?(e=Th({docName:c,workspace:m}),t[6]=c,t[7]=m,t[8]=e):e=t[8],_=e}let v=_,y=typeof window<`u`&&window.okDesktop!=null,b=u===`collapsed`,x=y?``:void 0,S=y&&b&&`pl-[78px]`,C;t[9]===S?C=t[10]:(C=Ui(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,y&&`[-webkit-app-region:drag]`,S,y&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[9]=S,t[10]=C);let w;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(LD,{className:Ui(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),t[11]=w):w=t[11];let T;t[12]===u?T=t[13]:(T=(0,Z.jsxs)(dr,{children:[w,(0,Z.jsx)(gr,{children:u===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:f}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:f}})})]}),t[12]=u,t[13]=T);let E=b&&a&&(0,Z.jsxs)(dr,{children:[(0,Z.jsx)(tr,{asChild:!0,children:(0,Z.jsx)(Xi,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":o({id:`IN4UX8`,values:{searchShortcut:p}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Ui(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(he,{"aria-hidden":`true`})})}),(0,Z.jsx)(gr,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:p}})})]}),D,O;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(mo,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),O=(0,Z.jsx)(tA,{}),t[14]=D,t[15]=O):(D=t[14],O=t[15]);let k;t[16]!==T||t[17]!==E?(k=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[T,E,D,O]}),t[16]=T,t[17]=E,t[18]=k):k=t[18];let A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(A=Ui(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`),t[19]=A):A=t[19];let j;t[20]===v?j=t[21]:(j=(0,Z.jsx)(oA,{input:v}),t[20]=v,t[21]=j);let M;t[22]===g?M=t[23]:(M=(0,Z.jsx)(lA,{onClickWhenNoRemote:()=>g(!0)}),t[22]=g,t[23]=M);let N;t[24]!==h||t[25]!==g?(N=(0,Z.jsx)($o,{open:h,onOpenChange:g}),t[24]=h,t[25]=g,t[26]=N):N=t[26];let P;t[27]!==r||t[28]!==n?(P=(0,Z.jsx)(Oo,{onSignIn:n,onSetIdentity:r}),t[27]=r,t[28]=n,t[29]=P):P=t[29];let F,I,L,R,z;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(WO,{}),I=(0,Z.jsx)(mo,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),L=(0,Z.jsx)(Bu,{}),R=(0,Z.jsx)(cA,{}),z=(0,Z.jsx)(aA,{}),t[30]=F,t[31]=I,t[32]=L,t[33]=R,t[34]=z):(F=t[30],I=t[31],L=t[32],R=t[33],z=t[34]);let B;t[35]!==j||t[36]!==M||t[37]!==N||t[38]!==P?(B=(0,Z.jsxs)(`div`,{className:A,children:[j,M,N,P,F,I,L,R,z]}),t[35]=j,t[36]=M,t[37]=N,t[38]=P,t[39]=B):B=t[39];let V;return t[40]!==k||t[41]!==B||t[42]!==x||t[43]!==C?(V=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:C,children:[k,B]}),t[40]=k,t[41]=B,t[42]=x,t[43]=C,t[44]=V):V=t[44],V}function gA(e){let t=(0,$.c)(38),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]=Dg(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(J_[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),b=yo(),{projectLocalConfig:x,projectLocalSynced:S}=vt(),{activeDocName:C}=ht(),w=b?.hasRemote,T=b?.pushPermission?.checkStatus,E;t[2]!==v||t[3]!==x||t[4]!==S||t[5]!==w||t[6]!==T?(E=jg({autoSyncOnboardingDismissed:v,hasRemote:w,projectLocalSynced:S,projectLocalConfig:x,pushPermissionCheckStatus:T}),t[2]=v,t[3]=x,t[4]=S,t[5]=w,t[6]=T,t[7]=E):E=t[7];let D=E,O,k;t[8]===C?(O=t[9],k=t[10]):(O=()=>{let e=function(e){let t=e.detail;t&&C&&ec(C,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(yg,e),()=>window.removeEventListener(yg,e)},k=[C],t[8]=C,t[9]=O,t[10]=k),(0,Q.useEffect)(O,k),Og(b?.pausedReason);let A;t[11]===s?A=t[12]:(A=function(e){l(e),s(e)},t[11]=s,t[12]=A);let j=A,M;t[13]===a?M=t[14]:(M=async function(){_(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?X.success(a({id:`rdE6_3`})):(console.error(`[save-version] failed:`,await e.text()),X.error(a({id:`q7zsRM`})))}catch(e){console.error(`[save-version] failed:`,e),X.error(a({id:`q7zsRM`}))}_(!1)},t[13]=a,t[14]=M);let N=M,P,F;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{p(`auth`),d(!0)},P=()=>{p(`identity`),d(!0)},t[15]=P,t[16]=F):(P=t[15],F=t[16]);let I;t[17]===r?I=t[18]:(I=(0,Z.jsx)(hA,{onSignIn:F,onSetIdentity:P,onOpenSearch:r}),t[17]=r,t[18]=I);let L;t[19]!==m||t[20]!==c||t[21]!==j||t[22]!==N||t[23]!==g?(L=(0,Z.jsx)(yO,{editorMode:c,onModeChange:j,activeTab:m,onActiveTabChange:h,onSaveVersion:N,saving:g}),t[19]=m,t[20]=c,t[21]=j,t[22]=N,t[23]=g,t[24]=L):L=t[24];let R=f===`identity`,z;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{d(!1)},t[25]=z):z=t[25];let B;t[26]!==u||t[27]!==R?(B=(0,Z.jsx)(Wa,{open:u,onOpenChange:d,identityPrompt:R,onSuccess:z}),t[26]=u,t[27]=R,t[28]=B):B=t[28];let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>y(!0),t[29]=V):V=t[29];let H;t[30]===D?H=t[31]:(H=(0,Z.jsx)(kg,{open:D,onResolved:V}),t[30]=D,t[31]=H);let U;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(gg,{}),t[32]=U):U=t[32];let W;return t[33]!==I||t[34]!==L||t[35]!==B||t[36]!==H?(W=(0,Z.jsxs)(Z.Fragment,{children:[I,L,B,H,U]}),t[33]=I,t[34]=L,t[35]=B,t[36]=H,t[37]=W):W=t[37],W}function _A(e){let t=ki(Kr(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function vA(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=ya();if(n)return null;if(r!==null){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)(Nr,{"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)(Nr,{"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(yA),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 yA(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Xi,{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:()=>_A(e.file),children:[(0,Z.jsx)(Nr,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var bA=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
32
32
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
33
33
  <path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06" fill="currentcolor"/>
34
34
  </symbol>