@fabiofiorita/porcelain 0.71.0 → 0.71.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/web/dist/assets/_-Cgj9Amlg.js +1 -0
  4. package/web/dist/assets/_layerId-WtWgdySc.js +1 -0
  5. package/web/dist/assets/_paired-BhXDazsm.js +1 -0
  6. package/web/dist/assets/_paired-C2SpPGqV.js +1 -0
  7. package/web/dist/assets/{_paired-D4B6U2tK.js → _paired-CQqaert8.js} +1 -1
  8. package/web/dist/assets/{_paired-B5NlVJC_.js → _paired-jHMYqNRe.js} +1 -1
  9. package/web/dist/assets/_reviewId-DYfy6yXm.js +1 -0
  10. package/web/dist/assets/_revision-Cl64oJuE.js +1 -0
  11. package/web/dist/assets/_section-BZ9yGLgf.js +1 -0
  12. package/web/dist/assets/_worktreeId-9KlGkDDm.js +1 -0
  13. package/web/dist/assets/_worktreeId-BhXDazsm.js +1 -0
  14. package/web/dist/assets/_worktreeId-C2SpPGqV.js +1 -0
  15. package/web/dist/assets/{_worktreeId-CO2pdZDS.js → _worktreeId-CDTAw3Hd.js} +1 -1
  16. package/web/dist/assets/access-Cf1mwFvV.js +1 -0
  17. package/web/dist/assets/{connected-workspace-Ct9I-K0k.js → connected-workspace-C1KgZzkv.js} +1 -1
  18. package/web/dist/assets/{desktop-actions-9fnMnk0K.js → desktop-actions-3aiwi-wY.js} +1 -1
  19. package/web/dist/assets/{file-editor-BRZ1wGrJ.js → file-editor-CpwgQA6Z.js} +2 -2
  20. package/web/dist/assets/{files-CbiIDuCN.js → files-D4CzkVZ-.js} +1 -1
  21. package/web/dist/assets/index-4fobVNe9.js +10 -0
  22. package/web/dist/assets/index-rsNq4als.css +2 -0
  23. package/web/dist/assets/lazyRouteComponent-B-XUbSrq.js +1 -0
  24. package/web/dist/assets/link-DkgNzeiC.js +1 -0
  25. package/web/dist/assets/pair-BhXDazsm.js +1 -0
  26. package/web/dist/assets/pair-GnPjxKlt.js +1 -0
  27. package/web/dist/assets/{review-route-BmOqxMxv.js → review-route-pjHfjF9J.js} +1 -1
  28. package/web/dist/assets/reviews-CCry97BC.js +1382 -0
  29. package/web/dist/assets/root-DLTE-HSj.js +1 -0
  30. package/web/dist/assets/{store-B70lwceg.js → store-C-FZWhob.js} +29 -29
  31. package/web/dist/assets/useRouterState-3SkCgP-l.js +1 -0
  32. package/web/dist/assets/{workspace-error-DxSI59T-.js → workspace-error-D6f2voC4.js} +1 -1
  33. package/web/dist/assets/{workspace-pending-BD49-liX.js → workspace-pending-eUi5r6LE.js} +1 -1
  34. package/web/dist/index.html +10 -10
  35. package/web/dist/assets/_-B7WKStG_.js +0 -1
  36. package/web/dist/assets/_layerId-Cpzkbx-o.js +0 -1
  37. package/web/dist/assets/_paired-DIrKwyOd.js +0 -1
  38. package/web/dist/assets/_paired-dOYqBIXq.js +0 -1
  39. package/web/dist/assets/_reviewId-CcQvm0cu.js +0 -1
  40. package/web/dist/assets/_revision-BFFo1iEH.js +0 -1
  41. package/web/dist/assets/_section-B-luVh6R.js +0 -1
  42. package/web/dist/assets/_worktreeId-BKxKSVKs.js +0 -1
  43. package/web/dist/assets/_worktreeId-DIrKwyOd.js +0 -1
  44. package/web/dist/assets/_worktreeId-dOYqBIXq.js +0 -1
  45. package/web/dist/assets/access-P0rZuFJT.js +0 -1
  46. package/web/dist/assets/index-BXo5ZqVf.css +0 -2
  47. package/web/dist/assets/index-YZrLUmqQ.js +0 -10
  48. package/web/dist/assets/lazyRouteComponent-HdZJNYM2.js +0 -1
  49. package/web/dist/assets/link-D9sCFypD.js +0 -1
  50. package/web/dist/assets/pair-dOYqBIXq.js +0 -1
  51. package/web/dist/assets/pair-xkkjkm9Y.js +0 -1
  52. package/web/dist/assets/reviews-CQOio1Aq.js +0 -1382
  53. package/web/dist/assets/useMatch-N1ge3lF_.js +0 -1
  54. package/web/dist/assets/useRouterState-DuzGu1Qw.js +0 -1
@@ -0,0 +1,1382 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/file-editor-CpwgQA6Z.js","assets/rolldown-runtime-hePW80VL.js","assets/files-D4CzkVZ-.js","assets/store-C-FZWhob.js","assets/preload-helper-Czpn1I53.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,$i as n,$l as r,$n as i,$o as a,$t as o,Aa as s,Ad as c,Ai as l,An as u,Ar as d,As as f,B as p,Bc as m,Bo as h,C as g,Cc as _,Cd as v,Ci as y,Cl as b,Cn as x,Ct as S,Da as C,Dc as w,Dd as T,Di as E,Dn as D,Do as O,Dt as k,Ec as A,Ed as j,Eo as M,Es as N,Et as P,F,Fd as I,Fn as L,Fo as R,Ga as z,Gn as B,Gt as V,H,Hn as U,Ho as W,Hr as G,Ht as ee,Ia as te,Id as K,Ir as ne,Is as q,Ka as re,Kl as ie,Kn as ae,Ko as oe,La as se,Lc as ce,Li as le,Ln as ue,Lo as de,Lr as fe,Ls as pe,Ma as me,Mc as he,Md as ge,Mi as _e,Mr as ve,Ms as ye,Na as be,Nc as xe,Ni as Se,Nn as Ce,No as we,Nr as Te,Ns as Ee,O as De,Oi as Oe,On as ke,Oo as Ae,Or as je,Os as Me,Ot as Ne,Po as Pe,Ps as Fe,Qi as Ie,Qn as Le,Qo as J,Qr as Re,Qt as ze,Qu as Be,Ri as Ve,Rl as He,Rn as Ue,Ro as We,Rr as Ge,Ru as Ke,S as qe,Sa as Je,Sc as Ye,Sd as Xe,Si as Ze,Sn as Qe,Sr as $e,Ss as et,St as tt,Su as nt,T as rt,Tc as it,Ti as at,Tn as ot,To as st,Ts as ct,Tt as lt,Uc as ut,Un as dt,Uo as ft,Ur as pt,Ut as mt,Va as ht,Vc as gt,Vn as _t,Vr as vt,Vs as yt,Vt as bt,W as xt,Wn as St,Wo as Ct,Wt as wt,Wu as Tt,X as Et,Xn as Dt,Xo as Ot,Xs as kt,Xt as At,Y as jt,Yi as Mt,Yo as Nt,Z as Pt,Zc as Ft,Zi as It,Zl as Lt,Zr as Rt,_ as zt,_a as Bt,_i as Vt,_n as Ht,_r as Ut,_s as Wt,_t as Gt,aa as Kt,al as qt,an as Jt,ao as Yt,ar as Xt,as as Zt,b as Qt,bc as $t,bd as en,bi as tn,bl as nn,bn as rn,br as an,bs as on,bt as sn,ca as cn,cd as ln,ci as un,cl as dn,cn as fn,co as pn,cr as mn,d as hn,dc as gn,dd as _n,di as vn,dl as yn,dn as bn,dr as xn,ds as Sn,du as Cn,ea as wn,ei as Tn,en as En,er as Dn,et as On,f as kn,fi as An,fn as jn,ft as Mn,fu as Nn,g as Pn,ga as Fn,gc as In,gd as Ln,gi as Rn,gn as zn,gr as Bn,gt as Vn,gu as Hn,h as Un,ha as Wn,hd as Gn,hi as Kn,hn as qn,hr as Jn,hs as Yn,hu as Xn,i as Zn,id as Qn,in as Y,ir as $n,is as er,j as tr,jd as nr,ji as rr,jn as ir,jo as ar,ka as or,kc as sr,kd as cr,kn as lr,ko as ur,kr as dr,ks as fr,l as pr,lc as mr,ld as hr,li as gr,ln as _r,ls as vr,m as yr,md as br,mi as xr,ml as Sr,mn as Cr,mu as wr,n as Tr,na as Er,nd as Dr,ni as Or,nt as kr,oa as Ar,oc as jr,oo as Mr,os as Nr,ot as Pr,p as Fr,pc as Ir,pd as Lr,pi as Rr,pl as zr,pr as Br,pt as Vr,pu as Hr,q as Ur,ql as Wr,qo as Gr,qs as Kr,qt as qr,r as Jr,ra as Yr,rd as Xr,rl as Zr,rn as Qr,rr as $r,s as ei,sa as ti,so as ni,sr as ri,ss as ii,t as ai,ta as oi,tc as si,td as ci,ti as li,tl as ui,tn as X,ts as di,tt as fi,u as pi,ua as mi,ud as hi,ui as gi,un as _i,us as vi,v as yi,va as bi,vd as xi,vi as Si,vo as Ci,vs as wi,vt as Ti,w as Ei,wa as Di,wc as Oi,wl as ki,wn as Ai,wo as ji,ws as Mi,wt as Ni,x as Pi,xd as Fi,xi as Ii,xs as Li,xt as Ri,y as zi,ya as Bi,yi as Vi,yn as Hi,ys as Ui,yt as Wi,zl as Gi,zn as Ki,zo as qi,zr as Ji}from"./files-D4CzkVZ-.js";import{$ as Yi,$n as Xi,$t as Zi,An as Qi,At as $i,B as ea,Bn as ta,Bt as na,C as ra,D as ia,Dn as aa,E as oa,Et as sa,F as ca,Fn as la,Ft as ua,G as da,Gn as fa,Gt as pa,H as ma,Hn as ha,Ht as ga,I as _a,In as va,It as ya,J as ba,Jn as xa,Jt as Sa,K as Ca,Kn as wa,Kt as Ta,L as Ea,Ln as Da,Lt as Oa,M as ka,Mn as Aa,Mt as ja,N as Ma,Nn as Na,Nt as Pa,O as Fa,On as Ia,P as La,Pn as Ra,Pt as za,Q as Ba,Qn as Va,Qt as Ha,R as Ua,Rn as Wa,Rt as Ga,S as Ka,Sn as qa,T as Ja,Tn as Ya,Tr as Xa,Tt as Za,U as Qa,Un as $a,Ut as eo,V as to,Vn as no,Vt as ro,W as io,Wn as ao,Wt as oo,X as so,Xn as co,Xt as lo,Y as uo,Yn as fo,Yt as po,Z as mo,Zn as ho,Zt as go,_ as _o,_n as vo,_r as yo,_t as bo,a as xo,an as So,ar as Co,at as wo,b as To,bn as Eo,br as Do,c as Oo,cr as ko,ct as Ao,d as jo,dr as Mo,en as No,er as Po,et as Fo,f as Io,fn as Lo,fr as Ro,g as zo,gn as Bo,gr as Vo,gt as Ho,h as Uo,hn as Wo,hr as Go,ht as Ko,in as qo,ir as Jo,it as Yo,j as Xo,jn as Zo,jt as Qo,k as $o,kn as es,kt as ts,l as ns,ln as rs,lr as is,lt as as,m as os,mn as ss,mr as cs,mt as ls,n as us,nn as ds,nr as fs,nt as ps,o as ms,on as hs,or as gs,ot as _s,p as vs,pn as ys,pr as bs,q as xs,qn as Ss,qt as Cs,r as ws,rn as Ts,rr as Es,rt as Ds,s as Os,sr as ks,st as As,t as js,tn as Ms,tr as Ns,tt as Ps,u as Fs,un as Is,ur as Ls,ut as Rs,v as zs,vn as Bs,vr as Vs,vt as Hs,w as Us,wn as Ws,wt as Gs,x as Ks,xn as qs,y as Js,yn as Ys,yr as Xs,z as Zs,zn as Qs,zt as $s}from"./access-Cf1mwFvV.js";import{i as ec,o as tc,s as nc,t as rc}from"./link-DkgNzeiC.js";import{$ as ic,$n as ac,$t as oc,A as sc,An as cc,At as lc,B as uc,Bt as dc,C as fc,Cn as pc,Ct as mc,D as hc,Dn as gc,Dt as _c,E as vc,En as yc,Et as bc,Fn as xc,Ft as Sc,Gt as Cc,H as wc,I as Tc,In as Ec,It as Dc,J as Oc,Jt as kc,K as Ac,Kt as jc,L as Mc,Ln as Nc,Lt as Pc,M as Fc,Mn as Ic,Mt as Lc,N as Rc,Nn as zc,Nt as Bc,O as Vc,On as Hc,Ot as Uc,P as Wc,Pn as Gc,Pt as Kc,Q as qc,Qn as Jc,Qt as Yc,R as Xc,Rn as Zc,Rt as Qc,S as $c,Sn as el,St as tl,T as nl,Tn as rl,Tt as il,U as al,V as ol,Vt as sl,Wt as cl,X as ll,Xn as ul,Xt as dl,Y as fl,Yt as pl,Z as ml,Zn as hl,Zt as gl,_n as _l,_t as vl,a as yl,an as bl,ar as xl,at as Sl,b as Cl,bn as wl,bt as Tl,c as El,ct as Dl,d as Ol,dn as kl,dt as Al,en as jl,er as Ml,et as Nl,f as Pl,fn as Fl,g as Il,gn as Ll,gt as Rl,hn as zl,ht as Bl,in as Vl,ir as Hl,it as Ul,j as Wl,jn as Gl,jt as Kl,k as ql,kn as Jl,kt as Yl,l as Xl,ln as Zl,lt as Ql,m as $l,mn as eu,mt as tu,n as nu,nn as ru,nr as iu,nt as au,o as ou,on as su,ot as cu,p as lu,pn as uu,pt as du,q as fu,qt as pu,r as mu,rn as hu,rr as gu,rt as _u,st as vu,t as yu,tn as bu,tr as xu,tt as Su,un as Cu,ut as wu,vn as Tu,vt as Eu,w as Du,wn as Ou,wt as ku,x as Au,xn as ju,xt as Mu,yn as Nu,yt as Pu,z as Fu,zn as Iu,zt as Lu}from"./store-C-FZWhob.js";import{t as Ru}from"./preload-helper-Czpn1I53.js";function zu(e){let t=Xa();return nc(t.stores.location,tc(e,t))}function Bu(){let e=Xa();return nc(e.stores.location,e=>e.state.__TSR_index!==0)}var Z=e(Se(),1),Vu=l();function Hu(e,t){return e===t}function Uu(e,t=e=>e,n){let r=n?.compare??Hu,i=(0,Z.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,Z.useCallback)(()=>e.get(),[e]);return(0,Vu.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function Wu(e,t){return t!=null&&!cs(t)?0:typeof e==`function`?e():e}function Gu(e,t,n){let r=Wu(e,n);return typeof r==`number`?r:r?.[t]}function Ku(e){return typeof e==`function`?e():e}function qu(e,t){return t||e===`click`||e===`mousedown`}function Ju(e){return e?.includes(`mouse`)&&e!==`mousedown`}var Q=_e(),Yu=Z.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new fe,currentIdRef:{current:null},currentContextRef:{current:null}});function Xu(e,t){e.current=t.current}function Zu(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=Z.useRef(n),a=Z.useRef(n),o=Z.useRef(null),s=Z.useRef(null),c=Ge();return Rr(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:Gu(i.current,`open`),close:Gu(n,`close`)}},[n,o,i,a]),(0,Q.jsx)(Yu.Provider,{value:Z.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Qu(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=Z.useContext(Yu),[f,p]=Z.useState(!1),m=Z.useRef(n);return Rr(()=>{m.current=n},[n]),Rr(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),Rr(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:Gu(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,_r(rn))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),Rr(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,Xu(o,c),d.clear()}},[l,a,o,i,c,d]),Z.useMemo(()=>({activeIdRef:a,hasProvider:u,delayRef:o,isInstantPhase:f}),[a,u,o,f])}function $u(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function ed(e){return e!=null&&e.clientX!=null}function td(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=Z.useRef(!1),u=Z.useRef(null),[f,p]=Z.useState(),[m,h]=Z.useState([]),g=gr(e=>{i.set(`positionReference`,e)}),_=gr((e,t,n)=>{l.current||(!c.current.openEvent||ed(c.current.openEvent))&&i.set(`positionReference`,$u(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:f}))}),v=gr(e=>{a?u.current||(_(e.clientX,e.clientY,e.currentTarget),h([])):_(e.clientX,e.clientY,e.currentTarget)}),y=cs(f)?o:a;Z.useEffect(()=>{if(!n){g(s);return}if(!y)return;function e(){u.current?.(),u.current=null}let t=Re(o);function r(t){let n=d(t);dr(o,n)?e():_(t.clientX,t.clientY)}return!c.current.openEvent||ed(c.current.openEvent)?u.current=vt(t,`mousemove`,r):g(s),e},[y,n,o,c,s,i,_,g,m]),Z.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),Z.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),Z.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let b=Z.useMemo(()=>{function e(e){p(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:v,onMouseEnter:v}},[v]);return Z.useMemo(()=>n?{reference:b,trigger:b}:{},[n,b])}var nd=rr(),rd=e(Oe(),1),id=class{attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(e,t,n=!0){this.fallbackStore=e,this.componentName=t,this.throwOnMissingTrigger=n}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(e){return this.storeListeners.add(e),()=>{this.storeListeners.delete(e)}}attachStore(e){return this.attachedStores.push(e),this.setActiveStore(e),()=>{let t=this.attachedStores.lastIndexOf(e);t!==-1&&this.attachedStores.splice(t,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(e){this.attachedStoreValue!==e&&(this.attachedStoreValue=e,this.storeListeners.forEach(e=>{e()}))}openByTrigger(e){let t=this.attachedStore;if(t===null)return;let n;if(e){for(let t=this.attachedStores.length-1;t>=0&&!n;--t)n=this.attachedStores[t].context.triggerElements.getById(e);n??=this.fallbackStore.context.triggerElements.getById(e)}if(e&&!n&&this.throwOnMissingTrigger)throw Error(An(99,this.componentName,e,this.componentName));t.setOpen(!0,_r(qn,void 0,n))}closePopup(){let e=this.attachedStore;e!==null&&e.setOpen(!1,_r(qn))}};function ad(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new fs({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Vt,inactiveTriggerProps:Vt,popupProps:Vt}}var od=e=>e.triggerIdProp??e.activeTriggerId,sd=e=>e.openProp??e.open,cd=e=>(e.popupElement?.id??e.floatingId)||void 0;function ld(e,t){return t!==void 0&&sd(e)&&od(e)===t}function ud(e,t){return ld(e,t)?!0:t!==void 0&&sd(e)&&od(e)==null&&e.triggerCount===1}var dd={open:sd,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:od,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:cd,isTriggerActive:(e,t)=>t!==void 0&&od(e)===t,isOpenedByTrigger:(e,t)=>ld(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&od(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>ud(e,t)?cd(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function fd(e){let t=Z.useCallback(t=>e===void 0?Si:e.subscribeStore(t),[e]),n=Z.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,nd.useSyncExternalStore)(t,n,()=>e?.serverStore)}var pd=ne&&Te;function md(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Z.useRef(!1),c=Z.useRef(null),l=Z.useRef(!0),u=Ge();Z.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=Re(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&li(e)&&e===je(G(e))&&(s.current=!0,c.current=e)}function a(){l.current=!0}function o(){l.current=!1}return pt(vt(t,`blur`,r),pd&&vt(t,`keydown`,a,!0),pd&&vt(t,`pointerdown`,o,!0))},[i,n]),Z.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);Tn(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let f=Z.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=d(t.nativeEvent);if(Tn(a)){if(pd&&!t.relatedTarget){if(!l.current&&!Jn(a))return}else if(!Bn(a))return}let o=Br(t.relatedTarget,i.context.triggerElements),{nativeEvent:f,currentTarget:p}=t,m=typeof r==`function`?r():r;if(i.select(`open`)&&o||m===0||m===void 0){i.setOpen(!0,_r(x,f,p));return}u.start(m,()=>{s.current||i.setOpen(!0,_r(x,f,p))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=Tn(n)&&n.hasAttribute(fn(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=je(G(e));(n||t!==e)&&(dr(o.current.floatingContext?.refs.floating.current,t)||dr(e,t)||a||Br(n??t,i.context.triggerElements)||i.setOpen(!1,_r(x,r)))})}}},[o,r,i,u]);return Z.useMemo(()=>n?{reference:f,trigger:f}:{},[n,f])}var hd=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new fe,this.restTimeout=new fe,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},gd=new WeakMap;function _d(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&gd.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),gd.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function vd(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=gd.get(n);a&&a!==e&&_d(a),_d(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,gd.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function yd(e){let t=e.context.dataRef.current,n=xr(()=>t.hoverInteractionState??hd.create()).current;return t.hoverInteractionState||=n,Kn(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function bd(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=Ls(),f=is(),p=yd(a),m=Ge(),h=gr(()=>qu(l.current.openEvent?.type,p.interactedInside)),g=gr(()=>Ju(l.current.openEvent?.type)),_=gr(()=>{_d(p)});Rr(()=>{o||(p.pointerType=void 0,p.restTimeoutPending=!1,p.interactedInside=!1,_())},[o,p,_]),Z.useEffect(()=>_,[_]),Rr(()=>{if(n&&o&&p.handleCloseOptions?.blockPointerEvents&&g()&&Tn(c)&&s){let e=c,t=s,n=G(s),r=u?.nodesRef.current.find(e=>e.id===f)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=p.pointerEventsScopeElement===t?null:p.pointerEventsScopeElement,a=r===t?null:r,o=p.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return vd(p,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{_()}}},[n,o,c,s,p,g,u,f,_]),Z.useEffect(()=>{if(!n)return;function e(){return!!(u&&f&&Vo(u.nodesRef.current,f).length>0)}function t(e){let t=Gu(r,`close`,p.pointerType),n=()=>{a.setOpen(!1,_r(Ai,e)),u?.events.emit(`floating.closed`,e)};t?p.openChangeTimeout.start(t,n):(p.openChangeTimeout.clear(),n())}function o(e){let t=d(e);if(!xn(t)){p.interactedInside=!1;return}p.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){p.openChangeTimeout.clear(),m.clear(),u?.events.off(`floating.closed`,y),_()}function v(n){if(e()&&u){u.events.on(`floating.closed`,y);return}if(Br(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&Tn(o)&&Vo(u.nodesRef.current,r,!1).some(e=>dr(e.context?.elements.floating,o)))){if(p.handler){p.handler(n);return}_(),g()&&!h()&&t(n)}}function y(t){u&&f&&!e()&&m.start(0,()=>{u.events.off(`floating.closed`,y),a.setOpen(!1,_r(Ai,t)),u.events.emit(`floating.closed`,t)})}let b=s;return pt(b&&vt(b,`mouseenter`,c),b&&vt(b,`mouseleave`,v),b&&vt(b,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,y)})},[n,s,a,l,r,i,g,h,_,p,u,f,m])}var xd={current:null};function Sd(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=xd,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:p,shouldOpen:m,guardStaleOpen:h=!1}=t,g=`rootStore`in e?e.rootStore:e,{dataRef:_,events:v}=g.context,y=Ls(l),b=yd(g),x=Z.useRef(!1),S=Ro(i),C=Ro(r),w=Ro(o),T=Ro(n),E=Ro(m),D=Ro(p),O=gr(()=>qu(_.current.openEvent?.type,b.interactedInside)),k=gr(()=>E.current?.()!==!1),A=gr((e,t,n)=>{let r=g.context.triggerElements;if(r.hasElement(t))return!e||!dr(e,t);if(!Tn(n))return!1;let i=n;return r.hasMatchingElement(e=>dr(e,i))&&(!e||!dr(e,i))}),j=gr(()=>{b.handler&&=(G(g.select(`domReferenceElement`)).removeEventListener(`mousemove`,b.handler),void 0)}),M=gr(()=>{_d(b)});return u&&(b.handleCloseOptions=i?.__options),Z.useEffect(()=>j,[j]),Z.useEffect(()=>{if(!n)return;function e(e){e.open?x.current=!1:(x.current=e.reason===Ai,j(),b.openChangeTimeout.clear(),b.restTimeout.clear(),b.blockMouseMove=!0,b.restTimeoutPending=!1)}return v.on(`openchange`,e),()=>{v.off(`openchange`,e)}},[n,v,b,j]),Z.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Gu(C.current,`close`,b.pointerType);n?b.openChangeTimeout.start(n,()=>{g.setOpen(!1,_r(Ai,e)),y?.events.emit(`floating.closed`,e)}):t&&(b.openChangeTimeout.clear(),g.setOpen(!1,_r(Ai,e)),y?.events.emit(`floating.closed`,e))}let t=c.current??(u?g.select(`domReferenceElement`):null);if(!Tn(t))return;function r(e){if(b.openChangeTimeout.clear(),b.blockMouseMove=!1,a&&!cs(b.pointerType))return;let t=Ku(w.current),n=Gu(C.current,`open`,b.pointerType),r=d(e),i=e.currentTarget??null,o=g.select(`domReferenceElement`),s=i;if(Tn(r)&&!g.context.triggerElements.hasElement(r)){for(let e of g.context.triggerElements.elements())if(dr(e,r)){s=e;break}}Tn(i)&&Tn(o)&&!g.context.triggerElements.hasElement(i)&&dr(i,o)&&(s=o);let c=s!=null&&A(o,s,r),l=g.select(`open`),u=D.current?.()??g.select(`transitionStatus`)===`ending`,f=!l&&u&&x.current,p=!c&&Tn(s)&&Tn(o)&&dr(o,s)&&f,m=t>0&&!n,h=c&&(l||f)||p,_=!l||c;if(h){k()&&g.setOpen(!0,_r(Ai,e,s));return}m||(n?b.openChangeTimeout.start(n,()=>{_&&k()&&g.setOpen(!0,_r(Ai,e,s))}):_&&k()&&g.setOpen(!0,_r(Ai,e,s)))}function i(t){if(O()){M();return}j();let n=g.select(`domReferenceElement`),r=G(n);b.restTimeout.clear(),b.restTimeoutPending=!1;let i=_.current.floatingContext??f?.();if(!Br(t.relatedTarget,g.context.triggerElements)){if(S.current&&i){g.select(`open`)||b.openChangeTimeout.clear();let n=c.current;b.handler=S.current({...i,tree:y,x:t.clientX,y:t.clientY,onClose(){M(),j(),T.current&&!O()&&n===g.select(`domReferenceElement`)&&e(t,!0)}}),r.addEventListener(`mousemove`,b.handler),b.handler(t);return}(b.pointerType!==`touch`||!dr(g.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){dr(t,e.relatedTarget)||(b.openChangeTimeout.clear(),b.restTimeout.clear(),b.restTimeoutPending=!1)}let l=h?vt(t,`mouseout`,o):void 0;return s?pt(vt(t,`mousemove`,r,{once:!0}),vt(t,`mouseenter`,r),vt(t,`mouseleave`,i),l):pt(vt(t,`mouseenter`,r),vt(t,`mouseleave`,i),l)},[j,M,_,C,g,n,S,b,u,A,O,a,s,w,c,y,T,f,D,k,h]),Z.useMemo(()=>{if(!n)return;function e(e){b.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=g.select(`domReferenceElement`),i=g.select(`open`),o=A(r,n,e.target);if(a&&!cs(b.pointerType))return;if(i&&o&&b.handleCloseOptions?.blockPointerEvents){let e=g.select(`floatingElement`);if(e){let t=b.handleCloseOptions?.getScope?.()??n.ownerDocument.body;vd(b,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Ku(w.current);if(i&&!o||s===0||!o&&b.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;b.restTimeout.clear();function c(){if(b.restTimeoutPending=!1,O())return;let e=g.select(`open`);!b.blockMouseMove&&(!e||o)&&k()&&g.setOpen(!0,_r(Ai,t,n))}b.pointerType===`touch`?rd.flushSync(()=>{c()}):o&&i?c():(b.restTimeoutPending=!0,b.restTimeout.start(s,c))}}},[n,b,O,A,a,g,w,k])}var Cd=.1,wd=Cd*Cd,Td=.5;function Ed(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Dd(e,t,n,r,i,a,o,s,c,l){let u=!1;return Ed(e,t,n,r,i,a)&&(u=!u),Ed(e,t,i,a,o,s)&&(u=!u),Ed(e,t,o,s,c,l)&&(u=!u),Ed(e,t,c,l,n,r)&&(u=!u),u}function Od(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function kd(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Ad(e={}){let{blockPointerEvents:t=!1}=e,n=new fe,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,f=null,p=typeof performance<`u`?performance.now():0;function m(e,t){let n=performance.now(),r=n-p;if(u===null||f===null||r===0)return u=e,f=t,p=n,!1;let i=e-u,a=t-f,o=i*i+a*a,s=r*r*wd;return u=e,f=t,p=n,o<s}function h(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:f,clientY:p}=r,g=d(r),_=r.type===`mouseleave`,v=dr(u,g),y=dr(a,g);if(v&&(l=!0,!_))return;if(y&&(l=!1,!_)){l=!0;return}if(_&&Tn(r.relatedTarget)&&dr(u,r.relatedTarget))return;function b(){return!!(s&&Vo(s.nodesRef.current,o).length>0)}function x(){b()||h()}if(b())return;let S=a.getBoundingClientRect(),C=u.getBoundingClientRect(),w=e>C.right-C.width/2,T=t>C.bottom-C.height/2,E=C.width>S.width,D=C.height>S.height,O=(E?S:C).left,k=(E?S:C).right,A=(D?S:C).top,j=(D?S:C).bottom;if(c===`top`&&t>=S.bottom-1||c===`bottom`&&t<=S.top+1||c===`left`&&e>=S.right-1||c===`right`&&e<=S.left+1){x();return}let M=!1;switch(c){case`top`:M=kd(f,p,O,S.top+1,k,C.bottom-1);break;case`bottom`:M=kd(f,p,O,C.top+1,k,S.bottom-1);break;case`left`:M=kd(f,p,C.right-1,j,S.left+1,A);break;case`right`:M=kd(f,p,S.right-1,j,C.left+1,A)}if(M)return;if(l&&!Od(f,p,S)){x();return}if(!_&&m(f,p)){x();return}let N=!1;switch(c){case`top`:{let n=E?Td/2:Td*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t+Td+1,o=w||E?C.bottom-Td:C.top,s=w?E?C.bottom-Td:C.top:C.bottom-Td;N=Dd(f,p,r,a,i,a,C.left,o,C.right,s);break}case`bottom`:{let n=E?Td/2:Td*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t-Td,o=w||E?C.top+Td:C.bottom,s=w?E?C.top+Td:C.bottom:C.top+Td;N=Dd(f,p,r,a,i,a,C.left,o,C.right,s);break}case`left`:{let n=D?Td/2:Td*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e+Td+1,o=T||D?C.right-Td:C.left,s=T?D?C.right-Td:C.left:C.right-Td;N=Dd(f,p,o,C.top,s,C.bottom,a,r,a,i);break}case`right`:{let n=D?Td/2:Td*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e-Td,o=T||D?C.left+Td:C.right,s=T?D?C.left+Td:C.right:C.left+Td;N=Dd(f,p,a,r,a,i,o,C.top,s,C.bottom);break}}N?l||n.start(40,x):x()}};return r.__options={...e,blockPointerEvents:t},r}var jd={name:`archive-restore`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]};jd.node;var Md=En(jd),Nd={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};Nd.node;var Pd=En(Nd),Fd={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};Fd.node;var Id=En(Fd),Ld={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};Ld.node;var Rd=En(Ld),zd={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};zd.node;var Bd=En(zd),Vd={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Vd.node;var Hd=En(Vd),Ud={name:`chevrons-down-up`,size:24,node:[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]};Ud.node;var Wd=En(Ud),Gd={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};Gd.node;var Kd=En(Gd),qd={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};qd.node;var Jd=En(qd),Yd={name:`circle-minus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]],aliases:[`minus-circle`]};Yd.node;var Xd=En(Yd),Zd={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};Zd.node;var Qd=En(Zd),$d={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};$d.node;var ef=En($d),tf={name:`columns-2`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]],aliases:[`columns`]};tf.node;var nf=En(tf),rf={name:`copy-plus`,size:24,node:[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};rf.node;var af=En(rf),of={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};of.node;var sf=En(of),cf={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};cf.node;var lf=En(cf),uf={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};uf.node;var df=En(uf),ff={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};ff.node;var pf=En(ff),mf={name:`file-code`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]};mf.node;var hf=En(mf),gf={name:`file-diff`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]};gf.node;var _f=En(gf),vf={name:`file-plus`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]};vf.node;var yf=En(vf),bf={name:`file-question-mark`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]],aliases:[`file-question`]};bf.node;var xf=En(bf),Sf={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};Sf.node;var Cf=En(Sf),wf={name:`file`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]};wf.node;var Tf=En(wf),Ef={name:`files`,size:24,node:[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`14sh0y`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`,key:`1970lx`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]};Ef.node;var Df=En(Ef),Of={name:`flask-conical`,size:24,node:[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]};Of.node;var kf=En(Of),Af={name:`folder-git-2`,size:24,node:[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]};Af.node;var jf=En(Af),Mf={name:`folder-minus`,size:24,node:[[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};Mf.node;var Nf=En(Mf),Pf={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};Pf.node;var Ff=En(Pf),If={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};If.node;var Lf=En(If),Rf={name:`funnel`,size:24,node:[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]],aliases:[`filter`]};Rf.node;var zf=En(Rf),Bf={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};Bf.node;var Vf=En(Bf),Hf={name:`git-commit-horizontal`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]],aliases:[`git-commit`]};Hf.node;var Uf=En(Hf),Wf={name:`git-graph`,size:24,node:[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v6`,key:`158jrl`}],[`circle`,{cx:`5`,cy:`18`,r:`3`,key:`104gr9`}],[`path`,{d:`M12 3v18`,key:`108xh3`}],[`circle`,{cx:`19`,cy:`6`,r:`3`,key:`108a5v`}],[`path`,{d:`M16 15.7A9 9 0 0 0 19 9`,key:`1e3vqb`}]]};Wf.node;var Gf=En(Wf),Kf={name:`git-merge`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]};Kf.node;var qf=En(Kf),Jf={name:`keyboard`,size:24,node:[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]};Jf.node;var Yf=En(Jf),Xf={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};Xf.node;var Zf=En(Xf),Qf={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};Qf.node;var $f=En(Qf),ep={name:`list-chevrons-up-down`,size:24,node:[[`path`,{d:`M3 5h8`,key:`18g2rq`}],[`path`,{d:`M3 12h8`,key:`1xfjp6`}],[`path`,{d:`M3 19h8`,key:`fpbke4`}],[`path`,{d:`m15 8 3-3 3 3`,key:`bc4io6`}],[`path`,{d:`m15 16 3 3 3-3`,key:`9wmg1l`}]]};ep.node;var tp=En(ep),np={name:`list-x`,size:24,node:[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`m15.5 9.5 5 5`,key:`ytk86i`}],[`path`,{d:`m20.5 9.5-5 5`,key:`17o44f`}]]};np.node;var rp=En(np),ip={name:`message-square-plus`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]};ip.node;var ap=En(ip),op={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};op.node;var sp=En(op),cp={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};cp.node;var lp=En(cp),up={name:`palette`,size:24,node:[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]};up.node;var dp=En(up),fp={name:`panel-left`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]],aliases:[`sidebar`]};fp.node;var pp=En(fp),mp={name:`panel-right`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]};mp.node;var hp=En(mp),gp={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};gp.node;var _p=En(gp),vp={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};vp.node;var yp=En(vp),bp={name:`pin-off`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]};bp.node;var xp=En(bp),Sp={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Sp.node;var Cp=En(Sp),wp={name:`radio-tower`,size:24,node:[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]};wp.node,En(wp);var Tp={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};Tp.node;var Ep=En(Tp),Dp={name:`reply`,size:24,node:[[`path`,{d:`M20 18v-2a4 4 0 0 0-4-4H4`,key:`5vmcpk`}],[`path`,{d:`m9 17-5-5 5-5`,key:`nvlc11`}]]};Dp.node;var Op=En(Dp),kp={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};kp.node;var Ap=En(kp),jp={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};jp.node;var Mp=En(jp),Np={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Np.node;var Pp=En(Np),Fp={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};Fp.node;var Ip=En(Fp),Lp={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Lp.node;var Rp=En(Lp),zp={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};zp.node,En(zp);var Bp={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};Bp.node;var Vp=En(Bp),Hp={name:`square-x`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-square`]};Hp.node;var Up=En(Hp),Wp={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Wp.node;var Gp=En(Wp),Kp={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};Kp.node;var qp=En(Kp),Jp={name:`user`,size:24,node:[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]};Jp.node;var Yp=En(Jp),Xp=Z.createContext(void 0);function Zp(e){let t=Z.useContext(Xp);if(t===void 0&&!e)throw Error(An(72));return t}var Qp=class extends un{setState(e){}update(e){}set(e,t){}notifyAll(){}},$p={...dd,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},em=class extends un{constructor(e,t,n){let r=new ta;super(tm(e,r,t,n),nm(r),$p)}setOpen=(e,t)=>{$a(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,_r(ot,e))}};function tm(e,t,n,r=!1){return{...ad(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function nm(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var rm=gi(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=co((e,t)=>new em({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),Ss(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=xa(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Z.useRef(null);Rr(()=>{m&&t&&p.setOpen(!1,_r(jn))},[m,t,p]),Rr(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),Rr(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),Z.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,_r(qn))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,Q.jsxs)(Xp.Provider,{value:p,children:[l&&(0,Q.jsx)(ha,{handle:l,store:p}),T&&(0,Q.jsx)(im,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function im({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=Es(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=td(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=Z.useMemo(()=>dt(a.reference,i.reference),[a.reference,i.reference]);return fo(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??Vt}),null}var am=Z.createContext(void 0);function om(){return Z.useContext(am)}var sm=`data-base-ui-tooltip-trigger`;function cm(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(Tn(n))return n}}let t=e.target;return Tn(t)?t:null}function lm(e){let t=e;for(;t;){let e=t.closest(`[${sm}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&Tn(n.host)?n.host:null}return null}var um=vn(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=Zp(!0),m=fd(a)??p;if(!m)throw Error(An(82));let h=aa(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=Z.useRef(null),b=u??0,{registerTrigger:x,isMountedByThisTrigger:S}=Va(h,y,m,{payload:o,closeOnClick:l,closeDelay:b}),C=om(),{activeIdRef:w,delayRef:T,isInstantPhase:E,hasProvider:D}=Qu(v,{open:_}),O=yd(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=Ro(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=Z.useRef(!1),F=Ge(),I=Z.useRef(void 0);function L(){return D&&w.current!=null?0:c??C??600}function R(e){let t=y.current;if(!t||!e)return!1;let n=lm(e);return n!==null&&n!==t&&dr(t,n)}function z(e){let t=R(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let B=Sd(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?Ad():null,restMs:L,delay(){return u==null&&D?{close:Gu(T.current,`close`)}:{close:b}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),V=md(v,{enabled:!A}).reference,H=e=>{let t=P.current,n=cm(e),r=z(n),i=y.current,a=i&&n&&dr(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,_r(Ai,e));return}if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&cs(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,_r(Ai,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},W=m.useState(`triggerProps`,S);return U(`button`,e,{state:{open:_},ref:[t,x,y],props:[B,V,S||M!==`none`?W:void 0,{onMouseOver(e){H(e.nativeEvent)},onFocus(e){R(cm(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[Ut]:A?``:void 0,[sm]:A?void 0:``},f],stateAttributesMapping:Do})}),dm=Z.createContext(void 0);function fm(){let e=Z.useContext(dm);if(e===void 0)throw Error(An(70));return e}var pm=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Zp().useState(`mounted`)||n?(0,Q.jsx)(dm.Provider,{value:n,children:(0,Q.jsx)(Ml,{ref:t,...r})}):null}),mm=Z.createContext(void 0);function hm(){let e=Z.useContext(mm);if(e===void 0)throw Error(An(71));return e}var gm=Z.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=ue,style:g,..._}=e,v=Zp(),y=fm(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=v.useState(`adaptiveOrigin`),O=va({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:D}),k=Z.useMemo(()=>({open:b,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,O.side,O.align,O.anchorHidden,S,T]),A=Ra(e,k,{styles:O.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,Q.jsx)(mm.Provider,{value:O,children:A})}),_m=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Zp(),{side:s,align:c}=hm(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);Ue({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),bd(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return U(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[no,f,la(d),a],stateAttributesMapping:Vs})}),vm=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Zp(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=hm(),f={open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)};return U(`div`,e,{state:f,ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:yo})}),ym=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=Z.useMemo(()=>({open:t,close:n}),[t,n]);return(0,Q.jsx)(am.Provider,{value:t,children:(0,Q.jsx)(Zu,{delay:i,timeoutMs:r,children:e.children})})},$=E();function bm({delay:e=0,...t}){return(0,Q.jsx)(ym,{"data-slot":`tooltip-provider`,delay:e,...t})}function xm({...e}){return(0,Q.jsx)(rm,{"data-slot":`tooltip`,...e})}function Sm({...e}){return(0,Q.jsx)(um,{"data-slot":`tooltip-trigger`,...e})}function Cm({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,Q.jsx)(pm,{children:(0,Q.jsx)(gm,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,Q.jsxs)(_m,{"data-slot":`tooltip-content`,className:Y(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-xl bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-lg data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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`,e),...o,children:[a,(0,Q.jsx)(vm,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:translate-x-[1.5px] data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:translate-x-[-1.5px] data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:translate-x-[-1.5px] data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:translate-x-[1.5px] data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var wm=Z.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return U(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),Tm=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
3
+ <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
4
+ <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
5
+ </symbol>
6
+ <symbol id="file-tree-icon-dot" viewBox="0 0 6 6">
7
+ <circle cx="3" cy="3" r="3" />
8
+ </symbol>
9
+ <symbol id="file-tree-icon-file" viewBox="0 0 16 16">
10
+ <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".5"/>
11
+ <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
12
+ </symbol>
13
+ <symbol id="file-tree-icon-lock" viewBox="0 0 16 16">
14
+ <path fill="currentcolor" d="M4 5.336V4a4 4 0 1 1 8 0v1.336c1.586.54 2 1.843 2 4.664v1c0 4.118-.883 5-5 5H7c-4.117 0-5-.883-5-5v-1c0-2.821.414-4.124 2-4.664M5.5 4v1.054Q6.166 4.998 7 5h2q.834-.002 1.5.054V4a2.5 2.5 0 0 0-5 0m-2 6v1c0 .995.055 1.692.167 2.193.107.483.246.686.35.79s.307.243.79.35c.5.112 1.198.167 2.193.167h2c.995 0 1.692-.055 2.193-.166.483-.108.686-.247.79-.35.104-.105.243-.308.35-.791.112-.5.167-1.198.167-2.193v-1c0-.995-.055-1.692-.166-2.193-.108-.483-.247-.686-.35-.79-.105-.104-.308-.243-.791-.35C10.693 6.555 9.995 6.5 9 6.5H7c-.995 0-1.692.055-2.193.167-.483.107-.686.246-.79.35s-.243.307-.35.79C3.555 8.307 3.5 9.005 3.5 10" />
15
+ </symbol>
16
+ <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
17
+ <path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
18
+ </symbol>
19
+ </svg>`,Em=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
20
+ <path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>
21
+ <path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>
22
+ </symbol>`,Dm=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
23
+ <path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>
24
+ </symbol>`,Om=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
25
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
26
+ <path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
27
+ </symbol>`,km=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
28
+ <path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>
29
+ </symbol>`,Am=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
30
+ <path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>
31
+ <path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>
32
+ </symbol>`,jm=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
33
+ <path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>
34
+ <path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>
35
+ <path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>
36
+ </symbol>`,Mm=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
37
+ <path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>
38
+ </symbol>`,Nm=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
39
+ <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
40
+ </symbol>`,Pm=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
41
+ <path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>
42
+ </symbol>`,Fm=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
43
+ <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
44
+ </symbol>`,Im=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
45
+ <path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>
46
+ <path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>
47
+ </symbol>`,Lm=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
48
+ <path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>
49
+ <path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>
50
+ <path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>
51
+ </symbol>`,Rm=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
52
+ <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>
53
+ <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
54
+ </symbol>`,zm=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
55
+ <path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>
56
+ <path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>
57
+ </symbol>`,Bm=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
58
+ <path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>
59
+ <path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>
60
+ </symbol>`,Vm=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
61
+ <path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>
62
+ </symbol>`,Hm=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
63
+ <path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>
64
+ </symbol>`,Um=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
65
+ <path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>
66
+ </symbol>`,Wm=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
67
+ <path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>
68
+ </symbol>`,Gm=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
69
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
70
+ <path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>
71
+ </symbol>`,Km=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
72
+ <path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>
73
+ <path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
74
+ </symbol>`,qm=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
75
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
76
+ <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>
77
+ </symbol>`,Jm=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
78
+ <path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>
79
+ </symbol>`,Ym=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
80
+ <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
81
+ </symbol>`,Xm=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
82
+ <path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>
83
+ <path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>
84
+ </symbol>`,Zm=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
85
+ <defs>
86
+ <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
87
+ <stop stop-color="currentColor"/>
88
+ <stop offset="1" stop-color="currentColor" stop-opacity="0"/>
89
+ </linearGradient>
90
+ </defs>
91
+ <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
92
+ <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
93
+ <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
94
+ </symbol>`,Qm=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
95
+ <path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>
96
+ <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
97
+ </symbol>`,$m=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
98
+ <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>
99
+ </symbol>`,eh=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
100
+ <path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>
101
+ </symbol>`,th=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
102
+ <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
103
+ <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
104
+ <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
105
+ <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
106
+ </symbol>`,nh=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
107
+ <path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>
108
+ <path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>
109
+ </symbol>`,rh=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
110
+ <path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>
111
+ <path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>
112
+ </symbol>`,ih=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
113
+ <path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>
114
+ </symbol>`,ah=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
115
+ <path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>
116
+ </symbol>`,oh=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
117
+ <path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>
118
+ </symbol>`,sh=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
119
+ <path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>
120
+ <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
121
+ </symbol>`,ch=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
122
+ <path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>
123
+ </symbol>`,lh=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
124
+ <path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>
125
+ <path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>
126
+ </symbol>`,uh=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
127
+ <path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>
128
+ <path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>
129
+ </symbol>`,dh=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
130
+ <path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>
131
+ </symbol>`,fh=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
132
+ <path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>
133
+ <path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
134
+ </symbol>`,ph=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
135
+ <path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>
136
+ </symbol>`,mh=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
137
+ <path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>
138
+ </symbol>`,hh=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
139
+ <path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>
140
+ <path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>
141
+ </symbol>`,gh=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
142
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
143
+ <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>
144
+ </symbol>`,_h=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
145
+ <path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>
146
+ </symbol>`,vh=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
147
+ <path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>
148
+ <path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>
149
+ <path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>
150
+ </symbol>`,yh=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
151
+ <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
152
+ <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
153
+ </symbol>`,bh=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
154
+ <path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>
155
+ <path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>
156
+ <path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>
157
+ </symbol>`,xh=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
158
+ <path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>
159
+ <path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>
160
+ </symbol>`,Sh=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
161
+ <path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>
162
+ </symbol>`,Ch=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
163
+ <path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
164
+ <path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
165
+ </symbol>`,wh=[Om,Nm,Fm,Im,Lm,Rm,Vm,Hm,Um,Gm,Km,qm,Jm,Ym,Xm,nh,ih,ah,dh,fh,hh,gh,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
166
+ <path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>
167
+ <path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>
168
+ </symbol>`],Th=[Em,Dm,km,Am,jm,Mm,Pm,zm,Bm,Wm,Zm,Qm,$m,eh,th,rh,oh,sh,ch,lh,uh,ph,mh,_h,vh,yh,bh,xh,Sh,Ch];function Eh(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
169
+ `)}\n</svg>`)}var Dh=Eh(Tm,wh),Oh={minimal:Tm,standard:Dh,complete:Eh(Dh,Th)},kh={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},Ah={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},jh={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},Mh=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),Nh=new Set([`complete`]);function Ph(e){return Oh[e===`none`?`minimal`:e]}function Fh(e){return`file-tree-builtin-${e}`}function Ih(e){return e!==`none`&&Nh.has(e)}function Lh(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=kh[t.toLowerCase()];if(i!=null&&(r||Mh.has(i)))return i;for(let e of n){if(r){let t=jh[e];if(t!=null)return t}let t=Ah[e];if(t!=null&&(r||Mh.has(t)))return t}return`default`}var Rh=`file-tree-container`,zh=`data-file-tree-style`,Bh=`data-file-tree-unsafe-css`,Vh=`data-file-tree-scrollbar-measure`,Hh=`data-file-tree-scrollbar-gutter-measured`,Uh=`--trees-scrollbar-gutter-measured`,Wh=`header`,Gh=`context-menu`,Kh=`context-menu-trigger`;function qh(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function Jh(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(qh(e)?`none`:`complete`),colored:e.colored??!0}}var Yh=e=>e.trim().toLowerCase(),Xh=e=>e.split(`/`).at(-1)??e,Zh=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function Qh(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function $h(e){let t=Jh(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(Yh(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let s=Xh(o),c=s.toLowerCase(),l=r.get(c);if(l!=null)return Qh(l,e);for(let[t,n]of a)if(c.includes(t))return Qh(n,e);let u=Zh(s);for(let t of u){let n=i.get(t);if(n!=null)return Qh(n,e)}let d=Lh(t.set,s,u);if(d!=null&&t.set!==`none`){if(d==="default"){let t=n?.[e];if(t!=null)return Qh(t,e)}return{name:Fh(d),remappedFrom:e,token:d}}}let s=n?.[e];return s==null?{name:e}:Qh(s,e)}}}var eg=5,tg=32,ng=128;function rg(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function ig(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function ag(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function og(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function sg(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function cg(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function lg(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,pg(e,t)}function ug(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=og(e).get(t);if(i===void 0)return;let a=i>>eg;e.childVisibleChunkSums[a]+=r}function dg(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=mg(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=tg}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function fg(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>eg;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<eg}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function pg(e,t){if(t.childIds.length<ng){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/tg),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>eg]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function mg(e,t,n,r){let i=Math.min(t.childIds.length,n+tg),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var hg=7,gg=3,_g=8,vg=4;function yg(e,t,n=0){return e<<vg|n<<gg|t}function bg(e){return e.depthAndFlags>>>vg}function xg(e){return(e.depthAndFlags&_g)>>gg}function Sg(e){return(e.depthAndFlags&_g)!==0}function Cg(e){return e.depthAndFlags&hg}function wg(e,t){return(Cg(e)&t)!==0}function Tg(e,t){e.depthAndFlags|=t}function Eg(e,t){e.depthAndFlags=yg(t,Cg(e),xg(e))}var Dg=Symbol(`benchmarkInstrumentation`);function Og(e,t){return t==null||Object.defineProperty(e,Dg,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function kg(e){return e==null?null:e[Dg]??null}function Ag(e,t,n){return e==null?n():e.measurePhase(t,n)}function jg(e,t,n){Number.isFinite(n)&&e!=null&&e.setCounter(t,n)}function Mg(e){return e>=48&&e<=57}function Ng(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Mg(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Mg(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function Pg(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Ng(t)}}function Fg(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Ig(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=Fg(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Lg(e,t,n){let r=Ig(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Rg(e,t){return Lg(e,t,Pg)}function zg(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Bg(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=zg(e,r);return a===zg(t,r)?Rg(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function Vg(e,t){return Bg(e,t)}function Hg(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Pg(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=zg(e,n);return o===zg(t,n)?Lg(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function Ug(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Pg(r);return e.sortKeyById[t]=i,i}function Wg(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Gg(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function Kg(e){let{hasTrailingSlash:t,segments:n}=Gg(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function qg(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Gg(e);return{requiresDirectory:t,segments:n}}function Jg(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[Pg(``)]}}function Yg(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function Xg(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var Zg=Symbol(`pathStorePreparedInputKind`);function Qg(e,t){return e[Zg]=t,e}function $g(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function e_(e,t,n){return n==="default"?Vg(e,t):n($g(e),$g(t))}function t_(){return{depthAndFlags:yg(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function n_(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function r_(e){return e.isDirectory?e.segments.length:e.segments.length-1}function i_(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function a_(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function o_(e,t={}){return f_(e,t).map(e=>e.path)}function s_(e,t={}){let n=f_(e,t);return Qg({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function c_(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return Qg({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function l_(e){let t=e,n=t.preparedPaths;if(t[Zg]===`prepared`&&n!=null)return n;if(!i_(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function u_(e){let t=e;return t[Zg]===`presorted`&&t.presortedPaths!=null||a_(t.presortedPaths)?t.presortedPaths:null}function d_(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function f_(e,t={}){let n=Wg(t),r=kg(t);jg(r,`workload.inputFiles`,e.length);let i=Ag(r,`store.preparePathEntries.parse`,()=>e.map(e=>Kg(e)));return Ag(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>e_(e,t,n.sort))),i}var p_=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[t_()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Jg();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=kg(e),this.options=Wg(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,rg())}appendPaths(e){return Ag(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>Kg(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Ag(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Ag(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null){if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:yg(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:yg(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d,m=a+1}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:yg(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=Kg(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null){if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:yg(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:yg(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=Kg(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Ag(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Ag(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?Hg(this.lastPreparedPath,e,this.segmentSortKeyCache):e_(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=r_(e),i=n==null?0:r_(n),a=n==null?0:n_(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=Yg(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:yg(bg(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),sg(i,s),s}createFileChildUnchecked(e,t){let n=Yg(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:yg(bg(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),sg(r,a),a}getOrCreateDirectoryChild(e,t){let n=Yg(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!Sg(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:yg(bg(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),sg(r,a),this.directories.set(a,rg()),a}createDirectoryChild(e,t){let n=Yg(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:yg(bg(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),sg(r,a),this.directories.set(a,rg()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Sg(n))throw Error(`Path is not a directory: "${t}"`);if(wg(n,1))throw Error(`Duplicate path: "${t}"`);Tg(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,ig());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(Sg(a)){let t=ig();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;Sg(n)&&this.directories.set(t,rg());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),sg(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Sg(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return lg(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function m_(e,t=`closed`,n=null){let r=g_(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function h_(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function g_(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function __(e,t){return wg(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&bg(t)<=e.defaultExpansion}function v_(e,t,n=e.snapshot.nodes[t]){return n==null||!Sg(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:__(e,n)}function y_(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Sg(r))return;let i=__(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function b_(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function x_(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function S_(e,t){let n=b_(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function C_(e,t){let n=b_(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function w_(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function T_(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function E_(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function D_(e,t){e.directoryLoadInfoById.delete(t)}function O_(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function k_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function A_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function j_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function M_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function N_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function P_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function F_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function I_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function L_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function R_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function z_(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function B_(e,t,n){return{...n,visibleCountDelta:Z_(e)-t}}function V_(e,t){let n=Z_(e),r=h_();e.transactionStack.push(r);try{t()}catch(t){throw W_(e,r,!1),t}W_(e,r,!0,Z_(e)-n)}function H_(e,t){let n=e.instrumentation;if(n==null){U_(e,t);return}Ag(n,`store.events.record`,()=>U_(e,t))}function U_(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){Y_(e,t);return}n.events.push(t),J_(n,t)}function W_(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?q_(i,t):Ag(n,`store.events.batch.merge`,()=>q_(i,t));return}let a=G_(t,r),o=e.instrumentation;if(o==null){Y_(e,a);return}Ag(o,`store.events.batch.commit`,()=>Y_(e,a))}function G_(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function K_(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function q_(e,t){for(let n of t.events)e.events.push(n);K_(e,t)}function J_(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function Y_(e,t){let n=e.instrumentation;if(n==null){X_(e,t);return}Ag(n,`store.events.emit`,()=>X_(e,t))}function X_(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function Z_(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function Q_(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Sg(n)||wg(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!Sg(a)?null:i}function $_(e,t){let n=t;for(;;){let t=Q_(e,n);if(t==null)return n;n=t}}function ev(e,t){let n=[t],r=t;for(;;){let t=Q_(e,r);if(t==null)return n;n.push(t),r=t}}function tv(e,t){let n=t==null?e.snapshot.rootId:dv(e,t);return n==null?[]:hv(e,n)}function nv(e,t){let n=Kg(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Av(e,kv(e,r)),{createdNodeIds:a,directoryId:o}=gv(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=mv(e,o);if(wg(n,1))throw Error(`Path already exists: "${t}"`);Tg(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=vv(e,o,n.basename),s.add(c);cv(e,o);let l=Av(e,o);return k_({affectedAncestorIds:uv(e,c),affectedNodeIds:[...s],path:t,projectionChanged:jv(i,l)})}function rv(e,t,n){let r=dv(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=mv(e,r);if(wg(i,2))throw Error(`The root node cannot be removed`);if(Sg(i)&&pv(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Av(e,a),s=Dv(e,r);xv(e,a,r,i.nameId),Ov(e,a),cv(e,a);let c=Av(e,a);return A_({affectedAncestorIds:uv(e,a),affectedNodeIds:s,path:t,projectionChanged:jv(o,c),recursive:n.recursive===!0})}function iv(e,t,n,r){let i=dv(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=mv(e,i);if(wg(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Tv(e,i,n),c=Av(e,a.parentId),l=Av(e,s.parentId),u=Xg(e.snapshot.segmentTable,a.nameId),d=Yg(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(Sg(a)&&Fv(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=ag(e.snapshot.nodes,pv(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Ev(e,p,o,xg(a))===`skip`)return null;let m=a.parentId;xv(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Pv(e,i),bv(e,s.parentId,i),Ov(e,m),e.pathCacheVersion++,cv(e,m),s.parentId!==m&&cv(e,s.parentId);let h=Av(e,m),g=Av(e,s.parentId);return j_({affectedAncestorIds:[...new Set([...uv(e,m),...uv(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Mv([c,l],[h,g]),to:sv(e,i)})}function av(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function ov(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function sv(e,t){let n=mv(e,t),r=av(e,t);if(r!=null)return r;if(wg(n,2))return ov(e,t,``);let i=sv(e,n.parentId),a=Xg(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return ov(e,t,Sg(n)?`${o}/`:o)}function cv(e,t){let n=e.instrumentation;if(n==null){Lv(e,t);return}Ag(n,`store.recomputeCountsUpwardFrom`,()=>Lv(e,t))}function lv(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!Sg(o)){Iv(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Iv(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function uv(e,t){let n=[],r=t;for(;r!=null;){let t=mv(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function dv(e,t){if(t.length===0)return e.snapshot.rootId;let n=qg(t);return fv(e,n.segments,n.requiresDirectory)}function fv(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=pv(e,r),a=ag(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=mv(e,r);return n&&!Sg(i)?null:r}function pv(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function mv(e,t){let n=e.snapshot.nodes[t];if(n===void 0||wg(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function hv(e,t){let n=e.snapshot.nodes[t];if(n===void 0||wg(n,4))return[];if(!Sg(n))return[sv(e,t)];if(pv(e,t).childIds.length===0)return wg(n,1)&&!wg(n,2)?[sv(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||wg(n,4)){i.pop();continue}if(!Sg(n)){r.push(sv(e,t.nodeId)),i.pop();continue}let a=pv(e,t.nodeId);if(a.childIds.length===0){wg(n,1)&&!wg(n,2)&&r.push(sv(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function gv(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=Yg(e.snapshot.segmentTable,i),a=pv(e,r),o=ag(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!Sg(mv(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=_v(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function _v(e,t,n){let r=mv(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:yg(bg(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,rg()),bv(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function vv(e,t,n){let r=Yg(e.snapshot.segmentTable,n),i=pv(e,t);if(ag(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${zv(e,t,n)}"`);let a=mv(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:yg(bg(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),bv(e,t,o),e.activeNodeCount++,o}function yv(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}Sv(e,n,o)<0?i=a:r=a+1}return r}function bv(e,t,n){let r=pv(e,t),i=mv(e,n);ag(e.snapshot.nodes,r).set(i.nameId,n),ug(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=yv(e,r,n);r.childIds.splice(a,0,n),cg(r,a),pg(e.snapshot.nodes,r)}function xv(e,t,n,r){let i=pv(e,t),a=og(i),o=a.get(n)??-1;ag(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&ug(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),cg(i,o),pg(e.snapshot.nodes,i))}function Sv(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Cv(e,t,n):r(wv(e,t),wv(e,n))}function Cv(e,t,n){let r=mv(e,t),i=mv(e,n),a=Sg(r);if(a!==Sg(i))return a?-1:1;let o=Ig(Ug(e.snapshot.segmentTable,r.nameId),Ug(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=Xg(e.snapshot.segmentTable,r.nameId),c=Xg(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function wv(e,t){let n=mv(e,t),r=sv(e,t),i=Sg(n),a=i?r.slice(0,-1):r;return{basename:Xg(e.snapshot.segmentTable,n.nameId),depth:bg(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Tv(e,t,n){let r=mv(e,t),i=dv(e,n);if(i!=null){let t=mv(e,i);if(Sg(t))return{basename:Xg(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=qg(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=qg(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:fv(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Ev(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${sv(e,t)}"`);let i=mv(e,t);if(xg(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(Sg(i)&&pv(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Dv(e,t),xv(e,a,t,o),Ov(e,a),cv(e,a),`handled`}function Dv(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=mv(e,t.nodeId);if(t.visitedChildren||!Sg(i)){Sg(i)&&e.snapshot.directories.delete(t.nodeId),Tg(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),D_(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=pv(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function Ov(e,t){let n=t;for(;n!=null;){let t=mv(e,n);if(!Sg(t)||wg(t,2)||pv(e,n).childIds.length>0)return;Tg(t,1),n=t.parentId===n?null:t.parentId}}function kv(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=ag(e.snapshot.nodes,pv(e,n)).get(t);if(i==null||!Sg(mv(e,i)))break;n=i}return n}function Av(e,t){let n=Nv(e,t);if(n==null)return null;let r=$_(e,n),i=mv(e,r),a=n===r?null:ev(e,n).map(t=>sv(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:pv(e,r).childIds.length>0,path:sv(e,r),terminalKind:xg(i)})}function jv(e,t){return Mv([e],[t])}function Mv(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Nv(e,t){let n=t;for(;n!=null;){let t=mv(e,n);if(!Sg(t)||wg(t,2))return null;if(!v_(e,n,t))return n;n=t.parentId}return null}function Pv(e,t){let n=mv(e,t);if(Eg(n,(t===e.snapshot.rootId?-1:bg(mv(e,n.parentId)))+1),!Sg(n))return;let r=pv(e,t);for(let t of r.childIds)Pv(e,t)}function Fv(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=mv(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Iv(e,t,n=mv(e,t),r=!1){let i=e.instrumentation;if(i==null){Rv(e,t,n,r);return}Ag(i,`store.recomputeNodeCounts`,()=>Rv(e,t,n,r))}function Lv(e,t){let n=t;for(;n!=null;){let t=mv(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Iv(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&ug(pv(e,s),n,a,o),n=s}}function Rv(e,t,n,r){if(!Sg(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=pv(e,t);if(r){let t=e.instrumentation;t==null?lg(e.snapshot.nodes,i):Ag(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>lg(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,wg(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=Q_(e,t)==null?v_(e,t,n)?1+o:1:o}function zv(e,t,n){let r=sv(e,t);return r.length===0?n:`${r}${n}`}function Bv(e){return e!=null&&!wg(e,4)}function Vv(e,t){let n=e.snapshot.nodes[t];return!Bv(n)||!Sg(n)||wg(n,2)?null:n}function Hv(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Bv(e.snapshot.nodes[n])&&(t+=1);return t}function Uv(e){return Math.max(0,e.valueById.length-1)}function Wv(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Hv(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Uv(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Gv(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function Kv(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Vv(e,n)!=null&&t.push(sv(e,n));for(let t of e.expandedDirectoryIds)Vv(e,t)!=null&&n.push(sv(e,t));return{collapsedPaths:t,expandedPaths:n}}function qv(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Vv(e,n)!=null&&x_(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:sv(e,n)});return t}function Jv(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=dv(e,n);t!=null&&y_(e,t,!0,mv(e,t))}for(let n of t.collapsedPaths){let t=dv(e,n);t!=null&&y_(e,t,!1,mv(e,t))}}function Yv(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=dv(e,n.path);t!=null&&Vv(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function Xv(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function Zv(e){let t=e.snapshot.segmentTable,n=Jg();for(let r of e.snapshot.nodes)if(Bv(r)){if(wg(r,2)){r.nameId=0;continue}r.nameId=Yg(n,Xg(t,r.nameId))}e.snapshot.segmentTable=n}function Qv(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Bv(r)||!Sg(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Bv(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[mv(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),lg(e.snapshot.nodes,n)}}function $v(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Bv(n))break;--t}e.snapshot.nodes.length=t+1}function ey(e){let t=Kv(e),n=qv(e);Ag(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>Xv(e)),Ag(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>Zv(e)),Ag(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>Qv(e)),Ag(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>$v(e)),Ag(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>Jv(e,t)),Ag(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>Yv(e,n)),Ag(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>lv(e,e.snapshot.rootId))}function ty(e){let t=Kv(e),n=qv(e),r=Ag(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>tv(e)),i=Og({...e.snapshot.options},e.instrumentation),a=Ag(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new p_(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,Ag(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>Jv(e,t)),Ag(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>Yv(e,n)),Ag(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>lv(e,e.snapshot.rootId))}function ny(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function ry(e,t){let n=Wv(e);t===`stable`?Ag(e.instrumentation,`store.cleanup.stable`,()=>ey(e)):Ag(e.instrumentation,`store.cleanup.aggressive`,()=>ty(e));let r=Wv(e);return Gv(t,t===`stable`,n,r)}var iy=64;function ay(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function oy(e){return mv(e,e.snapshot.rootId).visibleSubtreeCount}function sy(e,t,n,r){let i=mv(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function cy(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Dy(e,t.cursor),setSize:t.setSize,subtreeEndIndex:sy(e,t.cursor,t.index,n)}}function ly(e,t,n,r,i,a){let o=pv(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=dg(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return uy(e,u,l,r+c,i+1,s,o.childIds.length,a)}function uy(e,t,n,r,i,a,o,s){if(!Sg(mv(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=xy(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=mv(e,c.terminalNodeId);if(!Sg(l)||!v_(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return ly(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function dy(e,t){let n=oy(e);if(t<0||t>=n)return null;let r=ly(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>sv(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=cy(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Dy(e,r.cursor),setSize:r.setSize,subtreeEndIndex:sy(e,r.cursor,r.index,n)}}function fy(e,t,n){let r=e.instrumentation,i=oy(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return Ey(e,o+1);let t=[],n=vy(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Dy(e,n);t.push(r),n=Cy(e,n)}return t}let s=[],c=0,l=0,u=Ag(r,`store.getVisibleSlice.selectFirstRow`,()=>vy(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Ag(r,`store.getVisibleSlice.materializeRow`,()=>Dy(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Ag(r,`store.getVisibleSlice.advanceCursor`,()=>Cy(e,u))}return jg(r,`workload.visibleRowsRead`,s.length),jg(r,`workload.flattenedRowsRead`,c),jg(r,`workload.flattenedSegmentsRead`,l),s}function py(e,t=oy(e)){let n=e.instrumentation;return n==null?Ty(e,t):Ag(n,`store.getVisibleTreeProjection`,()=>Ty(e,t))}function my(e){return wy(py(e))}function hy(e,t){let n=dv(e,t);if(n==null||n===e.snapshot.rootId||Sg(mv(e,n))&&$_(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=mv(e,i).parentId,n=pv(e,t),s=og(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=fg(a,n,s),t!==o){let n=mv(e,t),a=Q_(e,t);if(!v_(e,t,n)&&a!==i)return null;$_(e,t)===t&&(r+=1)}i=t}return r}function gy(e,t){let n=dv(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=mv(e,n);if(!Sg(r))throw Error(`Path is not a directory: "${t}"`);return v_(e,n,r)?null:(y_(e,n,!0,r),cv(e,n),M_({affectedAncestorIds:uv(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function _y(e,t){let n=dv(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=mv(e,n);if(!Sg(r))throw Error(`Path is not a directory: "${t}"`);return v_(e,n,r)?(y_(e,n,!1,r),cv(e,n),N_({affectedAncestorIds:uv(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function vy(e,t){return t<0||t>=oy(e)?null:yy(e,e.snapshot.rootId,t,-1)}function yy(e,t,n,r){let i=pv(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?dg(e.snapshot.nodes,i,n):Ag(a,`store.getVisibleSlice.selectChildIndex`,()=>dg(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return by(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function by(e,t,n,r){if(!Sg(mv(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=xy(e,t,r);if(n===0)return i;let a=mv(e,i.terminalNodeId);if(!Sg(a)||!v_(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return yy(e,i.terminalNodeId,n-1,i.visibleDepth)}function xy(e,t,n){return Sg(mv(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:$_(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Ag(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>$_(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Sy(e,t){let n=mv(e,t);if(!Sg(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||Q_(e,r)!==t}function Cy(e,t){let n=mv(e,t.terminalNodeId);if(Sg(n)){let r=pv(e,t.terminalNodeId);if(v_(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:by(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=mv(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=pv(e,n),o=og(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return by(e,s,0,i);Sy(e,r)&&i--,r=n}}function wy(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function Ty(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(iy);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=ay(o,y);let x,S=_;if(Sg(v))S=f?$_(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:sv(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&Sg(C)&&v_(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function Ey(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!Sg(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:sv(e,f)};continue}let h=l?$_(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Dy(e,g);let _=i[h];_!=null&&Sg(_)&&v_(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Dy(e,t){let n=mv(e,t.terminalNodeId),r=Sg(n)?Oy(e,t):null,i=sv(e,t.terminalNodeId),a=Xg(e.snapshot.segmentTable,n.nameId),o=Sg(n)&&pv(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?ev(e,t.headNodeId).map(n=>{let r=mv(e,n);return{isTerminal:n===t.terminalNodeId,name:Xg(e.snapshot.segmentTable,r.nameId),nodeId:n,path:sv(e,n)}}):Ag(c,`store.getVisibleSlice.flatten.collectSegments`,()=>ev(e,t.headNodeId).map(n=>{let r=mv(e,n);return{isTerminal:n===t.terminalNodeId,name:Xg(e.snapshot.segmentTable,r.nameId),nodeId:n,path:sv(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:Sg(n)&&v_(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:Sg(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Oy(e,t){if(t.headNodeId===t.terminalNodeId)return x_(e,t.terminalNodeId);let n=ev(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=x_(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var ky=8;function Ay(e){let{nodes:t,directories:n,rootId:r,options:i}=e,a=t.length,o=new Int32Array(a),s=new Int32Array(a),c=new Int32Array(a),l=new Int32Array(a),u=new Int32Array(a),d=new Int32Array(a),f=new Int32Array(a);for(let e=0;e<a;e+=1){let n=t[e];n!=null&&(o[e]=n.parentId,s[e]=n.nameId,c[e]=n.depthAndFlags,l[e]=n.subtreeNodeCount,u[e]=n.visibleSubtreeCount)}let p=0;for(let e of n.values())p+=e.childIds.length;let m=new Int32Array(p),h=0;for(let[e,t]of n){let n=t.childIds;d[e]=h,f[e]=n.length;for(let e=0;e<n.length;e+=1)m[h]=n[e],h+=1}return{nodeCount:a,rootId:r,flattenEmptyDirectories:i.flattenEmptyDirectories===!0,parentId:o,nameId:s,depthAndFlags:c,subtreeNodeCount:l,visibleSubtreeCount:u,childStart:d,childCount:f,childIdsFlat:m}}function jy(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:i,subtreeNodeCount:a,visibleSubtreeCount:o,childStart:s,childCount:c,childIdsFlat:l}=e;for(let e=t-1;e>=1;--e){if((i[e]&ky)===0)continue;let t=s[e],n=c[e],u=0,d=0;for(let e=0;e<n;e+=1){let n=l[t+e];u+=a[n],d+=o[n]}a[e]=1+u;let f;f=r&&n===1?(i[l[t]]&ky)===0?1+d:d:1+d,o[e]=f}let u=s[n],d=c[n],f=0,p=0;for(let e=0;e<d;e+=1){let t=l[u+e];f+=a[t],p+=o[t]}a[n]=1+f,o[n]=p}function My(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!Sg(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&pg(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&Sg(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,pg(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Ny(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=Ay(e.snapshot);jy(i);let a=i.subtreeNodeCount,o=i.visibleSubtreeCount;for(let e=0;e<n.length;e+=1){let t=n[e];t!=null&&(t.subtreeNodeCount=a[e],t.visibleSubtreeCount=o[e])}for(let[e,i]of t){let t=i.childIds,a=t.length,o=0,s=0;for(let e=0;e<a;e++){let r=t[e];if(r==null)continue;let i=n[r];o+=i.subtreeNodeCount,s+=i.visibleSubtreeCount}i.totalChildSubtreeNodeCount=o,i.totalChildVisibleSubtreeCount=s,(e===r||a>=128)&&pg(n,i)}}function Py(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Fy=class e{#e;constructor(e={}){let t=kg(e),n=Ag(t,`store.builder.create`,()=>new p_(e));if(e.preparedInput!=null){let t=u_(e.preparedInput);t==null?n.appendPreparedPaths(l_(e.preparedInput),!1):n.appendPresortedPaths(t,d_(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Ag(t,`store.preparePathEntries`,()=>f_(r,e)))}let r=Ag(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Ag(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Ag(t,`store.state.create`,()=>m_(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Ag(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Py(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Ag(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?Ag(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>Ny(this.#e)):Ag(t,`store.state.initializeOpenVisibleCounts`,()=>My(this.#e)):Ag(t,`store.state.recomputeCounts`,()=>lv(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return o_(e,t)}static prepareInput(e,t={}){return s_(e,t)}static preparePresortedInput(e){return c_(e)}list(e){return Ag(this.#e.instrumentation,`store.list`,()=>tv(this.#e,e))}add(e){Ag(this.#e.instrumentation,`store.add`,()=>{let t=oy(this.#e);H_(this.#e,B_(this.#e,t,nv(this.#e,e)))})}remove(e,t={}){Ag(this.#e.instrumentation,`store.remove`,()=>{let n=oy(this.#e);H_(this.#e,B_(this.#e,n,rv(this.#e,e,t)))})}move(e,t,n={}){Ag(this.#e.instrumentation,`store.move`,()=>{let r=oy(this.#e),i=iv(this.#e,e,t,n);i!=null&&H_(this.#e,B_(this.#e,r,i))})}batch(e){V_(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision})}})}getVisibleCount(){return Ag(this.#e.instrumentation,`store.getVisibleCount`,()=>oy(this.#e))}getVisibleSlice(e,t){return Ag(this.#e.instrumentation,`store.getVisibleSlice`,()=>fy(this.#e,e,t))}getVisibleRowContext(e){return Ag(this.#e.instrumentation,`store.getVisibleRowContext`,()=>dy(this.#e,e))}getVisibleTreeProjection(){return my(this.#e)}getVisibleTreeProjectionData(e){return py(this.#e,e)}getVisibleIndex(e){return Ag(this.#e.instrumentation,`store.getVisibleIndex`,()=>hy(this.#e,e))}getPathInfo(e){return Ag(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=dv(this.#e,e);if(t==null)return null;let n=mv(this.#e,t);return{depth:bg(n),kind:Sg(n)?`directory`:`file`,path:sv(this.#e,t)}})}isExpanded(e){return Ag(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=mv(this.#e,t);return v_(this.#e,t,n)})}expand(e){Ag(this.#e.instrumentation,`store.expand`,()=>{let t=oy(this.#e),n=gy(this.#e,e);n!=null&&H_(this.#e,B_(this.#e,t,n))})}collapse(e){Ag(this.#e.instrumentation,`store.collapse`,()=>{let t=oy(this.#e),n=_y(this.#e,e);n!=null&&H_(this.#e,B_(this.#e,t,n))})}on(e,t){return O_(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return x_(this.#e,t)}markDirectoryUnloaded(e){Ag(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(pv(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=oy(this.#e);C_(this.#e,t),H_(this.#e,B_(this.#e,n,P_({affectedAncestorIds:uv(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Ag(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=oy(this.#e),r=S_(this.#e,t);return H_(this.#e,B_(this.#e,n,F_({affectedAncestorIds:uv(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Ag(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||x_(this.#e,n)!==`loading`||!T_(this.#e,n,e.attemptId))return!1;let r=sv(this.#e,n);this.validateChildPatch(r,t);let i=oy(this.#e),a=[];for(let e of t.operations){Iy(r,e);let t=oy(this.#e);switch(e.type){case`add`:a.push(B_(this.#e,t,nv(this.#e,e.path)));break;case`remove`:a.push(B_(this.#e,t,rv(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=iv(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(B_(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return H_(this.#e,B_(this.#e,i,I_({affectedAncestorIds:uv(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:sv(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Ag(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=oy(this.#e),r=w_(this.#e,t,e.attemptId);return H_(this.#e,B_(this.#e,n,L_({affectedAncestorIds:uv(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:sv(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Ag(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=oy(this.#e),i=E_(this.#e,n,e.attemptId,t);return H_(this.#e,B_(this.#e,r,R_({affectedAncestorIds:uv(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:sv(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Ag(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(ny(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=oy(this.#e),n=ry(this.#e,e.mode??`stable`);return H_(this.#e,B_(this.#e,t,z_({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=pv(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Pg(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Ig(Ug(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!Sg(mv(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=mv(this.#e,n);v_(this.#e,n,i)||(y_(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=mv(this.#e,e);if(!v_(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=dv(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!Sg(mv(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!Sg(mv(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=mv(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=mv(this.#e,e),r=Q_(this.#e,e);if(!v_(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function Iy(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`)}}var Ly={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Ry(e,t){if(typeof e==`number`)return{itemHeight:t??Ly.default.itemHeight,factor:e};let n=Ly[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var zy=Ly.default.itemHeight,By=`@layer base {
170
+ :host {
171
+ --trees-accent: var(--trees-accent-override, #009fff);
172
+ --trees-fg: var(--trees-fg-override, var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1)));
173
+ --trees-fg-muted: var(--trees-fg-muted-override, var(--trees-theme-sidebar-header-fg, light-dark(#84848a, #84848a)));
174
+ --trees-bg: var(--trees-bg-override, var(--trees-theme-sidebar-bg, light-dark(#f8f8f8, #141415)));
175
+ --trees-bg-muted: var(--trees-bg-muted-override, var(--trees-theme-list-hover-bg, light-dark(color-mix(in lab,
176
+ var(--trees-accent) var(--trees-bg-alpha-light, 8%),
177
+ var(--trees-bg)), color-mix(in lab,
178
+ var(--trees-accent) var(--trees-bg-alpha-dark, 10%),
179
+ var(--trees-bg)))));
180
+ --trees-input-bg: var(--trees-input-bg-override, light-dark(#f8f8f8, #070707));
181
+ --trees-added-light: #16a994;
182
+ --trees-added-dark: #00cab1;
183
+ --trees-ignored-light: #adadb1;
184
+ --trees-ignored-dark: #4a4a4e;
185
+ --trees-modified-light: #1ca1c7;
186
+ --trees-modified-dark: #08c0ef;
187
+ --trees-renamed-light: #d5a910;
188
+ --trees-renamed-dark: #ffd452;
189
+ --trees-untracked-light: #16a994;
190
+ --trees-untracked-dark: #00cab1;
191
+ --trees-deleted-light: #ff2e3f;
192
+ --trees-deleted-dark: #ff6762;
193
+ --trees-border-color: var(--trees-border-color-override, var(--trees-theme-sidebar-border, light-dark(#eeeeef, #070707)));
194
+ --trees-indent-guide-bg: var(--trees-indent-guide-bg-override, color-mix(in lab, var(--trees-fg-muted) 25%, transparent));
195
+ --trees-density: var(--trees-density-override, 1);
196
+ --trees-border-radius: var(--trees-border-radius-override, calc(6px * var(--trees-density)));
197
+ --trees-font-family: var(--trees-font-family-override, system-ui);
198
+ --trees-font-size: var(--trees-font-size-override, 13px);
199
+ --trees-font-weight-regular: var(--trees-font-weight-regular-override, 400);
200
+ --trees-font-weight-semibold: var(--trees-font-weight-semibold-override, 600);
201
+ --trees-focus-ring-color: var(--trees-focus-ring-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
202
+ --trees-focus-ring-width: var(--trees-focus-ring-width-override, 1px);
203
+ --trees-focus-ring-offset: var(--trees-focus-ring-offset-override, -1px);
204
+ --trees-search-fg: var(--trees-search-fg-override, var(--trees-theme-input-fg, var(--trees-fg)));
205
+ --trees-search-font-weight: var(--trees-search-font-weight-override, 600);
206
+ --trees-search-bg: var(--trees-search-bg-override, var(--trees-theme-input-bg, var(--trees-input-bg)));
207
+ --trees-scrollbar-thumb: var(--trees-scrollbar-thumb-override, var(--trees-theme-scrollbar-thumb, color-mix(in lab, var(--trees-fg) 25%, var(--trees-bg))));
208
+ --trees-selected-fg: var(--trees-selected-fg-override, var(--trees-theme-list-active-selection-fg, var(--trees-fg)));
209
+ --trees-selected-bg: var(--trees-selected-bg-override, var(--trees-theme-list-active-selection-bg, light-dark(color-mix(in lab, var(--trees-accent) 12%, var(--trees-bg)), color-mix(in lab, var(--trees-accent) 15%, var(--trees-bg)))));
210
+ --trees-selected-focused-border-color: var(--trees-selected-focused-border-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
211
+ --trees-status-added: var(--trees-status-added-override, var(--trees-theme-git-added-fg, light-dark(var(--trees-added-light), var(--trees-added-dark))));
212
+ --trees-status-ignored: var(--trees-status-ignored-override, var(--trees-theme-git-ignored-fg, light-dark(var(--trees-ignored-light), var(--trees-ignored-dark))));
213
+ --trees-status-modified: var(--trees-status-modified-override, var(--trees-theme-git-modified-fg, light-dark(var(--trees-modified-light), var(--trees-modified-dark))));
214
+ --trees-status-renamed: var(--trees-status-renamed-override, var(--trees-theme-git-renamed-fg, light-dark(var(--trees-renamed-light), var(--trees-renamed-dark))));
215
+ --trees-status-untracked: var(--trees-status-untracked-override, var(--trees-theme-git-untracked-fg, light-dark(var(--trees-untracked-light), var(--trees-untracked-dark))));
216
+ --trees-status-deleted: var(--trees-status-deleted-override, var(--trees-theme-git-deleted-fg, light-dark(var(--trees-deleted-light), var(--trees-deleted-dark))));
217
+ --trees-git-modified-color: var(--trees-git-modified-color-override, var(--trees-status-modified));
218
+ --trees-git-added-color: var(--trees-git-added-color-override, var(--trees-status-added));
219
+ --trees-git-ignored-color: var(--trees-git-ignored-color-override, var(--trees-status-ignored));
220
+ --trees-git-deleted-color: var(--trees-git-deleted-color-override, var(--trees-status-deleted));
221
+ --trees-git-renamed-color: var(--trees-git-renamed-color-override, var(--trees-status-renamed));
222
+ --trees-git-untracked-color: var(--trees-git-untracked-color-override, var(--trees-status-untracked));
223
+ --trees-icon-gray: light-dark(#84848a, #adadb1);
224
+ --trees-icon-red: light-dark(#d52c36, #ff6762);
225
+ --trees-icon-vermilion: light-dark(#ff8c5b, #d5512f);
226
+ --trees-icon-orange: light-dark(#d47628, #ffa359);
227
+ --trees-icon-yellow: light-dark(#d5a910, #ffd452);
228
+ --trees-icon-green: light-dark(#199f43, #5ecc71);
229
+ --trees-icon-teal: light-dark(#17a5af, #64d1db);
230
+ --trees-icon-cyan: light-dark(#1ca1c7, #68cdf2);
231
+ --trees-icon-blue: light-dark(#1a85d4, #69b1ff);
232
+ --trees-icon-indigo: light-dark(#693acf, #9d6afb);
233
+ --trees-icon-purple: light-dark(#a631be, #d568ea);
234
+ --trees-icon-pink: light-dark(#d32a61, #ff678d);
235
+ --trees-icon-mauve: light-dark(#594c5b, #79697b);
236
+ --trees-file-icon-color-default: var(--trees-file-icon-color, var(--trees-icon-gray));
237
+ --trees-file-icon-color-astro: var(--trees-file-icon-color, var(--trees-icon-purple));
238
+ --trees-file-icon-color-babel: var(--trees-file-icon-color, var(--trees-icon-yellow));
239
+ --trees-file-icon-color-bash: var(--trees-file-icon-color, var(--trees-icon-green));
240
+ --trees-file-icon-color-biome: var(--trees-file-icon-color, var(--trees-icon-blue));
241
+ --trees-file-icon-color-bootstrap: var(--trees-file-icon-color, var(--trees-icon-indigo));
242
+ --trees-file-icon-color-browserslist: var(--trees-file-icon-color, var(--trees-icon-yellow));
243
+ --trees-file-icon-color-bun: var(--trees-file-icon-color, var(--trees-icon-mauve));
244
+ --trees-file-icon-color-c: var(--trees-file-icon-color, var(--trees-icon-blue));
245
+ --trees-file-icon-color-cpp: var(--trees-file-icon-color, var(--trees-icon-blue));
246
+ --trees-file-icon-color-claude: var(--trees-file-icon-color, var(--trees-icon-orange));
247
+ --trees-file-icon-color-css: var(--trees-file-icon-color, var(--trees-icon-indigo));
248
+ --trees-file-icon-color-database: var(--trees-file-icon-color, var(--trees-icon-purple));
249
+ --trees-file-icon-color-docker: var(--trees-file-icon-color, var(--trees-icon-blue));
250
+ --trees-file-icon-color-eslint: var(--trees-file-icon-color, var(--trees-icon-indigo));
251
+ --trees-file-icon-color-git: var(--trees-file-icon-vermilion, var(--trees-icon-vermilion));
252
+ --trees-file-icon-color-go: var(--trees-file-icon-color, var(--trees-icon-cyan));
253
+ --trees-file-icon-color-graphql: var(--trees-file-icon-color, var(--trees-icon-pink));
254
+ --trees-file-icon-color-html: var(--trees-file-icon-color, var(--trees-icon-orange));
255
+ --trees-file-icon-color-image: var(--trees-file-icon-color, var(--trees-icon-pink));
256
+ --trees-file-icon-color-javascript: var(--trees-file-icon-color, var(--trees-icon-yellow));
257
+ --trees-file-icon-color-json: var(--trees-file-icon-color, var(--trees-icon-orange));
258
+ --trees-file-icon-color-markdown: var(--trees-file-icon-color, var(--trees-icon-green));
259
+ --trees-file-icon-color-mcp: var(--trees-file-icon-color, var(--trees-icon-teal));
260
+ --trees-file-icon-color-npm: var(--trees-file-icon-color, var(--trees-icon-red));
261
+ --trees-file-icon-color-oxc: var(--trees-file-icon-cyan, var(--trees-icon-cyan));
262
+ --trees-file-icon-color-postcss: var(--trees-file-icon-color, var(--trees-icon-red));
263
+ --trees-file-icon-color-prettier: var(--trees-file-icon-color, var(--trees-icon-teal));
264
+ --trees-file-icon-color-python: var(--trees-file-icon-color, var(--trees-icon-blue));
265
+ --trees-file-icon-color-react: var(--trees-file-icon-color, var(--trees-icon-cyan));
266
+ --trees-file-icon-color-ruby: var(--trees-file-icon-color, var(--trees-icon-red));
267
+ --trees-file-icon-color-rust: var(--trees-file-icon-color, var(--trees-icon-orange));
268
+ --trees-file-icon-color-sass: var(--trees-file-icon-color, var(--trees-icon-pink));
269
+ --trees-file-icon-color-svg: var(--trees-file-icon-color, var(--trees-icon-orange));
270
+ --trees-file-icon-color-svelte: var(--trees-file-icon-color, var(--trees-icon-red));
271
+ --trees-file-icon-color-svgo: var(--trees-file-icon-color, var(--trees-icon-green));
272
+ --trees-file-icon-color-swift: var(--trees-file-icon-color, var(--trees-icon-orange));
273
+ --trees-file-icon-color-table: var(--trees-file-icon-color, var(--trees-icon-teal));
274
+ --trees-file-icon-color-text: var(--trees-file-icon-color, var(--trees-icon-gray));
275
+ --trees-file-icon-color-tailwind: var(--trees-file-icon-color, var(--trees-icon-cyan));
276
+ --trees-file-icon-color-terraform: var(--trees-file-icon-color, var(--trees-icon-indigo));
277
+ --trees-file-icon-color-typescript: var(--trees-file-icon-color, var(--trees-icon-blue));
278
+ --trees-file-icon-color-vite: var(--trees-file-icon-color, var(--trees-icon-purple));
279
+ --trees-file-icon-color-vscode: var(--trees-file-icon-color, var(--trees-icon-blue));
280
+ --trees-file-icon-color-vue: var(--trees-file-icon-color, var(--trees-icon-green));
281
+ --trees-file-icon-color-wasm: var(--trees-file-icon-color, var(--trees-icon-indigo));
282
+ --trees-file-icon-color-webpack: var(--trees-file-icon-color, var(--trees-icon-blue));
283
+ --trees-file-icon-color-yml: var(--trees-file-icon-color, var(--trees-icon-red));
284
+ --trees-file-icon-color-zig: var(--trees-file-icon-color, var(--trees-icon-orange));
285
+ --trees-file-icon-color-zip: var(--trees-file-icon-color, var(--trees-icon-orange));
286
+ --trees-level-gap: var(--trees-level-gap-override, calc(8px * var(--trees-density)));
287
+ --trees-item-padding-x: var(--trees-item-padding-x-override, calc(8px * var(--trees-density)));
288
+ --trees-item-margin-x: var(--trees-item-margin-x-override, calc(2px * var(--trees-density)));
289
+ --trees-item-row-gap: var(--trees-item-row-gap-override, calc(6px * var(--trees-density)));
290
+ --trees-icon-width: var(--trees-icon-width-override, 16px);
291
+ --trees-icon-nudge: var(--trees-icon-nudge-override, calc(1px * var(--trees-density)));
292
+ --trees-row-height: var(--trees-item-height, 30px);
293
+ --trees-git-lane-width: var(--trees-git-lane-width-override, 12px);
294
+ --trees-action-lane-width: var(--trees-action-lane-width-override, calc(var(--trees-icon-width) + 2px));
295
+ --trees-context-menu-trigger-inline-offset: calc(var(--trees-padding-inline) + var(--trees-item-padding-x) -
296
+ var(--trees-focus-ring-width));
297
+ --trees-scrollbar-gutter: var(--trees-scrollbar-gutter-override, 6px);
298
+ --trees-padding-inline: var(--trees-padding-inline-override, 16px);
299
+ color-scheme: light dark;
300
+ font-size: var(--trees-font-size);
301
+ color: var(--trees-fg);
302
+ background-color: var(--trees-bg);
303
+ --truncate-marker-background-color: var(--trees-bg);
304
+ --truncate-marker-background-overlay-color: transparent;
305
+ font-family: var(--trees-font-family);
306
+ font-weight: var(--trees-font-weight-regular);
307
+ flex-direction: column;
308
+ display: flex;
309
+ }
310
+
311
+ :host([data-file-tree-virtualized="true"]) {
312
+ height: 100%;
313
+ overflow: hidden;
314
+ }
315
+
316
+ [data-file-tree-virtualized-wrapper="true"], [data-file-tree-virtualized-root="true"] {
317
+ flex-direction: column;
318
+ height: 100%;
319
+ display: flex;
320
+ overflow: hidden;
321
+ }
322
+
323
+ [data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
324
+ --trees-scrollbar-thumb-current: transparent;
325
+ scrollbar-gutter: stable;
326
+ overflow-y: auto;
327
+
328
+ &:hover {
329
+ --trees-scrollbar-thumb-current: var(--trees-scrollbar-thumb);
330
+ }
331
+
332
+ &::-webkit-scrollbar {
333
+ width: var(--trees-scrollbar-gutter);
334
+ height: var(--trees-scrollbar-gutter);
335
+ }
336
+
337
+ &::-webkit-scrollbar-track {
338
+ background: none;
339
+ }
340
+
341
+ &::-webkit-scrollbar-thumb {
342
+ background-color: var(--trees-scrollbar-thumb-current);
343
+ border-radius: calc(var(--trees-scrollbar-gutter) / 2);
344
+ background-clip: content-box;
345
+ border: 1px solid #0000;
346
+ }
347
+
348
+ &::-webkit-scrollbar-corner {
349
+ background-color: #0000;
350
+ }
351
+ }
352
+
353
+ [data-file-tree-scrollbar-measure="true"] {
354
+ visibility: hidden;
355
+ pointer-events: none;
356
+ width: 100px;
357
+ height: 100px;
358
+ position: absolute;
359
+ top: 0;
360
+ left: 0;
361
+ }
362
+
363
+ @supports ((-moz-appearance: none)) {
364
+ [data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
365
+ scrollbar-width: thin;
366
+ scrollbar-color: var(--trees-scrollbar-thumb-current) transparent;
367
+ }
368
+ }
369
+
370
+ [data-file-tree-virtualized-scroll="true"] {
371
+ min-height: 0;
372
+ padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
373
+ 0px)
374
+ /* NOTE(amadeus): We can assume that all Webkit based browser gutters
375
+ * will align to the value of '--trees-scrollbar-gutter', however if not, then
376
+ * \`--trees-scrollbar-gutter-measured\` should correct it. Mostly we are
377
+ * hoping to avoid SSR alignment jumps if possible. In non-SSR'd environments
378
+ * \`--trees-scrollbar-gutter-measured\` should always be immediately available.
379
+ */
380
+ max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
381
+ var(--trees-scrollbar-gutter-measured, var(--trees-scrollbar-gutter))),
382
+ 0px);
383
+ flex: 1 1 0;
384
+ position: relative;
385
+ overflow-y: auto;
386
+ }
387
+
388
+ @supports ((-moz-appearance: none)) {
389
+ [data-file-tree-virtualized-scroll="true"] {
390
+ padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
391
+ 0px)
392
+ /* NOTE(amadeus): However on Firefox it can vary a little bit, but most
393
+ * likely the majority of cases will default to a 0px width scrollbar lets
394
+ * inherit that first to avoid SSR jumps. In non-SSR'd environments
395
+ * \`--trees-scrollbar-gutter-measured\` should always be immediately available.
396
+ */
397
+ max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
398
+ var(--trees-scrollbar-gutter-measured, 0px)),
399
+ 0px);
400
+ }
401
+ }
402
+
403
+ [data-file-tree-sticky-overlay="true"] {
404
+ z-index: 4;
405
+ pointer-events: none;
406
+ height: 0;
407
+ position: sticky;
408
+ top: 0;
409
+ overflow: visible;
410
+ }
411
+
412
+ [data-file-tree-virtualized-root="true"][data-scroll-at-top="true"]:not([data-overlay-reveal]) [data-file-tree-sticky-overlay="true"] {
413
+ visibility: hidden;
414
+ }
415
+
416
+ [data-file-tree-sticky-overlay-content="true"] {
417
+ background-color: var(--trees-bg);
418
+ pointer-events: none;
419
+ position: relative;
420
+ }
421
+
422
+ [data-file-tree-virtualized-list="true"] {
423
+ background-color: var(--trees-bg);
424
+ overflow-anchor: none;
425
+ width: 100%;
426
+ min-height: 100%;
427
+ position: relative;
428
+
429
+ &[data-is-scrolling] {
430
+ pointer-events: none;
431
+ }
432
+ }
433
+
434
+ [data-file-tree-virtualized-sticky-offset="true"] {
435
+ contain: layout size;
436
+ }
437
+
438
+ [data-file-tree-virtualized-sticky="true"] {
439
+ isolation: isolate;
440
+ will-change: transform;
441
+ flex-direction: column;
442
+ width: 100%;
443
+ display: flex;
444
+ position: sticky;
445
+ top: 0;
446
+ }
447
+
448
+ [data-file-tree-search-container] {
449
+ padding: 0;
450
+ padding-inline: var(--trees-padding-inline);
451
+ margin-bottom: var(--trees-item-row-gap);
452
+ display: flex;
453
+ }
454
+
455
+ [data-file-tree-search-input] {
456
+ --trees-focus-ring-width: 2px;
457
+ font-family: var(--trees-font-family);
458
+ font-size: var(--trees-font-size);
459
+ height: var(--trees-row-height);
460
+ padding-inline: var(--trees-item-padding-x);
461
+ line-height: var(--trees-row-height);
462
+ color: var(--trees-search-fg);
463
+ background-color: var(--trees-search-bg);
464
+ border: 1px solid var(--trees-border-color);
465
+ border-radius: var(--trees-border-radius);
466
+ outline: none;
467
+ flex: 1;
468
+ margin-block: 1px;
469
+
470
+ &::placeholder {
471
+ color: color-mix(in lab,
472
+ var(--trees-search-fg) 65%,
473
+ var(--trees-search-bg));
474
+ }
475
+
476
+ &:focus-visible, &[data-file-tree-search-input-fake-focus="true"] {
477
+ outline: var(--trees-focus-ring-width) solid var(--trees-focus-ring-color);
478
+ outline-offset: var(--trees-focus-ring-offset);
479
+ }
480
+ }
481
+
482
+ [role="tree"] {
483
+ gap: var(--trees-gap-override, 0);
484
+ flex-direction: column;
485
+ display: flex;
486
+ position: relative;
487
+ }
488
+
489
+ [data-type="item"] {
490
+ color: inherit;
491
+ font-family: var(--trees-font-family);
492
+ font-size: var(--trees-font-size);
493
+ text-align: start;
494
+ background-color: var(--trees-bg);
495
+ padding: 0 var(--trees-item-padding-x);
496
+ margin: 0 var(--trees-item-margin-x);
497
+ cursor: pointer;
498
+ user-select: none;
499
+ -webkit-touch-callout: none;
500
+ touch-action: manipulation;
501
+ flex: 0 0 var(--trees-row-height);
502
+ height: var(--trees-row-height);
503
+ line-height: var(--trees-row-height);
504
+ align-items: center;
505
+ gap: var(--trees-item-row-gap);
506
+ border-radius: var(--trees-border-radius);
507
+ --truncate-marker-background-color: var(--trees-bg);
508
+ --truncate-marker-background-overlay-color: transparent;
509
+ --truncate-marker-block-inset: 0px;
510
+ border: none;
511
+ outline: none;
512
+ display: flex;
513
+ position: relative;
514
+
515
+ &:hover, &[data-item-context-hover="true"] {
516
+ background-color: var(--trees-bg-muted);
517
+ --truncate-marker-background-overlay-color: var(--trees-bg-muted);
518
+ }
519
+
520
+ &[data-item-focused="true"], &:focus-visible {
521
+ z-index: 2;
522
+
523
+ & [data-item-flattened-subitems] {
524
+ --truncate-marker-block-inset: var(--trees-focus-ring-width);
525
+ }
526
+
527
+ &:before {
528
+ content: "";
529
+ border-radius: var(--trees-border-radius);
530
+ outline: var(--trees-focus-ring-width) solid
531
+ var(--trees-focus-ring-color);
532
+ outline-offset: var(--trees-focus-ring-offset);
533
+ pointer-events: none;
534
+ display: block;
535
+ position: absolute;
536
+ inset: 0;
537
+ }
538
+
539
+ &[data-item-selected="true"]:before {
540
+ outline-color: var(--trees-selected-focused-border-color);
541
+ }
542
+ }
543
+
544
+ &[data-item-selected="true"] {
545
+ color: var(--trees-selected-fg);
546
+ background-color: var(--trees-selected-bg);
547
+ --truncate-marker-background-overlay-color: var(--trees-selected-bg);
548
+ z-index: 3;
549
+
550
+ & [data-item-section="icon"] {
551
+ color: var(--trees-selected-fg);
552
+ }
553
+ }
554
+
555
+ &[data-item-search-match="true"] {
556
+ font-weight: var(--trees-search-font-weight);
557
+ }
558
+ }
559
+
560
+ [data-type="item"][data-file-tree-sticky-row="true"] {
561
+ pointer-events: auto;
562
+ }
563
+
564
+ [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"] {
565
+ pointer-events: none;
566
+ }
567
+
568
+ [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"]:hover:not([data-item-selected="true"]), [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"][data-item-context-hover="true"]:not([data-item-selected="true"]) {
569
+ background-color: var(--trees-bg);
570
+ --truncate-marker-background-overlay-color: transparent;
571
+ }
572
+
573
+ [data-item-selected="true"]:has( + [data-item-selected="true"]) {
574
+ border-bottom-right-radius: 0;
575
+ border-bottom-left-radius: 0;
576
+ }
577
+
578
+ [data-item-selected="true"] + [data-item-selected="true"] {
579
+ border-top-left-radius: 0;
580
+ border-top-right-radius: 0;
581
+ }
582
+
583
+ [data-item-flattened-subitems] {
584
+ align-items: center;
585
+ gap: 2px;
586
+ display: inline-flex;
587
+ }
588
+
589
+ [data-item-flattened-subitem]:hover, [data-item-flattened-subitem-drag-target="true"] {
590
+ text-decoration: underline;
591
+ }
592
+
593
+ [data-item-section="icon"] {
594
+ color: var(--trees-fg-muted);
595
+ fill: currentColor;
596
+ width: var(--trees-icon-width);
597
+ flex-shrink: 0;
598
+ justify-content: center;
599
+ align-items: center;
600
+ display: flex;
601
+ }
602
+
603
+ :where([data-item-section="icon"] > [data-icon-token]) {
604
+ color: var(--trees-fg-muted);
605
+ }
606
+
607
+ [data-file-tree-colored-icons="true"] {
608
+ & [data-icon-token="astro"] {
609
+ color: var(--trees-file-icon-color-astro);
610
+ }
611
+
612
+ & [data-icon-token="babel"] {
613
+ color: var(--trees-file-icon-color-babel);
614
+ }
615
+
616
+ & [data-icon-token="bash"] {
617
+ color: var(--trees-file-icon-color-bash);
618
+ }
619
+
620
+ & [data-icon-token="biome"] {
621
+ color: var(--trees-file-icon-color-biome);
622
+ }
623
+
624
+ & [data-icon-token="bootstrap"] {
625
+ color: var(--trees-file-icon-color-bootstrap);
626
+ }
627
+
628
+ & [data-icon-token="browserslist"] {
629
+ color: var(--trees-file-icon-color-browserslist);
630
+ }
631
+
632
+ & [data-icon-token="bun"] {
633
+ color: var(--trees-file-icon-color-bun);
634
+ }
635
+
636
+ & [data-icon-token="c"] {
637
+ color: var(--trees-file-icon-color-c);
638
+ }
639
+
640
+ & [data-icon-token="cpp"] {
641
+ color: var(--trees-file-icon-color-cpp);
642
+ }
643
+
644
+ & [data-icon-token="claude"] {
645
+ color: var(--trees-file-icon-color-claude);
646
+ }
647
+
648
+ & [data-icon-token="css"] {
649
+ color: var(--trees-file-icon-color-css);
650
+ }
651
+
652
+ & [data-icon-token="database"] {
653
+ color: var(--trees-file-icon-color-database);
654
+ }
655
+
656
+ & [data-icon-token="default"] {
657
+ color: var(--trees-file-icon-color-default);
658
+ }
659
+
660
+ & [data-icon-token="docker"] {
661
+ color: var(--trees-file-icon-color-docker);
662
+ }
663
+
664
+ & [data-icon-token="eslint"] {
665
+ color: var(--trees-file-icon-color-eslint);
666
+ }
667
+
668
+ & [data-icon-token="git"] {
669
+ color: var(--trees-file-icon-color-git);
670
+ }
671
+
672
+ & [data-icon-token="go"] {
673
+ color: var(--trees-file-icon-color-go);
674
+ }
675
+
676
+ & [data-icon-token="graphql"] {
677
+ color: var(--trees-file-icon-color-graphql);
678
+ }
679
+
680
+ & [data-icon-token="html"] {
681
+ color: var(--trees-file-icon-color-html);
682
+ }
683
+
684
+ & [data-icon-token="image"] {
685
+ color: var(--trees-file-icon-color-image);
686
+ }
687
+
688
+ & [data-icon-token="javascript"] {
689
+ color: var(--trees-file-icon-color-javascript);
690
+ }
691
+
692
+ & [data-icon-token="json"] {
693
+ color: var(--trees-file-icon-color-json);
694
+ }
695
+
696
+ & [data-icon-token="markdown"] {
697
+ color: var(--trees-file-icon-color-markdown);
698
+ }
699
+
700
+ & [data-icon-token="mcp"] {
701
+ color: var(--trees-file-icon-color-mcp);
702
+ }
703
+
704
+ & [data-icon-token="npm"] {
705
+ color: var(--trees-file-icon-color-npm);
706
+ }
707
+
708
+ & [data-icon-token="oxc"] {
709
+ color: var(--trees-file-icon-color-oxc);
710
+ }
711
+
712
+ & [data-icon-token="postcss"] {
713
+ color: var(--trees-file-icon-color-postcss);
714
+ }
715
+
716
+ & [data-icon-token="prettier"] {
717
+ color: var(--trees-file-icon-color-prettier);
718
+ }
719
+
720
+ & [data-icon-token="python"] {
721
+ color: var(--trees-file-icon-color-python);
722
+ }
723
+
724
+ & [data-icon-token="react"] {
725
+ color: var(--trees-file-icon-color-react);
726
+ }
727
+
728
+ & [data-icon-token="ruby"] {
729
+ color: var(--trees-file-icon-color-ruby);
730
+ }
731
+
732
+ & [data-icon-token="rust"] {
733
+ color: var(--trees-file-icon-color-rust);
734
+ }
735
+
736
+ & [data-icon-token="sass"] {
737
+ color: var(--trees-file-icon-color-sass);
738
+ }
739
+
740
+ & [data-icon-token="svg"] {
741
+ color: var(--trees-file-icon-color-svg);
742
+ }
743
+
744
+ & [data-icon-token="svelte"] {
745
+ color: var(--trees-file-icon-color-svelte);
746
+ }
747
+
748
+ & [data-icon-token="svgo"] {
749
+ color: var(--trees-file-icon-color-svgo);
750
+ }
751
+
752
+ & [data-icon-token="swift"] {
753
+ color: var(--trees-file-icon-color-swift);
754
+ }
755
+
756
+ & [data-icon-token="table"] {
757
+ color: var(--trees-file-icon-color-table);
758
+ }
759
+
760
+ & [data-icon-token="text"] {
761
+ color: var(--trees-file-icon-color-text);
762
+ }
763
+
764
+ & [data-icon-token="tailwind"] {
765
+ color: var(--trees-file-icon-color-tailwind);
766
+ }
767
+
768
+ & [data-icon-token="terraform"] {
769
+ color: var(--trees-file-icon-color-terraform);
770
+ }
771
+
772
+ & [data-icon-token="typescript"] {
773
+ color: var(--trees-file-icon-color-typescript);
774
+ }
775
+
776
+ & [data-icon-token="vite"] {
777
+ color: var(--trees-file-icon-color-vite);
778
+ }
779
+
780
+ & [data-icon-token="vscode"] {
781
+ color: var(--trees-file-icon-color-vscode);
782
+ }
783
+
784
+ & [data-icon-token="vue"] {
785
+ color: var(--trees-file-icon-color-vue);
786
+ }
787
+
788
+ & [data-icon-token="wasm"] {
789
+ color: var(--trees-file-icon-color-wasm);
790
+ }
791
+
792
+ & [data-icon-token="webpack"] {
793
+ color: var(--trees-file-icon-color-webpack);
794
+ }
795
+
796
+ & [data-icon-token="yml"] {
797
+ color: var(--trees-file-icon-color-yml);
798
+ }
799
+
800
+ & [data-icon-token="zig"] {
801
+ color: var(--trees-file-icon-color-zig);
802
+ }
803
+
804
+ & [data-icon-token="zip"] {
805
+ color: var(--trees-file-icon-color-zip);
806
+ }
807
+ }
808
+
809
+ [data-icon-name="file-tree-icon-chevron"] {
810
+ &[data-align-capitals="false"] {
811
+ transform: translate(0, var(--trees-icon-nudge));
812
+ }
813
+
814
+ &[data-align-capitals="true"] {
815
+ transform: translate(0);
816
+ }
817
+ }
818
+
819
+ [data-item-section="content"] {
820
+ text-align: start;
821
+ text-overflow: ellipsis;
822
+ flex: 0 auto;
823
+ min-width: 0;
824
+ max-width: 100%;
825
+ overflow: hidden;
826
+ }
827
+
828
+ [data-item-section="decoration"] {
829
+ text-align: end;
830
+ min-width: 0;
831
+ color: var(--trees-fg-muted);
832
+ flex: 1 1 0;
833
+ justify-content: flex-end;
834
+ display: flex;
835
+ overflow: hidden;
836
+ }
837
+
838
+ [data-item-section="decoration"] > span {
839
+ text-overflow: ellipsis;
840
+ white-space: nowrap;
841
+ justify-content: flex-end;
842
+ align-items: center;
843
+ min-width: 0;
844
+ max-width: 100%;
845
+ display: inline-flex;
846
+ overflow: hidden;
847
+ }
848
+
849
+ [data-item-section="git"], [data-item-section="action"] {
850
+ flex: none;
851
+ justify-content: center;
852
+ align-items: center;
853
+ display: flex;
854
+ }
855
+
856
+ [data-item-section="git"] {
857
+ width: var(--trees-git-lane-width);
858
+ }
859
+
860
+ [data-item-section="action"] {
861
+ width: var(--trees-action-lane-width);
862
+ color: var(--trees-fg-muted);
863
+ fill: currentColor;
864
+ pointer-events: none;
865
+ }
866
+
867
+ [data-item-section="git"] > span, [data-item-section="action"] > span {
868
+ justify-content: center;
869
+ align-items: center;
870
+ width: 100%;
871
+ display: inline-flex;
872
+ }
873
+
874
+ [data-item-action-affordance="decorative"] {
875
+ opacity: .85;
876
+ }
877
+
878
+ [data-item-rename-input] {
879
+ appearance: none;
880
+ width: 100%;
881
+ min-width: 0;
882
+ height: calc(var(--trees-row-height) - 4px);
883
+ font-family: inherit;
884
+ font-size: inherit;
885
+ color: inherit;
886
+ box-sizing: border-box;
887
+ background-color: #0000;
888
+ border: 0;
889
+ outline: none;
890
+ padding-inline: 6px;
891
+ }
892
+
893
+ [data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="action"], [data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="decoration"] {
894
+ display: none;
895
+ }
896
+
897
+ [aria-expanded="false"][data-item-type="folder"] > [data-item-section="icon"] > [data-icon-name="file-tree-icon-chevron"] {
898
+ &[data-align-capitals="true"] {
899
+ transform: rotate(-90deg)
900
+ translate(calc(var(--trees-icon-nudge) / 2),
901
+ calc(var(--trees-icon-nudge) / 2));
902
+ }
903
+
904
+ &[data-align-capitals="false"] {
905
+ transform: rotate(-90deg)
906
+ translate(calc(var(--trees-icon-nudge) / 2 * -1),
907
+ calc(var(--trees-icon-nudge) / 2));
908
+ }
909
+ }
910
+
911
+ [data-item-section="spacing"] {
912
+ height: var(--trees-row-height);
913
+ padding-left: calc(calc(var(--trees-icon-width) / 2) - .5px);
914
+ flex-direction: row;
915
+ justify-content: center;
916
+ align-items: center;
917
+ display: flex;
918
+
919
+ &:empty {
920
+ padding-left: 0;
921
+ }
922
+ }
923
+
924
+ [data-item-section="spacing-item"] {
925
+ border-left: 1px solid var(--trees-indent-guide-bg);
926
+ height: 100%;
927
+ margin-right: calc(var(--trees-level-gap) - 1px);
928
+ opacity: 0;
929
+ transition: opacity .15s;
930
+ display: inline-block;
931
+ transform: translateX(-.25px);
932
+
933
+ & + & {
934
+ margin-left: calc(var(--trees-item-row-gap) + calc(var(--trees-icon-width) / 2) - .5px);
935
+ }
936
+ }
937
+
938
+ :host(:hover) [data-item-section="spacing-item"] {
939
+ opacity: .75;
940
+ }
941
+
942
+ [data-item-contains-git-change="true"] > [data-item-section="git"] {
943
+ color: var(--trees-git-modified-color);
944
+ opacity: .5;
945
+ fill: currentColor;
946
+ }
947
+
948
+ [data-item-git-status] {
949
+ & > :where([data-item-section="icon"]) > :where(:not([data-icon-name="file-tree-icon-chevron"])), & > [data-item-section="content"] {
950
+ color: var(--trees-item-git-status-color);
951
+ }
952
+
953
+ & > [data-item-section="git"] {
954
+ color: var(--trees-item-git-status-color);
955
+ font-weight: var(--trees-font-weight-semibold);
956
+ }
957
+ }
958
+
959
+ [data-item-git-status="added"] {
960
+ --trees-item-git-status-color: var(--trees-git-added-color);
961
+ }
962
+
963
+ [data-item-git-status="deleted"] {
964
+ --trees-item-git-status-color: var(--trees-git-deleted-color);
965
+ }
966
+
967
+ [data-item-git-status="ignored"] {
968
+ --trees-item-git-status-color: var(--trees-git-ignored-color);
969
+
970
+ & > [data-item-section="icon"] {
971
+ opacity: .5;
972
+ }
973
+ }
974
+
975
+ [data-item-section="git"] [data-icon-name="file-tree-icon-dot"] {
976
+ transform: translateY(calc(.65ex - 50%));
977
+ }
978
+
979
+ [data-item-git-status="modified"] {
980
+ --trees-item-git-status-color: var(--trees-git-modified-color);
981
+ }
982
+
983
+ [data-item-git-status="renamed"] {
984
+ --trees-item-git-status-color: var(--trees-git-renamed-color);
985
+ }
986
+
987
+ [data-item-git-status="untracked"] {
988
+ --trees-item-git-status-color: var(--trees-git-untracked-color);
989
+ }
990
+
991
+ [data-item-drag-target="true"] {
992
+ background-color: var(--trees-selected-bg);
993
+ }
994
+
995
+ [data-item-dragging="true"] {
996
+ opacity: .5;
997
+ }
998
+
999
+ [data-item-section="lock"] {
1000
+ color: var(--trees-fg-muted);
1001
+ flex: none;
1002
+ align-items: center;
1003
+ margin-left: auto;
1004
+ display: flex;
1005
+ }
1006
+
1007
+ [data-item-section="lock"] svg {
1008
+ display: block;
1009
+ }
1010
+
1011
+ [data-type="header-slot"] {
1012
+ flex: none;
1013
+ display: block;
1014
+ }
1015
+
1016
+ [data-type="context-menu-wash"] {
1017
+ z-index: 3;
1018
+ touch-action: none;
1019
+ background-color: #0000;
1020
+ position: absolute;
1021
+ inset: 0;
1022
+ }
1023
+
1024
+ [data-type="context-menu-anchor"] {
1025
+ top: 0;
1026
+ right: var(--trees-context-menu-trigger-inline-offset);
1027
+ z-index: 4;
1028
+ align-items: center;
1029
+ display: none;
1030
+ position: absolute;
1031
+
1032
+ &[data-visible="true"] {
1033
+ display: flex;
1034
+ }
1035
+ }
1036
+
1037
+ [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="context-menu-anchor"] {
1038
+ display: none;
1039
+ }
1040
+
1041
+ [data-type="context-menu-anchor"] > slot[name="context-menu"] {
1042
+ flex: 0 0 0;
1043
+ width: 0;
1044
+ min-width: 0;
1045
+ display: block;
1046
+ overflow: visible;
1047
+ }
1048
+
1049
+ [data-type="context-menu-trigger"] {
1050
+ all: unset;
1051
+ width: var(--trees-action-lane-width);
1052
+ color: var(--trees-fg-muted);
1053
+ fill: currentColor;
1054
+ cursor: pointer;
1055
+ font-family: var(--trees-font-family);
1056
+ font-size: var(--trees-font-size);
1057
+ border-top-right-radius: var(--trees-border-radius);
1058
+ border-bottom-right-radius: var(--trees-border-radius);
1059
+ margin: var(--trees-focus-ring-width);
1060
+ height: calc(var(--trees-row-height) - var(--trees-focus-ring-width) * 2);
1061
+ border-width: 0;
1062
+ justify-content: center;
1063
+ align-items: center;
1064
+ transition: color .12s;
1065
+ display: flex;
1066
+ }
1067
+
1068
+ [data-type="context-menu-trigger"]:hover, [data-type="context-menu-trigger"][aria-expanded="true"] {
1069
+ color: var(--trees-fg);
1070
+ }
1071
+
1072
+ [data-truncate-container] {
1073
+ --truncate-internal-marker-fade-width: var(--truncate-marker-fade-width, 2px);
1074
+ --truncate-internal-marker-gap: var(--truncate-marker-gap, 0px);
1075
+ --truncate-internal-marker-opacity: var(--truncate-marker-opacity, 50%);
1076
+ --truncate-internal-middle-marker-opacity: var(--truncate-middle-marker-opacity, 80%);
1077
+ --truncate-internal-marker-background-color: var(--truncate-marker-background-color, light-dark(#fff, #000));
1078
+ --truncate-internal-marker-background-overlay-color: var(--truncate-marker-background-overlay-color, transparent);
1079
+ --truncate-internal-marker-block-inset: var(--truncate-marker-block-inset, 0px);
1080
+ --truncate-internal-marker-fade-out-duration: var(--truncate-marker-fade-out-duration, 0s);
1081
+ --truncate-internal-marker-fade-in-duration: var(--truncate-marker-fade-in-duration, .1s);
1082
+ --truncate-internal-fade-marker-color: var(--truncate-fade-marker-color, #000);
1083
+ --truncate-internal-fade-marker-width: var(--truncate-fade-marker-width, .2lh);
1084
+ --truncate-internal-single-line-height: 1lh;
1085
+ height: var(--truncate-internal-single-line-height);
1086
+ min-width: 0;
1087
+ margin-top: -1px;
1088
+ margin-bottom: -1px;
1089
+ overflow: hidden;
1090
+ }
1091
+
1092
+ [data-truncate-marker] {
1093
+ height: var(--truncate-internal-single-line-height);
1094
+ padding-block: var(--truncate-internal-marker-block-inset);
1095
+ box-sizing: border-box;
1096
+ z-index: 2;
1097
+ color: color-mix(in srgb,
1098
+ currentColor var(--truncate-internal-marker-opacity),
1099
+ transparent);
1100
+ opacity: 0;
1101
+ transition: opacity var(--truncate-internal-marker-fade-out-duration)
1102
+ ease-in-out;
1103
+ background-clip: content-box;
1104
+ align-items: center;
1105
+ display: flex;
1106
+ position: absolute;
1107
+ }
1108
+
1109
+ @container measure (height > 1lh) {
1110
+ [data-truncate-marker] {
1111
+ opacity: 1;
1112
+ transition: opacity var(--truncate-internal-marker-fade-in-duration)
1113
+ ease-in-out;
1114
+ }
1115
+ }
1116
+
1117
+ [data-truncate-grid] {
1118
+ display: grid;
1119
+ position: relative;
1120
+ }
1121
+
1122
+ [data-truncate-content="visible"] {
1123
+ white-space: nowrap;
1124
+ }
1125
+
1126
+ [data-truncate-content="overflow"] {
1127
+ opacity: 0;
1128
+ pointer-events: none;
1129
+ user-select: none;
1130
+ word-break: break-all;
1131
+ margin-top: calc(-1 * var(--truncate-internal-single-line-height));
1132
+ }
1133
+
1134
+ [data-truncate-marker-cell] {
1135
+ user-select: none;
1136
+ pointer-events: none;
1137
+ overflow: visible;
1138
+ container: measure / size;
1139
+ }
1140
+
1141
+ [data-truncate-container="truncate"] {
1142
+ & [data-truncate-grid] {
1143
+ grid-template-columns: minmax(0, max-content) 0;
1144
+ }
1145
+
1146
+ & [data-truncate-marker] {
1147
+ right: 0;
1148
+ }
1149
+
1150
+ & [data-truncate-fade] {
1151
+ margin-right: calc(-2 * var(--truncate-internal-fade-marker-width));
1152
+ }
1153
+ }
1154
+
1155
+ [data-truncate-container="fruncate"] {
1156
+ & [data-truncate-grid] {
1157
+ grid-template-columns: 0 minmax(0, max-content) auto;
1158
+ }
1159
+
1160
+ & [data-truncate-content] {
1161
+ direction: rtl;
1162
+ }
1163
+
1164
+ & [data-truncate-content] > span {
1165
+ unicode-bidi: plaintext;
1166
+ }
1167
+
1168
+ & [data-truncate-fade] {
1169
+ margin-left: calc(-2 * var(--truncate-internal-fade-marker-width));
1170
+ }
1171
+ }
1172
+
1173
+ [data-truncate-variant="default"] {
1174
+ & [data-truncate-marker] {
1175
+ background-color: var(--truncate-internal-marker-background-color);
1176
+ background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
1177
+ var(--truncate-internal-marker-background-overlay-color));
1178
+ }
1179
+
1180
+ & [data-truncate-marker]:after, & [data-truncate-marker]:before {
1181
+ content: "";
1182
+ width: calc(var(--truncate-internal-marker-fade-width) +
1183
+ var(--truncate-internal-marker-gap));
1184
+ height: max(0px,
1185
+ calc(var(--truncate-internal-single-line-height) -
1186
+ var(--truncate-internal-marker-block-inset) * 2));
1187
+ background-color: var(--truncate-internal-marker-background-color);
1188
+ background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
1189
+ var(--truncate-internal-marker-background-overlay-color));
1190
+ -webkit-mask-image: linear-gradient(var(--truncate-internal-fade-dir),
1191
+ #000 0%,
1192
+ #000 var(--truncate-internal-marker-gap),
1193
+ transparent 100%);
1194
+ mask-image: linear-gradient(var(--truncate-internal-fade-dir),
1195
+ #000 0%,
1196
+ #000 var(--truncate-internal-marker-gap),
1197
+ transparent 100%);
1198
+ position: absolute;
1199
+ inset-block-start: var(--truncate-internal-marker-block-inset);
1200
+ }
1201
+
1202
+ & [data-truncate-marker]:after {
1203
+ --truncate-internal-fade-dir: to right;
1204
+ right: calc(-1 *
1205
+ (
1206
+ var(--truncate-internal-marker-fade-width) +
1207
+ var(--truncate-internal-marker-gap)
1208
+ ));
1209
+ }
1210
+
1211
+ & [data-truncate-marker]:before {
1212
+ --truncate-internal-fade-dir: to left;
1213
+ left: calc(-1 *
1214
+ (
1215
+ var(--truncate-internal-marker-fade-width) +
1216
+ var(--truncate-internal-marker-gap)
1217
+ ));
1218
+ }
1219
+ }
1220
+
1221
+ [data-truncate-variant="fade"] {
1222
+ & [data-truncate-marker] {
1223
+ background: none;
1224
+ }
1225
+ }
1226
+
1227
+ [data-truncate-fade] {
1228
+ box-shadow: 0 0 calc(var(--truncate-internal-fade-marker-width) / 2)
1229
+ var(--truncate-internal-fade-marker-color),
1230
+ 0 0 var(--truncate-internal-fade-marker-width)
1231
+ var(--truncate-internal-fade-marker-color);
1232
+ width: calc(var(--truncate-internal-fade-marker-width) * 2);
1233
+ height: calc(var(--truncate-internal-single-line-height) -
1234
+ (var(--truncate-internal-fade-marker-width) * 2));
1235
+ margin: var(--truncate-internal-fade-marker-width) 0;
1236
+ }
1237
+
1238
+ [data-truncate-group-container="middle"] {
1239
+ & [data-truncate-container] {
1240
+ --truncate-marker-opacity: var(--truncate-internal-middle-marker-opacity);
1241
+ }
1242
+
1243
+ min-width: 0;
1244
+ display: flex;
1245
+
1246
+ & > div {
1247
+ min-width: 0;
1248
+ }
1249
+
1250
+ & > div[data-truncate-segment-priority="1"] {
1251
+ flex: 0 1 max-content;
1252
+ }
1253
+
1254
+ & > div[data-truncate-segment-priority="2"] {
1255
+ flex: 0 999999 max-content;
1256
+ }
1257
+ }
1258
+ }
1259
+
1260
+ @layer theme, unsafe;
1261
+ `,Vy=`@layer base, unsafe;`;function Hy(e){return`${Vy}
1262
+ @layer base {
1263
+ ${e}
1264
+ }`}function Uy(e){return`${Vy}
1265
+ @layer unsafe {
1266
+ ${e}
1267
+ }`}var Wy=new WeakMap;function Gy(e){let t=Wy.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(Vh,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),Wy.set(e,i),i}function Ky(e,t){if(!e.isConnected)return;let n=Gy(t);if(n==null)return;let r=t.querySelector(`style[${Hh}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(Hh,``),t.appendChild(i)),i.textContent=`:host { ${Uh}: ${n}px; }`}var qy;function Jy(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){qy??(qy=new CSSStyleSheet,qy.replaceSync(Hy(By)));let t=!1;try{e.adoptedStyleSheets=[qy],t=!0}catch{}if(t){e.querySelector(`style[${zh}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(zh,``),t.textContent=Hy(By),e.prepend(t)}}function Yy(e,t){Xy(e,t),Jy(t),Ky(e,t)}function Xy(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});Yy(this,e)}}if(customElements.define(Rh,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(Rh)))e instanceof HTMLElement&&Yy(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Zy=e=>e.startsWith(`f::`)?e.slice(3):e;function Qy(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function $y(e,t){return e===``?t:`${e}/${t}`}function eb({files:e,path:t,isFolder:n,nextBasename:r}){let i=Zy(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=Qy(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=$y(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function tb(e){return e.endsWith(`/`)}function nb(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function rb(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function ib(e,t){return t.includes(e)?rb(t):[e]}function ab(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function ob(e,t){return{draggedPaths:e,target:t}}function sb(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(tb(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function cb(e,t){return t.kind===`root`||t.directoryPath==null?nb(e):t.directoryPath}function lb(e,t){let n=e.map(e=>{let n=cb(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function ub(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function db(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!ub(Fy.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function fb(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function pb(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function mb(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function hb(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return mb(e,t.path)?n?e:null:e;case`move`:return pb(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=hb(r,e,n),r==null)return null;return r}}}function gb(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function _b(e){switch(e.operation){case`add`:return{...gb(e),operation:`add`,path:e.path};case`remove`:return{...gb(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...gb(e),from:e.from,operation:`move`,to:e.to}}}function vb(e){return{...gb(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>_b(e)),operation:`batch`}}function yb(e){switch(e.operation){case`add`:case`remove`:case`move`:return _b(e);case`batch`:return vb(e);default:return null}}function bb(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function xb(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Sb(e){return xb(e).at(-1)??null}function Cb(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function wb(e){return e.endsWith(`/`)}var Tb=e=>e.toLowerCase();function Eb(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function Db(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Ob(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var kb=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Ab=Symbol(`FILE_TREE_RENAME_VIEW`),jb=512,Mb=512;function Nb(e){return e===`top`||e===`center`?e:`nearest`}function Pb(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=xb(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function Fb(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:Pb(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Ib=class e{static{Object.defineProperty(e.prototype,Ab,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=db({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=Sb(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:Nb(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=Mb){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t!=null&&this.#B.has(t)&&this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=ib(t,n);return this.#r.canDrag?.(r)!==!1&&(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=ob(t.draggedPaths,n);(sb(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}ab(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=ob(e.draggedPaths,t);if(sb(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=lb(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=wb(r),a=Db(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of xb(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=Eb(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,wb(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,wb(e)?{recursive:!0}:void 0);return}let t=wb(e),n=eb({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:Db(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(Ob(n.sourcePath,t),Ob(n.destinationPath,t))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=db({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!bb(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=Sb(e),n=Cb(e,t),r=null,i=null;for(let e of this.#be()){if(Sb(e)!==t)continue;let a=Cb(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=xb(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!bb(this.#B,r),a=this.#z!==t;(i||a)&&(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new Fy({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of xb(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(Tb),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(Tb),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of xb(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:kb(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of xb(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of xb(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=Fb(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,jb)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s!==e||this.#c!==n)&&(this.#s=e,this.#c=n,t&&this.#De())}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=hb(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=hb(this.#c,e,!0),r=[...this.#B].map(t=>hb(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=hb(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return bb(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&fb(e)&&(this.#i=null);let t=fb(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=yb(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},Lb=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function Rb(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(e[t]!==`/`&&t!==e.length){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function zb(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function Bb(e,t){return t?`${e}/`:e}function Vb(e,t=null){let n=Lb(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set,o=new Map;for(let t of e??[]){let e=Ub(t);e!=null&&Kb({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function Hb(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=Wb(e);t!=null&&(c=Gb({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=Ub(e);t!=null&&(c=Kb({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:Yb(i),statusByPath:i}:e}function Ub(e){return Wb(e.path)}function Wb(e){let t=Rb(e);if(t!=null)return{canonicalPath:Bb(t.path,t.isDirectory),isDirectory:t.isDirectory}}function Gb({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),Jb(t,n,e),!0)}function Kb({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??qb(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function qb(e,t,n){for(let r of zb(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function Jb(e,t,n){for(let r of zb(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function Yb(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var Xb,Zb,Qb,$b,ex,tx,nx,rx,ix,ax,ox={},sx=[],cx=Array.isArray,lx=sx.slice,ux=Object.assign;function dx(e){e&&e.parentNode&&e.remove()}function fx(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?lx.call(arguments,2):n),px(e,o,r,i,null)}function px(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Zb,__i:-1,__u:0};return i==null&&Xb.vnode!=null&&Xb.vnode(a),a}function mx(e){return e.children}function hx(e,t){this.props=e,this.context=t,this.__g=0}function gx(e,t){if(t==null)return e.__?gx(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?gx(e):null}function _x(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return _x(e)}}function vx(e){(8&e.__g||!(e.__g|=8)||!Qb.push(e)||ex++)&&$b==Xb.debounceRendering||(($b=Xb.debounceRendering)||queueMicrotask)(yx)}function yx(){for(var e,t,n,r,i,a,o,s,c=1;Qb.length;)Qb.length>c&&Qb.sort(tx),e=Qb.shift(),c=Qb.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=ux({},r)).__v=r.__v+1,Xb.vnode&&Xb.vnode(n),Dx(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??gx(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,kx(a,n,o),n.__e!=i&&_x(n)));ex=0}function bx(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||sx,b=t.length;for(c=xx(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?ox:y[m.__i]||ox,m.__i=f,_=Dx(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Mx(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=Sx(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function xx(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?px(null,o,null,null,null):cx(o)?px(mx,{children:o},null,null,null):o.constructor==null&&o.__b>0?px(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=Cx(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=gx(s)),Nx(s,s));return r}function Sx(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=Sx(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=gx(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Cx(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function wx(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function Tx(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||wx(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||wx(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(nx,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=rx,e.addEventListener(t,a?ax:ix,a)):e.removeEventListener(t,a?ax:ix,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function Ex(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=rx++;else if(t.u<n.l)return;return n(Xb.event?Xb.event(t):t)}}}function Dx(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=Xb.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new hx(v,x),f.constructor=M,f.render=Px),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=ux({},f.__s)),ux(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=Xb.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=ux({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===mx&&d.key==null&&(E=Ax(d.props.children)),s=bx(e,cx(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null){if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)dx(a[j]);Ox(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||Ox(t);Xb.__e(e,t,n)}else s=t.__e=jx(n.__e,t,n,r,i,a,o,c,l,u);return(d=Xb.diffed)&&d(t),128&t.__u?void 0:s}function Ox(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(Ox)}function kx(e,t,n){for(var r=0;r<n.length;r++)Mx(n[r],n[++r],n[++r]);Xb.__c&&Xb.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Xb.__e(e,t.__v)}})}function Ax(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:cx(e)?e.map(Ax):ux({},e)}function jx(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(Xb.__m&&Xb.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=lx.call(e.childNodes),v=n.props||ox,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;Tx(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||Tx(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),bx(b==`template`?e.content:e,cx(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&gx(n,0),s,c,l),a!=null)for(u=a.length;u--;)dx(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||Tx(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&Tx(e,u,g,v[u],i))}return e}function Mx(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){Xb.__e(e,n)}}function Nx(e,t,n){var r,i;if(Xb.unmount&&Xb.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Mx(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Xb.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Nx(r[i],t,n||typeof e.type!=`function`);n||dx(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Px(e,t,n){return this.constructor(e,n)}function Fx(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Xb.__&&Xb.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=fx(mx,null,[e]),i=[],a=[],Dx(t,e,r||ox,ox,t.namespaceURI,r?null:t.firstChild?lx.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),kx(i,e,a)}function Ix(e,t){e.__u|=32,Fx(e,t)}Xb={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw ex=0,e}},Zb=0,hx.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ux({},this.state);typeof e==`function`&&(e=e(ux({},n),this.props)),e&&ux(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),vx(this))},hx.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),vx(this))},hx.prototype.render=mx,Qb=[],ex=0,tx=function(e,t){return e.__v.__b-t.__v.__b},nx=/(PointerCapture)$|Capture$/i,rx=0,ix=Ex(!1),ax=Ex(!0);var Lx=0;Array.isArray;function Rx(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Lx,__i:-1,__u:0,__source:i,__self:a};return Xb.vnode&&Xb.vnode(l),l}var zx=16,Bx=16,Vx={};function Hx({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=Vx[e]??{width:zx,height:Bx},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Rx(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Rx(`use`,{href:c})})}var Ux=e=>e!==void 0&&/\s/.test(e),Wx=(e,t)=>{let n=t=>Ux(e[t-1])||Ux(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},Gx=e=>Wx(e,Math.ceil(e.length/2)),Kx=e=>{if(e.length<2)return[e,``];let t=Gx(e);return[e.slice(0,t),e.slice(t)]},qx=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Gx(e);return[e.slice(0,r),e.slice(r)]},Jx=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},Yx=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},Xx=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},Zx=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function Qx({children:e,marker:t,variant:n=`default`}){"use no memo";return Rx(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Rx(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Rx(`span`,{"data-truncate-fade":!0}):t})})}function $x(e){"use no memo";let{mode:t,children:n}=e;return Rx(`div`,{children:[Rx(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Rx(`span`,{children:n}):n}),Rx(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Rx(`span`,{children:n}):n})]})}function eS({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Rx($x,{mode:t,children:e},`content`),o=Rx(Qx,{marker:n,mode:t,variant:r},`marker`),s=Rx(`div`,{"data-truncate-fill":!0},`fill`);return Rx(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Rx(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function tS({children:e,...t}){"use no memo";return Rx(eS,{mode:`truncate`,...t,children:e})}function nS({children:e,...t}){"use no memo";return Rx(eS,{mode:`fruncate`,...t,children:e})}function rS({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Rx(tS,{...s,children:t[0]}),l=Rx(nS,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Rx(`div`,{className:a,style:o});if(e.length<i)return Rx(n===`end`?nS:tS,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Kx:r===`extension`?t=qx:r===`leaf-path`&&(t=Jx);else if(typeof r==`number`)t=Yx,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=Xx:e===`first`&&(t=Zx)}else typeof r==`function`&&(t=r);t??=Kx;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Rx(tS,{...s,..._,children:f}),l=Rx(nS,{...s,...v,children:p})}return Rx(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Rx(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Rx(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var iS={endIndex:-1,startIndex:-1};function aS(e,t,n){return Math.min(Math.max(e,t),n)}function oS(e,t){return e<0||t<e?iS:{endIndex:t,startIndex:e}}function sS(e){return e.startIndex<0||e.endIndex<e.startIndex}function cS(e,t){return sS(e)?0:(e.endIndex-e.startIndex+1)*t}function lS(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function uS(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function dS(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function fS(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function pS(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function mS(e,t,n){if(e.length===0||t<=0)return[];let r=pS(e),i=dS(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=fS(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function hS(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=aS(t.scrollTop,0,o),c=t.stickyRows??mS(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=lS(s,n,t.itemHeight),m=lS(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?iS:oS(m,uS(u+d,n,t.itemHeight)),y=g+1,b=sS(v)?iS:oS(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=cS(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:sS(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var gS={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},_S={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},vS=`Contains git status items`;function yS(e){return e.current?!0:(e.current=!0,!1)}function bS(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function xS(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return bS({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function SS(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function CS(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function wS(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function TS(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function ES(e,t){return e!=null&&e>0?e:t}function DS(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function OS(e,t,n,r,i=0){let a=bS({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function kS(e,t,n,r,i,a,o=0){let s=xS({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function AS(e,t,n,r,i,a){let o=SS({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function jS(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function MS(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function NS({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Rx(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function PS(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function FS(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var IS,LS,RS,zS,BS=Object.is,VS=0,HS=[],US=Xb,WS=US.__b,GS=US.__r,KS=US.diffed,qS=US.__c,JS=US.unmount,YS=US.__;function XS(e,t){US.__h&&US.__h(LS,e,VS||t),VS=0;var n=LS.__H||(LS.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ZS(e){return VS=1,QS(uC,e)}function QS(e,t,n){var r=XS(IS++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):uC(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);BS(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=LS,!LS.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,BS(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};LS.__f=!0;var a=LS.shouldComponentUpdate,o=LS.componentWillUpdate;LS.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},LS.shouldComponentUpdate=i}return r.__N||r.__}function $S(e,t){var n=XS(IS++,3);!US.__s&&lC(n.__H,t)&&(n.__=e,n.u=t,LS.__H.__h.push(n))}function eC(e,t){var n=XS(IS++,4);!US.__s&&lC(n.__H,t)&&(n.__=e,n.u=t,LS.__h.push(n))}function tC(e){return VS=5,nC(function(){return{current:e}},[])}function nC(e,t){var n=XS(IS++,7);return lC(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function rC(e,t){return VS=8,nC(function(){return e},t)}function iC(){for(var e;e=HS.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(sC),e.__H.__h.forEach(cC),e.__H.__h=[]}catch(t){e.__H.__h=[],US.__e(t,e.__v)}}US.__b=function(e){LS=null,WS&&WS(e)},US.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),YS&&YS(e,t)},US.__r=function(e){GS&&GS(e),IS=0;var t=(LS=e.__c).__H;t&&(RS===LS?(t.__h=[],LS.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(sC),t.__h.forEach(cC),t.__h=[],IS=0)),RS=LS},US.diffed=function(e){KS&&KS(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(HS.push(t)!==1&&zS===US.requestAnimationFrame||((zS=US.requestAnimationFrame)||oC)(iC)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),RS=LS=null},US.__c=function(e,t){t.some(function(e){try{e.__h.forEach(sC),e.__h=e.__h.filter(function(e){return!e.__||cC(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],US.__e(n,e.__v)}}),qS&&qS(e,t)},US.unmount=function(e){JS&&JS(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{sC(e)}catch(e){t=e}}),n.__H=void 0,t&&US.__e(t,n.__v))};var aC=typeof requestAnimationFrame==`function`;function oC(e){var t,n=function(){clearTimeout(r),aC&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);aC&&(t=requestAnimationFrame(n))}function sC(e){var t=LS,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),LS=t}function cC(e){var t=LS;e.__c=e.__(),LS=t}function lC(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!BS(t,e[n])})}function uC(e,t){return typeof t==`function`?t(e):t}function dC(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Rx(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Rx(mx,{children:[Rx(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Rx(tS,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function fC(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function pC(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function mC(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function hC({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=hS(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:mC(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?mC(u,1,t,o):i&&r<=0&&c.length>0?mS(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var gC=400,_C=40,vC=18;function yC(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?bC(e,t,n):a instanceof HTMLElement?a:null}function bC(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function xC(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function SC(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function CC(){return navigator.vendor!==`Apple Computer, Inc.`}function wC(e,t){let n=e-t.top;if(n<_C)return-Math.ceil((_C-Math.max(0,n))/_C*vC);let r=t.bottom-e;return r<_C?Math.ceil((_C-Math.max(0,r))/_C*vC):0}function TC(e,t){if(e!=null){let t=gS[e];return t==null?null:{text:t,title:_S[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:vS}:null}function EC(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function DC(e){return e!=null&&`toggle`in e}function OC(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function kC(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function AC(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function jC(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function MC(e,t){return t&&jC(e)||(e.ctrlKey||e.metaKey)&&OC(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var NC=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function PC(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function FC(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function IC(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function LC(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function RC(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function zC(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function BC(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function VC(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function HC(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=VC(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function UC(e,t){return{kind:e.kind,name:pC(e),path:t}}function WC(e){return e==null?void 0:`${e}__tree`}function GC(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function KC(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function qC(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Rx(`span`,{title:e.title,children:e.text}):Rx(`span`,{title:e.title,children:e.parts.map((e,t)=>Rx(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?KC(e.icon)?t(e.icon):{name:e.icon}:KC(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Rx(`span`,{title:e.title,children:Rx(Hx,{...n})})}function JC(e){e!=null&&CS(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function YC(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=fC(e);return Rx(mx,{children:[e.depth>0?Rx(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Rx(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Rx(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Rx(Hx,{...t(`file-tree-icon-chevron`)}):Rx(Hx,{...t(`file-tree-icon-file`,u)})}),Rx(`div`,{"data-item-section":`content`,children:e.isFlattened?dC(e,c,a):c??Rx(rS,{minimumLength:5,split:`extension`,children:e.name})}),i?Rx(`div`,{"data-item-section":`decoration`,children:r==null?null:qC(r,t)}):null,s?Rx(`div`,{"data-item-section":`git`,children:qC(o,t)}):null,n?Rx(`div`,{"data-item-section":`action`,children:l?Rx(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Rx(Hx,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function XC(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=fC(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??EC(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=TC(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,ee=a.getPath()===P,te=ee?a.getValue():``,K=R||!ee?null:Rx(NS,{ref:D,ariaLabel:`Rename ${pC(t)}`,isFlattened:t.isFlattened,value:te,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ne=YC(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:K,showDecorativeActionAffordance:G}),q={...PS({ariaLabel:pC(t),domId:t.isFocused?GC(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:IC(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&ee?Rx(`div`,{...q,children:ne}):Rx(`button`,{...q,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:ne})}function ZC(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(fC(e))).map((n,r)=>XC(e,n,t.start+r))}function QC({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=zy,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=tC(null),v=tC(null),y=tC(!1),b=tC(null),x=tC(null),S=tC(null),C=tC(null),w=tC(null),T=tC(new Map),E=tC(new Map),D=tC(()=>{}),O=tC(null),k=tC(0),A=tC(!1),j=tC(null);j.current!==t&&(A.current=!1,j.current=t);let M=tC(!1),N=tC(null),P=tC(null),F=tC(!1),I=tC(null),L=tC(null),R=tC(null),z=tC(null),B=tC(null),V=tC(null),H=tC(null),U=tC(null),W=tC(!1),G=tC(null),ee=tC(null),te=tC(null),K=tC(null),ne=nC(()=>new Map,[]),[,q]=ZS(0),re=tC(!1),[ie,ae]=ZS(null),[oe,se]=ZS(null),[ce,le]=ZS(null),[ue,de]=ZS(null),[fe,pe]=ZS(0),[me,he]=ZS(null),ge=tC(me);ge.current=me;let _e=tC(null),ve=tC(null),ye=tC(null),be=tC(null),xe=tC(null),Se=tC(!1),Ce=()=>{ve.current=null,ye.current=null,be.current=null},we=(e,t)=>{ve.current=e,ye.current=null,be.current=t==null?null:{path:e,scrollTop:t}},Te=(e,t)=>{ve.current=null,ye.current={path:e,viewportOffset:t},be.current=null},Ee=tC(d===`retain`&&t.isSearchOpen()),[De,Oe]=ZS(p);$S(()=>{p||Oe(!1)},[p]);let ke=tC(!1),Ae=rC(()=>{ke.current=!0,Oe(e=>e&&!1)},[]),[je,Me]=ZS(()=>hC({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ne,Pe]=ZS(!1);$S(()=>{Pe(!0)},[]);let Fe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ie=e?.contextMenu?.triggerMode??(Fe?`right-click`:`both`),Le=Ie===`both`||Ie===`button`,J=e?.contextMenu?.buttonVisibility??`when-needed`,Re=Ie===`both`||Ie===`right-click`;eC(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;xe.current=t,se(t),de(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Se.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let ze=rC((e,t)=>{RC(T.current,e,t)},[]),Be=rC((e,t)=>{RC(E.current,e,t)},[]),Ve=rC(e=>{x.current=e},[]),He=rC(e=>zC(e,E.current,T.current),[]),Ue=n!=null||r!=null||i!=null,{resolveIcon:We}=nC(()=>$h(a),[a]),Ge=t[Ab](),Ke=Ge.getPath(),qe=Ke!=null,Je=t.isSearchOpen(),Ye=t.getSearchValue(),Xe=t.getFocusedPath(),Ze=t.getFocusedIndex(),Qe=t.getScrollRequest(),$e=t.isDragAndDropEnabled(),et=t.getDragSession(),tt=nC(()=>et==null?null:new Set(et.draggedPaths),[et]),nt=et?.target??null,rt=et?.primaryPath??null,it=WC(o),{overlayHeight:at,overlayRows:ot,snapshot:st,visibleRows:ct}=je,lt=st.physical.viewportHeight,ut=nC(()=>({end:st.window.endIndex,start:st.window.startIndex}),[st.window.endIndex,st.window.startIndex]),dt=ot,ft=st.sticky.rows,pt=st.physical.totalHeight,mt=st.sticky.height,ht=nC(()=>new Set(ft.map(e=>fC(e.row))),[ft]),gt=Ze>=0&&Ze>=ut.start&&Ze<=ut.end,_t=rC((e,t)=>u?.({item:UC(e,t),row:e})??null,[u]),vt=rC(e=>CS(e==null?null:T.current.get(e)??null)?!0:CS(S.current),[]),yt=rC(e=>{vt(t.focusNearestPath(e))},[t,vt]),bt=tC(yt);bt.current=yt;let xt=tC(!0),St=tC(()=>{}),Ct=rC((t=!0)=>{let n=ge.current;n!=null&&(xt.current=xt.current&&t,he(null),e?.contextMenu?.onClose?.(),xt.current&&yt(n.path))},[e?.contextMenu,yt]);St.current=Ct;let wt=rC(e=>{let t=e==null?null:LC(S.current,e);le(e=>e===t?e:t)},[]),Tt=rC((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=He(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;we(n,e?.scrollTop??null),M.current=!0,ae(e=>e===n?e:n)}i.focus(),wt(a),xt.current=!0,he({anchorRect:r?.anchorRect??null,item:UC(e,n),path:n,source:r?.source??`keyboard`})},[t,He,wt]),Et=rC(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=TS(e,lt);I.current=Ze<0||e==null?null:Math.max(0,Math.min(Ze*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(de(`focus`),q(e=>e+1))}},[t,Ze,s,l,lt]),Dt=rC((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=TS(i,lt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:hC({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,AS(i,a,s,l,u,d),D.current(),_e.current=n?e:null,!0},[t,s,c,lt,h]),Ot=()=>y.current===!0||K.current!=null||W.current===!0,kt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),At=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},jt=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},Mt=()=>{V.current?.remove(),V.current=null},Nt=()=>{At(L.current),L.current=null,B.current=null},Pt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Ft=()=>{U.current?.(),U.current=null,K.current!=null&&(clearTimeout(K.current),K.current=null),W.current=!1,G.current=null,te.current=null,ee.current!=null&&(ee.current.setAttribute(`draggable`,`true`),ee.current.style.removeProperty(`touch-action`),ee.current=null),Mt(),jt(),Nt(),H.current=null},It=(e,n)=>{let r=S.current?.getRootNode(),i=xC(yC(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Lt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){jt();return}let r=t.getItem(e.directoryPath),i=DC(r)?r:null;if(i==null||i.isExpanded()){jt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(jt(),R.current=a,z.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Rt=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=wC(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Lt(It(e.clientX,e.clientY)),L.current=kt(Rt)},zt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=kt(Rt)},Bt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Ft(),Mt(),jt(),Nt(),t.startDrag(r)===!1){e.preventDefault();return}if(H.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),CC())){let t=SC(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Pt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Vt=()=>{Mt(),jt(),Nt(),H.current=null,t.cancelDrag()},Ht=(e,n,r)=>{if(K.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;te.current={clientX:i.clientX,clientY:i.clientY},ee.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;K.current!=null&&(clearTimeout(K.current),K.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),ee.current===a&&(ee.current=null),te.current=null)},s=e=>{let t=e.touches[0],n=te.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,K.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),ee.current===a&&(ee.current=null),te.current=null;return}W.current=!0,ee.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=SC(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Pt(s),V.current=s,G.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=G.current;n!=null&&V.current!=null&&(V.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Lt(It(t.clientX,t.clientY)),zt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&It(n.clientX,n.clientY),t.completeDrag(),Ft()},u=()=>{t.cancelDrag(),Ft()};U.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},gC)},Ut=e=>{if(me!=null){if(e.key===`Escape`){Ct(),e.preventDefault(),e.stopPropagation();return}NC.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ge.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)Ge.cancel();else if(e.key===`Enter`)Ge.commit();else return;de(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Et(Xe??void 0),e.preventDefault(),e.stopPropagation();return}if(Je){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=TS(n,lt);I.current=Ze<0||n==null?null:Math.max(0,Math.min(Ze*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;de(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&kC(e)){t.openSearch(e.key),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Fe&&jC(e),r=MC(e,Fe),i=r&&S.current!=null?wS(S.current):null,a=r?new Set(BC(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Xe&&a.has(o)){let e=C.current;we(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=DC(p)?p:null,h=u!=null&&(ht.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=zC(u,E.current,T.current);e==null||n==null?y=!1:Tt(e,u)}else if((e.ctrlKey||e.metaKey)&&OC(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;de(`focus`);let b=t.getFocusedPath(),x=b!=null&&(ht.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))we(b,v?.scrollTop??null),M.current=!0,ae(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Te(b,HC(S.current,v,i,u,s,mt,lt)),M.current=!0,ae(e=>e===b?e:b)):Ce()}q(e=>e+1),e.preventDefault(),e.stopPropagation()};eC(()=>{if(f&&Je){if(Ee.current){Ee.current=!1;return}CS(w.current)}},[Je,f]),eC(()=>{let e=x.current;switch(MS({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ke})){case`reset`:P.current=null;return;case`reveal-canonical`:Ke!=null&&Dt(Ke,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(_e.current=null,P.current=Ke,CS(e),e.select());return}},[ut.end,ut.start,Ke,Dt,ht]),eC(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=wS(e)?.dataset.itemPath??null;ae(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,wS(e)!=null){r();return}M.current=!1,ae(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,ae(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;ae(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),eC(()=>{let e=S.current;e!=null&&(st.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[st.physical.scrollTop]),eC(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=TS(n,g);let a=()=>{let e=t.getVisibleCount(),r=ES(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Me(hC({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=ES(O.current,g),i=t.getVisibleRows(e,e)[0]??null;OS(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=t.subscribe(()=>{yS(re)&&q(e=>e+1),a()}),l=()=>{Se.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,pe(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Se.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),ge.current!=null&&y.current&&St.current(),Se.current===!0){y.current=!1;return}se(e=>e==null?e:null),l()},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:DS(e[0]))??TS(n,g),a()}):null;return x?.observe(n),()=>{D.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,x?.disconnect()}},[t,g,s,c,h]),eC(()=>{Fe||me==null||Ct(!1)},[Ct,Fe,me]);let Wt=nC(()=>me==null?null:`${me.path}::${me.source}`,[me]);eC(()=>{if(Wt==null){m?.clearSlotContent(Gh);return}let t=ge.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??FC(n.getBoundingClientRect()),close:e=>{St.current(e?.restoreFocus??!0)},restoreFocus:()=>{xt.current&&bt.current(ge.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(Gh,i),e?.contextMenu?.onOpen?.(t.item,r),JC(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&JC(i)}),()=>{m?.clearSlotContent(Gh)}},[Wt,e?.contextMenu,m]),eC(()=>{me!=null&&t.getItem(me.path)==null&&Ct()},[Ct,me,t]),eC(()=>{if(me==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(PC(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Ct())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Ct())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Ct,me]),eC(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Xe;return}let r=Xe==null?null:T.current.get(Xe)??null,i=wS(n),a=i?.dataset.itemPath??null,o=qe&&x.current===i,c=f&&w.current===i,l=F.current&&!Je,u=I.current??0,d=_e.current,p=ve.current,m=ye.current,g=be.current,_=i!=null,v=M.current||_,y=N.current!==Xe,b=p!=null&&p===Xe&&Xe!=null,E=!1,O=!1;if(Qe!=null&&Qe.id!==k.current){k.current=Qe.id;let n=Qe.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,lt-s))):mt;E=!0,O=kS(e,n,s,lt,pt,Qe.offset,t)}t.clearScrollRequest(Qe.id)}let A=!E&&l&&AS(e,Ze,s,lt,pt,u),j=!E&&d!=null&&d===Xe&&AS(e,Ze,s,lt,pt,mt),P=!E&&m!=null&&m.path===Xe&&AS(e,Ze,s,lt,pt,m.viewportOffset),L=!E&&g!=null&&g.path===Xe&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Xe&&!b&&OS(e,Ze,s,lt,mt))&&D.current(),E){N.current=Xe;return}if(!v){N.current=Xe;return}if(o){N.current=Xe;return}if(c&&!l){N.current=Xe;return}if(r==null){l&&Ze>=0&&(AS(e,Ze,s,lt,pt,u),D.current()),N.current=Xe;return}(y||l||d===Xe||p===Xe||m?.path===Xe||g?.path===Xe||a==null||a!==Xe)&&(CS(r),d===Xe&&(_e.current=null),p===Xe&&(ve.current=null),m?.path===Xe&&(ye.current=null),g?.path===Xe&&(be.current=null),F.current=!1,I.current=null),N.current=Xe},[t,Ze,Xe,gt,s,qe,Je,ut,lt,f,Qe,h,mt,pt,ct]);let Gt=Ze>=0&&Ze>=st.visible.startIndex&&Ze<=st.visible.endIndex,Kt=Xe!=null&&dt.some(e=>fC(e.row)===Xe),qt=Gt||Kt,Jt=Le&&M.current===!0&&qt?Xe:null,Yt=ue===`pointer`?oe:null,Xt=me?.path??xe.current??Yt??Jt??oe,Zt=me?.source===`right-click`;eC(()=>{y.current&&me==null||wt(He(Xt))},[me,He,ut,lt,fe,dt,Xt,wt,ct]);let Qt=rC(e=>{if(y.current||PC(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&de(e=>e===`pointer`?e:`pointer`),se(e=>e===i?e:i)},[]),$t=rC(()=>{se(null)},[]);eC(()=>{if(!$e)return;let e=()=>{Ft(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Ft(),t.cancelDrag()}},[t,$e]);let en=e=>{if(!$e||t.getDragSession()==null||W.current)return;let n=xC(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Lt(t.getDragSession()?.target??null),zt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},tn=e=>{if(!$e||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(jt(),Nt(),t.setDragTarget(null))},nn=e=>{$e&&t.getDragSession()!=null&&!W.current&&(e.preventDefault(),It(e.clientX,e.clientY),t.completeDrag(),Mt(),jt(),Nt(),H.current=null)},rn=st.window.height,an=st.window.offsetTop,on=Math.min(0,lt-rn),sn=Math.min(0,lt-rn-mt),cn=ie===Xe||F.current,ln=Xe!=null&&cn&&!gt&&Ze>=0?ct[Ze]??t.getVisibleRows(Ze,Ze)[0]??null:null,un=ln==null?null:jS(Ze,s,ut,rn),dn=H.current,fn=rt!=null&&dn!=null&&dn.path===rt&&dn.index>=ut.start&&dn.index<=ut.end,pn=rt!=null&&dn!=null&&dn.path===rt&&!fn&&dn.path!==ln?.path?dn:null,mn=pn==null?null:jS(pn.index,s,ut,rn),hn=AC((Ze>=0?ct[Ze]??t.getVisibleRows(Ze,Ze)[0]??null:null)?.ancestorPaths.at(-1)??null),gn=Je&&Xe!=null?GC(o,Xe,!gt):void 0,_n=me?.path??(Je?Xe:ie),vn=me?.path??oe,yn=He(Xt),bn=Fe&&Le&&!Zt&&!qe&&yn!=null&&ce!=null&&Xt!=null,xn=Fe&&(bn||me!=null),Sn=me?.anchorRect,Cn=Sn==null&&yn!=null&&ce!=null&&(me!=null||bn)?ce:null,wn=Sn==null?Cn==null?void 0:{top:`${Cn}px`}:{left:`${Sn.left}px`,position:`fixed`,right:`auto`,top:`${Sn.top}px`},Tn=Zt?{opacity:`0`}:void 0,En=rC((e,n,r,i)=>{let a=FS({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:Je,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=st.visible.startIndex&&n.index<=st.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,ae(e=>e===c?e:c),de(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Dt(c,{targetOffset:`sticky-parents`})},[t,Je,st.visible.endIndex,st.visible.startIndex,Dt]),Dn=()=>{if(y.current||!Le||Xt==null||yn==null)return;let e=t.getItem(Xt);e!=null&&(wt(yn),xt.current=!0,he({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:yn.getAttribute(`aria-label`)??Xt,path:e.getPath()},path:e.getPath(),source:`button`}))},On={contextHoverPath:vn,contextMenuButtonTriggerEnabled:Le,contextMenuButtonVisibility:J,contextMenuEnabled:Fe,contextMenuRightClickEnabled:Re,contextMenuTriggerMode:Ie,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:$e,draggedPathSet:tt,dragTarget:nt,gitLaneActive:Ue,gitStatusByPath:n,handleRowDragEnd:Vt,handleRowDragStart:Bt,handleRowTouchStart:Ht,ignoredGitDirectories:r,ignoredInheritanceCache:ne,instanceId:o,itemHeight:s,onKeyDown:Ut,onRowClick:En,openContextMenuForRow:Tt,registerButton:ze,registerRenameInput:Ve,renameView:Ge,renderDecorationForRow:_t,resolveIcon:We,shouldSuppressContextMenu:Ot,visualFocusPath:_n},kn={...On,registerButton:Be};return Rx(`div`,{ref:S,id:it,"data-file-tree-context-menu-button-visibility":Fe&&Le?J:void 0,"data-file-tree-context-menu-trigger-mode":Fe?Ie:void 0,"data-file-tree-has-context-menu-action-lane":Fe&&Le?`true`:void 0,"data-file-tree-has-git-lane":Ue?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:$e?tn:void 0,onDragOver:$e?en:void 0,onDrop:$e?nn:void 0,onKeyDown:Ut,onPointerLeave:Fe?$t:void 0,onPointerOver:Fe?Qt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Rx(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:hn}}),Rx(`slot`,{name:Wh,"data-type":`header-slot`}),f?Rx(`div`,{"data-file-tree-search-container":!0,"data-open":Je?`true`:`false`,children:Rx(`input`,{ref:w,"aria-activedescendant":gn,"aria-controls":it,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":De?`true`:void 0,value:Ye,onBlur:()=>{(d!==`retain`||ke.current)&&t.closeSearch()},onFocus:Ae,onPointerDown:Ae,onInput:e=>{Ae();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Rx(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ne&&dt.length>0?Rx(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Rx(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${at}px`},children:dt.map((e,t)=>XC(kn,e.row,`sticky:${fC(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${dt.length-t}`}}))})}):null,Rx(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${pt}px`},children:[Rx(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${an}px`}}),Rx(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${rn}px`,top:`${on}px`,bottom:`${sn}px`},children:[ZC(On,ut,ht),ln!=null&&un!=null?XC(On,ln,`parked:${ln.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:rt===ln.path?`none`:void 0,position:`absolute`,right:`0`,top:`${un}px`}}):null,pn!=null&&mn!=null?XC(On,pn,`parked-drag:${pn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${mn}px`}}):null]})]})]}),Fe?Rx(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":xn?`true`:`false`,style:wn,children:[Rx(`button`,{ref:v,type:`button`,"data-type":Kh,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":me==null?`false`:`true`,"data-visible":bn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),me!=null){Ct();return}Dn()},tabIndex:-1,style:Tn,children:Rx(Hx,{...We(`file-tree-icon-ellipsis`)})}),me==null?null:Rx(`slot`,{name:Gh})]}):null,me==null?null:Rx(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Ct()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Ct()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var $C={hydrateRoot:(e,t)=>{Ix(fx(QC,t),e)},renderRoot:(e,t)=>{Fx(fx(QC,t),e)},unmountRoot:e=>{Fx(null,e)}};function ew(e,t){$C.renderRoot(e,t)}function tw(e,t){$C.hydrateRoot(e,t)}function nw(e){$C.unmountRoot(e)}var rw=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}};Array.isArray;var iw=0;function aw(e){return e!=null&&e.length>0?e:(iw+=1,`pst_ft_${iw}`)}function ow({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??zy)}function sw(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function cw(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function lw(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var uw=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new rw;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=aw(a),this.#p=Vb(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=Ry(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new Ib({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(nw(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=Hb(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&ew(n.wrapper,this.#w())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),ew(t.wrapper,this.#w()))}setGitStatus(e){let t=Vb(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&ew(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),ew(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),tw(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),ew(r,this.#w())}#C(){return{initialViewportHeight:ow({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(Wh,e());return}this.#l.setSlotHtml(Wh,this.#e?.header?.html??null)}#k(e){let t=lw(e).find(e=>cw(e)),n=sw(Ph(Jh(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=lw(e),n=t.find(e=>cw(e)),r=t.filter(e=>e!==n),i=Jh(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=sw(i);if(a==null){for(let e of r)e.remove();return}if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=Jh(this.#m);t.colored&&Ih(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${Bh}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}(this.#g?.parentNode!==e||this.#_!==this.#h)&&(this.#g??=document.createElement(`style`),this.#g.setAttribute(Bh,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Uy(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return Yy(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},dw=`complete`,fw=$h({set:dw,colored:!0});function pw(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,width:0,height:0,overflow:`hidden`},dangerouslySetInnerHTML:{__html:Ph(dw)}}),e[0]=t):t=e[0],t}function mw(e){let t=(0,$.c)(11),{path:n,className:r}=e,i;t[0]===n?i=t[1]:(i=fw.resolveIcon(`file-tree-icon-file`,n),t[0]=n,t[1]=i);let a=i,o=a.width??16,s=a.height??16,c=a.token,l=a.viewBox??`0 0 ${o} ${s}`,u;t[2]===r?u=t[3]:(u=Y(`pierre-file-icon`,r),t[2]=r,t[3]=u);let d=`#${a.name}`,f;t[4]===d?f=t[5]:(f=(0,Q.jsx)(`use`,{href:d}),t[4]=d,t[5]=f);let p;return t[6]!==a.token||t[7]!==l||t[8]!==u||t[9]!==f?(p=(0,Q.jsx)(`svg`,{"aria-hidden":`true`,"data-icon-token":c,viewBox:l,className:u,children:f}),t[6]=a.token,t[7]=l,t[8]=u,t[9]=f,t[10]=p):p=t[10],p}var hw=e=>`data:${e.mediaType};base64,${e.base64}`;function gw(e,t,n){let r=(0,$.c)(4),i;return r[0]!==e||r[1]!==n||r[2]!==t?(i=Pn({scope:t,connection:e,path:n}),r[0]=e,r[1]=n,r[2]=t,r[3]=i):i=r[3],at(i)}function _w(e,t,n,r,i){let a=(0,$.c)(6),o;return a[0]!==e||a[1]!==r||a[2]!==n||a[3]!==i||a[4]!==t?(o=Tr({scope:t,connection:e,path:n,html:r,platform:i}),a[0]=e,a[1]=r,a[2]=n,a[3]=i,a[4]=t,a[5]=o):o=a[5],at(o)}function vw(e){let t=e.path?`${e.path}/`:``;return e.entries.map(e=>({path:`${t}${e.name}${e.kind===`directory`?`/`:``}`,kind:e.kind,...e.ignored?{ignored:!0}:{},...e.target===void 0?{}:{target:e.target}}))}function yw(e){let t=e.split(`/`).filter(Boolean);return t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`/`))}function bw(e,t,n){let r=e=>e.replace(/\/$/,``),i=new Set([...t].map(r)),a=new Set([...n].map(r)),o=e.filter(e=>e.kind===`directory`).map(e=>r(e.path)).sort((e,t)=>e.localeCompare(t)),s=new Set(o.filter(e=>i.has(e))),c=new Map;for(let t of e){let e=yw(t.path).at(-1);e&&c.set(e,(c.get(e)??0)+1)}for(let e of o){let t=yw(e).at(-1);!a.has(e)&&t&&s.has(t)&&c.get(t)===1&&s.add(e)}return[...s].filter(e=>yw(e).every(e=>s.has(e)))}function xw(e){let t=new Map(e.map(e=>[e.path,e])),n=new Map,r=t.has(``)?[``]:[];for(let e of r){let i=t.get(e);if(i){for(let e of vw(i))if(n.set(e.path,e),e.kind===`directory`){let n=e.path.replace(/\/$/,``);t.has(n)&&r.push(n)}}}return[...n.values()].sort((e,t)=>e.path.localeCompare(t.path))}function Sw(e,t){let n=t.trim().toLowerCase();return e.filter(e=>e.toLowerCase().includes(n)).slice(0,50)}var Cw=e=>/\.(png|jpe?g|gif|webp|avif|svg|ico)$/i.test(e);function ww(e){let t=(0,$.c)(3),{scope:n,path:r,connection:i}=e,a=gw(i,n,r),o;return t[0]!==r||t[1]!==a?(o=(0,Q.jsx)(`div`,{className:`flex w-full flex-col items-center gap-2 p-4`,children:(0,Q.jsx)(Tw,{query:a,path:r})}),t[0]=r,t[1]=a,t[2]=o):o=t[2],o}function Tw(e){let t=(0,$.c)(10),{query:n,path:r}=e;if(M(n)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{role:`status`,children:`Loading image…`}),t[0]=e):e=t[0],e}if(st(n)){let e;t[1]===n.cause?e=t[2]:(e=Zc(nt(n.cause)),t[1]=n.cause,t[2]=e);let r;return t[3]===e?r=t[4]:(r=(0,Q.jsx)(`p`,{role:`status`,children:e}),t[3]=e,t[4]=r),r}let i;t[5]===n?i=t[6]:(i=hw(br(ar(n))),t[5]=n,t[6]=i);let a;return t[7]!==r||t[8]!==i?(a=(0,Q.jsx)(`img`,{src:i,alt:r,className:`max-h-[70vh] max-w-full object-contain`}),t[7]=r,t[8]=i,t[9]=a):a=t[9],a}function Ew(e){let t=(0,Z.useRef)(e);return(0,Z.useInsertionEffect)(()=>void(t.current=e)),(0,Z.useCallback)((...e)=>t.current(...e),[])}var Dw=(0,Z.createContext)(void 0);function Ow(){return(0,Z.useContext)(Dw)}var kw={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},Aw={display:`contents`};function jw(){return null}function Mw({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function Nw(e,t){return e-(t===0?0:1)}function Pw(e,t){return Nw(e,t)+t}function Fw(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:Iw(n,e.startContentIndex)}}function Iw(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}function Lw({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d,getAnnotationSlotName:f=eu}){let p=n?.(e),m=r?.(e),h=i?.(e),g=a?.(e);return(0,Q.jsxs)(Q.Fragment,{children:[p==null?(0,Q.jsxs)(Q.Fragment,{children:[m!=null&&(0,Q.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,Q.jsx)(`div`,{slot:`header-filename-suffix`,children:h}),g!=null&&(0,Q.jsx)(`div`,{slot:`header-metadata`,children:g})]}):(0,Q.jsx)(`div`,{slot:Nu,children:p}),o!=null&&l?.map((e,t)=>(0,Q.jsx)(`div`,{slot:f(e),children:o(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=Rw(t,e);return(0,Q.jsx)(`div`,{slot:n,style:Aw,children:c(t,d)},n)}),s!=null&&(0,Q.jsx)(`div`,{slot:`gutter-utility-slot`,style:kw,children:s(u)})]})}function Rw(e,t){let n=Fw(e,t);return n==null?void 0:Mw({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function zw({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c,getAnnotationSlotName:l=eu}){let u=t?.(e),d=n?.(e),f=r?.(e),p=i?.(e);return(0,Q.jsxs)(Q.Fragment,{children:[u==null?(0,Q.jsxs)(Q.Fragment,{children:[d!=null&&(0,Q.jsx)(`div`,{slot:`header-prefix`,children:d}),f!=null&&(0,Q.jsx)(`div`,{slot:`header-filename-suffix`,children:f}),p!=null&&(0,Q.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,Q.jsx)(`div`,{slot:Nu,children:u}),a!=null&&o?.map((e,t)=>(0,Q.jsx)(`div`,{slot:l(e),children:a(e)},t)),s!=null&&(0,Q.jsx)(`div`,{slot:`gutter-utility-slot`,style:kw,children:s(c)})]})}function Bw(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function Vw(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Hw(e,t){return dl(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Uw(e){let t=e.lang??pu(e.name),n=e.lang??(e.prevName==null?`text`:pu(e.prevName));return t===`text`&&n===`text`}function Ww(e){return[Nw(e.additionStart,e.additionCount)+1,Pw(e.additionStart,e.additionCount)+1]}function Gw({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function Kw(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-Pw(t.additionStart,t.additionCount),r=e.deletionLines.length-Pw(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function qw({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-Pw(n.additionStart,n.additionCount),i=e.deletionLines.length-Pw(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function Jw({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=qw({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function Yw({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=Ww(a);if(t<o){let s=Gw({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=Jw({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=Ww(a);return t<o+i.fromStart||t>=o+i.rangeSize}function Xw({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=Ww(n),l=Gw({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=Jw({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function Zw({type:e,metrics:t}){return t.hunkSeparatorHeight??_c(e)}function Qw({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function $w({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function eT(e){return e!==`simple`&&e!==`metadata`}function tT({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!$w({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=Zw({type:e,metrics:t}),a=Qw({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function nT({type:e,metrics:t}){if(!eT(e))return;let n=Zw({type:e,metrics:t}),r=Qw({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function rT({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=iT({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=Nw(r.deletionStart,r.deletionCount),s=Nw(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=Gw({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?Jw({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(sT(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,sT(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(sT(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=cT(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(lT({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(sT(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function iT({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=aT({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function aT({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=Gw({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?Jw({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function oT(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function sT(e,t,n,r,i,a){let[o,s]=oT(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function cT(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function lT({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}function uT(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var dT=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},fT=new class extends dT{};function pT(e,t,n){return fT.diff(e,t,n)}function mT(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function hT(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function gT(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function _T(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function vT(e,t){return gT(e,t,``)}function yT(e,t){return _T(e,t,``)}function bT(e,t){return t.slice(0,xT(e,t))}function xT(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function ST(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function CT(e,t){if(t)return TT(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function wT(e,t){if(t)return TT(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function TT(e,t){if(!t)return[wT(e),CT(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=ST(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var ET=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,DT=RegExp(`[${ET}]+|\\s+|[^${ET}]`,`ug`);new class extends dT{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=ST(e,r)}else n=e.match(DT)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&OT(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&OT(n,i,r,null,t.intlSegmenter),e}};function OT(e,t,n,r,i){if(t&&n){let[a,o]=TT(t.value,i),[s,c]=TT(n.value,i);if(e){let r=mT(a,s);e.value=_T(e.value,s,r),t.value=vT(t.value,r),n.value=vT(n.value,r)}if(r){let e=hT(o,c);r.value=gT(r.value,c,e),t.value=yT(t.value,e),n.value=yT(n.value,e)}}else if(n){if(e){let e=wT(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=wT(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=wT(r.value,i),[a,o]=TT(t.value,i),s=mT(n,a);t.value=vT(t.value,s);let c=hT(vT(n,s),o);t.value=yT(t.value,c),r.value=gT(r.value,n,c),e.value=_T(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=wT(r.value,i),n=bT(CT(t.value,i),e);t.value=yT(t.value,n)}else if(e){let n=bT(CT(e.value,i),wT(t.value,i));t.value=vT(t.value,n)}}var kT=new class extends dT{tokenize(e){let t=RegExp(`(\\r?\\n)|[${ET}]+|[^\\S\\n\\r]+|[^${ET}]`,`ug`);return e.match(t)||[]}};function AT(e,t,n){return kT.diff(e,t,n)}var jT=new class extends dT{constructor(){super(...arguments),this.tokenize=NT}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
1268
+ `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
1269
+ `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
1270
+ `)&&(e=e.slice(0,-1)),t.endsWith(`
1271
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function MT(e,t,n){return jT.diff(e,t,n)}function NT(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
1272
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function PT(e){return e==`.`||e==`!`||e==`?`}new class extends dT{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(PT(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends dT{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends dT{constructor(){super(...arguments),this.tokenize=NT}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(FT(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function FT(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=FT(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=FT(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends dT{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function IT(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function LT(e){if(!IT(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var RT={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function zT(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;MT(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(MT(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||HT(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
1273
+ `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function BT(e,t){if(t||=RT,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>BT(e,t)).join(`
1274
+ `)}let n=[];if(e.isGit){if(t=RT,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+LT(r)+` `+LT(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+LT((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+LT((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+LT((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+LT((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+LT(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+LT(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
1275
+ `)+`
1276
+ `}function VT(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;zT(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?BT(e,o.headerOptions):void 0)}}))}else{let s=zT(e,t,n,r,i,a,o);return s?BT(s,o?.headerOptions):void 0}}function HT(e){let t=e.endsWith(`
1277
+ `),n=e.split(`
1278
+ `).map(e=>e+`
1279
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function UT({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function WT({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}var GT={forcePlainText:!1};function KT(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=GT){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=Lc({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??JT();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}rT({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&qT({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=YT({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else sl(f.deletionLines,s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else sl(f.additionLines,c)}return{code:f,themeStyles:u,baseThemeType:l}}function qT({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=uT(e),t=uT(t),e.length>s||t.length>s))return;let c=o===`char`?pT(e,t):AT(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(WT({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),WT({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?WT({item:e,arr:l,enableJoin:d,isLastItem:t}):WT({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(UT({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(UT({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function JT(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function YT({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??pu(e.name),d=s??pu(t.name),{state:f,transformers:p}=Kc(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Bc(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Bc(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Kl(i.codeToHast(uT(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Kl(i.codeToHast(uT(t.contents),m)))}}function XT(e){let t=[];for(let n of e){let e=uu.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function ZT(e){for(let t of Array.isArray(e)?e:[e])if(!uu.has(t))return!1;return!0}async function QT(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=Vl(r)??bl(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function $T(e){return Cu.getResolvedThemes(e)}async function eE(e){for(let t of e)bu(t);let t=await Cu.resolveThemes(e);for(let n=0;n<e.length;n++)ru(e[n],t[n]);return t}var tE=e(il(),1),nE=Symbol(`IGNORE_RESPONSE`),rE=1e4,iE=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},aE=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`)}},oE=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=rl,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s=`shiki-js`}){this.options=e,this.preferredHighlighter=s,this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new tE.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new tE.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??rl,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||Hw(a,this.renderOptions))return;let o=kl(e),c=[];if(dl(a.theme,this.renderOptions.theme)||(c=pl(o)?$T(o):await eE(o)),!s())return;if(this.highlighter!=null)Zl(c,this.highlighter);else{let e=await Yc({themes:o,langs:[`text`],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=e}let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof iE||!s())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);lE(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0){if(this.initialized===!1){let{lifecycleGeneration:t}=this;this.initialized=new Promise((n,r)=>{(async()=>{try{let r=kl(this.renderOptions.theme),i=[];if(i=pl(r)?$T(r):await eE(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=ZT(e)?XT(e):await QT(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([Yc({themes:r,langs:[`text`,...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(i,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof iE||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,dE(e));this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=jc(),i=r>0?Cc():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>this.handleWorkerError(o,e)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};o.pendingSetupRequestId=s,this.activeTaskById.set(s,c),this.executeTask(o,c)}))}let a=this.options.workerInitializationTimeout??rE,o;try{await Promise.race([Promise.all(n),new Promise((e,t)=>{o=setTimeout(()=>{t(Error(`WorkerPoolManager: worker initialization timed out after ${a}ms`))},a)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){console.error(`Worker error:`,t,e);let{pendingSetupRequestId:n}=e;if(n==null)return;let r=this.activeTaskById.get(n);r?.type===`initialize`&&(r.reject(dE(t)),this.cleanWorkerAndTask(e,r))}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=cE(t),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);cl(t)||n!=null&&kc(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateFileHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}let t=this.getFileResultCache(e),n=this.getFileHighlightKey(e);if(n==null||cl(e)||t!=null&&kc(t.options,this.getFileRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`file`?r:void 0;{let t=this.submitCacheTask({type:`file`,file:e},n);return t.type===`file`?t:void 0}}getPlainFileAST(e,t,n,r){if(this.highlighter==null){this.queueInitialization();return}return lc(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);Uw(t)||n!=null&&Hw(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}getOrCreateDiffHighlightCacheTask(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}let t=this.getDiffResultCache(e),n=this.getDiffHighlightKey(e);if(n==null||Uw(e)||t!=null&&Hw(t.options,this.getDiffRenderOptions()))return;let r=this.getTaskByHighlightKey(n);if(r!=null)return r.primeCache=!0,r.type===`diff`?r:void 0;{let t=this.submitCacheTask({type:`diff`,diff:e},n);return t.type===`diff`?t:void 0}}getPlainDiffAST(e,t,n,r,i){return this.highlighter==null?void 0:KT(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new iE;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){let e=new iE;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):lE(t)&&this.rejectRenderTaskCallbacks(t,e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=n.filter(e=>!Fl(e));r.length>0&&Yc({themes:kl(this.renderOptions.theme),langs:[`text`,...r],preferredHighlighter:this.preferredHighlighter}).catch(e=>{console.error(e)});let i=n.filter(t=>!e.langs.has(t));if(i.length>0&&(ZT(i)?t.request.resolvedLanguages=XT(i):t.request.resolvedLanguages=await QT(i)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.rejectRenderTaskCallbacks(t,dE(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw nE;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(lE(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!kc(i,this.getFileRenderOptions()))throw nE;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,r,i);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!Hw(i,this.getDiffRenderOptions()))throw nE;let{request:a}=n;this.syncCustomExtensionVersion(e,a),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:r,options:i}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,r,i);break}}}catch(e){e!==nE&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,lE(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(lE(t)&&(this.rejectRenderTaskCallbacks(t,new aE),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){sE(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);for(let n of cE(t))e.langs.add(n);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),lE(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,dE(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=jc();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=Cc())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of uE(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new aE),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new aE),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))lE(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of uE(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of uE(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of uE(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of uE(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&Vw(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&Bw(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())lE(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function sE(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function cE(e){let t=new Set;if(e.type===`initialize`||e.type===`set-render-options`)return[];switch(e.type){case`file`:t.add(e.request.file.lang??pu(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??pu(e.request.diff.name)),t.add(e.request.diff.lang??pu(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function lE(e){return e?.type===`file`||e?.type===`diff`}function uE(e){return e.instances}function dE(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){if(`error`in e&&e.error instanceof Error)return e.error;if(`message`in e&&typeof e.message==`string`)return Error(e.message)}return Error(String(e))}var fE;function pE({poolOptions:e,highlighterOptions:t}){return fE??=new oE(e,t),fE}function mE(){fE!=null&&(fE.terminate(),fE=void 0)}var hE=(0,Z.createContext)(void 0),gE=0;function _E({children:e,poolOptions:t,highlighterOptions:n}){let[r]=(0,Z.useState)(()=>{if(!(typeof window>`u`))return pE({poolOptions:t,highlighterOptions:n})});return(0,Z.useInsertionEffect)(()=>{if(r!=null)return gE++,()=>{gE--}},[r]),(0,Z.useEffect)(()=>()=>{gE===0&&mE()},[]),(0,Q.jsx)(hE.Provider,{value:r,children:e})}function vE(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:yE(e.items,t.items)}function yE(e,t){if(e==null||t==null)return 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==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function bE(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(_l,``),t.before(r)):(r.setAttribute(Ll,``),t.after(r)),n?.observe(r),r}function xE(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function SE(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}async function CE(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function wE({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=Uc(t,n),l=c,u=i?!0:a,d=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=Gw({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=tT({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=TE(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?Jw({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=nT({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=nT({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=Yl(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function TE(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return EE(e,t)}function EE(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}function DE({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}var OE=1;function kE(e,...t){return`ck${OE}:${JSON.stringify([e,...t])}`}function AE(e){return e===``?[]:e.split(Nc)}function jE(e,t,n){let r=e===`clone`?ql(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return ME(r,PE(r,n),FE(r,n));case`rename-pure`:{let e=FE(r,n);IE(r,n);let t=AE(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,RE(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function ME(e,t,n){let r=AE(t.contents),i=AE(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=NE(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,RE(e,t,n),e}function NE(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(Nw(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=Pw(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=Pw(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function PE(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function FE(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function IE(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function LE(e,t,n){return e.cacheKey==null?zE(t,n):`${e.cacheKey}:hydrated`}function RE(e,t,n){let r=LE(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function zE(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?kE(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}var BE=new TextEncoder,VE=new TextDecoder(`utf-8`,{ignoreBOM:!0}),HE=/[\uD800-\uDFFF]/,UE=1024,WE=new Uint8Array(UE);function GE(){WE.length!==UE&&(WE=new Uint8Array(UE))}function KE(e){if(e.length===0)return e;if(HE.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;WE.length<t&&(WE=new Uint8Array(t));let{written:n}=BE.encodeInto(e,WE);return VE.decode(WE.subarray(0,n))}var qE=4096,JE=.5;function YE(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=ZE(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}XE(t,e)}}function XE(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function ZE(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>qE)return null;let c=[];for(let t=0;t<n;t++)c.push($E(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push($E(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=eD(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*JE:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var QE=/\s+/g;function $E(e){return e.replace(QE,``)}function eD(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function tD(e,t,n=!1,r){let i=yD(e),a=i?cD(e):lD(e),o,s=[];for(let e of a){if(i&&!Ic.test(e)){if(o==null)o=KE(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!uD(e)){if(o==null)o=KE(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=rD(e,{cacheKey:t==null?void 0:r==null?kE(`patch-file`,t,String(s.length)):kE(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function nD(e,t){try{return rD(e,t)}finally{GE()}}function rD(e,{cacheKey:t,isGitDiff:n=Ic.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=bD(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=sD(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=gD(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?oD(i.contents):[],deletionLines:!l&&r!=null&&i!=null?oD(r.contents):[],cacheKey:SD(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(zl),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=KE(r.trim()),n!==r&&(c.prevName=KE(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?Gl:cc):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=KE(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=KE(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=KE(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=KE(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=KE(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=KE(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(Ec)??[];t!=null&&(c.prevObjectId=KE(t)),n!=null&&(c.newObjectId=KE(n)),r!=null&&(c.mode=KE(r))}e.startsWith(`rename from `)&&(c.prevName=KE(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=KE(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
1280
+ `||s[s.length-1]===`\r`||s[s.length-1]===`\r
1281
+ `||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:SD(p.hunkContext),hunkSpecs:KE(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(!mD(t)||hD(t))break;if(a)throw Error(`parsePatchContent: hunk has more lines than expected`)}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=CD(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=wD(t);(g==null||g.type!==`change`)&&(g=TD(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=wD(t);(g==null||g.type!==`change`)&&(g=TD(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=wD(t);(g==null||g.type!==`context`)&&(g=TD(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=uT(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=uT(c.deletionLines[e]))}}}if(x!==b.additionCount||S!==b.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=Nw(b.additionStart,b.additionCount)+(x===0?0:1),t=Nw(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!l){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(Nw(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=Pw(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=Pw(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),YE(c),c}}function iD(e,t,n=!1){let r=[],i=aD(e)?e.split(Tu):[e];for(let e of i)try{r.push(tD(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{GE()}return r}function aD(e){return e.startsWith(`From `)||e.includes(`
1282
+ From `)}function oD(e){let t=sD(e);for(let e=0;e<t.length;e++)t[e]=KE(t[e]);return t}function sD(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
1283
+ `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function cD(e){return bD(e,`diff --git`)}function lD(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=pD(e,r);if(i<=0&&a<=0){if(dD(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=pD(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=gD(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];if(c===`\\`){r=s;continue}c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0)),r=s}return t.push(e.slice(n)),t}function uD(e){return dD(e,0)}function dD(e,t){let n=pD(e,t);return fD(e,t,`---`)&&fD(e,n,`+++`)}function fD(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
1284
+ `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function pD(e,t){let n=e.indexOf(`
1285
+ `,t);return n===-1?e.length:n+1}function mD(e){let t=e[0];return t===`+`||t===`-`||t===` `}function hD(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
1286
+ `&&n!==`\r`)return!1}return!0}function gD(e){if(!e.startsWith(`@@ -`))return;let t=4,n=_D(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=_D(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=_D(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=_D(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=vD(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function _D(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function vD(e){return e.endsWith(`\r
1287
+ `)?e.slice(0,-2):e.endsWith(`
1288
+ `)?e.slice(0,-1):e}function yD(e){return e.startsWith(`diff --git`)||e.includes(`
1289
+ diff --git`)}function bD(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:xD(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=xD(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function xD(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function SD(e){return e==null?e:KE(e)}function CD(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function wD(e){let t=e.slice(1);return KE(t===``?`
1290
+ `:t)}function TD(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var ED=`/dev/null`;function DD(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??OD(),a=t??OD(),o=nD(VT(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey,r=t?.cacheKey;return n!=null&&r!=null?kE(`diff`,n,r):void 0})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function OD(){return{name:ED,contents:``}}var kD=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function AD(e,t){let n=DD({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function jD(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function MD(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function ND(e,t){return t.length>0&&t.length<e.deletionLines.length&&MD(t)}function PD(e,t,n){let r=e.deletionLines.join(``),i=jD(t.length,r),a=DD({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function FD(e,t){return PD(e,[``],t)}function ID(e,t){if(e.additionLines.length===0)return FD(e,t);if(ND(e,e.additionLines))return PD(e,e.additionLines,t);let n=e.additionLines,r=AD(e,t);return RD(r,n),r}function LD(e){return e.length>1&&e.at(-1)===``}function RD(e,t){if(!LD(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&Pw(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,JD(e);return}}}function zD(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return BD(e,AD(e,n));let r=Array.from(t);if(r.length===0)return BD(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||uT(r)===uT(i))return BD(e,AD(e,n))}let i=VD(e,r);if(i.size===0)return BD(e,AD(e,n));for(let t of i)if(!UD(e,t,n))return BD(e,AD(e,n));return JD(e),Kw(e)?BD(e,AD(e,n)):BD(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function BD(e,t){return Object.assign(e,t),t}function VD(e,t){let n=new Set;for(let r of t){let t=HD(e,r);if(t==null)return new Set;n.add(t)}return n}function HD(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function UD(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=DD({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(GD(r,s),WD(e,t),!0)}function WD(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
1291
+ `),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
1292
+ `)}function GD(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>KD(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,qD(e)}function KD(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function qD(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function JD(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Nw(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,qD(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=Pw(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-Pw(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var YD=new WeakMap;function XD(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function ZD(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function QD(e,t){let n=e.hunks,r=e.additionLines,i=XD(r),a=i===r?e:{...e,additionLines:i},o=cO(n,sO(a,t),e.deletionLines.length),s=dO(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,xO(e),RD(e,r),mO(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function $D(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<_O(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:_O(r);if(i==null||t<i||o!=null&&o!==s)return QD(e,n);o=s}if(o!=null){if(eO(e,i,o,r,n)){e.editSessionDirty=!0;return}return QD(e,n)}}function eO(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=tO(e),o=e.hunks[n];if(o.hunkContent.some(nO))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function tO(e){let t=YD.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return YD.set(e,{lines:e.deletionLines,set:n}),n}function nO(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function rO(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function iO(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=Gw({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=vO(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=Jw({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=vO(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function aO(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=vO(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,vO(i)+i.deletionCount,e.deletionLines.length),n}function oO(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?AD(e,t):ID(e,t)),!0)}function sO(e,t){if(ZD(e.deletionLines,e.additionLines)==null)return[];let n=DD({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=KD(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function cO(e,t,n){let r=e.map((e,t)=>{let n=vO(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&lO(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=uO(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function lO(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function uO(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function dO(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);pO(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);pO(s,c,i,r),r+=c,i+=c,n.push(fO(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function fO(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:yO(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:bO(t.additionStart,r),deletionStart:yO(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:bO(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${yO(t.deletionStart,i)},${i} +${yO(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return qD(s),s}function pO(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function mO(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(vO(r)!==vO(i)||r.deletionCount!==i.deletionCount||_O(r)!==_O(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!hO(r,i))return!0}return!1}function hO(e,t){let n=gO(e),r=gO(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*gO(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function _O(e){return Nw(e.additionStart,e.additionCount)}function vO(e){return Nw(e.deletionStart,e.deletionCount)}function yO(e,t){return t===0?e:e+1}function bO(e,t){return t===0?e-1:e}function xO(e){JD(e);for(let t=0;t<e.hunks.length;t++)WD(e,t)}function SO(e){return Qc({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function CO(e){return Qc({tagName:`div`,children:[Qc({tagName:`span`,children:[dc(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function wO(e){return Qc({tagName:`div`,children:[Lu({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function TO({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(Qc({tagName:`div`,children:[dc(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(wO(`up`)),s++),o||(e.push(wO(`down`)),s++)):(e.push(wO(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(Qc({tagName:`div`,children:[Qc({tagName:`span`,children:[dc(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(Qc({tagName:`div`,children:[dc(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(Qc({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(Qc({tagName:`slot`,properties:{name:i}})),Qc({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function EO(e,t){return`hunk-separator-${e}-${t}`}function DO(e){let t=e.at(-1);return t==null?0:Math.max(Pw(t.additionStart,t.additionCount),Pw(t.deletionStart,t.deletionCount))}var OO=-1,kO=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++OO}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:rl},t=eu,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=hu(e.theme??rl)?gl():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,!e.isPartial&&e.additionLines.length===0){Object.assign(e,FD(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(r==null||n&&r.diff===e)return;let{options:i}=this.getRenderOptions(e),a=r.diff===e,o=t!=null&&Bw(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!Hw(r.options,i)||!a&&!o){this.clearRenderCache();return}a||(this.renderCache={diff:e,options:i,highlighted:!0,result:{...s,code:{...s.code,additionLines:[...s.code.additionLines]}},renderRange:r.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!Bw(t.diff,e)||Uw(e)||HO(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!Bw(n,e)||!Bw(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);Hw(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??el}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return!1;let{result:i,diff:a}=r;if(i==null)return!1;if(a.isPartial)throw Error(`Could not update render cache for partial diff`);let o=i.code.additionLines,s=this.pendingStructuralRows=n?new Map:void 0,c=[],l=new Map;for(let[t,n]of e){let e=o[t]?.properties??{},r=n.map(e=>e[2]).join(``),i=t<a.additionLines.length,u=i?a.additionLines[t]??``:``,d=uT(u);s==null&&i&&(a.additionLines[t]=vu(u,r),d!==r&&(c.push(t),l.set(t,u)));let f={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};s==null?o[t]=f:s.set(t,f)}let u=!1;if(c.length>0){if(this.editSessionActive){if(a.additionLines.length<=1&&a.additionLines.join(``)===``)this.applyRecomputePreservingSessionType(a,FD(a,this.options.parseDiffOptions)),u=!0;else if(ND(a,a.additionLines))this.applyRecomputePreservingSessionType(a,PD(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=$D(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}}else Object.assign(a,zD(a,c,this.options.parseDiffOptions))}return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=rO(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{diff:r,result:i}=n;if(i==null)return;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=BO(e),i.code.additionLines=RO(a,r.additionLines,i.code.additionLines,e),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,FD(r,this.options.parseDiffOptions)),i.code.additionLines[0]=zO(0,e.getLineText(0))):this.editSessionActive?this.applySessionDocumentChange(r):Object.assign(r,ID(r,this.options.parseDiffOptions)),t!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(ND(e,n)){this.applyRecomputePreservingSessionType(e,PD(e,n,t));return}this.applyExpansionRemap(QD(e,t))}applyRecomputePreservingSessionType(e,t){let n=this.editSessionActive?e.type:void 0;Object.assign(e,t),n!=null&&(e.type=n),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>cu(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=rl,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=yc,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await Yc(au(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=HO(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!Hw(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!Uw(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLangs=VO(e),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??rl}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!Bw(e,n.diff)||!Hw(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(Bw(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||Uw(e)||HO(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||Bw(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&hu(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&hu(t.theme)}renderDiff(e=this.diff,t=pc){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||Uw(e)||HO(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!Bw(e,this.renderCache.diff),d=!Dl(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&Su(t);l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||u||d||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Su(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLangs=VO(e),this.highlighter??=gl();let t=this.highlighter!=null&&hu(i.theme),n=this.highlighter!=null&&Fl(this.computedLangs),r=!c&&n;if(l&&this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=pc){this.diff=e;let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return _u({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=HO(e,this.getTokenizeMaxLength());this.computedLangs=t?[`text`]:VO(e);let n=this.highlighter!=null&&hu(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&Fl(this.computedLangs);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=KT(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(rT({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=zO(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i!=null&&a!=null&&Bw(i,e)&&Hw(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&Hw(a.options,n)&&Bw(a.diff,i)||(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(n!=null&&Hw(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&Bw(n.diff,e)&&Hw(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Bw(e,n.diff)&&Hw(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1,f=a===`unified`,p=UO(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:Pc(),deletionsGutterAST:Pc(),additionsGutterAST:Pc(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=qw({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,Sc(void 0,`buffer`,this.size)),h?.push(SO(this.size))):(x.pushToGutter(`deletions`,Sc(void 0,`buffer`,this.size)),g?.push(SO(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,Dc(t,n,r,i))};function T(e){C.flush(),a===`unified`?FO(`unified`,e,x):(FO(`deletions`,e,x),FO(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),rT({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&MO(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=IO(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=IO(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),PO({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&MO(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&NO(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=IO(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=IO(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}PO({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&NO(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,D=_?n.noEOFCRAdditions:!1,O=(s?.noEOFCR??!1)||E,k=(o?.noEOFCR??!1)||D;if(k||O){if(a===`split`&&C.flush(),O){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(CO(e)),x.pushToGutter(`unified`,Sc(e,`metadata`,1))):(x.deletionsContentAST.push(CO(e)),x.pushToGutter(`deletions`,Sc(e,`metadata`,1)),k||(x.pushToGutter(`additions`,Sc(void 0,`buffer`,1)),x.additionsContentAST.push(SO(1))))}if(k){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(CO(e)),x.pushToGutter(`unified`,Sc(e,`metadata`,1))):(x.additionsContentAST.push(CO(e)),x.pushToGutter(`additions`,Sc(e,`metadata`,1)),O||(x.pushToGutter(`deletions`,Sc(void 0,`buffer`,1)),x.deletionsContentAST.push(SO(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(DO(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),D=t.bufferBefore>0||t.bufferAfter>0,O=!f&&e.type!==`deleted`,k=!f&&e.type!==`new`,A=x.rowCount>0||D;h=O&&A?h:void 0,g=k&&A?g:void 0,_=f&&A?_:void 0;let j=this.createPreElement(g!=null&&h!=null,E);return{fileDiff:e,unifiedGutterAST:f&&A?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:k&&A?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:O&&A?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:j,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=Pc(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,Sl(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(Qc({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(Qc({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(Qc({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return su(this.renderFullAST(e,t))}renderPartialHTML(e,t){return su(t==null?e:Qc({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!Rl(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(tu(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(tu(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){PO({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}PO({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(this.annotationSlotName(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(this.annotationSlotName(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}getAnnotationNames(e){return e?.map(e=>this.annotationSlotName(e))??[]}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return Ul({fileOrDiff:e,mode:t,stickyHeader:n})}},AO=new Intl.PluralRules(`en-US`);function jO(e){return`${e} unmodified line${AO.select(e)===`one`?``:`s`}`}function MO(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function NO(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function PO({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,Sc(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,Sc(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,Sc(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function FO(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,TO({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(TO({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,TO({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(TO({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=EO(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?jO(n):`More unchanged context may be available`;c.pushToGutter(e,TO({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(TO({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function IO(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function LO(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function RO(e,t,n,r){let i=LO(e),a=LO(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let e=s;e<t.length;e++)l[e]??=zO(e,r.getLineText(e));return l}function zO(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function BO(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function VO(e){if(e.lang!=null)return[e.lang];let t=pu(e.prevName??e.name),n=pu(e.name);return t===n?[n]:[t,n]}function HO(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function UO(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function WO(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function GO(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function KO(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:uc(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function qO(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function JO(e){let t={...e};return delete t.cacheKey,t}function YO(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??pu(e.name),r=t.lang??pu(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}function XO(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function ZO(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&XO(n.lines,t.deletionLines)}var QO=-1,$O=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++QO}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:rl},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Ql,this.scrollSyncManager=new kD,this.interactionManager=new wu(`diff`,Al(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??rl}getHunksRendererOptions(e){return KO(e)}createHunksRenderer(e){return new kO(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;hunkIterator:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=Nw(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break hunkIterator}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break hunkIterator}continue}for(let e of o.hunkContent)if(e.type===`context`){if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break hunkIterator}c+=e.lines,l+=e.lines,u+=e.lines}else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Al(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!dl(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>wc(this.editSession?.annotations,e,eu);getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,al(t,e,eu))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){let{editor:t}=this;Mu(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=DE(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||ik(this.pre,nk({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||ak(this.headerElement,rk({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Wc(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)e instanceof HTMLElement&&e.tagName.toLowerCase()===`code`&&(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?DD(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||t==null||!qO(e)||this.pendingFiles?.fileDiff===e)return;let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(jE(`merge`,e,t),this.setHydratedState(t),this.startHydratedEditSession(e)){this.rerender();return}await CE(()=>this.primeHighlightCache(e)),this.enabled&&this.fileDiff===e&&this.rerender()}}startHydratedEditSession(e){if(e.isPartial)throw Error(`FileDiff.startHydratedEditSession: diffs cannot be partial for editing`);if(this.fileDiff!==e)return!1;let{editor:t}=this;return this.editSession?.outgoingDiff==null?t==null||this.editSession!=null?!1:(this.installEditSession(e,t.__getDocumentContents(ek(e)),t.__getDocumentSessionState()),!0):(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(Bw(this.fileDiff,e))return!1;let n=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,n==null?this.editor!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e,this.editor.__getDocumentContents(ek(e)),this.editor.__getDocumentSessionState())):(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=n)),this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=ol(t,eu,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:AE(t.contents),a=n!=null&&ZO(n,e);if(n!=null&&!a)throw Error(`FileDiff: retained session cannot resume against a different old file`);if(t!=null&&t.contents!==r&&!a)throw Error(`FileDiff: retained edits are missing their diff session state`);let o=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===r,s=JO(e);t!=null&&i!=null&&!o&&(s.name=t.name,s.lang=t.lang),a&&n!=null&&i!=null&&(s.additionLines=i,s.type=n.type,s.hunks=n.hunks,s.editSessionDirty=!0,JD(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??ol(this.lineAnnotations,eu),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(s,o&&!a?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let l=DE(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!tk(u,this.deletionFile)||!tk(d,this.additionFile)),y=e!=null&&!Bw(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&Dl(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.fileDiff==null)&&(x=DD(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateExternalDiff(e,i):x!=null&&(y=!0,this.updateExternalDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getLatestDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(oO(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:w=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(C,Jl);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??C,this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g||!Bw(this.renderedDiff,C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(C,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a,t.fileDiff),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData),this.renderedDiff=t.fileDiff}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getLatestDiff();if(e==null||t==null||i==null||i.isPartial)return;let a=a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==i)return;let o=this.editSession?.outgoingDiff,s=this.fileDiff,c=o!=null&&s!=null&&o!==i,l=c?YO(o,s):!1;e.__syncRenderView({highlighter:a,fileContainer:t,fileDiff:i,lineAnnotations:n,renderRange:r,externalDocument:c,resetHistory:l})},o=this.getTheme(),s=i.lang??pu(i.name),c=gl({theme:o,lang:s});c==null?Yc({themes:kl(o),langs:[`text`,s],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}computeEditorRenderRange(e){let t=this.getLatestDiff();if(e==null||t==null||Su(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return rT({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let{fileDiff:t,editSession:{diff:n,outgoingDiff:r}={}}=this;if(r!=null&&t!=null){if(!t.isPartial&&YO(r,t))return;n=r}if(!(n==null||n.isPartial))return{diffSession:{oldFile:n.type===`new`?null:{name:n.prevName??n.name,lines:e?[...n.deletionLines]:n.deletionLines},type:n.type,hunks:e?sc(n.hunks):n.hunks},hasChanges:n.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);let t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){let{fileDiff:t}=this,n=this.editSession?.outgoingDiff;n!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===n&&this.installEditSession(t);let r=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;r==null?this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff):this.installEditSession(r,e.__getDocumentContents(ek(r)),e.__getDocumentSessionState()),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary();let i=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(i!=null&&this.hunksRenderer.diffCache===i&&(this.renderedDiff=i),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,fileDiff:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{diff:a,annotations:o}=n;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let s=o?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=ql(a),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:r,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===r.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);c=p,l=h.oldFile,u=h.newFile}}catch(e){d=!0,f=e}if(e&&c!=null&&(this.fileDiff=c,this.additionFile!=null&&(this.deletionFile=l,this.additionFile=u),s!=null&&(this.lineAnnotations=s)),this.editSession=void 0,e&&this.fileContainer!=null&&this.rerender(),d)throw f}finalizeEditSessionHunks(){let e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=iO(e,this.hunksRenderer.getExpandedHunksMap(),t);return oO(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(aO(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){let n=this.editSession?.diff;if(n==null)throw Error(`FileDiff.applyDocumentChange: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let r=this.editSession?.diff;if(r==null)throw Error(`FileDiff.updateRenderCache: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(r);let{shouldRefreshDiffsView:i,lineCountChangeInFlight:a}=n;if(this.hunksRenderer.updateRenderCache(e,t,a)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}i===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){let e=this.editSession?.diff,{fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){let t=this.getRenderedDiff();if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return Yw({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return Xw({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.getRenderedDiff(),{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=Ww(o);if(e<s){let c=Gw({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=Jw({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=Ww(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){tl(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Uw(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!GO(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!WO(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:qc(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=ml();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:Eu(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Eu(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=Nl;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:r,html:i,lastRenderedHTML:a}}=this,o=(n!==this.editSession?.diff&&Bw(r,n)?i:void 0)??su(e);if(this.headerCache.html=o,this.headerCache.fileDiff=n,o!==a){let e=document.createElement(`div`);e.innerHTML=o;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.headerCache.lastRenderedHTML=o}if(this.isContainerManaged)return;let{renderCustomHeader:s,renderHeaderPrefix:c,renderHeaderFilenameSuffix:l,renderHeaderMetadata:u}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Nu,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let d=c?.(n)??void 0,f=l?.(n)??void 0,p=u?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,xc,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,zc,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Gc,p),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=ll(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Oc(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=fl(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Mc({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:fu(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=Ac(this.themeCSSStyle.textContent??``,fl(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Tc()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Xc(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=ok(t[0]),a=ok(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=su(i),r.content.innerHTML=su(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Fu({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Fu({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Fu({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:n}){let{pre:r,codeUnified:i,codeAdditions:a,codeDeletions:o,options:{diffStyle:s=`split`}}=this;if(r==null||t==null||n==null||!Number.isFinite(t.totalLines)||!Number.isFinite(n.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(s,i,o,a);if(c==null)return!1;let l=t.startingLine,u=n.startingLine,d=l+t.totalLines,f=u+n.totalLines,p=Math.max(l,u),m=Math.min(d,f);if(m<=p)return!1;let h=Math.max(0,p-l),g=Math.max(0,d-m),_=this.trimColumns({columns:c,trimStart:h,trimEnd:g,previousStart:l,overlapStart:p,overlapEnd:m,diffStyle:s});if(_<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<_)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let v=this.lastRowCount-_,y=(t,n)=>{if(!(n<=0))return this.hunksRenderer.renderDiff(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},b=y(u,Math.max(p-u,0));if(b==null&&u<p)return!1;let x=y(m,Math.max(f-m,0));if(x==null&&f>m)return!1;let S=(e,t)=>{if(e!=null){if(s===`unified`&&!Array.isArray(c))this.insertPartialHTML(s,c,e,t);else if(s===`split`&&Array.isArray(c))this.insertPartialHTML(s,c,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);v+=e.rowCount,this.renderedDiff=e.fileDiff}};return this.cleanupErrorWrapper(),S(b,`afterbegin`),S(x,`beforeend`),this.lastRowCount!==v&&(this.applyRowSpan(s,c,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`split`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(n))return;let r=(e,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(e,t),i=ok(r?.[0]),a=ok(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};r(`deletions`,n[0]),r(`additions`,n[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`unified`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(n==null||Array.isArray(n))return;let r=this.hunksRenderer.renderCodeAST(`unified`,t),i=ok(r?.[0]),a=ok(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=su(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?Xc(this.pre,o):o(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=ok(t[0]),i=ok(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};ic(u,this.appliedPreAttributes)||(Rc(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function ek(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function tk(e,t){return e==null||t==null?e==null&&t==null:Vw(e,t)}function nk({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function rk({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function ik(e,t,n=!1){return!n&&e==null&&t}function ak(e,t,n=!1){return e==null&&t&&!n}function ok(e){if(e!=null&&e.type===`element`)return e.children??[]}var sk=3e3,ck=new Map,lk=-1,uk=class extends $O{__id=`little-virtualized-file-diff:${++lk}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:ck,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=bc(n)}setMetrics(e,t=!1){let n=bc(e);(t||!ku(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache({includeEstimatedHeights:!1}),!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLatestAnnotations();return Bl(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!1}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!mc(t,e),r=n&&vk(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:yk(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=ck,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}applyGhostTextRows(e,t){let{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:i},metrics:{lineHeight:a}}=this;if(r===t)return!1;let o=this.getDiffStyle(),s=new Map;for(let[n,r]of t){let t=this.getLineIndexForDiff(e,n+1,`additions`);t!=null&&s.set(o===`split`?t[1]:t[0],r)}let c=!1;for(let e of new Set([...i.keys(),...s.keys()])){let t=((s.get(e)??0)-(i.get(e)??0))*a;if(t===0)continue;let r=(n.get(e)??0)+t;r===0?n.delete(e):n.set(e,r),this.cache.measuredHeightDeltaTotal+=t,c=!0}return this.cache.ghostTextRows=t,this.cache.ghostTextRowsByIndex=s,c}reconcileHeights(){let e=!1,{options:{overflow:t=`scroll`},cache:{ghostTextRowsByIndex:n},metrics:{lineHeight:r}}=this,i=this.getRenderedDiff();if(this.fileContainer==null||i==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(i,this.editor?.__getGhostTextRows()??ck);let a=this.getLatestAnnotations();if(t===`scroll`&&a.length===0&&!this.isResizeDebuggingEnabled())return e&&this.computeApproximateSize(!0),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],c=this.hasFileAnnotations(i);if(this.renderRange!=null&&c&&Rl(this.renderRange)){let t=dk(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!c&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of s){if(t==null)continue;let i=t.children[1];if(!(i instanceof HTMLElement))continue;let a=o===`split`&&t===this.codeDeletions;for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let s=Ck(i,o),c=n.get(s)??0;if(a&&c>0)continue;let l=t.getBoundingClientRect().height+c*r,u=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(u=!0),l+=t.nextElementSibling.getBoundingClientRect().height);let d=this.getEstimatedLineHeight(u),f=this.cache.heightDeltas.get(s)??0,p=l-d;p!==f&&(e=!0,this.cache.measuredHeightDeltaTotal+=p-f,p===0?this.cache.heightDeltas.delete(s):this.cache.heightDeltas.set(s,p))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpansions:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;if(s!=null&&(this.pendingHydratedDiff=void 0,s.expectedDiff===e&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.startHydratedEditSession(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null){this.pendingExpansions=void 0;for(let{hunkIndex:e,direction:t,expansionLineCountOverride:n}of o)this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,a=!0}let l=this.updateExternalDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d||p)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=bc(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?this.resetLayoutCache({includeEstimatedHeights:a}):a&&this.invalidateDerivedLayoutCache(!0),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=Uc(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return rT({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=c===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=tT({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=o-n&&u<o)return m={top:p,height:r.height},!0;p+=r.height+r.gapAfter}}let s=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===u)return m={top:p,height:s},!0;if(p+=s,r>0){let e=nT({type:l,metrics:this.metrics});if(e!=null){if(u>o&&u<=o+r)return m={top:p+e.gapBefore,height:e.height},!0;p+=e.totalHeight}}return!1}}),m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??Uc(this.metrics,n)+this.cache.fileAnnotationHeight,u;return rT({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:a,additionLine:c})=>{let d=o===`split`?c?.splitLineIndex??a?.splitLineIndex:c?.unifiedLineIndex??a?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=tT({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e&&(a==null?c!=null&&(u={lineNumber:c.lineNumber,side:`additions`,top:l}):u={lineNumber:a.lineNumber,side:`deletions`,top:l},u!=null))return!0;let f=this.getLineHeight(d,(c?.noEOFCR??!1)||(a?.noEOFCR??!1));if(l+=f,i>0){let e=nT({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}return!1}}),u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!Bw(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(this.isAdvancedMode()){let n=jE(`clone`,e,t);if(await CE(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(jE(`merge`,e,t),this.setHydratedState(t),!this.startHydratedEditSession(e)&&(await CE(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.getRenderedDiff();if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return Yw({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),this.enabled&&this.fileDiff!=null&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getLatestDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!Bw(this.getRenderedDiff(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let i=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutDiff()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(t,this.editor?.__getGhostTextRows()??ck);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=Uc(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=wE({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:bk(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=DE(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!Sk(s,this.deletionFile)||!Sk(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=DD(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!Bw(this.fileDiff,u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateExternalDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:!1}:this.updatePendingRender(u,r);if((v||g)&&this.resetLayoutCache({includeEstimatedHeights:g}),f)this.top??=this.getVirtualizedTop(),g&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.pendingRender=void 0,this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(this.getRenderedDiff()!==this.pendingRender?.diff)throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!Bw(a,o),renderedDiffChanged:!Bw(r,o)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return xk(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=bk(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=fk(this.cache.heightDeltas),u=Uc(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=hk(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+gk(i,e)*this.metrics.lineHeight+pk(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=sk}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+pk(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=Gw({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?tT({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?Jw({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?nT({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:_k({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=Gw({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=Jw({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=bk(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=Uc(this.metrics,i),h=e.hunks.length>0?Yl(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,O=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),k=t+(O?.top??_),A=O?.renderedLineIndex??0,j,M,N;if(rT({diff:e,diffStyle:l,startingLine:O?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?tT({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;k+=y;let b=A%s===0,x=Math.floor(A/s);if(b&&(E[x]=k-(t+_+y),N!=null)){if(N<=0)return!0;N--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),N==null&&k>=r&&b&&(N=T),A++,k+=S,c>0||v&&d){let e=nT({type:u,metrics:this.metrics});e!=null&&(k<r&&k+e.totalHeight>n&&(j??=x),M==null&&k+e.totalHeight>D&&(M=x),k+=e.totalHeight)}return!1}}),j==null){if(x)j=0,M=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}M??=j;let P=Math.round(M-w/2),F=Math.max(0,Math.ceil(p/s)-w),I=Math.max(0,Math.min(P,F)),L=I*s,R=P<0?C+P*s:C,z=E[I]??0,B=L===0?0:g+z,V=I+R/s,H=V<E.length?v-E[V]:v-(k-t-_);return{startingLine:L,totalLines:R,bufferBefore:B,bufferAfter:Math.max(0,H)}}};function dk(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===du&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function fk(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function pk({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=mk(e,n);return(t[mk(e,r)]??0)-(t[i]??0)}function mk(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function hk(e){return Math.ceil(e/sk)*sk}function gk(e,t){let n=0;for(let r of e)r<t&&n++;return n}function _k({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function vk(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function yk(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function bk(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function xk(e){return typeof e==`function`?`custom`:e??`line-info`}function Sk(e,t){return e==null||t==null?e==null&&t==null:Vw(e,t)}function Ck(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}var wk=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),Tk=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Ek=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],Dk=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],Ok=Symbol(`CodeView.itemOptionsState`);function kk(e,t){Object.defineProperty(e,Ok,{configurable:!1,enumerable:!1,value:t})}function Ak(e){return e[Ok]}function jk(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var Mk=120,Nk=1,Pk=`--diffs-overflow-override`,Fk=12e6,Ik=1e6,Lk=2e6,Rk=1e7,zk=11e6;function Bk(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var Vk=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),Hk=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=wl;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;pendingHighlighterTheme;isContainerManaged;constructor(e={theme:rl},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??ju}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??wl.hunkLineCount,lineHeight:e?.lineHeight??wl.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??wl.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??wl.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??Ou}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return gc&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<Nk||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),Vk&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Pk,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Mk)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(Pk,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element!=null&&(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0),!1);if(r.element!=null&&i===r.render)return!1;let a=r.element??bE(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isContainerManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){Mu(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let{items:e}=this,t=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),e});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items=[],this.idToItem.clear(),this.instanceToItem.clear();let n=!1,r;for(let e of t)try{e.editor.cleanUp(`discard`)}catch(e){n||(n=!0,r=e)}for(let t of e)try{t.instance.cleanUp()}catch(e){n||(n=!0,r=e)}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator(),n)throw r}cleanUp(){let e=!1,t;try{this.reset()}catch(n){e=!0,t=n}if(this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,e)throw t}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(Hc),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))qk(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return xE()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection()}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.setItems(n),!0}setItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e));try{this.syncItemEditors(t)}finally{for(let e of t?.values()??[])e.instance.cleanUp()}this.syncSelection()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=Uk(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;Wk(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!ku(r,i),o=!ku(n,this.getLayout());o&&this.syncLayout();let s=a||Gk(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||Kk(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),mc(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||c)&&this.render()}capturePendingLayoutAnchor(e=this.idToItem){this.root!=null&&this.items.length!==0&&this.pendingScrollTarget==null&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(t=!1){e.__STOP||(t?(Mu(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):tl(this.computeRenderRangeAndEmit))}isReady(){let{workerManager:e}=this;return e==null||e.getStats().workersFailed?this.isSharedHighlighterReady():e.isInitialized()?(this.clearReadySubscription(),!0):(this.isReadySubscription??=e.subscribeToStatChanges(e=>{(e.managerState===`initialized`||e.workersFailed)&&(this.clearReadySubscription(),this.render(!0))}),e.getStats().managerState===`waiting`&&e.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0,this.pendingHighlighterTheme=void 0)}isSharedHighlighterReady(){let e=this.workerManager?.getFileRenderOptions().theme??this.options.theme??rl;return oc()&&hu(e)?(this.clearReadySubscription(),!0):(dl(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return jl({themes:kl(e),langs:[],preferredHighlighter:this.options.preferredHighlighter}).then(()=>{t||(this.clearReadySubscription(),this.render(!0))},e=>{t||(this.clearReadySubscription(),console.error(e))}),()=>{t=!0}})(),!1)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=$k(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(t!=null||n!=null||r!=null)return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new uk(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new Wl(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&Tl(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i;try{if(r==null){Bk(n);let r=Ak(e.instance.options);if(r==null)throw Error(`CodeView.attachItemEditor: instance options are missing their state`);let a=e=>{let t=this.idToItem.get(r.id);t!=null&&this.options.onItemEditChange?.(e,t.item)},o=this.options.getEditStateKey?.(e.item);if(e.type===`diff`){let s=n(`file-diff`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}else{let s=n(`file`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}}else r.dispose=(e.type,r.editor.edit(e.instance));this.attachedEditors.add(t)}catch(t){throw i?.cleanUp(),this.releaseRenderedItem(e),t}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null){let{edit:e=!1,collapsed:t=!1}=i.item;if(e){t&&this.attachedEditors.delete(n)&&r.editor.cleanUp(`recycle`);continue}}else a!=null&&(r.state.removedItem=a.item);this.itemEditors.delete(n),this.attachedEditors.delete(n),t.push(r)}if(t.length===0)return;let n=!1,r;for(let e of t){try{e.dispose()}catch(e){n||(n=!0,r=e)}let t=this.idToItem.get(e.state.id);t!=null&&this.markItemLayoutDirty(t)}if(this.render(),n)throw r}requireItemFromState(e){let t=this.idToItem.get(e.id)?.item??e.removedItem;if(t==null)throw Error(`CodeView.onItemEditComplete: unknown item "${e.id}"`);return t}completeFileItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`file`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a file item`);let r={...n,file:t.file,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}completeDiffItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`diff`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a diff item`);let r={...n,fileDiff:t.fileDiff,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n!=null&&n.type!==`position`&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of Tk)jk(e,t,()=>this.options[t]);jk(e,`stickyHeader`,()=>this.options.stickyHeaders),jk(e,`collapsed`,e=>{let t=Ak(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),jk(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Ak(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of Ek)this.defineItemSharedCallback(e,`file`,t);for(let t of Dk)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of wk)jk(e,t,()=>this.options[t]);jk(e,`stickyHeader`,()=>this.options.stickyHeaders),jk(e,`hunkSeparators`,()=>this.options.hunkSeparators),jk(e,`collapsed`,e=>{let t=Ak(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),jk(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Ak(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of Ek)this.defineItemSharedCallback(e,`diff`,t);for(let t of Dk)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return kk(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return kk(t,{id:e}),t}updateItemOptionsId(e,t){let n=Ak(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(n!=null&&n.type===t)return n}defineItemSharedCallback(e,t,n){jk(e,n,e=>{if(this.options[n]==null)return;let r=Ak(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){jk(e,n,e=>{let r=Ak(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)},i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version!==t.version&&(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>zk}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),Fk):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=SE(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=SE(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,r=this.getMaxPagedScrollTop(),i=this.getMaxScrollPageOffset(),a=n>zk&&t<i,o=n<Ik&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(Rk,r):Lk):{pagedScrollTop:SE(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=SE(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${Jk(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${Jk(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null||!this.isReady())return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=Pu({scrollTop:s-this.header.height,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m=this.reconcileHeaderFooterHosts(),h,g=new Set,_=this.findFirstVisibleIndex(u),v=this.findLastVisibleIndex(d);for(let e=_;e<=v;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),Zk(this.stickyContainer,t.element,h),n.virtualizedSetup(),Xk(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(Zk(this.stickyContainer,t.element,h),Xk(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element),t.item.edit===!0&&this.attachItemEditor(t)}this.renderState.firstIndex=_<=v?_:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.flushManagers(g),m&&this.measureMountedHosts(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();let y=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let b=y==null?0:y-i,x=s,S=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,b);e==null?x=i:(x=e,S=!0)}else x=y??s;x!==l&&(this.applyScrollFix(x,l,this.windowSpecs),l=x),S&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=SE(l),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container!=null&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(r!=null&&i!=null)return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);if(t==null){this.stickyOffset.style.height=`${this.getPagedLayoutTop(e.top)}px`;return}this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;(n-t!==this.renderState.stickyHeight||t!==this.renderState.stickyTop||n!==this.renderState.stickyBottom)&&this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=e=>{let t=!1;for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=Nk){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else this.scrollDirty=!0,this.heightDirty=!0,t=!0;t&&this.render(!0)};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(o!==-1&&s!==-1){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=SE(this.clampScrollTop(e)),i=SE(t),{scrollPageOffset:a}=this,o=SE(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;(r!==this.renderState.scrollTop||r!==i||l!==o||u)&&(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null||SE(this.getScrollTop())===SE(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);vE(this.slotSnapshot,e)||(this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);e.top=r,e.height=e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,r,t,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,r,t,e.item.annotations??[]),r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function Uk(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,e.top,void 0,e.item.annotations??[])}function Wk(e,t){return!dl(e.theme??rl,t.theme??rl)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function Gk(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Kk(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function qk(e){return e instanceof SVGElement||Eu(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function Jk(e){let t=Yk(e.start,e.side),n=Yk(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function Yk(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function Xk(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function Zk(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function Qk(e){return(e.annotations?.length??0)>0}function $k(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)Qk(t.item)&&i.push(t);return i.length>0?i:void 0}function eA(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}var tA=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function nA(e){return{instance:void 0,items:void 0,controlled:e,managedOptions:void 0,disableFlushSync:!1,slotCoordinator:void 0}}function rA(e,t){let{className:n,containerRef:r,disableWorkerPool:i=!1,editorOptions:a,getEditStateKey:o,initialItems:s,items:c,onItemEditChange:l,onItemEditComplete:u,onScroll:d,onSelectedLinesChange:f,options:p,renderAnnotation:m,renderCodeViewFooter:h,renderCodeViewHeader:g,renderCustomHeader:_,renderGutterUtility:v,renderHeaderFilenameSuffix:y,renderHeaderMetadata:b,renderHeaderPrefix:x,selectedLines:S,style:C}=e,w=c!==void 0,T=Ow(),E=(0,Z.useContext)(hE),D=(0,Z.useRef)(nA(w)),O=_!=null,k=m!=null,A=v!=null,j=O||x!=null||y!=null||b!=null,M=j||k||A,N=g!=null,P=h!=null,F=Ew(e=>{f?.(e)}),I=S!==void 0,L=Ew((e,t,n)=>{if(T==null)throw Error(`CodeView: EditContext is not attached`);let r={...a,...t};return T(e,r,n)}),R=Ew((e,t)=>{l?.(e,t)}),z=Ew((e,t,n)=>u?.(e,t,n)??`reject`),B=(0,Z.useMemo)(()=>lA({options:p,hasCustomHeader:O,hasGutterRenderer:A,hasCodeViewHeader:N,hasCodeViewFooter:P,onSelectedLinesChange:f==null?void 0:F,controlledSelection:I,getEditStateKey:o,createEditor:T==null?void 0:L,onItemEditChange:l==null?void 0:R,onItemEditComplete:u==null?void 0:z}),[T,I,L,R,z,F,P,N,O,A,o,l,u,f,p]),[V]=(0,Z.useState)(()=>cA()),[,H]=(0,Z.useState)({}),U=Ew(e=>{D.current.instance!=null&&(e==null||e!==D.current.instance.getContainerElement())&&(D.current.instance.cleanUp(),V.publish(void 0),D.current=nA(w)),e!=null&&e!==D.current.instance?.getContainerElement()&&(D.current.instance=new Hk(B,i?void 0:E,!0),D.current.instance.setup(e)),eA(r,e)}),W=Ew(e=>{D.current.disableFlushSync?V.publish(e):(0,rd.flushSync)(()=>{V.publish(e)})}),G=(0,Z.useMemo)(()=>{if(j||k||A||N||P)return{hasHeaderRenderers:j,hasAnnotationRenderer:k,hasGutterRenderer:A,onSnapshotChange:W}},[W,k,A,j,N,P]);return tA(()=>d==null?void 0:D.current.instance?.subscribeToScroll(d)),tA(()=>{let{instance:e,controlled:t,items:n,managedOptions:r,slotCoordinator:i}=D.current;if(e!=null)try{D.current.disableFlushSync=!0;let a=!1;if(mc(B,r)||(D.current.managedOptions=B,e.setOptions(B),a=!0),t!==w){console.error(`CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.`);return}if(w)c!==n&&(oA(n,c)?D.current.items=c:aA(n,c)?(D.current.items=c,e.addItems(c.slice(n.length))):(D.current.items=c,e.setItems(c),a=!0));else if(n==null){let t=s??[];D.current.items=t,t.length>0&&(e.setItems(t),a=!0)}S!==void 0&&e.setSelectedLines(S,{notify:!1});let o=e.setSlotCoordinator(G),l=!1;G!==i&&((G==null||i==null)&&(l=!0),D.current.slotCoordinator=G),(a||o)&&e.render(!0),o&&G==null&&V.publish(void 0),l&&H({})}finally{D.current.disableFlushSync=!1}}),(0,Z.useImperativeHandle)(t,()=>({addItems(e){let{controlled:t,instance:n}=D.current;sA(t,`addItems`),n==null?console.error(`CodeView.addItems: no valid instance to append items with`,e):n.addItems(e)},getItem(e){let{instance:t}=D.current;if(t==null){console.error(`CodeView.getItem: no valid instance exists`,e);return}return t.getItem(e)},removeItem(e){let{controlled:t,instance:n}=D.current;return sA(t,`removeItem`),n==null?(console.error(`CodeView.removeItem: no valid instance to remove item from`,e),!1):n.removeItem(e)},updateItem(e){let{controlled:t,instance:n}=D.current;return sA(t,`updateItem`),n==null?(console.error(`CodeView.updateItem: no valid instance to update item with`,e),!1):n.updateItem(e)},updateItemId(e,t){let{controlled:n,instance:r}=D.current;return sA(n,`updateItemId`),r==null?(console.error(`CodeView.updateItemId: no valid instance to update item id with`,e,t),!1):r.updateItemId(e,t)},scrollTo(e){let{instance:t}=D.current;t==null?console.error(`CodeView.scrollTo: no valid instance to scroll with`,e):t.scrollTo(e)},setSelectedLines(e){let{instance:t}=D.current;t==null?console.error(`CodeView.setSelectedLines: no valid instance to update selection with`,e):(t.setSelectedLines(e,{notify:!1}),F(e))},getSelectedLines(){let{instance:e}=D.current;return e==null?(console.error(`CodeView.getSelectedLines: no valid instance exists`),null):e.getSelectedLines()},clearSelectedLines(){let{instance:e}=D.current;e==null?console.error(`CodeView.clearSelectedLines: no valid instance to update selection with`):(e.clearSelectedLines({notify:!1}),F(null))},getEditor(e){let{instance:t}=D.current;if(t==null){console.error(`CodeView.getEditor: no valid instance exists`,e);return}return t.getEditor(e)},getInstance(){return D.current.instance}}),[F]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{ref:U,className:n,style:C}),(M||N||P)&&(0,Q.jsx)(uA,{managedContentStore:V,renderCustomHeader:_,renderHeaderPrefix:x,renderHeaderFilenameSuffix:y,renderHeaderMetadata:b,renderAnnotation:m,renderGutterUtility:v,renderCodeViewHeader:g,renderCodeViewFooter:h})]})}var iA=(0,Z.forwardRef)(rA);function aA(e,t){if(e==null||t.length<=e.length)return!1;if(e.length===0)return!0;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return!1;return!0}function oA(e,t){if(e==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function sA(e,t){if(e)throw Error(`CodeView.${t} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`)}function cA(){let e,t=new Set;return{getSnapshot(){return e},publish(n){if(!vE(e,n)){e=n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function lA({options:e,hasCustomHeader:t,hasGutterRenderer:n,hasCodeViewHeader:r,hasCodeViewFooter:i,onSelectedLinesChange:a,controlledSelection:o,getEditStateKey:s,createEditor:c,onItemEditChange:l,onItemEditComplete:u}){let d={...e,controlledSelection:o,onSelectedLinesChange:a,createEditor:c};return s!=null&&(d.getEditStateKey=s),l!=null&&(d.onItemEditChange=l),u!=null&&(d.onItemEditComplete=u),t&&(d.renderCustomHeader=fA),n&&(d.renderGutterUtility=fA),r&&(d.renderCodeViewHeader=fA),i&&(d.renderCodeViewFooter=fA),d}var uA=(0,Z.memo)(function({managedContentStore:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderCodeViewHeader:s,renderCodeViewFooter:c}){"use no memo";let l=Ew(t=>e.subscribe(t)),u=Ew(()=>e.getSnapshot()),d=(0,Z.useSyncExternalStore)(l,u,u),f=``;for(let e of d?.items??[])f+=`${e.id}:${e.version}:${e.type}`;let p=(0,Z.useMemo)(()=>d?.items?.map(e=>(0,rd.createPortal)(dA({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o}),e.element,e.id)),[t,n,r,i,a,o,f]),m=(0,Z.useMemo)(()=>s!=null&&d?.header!=null?(0,rd.createPortal)(s(),d.header):null,[s,d?.header]),h=(0,Z.useMemo)(()=>c!=null&&d?.footer!=null?(0,rd.createPortal)(c(),d.footer):null,[c,d?.footer]);return(0,Q.jsxs)(Q.Fragment,{children:[p,m,h]})});function dA({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o}){if(e.type===`diff`){let{item:s,instance:c}=e;return Lw({fileDiff:s.fileDiff,renderCustomHeader:t==null?void 0:()=>t(s),renderHeaderPrefix:n==null?void 0:()=>n(s),renderHeaderFilenameSuffix:r==null?void 0:()=>r(s),renderHeaderMetadata:i==null?void 0:()=>i(s),renderAnnotation:a==null?void 0:e=>a(e,s),lineAnnotations:s.annotations,renderGutterUtility:o==null?void 0:e=>o(e,s),getHoveredLine:c.getHoveredLine,getAnnotationSlotName:c.getAnnotationSlotName})}{let{item:s,instance:c}=e;return zw({file:s.file,renderCustomHeader:t==null?void 0:()=>t(s),renderHeaderPrefix:n==null?void 0:()=>n(s),renderHeaderFilenameSuffix:r==null?void 0:()=>r(s),renderHeaderMetadata:i==null?void 0:()=>i(s),renderAnnotation:a==null?void 0:e=>a(e,s),lineAnnotations:s.annotations,renderGutterUtility:o==null?void 0:e=>o(e,s),getHoveredLine:c.getHoveredLine,getAnnotationSlotName:c.getAnnotationSlotName})}}function fA(){}function pA(e,t){return typeof window>`u`&&t!=null?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,Q.jsx)(Q.Fragment,{children:e})}var mA=(0,Z.createContext)(void 0);function hA(){return(0,Z.useContext)(mA)}var gA=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function _A({file:e,options:t,editorOptions:n,editStateKey:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:o,metrics:s,hasGutterRenderUtility:c,hasCustomHeader:l,disableWorkerPool:u,edit:d,onEditChange:f,onEditComplete:p}){let m=hA(),h=a!==void 0,g=(0,Z.useContext)(hE),_=Ow(),v=Ew(e=>f?.(e)),y=f==null?void 0:v,b=(0,Z.useRef)(null),x=Ew(e=>{let t=p?.(e)??`reject`;return t===`accept`&&(b.current={file:{installed:e.file,stale:e.originalFile},annotations:{installed:e.lineAnnotations,stale:e.originalLineAnnotations}}),t}),S=p==null?void 0:x,C=(0,Z.useRef)(null),w=(0,Z.useRef)(null),T=Ew(()=>{if(_==null)throw Error(`File: EditContext is not attached`);return _(`file`,n??{},r)}),E=Ew(n=>{if(n!=null){if(C.current!=null)throw Error(`File: An instance should not already exist when a node is created`);m==null?C.current=new Fc(yA({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),u?void 0:g,!0):C.current=new Wl(yA({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),m,s,u?void 0:g,!0),d&&w.current==null&&(w.current=bA(C.current,T)),C.current.hydrate({file:e,fileContainer:n,lineAnnotations:i,prerenderedHTML:o})}else{if(C.current==null)throw Error(`File: A File instance should exist when unmounting`);C.current.cleanUp(),C.current=null,w.current=null}});return gA(()=>{let{current:n}=C;if(n==null)return;let r=yA({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),o=r!==void 0&&!mc(n.options,r);if(n.setOptions(r),!d&&w.current!=null){let{current:e}=w;w.current=null,e()}let s=vA(e,i,b);n.render({file:s.file,lineAnnotations:s.lineAnnotations,forceRender:o}),a!==void 0&&n.setSelectedLines(a),d&&w.current==null&&(w.current=bA(n,T))}),{ref:E,getHoveredLine:(0,Z.useCallback)(()=>C.current?.getHoveredLine(),[]),getAnnotationSlotName:(0,Z.useCallback)(e=>C.current?.getAnnotationSlotName(e)??eu(e),[])}}function vA(e,t,n){let{current:r}=n;if(r==null)return{file:e,lineAnnotations:t};let{file:i,annotations:a}=r,o=e;i!=null&&(vl(e,i.stale)?o=i.installed:r.file=null);let s=t;return a!=null&&(t===a.stale?s=a.installed:r.annotations=null),r.file==null&&r.annotations==null&&(n.current=null),{file:o,lineAnnotations:s}}function yA({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return t||r||n||i!=null||a!=null?{...e,controlledSelection:t,renderCustomHeader:n?jw:e?.renderCustomHeader,renderGutterUtility:r?jw:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}:e}function bA(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function xA({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,editStateKey:a,metrics:o,className:s,style:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,prerenderedHTML:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S}=_A({file:e,options:r,editorOptions:i,editStateKey:a,metrics:o,lineAnnotations:t,selectedLines:n,prerenderedHTML:m,hasGutterRenderUtility:h!=null,hasCustomHeader:u!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),C=zw({file:e,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:h,lineAnnotations:t,getHoveredLine:x,getAnnotationSlotName:S});return(0,Q.jsx)(Hc,{ref:b,className:s,style:c,children:pA(C,m)})}function SA(e){return e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
1293
+ `)}function CA(e){return/^\s*$/.test(e)}function wA(e,t){let n=0;for(;n<e.length&&n<t&&e[n]===` `;)n++;return e.slice(n)}function TA(e){let t=``;for(let n of e)n.type===`text`||n.type===`inlineCode`?t+=n.value:`children`in n?t+=TA(n.children):n.type===`image`&&(t+=n.alt);return t}function EA(e=DA){let t=new Map;return n=>{let r=e(n),i=t.get(r)??1,a=r;for(;t.has(a);)a=`${r}-${++i}`;return t.set(r,i),t.set(a,1),a}}function DA(e){return e.toLowerCase().normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).replace(/&[a-z0-9#]+;/gi,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`section`}function OA(e){let t=e.replace(/[\u0000-\u001F\u007F\s]+/g,``);return/^(?!https?:|mailto:|tel:)[a-z][a-z0-9+.-]*:/i.test(t)?``:t}function kA(e){let t=e.match(/^(?:<([^<>\n]*)>|([^<>\s]*?))(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);if(!t)return;let n=t[1]??t[2],r=t[3]??t[4]??t[5];return{href:n.replace(/\\([!-/:-@\[-`{-~])/g,`$1`),...r?{title:r}:{}}}function AA(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}function jA(e){return AA(e).replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)||`footnote`}function MA(e,t=1){return t>1?`${e}-${t}`:e}function NA(e,t={}){let n=LA(e,t);for(let e of t.extensions??[])n=e.transformInline?.(n,{options:t})??n;return n}var PA=32,FA=16,IA=/[\\`!\[_*~<]/g;function LA(e,t,n={scans:Math.max(e.length*FA,1024),depth:0,links:0}){if(n.depth>=PA)return e?[{type:`text`,value:e}]:[];n.depth++;let r=[],i=0,a=``,o=()=>{a&&=(r.push({type:`text`,value:a}),``)};for(;i<e.length;){let s=e[i],c=e[i+1];if(s===`\\`){if(c===`
1294
+ `){o(),r.push({type:`break`}),i+=2;continue}if(c&&/[!-/:-@\[-`{-~]/.test(c)){a+=c,i+=2;continue}}if(s==="`"){let t=HA(e,i,"`"),s=UA(e,i+t,"`",t,n);if(s!==-1){o(),r.push({type:`inlineCode`,value:e.slice(i+t,s).replace(/\n/g,` `).replace(/^ (?! *$)(.*) $/s,`$1`)}),i=s+t;continue}a+=e.slice(i,i+t),i+=t;continue}if(s===`[`||s===`!`&&c===`[`){let l=s===`!`,u=c===`^`&&RA(e,i,t,n);if(u){o(),r.push(u.node),n.links++,i=u.end;continue}let d=zA(e,i+Number(l),t,n);if(d){let e=n.links,s=LA(d.label,l?t.references?{references:t.references}:{}:t,n),c=!l&&n.links!==e,u=OA(d.href);if(l||!c&&(u||!d.href))o(),r.push({...l?{type:`image`,src:u,alt:TA(s)}:{type:`link`,href:u,children:s},...d.title?{title:d.title}:{}});else{c&&(a+=`[`);for(let e of s)e.type===`text`?a+=e.value:(o(),r.push(e))}n.links=l?e:n.links+1,i=c?i+d.label.length+1:d.end;continue}}if(s===`*`&&c===`*`&&e[i+2]===`*`){let a=WA(e,i+3,`***`,n);if(a!==-1){o(),r.push({type:`emphasis`,children:LA(e.slice(i+1,a+2),t,n)}),i=a+3;continue}}if(s===`~`&&c===`~`&&e[i+2]===`~`){let t=HA(e,i,`~`);a+=e.slice(i,i+t),i+=t;continue}if(s===`*`||s===`_`||s===`~`){let l=c===s?2:1,u=s===`_`&&!KA(e,i,l,!0)?-1:WA(e,i+l,s.repeat(l),n);u===-1?(a+=s.repeat(l),i+=l):(o(),r.push({type:s===`~`?`strike`:l===2?`strong`:`emphasis`,children:LA(e.slice(i+l,u),t,n)}),i=u+l);continue}if(s===`<`&&t.allowHtml){let t=GA(e,i+1,`>`,n);if(t!==-1&&BA(e.slice(i,t+1))){o(),r.push({type:`inlineHtml`,value:e.slice(i,t+1)}),i=t+1;continue}}IA.lastIndex=i+1;let l=n.scans>0?IA.exec(e)?.index??e.length:e.indexOf(`\\`,i+1);a+=e.slice(i,l<0?e.length:l),i=l<0?e.length:l}return o(),n.depth--,r}function RA(e,t,n,r){let i=GA(e,t+2,`]`,r);if(i===-1)return;let a=AA(e.slice(t+2,i)),o=n.footnotes?.[a];if(!o||!n.footnoteOrder)return;let s=n.footnoteOrder.indexOf(a)+1;s||=n.footnoteOrder.push(a);let c=(n.footnoteCounts?.[a]??0)+1;return n.footnoteCounts&&(n.footnoteCounts[a]=c),{node:{type:`footnoteReference`,id:o.id??jA(o.label),number:s,...c>1?{referenceIndex:c}:{}},end:i+1}}function zA(e,t,n,r){let i=VA(e,t,`[`,`]`,r);if(i===-1)return;let a=e.slice(t+1,i),o=i+1,s;if(e[o]===`(`){let t=VA(e,o,`(`,`)`,r);if(t===-1)return;s=kA(e.slice(o+1,t).trim()),o=t+1}else if(e[o]===`[`){let t=VA(e,o,`[`,`]`,r);if(t===-1)return;s=n.references?.[AA(e.slice(o+1,t)||a)],o=t+1}else s=n.references?.[AA(a)];if(s)return{...s,label:a,end:o}}function BA(e){return/^<(?:!--(?:[\s\S]*--|-?)|\?[\s\S]*\?|![A-Z][\s\S]*|!\[CDATA\[[\s\S]*\]\]|\/[A-Za-z][\w:-]*\s*|[A-Za-z][\w:-]*(?:\s+[A-Za-z_:][\w:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*\s*\/?)>$/.test(e)}function VA(e,t,n,r,i){if(GA(e,t+1,r,i)===-1)return-1;let a=0;for(let o=t;o<e.length;o++){if(--i.scans<0)return-1;if(e[o]===`\\`){o++;continue}if(e[o]===n&&a++,e[o]===r&&(a--,a===0))return o}return-1}function HA(e,t,n,r){let i=0;for(;e[t+i]===n&&!(r&&--r.scans<0);)i++;return i}function UA(e,t,n,r,i){let a=t;for(;(a=GA(e,a,n,i))!==-1;){let t=HA(e,a,n,i);if(t===r)return a;a+=t}return-1}function WA(e,t,n,r){if(n===`~`&&/[\s\d]/.test(e[t]??``))return-1;for(let i=t;i<e.length;i++){if(--r.scans<0)return-1;if(e[i]===`\\`){i++;continue}if(e.startsWith(n,i)){if(n[0]===`~`){if(e[i-1]===`~`||e[i+n.length]===`~`)continue;if(n===`~`&&/\s/.test(e[i-1]??``))return-1}else if(e[i+1]===n){let t=HA(e,i,n,r),a=WA(e,i+t,n.repeat(t),r);if(a>i+t){i=a+t-1;continue}}if(n[0]!==`_`||KA(e,i,n.length,!1))return i}}return-1}function GA(e,t,n,r){if(r.scans<=0)return-1;let i=e.indexOf(n,t);return r.scans-=(i<0?e.length:i+1)-t,r.scans<0?-1:i}function KA(e,t,n,r){let i=e[r?t+n:t-1],a=e[r?t-1:t+n];return i!==void 0&&!/\s/.test(i)&&(a===void 0||/[^\p{L}\p{N}]/u.test(a))}var qA=64;function JA(e,t={}){let n=SA(e),r=t.frontmatter!==!1,i=n.split(`
1295
+ `),a;if(r&&i[0]===`---`){let e=i.findIndex((e,t)=>t>0&&e===`---`);e>0&&(a=i.slice(1,e).join(`
1296
+ `),i=i.slice(e+1))}let o=ZA(i);i=o.lines;let s=[],c=Object.create(null),l=Object.keys(o.references).length>0,u=Object.keys(o.footnotes).length>0,d=l||u?{...t,...l?{references:o.references}:{},...u?{footnotes:o.footnotes,footnoteOrder:s,footnoteCounts:c}:{}}:t,f=EA(),p=new YA(i,d,f).parse();u&&s.length>0&&p.push(QA(o.footnotes,s,d,f));let m=a===void 0?{type:`root`,children:p}:{type:`root`,frontmatter:a,children:p};for(let e of d.extensions??[])m=e.transformDocument?.(m,{options:d})??m;return m}var YA=class e{lines;options;slugger;budget;index=0;loose=!1;constructor(e,t,n,r={depth:0}){this.lines=e,this.options=t,this.slugger=n,this.budget=r}parse(){if(this.budget.depth>=qA){let e=this.lines.slice(this.index).join(`
1297
+ `);return this.index=this.lines.length,e?[{type:`paragraph`,children:NA(e,this.options)}]:[]}this.budget.depth++;let e=[];for(;this.index<this.lines.length;){if(CA(this.current())){e.length&&(this.loose=!0),this.index++;continue}let t=this.parseExtensionBlock();if(t){e.push(t);continue}let n=this.parseFence()??this.parseHeading()??this.parseThematicBreak()??this.parseBlockquote()??this.parseList()??this.parseTable()??this.parseHtmlBlock()??this.parseParagraph();e.push(n)}return this.budget.depth--,e}parseExtensionBlock(){for(let t of this.options.extensions??[]){let n=0,r=t.parseBlock?.({lines:this.lines,index:this.index,options:this.options,parseInline:e=>NA(e,this.options),parseBlocks:t=>new e(SA(t).split(`
1298
+ `),this.options,this.slugger,this.budget).parse(),consume:e=>{n=e}});if(r)return this.index+=Math.max(n,1),r}}parseFence(){let e=this.current().match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(!e)return;let t=e[2],n=e[3].trim(),r=[];for(this.index++;this.index<this.lines.length;){let n=this.current();if(n.match(/^ {0,3}(`{3,}|~{3,})\s*$/)?.[1].startsWith(t)){this.index++;break}r.push(wA(n,e[1].length)),this.index++}return{type:`code`,value:r.join(`
1299
+ `),...XA(n)}}parseHeading(){let e=this.current().match(/^ {0,3}(#{1,6})(?:[ \t]+(.*)|[ \t]*)$/);if(!e)return;let t=e[1].length,n=e[2]??``,r=NA((/^#+[ \t]*$/.test(n)?``:n.replace(/[ \t]+#+[ \t]*$/,``)).trim(),this.options),i=this.createHeadingId(r);return this.index++,i?{type:`heading`,depth:t,id:i,children:r}:{type:`heading`,depth:t,children:r}}parseThematicBreak(){if(/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(this.current()))return this.index++,{type:`thematicBreak`}}parseBlockquote(){if(!/^ {0,3}>\s?/.test(this.current()))return;let t=[];for(;this.index<this.lines.length;){let e=this.current(),n=e.match(/^ {0,3}>\s?(.*)$/);if(!n){if(!CA(e))break;this.loose=!0}t.push(n?.[1]??``),this.index++}return{type:`blockquote`,children:new e(t,this.options,this.slugger,this.budget).parse()}}parseList(){let t=ej(this.current());if(!t)return;let n=[],r=t.ordered,i=t.indent,a=!1;for(;this.index<this.lines.length;){let r=ej(this.current());if(!r||r.marker!==t.marker||r.indent!==i)break;let o=r.content,s=o.match(/^\[([ xX])\]\s+(.*)$/),c=s?s[1].toLowerCase()===`x`:void 0;s&&(o=s[2]);let l=[o];for(this.index++;this.index<this.lines.length;){let e=this.current(),n=ej(e);if(n&&n.indent===i)break;if(CA(e)){let e=this.index;for(;e<this.lines.length&&CA(this.lines[e]);)e++;let n=this.lines[e];if(n===void 0)break;let o=ej(n);if(o?.indent===i){if(o.marker!==t.marker)break;a=!0,this.index=e;break}if(tj(n)<r.contentIndent)break;for(;this.index<e;)l.push(wA(this.lines[this.index++],r.contentIndent));continue}if(tj(e)>=r.contentIndent){l.push(wA(e,r.contentIndent)),this.index++;continue}if(nj(e,this.next()))break;l.push(e.trimStart()),this.index++}let u=new e(l,this.options,this.slugger,this.budget),d=u.parse();a||=u.loose;let f={type:`listItem`,children:d};c!==void 0&&(f.checked=c),n.push(f)}return{type:`list`,ordered:r,...r&&{start:t.number},...a&&{loose:!0},items:n}}parseTable(){let e=this.current(),t=this.next();if(!t||!rj(e,t))return;let n=ij(e),r=ij(t).map(aj),i=n.length,a=[];for(this.index+=2;this.index<this.lines.length;){let e=this.current();if(CA(e)||nj(e,this.next()))break;let t=ij(e);a.push(Array.from({length:i},(e,n)=>oj(t[n]??``,this.options))),this.index++}return{type:`table`,align:r,header:n.map(e=>oj(e,this.options)),rows:a}}parseHtmlBlock(){if(!this.options.allowHtml||!/^ {0,3}<([A-Za-z][\w:-]*|!--|\/[A-Za-z])/.test(this.current()))return;let e=[];if(/^ {0,3}<!--/.test(this.current())){for(;this.index<this.lines.length;){let t=this.current();if(e.push(t),this.index++,t.includes(`-->`))break}return{type:`html`,value:e.join(`
1300
+ `)}}for(;this.index<this.lines.length&&!CA(this.current());)e.push(this.current()),this.index++;return{type:`html`,value:e.join(`
1301
+ `)}}parseParagraph(){let e=[];for(;this.index<this.lines.length;){let t=this.current();if(CA(t)||e.length>0&&nj(t,this.next()))break;e.push(t.trim()),this.index++}return{type:`paragraph`,children:NA(e.join(`
1302
+ `),this.options)}}createHeadingId(e){if(this.options.headingIds===!1)return;let t=TA(e);return typeof this.options.headingIds==`function`?this.options.headingIds(t,this.index):this.slugger(t)}current(){return this.lines[this.index]??``}next(){return this.lines[this.index+1]}};function XA(e){if(!e)return{};let t=e.match(/^([A-Za-z0-9_+.#-]+)/)?.[1],n=t?e.slice(t.length).trim():e,r=n.match(/(?:^|\s)(?:title|file)=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/),i=n.match(/(?:^|\s)framework=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/),a=n.match(/\{([^}]+)\}|(?:^|\s)lines=([^\s]+)/),o=a?$A(a[1]??a[2]):[],s=r?r[1]??r[2]??r[3]:void 0,c=i?i[1]??i[2]??i[3]:void 0;return{...t?{lang:t}:{},...n?{meta:n}:{},...s?{title:s,file:s}:{},...c?{framework:c.toLowerCase()}:{},...o.length?{highlightLines:o}:{}}}function ZA(e){let t=Object.create(null),n=Object.create(null),r=EA(jA),i=[],a=``,o=0;for(;o<e.length;){let s=e[o],c=s.match(/^ {0,3}(`{3,}|~{3,})(.*)$/);if(c)a?c[1].startsWith(a)&&CA(c[2])&&(a=``):a=c[1];else if(!a){let i=s.match(/^ {0,3}\[\^([^\]\n]+)\]:[ \t]*(.*)$/);if(i){let t=i[1],a=[i[2]??``];for(o++;o<e.length;){let t=e[o];if(!/^(?: {4,}|\t)/.test(t))break;a.push(t.replace(/^(?: {4}|\t)/,``)),o++}let s=AA(t);n[s]||(n[s]={label:t,content:a.join(`
1303
+ `),id:r(t)});continue}let a=s.match(/^ {0,3}\[([^\]\n]+)\]:[ \t]*(\S.*)$/),c=a&&kA(a[2].trimEnd());if(c){t[AA(a[1])]??=c,o++;continue}}i.push(s),o++}return{lines:i,references:t,footnotes:n}}function QA(e,t,n,r){let i=[];for(let a=0;a<t.length;a++){let o=e[t[a]];o&&i.push({id:o.id??jA(o.label),number:a+1,children:new YA(SA(o.content).split(`
1304
+ `),n,r).parse()})}for(let e of i){let r=n.footnoteCounts?.[t[e.number-1]]??1;r>1&&(e.referenceCount=r)}return{type:`footnotes`,items:i}}function $A(e){let t=new Set;for(let n of e.split(`,`)){let e=n.trim().match(/^(\d+)(?:-(\d+))?$/);if(!e)continue;let r=Number(e[1]),i=Number(e[2]??e[1]);if(!(i>2**53-1))for(let e=r;e<=i&&e<r+1e3;e++)t.add(e)}return[...t].sort((e,t)=>e-t)}function ej(e){let t=e.match(/^(\s{0,8})([-+*]|\d{1,9}[.)])(?:([ \t]+)(.*))?$/);if(!t)return;let n=t[2],r=/\d/.test(n[0]);return{ordered:r,...r?{number:Number.parseInt(n,10)}:{},indent:t[1].length,marker:r?n.at(-1):n,contentIndent:t[1].length+n.length+(t[3]?.length??1),content:t[4]??``}}function tj(e){return e.match(/^ */)?.[0].length??0}function nj(e,t){let n=ej(e);return/^ {0,3}(?:`{3,}|~{3,}|#{1,6}(?:\s|$)|([-*_])(?:\s*\1){2,}\s*$|>)/.test(e)||n!==void 0&&(!n.ordered||n.number===1)||!!t&&rj(e,t)}function rj(e,t){if(!e.includes(`|`))return!1;let n=ij(t);return n.length===ij(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function ij(e){let t=e.trim(),n=[],r=``;for(let e=+!!t.startsWith(`|`);e<t.length;e++){let i=t[e];if(i===`\\`&&t[e+1]===`|`){r+=`|`,e++;continue}if(i===`|`){n.push(r.trim()),r=``;continue}r+=i}return(r||!t.endsWith(`|`)||!n.length)&&n.push(r.trim()),n}function aj(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function oj(e,t){return{type:`tableCell`,children:NA(e,t)}}function sj({children:e,...t}){return(0,Z.createElement)(Z.Fragment,null,cj(e,t))}function cj(e,t={}){return(typeof e==`string`?JA(e,t):e).children.map((e,n)=>lj(e,t,`b:${n}`))}function lj(e,t={},n){switch(e.type){case`heading`:return vj(t,`h${e.depth}`,{key:n,...e.id?{id:e.id}:{},...e.framework?{"data-framework":e.framework}:{}},dj(e.children,t),bj(e.id,t));case`paragraph`:return vj(t,`p`,{key:n},dj(e.children,t));case`code`:return fj(e,t,n);case`list`:return vj(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start!==void 0&&e.start!==1?{start:e.start}:{}},e.items.map((n,r)=>vj(t,`li`,{key:r},pj(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return vj(t,`blockquote`,{key:n},e.children.map((e,r)=>lj(e,t,`${n}:${r}`)));case`table`:return vj(t,`table`,{key:n},vj(t,`thead`,null,vj(t,`tr`,null,e.header.map((n,r)=>mj(`th`,n,e.align[r],t,r)))),e.rows.length?vj(t,`tbody`,null,e.rows.map((n,r)=>vj(t,`tr`,{key:r},n.map((n,r)=>mj(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return hj(e.items,t,n);case`thematicBreak`:return vj(t,`hr`,{key:n});case`html`:return t.allowHtml?vj(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):vj(t,`p`,{key:n},e.value);case`callout`:return vj(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},vj(t,`p`,{className:`markdown-alert-title`},e.title),vj(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>lj(e,t,`${n}:${r}`))));case`component`:return yj(e,t,n)}}function uj(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return vj(t,`code`,{key:n},e.value);case`strong`:return vj(t,`strong`,{key:n},dj(e.children,t));case`emphasis`:return vj(t,`em`,{key:n},dj(e.children,t));case`strike`:return vj(t,`del`,{key:n},dj(e.children,t));case`footnoteReference`:return vj(t,`sup`,{key:n},vj(t,`a`,{id:`user-content-fnref-${MA(e.id,e.referenceIndex)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return vj(t,`a`,{key:n,href:e.href,...e.title?{title:e.title}:{}},dj(e.children,t));case`image`:return vj(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title?{title:e.title}:{}});case`break`:return vj(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?vj(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value}}function dj(e,t){return e.map((e,n)=>uj(e,t,`i:${n}`))}function fj(e,t,n){let r=e.lang??`plaintext`,i=t.highlighter,a={className:`language-${r}`},o=i?void 0:e.value,s=i?{dangerouslySetInnerHTML:{__html:i(e.value,r,{...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})}}:void 0,c=vj(t,`pre`,{className:`tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}`,"data-lang":r,...e.title?{"data-code-title":e.title}:{},...e.file?{"data-filename":e.file}:{},...e.framework?{"data-framework":e.framework}:{}},vj(t,`code`,{...a,...s},o));return e.title?vj(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},vj(t,`figcaption`,null,e.title),c):vj(t,Z.Fragment,{key:n},c)}function pj(e,t,n,r,i){let a=t===void 0?[]:[vj(r,`input`,{key:`${i}:checkbox`,type:`checkbox`,disabled:!0,checked:t,readOnly:!0}),` `];for(let t=0;t<e.length;t++){let o=e[t];if(o.type===`paragraph`&&(!n||t===0)){for(let e of dj(o.children,r))a.push(e);n&&(a=[vj(r,`p`,{key:`${i}:paragraph`},a)])}else a.push(lj(o,r,`${i}:${t}`))}return a}function mj(e,t,n,r,i){return vj(r,e,{key:i,...n?{style:{textAlign:n}}:{}},dj(t.children,r))}function hj(e,t,n){return vj(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},vj(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,bj(`footnote-label`,t)),vj(t,`ol`,null,e.map(e=>vj(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},gj(e,t)))))}function gj(e,t){let n=e.children.length-1,r=_j(e,t),i=e.children.map((e,i)=>i===n&&e.type===`paragraph`?vj(t,`p`,{key:i},dj(e.children,t),r):lj(e,t,`${i}`));return e.children[n]?.type!==`paragraph`&&i.push(vj(t,`p`,{key:`backref-wrapper`},r.slice(1))),i}function _j(e,t){let n=[];for(let r=1;r<=(e.referenceCount??1);r++){let i=MA(e.id,r),a=r===1?`${e.number}`:`${e.number}-${r}`;n.push(` `,vj(t,`a`,{key:r,"data-footnote-backref":``,"aria-label":`Back to reference ${a}`,className:`data-footnote-backref`,href:`#user-content-fnref-${i}`},`↩`))}return n}function vj(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,Z.createElement)(i,n,...r)}function yj(e,t,n){let r=e.tagName??`md-comment-component`,i={...e.properties??{}};return e.tagName||(i[`data-component`]=e.name,i[`data-attributes`]||=JSON.stringify(e.attributes)),vj(t,r,{key:n,...i},e.children.map((e,r)=>lj(e,t,`${n}:${r}`)))}function bj(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return vj(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}var xj=[{key:`archiveDeleteWorktree`,label:`Delete local worktree`},{key:`archiveDeleteLocalBranch`,label:`Delete local branch`},{key:`archiveDeleteRemoteBranch`,label:`Delete remote branch`}];function Sj(e){return{deleteWorktree:e.archiveDeleteWorktree,deleteLocalBranch:e.archiveDeleteLocalBranch,deleteRemoteBranch:e.archiveDeleteRemoteBranch}}var Cj={ts:`ts`,typescript:`ts`,tsx:`tsx`,js:`js`,javascript:`js`,jsx:`jsx`,json:`json`,bash:`sh`,sh:`sh`,shell:`sh`,css:`css`,html:`html`,md:`md`,markdown:`md`,yaml:`yaml`,yml:`yaml`,sql:`sql`,diff:`diff`};function wj(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(wj).join(``):(0,Z.isValidElement)(e)?wj(e.props.children):``}function Tj(e){let t=(0,$.c)(11),{dark:n}=Au(),r=(e[`data-lang`]??`text`).toLowerCase(),i;if(t[0]!==e.children){let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=/\n$/,t[2]=n):n=t[2],i=wj(Z.Children.toArray(e.children)).replace(n,``),t[0]=e.children,t[1]=i}else i=t[1];let a=i,o=`snippet.${Cj[r]??`txt`}`,s;t[3]!==a||t[4]!==o?(s={name:o,contents:a},t[3]=a,t[4]=o,t[5]=s):s=t[5];let c=n?`dark`:`light`,l;t[6]===c?l=t[7]:(l=Vc(c,{overflow:`wrap`}),t[6]=c,t[7]=l);let u;return t[8]!==s||t[9]!==l?(u=(0,Q.jsx)(`div`,{className:`my-3 overflow-hidden rounded-lg border`,children:(0,Q.jsx)(xA,{file:s,options:l})}),t[8]=s,t[9]=l,t[10]=u):u=t[10],u}var Ej={pre:Tj,h1:e=>(0,Q.jsx)(`h1`,{className:`mt-5 mb-2 text-lg font-semibold first:mt-0`,...e}),h2:e=>(0,Q.jsx)(`h2`,{className:`mt-5 mb-2 text-base font-semibold first:mt-0`,...e}),h3:e=>(0,Q.jsx)(`h3`,{className:`mt-4 mb-1.5 text-sm font-semibold`,...e}),p:e=>(0,Q.jsx)(`p`,{className:`my-2 leading-relaxed`,...e}),ul:e=>(0,Q.jsx)(`ul`,{className:`my-2 list-disc pl-5`,...e}),ol:e=>(0,Q.jsx)(`ol`,{className:`my-2 list-decimal pl-5`,...e}),li:e=>(0,Q.jsx)(`li`,{className:`my-0.5`,...e}),a:e=>(0,Q.jsx)(`a`,{className:`text-foreground underline underline-offset-2`,target:`_blank`,rel:`noreferrer`,...e}),code:e=>(0,Q.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[0.9em]`,...e}),blockquote:e=>(0,Q.jsx)(`blockquote`,{className:`my-3 border-l-2 pl-3 text-muted-foreground`,...e}),table:e=>(0,Q.jsx)(`div`,{className:`my-3 overflow-x-auto rounded-lg border`,children:(0,Q.jsx)(`table`,{className:`w-full text-left text-caption`,...e})}),th:e=>(0,Q.jsx)(`th`,{className:`border-b bg-muted/60 px-3 py-1.5 font-medium`,...e}),td:e=>(0,Q.jsx)(`td`,{className:`border-b px-3 py-1.5 last:border-b-0`,...e}),hr:()=>(0,Q.jsx)(`hr`,{className:`my-4`})};function Dj(e){let t=(0,$.c)(7),{text:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Y(`text-ui text-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Q.jsx)(sj,{components:Ej,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsx)(`div`,{className:i,children:a}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var Oj=It(e=>Er(t=>e.paths.map(n=>t(Pi({...e,path:n}))))),kj=It(e=>n((t,n)=>{for(let t of e.paths)n.refresh(Pi({...e,path:t}));return null}));function Aj(e,t,n){let r=(0,$.c)(4),i;return r[0]!==e||r[1]!==n||r[2]!==t?(i=Pi({connection:e,scope:t,path:n}),r[0]=e,r[1]=n,r[2]=t,r[3]=i):i=r[3],$l(i).value}function jj(e,t,n){let r=(0,$.c)(14),i={connection:e,scope:t,paths:n},a=at(Oj(i)),o=y(kj(i)),s;if(r[0]!==n||r[1]!==a){let e;r[3]===a?e=r[4]:(e=(e,t)=>{let n=a[t],r=n?Gn(ar(n)):void 0;return r&&`text`in r?[[e,r.text]]:[]},r[3]=a,r[4]=e),s=new Map(n.flatMap(e)),r[0]=n,r[1]=a,r[2]=s}else s=r[2];let c;r[5]===a?c=r[6]:(c=a.some(M),r[5]=a,r[6]=c);let l;r[7]===a?l=r[8]:(l=a.some(st),r[7]=a,r[8]=l);let u;return r[9]!==o||r[10]!==s||r[11]!==c||r[12]!==l?(u={contents:s,pending:c,failed:l,retry:o},r[9]=o,r[10]=s,r[11]=c,r[12]=l,r[13]=u):u=r[13],u}var Mj=(0,Z.lazy)(()=>Ru(()=>import(`./file-editor-CpwgQA6Z.js`),__vite__mapDeps([0,1,2,3,4])));function Nj(e){let t=(0,$.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(`p`,{role:`status`,className:`p-3.5 text-xs text-muted-foreground`,children:`Loading editor…`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,Q.jsx)(Z.Suspense,{fallback:n,children:(0,Q.jsx)(Mj,{...e})}),t[1]=e,t[2]=r),r}var Pj=/url\(\s*(['"]?)([^)'"]+)\1\s*\)|@import\s+(['"])([^'"]+)\3/g,Fj=it(`BrowserHtmlPreview.inlineAssets`)(function*(e,t,n){let r=`https://porcelain-preview.invalid/`,i=t.includes(`/`)?`${t.slice(0,t.lastIndexOf(`/`))}/`:``,a=new URL(i,r),o=new Set,s=new Map,c=0;function l(e,t){if(e.startsWith(`data:`)||e.startsWith(`#`))return null;let n=new URL(e,new URL(t,r));if(n.origin!==a.origin)throw Error(`External asset`);if(!n.pathname.startsWith(a.pathname))throw Error(`Outside the document folder`);return{path:decodeURIComponent(n.pathname.slice(1)),hash:n.hash}}function u(e,t){let n=[];for(let r of e.matchAll(Pj)){let e=(r[2]??r[4]??``).trim();try{let r=l(e,t);r&&n.push(r.path)}catch{o.add(e)}}return n}function d(e){return new TextDecoder().decode(Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)))}function f(e,t,n){try{let r=l(e,t);if(r===null)return e;let i=s.get(r.path);if(!i)throw Error(`Unavailable`);if(n.includes(r.path))throw Error(`Circular stylesheet`);let a=(i.mediaType===`text/css`?`data:text/css;charset=utf-8,${encodeURIComponent(p(d(i),r.path,[...n,r.path]))}`:hw(i))+r.hash;if(c+a.length>29360128)throw Error(`Expanded preview too large`);return c+=a.length,a}catch{return o.add(e),`data:,`}}function p(e,t,n=[]){let r=``,i=0;for(let a of e.matchAll(Pj)){r+=e.slice(i,a.index);let o=f((a[2]??a[4]??``).trim(),t,n);r+=a[4]?`@import url("${o}")`:`url("${o}")`,i=a.index+a[0].length}return r+e.slice(i)}let m=new DOMParser().parseFromString(e,`text/html`);for(let e of m.querySelectorAll(`base, meta[http-equiv]`))e.remove();let h=[...m.querySelectorAll(`link[href], img[src], script[src], source[src], video[poster], image[href]`)].map(e=>({node:e,attribute:e.hasAttribute(`href`)?`href`:e.hasAttribute(`poster`)?`poster`:`src`})),g=[...m.querySelectorAll(`[srcset]`)],_=[...m.querySelectorAll(`style`),...m.querySelectorAll(`[style]`)],v=[],y=e=>{try{let n=l(e,t);n&&v.push(n.path)}catch{o.add(e)}};for(let{node:e,attribute:t}of h)y(e.getAttribute(t)??``);for(let e of g)for(let t of Ij(e.getAttribute(`srcset`)??``))y(t.url);for(let e of _)v.push(...u(e.tagName===`STYLE`?e.textContent??``:e.getAttribute(`style`)??``,t));s=yield*ai(v,n,u);for(let{node:e,attribute:n}of h)e.setAttribute(n,f(e.getAttribute(n)??``,t,[])),e.removeAttribute(`integrity`),e.removeAttribute(`crossorigin`);for(let e of g)e.setAttribute(`srcset`,Ij(e.getAttribute(`srcset`)??``).map(e=>`${f(e.url,t,[])}${e.descriptor?` ${e.descriptor}`:``}`).join(`, `));for(let e of m.querySelectorAll(`style`))e.textContent=p(e.textContent??``,t);for(let e of m.querySelectorAll(`[style]`))e.setAttribute(`style`,p(e.getAttribute(`style`)??``,t));let b=m.createElement(`meta`);return b.httpEquiv=`Content-Security-Policy`,b.content=`default-src 'none'; script-src 'unsafe-inline' data:; style-src 'unsafe-inline' data:; img-src data: blob:; font-src data:; connect-src 'none'; form-action 'none'; base-uri 'none'`,m.head.prepend(b),{html:`<!doctype html>${m.documentElement.outerHTML}`,missing:[...o]}});function Ij(e){return[...e.matchAll(/(data:[^\s]+|[^,\s]+)(?:\s+(\d+(?:\.\d+)?[wx]))?\s*,?/g)].map(e=>({url:(e[1]??``).replace(/,$/,``),descriptor:e[2]??``}))}var Lj=Wr(Jr,{render:(e,t,n)=>Fj(e,t,n).pipe(gn(()=>Ye(new Zn)))});function Rj(e){let t=(0,$.c)(9),{html:n,title:r,className:i}=e,{dark:a}=Au(),o=a?`dark`:`light`,s;t[0]===o?s=t[1]:(s={colorScheme:o},t[0]=o,t[1]=s);let c;t[2]===i?c=t[3]:(c=Y(`block min-h-128 w-full border-0 bg-transparent`,i),t[2]=i,t[3]=c);let l;return t[4]!==n||t[5]!==s||t[6]!==c||t[7]!==r?(l=(0,Q.jsx)(`iframe`,{title:r,"aria-label":r,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,srcDoc:n,style:s,className:c}),t[4]=n,t[5]=s,t[6]=c,t[7]=r,t[8]=l):l=t[8],l}function zj(e){let t=(0,$.c)(14),{scope:n,path:r,html:i,connection:a}=e,o=_w(a,n,r,i,Lj);if(M(o)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading preview…`}),t[0]=e):e=t[0],e}if(st(o)){let e;t[1]===o.cause?e=t[2]:(e=Zc(nt(o.cause)),t[1]=o.cause,t[2]=e);let n;return t[3]===e?n=t[4]:(n=(0,Q.jsx)(`p`,{role:`alert`,className:`p-4`,children:e}),t[3]=e,t[4]=n),n}let s,c;t[5]===o?(s=t[6],c=t[7]):(s=br(ar(o)),c=s.missing.length>0&&(0,Q.jsxs)(`p`,{role:`status`,className:`px-4 py-2 text-xs text-muted-foreground`,children:[`Some assets could not be loaded: `,s.missing.join(`, `),`. This preview supports local static assets.`]}),t[5]=o,t[6]=s,t[7]=c);let l=`${r} HTML preview`,u;t[8]!==s.html||t[9]!==l?(u=(0,Q.jsx)(Rj,{html:s.html,title:l,className:`min-h-0 flex-1`}),t[8]=s.html,t[9]=l,t[10]=u):u=t[10];let d;return t[11]!==c||t[12]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function Bj(e,t,n){let r=(0,$.c)(4),i;return r[0]!==e||r[1]!==n||r[2]!==t?(i=zi({connection:e,scope:t,path:n}),r[0]=e,r[1]=n,r[2]=t,r[3]=i):i=r[3],$l(i).value}function Vj(e,t,n){let r=(0,$.c)(3),i={connection:e,scope:t,paths:n},a=at(yi(i)),o=y(Qt(i)),s;return r[0]!==a||r[1]!==o?(s={results:a,retry:o},r[0]=a,r[1]=o,r[2]=s):s=r[2],s}function Hj({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=Z.useState(0),[u,f]=Z.useState(0),p=c===0,m=Es(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=d(t);if(p&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||dr(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return Ea(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),f(t)}),Rr(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),fo(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var Uj=Z.createContext(void 0);function Wj(e){let t=Z.useContext(Uj);if(!e&&t===void 0)throw Error(An(27));return t}var Gj={...dd,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Kj=class extends un{constructor(e,t,n){let r=new ta,i=Jj(e,r,t,n);super(i,Yj(r),Gj)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(wa(this.state,e,t.trigger)))}};function qj(){let e=new ta;return new Qp(Object.freeze(Jj(void 0,e)),Object.freeze(Yj(e)),Gj)}function Jj(e,t,n,r=!1){return{...ad(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function Yj(e){return{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Xj(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=Wj(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=co((e,t)=>new Kj({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);ho(b,x),Ss(b);let{forceUnmount:w}=xa(x,b);Z.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,_r(qn))}),[w,b]);let T=x||S;return(0,Q.jsxs)(Uj.Provider,{value:b,children:[u&&(0,Q.jsx)(ha,{handle:u,store:b}),T&&(0,Q.jsx)(Hj,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}function Zj(e){return Xj(`alert-dialog`,e)}var Qj=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Wj(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d={open:c,transitionStatus:s.useState(`transitionStatus`)};return U(`div`,e,{state:d,ref:[s.context.backdropRef,t],stateAttributesMapping:Vs,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),$j=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=Wj(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=D({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,_r(bn,e.nativeEvent))}return U(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),eM=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Wj(),c=aa(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),U(`p`,e,{ref:t,props:[{id:c},o]})}),tM=Z.createContext(void 0);function nM(){let e=Z.useContext(tM);if(e===void 0)throw Error(An(26));return e}var rM=`--nested-dialogs`,iM=`data-nested-dialog-open`,aM={...yo,...an,nestedDialogOpen(e){return e?{[iM]:``}:null}},oM=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Wj(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);nM(),Ue({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?fa(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=U(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...no,hidden:!m,onKeyDown(e){$o.has(e.key)&&e.stopPropagation()},style:{[rM]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:aM});return(0,Q.jsx)(Co,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),sM=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Wj(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,Q.jsx)(tM.Provider,{value:n,children:(0,Q.jsxs)(Jt,{ref:t,...r,children:[a&&o===!0&&(0,Q.jsx)(Ua,{ref:i.context.internalBackdropRef,inert:_t(!s)}),e.children]})}):null}),cM=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Wj(),c=aa(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),U(`h2`,e,{ref:t,props:[{id:c},o]})}),lM=vn(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=Wj(!0),f=fd(l)??d;if(!f)throw Error(An(79));let p=aa(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=Z.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=Va(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=D({disabled:a,native:o}),S=Jo(m),C=Qa(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return U(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[Ce]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:Do})}),uM=class extends id{constructor(){super(qj(),`Dialog`,!1)}open(e){this.openByTrigger(e)}openWithPayload(e){let t=this.attachedStore;t!==null&&(t.set(`payload`,e),t.setOpen(!0,_r(qn)))}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function dM(){return new uM}var fM=class extends uM{};function pM(){return new fM}function mM({...e}){return(0,Q.jsx)(Zj,{"data-slot":`alert-dialog`,...e})}function hM({...e}){return(0,Q.jsx)(sM,{"data-slot":`alert-dialog-portal`,...e})}function gM({className:e,...t}){return(0,Q.jsx)(Qj,{"data-slot":`alert-dialog-overlay`,className:Y(`fixed inset-0 isolate z-50 bg-black/30 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function _M({className:e,size:t=`default`,...n}){return(0,Q.jsxs)(hM,{children:[(0,Q.jsx)(gM,{}),(0,Q.jsx)(oM,{"data-slot":`alert-dialog-content`,"data-size":t,className:Y(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-[min(var(--radius-4xl),24px)] bg-popover p-6 text-popover-foreground shadow-xl ring-1 ring-foreground/5 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-md dark:ring-foreground/10 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`,e),...n})]})}function vM({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:Y(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function yM({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:Y(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function bM({className:e,...t}){return(0,Q.jsx)(cM,{"data-slot":`alert-dialog-title`,className:Y(`font-heading text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function xM({className:e,...t}){return(0,Q.jsx)(eM,{"data-slot":`alert-dialog-description`,className:Y(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function SM({className:e,...t}){return(0,Q.jsx)(X,{"data-slot":`alert-dialog-action`,className:Y(e),...t})}function CM({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,Q.jsx)($j,{"data-slot":`alert-dialog-cancel`,className:Y(e),render:(0,Q.jsx)(X,{variant:t,size:n}),...r})}var wM=Z.createContext(void 0);function TM(e){let t=Z.useContext(wM);if(t===void 0&&!e)throw Error(An(33));return t}var EM=Z.createContext(void 0);function DM(e){let t=Z.useContext(EM);if(t===void 0&&!e)throw Error(An(36));return t}var OM=Z.createContext(void 0);function kM(e=!0){let t=Z.useContext(OM);if(t===void 0&&!e)throw Error(An(25));return t}var AM=Z.createContext(void 0);function jM(){let e=Z.useContext(AM);if(e===void 0)throw Error(An(30));return e}function MM(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=kM(!0),f=d!==void 0;return Z.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:Ht})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!ne&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&ke(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var NM={type:`regular-item`};function PM(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=Z.useRef(null),{getButtonProps:d,buttonRef:f}=D({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=MM({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Z.useCallback(e=>dt(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=B(u,f);return Z.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var FM=`data-checked`,IM=`data-unchecked`,LM={checked(e){return e?{[FM]:``}:{[IM]:``}},...an},RM=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l,defaultChecked:u,onCheckedChange:d,style:f,...p}=e,m=ra({guess:!0,label:a}),h=TM(!0),g=aa(i),{store:_}=DM(),v=_.useState(`disabled`),y=s||v,b=_.useState(`isActive`,m.index),x=_.useState(`itemProps`),[S,C]=uo({controlled:l,default:u??!1,name:`MenuCheckboxItem`,state:`checked`}),{getItemProps:w,itemRef:T}=PM({closeOnClick:c,disabled:y,highlighted:b,id:g,store:_,nativeButton:o,nodeId:h?.context.nodeId,itemMetadata:NM}),E=Z.useMemo(()=>({disabled:y,highlighted:b,checked:S}),[y,b,S]);function D(e){let t=_r(Ht,e.nativeEvent,void 0,{preventUnmountOnClose:Si});d?.(!S,t),!t.isCanceled&&C(e=>!e)}let O=U(`div`,e,{state:E,stateAttributesMapping:LM,props:[x,{role:`menuitemcheckbox`,"aria-checked":S,onClick:D},p,w],ref:[T,t,m.ref]});return(0,Q.jsx)(AM.Provider,{value:E,children:O})}),zM=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=jM(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Po(s.checked);Ue({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}});let f={checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l};return U(`span`,e,{state:f,ref:[t,c],stateAttributesMapping:LM,props:{"aria-hidden":!0,...o},enabled:a||u})}),BM=Z.createContext(void 0);function VM(){let e=Z.useContext(BM);if(e===void 0)throw Error(An(31));return e}var HM=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(void 0),c=U(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,Q.jsx)(BM.Provider,{value:s,children:c})}),UM=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=aa(a),c=VM();return Rr(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),U(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),WM=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=ra({guess:!0,label:a}),f=TM(!0),p=aa(i),{store:m}=DM(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=PM({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:NM});return U(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),GM=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=DM(),{side:c,align:l}=TM(),u=La(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;Ue({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Z.useEffect(()=>{function e(e){s.setOpen(!1,_r(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),bd(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O={transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},k=U(`div`,e,{state:O,ref:[t,s.context.popupRef,D],stateAttributesMapping:Vs,props:[p,{onKeyDown(e){u&&$o.has(e.key)&&e.stopPropagation()}},la(f),o,{"data-rootownerid":y}]}),A=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(A=!0),(0,Q.jsx)(Co,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?A:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:k})}),KM=Z.createContext(void 0);function qM(){let e=Z.useContext(KM);if(e===void 0)throw Error(An(32));return e}var JM=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=DM();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,Q.jsx)(KM.Provider,{value:n,children:(0,Q.jsx)(Jt,{ref:t,...r,portalOwnerRole:o})})}),YM=Z.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=L,style:g,..._}=e,{store:v}=DM(),y=qM(),b=kM(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`adaptiveOrigin`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),F=v.useState(`floatingParentNodeId`),I=S.useState(`domReferenceElement`),R=Z.useRef(null),z=Ki(A),B=n,V=c,H=l,U=s,W=h;x.type===`context-menu`&&(B=n??x.context?.anchor,U??=`start`,!o&&U!==`center`&&(H=e.alignOffset??2,V=e.sideOffset??-5));let G=o,ee=U;x.type===`menu`?(G??=`inline-end`,ee??=`start`,W=e.collisionAvoidance??ue):x.type===`menubar`&&(G??=x.context.orientation===`vertical`?`inline-end`:`bottom`,ee??=`start`);let te=x.type===`context-menu`,K=va({anchor:B,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:G,sideOffset:V,align:ee,alignOffset:H,arrowPadding:te?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:W,shift:te?{crossAxis:!(`side`in W&&W.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});Z.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,_r(Qe)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),Z.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,_r(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ne=Ge();Z.useEffect(()=>{T||ne.clear()},[T,ne]),Z.useEffect(()=>{function e(e){if(T&&e.nodeId===v.select(`floatingParentNodeId`)){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?ne.isStarted()||ne.start(e,()=>{v.setOpen(!1,_r(Qe))}):v.setOpen(!1,_r(Qe))}else ne.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,ne]),Z.useEffect(()=>{let e={open:T,nodeId:P,parentNodeId:F,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,F]),Rr(()=>{let e=I,t=R.current;if(e&&(R.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return z(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,z,v]);let q={open:T,side:K.side,align:K.align,anchorHidden:K.anchorHidden,nested:x.type===`menu`,instant:j},re=x.type===`menubar`&&x.context.modal;_a(T&&(re||E&&N!==`trigger-hover`),D===`touch`,A,O);let ie=Ra(e,q,{styles:K.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),ae=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),oe=null;return x.type===`menubar`?oe=x.context.contentElement:x.type===void 0&&(oe=O),(0,Q.jsxs)(wM.Provider,{value:K,children:[ae&&(0,Q.jsx)(Ua,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:_t(!T),cutout:oe}),(0,Q.jsx)(gs,{id:P,children:(0,Q.jsx)(Zs,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:ie})})]})}),XM=Z.createContext(void 0);function ZM(){let e=Z.useContext(XM);if(e===void 0)throw Error(An(34));return e}var QM=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=Z.useState(void 0),[p,m]=uo({controlled:i,default:a,name:`MenuRadioGroup`}),h=gr((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=U(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=Z.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,Q.jsx)(BM.Provider,{value:f,children:(0,Q.jsx)(XM.Provider,{value:_,children:g})})})),$M=Z.createContext(void 0);function eN(){let e=Z.useContext($M);if(e===void 0)throw Error(An(35));return e}var tN=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=ra({guess:!0,label:a}),p=TM(!0),m=aa(i),{store:h}=DM(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=ZM(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=PM({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:NM}),E=Z.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=_r(Ht,e.nativeEvent,void 0,{preventUnmountOnClose:Si});y(l,t)}let O=U(`div`,e,{state:E,stateAttributesMapping:LM,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,Q.jsx)($M.Provider,{value:E,children:O})}),nN=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=eN(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Po(s.checked);Ue({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}});let f={checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l};return U(`span`,e,{state:f,stateAttributesMapping:LM,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),rN=Z.createContext(null);function iN(e){let t=Z.useContext(rN);if(t===null&&!e)throw Error(An(5));return t}var aN={...dd,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},oN=class extends un{constructor(e,t,n=!1){let r=new ta,i=cN(r,t,n,e);super(i,sN(r),aN),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function sN(e){return{positionerRef:Z.createRef(),popupRef:Z.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function cN(e,t,n=!1,r){return{...ad(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Mo,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Vt,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var lN=Z.createContext(void 0);function uN(){return Z.useContext(lN)}var dN=gi(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=kM(!0),_=DM(!0),v=iN(!0),y=uN(),b=Z.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=ir(),S=ir(),C=is(),w=b.type===`menu`?b.store:void 0,T=(n??a)&&w?.state.transitionStatus===`starting`,E=xr(()=>T?w?.state.instantType:void 0).current,D=fN({open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b,disabled:o,highlightItemOnHover:h,modal:b.type===void 0?s:void 0,rootId:x,instantType:E},S,C!=null);D.useControlledProp(`openProp`,n),D.useControlledProp(`triggerIdProp`,p),D.useContextCallback(`onOpenChangeComplete`,i);let O=D.useState(`floatingTreeRoot`),k=ko(O),A=D.useState(`open`),j=D.useState(`activeTriggerElement`),M=D.useState(`positionerElement`),N=D.useState(`hoverEnabled`),P=D.useState(`disabled`),F=D.useState(`lastOpenChangeReason`),I=D.useState(`parent`),L=D.useState(`activeIndex`),R=D.useState(`payload`),z=D.useState(`floatingParentNodeId`),B=Z.useRef(null),V=Z.useRef(I.type!==`context-menu`),H=Ge(),U=Z.useRef(!0),W=Ge(),G=z!=null,{openMethod:ee,triggerProps:te}=ma(A);D.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:I.type===void 0?s:void 0,openMethod:ee,rootId:x}),Ss(D);let{forceUnmount:K,transitionStatus:ne}=xa(A,D,()=>{D.set(`allowMouseEnter`,!1)},T),q=Ki(D.context.popupRef);Z.useEffect(()=>{if(E===void 0)return;let e=()=>{D.state.instantType===E&&D.set(`instantType`,void 0)};if(!A){e();return}if(ne!==void 0)return;if(D.context.popupRef.current==null){e();return}let t=new AbortController;return q(e,t.signal),()=>{t.abort()}},[E,A,ne,q,D]),Rr(()=>{g&&!_?D.update({parent:{type:`context-menu`,context:g},floatingNodeId:k,floatingParentNodeId:C}):_&&D.update({floatingNodeId:k,floatingParentNodeId:C})},[g,_,k,C,D]),Z.useEffect(()=>{if(A||(B.current=null),I.type===`context-menu`){if(!A){H.clear(),V.current=!1;return}H.start(500,()=>{V.current=!0})}},[H,A,I.type]),Rr(()=>{!A&&!N&&D.set(`hoverEnabled`,!0)},[A,N,D]);let re=gr((e,t)=>{let n=t.reason;if(!e&&!D.select(`open`)||A===e&&t.trigger===j&&F===n)return;let i=ao(t);if(!e&&t.trigger==null&&(t.trigger=j??void 0),r?.(e,t),t.isCanceled)return;D.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!U.current)return;e&&n===`trigger-focus`?(U.current=!1,W.start(300,()=>{U.current=!0})):(U.current=!0,W.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null);B.current=t.event;let c=wa(D.state,e,t.trigger,i());c.openChangeReason=n,c.instantType=I.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:o||s?o?`click`:`dismiss`:void 0,D.update(c)}),ie=Ns({popupStore:D,floatingRootContext:D.state.floatingRootContext,floatingId:S,nested:C!=null,onOpenChange:re}),ae=ie.context.events;Rr(()=>{let e=({open:e,eventDetails:t})=>re(e,t);return ae.on(`setOpen`,e),()=>{ae?.off(`setOpen`,e)}},[ae,re]);let oe=Z.useCallback(()=>{D.setOpen(!1,_r(qn))},[D]);Z.useImperativeHandle(u,()=>({unmount:K,close:oe}),[K,oe]);let se;I.type===`context-menu`&&(se=I.context),Z.useImperativeHandle(se?.positionerRef,()=>M,[M]),Z.useImperativeHandle(se?.actionsRef,()=>({setOpen:re}),[re]);let ce=Es(ie,{enabled:!P,bubbles:{escapeKey:d&&I.type===`menu`},outsidePress(){return I.type!==`context-menu`||B.current?.type===`contextmenu`||V.current},externalTree:G?O:void 0}),le=Da(),ue=Z.useCallback(e=>{D.select(`activeIndex`)!==e&&D.set(`activeIndex`,e)},[D]),de=Qs(ie,{enabled:!P,listRef:D.context.itemDomElements,activeIndex:L,nested:I.type!==void 0,loopFocus:c,orientation:l,parentOrientation:I.type===`menubar`?I.context.orientation:void 0,rtl:le===`rtl`,disabledIndices:Rn,onNavigate:ue,openOnArrowKeyDown:I.type!==`context-menu`,externalTree:G?O:void 0,focusItemOnHover:h}),fe=Z.useCallback(e=>{D.context.typingRef.current=e},[D]),pe=Wa(ie,{enabled:!P,listRef:D.context.itemLabels,elementsRef:D.context.itemDomElements,activeIndex:L,resetMs:500,onMatch:e=>{A&&e!==L&&D.set(`activeIndex`,e)},onTyping:fe}),me=Z.useMemo(()=>{let e=dt(pe.reference,de.reference,ce.reference,{onMouseMove(){D.set(`allowMouseEnter`,!0)}},te);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=A,e},[D,pe.reference,de.reference,ce.reference,te,A]),he=Z.useMemo(()=>{let e=dt(de.trigger,ce.trigger,te);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[de.trigger,ce.trigger,te]);xr(()=>(D.update({inactiveTriggerProps:he}),null));let ge=Z.useMemo(()=>dt(no,{id:S,role:`menu`,"aria-orientation":l===`horizontal`?`horizontal`:void 0,"aria-labelledby":j?.id,onMouseMove(){D.set(`allowMouseEnter`,!0),I.type===`menu`&&D.set(`hoverEnabled`,!1)},onClick(){D.select(`hoverEnabled`)&&D.set(`hoverEnabled`,!1)},onKeyDown(e){let t=D.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},pe.floating,de.floating,ce.floating),[j,S,l,I.type,D,pe.floating,de.floating,ce.floating]),_e=de.item??Vt;fo(D,{floatingRootContext:ie,activeTriggerProps:me,inactiveTriggerProps:he,popupProps:ge,itemProps:_e});let ve=Z.useMemo(()=>({store:D,parent:b}),[D,b]),ye=(0,Q.jsxs)(EM.Provider,{value:ve,children:[f&&(0,Q.jsx)(ha,{handle:f,store:D}),typeof t==`function`?t({payload:R}):t]});return I.type===void 0||I.type===`context-menu`?(0,Q.jsx)(ks,{externalTree:O,children:ye}):ye});function fN(e,t,n){return xr(()=>new oN(e,t,n)).current}function pN(e){let t=DM().store,n=Z.useMemo(()=>({parentMenu:t}),[t]);return(0,Q.jsx)(lN.Provider,{value:n,children:(0,Q.jsx)(dN,{...e})})}function mN(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=u(),{ref:i,index:a}=ra(e),o=n===a,s=Z.useRef(null),c=B(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function hN(e){let{render:t,className:n,style:r,state:i=Vt,props:a=Rn,refs:o=Rn,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=mN({metadata:s});return U(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function gN(e){if(li(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!Or(e))return gN(Rt(e))}function _N(e,t){let n=Z.useRef(null);function r(t){rd.flushSync(()=>{e.setOpen(!1,_r(Cr,t.nativeEvent,t.currentTarget))}),i(n.current)?.focus()}function a(n){let r=e.select(`positionerElement`);if(r&&Dn(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{rd.flushSync(()=>{e.setOpen(!1,_r(Cr,n.nativeEvent,n.currentTarget))});let i=Le(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&dr(r,i);){let e=i;if(i=Dt(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:a}}function vN(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Z.useRef(!1);return Z.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,G(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Vt,[t,n,r])}var yN=vn(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:d=0,handle:f,payload:p,...m}=e,h=DM(!0),g=fd(f)??h?.store;if(!g)throw Error(An(85));let _=aa(s),v=g.useState(`isTriggerActive`,_),y=g.useState(`floatingRootContext`),b=g.useState(`isOpenedByTrigger`,_),x=g.useState(`triggerPopupId`,_),S=Z.useRef(null),C=xN(),w=u(!0),T=Ls(),E=Z.useMemo(()=>T??new Mo,[T]),O=ko(E),k=is(),{registerTrigger:A,isMountedByThisTrigger:j}=Va(_,S,g,{payload:p,closeDelay:d,parent:C,floatingTreeRoot:E,floatingNodeId:O,floatingParentNodeId:k,keyboardEventRelay:w?.relayKeyboardEvent}),M=C.type===`menubar`,N=g.useState(`disabled`),P=a||N||M&&C.context.disabled,{getButtonProps:F,buttonRef:I}=D({disabled:P,native:o});Z.useEffect(()=>{!b&&C.type===void 0&&(g.context.allowMouseUpTriggerRef.current=!1)},[g,b,C.type]);let L=Z.useRef(null),R=Ge(),z=gr(e=>{if(!L.current)return;R.clear(),g.context.allowMouseUpTriggerRef.current=!1;let t=e.target;dr(L.current,t)||dr(g.select(`positionerElement`),t)||t===L.current||(t==null||gN(t)!==g.select(`rootId`))&&(ea(e,L.current)||E.events.emit(`close`,{domEvent:e,reason:_i}))});Z.useEffect(()=>{b&&g.select(`lastOpenChangeReason`)===`trigger-hover`&&G(L.current).addEventListener(`mouseup`,z,{once:!0})},[b,z,g]);let B=M&&C.context.hasSubmenuOpen,V=Sd(y,{enabled:(c??B)&&!P&&(!M||B&&!j),handleClose:Ad({blockPointerEvents:!M}),mouseOnly:!0,move:!1,restMs:C.type===void 0?l:void 0,delay:{close:d},triggerElementRef:S,externalTree:E,isActiveTrigger:v,isClosing:()=>g.select(`transitionStatus`)===`ending`}),H=bN(b,g.select(`lastOpenChangeReason`)),W=Jo(y,{enabled:!P,event:b&&M?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:C.type===void 0&&H}),ee=md(y,{enabled:!P&&B}),te=vN({open:b,enabled:M,mouseDownAction:`open`}),K=Z.useMemo(()=>dt(ee.reference,W.reference),[ee.reference,W.reference]),ne=g.useState(`triggerProps`,j),{preFocusGuardRef:q,handlePreFocusGuardFocus:re,handleFocusTargetFocus:ie}=_N(g,S),oe={disabled:P,open:b},se=[L,t,I,A,S],ce=[K,V??Vt,ne,{"aria-haspopup":`menu`,"aria-controls":x,id:_,onMouseDown:e=>{g.select(`open`)||(R.start(200,()=>{g.context.allowMouseUpTriggerRef.current=!0}),G(e.currentTarget).addEventListener(`mouseup`,z,{once:!0}))}},M?{role:`menuitem`}:{},te,m,F],le=U(`button`,e,{enabled:!M,stateAttributesMapping:Xs,state:oe,ref:se,props:ce});return M?(0,Q.jsx)(hN,{tag:`button`,render:n,className:r,style:i,state:oe,refs:se,props:ce,stateAttributesMapping:Xs}):b?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(ae,{ref:q,onFocus:re},`${_}-pre-focus-guard`),(0,Q.jsx)(Z.Fragment,{children:le},_),(0,Q.jsx)(ae,{ref:g.context.triggerFocusTargetRef,onFocus:ie},`${_}-post-focus-guard`)]}):(0,Q.jsx)(Z.Fragment,{children:le},_)});function bN(e,t){let n=Ge(),[r,i]=Z.useState(!1);return Rr(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function xN(){let e=iN(!0);return Z.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var SN={"aria-expanded":void 0},CN=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:u=0,disabled:d=!1,...f}=e,p=uN();if(!p?.parentMenu)throw Error(An(37));let m=ra({guess:!0,label:a}),h=TM(),{store:g}=DM(),_=aa(o),v=g.useState(`open`),y=g.useState(`floatingRootContext`),b=g.useState(`floatingTreeRoot`),x=g.useState(`triggerPopupId`,_),S=Xi(_,g),C=gr(e=>{S(e),e!==null&&g.select(`open`)&&g.select(`activeTriggerId`)==null&&g.update({activeTriggerId:_??null,activeTriggerElement:e,closeDelay:u})}),w=Z.useRef(null),T=Z.useCallback(e=>{w.current=e,g.set(`activeTriggerElement`,e)},[g]);Rr(()=>(C(w.current),()=>C(null)),[C,_,g]),g.useSyncedValue(`closeDelay`,u);let E=p.parentMenu,D=g.useState(`disabled`),O=E.useState(`disabled`),k=d||D||O,A=E.useState(`itemProps`),j=E.useState(`isActive`,m.index),M=Z.useMemo(()=>({type:`submenu-trigger`,setActive(){E.select(`highlightItemOnHover`)&&E.set(`activeIndex`,m.index)}}),[E,m.index]),{getItemProps:N,itemRef:P}=PM({closeOnClick:!1,disabled:k,highlighted:j,id:_,store:g,typingRef:E.context.typingRef,nativeButton:s,itemMetadata:M,nodeId:h?.context.nodeId}),F=Sd(y,{enabled:g.useState(`hoverEnabled`)&&c&&!k,handleClose:Ad({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:{open:l,close:u},shouldOpen:l>0?()=>E.select(`allowMouseEnter`):void 0,triggerElementRef:w,externalTree:b,isClosing:()=>g.select(`transitionStatus`)===`ending`,guardStaleOpen:!0}),I=Jo(y,{enabled:!k,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??Vt,L=g.useState(`triggerProps`,!0);delete L.id;let R={disabled:k,highlighted:j,open:v},z=g.useState(`openMethod`),B=g.useState(`lastOpenChangeReason`)===`list-navigation`||z===`keyboard`;return U(`div`,e,{state:R,stateAttributesMapping:Do,props:[I,F,L,A,v&&B&&ve?SN:void 0,{"aria-controls":x,tabIndex:v||j?0:-1,onBlur(){j&&E.set(`activeIndex`,null)}},f,N],ref:[t,m.ref,P,C,T]})});function wN({...e}){return(0,Q.jsx)(dN,{"data-slot":`dropdown-menu`,...e})}function TN({...e}){return(0,Q.jsx)(yN,{"data-slot":`dropdown-menu-trigger`,...e})}function EN({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,Q.jsx)(JM,{children:(0,Q.jsx)(YM,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,Q.jsx)(GM,{"data-slot":`dropdown-menu-content`,className:Y(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,i),...a})})})}function DN({...e}){return(0,Q.jsx)(HM,{"data-slot":`dropdown-menu-group`,...e})}function ON({className:e,inset:t,...n}){return(0,Q.jsx)(UM,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:Y(`px-2 py-1 text-xs text-muted-foreground data-inset:pl-7`,e),...n})}function kN({className:e,inset:t,variant:n=`default`,...r}){return(0,Q.jsx)(WM,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:Y(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]: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 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function AN({...e}){return(0,Q.jsx)(pN,{"data-slot":`dropdown-menu-sub`,...e})}function jN({className:e,inset:t,children:n,...r}){return(0,Q.jsxs)(CN,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:Y(`flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,Q.jsx)(Zo,{className:`ml-auto`})]})}function MN({align:e=`start`,alignOffset:t=-3,side:n=`right`,sideOffset:r=0,className:i,...a}){return(0,Q.jsx)(EN,{"data-slot":`dropdown-menu-sub-content`,className:Y(`w-auto min-w-[96px] rounded-2xl p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 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 dark:ring-foreground/10 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 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,i),align:e,alignOffset:t,side:n,sideOffset:r,...a})}function NN({className:e,children:t,checked:n,inset:r,...i}){return(0,Q.jsxs)(RM,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:Y(`relative flex min-h-7 cursor-default items-center gap-2 rounded-xl py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground 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`,e),checked:n,...i,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,Q.jsx)(zM,{children:(0,Q.jsx)(o,{})})}),t]})}function PN({...e}){return(0,Q.jsx)(QM,{"data-slot":`dropdown-menu-radio-group`,...e})}function FN({className:e,children:t,inset:n,...r}){return(0,Q.jsxs)(tN,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:Y(`relative flex min-h-7 cursor-default items-center gap-2 rounded-xl py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground 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`,e),...r,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,Q.jsx)(nN,{children:(0,Q.jsx)(o,{})})}),t]})}function IN({className:e,...t}){return(0,Q.jsx)(wm,{"data-slot":`dropdown-menu-separator`,className:Y(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var LN=`160000`;function RN(e){return e.oldMode===LN||e.newMode===LN}function zN(e){return e.kind===`text`||e.kind===`metadata-only`}function BN(e,t){return RN(e)||t?.kind!==`text`?null:e.newPath??e.oldPath??null}function VN(e){switch(e){case`size-limit`:return`Too large to show`;case`unsupported-submodule`:return`Submodule change`;case`unsupported-encoding`:return`Unsupported text encoding`}}function HN(e){switch(e.kind){case`binary`:return`Binary change`;case`metadata-only`:return`No code change`;case`omitted`:return VN(e.reason);case`text`:return}}function UN(e,t,n){return RN(e)?`Submodule change`:t===void 0?n?`The patch could not be read`:`Reading the patch`:HN(t)}function WN(e){return e.scope===`staged`||e.scope===`unstaged`?{scope:e.scope,oldPath:e.oldPath,newPath:e.newPath}:void 0}var GN=/(?=^From [a-f0-9]+ .+$)/m,KN=/(?=^diff --git)/gm,qN=/^(---|\+\+\+)\s+([^\t\r\n]+)/,JN=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,YN=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,XN=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;Object.freeze({fromStart:0,fromEnd:0});function ZN(e,t){return e-(t===0?0:1)}function QN(e,t){return ZN(e,t)+t}var $N=1;function eP(e,...t){return`ck${$N}:${JSON.stringify([e,...t])}`}function tP(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var nP=new TextEncoder,rP=new TextDecoder(`utf-8`,{ignoreBOM:!0}),iP=/[\uD800-\uDFFF]/,aP=1024,oP=new Uint8Array(aP);function sP(){oP.length!==aP&&(oP=new Uint8Array(aP))}function cP(e){if(e.length===0)return e;if(iP.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;oP.length<t&&(oP=new Uint8Array(t));let{written:n}=nP.encodeInto(e,oP);return rP.decode(oP.subarray(0,n))}var lP=4096,uP=.5;function dP(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=pP(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}fP(t,e)}}function fP(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function pP(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>lP)return null;let c=[];for(let t=0;t<n;t++)c.push(hP(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(hP(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=gP(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*uP:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var mP=/\s+/g;function hP(e){return e.replace(mP,``)}function gP(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function _P(e,t,n=!1,r){let i=PP(e),a=i?CP(e):wP(e),o,s=[];for(let e of a){if(i&&!KN.test(e)){if(o==null)o=cP(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!TP(e)){if(o==null)o=cP(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=vP(e,{cacheKey:t==null?void 0:r==null?eP(`patch-file`,t,String(s.length)):eP(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function vP(e,{cacheKey:t,isGitDiff:n=KN.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=FP(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=SP(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=jP(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?xP(i.contents):[],deletionLines:!l&&r!=null&&i!=null?xP(r.contents):[],cacheKey:LP(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(YN),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=cP(r.trim()),n!==r&&(c.prevName=cP(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?JN:qN):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=cP(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=cP(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=cP(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=cP(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=cP(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=cP(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(XN)??[];t!=null&&(c.prevObjectId=cP(t)),n!=null&&(c.newObjectId=cP(n)),r!=null&&(c.mode=cP(r))}e.startsWith(`rename from `)&&(c.prevName=cP(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=cP(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
1305
+ `||s[s.length-1]===`\r`||s[s.length-1]===`\r
1306
+ `||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:LP(p.hunkContext),hunkSpecs:cP(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(!kP(t)||AP(t))break;if(a)throw Error(`parsePatchContent: hunk has more lines than expected`)}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=RP(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=zP(t);(g==null||g.type!==`change`)&&(g=BP(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=zP(t);(g==null||g.type!==`change`)&&(g=BP(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=zP(t);(g==null||g.type!==`context`)&&(g=BP(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=tP(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=tP(c.deletionLines[e]))}}}if(x!==b.additionCount||S!==b.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=ZN(b.additionStart,b.additionCount)+(x===0?0:1),t=ZN(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!l){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(ZN(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=QN(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=QN(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),dP(c),c}}function yP(e,t,n=!1){let r=[],i=bP(e)?e.split(GN):[e];for(let e of i)try{r.push(_P(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{sP()}return r}function bP(e){return e.startsWith(`From `)||e.includes(`
1307
+ From `)}function xP(e){let t=SP(e);for(let e=0;e<t.length;e++)t[e]=cP(t[e]);return t}function SP(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
1308
+ `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function CP(e){return FP(e,`diff --git`)}function wP(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=OP(e,r);if(i<=0&&a<=0){if(EP(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=OP(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=jP(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];if(c===`\\`){r=s;continue}c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0)),r=s}return t.push(e.slice(n)),t}function TP(e){return EP(e,0)}function EP(e,t){let n=OP(e,t);return DP(e,t,`---`)&&DP(e,n,`+++`)}function DP(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
1309
+ `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function OP(e,t){let n=e.indexOf(`
1310
+ `,t);return n===-1?e.length:n+1}function kP(e){let t=e[0];return t===`+`||t===`-`||t===` `}function AP(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
1311
+ `&&n!==`\r`)return!1}return!0}function jP(e){if(!e.startsWith(`@@ -`))return;let t=4,n=MP(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=MP(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=MP(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=MP(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=NP(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function MP(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function NP(e){return e.endsWith(`\r
1312
+ `)?e.slice(0,-2):e.endsWith(`
1313
+ `)?e.slice(0,-1):e}function PP(e){return e.startsWith(`diff --git`)||e.includes(`
1314
+ diff --git`)}function FP(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:IP(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=IP(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function IP(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function LP(e){return e==null?e:cP(e)}function RP(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function zP(e){let t=e.slice(1);return cP(t===``?`
1315
+ `:t)}function BP(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}function VP(e){let t=e[0];if(t!==`+`&&t!==`-`&&t!==` `&&t!==`\\`){console.error(`parseLineType: Invalid firstChar: "${t}", full line: "${e}"`);return}let n=e.substring(1);return{line:n===``?`
1316
+ `:n,type:t===` `?`context`:t===`\\`?`metadata`:t===`+`?`addition`:`deletion`}}function HP(e){if(e.trim()===``)return{kind:`empty`};let t=e.split(`
1317
+ `);t.at(-1)===``&&t.pop();let n=t.findIndex(e=>e.startsWith(`@@`));if(n<0)return{kind:`invalid`};try{let r=yP(t[0]?.startsWith(`@@`)?`diff --git a/excerpt b/excerpt\n${e}`:e,void 0,!0).flatMap(e=>e.files),i=r[0];if(r.length!==1||!i?.hunks.length)return{kind:`invalid`};let a=n,o=0,s=[];for(let e of i.hunks){if(t[a]!==e.hunkSpecs?.replace(/\n$/,``))return{kind:`invalid`};let n={id:`patch:${a}`,text:t[a++]??``},r=[],i=e.deletionStart||1,c=e.additionStart||1,l=e=>{let n=t[a]??``,s=VP(n),l=e===`removed`?`deletion`:e===`added`?`addition`:`context`;if(s?.type!==l)return!1;let u={source:n,line:{id:`patch:${a++}`,text:n.slice(1),kind:e,...e===`added`?{}:{oldLine:i},...e===`removed`?{}:{newLine:c}},oldLine:i,newLine:c,position:c};return r.push(u),e!==`added`&&i++,e!==`removed`&&c++,e!==`context`&&o++,t[a]===`\`&&r.push({...u,source:`\`,line:{id:`patch:${a++}`,text:`\`}}),!0};for(let n of e.hunkContent)if(n.type===`context`){for(let e=0;e<n.lines;e++)if(!l(`context`))return{kind:`invalid`}}else for(let e=0;e<n.deletions+n.additions;e++){let e=VP(t[a]??``)?.type;if(!l(e===`deletion`?`removed`:`added`))return{kind:`invalid`}}s.push({header:n,lines:r})}return a===t.length?{kind:`valid`,header:t.slice(0,n),hunks:s,changes:o}:{kind:`invalid`}}catch{return{kind:`invalid`}}}var UP=(e,t,n,r)=>`@@ -${t===0?e-1:e},${t} +${r===0?n-1:n},${r} @@`;function WP(e){let t=e[0];if(t==null)return[];let n=e.filter(e=>e.text.startsWith(` `)||e.text.startsWith(`-`)).length,r=e.filter(e=>e.text.startsWith(` `)||e.text.startsWith(`+`)).length;return[UP(t.oldLine,n,t.newLine,r),...e.map(e=>e.text)]}function GP(e){let t=e.map(e=>e.startLine===e.endLine?`${e.startLine}`:`${e.startLine}–${e.endLine}`);return`${e.length===1&&e[0]?.startLine===e[0]?.endLine?`Line`:`Lines`} ${t.join(`, `)}`}function KP(e,t,n=3){let r=HP(e);if(r.kind!==`valid`)return r.kind===`empty`?e:null;let{header:i,hunks:a}=r,o=e=>t.some(t=>e>=t.startLine-n&&e<=t.endLine+n),s=[...i];for(let e of a){let t=[];for(let n of e.lines){let e={...n,text:n.source};(e.text.startsWith(`\\`)?t.length>0:o(e.position))?t.push(e):t.length>0&&(s.push(...WP(t)),t=[])}t.length>0&&s.push(...WP(t))}return s.length===i.length?null:`${s.join(`
1318
+ `)}\n`}function qP(e){return`path`in e?e.path:e.newPath??e.oldPath??``}function JP(e){return`${e.scope}\n${e.oldPath}\n${e.newPath}`}function YP(e){return`change:${e.scope}:${qP(e)}`}function XP(e){return e.mergeBaseOid===null||e.mergeBaseOid===void 0?null:{baseOid:e.mergeBaseOid,headOid:e.head.oid}}function ZP(e){return e instanceof Error&&(e.name===`RequestError`||e.name===`ConnectionError`)?e.message:`The branch could not be compared. Try again.`}function QP(e){let t=new Map;for(let n of e){let e=qP(n);t.has(e)||t.set(e,{path:e,paths:[e],kind:`kind`in n?n.kind:`changed`})}return[...t.values()]}var $P=e=>e.newPath??e.oldPath??``;function eF(e,t,n){if(t.length===0)return[];let r=new Map,i=e=>{let t=r.get(e)??{expectedFiles:[],selections:[]};return r.set(e,t),t};for(let t of e)i(t.path).expectedFiles.push(t);for(let e of t)i($P(e)).selections.push(e);let a=[],o={expectedFiles:[],selections:[]};for(let e of[...r.keys()].sort((e,t)=>e.localeCompare(t))){let t=r.get(e)??{expectedFiles:[],selections:[]};o.selections.length>0&&(o.expectedFiles.length+t.expectedFiles.length>n||o.selections.length+t.selections.length>n)&&(a.push(o),o={expectedFiles:[],selections:[]}),o.expectedFiles.push(...t.expectedFiles),o.selections.push(...[...t.selections].sort((e,t)=>JP(e).localeCompare(JP(t))))}return a.push(o),a}function tF(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}var nF=it(`Changes.readSnapshot`)(function*({connection:e,scope:t}){let n=yield*kr(e,e=>e.changes.readChanges({params:{worktreeId:t.worktreeId}}));return yield*Pt(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),rF=It(e=>Ei(e.connection,e.scope,[`changes`],nF(e),On(e.connection))),iF=it(`Changes.readGitStatusSnapshot`)(function*({connection:e,scope:t}){let n=yield*kr(e,e=>e.changes.readGitStatus({params:{worktreeId:t.worktreeId}}));return yield*Pt(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),aF=It(e=>Ei(e.connection,e.scope,[`git-status`],iF(e),On(e.connection))),oF=It(e=>qe(e,[`branch`,e.base??null],t=>t.changes.readBranchChanges({params:{worktreeId:e.scope.worktreeId},query:{base:e.base}}),t=>t.worktreeId===e.scope.worktreeId)),sF=It(e=>qe(e,[`branch-bases`],t=>t.changes.listBranchBases({params:{worktreeId:e.scope.worktreeId}}))),cF=It(({connection:e,scope:t,input:n})=>Ei(e,t,[`change-diffs`,n],he(function*(){let r=yield*(yield*fi(e)).request(e=>e.changes.readChangeDiffs({params:{worktreeId:t.worktreeId},payload:n}));return yield*Pt(e,r.environmentId===e.environmentId&&r.worktreeId===t.worktreeId&&r.statusToken===n.expectedStatusToken),r}),On(e),n.expectedFiles.map(e=>e.path))),lF=It(({connection:e,scope:t,input:n})=>Ei(e,t,[`branch-diffs`,n],he(function*(){return yield*(yield*fi(e)).request(e=>e.changes.readBranchDiffs({params:{worktreeId:t.worktreeId},payload:n}))}),On(e))),uF=It(({connection:e,scope:t,oid:n,parent:r,paths:i})=>Ei(e,t,[`commit-diffs`,n,r,i],he(function*(){let a=yield*(yield*fi(e)).request(e=>e.changes.readCommitDiffs({params:{worktreeId:t.worktreeId,oid:n},payload:{...r===1?{}:{parent:r},paths:i.map(e=>[...e])}}));return yield*Pt(e,a.commitOid===n),a}),On(e)));function dF(e){return new Map(e.diffs.map(e=>[`selection`in e?JP(e.selection):e.paths.join(`\0`),e.content]))}var fF=It(e=>Kt(t=>e.map(e=>ur(t(e),dF)),t=>{for(let n of e)t(n)})),pF=It(e=>Er(t=>m(w(e,e=>m(t.result(e,{suspendOnWaiting:!0}),dF),{concurrency:`unbounded`}),e=>new Map(e.flatMap(e=>[...e])))).pipe(cn(0)));function mF(e,t){return Je(t.map(t=>Et.reviewSurface(e.connection.environmentId,e.scope,[t])))}var hF=It(e=>On(e.connection).fn(it(`Changes.readCurrent`)(t=>Sr(nF(e),()=>mF(e,[`changes`]))))),gF=It(e=>On(e.connection).fn(it(`Changes.refreshGitLook`)(t=>Sr(nF(e),()=>mF(e,[`changes`,`git-status`]))))),_F=It(e=>On(e.connection).fn(it(`Changes.readCurrentGitStatus`)(t=>Sr(iF(e),()=>mF(e,[`git-status`]))))),vF=class e extends Dr()(`@porcelain/client/ChangedDiffRecovery`){static layer=He(e,he(function*(){let e=yield*Bt({attempted:{},pending:{}});return{state:Fn(e),changes:Wn(e),begin:it(`ChangedDiffRecovery.begin`)((t,n)=>bi(e,e=>e.attempted[t]===n?[!1,e]:[!0,{attempted:{...e.attempted,[t]:n},pending:{...e.pending,[t]:n}}])),finish:it(`ChangedDiffRecovery.finish`)((t,n)=>Bi(e,e=>{if(e.pending[t]!==n)return e;let r={...e.pending};return delete r[t],{...e,pending:r}}))}}))},yF=It(e=>e.atoms(t=>ie(vF.layer,t(On(e).layer)))),bF=It(e=>yF(e.connection).fn(it(`Changes.recoverDiffs`)(function*(t,n){let r=yield*vF,i=JSON.stringify([e.scope.projectId,e.scope.worktreeId]);if(!(yield*r.begin(i,t)))return;let a=rF(e);return n.refresh(a),yield*$t(n.result(a,{suspendOnWaiting:!0}),r.finish(i,t))}),{concurrent:!0})),xF=It(({connection:e,scope:t,statusToken:n})=>yF(e).atom(z(m(vF,e=>e.changes)).pipe(me(e=>{let r=JSON.stringify([t.projectId,t.worktreeId]);return{pending:e.pending[r]===n,attempted:e.attempted[r]===n}})))),SF=It(e=>{let{connection:n,scope:r,statusToken:i}=e,a=eF(e.expectedFiles,e.selections,200).map(e=>cF({connection:n,scope:r,input:{expectedStatusToken:i,expectedFiles:e.expectedFiles,selections:e.selections}})),o=fF(a),s=pF(a),c=bF({connection:n,scope:r});return Kt(n=>{n.mount(c);let r=n(o),a=n(xF(e));return O(a)&&!a.value.attempted&&r.some(e=>st(e)&&t(nt(e.cause)))&&n.set(c,i),{result:n(s),recovery:a}},e=>e(o)).pipe(cn(0))});function CF(e,t){let n=(0,$.c)(3),r;return n[0]!==t||n[1]!==e?(r=rF({scope:e,connection:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],$l(r).value}function wF(e,t){let n=(0,$.c)(3),r;return n[0]!==t||n[1]!==e?(r=rF({scope:e,connection:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],at(r)}function TF(e,t,n,r,i){let a=(0,$.c)(21),o;a[0]!==t||a[1]!==r||a[2]!==e||a[3]!==i||a[4]!==n?(o=SF({scope:e,connection:t,statusToken:n,expectedFiles:r,selections:i}),a[0]=t,a[1]=r,a[2]=e,a[3]=i,a[4]=n,a[5]=o):o=a[5];let s=o,{result:c,recovery:l}=at(s),u;a[6]===l?u=a[7]:(u=_n(ar(l),EF),a[6]=l,a[7]=u);let d=u,f;a[8]===c?f=a[9]:(f=O(c)?c.value:new Map,a[8]=c,a[9]=f);let p;a[10]!==d||a[11]!==c?(p=M(c)||d,a[10]=d,a[11]=c,a[12]=p):p=a[12];let m;a[13]!==d||a[14]!==c?(m=st(c)&&!d,a[13]=d,a[14]=c,a[15]=m):m=a[15];let h=Ze(s),g;return a[16]!==f||a[17]!==p||a[18]!==m||a[19]!==h?(g={diffs:f,pending:p,failed:m,retry:h},a[16]=f,a[17]=p,a[18]=m,a[19]=h,a[20]=g):g=a[20],g}function EF(e){return e.pending}var DF=Er(ji());function OF(e,t,n){let r=(0,$.c)(11),i=n===void 0||n,a;r[0]!==t||r[1]!==e?(a=aF({connection:t,scope:e}),r[0]=t,r[1]=e,r[2]=a):a=r[2];let o=a,s=at(i?o:DF),c;r[3]!==t||r[4]!==e?(c=_F({connection:t,scope:e}),r[3]=t,r[4]=e,r[5]=c):c=r[5];let l;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(l={mode:`promise`},r[6]=l):l=r[6];let u=y(c,l),d=Ze(i?o:DF),f;return r[7]!==s||r[8]!==u||r[9]!==d?(f={result:s,read:u,refresh:d},r[7]=s,r[8]=u,r[9]=d,r[10]=f):f=r[10],f}function kF(e,t){if(!zN(t))return null;let n=hc(t.patch),r=iD(t.patch,`${YP(e)}:${n}`).flatMap(e=>e.files),i=r.length===1?r[0]:void 0;return i?{id:YP(e),kind:`diff`,path:qP(e),fileDiff:i,version:n,note:`${e.scope} · ${e.kind}`}:null}function AF(e,t,n){let r=BN(t,n);if(!r||n?.kind!==`text`)return null;let i=hc(n.patch),a=iD(n.patch,`${e}:${r}:${i}`)[0]?.files[0];return a?{id:`commit:${e}:${r}`,kind:`diff`,path:r,fileDiff:a,version:i,note:t.status}:null}function jF(e,t){let n=(0,$.c)(4),r;n[0]!==t||n[1]!==e?(r=hF({connection:t,scope:e}),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;return n[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promise`},n[3]=i):i=n[3],y(r,i)}function MF(e,t){let n=(0,$.c)(4),r;n[0]!==t||n[1]!==e?(r=gF({connection:t,scope:e}),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;return n[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promise`},n[3]=i):i=n[3],y(r,i)}function NF(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=fF(e),t[0]=e,t[1]=n);let r=n,i=at(r),a=Ze(r),o;return t[2]!==i||t[3]!==a?(o={results:i,retry:a},t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function PF(e){let t=(0,$.c)(11),n=NF(e),r;t[0]===n.results?r=t[1]:(r=new Map(n.results.flatMap(FF)),t[0]=n.results,t[1]=r);let i;t[2]===n.results?i=t[3]:(i=n.results.some(M),t[2]=n.results,t[3]=i);let a;t[4]===n.results?a=t[5]:(a=n.results.some(st),t[4]=n.results,t[5]=a);let o;return t[6]!==n.retry||t[7]!==r||t[8]!==i||t[9]!==a?(o={patches:r,pending:i,failed:a,retry:n.retry},t[6]=n.retry,t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}function FF(e){return Xe(ar(e)).flatMap(IF)}function IF(e){return[...e]}var LF=Er(ji());function RF(e,t,n){let r=(0,$.c)(7),i;r[0]!==n||r[1]!==t||r[2]!==e?(i=oF({connection:t,scope:e,...n===void 0?{}:{base:n}}),r[0]=n,r[1]=t,r[2]=e,r[3]=i):i=r[3];let a=i,o=at(a),s=Ze(a),c;return r[4]!==o||r[5]!==s?(c={result:o,refresh:s},r[4]=o,r[5]=s,r[6]=c):c=r[6],c}function zF(e,t,n){let r=(0,$.c)(7),i;r[0]!==t||r[1]!==n||r[2]!==e?(i=n?sF({connection:t,scope:e}):LF,r[0]=t,r[1]=n,r[2]=e,r[3]=i):i=r[3];let a=i,o=at(a),s=Ze(a),c;return r[4]!==o||r[5]!==s?(c={result:o,refresh:s},r[4]=o,r[5]=s,r[6]=c):c=r[6],c}function BF(e,t,n,r){let i=(0,$.c)(5),a;return i[0]!==t||i[1]!==r||i[2]!==n||i[3]!==e?(a=n?tF(r,25).map(r=>lF({connection:t,scope:e,input:{baseOid:n.baseOid,headOid:n.headOid,paths:r.map(VF)}})):[],i[0]=t,i[1]=r,i[2]=n,i[3]=e,i[4]=a):a=i[4],PF(a)}function VF(e){return[...e]}function HF(e,t,n,r,i){let a=(0,$.c)(11),o;if(a[0]!==e||a[1]!==n||a[2]!==r||a[3]!==i||a[4]!==t){let s;a[6]!==e||a[7]!==n||a[8]!==r||a[9]!==t?(s=i=>uF({connection:e,scope:t,oid:n,parent:r,paths:i}),a[6]=e,a[7]=n,a[8]=r,a[9]=t,a[10]=s):s=a[10],o=tF(i,25).map(s),a[0]=e,a[1]=n,a[2]=r,a[3]=i,a[4]=t,a[5]=o}else o=a[5];return PF(o)}function UF(e){return e?.replace(/^refs\/heads\//,``)??`Detached HEAD`}function WF(e,t){for(let n of e.projects){let e=n.worktrees.find(e=>e.id===t);if(e)return{worktree:e,projectId:n.id}}}function GF(e){let t=e.projects.flatMap(e=>e.worktrees);return t.find(e=>e.available&&!e.main)??t.find(e=>e.available)}function KF(e){return e.projects.flatMap(e=>e.worktrees).find(e=>e.available&&(e.status===`replied`||e.status===`pending`))??GF(e)}function qF(e){return e.worktrees.find(e=>e.main)?.path??e.worktrees[0]?.path??``}function JF(e){switch(e.unavailableReason){case`moved`:return`Porcelain doesn't recognise this repository as the one it registered. Remove the project and add it again.`;case`missing`:return`The repository folder is missing.`;case`permission`:return`Porcelain cannot read this repository because access is denied.`;case`git-failed`:return`Git could not read this repository.`;default:return`Porcelain can't reach this repository right now.`}}function YF(e){return e.endsWith(`/`)?e.slice(0,-1):e}function XF(e,t){if(t.has(e))return e;for(let n of t)if(e.startsWith(`${n}/`))return n;return null}function ZF(e,t,n){return n?e:e.filter(e=>XF(e,t)===null)}function QF(e,t){let n=(0,$.c)(7),r;n[0]!==e||n[1]!==t?(r=Bo({connection:e,projectId:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promise`},n[3]=i):i=n[3];let[a,o]=Vi(r,i),s;return n[4]!==a||n[5]!==o?(s={result:a,submit:o},n[4]=a,n[5]=o,n[6]=s):s=n[6],s}function $F(e,t){let n=(0,$.c)(5),r=QF(e,t),i;n[0]===r?i=n[1]:(i=e=>r.submit({path:YF(e.path),flag:`hidden`,value:e.hidden}),n[0]=r,n[1]=i);let a;return n[2]!==r||n[3]!==i?(a={...r,submit:i},n[2]=r,n[3]=i,n[4]=a):a=n[4],a}function eI(e,t){let n=(0,$.c)(5),r=QF(e,t),i;n[0]===r?i=n[1]:(i=e=>r.submit({path:YF(e.path),flag:`pinned`,value:e.pinned}),n[0]=r,n[1]=i);let a;return n[2]!==r||n[3]!==i?(a={...r,submit:i},n[2]=r,n[3]=i,n[4]=a):a=n[4],a}var tI=Er(void 0);function nI(e,t,n,r){let i=(0,$.c)(13),a;i[0]===e?a=i[1]:(a=ys(e),i[0]=e,i[1]=a);let o;i[2]===Symbol.for(`react.memo_cache_sentinel`)?(o={mode:`promiseExit`},i[2]=o):o=i[2];let[s,c]=Vi(a,o),l=y(tI),u;i[3]!==n||i[4]!==c||i[5]!==s||i[6]!==t||i[7]!==r||i[8]!==l?(u=e=>{if(!s.waiting)return c({path:e,remote:t,complete:()=>{l(void 0),n()},select:e=>nn({try:()=>r(e),catch:rI})})},i[3]=n,i[4]=c,i[5]=s,i[6]=t,i[7]=r,i[8]=l,i[9]=u):u=i[9];let d=u,f;return i[10]!==s||i[11]!==d?(f={result:s,submit:d},i[10]=s,i[11]=d,i[12]=f):f=i[12],f}function rI(e){return new qr({message:`Could not open the selected worktree.`,cause:e})}function iI(){let e=(0,$.c)(2),t=y(tI),n;return e[0]===t?n=e[1]:(n=e=>{e||t(void 0)},e[0]=t,e[1]=n),n}var aI=ti(De.layer).atom(De),oI=It(e=>e.atoms(De.layer).fn((t,n)=>he(function*(){let r=yield*(yield*De).pickProject(e.address);r!==null&&(yield*n.setResult(ys(e),{path:r,remote:null,complete:()=>void 0,select:e=>nn({try:()=>t(e),catch:e=>new qr({message:`Could not open the selected worktree.`,cause:e})})}))})));function sI(e,t,n){let r=(0,$.c)(3),i=Gn(ar(at(aI))),a;r[0]===e?a=r[1]:(a=oI(e),r[0]=e,r[1]=a);let o;r[2]===Symbol.for(`react.memo_cache_sentinel`)?(o={mode:`promiseExit`},r[2]=o):o=r[2];let[s,c]=Vi(a,o);return i?.canPickProject(e.address)&&(()=>{s.waiting||c(t).then(e=>{if(Cn(e)){let t=nt(e.cause);n(t instanceof Error?t:new qr({message:`Could not open the selected worktree.`,cause:t}))}})})}var cI=gi(function(e){return Xj(`dialog`,e)}),lI=dM(),uI=dM(),dI=pM(),fI=pM();function pI(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=Wo({connection:e,projectId:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],$l(r).value}function mI(e,t){let n=(0,$.c)(2),r=pI(e,t),i;return n[0]===r.preferences?i=n[1]:(i=new Set(r.preferences.filter(gI).map(hI)),n[0]=r.preferences,n[1]=i),i}function hI(e){return e.path}function gI(e){return e.hidden}function _I(e,t){let n=(0,$.c)(2),r=pI(e,t),i;return n[0]===r.preferences?i=n[1]:(i=r.preferences.filter(yI).map(vI),n[0]=r.preferences,n[1]=i),i}function vI(e){return e.path}function yI(e){return e.pinned}function bI(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=Eo(e),t[0]=e,t[1]=n),$l(n).value}function xI(e){let t=(0,$.c)(7),{environment:n,children:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(`span`,{className:`text-sm font-semibold`,children:`Porcelain`}),t[0]=i):i=t[0];let a=`Connected to ${n}`,o;t[1]!==n||t[2]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col leading-tight`,children:[i,(0,Q.jsx)(`span`,{className:`truncate text-2xs text-muted-foreground`,title:a,children:n})]}),t[1]=n,t[2]=a,t[3]=o):o=t[3];let s;return t[4]!==r||t[5]!==o?(s=(0,Q.jsxs)(`header`,{className:`desktop-sidebar-header flex h-11 shrink-0 items-center gap-2 border-b px-3`,children:[o,r]}),t[4]=r,t[5]=o,t[6]=s):s=t[6],s}function SI({...e}){return(0,Q.jsx)(cI,{"data-slot":`dialog`,...e})}function CI({...e}){return(0,Q.jsx)(sM,{"data-slot":`dialog-portal`,...e})}function wI({className:e,...t}){return(0,Q.jsx)(Qj,{"data-slot":`dialog-overlay`,className:Y(`fixed inset-0 isolate z-50 bg-black/30 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function TI({className:e,children:t,showCloseButton:n=!0,...r}){return(0,Q.jsxs)(CI,{children:[(0,Q.jsx)(wI,{}),(0,Q.jsxs)(oM,{"data-slot":`dialog-content`,className:Y(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-[min(var(--radius-4xl),24px)] bg-popover p-6 text-sm text-popover-foreground shadow-xl ring-1 ring-foreground/5 duration-100 outline-none sm:max-w-md dark:ring-foreground/10 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`,e),...r,children:[t,n&&(0,Q.jsxs)($j,{"data-slot":`dialog-close`,render:(0,Q.jsx)(X,{variant:`ghost`,className:`absolute top-4 right-4 bg-secondary`,size:`icon-sm`}),children:[(0,Q.jsx)(hl,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function EI({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`dialog-header`,className:Y(`flex flex-col gap-1.5`,e),...t})}function DI({className:e,showCloseButton:t=!1,children:n,...r}){return(0,Q.jsxs)(`div`,{"data-slot":`dialog-footer`,className:Y(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,Q.jsx)($j,{render:(0,Q.jsx)(X,{variant:`outline`}),children:`Close`})]})}function OI({className:e,...t}){return(0,Q.jsx)(cM,{"data-slot":`dialog-title`,className:Y(`font-heading text-base leading-none font-medium`,e),...t})}function kI({className:e,...t}){return(0,Q.jsx)(eM,{"data-slot":`dialog-description`,className:Y(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var AI=Z.createContext(void 0);function jI(){let e=Z.useContext(AI);if(e===void 0)throw Error(An(53));return e}function MI(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var NI=`data-has-overflow-x`,PI=`data-has-overflow-y`,FI=`data-overflow-x-start`,II=`data-overflow-x-end`,LI=`data-overflow-y-start`,RI=`data-overflow-y-end`,zI=e=>t=>t?{[e]:``}:null,BI={hasOverflowX:zI(NI),hasOverflowY:zI(PI),overflowXStart:zI(FI),overflowXEnd:zI(II),overflowYStart:zI(LI),overflowYEnd:zI(RI),cornerHidden:()=>null},VI=`--scroll-area-corner-height`,HI=`--scroll-area-corner-width`,UI=`data-orientation`,WI={x:0,y:0},GI={width:0,height:0},KI={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},qI={x:!0,y:!0,corner:!0},JI=Z.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=YI(i),d=aa(),f=Ge(),p=Ge(),{nonce:m,disableStyleElements:h}=Us(),[g,_]=Z.useState(!1),[v,y]=Z.useState(!1),[b,x]=Z.useState(!1),[S,C]=Z.useState(!1),[w,T]=Z.useState(!1),[E,D]=Z.useState(GI),[O,k]=Z.useState(GI),[A,j]=Z.useState(KI),[M,N]=Z.useState(qI),P=Z.useRef(null),F=Z.useRef(null),I=Z.useRef(null),L=Z.useRef(null),R=Z.useRef(null),z=Z.useRef(null),B=Z.useRef(null),V=Z.useRef(null),H=Z.useRef(0),W=Z.useRef(0),G=Z.useRef(0),ee=Z.useRef(0),te=Z.useRef(`vertical`),K=Z.useRef(WI),ne=Z.useRef(null);function q(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let re=gr(e=>{let t=e.x-K.current.x,n=e.y-K.current.y;K.current=e,n!==0&&q(!0),t!==0&&q(!1)}),ie=gr(()=>{let e=F.current;e&&ne.current===null&&(ne.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),ae=gr(e=>{if(e.button!==0||V.current!==null&&(te.current===`vertical`?R.current:z.current)?.hasPointerCapture(V.current))return;V.current=e.pointerId,H.current=e.clientY,W.current=e.clientX,te.current=e.currentTarget.getAttribute(UI);let t=F.current;t&&(G.current=t.scrollTop,ee.current=t.scrollLeft,ie()),(te.current===`vertical`?R.current:z.current)?.setPointerCapture(e.pointerId)}),oe=gr(e=>{if(e.pointerId!==V.current)return;V.current=null,(te.current===`vertical`?x:y)(!1),ne.current!==null&&(F.current&&(F.current.style.scrollSnapType=ne.current),ne.current=null);let t=te.current===`vertical`?R.current:z.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),se=gr(e=>{if(e.pointerId!==V.current)return;if(e.buttons%2==0){oe(e);return}let t=F.current;if(!t)return;let n=te.current===`vertical`,r=n?R.current:z.current,i=n?I.current:L.current;if(!r||!i)return;let a=n?`y`:`x`,o=MI(i,`padding`,a),s=MI(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-H.current:e.clientX-W.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?G.current:ee.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),q(n)});function ce(e){C(e.pointerType===`touch`)}function le(e){if(ce(e),e.pointerType!==`touch`){let t=dr(P.current,e.target);_(t)}}let ue=Z.useMemo(()=>({scrolling:v||b,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:M.corner}),[v,b,M.x,M.y,M.corner,A]),de={role:`presentation`,onPointerEnter:le,onPointerMove:le,onPointerDown:ce,onPointerLeave(){_(!1)},style:{position:`relative`,[VI]:`${E.height}px`,[HI]:`${E.width}px`}},fe=U(`div`,e,{state:ue,ref:[t,P],props:[de,o],stateAttributesMapping:BI}),pe=Z.useMemo(()=>({handlePointerDown:ae,handlePointerMove:se,handlePointerUp:oe,handleScroll:re,disableViewportSnap:ie,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:B,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:F,scrollbarYRef:I,scrollbarXRef:L,thumbYRef:R,thumbXRef:z,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:ue,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[ae,se,oe,re,ie,E,O,w,S,v,b,g,d,M,A,ue,s,c,l,u]);return(0,Q.jsxs)(AI.Provider,{value:pe,children:[!h&&ca.getElement(m),fe]})});function YI(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}var XI=Z.createContext(void 0),ZI=`--scroll-area-overflow-x-start`,QI=`--scroll-area-overflow-x-end`,$I=`--scroll-area-overflow-y-start`,eL=`--scroll-area-overflow-y-end`,tL=`--scroll-area-thumb-height`,nL=`--scroll-area-thumb-width`,rL=[ZI,QI,$I,eL],iL=!1;function aL(){iL||Te||(typeof CSS<`u`&&`registerProperty`in CSS&&rL.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),iL=!0)}var oL=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=jI(),T=Da(),E=Z.useRef(!0),D=Z.useRef([NaN,NaN,NaN,NaN]),O=Ge(),k=Ge(),A=gr(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,O=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,O&&v(!0),h===0||_===0)return;let k=sL(e),A=k.y,j=k.x,M=b/_,N=y/h,P=Math.max(0,_-b),F=Math.max(0,h-y),I=0,L=0;j||(I=to(T===`rtl`?-w:w,P),L=P-I);let R=A?0:to(x,F),z=A?0:F-R,B=j?0:b,V=A?0:y,H=0,U=0;!j&&!A&&(H=t?.offsetWidth||0,U=n?.offsetHeight||0);let W=f.width===0&&f.height===0,G=W?H:0,ee=W?U:0,te=MI(n,`padding`,`x`),K=MI(t,`padding`,`y`),ne=MI(i,`margin`,`x`),q=MI(r,`margin`,`y`),re=B-te-ne,ie=V-K-q,ae=n?Math.min(n.offsetWidth-G,re):re,oe=t?Math.min(t.offsetHeight-ee,ie):ie,se=Math.max(16,ae*M),ce=Math.max(16,oe*N);if(m(e=>cL(e,{width:se,height:ce})),t&&r){let e=lL(r,tL,x,F,h,ce,t.offsetHeight-ce-K-q);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-se-te-ne,t=lL(i,nL,T===`rtl`?-w:w,P,_,se,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let le=[I,L,R,z];rL.forEach((t,n)=>{e.style.setProperty(t,`${le[n]}px`)}),a&&p(e=>cL(e,{width:H,height:U})),g(e=>cL(e,k));let ue={xStart:!j&&I>C.xStart,xEnd:!j&&L>C.xEnd,yStart:!A&&R>C.yStart,yEnd:!A&&z>C.yEnd};S(e=>cL(e,ue))});Rr(()=>{aL()},[]),Rr(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),Rr(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),Rr(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),k.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished)).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,o,k]);function j(){E.current=!1}let M={role:`presentation`,...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:ca.className,style:{overflow:`scroll`},onScroll(){o.current&&(A(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),O.start(100,()=>{E.current=!0}))},onWheel:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=U(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:BI}),P=Z.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,Q.jsx)(XI.Provider,{value:P,children:N})});function sL(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function cL(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function lL(e,t,n,r,i,a,o){let s=bs(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}var uL=Z.createContext(void 0);function dL(){let e=Z.useContext(uL);if(e===void 0)throw Error(An(54));return e}var fL=Z.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:f,scrollbarYRef:p,scrollbarXRef:m,viewportRef:h,thumbYRef:g,thumbXRef:_,handlePointerDown:v,handlePointerUp:y,handleScroll:b,disableViewportSnap:x,rootId:S,thumbSize:C,hasMeasuredScrollbar:w,viewportState:T}=jI(),E=i===`vertical`,D={...T,hovering:c,scrolling:E?u:l,orientation:i},O=Da(),k=!w&&!a,A=E?f.y:f.x,j=a||!A;Z.useEffect(()=>{if(!j)return;let e=h.current,t=E?p.current:m.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!E,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&O===`rtl`?-a:0,s=n&&O===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),b({x:e.scrollLeft,y:e.scrollTop}))}return vt(t,`wheel`,n,{passive:!1})},[O,b,E,m,p,j,h]);let M={...S&&{"data-id":`${S}-scrollbar`},"aria-hidden":!0,onPointerDown(e){if(e.button!==0)return;let t=d(e.nativeEvent),n=E?g.current:_.current;if(n&&dr(n,t))return;let r=h.current;if(!r)return;let i=E?p.current:m.current;if(!n||!i)return;let a=E?`y`:`x`,o=MI(n,`margin`,a),s=MI(i,`padding`,a),c=E?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=E?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,f=E?r.scrollHeight:r.scrollWidth,y=E?r.clientHeight:r.clientWidth,S=(E?i.offsetHeight:i.offsetWidth)-c-s-o;if(S<=0)return;let C=u/S,w=f-y;x(),E?r.scrollTop=C*w:r.scrollLeft=O===`rtl`?-(1-C)*w:C*w,b({x:r.scrollLeft,y:r.scrollTop}),v(e)},onMouseDown(e){e.preventDefault()},onPointerUp:y,onPointerCancel:y,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:k?`hidden`:void 0,...E?{top:0,bottom:`var(${VI})`,insetInlineEnd:0,[tL]:`${C.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${HI})`,bottom:0,[nL]:`${C.width}px`}}},N=U(`div`,e,{ref:[t,E?p:m],state:D,props:[M,s],stateAttributesMapping:BI});return j?(0,Q.jsx)(uL.Provider,{value:i,children:N}):null}),pL=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=jI(),m=dL(),h=m===`vertical`;return U(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})}),mL=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=jI(),l=U(`div`,e,{ref:[t,o],props:[{"aria-hidden":!0,style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},a]});return c.corner?null:l});function hL({className:e,children:t,...n}){return(0,Q.jsxs)(JI,{"data-slot":`scroll-area`,className:Y(`relative`,e),...n,children:[(0,Q.jsx)(oL,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,Q.jsx)(gL,{}),(0,Q.jsx)(mL,{})]})}function gL({className:e,orientation:t=`vertical`,...n}){return(0,Q.jsx)(fL,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:Y(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,Q.jsx)(pL,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}function _L({className:e,...t}){return(0,Q.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:Y(e),...t})}function vL({className:e,...t}){return(0,Q.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:Y(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground sm:gap-2.5`,e),...t})}function yL({className:e,...t}){return(0,Q.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:Y(`inline-flex items-center gap-1.5`,e),...t})}function bL({className:e,render:t,...n}){return ps({defaultTagName:`a`,props:dt({className:Y(`transition-colors hover:text-foreground`,e)},n),render:t,state:{slot:`breadcrumb-link`}})}function xL({className:e,...t}){return(0,Q.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:Y(`font-normal text-foreground`,e),...t})}function SL({children:e,className:t,...n}){return(0,Q.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:Y(`[&>svg]:size-3.5`,t),...n,children:e??(0,Q.jsx)(Zo,{})})}function CL(e,t){let n=(0,$.c)(6),r;n[0]!==e||n[1]!==t?(r=ss(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a=at(i),o=Ze(i),s;return n[3]!==a||n[4]!==o?(s={value:a,refresh:o},n[3]=a,n[4]=o,n[5]=s):s=n[5],s}function wL(e){let t=(0,$.c)(3),{folder:n,disabled:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Q.jsx)(hL,{className:`h-40`,"aria-label":`Folders`,children:(0,Q.jsx)(`div`,{className:`flex flex-col p-1`,children:(0,Q.jsx)(TL,{folder:n,disabled:r})})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function TL(e){let t=(0,$.c)(38),{folder:n,disabled:r}=e,i=y(tI),a;t[0]===n.value?a=t[1]:(a=Gn(ar(n.value)),t[0]=n.value,t[1]=a);let o=a;if(M(n.value)){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{role:`status`,className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`Loading folders…`}),t[2]=e):e=t[2],e}if(st(n.value)){let e;t[3]===n.value.cause?e=t[4]:(e=qs(nt(n.value.cause)),t[3]=n.value.cause,t[4]=e);let a;t[5]===e?a=t[6]:(a=(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:e}),t[5]=e,t[6]=a);let o;t[7]!==r||t[8]!==n.refresh?(o=(0,Q.jsx)(X,{variant:`outline`,size:`xs`,onClick:n.refresh,disabled:r,children:`Try again`}),t[7]=r,t[8]=n.refresh,t[9]=o):o=t[9];let s;t[10]===i?s=t[11]:(s=()=>i(void 0),t[10]=i,t[11]=s);let c;t[12]!==r||t[13]!==s?(c=(0,Q.jsx)(X,{variant:`ghost`,size:`xs`,onClick:s,disabled:r,children:`Home folder`}),t[12]=r,t[13]=s,t[14]=c):c=t[14];let l;t[15]!==o||t[16]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[o,c]}),t[15]=o,t[16]=c,t[17]=l):l=t[17];let u;return t[18]!==a||t[19]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-2 px-2 py-1.5`,children:[a,l]}),t[18]=a,t[19]=l,t[20]=u):u=t[20],u}if(!o)return null;let s;t[21]!==o.parent||t[22]!==r||t[23]!==i?(s=o.parent&&(0,Q.jsxs)(X,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,onClick:()=>i(o.parent??void 0),disabled:r,children:[(0,Q.jsx)(Hd,{"data-icon":`inline-start`}),`Up`]}),t[21]=o.parent,t[22]=r,t[23]=i,t[24]=s):s=t[24];let c;if(t[25]!==o.directories||t[26]!==r||t[27]!==i){let e;t[29]!==r||t[30]!==i?(e=e=>(0,Q.jsxs)(X,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,title:e.path,onClick:()=>i(e.path),disabled:r,children:[(0,Q.jsx)(Lf,{"data-icon":`inline-start`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path),t[29]=r,t[30]=i,t[31]=e):e=t[31],c=o.directories.map(e),t[25]=o.directories,t[26]=r,t[27]=i,t[28]=c}else c=t[28];let l;t[32]===o.directories.length?l=t[33]:(l=!o.directories.length&&(0,Q.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No subfolders.`}),t[32]=o.directories.length,t[33]=l);let u;return t[34]!==s||t[35]!==c||t[36]!==l?(u=(0,Q.jsxs)(Q.Fragment,{children:[s,c,l]}),t[34]=s,t[35]=c,t[36]=l,t[37]=u):u=t[37],u}function EL(e){let t=(0,$.c)(44),{connection:n,disabled:r,onOpen:i}=e,a=at(tI),o=y(tI),s=CL(n,a),c,l;t[0]===s.value?(c=t[1],l=t[2]):(c=Gn(ar(s.value)),l=c?[`/`,...c.path.split(`/`).filter(Boolean)]:[],t[0]=s.value,t[1]=c,t[2]=l);let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Browse for a folder`}),t[3]=d):d=t[3];let f;t[4]!==u||t[5]!==c||t[6]!==r||t[7]!==o?(f=c&&(0,Q.jsx)(_L,{"aria-label":`Folder path`,children:(0,Q.jsx)(vL,{children:u.map((e,t)=>{let n=t===0?`/`:`/${u.slice(1,t+1).join(`/`)}`;return(0,Q.jsxs)(Z.Fragment,{children:[t>0&&(0,Q.jsx)(SL,{}),(0,Q.jsx)(yL,{className:`min-w-0`,children:t===u.length-1?(0,Q.jsx)(xL,{className:`max-w-48`,title:c.path,children:e}):(0,Q.jsx)(bL,{render:(0,Q.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>o(n)}),title:n,children:e})})]},n)})})}),t[4]=u,t[5]=c,t[6]=r,t[7]=o,t[8]=f):f=t[8];let p;t[9]===f?p=t[10]:(p=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 px-3 pt-1`,children:[d,f]}),t[9]=f,t[10]=p);let m;t[11]!==r||t[12]!==s?(m=(0,Q.jsx)(wL,{folder:s,disabled:r}),t[11]=r,t[12]=s,t[13]=m):m=t[13];let h;t[14]===c?.truncated?h=t[15]:(h=c?.truncated&&(0,Q.jsx)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:`This folder is large; some entries are not shown.`}),t[14]=c?.truncated,t[15]=h);let g=c?.repository?`Every worktree appears in the sidebar.`:`Pick a folder that is a Git repository.`,_;t[16]===g?_=t[17]:(_=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:g}),t[16]=g,t[17]=_);let v;t[18]!==c?.repository||t[19]!==r||t[20]!==s.value?(v=r||!c?.repository||Ae(s.value)||st(s.value),t[18]=c?.repository,t[19]=r,t[20]=s.value,t[21]=v):v=t[21];let b;t[22]!==c||t[23]!==i?(b=()=>{c&&i(c.path)},t[22]=c,t[23]=i,t[24]=b):b=t[24];let x;t[25]===r?x=t[26]:(x=r&&(0,Q.jsx)(Ko,{}),t[25]=r,t[26]=x);let S;t[27]===c?.path?S=t[28]:(S=c?.path.split(`/`).filter(Boolean).at(-1)??`folder`,t[27]=c?.path,t[28]=S);let C;t[29]===S?C=t[30]:(C=(0,Q.jsxs)(`span`,{className:`max-w-36 truncate`,children:[`Open `,S]}),t[29]=S,t[30]=C);let w;t[31]!==b||t[32]!==x||t[33]!==C||t[34]!==v?(w=(0,Q.jsxs)(X,{size:`sm`,disabled:v,onClick:b,children:[x,C]}),t[31]=b,t[32]=x,t[33]=C,t[34]=v,t[35]=w):w=t[35];let T;t[36]!==w||t[37]!==_?(T=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-1 pb-1 pl-3`,children:[_,w]}),t[36]=w,t[37]=_,t[38]=T):T=t[38];let E;return t[39]!==T||t[40]!==p||t[41]!==m||t[42]!==h?(E=(0,Q.jsxs)(`section`,{"aria-label":`Browse for a folder`,className:`flex flex-col gap-2 rounded-2xl border bg-muted/30 p-2`,children:[p,m,h,T]}),t[39]=T,t[40]=p,t[41]=m,t[42]=h,t[43]=E):E=t[43],E}function DL(e){let t=(0,$.c)(9),{connection:n,remotes:r,onOpened:i}=e,a=iI(),o;t[0]!==n||t[1]!==r?(o=e=>{if(e===null)return{connection:n,name:void 0};let t=r.find(t=>t.remote.environmentId===e);return t&&{connection:t.connection,name:t.remote.name}},t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]!==s||t[4]!==i?(c=e=>{let{payload:t}=e,n=t&&s(t.remote);return t&&n&&(0,Q.jsx)(TI,{className:`flex max-h-[90svh] flex-col sm:max-w-lg`,children:(0,Q.jsx)(OL,{connection:n.connection,remote:t.remote,name:n.name,onOpened:i},t.remote)})},t[3]=s,t[4]=i,t[5]=c):c=t[5];let l;return t[6]!==a||t[7]!==c?(l=(0,Q.jsx)(cI,{handle:lI,onOpenChangeComplete:a,children:c}),t[6]=a,t[7]=c,t[8]=l):l=t[8],l}function OL(e){let t=(0,$.c)(18),{connection:n,remote:r,name:i,onOpened:a}=e,o=nI(n,r,kL,a),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-secondary text-secondary-foreground`,children:(0,Q.jsx)(jf,{"aria-hidden":`true`})}),t[0]=s):s=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(OI,{children:`Open project`}),t[1]=c):c=t[1];let l=i===void 0?`Browse for a repository on the Porcelain server.`:`Browse for a repository on ${i}.`,u;t[2]===l?u=t[3]:(u=(0,Q.jsxs)(EI,{className:`shrink-0 flex-row items-center text-left`,children:[s,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[c,(0,Q.jsx)(kI,{children:l})]})]}),t[2]=l,t[3]=u);let d;t[4]===o?d=t[5]:(d=e=>void o.submit(e),t[4]=o,t[5]=d);let f;t[6]!==n||t[7]!==o.result.waiting||t[8]!==d?(f=(0,Q.jsx)(EL,{disabled:o.result.waiting,connection:n,onOpen:d}),t[6]=n,t[7]=o.result.waiting,t[8]=d,t[9]=f):f=t[9];let p;t[10]===o.result?p=t[11]:(p=st(o.result)&&(0,Q.jsx)(Ho,{variant:`destructive`,children:(0,Q.jsx)(bo,{children:qs(nt(o.result.cause))})}),t[10]=o.result,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Q.jsx)(hL,{className:`min-h-0 [&>[data-slot=scroll-area-viewport]]:max-h-[calc(90svh-8rem)]`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[f,p]})}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==u||t[16]!==m?(h=(0,Q.jsxs)(Q.Fragment,{children:[u,m]}),t[15]=u,t[16]=m,t[17]=h):h=t[17],h}function kL(){return lI.close()}function AL(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=mu(`(max-width: 767px)`),e[0]=t):t=e[0],at(t)}function jL({...e}){return(0,Q.jsx)(cI,{"data-slot":`sheet`,...e})}function ML({...e}){return(0,Q.jsx)(lM,{"data-slot":`sheet-trigger`,...e})}function NL({...e}){return(0,Q.jsx)(sM,{"data-slot":`sheet-portal`,...e})}function PL({className:e,...t}){return(0,Q.jsx)(Qj,{"data-slot":`sheet-overlay`,className:Y(`fixed inset-0 z-50 bg-black/30 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-sm`,e),...t})}function FL({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,Q.jsxs)(NL,{children:[(0,Q.jsx)(PL,{}),(0,Q.jsxs)(oM,{"data-slot":`sheet-content`,"data-side":n,className:Y(`fixed z-50 flex flex-col bg-popover bg-clip-padding text-sm text-popover-foreground shadow-xl transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,e),...i,children:[t,r&&(0,Q.jsxs)($j,{"data-slot":`sheet-close`,render:(0,Q.jsx)(X,{variant:`ghost`,className:`absolute top-4 right-4 bg-secondary`,size:`icon-sm`}),children:[(0,Q.jsx)(hl,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function IL({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:Y(`flex flex-col gap-1.5 p-6`,e),...t})}function LL({className:e,...t}){return(0,Q.jsx)(cM,{"data-slot":`sheet-title`,className:Y(`font-heading text-base font-medium text-foreground`,e),...t})}function RL({className:e,...t}){return(0,Q.jsx)(eM,{"data-slot":`sheet-description`,className:Y(`text-sm text-muted-foreground`,e),...t})}function zL({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`skeleton`,className:Y(`animate-pulse rounded-2xl bg-muted`,e),...t})}var BL=`sidebar_state`,VL=604800,HL=`16rem`,UL=`18rem`,WL=`3rem`,GL=`b`,KL=Z.createContext(null);function qL(){let e=Z.useContext(KL);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function JL({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=AL(),[c,l]=Z.useState(!1),[u,d]=Z.useState(e),f=t??u,p=Z.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${BL}=${t}; path=/; max-age=${VL}`},[n,f]),m=Z.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);Z.useEffect(()=>{let e=e=>{e.key===GL&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=Z.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,Q.jsx)(KL.Provider,{value:g,children:(0,Q.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":HL,"--sidebar-width-icon":WL,...i},className:Y(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function YL({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=qL();return n===`none`?(0,Q.jsx)(`div`,{"data-slot":`sidebar`,className:Y(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,Q.jsx)(jL,{open:l,onOpenChange:u,...o,children:(0,Q.jsxs)(FL,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":UL},side:e,children:[(0,Q.jsxs)(IL,{className:`sr-only`,children:[(0,Q.jsx)(LL,{children:`Sidebar`}),(0,Q.jsx)(RL,{children:`Displays the mobile sidebar.`})]}),(0,Q.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,Q.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,Q.jsx)(`div`,{"data-slot":`sidebar-gap`,className:Y(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,Q.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:Y(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear 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)] md:flex`,t===`floating`||t===`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`,r),...o,children:(0,Q.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-2xl group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function XL({className:e,onClick:t,...n}){let{toggleSidebar:r}=qL();return(0,Q.jsxs)(X,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:Y(e),onClick:e=>{t?.(e),r()},...n,children:[(0,Q.jsx)(pp,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function ZL({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:Y(`no-scrollbar flex min-h-0 flex-1 flex-col gap-2 overflow-auto [--radius:var(--radius-xl)] group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function QL({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:Y(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function $L({className:e,render:t,...n}){return ps({defaultTagName:`div`,props:dt({className:Y(`flex h-8 shrink-0 items-center rounded-xl px-3 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-3 [&>svg]:size-4 [&>svg]:shrink-0`,e)},n),render:t,state:{slot:`sidebar-group-label`,sidebar:`group-label`}})}function eR({className:e,...t}){return(0,Q.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:Y(`flex w-full min-w-0 flex-col gap-0.5`,e),...t})}function tR({className:e,...t}){return(0,Q.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:Y(`group/menu-item relative`,e),...t})}var nR=Qr(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-xl px-3 py-2 text-left text-sm whitespace-nowrap ring-sidebar-ring outline-hidden transition-[width,height,padding] duration-200 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-accent hover:text-sidebar-accent-foreground focus-visible:ring-3 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 has-[>svg:first-child]:pl-2.5 has-[>svg:last-child]:pr-2.5 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent 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 px-3 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function rR({render:e,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o}){let{isMobile:s,state:c}=qL(),l=ps({defaultTagName:`button`,props:dt({className:Y(nR({variant:n,size:r}),a)},o),render:i?(0,Q.jsx)(Sm,{render:e}):e,state:{slot:`sidebar-menu-button`,sidebar:`menu-button`,size:r,active:t}});return i?(typeof i==`string`&&(i={children:i}),(0,Q.jsxs)(xm,{children:[l,(0,Q.jsx)(Cm,{side:`right`,align:`center`,hidden:c!==`collapsed`||s,...i})]})):l}function iR(e,t){return t.endSide&&t.side&&t.endSide!==t.side?null:{...e,kind:`codeRange`,startLine:Math.min(t.start,t.end),endLine:Math.max(t.start,t.end),...e.comparison?.kind===`file`||e.comparison?.kind===`worktree`&&e.comparison.scope===`untracked`?{}:{side:t.side??`additions`}}}function aR(e,t){if(e.kind===`change`||e.filePath!==t.filePath)return!1;if(e.comparison?.kind===`branch`)return t.comparison?.kind===`branch`;if(e.revision!==t.revision)return!1;if(!e.comparison)return e.kind===`file`||t.comparison?.kind===`file`&&e.side===void 0;let n=t.comparison;return e.comparison.kind===n?.kind?e.comparison.kind===`worktree`&&n.kind===`worktree`?e.comparison.scope===n.scope:e.comparison.kind===`commit`&&n.kind===`commit`?e.comparison.parent===n.parent:!0:!1}function oR(e,t){return e.contentFingerprint!==null&&e.contentFingerprint!==void 0&&e.contentFingerprint!==t.contentFingerprint}function sR(e){return e.comparison?.kind===`branch`?e.comparison.base:void 0}function cR(e){return e.kind===`change`?void 0:e.filePath}function lR(e){return e?{kind:`change`,comparison:{kind:`branch`,base:e.base},revision:e.tip}:{kind:`change`}}function uR(e){if(e.kind===`change`)return e.comparison?.kind===`branch`?`Whole branch`:`Whole change`;if(e.kind===`file`)return`Whole file`;let t=e.side===`deletions`?`−`:`+`;return e.startLine===e.endLine?`${t}${e.startLine}`:`${t}${e.startLine} to ${t}${e.endLine}`}function dR(e){return e.messages[0]?.author??`reviewer`}function fR(e){let t=e.filter(e=>e.resolved),n=t.filter(e=>dR(e)===`reviewer`).map(e=>({threadId:e.id,revision:e.revision}));return{confirmed:n,kept:t.length-n.length}}function pR(e){return e.resolved?`resolved`:e.messages.at(-1)?.author===`agent`?`agent-replied`:`awaiting-agent`}function mR(e){switch(pR(e)){case`resolved`:return`Resolved`;case`awaiting-agent`:return`Waiting for the agent`;case`agent-replied`:return dR(e)===`agent`&&e.messages.length===1?`From the agent`:`Agent replied`}}function hR(e){return e.trim().length>0&&!e.includes(`\0`)&&e.length<=16e3}function gR(e,t,n){return e?.body===t?e:n()}function _R(e,t){let n=[[`open`,e.open],[`resolved`,e.resolved]].filter(([,e])=>e>0);return e.highest===0||!n.every(([e])=>t.has(e))?null:e.highest}function vR(e,t,n=[]){let r=new Map(e.map(e=>[e.id,e]));for(let e of t)r.set(e.id,e);for(let e of n)r.delete(e);return[...r.values()]}var yR=[`fail`,`pass`];function bR(e){let t=e?.checks??[],n=e=>t.filter(t=>t.result===e).length;return{failing:n(`fail`),passing:n(`pass`),current:e?.current??!0}}function xR(e){return[...e].sort((e,t)=>yR.indexOf(e.result)-yR.indexOf(t.result))}function SR(e,t){let n=e=>e.layerId===t;return{checks:(e?.checks??[]).filter(n),assets:(e?.assets??[]).filter(n),current:e?.current??!0}}function CR(e){let t=e.failing+e.passing;return t===0?`no checks`:e.failing>0?`${e.failing} failing`:e.current?t===1?`passed`:`all ${t} passed`:`outdated`}function wR(e){switch(e){case`fail`:return`Failed`;case`pass`:return`Passed`}}function TR(e){return Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0))}function ER(e){return URL.parse(e)?.host??e}function DR(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function OR(e,t){let n=new Map(e.map(e=>[e.path,e])),r=[];for(let e of t){let t=n.get(e.path);t&&(r.push(t),n.delete(e.path))}return[...r,...n.values()]}function kR(e,t){if(e.fingerprint===null||e.fingerprint===void 0)return`unreviewed`;let n=t.find(t=>t.path===e.path);return n?n.fingerprint===e.fingerprint?`reviewed`:`stale`:`unreviewed`}function AR(e,t){return t.find(t=>t.path===e.path)}function jR(e,t,n){let r=n==null?null:new Set(n);return e.changes.flatMap(n=>{if(r&&!r.has(n.path))return[];let i=AR(n,t.marks);return[{...n,environmentId:e.environmentId,worktreeId:e.worktreeId,statusToken:e.statusToken,reviewStatus:kR(n,t.marks),...i?{mark:i}:{}}]})}function MR(e,t,n){let r=n==null?null:new Set(n);return e.flatMap(e=>{if(r&&!r.has(e.path))return[];let n=AR(e,t.marks);return[{...e,reviewStatus:kR(e,t.marks),...n?{mark:n}:{}}]})}function NR(e){return e instanceof Error&&(e.name===`ConnectionError`||e.name===`WriteNotSentError`)?e.message:`This review surface could not be loaded. Try again.`}function PR(e){return e.fingerprint!==null&&e.fingerprint!==void 0}function FR(e){return e.split(`/`).at(-1)??e}function IR(e,t,n){let r=encodeURIComponent(e.token),i={expires:e.expires,signature:e.signature},a=new URL(t),o=n===void 0?void 0:new URL(n);return o!==void 0&&(a.protocol!==o.protocol||a.host!==o.host)?new URL(`/remote-review-summaries/${r}?${new URLSearchParams({computer:`${a.protocol}//${a.host}`,...i})}`,n).href:new URL(`/review-summaries/${r}?${new URLSearchParams(i)}`,t).href}function LR(e){let t=(e,t)=>`${e} ${t}${e===1?``:`s`}`,n=e.filter(e=>e.binary!==!0),r=e.length-n.length,i=n.reduce((e,t)=>e+t.ranges.reduce((e,t)=>e+t.endLine-t.startLine+1,0),0),a=[...n.length>0?[`${t(i,`line`)} in ${t(n.length,`file`)}`]:[],...r>0?[t(r,`binary file`)]:[]];return a.length===0?null:a.join(` and `)}function RR(e){return!e||typeof e!=`object`||!(`source`in e)||!(`openLayer`in e)?null:e.source===`porcelain-summary`&&typeof e.openLayer==`number`&&Number.isInteger(e.openLayer)?e.openLayer:null}var zR={kind:`worktree`};function BR(e){return{kind:`branch`,base:e?.base?.ref??``,branch:e?.head.branch}}function VR(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function HR(e){return[...new Map(e.map(e=>[e.path,e])).values()]}function UR(e){let t={marked:[],skipped:[],failed:[]},n=[];for(let r of HR(e)){if(r.reviewStatus===`reviewed`){t.skipped.push({path:r.path,reason:`already-reviewed`});continue}if(!PR(r)||r.fingerprint===null||r.fingerprint===void 0){t.skipped.push({path:r.path,reason:`not-fingerprintable`});continue}n.push({path:r.path,fingerprint:r.fingerprint})}return{report:t,files:n}}function WR(e,t){return{...e,marked:[...e.marked,...t.marked],failed:[...e.failed,...t.conflicts.map(e=>({path:e.path,error:Error(e.reason===`missing`?`That file is no longer in the change list.`:`The file changed since it was shown.`)}))]}}function GR(e){let t=e.failed.length,n=e.skipped.filter(e=>e.reason===`not-fingerprintable`).length,r=e.skipped.length-n;return[e.marked.length>0?`Marked ${e.marked.length} ${e.marked.length===1?`file`:`files`}.`:`No files marked.`,n>0?`Skipped ${n}.`:``,r>0?`${r} already reviewed.`:``,t>0?`${t} failed.`:``].filter(Boolean).join(` `)}function KR(e){return`${e.join(`, `)} cannot be marked reviewed because ${e.length===1?`its fingerprint is`:`their fingerprints are`} unavailable (too large or unreadable).`}function qR(e){return`${KR(e)} This stop stays open until every file can be marked reviewed.`}function JR(e){let{files:t,report:n}=UR(e),r=n.skipped.filter(e=>e.reason===`not-fingerprintable`).map(e=>e.path);return{eligible:t.length,unavailable:r,blocked:r.length>0&&t.length===0,action:r.length===0?void 0:t.length>0?`Mark available files reviewed`:`Review unavailable`,explanation:r.length>0?qR(r):void 0}}function YR(e){let t=e.skipped.filter(e=>e.reason===`not-fingerprintable`).map(e=>e.path);if(t.length>0)return{title:`Some files cannot be marked reviewed`,description:`${GR(e)} ${qR(t)}`,type:e.failed.length>0?`error`:`warning`};if(e.failed.length>0)return{title:`Some files changed before they were marked`,description:GR(e),type:`error`}}function XR(e){let t=HR(e),n=t.filter(PR),r=n.filter(e=>e.fingerprint!==null&&e.fingerprint!==void 0&&e.reviewStatus!==`reviewed`),i=n.filter(e=>e.reviewStatus===`reviewed`),a=t.length-n.length,o=r.length===0&&i.length>0,s=a>0?`${n.length} reviewed · ${a} unavailable`:`All reviewed`,c=n.length===0?null:o?`Unmark all`:r.length===0?s:null;return{entries:t,reviewedPaths:i.map(e=>e.path),unmarking:o,blocked:n.length===0||r.length===0&&i.length===0,label:n.length===0?`No files can be marked reviewed`:c??`Mark all ${r.length} files reviewed`,text:n.length===0?`No reviewable files`:c??`Mark all reviewed`}}function ZR(e,t){return t===`reviewed`?`Unmark ${e} as unreviewed`:t===`stale`?`Mark changed ${e} as reviewed`:`Mark ${e} as reviewed`}function QR(e,t){return!e?.fingerprint||t?null:e.reviewed?{kind:`unmark`,path:e.path}:{kind:`mark`,input:{path:e.path,fingerprint:e.fingerprint}}}function $R(e){return e.kind===`branch`?{kind:`branch`,branch:e.branch}:{kind:`worktree`}}function ez(e){return[`reviewed`,...e.kind===`branch`?[`branch`,e.branch??``]:[]]}function tz(e,t){let n=new Map(e.marks.map(e=>[e.path,e]));for(let e of t)for(let t of e.changes)t.fingerprint?n.set(t.path,{path:t.path,fingerprint:t.fingerprint,reviewedAt:e.reviewedAt}):n.delete(t.path);return{...e,marks:[...n.values()]}}function nz(e,t,n){return`${e} ${e===1?t:n}`}function rz(e){let t=bR(e),n=t.failing+t.passing;return t.failing>0?{key:`checks`,label:`${t.failing} of ${nz(n,`check`,`checks`)} failing`,tone:`failing`}:n===0?{key:`checks`,label:`No checks attached`,tone:`attention`}:e?.current===!1?{key:`checks`,label:`Checks ran before the latest changes`,tone:`attention`}:{key:`checks`,label:`${nz(n,`check`,`checks`)} passed`,tone:`ok`}}function iz(e){if(e===null)return{key:`unexplained`,label:`No review published`,tone:`attention`};let t=LR(e.notExplained);return t===null?{key:`unexplained`,label:`Every change explained`,tone:`ok`}:{key:`unexplained`,label:`${t} not explained`,tone:`attention`}}function az(e,t){if(e===0&&t===0)return[{key:`comments`,label:`No open comments`,tone:`ok`}];let n=[];return e>0&&n.push({key:`comments`,label:`${nz(e,`comment`,`comments`)} waiting on the agent`,tone:`attention`}),t>0&&n.push({key:`replies`,label:`${nz(t,`comment`,`comments`)} waiting on you`,tone:`attention`}),n}function oz(e){let t=e.files.length,n=e.files.filter(e=>e.reviewStatus===`reviewed`).length,r=e.files.filter(e=>e.reviewStatus===`stale`).length,i=e.threads.filter(e=>pR(e)===`awaiting-agent`).length,a=e.threads.filter(e=>pR(e)===`agent-replied`).length,o=e.explains?iz(e.review):null;return[t===0?{key:`files`,label:`No changed files`,tone:`ok`}:{key:`files`,label:`${n} of ${nz(t,`file`,`files`)} reviewed`,tone:n===t?`ok`:`attention`},r===0?{key:`stale`,label:`No marks went stale`,tone:`ok`}:{key:`stale`,label:`${nz(r,`mark`,`marks`)} changed since reviewed`,tone:`attention`},...o===null?[]:[o],...az(i,a),rz(e.review?.proof)]}function sz(e){let t=e.filter(e=>e.tone!==`ok`).length;return t===0?`Nothing left to check`:`${nz(t,`thing`,`things`)} to check`}var cz=new Set([`spec`,`specs`,`__tests__`,`tests`]);function lz(e){let t=e.slice(e.lastIndexOf(`/`)+1);return/\.(?:spec|test|browser)\.[^.]+$/.test(t)||/_(?:test|spec)\.[^.]+$/.test(t)||/^test_.+\.py$/.test(t)||/(?:Test|Tests|Spec)\.(?:java|kt|cs|swift|scala)$/.test(t)?!0:e.split(`/`).slice(0,-1).some(e=>cz.has(e))}function uz(e,t){if(!t)return e;let n=[],r=[];for(let t of e)lz(t.path)?r.push(t):n.push(t);return[...n,...r]}function dz(e){return`decision:${e}`}function fz(e){return`${e} ${e===1?`decision shapes`:`decisions shape`} this change`}function pz(e,t,{specsApart:n}){let r=new Set(t),i=e=>n&&lz(e),a=new Map,o=e.layers.map((e,t)=>{let n=dz(e.id),o=[...new Set(e.steps.filter(e=>e.kind===`changed`).map(e=>e.pointer.path).filter(e=>r.has(e)))],s=[],c=[];for(let e of o){let t=i(e)?`specs`:a.get(e);if(t){c.push({path:e,stop:t});continue}a.set(e,n),s.push(e)}return{kind:`decision`,key:n,number:t+1,layer:e,paths:s,elsewhere:c}}),s=t.filter(i),c=t.filter(e=>!a.has(e)&&!i(e)),l=e.notExplained.flatMap(e=>{let t=i(e.path)&&r.has(e.path)?`specs`:a.get(e.path);return t?[{...e,stop:t}]:[]});return[{kind:`briefing`,key:`briefing`,paths:[]},...o,...c.length>0||l.length>0?[{kind:`unexplained`,key:`unexplained`,paths:c,partial:l}]:[],...s.length>0?[{kind:`specs`,key:`specs`,paths:s}]:[]]}function mz(e,t){return e.find(e=>e.key===t)??e[0]??{kind:`briefing`,key:`briefing`,paths:[]}}function hz(e,t,n){let r=e.findIndex(e=>e.key===t);return r===-1?void 0:e[r+n]}function gz(e,t){let n=new Map(t.map(e=>[e.path,e.reviewStatus])),r=e.filter(e=>n.get(e)===`reviewed`).length;return{reviewed:r,total:e.length,done:r===e.length}}function _z(e){switch(e.kind){case`briefing`:return`Briefing`;case`decision`:return e.layer.title;case`unexplained`:return`Not explained`;case`specs`:return`Specs`}}function vz(e){return e.kind===`decision`?`${e.number}. ${_z(e)}`:_z(e)}function yz(e,t,n){if(e.kind===`briefing`)return!1;let r=gz(e.paths,t).done;return e.kind===`decision`?r&&n.get(e.layer.id)?.reviewed===!0:r}function bz(e){let t=[];for(let n of e.steps){if(n.kind!==`changed`)continue;let r=e.lanes[n.lane];r!==void 0&&t.at(-1)!==r&&t.push(r)}return t}function xz(e){let t=new Map(e.layers.map((e,t)=>[e.id,t+1]));return e=>({id:e.id,label:e.label,detail:e.detail,problem:e.problem,decision:e.layerId===void 0?void 0:t.get(e.layerId)})}function Sz(e){let t=xz(e),n=e.diagram?.after.boxes??[],r=n.filter(e=>!e.decision);return{added:r.filter(e=>e.change===`new`).map(t),changed:r.filter(e=>e.change===`changed`).map(t),removed:r.filter(e=>e.change===`removed`).map(t),questions:n.filter(e=>e.problem!==void 0).map(t)}}function Cz(e,t){let n=e.diagram?.after;if(!n)return[];let r=xz(e),i=new Map(n.boxes.map(e=>[e.id,e])),a=new Set(n.boxes.filter(e=>e.decision&&e.layerId===t).map(e=>e.id)),o=new Set;return n.arrows.flatMap(e=>{let t=a.has(e.from);if(t===a.has(e.to))return[];let n=i.get(t?e.to:e.from);return!n||o.has(n.id)?[]:(o.add(n.id),[{verb:e.label??`relates to`,outgoing:t,change:n.change,part:r(n)}])})}function wz(e,t){return e?`Unmark as reviewed`:t?`Mark as reviewed again`:`Mark as reviewed`}function Tz(e){switch(e.kind){case`file`:return[{id:`review`,label:wz(e.status===`reviewed`,e.status===`stale`),disabled:!e.canReview},{id:`comment`,label:`Comment`},{id:`open`,label:`Open diff`},{id:`open-to-side`,label:e.sideLabel},{id:`open-file`,label:`Open file`},{id:`timeline`,label:`Show timeline`},{id:`copy-relative`,label:`Copy relative path`},...e.canDiscard?[{id:`discard`,label:`Discard`,destructive:!0}]:[]];case`decision`:{let t=JR(e.files);return[{id:`open`,label:`Open`},{id:`review`,label:e.reviewed?wz(!0,e.stale):t.action??wz(!1,e.stale),disabled:!e.settled||e.pending||t.blocked}]}case`section`:return[{id:`open`,label:`Open`}];case`group`:return[{id:`expand-all`,label:`Expand all`},{id:`collapse-all`,label:`Collapse all`}];case`thread`:return[...e.canReveal?[{id:`reveal`,label:`Show in the code`}]:[],...e.resolved?[]:[{id:`reply`,label:`Reply`,disabled:e.pending}],{id:`resolution`,label:e.resolved?`Reopen`:`Resolve`,disabled:e.pending}];default:return e}}function Ez(e){let{verdict:t,content:n}=e,r=e.files.filter(e=>e.status===`deleted`).map(e=>e.path),i=new Set(t.removed.flatMap(e=>e.paths));return{header:{branch:e.branch,base:e.base,headOid:e.headOid,shortHead:e.headOid.slice(0,7),revision:e.revision},asked:{text:t.asked.text,links:t.asked.links??[]},recommendation:{value:t.recommendation,label:t.recommendation===`merge`?`Merge`:`Hold`,reasons:t.reasons},proven:{headOid:e.headOid,shortHead:e.headOid.slice(0,7),checks:xR(n.proof.checks),assets:n.proof.assets},notProven:t.notProven,removed:{fileCount:r.length,groups:t.removed.map(e=>({behavior:e.behavior,why:e.why,paths:r.filter(t=>e.paths.includes(t))})),unexplainedPaths:r.filter(e=>!i.has(e))},startHere:n.layers[0]?{layerId:n.layers[0].id,title:n.layers[0].title}:void 0}}function Dz(e,t){return e.files.map(e=>{let n=e.newOid??e.oldOid,r=t?.files.some(t=>t.path===e.path&&t.fingerprint===n)===!0?`reviewed`:`unreviewed`;return{path:e.path,fingerprint:n,reviewStatus:r}})}function Oz(e,t){return new Map(e.content.layers.map(e=>[e.id,{stale:!1,reviewed:t?.decisions.some(t=>t.layerId===e.id&&t.fingerprint===e.fingerprint)===!0}]))}var kz=J.check(N()),Az=qi.check(on()).check(wi({minimum:1,maximum:2**53-1}));a({reviewId:kz,environmentId:oe,host:oe,revision:Me(Az),decision:Me(kz)});var jz=[`Projects`,`Needs you`,`Waiting on agent`,`Ready to merge`,`No review`];function Mz({revision:e,marks:t,status:n}){let r=e?.content.layers??[],i=r.filter(e=>t?.decisions.some(t=>t.layerId===e.id&&t.fingerprint===e.fingerprint)).length,a=r.length,o=t!==void 0&&a>0&&i===a,s=n===`replied`,c=s?`Needs you`:e?.verdict.recommendation===`merge`&&o?`Ready to merge`:n===`reviewed`||o?`Waiting on agent`:`Needs you`,l=[];e?.content.proof.checks.some(e=>e.result===`fail`)&&l.push({label:`Proof failed`,variant:`destructive`});let u=e?.content.notExplained.length??0;return u>0&&l.push({label:`${u} not explained`,variant:`outline`}),s&&l.push({label:`Agent replied`,variant:`default`}),e&&l.push({label:e.verdict.recommendation===`hold`?`Agent says hold`:`Recommends merge`,variant:`secondary`}),c===`Waiting on agent`&&l.push({label:`Waiting for a commit`,variant:`secondary`}),{reviewed:i,total:a,group:c,badges:l}}function Nz(e,t,n){return n?.trim()||t?.verdict.asked.text.trim()||e.branch}var Pz={projects:void 0,environments:void 0};function Fz(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function Iz(e,t,n,r){let i=t.toLocaleLowerCase().trim().split(/\s+/).filter(Boolean);return e.filter(e=>e.closed===r&&(n.projects===void 0||n.projects.includes(`${e.environmentId}/${e.projectId}`))&&(n.environments===void 0||n.environments.includes(e.environmentId))&&i.every(t=>[e.title,e.branch,e.path,e.projectName,e.environmentName,e.pullRequestNumber].filter(Boolean).join(` `).toLocaleLowerCase().includes(t)))}function Lz(e){let t=e.badges.find(e=>e.variant===`destructive`);if(t)return{reason:t.label,tone:`destructive`};if(e.reviewId)return{reason:e.group,tone:e.group===`Ready to merge`?`primary`:`muted`}}function Rz(e,t){let n=e.group===`No review`;return{project:n||t&&e.group!==`Projects`?e.projectName:void 0,branch:n?void 0:e.branch}}function zz(e,t){if(e.group===`Projects`)return e.branch;let n=e.publishedAt?Math.max(0,(t-Date.parse(e.publishedAt))/1e3):void 0,r=n===void 0?void 0:n<60?`now`:n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:`${Math.floor(n/86400)}d`;return[e.projectName,e.pullRequestNumber?`#${e.pullRequestNumber}`:e.branch,r].filter(Boolean).join(` · `)}function Bz(e){return{projects:[...new Map(e.map(e=>[`${e.environmentId}/${e.projectId}`,{id:`${e.environmentId}/${e.projectId}`,label:`${e.projectName} · ${e.environmentName}`}])).values()],environments:[...new Map(e.map(e=>[e.environmentId,{id:e.environmentId,label:e.environmentName}])).values()]}}function Vz(e,t){return e.map(n=>({...n,checked:t===void 0||t.includes(n.id),next:Fz(t??e.map(e=>e.id),n.id)}))}function Hz(e,t,n,r){let i=Bz(e),a=Iz(e,t,n,r);return{rows:a,multipleProjects:new Set(a.map(e=>`${e.environmentId}/${e.projectId}`)).size>1,filters:[{key:`projects`,label:`Projects`,items:Vz(i.projects,n.projects)},{key:`environments`,label:`Environments`,items:Vz(i.environments,n.environments)}]}}function Uz(e){return[`The review and its saved revisions will remain under Closed.`,e.mainCheckout?`The project’s main checkout and its branches are protected. Nothing will be deleted.`:void 0,e.worktreePath?`Delete worktree: ${e.worktreePath}`:void 0,e.detachWorktreePath?`Keep worktree detached from its branch: ${e.detachWorktreePath}`:void 0,e.localBranch?`Delete local branch: ${e.localBranch}`:void 0,e.remoteBranch?`Delete remote branch: ${e.remoteBranch}`:void 0,e.remoteBranchNote,!e.mainCheckout&&!e.worktreePath&&!e.localBranch&&!e.remoteBranch?`Nothing will be deleted with the current settings.`:void 0,e.dirty?`Warning: this worktree has uncommitted changes. Deleting the worktree permanently discards them.`:void 0,e.unpushed?`Warning: this branch has commits not confirmed on its remote. Deleting branches may lose those commits.`:void 0].filter(Boolean).join(`
1319
+
1320
+ `)}function Wz(e){return e instanceof Error?e.message:`Archiving failed. Try preparing the archive again.`}var Gz=class e extends Dr()(`@porcelain/client/ReviewedFilesState`){static layer(t,n,r){return He(e,he(function*(){let e=yield*fi(t),i=yield*Bt([]),a=ez(r),o=yield*qa(t,Et.reviewSurface(t.environmentId,n,a),he(function*(){let i=yield*e.request(e=>e.reviews.listReviewedFiles({params:{worktreeId:n.worktreeId},query:r.kind===`branch`?{scope:`branch`,branch:r.branch}:{}}));return yield*Pt(t,i.worktreeId===n.worktreeId),i}),en(),Et.worktreeReads(t,n,a));return{stream:re(o.stream,Wn(i),(e,t)=>ur(e,e=>tz(e,t))),confirm:(e,r)=>b(a=>he(function*(){yield*a(Pt(t));let s={id:Symbol(),changes:e,reviewedAt:Kr(yield*kt)};return yield*Bi(i,e=>[...e,s]),yield*a(o.confirm(r.pipe(Sr(e=>Pt(t,e.worktreeId===n.worktreeId))),(e,t)=>Fi({worktreeId:t.worktreeId,marks:t.marks}))).pipe($t(Bi(i,e=>e.filter(e=>e.id!==s.id))))}))}}))}},Kz=It(({connection:e,scope:t,range:n})=>e.atoms(r=>ie(Gz.layer(e,t,n),r(On(e).layer))));function qz(e){return Kz({...e,range:$R(e.range)})}var Jz=It(({connection:e,scope:t,range:n})=>{let r=qz({connection:e,scope:t,range:n}),i={worktreeId:t.worktreeId},a=n.kind===`branch`?{scope:`branch`,branch:n.branch}:{};function o(e,t){return Oi(Gz,n=>n.confirm(e,t))}let s=it(`Reviews.markFile`)(function*(t){let r=yield*fi(e);return yield*o([t],r.request(e=>n.kind===`branch`?e.reviews.setReviewedFile({params:i,payload:{...t,reviewed:!0,scope:`branch`,base:n.base}}):e.reviews.setReviewedFile({params:i,payload:{...t,reviewed:!0}})))}),c=it(`Reviews.unmarkFile`)(function*(t){let n=yield*fi(e);return yield*o([{path:t}],n.request(e=>e.reviews.removeReviewedFile({params:i,query:{path:t,...a}})))}),l=it(`Reviews.markFiles`)(function*(t){return yield*o(t,(yield*fi(e)).request(e=>n.kind===`branch`?e.reviews.setReviewedFiles({params:i,payload:{files:t,scope:`branch`,base:n.base}}):e.reviews.setReviewedFiles({params:i,payload:{files:t}})))}),u=it(`Reviews.unmarkFiles`)(function*(t){let n=yield*fi(e);return yield*o(t.map(e=>({path:e})),n.request(e=>e.reviews.removeReviewedFiles({params:i,payload:{paths:[...t],...a}})))});return{set:r.fn(s,{concurrent:!0}),remove:r.fn(c,{concurrent:!0}),bulk:r.fn(it(`Reviews.reviewFiles`)(function*(e){if(e.kind===`unmark`){for(let t of VR(e.paths,V))yield*u(t);return{kind:`unmark`}}let t=UR(e.entries),n=t.report;for(let e of VR(t.files,V))n=WR(n,yield*l(e));return{kind:`mark`,report:n}}),{concurrent:!0})}});function Yz(e,t){if(st(e))return nt(e.cause);if(st(t))return nt(t.cause)}var Xz=class e extends Dr()(`@porcelain/client/LayerMarksState`){static layer(t,n){return He(e,he(function*(){let e=yield*fi(t);return yield*qa(t,Et.reviewSurface(t.environmentId,n,[`reviewed-layers`]),he(function*(){let r=yield*e.request(e=>e.reviews.listReviewedLayers({params:{worktreeId:n.worktreeId}}));return yield*Pt(t,r.worktreeId===n.worktreeId),r}),en(),Et.worktreeReads(t,n,[`reviewed-layers`]))}))}},Zz=It(({connection:e,scope:t})=>e.atoms(n=>ie(Xz.layer(e,t),n(On(e).layer)))),Qz=It(({connection:e,scope:t})=>Zz({connection:e,scope:t}).fn(it(`Reviews.setLayerMark`)(function*(n){let r=yield*fi(e),i=yield*(yield*Xz).confirm(he(function*(){let i=yield*n.kind===`unmark`?r.request(e=>e.reviews.removeReviewedLayer({params:{worktreeId:t.worktreeId},query:{layerId:n.layerId}})):r.request(e=>e.reviews.setReviewedLayer({params:{worktreeId:t.worktreeId},payload:{layerId:n.layerId,fingerprint:n.fingerprint,reviewed:!0}}));return yield*Pt(e,i.worktreeId===t.worktreeId),i}),(e,t)=>Fi(t));return yield*Je([Et.inventory(e.environmentId)]),i}),{concurrent:!0}));It(e=>{let t=Jz({...e,range:zR}).bulk,n=Qz(e);return Ie((e,r)=>he(function*(){let i=e.decision;if(e.kind===`complete`){let n=yield*r.setResult(t,{kind:`mark`,entries:e.files}).pipe(gt(e=>({title:`Could not mark the files reviewed`,description:NR(e),type:`error`}))),i=n.kind===`mark`?YR(n.report):void 0;if(i)return yield*Ye(i);if(!e.decision||e.decision.reviewed)return}i&&(yield*r.setResult(n,{...i,kind:e.kind===`reopen`?`unmark`:`mark`}).pipe(gt(e=>({title:`Could not update the decision`,description:NR(e),type:`error`}))))}))});var $z=It(e=>rt(e.scope,`reviewed`,Gz,qz(e)));function eB({range:e=zR,...t}){return $z({...t,range:$R(e)})}var tB=a({method:W([`GET`,`POST`,`PATCH`,`PUT`,`DELETE`,`HEAD`,`OPTIONS`,`TRACE`,`QUERY`]),url:J,urlParams:we(di([J,J])),hash:Me(J),headers:Nt(J,er([J,Ot(J)]))}).annotate({identifier:`HttpRequestDetails`}),nB=a({status:h,headers:Nt(J,er([J,Ot(J)]))}).annotate({identifier:`HttpResponseDetails`}),rB=`~effect/ai/AiError/Reason`,iB=()=>sB.pipe(ye(yn({})),Ee(yn({}))),aB=e=>{let t=T(e),n={};for(let e in t){let r=t[e];j(n,e,yt(r)?r.toString():r)}return n},oB=class e extends We(`effect/ai/AiError/NetworkError`)({_tag:f(`NetworkError`),reason:W([`TransportError`,`EncodeError`,`InvalidUrlError`]),request:tB,description:Me(J)}){[rB]=rB;get isRetryable(){return this.reason===`TransportError`}static fromRequestError(t){return new e({description:t.description,reason:t._tag,request:{hash:Gn(t.request.hash),headers:aB(t.request.headers),method:t.request.method,url:t.request.url,urlParams:Array.from(t.request.urlParams)}})}get message(){let e=`${this.request.method} ${this.request.url}`,t=this.description?`${this.reason}: ${this.description}`:`${this.reason}: A network error occurred.`;t+=` (${e})`;let n=``;switch(this.reason){case`EncodeError`:n+=`Check that the request body data is properly formatted and matches the expected content type.`;break;case`InvalidUrlError`:n+=`Verify that the URL format is correct and that all required parameters have been provided.`,n+=` Check for any special characters that may need encoding.`;break;case`TransportError`:n+=`Check your network connection and verify that the requested URL is accessible.`}return t+=`\n\n${n}`,t}},sB=Nt(J,Gr(ft)),cB=a({promptTokens:Me(h),completionTokens:Me(h),totalTokens:Me(h)}).annotate({identifier:`UsageInfo`}),lB=a({request:tB,response:Me(nB),body:Me(J)}).annotate({identifier:`HttpContext`}),uB=class extends We(`effect/ai/AiError/RateLimitError`)({_tag:f(`RateLimitError`),retryAfter:Me(de),metadata:iB(),http:Me(lB)}){[rB]=rB;get isRetryable(){return!0}get message(){let e=`Rate limit exceeded`;return this.retryAfter&&(e+=`. Retry after ${Ke(this.retryAfter)}`),e}},dB=class extends We(`effect/ai/AiError/QuotaExhaustedError`)({_tag:f(`QuotaExhaustedError`),resetAt:Me(R),metadata:iB(),http:Me(lB)}){[rB]=rB;get isRetryable(){return!1}get message(){let e=`Quota exhausted`;return this.resetAt&&(e+=`. Resets at ${this.resetAt}`),`${e}. Check your account billing and usage limits.`}},fB=class extends We(`effect/ai/AiError/AuthenticationError`)({_tag:f(`AuthenticationError`),kind:W([`InvalidKey`,`ExpiredKey`,`MissingKey`,`InsufficientPermissions`,`Unknown`]),description:Me(J),metadata:iB(),http:Me(lB)}){[rB]=rB;get isRetryable(){return!1}get message(){let e=`${this.kind}: ${{InvalidKey:`Verify your API key is correct`,ExpiredKey:`Your API key has expired. Generate a new one`,MissingKey:`No API key provided. Set the appropriate environment variable`,InsufficientPermissions:`Your API key lacks required permissions`,Unknown:`Authentication failed. Check your credentials`}[this.kind]}`;return this.description&&(e+=`. ${this.description}`),e}},pB=class extends We(`effect/ai/AiError/ContentPolicyError`)({_tag:f(`ContentPolicyError`),description:J,metadata:iB(),http:Me(lB)}){[rB]=rB;get isRetryable(){return!1}get message(){return`Content policy violation: ${this.description}`}},mB=class extends We(`effect/ai/AiError/InvalidRequestError`)({_tag:f(`InvalidRequestError`),parameter:Me(J),constraint:Me(J),description:Me(J),metadata:iB(),http:Me(lB)}){[rB]=rB;get isRetryable(){return!1}get message(){let e=`Invalid request`;return this.parameter&&(e+=`: parameter '${this.parameter}'`),this.constraint&&(e+=` ${this.constraint}`),this.description&&(e+=`. ${this.description}`),e}},hB=class extends We(`effect/ai/AiError/InternalProviderError`)({_tag:f(`InternalProviderError`),description:J,metadata:iB(),http:Me(lB)}){[rB]=rB;get isRetryable(){return!0}get message(){return`Internal provider error: ${this.description}`}},gB=class e extends We(`effect/ai/AiError/InvalidOutputError`)({_tag:f(`InvalidOutputError`),description:J,metadata:iB(),usage:Me(cB)}){[rB]=rB;get isRetryable(){return!0}static fromSchemaError(t){return new e({description:t.message})}get message(){return`Invalid output: ${this.description}`}},_B=class e extends We(`effect/ai/AiError/StructuredOutputError`)({_tag:f(`StructuredOutputError`),description:J,responseText:J,metadata:iB(),usage:Me(cB)}){[rB]=rB;get isRetryable(){return!0}static fromSchemaError(t,n){return new e({description:t.message,responseText:n})}get message(){return`Structured output validation failed: ${this.description}`}},vB=class extends We(`effect/ai/AiError/UnsupportedSchemaError`)({_tag:f(`UnsupportedSchemaError`),description:J,metadata:iB()}){[rB]=rB;get isRetryable(){return!1}get message(){return`Unsupported schema: ${this.description}`}},yB=class extends We(`effect/ai/AiError/UnknownError`)({_tag:f(`UnknownError`),description:Me(J),metadata:iB(),http:Me(lB)}){[rB]=rB;get isRetryable(){return!1}get message(){return this.description??`Unknown error`}},bB=class extends We(`effect/ai/AiError/ToolNotFoundError`)({_tag:f(`ToolNotFoundError`),toolName:J,availableTools:we(J)}){[rB]=rB;get isRetryable(){return!0}get message(){let e=this.availableTools.length>0?this.availableTools.join(`, `):`none`;return`Tool '${this.toolName}' not found. Available tools: ${e}`}},xB=class extends We(`effect/ai/AiError/ToolParameterValidationError`)({_tag:f(`ToolParameterValidationError`),toolName:J,description:J}){[rB]=rB;get isRetryable(){return!0}get message(){return`Invalid parameters for tool '${this.toolName}': ${this.description}`}},SB=class extends We(`effect/ai/AiError/InvalidToolResultError`)({_tag:f(`InvalidToolResultError`),toolName:J,description:J}){[rB]=rB;get isRetryable(){return!1}get message(){return`Tool '${this.toolName}' returned invalid result: ${this.description}`}},CB=class extends We(`effect/ai/AiError/ToolResultEncodingError`)({_tag:f(`ToolResultEncodingError`),toolName:J,toolResult:Zt,description:J}){[rB]=rB;get isRetryable(){return!1}get message(){return`Failed to encode result for tool '${this.toolName}': ${this.description}`}},wB=er([uB,dB,fB,pB,mB,hB,oB,gB,_B,vB,yB,bB,xB,SB,CB,class extends We(`effect/ai/AiError/ToolConfigurationError`)({_tag:f(`ToolConfigurationError`),toolName:J,description:J}){[rB]=rB;get isRetryable(){return!1}get message(){return`Invalid configuration for tool '${this.toolName}': ${this.description}`}},class extends We(`effect/ai/AiError/ToolkitRequiredError`)({_tag:f(`ToolkitRequiredError`),pendingApprovals:we(J),description:Me(J)}){[rB]=rB;get isRetryable(){return!1}get message(){return`Toolkit required to resolve pending tool approvals: ${this.pendingApprovals.join(`, `)}`}},class extends We(`effect/ai/AiError/InvalidUserInputError`)({_tag:f(`InvalidUserInputError`),description:J}){[rB]=rB;get isRetryable(){return!1}get message(){return`Invalid user input: ${this.description}`}}]),TB=`~effect/ai/AiError`,EB=class extends We(`effect/ai/AiError/AiError`)({_tag:f(`AiError`),module:J,method:J,reason:wB}){[TB]=TB;cause=this.reason;get isRetryable(){return this.reason.isRetryable}get retryAfter(){return`retryAfter`in this.reason?this.reason.retryAfter:void 0}get message(){return`${this.module}.${this.method}: ${this.reason.message}`}},DB=e=>cr(e,rB),OB=e=>new EB(e),kB=`~effect/ai/Tool`,AB=(e,t)=>Object.assign(Object.create(Object.getPrototypeOf(e)),e,t),jB={[kB]:{_Requirements:I},pipe(){return K(this,arguments)},addDependency(){return AB(this)},setParameters(e){return AB(this,{parametersSchema:e,jsonSchema:void 0})},setSuccess(e){return AB(this,{successSchema:e})},setFailure(e){return AB(this,{failureSchema:e})},setNeedsApproval(e){return AB(this,{needsApproval:e})},annotate(e,t){return AB(this,{annotations:Xr(this.annotations,e,t)})},annotateMerge(e){return AB(this,{annotations:hi(this.annotations,e)})}};({...jB}),{...jB};var MB=e=>{let t=Object.assign(Object.create(jB),e);return t.id=`effect/ai/Tool/${e.name}`,t},NB=(e,t)=>{let n=t?.success??Nr,r=t?.failure??Ct;return MB({name:e,description:t?.description,parametersSchema:t?.parameters??VB,successSchema:n,failureSchema:r,failureMode:t?.failureMode??`error`,annotations:Qn(),needsApproval:t?.needsApproval})},PB=ci(`effect/ai/Tool/Readonly`,{defaultValue:nr}),FB=ci(`effect/ai/Tool/Destructive`,{defaultValue:ge}),IB=ci(`effect/ai/Tool/Idempotent`,{defaultValue:nr}),LB=ci(`effect/ai/Tool/OpenWorld`,{defaultValue:ge}),RB=ci(`effect/ai/Tool/Strict`,{defaultValue:()=>void 0}),zB=a({type:W([`execution-denied`,`execution-interrupted`]),reason:J}).annotate({identifier:`ToolExecutionFailure`}),BB=e=>er([EB,e.failureSchema,zB]),VB=Nt(J,Ct),HB=`~effect/ai/Toolkit`,UB=ci(`effect/ai/Toolkit/FailureOrigin`,{defaultValue:()=>`result`}),WB=(e,t)=>Xn(Hn(e),ln(UB,t)),GB={...v({label:`Toolkit`,evaluate:A(function*(e){let t=this.tools,n=e.context,r=new WeakMap,i=e=>{let t=r.get(e);if(c(t)){let i=n.mapUnsafe.get(e.id),a=Mi(e.parametersSchema)?vi(e.parametersSchema):e=>yn(e),o=Yn(e.successSchema),s=Yn(BB(e));t={context:i.context,handler:i.handler,decodeParameters:a,encodeResult:(e,t)=>t?s(e):o(e)},r.set(e,t)}return t};return{tools:t,handle:A(function*(e,n,r,a){let o=Object.hasOwn(t,e)?t[e]:void 0;if(yield*jr({tool:e,parameters:n}),c(o))return yield*OB({module:`Toolkit`,method:`${e}.handle`,reason:new bB({toolName:e,availableTools:Object.keys(t)})});let l=i(o),u=(t,n)=>l.encodeResult(t,n).pipe(gt(n=>OB({module:`Toolkit`,method:`${e}.handle`,reason:new CB({toolName:e,toolResult:t,description:n.message})}))),d=yield*ui(l.decodeParameters(n,a));if(Be(d)){let t=OB({module:`Toolkit`,method:`${e}.handle`,reason:new xB({toolName:e,description:d.failure.message})});return o.failureMode===`error`?yield*_(WB(t,`parameters`)):or(m(u(t,!0),e=>({result:t,isFailure:!0,failureOrigin:`parameters`,preliminary:!1,encodedResult:e})))}let f=d.success,p=yield*ni(),h={toolCallId:r,preliminary:e=>mr(pn(p,{result:e,isFailure:!1,preliminary:!0}))},g=yield*l.handler(f,h).pipe(Oi(e=>pn(p,{result:e,isFailure:!1,preliminary:!1})),ki(e=>hi(l.context,e)),ut({onFailure:e=>Mr(p,e),onSuccess:()=>Yt(p)}),sr),v=t=>ct(t)?OB({module:`Toolkit`,method:`${e}.handle`,reason:new SB({toolName:e,description:`Tool handler returned invalid result: ${t.message}`})}):DB(t)?OB({module:`Toolkit`,method:`${e}.handle`,reason:t}):t;return s(p).pipe(Di(e=>{let t=v(e),n=ct(e)?`result`:`handler`;return o.failureMode===`error`?C(WB(t,n)):ht({result:t,isFailure:!0,failureOrigin:n,preliminary:!1})}),be(A(function*(e){let t=yield*u(e.result,e.isFailure);return{...e,encodedResult:t}})),te(Ci(g)))})}})}),[HB]:HB,of:I,toHandlers(e){return he({self:this},function*(){let t=yield*In(),n=ce(e)?yield*e:e,r=new Map;for(let[e,i]of Object.entries(n)){let n=Object.hasOwn(this.tools,e)?this.tools[e]:void 0;n!==void 0&&r.set(n.id,{name:e,handler:i,context:t})}return hr(r)})},toLayer(e){return Gi(this.toHandlers(e))},toJSON(){return{_id:`effect/ai/Toolkit`,tools:Array.from(Object.values(this.tools)).map(e=>e.name)}}},KB=e=>Object.assign(function(){},GB,{tools:e}),qB=(...e)=>{let t={};for(let n of e)j(t,n.name,n);return t},JB=(...e)=>KB(qB(...e)),YB=a({cwd:fr(J.check(et(1)).check(Li(wt)))}),XB=a({...YB.fields,...Gt.fields}),ZB=a({...Ti.fields,warnings:we(J)}),QB=a({...YB.fields,reviewId:Me(J.check(N())),revision:Me(h.check(Ui(0)))}),$B=a({reviewId:Me(J.check(N())),...YB.fields,scope:sn.pipe(Fe(yn(`waiting`)))}),eV=a({...YB.fields,...Ri.fields}),tV=a({...YB.fields,threadId:J.check(N()),...Ni.fields}),nV=a({...YB.fields,threadId:J.check(N()),...P.fields});JB(NB(`publish_review`,{parameters:XB,success:ZB,failure:bt,failureMode:`return`,description:`Publish an immutable revision of committed branch work with a required verdict. Read the current revision and porcelain://review-guide first. Include your own CSS, matching the reviewed application where possible; missing CSS produces an advisory warning. Attach proof that the work is done: checks you ran with their result, and screenshots, short videos or links.`}).annotate(RB,!0).annotate(LB,!1).annotate(FB,!0),NB(`read_review`,{parameters:QB,success:Wi,failure:bt,failureMode:`return`,description:`Read the latest published review, resolved pointers and uncovered changed lines.`}).annotate(RB,!0).annotate(LB,!1).annotate(PB,!0).annotate(IB,!0),NB(`list_comments`,{parameters:$B,success:a({threads:S}),failure:bt,failureMode:`return`,description:`Read review threads waiting for the agent. Omit scope, or pass waiting, for unresolved threads whose latest message is not from the agent. Pass all to include every thread.`}).annotate(RB,!0).annotate(LB,!1).annotate(PB,!0).annotate(IB,!0),NB(`create_comment`,{parameters:eV,success:tt,failure:bt,failureMode:`return`,description:`Create an agent review thread on the whole change (kind change, with a branch comparison and its tip for a branch review), a file or a code range. Stable optional IDs make retries idempotent.`}).annotate(RB,!0).annotate(LB,!1).annotate(FB,!1),NB(`reply_to_comment`,{parameters:tV,success:lt,failure:bt,failureMode:`return`,description:`Reply to a review thread. Stable optional messageId makes retries idempotent.`}).annotate(RB,!0).annotate(LB,!1).annotate(FB,!1),NB(`resolve_comment`,{parameters:nV,success:k,failure:bt,failureMode:`return`,description:`Resolve or reopen a review thread.`}).annotate(RB,!0).annotate(LB,!1).annotate(FB,!1).annotate(IB,!0));var rV=it(`Reviews.readSummaryHtml`)(function*(e,t,n){return yield*he(function*(){let n=yield*Ve(Vn);return yield*e.request(Mn(n.reviewSummary.readReviewSummary({params:{token:t.token},query:{expires:t.expires,signature:t.signature}})))}).pipe(Ft(Vr(n?(e,t)=>n.transport(n.url,t):e.transport)))}),iV=It(({connection:e,scope:t,summary:n,delivery:r})=>Ei(e,t,[`review-summary`,n.token,n.expires,n.signature,r?.url],rV(e,n,r),On(e))),aV=It(({connection:e,scope:t})=>Ei(e,t,[`review`],he(function*(){let{review:n}=yield*(yield*fi(e)).request(e=>e.reviews.readPublishedReview({params:{worktreeId:t.worktreeId}})),r=n??null;return yield*Pt(e,r===null||r.environmentId===e.environmentId&&r.worktreeId===t.worktreeId),r}),On(e)).pipe(mi(Tt(Pr)),cn(0))),oV=It(({connection:e,scope:t,proofId:n})=>Ei(e,t,[`proof`,n],he(function*(){let r=yield*(yield*fi(e)).request(e=>e.reviews.readProofFile({params:{worktreeId:t.worktreeId},query:{proofId:n}}));return yield*Pt(e,r.id===n),r}),On(e)));It(e=>rt(e.scope,`reviewed-layers`,Xz,Zz(e)));var sV=class e extends Dr()(`@porcelain/client/CommentThreadsState`){static layer(t,n){return He(e,he(function*(){let e=yield*fi(t);return yield*qa(t,Et.reviewSurface(t.environmentId,n,[`comments`]),he(function*(){let r=yield*e.request(e=>e.reviews.listCommentThreads({params:{worktreeId:n.worktreeId}}));return yield*Pt(t,r.every(e=>e.worktreeId===n.worktreeId)),r}),en(),Et.worktreeReads(t,n,[`comments`]))}))}},cV=It(({connection:e,scope:t})=>e.atoms(n=>ie(sV.layer(e,t),n(On(e).layer)))),lV=It(e=>Er({snapshot:``,filters:new Set,through:0})),uV=It(e=>rt(e.scope,`comments`,sV,cV(e))),dV=It(({connection:e,scope:t})=>{let n=cV({connection:e,scope:t}),r={worktreeId:t.worktreeId},i=Je([Et.inventory(e.environmentId)]);function a(n,r=!1){return he(function*(){let a=yield*(yield*sV).confirm(n.pipe(Sr(n=>Pt(e,n.worktreeId===t.worktreeId))),(e,t)=>Fi(vR(Lr(e,()=>[]),[t])));return r&&(yield*i),a})}function o(e,t){return he(function*(){let n=yield*(yield*sV).confirm(e,t);return yield*i,n})}return{create:n.fn(it(`Reviews.createComment`)(function*(t){return yield*a((yield*fi(e)).request(e=>e.reviews.createCommentThread({params:r,payload:t})))}),{concurrent:!0}),reply:n.fn(it(`Reviews.replyToComment`)(function*({threadId:t,body:n,messageId:i}){return yield*a((yield*fi(e)).request(e=>e.reviews.replyToComment({params:{...r,threadId:t},payload:{body:n,messageId:i}})),!0)}),{concurrent:!0}),resolve:n.fn(it(`Reviews.resolveComment`)(function*({threadId:t,resolved:n}){return yield*a((yield*fi(e)).request(e=>e.reviews.updateCommentThread({params:{...r,threadId:t},payload:{resolved:n}})))}),{concurrent:!0}),edit:n.fn(it(`Reviews.editComment`)(function*({threadId:t,messageId:n,body:i}){return yield*a((yield*fi(e)).request(e=>e.reviews.editCommentMessage({params:{...r,threadId:t},payload:{messageId:n,body:i}})))}),{concurrent:!0}),remove:n.fn(it(`Reviews.deleteComment`)(function*({threadId:n,messageId:i}){return yield*o(he(function*(){let a=yield*kr(e,e=>e.reviews.deleteCommentMessage({params:{...r,threadId:n},query:{messageId:i}}));return yield*Pt(e,a.threadId===n&&(!a.thread||a.thread.worktreeId===t.worktreeId)),a}),(e,t)=>Fi(vR(Lr(e,()=>[]),t.thread?[t.thread]:[],t.thread?[]:[t.threadId])))}),{concurrent:!0}),removeResolved:n.fn(it(`Reviews.deleteResolvedComments`)(function*(t){return yield*o(kr(e,e=>e.reviews.deleteResolvedComments({params:r,payload:{threads:t}})),(e,t)=>Fi(vR(Lr(e,()=>[]),[],t.deleted)))}),{concurrent:!0}),seen:n.fn(it(`Reviews.markCommentsSeen`)(function*(n){return yield*o(he(function*(){let i=yield*kr(e,e=>e.reviews.markCommentsSeen({params:r,payload:{throughRevision:n}}));return yield*Pt(e,i.worktreeId===t.worktreeId),i}),e=>e)}),{concurrent:!0})}});function fV(e,t){return dV({...e,owner:t})}var pV=It(e=>Er(t=>{let{filter:n,...r}=e;if(!n)return;let i=lV(r),a=fV(e,e.owner).seen;t.mount(i),t.mount(a),t.subscribe(uV(e),e=>{if(!O(e))return;let r=e.value,o=r.map(e=>`${e.id}:${e.revision}`).sort().join(`
1321
+ `),s=t.registry.get(i),c=new Set(s.snapshot===o?s.filters:[]);c.add(n);let l=r.reduce((e,t)=>Math.max(e,t.revision),0),u=r.filter(e=>!e.resolved).length,d=n===`all`?l:_R({highest:l,open:u,resolved:r.length-u},c);t.registry.set(i,{snapshot:o,filters:c,through:Math.max(s.through,d??0)}),d!==null&&d>s.through&&t.registry.set(a,d)},{immediate:!0})}));function mV([e,t]){return{result:e,send:(e,n)=>{t(e).then(e=>{Nn(e)&&n?.()})},reset:()=>{t(Mt)}}}function hV(e,t,n=()=>!0){return On(e).atom(he(function*(){let r=yield*kr(e,t);return yield*Pt(e,n(r)),r})).pipe(e.atoms.withReactivity([Et.environment(e.environmentId),Et.inventory(e.environmentId)]),cn(0))}function gV(e){return e.connection.atoms.withReactivity([Et.projectReviews(e.connection.environmentId),Et.durableReview(e.connection.environmentId,e.reviewId)])}var _V=It(e=>hV(e.connection,t=>(e.revision===void 0?t.reviews.readReview({params:{reviewId:e.reviewId}}):t.reviews.readReviewRevision({params:{reviewId:e.reviewId,revision:e.revision}})).pipe(Ir(`ReviewNotFoundError`,()=>yn({review:void 0,revisions:[],revision:void 0}))),t=>(t.review===void 0||t.review.reviewId===e.reviewId)&&(t.revision===void 0||(e.revision===void 0||t.revision.revision===e.revision)&&t.revision.content.environmentId===e.connection.environmentId)).pipe(gV(e))),vV=It(e=>hV(e.connection,t=>t.reviews.listProjectReviews({params:{projectId:e.projectId}}),t=>t.every(t=>t.projectId===e.projectId)).pipe(e.connection.atoms.withReactivity([Et.projectReviews(e.connection.environmentId)]))),yV=It(e=>hV(e.connection,t=>t.reviews.listReviewMarks({params:{reviewId:e.reviewId}})).pipe(gV(e))),bV=It(e=>hV(e.connection,t=>t.reviews.listReviewCommentThreads({params:{reviewId:e.reviewId}}),t=>t.every(t=>t.review?.reviewId===e.reviewId)).pipe(gV(e))),xV=It(e=>hV(e.connection,t=>t.reviews.readReviewFile({params:{reviewId:e.reviewId,revision:e.revision},query:{path:e.path}}))),SV=It(e=>hV(e.connection,t=>t.reviews.readReviewDiffs({params:{reviewId:e.reviewId,revision:e.revision},payload:{paths:e.paths}}))),CV=It(e=>hV(e.connection,t=>t.reviews.readReviewProofFile({params:{reviewId:e.reviewId,revision:e.revision},query:{proofId:e.proofId}}),t=>t.id===e.proofId));It(e=>hV(e.connection,t=>t.reviews.compareReview({params:{reviewId:e.reviewId},query:{from:e.from,to:e.to}}),t=>t.reviewId===e.reviewId&&(e.from===void 0||t.from===e.from)&&(e.to===void 0||t.to===e.to)).pipe(gV(e))),It(e=>hV(e.connection,t=>t.reviews.readReviewInterdiff({params:{reviewId:e.reviewId},query:{from:e.from,to:e.to,path:e.path}}),t=>t.kind===`unavailable`||t.path===e.path&&(e.from===void 0||t.from===e.from)&&(e.to===void 0||t.to===e.to)).pipe(gV(e)));var wV=It(e=>hV(e.connection,t=>t.reviews.readReviewPullRequest({params:{reviewId:e.reviewId}})).pipe(gV(e)));It(e=>hV(e.connection,t=>t.reviews.listProjectPullRequests({params:{projectId:e.projectId}})).pipe(e.connection.atoms.withReactivity([Et.projectReviews(e.connection.environmentId)]))),It(e=>hV(e.connection,t=>t.reviews.readProjectGitHubAccount({params:{projectId:e.projectId}})));var TV=It(e=>On(e.connection).atom(kr(e.connection,t=>t.reviews.setReviewSeen({params:{reviewId:e.reviewId},payload:{revision:e.revision}})))),EV=It(e=>{let t=On(e.connection),n={reviewId:e.reviewId},r=Je([Et.projectReviews(e.connection.environmentId),Et.durableReview(e.connection.environmentId,e.reviewId)]);return{archive:t.fn(it(`Reviews.archive`)(function*(t){let i=yield*kr(e.connection,e=>e.reviews.archiveReview({params:n,payload:t}));return i.archived&&(yield*r),i})),createComment:t.fn(it(`Reviews.createComment`)(function*(t){let i=yield*kr(e.connection,e=>e.reviews.createReviewCommentThread({params:n,payload:t}));return yield*r,i})),reply:t.fn(it(`Reviews.reply`)(function*(t){let{threadId:i,...a}=t,o=yield*kr(e.connection,e=>e.reviews.replyToReviewComment({params:{...n,threadId:i},payload:a}));return yield*r,o})),resolve:t.fn(it(`Reviews.resolve`)(function*(t){let{threadId:i,...a}=t,o=yield*kr(e.connection,e=>e.reviews.updateReviewCommentThread({params:{...n,threadId:i},payload:a}));return yield*r,o})),edit:t.fn(it(`Reviews.edit`)(function*(t){let{threadId:i,...a}=t,o=yield*kr(e.connection,e=>e.reviews.editReviewCommentMessage({params:{...n,threadId:i},payload:a}));return yield*r,o})),deleteComment:t.fn(it(`Reviews.deleteComment`)(function*(t){let i=yield*kr(e.connection,e=>e.reviews.deleteReviewCommentMessage({params:{...n,threadId:t.threadId},query:{messageId:t.messageId}}));return yield*r,i})),deleteResolved:t.fn(it(`Reviews.deleteResolved`)(function*(t){let i=yield*kr(e.connection,e=>e.reviews.deleteResolvedReviewComments({params:n,payload:t}));return yield*r,i})),seen:t.fn(it(`Reviews.seen`)(function*(t){let i=yield*kr(e.connection,e=>e.reviews.setReviewSeen({params:n,payload:{revision:t}}));return yield*r,i})),close:t.fn(it(`Reviews.close`)(function*(){let t=yield*kr(e.connection,e=>e.reviews.setReviewState({params:n,payload:{state:`closed`}}));return yield*r,t})),remove:t.fn(it(`Reviews.remove`)(function*(){let t=yield*kr(e.connection,e=>e.reviews.deleteProjectReview({params:n}));return yield*r,t})),completeDecision:t.fn(it(`Reviews.completeDecision`)(function*(t){return yield*he(function*(){for(let r of t.files)yield*kr(e.connection,e=>e.reviews.setReviewMark({params:n,payload:{kind:`file`,revision:t.revision,...r}}));return yield*kr(e.connection,e=>e.reviews.setReviewMark({params:n,payload:{kind:`decision`,revision:t.revision,layerId:t.layerId,fingerprint:t.fingerprint}}))}).pipe($t(r))})),mark:t.fn(it(`Reviews.mark`)(function*(t){let i=yield*kr(e.connection,e=>(t.kind,e.reviews.setReviewMark({params:n,payload:t})));return yield*r,i})),unmark:t.fn(it(`Reviews.unmark`)(function*(t){let i=yield*kr(e.connection,e=>(t.kind,e.reviews.removeReviewMark({params:n,payload:t})));return yield*r,i}))}});It(e=>On(e.connection).fn(it(`Reviews.setGitHubAccount`)(function*(t){let n=yield*kr(e.connection,n=>n.reviews.setProjectGitHubAccount({params:{projectId:e.projectId},payload:t}));return yield*Je([Et.inventory(e.connection.environmentId),Et.projectReviews(e.connection.environmentId)]),n})));var DV=It(e=>Kt(t=>{let n=[],r=[],i=[],a=!1;function o(e,t){return M(e)&&(a=!0),st(e)&&r.push(`${t} could not be read.`),Gn(ar(e))}for(let r of e){let e=o(t(Eo(r)),`Projects`);if(e)for(let a of e.projects){i.push({connection:r,project:a,environmentName:e.environment.name});let s=o(t(vV({connection:r,projectId:a.id})),`Reviews for ${a.name}`),c=new Set;for(let i of s??[]){let s={connection:r,reviewId:i.reviewId},l=t(_V(s)),u=t(yV(s)),d=o(l,`Review on ${i.branch}`)?.revision,f=o(u,`Progress on ${i.branch}`),p=i.pullRequest?Gn(ar(t(wV(s)))):void 0,m=a.worktrees.find(e=>UF(e.branch)===i.branch&&(!d||e.path===d.worktreePath)),h=i.archived===!0||i.state===`closed`||p?.kind===`available`&&p.pullRequest.state!==`open`;m&&!h&&c.add(m.id),(h||!m?.main)&&(M(l)||M(u)||n.push({key:`${r.environmentId}/${i.reviewId}`,environmentId:r.environmentId,environmentName:e.environment.name,projectId:a.id,projectName:a.name,worktreeId:m?.id,path:m?.path??d?.worktreePath,reviewId:i.reviewId,branch:i.branch,title:Nz(i,d,p?.kind===`available`?p.pullRequest.title:void 0),closed:h,archived:i.archived===!0,archivable:!i.archived&&p?.kind===`available`&&p.pullRequest.state!==`open`,publishedAt:d?.publishedAt,pullRequestNumber:i.pullRequest?.split(`/`).filter(Boolean).at(-1),disabled:!a.available||m?.available===!1,...Mz({revision:d,marks:f,status:m?.status}),...h?{group:`Closed`}:{},...i.archived||p?.kind===`available`&&p.pullRequest.state!==`open`?{badges:[{label:i.archived?`Archived`:p?.kind===`available`?`PR ${p.pullRequest.state}`:`Closed`,variant:`secondary`}]}:{}}))}for(let t of a.worktrees)(t.main||!c.has(t.id))&&n.push({key:`${r.environmentId}/${a.id}/${t.id}`,environmentId:r.environmentId,environmentName:e.environment.name,projectId:a.id,projectName:a.name,worktreeId:t.id,path:t.path,branch:UF(t.branch),title:t.main?a.name:t.branch?UF(t.branch):t.path,group:t.main?`Projects`:`No review`,closed:!1,reviewed:0,total:0,badges:[],disabled:!a.available||!t.available})}}return n.sort((e,t)=>(t.publishedAt??``).localeCompare(e.publishedAt??``)||e.title.localeCompare(t.title)||e.key.localeCompare(t.key)),{entries:n,loading:a,messages:r,projects:i}})),OV=It(e=>n((t,n)=>{let r=n(DV(e));n.set(vo(e),void 0);for(let{connection:e,project:t}of r.projects)n.refresh(vV({connection:e,projectId:t.id}));for(let t of r.entries){let r=e.find(e=>e.environmentId===t.environmentId);if(!r||!t.reviewId)continue;let i={connection:r,reviewId:t.reviewId};n.refresh(_V(i)),n.refresh(yV(i)),n.refresh(wV(i))}}));function kV(e,t,n,r){let i=(0,$.c)(14),a;i[0]!==e||i[1]!==t?(a=EV({connection:e,reviewId:t}),i[0]=e,i[1]=t,i[2]=a):a=i[2];let o;i[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={mode:`promise`},i[3]=o):o=i[3];let[s,c]=Vi(a.archive,o),l=ec(),u=Za(),d=e.environmentId===u?.environmentId?void 0:e.environmentId,f;i[4]!==r||i[5]!==d||i[6]!==l||i[7]!==n||i[8]!==t||i[9]!==c?(f=async e=>{e.confirmation&&r&&r();let i;try{e.confirmation&&await l({to:`/reviews/$reviewId`,params:{reviewId:t},search:{environment:d,decision:void 0}}),i=await c(e)}catch{return}return i.archived&&n&&n(),i},i[4]=r,i[5]=d,i[6]=l,i[7]=n,i[8]=t,i[9]=c,i[10]=f):f=i[10];let p;return i[11]!==s||i[12]!==f?(p={result:s,submit:f},i[11]=s,i[12]=f,i[13]=p):p=i[13],p}function AV(e){let t=(0,$.c)(6),{connection:n,reviewId:r}=e,{preferences:i}=Cl(),{setOpenMobile:a}=qL(),{submit:o}=kV(n,r),s;return t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==o?(s=(0,Q.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>{let e=Sj(i);fI.openWithPayload({connection:n,reviewId:r,options:e,requestId:crypto.randomUUID(),beforeLeave:()=>a(!1)}),o({options:e})},children:`Archive`}),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o,t[5]=s):s=t[5],s}function jV(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(Zj,{handle:fI,children:MV}),e[0]=t):t=e[0],t}function MV(e){let{payload:t}=e;return t&&(0,Q.jsx)(NV,{...t},t.requestId)}function NV(e){let t=(0,$.c)(31),{connection:n,reviewId:r,options:i,beforeLeave:a}=e,{result:o,submit:s}=kV(n,r,PV,a),[c,l]=(0,Z.useState)(!1),u;t[0]===o?u=t[1]:(u=O(o)?o.value:void 0,t[0]=o,t[1]=u);let d=u?.plan,f=`Checking the worktree and branches…`;if(st(o)&&(f=`Archiving could not be completed.`),d){let e;t[2]===d?e=t[3]:(e=Uz(d),t[2]=d,t[3]=e),f=e}let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(bM,{children:`Archive review?`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Q.jsxs)(vM,{children:[p,(0,Q.jsx)(xM,{className:`whitespace-pre-wrap [overflow-wrap:anywhere]`,children:f})]}),t[5]=f,t[6]=m);let h;t[7]===o?h=t[8]:(h=st(o)?(0,Q.jsx)(`p`,{role:`alert`,children:Wz(nt(o.cause))}):null,t[7]=o,t[8]=h);let g;t[9]!==c||t[10]!==d?(g=d&&(d.dirty||d.unpushed)?(0,Q.jsxs)(Ds,{orientation:`horizontal`,children:[(0,Q.jsx)(da,{checked:c,onCheckedChange:l,id:`archive-discard-changes`}),(0,Q.jsx)(_s,{htmlFor:`archive-discard-changes`,children:`I understand the risk of losing changes and commits`})]}):null,t[9]=c,t[10]=d,t[11]=g):g=t[11];let _;t[12]===o.waiting?_=t[13]:(_=(0,Q.jsx)(CM,{disabled:o.waiting,children:`Cancel`}),t[12]=o.waiting,t[13]=_);let v=o.waiting||!d||(d.dirty||d.unpushed)&&!c,y;t[14]!==c||t[15]!==i||t[16]!==d||t[17]!==s?(y=()=>{d&&s({options:i,confirmation:{plan:d,discardChanges:c}})},t[14]=c,t[15]=i,t[16]=d,t[17]=s,t[18]=y):y=t[18];let b=o.waiting?`Checking…`:`Archive review`,x;t[19]!==v||t[20]!==y||t[21]!==b?(x=(0,Q.jsx)(X,{variant:`destructive`,disabled:v,onClick:y,children:b}),t[19]=v,t[20]=y,t[21]=b,t[22]=x):x=t[22];let S;t[23]!==x||t[24]!==_?(S=(0,Q.jsxs)(yM,{children:[_,x]}),t[23]=x,t[24]=_,t[25]=S):S=t[25];let C;return t[26]!==S||t[27]!==m||t[28]!==h||t[29]!==g?(C=(0,Q.jsxs)(_M,{children:[m,h,g,S]}),t[26]=S,t[27]=m,t[28]=h,t[29]=g,t[30]=C):C=t[30],C}function PV(){return fI.close()}function FV(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=uo({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=Po(a,!0,!0),u=aa(),[d,f]=Z.useState(),p=d===null?void 0:d??u,m=gr(e=>{let t=!a,n=_r(ot,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return Z.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var IV=Z.createContext(void 0);function LV(){let e=Z.useContext(IV);if(e===void 0)throw Error(An(15));return e}var RV=`data-open`,zV=`data-closed`,BV=$e,VV=`data-panel-open`,HV={[RV]:``},UV={[zV]:``},WV={open(e){return e?{[VV]:``}:null}},GV={open(e){return e?HV:UV},...an},KV=Z.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=gr(o),d=FV({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=Z.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=Z.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=U(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:GV});return(0,Q.jsx)(IV.Provider,{value:p,children:m})}),qV={...WV,...an},JV=Z.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=LV(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=D({disabled:c,focusableWhenDisabled:!0,native:u});return U(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:qV})}),YV={height:void 0,width:void 0};function XV(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=Z.useRef(null),f=Z.useRef(null),[p,m]=Z.useState(YV),h=Z.useRef(YV),g=Z.useRef(!1),_=Z.useRef(s),v=Z.useRef(!1),[y,b]=Z.useState(!1),x=Z.useRef(null),S=B(t,d),C=Ro(s),w=Ki(d),T=!s&&!a,E=y?`idle`:u,D=s&&(_.current||v.current),O=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,k=n&&T&&f.current!==`css-animation`,A=gr((e,t=!0)=>{t&&(h.current=e),m(e)}),j=gr(()=>{x.current?.(),x.current=null}),M=gr(e=>{j(),x.current=()=>{x.current=null,e()}}),N=gr(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});Rr(()=>{y&&u!==`starting`&&b(!1)},[y,u]),Z.useEffect(()=>()=>{N(),j()},[N,j]),Rr(()=>{let e=d.current;if(!e)return;!s&&x.current&&j();let t=QV(e,D);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=ZV(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){A(ZV(e)),b(!0);return}if(t===`css-transition`){let t=tH(e);if(A(ZV(e)),!n)return t;let r=eH(e,`transition-duration`,`0s`);return M(r),b(!0),t}A(ZV(e));let r=eH(e,`animation-name`,`none`);if(!n){r();return}let i=eH(e,`animation-duration`,`0s`);r(),M(i),b(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(_.current=!1,v.current=!1,t===`none`){A(YV,!1),c(!1);return}A(ZV(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=ZV(e);if(!(n.height>0||n.width>0)){c(!1);return}A(n),t===`css-animation`&&eH(e,`animation-name`,`none`)()},[a,s,j,A,c,M,D,u]),Ue({enabled:s&&a&&E===`idle`,open:!0,ref:d,onComplete(){s&&A(YV,!1)}}),Z.useEffect(()=>{if(s||!a||E!==`ending`||!d.current)return;let e=new AbortController,t=-1;function n(){C.current||(c(!1),A(YV,!1))}return t=Ji.request(()=>{w(n,e.signal)}),()=>{Ji.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),Rr(()=>{let e=d.current;e&&n&&T&&e.setAttribute(`hidden`,`until-found`)},[T,n]),Z.useEffect(function(){let e=d.current;if(!e)return;function t(e){let t=_r(rn,e);o(!0,t),!t.isCanceled&&(g.current=!0,l(!0))}return vt(e,`beforematch`,t)},[o,l]);let P=i||n||a||s;return{height:O.height,props:{...k?{[BV]:``}:void 0,hidden:T,id:r},ref:S,shouldPreventOpenAnimation:D,shouldRender:P,transitionStatus:E,width:O.width}}function ZV(e){return{height:e.scrollHeight,width:e.scrollWidth}}function QV(e,t){let n=Re(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&$V(n.animationDuration),i=$V(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function $V(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function eH(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===``){e.style.removeProperty(t);return}e.style.setProperty(t,r,i)}}function tH(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{if(n===``){e.style.removeProperty(t);return}e.style.setProperty(t,n)})}let r=Ji.request(n);return()=>{Ji.cancel(r),n()}}var nH=`--collapsible-panel-height`,rH=`--collapsible-panel-width`,iH=Z.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{defaultPanelId:l,mounted:u,onOpenChange:d,open:f,setMounted:p,setPanelIdState:m,setOpen:h,state:g,transitionStatus:_}=LV(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;Rr(()=>(m(e=>b??(e===null?void 0:e)),()=>{m(e=>e===b?null:e)}),[b,m]);let{height:S,props:C,ref:w,shouldPreventOpenAnimation:T,shouldRender:E,transitionStatus:D,width:O}=XV({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=St(s,k),j=U(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[nH]:S===void 0?`auto`:`${S}px`,[rH]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:GV});return E?j:null});function aH({...e}){return(0,Q.jsx)(KV,{"data-slot":`collapsible`,...e})}function oH({...e}){return(0,Q.jsx)(JV,{"data-slot":`collapsible-trigger`,...e})}function sH({...e}){return(0,Q.jsx)(iH,{"data-slot":`collapsible-content`,...e})}function cH({className:e,...t}){return(0,Q.jsx)(`textarea`,{"data-slot":`textarea`,className:Y(`flex field-sizing-content min-h-16 w-full resize-none rounded-2xl border border-transparent bg-input/50 px-2.5 py-2 text-base transition-[color,box-shadow] duration-200 outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function lH({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:Y(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-2xl border border-transparent bg-input/50 transition-[color,box-shadow] duration-200 outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 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/30 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: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`,e),...t})}var uH=Qr(`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 **:data-[slot=kbd]:rounded-2xl **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1.5 [&>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 dH({className:e,align:t=`inline-start`,...n}){return(0,Q.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:Y(uH({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var fH=Qr(`flex items-center gap-2 rounded-2xl text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-xl px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-xl p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function pH({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,Q.jsx)(X,{type:t,"data-size":r,variant:n,className:Y(fH({size:r}),e),...i})}function mH({className:e,...t}){return(0,Q.jsx)(`span`,{className:Y(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function hH({className:e,...t}){return(0,Q.jsx)(ba,{"data-slot":`input-group-control`,className:Y(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}function gH(e){let t=(0,$.c)(35),{environmentId:n,project:r,onRetry:i}=e,a;t[0]!==n||t[1]!==r?(a={project:r,remote:n},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(jf,{}),t[3]=s):s=t[3];let c;t[4]===r.name?c=t[5]:(c=(0,Q.jsxs)(jN,{children:[s,(0,Q.jsx)(`span`,{className:`truncate`,children:r.name})]}),t[4]=r.name,t[5]=c);let l;t[6]!==i||t[7]!==r?(l=!r.available&&(0,Q.jsxs)(DN,{children:[(0,Q.jsx)(ON,{children:JF(r)}),(0,Q.jsx)(kN,{onClick:i,children:`Retry`})]}),t[6]=i,t[7]=r,t[8]=l):l=t[8];let u;t[9]===r?u=t[10]:(u=()=>At(qF(r),`project path`),t[9]=r,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Qi,{}),t[11]=d):d=t[11];let f;t[12]===u?f=t[13]:(f=(0,Q.jsx)(DN,{children:(0,Q.jsxs)(kN,{onClick:u,children:[d,`Copy path`]})}),t[12]=u,t[13]=f);let p;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(IN,{}),t[14]=p):p=t[14];let m;t[15]===o?m=t[16]:(m=()=>uI.openWithPayload(o),t[15]=o,t[16]=m);let h;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(_p,{}),t[17]=h):h=t[17];let g;t[18]===m?g=t[19]:(g=(0,Q.jsxs)(kN,{onClick:m,children:[h,`Rename project`]}),t[18]=m,t[19]=g);let _;t[20]===o?_=t[21]:(_=()=>dI.openWithPayload(o),t[20]=o,t[21]=_);let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(Nf,{}),t[22]=v):v=t[22];let y;t[23]===_?y=t[24]:(y=(0,Q.jsxs)(kN,{variant:`destructive`,onClick:_,children:[v,`Remove from Porcelain`]}),t[23]=_,t[24]=y);let b;t[25]!==g||t[26]!==y?(b=(0,Q.jsxs)(DN,{children:[g,y]}),t[25]=g,t[26]=y,t[27]=b):b=t[27];let x;t[28]!==b||t[29]!==l||t[30]!==f?(x=(0,Q.jsxs)(MN,{className:`min-w-44`,children:[l,f,p,b]}),t[28]=b,t[29]=l,t[30]=f,t[31]=x):x=t[31];let S;return t[32]!==x||t[33]!==c?(S=(0,Q.jsxs)(AN,{children:[c,x]}),t[32]=x,t[33]=c,t[34]=S):S=t[34],S}function _H(e){let t=(0,$.c)(17),{remotes:n,onOpenProject:r}=e,i=vH;if(!n?.length){let e;return t[0]===r?e=t[1]:(e=i(()=>r(null)),t[0]=r,t[1]=e),e}let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(TN,{render:i(),children:(0,Q.jsx)(Cp,{})}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(ON,{children:`Open project on`}),t[3]=o):o=t[3];let s;t[4]===r?s=t[5]:(s=()=>r(null),t[4]=r,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(es,{}),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,Q.jsxs)(kN,{onClick:s,children:[c,`This computer`]}),t[7]=s,t[8]=l);let u;if(t[9]!==r||t[10]!==n){let e;t[12]===r?e=t[13]:(e=e=>(0,Q.jsx)(yH,{entry:e,onOpen:()=>r(e)},e.remote.environmentId),t[12]=r,t[13]=e),u=n.map(e),t[9]=r,t[10]=n,t[11]=u}else u=t[11];let d;return t[14]!==l||t[15]!==u?(d=(0,Q.jsxs)(wN,{children:[a,(0,Q.jsx)(EN,{align:`end`,className:`w-56`,children:(0,Q.jsxs)(DN,{children:[o,l,u]})})]}),t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function vH(e){return(0,Q.jsx)(X,{variant:`ghost`,size:`icon-sm`,className:`ml-auto`,"aria-label":`Open project`,title:`Open project`,onClick:e,children:(0,Q.jsx)(Cp,{})})}function yH(e){let t=(0,$.c)(11),{entry:n,onOpen:r}=e,i=Hs(n.remote),a=i.kind===`online`,o=!a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Ip,{}),t[0]=s):s=t[0];let c=a?i.name:n.remote.name,l;t[1]===c?l=t[2]:(l=(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:c}),t[1]=c,t[2]=l);let u;t[3]!==a||t[4]!==i?(u=!a&&(0,Q.jsx)(os,{variant:Lo(i),className:`ml-auto`,children:Ya(i)}),t[3]=a,t[4]=i,t[5]=u):u=t[5];let d;return t[6]!==r||t[7]!==o||t[8]!==l||t[9]!==u?(d=(0,Q.jsxs)(kN,{disabled:o,onClick:r,children:[s,l,u]}),t[6]=r,t[7]=o,t[8]=l,t[9]=u,t[10]=d):d=t[10],d}function bH(e){let t=(0,$.c)(123),{inventory:n,remotes:r,selected:i,onSelect:a,onOpenProject:o,onOpenSettings:s,onOpenRemotes:c,onOpenShortcuts:l}=e,{connection:u}=Gs(),{preferences:d,setPreference:f}=Cl(),p=[u,...(r??[]).map(DH)],{entries:m,loading:h,messages:g,projects:_}=at(DV(p)),v=y(OV(p)),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b={query:``,filter:Pz,closed:!1},t[0]=b):b=t[0];let[x,S]=(0,Z.useState)(b),{query:C,filter:w,closed:T}=x,E=zu(),D;t[1]===E.href?D=t[2]:(D={href:E.href,open:!1,query:``},t[1]=E.href,t[2]=D);let[O,k]=(0,Z.useState)(D),A=O.href===E.href&&O.open,j=A?O.query:``,M;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>k(t=>({...t,query:e})),t[3]=M):M=t[3];let N=M,P;t[4]!==m||t[5]!==j?(P=[...new Map(Hz(m,j,Pz,!1).rows.filter(EH).map(TH)).values()],t[4]=m,t[5]=j,t[6]=P):P=t[6];let F=P,I;t[7]!==F||t[8]!==u||t[9]!==i?.remote||t[10]!==i?.worktreeId?(I=F.find(e=>i?.worktreeId===e.worktreeId&&(i?.remote??u.environmentId)===e.environmentId),t[7]=F,t[8]=u,t[9]=i?.remote,t[10]=i?.worktreeId,t[11]=I):I=t[11];let L=I,R;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>S(t=>({...t,query:e})),t[12]=R):R=t[12];let z=R,B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>S(t=>({...t,filter:e})),t[13]=B):B=t[13];let V=B,H;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>S(t=>({...t,closed:e})),t[14]=H):H=t[14];let U=H,W=T?`No closed reviews`:`No matching worktrees`,G=_.length===0?`No projects registered`:W,{rows:ee,filters:te,multipleProjects:K}=Hz(m,C,w,T),{setOpenMobile:ne}=qL(),q;t[15]!==u||t[16]!==a||t[17]!==ne?(q=e=>{e.worktreeId&&(a({remote:e.environmentId===u.environmentId?null:e.environmentId,projectId:e.projectId,worktreeId:e.worktreeId}),ne(!1))},t[15]=u,t[16]=a,t[17]=ne,t[18]=q):q=t[18];let re=q,ie;t[19]!==o||t[20]!==r?(ie=(0,Q.jsx)(_H,{remotes:r,onOpenProject:o}),t[19]=o,t[20]=r,t[21]=ie):ie=t[21];let ae;t[22]!==n.environment.name||t[23]!==ie?(ae=(0,Q.jsx)(xI,{environment:n.environment.name,children:ie}),t[22]=n.environment.name,t[23]=ie,t[24]=ae):ae=t[24];let oe;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(oe=e=>{e.key===`Escape`&&z(``)},t[25]=oe):oe=t[25];let se;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(se=e=>z(e.target.value),t[26]=se):se=t[26];let ce;t[27]===C?ce=t[28]:(ce=(0,Q.jsx)(hH,{type:`search`,"aria-label":`Search reviews and worktrees`,onKeyDown:oe,placeholder:`Search`,value:C,onChange:se}),t[27]=C,t[28]=ce);let le;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Q.jsx)(dH,{children:(0,Q.jsx)(Pp,{})}),t[29]=le):le=t[29];let ue;t[30]===ce?ue=t[31]:(ue=(0,Q.jsxs)(lH,{className:`min-w-0 flex-1`,children:[ce,le]}),t[30]=ce,t[31]=ue);let de;t[32]===E.href?de=t[33]:(de=e=>k({href:E.href,open:e,query:``}),t[32]=E.href,t[33]=de);let fe=w.projects!==void 0||w.environments!==void 0?`secondary`:`outline`,pe;t[34]===fe?pe=t[35]:(pe=(0,Q.jsx)(TN,{render:(0,Q.jsx)(X,{variant:fe,size:`icon`,"aria-label":`Filter reviews`})}),t[34]=fe,t[35]=pe);let me;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Q.jsx)(zf,{}),t[36]=me):me=t[36];let he;t[37]===pe?he=t[38]:(he=(0,Q.jsx)(Sm,{render:pe,children:me}),t[37]=pe,t[38]=he);let ge;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Q.jsx)(Cm,{children:`Filter and open`}),t[39]=ge):ge=t[39];let _e;t[40]===he?_e=t[41]:(_e=(0,Q.jsxs)(xm,{children:[he,ge]}),t[40]=he,t[41]=_e);let ve;t[42]===w?ve=t[43]:(ve=e=>(0,Q.jsxs)(DN,{children:[(0,Q.jsx)(ON,{children:e.label}),e.items.map(t=>(0,Q.jsx)(NN,{checked:t.checked,closeOnClick:!1,onCheckedChange:()=>V({...w,[e.key]:t.next}),children:(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:t.label,children:t.label})},t.id)),(0,Q.jsx)(IN,{})]},e.key),t[42]=w,t[43]=ve);let ye=te.map(ve),be;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Q.jsx)(jN,{children:`Projects`}),t[44]=be):be=t[44];let xe;t[45]!==u||t[46]!==_||t[47]!==v?(xe=_.length===0?(0,Q.jsx)(ms,{children:(0,Q.jsx)(Oo,{children:(0,Q.jsx)(Fs,{children:`No projects registered`})})}):_.map(e=>(0,Q.jsx)(`div`,{role:`group`,"aria-label":e.connection.environmentId===u.environmentId?`This computer`:e.environmentName,children:(0,Q.jsx)(gH,{environmentId:e.connection.environmentId===u.environmentId?null:e.connection.environmentId,project:e.project,onRetry:()=>v(void 0)},`${e.connection.environmentId}/${e.project.id}`)},`${e.connection.environmentId}/${e.project.id}`)),t[45]=u,t[46]=_,t[47]=v,t[48]=xe):xe=t[48];let Se;t[49]===xe?Se=t[50]:(Se=(0,Q.jsxs)(AN,{children:[be,(0,Q.jsx)(MN,{className:`max-h-96 w-80 min-w-72 max-w-[calc(100vw-2rem)] overflow-y-auto`,children:xe})]}),t[49]=xe,t[50]=Se);let Ce,we;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=e=>{e||N(``)},we=(0,Q.jsx)(jN,{children:`Worktrees`}),t[51]=Ce,t[52]=we):(Ce=t[51],we=t[52]);let Te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Q.jsx)(ON,{children:`Open a worktree`}),t[53]=Te):Te=t[53];let Ee;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=e=>N(e.target.value),t[54]=Ee):Ee=t[54];let De;t[55]===j?De=t[56]:(De=(0,Q.jsx)(hH,{type:`search`,"aria-label":`Search worktrees`,placeholder:`Search`,value:j,onChange:Ee,onKeyDown:wH}),t[55]=j,t[56]=De);let Oe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Q.jsx)(dH,{children:(0,Q.jsx)(Pp,{})}),t[57]=Oe):Oe=t[57];let ke;t[58]===De?ke=t[59]:(ke=(0,Q.jsxs)(lH,{children:[De,Oe]}),t[58]=De,t[59]=ke);let Ae=L?.key??``,je;t[60]!==F||t[61]!==re?(je=F.map(e=>(0,Q.jsxs)(FN,{value:e.key,closeOnClick:!0,disabled:e.disabled,onClick:()=>re(e),children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,title:`${e.branch} · ${e.projectName}`,children:[e.branch,` · `,e.projectName]}),(0,Q.jsx)(os,{variant:`secondary`,className:`max-w-1/2`,title:e.environmentName,children:(0,Q.jsx)(`span`,{className:`truncate`,children:e.environmentName})})]},e.key)),t[60]=F,t[61]=re,t[62]=je):je=t[62];let Me;t[63]!==Ae||t[64]!==je?(Me=(0,Q.jsx)(PN,{value:Ae,children:je}),t[63]=Ae,t[64]=je,t[65]=Me):Me=t[65];let Ne;t[66]!==F.length||t[67]!==h?(Ne=!h&&F.length===0?(0,Q.jsx)(ms,{children:(0,Q.jsx)(Oo,{children:(0,Q.jsx)(Fs,{children:`No matching worktrees`})})}):null,t[66]=F.length,t[67]=h,t[68]=Ne):Ne=t[68];let Pe;t[69]!==ke||t[70]!==Me||t[71]!==Ne?(Pe=(0,Q.jsxs)(AN,{highlightItemOnHover:!1,onOpenChange:Ce,children:[we,(0,Q.jsx)(MN,{className:`max-h-96 w-80 min-w-72 max-w-[calc(100vw-2rem)] overflow-y-auto`,children:(0,Q.jsxs)(DN,{children:[Te,ke,Me,Ne]})})]}),t[69]=ke,t[70]=Me,t[71]=Ne,t[72]=Pe):Pe=t[72];let Fe;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,Q.jsx)(kN,{onClick:()=>V(Pz),children:`Clear filters`}),t[73]=Fe):Fe=t[73];let Ie=T?`Back to reviews`:`Closed reviews`,Le;t[74]===T?Le=t[75]:(Le=()=>U(!T),t[74]=T,t[75]=Le);let J;t[76]!==T||t[77]!==Ie||t[78]!==Le?(J=(0,Q.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":Ie,"aria-pressed":T,onClick:Le}),t[76]=T,t[77]=Ie,t[78]=Le,t[79]=J):J=t[79];let Re;t[80]===T?Re=t[81]:(Re=T?(0,Q.jsx)(Rd,{}):(0,Q.jsx)(Pd,{}),t[80]=T,t[81]=Re);let ze;t[82]!==J||t[83]!==Re?(ze=(0,Q.jsx)(Sm,{render:J,children:Re}),t[82]=J,t[83]=Re,t[84]=ze):ze=t[84];let Be=T?`Back to reviews`:`Closed reviews`,Ve;t[85]===Be?Ve=t[86]:(Ve=(0,Q.jsx)(Cm,{children:Be}),t[85]=Be,t[86]=Ve);let He;t[87]!==ze||t[88]!==Ve?(He=(0,Q.jsxs)(xm,{children:[ze,Ve]}),t[87]=ze,t[88]=Ve,t[89]=He):He=t[89];let Ue=ZL,We;t[90]===h?We=t[91]:(We=h&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Ko,{"aria-label":`Reading worktrees`}),`Reading worktrees…`]}),t[90]=h,t[91]=We);let Ge=(T?[`Closed`]:jz).map(e=>{let t=e===`Closed`?ee:ee.filter(t=>t.group===e);return t.length===0?null:(0,Q.jsx)(QL,{children:(0,Q.jsxs)(aH,{open:d.reviewListGroupOpen[e]??!0,onOpenChange:t=>f(`reviewListGroupOpen`,{...d.reviewListGroupOpen,[e]:t}),className:`group/review-list`,children:[(0,Q.jsxs)($L,{render:(0,Q.jsx)(oH,{}),className:`h-7 w-full cursor-pointer`,children:[e,` · `,t.length,(0,Q.jsx)(Na,{className:`ml-auto group-data-closed/review-list:-rotate-90`})]}),(0,Q.jsx)(sH,{children:(0,Q.jsx)(eR,{children:t.map(e=>{let t=Lz(e),n=Rz(e,K),r={destructive:{Icon:Jd,className:`text-destructive`},primary:{Icon:ac,className:`text-primary`},muted:{Icon:ef,className:`text-muted-foreground`}}[t?.tone??`muted`];return(0,Q.jsxs)(tR,{className:`flex items-start`,children:[(0,Q.jsx)(rR,{size:`lg`,className:`min-w-0 flex-1`,"aria-label":e.reviewId?`${e.title}, ${e.reviewed} of ${e.total} decisions reviewed, ${zz(e,Date.now())}, ${e.environmentName}, ${e.badges.map(CH).join(`, `)}`:void 0,disabled:!e.reviewId&&e.disabled,isActive:!T&&e.worktreeId!==void 0&&i?.worktreeId===e.worktreeId&&(i?.remote??u.environmentId)===e.environmentId,onClick:()=>e.reviewId?ne(!1):re(e),render:e.reviewId?(0,Q.jsx)(rc,{to:`/reviews/$reviewId`,params:{reviewId:e.reviewId},search:{environment:e.environmentId===u.environmentId?void 0:e.environmentId,decision:void 0}}):void 0,children:(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.title,children:e.title}),e.reviewId?(0,Q.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,"aria-label":`${e.reviewed} of ${e.total} decisions reviewed`,children:[e.reviewed,`/`,e.total]}):null]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-xs text-muted-foreground`,children:[t?(0,Q.jsxs)(xm,{children:[(0,Q.jsx)(Sm,{render:(0,Q.jsx)(`span`,{role:`img`,"aria-label":`Review status`,className:`inline-flex shrink-0`}),children:(0,Q.jsx)(r.Icon,{"aria-hidden":!0,className:r.className})}),(0,Q.jsx)(Cm,{children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{children:zz(e,Date.now())}),e.badges.length?e.badges.map(SH):(0,Q.jsx)(`p`,{children:t.reason})]})})]}):null,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1`,children:[n.project?(0,Q.jsx)(`span`,{className:n.branch?`min-w-0 max-w-1/2 truncate`:`min-w-0 flex-1 truncate`,title:n.project,children:n.project}):null,n.branch?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:n.branch,children:n.branch}):null]}),(0,Q.jsx)(os,{variant:`secondary`,className:`max-w-1/2`,title:e.environmentName,children:(0,Q.jsx)(`span`,{className:`truncate`,children:e.environmentName})})]})]})}),e.archivable&&e.reviewId?(0,Q.jsx)(AV,{connection:p.find(t=>t.environmentId===e.environmentId)??u,reviewId:e.reviewId}):null]},e.key)})})})]})},e)}),Ke;t[92]===Ge?Ke=t[93]:(Ke=(0,Q.jsx)(`div`,{className:`flex flex-col -space-y-1`,children:Ge}),t[92]=Ge,t[93]=Ke);let qe;t[94]!==G||t[95]!==h||t[96]!==ee?(qe=!h&&ee.length===0&&(0,Q.jsx)(ms,{children:(0,Q.jsxs)(Oo,{children:[(0,Q.jsx)(Fs,{children:G}),(0,Q.jsx)(Os,{children:`Try another search or clear the filters.`})]})}),t[94]=G,t[95]=h,t[96]=ee,t[97]=qe):qe=t[97];let Je;t[98]===g?Je=t[99]:(Je=g.map(xH),t[98]=g,t[99]=Je);let Ye;t[100]!==g.length||t[101]!==v?(Ye=g.length>0&&(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>v(void 0),children:`Read again`}),t[100]=g.length,t[101]=v,t[102]=Ye):Ye=t[102];let Xe;t[103]!==Ue||t[104]!==We||t[105]!==Ke||t[106]!==qe||t[107]!==Je||t[108]!==Ye?(Xe=(0,Q.jsxs)(Ue,{children:[We,Ke,qe,Je,Ye]}),t[103]=Ue,t[104]=We,t[105]=Ke,t[106]=qe,t[107]=Je,t[108]=Ye,t[109]=Xe):Xe=t[109];let Ze;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,Q.jsx)(Rp,{}),t[110]=Ze):Ze=t[110];let Qe;t[111]===s?Qe=t[112]:(Qe=(0,Q.jsxs)(X,{variant:`ghost`,size:`sm`,onClick:s,children:[Ze,`Settings`]}),t[111]=s,t[112]=Qe);let $e;t[113]!==c||t[114]!==r?($e=r?.map(e=>{let{remote:t}=e;return(0,Q.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>c(t.environmentId),children:t.name},t.environmentId)}),t[113]=c,t[114]=r,t[115]=$e):$e=t[115];let et;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Q.jsx)(Yf,{}),t[116]=et):et=t[116];let tt;t[117]===l?tt=t[118]:(tt=(0,Q.jsx)(`div`,{className:`ml-auto`,children:(0,Q.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Keyboard shortcuts`,onClick:l,children:et})}),t[117]=l,t[118]=tt);let nt;return t[119]!==Qe||t[120]!==$e||t[121]!==tt?(nt=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center gap-1 border-t p-2`,children:[Qe,$e,tt]}),t[119]=Qe,t[120]=$e,t[121]=tt,t[122]=nt):nt=t[122],(0,Q.jsx)(`div`,{className:`h-full min-h-0 overflow-hidden rounded-xl border bg-card text-ui [--sidebar:var(--card)] [--sidebar-foreground:var(--foreground)]`,children:(0,Q.jsxs)(YL,{role:`navigation`,collapsible:`none`,className:`h-full w-full min-h-0 overflow-hidden`,"aria-label":`Projects and worktrees`,children:[ae,(0,Q.jsxs)(`div`,{className:`flex gap-1 p-2`,children:[ue,(0,Q.jsxs)(wN,{highlightItemOnHover:!1,open:A,onOpenChange:de,children:[_e,(0,Q.jsxs)(EN,{align:`end`,className:`max-h-96 w-80 min-w-72 max-w-[calc(100vw-2rem)] overflow-y-auto`,children:[ye,Se,Pe,Fe]})]}),He]}),Xe,nt]})})}function xH(e){return(0,Q.jsx)(`p`,{role:`status`,className:`px-3 text-xs`,children:e},e)}function SH(e){return(0,Q.jsx)(`p`,{children:e.label},e.label)}function CH(e){return e.label}function wH(e){[`Escape`,`ArrowDown`,`ArrowUp`,`Tab`].includes(e.key)||e.stopPropagation()}function TH(e){return[`${e.environmentId}/${e.worktreeId}`,e]}function EH(e){return e.worktreeId}function DH(e){return e.connection}var OH=It(e=>Er(t=>{t.mount(e);let n=t.registry;t.addFinalizer(()=>{n.getNodes().has(e)&&(n.get(e).waiting||n.set(e,Mt))})}));function kH(e,t){let n=(0,$.c)(9),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promise`},n[0]=r):r=n[0];let[i,a]=Vi(e,r),o;n[1]===e?o=n[2]:(o=OH(e),n[1]=e,n[2]=o),tn(o);let s;n[3]!==t||n[4]!==a?(s=e=>a(e).then(t,AH),n[3]=t,n[4]=a,n[5]=s):s=n[5];let c;return n[6]!==i||n[7]!==s?(c={result:i,submit:s},n[6]=i,n[7]=s,n[8]=c):c=n[8],c}function AH(){}function jH(e,t){let n=(0,$.c)(2),r;return n[0]===e?r=n[1]:(r=Ys(e),n[0]=e,n[1]=r),kH(r,t)}function MH(e,t){let n=(0,$.c)(2),r;return n[0]===e?r=n[1]:(r=Bs(e),n[0]=e,n[1]=r),kH(r,t)}var NH=Ne;function PH(e){let t=(0,$.c)(4),{remote:n,connection:r,children:i}=e,a;return t[0]!==i||t[1]!==r||t[2]!==n?(a=n===null?i({connection:r,unavailable:void 0}):(0,Q.jsx)(FH,{environmentId:n,children:i}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function FH(e){let t=(0,$.c)(3),{environmentId:n,children:r}=e,i=sa(n),a;return t[0]!==r||t[1]!==i?(a=i&&(0,Q.jsx)(IH,{entry:i,children:r}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function IH(e){let t=(0,$.c)(6),{entry:n,children:r}=e,i=Hs(n.remote),a;t[0]===i?a=t[1]:(a=i.kind===`online`?void 0:`${Ya(i)}. ${Ws(i)??`Wait for this computer to answer before changing its projects.`}`,t[0]=i,t[1]=a);let o;return t[2]!==r||t[3]!==n.connection||t[4]!==a?(o=r({connection:n.connection,unavailable:a}),t[2]=r,t[3]=n.connection,t[4]=a,t[5]=o):o=t[5],o}function LH(e){let t=(0,$.c)(5),{unavailable:n,result:r}=e,i;t[0]!==r||t[1]!==n?(i=n??(st(r)?qs(nt(r.cause)):void 0),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;return t[3]===a?o=t[4]:(o=a&&(0,Q.jsx)(Ho,{variant:`destructive`,children:(0,Q.jsx)(bo,{children:a})}),t[3]=a,t[4]=o),o}function RH(e){let t=(0,$.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(Zj,{handle:dI,children:e=>{let{payload:t}=e;return t&&(0,Q.jsx)(PH,{remote:t.remote,connection:n,children:e=>(0,Q.jsx)(_M,{children:(0,Q.jsx)(zH,{project:t.project,...e},t.project.id)})})}}),t[0]=n,t[1]=r),r}function zH(e){let t=(0,$.c)(32),{project:n,connection:r,unavailable:i}=e,a=MH(r,BH),{result:o}=a,s;t[0]===n.name?s=t[1]:(s=(0,Q.jsxs)(bM,{children:[`Remove `,n.name,` from Porcelain?`]}),t[0]=n.name,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(xM,{children:`Removes this project and its reviews and comments from Porcelain; files and Git history stay on disk.`}),t[2]=c):c=t[2];let l;t[3]===s?l=t[4]:(l=(0,Q.jsxs)(vM,{children:[s,c]}),t[3]=s,t[4]=l);let u;t[5]===n?u=t[6]:(u=qF(n),t[5]=n,t[6]=u);let d;t[7]===u?d=t[8]:(d=(0,Q.jsx)(`p`,{className:`break-all font-mono text-xs text-muted-foreground`,children:u}),t[7]=u,t[8]=d);let f;t[9]!==o||t[10]!==i?(f=(0,Q.jsx)(LH,{unavailable:i,result:o}),t[9]=o,t[10]=i,t[11]=f):f=t[11];let p;t[12]===o.waiting?p=t[13]:(p=(0,Q.jsx)(CM,{disabled:o.waiting,children:`Cancel`}),t[12]=o.waiting,t[13]=p);let m=o.waiting||i!==void 0,h;t[14]!==n.id||t[15]!==a?(h=()=>void a.submit(n.id),t[14]=n.id,t[15]=a,t[16]=h):h=t[16];let g;t[17]===o.waiting?g=t[18]:(g=o.waiting&&(0,Q.jsx)(Ko,{}),t[17]=o.waiting,t[18]=g);let _=o.waiting?`Removing…`:`Remove from Porcelain`,v;t[19]!==g||t[20]!==_||t[21]!==m||t[22]!==h?(v=(0,Q.jsxs)(SM,{variant:`destructive`,disabled:m,onClick:h,children:[g,_]}),t[19]=g,t[20]=_,t[21]=m,t[22]=h,t[23]=v):v=t[23];let y;t[24]!==v||t[25]!==p?(y=(0,Q.jsxs)(yM,{children:[p,v]}),t[24]=v,t[25]=p,t[26]=y):y=t[26];let b;return t[27]!==y||t[28]!==l||t[29]!==d||t[30]!==f?(b=(0,Q.jsxs)(Q.Fragment,{children:[l,d,f,y]}),t[27]=y,t[28]=l,t[29]=d,t[30]=f,t[31]=b):b=t[31],b}function BH(){return dI.close()}var VH=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function HH(e,t){return new VH(e,t).maybeExecute}var UH=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},WH=new class extends UH{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function GH(e,t){return typeof e==`function`?e(t):e}function KH(e,t){return eU(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function qH(e,t,n){let r=eU(t);function i(e){if(!r.length)return GH(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function JH(e,t){let n=eU(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var YH=46,XH=91,ZH=93,QH=48,$H=57;function eU(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===XH),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===YH||s===XH||s===ZH){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==QH),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==ZH&&(a!==-1||s!==ZH)&&(a!==s||s!==YH&&s!==XH)&&n.push(``);r=o+1,i=!0}else(s<QH||s>$H)&&(i=!1);a=s}return n.length||n.push(``),n}function tU(e){return!(Array.isArray(e)&&e.length===0)}function nU(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function rU(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var iU=e=>!!e&&typeof e==`object`&&`fields`in e;function aU(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!aU(e[i],t[i]))return!1;return!0}var oU=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},sU=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function cU(e,t){return e==null?t:{...e,...t}}for(var lU=256,uU=[],dU;lU--;)uU[lU]=(lU+256).toString(16).substring(1);function fU(){let e=0,t,n=``;if(!dU||lU+16>256){for(dU=Array(256),e=256;e--;)dU[e]=256*Math.random()|0;e=0,lU=0}for(;e<16;e++)t=dU[lU+e],n+=e===6?uU[t&15|64]:e===8?uU[t&63|128]:uU[t],e&1&&e>1&&e<11&&(n+=`-`);return lU++,n}var pU=HH(e=>WH.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function mU(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=mU(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,mU(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(mU(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=mU(e[n]));return t}function hU(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var gU=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function _U(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var vU=(e,t)=>{let n=_U(e,t);return{form:n,fields:n}},yU={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:vU(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:vU(r.issues,e)}},bU=e=>!!e&&`~standard`in e,xU={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function SU(e){function t(t){let n=e.getFieldMeta(t)??xU;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>xU;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function CU(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var wU=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{pU(this)}),t=WH.on(`request-form-state`,e=>{e.payload.id===this._formId&&WH.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=WH.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=WH.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),WH.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return WH.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!aU(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!aU(e.defaultState,t.defaultState)&&!this.state.isTouched;if(n||r){if(gu(()=>{this.baseStore.setState(()=>CU(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=SU(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}WH.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=qH(t,e.instance.name,e.instance.options.defaultValue))}),CU({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return gu(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return gu(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=nU(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||gU}),r=!1,i={};return gu(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=TU(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=EU(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??xU,r=a?.[e],{newErrorValue:s,newSource:c}=oU({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=xU)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=EU(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=EU(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=rU(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||gU});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=EU(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=TU(r);s&&(i=i?{...i,...s}:s);let c=EU(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??xU,r=i?.[e],{newErrorValue:a,newSource:o}=oU({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=xU)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),gu(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),WH.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),WH.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}gu(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),gu(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),WH.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),WH.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>KH(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:GH(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=xU,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;gu(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:qH(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t.startsWith(`${n}.`)||t.startsWith(`${n}[`)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=JH(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),SU(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],cU(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),SU(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),cU(r,{dontValidate:!0})),SU(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),cU(n,{dontValidate:!0})),SU(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return qH(qH(e,`${t}`,i),`${n}`,r)},cU(r,{dontValidate:!0})),SU(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},cU(r,{dontValidate:!0})),SU(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],cU(t,{dontValidate:!0})),SU(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=KH(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:xU},values:i===void 0?t.values:qH(t.values,e,i)}})},this.setErrorMap=e=>{gu(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(iU(t)){let{formError:e,fieldErrors:r}=TU(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>yU.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>yU.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??fU(),this._devtoolsSubmissionOverride=!1;let t=CU({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(n!==void 0&&iU(n))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=iu(t);let n;this.fieldMetaDerived=iu(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=KH(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!tU(u),f=!o.isDirty,p=aU(l,this.getFieldInfo(a)?.instance?.options.defaultValue??KH(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=iu(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!hU(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&hU(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let T={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(T,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=T}return r});let r;this.store=iu(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&iU(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&aU(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return bU(e.validate)?yU[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function TU(e){return e?iU(e)?{formError:TU(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function EU(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var DU=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...xU,isTouched:e.fieldMetaBase[this.name]?.isTouched??xU.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??xU.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??xU.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(aU(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,cU(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,cU(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,cU(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,cU(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,cU(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,cU(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,cU(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,cU(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=nU(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||gU}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=nU(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||gU});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;gu(()=>{let e=(e,n)=>{let r=kU(n.cause),a=n.validate?OU(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=sU({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=kU(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=rU(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||gU}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=rU(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||gU});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));gu(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=kU(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=OU(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=sU({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),gu(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>hU(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[kU(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[kU(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)(!a.get(t)||t.options.asyncAlways)&&c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>yU.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>yU.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)hU(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=iu(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...xU,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!aU(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return bU(e.validate)?yU[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function OU(e){if(e)return e}function kU(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function AU(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function jU(e){return{...xU,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var MU=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??AU({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(aU(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...xU,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??AU({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;PU(t)&&(n=t.group,r=t.fields);let i=NU(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:AU({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,cU(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof DU&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&hU(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=oU({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=xU)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=nU(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||gU}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=nU(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||gU});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;gu(()=>{let t=(t,r)=>{let i=IU(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&PU(s)&&(c=s.group,l=s.fields);let u=NU(c),d=n[i],{newErrorValue:f,newSource:p}=sU({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=IU(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=rU(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||gU}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=rU(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||gU});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=IU(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&PU(o)&&(l=o.group,u=o.fields);let d=NU(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=sU({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return gu(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>hU(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[IU(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>hU(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),gu(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}gu(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),gu(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=iu(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??jU(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!aU(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(bU(e.validate)){let t=yU[e.type](e.value,e.validate);return e.type===`validate`?FU(t):t.then(FU)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function NU(e){if(e)return e}function PU(e){return!!e&&typeof e==`object`&&`fields`in e}function FU(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function IU(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function LU(e,t){if(!t)return;let n=Object.assign({},e,{state:mU(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return gu(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var RU=typeof window<`u`?Z.useLayoutEffect:Z.useEffect;function zU(e){let[t,n]=(0,Z.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,Z.useState)(()=>new DU({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new DU({...e}),i(a),n({form:e.form,name:e.name}));let o=Uu(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=Uu(a.store,e=>e.meta.isTouched),c=Uu(a.store,e=>e.meta.isBlurred),l=Uu(a.store,e=>e.meta.isDirty),u=Uu(a.store,e=>e.meta.errorMap),d=Uu(a.store,e=>e.meta.errorSourceMap),f=Uu(a.store,e=>e.meta.isValidating),p=(0,Z.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return RU(a.mount,[a]),RU(()=>{a.update(e)}),p}var BU=(({children:e,...t})=>{let n=zU(t),r=(0,Z.useMemo)(()=>GH(e,n),[e,n]);return(0,Q.jsx)(Q.Fragment,{children:r})});function VU(){return(0,Z.useState)(()=>fU())[0]}var HU=Z,UU=`19.2.8`.split(`.`)[0]===`17`?VU:HU.useId;function WU(e){let[t,n]=(0,Z.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,Z.useState)(()=>new MU({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new MU({...e})),n({form:e.form,name:e.name}));let a=Uu(r.store,e=>e.value),o=Uu(r.store,e=>e.meta.isTouched),s=Uu(r.store,e=>e.meta.isBlurred),c=Uu(r.store,e=>e.meta.isDirty),l=Uu(r.store,e=>e.meta.errorMap),u=Uu(r.store,e=>e.meta.errorSourceMap),d=Uu(r.store,e=>e.meta.isValidating),f=Uu(r.store,e=>e.meta.isSubmitting),p=Uu(r.store,e=>e.meta.isSubmitted),m=Uu(r.store,e=>e.meta.submissionAttempts),h=Uu(r.store,e=>e.meta.isSubmitSuccessful),g=Uu(r.store,e=>e.meta.canSubmit),_=Uu(r.store,e=>e.meta.isValid),v=Uu(r.store,e=>e.meta.isFieldsValid),y=Uu(r.store,e=>e.meta.isFieldsValidating),b=Uu(r.store,e=>e.meta.isGroupValid),x=(0,Z.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return RU(r.mount,[r]),RU(()=>{r.update(e)}),x}var GU=(({children:e,...t})=>{let n=WU(t),r=(0,Z.useMemo)(()=>GH(e,n),[e,n]);return(0,Q.jsx)(Q.Fragment,{children:r})});function KU({form:e,selector:t=e=>e,children:n}){let r=Uu(e.store,t);return(0,Q.jsx)(Q.Fragment,{children:GH(n,r)})}function qU(e){let t=UU(),[n,r]=(0,Z.useState)(e?.formId),[i,a]=(0,Z.useState)(()=>new wU({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new wU({...e,formId:n})),r(n)}let o=(0,Z.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,Q.jsx)(BU,{...e,form:i})},e.FormGroup=function(e){return(0,Q.jsx)(GU,{...e,form:i})},e.Subscribe=function(e){return(0,Q.jsx)(KU,{form:i,selector:e.selector,children:e.children})},e},[i]);RU(i.mount,[]),RU(()=>{i.update(e)});let s=(0,Z.useRef)(!1);return RU(()=>{s.current&&e?.transform&&LU(i,e.transform)},[i,e?.transform]),RU(()=>{s.current=!0}),o}function JU(e){let t=(0,$.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(cI,{handle:uI,children:e=>{let{payload:t}=e;return t&&(0,Q.jsx)(PH,{remote:t.remote,connection:n,children:e=>(0,Q.jsx)(TI,{children:(0,Q.jsx)(YU,{project:t.project,...e},t.project.id)})})}}),t[0]=n,t[1]=r),r}function YU(e){let t=(0,$.c)(40),{project:n,connection:r,unavailable:i}=e,a=jH(r,$U),{result:o}=a,s;t[0]===n.name?s=t[1]:(s={name:n.name},t[0]=n.name,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={onChange:NH},t[2]=c):c=t[2];let l;t[3]!==n.id||t[4]!==a?(l=e=>{let{value:t}=e;return a.submit({projectId:n.id,name:t.name})},t[3]=n.id,t[4]=a,t[5]=l):l=t[5];let u;t[6]!==s||t[7]!==l?(u={defaultValues:s,validators:c,onSubmit:l},t[6]=s,t[7]=l,t[8]=u):u=t[8];let d=qU(u),f;t[9]===d?f=t[10]:(f=e=>xs(e,()=>d.handleSubmit()),t[9]=d,t[10]=f);let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsxs)(EI,{children:[(0,Q.jsx)(OI,{children:`Rename project`}),(0,Q.jsx)(kI,{children:`The name is only a label in this sidebar. Nothing on disk changes, and two projects may share one.`})]}),t[11]=p):p=t[11];let m;t[12]===d.Field?m=t[13]:(m=(0,Q.jsx)(d.Field,{name:`name`,children:QU}),t[12]=d.Field,t[13]=m);let h;t[14]===n?h=t[15]:(h=qF(n),t[14]=n,t[15]=h);let g;t[16]===h?g=t[17]:(g=(0,Q.jsx)(`p`,{className:`break-all font-mono text-xs text-muted-foreground`,children:h}),t[16]=h,t[17]=g);let _;t[18]!==m||t[19]!==g?(_=(0,Q.jsxs)(`div`,{className:`grid gap-2 py-4`,children:[m,g]}),t[18]=m,t[19]=g,t[20]=_):_=t[20];let v;t[21]!==o||t[22]!==i?(v=(0,Q.jsx)(LH,{unavailable:i,result:o}),t[21]=o,t[22]=i,t[23]=v):v=t[23];let y;t[24]===o.waiting?y=t[25]:(y=(0,Q.jsx)(X,{type:`button`,variant:`outline`,disabled:o.waiting,onClick:ZU,children:`Cancel`}),t[24]=o.waiting,t[25]=y);let b;t[26]!==o.waiting||t[27]!==i?(b=e=>(0,Q.jsxs)(X,{type:`submit`,disabled:!e||o.waiting||i!==void 0,children:[o.waiting&&(0,Q.jsx)(Ko,{}),o.waiting?`Renaming…`:`Rename`]}),t[26]=o.waiting,t[27]=i,t[28]=b):b=t[28];let x;t[29]!==d.Subscribe||t[30]!==b?(x=(0,Q.jsx)(d.Subscribe,{selector:XU,children:b}),t[29]=d.Subscribe,t[30]=b,t[31]=x):x=t[31];let S;t[32]!==y||t[33]!==x?(S=(0,Q.jsxs)(DI,{children:[y,x]}),t[32]=y,t[33]=x,t[34]=S):S=t[34];let C;return t[35]!==_||t[36]!==v||t[37]!==S||t[38]!==f?(C=(0,Q.jsxs)(`form`,{onSubmit:f,children:[p,_,v,S]}),t[35]=_,t[36]=v,t[37]=S,t[38]=f,t[39]=C):C=t[39],C}function XU(e){return e.canSubmit}function ZU(){return uI.close()}function QU(e){return(0,Q.jsxs)(Ds,{"data-invalid":e.state.meta.isTouched&&!e.state.meta.isValid,children:[(0,Q.jsx)(as,{htmlFor:`project-name`,children:`Name`}),(0,Q.jsx)(ba,{id:`project-name`,name:e.name,value:e.state.value,autoFocus:!0,"aria-invalid":e.state.meta.isTouched&&!e.state.meta.isValid,"aria-describedby":e.state.meta.isTouched&&!e.state.meta.isValid?`project-name-error`:void 0,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value)}),e.state.meta.isTouched&&!e.state.meta.isValid&&(0,Q.jsx)(Yo,{id:`project-name-error`,errors:e.state.meta.errors})]})}function $U(){return uI.close()}function eW(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function tW(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function nW(e){return e/100*window.innerHeight}function rW(e){return e/100*window.innerWidth}function iW(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 aW({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=iW(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=tW(t,i);break;case`em`:r=eW(t,i);break;case`vh`:r=nW(i);break;case`vw`:r=rW(i)}return r}function oW(e){return parseFloat(e.toFixed(3))}function sW({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 cW(e){let{panels:t}=e,n=sW({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=oW(aW({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=oW(aW({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=oW(aW({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=oW(aW({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 lW(e,t=`Assertion error`){if(!e)throw Error(t)}function uW(e,t){return Array.from(t).sort(e===`horizontal`?dW:fW)}function dW(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function fW(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function pW(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function mW(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 hW({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}=mW(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return lW(i,`No rect found`),i}var gW;function _W(){return gW===void 0&&(gW=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),gW}function vW(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=uW(n,Array.from(t.children).filter(pW).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,hW({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p}}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=_W()?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:sW({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 yW=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)}}},bW={cursorFlags:0,state:`inactive`},xW=new yW;function SW(){return bW}function CW(e){return xW.addListener(`change`,e)}function wW(e){let t=bW,n={...bW};n.cursorFlags=e,bW=n,xW.emit(`change`,{prev:t,next:n})}function TW(e){let t=bW;bW=e,xW.emit(`change`,{prev:t,next:e})}var EW=e=>e,DW=()=>{},OW=1,kW=2,AW=4,jW=8,MW=3,NW=12,PW;function FW(){return PW===void 0&&(PW=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(PW=!0)),PW}function IW({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++}})}if(r!==0||i!==0){if(n===`active`&&e&&FW()){let t=(e&OW)!==0,n=(e&kW)!==0,r=(e&AW)!==0,i=(e&jW)!==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`}return FW()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var LW=new WeakMap;function RW(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=LW.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=SW();switch(r.state){case`active`:case`hover`:{let e=IW({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)}LW.set(e,{prevStyle:t,styleSheet:n})}var zW=new Map,BW=new yW;function VW(e){zW=new Map(zW),zW.delete(e)}function HW(e,t){for(let[t]of zW)if(t.id===e)return t}function UW(e,t){for(let[t,n]of zW)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function WW(){return zW}function GW(e,t){return BW.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function KW(e,t,n){let r=zW.get(e);zW=new Map(zW),zW.set(e,t),BW.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function qW(e){let t=SW(),n=WW(),r=!1;return t.state===`active`&&(TW({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(RW(e),r=!0,t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=UW(e.group.id,!0);KW(e.group,t,{isUserInteraction:!0})}))),r}function JW(e){e.defaultPrevented||qW(e.currentTarget)}function YW(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=mW(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)}}return r?{distance:i,hitRegion:r}:void 0}function XW(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ZW(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:rG(e),b:rG(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();lW(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:nG(tG(n.a)),b:nG(tG(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 QW=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function $W(e){let t=getComputedStyle(iG(e)??e).display;return t===`flex`||t===`inline-flex`}function eG(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||$W(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`||QW.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function tG(e){let t=e.length;for(;t--;){let n=e[t];if(lW(n,`Missing node`),eG(n))return n}return null}function nG(e){return e&&Number(getComputedStyle(e).zIndex)||0}function rG(e){let t=[];for(;e;)t.push(e),e=iG(e);return t}function iG(e){let{parentNode:t}=e;return XW(t)?t.host:t}function aG(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 oG({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!pW(n)||n.contains(e)||e.contains(n))return!0;if(ZW(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(aG(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function sG(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=vW(r),a=YW(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&oG({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function cG(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 lG(e,t,n=0){return Math.abs(oW(e)-oW(t))<=n}function uG(e,t){return lG(e,t)?0:e>t?1:-1}function dG({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(uG(r,c)<0){if(a){let e=(i+c)/2;r=uG(r,e)<0?i:c}else r=c}return r=Math.min(s,r),r=oW(r),r}function fG({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(lG(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;lW(u!=null,`Invalid first pivot index`),lW(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];lW(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(lW(n!=null,`Previous layout not found for panel index ${t}`),lG(n,i)){let t=o-n;uG(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];lW(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(lW(n!=null,`Previous layout not found for panel index ${t}`),lG(n,o)){let t=n-i;uG(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];lW(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&uG(i,c)<0){if(e>0){let t=c-o,n=t/2;uG(i+e,c)<0&&(e=uG(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;uG(i-e,c)<0&&(e=uG(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];lW(e!=null,`Previous layout not found for panel index ${r}`);let a=dG({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];lW(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=dG({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!lG(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(cG(c,l))return i;{let t=e<0?d:u,r=s[t];lW(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=dG({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!lG(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];lW(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=dG({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(lG(i,s)||(t-=s-i,l[r]=s),lG(t,0))break;e>0?r--:r++}}}if(!lG(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 pG(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||uG(e[n],t[n])!==0)return!1;return!0}function mG({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(!lG(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];lW(t!=null,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];lW(i!=null,`No layout data found for index ${e}`);let o=r[e];lW(o!=null,`No layout data found for index ${e}`);let s=dG({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!lG(a,0))for(let e=0;e<t.length;e++){let n=r[e];lW(n!=null,`No layout data found for index ${e}`);let i=n+a,o=dG({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,lG(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function hG({groupId:e,panelId:t}){let n=()=>{let t=WW();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&lG(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:oW(100-e)}}return fG({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=mG({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});pG(c,u)||KW(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&lG(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=sW({group:t}),o=oW(aW({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function gG(e){e.defaultPrevented||sG(e,WW()).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=hG({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function _G(e){let t=WW();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 vG({groupId:e}){let t=()=>{let t=WW();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=mG({layout:e,panelConstraints:r});return n?o:(pG(o,c)||KW(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function yG(e,t){let n=_G(e),r=UW(n.id,!0),i=n.separators.find(t=>t.element===e);lW(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);lW(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=vG({groupId:n.id}).getLayout(),c=mG({layout:fG({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});pG(s,c)||KW(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function bG(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=_G(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&yG(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&yG(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&yG(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&yG(t,-5);break;case`End`:e.preventDefault(),yG(t,100);break;case`Enter`:{e.preventDefault();let n=_G(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=UW(n.id,!0),o=n.separators.find(e=>e.element===t);lW(o,`Matching separator not found`);let s=a.get(o);lW(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(lW(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];yG(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=_G(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);lW(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(),yG(t,-100)}}function xG(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=WW(),n=sG(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),TW({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function SG({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=fG({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(pG(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?OW:kW;break;case`vertical`:s|=d<0?AW:jW}}else KW(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&MW:c|=s&MW,t.movementY===0?c|=o&NW:c|=s&NW,wW(c),RW(e)}function CG(e){let t=WW(),n=SW();n.state===`active`&&SG({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function wG(e){if(e.defaultPrevented)return;let t=SW(),n=WW();switch(t.state){case`active`:if(e.buttons===0){TW({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=UW(e.group.id,!0);KW(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.isConnected&&!t.hasPointerCapture?.(e.pointerId)&&t.setPointerCapture?.(e.pointerId)}SG({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=sG(e,n);r.length===0?t.state!==`inactive`&&TW({cursorFlags:0,state:`inactive`}):TW({cursorFlags:0,hitRegions:r,state:`hover`}),RW(e.currentTarget);break}}}function TG(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(SW().state){case`hover`:TW({cursorFlags:0,state:`inactive`})}}function EG(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||qW(e.currentTarget)&&e.preventDefault()}function DG(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=oW(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=oW((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function OG(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=sW({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:oW(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function kG(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 AG(e,t){return e.length===t.length&&e.every((e,n)=>kG(e,t[n]))}function jG({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=oW(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e}}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]=oW((r[e]??0)/a*l);else{let e=oW(l/c.length);for(let t of c)u[t]=e}return u}function MG(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 NG=new Map;function PG(e){let t=!0;lW(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=sW({group:e});if(t===0)return;let n=UW(e.id);if(!n)return;let r=cW(e),i=n.defaultLayoutDeferred?DG(r):n.layout,a=mG({layout:jG({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&pG(n.layout,a)&&AG(n.derivedPanelConstraints,r)&&n.groupSize===t)continue;KW(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else OG(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{lW(!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=sW({group:e}),s=cW(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(MG(e.panels,l)||(l=void 0));let u=mG({layout:e.mutableState.layouts[c]??l??DG(s),panelConstraints:s}),d=e.element.ownerDocument;NG.set(d,(NG.get(d)??0)+1);let f=new Map;return vW(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),KW(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{lW(!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`,bG)}),NG.get(d)===1&&(d.addEventListener(`contextmenu`,JW,!0),d.addEventListener(`dblclick`,gG,!0),d.addEventListener(`pointerdown`,xG,!0),d.addEventListener(`pointerleave`,CG),d.addEventListener(`pointermove`,wG),d.addEventListener(`pointerout`,TG),d.addEventListener(`pointerup`,EG,!0)),function(){t=!1,NG.set(d,Math.max(0,(NG.get(d)??0)-1)),VW(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,bG)}),NG.get(d)||(d.removeEventListener(`contextmenu`,JW,!0),d.removeEventListener(`dblclick`,gG,!0),d.removeEventListener(`pointerdown`,xG,!0),d.removeEventListener(`pointerleave`,CG),d.removeEventListener(`pointermove`,wG),d.removeEventListener(`pointerout`,TG),d.removeEventListener(`pointerup`,EG,!0)),a.disconnect()}}function FG(){let[e,t]=(0,Z.useState)({});return[e,(0,Z.useCallback)(()=>t({}),[])]}function IG(e){let t=(0,Z.useId)();return`${e??t}`}var LG=typeof window<`u`?Z.useLayoutEffect:Z.useEffect;function RG(e){let t=(0,Z.useRef)(e);return LG(()=>{t.current=e},[e]),(0,Z.useCallback)((...e)=>t.current?.(...e),[t])}function zG(...e){return RG(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t}})})}function BG(e){let t=(0,Z.useRef)({...e});return LG(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var VG=(0,Z.createContext)(null);function HG(e,t){let n=(0,Z.useRef)({getLayout:()=>({}),setLayout:EW});(0,Z.useImperativeHandle)(t,()=>n.current,[]),LG(()=>{Object.assign(n.current,vG({groupId:e}))})}function UG({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,Z.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=RG(e=>{pG(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=RG((e,t)=>{pG(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=IG(s),v=(0,Z.useRef)(null),[y,b]=FG(),x=(0,Z.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=zG(v,a);HG(_,o);let C=RG((e,t)=>{let r=SW(),i=HW(e),a=UW(e);if(a){let e=!1;return r.state===`active`&&(e=r.hitRegions.some(e=>e.group===i)),{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=BG({defaultLayout:n,disableCursor:r}),T=(0,Z.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=uW(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=uW(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=HW(_),i=UW(_);r&&i&&KW(r,{...i,derivedPanelConstraints:cW(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,Z.useRef)(null);return LG(()=>{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=PG(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=UW(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=GW(_,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=lG(t.collapsedSize,i[t.panelId]),a=lG(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=SW().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Z.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Q.jsx)(VG.Provider,{value:T,children:(0,Q.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})})}UG.displayName=`Group`;function WG(){let e=(0,Z.useContext)(VG);return lW(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function GG(e,t){let{id:n}=WG(),r=(0,Z.useRef)({collapse:DW,expand:DW,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:DW});(0,Z.useImperativeHandle)(t,()=>r.current,[]),LG(()=>{Object.assign(r.current,hG({groupId:n,panelId:e}))})}function KG({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=IG(c),_=BG({disabled:a}),v=(0,Z.useRef)(null),y=zG(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=WG(),T=d!==null,E=RG((e,t,n)=>{d?.(e,c,n)});LG(()=>{let e=v.current;if(e!==null){let t={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}};return C(t)}},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,Z.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),GG(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Z.useSyncExternalStore)(e=>GW(x,e),D,D),k;return k=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,Q.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...qG,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Q.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}KG.displayName=`Panel`;var qG={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function JG({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=mG({layout:fG({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=mG({layout:fG({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function YG({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=IG(a),l=BG({disabled:n,disableDoubleClick:r}),[u,d]=(0,Z.useState)({}),[f,p]=(0,Z.useState)(`inactive`),[m,h]=(0,Z.useState)(!1),g=(0,Z.useRef)(null),_=zG(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=WG(),C=b===`horizontal`?`vertical`:`horizontal`;LG(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=CW(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=GW(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=n.findIndex(t=>t.panelId===e.id);d(JG({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,Z.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,Q.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}YG.displayName=`Separator`;function XG({className:e,...t}){return(0,Q.jsx)(UG,{"data-slot":`resizable-panel-group`,className:Y(`flex h-full w-full aria-[orientation=vertical]:flex-col`,e),...t})}function ZG({...e}){return(0,Q.jsx)(KG,{"data-slot":`resizable-panel`,...e})}function QG({withHandle:e,className:t,...n}){return(0,Q.jsx)(YG,{"data-slot":`resizable-handle`,className:Y(`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`,t),...n,children:e&&(0,Q.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`})})}function $G(e){let t=(0,$.c)(4),{open:n,onOpenChange:r,children:i}=e,a;return t[0]!==i||t[1]!==r||t[2]!==n?(a=(0,Q.jsx)(bm,{delay:400,children:(0,Q.jsx)(JL,{open:n,onOpenChange:r,children:i})}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function eK(e){let t=(0,$.c)(17),{navigator:n,isMobile:r,open:i,children:a}=e,o=(r||!i)&&`desktop-workspace-without-navigator`,s;t[0]===o?s=t[1]:(s=Y(`h-svh min-w-0 flex-1 bg-muted p-2 text-ui text-foreground`,o),t[0]=o,t[1]=s);let c;t[2]!==r||t[3]!==n||t[4]!==i?(c=!r&&i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ZG,{id:`navigator`,defaultSize:264,minSize:220,maxSize:420,children:(0,Q.jsx)(bH,{...n})}),(0,Q.jsx)(QG,{className:`w-2 bg-transparent after:w-2`})]}),t[2]=r,t[3]=n,t[4]=i,t[5]=c):c=t[5];let l=r?0:420,u;t[6]===a?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:a}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,Q.jsx)(ZG,{id:`document`,minSize:l,children:u}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==c||t[12]!==d?(f=(0,Q.jsxs)(XG,{orientation:`horizontal`,children:[c,d]}),t[11]=c,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==s||t[15]!==f?(p=(0,Q.jsx)(`div`,{className:s,children:f}),t[14]=s,t[15]=f,t[16]=p):p=t[16],p}function tK(e){let[t,n]=Z.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),r=Z.useRef(null),i=Z.useRef(null),a=Z.useRef(null),o=Z.useRef(null),s=Z.useRef(!0),c=Z.useRef(null),l=ir(),u=Z.useMemo(()=>({anchor:t,setAnchor:n,actionsRef:a,backdropRef:r,internalBackdropRef:i,positionerRef:o,allowMouseUpTriggerRef:s,initialCursorPointRef:c,rootId:l}),[t,l]);return(0,Q.jsx)(OM.Provider,{value:u,children:(0,Q.jsx)(EM.Provider,{value:void 0,children:(0,Q.jsx)(dN,{...e})})})}var nK=500,rK=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{setAnchor:o,actionsRef:s,internalBackdropRef:c,backdropRef:l,positionerRef:u,allowMouseUpTriggerRef:f,initialCursorPointRef:p,rootId:m}=kM(!1),{store:h}=DM(!1),g=h.useState(`open`),_=h.useState(`disabled`),v=Z.useRef(null),y=Z.useRef(null),b=Ge(),x=Ge(),S=Z.useRef(!1),C=Z.useRef(null);function w(e,t,n){let r=n.type.startsWith(`touch`);p.current={x:e,y:t},o({getBoundingClientRect(){return DOMRect.fromRect({width:r?10:0,height:r?10:0,x:e,y:t})}}),S.current=!1,s.current?.setOpen(!0,_r(ot,n)),x.start(nK,()=>{S.current=!0})}function T(e){if(_)return;f.current=!0,Go(e),w(e.clientX,e.clientY,e.nativeEvent);let t=G(v.current);C.current?.abort();let n=new AbortController;C.current=n,t.addEventListener(`mouseup`,e=>{if(f.current=!1,!S.current)return;x.clear(),S.current=!1;let t=d(e);dr(u.current,t)||m&&t&&gN(t)===m||s.current?.setOpen(!1,_r(_i,e))},{once:!0,signal:n.signal})}function E(){b.clear(),y.current=null}function D(e){if(_){E();return}if(f.current=!1,e.touches.length!==1){E();return}e.stopPropagation();let t=e.touches[0],n={x:t.clientX,y:t.clientY};y.current=n,b.start(nK,()=>{w(n.x,n.y,e.nativeEvent)})}function O(e){if(e.touches.length!==1){E();return}if(b.isStarted()&&y.current){let t=e.touches[0],n=Math.abs(t.clientX-y.current.x),r=Math.abs(t.clientY-y.current.y);(n>10||r>10)&&E()}}return Z.useEffect(()=>()=>{C.current?.abort()},[]),Z.useEffect(()=>{function e(e){if(_)return;let t=d(e);(dr(v.current,t)||dr(c.current,t)||dr(l.current,t))&&e.preventDefault()}let t=G(v.current);return vt(t,`contextmenu`,e)},[l,_,c]),U(`div`,e,{state:{open:g},ref:[v,t],props:[{onContextMenu:T,onTouchStart:D,onTouchMove:O,onTouchEnd:E,onTouchCancel:E,style:{WebkitTouchCallout:`none`}},a],stateAttributesMapping:Xs})}),iK=YM;function aK({...e}){return(0,Q.jsx)(tK,{"data-slot":`context-menu`,...e})}function oK({className:e,...t}){return(0,Q.jsx)(rK,{"data-slot":`context-menu-trigger`,className:Y(`select-none`,e),...t})}function sK({className:e,align:t=`start`,alignOffset:n=4,side:r=`right`,sideOffset:i=0,...a}){return(0,Q.jsx)(JM,{children:(0,Q.jsx)(iK,{className:`isolate z-50 outline-none`,align:t,alignOffset:n,side:r,sideOffset:i,children:(0,Q.jsx)(GM,{"data-slot":`context-menu-content`,className:Y(`z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 dark:ring-foreground/10 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 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,e),...a})})})}function cK({className:e,inset:t,variant:n=`default`,...r}){return(0,Q.jsx)(WM,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:Y(`group/context-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 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`,e),...r})}function lK({className:e,...t}){return(0,Q.jsx)(wm,{"data-slot":`context-menu-separator`,className:Y(`-mx-1 my-1 h-px bg-border/50`,e),...t})}function uK({className:e,...t}){return(0,Q.jsx)(`span`,{"data-slot":`context-menu-shortcut`,className:Y(`ml-auto text-xs tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground`,e),...t})}var dK=e=>e.split(`/`).at(-1)??e,fK={symlink:`porcelain-symlink`,submodule:`porcelain-submodule`},pK=`<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
1322
+ <symbol id="${fK.symlink}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1323
+ <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
1324
+ <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
1325
+ </symbol>
1326
+ <symbol id="${fK.submodule}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1327
+ <path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" />
1328
+ <circle cx="12" cy="13" r="2" />
1329
+ <path d="M14 13h3" />
1330
+ <path d="M7 13h3" />
1331
+ </symbol>
1332
+ </svg>`;function mK(e=[]){return{set:`complete`,colored:!0,spriteSheet:pK,byFileName:Object.fromEntries(e.flatMap(e=>{let t=e.kind===`symlink`?fK.symlink:e.kind===`submodule`?fK.submodule:null;return t?[[dK(e.path),t]]:[]}))}}function hK(e,t){return pi(t).filter(t=>{let n=e.getItem(t);return n!==null&&`isExpanded`in n&&n.isExpanded()})}function gK(e){let t=(0,$.c)(32),n=(0,Z.useId)(),r;t[0]===n?r=t[1]:(r=Ol(n),t[0]=n,t[1]=r);let i=r,a=at(yu),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(null),u;t[2]!==c||t[3]!==e.filter||t[4]!==e.paths?(u=c?.pathsKey===e.paths.join(`\0`)&&c.filter===e.filter,t[2]=c,t[3]=e.filter,t[4]=e.paths,t[5]=u):u=t[5];let d=u;o&&!d&&s(!1);let f;t[6]!==i||t[7]!==a?(f=function(e){if(e)return vK(e,a,i,l)},t[6]=i,t[7]=a,t[8]=f):f=t[8];let p=f,m=o&&d,h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`}),t[9]=h):h=t[9];let g;t[10]!==i||t[11]!==e||t[12]!==a?(g=(0,Q.jsx)(`span`,{hidden:!0,ref:t=>{t&&a.set(i,Fi(e))}}),t[10]=i,t[11]=e,t[12]=a,t[13]=g):g=t[13];let _;t[14]===p?_=t[15]:(_=(0,Q.jsx)(`div`,{ref:p,className:`flex min-h-0 flex-1 flex-col`}),t[14]=p,t[15]=_);let v;t[16]!==g||t[17]!==_?(v=(0,Q.jsxs)(oK,{render:h,children:[g,_]}),t[16]=g,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==d||t[20]!==o||t[21]!==c?(y=o&&d&&c&&(0,Q.jsx)(`span`,{hidden:!0,ref:()=>{let{row:e}=c;return e.setAttribute(`aria-haspopup`,`menu`),e.setAttribute(`data-context-menu-open`,``),()=>{e.removeAttribute(`aria-haspopup`),e.removeAttribute(`data-context-menu-open`)}}}),t[19]=d,t[20]=o,t[21]=c,t[22]=y):y=t[22];let b;t[23]!==d||t[24]!==c||t[25]!==e.renderMenu?(b=c&&e.renderMenu(c.item,{finalFocus:d?c.finalFocus:_K,close:c.close},c.rename),t[23]=d,t[24]=c,t[25]=e.renderMenu,t[26]=b):b=t[26];let x;return t[27]!==b||t[28]!==m||t[29]!==v||t[30]!==y?(x=(0,Q.jsxs)(aK,{open:m,onOpenChange:s,children:[v,y,b]}),t[27]=b,t[28]=m,t[29]=v,t[30]=y,t[31]=x):x=t[31],x}function _K(){return!1}function vK(e,t,n,r){let i=()=>br(t.get(n)),a=!0,o=!1,s={selected:``,complete:!1},c=null,l,u=new Set;function d(e){let t=requestAnimationFrame(()=>{u.delete(t),a&&e()});u.add(t)}let f=new uw({paths:i().paths,density:`compact`,flattenEmptyDirectories:!0,initialExpansion:`closed`,icons:mK(i().links),unsafeCSS:`[data-icon-name="file-tree-icon-chevron"] { color: var(--trees-fg-muted); } [data-context-menu-open] { outline: 1px solid var(--trees-fg-muted); outline-offset: -1px; border-radius: 4px; }`,gitStatus:i().gitStatus,search:!1,onSearchChange:e=>{e??i().onFilterChange(``)},renaming:{onError:e=>{c=null,i().onInvalidName(e),queueMicrotask(()=>{a&&f.resetPaths(i().paths)})},onRename:e=>{let t=c;c=null,(t?.path.replace(/\/$/,``)===e.sourcePath.replace(/\/$/,``)?i().onCreate(e.destinationPath,t.kind):i().onMove(e.sourcePath,e.destinationPath)).catch(()=>{a&&f.resetPaths(i().paths)})}},dragAndDrop:{canDrag:()=>(o=!0,queueMicrotask(()=>{o=!1}),!0),canDrop:({draggedPaths:e,target:t})=>pr(e,t.directoryPath??``),onDropComplete:e=>{let t=i().onMove;qt(ei(e.draggedPaths,e.target.directoryPath??``,(e,n)=>nn({try:()=>t(e,n),catch:e=>new wr(e)}))).catch(()=>{a&&f.resetPaths(i().paths)})}},renderRowDecoration:({item:e})=>{let t=i().links.find(t=>t.path===e.path);return t?{text:t.kind===`symlink`?`→ ${t.target??`?`}`:`submodule`,title:`Not followed`}:null},onSelectionChange:([e])=>{!o&&e&&c?.path.replace(/\/$/,``)!==e.replace(/\/$/,``)&&e!==i().selected&&i().onSelect(e)}});function p(){i().bindCollapseAll(()=>{o=!0,s={selected:i().selected,complete:!0},f.setSearch(null),f.resetPaths(i().paths,{initialExpandedPaths:[]}),o=!1}),i().bindRename(e=>{d(()=>{o=!0,f.startRenaming(e),o=!1})})}function m(){let{creating:t}=i();if(!t||l===t.nonce)return;l=t.nonce;let n=yr(t.kind,t.folder,e=>f.getItem(e)!==null);c={path:n,kind:t.kind},f.add(n),f.startRenaming(n,{removeIfCanceled:!0}),d(()=>{let t=e.querySelector(`[data-slot="file-tree"]`)?.shadowRoot?.querySelector(`[data-item-rename-input]`);t instanceof HTMLInputElement&&t.focus()})}function h(){let e=hK(f,i().paths).map(e=>e.replace(/\/$/,``));e.length&&i().onExpand(e)}function g(){let{selected:e}=i(),t=i().paths;s.selected!==e&&(s={selected:e,complete:!1});let n=bw(t.flatMap(e=>{let t=i().kinds.get(e);return t===void 0?[]:[{path:e,kind:t}]}),new Set(hK(f,t)),new Set(pi(t).filter(e=>f.getItem(e)!==null))).map(e=>`${e}/`);o=!0;{let r=s.complete?[]:Un(e);f.resetPaths(c?[...t,c.path]:t,{initialExpandedPaths:[...new Set([...n,...r])]});let i=f.getItem(e);!s.complete&&i&&!i.isDirectory()&&(i.select(),s.complete=!0)}o=!1,h()}let _;function v(){let e=i();p(),o=!0,(!_||_.filter!==e.filter)&&f.setSearch(e.filter===``?null:e.filter),o=!1,(!_||_.paths.join(`\0`)!==e.paths.join(`\0`)||_.selected!==e.selected)&&g(),_?.gitStatus!==e.gitStatus&&f.setGitStatus(e.gitStatus),_?.links!==e.links&&f.setIcons(mK(e.links)),_=e,m()}let y=t.subscribe(n,v),b=f.subscribe(()=>{o||h()});function x(e){let t=c;t&&e.composedPath().find(e=>e instanceof HTMLInputElement&&e.hasAttribute(`data-item-rename-input`))?.value===kn(t.path)&&(c=null,i().onCreate(t.path,t.kind).catch(()=>{a&&f.resetPaths(i().paths)}))}function S(e){let t=e.composedPath().find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-item-path`)),n=t?.dataset.itemPath,a=n===void 0?null:f.getItem(n);if(!t||!n||!a||t.querySelector(`[data-item-rename-input]`))return!1;let s={restore:!0},{paths:c,filter:l}=i();return r({row:t,pathsKey:c.join(`\0`),filter:l,finalFocus:()=>s.restore&&t.isConnected&&t.dataset.itemPath===n?t:!1,close:e=>{s.restore=e,r(null)},rename:()=>{d(()=>{o=!0,f.startRenaming(n),o=!1})},item:{path:n,name:kn(n),kind:a.isDirectory()?`directory`:`file`}}),!0}function C(e){e.key===`Enter`&&x(e),e.key===`Escape`&&(c=null)}function w(e){if(e.button!==0||!e.altKey&&(e.ctrlKey||e.metaKey||e.shiftKey))return;let t=e.composedPath();if(t.some(e=>e instanceof HTMLInputElement))return;let n=t.find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-item-path`))?.dataset.itemPath;if(!n||i().kinds.get(n)!==`file`)return;let r=f.getItem(n);if(r&&c?.path!==n){e.preventDefault(),e.stopPropagation(),o=!0;for(let e of f.getSelectedPaths())e!==n&&f.getItem(e)?.deselect();r.select(),o=!1,i().onSelect(n,e.altKey)}}function T(e){S(e)||e.stopPropagation()}return e.addEventListener(`keydown`,C,!0),e.addEventListener(`click`,w,!0),e.addEventListener(`blur`,x,!0),e.addEventListener(`contextmenu`,T,!0),e.addEventListener(`touchstart`,T,!0),f.render({containerWrapper:e}),f.getFileTreeContainer()?.setAttribute(`class`,`min-h-0 flex-1`),f.getFileTreeContainer()?.setAttribute(`data-slot`,`file-tree`),f.getFileTreeContainer()?.setAttribute(`aria-label`,`Worktree files`),v(),()=>{a=!1;for(let e of u)cancelAnimationFrame(e);y(),b(),i().bindRename(()=>void 0),i().bindCollapseAll(()=>void 0),e.removeEventListener(`keydown`,C,!0),e.removeEventListener(`click`,w,!0),e.removeEventListener(`blur`,x,!0),e.removeEventListener(`contextmenu`,T,!0),e.removeEventListener(`touchstart`,T,!0),f.cleanUp(),e.replaceChildren()}}function yK(e,t){if(t.close(e!==`rename`&&e!==`open-to-side`),e===`rename`){queueMicrotask(t.rename);return}e===`new-file`?t.onStartCreate(`file`,t.path):e===`new-folder`?t.onStartCreate(`directory`,t.path):e===`open`||e===`open-file`?t.onOpenFile(t.path):e===`open-to-side`?t.onOpenToSide(t.path):e===`open-diff`?t.onOpenDiff(t.path):e===`timeline`?t.onOpenTimeline(t.path):e===`duplicate`?t.onDuplicate(t.path):e===`pin`?t.onTogglePinned(t.path):e===`hide`?t.onSetHidden(t.hiddenEntry??t.path,t.hiddenEntry===null):e===`copy-relative`?At(t.path,`relative path`):e===`copy-full`?At(`${t.worktreePath.replace(/\/$/,``)}/${t.path}`,`full path`):t.onTrash(t.path)}var bK={"new-file":yf,"new-folder":Ff,rename:_p,duplicate:af,open:hf,"open-file":hf,"open-to-side":nf,"open-diff":_f,timeline:Ap,pin:yp,hide:df,"copy-relative":Qi,"copy-full":Qi,trash:Gp};function xK(e){let t=(0,$.c)(8),{path:n,finalFocus:r,actions:i,hidden:a,onAction:o}=e,s=`${n} actions`,c;t[0]!==i||t[1]!==a||t[2]!==o?(c=(0,Q.jsx)(CK,{actions:i,hidden:a,onAction:o}),t[0]=i,t[1]=a,t[2]=o,t[3]=c):c=t[3];let l;return t[4]!==r||t[5]!==s||t[6]!==c?(l=(0,Q.jsx)(sK,{"aria-label":s,className:`w-max max-w-[calc(100vw-2rem)] whitespace-nowrap`,onKeyDownCapture:SK,finalFocus:r,children:c}),t[4]=r,t[5]=s,t[6]=c,t[7]=l):l=t[7],l}function SK(e){if(e.key!==`ArrowDown`||e.target!==e.currentTarget)return;let t=e.currentTarget.querySelector(`[role="menuitem"]`);t instanceof HTMLElement&&(e.preventDefault(),e.stopPropagation(),t.focus())}function CK({actions:e,hidden:t,onAction:n}){return e.map(e=>(0,Q.jsx)(wK,{action:e,onAction:n,hidden:t},e.id))}function wK(e){let t=(0,$.c)(15),{action:n,onAction:r,hidden:i}=e,a=n.id===`hide`&&i?pf:bK[n.id],o;t[0]===n.id?o=t[1]:(o=(n.id===`hide`||n.id===`copy-relative`||n.id===`trash`)&&(0,Q.jsx)(lK,{}),t[0]=n.id,t[1]=o);let s=n.id===`trash`?`destructive`:`default`,c;t[2]!==n.id||t[3]!==r?(c=()=>r(n.id),t[2]=n.id,t[3]=r,t[4]=c):c=t[4];let l;t[5]===a?l=t[6]:(l=(0,Q.jsx)(a,{}),t[5]=a,t[6]=l);let u;t[7]!==n.label||t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,Q.jsxs)(cK,{variant:s,onClick:c,children:[l,n.label]}),t[7]=n.label,t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==o||t[13]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[o,u]}),t[12]=o,t[13]=u,t[14]=d):d=t[14],d}function TK(e){let t=(0,$.c)(16),{paths:n,selected:r,onOpen:i,onUnpin:a,menuFor:o}=e,[s,c]=(0,Z.useState)(!1);if(n.length===0)return null;let l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(`p`,{className:`px-1.5 pt-1 pb-0.5 text-2xs font-medium text-muted-foreground`,children:`Pinned`}),t[0]=l):l=t[0];let u;if(t[1]!==o||t[2]!==i||t[3]!==a||t[4]!==s||t[5]!==n||t[6]!==r){let e;t[8]!==o||t[9]!==i||t[10]!==a||t[11]!==s||t[12]!==r?(e=e=>{let t=e.lastIndexOf(`/`)+1,n=o(e);return(0,Q.jsxs)(aK,{onOpenChange:e=>{e&&c(!1)},children:[(0,Q.jsxs)(oK,{render:(0,Q.jsx)(`li`,{className:`flex items-center gap-0.5`}),children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-current":e===r?`page`:void 0,title:e,className:Y(`flex h-6 min-w-0 flex-1 items-center gap-1.5 rounded-md px-1.5 text-left text-caption hover:bg-accent`,e===r&&`bg-accent`),onClick:t=>i(e,t.altKey),children:[(0,Q.jsx)(mw,{path:e,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:e.slice(t)}),t>0&&(0,Q.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e.slice(0,t-1)})]}),(0,Q.jsx)(X,{size:`icon-xs`,variant:`ghost`,"aria-label":`Unpin ${e}`,title:`Unpin`,onClick:()=>a(e),children:(0,Q.jsx)(xp,{})})]}),(0,Q.jsx)(sK,{finalFocus:!s,children:(0,Q.jsx)(CK,{actions:n.actions,hidden:n.hidden,onAction:e=>{e===`open-to-side`&&(0,rd.flushSync)(()=>c(!0)),n.onAction(e)}})})]},e)},t[8]=o,t[9]=i,t[10]=a,t[11]=s,t[12]=r,t[13]=e):e=t[13],u=n.map(e),t[1]=o,t[2]=i,t[3]=a,t[4]=s,t[5]=n,t[6]=r,t[7]=u}else u=t[7];let d;return t[14]===u?d=t[15]:(d=(0,Q.jsxs)(`section`,{"aria-label":`Pinned files`,className:`shrink-0 px-2 pt-1.5 pb-1`,children:[l,(0,Q.jsx)(`ul`,{children:u})]}),t[14]=u,t[15]=d),d}var EK=1,DK=.9,OK=.8,kK=.17,AK=.1,jK=.999,MK=.9999,NK=.99,PK=/[\\\/_+.#"@\[\(\{&]/,FK=/[\\\/_+.#"@\[\(\{&]/g,IK=/[\s-]/,LK=/[\s-]/g;function RK(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?EK:NK;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=RK(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=EK:PK.test(e.charAt(l-1))?(d*=OK,p=e.slice(i,l-1).match(FK),p&&i>0&&(d*=jK**+p.length)):IK.test(e.charAt(l-1))?(d*=DK,m=e.slice(i,l-1).match(LK),m&&i>0&&(d*=jK**+m.length)):(d*=kK,i>0&&(d*=jK**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=MK)),(d<AK&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=RK(e,t,n,r,l+1,a+2,o),f*AK>d&&(d=f*AK)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function zK(e){return e.toLowerCase().replace(LK,` `)}function BK(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,RK(e,t,zK(e),zK(t),0,0,{})}var VK=Object.defineProperty,HK=(e,t)=>VK(e,`name`,{value:t,configurable:!0}),UK=!!(typeof window<`u`&&window.document&&window.document.createElement);function WK(e,t,{checkForDefaultPrevented:n=!0}={}){return HK(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}HK(WK,`composeEventHandlers`);function GK(e){if(!UK)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}HK(GK,`getOwnerWindow`);function KK(e){if(!UK)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}HK(KK,`getOwnerDocument`);function qK(e,t=!1){let{activeElement:n}=KK(e);if(!n?.nodeName)return null;if(JK(n)&&n.contentDocument)return qK(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=KK(n).getElementById(e);if(t)return t}}return n}HK(qK,`getActiveElement`);function JK(e){return e.tagName===`IFRAME`}HK(JK,`isFrame`);var YK=Object.defineProperty,XK=(e,t)=>YK(e,`name`,{value:t,configurable:!0});function ZK(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}XK(ZK,`setRef`);function QK(...e){return t=>{let n=!1,r=e.map(e=>{let r=ZK(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():ZK(e[t],null)}}}}XK(QK,`composeRefs`);function $K(...e){return Z.useCallback(QK(...e),e)}XK($K,`useComposedRefs`);var eq=Object.defineProperty,tq=(e,t)=>eq(e,`name`,{value:t,configurable:!0});function nq(e,t){let n=Z.createContext(t);n.displayName=e+`Context`;let r=tq(e=>{let{children:t,...r}=e,i=Z.useMemo(()=>r,Object.values(r));return(0,Q.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=Z.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return tq(i,`useContext`),[r,i]}tq(nq,`createContext`);function rq(e,t=[]){let n=[];function r(t,r){let i=Z.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=tq(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=Z.useMemo(()=>o,Object.values(o));return(0,Q.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=Z.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return tq(s,`useContext`),[o,s]}tq(r,`createContext`);let i=tq(()=>{let t=n.map(e=>Z.createContext(e));return tq(function(n){let r=n?.[e]||t;return Z.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,iq(i,...t)]}tq(rq,`createContextScope`);function iq(...e){let t=e[0];if(e.length===1)return t;let n=tq(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return tq(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return Z.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}tq(iq,`composeContextScopes`);var aq=globalThis?.document?Z.useLayoutEffect:()=>{},oq=Object.defineProperty,sq=(e,t)=>oq(e,`name`,{value:t,configurable:!0}),cq=Z.useId||(()=>void 0),lq=0;function uq(e){let[t,n]=Z.useState(cq());return aq(()=>{e||n(e=>e??String(lq++))},[e]),e||(t?`radix-${t}`:``)}sq(uq,`useId`);var dq=Object.defineProperty,fq=(e,t)=>dq(e,`name`,{value:t,configurable:!0}),pq=Z.useEffectEvent,mq=Z.useInsertionEffect;function hq(e){if(typeof pq==`function`)return pq(e);let t=Z.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof mq==`function`?mq(()=>{t.current=e}):aq(()=>{t.current=e}),Z.useMemo(()=>((...e)=>t.current?.(...e)),[])}fq(hq,`useEffectEvent`);var gq=Object.defineProperty,_q=(e,t)=>gq(e,`name`,{value:t,configurable:!0}),vq=Z.useInsertionEffect||aq;function yq({prop:e,defaultProp:t,onChange:n=_q(()=>{},`onChange`),caller:r}){let[i,a,o]=bq({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,Z.useCallback(t=>{if(s){let n=xq(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}_q(yq,`useControllableState`);function bq({defaultProp:e,onChange:t}){let[n,r]=Z.useState(e),i=Z.useRef(n),a=Z.useRef(t);return vq(()=>{a.current=t},[t]),Z.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}_q(bq,`useUncontrolledState`);function xq(e){return typeof e==`function`}_q(xq,`isFunction`);var Sq=Symbol(`RADIX:SYNC_STATE`);function Cq(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=hq(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=Z.useReducer((t,n)=>{if(n.type===Sq)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=Z.useRef(p);Z.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=Z.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return Z.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:Sq,state:i})},[i,d.state,c]),[h,f]}_q(Cq,`useControllableStateReducer`);var wq=Object.defineProperty,Tq=(e,t)=>wq(e,`name`,{value:t,configurable:!0});function Eq(e){let t=Z.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Pq(r)&&typeof Rq==`function`&&(r=Rq(r._payload)),Z.Children.forEach(r,e=>{if(Mq(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Pq(n)&&typeof Rq==`function`&&(n=Rq(n._payload)),a=kq(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=Z.cloneElement(a,void 0,s):!o&&Z.Children.count(r)===1&&Z.isValidElement(r)&&(a=r);let c=a?jq(a):void 0,l=$K(n,c);if(!a){if(r||r===0)throw Error(o?Lq(e):Iq(e));return r}let u=Aq(i,a.props??{});return a.type!==Z.Fragment&&(u.ref=n?l:c),Z.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}Tq(Eq,`createSlot`);var Dq=Symbol.for(`radix.slottable`);function Oq(e){let t=Tq(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Dq,t}Tq(Oq,`createSlottable`);var kq=Tq((e,t)=>{if(`child`in e.props){let t=e.props.child;return Z.isValidElement(t)?Z.cloneElement(t,void 0,e.props.children(t.props.children)):null}return Z.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function Aq(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}Tq(Aq,`mergeProps`);function jq(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Tq(jq,`getElementRef`);function Mq(e){return Z.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Dq}Tq(Mq,`isSlottable`);var Nq=Symbol.for(`react.lazy`);function Pq(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Nq&&`_payload`in e&&Fq(e._payload)}Tq(Pq,`isLazyComponent`);function Fq(e){return typeof e==`object`&&!!e&&`then`in e}Tq(Fq,`isPromiseLike`);var Iq=Tq(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),Lq=Tq(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Rq=Z.use,zq=Object.defineProperty,Bq=(e,t)=>zq(e,`name`,{value:t,configurable:!0}),Vq=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Eq(`Primitive.${t}`),r=Z.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,Q.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Hq(e,t){e&&rd.flushSync(()=>e.dispatchEvent(t))}Bq(Hq,`dispatchDiscreteCustomEvent`);var Uq=Object.defineProperty,Wq=(e,t)=>Uq(e,`name`,{value:t,configurable:!0});function Gq(e){let t=Z.useRef(e);return Z.useEffect(()=>{t.current=e}),Z.useMemo(()=>((...e)=>t.current?.(...e)),[])}Wq(Gq,`useCallbackRef`);var Kq=Object.defineProperty,qq=(e,t)=>Kq(e,`name`,{value:t,configurable:!0}),Jq=`dismissableLayer.update`,Yq=`dismissableLayer.pointerDownOutside`,Xq=`dismissableLayer.focusOutside`,Zq,Qq=Z.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),$q=Z.forwardRef(qq(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=Z.useContext(Qq),[d,f]=Z.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=Z.useState({}),h=$K(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=Z.useRef(!1),C=nJ(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:Z.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=rJ(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=Gq(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return Z.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),Z.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Zq=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),iJ(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Zq))}},[d,p,n,u]),Z.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),iJ())},[d,u]),Z.useEffect(()=>{let e=qq(()=>m({}),`handleUpdate`);return document.addEventListener(Jq,e),()=>document.removeEventListener(Jq,e)},[]),(0,Q.jsx)(Vq.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:WK(e.onFocusCapture,w.onFocusCapture),onBlurCapture:WK(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:WK(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function eJ(){let e=Z.useContext(Qq),[t,n]=Z.useState(null);return Z.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}qq(eJ,`useDismissableLayerSurface`);var tJ=qq(()=>!0,`IS_TRUE`);function nJ(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=tJ}=t,s=Gq(e),c=Z.useRef(!1),l=Z.useRef(!1),u=Z.useRef(new Map),d=Z.useRef(()=>{});return Z.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}qq(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}qq(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}qq(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}qq(p,`handleInteractionBubble`);let m=qq(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||aJ(Yq,s,p,{discrete:!0})};if(qq(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:qq(()=>c.current=!0,`onPointerDownCapture`)}}qq(nJ,`usePointerDownOutside`);function rJ(e,t=globalThis?.document){let n=Gq(e),r=Z.useRef(!1);return Z.useEffect(()=>{let e=qq(e=>{e.target&&!r.current&&aJ(Xq,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:qq(()=>r.current=!0,`onFocusCapture`),onBlurCapture:qq(()=>r.current=!1,`onBlurCapture`)}}qq(rJ,`useFocusOutside`);function iJ(){let e=new CustomEvent(Jq);document.dispatchEvent(e)}qq(iJ,`dispatchUpdate`);function aJ(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Hq(i,a):i.dispatchEvent(a)}qq(aJ,`handleAndDispatchCustomEvent`);var oJ=Object.defineProperty,sJ=(e,t)=>oJ(e,`name`,{value:t,configurable:!0}),cJ=`focusScope.autoFocusOnMount`,lJ=`focusScope.autoFocusOnUnmount`,uJ={bubbles:!1,cancelable:!0},dJ=Z.forwardRef(sJ(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=Z.useState(null),l=Gq(i),u=Gq(a),d=Z.useRef(null),f=$K(t,c),p=Z.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Z.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:vJ(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||vJ(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&vJ(s)};sJ(e,`handleFocusIn`),sJ(t,`handleFocusOut`),sJ(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),Z.useEffect(()=>{if(s){yJ.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(cJ,uJ);s.addEventListener(cJ,l),s.dispatchEvent(t),t.defaultPrevented||(fJ(SJ(mJ(s)),{select:!0}),document.activeElement===e&&vJ(s))}return()=>{s.removeEventListener(cJ,l),setTimeout(()=>{let t=new CustomEvent(lJ,uJ);s.addEventListener(lJ,u),s.dispatchEvent(t),t.defaultPrevented||vJ(e??document.body,{select:!0}),s.removeEventListener(lJ,u),yJ.remove(p)},0)}}},[s,l,u,p]);let m=Z.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=pJ(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&vJ(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&vJ(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,Q.jsx)(Vq.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function fJ(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(vJ(r,{select:t}),document.activeElement!==n)return}sJ(fJ,`focusFirst`);function pJ(e){let t=mJ(e);return[hJ(t,e),hJ(t.reverse(),e)]}sJ(pJ,`getTabbableEdges`);function mJ(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:sJ(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}sJ(mJ,`getTabbableCandidates`);function hJ(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):gJ(r,{upTo:t})))return r}sJ(hJ,`findVisible`);function gJ(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}sJ(gJ,`isHidden`);function _J(e){return e instanceof HTMLInputElement&&`select`in e}sJ(_J,`isSelectableInput`);function vJ(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&_J(e)&&t&&e.select()}}sJ(vJ,`focus`);var yJ=bJ();function bJ(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=xJ(e,t),e.unshift(t)},remove(t){e=xJ(e,t),e[0]?.resume()}}}sJ(bJ,`createFocusScopesStack`);function xJ(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}sJ(xJ,`arrayRemove`);function SJ(e){return e.filter(e=>e.tagName!==`A`)}sJ(SJ,`removeLinks`);var CJ=Object.defineProperty,wJ=Z.forwardRef(((e,t)=>CJ(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=Z.useState(!1);aq(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?rd.createPortal((0,Q.jsx)(Vq.div,{...r,ref:t}),o):null},`Portal`)),TJ=Object.defineProperty,EJ=(e,t)=>TJ(e,`name`,{value:t,configurable:!0});function DJ(e,t){return Z.useReducer((e,n)=>t[e][n]??e,e)}EJ(DJ,`useStateMachine`);var OJ=EJ(e=>{let{present:t,children:n}=e,r=kJ(t),i=typeof n==`function`?n({present:r.isPresent}):Z.Children.only(n),a=jJ(r.ref,NJ(i));return typeof n==`function`||r.isPresent?Z.cloneElement(i,{ref:a}):null},`Presence`);function kJ(e){let[t,n]=Z.useState(),r=Z.useRef(null),i=Z.useRef(e),a=Z.useRef(`none`),o=Z.useRef(void 0),[s,c]=DJ(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return Z.useEffect(()=>{s===`mounted`?(a.current=o.current??MJ(r.current),o.current=void 0):a.current=`none`},[s]),aq(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=MJ(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),aq(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=EJ(a=>{let o=MJ(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=EJ(e=>{e.target===t&&(a.current=MJ(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:Z.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=MJ(t)}else r.current=null;n(e)},[])}}EJ(kJ,`usePresence`);function AJ(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}EJ(AJ,`setRef`);function jJ(...e){let t=Z.useRef(e);return t.current=e,Z.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=AJ(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():AJ(n[e],null)}}},[])}EJ(jJ,`useStableComposedRefs`);function MJ(e){return e?.animationName||`none`}EJ(MJ,`getAnimationName`);function NJ(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}EJ(NJ,`getElementRef`);var PJ=Object.defineProperty,FJ=(e,t)=>PJ(e,`name`,{value:t,configurable:!0}),IJ=0,LJ=null;function RJ(e){return zJ(),e.children}FJ(RJ,`FocusGuards`);function zJ(){Z.useEffect(()=>{LJ||={start:BJ(),end:BJ()};let{start:e,end:t}=LJ;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),IJ++,()=>{IJ===1&&(LJ?.start.remove(),LJ?.end.remove(),LJ=null),IJ=Math.max(0,IJ-1)}},[])}FJ(zJ,`useFocusGuards`);function BJ(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}FJ(BJ,`createFocusGuard`);var VJ=function(){return VJ=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},VJ.apply(this,arguments)};function HJ(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function UJ(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var WJ=`right-scroll-bar-position`,GJ=`width-before-scroll-bar`,KJ=`with-scroll-bars-hidden`,qJ=`--removed-body-scroll-bar-size`;function JJ(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function YJ(e,t){var n=(0,Z.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var XJ=typeof window<`u`?Z.useLayoutEffect:Z.useEffect,ZJ=new WeakMap;function QJ(e,t){var n=YJ(t||null,function(t){return e.forEach(function(e){return JJ(e,t)})});return XJ(function(){var t=ZJ.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||JJ(e,null)}),i.forEach(function(e){r.has(e)||JJ(e,a)})}ZJ.set(n,e)},[e]),n}function $J(e){return e}function eY(e,t){t===void 0&&(t=$J);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function tY(e){e===void 0&&(e={});var t=eY(null);return t.options=VJ({async:!0,ssr:!1},e),t}var nY=function(e){var t=e.sideCar,n=HJ(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return Z.createElement(r,VJ({},n))};nY.isSideCarExport=!0;function rY(e,t){return e.useMedium(t),nY}var iY=tY(),aY=function(){},oY=Z.forwardRef(function(e,t){var n=Z.useRef(null),r=Z.useState({onScrollCapture:aY,onWheelCapture:aY,onTouchMoveCapture:aY}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=HJ(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=QJ([n,t]),C=VJ(VJ({},b),i);return Z.createElement(Z.Fragment,null,u&&Z.createElement(x,{sideCar:iY,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?Z.cloneElement(Z.Children.only(s),VJ(VJ({},C),{ref:S})):Z.createElement(v,VJ({},C,{className:c,ref:S}),s))});oY.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},oY.classNames={fullWidth:GJ,zeroRight:WJ};var sY=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function cY(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=sY();return t&&e.setAttribute(`nonce`,t),e}function lY(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function uY(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var dY=function(){var e=0,t=null;return{add:function(n){e==0&&(t=cY())&&(lY(t,n),uY(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},fY=function(){var e=dY();return function(t,n){Z.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},pY=function(){var e=fY();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},mY={left:0,top:0,right:0,gap:0},hY=function(e){return parseInt(e||``,10)||0},gY=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[hY(n),hY(r),hY(i)]},_Y=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return mY;var t=gY(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},vY=pY(),yY=`data-scroll-locked`,bY=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
1333
+ .${KJ} {
1334
+ overflow: hidden ${r};
1335
+ padding-right: ${s}px ${r};
1336
+ }
1337
+ body[${yY}] {
1338
+ overflow: hidden ${r};
1339
+ overscroll-behavior: contain;
1340
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
1341
+ padding-left: ${i}px;
1342
+ padding-top: ${a}px;
1343
+ padding-right: ${o}px;
1344
+ margin-left:0;
1345
+ margin-top:0;
1346
+ margin-right: ${s}px ${r};
1347
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
1348
+ }
1349
+
1350
+ .${WJ} {
1351
+ right: ${s}px ${r};
1352
+ }
1353
+
1354
+ .${GJ} {
1355
+ margin-right: ${s}px ${r};
1356
+ }
1357
+
1358
+ .${WJ} .${WJ} {
1359
+ right: 0 ${r};
1360
+ }
1361
+
1362
+ .${GJ} .${GJ} {
1363
+ margin-right: 0 ${r};
1364
+ }
1365
+
1366
+ body[${yY}] {
1367
+ ${qJ}: ${s}px;
1368
+ }
1369
+ `},xY=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},SY=function(){Z.useEffect(function(){return document.body.setAttribute(yY,(xY()+1).toString()),function(){var e=xY()-1;e<=0?document.body.removeAttribute(yY):document.body.setAttribute(yY,e.toString())}},[])},CY=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;SY();var a=Z.useMemo(function(){return _Y(i)},[i]);return Z.createElement(vY,{styles:bY(a,!t,i,n?``:`!important`)})},wY=!1;if(typeof window<`u`)try{var TY=Object.defineProperty({},"passive",{get:function(){return wY=!0,!0}});window.addEventListener(`test`,TY,TY),window.removeEventListener(`test`,TY,TY)}catch{wY=!1}var EY=wY?{passive:!1}:!1,DY=function(e){return e.tagName===`TEXTAREA`},OY=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!DY(e)&&n[t]===`visible`)},kY=function(e){return OY(e,`overflowY`)},AY=function(e){return OY(e,`overflowX`)},jY=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),PY(e,r)){var i=FY(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},MY=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},NY=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},PY=function(e,t){return e===`v`?kY(t):AY(t)},FY=function(e,t){return e===`v`?MY(t):NY(t)},IY=function(e,t){return e===`h`&&t===`rtl`?-1:1},LY=function(e,t,n,r,i){var a=IY(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=FY(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&PY(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},RY=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},zY=function(e){return[e.deltaX,e.deltaY]},BY=function(e){return e&&`current`in e?e.current:e},VY=function(e,t){return e[0]===t[0]&&e[1]===t[1]},HY=function(e){return`
1370
+ .block-interactivity-${e} {pointer-events: none;}
1371
+ .allow-interactivity-${e} {pointer-events: all;}
1372
+ `},UY=0,WY=[];function GY(e){var t=Z.useRef([]),n=Z.useRef([0,0]),r=Z.useRef(),i=Z.useState(UY++)[0],a=Z.useState(pY)[0],o=Z.useRef(e);Z.useEffect(function(){o.current=e},[e]),Z.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=UJ([e.lockRef.current],(e.shards||[]).map(BY),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=Z.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=RY(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=jY(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=jY(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return LY(h,t,e,h===`h`?s:c,!0)},[]),c=Z.useCallback(function(e){var n=e;if(WY.length&&WY[WY.length-1]===a){var r=`deltaY`in n?zY(n):RY(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&VY(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(BY).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=Z.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:KY(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=Z.useCallback(function(e){n.current=RY(e),r.current=void 0},[]),d=Z.useCallback(function(t){l(t.type,zY(t),t.target,s(t,e.lockRef.current))},[]),f=Z.useCallback(function(t){l(t.type,RY(t),t.target,s(t,e.lockRef.current))},[]);Z.useEffect(function(){return WY.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,EY),document.addEventListener(`touchmove`,c,EY),document.addEventListener(`touchstart`,u,EY),function(){WY=WY.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,EY),document.removeEventListener(`touchmove`,c,EY),document.removeEventListener(`touchstart`,u,EY)}},[]);var p=e.removeScrollBar,m=e.inert;return Z.createElement(Z.Fragment,null,m?Z.createElement(a,{styles:HY(i)}):null,p?Z.createElement(CY,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function KY(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var qY=rY(iY,GY),JY=Z.forwardRef(function(e,t){return Z.createElement(oY,VJ({},e,{ref:t,sideCar:qY}))});JY.classNames=oY.classNames;var YY=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},XY=new WeakMap,ZY=new WeakMap,QY={},$Y=0,eX=function(e){return e&&(e.host||eX(e.parentNode))},tX=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=eX(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},nX=function(e,t,n,r){var i=tX(t,Array.isArray(e)?e:[e]);QY[n]||(QY[n]=new WeakMap);var a=QY[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(XY.get(e)||0)+1,l=(a.get(e)||0)+1;XY.set(e,c),a.set(e,l),o.push(e),c===1&&i&&ZY.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),$Y++,function(){o.forEach(function(e){var t=XY.get(e)-1,i=a.get(e)-1;XY.set(e,t),a.set(e,i),t||(ZY.has(e)||e.removeAttribute(r),ZY.delete(e)),i||e.removeAttribute(n)}),$Y--,$Y||(XY=new WeakMap,XY=new WeakMap,ZY=new WeakMap,QY={})}},rX=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||YY(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),nX(r,i,n,`aria-hidden`)):function(){return null}},iX=Object.defineProperty,aX=(e,t)=>iX(e,`name`,{value:t,configurable:!0}),oX=`Dialog`,[sX,cX]=rq(oX),[lX,uX]=sX(oX),dX=aX(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=Z.useRef(null),c=Z.useRef(null),[l,u]=yq({prop:r,defaultProp:i??!1,onChange:a,caller:oX}),[d,f]=Z.useState(0),[p,m]=Z.useState(0);return(0,Q.jsx)(lX,{scope:t,triggerRef:s,contentRef:c,contentId:uq(),titleId:uq(),descriptionId:uq(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:Z.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),fX=`DialogPortal`,[pX,mX]=sX(fX,{forceMount:void 0}),hX=aX(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=uX(fX,t);return(0,Q.jsx)(pX,{scope:t,forceMount:n,children:Z.Children.map(r,e=>(0,Q.jsx)(OJ,{present:n||a.open,children:(0,Q.jsx)(wJ,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),gX=`DialogOverlay`,_X=Z.forwardRef(aX(function(e,t){let n=mX(gX,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=uX(gX,e.__scopeDialog);return a.modal?(0,Q.jsx)(OJ,{present:r||a.open,children:(0,Q.jsx)(yX,{...i,ref:t})}):null},`DialogOverlay`)),vX=Eq(`DialogOverlay.RemoveScroll`),yX=Z.forwardRef(aX(function(e,t){let{__scopeDialog:n,...r}=e,i=uX(gX,n),a=$K(t,eJ());return(0,Q.jsx)(JY,{as:vX,allowPinchZoom:!0,shards:[i.contentRef],children:(0,Q.jsx)(Vq.div,{"data-state":TX(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),bX=`DialogContent`,xX=Z.forwardRef(aX(function(e,t){let n=mX(bX,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=uX(bX,e.__scopeDialog);return(0,Q.jsx)(OJ,{present:r||a.open,children:a.modal?(0,Q.jsx)(SX,{...i,ref:t}):(0,Q.jsx)(CX,{...i,ref:t})})},`DialogContent`)),SX=Z.forwardRef(aX(function(e,t){let n=uX(bX,e.__scopeDialog),r=Z.useRef(null),i=$K(t,n.contentRef,r);return Z.useEffect(()=>{let e=r.current;if(e)return rX(e)},[]),(0,Q.jsx)(wX,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:WK(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:WK(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:WK(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),CX=Z.forwardRef(aX(function(e,t){let n=uX(bX,e.__scopeDialog),r=Z.useRef(!1),i=Z.useRef(!1);return(0,Q.jsx)(wX,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),wX=Z.forwardRef(aX(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=uX(bX,n);return zJ(),(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(dJ,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,Q.jsx)($q,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":TX(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`));function TX(e){return e?`open`:`closed`}aX(TX,`getState`);var EX=`[cmdk-group=""]`,DX=`[cmdk-group-items=""]`,OX=`[cmdk-group-heading=""]`,kX=`[cmdk-item=""]`,AX=`${kX}:not([aria-disabled="true"])`,jX=`cmdk-item-select`,MX=`data-value`,NX=(e,t,n)=>BK(e,t,n),PX=Z.createContext(void 0),FX=()=>Z.useContext(PX),IX=Z.createContext(void 0),LX=()=>Z.useContext(IX),RX=Z.createContext(void 0),zX=Z.forwardRef((e,t)=>{let n=$X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=$X(()=>new Set),i=$X(()=>new Map),a=$X(()=>new Map),o=$X(()=>new Set),s=ZX(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=uq(),y=uq(),b=uq(),x=Z.useRef(null),S=nZ();QX(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),QX(()=>{S(6,k)},[]);let C=Z.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=Z.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??NX;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(DX);t?t.appendChild(e.parentElement===t?e:e.closest(`${DX} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${DX} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${EX}[${MX}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(MX);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(EX)?.querySelector(OX))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${kX}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(AX)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(MX))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(MX))}function P(e){let t=A()?.closest(EX),n;for(;t&&!n;)t=e>0?YX(t,EX):XX(t,EX),n=t?.querySelector(AX);n?C.setState(`value`,n.getAttribute(MX)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return Z.createElement(Vq.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(jX);t.dispatchEvent(e)}}}}},Z.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:aZ},c),iZ(e,e=>Z.createElement(IX.Provider,{value:C},Z.createElement(PX.Provider,{value:w},e))))}),BX=Z.forwardRef((e,t)=>{let n=uq(),r=Z.useRef(null),i=Z.useContext(RX),a=FX(),o=ZX(e),s=o.current?.forceMount??i?.forceMount;QX(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=tZ(n,r,[e.value,e.children,r],e.keywords),l=LX(),u=eZ(e=>e.value&&e.value===c.current),d=eZ(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);Z.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(jX,f),()=>t.removeEventListener(jX,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return Z.createElement(Vq.div,{ref:QK(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),VX=Z.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=uq(),s=Z.useRef(null),c=Z.useRef(null),l=uq(),u=FX(),d=eZ(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));QX(()=>u.group(o),[]),tZ(o,s,[e.value,e.heading,c]);let f=Z.useMemo(()=>({id:o,forceMount:i}),[i]);return Z.createElement(Vq.div,{ref:QK(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&Z.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),iZ(e,e=>Z.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},Z.createElement(RX.Provider,{value:f},e))))}),HX=Z.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Z.useRef(null),a=eZ(e=>!e.search);return!n&&!a?null:Z.createElement(Vq.div,{ref:QK(i,t),...r,"cmdk-separator":``,role:`separator`})}),UX=Z.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=LX(),o=eZ(e=>e.search),s=eZ(e=>e.selectedItemId),c=FX();return Z.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),Z.createElement(Vq.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),WX=Z.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=Z.useRef(null),o=Z.useRef(null),s=eZ(e=>e.selectedItemId),c=FX();return Z.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),Z.createElement(Vq.div,{ref:QK(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},iZ(e,e=>Z.createElement(`div`,{ref:QK(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),GX=Z.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return Z.createElement(dX,{open:n,onOpenChange:r},Z.createElement(hX,{container:o},Z.createElement(_X,{"cmdk-overlay":``,className:i}),Z.createElement(xX,{"aria-label":e.label,"cmdk-dialog":``,className:a},Z.createElement(zX,{ref:t,...s}))))}),KX=Z.forwardRef((e,t)=>eZ(e=>e.filtered.count===0)?Z.createElement(Vq.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),qX=Z.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return Z.createElement(Vq.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},iZ(e,e=>Z.createElement(`div`,{"aria-hidden":!0},e)))}),JX=Object.assign(zX,{List:WX,Item:BX,Input:UX,Group:VX,Separator:HX,Dialog:GX,Empty:KX,Loading:qX});function YX(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function XX(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ZX(e){let t=Z.useRef(e);return QX(()=>{t.current=e}),t}var QX=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function $X(e){let t=Z.useRef();return t.current===void 0&&(t.current=e()),t}function eZ(e){let t=LX(),n=()=>e(t.snapshot());return Z.useSyncExternalStore(t.subscribe,n,n)}function tZ(e,t,n,r=[]){let i=Z.useRef(),a=FX();return QX(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(MX,s),i.current=s}),i}var nZ=()=>{let[e,t]=Z.useState(),n=$X(()=>new Map);return QX(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function rZ(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function iZ({asChild:e,children:t},n){return e&&Z.isValidElement(t)?Z.cloneElement(rZ(t),{ref:t.ref},n(t.props.children)):n(t)}var aZ={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function oZ({className:e,...t}){return(0,Q.jsx)(JX,{"data-slot":`command`,className:Y(`flex size-full flex-col overflow-hidden rounded-3xl bg-popover p-1 text-popover-foreground`,e),...t})}function sZ({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!1,...a}){return(0,Q.jsxs)(SI,{...a,children:[(0,Q.jsxs)(EI,{className:`sr-only`,children:[(0,Q.jsx)(OI,{children:e}),(0,Q.jsx)(kI,{children:t})]}),(0,Q.jsx)(TI,{className:Y(`top-1/3 translate-y-0 overflow-hidden rounded-3xl! p-0`,r),showCloseButton:i,children:n})]})}function cZ({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,Q.jsxs)(lH,{className:`h-8! bg-input/50`,children:[(0,Q.jsx)(JX.Input,{"data-slot":`command-input`,className:Y(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,Q.jsx)(dH,{children:(0,Q.jsx)(Pp,{className:`size-4 shrink-0 opacity-50`})})]})})}function lZ({className:e,...t}){return(0,Q.jsx)(JX.List,{"data-slot":`command-list`,className:Y(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function uZ({className:e,...t}){return(0,Q.jsx)(JX.Empty,{"data-slot":`command-empty`,className:Y(`py-6 text-center text-sm`,e),...t})}function dZ({className:e,...t}){return(0,Q.jsx)(JX.Group,{"data-slot":`command-group`,className:Y(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function fZ({className:e,children:t,...n}){return(0,Q.jsxs)(JX.Item,{"data-slot":`command-item`,className:Y(`group/command-item relative flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-2xl data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,Q.jsx)(o,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function pZ(e,t){let n=(0,$.c)(6),r;n[0]!==e||n[1]!==t?(r=zt({connection:e,scope:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a=at(i),o=Ze(i),s;return n[3]!==a||n[4]!==o?(s={result:a,refresh:o},n[3]=a,n[4]=o,n[5]=s):s=n[5],s}var mZ=dM(),hZ={toggle(){mZ.isOpen?mZ.close():mZ.open(null)},close(){mZ.close()}};function gZ(e,t){let n=(0,$.c)(9),{query:r,setQuery:i}=lu(),a;n[0]!==e||n[1]!==t||n[2]!==i?(a=n=>{t.close(),i(``),e(n)},n[0]=e,n[1]=t,n[2]=i,n[3]=a):a=n[3];let o;return n[4]!==t.toggle||n[5]!==r||n[6]!==i||n[7]!==a?(o={query:r,setQuery:i,toggle:t.toggle,select:a},n[4]=t.toggle,n[5]=r,n[6]=i,n[7]=a,n[8]=o):o=n[8],o}function _Z(e){let t=(0,$.c)(1),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={enabled:!0},t[0]=n):n=t[0],xu(`Mod+P`,e,n)}function vZ(e){let t=(0,$.c)(42),{scope:n,connection:r,onOpen:i}=e,{query:a,setQuery:o,toggle:s,select:c}=gZ(i,hZ),l=pZ(r,n);_Z(s);let u,d,f,p,m,h,g,_,v,y,b,x;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==o){let e=Sw(Gn(ar(l.result))?.paths??[],a);f=sZ,y=mZ,b=`Find a file`,x=`Search every file in this worktree by name.`,d=oZ,m=!1,t[16]!==a||t[17]!==o?(h=(0,Q.jsx)(cZ,{"aria-label":`Find a file by name`,placeholder:`Find a file by name`,value:a,onValueChange:o}),t[16]=a,t[17]=o,t[18]=h):h=t[18],t[19]===l?g=t[20]:(g=st(l.result)&&(0,Q.jsxs)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`block`,children:`Full file search could not be loaded. You can still browse folders.`}),(0,Q.jsx)(X,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:()=>l.refresh(),children:`Try again`})]}),t[19]=l,t[20]=g),t[21]===l.result?_=t[22]:(_=M(l.result)&&!st(l.result)&&(0,Q.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`Reading file names…`}),t[21]=l.result,t[22]=_),v=!M(l.result)&&!st(l.result)&&e.length===0&&(0,Q.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`No file matches that name.`}),u=lZ;let n;t[23]===c?n=t[24]:(n=e=>(0,Q.jsx)(fZ,{value:e,onSelect:()=>c(e),children:e},e),t[23]=c,t[24]=n),p=e.map(n),t[0]=l,t[1]=a,t[2]=c,t[3]=o,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=x}else u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15];let S;t[25]!==u||t[26]!==p?(S=(0,Q.jsx)(u,{children:p}),t[25]=u,t[26]=p,t[27]=S):S=t[27];let C;t[28]!==d||t[29]!==S||t[30]!==m||t[31]!==h||t[32]!==g||t[33]!==_||t[34]!==v?(C=(0,Q.jsxs)(d,{shouldFilter:m,children:[h,g,_,v,S]}),t[28]=d,t[29]=S,t[30]=m,t[31]=h,t[32]=g,t[33]=_,t[34]=v,t[35]=C):C=t[35];let w;return t[36]!==f||t[37]!==C||t[38]!==y||t[39]!==b||t[40]!==x?(w=(0,Q.jsx)(f,{handle:y,title:b,description:x,children:C}),t[36]=f,t[37]=C,t[38]=y,t[39]=b,t[40]=x,t[41]=w):w=t[41],w}function yZ(e){let t=(0,$.c)(8),{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s}=e,c=`${n.projectId}:${n.worktreeId}`,l;return t[0]!==r||t[1]!==o||t[2]!==n||t[3]!==c||t[4]!==a||t[5]!==s||t[6]!==i?(l=(0,Q.jsx)(bZ,{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s},c),t[0]=r,t[1]=o,t[2]=n,t[3]=c,t[4]=a,t[5]=s,t[6]=i,t[7]=l):l=t[7],l}function bZ(e){let t=(0,$.c)(104),{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s}=e,c=Bj(r,n,``),l=yl(r,n),u=st(l.result)?nt(l.result.cause):void 0,[d,f]=(0,Z.useState)(),[p,m]=(0,Z.useState)(null),h=Gn(ar(wF(n,r))),g=mI(r,n.projectId),_=$F(r,n.projectId),v=_I(r,n.projectId),y=eI(r,n.projectId),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(``),w=S===``?`Collapse all`:`Clear search and collapse all`,T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[0]=T):T=t[0];let[E,D]=(0,Z.useState)(T),O;t[1]!==E||t[2]!==a?(O=FZ(E,yw(a)),t[1]=E,t[2]=a,t[3]=O):O=t[3];let k=Vj(r,n,O),A=xw([c,...k.results.flatMap(PZ)]),j=ZF(A.map(NZ),g,b),M=new Map(A.map(MZ)),N;t[4]===k.results?N=t[5]:(N=k.results.filter(st),t[4]=k.results,t[5]=N);let P=N,F=[...A.filter(jZ).map(AZ),...(h?.changes??[]).flatMap(kZ).map(OZ)],I=new Set((h?.changes??[]).map(DZ)),L=new Set(A.filter(EZ).map(TZ)),R=(e,t)=>{let n=t!==void 0&&t;return o({kind:I.has(e)&&!Cw(e)&&!/\.html?$/i.test(e)?`change`:`file`,path:e},void 0,{toSide:n})},z=e=>l.duplicate(e,hn(e,e=>M.has(e)),R),B;t[6]!==z||t[7]!==l.result.waiting||t[8]!==a?(B=()=>{l.result.waiting||z(a)},t[6]=z,t[7]=l.result.waiting,t[8]=a,t[9]=B):B=t[9];let V=L.has(a),H;t[10]===V?H=t[11]:(H={enabled:V,ignoreInputs:!0},t[10]=V,t[11]=H),xu(Il.duplicateFile,B,H);let U=(e,t)=>{let n=t!==void 0&&t,r=M.get(e);r===`symlink`||r===`submodule`?o({kind:`file`,path:e},void 0,{toSide:n}):r===`file`&&R(e,n)},{collapseAll:W,renameFile:G,bindCollapseAll:ee,bindRename:te}=Pl(`${n.projectId}:${n.worktreeId}`),K=e=>{let t=XF(e,g),n=A.find(t=>t.path===e)??(v.includes(e)?{kind:`file`}:void 0);return{hidden:t!==null,actions:Fr(n,{changed:I.has(e),openToSideLabel:s,hiddenEntry:t,ownHidden:t===YF(e),hiddenName:t?.replace(/\/$/,``).split(`/`).at(-1)??``,pinned:n?.kind===`file`?v.includes(e):void 0}),run:(n,r,a)=>yK(n,{path:e,hiddenEntry:t,worktreePath:i,close:r,rename:a,onStartCreate:(e,t)=>{l.result.waiting||f({kind:e,folder:t,nonce:Date.now()})},onOpenFile:e=>o({kind:`file`,path:e}),onOpenToSide:e=>R(e,!0),onOpenDiff:e=>o({kind:`change`,path:e}),onOpenTimeline:e=>o({kind:`timeline`,path:e}),onSetHidden:(e,t)=>Ca(_.submit({path:e,hidden:t})),onTogglePinned:e=>Ca(y.submit({path:e,pinned:!v.includes(e)})),onTrash:m,onDuplicate:e=>{l.result.waiting||z(e)}})}},ne;t[12]!==o||t[13]!==D?(ne=e=>{D(t=>FZ(t,yw(e))),o({kind:`file`,path:e})},t[12]=o,t[13]=D,t[14]=ne):ne=t[14];let q;t[15]!==r||t[16]!==n||t[17]!==ne?(q=(0,Q.jsx)(vZ,{scope:n,connection:r,onOpen:ne}),t[15]=r,t[16]=n,t[17]=ne,t[18]=q):q=t[18];let re;t[19]===C?re=t[20]:(re=e=>C(e.target.value),t[19]=C,t[20]=re);let ie;t[21]!==S||t[22]!==re?(ie=(0,Q.jsx)(ba,{"aria-label":`Search files`,placeholder:`Search...`,value:S,onChange:re,className:`h-7 w-auto min-w-0 flex-1`}),t[21]=S,t[22]=re,t[23]=ie):ie=t[23];let ae;t[24]!==g.size||t[25]!==x||t[26]!==b?(ae=g.size>0&&(0,Q.jsx)(X,{size:`icon-sm`,variant:b?`secondary`:`ghost`,"aria-pressed":b,"aria-label":b?`Showing hidden`:`Hidden (${g.size})`,onClick:()=>x(wZ),children:b?(0,Q.jsx)(pf,{className:`text-muted-foreground`}):(0,Q.jsx)(df,{className:`text-muted-foreground`})}),t[24]=g.size,t[25]=x,t[26]=b,t[27]=ae):ae=t[27];let oe;t[28]===l.result.waiting?oe=t[29]:(oe=(0,Q.jsx)(X,{size:`icon-sm`,variant:`ghost`,"aria-label":`Create file or folder`,title:`Create file or folder`,disabled:l.result.waiting}),t[28]=l.result.waiting,t[29]=oe);let se;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Q.jsx)(Cp,{className:`text-muted-foreground`}),t[30]=se):se=t[30];let ce;t[31]===oe?ce=t[32]:(ce=(0,Q.jsx)(TN,{render:oe,children:se}),t[31]=oe,t[32]=ce);let le;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Q.jsxs)(kN,{onClick:()=>f({kind:`file`,folder:``,nonce:Date.now()}),children:[(0,Q.jsx)(yf,{}),`New file`]}),t[33]=le):le=t[33];let ue;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Q.jsxs)(EN,{align:`end`,children:[le,(0,Q.jsxs)(kN,{onClick:()=>f({kind:`directory`,folder:``,nonce:Date.now()}),children:[(0,Q.jsx)(Ff,{}),`New folder`]})]}),t[34]=ue):ue=t[34];let de;t[35]===ce?de=t[36]:(de=(0,Q.jsxs)(wN,{children:[ce,ue]}),t[35]=ce,t[36]=de);let fe;t[37]===W?fe=t[38]:(fe=()=>W(),t[37]=W,t[38]=fe);let pe;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(tp,{className:`text-muted-foreground`}),t[39]=pe):pe=t[39];let me;t[40]!==w||t[41]!==fe?(me=(0,Q.jsx)(X,{size:`icon-sm`,variant:`ghost`,"aria-label":w,title:w,onClick:fe,children:pe}),t[40]=w,t[41]=fe,t[42]=me):me=t[42];let he;t[43]!==ie||t[44]!==ae||t[45]!==de||t[46]!==me?(he=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 px-2 pt-2`,children:[ie,ae,de,me]}),t[43]=ie,t[44]=ae,t[45]=de,t[46]=me,t[47]=he):he=t[47];let ge;t[48]===y?ge=t[49]:(ge=e=>Ca(y.submit({path:e,pinned:!1})),t[48]=y,t[49]=ge);let _e;t[50]!==K||t[51]!==G?(_e=e=>{let t=K(e);return{actions:t.actions,hidden:t.hidden,onAction:n=>t.run(n,CZ,()=>G(e))}},t[50]=K,t[51]=G,t[52]=_e):_e=t[52];let ve;t[53]!==R||t[54]!==v||t[55]!==a||t[56]!==ge||t[57]!==_e?(ve=(0,Q.jsx)(TK,{paths:v,selected:a,onOpen:R,onUnpin:ge,menuFor:_e}),t[53]=R,t[54]=v,t[55]=a,t[56]=ge,t[57]=_e,t[58]=ve):ve=t[58];let ye;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Q.jsx)(`p`,{className:`px-3.5 pt-1 pb-0.5 text-2xs font-medium text-muted-foreground`,children:`All files`}),t[59]=ye):ye=t[59];let be;t[60]===A?be=t[61]:(be=A.filter(SZ),t[60]=A,t[61]=be);let xe;t[62]!==l||t[63]!==o?(xe=(e,t)=>l.create(e,t,e=>o({kind:`file`,path:e})),t[62]=l,t[63]=o,t[64]=xe):xe=t[64];let Se;t[65]===K?Se=t[66]:(Se=(e,t,n)=>{let r=e.kind===`directory`&&!e.path.endsWith(`/`)?`${e.path}/`:e.path,i=K(r);return(0,Q.jsx)(xK,{path:r,finalFocus:t.finalFocus,actions:i.actions,hidden:i.hidden,onAction:e=>i.run(e,t.close,n)},r)},t[65]=K,t[66]=Se);let Ce;t[67]===D?Ce=t[68]:(Ce=e=>D(t=>FZ(t,e)),t[67]=D,t[68]=Ce);let we=p!==null,Te;t[69]===l.result.waiting?Te=t[70]:(Te=e=>{!e&&!l.result.waiting&&m(null)},t[69]=l.result.waiting,t[70]=Te);let Ee;t[71]===p?Ee=t[72]:(Ee=(0,Q.jsxs)(bM,{children:[`Move `,p,` to the trash?`]}),t[71]=p,t[72]=Ee);let De=p!=null&&I.has(p)?`This is part of the agent’s changes. Deleting it changes what you are reviewing, and the agent may write it again. You can restore it from the system trash.`:`You can restore it from the system trash. This changes the files in your worktree.`,Oe;t[73]===De?Oe=t[74]:(Oe=(0,Q.jsx)(xM,{children:De}),t[73]=De,t[74]=Oe);let ke;t[75]!==Ee||t[76]!==Oe?(ke=(0,Q.jsxs)(vM,{children:[Ee,Oe]}),t[75]=Ee,t[76]=Oe,t[77]=ke):ke=t[77];let Ae;t[78]===l.result.waiting?Ae=t[79]:(Ae=(0,Q.jsx)(CM,{disabled:l.result.waiting,children:`Cancel`}),t[78]=l.result.waiting,t[79]=Ae);let je;t[80]!==p||t[81]!==l?(je=()=>{p&&l.trash(p,()=>m(null))},t[80]=p,t[81]=l,t[82]=je):je=t[82];let Me;t[83]!==l.result.waiting||t[84]!==je?(Me=(0,Q.jsx)(X,{variant:`destructive`,disabled:l.result.waiting,onClick:je,children:`Move to trash`}),t[83]=l.result.waiting,t[84]=je,t[85]=Me):Me=t[85];let Ne;t[86]!==Ae||t[87]!==Me?(Ne=(0,Q.jsxs)(yM,{children:[Ae,Me]}),t[86]=Ae,t[87]=Me,t[88]=Ne):Ne=t[88];let Pe=u!==void 0&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:Zc(u)}),Fe;t[89]!==ke||t[90]!==Ne||t[91]!==Pe?(Fe=(0,Q.jsxs)(_M,{children:[ke,Ne,Pe]}),t[89]=ke,t[90]=Ne,t[91]=Pe,t[92]=Fe):Fe=t[92];let Ie;t[93]!==we||t[94]!==Te||t[95]!==Fe?(Ie=(0,Q.jsx)(mM,{open:we,onOpenChange:Te,children:Fe}),t[93]=we,t[94]=Te,t[95]=Fe,t[96]=Ie):Ie=t[96];let Le;t[97]===y.result?Le=t[98]:(Le=st(y.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`border-t px-3 py-2 text-xs text-destructive`,children:Iu(nt(y.result.cause))}),t[97]=y.result,t[98]=Le);let J;t[99]===_.result?J=t[100]:(J=st(_.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`border-t px-3 py-2 text-xs text-destructive`,children:Iu(nt(_.result.cause))}),t[99]=_.result,t[100]=J);let Re;return t[101]!==k||t[102]!==P.length?(Re=P.length>0&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t px-3 py-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Some folders could not be loaded.`}),(0,Q.jsx)(X,{variant:`outline`,size:`xs`,onClick:()=>k.retry(),children:`Try again`})]}),t[101]=k,t[102]=P.length,t[103]=Re):Re=t[103],(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[q,he,ve,(0,Q.jsxs)(`section`,{"aria-label":`All files`,className:`flex min-h-0 flex-1 flex-col pt-1`,children:[ye,(0,Q.jsx)(gK,{filter:S,onFilterChange:C,paths:j,kinds:M,links:be,creating:d,onCreate:xe,onMove:l.move,gitStatus:F,selected:a,bindRename:te,bindCollapseAll:ee,onInvalidName:xZ,renderMenu:Se,onExpand:Ce,onSelect:U})]}),Ie,u!==void 0&&!p&&(0,Q.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-destructive`,children:Zc(u)}),Le,J,Re]})}function xZ(e){return ul.add({title:`Invalid name`,description:e,type:`error`})}function SZ(e){return e.kind===`symlink`||e.kind===`submodule`}function CZ(){}function wZ(e){return!e}function TZ(e){return e.path}function EZ(e){return e.kind===`file`}function DZ(e){return e.path}function OZ(e){return{path:qP(e),status:IZ(e)}}function kZ(e){return e.comparisons}function AZ(e){return{path:e.path,status:`ignored`}}function jZ(e){return e.ignored}function MZ(e){return[e.path,e.kind]}function NZ(e){return e.path}function PZ(e){return Xe(ar(e))}function FZ(e,t){let n=[...new Set([...e,...t])].sort();return n.length===e.length&&n.every((t,n)=>t===e[n])?e:n}function IZ(e){return e.scope===`untracked`?`untracked`:e.scope===`unmerged`||e.kind===`type-changed`?`modified`:e.kind}function LZ(e,t,n){let r=(0,$.c)(7),i;r[0]!==e||r[1]!==t?(i=Xl({draft:e,viewer:t}),r[0]=e,r[1]=t,r[2]=i):i=r[2],tn(i);let a;r[3]!==e||r[4]!==n||r[5]!==t?(a=El({draft:e,viewer:t,fingerprint:n}),r[3]=e,r[4]=n,r[5]=t,r[6]=a):a=r[6],tn(a)}var RZ=It(({connection:e,environmentIds:t})=>Er(n=>{if(!e||t.length===0)return;let r=n(jt(e)),i=Gn(ar(r));if(!i)return;let a=e=>{i.hasUnsaved(t)&&e.preventDefault()};window.addEventListener(`beforeunload`,a),n.addFinalizer(()=>window.removeEventListener(`beforeunload`,a))}));function zZ(e,t){let n=(0,$.c)(3),r;n[0]!==e||n[1]!==t?(r=RZ({connection:e,environmentIds:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],tn(r)}var BZ=W([`changes`,`files`,`history`]),VZ=W([`uncommitted`,`branch`]),HZ=Me(J.check(Li(Ur))).pipe(ii(()=>yn(Fi(void 0)))),UZ=a({surface:Me(BZ).pipe(ii(()=>yn(Fi(void 0)))),entry:HZ,side:HZ,scope:Me(VZ).pipe(ii(()=>yn(Fi(void 0)))),base:HZ}),WZ=Wt(BZ),GZ=Wt(VZ);function KZ(){let e=(0,$.c)(2),[t,n]=(0,Z.useState)(null),r;return e[0]===t?r=e[1]:(r={element:t,attach:n},e[0]=t,e[1]=r),r}var qZ=Z.createContext(void 0);function JZ(){let e=Z.useContext(qZ);if(e===void 0)throw Error(An(64));return e}var YZ=`data-activation-direction`,XZ={tabActivationDirection:e=>({[YZ]:e})},ZZ=Z.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,style:c,...l}=e,u=e.defaultValue!==void 0,d=Z.useRef([]),[f,p]=Z.useState(()=>new Map),[m,h]=uo({controlled:s,default:r,name:`Tabs`,state:`value`}),g=s!==void 0,[_,v]=Z.useState(()=>new Map),y=Z.useRef(void 0),b=Z.useCallback(e=>QZ(_,e),[_]),[x,S]=Z.useState(()=>({previousValue:m,tabActivationDirection:`none`})),{previousValue:C,tabActivationDirection:w}=x,T=w,E=!1;C!==m&&(T=$Z(C,m,a,_),E=C!=null&&m!=null&&b(m)==null);let D=E?C:m,O=C!==D||w!==T;Rr(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=gr((e,t)=>{t.activationDirection=$Z(m,e,a,_),i?.(e,t),!t.isCanceled&&h(e)}),A=gr((e,t)=>{i?.(e,_r(t,void 0,void 0,{activationDirection:`none`}))}),j=gr((e,t)=>(p(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{p(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),M=Z.useCallback(e=>f.get(e),[f]),N=Z.useCallback(e=>{for(let t of _.values())if(e===t.value)return t.id},[_]),P=Z.useMemo(()=>({getTabElementBySelectedValue:b,getTabIdByPanelValue:N,getTabPanelIdByValue:M,onValueChange:k,orientation:a,registerMountedTabPanel:j,setTabMap:v,tabActivationDirection:T,value:m}),[b,N,M,k,a,j,v,T,m]),F=Z.useMemo(()=>{for(let e of _.values())if(e.value===m)return e},[_,m]),I=Z.useMemo(()=>{for(let e of _.values())if(!e.disabled)return e.value},[_]),L=Z.useRef(!u),R=Z.useRef(r),z=Z.useRef(u),B=Z.useRef(!1);Rr(()=>{if(g)return;function e(e,t){h(e),S({previousValue:e,tabActivationDirection:`none`}),A(e,t),L.current=!1}if(_.size===0){B.current&&m!==null&&!y.current?.isConnected&&e(null,Hi);return}B.current=!0,y.current=_.keys().next().value;let t=F?.disabled,n=F==null&&m!==null;if(!t&&m===R.current&&(z.current=!1),z.current&&t&&m===R.current)return;let r=L.current;if(t||n){let n=I??null;if(m===n){L.current=!1;return}let i=Hi;r?i=zn:t&&(i=jn),e(n,i);return}r&&F!=null&&(A(m,zn),L.current=!1)},[I,g,A,F,h,_,m]);let V=U(`div`,e,{state:{orientation:a,tabActivationDirection:T},ref:t,props:l,stateAttributesMapping:XZ});return(0,Q.jsx)(qZ.Provider,{value:P,children:(0,Q.jsx)(Zs,{elementsRef:d,children:V})})});function QZ(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function $Z(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=QZ(r,e),c=QZ(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}var eQ=`data-composite-item-active`,tQ=Z.createContext(void 0);function nQ(){let e=Z.useContext(tQ);if(e===void 0)throw Error(An(65));return e}var rQ=Z.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:d,getTabPanelIdByValue:f,onValueChange:p,orientation:m,tabActivationDirection:h}=JZ(),{activateOnFocus:g,registerTabResizeObserverElement:_,tabsListElement:v}=nQ(),{highlightedIndex:y,onHighlightedIndexChange:b}=u(),x=aa(o),{compositeProps:S,compositeRef:C,index:w}=mN({metadata:Z.useMemo(()=>({disabled:r,id:x,value:a}),[r,x,a])}),T=a===d,E=Z.useRef(!1),O=Z.useRef(null),k=gr(e=>{O.current?.(),O.current=e?_(e):null});Rr(()=>{if(E.current){E.current=!1;return}if(!(T&&w>-1&&y!==w))return;let e=v;if(e!=null){let t=je(G(e));if(t&&dr(e,t))return}r||b(w)},[T,w,y,b,r,v]);let{getButtonProps:A,buttonRef:j}=D({disabled:r,native:s,focusableWhenDisabled:!0}),M=f(a),N=Z.useRef(!1),P=Z.useRef(!1);function F(e){p(a,_r(rn,e.nativeEvent,void 0,{activationDirection:`none`}))}function I(e){T||r||F(e)}function L(e){T||r||g&&(!N.current||P.current)&&F(e)}function R(e){if(T||r)return;N.current=!0,P.current=e.button===0;let t=G(e.currentTarget);function n(){N.current=!1,P.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return U(`button`,e,{state:{disabled:r,active:T,orientation:m,tabActivationDirection:h},ref:[t,j,C,k],props:[S,{role:`tab`,"aria-controls":M,"aria-selected":T,id:x,onClick:I,onFocus:L,onPointerDown:R,[eQ]:T?``:void 0,onKeyDownCapture(){E.current=!0}},l,A],stateAttributesMapping:XZ})}),iQ=`data-index`,aQ={...XZ,...an},oQ=Z.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:o,...s}=e,{value:c,getTabIdByPanelValue:l,orientation:u,tabActivationDirection:d,registerMountedTabPanel:f}=JZ(),p=aa(),{ref:m,index:h}=ra(),g=r===c,{mounted:_,transitionStatus:v,setMounted:y}=Po(g),b=!_,x=l(r),S={hidden:b,orientation:u,tabActivationDirection:d,transitionStatus:v},C=Z.useRef(null),w=U(`div`,e,{state:S,ref:[t,m,C],props:[{"aria-labelledby":x,hidden:b,id:p,role:`tabpanel`,tabIndex:g?0:-1,inert:_t(!g),[iQ]:h},s],stateAttributesMapping:aQ});return Ue({open:g,ref:C,onComplete(){g||y(!1)}}),Rr(()=>{if(!(p==null||b&&!a))return f(r,p)},[b,a,r,p,f]),a||_?w:null});function sQ(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:f,modifierKeys:p=Rn}=e,[m,h]=Z.useState(0),g=r!=null,_=Z.useRef(null),v=B(_,c),y=Z.useRef([]),b=Z.useRef(!1),x=Z.useRef(null),S=o??m,C=gr((e,t=!1)=>{if(x.current=y.current[e]??null,(s??h)(e),t){let t=y.current[e];Ma(_.current,t,a,n)}}),w=gr(e=>{if(e.size===0)return;if(b.current){let e=y.current,t=e.indexOf(x.current);if(t===-1){let t=e[S];!t||mn(e,S,f)?C(cQ(e,f)):x.current=t}else t!==S&&C(t);return}b.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)C(i);else if(mn(t,S,f)){let e=$r(t,{disabledIndices:f});ri(t,e)||C(e)}Ma(_.current,r,a,n)});Rr(()=>{if(f==null||o!=null||!b.current)return;let e=y.current;if(mn(e,S,f)){let t=$r(e,{disabledIndices:f});ri(e,t)||C(t)}},[f,o,S,y,C]);let T=gr((e,t,n)=>i?i(e,t,n,y):n),E=gr(e=>{let o=e.key===`Home`||e.key===`End`;if(!$o.has(e.key)||!l&&o||lQ(e,p)||!_.current)return;let s=a===`rtl`,c=s?oa:ia,m=s?ia:oa,h=n===`vertical`?Ja:c,v=n===`vertical`?Fa:m,b=d(e.nativeEvent);if(b!=null&&ka(b)&&!io(b)){let t=b.selectionStart,n=b.selectionEnd,r=b.value;if(t==null||e.shiftKey||t!==n||e.key!==v&&t<r.length||e.key!==h&&t>0)return}let x=S,w=Xt(y,f),E=$n(y,f);r!=null&&(x=r({disabledIndices:f,elementsRef:y,event:e,highlightedIndex:S,loopFocus:t,maxIndex:E,minIndex:w,onLoop:T,orientation:n,rtl:s}));let D=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,O=n!==`vertical`&&e.key===m||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?x=w:e.key===`End`&&(x=E)),x===S&&(D||O)&&(t&&x===E&&D?(x=w,i&&(x=i(e,S,x,y))):t&&x===w&&O?(x=E,i&&(x=i(e,S,x,y))):x=$r(y.current,{startingIndex:x,decrement:O,disabledIndices:f})),x!==S&&!ri(y.current,x)&&(u&&e.stopPropagation(),(g||o||D||O)&&e.preventDefault(),C(x,!0),queueMicrotask(()=>{y.current[x]?.focus()}))});return{props:{ref:v,onFocus(e){let t=_.current,n=d(e.nativeEvent);t&&n!=null&&ka(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:E},highlightedIndex:S,onHighlightedIndexChange:C,elementsRef:y,onMapChange:w,relayKeyboardEvent:E}}function cQ(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!mn(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function lQ(e,t){for(let n of Xo)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function uQ(e){let{render:t,className:n,style:r,refs:i=Rn,props:a=Rn,state:o=Vt,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=sQ({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:Da(),disabledIndices:v,modifierKeys:y}),k=U(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=Z.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,Q.jsx)(lr.Provider,{value:A,children:(0,Q.jsx)(Zs,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}var dQ=Z.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{orientation:c,setTabMap:l,tabActivationDirection:u}=JZ(),[d,f]=Z.useState(0),[p,m]=Z.useState(null),h=Z.useRef(new Set),g=Z.useRef(new Set),_=Z.useRef(null);Rr(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{h.current.forEach(e=>{e()})});return _.current=e,p&&e.observe(p),g.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),_.current=null}},[p]);let v=gr(e=>(h.current.add(e),()=>{h.current.delete(e)})),y=gr(e=>(g.current.add(e),_.current?.observe(e),()=>{g.current.delete(e),_.current?.unobserve(e)})),b={orientation:c,tabActivationDirection:u},x={"aria-orientation":c===`vertical`?`vertical`:void 0,role:`tablist`},S=Z.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:v,registerTabResizeObserverElement:y,tabsListElement:p}),[n,v,y,p]);return(0,Q.jsx)(tQ.Provider,{value:S,children:(0,Q.jsx)(uQ,{render:a,className:r,style:o,state:b,refs:[t,m],props:[x,s],stateAttributesMapping:XZ,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:i,orientation:c,onHighlightedIndexChange:f,onMapChange:l,disabledIndices:Rn})})});function fQ({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(ZZ,{"data-slot":`tabs`,"data-orientation":t,className:Y(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var pQ=Qr(`group/tabs-list inline-flex w-fit items-center justify-center rounded-2xl p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col group-data-vertical/tabs:p-1 data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function mQ({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(dQ,{"data-slot":`tabs-list`,"data-variant":t,className:Y(pQ({variant:t}),e),...n})}function hQ({className:e,...t}){return(0,Q.jsx)(rQ,{"data-slot":`tabs-trigger`,className:Y(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-2xl border border-transparent! px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:px-3 group-data-vertical/tabs:py-0.5 hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function gQ({className:e,...t}){return(0,Q.jsx)(oQ,{"data-slot":`tabs-content`,className:Y(`flex-1 text-sm outline-none`,e),...t})}function _Q(e){let t=new Map;for(let n of e){let e=n.id.split(`:`)[0]||n.id,r=t.get(e)??[];r.push(n),t.set(e,r)}return[...t.entries()]}function vQ(e,t){let n=e?.filter(e=>!e.id.endsWith(`:default`));return n?.find(e=>e.id===t)?.id??n?.find(e=>/^codex:(?:.*-)?luna(?:-|$)/.test(e.id))?.id??n?.find(e=>e.id===`claude:sonnet`)?.id??n?.find(e=>e.id===`claude:haiku`)?.id}function yQ(e){return e.split(`/`).at(-1)??e}function bQ(e,t){let{message:n,stashOid:r,option:i}=t;return e===`stash-create`?{action:e,message:n,includeUntracked:i}:{action:e,stashOid:r,restoreIndex:i}}var xQ=[{id:`commit`,label:`Commit…`,description:`Commit selected files`},{id:`amend`,label:`Amend last commit…`,description:`Replace the latest commit`},{id:`push`,label:`Push`,description:`Send committed changes`},{id:`pull`,label:`Pull`,description:`Bring in upstream changes`},{id:`fetch`,label:`Fetch`,description:`Update a remote-tracking branch`},{id:`stash-create`,label:`Stash changes`,description:`Set aside local changes`},{id:`stash-apply`,label:`Apply stash`,description:`Restore a stash and keep it`},{id:`stash-pop`,label:`Pop stash`,description:`Restore, then remove a stash`}],SQ=[{id:`commit`,actions:[xQ[0],xQ[1]]},{id:`sync`,actions:[xQ[2],xQ[3],xQ[4]]},{id:`stash`,actions:[xQ[5],xQ[7]]}];function CQ(e){return xQ.find(t=>t.id===e)?.label}function wQ(e){let t=(0,$.c)(2),n;return t[0]===e.connection?n=t[1]:(n=hs(e.connection),t[0]=e.connection,t[1]=n),at(n)}function TQ(e,t){let n=(0,$.c)(9),r;n[0]!==t.connection||n[1]!==e?(r=Ts({connection:t.connection,scope:e}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promiseExit`},n[3]=i):i=n[3];let[a,o]=Vi(r,i),s;n[4]===o?s=n[5]:(s=e=>{o(e)},n[4]=o,n[5]=s);let c;return n[6]!==a||n[7]!==s?(c={result:a,dismiss:s},n[6]=a,n[7]=s,n[8]=c):c=n[8],c}function EQ(e){let t=(0,$.c)(17),{scope:n,context:r}=e,{connection:i}=r,a=Gn(ar(wF(n,i))),o=TQ(n,r),s=a?.interrupted;if(!s)return null;let c=s.action.replaceAll(`-`,` `),l;t[0]===c?l=t[1]:(l=(0,Q.jsxs)(`p`,{className:`font-medium`,children:[`A Git action was interrupted:`,` `,c]}),t[0]=c,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Check the current changes before trying again.`}),t[2]=u):u=t[2];let d;t[3]===o.result?d=t[4]:(d=st(o.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`mt-1 text-destructive`,children:lo(nt(o.result.cause))}),t[3]=o.result,t[4]=d);let f;t[5]!==d||t[6]!==l?(f=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,u,d]}),t[5]=d,t[6]=l,t[7]=f):f=t[7];let p;t[8]!==o||t[9]!==s.requestId?(p=()=>o.dismiss(s.requestId),t[8]=o,t[9]=s.requestId,t[10]=p):p=t[10];let m;t[11]!==o.result.waiting||t[12]!==p?(m=(0,Q.jsx)(X,{size:`xs`,variant:`ghost`,disabled:o.result.waiting,onClick:p,children:`Got it`}),t[11]=o.result.waiting,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==f||t[15]!==m?(h=(0,Q.jsxs)(`div`,{role:`status`,className:`flex shrink-0 items-start gap-3 border-b border-graph-4/20 bg-graph-4/10 px-3 py-2 text-xs`,children:[f,m]}),t[14]=f,t[15]=m,t[16]=h):h=t[16],h}function DQ(e){let t=(0,$.c)(23),{scope:n,context:r,onOpen:i}=e,{connection:a}=r,o=Gn(ar(wF(n,a))),s=o?.inProgress;if(!s)return null;let c=o.changes.filter(OQ),l=`${s===`merge`?`Merge`:`Rebase`} recovery`,u=s===`merge`?`Merge`:`Rebase`,d=c.length?`is waiting for conflict resolution`:`is ready to finish`,f;t[0]!==u||t[1]!==d?(f=(0,Q.jsxs)(`p`,{className:`font-medium`,children:[u,` `,d]}),t[0]=u,t[1]=d,t[2]=f):f=t[2];let p=c.length>0&&(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:c.map(e=>(0,Q.jsx)(X,{size:`xs`,variant:`outline`,onClick:()=>i({kind:`file`,path:e.path}),children:e.path},e.path))}),m=s===`merge`&&o.mergeHeadOid?`Use Commit from the Git menu to finish. The merge commit includes every staged resolution.`:`Stage the resolved files, then continue in a terminal in this worktree.`,h;t[3]===m?h=t[4]:(h=(0,Q.jsxs)(`p`,{children:[`Resolve the files in your editor or with your agent.`,` `,m]}),t[3]=m,t[4]=h);let g;t[5]===s?g=t[6]:(g=s===`rebase`&&(0,Q.jsx)(AQ,{command:`git rebase --continue`}),t[5]=s,t[6]=g);let _;t[7]!==o||t[8]!==s?(_=s===`merge`&&!o.mergeHeadOid&&(0,Q.jsx)(AQ,{command:`git commit`}),t[7]=o,t[8]=s,t[9]=_):_=t[9];let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(`span`,{children:`To back out:`}),t[10]=v):v=t[10];let y=`git ${s} --abort`,b;t[11]===y?b=t[12]:(b=(0,Q.jsx)(AQ,{command:y}),t[11]=y,t[12]=b);let x;t[13]!==_||t[14]!==b||t[15]!==g?(x=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[g,_,v,b]}),t[13]=_,t[14]=b,t[15]=g,t[16]=x):x=t[16];let S;return t[17]!==l||t[18]!==x||t[19]!==f||t[20]!==p||t[21]!==h?(S=(0,Q.jsxs)(`section`,{"aria-label":l,className:`shrink-0 space-y-2 border-b border-graph-4/20 bg-graph-4/10 px-3 py-2 text-xs`,children:[f,p,h,x]}),t[17]=l,t[18]=x,t[19]=f,t[20]=p,t[21]=h,t[22]=S):S=t[22],S}function OQ(e){return e.comparisons.some(kQ)}function kQ(e){return e.scope===`unmerged`}function AQ(e){let t=(0,$.c)(8),{command:n}=e,r=`Copy ${n}`,i,a;t[0]===n?(i=t[1],a=t[2]):(i=()=>At(n,`command`),a=(0,Q.jsx)(`code`,{children:n}),t[0]=n,t[1]=i,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(Qi,{}),t[3]=o):o=t[3];let s;return t[4]!==r||t[5]!==i||t[6]!==a?(s=(0,Q.jsxs)(X,{size:`xs`,variant:`outline`,"aria-label":r,onClick:i,children:[a,o]}),t[4]=r,t[5]=i,t[6]=a,t[7]=s):s=t[7],s}function jQ(e,t){let n=(0,$.c)(5),r;if(n[0]!==t||n[1]!==e.state){let i;n[3]===t?i=n[4]:(i=e=>e.operations.get(t)??null,n[3]=t,n[4]=i),r=e.state.map(i),n[0]=t,n[1]=e.state,n[2]=r}else r=n[2];return Ii(r)}var MQ=It(e=>le({done:new Set,activeGroup:null,ownHead:null,busy:!1,error:null,drafted:{message:null,groups:null},editingFiles:!1})),NQ=It(e=>new Set);function PQ(e,t,n){let r=(0,$.c)(14),{connection:i}=n,{operations:a}=i,o;r[0]!==t||r[1]!==e?(o=Is(e,t),r[0]=t,r[1]=e,r[2]=o):o=r[2];let s=o,c;r[3]!==s||r[4]!==a.state.value.operations?(c=()=>{let e=a.state.value.operations.get(s);return e?.receipt&&rs(e.receipt)?e.requestId:null},r[3]=s,r[4]=a.state.value.operations,r[5]=c):c=r[5];let[l]=(0,Z.useState)(c),u=jQ(a,s),d=u?.requestId===l?null:u,f={connection:i,scope:e,action:t},{value:p}=$l(No(f)),m=ds(f),h=Ms(f),g=at(m),_=at(h),v;r[6]===d?v=r[7]:(v=d?.receipt&&rs(d.receipt),r[6]=d,r[7]=v);let y=!!v,b;return r[8]!==p||r[9]!==g||r[10]!==d||r[11]!==_||r[12]!==y?(b={...p,execution:g,recovered:_,operation:d,canStartNew:y},r[8]=p,r[9]=g,r[10]=d,r[11]=_,r[12]=y,r[13]=b):b=r[13],b}var FQ=It(({signal:e,submit:t,recover:n})=>Er(r=>{e!==void 0&&(r.set(t,Mt),r.set(n,Mt))}));function IQ(e,t,n){let r=(0,$.c)(45),{path:i,hunk:a,signal:o,what:s,look:c,readChanges:l,notify:u,dismissNotice:d,close:f}=n,m=PQ(e,`discard`,t),h=PQ(e,`stash-apply`,t),g=!(!m.operation||m.canStartNew),_;r[0]===l?_=r[1]:(_=()=>nn({try:l,catch:HQ}),r[0]=l,r[1]=_);let v;r[2]!==f||r[3]!==d||r[4]!==u||r[5]!==h||r[6]!==_||r[7]!==s?(v={what:s,readChanges:_,notify:u,dismissNotice:d,close:f,restore:h,restoreTimeoutMs:p,run:Zr},r[2]=f,r[3]=d,r[4]=u,r[5]=h,r[6]=_,r[7]=s,r[8]=v):v=r[8];let b=v,[x]=(0,Z.useState)(BQ),[S]=(0,Z.useState)(RQ),C;r[9]===Symbol.for(`react.memo_cache_sentinel`)?(C={mode:`promiseExit`},r[9]=C):C=r[9];let[w,T]=Vi(x,C),E;r[10]===Symbol.for(`react.memo_cache_sentinel`)?(E={mode:`promiseExit`},r[10]=E):E=r[10];let[D,O]=Vi(S,E),k=y(x),A=y(S),j;r[11]!==S||r[12]!==o||r[13]!==x?(j=FQ({signal:o,submit:x,recover:S}),r[11]=S,r[12]=o,r[13]=x,r[14]=j):j=r[14],tn(j);let M=w.waiting||D.waiting,N=LQ,P;r[15]!==D||r[16]!==w?(P=N(w)??N(D),r[15]=D,r[16]=w,r[17]=P):P=r[17];let F;r[18]!==A||r[19]!==k?(F=()=>{k(Mt),A(Mt)},r[18]=A,r[19]=k,r[20]=F):F=r[20];let I;r[21]!==M||r[22]!==m||r[23]!==b||r[24]!==a||r[25]!==c||r[26]!==i||r[27]!==A||r[28]!==T||r[29]!==g?(I=()=>{M||g||!c||(A(Mt),T({run:()=>m.run({action:`discard`,path:i,...a?{hunk:a}:{}},po(c,[i])),discarding:b}))},r[21]=M,r[22]=m,r[23]=b,r[24]=a,r[25]=c,r[26]=i,r[27]=A,r[28]=T,r[29]=g,r[30]=I):I=r[30];let L;r[31]!==M||r[32]!==m.recover||r[33]!==b||r[34]!==O||r[35]!==k?(L=()=>{M||(k(Mt),O({recover:m.recover,discarding:b}))},r[31]=M,r[32]=m.recover,r[33]=b,r[34]=O,r[35]=k,r[36]=L):L=r[36];let R;return r[37]!==M||r[38]!==m.operation||r[39]!==P||r[40]!==F||r[41]!==I||r[42]!==L||r[43]!==g?(R={operation:m.operation,uncertain:g,busy:M,error:P,reset:F,run:I,checkOutcome:L},r[37]=M,r[38]=m.operation,r[39]=P,r[40]=F,r[41]=I,r[42]=L,r[43]=g,r[44]=R):R=r[44],R}function LQ(e){return Gn(ar(e))??(st(e)?{text:lo(nt(e.cause)),moved:!1}:null)}function RQ(){return Ie(zQ)}function zQ(e){return ya(e.recover(),e.discarding)}function BQ(){return Ie(VQ)}function VQ(e){return ya(e.run(),e.discarding)}function HQ(e){return new wr(e,lo(e))}function UQ({text:e}){return e.split(/`([^`\n]+)`/).map((e,t)=>t%2?(0,Q.jsx)(`code`,{className:`box-decoration-clone rounded bg-muted px-1 py-0.5 font-mono text-[0.9em]`,children:e},t):e)}function WQ(e){let t=(0,$.c)(6),{text:n,children:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Jc,{className:`mt-0.5 size-4 shrink-0`}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,Q.jsx)(UQ,{text:n}),t[1]=n,t[2]=a);let o;return t[3]!==r||t[4]!==a?(o=(0,Q.jsxs)(`p`,{role:`alert`,className:`flex gap-2 text-sm text-destructive`,children:[i,(0,Q.jsxs)(`span`,{children:[a,r]})]}),t[3]=r,t[4]=a,t[5]=o):o=t[5],o}function GQ(e){let t=(0,$.c)(48),{scope:n,context:r,path:i,hunk:a,variant:o,signal:s,hiddenTrigger:c,children:l}=e,u=o===void 0?`button`:o,d=c!==void 0&&c,{connection:f}=r,p=Gn(ar(wF(n,f))),m=jF(n,f),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null),y=p,b=y?ga(y):null,x=y?.changes.find(e=>e.path===i),S=_??b,C;t[0]===a?C=t[1]:(C=a?YQ(a):null,t[0]=a,t[1]=C);let w=C,T;t[2]!==w||t[3]!==i?(T=w?`${w} of ${yQ(i)}`:yQ(i),t[2]=w,t[3]=i,t[4]=T):T=t[4];let E=T,D;t[5]===g?D=t[6]:(D=()=>g(!1),t[5]=g,t[6]=D);let O;t[7]!==S||t[8]!==a||t[9]!==i||t[10]!==m||t[11]!==s||t[12]!==D||t[13]!==E?(O={path:i,hunk:a,signal:s,what:E,look:S,readChanges:m,notify:JQ,dismissNotice:qQ,close:D},t[7]=S,t[8]=a,t[9]=i,t[10]=m,t[11]=s,t[12]=D,t[13]=E,t[14]=O):O=t[14];let k=IQ(n,r,O),{busy:A,error:j,uncertain:M}=k,N=!!(S&&(x||h)),[P,F]=(0,Z.useState)();s!==void 0&&s!==P&&b&&(F(s),v(b),g(!0));let I;t[15]!==k||t[16]!==d||t[17]!==a||t[18]!==w||t[19]!==i||t[20]!==g||t[21]!==v||t[22]!==N||t[23]!==b||t[24]!==u?(I=N&&!d?(0,Q.jsxs)(X,{size:u===`button`?`sm`:`xs`,variant:u===`button`?`destructive`:`ghost`,"aria-label":a?`Discard ${w} of ${yQ(i)}`:`Discard changes to ${yQ(i)}`,onClick:()=>{k.reset(),v(b),g(!0)},children:[(0,Q.jsx)(qp,{}),XQ(u)]}):null,t[15]=k,t[16]=d,t[17]=a,t[18]=w,t[19]=i,t[20]=g,t[21]=v,t[22]=N,t[23]=b,t[24]=u,t[25]=I):I=t[25];let L=I,R;t[26]!==A||t[27]!==k.checkOutcome||t[28]!==k.operation?.receipt||t[29]!==k.run||t[30]!==j||t[31]!==a||t[32]!==h||t[33]!==i||t[34]!==g||t[35]!==N||t[36]!==M||t[37]!==E?(R=N?(0,Q.jsx)(mM,{open:h,onOpenChange:e=>!A&&g(e),children:(0,Q.jsxs)(_M,{children:[(0,Q.jsxs)(vM,{children:[(0,Q.jsxs)(bM,{children:[`Discard `,E,`?`]}),(0,Q.jsx)(xM,{children:a?`Select one complete changed hunk. Only that hunk is reverted; partial selections are refused. A recovery copy is saved first.`:`The file goes back to the last commit. You can restore the changes.`})]}),(0,Q.jsx)(`p`,{className:`truncate rounded-lg bg-muted/50 px-3 py-2 font-mono text-xs`,title:i,children:i}),j&&(0,Q.jsx)(WQ,{text:j.text,children:j.moved?` Look at the diff again before discarding.`:``}),k.operation?.receipt?.progress.map(KQ),M&&!k.operation?.receipt&&(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`The response was lost. Check the existing discard request before trying again.`}),(0,Q.jsxs)(yM,{children:[(0,Q.jsx)(CM,{disabled:A,children:j?.moved?`Look again`:`Cancel`}),!j?.moved&&(M?(0,Q.jsx)(X,{disabled:A,onClick:k.checkOutcome,children:A?`Checking…`:`Check outcome`}):(0,Q.jsx)(X,{variant:`destructive`,disabled:A,onClick:k.run,children:A?`Discarding…`:`Discard`}))]})]})}):null,t[26]=A,t[27]=k.checkOutcome,t[28]=k.operation?.receipt,t[29]=k.run,t[30]=j,t[31]=a,t[32]=h,t[33]=i,t[34]=g,t[35]=N,t[36]=M,t[37]=E,t[38]=R):R=t[38];let z=R;if(l){let e;t[39]!==l||t[40]!==L?(e=l(L),t[39]=l,t[40]=L,t[41]=e):e=t[41];let n;return t[42]!==z||t[43]!==e?(n=(0,Q.jsxs)(Q.Fragment,{children:[e,z]}),t[42]=z,t[43]=e,t[44]=n):n=t[44],n}let B;return t[45]!==z||t[46]!==L?(B=(0,Q.jsxs)(Q.Fragment,{children:[L,z]}),t[45]=z,t[46]=L,t[47]=B):B=t[47],B}function KQ(e){return(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:e},e)}function qQ(e){return ul.close(e)}function JQ(e){return ul.add(e)}function YQ({startLine:e,endLine:t}){return e===t?`line ${e}`:`lines ${e}–${t}`}function XQ(e){return e===`quiet`?(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:`Discard`}):e===`compact`?`Discard selection`:`Discard`}var ZQ=Qr(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[>[data-variant=outline]]:*:data-[slot=input-group]:border-border has-[>[data-variant=outline]]:*:data-[slot=select-trigger]:border-border has-[>[data-variant=outline]]:[&>[data-slot=input-group]:has(:focus-visible)]:border-ring has-[>[data-variant=outline]]:[&>[data-slot=select-trigger]:focus-visible]:border-ring has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-2xl [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[>[data-variant=outline]]:[&>input]:border-border has-[>[data-variant=outline]]:[&>input:focus-visible]:border-ring`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-2xl! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-2xl! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function QQ({className:e,orientation:t,...n}){return(0,Q.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:Y(ZQ({orientation:t}),e),...n})}var $Q=Z.createContext(void 0);function e$(e){let t=Z.useContext($Q);if(t===void 0&&!e)throw Error(An(47));return t}var t$={...dd,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},n$=class extends un{constructor(e,t,n){let r=new ta;super(r$(e,r,t,n),i$(r),t$)}setOpen=(e,t)=>{let n=t.reason===Ai,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=ao(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=wa(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),rd.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function r$(e,t,n,r=!1){let i={...ad(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function i$(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new fe,triggerElements:e}}var a$=gi(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=s$(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),ho(u,d),Ss(u);let{forceUnmount:m}=xa(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),Z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),Z.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,_r(qn))}),[m,u]);let h=d||f;return(0,Q.jsxs)($Q.Provider,{value:u,children:[s&&(0,Q.jsx)(ha,{handle:s,store:u}),h&&(0,Q.jsx)(c$,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function o$(e){return e$(!0)?(0,Q.jsx)(a$,{props:e}):(0,Q.jsx)(ks,{children:(0,Q.jsx)(a$,{props:e})})}function s$(e,t){let n=co((e,n)=>new n$(t,e,n));return Z.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function c$({store:e,modal:t}){let n=e.useState(`floatingRootContext`),r=Es(n,{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),i=r.reference,a=r.floating;return fo(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:a}),null}var l$=vn(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=e$(!0),h=fd(s)??m;if(!h)throw Error(An(74));let g=aa(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=Va(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),O=h.useState(`focusManagerModal`),k=Sd(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Ad(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=Jo(v,{stickIfOpen:T}),j=Qa(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),M=h.useState(`triggerProps`,C),{getButtonProps:N,buttonRef:P}=D({disabled:a,native:o}),F={open(e){return e&&w===`trigger-press`?Xs.open(e):Do.open(e)}},{preFocusGuardRef:I,handlePreFocusGuardFocus:L,handleFocusTargetFocus:R}=_N(h,x),z=U(`button`,e,{state:{disabled:a,open:y},ref:[P,t,S,x],props:[A.reference,k,M,j,{[Ce]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,N],stateAttributesMapping:F}),B=(0,Q.jsx)(Z.Fragment,{children:z},g);return C&&!O?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(ae,{ref:I,onFocus:L}),B,(0,Q.jsx)(ae,{ref:h.context.triggerFocusTargetRef,onFocus:R})]}):B}),u$=Z.createContext(void 0);function d$(){let e=Z.useContext(u$);if(e===void 0)throw Error(An(45));return e}var f$=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return e$().useState(`mounted`)||n?(0,Q.jsx)(u$.Provider,{value:n,children:(0,Q.jsx)(Jt,{ref:t,...r})}):null}),p$=Z.createContext(void 0);function m$(){let e=Z.useContext(p$);if(!e)throw Error(An(46));return e}var h$=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=ue,..._}=e,v=e$(),y=d$(),b=ko(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`adaptiveOrigin`),M=Z.useRef(null),N=Ki(O),P=va({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j}),F=x.useState(`domReferenceElement`);Rr(()=>{let e=F,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,N,v]);let I=E===!0&&w!==`trigger-hover`;_a(C&&I,D===`touch`,O,T);let L=v.useStateSetter(`positionerElement`),R={open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},z=Ra(e,R,{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,L],hidden:!S,inert:!C});return(0,Q.jsxs)(p$.Provider,{value:P,children:[S&&I&&(0,Q.jsx)(Ua,{inert:_t(!C),cutout:T}),(0,Q.jsx)(gs,{id:b,children:z})]})}),g$=Z.createContext(void 0);function _$(){let[e,t]=Z.useState(0),n=gr(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var v$=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=e$(),l=m$(),u=La(!0)!=null,{context:d,hasClosePart:f}=_$(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);Ue({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),bd(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?fa(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},N=U(`div`,e,{state:M,ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...no,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&$o.has(e.key)&&e.stopPropagation()}},la(g),s],stateAttributesMapping:Vs});return(0,Q.jsx)(Co,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:li(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,Q.jsx)(g$.Provider,{value:d,children:N})})}),y$=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=e$(),s=aa(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),U(`h2`,e,{ref:t,props:[{id:s},a]})}),b$=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=e$(),s=aa(a.id);return o.useSyncedValueWithCleanup(`descriptionElementId`,s),U(`p`,e,{ref:t,props:[{id:s},a]})});function x$({...e}){return(0,Q.jsx)(o$,{"data-slot":`popover`,...e})}function S$({...e}){return(0,Q.jsx)(l$,{"data-slot":`popover-trigger`,...e})}function C$({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,Q.jsx)(f$,{children:(0,Q.jsx)(h$,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,Q.jsx)(v$,{"data-slot":`popover-content`,className:Y(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-3xl bg-popover p-4 text-sm text-popover-foreground shadow-lg ring-1 ring-foreground/5 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 dark:ring-foreground/10 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`,e),...a})})})}function w$({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`popover-header`,className:Y(`flex flex-col gap-1 text-sm`,e),...t})}function T$({className:e,...t}){return(0,Q.jsx)(y$,{"data-slot":`popover-title`,className:Y(`text-base font-medium`,e),...t})}function E$({className:e,...t}){return(0,Q.jsx)(b$,{"data-slot":`popover-description`,className:Y(`text-muted-foreground`,e),...t})}function D$(e,t,n){let r=(0,$.c)(27),i=PQ(e,`fetch`,t),a=PQ(e,`pull`,t),o=PQ(e,`push`,t),s=PQ(e,`stash-apply`,t),c;r[0]===n.details?c=r[1]:(c=()=>nn({try:n.details.read,catch:A$}),r[0]=n.details,r[1]=c);let l;r[2]!==n.details||r[3]!==c?(l={...n.details,read:c},r[2]=n.details,r[3]=c,r[4]=l):l=r[4];let u;r[5]!==n||r[6]!==l?(u={...n,details:l},r[5]=n,r[6]=l,r[7]=u):u=r[7];let d=u,f,p;r[8]!==i||r[9]!==a||r[10]!==o?(f={fetch:i,pull:a,push:o},p=[`fetch`,`pull`,`push`].map(e=>({name:e,operation:f[e].operation,canStartNew:f[e].canStartNew})).find(k$),r[8]=i,r[9]=a,r[10]=o,r[11]=f,r[12]=p):(f=r[11],p=r[12]);let m=p,h;r[13]!==d||r[14]!==f?(h=(e,t)=>Zr(ja(d,f[e],e,t)),r[13]=d,r[14]=f,r[15]=h):h=r[15];let g;r[16]!==d||r[17]!==s?(g=e=>Zr(Qo(d,s,e)),r[16]=d,r[17]=s,r[18]=g):g=r[18];let _;r[19]!==n.onLooked||r[20]!==n.refreshLook?(_=()=>qt($i(nn({try:n.refreshLook,catch:O$}),n.onLooked)),r[19]=n.onLooked,r[20]=n.refreshLook,r[21]=_):_=r[21];let v;return r[22]!==m||r[23]!==h||r[24]!==g||r[25]!==_?(v={running:m,runNetwork:h,restoreDiscarded:g,lookAgain:_},r[22]=m,r[23]=h,r[24]=g,r[25]=_,r[26]=v):v=r[26],v}function O$(e){return new wr(e,lo(e))}function k$(e){let{operation:t,canStartNew:n}=e;return t!=null&&!n}function A$(e){return new wr(e,lo(e))}function j$(e){let t=(0,$.c)(12),{action:n,className:r}=e;switch(n){case`amend`:{let e;return t[0]===r?e=t[1]:(e=(0,Q.jsx)(Ap,{className:r}),t[0]=r,t[1]=e),e}case`push`:{let e;return t[2]===r?e=t[3]:(e=(0,Q.jsx)(Hd,{className:r}),t[2]=r,t[3]=e),e}case`pull`:case`fetch`:{let e;return t[4]===r?e=t[5]:(e=(0,Q.jsx)(Id,{className:r}),t[4]=r,t[5]=e),e}case`stash-create`:{let e;return t[6]===r?e=t[7]:(e=(0,Q.jsx)(Pd,{className:r}),t[6]=r,t[7]=e),e}case`stash-apply`:case`stash-pop`:{let e;return t[8]===r?e=t[9]:(e=(0,Q.jsx)(Md,{className:r}),t[8]=r,t[9]=e),e}default:{let e;return t[10]===r?e=t[11]:(e=(0,Q.jsx)(Uf,{className:r}),t[10]=r,t[11]=e),e}}}var M$={added:`Added`,modified:`Modified`,deleted:`Deleted`,renamed:`Renamed`,"type-changed":`Type changed`};function N$(e,t){if(e.status===`renamed`&&e.previousPath!==null&&e.previousPath!==void 0)return`Renamed from ${e.previousPath}`;let n=M$[e.status];return e.path===t?n:`${n} as ${e.path}`}function P$(e){return e.body===null||e.body===void 0?e.subject:`${e.subject}\n\n${e.body}`}function F$(e){return[...new Set([e.oldPath,e.newPath].filter(e=>e!=null))]}function I$(e){return e.newPath??e.oldPath??`Unknown path`}var L$=7;function R$(e){return e.slice(0,L$)}function z$(e){return e.replace(/^refs\/(?:heads|remotes|tags)\//u,``)}function B$(e){switch(e?.head.kind){case`attached`:return z$(e.head.ref);case`unborn`:return`No commits yet on ${z$(e.head.ref)}`;case`detached`:return`Detached HEAD`;default:return`This branch`}}function V$(e){return e===`shallow`?`Shallow clone: older history is not available.`:e===`wide`?`Too many branches meet here to continue past this point.`:`Start of history.`}function H$(e,t,n,r){let i=(0,$.c)(29),{expectedStatus:a,onBusy:o,onLookAgain:s}=r,c=PQ(e,t,n),[l]=(0,Z.useState)(K$),u;i[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={mode:`promiseExit`},i[0]=u):u=i[0];let[d,f]=Vi(l,u),p=y(l),m=c.execution.waiting||d.waiting,h=!(!c.operation||c.canStartNew),g=G$,_=c.operation?.receipt,v;i[1]!==c.execution||i[2]!==c.recovered||i[3]!==d?(v=g(c.execution)??g(d)??g(c.recovered),i[1]=c.execution,i[2]=c.recovered,i[3]=d,i[4]=v):v=i[4];let b;i[5]!==m||i[6]!==a||i[7]!==c||i[8]!==o||i[9]!==p||i[10]!==h?(b=e=>{m||h||(o(!0),p(Mt),c.reset(),Zr(c.run(e,po(a,a.files?.map(W$)??[],void 0,!0)).pipe($t(zr(()=>o(!1))),xe)))},i[5]=m,i[6]=a,i[7]=c,i[8]=o,i[9]=p,i[10]=h,i[11]=b):b=i[11];let x;i[12]!==m||i[13]!==c||i[14]!==s||i[15]!==f?(x=()=>{s&&!m&&(c.reset(),f({read:nn({try:s,catch:U$}),startNew:c.startNew()}))},i[12]=m,i[13]=c,i[14]=s,i[15]=f,i[16]=x):x=i[16];let S;i[17]!==c||i[18]!==p?(S=()=>{c.reset(),p(Mt),Zr(c.recover().pipe(xe))},i[17]=c,i[18]=p,i[19]=S):S=i[19];let C;return i[20]!==m||i[21]!==c.operation||i[22]!==_||i[23]!==v||i[24]!==b||i[25]!==x||i[26]!==S||i[27]!==h?(C={operation:c.operation,messageLimit:mt,outcome:_,busy:m,uncertain:h,error:v,onSubmit:b,lookAgain:x,checkOutcome:S},i[20]=m,i[21]=c.operation,i[22]=_,i[23]=v,i[24]=b,i[25]=x,i[26]=S,i[27]=h,i[28]=C):C=i[28],C}function U$(e){return new wr(e,lo(e))}function W$(e){return e.path}function G$(e){return st(e)?nt(e.cause):null}function K$(){return Ie(q$)}function q$(e){return ts(e.read,e.startNew)}function J$(){let e=globalThis.crypto;if(typeof e?.randomUUID==`function`)return e.randomUUID();let t=URL.createObjectURL(new Blob);return URL.revokeObjectURL(t),t.slice(t.lastIndexOf(`/`)+1)}var Y$=it(`BrowserCommitDraft.submit`)(function*(e,t,n){return yield*dn(he(function*(){let i=yield*si(r(),e=>Lt(e,Hr)),a=new AbortController,o=()=>{Zr(Lt(i,Hr))};return yield*si(zr(()=>{t.add(a),a.signal.addEventListener(`abort`,o,{once:!0})}),()=>zr(()=>{a.signal.removeEventListener(`abort`,o),t.delete(a)})),yield*e(n,i)}))});function X$(e,t,n){let r=(0,$.c)(12),i;r[0]!==t.connection||r[1]!==e?(i=So({connection:t.connection,scope:e}),r[0]=t.connection,r[1]=e,r[2]=i):i=r[2];let{value:a}=$l(i),o;r[3]!==t.connection||r[4]!==e?(o=qo({connection:t.connection,scope:e}),r[3]=t.connection,r[4]=e,r[5]=o):o=r[5];let s=at(o),c;r[6]!==n||r[7]!==a?(c=e=>Y$(a,n,e),r[6]=n,r[7]=a,r[8]=c):c=r[8];let l;return r[9]!==s||r[10]!==c?(l={result:s,submit:c},r[9]=s,r[10]=c,r[11]=l):l=r[11],l}function Z$(e,t,n,r){let i=(0,$.c)(126),{scope:a,status:o,action:s,onBusy:c,onLookAgain:l,initialMessage:u,lastCommitMessage:d}=e,f=s===void 0?`commit`:s,p=u===void 0?``:u,m=d===void 0?``:d,h;i[0]!==f||i[1]!==p||i[2]!==m?(h=Ha(f,p,m),i[0]=f,i[1]=p,i[2]=m,i[3]=h):h=i[3];let g;i[4]===h?g=i[5]:(g={defaultValues:h},i[4]=h,i[5]=g);let _=qU(g),v;i[6]===_?v=i[7]:(v=MQ(_),i[6]=_,i[7]=v);let y=v,b;i[8]===_?b=i[9]:(b=NQ(_),i[8]=_,i[9]=b);let x=b,{mode:S,message:C,amendMessage:w,excluded:T,added:E,groups:D}=Uu(_.store,r1),{done:O,activeGroup:k,ownHead:A,busy:j,error:M,drafted:N,editingFiles:P}=Ii(y),F;i[10]===_?F=i[11]:(F=e=>_.setFieldValue(`mode`,e),i[10]=_,i[11]=F);let I=F,L;i[12]===_?L=i[13]:(L=e=>_.setFieldValue(`message`,e),i[12]=_,i[13]=L);let R=L,z;i[14]===_?z=i[15]:(z=e=>_.setFieldValue(`amendMessage`,e),i[14]=_,i[15]=z);let B=z,V;i[16]===_?V=i[17]:(V=e=>_.setFieldValue(`excluded`,e),i[16]=_,i[17]=V);let H=V,U;i[18]===_?U=i[19]:(U=e=>_.setFieldValue(`added`,e),i[18]=_,i[19]=U);let W=U,G;i[20]===_?G=i[21]:(G=e=>_.setFieldValue(`groups`,e),i[20]=_,i[21]=G);let ee=G,te;i[22]===y?te=i[23]:(te=e=>y.update(t=>({...t,done:typeof e==`function`?e(t.done):e})),i[22]=y,i[23]=te);let K=te,ne;i[24]===y?ne=i[25]:(ne=e=>y.update(t=>({...t,activeGroup:e})),i[24]=y,i[25]=ne);let q=ne,re;i[26]===y?re=i[27]:(re=e=>y.update(t=>({...t,ownHead:e})),i[26]=y,i[27]=re);let ie=re,ae;i[28]===y?ae=i[29]:(ae=e=>y.update(t=>({...t,busy:e})),i[28]=y,i[29]=ae);let oe=ae,se;i[30]===y?se=i[31]:(se=e=>y.update(t=>({...t,error:e})),i[30]=y,i[31]=se);let ce=se,le;i[32]===y?le=i[33]:(le=(e,t)=>y.update(n=>({...n,drafted:{...n.drafted,[e]:t}})),i[32]=y,i[33]=le);let ue=le,de=S===`amend`?`amend`:`commit`,fe=PQ(a,de,t),pe=X$(a,t,x),me=wQ(t),he;i[34]!==r.value||i[35]!==me?(he=vQ(Gn(ar(me)),r.value),i[34]=r.value,i[35]=me,i[36]=he):he=i[36];let ge=he,_e;if(i[37]!==T||i[38]!==n){let e;i[40]===T?e=i[41]:(e=e=>!T.has(e.path),i[40]=T,i[41]=e),_e=new Set(n.filter(e).flatMap(n1)),i[37]=T,i[38]=n,i[39]=_e}else _e=i[39];let ve;i[42]===_e?ve=i[43]:(ve=[..._e],i[42]=_e,i[43]=ve);let ye=ve,be;if(i[44]!==E||i[45]!==n){let e;i[47]===E?e=i[48]:(e=e=>E.has(e.path),i[47]=E,i[48]=e),be=new Set(n.filter(e).flatMap(t1)),i[44]=E,i[45]=n,i[46]=be}else be=i[46];let xe;i[49]===be?xe=i[50]:(xe=[...be],i[49]=be,i[50]=xe);let Se=de===`amend`?xe:ye,Ce=de===`amend`?w:C,we=!(!fe.operation||fe.canStartNew),Te=fe.operation?.receipt,Ee=j||pe.result.waiting,De=D?N.groups:N.message,Oe;i[51]!==De||i[52]!==de||i[53]!==O||i[54]!==D||i[55]!==o?(Oe=de===`commit`&&De!=null&&Zi(o,De,new Set((D??[]).filter(e=>O.has(e.id)).flatMap(e1))),i[51]=De,i[52]=de,i[53]=O,i[54]=D,i[55]=o,i[56]=Oe):Oe=i[56];let ke=Oe,Ae;i[57]!==n||i[58]!==D?(Ae=D?n.filter(e=>!D.some(t=>t.paths.includes(e.path))):[],i[57]=n,i[58]=D,i[59]=Ae):Ae=i[59];let je=Ae,Me;i[60]!==de||i[61]!==Ce||i[62]!==O||i[63]!==D||i[64]!==S||i[65]!==ge||i[66]!==Se||i[67]!==ke||i[68]!==o?(Me=ke?!0:S===`groups`&&D?D.filter(e=>!O.has(e.id)).some($$):de===`amend`?!Ce.trim():o.inProgress!==`merge`&&!Se.length||!Ce.trim()&&(!ge||!Se.length),i[60]=de,i[61]=Ce,i[62]=O,i[63]=D,i[64]=S,i[65]=ge,i[66]=Se,i[67]=ke,i[68]=o,i[69]=Me):Me=i[69];let Ne=Me,Pe;i[70]===o?Pe=i[71]:(Pe=Ga(`commit`,o),i[70]=o,i[71]=Pe);let Fe=Pe,Ie;i[72]===o?Ie=i[73]:(Ie=Ga(`amend`,o),i[72]=o,i[73]=Ie);let Le=Ie,J;i[74]===l?J=i[75]:(J=l?nn({try:l,catch:Q$}):void 0,i[74]=l,i[75]=J);let Re;return i[76]!==k||i[77]!==E||i[78]!==w||i[79]!==Le||i[80]!==Ne||i[81]!==j||i[82]!==de||i[83]!==Fe||i[84]!==ye||i[85]!==x||i[86]!==Ce||i[87]!==O||i[88]!==N||i[89]!==P||i[90]!==M||i[91]!==T||i[92]!==n||i[93]!==_||i[94]!==pe||i[95]!==fe||i[96]!==D||i[97]!==je||i[98]!==C||i[99]!==S||i[100]!==ge||i[101]!==me||i[102]!==c||i[103]!==A||i[104]!==Se||i[105]!==Te||i[106]!==a||i[107]!==q||i[108]!==W||i[109]!==B||i[110]!==oe||i[111]!==K||i[112]!==ue||i[113]!==ce||i[114]!==H||i[115]!==ee||i[116]!==R||i[117]!==I||i[118]!==ie||i[119]!==ke||i[120]!==y||i[121]!==o||i[122]!==J||i[123]!==we||i[124]!==Ee?(Re={scope:a,status:o,onBusy:c,onLookAgain:J,createId:J$,mode:S,commitAction:de,git:fe,generator:pe,models:me,model:ge,message:C,amendMessage:w,editingFiles:P,excluded:T,added:E,groups:D,done:O,activeGroup:k,ownHead:A,busy:j,error:M,drafted:N,files:n,commitPaths:ye,paths:Se,currentMessage:Ce,uncertain:we,receipt:Te,working:Ee,staleDraft:ke,leftUncommitted:je,blocker:Ne,commitModeBlocker:Fe,amendModeBlocker:Le,controllers:x,form:_,setMode:I,setMessage:R,setAmendMessage:B,setExcluded:H,setAdded:W,setGroups:ee,setDone:K,setActiveGroup:q,setOwnHead:ie,setBusy:oe,setError:ce,setDrafted:ue,state:y},i[76]=k,i[77]=E,i[78]=w,i[79]=Le,i[80]=Ne,i[81]=j,i[82]=de,i[83]=Fe,i[84]=ye,i[85]=x,i[86]=Ce,i[87]=O,i[88]=N,i[89]=P,i[90]=M,i[91]=T,i[92]=n,i[93]=_,i[94]=pe,i[95]=fe,i[96]=D,i[97]=je,i[98]=C,i[99]=S,i[100]=ge,i[101]=me,i[102]=c,i[103]=A,i[104]=Se,i[105]=Te,i[106]=a,i[107]=q,i[108]=W,i[109]=B,i[110]=oe,i[111]=K,i[112]=ue,i[113]=ce,i[114]=H,i[115]=ee,i[116]=R,i[117]=I,i[118]=ie,i[119]=ke,i[120]=y,i[121]=o,i[122]=J,i[123]=we,i[124]=Ee,i[125]=Re):Re=i[125],Re}function Q$(e){return new wr(e,lo(e))}function $$(e){return!e.message.trim()||!e.paths.length}function e1(e){return e.paths}function t1(e){return e.paths}function n1(e){return e.paths}function r1(e){return e.values}function i1(e,t,n,r){let i=(0,$.c)(49),a=Z$(e,t,n,r),{state:o,form:s,commitAction:c,groups:l,working:u,setMode:d,setGroups:f,setDrafted:p,commitPaths:m,setAmendMessage:h,setMessage:g,setAdded:_,setExcluded:v}=a,y,b,x,S;i[0]===a?(y=i[1],b=i[2],x=i[3],S=i[4]):(y=()=>Zr(oo(a)),b=()=>Zr(pa(a,`message`)),x=()=>Zr(Ta(a)),S=()=>Zr(Cs(a)),i[0]=a,i[1]=y,i[2]=b,i[3]=x,i[4]=S);let C;i[5]===o?C=i[6]:(C=()=>o.update(a1),i[5]=o,i[6]=C);let w;i[7]!==c||i[8]!==h||i[9]!==g?(w=e=>{c===`amend`?h(e):g(e)},i[7]=c,i[8]=h,i[9]=g,i[10]=w):w=i[10];let T;i[11]!==m||i[12]!==a||i[13]!==l||i[14]!==p||i[15]!==f||i[16]!==d||i[17]!==u?(T=e=>{(e===`single`||e===`amend`||e===`groups`)&&(d(e),e===`single`&&(f(null),p(`groups`,null)),e===`groups`&&l===null&&!u&&Zr(pa(a,`groups`,m)))},i[11]=m,i[12]=a,i[13]=l,i[14]=p,i[15]=f,i[16]=d,i[17]=u,i[18]=T):T=i[18];let E;i[19]!==c||i[20]!==s||i[21]!==_||i[22]!==v?(E=(e,t)=>{if(c===`amend`){let n=new Set(s.state.values.added);t?n.add(e):n.delete(e),_(n)}else{let n=new Set(s.state.values.excluded);t?n.delete(e):n.add(e),v(n)}},i[19]=c,i[20]=s,i[21]=_,i[22]=v,i[23]=E):E=i[23];let D,O,k,A;i[24]!==s||i[25]!==f?(k=e=>f(s.state.values.groups?.filter(t=>t.id!==e)??null),A=(e,t)=>f(s.state.values.groups?.map(n=>n.id===e?{...n,message:t}:n)??null),D=(e,t)=>f(s.state.values.groups?.map(n=>({...n,paths:[...n.paths.filter(t=>!e.includes(t)),...n.id===t?e:[]]}))??null),O=()=>f([...s.state.values.groups??[],{id:J$(),message:``,paths:[]}]),i[24]=s,i[25]=f,i[26]=D,i[27]=O,i[28]=k,i[29]=A):(D=i[26],O=i[27],k=i[28],A=i[29]);let j;i[30]!==p||i[31]!==f?(j=()=>{f(null),p(`groups`,null)},i[30]=p,i[31]=f,i[32]=j):j=i[32];let M;return i[33]!==r.set||i[34]!==a||i[35]!==y||i[36]!==b||i[37]!==D||i[38]!==O||i[39]!==j||i[40]!==x||i[41]!==S||i[42]!==C||i[43]!==w||i[44]!==T||i[45]!==E||i[46]!==k||i[47]!==A?(M={...a,messageLimit:mt,groupLimit:20,commit:y,generate:b,lookAgain:x,checkOutcome:S,setModel:r.set,toggleEditingFiles:C,setCurrentMessage:w,setMode:T,setIncluded:E,removeGroup:k,setGroupMessage:A,moveFile:D,addGroup:O,clearGroups:j},i[33]=r.set,i[34]=a,i[35]=y,i[36]=b,i[37]=D,i[38]=O,i[39]=j,i[40]=x,i[41]=S,i[42]=C,i[43]=w,i[44]=T,i[45]=E,i[46]=k,i[47]=A,i[48]=M):M=i[48],M}function a1(e){return{...e,editingFiles:!e.editingFiles}}var o1=It(e=>Er(t=>{t.addFinalizer(()=>{for(let t of e)t.abort();e.clear()})}));function s1(e){let t=(0,$.c)(2),n;t[0]===e?n=t[1]:(n=o1(e),t[0]=e,t[1]=n),tn(n)}function c1(e){let t=(0,$.c)(99),{status:n,liveBranch:r,onLookAgain:i}=e,{preferences:a,setPreference:o}=Cl(),s=e.context,c;t[0]===e.status.changes?c=t[1]:(c=QP(e.status.changes),t[0]=e.status.changes,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(`commitModel`,e),t[2]=o,t[3]=l);let u;t[4]!==a.commitModel||t[5]!==l?(u={value:a.commitModel,set:l},t[4]=a.commitModel,t[5]=l,t[6]=u):u=t[6];let d=i1(e,s,c,u);s1(d.controllers);let{mode:f,commitAction:p,git:m,model:h,groups:g,done:_,commitPaths:v,uncertain:y,receipt:b,working:x,error:S,staleDraft:C,blocker:w,commitModeBlocker:T,amendModeBlocker:E}=d,D;t[7]===d?D=t[8]:(D=e=>{e.preventDefault(),d.commit()},t[7]=d,t[8]=D);let O;t[9]!==w||t[10]!==d?(O=e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),w||d.commit())},t[9]=w,t[10]=d,t[11]=O):O=t[11];let k=p===`amend`?`Amend last commit`:`Commit changes`,A;t[12]===k?A=t[13]:(A=(0,Q.jsx)(OI,{children:k}),t[12]=k,t[13]=A);let j=p===`amend`?`The last commit is replaced by one with this message and the files you add.`:`Committed steps fold away in the review and show up in History.`,M;t[14]===j?M=t[15]:(M=(0,Q.jsx)(kI,{children:j}),t[14]=j,t[15]=M);let N;t[16]!==A||t[17]!==M?(N=(0,Q.jsxs)(EI,{children:[A,M]}),t[16]=A,t[17]=M,t[18]=N):N=t[18];let P;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(Vf,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[19]=P):P=t[19];let F;t[20]===r?.name?F=t[21]:(F=r?.name?.replace(/^refs\/heads\//,``)??`Detached HEAD`,t[20]=r?.name,t[21]=F);let I;t[22]===F?I=t[23]:(I=(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:F}),t[22]=F,t[23]=I);let L;t[24]===r?L=t[25]:(L=r?.upstream!==null&&r?.upstream!==void 0&&(0,Q.jsxs)(`span`,{className:`ml-auto shrink-0 text-muted-foreground`,children:[r.ahead,` ahead · `,r.behind,` behind`]}),t[24]=r,t[25]=L);let R;t[26]!==I||t[27]!==L?(R=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-muted/50 px-3 py-2 text-caption`,children:[P,I,L]}),t[26]=I,t[27]=L,t[28]=R):R=t[28];let z;t[29]!==E||t[30]!==T||t[31]!==v||t[32]!==d.setMode||t[33]!==f||t[34]!==h||t[35]!==n.inProgress||t[36]!==x?(z=n.inProgress!==`merge`&&(0,Q.jsx)(fQ,{value:f,onValueChange:d.setMode,children:(0,Q.jsxs)(mQ,{className:`w-full`,children:[(0,Q.jsx)(hQ,{value:`single`,className:`flex-1`,disabled:x||T!=null,children:`Single commit`}),(0,Q.jsx)(hQ,{value:`amend`,className:`flex-1`,disabled:x||E!=null,children:`Amend last`}),(0,Q.jsx)(hQ,{value:`groups`,className:`flex-1`,disabled:x||T!=null||!h||!v.length,children:`Use groups`})]})}),t[29]=E,t[30]=T,t[31]=v,t[32]=d.setMode,t[33]=f,t[34]=h,t[35]=n.inProgress,t[36]=x,t[37]=z):z=t[37];let B=x||y,V;t[38]!==d||t[39]!==f?(V=f===`groups`?(0,Q.jsx)(g1,{form:d}):(0,Q.jsx)(d1,{form:d}),t[38]=d,t[39]=f,t[40]=V):V=t[40];let H;t[41]!==B||t[42]!==V?(H=(0,Q.jsx)(`fieldset`,{disabled:B,className:`flex min-w-0 flex-col gap-3`,children:V}),t[41]=B,t[42]=V,t[43]=H):H=t[43];let U;t[44]===C?U=t[45]:(U=C&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-graph-4`,children:`The worktree changed since this draft was proposed. Generate it again before committing.`}),t[44]=C,t[45]=U);let W;t[46]!==p||t[47]!==e?(W=S1(e,p),t[46]=p,t[47]=e,t[48]=W):W=t[48];let G;t[49]===W?G=t[50]:(G=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:W}),t[49]=W,t[50]=G);let ee;t[51]!==S||t[52]!==b?(ee=b&&!(S&&go(b))&&(0,Q.jsxs)(`div`,{role:`status`,className:`text-sm`,children:[(0,Q.jsx)(`p`,{children:b.state}),b.progress.map(u1)]}),t[51]=S,t[52]=b,t[53]=ee):ee=t[53];let te;t[54]!==b||t[55]!==y?(te=y&&!b&&(0,Q.jsx)(`p`,{role:`status`,children:`Outcome not yet confirmed`}),t[54]=b,t[55]=y,t[56]=te):te=t[56];let K;t[57]===S?K=t[58]:(K=S?(0,Q.jsx)(WQ,{text:lo(S)}):null,t[57]=S,t[58]=K);let ne;t[59]!==d.lookAgain||t[60]!==i||t[61]!==b||t[62]!==C||t[63]!==x?(ne=(C||b&&Sa(b))&&i&&(0,Q.jsx)(X,{type:`button`,variant:`outline`,disabled:x,onClick:d.lookAgain,children:`Look again`}),t[59]=d.lookAgain,t[60]=i,t[61]=b,t[62]=C,t[63]=x,t[64]=ne):ne=t[64];let q;t[65]!==d.checkOutcome||t[66]!==m.operation||t[67]!==x?(q=m.operation&&!x&&(0,Q.jsx)(X,{type:`button`,variant:`outline`,onClick:d.checkOutcome,children:`Check outcome`}),t[65]=d.checkOutcome,t[66]=m.operation,t[67]=x,t[68]=q):q=t[68];let re;t[69]!==w||t[70]!==_||t[71]!==g||t[72]!==f||t[73]!==b||t[74]!==n.changes||t[75]!==n.inProgress||t[76]!==y||t[77]!==x?(re=x||y||!!(b&&Sa(b))||w||n.inProgress!==`merge`&&n.changes.some(l1)||!!(f===`groups`&&g?.every(e=>_.has(e.id))),t[69]=w,t[70]=_,t[71]=g,t[72]=f,t[73]=b,t[74]=n.changes,t[75]=n.inProgress,t[76]=y,t[77]=x,t[78]=re):re=t[78];let ie;t[79]===d?ie=t[80]:(ie=C1(d),t[79]=d,t[80]=ie);let ae;t[81]!==re||t[82]!==ie?(ae=(0,Q.jsx)(X,{type:`submit`,disabled:re,children:ie}),t[81]=re,t[82]=ie,t[83]=ae):ae=t[83];let oe;return t[84]!==N||t[85]!==R||t[86]!==z||t[87]!==H||t[88]!==U||t[89]!==G||t[90]!==ee||t[91]!==te||t[92]!==K||t[93]!==ne||t[94]!==q||t[95]!==ae||t[96]!==D||t[97]!==O?(oe=(0,Q.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:D,onKeyDown:O,children:[N,R,z,H,U,G,ee,te,K,ne,q,ae]}),t[84]=N,t[85]=R,t[86]=z,t[87]=H,t[88]=U,t[89]=G,t[90]=ee,t[91]=te,t[92]=K,t[93]=ne,t[94]=q,t[95]=ae,t[96]=D,t[97]=O,t[98]=oe):oe=t[98],oe}function l1(e){return e.scope===`unmerged`}function u1(e){return(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function d1(e){let t=(0,$.c)(49),{form:n}=e,{commitAction:r,models:i,model:a,editingFiles:o,excluded:s,added:c,files:l,paths:u,currentMessage:d,working:f}=n,p;if(t[0]!==c||t[1]!==r||t[2]!==d||t[3]!==o||t[4]!==s||t[5]!==l||t[6]!==n||t[7]!==a||t[8]!==i||t[9]!==u.length||t[10]!==f){let e=Gn(ar(i)),m=r===`amend`?`Files to add`:`Files`,h;t[12]===m?h=t[13]:(h=(0,Q.jsx)(`span`,{className:`font-medium`,children:m}),t[12]=m,t[13]=h);let g;t[14]!==l.length||t[15]!==u.length?(g=(0,Q.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[`(`,u.length,` of `,l.length,`)`]}),t[14]=l.length,t[15]=u.length,t[16]=g):g=t[16];let _;t[17]!==r||t[18]!==o||t[19]!==l.length||t[20]!==n||t[21]!==f?(_=r===`commit`&&l.length>0&&(0,Q.jsx)(X,{type:`button`,size:`xs`,variant:`ghost`,className:`ml-auto`,disabled:f,onClick:()=>n.toggleEditingFiles(),children:o?`Done`:`Edit`}),t[17]=r,t[18]=o,t[19]=l.length,t[20]=n,t[21]=f,t[22]=_):_=t[22];let v;t[23]!==h||t[24]!==g||t[25]!==_?(v=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-caption`,children:[h,g,_]}),t[23]=h,t[24]=g,t[25]=_,t[26]=v):v=t[26];let y;if(t[27]!==c||t[28]!==r||t[29]!==o||t[30]!==s||t[31]!==l||t[32]!==n){let e;t[34]!==c||t[35]!==r||t[36]!==o||t[37]!==s||t[38]!==n?(e=e=>{let t=r===`amend`?c.has(e.path):!s.has(e.path),i=r===`amend`||o,a=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(mw,{path:e.path,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path}),(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:b1(e.kind,t,r)})]});return i?(0,Q.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-xs hover:bg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":e.path,checked:t,onChange:t=>n.setIncluded(e.path,t.target.checked)}),a]},e.path):(0,Q.jsx)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-xs`,children:a},e.path)},t[34]=c,t[35]=r,t[36]=o,t[37]=s,t[38]=n,t[39]=e):e=t[39],y=l.map(e),t[27]=c,t[28]=r,t[29]=o,t[30]=s,t[31]=l,t[32]=n,t[33]=y}else y=t[33];let b;t[40]===y?b=t[41]:(b=(0,Q.jsx)(`div`,{className:`max-h-40 overflow-auto rounded-xl border p-1`,children:y}),t[40]=y,t[41]=b);let x;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(_s,{htmlFor:`commit-message`,children:`Message`}),t[42]=x):x=t[42];let S;t[43]===n?S=t[44]:(S=e=>n.setCurrentMessage(e.target.value),t[43]=n,t[44]=S);let C;t[45]!==d||t[46]!==n.messageLimit||t[47]!==S?(C=(0,Q.jsxs)(Ds,{children:[x,(0,Q.jsx)(cH,{id:`commit-message`,value:d,onChange:S,rows:4,maxLength:n.messageLimit,placeholder:`Describe what changed and why`})]}),t[45]=d,t[46]=n.messageLimit,t[47]=S,t[48]=C):C=t[48],p=(0,Q.jsxs)(Q.Fragment,{children:[v,b,C,r===`commit`&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,disabled:!a||!u.length,onClick:()=>n.generate(),children:[(0,Q.jsx)(Vp,{}),`Generate with AI`]}),(0,Q.jsxs)(zo,{items:e?.map(h1)??[],value:a??null,disabled:!e?.length,onValueChange:e=>{e&&n.setModel(e)},children:[(0,Q.jsx)(Ks,{"aria-label":`Commit model`,className:`w-auto max-w-48`,size:`sm`,children:(0,Q.jsx)(Ka,{placeholder:e?.length?`Choose a model`:`No coding CLI available`})}),(0,Q.jsx)(_o,{children:_Q(e?.filter(m1)??[]).map(f1)})]})]})]}),t[0]=c,t[1]=r,t[2]=d,t[3]=o,t[4]=s,t[5]=l,t[6]=n,t[7]=a,t[8]=i,t[9]=u.length,t[10]=f,t[11]=p}else p=t[11];return p}function f1(e){let[t,n]=e;return(0,Q.jsxs)(zs,{children:[(0,Q.jsx)(To,{children:t}),n.map(p1)]},t)}function p1(e){return(0,Q.jsx)(Js,{value:e.id,children:e.label},e.id)}function m1(e){return!e.id.endsWith(`:default`)}function h1(e){return{value:e.id,label:e.label}}function g1(e){let t=(0,$.c)(28),{form:n}=e,{groups:r,done:i,activeGroup:a,files:o,leftUncommitted:s,error:c}=n;if(r===null){let e=c?`Groups were not proposed.`:`Proposing commits…`,n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:e}),t[0]=e,t[1]=n),n}let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l={value:`uncommitted`,label:`Leave uncommitted`},t[2]=l):l=t[2];let u;t[3]===r?u=t[4]:(u=[l,...r.map(y1)],t[3]=r,t[4]=u);let d=u,f;t[5]!==a||t[6]!==d||t[7]!==i||t[8]!==o||t[9]!==n||t[10]!==r?(f=r.map((e,t)=>(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2 rounded-lg border p-3`,"aria-label":`Commit ${t+1}`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Commit `,t+1,x1(e.id,i,a)]}),e.paths.length===0&&i.size===0&&(0,Q.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>n.removeGroup(e.id),children:`Remove empty group`}),(0,Q.jsx)(cH,{"aria-label":`Message for commit ${t+1}`,value:e.message,disabled:i.has(e.id),required:!0,maxLength:n.messageLimit,onChange:t=>n.setGroupMessage(e.id,t.target.value)}),o.filter(t=>e.paths.includes(t.path)).map(t=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.path}),(0,Q.jsxs)(zo,{items:d,value:e.id,disabled:i.size>0,onValueChange:e=>{e&&n.moveFile(t.paths,e)},children:[(0,Q.jsx)(Ks,{size:`sm`,"aria-label":`Commit for ${t.path}`,children:(0,Q.jsx)(Ka,{})}),(0,Q.jsxs)(_o,{children:[(0,Q.jsx)(Js,{value:`uncommitted`,children:`Leave uncommitted`}),r.map(v1)]})]})]},t.path))]},e.id)),t[5]=a,t[6]=d,t[7]=i,t[8]=o,t[9]=n,t[10]=r,t[11]=f):f=t[11];let p;t[12]!==d||t[13]!==i.size||t[14]!==n||t[15]!==r||t[16]!==s?(p=s.length>0&&(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2 rounded-lg border border-dashed p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Left uncommitted`}),s.map(e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path}),(0,Q.jsxs)(zo,{items:d,value:`uncommitted`,disabled:i.size>0,onValueChange:t=>{t&&n.moveFile(e.paths,t)},children:[(0,Q.jsx)(Ks,{size:`sm`,"aria-label":`Commit for ${e.path}`,children:(0,Q.jsx)(Ka,{})}),(0,Q.jsxs)(_o,{children:[(0,Q.jsx)(Js,{value:`uncommitted`,children:`Leave uncommitted`}),r.map(_1)]})]})]},e.path))]}),t[12]=d,t[13]=i.size,t[14]=n,t[15]=r,t[16]=s,t[17]=p):p=t[17];let m;t[18]!==i.size||t[19]!==n.addGroup||t[20]!==n.clearGroups||t[21]!==n.groupLimit||t[22]!==r.length?(m=i.size===0&&(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,disabled:r.length>=n.groupLimit,onClick:n.addGroup,children:[(0,Q.jsx)(Cp,{}),`Add group`]}),(0,Q.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:n.clearGroups,children:`Single commit`})]}),t[18]=i.size,t[19]=n.addGroup,t[20]=n.clearGroups,t[21]=n.groupLimit,t[22]=r.length,t[23]=m):m=t[23];let h;return t[24]!==f||t[25]!==p||t[26]!==m?(h=(0,Q.jsxs)(Q.Fragment,{children:[f,p,m]}),t[24]=f,t[25]=p,t[26]=m,t[27]=h):h=t[27],h}function _1(e,t){return(0,Q.jsxs)(Js,{value:e.id,children:[`Commit `,t+1]},e.id)}function v1(e,t){return(0,Q.jsxs)(Js,{value:e.id,children:[`Commit `,t+1]},e.id)}function y1(e,t){return{value:e.id,label:`Commit ${t+1}`}}function b1(e,t,n){return t?e.replaceAll(`-`,` `):n===`amend`?`Not added`:`Excluded`}function x1(e,t,n){return t.has(e)?` · committed`:n===e?` · in progress`:``}function S1({status:e,liveBranch:t,replacedSubject:n},r){return r===`amend`?`Amending replaces the last commit${n?`: ${n}`:``}. ${t?.upstream&&t.ahead===0?`This commit is already on the known upstream; amending rewrites shared history.`:`Unselected staged changes stay staged.`}`:e.inProgress===`merge`?`This finishes the merge and commits every staged resolution, including staged files outside your selection.`:`Selected files use their current contents. Other staged files stay staged.`}function C1({working:e,generator:t,groups:n,commitAction:r}){return e?t.result.waiting?`Generating…`:r===`amend`?`Amending…`:`Committing…`:n&&r===`commit`?`Commit groups in order`:r===`amend`?`Amend last commit`:`Commit selected files`}function w1(e){let t=(0,$.c)(14),{scope:n,context:r,entry:i,status:a,onBusy:o,onLookAgain:s}=e;if(i===`discard`||i===`fetch`||i===`pull`||i===`push`)return null;if(i===`commit`||i===`amend`){let e;return t[0]!==r||t[1]!==i||t[2]!==o||t[3]!==s||t[4]!==n||t[5]!==a?(e=(0,Q.jsx)(T1,{scope:n,context:r,action:i,status:a,onBusy:o,onLookAgain:s}),t[0]=r,t[1]=i,t[2]=o,t[3]=s,t[4]=n,t[5]=a,t[6]=e):e=t[6],e}let c;return t[7]!==r||t[8]!==i||t[9]!==o||t[10]!==s||t[11]!==n||t[12]!==a?(c=(0,Q.jsx)(D1,{scope:n,context:r,action:i,status:a,onBusy:o,onLookAgain:s},i),t[7]=r,t[8]=i,t[9]=o,t[10]=s,t[11]=n,t[12]=a,t[13]=c):c=t[13],c}function T1(e){let t=(0,$.c)(17),{scope:n,context:r,action:i,status:a,onBusy:o,onLookAgain:s}=e,c;t[0]===i?c=t[1]:(c=(0,Q.jsx)(E1,{action:i}),t[0]=i,t[1]=c);let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(`p`,{role:`status`,children:`Reading commit details…`}),t[2]=l):l=t[2];let u;t[3]===c?u=t[4]:(u=(0,Q.jsxs)(Q.Fragment,{children:[c,l]}),t[3]=c,t[4]=u);let d;t[5]!==i||t[6]!==r||t[7]!==o||t[8]!==s||t[9]!==n||t[10]!==a?(d=e=>{let t=e.headCommit;return i===`amend`&&!t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(E1,{action:i}),(0,Q.jsx)(`p`,{role:`alert`,children:`The last commit could not be read. Close and try again.`})]}):(0,Q.jsx)(c1,{scope:n,context:r,action:i,status:a,liveBranch:e.branch??a.branch,initialMessage:i===`amend`&&t?[t.subject,t.body].filter(Boolean).join(`
1373
+
1374
+ `):``,lastCommitMessage:t?[t.subject,t.body].filter(Boolean).join(`
1375
+
1376
+ `):``,...t?{replacedSubject:t.subject}:{},onBusy:o,onLookAgain:s})},t[5]=i,t[6]=r,t[7]=o,t[8]=s,t[9]=n,t[10]=a,t[11]=d):d=t[11];let f;return t[12]!==r||t[13]!==n||t[14]!==u||t[15]!==d?(f=(0,Q.jsx)(O1,{scope:n,context:r,pending:u,children:d}),t[12]=r,t[13]=n,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function E1(e){let t=(0,$.c)(7),{action:n}=e,r=n===`amend`?`Amend last commit`:`Commit changes`,i;t[0]===r?i=t[1]:(i=(0,Q.jsx)(OI,{children:r}),t[0]=r,t[1]=i);let a=n===`amend`?`The last commit is replaced by one with this message and the files you add.`:`Committed steps fold away in the review and show up in History.`,o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(kI,{children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(EI,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function D1(e){let t=(0,$.c)(12),{scope:n,context:r,action:i,status:a,onBusy:o,onLookAgain:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Reading branch…`}),t[0]=c):c=t[0];let l;t[1]!==i||t[2]!==r||t[3]!==o||t[4]!==s||t[5]!==n||t[6]!==a?(l=e=>(0,Q.jsx)(k1,{scope:n,context:r,action:i,status:{...a,branch:e.branch??a.branch},expectedStatus:a,onBusy:o,onLookAgain:s}),t[1]=i,t[2]=r,t[3]=o,t[4]=s,t[5]=n,t[6]=a,t[7]=l):l=t[7];let u;return t[8]!==r||t[9]!==n||t[10]!==l?(u=(0,Q.jsx)(O1,{scope:n,context:r,pending:c,children:l}),t[8]=r,t[9]=n,t[10]=l,t[11]=u):u=t[11],u}function O1(e){let t=(0,$.c)(12),{scope:n,context:r,pending:i,children:a}=e,o=OF(n,r.connection);if(st(o.result)){let e;t[0]===o.result.cause?e=t[1]:(e=lo(nt(o.result.cause)),t[0]=o.result.cause,t[1]=e);let n;t[2]===e?n=t[3]:(n=(0,Q.jsx)(WQ,{text:e}),t[2]=e,t[3]=n);let r;t[4]===o.refresh?r=t[5]:(r=(0,Q.jsx)(X,{variant:`outline`,onClick:o.refresh,children:`Read status again`}),t[4]=o.refresh,t[5]=r);let i;return t[6]!==n||t[7]!==r?(i=(0,Q.jsxs)(Q.Fragment,{children:[n,r]}),t[6]=n,t[7]=r,t[8]=i):i=t[8],i}if(!O(o.result))return i;let s;return t[9]!==a||t[10]!==o.result.value?(s=a(o.result.value),t[9]=a,t[10]=o.result.value,t[11]=s):s=t[11],s}function k1(e){let t=(0,$.c)(68),{scope:n,context:r,action:i,status:a,expectedStatus:o,onBusy:s,onLookAgain:c}=e,l=o===void 0?a:o,u=a.branch,[d,f]=(0,Z.useState)(`Porcelain review`),[p,m]=(0,Z.useState)(u?.stashes?.[0]?.oid??``),[h,g]=(0,Z.useState)(i===`stash-create`),_;t[0]!==l||t[1]!==s||t[2]!==c?(_={expectedStatus:l,onBusy:s,onLookAgain:c},t[0]=l,t[1]=s,t[2]=c,t[3]=_):_=t[3];let v=H$(n,i,r,_),{busy:y,uncertain:b,outcome:x,error:S}=v,C;t[4]!==i||t[5]!==v||t[6]!==d||t[7]!==h||t[8]!==p?(C=e=>{e.preventDefault(),v.onSubmit(bQ(i,{message:d,stashOid:p,option:h}))},t[4]=i,t[5]=v,t[6]=d,t[7]=h,t[8]=p,t[9]=C):C=t[9];let w=y||b,T;t[10]!==i||t[11]!==h?(T=i===`stash-create`&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:h?`Tracked changes and new files are set aside. The handoff stays empty until you restore the stash.`:`Tracked changes are set aside. New files stay in the worktree.`}),t[10]=i,t[11]=h,t[12]=T):T=t[12];let E;t[13]!==i||t[14]!==v.messageLimit||t[15]!==d?(E=i===`stash-create`&&(0,Q.jsxs)(Ds,{children:[(0,Q.jsx)(_s,{htmlFor:`git-message`,children:`Message`}),(0,Q.jsx)(cH,{id:`git-message`,value:d,onChange:e=>f(e.target.value),required:!0,maxLength:v.messageLimit})]}),t[13]=i,t[14]=v.messageLimit,t[15]=d,t[16]=E):E=t[16];let D;t[17]!==i||t[18]!==u||t[19]!==p?(D=(i===`stash-apply`||i===`stash-pop`)&&(0,Q.jsxs)(Ds,{children:[(0,Q.jsx)(_s,{htmlFor:`git-stash`,children:`Stash`}),u?.stashes?.length?(0,Q.jsxs)(zo,{items:u.stashes.map(j1),value:p,onValueChange:e=>{e&&m(e)},children:[(0,Q.jsx)(Ks,{id:`git-stash`,children:(0,Q.jsx)(Ka,{})}),(0,Q.jsx)(_o,{children:u.stashes.map(A1)})]}):(0,Q.jsx)(ba,{id:`git-stash`,value:p,onChange:e=>m(e.target.value),required:!0,pattern:`([a-f0-9]{40}|[a-f0-9]{64})`})]}),t[17]=i,t[18]=u,t[19]=p,t[20]=D):D=t[20];let O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>g(e.target.checked),t[21]=O):O=t[21];let k;t[22]===h?k=t[23]:(k=(0,Q.jsx)(`input`,{type:`checkbox`,checked:h,onChange:O}),t[22]=h,t[23]=k);let A=i===`stash-create`?`Include untracked files`:`Restore staged changes`,j;t[24]!==A||t[25]!==k?(j=(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[k,A]}),t[24]=A,t[25]=k,t[26]=j):j=t[26];let M;t[27]!==j||t[28]!==w||t[29]!==T||t[30]!==E||t[31]!==D?(M=(0,Q.jsxs)(`fieldset`,{disabled:w,className:`flex min-w-0 flex-col gap-4`,children:[T,E,D,j]}),t[27]=j,t[28]=w,t[29]=T,t[30]=E,t[31]=D,t[32]=M):M=t[32];let N;t[33]===x?N=t[34]:(N=(0,Q.jsx)(M1,{outcome:x}),t[33]=x,t[34]=N);let P;t[35]!==x||t[36]!==b?(P=b&&!x&&(0,Q.jsx)(`p`,{role:`status`,children:`Outcome not yet confirmed`}),t[35]=x,t[36]=b,t[37]=P):P=t[37];let F;t[38]===S?F=t[39]:(F=S?(0,Q.jsx)(WQ,{text:lo(S)}):null,t[38]=S,t[39]=F);let I;t[40]!==y||t[41]!==v.lookAgain||t[42]!==c||t[43]!==x?(I=x&&Sa(x)&&c&&(0,Q.jsx)(X,{type:`button`,variant:`outline`,disabled:y,onClick:v.lookAgain,children:`Look again`}),t[40]=y,t[41]=v.lookAgain,t[42]=c,t[43]=x,t[44]=I):I=t[44];let L;t[45]!==y||t[46]!==v.checkOutcome||t[47]!==v.operation?(L=v.operation&&!y&&(0,Q.jsx)(X,{type:`button`,variant:`outline`,onClick:v.checkOutcome,children:`Check outcome`}),t[45]=y,t[46]=v.checkOutcome,t[47]=v.operation,t[48]=L):L=t[48];let R;t[49]!==y||t[50]!==x||t[51]!==b?(R=y||b||!!(x&&Sa(x)),t[49]=y,t[50]=x,t[51]=b,t[52]=R):R=t[52];let z;t[53]!==i||t[54]!==y?(z=y?`Working…`:CQ(i),t[53]=i,t[54]=y,t[55]=z):z=t[55];let B;t[56]!==R||t[57]!==z?(B=(0,Q.jsx)(X,{type:`submit`,disabled:R,children:z}),t[56]=R,t[57]=z,t[58]=B):B=t[58];let V;return t[59]!==M||t[60]!==N||t[61]!==P||t[62]!==F||t[63]!==I||t[64]!==L||t[65]!==B||t[66]!==C?(V=(0,Q.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:C,children:[M,N,P,F,I,L,B]}),t[59]=M,t[60]=N,t[61]=P,t[62]=F,t[63]=I,t[64]=L,t[65]=B,t[66]=C,t[67]=V):V=t[67],V}function A1(e){return(0,Q.jsxs)(Js,{value:e.oid,children:[e.message,` · `,R$(e.oid)]},e.oid)}function j1(e){return{value:e.oid,label:`${e.message} · ${R$(e.oid)}`}}function M1(e){let t=(0,$.c)(7),{outcome:n}=e;if(!n)return null;if(n.message&&go(n)&&n.state!==`conflicted`){let e;return t[0]===n.message?e=t[1]:(e=(0,Q.jsx)(WQ,{text:n.message}),t[0]=n.message,t[1]=e),e}let r=n.state,i;t[2]===n?i=t[3]:(i=N1(n),t[2]=n,t[3]=i);let a;return t[4]!==n.state||t[5]!==i?(a=(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm`,children:[r,i]}),t[4]=n.state,t[5]=i,t[6]=a):a=t[6],a}function N1({message:e,reason:t}){return e?` · ${e}`:t?` · ${t.replaceAll(`_`,` `).toLowerCase()}`:``}function P1(e){let t=(0,$.c)(39),{scope:n,context:r}=e,{connection:i}=r,a=Gn(ar(wF(n,i))),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),u=a!=null&&na(ga(a)).kind===`hint`,d=o||u,f=OF(n,i,d),p=Gn(ar(f.result)),m=MF(n,i),{preferences:h}=Cl(),[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(null),[w,T]=(0,Z.useState)(null),E;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>s(!0),t[0]=E):E=t[0];let D;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e&&x(null),y(e)},t[1]=D):D=t[1];let O;t[2]!==f||t[3]!==h.pullStrategy||t[4]!==m?(O={details:f,enableDetails:E,pullStrategy:h.pullStrategy,notify:I1,onProgress:D,onResult:x,refreshLook:m,onLooked:T},t[2]=f,t[3]=h.pullStrategy,t[4]=m,t[5]=O):O=t[5];let k=D$(n,r,O);if(a==null)return null;let A={...ga(a),branch:ro(a.branch,d?p?.branch:void 0)},j;t[6]===S?j=t[7]:(j=e=>e.id===S,t[6]=S,t[7]=j);let N=xQ.find(j),P=na(A),F=ua(P,A),I=P.kind===`run`||P.kind===`stash`,L=eo(P,A),R=Oa(A),z=k.running,B=e=>{if(Pa(e)){k.runNetwork(e,A.branch);return}T(A),C(e)},V;t[8]===z?V=t[9]:(V=e=>{e||x(null),z&&y(e)},t[8]=z,t[9]=V);let H;t[10]!==b||t[11]!==z?(H=(0,Q.jsx)(C$,{align:`end`,className:`w-80`,children:b&&!z?(0,Q.jsxs)(w$,{children:[(0,Q.jsx)(T$,{children:b.title}),b.description!==void 0&&(b.type===`error`?(0,Q.jsx)(WQ,{text:b.description}):(0,Q.jsx)(E$,{children:(0,Q.jsx)(UQ,{text:b.description})}))]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(T$,{children:z?`${za(z.name)}…`:`Git action…`}),(0,Q.jsx)(`ol`,{className:`flex flex-col gap-0.5 font-mono text-2xs leading-4`,children:z?.operation?.receipt?.progress.length?z.operation.receipt.progress.slice(-4).map(F1):(0,Q.jsx)(`li`,{className:`text-muted-foreground`,children:`Waiting for Git…`})})]})}),t[10]=b,t[11]=z,t[12]=H):H=t[12];let U;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{l(e),e&&s(!0)},t[13]=U):U=t[13];let W=z!=null,G;t[14]===W?G=t[15]:(G=(0,Q.jsx)(X,{variant:`outline`,size:`icon-sm`,"aria-label":`Git actions`,title:`Git actions menu`,disabled:W}),t[14]=W,t[15]=G);let ee;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(Na,{className:`size-3.5`}),t[16]=ee):ee=t[16];let te;t[17]===G?te=t[18]:(te=(0,Q.jsx)(TN,{render:G,children:ee}),t[17]=G,t[18]=te);let K;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(Vf,{className:`size-3.5 shrink-0`}),t[19]=K):K=t[19];let ne=R?R.name?.replace(/^refs\/heads\//,``)??`Detached HEAD`:`Git actions`,q;t[20]===ne?q=t[21]:(q=(0,Q.jsx)(`span`,{className:`truncate`,children:ne}),t[20]=ne,t[21]=q);let re;t[22]===R?re=t[23]:(re=R&&(0,Q.jsxs)(`span`,{className:`ml-auto shrink-0 tabular-nums`,children:[R.ahead,` ahead · `,R.behind,` behind`]}),t[22]=R,t[23]=re);let ie;t[24]!==q||t[25]!==re?(ie=(0,Q.jsx)(DN,{children:(0,Q.jsxs)(ON,{className:`flex items-center`,children:[K,q,re]})}),t[24]=q,t[25]=re,t[26]=ie):ie=t[26];let ae;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(IN,{}),t[27]=ae):ae=t[27];let oe=SQ.map((e,t)=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(DN,{children:e.actions.map(e=>{let t=Pa(e.id)&&d&&M(f.result)?`Reading the configured upstream.`:Ga(e.id,A),n=t??$s(e.id,A);return(0,Q.jsxs)(kN,{disabled:t!=null,onClick:()=>B(e.id),className:`items-start`,children:[(0,Q.jsx)(j$,{action:e.id,className:t==null?`mt-0.5`:`mt-0.5 opacity-50`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{className:t==null?void 0:`opacity-50`,children:e.label}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.description}),n&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n})]})]},e.id)})}),t<SQ.length-1&&(0,Q.jsx)(IN,{})]},e.id)),se;t[28]!==R?.discarded||t[29]!==k?(se=(R?.discarded?.length??0)>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(IN,{}),(0,Q.jsxs)(DN,{children:[(0,Q.jsx)(ON,{children:`Discarded`}),R?.discarded?.map(e=>{let t=e.kind===`rename`?`Restore discarded rename of ${e.path}`:`Restore discarded hunk of ${e.path}`;return(0,Q.jsxs)(kN,{onClick:()=>{l(!1),k.restoreDiscarded(e)},children:[(0,Q.jsx)(qp,{}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Kept until you restore it`})]})]},e.oid)})]})]}),t[28]=R?.discarded,t[29]=k,t[30]=se):se=t[30];let ce;t[31]!==ie||t[32]!==oe||t[33]!==se?(ce=(0,Q.jsxs)(EN,{align:`end`,className:`w-72`,children:[ie,ae,oe,se]}),t[31]=ie,t[32]=oe,t[33]=se,t[34]=ce):ce=t[34];let le;return t[35]!==c||t[36]!==te||t[37]!==ce?(le=(0,Q.jsxs)(wN,{open:c,onOpenChange:U,children:[te,ce]}),t[35]=c,t[36]=te,t[37]=ce,t[38]=le):le=t[38],(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(QQ,{"aria-label":`Git controls`,className:`shrink-0`,children:[(0,Q.jsxs)(x$,{open:z!=null&&v||b!=null,onOpenChange:V,children:[(0,Q.jsxs)(S$,{render:(0,Q.jsx)(X,{variant:`outline`,size:I&&!z?`sm`:`icon-sm`,"aria-label":z?`${za(z.name)} in progress: show progress`:P.label,title:z?`${za(z.name)} in progress`:F,disabled:z==null&&P.kind===`hint`,focusableWhenDisabled:!0,className:`aria-disabled:cursor-default`,onClick:()=>{z||b||(P.kind===`commit`?B(`commit`):P.kind===`stash`?B(`stash-apply`):P.kind===`run`&&k.runNetwork(P.action,A.branch))}}),children:[z?(0,Q.jsx)(Ko,{className:`size-3.5`}):(0,Q.jsx)(j$,{action:L1(P),className:`size-3.5`}),I&&!z&&(0,Q.jsxs)(`span`,{"aria-hidden":`true`,children:[P.label,L!=null&&` ${L}`]})]}),H]}),le]}),S==null?null:(0,Q.jsx)(SI,{open:!0,disablePointerDismissal:!0,onOpenChange:e=>{!e&&!g&&C(null)},children:(0,Q.jsxs)(TI,{"aria-busy":g,className:`max-h-[min(90svh,48rem)] overflow-y-auto sm:max-w-2xl`,children:[N?.id!==`commit`&&N?.id!==`amend`&&(0,Q.jsxs)(EI,{children:[(0,Q.jsx)(OI,{children:N?.label??`Git action`}),(0,Q.jsx)(kI,{children:R1(N?.id)})]}),(0,Q.jsx)(w1,{scope:n,context:r,entry:S,status:w??A,onBusy:_,onLookAgain:k.lookAgain})]})})]})}function F1(e){return(0,Q.jsx)(`li`,{className:`truncate`,title:e,children:e},e)}function I1(e){let{title:t,description:n,type:r}=e;return ul.add({title:t,description:n===void 0?void 0:(0,Q.jsx)(UQ,{text:n}),type:r})}function L1(e){return e.kind===`run`?e.action:e.kind===`stash`?`stash-apply`:`commit`}function R1(e){return e===`stash-pop`?`Its changes come back into the working tree and the stash is dropped.`:e===`stash-apply`?`Its changes come back into the working tree and the stash is kept.`:`Every change, new files included, is set aside until you pop the stash.`}function z1(e,t){return e?`Loading models…`:t?`Choose a model`:`No models available`}function B1(e,t,n){return e?`Could not load installed coding CLIs.`:!t&&!n?`Install and sign in to Codex or Claude Code on the server to generate drafts.`:`Uses a signed-in coding CLI on the server. Codex models come from its local catalogue.`}function V1(){let e=(0,$.c)(5),t=wQ(Gs()),n=Gn(ar(t)),r=M(t),{preferences:i,setPreference:a}=Cl(),o=vQ(n,i.commitModel)??``,s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`label`,{htmlFor:`commit-model`,className:`text-sm font-medium`,children:`Commit model`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Drafts messages and groups in the commit dialog.`})]}),e[0]=s):s=e[0];let c;e[1]===a?c=e[2]:(c=e=>{e&&a(`commitModel`,e)},e[1]=a,e[2]=c);let l=B1(st(t),r,n?.length),u;return e[3]===l?u=e[4]:(u=(0,Q.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:l}),e[3]=l,e[4]=u),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:gap-x-6`,children:[s,(0,Q.jsxs)(zo,{items:n?.map(G1)??[],value:o||null,disabled:r||!n?.length,onValueChange:c,children:[(0,Q.jsx)(Ks,{id:`commit-model`,className:`w-full shrink-0 sm:w-56`,children:(0,Q.jsx)(Ka,{placeholder:z1(r,n?.length)})}),(0,Q.jsx)(_o,{children:_Q(n?.filter(W1)??[]).map(H1)})]}),u]})}function H1(e){let[t,n]=e;return(0,Q.jsxs)(zs,{children:[(0,Q.jsx)(To,{children:t}),n.map(U1)]},t)}function U1(e){return(0,Q.jsx)(Js,{value:e.id,children:e.label},e.id)}function W1(e){return!e.id.endsWith(`:default`)}function G1(e){return{value:e.id,label:e.label}}function K1(e){let t=(0,$.c)(2),n;t[0]===e?n=t[1]:(n=nu(e),t[0]=e,t[1]=n),tn(n)}var q1=`claude mcp add porcelain -- porcelain mcp`,J1=[{id:`appearance`,label:`Appearance`,icon:dp},{id:`git`,label:`Git and agents`,icon:Vf},{id:`connection`,label:`Connection`,icon:Ia},{id:`updates`,label:`Updates`,icon:Ep}],Y1=J1[0].id;function X1(e){let t=(0,$.c)(23),{label:n,description:r,name:i,options:a}=e,{preferences:o,setPreference:s}=Cl(),c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(Ps,{children:n}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=(0,Q.jsx)(Yi,{children:r}),t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,Q.jsxs)(Ba,{children:[c,l]}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d=o[i],f;t[7]!==i||t[8]!==a||t[9]!==s?(f=e=>{let t=a.find(t=>t.value===e);t&&s(i,t.value)},t[7]=i,t[8]=a,t[9]=s,t[10]=f):f=t[10];let p;t[11]===a?p=t[12]:(p=a.map(Z1),t[11]=a,t[12]=p);let m;t[13]!==n||t[14]!==p?(m=(0,Q.jsx)(mQ,{"aria-label":n,children:p}),t[13]=n,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==d||t[17]!==f||t[18]!==m?(h=(0,Q.jsx)(mo,{children:(0,Q.jsx)(fQ,{value:d,onValueChange:f,children:m})}),t[16]=d,t[17]=f,t[18]=m,t[19]=h):h=t[19];let g;return t[20]!==u||t[21]!==h?(g=(0,Q.jsxs)(so,{variant:`outline`,children:[u,h]}),t[20]=u,t[21]=h,t[22]=g):g=t[22],g}function Z1(e){return(0,Q.jsx)(hQ,{value:e.value,children:e.label},e.value)}function Q1(){let e=(0,$.c)(6),{preferences:t,setPreference:n}=Cl(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(As,{variant:`label`,children:`When archiving a review`}),e[0]=r):r=e[0];let i;e[1]!==t||e[2]!==n?(i=xj.map(e=>{let{key:r,label:i}=e;return(0,Q.jsxs)(so,{variant:`outline`,children:[(0,Q.jsx)(Ba,{children:(0,Q.jsx)(Ps,{children:i})}),(0,Q.jsx)(mo,{children:(0,Q.jsx)(da,{"aria-label":i,checked:t[r],onCheckedChange:e=>n(r,e)})})]},r)}),e[1]=t,e[2]=n,e[3]=i):i=e[3];let a;return e[4]===i?a=e[5]:(a=(0,Q.jsxs)(Ao,{children:[r,(0,Q.jsx)(Fo,{children:i})]}),e[4]=i,e[5]=a),a}function $1(){let e=(0,$.c)(6),{preferences:t,setPreference:n}=Cl(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Ba,{children:[(0,Q.jsx)(Ps,{children:`Spec files`}),(0,Q.jsx)(Yi,{children:`Group specs separately and start them collapsed.`})]}),e[0]=r):r=e[0];let i;e[1]===n?i=e[2]:(i=e=>n(`collapseSpecs`,e),e[1]=n,e[2]=i);let a;return e[3]!==t.collapseSpecs||e[4]!==i?(a=(0,Q.jsxs)(so,{variant:`outline`,children:[r,(0,Q.jsx)(mo,{children:(0,Q.jsx)(da,{"aria-label":`Spec files`,checked:t.collapseSpecs,onCheckedChange:i})})]}),e[3]=t.collapseSpecs,e[4]=i,e[5]=a):a=e[5],a}function e0(){let e=(0,$.c)(28),{configuration:t,failed:n,retry:r}=ws(),i=q1,a=n?` MCP configuration is unavailable.`:` Loading MCP configuration…`,o,s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(Ps,{children:`Porcelain MCP server`}),s=(0,Q.jsx)(Yi,{children:`Agents read and add comments, read reviewed marks, and upload their handoff through it. It needs no credential.`}),e[0]=o,e[1]=s):(o=e[0],s=e[1]);let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Run this on the computer hosting your Porcelain server.`}),e[2]=c):c=e[2];let l;e[3]===t?l=e[4]:(l=!1,e[3]=t,e[4]=l);let u;e[5]!==i||e[6]!==a?(u=i?(0,Q.jsxs)(Q.Fragment,{children:[`Add it to Claude Code with`,` `,(0,Q.jsx)(`code`,{className:`break-all font-mono`,children:i})]}):a,e[5]=i,e[6]=a,e[7]=u):u=e[7];let d;e[8]===u?d=e[9]:(d=(0,Q.jsx)(`p`,{className:`text-sm`,children:u}),e[8]=u,e[9]=d);let f;e[10]!==l||e[11]!==d?(f=(0,Q.jsxs)(Ba,{children:[o,s,c,l,d]}),e[10]=l,e[11]=d,e[12]=f):f=e[12];let p;e[13]!==n||e[14]!==r?(p=!1,e[13]=n,e[14]=r,e[15]=p):p=e[15];let m=i===void 0,h;e[16]===i?h=e[17]:(h=()=>{i!==void 0&&At(i,`MCP configuration`)},e[16]=i,e[17]=h);let g;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(Qi,{}),e[18]=g):g=e[18];let _;e[19]!==m||e[20]!==h?(_=(0,Q.jsx)(X,{size:`icon-sm`,variant:`ghost`,"aria-label":`Copy MCP configuration`,disabled:m,onClick:h,children:g}),e[19]=m,e[20]=h,e[21]=_):_=e[21];let v;e[22]!==_||e[23]!==p?(v=(0,Q.jsxs)(mo,{children:[p,_]}),e[22]=_,e[23]=p,e[24]=v):v=e[24];let y;return e[25]!==v||e[26]!==f?(y=(0,Q.jsxs)(so,{variant:`outline`,children:[f,v]}),e[25]=v,e[26]=f,e[27]=y):y=e[27],y}function t0(){let{connection:e}=Gs();return bI(e).environment}function n0(){let e=(0,$.c)(2),t=t0(),n;return e[0]===t?n=e[1]:(n=(0,Q.jsx)(jo,{environment:t}),e[0]=t,e[1]=n),n}function r0(){let e=(0,$.c)(2),t=t0(),n;return e[0]===t?n=e[1]:(n=(0,Q.jsx)(Io,{environment:t}),e[0]=t,e[1]=n),n}function i0(e){let t=(0,$.c)(18),{section:n}=e;switch(n){case`git`:{let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Q1,{}),t[0]=e):e=t[0];let n;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(As,{variant:`label`,children:`Git`}),t[1]=n):n=t[1];let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(X1,{label:`Pull strategy`,description:`Used by Pull in the Git menu.`,name:`pullStrategy`,options:[{value:`merge`,label:`Merge`},{value:`rebase`,label:`Rebase`}]}),t[2]=r):r=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsxs)(Ao,{children:[n,(0,Q.jsxs)(Fo,{children:[r,(0,Q.jsx)(so,{variant:`outline`,children:(0,Q.jsx)(Ba,{children:(0,Q.jsx)(V1,{})})})]})]}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(As,{variant:`label`,children:`Agents`}),t[4]=a):a=t[4];let o;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(Q.Fragment,{children:[e,i,(0,Q.jsxs)(Ao,{children:[a,(0,Q.jsx)(Fo,{children:(0,Q.jsx)(e0,{})})]})]}),t[5]=o):o=t[5],o}case`connection`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Fo,{children:(0,Q.jsx)(so,{variant:`outline`,children:(0,Q.jsx)(Ba,{children:(0,Q.jsx)(ls,{})})})}),t[6]=e):e=t[6],e}case`computer`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(n0,{}),t[7]=e):e=t[7],e}case`ways-in`:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(vs,{}),t[8]=e):e=t[8],e}case`devices`:{let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(r0,{}),t[9]=e):e=t[9],e}case`updates`:{let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Fo,{children:(0,Q.jsx)(so,{variant:`outline`,children:(0,Q.jsx)(Ba,{children:(0,Q.jsx)(Rs,{})})})}),t[10]=e):e=t[10],e}default:{let e;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Fo,{children:(0,Q.jsx)(X1,{label:`Theme`,description:`System follows your operating system.`,name:`appearance`,options:[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}]})}),t[11]=e):e=t[11];let n;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(As,{variant:`label`,children:`Code`}),t[12]=n):n=t[12];let r;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(X1,{label:`Diff layout`,description:`Split shows old and new side by side.`,name:`diffStyle`,options:[{value:`unified`,label:`Unified`},{value:`split`,label:`Split`}]}),t[13]=r):r=t[13];let i;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsxs)(Ao,{children:[n,(0,Q.jsxs)(Fo,{children:[r,(0,Q.jsx)(X1,{label:`Long lines`,description:`Wrap keeps every line visible without scrolling.`,name:`lineOverflow`,options:[{value:`scroll`,label:`Scroll`},{value:`wrap`,label:`Wrap`}]}),(0,Q.jsx)($1,{})]})]}),t[14]=i):i=t[14];let a;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(As,{variant:`label`,children:`Documents`}),t[15]=a):a=t[15];let o;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(X1,{label:`Markdown opens as`,description:`You can switch per file.`,name:`markdownDefault`,options:[{value:`reader`,label:`Reader`},{value:`source`,label:`Source`}]}),t[16]=o):o=t[16];let s;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsxs)(Q.Fragment,{children:[e,i,(0,Q.jsxs)(Ao,{children:[a,(0,Q.jsxs)(Fo,{children:[o,(0,Q.jsx)(X1,{label:`HTML opens as`,description:`Previews run in a sandbox with no access to Porcelain.`,name:`htmlDefault`,options:[{value:`preview`,label:`Preview`},{value:`source`,label:`Source`}]})]})]})]}),t[17]=s):s=t[17],s}}}function a0(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(hL,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-8 px-6 py-6`,children:n})}),t[0]=n,t[1]=r),r}function o0(e){let t=(0,$.c)(61),{section:n,environmentId:r}=e,i=ec(),a=sa(r??``)?.remote,{element:o,attach:s}=KZ(),{element:c,attach:l}=KZ(),[u,d]=(0,Z.useState)(null),f=()=>{u?y.history.back():i({to:`/settings/$section`,params:{section:`remotes`},replace:!0})},p;t[0]!==o?.scrollTop||t[1]!==i?(p=e=>{d({scroll:o?.scrollTop??0,focus:document.activeElement instanceof HTMLElement?document.activeElement:null}),i({to:`/settings/$section/$environmentId`,params:{section:`remotes`,environmentId:e}})},t[0]=o?.scrollTop,t[1]=i,t[2]=p):p=t[2];let m=p,h;t[3]!==r||t[4]!==l?(h=e=>{l(e),r!==void 0&&e?.focus({preventScroll:!0})},t[3]=r,t[4]=l,t[5]=h):h=t[5];let g=h,_;t[6]!==r||t[7]!==u||t[8]!==s?(_=e=>{if(s(e),r===void 0&&e){u&&(e.scrollTop=u.scroll);let t=u?.focus;t?.isConnected?t.focus({preventScroll:!0}):e.focus({preventScroll:!0})}},t[6]=r,t[7]=u,t[8]=s,t[9]=_):_=t[9];let v=_,y=Xa(),b=Bu(),{connection:x}=Gs(),{environment:S}=bI(x);K1(S.custom?`Settings · ${S.name}`:`Settings`);let C;t[10]===n?C=t[11]:(C=J1.find(e=>e.id===n)??J1[0],t[10]=n,t[11]=C);let w=C,T;t[12]!==b||t[13]!==r||t[14]!==i||t[15]!==f||t[16]!==y?(T=()=>{r===void 0?b?y.history.back():i({to:`/`}):f()},t[12]=b,t[13]=r,t[14]=i,t[15]=f,t[16]=y,t[17]=T):T=t[17];let E=T,D;t[18]===c?D=t[19]:(D={target:c,ignoreInputs:!0},t[18]=c,t[19]=D),xu(`Escape`,E,D);let O;t[20]===S.name?O=t[21]:(O=(0,Q.jsx)(xI,{environment:S.name}),t[20]=S.name,t[21]=O);let k;t[22]!==w.id||t[23]!==r||t[24]!==i||t[25]!==f?(k=J1.map(e=>{let t=e.icon,n=w.id===e.id;return(0,Q.jsxs)(X,{variant:n?`secondary`:`ghost`,size:`sm`,className:`shrink-0 justify-start md:w-full`,"aria-current":n?`page`:void 0,onClick:()=>{if(r!==void 0&&e.id===`remotes`){f();return}i({to:`/settings/$section`,params:{section:e.id},replace:!0})},children:[(0,Q.jsx)(t,{}),e.label]},e.id)}),t[22]=w.id,t[23]=r,t[24]=i,t[25]=f,t[26]=k):k=t[26];let A;t[27]===k?A=t[28]:(A=(0,Q.jsx)(`div`,{className:`flex gap-1 overflow-x-auto p-2 md:min-h-0 md:flex-1 md:flex-col md:overflow-y-auto`,children:k}),t[27]=k,t[28]=A);let j;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(Rd,{className:`size-3.5`}),t[29]=j):j=t[29];let M;t[30]===E?M=t[31]:(M=(0,Q.jsx)(`footer`,{className:`flex shrink-0 items-center border-t p-2`,children:(0,Q.jsxs)(X,{variant:`ghost`,className:`h-8 min-w-0 flex-1 justify-start`,onClick:E,children:[j,`Back`]})}),t[30]=E,t[31]=M);let N;t[32]!==M||t[33]!==O||t[34]!==A?(N=(0,Q.jsxs)(`nav`,{"aria-label":`Settings sections`,className:`flex shrink-0 flex-col overflow-hidden rounded-xl border bg-card md:w-66`,children:[O,A,M]}),t[32]=M,t[33]=O,t[34]=A,t[35]=N):N=t[35];let P,F;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(yL,{children:`Settings`}),F=(0,Q.jsx)(SL,{}),t[36]=P,t[37]=F):(P=t[36],F=t[37]);let I;t[38]!==w.label||t[39]!==r||t[40]!==f?(I=(0,Q.jsx)(yL,{children:(0,Q.jsx)(`h2`,{children:r===void 0?(0,Q.jsx)(xL,{children:w.label}):(0,Q.jsx)(bL,{render:(0,Q.jsx)(`button`,{type:`button`,onClick:f}),children:`Remote computers`})})}),t[38]=w.label,t[39]=r,t[40]=f,t[41]=I):I=t[41];let L;t[42]!==r||t[43]!==a?(L=r!==void 0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(SL,{}),(0,Q.jsx)(yL,{children:(0,Q.jsx)(xL,{children:a?(0,Q.jsx)(js,{remote:a}):`Computer unavailable`})})]}),t[42]=r,t[43]=a,t[44]=L):L=t[44];let R;t[45]!==I||t[46]!==L?(R=(0,Q.jsx)(`header`,{className:`flex h-11 shrink-0 items-center border-b px-6`,children:(0,Q.jsx)(_L,{children:(0,Q.jsxs)(vL,{children:[P,F,I,L]})})}),t[45]=I,t[46]=L,t[47]=R):R=t[47];let z;t[48]!==v||t[49]!==w.id||t[50]!==r||t[51]!==m||t[52]!==f?(z=w.id===`remotes`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{ref:v,className:r===void 0?`min-h-0 flex-1 overflow-y-auto`:`hidden`,role:`region`,"aria-label":`Remote computers list`,tabIndex:-1,children:(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-8 px-6 py-6`,children:(0,Q.jsx)(xo,{onOpen:m})})}),r!==void 0&&(0,Q.jsx)(a0,{children:(0,Q.jsx)(us,{environmentId:r,onForgotten:f},r)})]}):(0,Q.jsx)(a0,{children:(0,Q.jsx)(i0,{section:w.id})}),t[48]=v,t[49]=w.id,t[50]=r,t[51]=m,t[52]=f,t[53]=z):z=t[53];let B;t[54]!==R||t[55]!==z?(B=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-xl border bg-card`,children:[R,z]}),t[54]=R,t[55]=z,t[56]=B):B=t[56];let V;return t[57]!==g||t[58]!==N||t[59]!==B?(V=(0,Q.jsx)(`div`,{className:`h-svh min-w-0 flex-1 bg-muted p-2 text-ui text-foreground`,children:(0,Q.jsxs)(`main`,{ref:g,tabIndex:-1,"aria-label":`Settings`,className:`flex h-full min-h-0 min-w-0 flex-col gap-2 md:flex-row`,children:[N,B]})}),t[57]=g,t[58]=N,t[59]=B,t[60]=V):V=t[60],V}var s0={kind:`handoff`},c0={kind:`all-changes`},l0={kind:`specs`},u0={kind:`branch`},d0={kind:`proof`},f0={kind:`graph`};function p0(e){switch(e.kind){case`handoff`:return`handoff`;case`all-changes`:return`all-changes`;case`specs`:return`specs`;case`proof`:return`proof`;case`change`:return`change:${e.path}`;case`file`:return`file:${e.path}`;case`commit`:return`commit:${e.oid}`;case`branch`:return`branch`;case`branch-file`:return`branch:${e.path}`;case`graph`:return`graph`;case`timeline`:return`timeline:${e.path}`}}function m0(e){if(e==null||e===``)return null;if(e===`handoff`)return s0;if(e===`all-changes`)return c0;if(e===`specs`)return l0;if(e===`proof`)return d0;if(e===`branch`)return u0;if(e===`graph`)return f0;let t=e.indexOf(`:`);if(t<=0)return null;let n=e.slice(0,t),r=e.slice(t+1);if(r===``)return null;switch(n){case`change`:case`file`:case`timeline`:return{kind:n,path:r};case`branch`:return{kind:`branch-file`,path:r};case`commit`:return/^[0-9a-f]{4,64}$/.test(r)?{kind:n,oid:r}:null;default:return null}}function h0(e,t,n){if(e.includes(t))return[...e];let r=n==null?-1:e.indexOf(n),i=[...e];return i.splice(r===-1?i.length:r+1,0,t),i}function g0(e){if(e)return`Review`}var _0={changes:`Changes`,files:`Files`,history:`History`};function v0(e){switch(e.kind){case`handoff`:return`Changes`;case`all-changes`:return`All changes`;case`specs`:return`Specs`;case`proof`:return`Proof`;case`branch`:return`Branch changes`;case`graph`:return`Commit graph`;case`commit`:return R$(e.oid);case`change`:case`file`:case`branch-file`:return e.path.split(`/`).at(-1)??e.path;case`timeline`:return`Timeline of ${e.path.split(`/`).at(-1)??e.path}`}}function y0(e){let t=m0(e.entry),n=t?v0(t):_0[e.surface??`files`],r=e.project?`${n} — ${e.project}`:n;return e.environment?`${r} · ${e.environment}`:r}var b0=()=>({tabs:[],pinned:[]});function x0(e,t,n){if(e[t]?.tabs.includes(n))return t;let r=+(t===0);return e[r]?.tabs.includes(n)?r:t}function S0(e){return[...e.pinned.filter(t=>e.tabs.includes(t)),...e.tabs.filter(t=>!e.pinned.includes(t))]}function C0(e,t,n){return e.tabs.includes(t)?e:{...e,tabs:h0(e.tabs,t,n)}}function w0(e,t){return{tabs:e.tabs.filter(e=>e!==t),pinned:e.pinned.filter(e=>e!==t)}}function T0(e,t){return{...e,tabs:e.tabs.filter(n=>n===t||e.pinned.includes(n))}}function E0(e){return{...e,tabs:e.tabs.filter(t=>e.pinned.includes(t))}}function D0(e,t){return e.pinned.includes(t)?{...e,pinned:e.pinned.filter(e=>e!==t)}:{...e,pinned:[...e.pinned,t]}}function O0(e,t,n){let r=S0(e),i=new Set(S0(n)),a=r.indexOf(t);return a===-1?null:[...r.slice(a+1),...r.slice(0,a).reverse()].find(e=>i.has(e))??null}function k0(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A0(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&(m0(e)??null)!==null):[]}function j0(e){if(!k0(e)||!Array.isArray(e.panes))return null;let t=e.panes.map(e=>{let t=A0(k0(e)?e.tabs:void 0);return{tabs:t,pinned:A0(k0(e)?e.pinned:void 0).filter(e=>t.includes(e))}}).filter((e,t)=>t===0||e.tabs.length>0);return t.length>0?t:null}function M0(e){return e===null?`Open to the side`:e===`left`?`Open in the right pane`:`Open in the left pane`}function N0(e){let t=(0,$.c)(4),{children:n}=e,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={poolSize:4,workerFactory:P0},i={theme:vc},t[0]=r,t[1]=i):(r=t[0],i=t[1]);let a;return t[2]===n?a=t[3]:(a=(0,Q.jsx)(_E,{poolOptions:r,highlighterOptions:i,children:n}),t[2]=n,t[3]=a),a}function P0(){return new Worker(new URL(`/assets/worker-Bs0l0ezO.js`,``+import.meta.url),{type:`module`})}function F0(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=mu(`(min-width: 1280px)`),e[0]=t):t=e[0],at(t)}function I0(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function L0(e){return!e||typeof e!=`object`||!(`folded`in e)||!(`expanded`in e)?{folded:[],expanded:[]}:I0(e.folded)&&I0(e.expanded)?{folded:e.folded,expanded:e.expanded}:{folded:[],expanded:[]}}function R0(e,t,n=!1){return e.folded.includes(t)||n&&!e.expanded.includes(t)}function z0(e,t,n){let r=new Set(e.folded),i=new Set(e.expanded);for(let e of t)n?(r.add(e),i.delete(e)):(r.delete(e),i.add(e));return{folded:[...r],expanded:[...i]}}var B0=Sn(a({saved:Pe})),V0=Zt.pipe(vr(a({panes:Gr(we(a({tabs:we(J),pinned:we(J)}))),saved:Pe}),{decode:pe(e=>({panes:j0(e),saved:B0(e).pipe(xi(e=>e.saved),Lr(()=>!0))})),encode:q()})),H0=Zt.pipe(vr(a({folded:we(J),expanded:we(J)}),{decode:pe(L0),encode:q()})),U0=It(e=>oi({runtime:$c,key:`porcelain.tabs.${e}`,schema:V0,defaultValue:()=>({panes:null,saved:!1})})),W0=It(e=>oi({runtime:$c,key:e,schema:H0,defaultValue:()=>({folded:[],expanded:[]})}));function G0(e){let t=(0,$.c)(8),n;t[0]===e?n=t[1]:(n=U0(e),t[0]=e,t[1]=n);let r=n,{panes:i,saved:a}=at(r),o=y(r),s;t[2]===o?s=t[3]:(s=e=>o({panes:e,saved:!0}),t[2]=o,t[3]=s);let c;return t[4]!==i||t[5]!==a||t[6]!==s?(c={panes:i,saved:a,save:s},t[4]=i,t[5]=a,t[6]=s,t[7]=c):c=t[7],c}function K0(e,t){let n=(0,$.c)(7),r=`porcelain.folds.${e}.${t}`,i;n[0]===r?i=n[1]:(i=W0(r),n[0]=r,n[1]=i);let a=i,o=at(a),s=y(a),c;n[2]===s?c=n[3]:(c=(e,t)=>s(n=>z0(n,e,t)),n[2]=s,n[3]=c);let l;return n[4]!==c||n[5]!==o?(l={folds:o,setCollapsed:c},n[4]=c,n[5]=o,n[6]=l):l=n[6],l}var q0=It(e=>oi({runtime:$c,key:`porcelain.walkthrough.${e}`,schema:J,defaultValue:()=>`briefing`})),J0=It(e=>Er(`walkthrough`).pipe(wn));function Y0(e){let t=(0,$.c)(12),n;t[0]===e?n=t[1]:(n=q0(e),t[0]=e,t[1]=n);let r=n,i;t[2]===e?i=t[3]:(i=J0(e),t[2]=e,t[3]=i);let a=i,o=y(r),s=y(a),c=at(r),l=at(a),u;t[4]!==o||t[5]!==s?(u=e=>{o(e),s(`walkthrough`)},t[4]=o,t[5]=s,t[6]=u):u=t[6];let d;return t[7]!==s||t[8]!==c||t[9]!==l||t[10]!==u?(d={place:c,view:l,setView:s,setPlace:u},t[7]=s,t[8]=c,t[9]=l,t[10]=u,t[11]=d):d=t[11],d}var X0=It(e=>Er(null));function Z0(){let e=(0,$.c)(5),t=(0,Z.useId)(),n;e[0]===t?n=e[1]:(n=X0(t),e[0]=t,e[1]=n);let r=n;tn(r);let i=at(yu),a;return e[2]!==r||e[3]!==i?(a={scrollTo:e=>i.get(r)?.scrollTo(e),attach:e=>{if(e)return i.set(r,e),()=>{i.get(r)===e&&i.set(r,null)}}},e[2]=r,e[3]=i,e[4]=a):a=e[4],a}var Q0=It(e=>Er({revision:void 0,request:0}).pipe(wn));function $0(e){let t=(0,$.c)(7),n;t[0]===e?n=t[1]:(n=Q0(e),t[0]=e,t[1]=n);let r=n,i=at(r),a=y(r),o;t[2]===a?o=t[3]:(o=e=>a(t=>({revision:e,request:t.request+1})),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s={...i,choose:o},t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function e2(e){let t=(0,$.c)(16),{worktreeId:n,entry:r,side:i,onSearch:a,fallback:o,focused:s,setFocused:c,ready:l,focusBoundary:u,focusBoundaryOpen:d}=e,{panes:f,saved:p,save:m}=G0(n),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=[void 0,void 0],t[0]=h):h=t[0];let[g,_]=(0,Z.useState)(h),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=[null,null],t[1]=v):v=t[1];let[y,b]=(0,Z.useState)(v),x=(0,Z.useId)(),S;t[2]===x?S=t[3]:(S=t2(x),t[2]=x,t[3]=S);let C=at(S),w=C.cancel,T=[r!=null&&(m0(r)??null)!==null?r:void 0,i!=null&&(m0(i)??null)!==null?i:void 0],E;t[4]!==r||t[5]!==o||t[6]!==a||t[7]!==l||t[8]!==p||t[9]!==i?(E=n2({ready:l,entry:r,side:i,onSearch:a,fallback:o,saved:p}),t[4]=r,t[5]=o,t[6]=a,t[7]=l,t[8]=p,t[9]=i,t[10]=E):E=t[10],tn(E);let D=e=>{let t=g[e];return t===void 0?T[e]:t??void 0},O=f??[o==null?b0():{tabs:[o],pinned:[]}],k=[D(0)??(f==null?o:S0(O[0]??b0()).at(-1)??null),D(1)??(O[1]===null||O[1]===void 0?null:S0(O[1]).at(-1)??null)],A=[C0(O[0]??b0(),k[0]??``,y[0])];(k[0]===null||k[0]===void 0)&&(A[0]=O[0]??b0()),k[1]!==null&&k[1]!==void 0?A[1]=C0(O[1]??b0(),k[1],y[1]):O[1]?.tabs.length&&(A[1]=O[1]);let j=A.length>1;if(l){let e=g.map((e,t)=>e!==void 0&&(T[t]??null)===(e??null)?void 0:e);(e[0]!==g[0]||e[1]!==g[1])&&_([e[0],e[1]]),(y[0]!==k[0]||y[1]!==k[1])&&b(k),s===1&&!j&&c(0)}tn(r2({worktreeId:n,panes:A,ready:l}));let M;t[11]!==w||t[12]!==a?(M=e=>{w(),_(t=>[`entry`in e?e.entry??null:t[0],`side`in e?e.side??null:t[1]]),a({...`entry`in e?{entry:e.entry??void 0}:{},...`side`in e?{side:e.side??void 0}:{}})},t[11]=w,t[12]=a,t[13]=M):M=t[13];let N=M,P;t[14]===N?P=t[15]:(P=(e,t)=>N(e===0?{entry:t}:{side:t}),t[14]=N,t[15]=P);let F=P,I=(e,t)=>A.map((n,r)=>r===e?t:n),L=(e,t,n)=>{if(w(),j&&t.tabs.length===0){let t=+(e===0);m([A[t]??b0()]),c(0),N({entry:k[t],side:null});return}m(I(e,t)),n!==k[e]&&F(e,n)};return{focusDestination:C.schedule,hasDestinationFocus(){return C.current()!==null},selectPane(e){w(),c(e)},focusPane(e,t){if(d)return;let n=C.destination;n!==null&&(n.pane!==e||t.getAttribute(`role`)!==`tab`||t.getAttribute(`data-entry`)!==n.key)&&w(),c(e)},bindPane(e,t){return C.bind(e,t,{focused:s,actives:k,panes:A,focusBoundary:u})},split:j,panes:A.map((e,t)=>({tabs:S0(e),pinned:e.pinned,active:k[t]??null})),activate(e,t){c(e),F(e,t)},open(e,t){let n=x0(A,e,t);return F(n,t),C.request({pane:n,key:t}),c(n),n},close(e,t){let n=A[e]??b0(),r=w0(n,t);L(e,r,t===k[e]?O0(n,t,r):k[e])},closeOthers(e,t){L(e,T0(A[e]??b0(),t),t)},closeUnpinned(e){let t=E0(A[e]??b0()),n=k[e];L(e,t,n!=null&&t.tabs.includes(n)?n:S0(t)[0]??null)},togglePin(e,t){m(I(e,D0(A[e]??b0(),t)))},openToSide(e,t){let n=+(e===0),r=[...A];r[n]=C0(A[n]??b0(),t,k[n]),m(r),F(n,t),C.request({pane:n,key:t}),c(n)},step(e,t){w();let n=S0(A[e]??b0());if(n.length===0)return;let r=k[e]===null||k[e]===void 0?-1:n.indexOf(k[e]);F(e,n[(r+t+n.length)%n.length]??null)}}}var t2=It(e=>Er(e=>{let t=[null,null],n=null,r,i=null,a=()=>{i!==null&&cancelAnimationFrame(i),i=null},o=()=>{n=null,a()},s=()=>(n&&r&&(r.focused!==n.pane||r.actives[n.pane]!==n.key||!r.panes[n.pane]?.tabs.includes(n.key))&&o(),n),c=()=>{n&&i===null&&(i=requestAnimationFrame(()=>{i=null;let e=s();if(!e||r?.focusBoundary?.isConnected)return;let a=[...t[e.pane]?.querySelectorAll(`[role="tab"]`)??[]].find(t=>t.dataset.entry===e.key);a?.isConnected&&(a.focus(),a.ownerDocument.activeElement===a&&n===e&&(n=null))}))};return e.addFinalizer(o),{get destination(){return n},current:s,cancel:o,schedule:c,request(e){n=e},bind(e,n,i){if(a(),r=i,t[e]=n,s(),n)return c(),()=>{t[e]===n&&(t[e]=null),a()}}}})),n2=It(({ready:e,entry:t,side:n,onSearch:r,fallback:i,saved:a})=>Er(()=>{e&&(t!==void 0&&m0(t)===null&&r({entry:void 0},{replace:!0}),n!==void 0&&m0(n)===null&&r({side:void 0},{replace:!0}),!a&&t===void 0&&n===void 0&&i!==null&&r({entry:i},{replace:!0}))})),r2=It(({worktreeId:e,panes:t,ready:n})=>Er(r=>{if(!n)return;let i=U0(e),a=r.once(i);a.saved&&JSON.stringify(a.panes)===JSON.stringify(t)||r.set(i,{panes:t,saved:!0})})),i2=It(e=>aV(e).pipe(Ar,cn(0)));function a2(e,t){let n=(0,$.c)(9),r;n[0]!==t.connection||n[1]!==e?(r=i2({scope:e,connection:t.connection}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i=r,a=at(i),o;n[3]===a?o=n[4]:(o=Gn(ar(a)),n[3]=a,n[4]=o);let s=Ze(i),c;return n[5]!==a||n[6]!==o||n[7]!==s?(c={result:a,review:o,refresh:s},n[5]=a,n[6]=o,n[7]=s,n[8]=c):c=n[8],c}var o2=e=>function(t){return t.className===null||t.className===void 0?(0,Q.jsx)(mw,{path:e}):(0,Q.jsx)(mw,{path:e,className:t.className})};function s2(e,t){let n=m0(e);switch(n?.kind){case`handoff`:return t?{Icon:Zf,title:t,hint:`Walkthrough of the decisions`}:{Icon:_f,title:`Changes`,hint:`All changes`};case`all-changes`:return{Icon:_f,title:`All changes`,hint:`Every changed file, including specs`};case`specs`:return{Icon:kf,title:`Specs`,hint:`Changed spec and test files`};case`proof`:return{Icon:kf,title:`Proof`,hint:`Checks and attachments the agent published`};case`change`:return{Icon:o2(n.path),title:FR(n.path),hint:`${n.path} · changes`};case`file`:return{Icon:o2(n.path),title:FR(n.path),hint:`${n.path} · file`};case`commit`:return{Icon:Uf,title:R$(n.oid),hint:`Commit ${n.oid}`};case`branch`:return{Icon:Vf,title:`Branch`,hint:`Every change on the branch`};case`branch-file`:return{Icon:o2(n.path),title:FR(n.path),hint:`${n.path} · branch`};case`graph`:return{Icon:Gf,title:`Graph`,hint:`Commit graph of the checked-out branch`};case`timeline`:return{Icon:Ap,title:`Timeline of ${FR(n.path)}`,hint:`${n.path} · timeline`};default:return{Icon:Cf,title:e,hint:e}}}function c2(e){let t=(0,$.c)(37),n,r,i,a,o,s,c,l,u;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9]):({tabs:l,pinned:o,active:r,reviewTitle:s,side:c,focused:i,leading:a,trailing:u,...n}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u);let d=c!=null&&i&&`bg-muted/40`,f;t[10]===d?f=t[11]:(f=Y(`flex h-10 shrink-0 items-center border-b`,d),t[10]=d,t[11]=f);let p;t[12]===a?p=t[13]:(p=a!=null&&(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center pl-1`,children:a}),t[12]=a,t[13]=p);let m=c==null?`Open documents`:`Open documents, ${c} pane`,h;t[14]===l.length?h=t[15]:(h=l.length===0&&(0,Q.jsx)(`span`,{className:`px-2 text-xs text-muted-foreground`,children:`No open tabs`}),t[14]=l.length,t[15]=h);let g;t[16]!==n||t[17]!==r||t[18]!==o||t[19]!==s||t[20]!==c||t[21]!==l?(g=l.map((e,t)=>{let i=o.includes(e),a=i&&!o.includes(l[t+1]??``)&&t<l.length-1;return(0,Q.jsxs)(`span`,{className:`contents`,children:[(0,Q.jsx)(l2,{tabKey:e,active:e===r,pinned:i,hasUnpinned:l.some(e=>!o.includes(e)),reviewTitle:s,side:c,...n}),a&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-4 w-px shrink-0 bg-border`})]},e)}),t[16]=n,t[17]=r,t[18]=o,t[19]=s,t[20]=c,t[21]=l,t[22]=g):g=t[22];let _;t[23]!==m||t[24]!==h||t[25]!==g?(_=(0,Q.jsx)(oL,{className:`size-full overflow-y-hidden`,children:(0,Q.jsxs)(`div`,{role:`tablist`,"aria-label":m,className:`flex h-full w-max min-w-full items-center gap-1 px-1.5`,children:[h,g]})}),t[23]=m,t[24]=h,t[25]=g,t[26]=_):_=t[26];let v;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(gL,{orientation:`horizontal`,className:`absolute inset-x-0 bottom-0 data-horizontal:h-1.5`}),t[27]=v):v=t[27];let y;t[28]===_?y=t[29]:(y=(0,Q.jsxs)(JI,{className:`relative h-full min-w-0 flex-1`,children:[_,v]}),t[28]=_,t[29]=y);let b;t[30]===u?b=t[31]:(b=u!=null&&(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-0.5 px-1.5`,children:u}),t[30]=u,t[31]=b);let x;return t[32]!==b||t[33]!==f||t[34]!==p||t[35]!==y?(x=(0,Q.jsxs)(`div`,{className:f,children:[p,y,b]}),t[32]=b,t[33]=f,t[34]=p,t[35]=y,t[36]=x):x=t[36],x}function l2(e){let t=(0,$.c)(93),{tabKey:n,active:r,pinned:i,hasUnpinned:a,reviewTitle:o,side:s,onActivate:c,onClose:l,onCloseOthers:u,onCloseUnpinned:d,onTogglePin:f,onOpenToSide:p}=e,m;t[0]!==o||t[1]!==n?(m=s2(n,o),t[0]=o,t[1]=n,t[2]=m):m=t[2];let{Icon:h,title:g,hint:_}=m,[v,y]=(0,Z.useState)(!1),b;t[3]===s?b=t[4]:(b=M0(s),t[3]=s,t[4]=b);let x=b,S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{e&&y(!1)},t[5]=S):S=t[5];let C;t[6]===r?C=t[7]:(C=e=>{r&&e?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},t[6]=r,t[7]=C);let w=i?`${_} · pinned`:_,T=r?`bg-accent text-accent-foreground`:`text-muted-foreground hover:bg-accent/50`,E;t[8]===T?E=t[9]:(E=Y(`group flex h-7 shrink-0 cursor-default items-center gap-1.5 rounded-md pr-1 pl-2 text-xs transition-colors`,T),t[8]=T,t[9]=E);let D;t[10]!==c||t[11]!==n?(D=()=>c(n),t[10]=c,t[11]=n,t[12]=D):D=t[12];let O;t[13]!==l||t[14]!==i||t[15]!==n?(O=e=>{e.button===1&&!i&&(e.preventDefault(),l(n))},t[13]=l,t[14]=i,t[15]=n,t[16]=O):O=t[16];let k;t[17]!==c||t[18]!==n?(k=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c(n))},t[17]=c,t[18]=n,t[19]=k):k=t[19];let A;t[20]!==r||t[21]!==k||t[22]!==C||t[23]!==w||t[24]!==E||t[25]!==D||t[26]!==O||t[27]!==n?(A=(0,Q.jsx)(`div`,{ref:C,role:`tab`,tabIndex:0,"aria-selected":r,title:w,"data-entry":n,className:E,onClick:D,onAuxClick:O,onKeyDown:k}),t[20]=r,t[21]=k,t[22]=C,t[23]=w,t[24]=E,t[25]=D,t[26]=O,t[27]=n,t[28]=A):A=t[28];let j;t[29]===h?j=t[30]:(j=(0,Q.jsx)(h,{className:`size-3.5 shrink-0`}),t[29]=h,t[30]=j);let M;t[31]===n?M=t[32]:(M=Y(`max-w-44 truncate pr-0.5`,n.startsWith(`file:`)&&`italic`),t[31]=n,t[32]=M);let N;t[33]!==M||t[34]!==g?(N=(0,Q.jsx)(`span`,{className:M,children:g}),t[33]=M,t[34]=g,t[35]=N):N=t[35];let P;t[36]!==r||t[37]!==l||t[38]!==f||t[39]!==i||t[40]!==n||t[41]!==g?(P=i?(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Unpin ${g}`,onClick:e=>{e.stopPropagation(),f(n)},className:`grid size-4 place-items-center rounded-sm text-muted-foreground hover:bg-foreground/10 hover:text-foreground`,children:(0,Q.jsx)(yp,{className:`size-3`})}):(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Close ${g}`,onClick:e=>{e.stopPropagation(),l(n)},className:Y(`grid size-4 place-items-center rounded-sm text-muted-foreground hover:bg-foreground/10 hover:text-foreground`,r?`opacity-100`:`opacity-0 group-hover:opacity-100 focus-visible:opacity-100`),children:(0,Q.jsx)(hl,{className:`size-3`})}),t[36]=r,t[37]=l,t[38]=f,t[39]=i,t[40]=n,t[41]=g,t[42]=P):P=t[42];let F;t[43]!==A||t[44]!==j||t[45]!==N||t[46]!==P?(F=(0,Q.jsxs)(oK,{render:A,children:[j,N,P]}),t[43]=A,t[44]=j,t[45]=N,t[46]=P,t[47]=F):F=t[47];let I=!v,L;t[48]!==f||t[49]!==n?(L=()=>f(n),t[48]=f,t[49]=n,t[50]=L):L=t[50];let R;t[51]===i?R=t[52]:(R=i?(0,Q.jsx)(xp,{}):(0,Q.jsx)(yp,{}),t[51]=i,t[52]=R);let z=i?`Unpin`:`Pin`,B;t[53]!==L||t[54]!==R||t[55]!==z?(B=(0,Q.jsxs)(cK,{onClick:L,children:[R,z]}),t[53]=L,t[54]=R,t[55]=z,t[56]=B):B=t[56];let V;t[57]!==p||t[58]!==n?(V=()=>{(0,rd.flushSync)(()=>y(!0)),p(n)},t[57]=p,t[58]=n,t[59]=V):V=t[59];let H;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(nf,{}),t[60]=H):H=t[60];let U;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(uK,{children:Hl(Il.openToSide)}),t[61]=U):U=t[61];let W;t[62]!==x||t[63]!==V?(W=(0,Q.jsxs)(cK,{onClick:V,children:[H,x,U]}),t[62]=x,t[63]=V,t[64]=W):W=t[64];let G;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(lK,{}),t[65]=G):G=t[65];let ee;t[66]!==l||t[67]!==n?(ee=()=>l(n),t[66]=l,t[67]=n,t[68]=ee):ee=t[68];let te;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(hl,{}),t[69]=te):te=t[69];let K;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(uK,{children:Hl(Il.closeTab)}),t[70]=K):K=t[70];let ne;t[71]===ee?ne=t[72]:(ne=(0,Q.jsxs)(cK,{onClick:ee,children:[te,`Close`,K]}),t[71]=ee,t[72]=ne);let q;t[73]!==u||t[74]!==n?(q=()=>u(n),t[73]=u,t[74]=n,t[75]=q):q=t[75];let re;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(Up,{}),t[76]=re):re=t[76];let ie;t[77]===q?ie=t[78]:(ie=(0,Q.jsxs)(cK,{onClick:q,children:[re,`Close others`]}),t[77]=q,t[78]=ie);let ae=!a,oe;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(rp,{}),t[79]=oe):oe=t[79];let se;t[80]!==d||t[81]!==ae?(se=(0,Q.jsxs)(cK,{disabled:ae,onClick:d,children:[oe,`Close unpinned`]}),t[80]=d,t[81]=ae,t[82]=se):se=t[82];let ce;t[83]!==I||t[84]!==B||t[85]!==W||t[86]!==ne||t[87]!==ie||t[88]!==se?(ce=(0,Q.jsxs)(sK,{className:`min-w-52`,finalFocus:I,children:[B,W,G,ne,ie,se]}),t[83]=I,t[84]=B,t[85]=W,t[86]=ne,t[87]=ie,t[88]=se,t[89]=ce):ce=t[89];let le;return t[90]!==F||t[91]!==ce?(le=(0,Q.jsxs)(aK,{onOpenChange:S,children:[F,ce]}),t[90]=F,t[91]=ce,t[92]=le):le=t[92],le}function u2(e){let t=[],n=[],r=()=>{let e=t.indexOf(null);return e===-1?(t.push(null),t.length-1):e};for(let i of e){let e=t.flatMap((e,t)=>e===i.oid?[t]:[]);for(let n of e)t[n]=null;let a=e.length>0?Math.min(...e):r(),o=i.parentOids.map((e,n)=>{let i=t.indexOf(e),o=n===0?a:i===-1?r():i;return t[o]=e,o});n.push({commit:i,lane:a,outgoing:o,lanesAfter:[...t]})}return n}function d2(e){let t=e.flatMap(e=>[e.lane,...e.outgoing,...e.lanesAfter.flatMap((e,t)=>e==null?[]:[t])]);return 26+Math.max(0,...t)*16}function f2(e){let t=e%100;return`${e}${t>=11&&t<=13?`th`:[`th`,`st`,`nd`,`rd`][e%10]??`th`}`}function p2(e){let t=e.findLastIndex(e=>e.restarted),n=t===-1?e:e.slice(t),r=n.at(-1);return{snapshot:n[0]?.snapshot??null,commits:n.flatMap(e=>e.commits),nextAfter:r?.nextAfter??null,boundary:r?.boundary??null,restarted:r?.restarted??!1}}var m2=It(({connection:e,scope:t})=>g(e,t,[`history`],se(void 0,n=>he(function*(){let r=yield*(yield*fi(e)).request(e=>e.changes.listCommits({params:{worktreeId:t.worktreeId},query:{after:n?.after,tip:n?.tip}}));return yield*Pt(e),[[r],r.nextAfter&&r.tip?Fi({after:r.nextAfter,tip:r.tip}):en()]})),On(e))),h2=It(({connection:e,scope:t,oid:n,parent:r=1})=>Ei(e,t,[`commit`,n,r],he(function*(){let i=yield*(yield*fi(e)).request(e=>e.changes.readCommitFiles({params:{worktreeId:t.worktreeId,oid:n},query:r===1?{}:{parent:r}}));return yield*Pt(e,i.commit.oid===n&&(i.comparison.kind===`empty-tree`||i.comparison.parentNumber===r)),i}),On(e))),g2=It(({connection:e,scope:t,path:n})=>Ei(e,t,[`history`,`file`,n],he(function*(){return yield*(yield*fi(e)).request(e=>e.changes.listFileCommits({params:{worktreeId:t.worktreeId},query:{path:n,limit:100}}))}),On(e))),_2=It(e=>Yr(m2(e),e=>ur(e,e=>p2(e.items))).pipe(cn(0)));function v2(e,t,n,r){let i=(0,$.c)(5),a=r===void 0?1:r,o;return i[0]!==e||i[1]!==n||i[2]!==a||i[3]!==t?(o=h2({connection:e,scope:t,oid:n,parent:a}),i[0]=e,i[1]=n,i[2]=a,i[3]=t,i[4]=o):o=i[4],$l(o).value}function y2(e,t){let n=(0,$.c)(12),r;n[0]!==e||n[1]!==t?(r=m2({connection:e,scope:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a;n[3]!==e||n[4]!==t?(a=_2({connection:e,scope:t}),n[3]=e,n[4]=t,n[5]=a):a=n[5];let{result:o,value:s}=$l(a),c=y(i),l;n[6]===c?l=n[7]:(l=()=>c(void 0),n[6]=c,n[7]=l);let u;return n[8]!==o||n[9]!==l||n[10]!==s?(u={...s,result:o,readMore:l},n[8]=o,n[9]=l,n[10]=s,n[11]=u):u=n[11],u}function b2(e){let t=(0,$.c)(5),[n,r]=(0,Z.useState)(1),i;t[0]===e?i=t[1]:(i=function(t){if(!t)return;let n=t.querySelector(`[data-ref-measurement]`);if(!n)return;let i=()=>{let i=Array.from(n.children,S2),a=i.pop()??0,o=Number.parseFloat(getComputedStyle(t).columnGap),s=t.getBoundingClientRect().width;if(i.reduce(x2,0)+Math.max(0,i.length-1)*o<=s){r(e.length);return}let c=0,l=0;for(let t of i){c+=t+(l===0?0:o);let n=l+1===e.length?0:o+a;if(c+n>s)break;l+=1}r(Math.max(1,l))},a=new ResizeObserver(i);return a.observe(t),a.observe(n),i(),()=>a.disconnect()},t[0]=e,t[1]=i);let a=i,o;return t[2]!==a||t[3]!==n?(o={row:a,visibleCount:n},t[2]=a,t[3]=n,t[4]=o):o=t[4],o}function x2(e,t){return e+t}function S2(e){return e.getBoundingClientRect().width}var C2=`h-4 min-w-0 max-w-40`;function w2(e){let t=(0,$.c)(18),{refs:n,onOpenCommit:r}=e,{row:i,visibleCount:a}=b2(n),o;if(t[0]!==r||t[1]!==n||t[2]!==i||t[3]!==a){let e=n.slice(a),s;t[5]===n?s=t[6]:(s=n.map(E2),t[5]=n,t[6]=s);let c;t[7]===n.length?c=t[8]:(c=(0,Q.jsxs)(os,{variant:`secondary`,className:`h-4`,children:[`+`,n.length]}),t[7]=n.length,t[8]=c);let l;t[9]!==s||t[10]!==c?(l=(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none invisible absolute inset-0 overflow-hidden`,children:(0,Q.jsxs)(`div`,{"data-ref-measurement":!0,className:`flex w-max gap-1`,children:[s,c]})}),t[9]=s,t[10]=c,t[11]=l):l=t[11];let u;if(t[12]!==r||t[13]!==n||t[14]!==a){let e;t[16]===r?e=t[17]:(e=e=>(0,Q.jsxs)(xm,{children:[(0,Q.jsx)(Sm,{render:(0,Q.jsx)(os,{render:(0,Q.jsx)(`button`,{type:`button`,onClick:r}),variant:`secondary`,className:`${C2} pointer-events-auto shrink`}),children:(0,Q.jsx)(`span`,{className:`truncate`,children:z$(e)})}),(0,Q.jsx)(Cm,{className:`break-all`,children:e})]},e),t[16]=r,t[17]=e),u=n.slice(0,a).map(e),t[12]=r,t[13]=n,t[14]=a,t[15]=u}else u=t[15];o=(0,Q.jsxs)(`div`,{ref:i,className:`pointer-events-none relative flex min-w-0 items-center gap-1`,children:[l,u,e.length>0&&(0,Q.jsxs)(x$,{children:[(0,Q.jsxs)(S$,{render:(0,Q.jsx)(os,{render:(0,Q.jsx)(`button`,{type:`button`}),variant:`secondary`,className:`pointer-events-auto h-4 hover:bg-accent`,"aria-label":`Show ${e.length} more ${e.length===1?`ref`:`refs`}`}),children:[`+`,e.length]}),(0,Q.jsxs)(C$,{align:`start`,className:`max-w-[calc(100vw-2rem)]`,children:[(0,Q.jsx)(T$,{children:`More refs`}),(0,Q.jsx)(`ul`,{className:`max-h-64 overflow-y-auto text-xs`,children:e.map(T2)})]})]})]}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o}else o=t[4];return o}function T2(e){return(0,Q.jsx)(`li`,{className:`py-1 break-all`,children:e},e)}function E2(e){return(0,Q.jsx)(os,{variant:`secondary`,className:C2,children:(0,Q.jsx)(`span`,{"data-label":z$(e),className:`truncate before:content-[attr(data-label)]`})},e)}function D2(e){let t=(0,$.c)(69),{commit:n,selected:r,height:i,inset:a,onSelect:o,openToSide:s,children:c}=e,[l,u]=(0,Z.useState)(!1),d;t[0]!==o||t[1]!==s?(d=e=>o(s!==void 0&&e.altKey),t[0]=o,t[1]=s,t[2]=d):d=t[2];let f=d,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e&&u(!1)},t[3]=p):p=t[3];let m;t[4]!==i||t[5]!==a?(m={height:i,paddingLeft:a},t[4]=i,t[5]=a,t[6]=m):m=t[6];let h=i===void 0&&`py-1.5`,g=r&&`bg-accent`,_;t[7]!==h||t[8]!==g?(_=Y(`relative flex w-full flex-col justify-center gap-0.5 rounded-lg px-2 text-left transition-colors hover:bg-accent`,h,g),t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]!==m||t[11]!==_?(v=(0,Q.jsx)(`div`,{style:m,className:_}),t[10]=m,t[11]=_,t[12]=v):v=t[12];let y=n.subject,b;t[13]===n.parentOids.length?b=t[14]:(b=n.parentOids.length>1&&(0,Q.jsx)(qf,{"aria-label":`Merge commit`,className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=n.parentOids.length,t[14]=b);let x;t[15]===n.subject?x=t[16]:(x=(0,Q.jsx)(`span`,{className:`truncate`,children:n.subject}),t[15]=n.subject,t[16]=x);let S;t[17]!==x||t[18]!==b?(S=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-caption leading-tight`,children:[b,x]}),t[17]=x,t[18]=b,t[19]=S):S=t[19];let C;t[20]===n.oid?C=t[21]:(C=R$(n.oid),t[20]=n.oid,t[21]=C);let w;t[22]===C?w=t[23]:(w=(0,Q.jsx)(`code`,{className:`font-mono`,children:C}),t[22]=C,t[23]=w);let T;t[24]===n.author.name?T=t[25]:(T=(0,Q.jsx)(`span`,{className:`truncate`,children:n.author.name}),t[24]=n.author.name,t[25]=T);let E;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t[26]=E):E=t[26];let D;t[27]===n.author.timestamp?D=t[28]:(D=Uo(n.author.timestamp),t[27]=n.author.timestamp,t[28]=D);let O;t[29]===D?O=t[30]:(O=(0,Q.jsx)(`span`,{className:`shrink-0`,children:D}),t[29]=D,t[30]=O);let k;t[31]!==w||t[32]!==T||t[33]!==O?(k=(0,Q.jsxs)(`span`,{className:`flex gap-1.5 text-2xs text-muted-foreground`,children:[w,T,E,O]}),t[31]=w,t[32]=T,t[33]=O,t[34]=k):k=t[34];let A;t[35]!==c||t[36]!==n.subject||t[37]!==f||t[38]!==r||t[39]!==S||t[40]!==k?(A=(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":r,title:y,onClick:f,className:`flex w-full min-w-0 flex-col gap-0.5 text-left before:absolute before:inset-0 before:rounded-lg`,children:[S,k,c]}),t[35]=c,t[36]=n.subject,t[37]=f,t[38]=r,t[39]=S,t[40]=k,t[41]=A):A=t[41];let j;t[42]!==n.refs||t[43]!==f?(j=n.refs.length>0&&(0,Q.jsx)(w2,{refs:n.refs,onOpenCommit:f}),t[42]=n.refs,t[43]=f,t[44]=j):j=t[44];let M;t[45]!==A||t[46]!==j||t[47]!==v?(M=(0,Q.jsxs)(oK,{render:v,children:[A,j]}),t[45]=A,t[46]=j,t[47]=v,t[48]=M):M=t[48];let N=!l,P;t[49]===s?P=t[50]:(P=s&&(0,Q.jsxs)(cK,{onClick:()=>{(0,rd.flushSync)(()=>u(!0)),s.open()},children:[(0,Q.jsx)(nf,{}),s.label]}),t[49]=s,t[50]=P);let F;t[51]===n.oid?F=t[52]:(F=()=>At(n.oid,`commit id`),t[51]=n.oid,t[52]=F);let I;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(Qi,{}),t[53]=I):I=t[53];let L;t[54]===F?L=t[55]:(L=(0,Q.jsxs)(cK,{onClick:F,children:[I,`Copy commit id`]}),t[54]=F,t[55]=L);let R;t[56]===n?R=t[57]:(R=()=>At(P$(n),`commit message`),t[56]=n,t[57]=R);let z;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(Qi,{}),t[58]=z):z=t[58];let B;t[59]===R?B=t[60]:(B=(0,Q.jsxs)(cK,{onClick:R,children:[z,`Copy message`]}),t[59]=R,t[60]=B);let V;t[61]!==N||t[62]!==P||t[63]!==L||t[64]!==B?(V=(0,Q.jsxs)(sK,{finalFocus:N,children:[P,L,B]}),t[61]=N,t[62]=P,t[63]=L,t[64]=B,t[65]=V):V=t[65];let H;return t[66]!==M||t[67]!==V?(H=(0,Q.jsxs)(aK,{onOpenChange:p,children:[M,V]}),t[66]=M,t[67]=V,t[68]=H):H=t[68],H}var O2=[`text-graph-1`,`text-graph-2`,`text-graph-3`,`text-graph-4`,`text-graph-5`,`text-graph-6`],k2=e=>13+e*16,A2=e=>O2[e%O2.length]??O2[0];function j2(e){let t=(0,$.c)(6),{rows:n,width:r}=e,i=n.length*58,a;t[0]===n?a=t[1]:(a=n.map((e,t)=>{let r=t*58+29,i=n[t+1],a=e.lanesAfter.flatMap((t,n)=>t==null||i==null?[]:[{lane:n,startX:e.outgoing.includes(n)?k2(e.lane):k2(n),endX:t===i.commit.oid?k2(i.lane):k2(n)}]),o=e.commit.parentOids.length>1;return(0,Q.jsxs)(`g`,{children:[a.map(e=>{let{lane:t,startX:n,endX:i}=e;return(0,Q.jsx)(`path`,{d:n===i?`M ${n} ${r} L ${i} ${r+58}`:`M ${n} ${r} C ${n} ${r+29}, ${i} ${r+29}, ${i} ${r+58}`,fill:`none`,stroke:`currentColor`,strokeWidth:xt,className:A2(t)},t)}),(0,Q.jsx)(`circle`,{cx:k2(e.lane),cy:r,r:o?5:4,fill:o?`var(--card)`:`currentColor`,stroke:`currentColor`,strokeWidth:2,className:A2(e.lane)})]},e.commit.oid)}),t[0]=n,t[1]=a);let o;return t[2]!==i||t[3]!==a||t[4]!==r?(o=(0,Q.jsx)(`svg`,{"aria-hidden":`true`,className:`pointer-events-none absolute top-2 left-1.5`,"data-testid":`history-graph`,width:r,height:i,children:a}),t[2]=i,t[3]=a,t[4]=r,t[5]=o):o=t[5],o}function M2(e){let t=(0,$.c)(3),{enabled:n,onVisible:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`h-px`,ref:e=>{if(!e||!n||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{let[t]=e;t?.isIntersecting&&r()},{rootMargin:`0px 0px 240px 0px`});return t.observe(e),()=>t.disconnect()}}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function N2(e){let t=(0,$.c)(14),{commits:n,history:r,selected:i,onSelect:a,sideLabel:o}=e,s;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==o){let e;t[5]!==a||t[6]!==i||t[7]!==o?(e=e=>(0,Q.jsx)(D2,{commit:e,selected:i===e.oid,onSelect:t=>a(e.oid,t),openToSide:{label:o,open:()=>a(e.oid,!0)}},e.oid),t[5]=a,t[6]=i,t[7]=o,t[8]=e):e=t[8],s=n.map(e),t[0]=n,t[1]=a,t[2]=i,t[3]=o,t[4]=s}else s=t[4];let c;t[9]===r?c=t[10]:(c=(0,Q.jsx)(P2,{history:r}),t[9]=r,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,Q.jsxs)(`div`,{className:`py-2 pr-3 pl-1.5`,children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function P2(e){let t=(0,$.c)(11),{history:n}=e,r;t[0]===n?r=t[1]:(r=(0,Q.jsx)(F2,{history:n}),t[0]=n,t[1]=r);let i;t[2]!==n.nextAfter||t[3]!==n.result?(i=n.nextAfter!==null&&n.nextAfter!==void 0&&!n.result.waiting&&!st(n.result),t[2]=n.nextAfter,t[3]=n.result,t[4]=i):i=t[4];let a;t[5]!==n.readMore||t[6]!==i?(a=(0,Q.jsx)(M2,{enabled:i,onVisible:n.readMore}),t[5]=n.readMore,t[6]=i,t[7]=a):a=t[7];let o;return t[8]!==r||t[9]!==a?(o=(0,Q.jsxs)(Q.Fragment,{children:[r,a]}),t[8]=r,t[9]=a,t[10]=o):o=t[10],o}function F2(e){let t=(0,$.c)(8),{history:n}=e;if(n.result.waiting){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 px-2 py-3 text-2xs text-muted-foreground`,children:[(0,Q.jsx)(Ko,{className:`size-3.5`}),`Loading older commits…`]}),t[0]=e):e=t[0],e}if(st(n.result)){let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`span`,{children:`Couldn't load older commits`}),t[1]=e):e=t[1];let r;return t[2]===n.readMore?r=t[3]:(r=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-2 text-2xs text-muted-foreground`,children:[e,(0,Q.jsx)(X,{size:`xs`,variant:`outline`,onClick:n.readMore,children:`Retry`})]}),t[2]=n.readMore,t[3]=r),r}if(n.nextAfter===null||n.nextAfter===void 0){let e;t[4]===n.boundary?e=t[5]:(e=V$(n.boundary),t[4]=n.boundary,t[5]=e);let r;return t[6]===e?r=t[7]:(r=(0,Q.jsx)(`p`,{className:`px-2 py-3 text-2xs text-muted-foreground`,children:e}),t[6]=e,t[7]=r),r}return null}function I2(e){let t=(0,$.c)(14),{scope:n,connection:r,selected:i,onSelect:a,sideLabel:o,onOpenGraph:s}=e,c=y2(r,n),l;t[0]!==c.commits.length||t[1]!==s?(l=c.commits.length>0?(0,Q.jsxs)(X,{size:`xs`,variant:`ghost`,onClick:s,children:[(0,Q.jsx)(Gf,{}),`Open graph`]}):void 0,t[0]=c.commits.length,t[1]=s,t[2]=l):l=t[2];let u;t[3]!==c||t[4]!==l?(u=(0,Q.jsx)(L2,{history:c,action:l}),t[3]=c,t[4]=l,t[5]=u):u=t[5];let d;t[6]!==c||t[7]!==a||t[8]!==i||t[9]!==o?(d=(0,Q.jsx)(hL,{className:`h-0 min-h-0 flex-1`,children:c.commits.length===0?(0,Q.jsx)(R2,{}):(0,Q.jsx)(N2,{commits:c.commits,history:c,selected:i,onSelect:a,sideLabel:o})}),t[6]=c,t[7]=a,t[8]=i,t[9]=o,t[10]=d):d=t[10];let f;return t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function L2(e){let t=(0,$.c)(8),{history:n,action:r}=e,i;t[0]!==r||t[1]!==n.snapshot?(i=(n.snapshot!==null&&n.snapshot!==void 0||r!==void 0)&&(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-b py-1.5 pr-1.5 pl-3.5 text-2xs text-muted-foreground`,children:[(0,Q.jsx)(Vf,{className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:B$(n.snapshot)}),r]}),t[0]=r,t[1]=n.snapshot,t[2]=i):i=t[2];let a;t[3]===n.restarted?a=t[4]:(a=n.restarted&&(0,Q.jsx)(`p`,{role:`status`,className:`shrink-0 border-b bg-muted/40 px-3.5 py-2 text-2xs text-muted-foreground`,children:`History changed. Showing it from the top.`}),t[3]=n.restarted,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,Q.jsxs)(Q.Fragment,{children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function R2(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(ms,{children:(0,Q.jsxs)(Oo,{children:[(0,Q.jsx)(Fs,{children:`No commits yet`}),(0,Q.jsx)(Os,{children:`Commits will appear here once this worktree has history.`})]})}),e[0]=t):t=e[0],t}function z2(e){let t=(0,$.c)(14),{scope:n,connection:r,onSelect:i,sideLabel:a}=e,o=y2(r,n),s,c;t[0]===o.commits?(s=t[1],c=t[2]):(s=u2(o.commits),c=d2(s),t[0]=o.commits,t[1]=s,t[2]=c);let l=c,u;t[3]===o?u=t[4]:(u=(0,Q.jsx)(L2,{history:o}),t[3]=o,t[4]=u);let d;t[5]!==o||t[6]!==i||t[7]!==s||t[8]!==a||t[9]!==l?(d=s.length===0?(0,Q.jsx)(R2,{}):(0,Q.jsxs)(`div`,{className:`relative px-1.5 py-2`,children:[(0,Q.jsx)(j2,{rows:s,width:l}),(0,Q.jsx)(`ol`,{"aria-label":`Commit graph`,className:`flex flex-col`,children:s.map(e=>{let{commit:t}=e;return(0,Q.jsx)(`li`,{children:(0,Q.jsx)(D2,{commit:t,selected:!1,height:58,inset:l+8,onSelect:e=>i(t.oid,e),openToSide:{label:a,open:()=>i(t.oid,!0)}})},t.oid)})}),(0,Q.jsx)(`div`,{style:{paddingLeft:l},children:(0,Q.jsx)(P2,{history:o})})]}),t[5]=o,t[6]=i,t[7]=s,t[8]=a,t[9]=l,t[10]=d):d=t[10];let f;return t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function B2(e,t,n){let r=(0,$.c)(4),i;return r[0]!==e||r[1]!==n||r[2]!==t?(i=g2({connection:e,scope:t,path:n}),r[0]=e,r[1]=n,r[2]=t,r[3]=i):i=r[3],$l(i).value}function V2(e){let t=(0,$.c)(19),{scope:n,connection:r,path:i,onSelect:a,sideLabel:o}=e,s=B2(r,n,i);if(s.commits.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(ms,{children:(0,Q.jsxs)(Oo,{children:[(0,Q.jsx)(Fs,{children:`No commits touch this file`}),(0,Q.jsx)(Os,{children:`Its timeline starts with the first commit that includes it.`})]})}),t[0]=e):e=t[0],e}let c=`Timeline of ${i}`,l;if(t[1]!==a||t[2]!==i||t[3]!==o||t[4]!==s.commits){let e;t[6]!==a||t[7]!==i||t[8]!==o?(e=e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(D2,{commit:e.commit,selected:!1,onSelect:t=>a({oid:e.commit.oid,path:e.path},t),openToSide:{label:o,open:()=>a({oid:e.commit.oid,path:e.path},!0)},children:(0,Q.jsx)(`span`,{className:`truncate text-2xs text-muted-foreground`,children:N$(e,i)})})},e.commit.oid),t[6]=a,t[7]=i,t[8]=o,t[9]=e):e=t[9],l=s.commits.map(e),t[1]=a,t[2]=i,t[3]=o,t[4]=s.commits,t[5]=l}else l=t[5];let u=s.more?`Showing the latest ${s.commits.length} commits.`:`Start of this file’s history.`,d;t[10]===u?d=t[11]:(d=(0,Q.jsx)(`span`,{children:u}),t[10]=u,t[11]=d);let f;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`span`,{children:`A merge appears only when its own result changed the file.`}),t[12]=f):f=t[12];let p;t[13]===d?p=t[14]:(p=(0,Q.jsxs)(`li`,{className:`flex flex-col gap-1 px-2 py-3 text-2xs text-muted-foreground`,children:[d,f]}),t[13]=d,t[14]=p);let m;return t[15]!==c||t[16]!==l||t[17]!==p?(m=(0,Q.jsxs)(`ol`,{"aria-label":c,className:`flex flex-col p-2`,children:[l,p]}),t[15]=c,t[16]=l,t[17]=p,t[18]=m):m=t[18],m}function H2(e,t,n){let r=(0,$.c)(4),i=n===void 0?zR:n,a;return r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=eB({scope:e,connection:t.connection,range:i}),r[0]=t.connection,r[1]=i,r[2]=e,r[3]=a):a=r[3],$l(a).value}function U2(e,t,n){let r=(0,$.c)(4),i=n===void 0?zR:n,a;r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=eB({scope:e,connection:t.connection,range:i}),r[0]=t.connection,r[1]=i,r[2]=e,r[3]=a):a=r[3],tn(a)}function W2(e,t,n,r){let i=(0,$.c)(4),a=H2(e,t),o;return i[0]!==n||i[1]!==r||i[2]!==a?(o=jR(n,a,r),i[0]=n,i[1]=r,i[2]=a,i[3]=o):o=i[3],o}function G2(e,t,n){(e[t]??=[]).push(n)}function K2(e,t){let n={};return e.steps.forEach((r,i)=>{switch(r.location.state){case`committed`:case`broken`:return}let a=`${i+1}`;G2(n,r.pointer.path,{title:t===void 0?r.title:`${t}. ${e.title} · ${r.title}`,text:r.text,line:r.location.state===`current`?r.location.endLine:r.pointer.endLine,stale:r.location.state===`changed`,marker:t===void 0?a:`${t}.${a}`,tone:`agent`})}),n}function q2(e){let t={};for(let n of e)for(let e of n.ranges)G2(t,n.path,{title:`Not explained`,text:`${GP([e])} changed without an explanation from the agent.`,line:e.endLine,stale:!1,tone:`gap`});return t}function J2(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n))for(let n of r)G2(t,e,n);return t}function Y2(e,t,n,r){return{id:e,kind:`file`,path:t,contents:n,version:hc(n),...r?{note:r}:{}}}var X2=new Map,Z2=new Map;function Q2(e){if(e.kind===`diff`){let t=X2.get(e.id);return t?.cacheKey!==void 0&&t.cacheKey===e.fileDiff.cacheKey?{type:`diff`,fileDiff:t}:(X2.set(e.id,e.fileDiff),{type:`diff`,fileDiff:e.fileDiff})}let t=Z2.get(e.id);if(t?.name===e.path&&t.contents===e.contents)return{type:`file`,file:t};let n={name:e.path,contents:e.contents};return Z2.set(e.id,n),{type:`file`,file:n}}function $2(e,t,n){let r=(0,$.c)(9),i=n===void 0?zR:n,a;r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=Jz({scope:e,connection:t.connection,range:i}),r[0]=t.connection,r[1]=i,r[2]=e,r[3]=a):a=r[3];let o=a.set,s;r[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={mode:`promiseExit`},r[4]=s):s=r[4];let[c,l]=Vi(o,s),u=y(o),d;return r[5]!==c||r[6]!==l||r[7]!==u?(d={result:c,submit:l,start:u},r[5]=c,r[6]=l,r[7]=u,r[8]=d):d=r[8],d}function e4(e,t,n){let r=(0,$.c)(9),i=n===void 0?zR:n,a;r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=Jz({scope:e,connection:t.connection,range:i}),r[0]=t.connection,r[1]=i,r[2]=e,r[3]=a):a=r[3];let o=a.remove,s;r[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={mode:`promiseExit`},r[4]=s):s=r[4];let[c,l]=Vi(o,s),u=y(o),d;return r[5]!==c||r[6]!==l||r[7]!==u?(d={result:c,submit:l,start:u},r[5]=c,r[6]=l,r[7]=u,r[8]=d):d=r[8],d}function t4(e,t,n){let r=(0,$.c)(10),i=n===void 0?zR:n,a;r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=Jz({scope:e,connection:t.connection,range:i}),r[0]=t.connection,r[1]=i,r[2]=e,r[3]=a):a=r[3];let[o,s]=Vi(a.bulk),c;r[4]===o?c=r[5]:(c=Gn(ar(o)),r[4]=o,r[5]=c);let l=c,u=!o.waiting&&l?.kind===`mark`?l.report:null,d;return r[6]!==o||r[7]!==s||r[8]!==u?(d={result:o,report:u,start:s},r[6]=o,r[7]=s,r[8]=u,r[9]=d):d=r[9],d}function n4(e,t,n,r){let i=(0,$.c)(4),a=r===void 0?zR:r,o=$2(e,t,a),s=e4(e,t,a),c;return i[0]!==o||i[1]!==n||i[2]!==s?(c={toggle(e){let t=QR(e,o.result.waiting||s.result.waiting);t&&(t.kind===`unmark`?s.submit(t.path):o.submit(t.input)).then(e=>{Cn(e)&&n({title:`Could not update review`,description:NR(nt(e.cause)),type:`error`})})}},i[0]=o,i[1]=n,i[2]=s,i[3]=c):c=i[3],c}function r4(e,t){let n=(0,$.c)(6),r;n[0]!==t.connection||n[1]!==e?(r=e.review?bV({reviewId:e.review.reviewId,connection:t.connection}):uV({scope:e,connection:t.connection}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let{result:i,value:a}=$l(r),o;return n[3]!==i||n[4]!==a?(o={threads:a,result:i},n[3]=i,n[4]=a,n[5]=o):o=n[5],o}function i4(e,t){let n=(0,$.c)(3),r;n[0]!==t.connection||n[1]!==e?(r=e.review?bV({reviewId:e.review.reviewId,connection:t.connection}):uV({scope:e,connection:t.connection}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2],tn(r)}function a4(e){let t=(0,$.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={mode:`promiseExit`},t[0]=n):n=t[0];let r=Vi(e,n),i;return t[1]===r?i=t[2]:(i=mV(r),t[1]=r,t[2]=i),i}function o4(e,t,n){let r=(0,$.c)(5),i=(0,Z.useId)(),a;r[0]!==t.connection||r[1]!==n||r[2]!==i||r[3]!==e?(a=pV({connection:t.connection,scope:e,owner:i,filter:n}),r[0]=t.connection,r[1]=n,r[2]=i,r[3]=e,r[4]=a):a=r[4],tn(a)}function s4(e,t){let n=(0,$.c)(5),r;n[0]!==t.connection||n[1]!==e?(r=e.review?EV({reviewId:e.review.reviewId,connection:t.connection}).createComment:fV({scope:e,connection:t.connection}).create,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i=a4(r),a;return n[3]===i?a=n[4]:(a={...i,bodyLimit:ee},n[3]=i,n[4]=a),a}function c4(e,t){let n=(0,$.c)(5),r;n[0]!==t.connection||n[1]!==e?(r=e.review?EV({reviewId:e.review.reviewId,connection:t.connection}).reply:fV({scope:e,connection:t.connection}).reply,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i=a4(r),a;return n[3]===i?a=n[4]:(a={...i,bodyLimit:ee},n[3]=i,n[4]=a),a}function l4(e,t){let n=(0,$.c)(3),r;return n[0]!==t.connection||n[1]!==e?(r=e.review?EV({reviewId:e.review.reviewId,connection:t.connection}).resolve:fV({scope:e,connection:t.connection}).resolve,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2],a4(r)}function u4(e,t){let n=(0,$.c)(5),r;n[0]!==t.connection||n[1]!==e?(r=e.review?EV({reviewId:e.review.reviewId,connection:t.connection}).edit:fV({scope:e,connection:t.connection}).edit,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i=a4(r),a;return n[3]===i?a=n[4]:(a={...i,bodyLimit:ee},n[3]=i,n[4]=a),a}function d4(e,t){let n=(0,$.c)(3),r;return n[0]!==t.connection||n[1]!==e?(r=e.review?EV({reviewId:e.review.reviewId,connection:t.connection}).deleteComment:fV({scope:e,connection:t.connection}).remove,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2],a4(r)}function f4(e,t){let n=(0,$.c)(9),r;n[0]!==t.connection||n[1]!==e?(r=fV({scope:e,connection:t.connection}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let[i,a]=Vi(r.removeResolved),o;n[3]===a?o=n[4]:(o=()=>a(Mt),n[3]=a,n[4]=o);let s;return n[5]!==i||n[6]!==a||n[7]!==o?(s={result:i,send:a,reset:o},n[5]=i,n[6]=a,n[7]=o,n[8]=s):s=n[8],s}function p4(e){let t=(0,$.c)(57),{scope:n,context:r,anchor:i,onClose:a}=e,o=(0,Z.useId)(),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(void 0),d;t[0]===i?d=t[1]:(d=JSON.stringify(i),t[0]=i,t[1]=d);let f=d,p=s4(n,r),m;t[2]===s?m=t[3]:(m=hR(s),t[2]=s,t[3]=m);let h=m,g;t[4]!==i||t[5]!==f||t[6]!==s||t[7]!==p||t[8]!==a||t[9]!==l||t[10]!==n||t[11]!==h?(g=()=>{if(!h||p.result.waiting)return;let e=gR(l?.anchor===f?l:void 0,s,()=>({body:s,anchor:f,threadId:crypto.randomUUID(),messageId:crypto.randomUUID()}));u(e),p.send({anchor:i,body:s,threadId:e.threadId,messageId:e.messageId,...n.review?{reviewRevision:n.review.revision}:{}},()=>{u(void 0),a()})},t[4]=i,t[5]=f,t[6]=s,t[7]=p,t[8]=a,t[9]=l,t[10]=n,t[11]=h,t[12]=g):g=t[12];let _=g,v;t[13]===_?v=t[14]:(v=e=>{e.preventDefault(),_()},t[13]=_,t[14]=v);let y;t[15]===i?y=t[16]:(y=cR(i),t[15]=i,t[16]=y);let b;t[17]===i?b=t[18]:(b=uR(i),t[17]=i,t[18]=b);let x;t[19]!==i.kind||t[20]!==i.revision?(x=i.kind===`change`&&i.revision!==null&&i.revision!==void 0?`at ${R$(i.revision)}`:void 0,t[19]=i.kind,t[20]=i.revision,t[21]=x):x=t[21];let S;t[22]!==y||t[23]!==b||t[24]!==x?(S=[y,b,x].filter(m4),t[22]=y,t[23]=b,t[24]=x,t[25]=S):S=t[25];let C=S.join(` · `),w;t[26]!==o||t[27]!==C?(w=(0,Q.jsx)(`label`,{htmlFor:o,className:`text-xs text-muted-foreground`,children:C}),t[26]=o,t[27]=C,t[28]=w):w=t[28];let T;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{u(void 0),c(e.target.value)},t[29]=T):T=t[29];let E;t[30]!==p.result.waiting||t[31]!==a||t[32]!==_?(E=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),_()),e.key===`Escape`&&!p.result.waiting&&(e.stopPropagation(),a())},t[30]=p.result.waiting,t[31]=a,t[32]=_,t[33]=E):E=t[33];let D;t[34]!==s||t[35]!==o||t[36]!==p.bodyLimit||t[37]!==p.result.waiting||t[38]!==E?(D=(0,Q.jsx)(cH,{id:o,autoFocus:!0,"aria-label":`Comment`,placeholder:`Share feedback…`,value:s,maxLength:p.bodyLimit,disabled:p.result.waiting,onChange:T,onKeyDown:E}),t[34]=s,t[35]=o,t[36]=p.bodyLimit,t[37]=p.result.waiting,t[38]=E,t[39]=D):D=t[39];let O;t[40]===p.result?O=t[41]:(O=st(p.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:NR(nt(p.result.cause))}),t[40]=p.result,t[41]=O);let k;t[42]!==p.result.waiting||t[43]!==a?(k=(0,Q.jsx)(X,{type:`button`,size:`sm`,variant:`ghost`,disabled:p.result.waiting,onClick:a,children:`Cancel`}),t[42]=p.result.waiting,t[43]=a,t[44]=k):k=t[44];let A=!h||p.result.waiting,j=p.result.waiting?`Posting…`:`Comment`,M;t[45]!==A||t[46]!==j?(M=(0,Q.jsx)(X,{type:`submit`,size:`sm`,disabled:A,children:j}),t[45]=A,t[46]=j,t[47]=M):M=t[47];let N;t[48]!==k||t[49]!==M?(N=(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[k,M]}),t[48]=k,t[49]=M,t[50]=N):N=t[50];let P;return t[51]!==w||t[52]!==D||t[53]!==O||t[54]!==N||t[55]!==v?(P=(0,Q.jsxs)(`form`,{className:`m-3 flex flex-col gap-2 rounded-lg border bg-card p-3 font-sans`,onSubmit:v,children:[w,D,O,N]}),t[51]=w,t[52]=D,t[53]=O,t[54]=N,t[55]=v,t[56]=P):P=t[56],P}function m4(e){return e!=null}function h4(e){let t=(0,$.c)(28),{title:n,text:r,stale:i,marker:a,tone:o}=e,s=i!==void 0&&i,c=(o===void 0?`agent`:o)===`gap`,l;t[0]===r?l=t[1]:(l=(0,Q.jsx)(Dj,{text:r,className:`text-sm`}),t[0]=r,t[1]=l);let u=l,d=`${c?`Not explained`:`Agent note`}${n?` · ${n}`:``}`,f=c&&`border-graph-4/40 bg-graph-4/5`,p;t[2]===f?p=t[3]:(p=Y(`m-3 flex max-w-3xl gap-2.5 rounded-lg border bg-background px-3 py-2.5 font-sans shadow-xs`,f),t[2]=f,t[3]=p);let m=c&&`bg-graph-4/15 text-graph-4`,h;t[4]===m?h=t[5]:(h=Y(`mt-px grid h-5 min-w-5 shrink-0 place-items-center rounded-full bg-graph-1/12 px-1 text-2xs font-semibold text-graph-1 tabular-nums`,m),t[4]=m,t[5]=h);let g;t[6]!==c||t[7]!==a?(g=c?(0,Q.jsx)(Jc,{className:`size-3`}):a??`•`,t[6]=c,t[7]=a,t[8]=g):g=t[8];let _;t[9]!==h||t[10]!==g?(_=(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:h,children:g}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===n?v=t[13]:(v=n&&(0,Q.jsx)(`p`,{className:`text-caption font-medium`,children:n}),t[12]=n,t[13]=v);let y;t[14]===s?y=t[15]:(y=s&&(0,Q.jsx)(`p`,{role:`status`,className:`text-caption text-graph-4`,children:`Code changed since the review was written.`}),t[14]=s,t[15]=y);let b;t[16]!==u||t[17]!==r.length?(b=r.length>360?(0,Q.jsxs)(`details`,{className:`text-muted-foreground`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-caption`,children:`Read the note`}),u]}):(0,Q.jsx)(`div`,{className:`text-muted-foreground`,children:u}),t[16]=u,t[17]=r.length,t[18]=b):b=t[18];let x;t[19]!==v||t[20]!==y||t[21]!==b?(x=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,y,b]}),t[19]=v,t[20]=y,t[21]=b,t[22]=x):x=t[22];let S;return t[23]!==_||t[24]!==x||t[25]!==d||t[26]!==p?(S=(0,Q.jsxs)(`aside`,{"aria-label":d,className:p,children:[_,x]}),t[23]=_,t[24]=x,t[25]=d,t[26]=p,t[27]=S):S=t[27],S}var g4=Qr(`group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full`,{variants:{variant:{default:`*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80`,secondary:`*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]`,muted:`*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]`,tinted:`*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]`,outline:`*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30`,ghost:`border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50`,destructive:`*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30`}},defaultVariants:{variant:`default`}});function _4({variant:e=`default`,align:t=`start`,className:n,...r}){return(0,Q.jsx)(`div`,{"data-slot":`bubble`,"data-variant":e,"data-align":t,className:Y(g4({variant:e}),n),...r})}function v4({className:e,render:t,...n}){return ps({defaultTagName:`div`,props:dt({className:Y(`w-fit max-w-full min-w-0 overflow-hidden rounded-3xl border border-transparent px-3 py-2.5 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/30`,e)},n),render:t,state:{slot:`bubble-content`}})}Qr(`absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0`,{variants:{side:{top:`top-0 -translate-y-3/4`,bottom:`bottom-0 translate-y-3/4`},align:{start:`left-3`,end:`right-3`}},defaultVariants:{side:`bottom`,align:`end`}});function y4({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-group`,className:Y(`flex min-w-0 flex-col gap-2`,e),...t})}function b4({className:e,align:t=`start`,...n}){return(0,Q.jsx)(`div`,{"data-slot":`message`,"data-align":t,className:Y(`group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse`,e),...n})}function x4({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-avatar`,className:Y(`flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8`,e),...t})}function S4({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-content`,className:Y(`flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end`,e),...t})}function C4({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-header`,className:Y(`flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0`,e),...t})}var w4={open:_f,review:o,comment:ap,"open-to-side":nf,"open-file":Tf,timeline:Ap,"copy-relative":Qi,discard:qp,"expand-all":Kd,"collapse-all":Wd,reply:Op,resolution:o,reveal:Tf};function T4(e){let t=(0,$.c)(2),{action:n}=e,r=n.id===`resolution`&&n.label===`Reopen`?Mp:w4[n.id],i;return t[0]===r?i=t[1]:(i=(0,Q.jsx)(r,{}),t[0]=r,t[1]=i),i}function E4(e){let t=(0,$.c)(41),{actions:n,label:r,description:i,onAction:a,children:o}=e,s=(0,Z.useId)(),[c,l]=(0,Z.useState)(!1),u;t[0]===a?u=t[1]:(u=e=>{e===`open-to-side`&&(0,rd.flushSync)(()=>l(!0)),a(e)},t[0]=a,t[1]=u);let d=u,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e&&l(!1)},t[2]=f):f=t[2];let p=f,m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(`div`,{className:`min-w-0`}),t[3]=m):m=t[3];let h;t[4]!==i||t[5]!==s?(h=i&&(0,Q.jsx)(`span`,{id:s,className:`sr-only`,children:i}),t[4]=i,t[5]=s,t[6]=h):h=t[6];let g=i?s:void 0,_;t[7]!==r||t[8]!==g?(_=(0,Q.jsx)(X,{variant:`ghost`,size:`icon-xs`,className:`shrink-0`,"aria-label":r,"aria-describedby":g}),t[7]=r,t[8]=g,t[9]=_):_=t[9];let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(sf,{}),t[10]=v):v=t[10];let y;t[11]===_?y=t[12]:(y=(0,Q.jsx)(TN,{render:_,children:v}),t[11]=_,t[12]=y);let b=!c,x;if(t[13]!==d||t[14]!==n){let e;t[16]===d?e=t[17]:(e=e=>(0,Q.jsxs)(kN,{disabled:e.disabled,variant:e.destructive?`destructive`:`default`,onClick:()=>d(e.id),children:[(0,Q.jsx)(T4,{action:e}),e.label]},e.id),t[16]=d,t[17]=e),x=n.map(e),t[13]=d,t[14]=n,t[15]=x}else x=t[15];let S;t[18]!==x||t[19]!==b?(S=(0,Q.jsx)(EN,{align:`end`,finalFocus:b,children:x}),t[18]=x,t[19]=b,t[20]=S):S=t[20];let C;t[21]!==S||t[22]!==h||t[23]!==y?(C=(0,Q.jsxs)(wN,{onOpenChange:p,children:[h,y,S]}),t[21]=S,t[22]=h,t[23]=y,t[24]=C):C=t[24];let w;t[25]!==o||t[26]!==C?(w=o(C),t[25]=o,t[26]=C,t[27]=w):w=t[27];let T;t[28]===w?T=t[29]:(T=(0,Q.jsx)(oK,{render:m,children:w}),t[28]=w,t[29]=T);let E=!c,D;if(t[30]!==d||t[31]!==n){let e;t[33]===d?e=t[34]:(e=e=>(0,Q.jsxs)(cK,{disabled:e.disabled,variant:e.destructive?`destructive`:`default`,onClick:()=>d(e.id),children:[(0,Q.jsx)(T4,{action:e}),e.label]},e.id),t[33]=d,t[34]=e),D=n.map(e),t[30]=d,t[31]=n,t[32]=D}else D=t[32];let O;t[35]!==E||t[36]!==D?(O=(0,Q.jsx)(sK,{finalFocus:E,children:D}),t[35]=E,t[36]=D,t[37]=O):O=t[37];let k;return t[38]!==T||t[39]!==O?(k=(0,Q.jsxs)(aK,{onOpenChange:p,children:[T,O]}),t[38]=T,t[39]=O,t[40]=k):k=t[40],k}var D4=e=>e==null?null:Uo(e);function O4(e){let t=(0,$.c)(7),{author:n}=e,r=n===`agent`,i;t[0]===` `?i=t[1]:(i=Y(`size-6 min-w-6`,` `),t[0]=` `,t[1]=i);let a;t[2]===r?a=t[3]:(a=r?(0,Q.jsx)(Vp,{className:`size-3.5`}):(0,Q.jsx)(Yp,{className:`size-3.5`}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsx)(x4,{className:i,children:a}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function k4(e){let t=(0,$.c)(10),{thread:n}=e,r;t[0]===n?r=t[1]:(r=dR(n),t[0]=n,t[1]=r);let i=r===`agent`,a=i?`font-medium text-foreground`:`text-muted-foreground`,o;t[2]===a?o=t[3]:(o=Y(`flex shrink-0 items-center gap-1`,a),t[2]=a,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,Q.jsx)(Vp,{className:`size-3`}):(0,Q.jsx)(Yp,{className:`size-3`}),t[4]=i,t[5]=s);let c=i?`Agent`:`You`,l;return t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Q.jsxs)(`span`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function A4(e){let t=(0,$.c)(26),{owner:n,messageId:r,onEdit:i}=e,a=d4(n.scope,n.context),o;t[0]===a.result.waiting?o=t[1]:(o=(0,Q.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Comment actions`,disabled:a.result.waiting}),t[0]=a.result.waiting,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(sf,{}),t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=(0,Q.jsx)(TN,{render:o,children:s}),t[3]=o,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(_p,{}),t[5]=l):l=t[5];let u;t[6]===i?u=t[7]:(u=(0,Q.jsxs)(kN,{onClick:i,children:[l,`Edit`]}),t[6]=i,t[7]=u);let d;t[8]!==r||t[9]!==n.threadId||t[10]!==a?(d=()=>a.send({threadId:n.threadId,messageId:r}),t[8]=r,t[9]=n.threadId,t[10]=a,t[11]=d):d=t[11];let f;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(Gp,{}),t[12]=f):f=t[12];let p;t[13]===d?p=t[14]:(p=(0,Q.jsxs)(kN,{variant:`destructive`,onClick:d,children:[f,`Delete`]}),t[13]=d,t[14]=p);let m;t[15]!==u||t[16]!==p?(m=(0,Q.jsxs)(EN,{align:`end`,children:[u,p]}),t[15]=u,t[16]=p,t[17]=m):m=t[17];let h;t[18]!==c||t[19]!==m?(h=(0,Q.jsxs)(wN,{children:[c,m]}),t[18]=c,t[19]=m,t[20]=h):h=t[20];let g;t[21]===a.result?g=t[22]:(g=st(a.result)&&(0,Q.jsx)(`span`,{role:`alert`,className:`font-normal text-destructive`,children:NR(nt(a.result.cause))}),t[21]=a.result,t[22]=g);let _;return t[23]!==h||t[24]!==g?(_=(0,Q.jsxs)(Q.Fragment,{children:[h,g]}),t[23]=h,t[24]=g,t[25]=_):_=t[25],_}function j4(e){let t=(0,$.c)(33),{owner:n,message:r,onDone:i}=e,[a,o]=(0,Z.useState)(r.body),s=u4(n.scope,n.context),c;t[0]===a?c=t[1]:(c=hR(a),t[0]=a,t[1]=c);let l=c,u;t[2]!==a||t[3]!==s||t[4]!==r.id||t[5]!==i||t[6]!==n.threadId||t[7]!==l?(u=e=>{e.preventDefault(),l&&!s.result.waiting&&s.send({threadId:n.threadId,messageId:r.id,body:a},i)},t[2]=a,t[3]=s,t[4]=r.id,t[5]=i,t[6]=n.threadId,t[7]=l,t[8]=u):u=t[8];let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>o(e.target.value),t[9]=d):d=t[9];let f;t[10]===i?f=t[11]:(f=e=>{e.key===`Escape`&&i()},t[10]=i,t[11]=f);let p;t[12]!==a||t[13]!==s.bodyLimit||t[14]!==s.result.waiting||t[15]!==f?(p=(0,Q.jsx)(cH,{autoFocus:!0,"aria-label":`Edit comment`,value:a,maxLength:s.bodyLimit,disabled:s.result.waiting,onChange:d,onKeyDown:f}),t[12]=a,t[13]=s.bodyLimit,t[14]=s.result.waiting,t[15]=f,t[16]=p):p=t[16];let m;t[17]===s.result?m=t[18]:(m=st(s.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-2xs text-destructive`,children:NR(nt(s.result.cause))}),t[17]=s.result,t[18]=m);let h;t[19]!==s.result.waiting||t[20]!==i?(h=(0,Q.jsx)(X,{type:`button`,size:`sm`,variant:`ghost`,disabled:s.result.waiting,onClick:i,children:`Cancel`}),t[19]=s.result.waiting,t[20]=i,t[21]=h):h=t[21];let g=s.result.waiting||!l,_=s.result.waiting?`Saving…`:`Save`,v;t[22]!==g||t[23]!==_?(v=(0,Q.jsx)(X,{type:`submit`,size:`sm`,disabled:g,children:_}),t[22]=g,t[23]=_,t[24]=v):v=t[24];let y;t[25]!==v||t[26]!==h?(y=(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[h,v]}),t[25]=v,t[26]=h,t[27]=y):y=t[27];let b;return t[28]!==y||t[29]!==u||t[30]!==p||t[31]!==m?(b=(0,Q.jsxs)(`form`,{className:`flex w-full flex-col gap-2`,onSubmit:u,children:[p,m,y]}),t[28]=y,t[29]=u,t[30]=p,t[31]=m,t[32]=b):b=t[32],b}function M4(e){let t=(0,$.c)(32),{message:n,owner:r,wide:i}=e,a=i!==void 0&&i,[o,s]=(0,Z.useState)(!1),c=n.author!==`agent`,l;t[0]===n.createdAt?l=t[1]:(l=D4(n.createdAt),t[0]=n.createdAt,t[1]=l);let u=l,d=c?`end`:`start`,f;t[2]!==n.author||t[3]!==a?(f=!a&&(0,Q.jsx)(O4,{author:n.author}),t[2]=n.author,t[3]=a,t[4]=f):f=t[4];let p=c?`You`:`Agent`,m;t[5]===u?m=t[6]:(m=u!=null&&(0,Q.jsx)(`span`,{className:`font-normal`,children:u}),t[5]=u,t[6]=m);let h;t[7]===n.editedAt?h=t[8]:(h=n.editedAt!==null&&n.editedAt!==void 0&&(0,Q.jsx)(`span`,{className:`font-normal`,children:`edited`}),t[7]=n.editedAt,t[8]=h);let g;t[9]!==o||t[10]!==n.id||t[11]!==c||t[12]!==r?(g=c&&!o&&(0,Q.jsx)(A4,{owner:r,messageId:n.id,onEdit:()=>s(!0)}),t[9]=o,t[10]=n.id,t[11]=c,t[12]=r,t[13]=g):g=t[13];let _;t[14]!==p||t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Q.jsx)(C4,{children:(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 flex-wrap items-center gap-2`,children:[p,m,h,g]})}),t[14]=p,t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==o||t[20]!==n||t[21]!==c||t[22]!==r||t[23]!==a?(v=o?(0,Q.jsx)(j4,{owner:r,message:n,onDone:()=>s(!1)}):(0,Q.jsx)(_4,{variant:c?`tinted`:`muted`,align:c?`end`:`start`,className:a?`max-w-full`:`max-w-[85%]`,children:(0,Q.jsx)(v4,{className:`whitespace-pre-wrap`,children:n.body})}),t[19]=o,t[20]=n,t[21]=c,t[22]=r,t[23]=a,t[24]=v):v=t[24];let y;t[25]!==v||t[26]!==_?(y=(0,Q.jsxs)(S4,{children:[_,v]}),t[25]=v,t[26]=_,t[27]=y):y=t[27];let b;return t[28]!==y||t[29]!==d||t[30]!==f?(b=(0,Q.jsxs)(b4,{align:d,children:[f,y]}),t[28]=y,t[29]=d,t[30]=f,t[31]=b):b=t[31],b}function N4(e){let t=(0,$.c)(55),{thread:n,scope:r,context:i,onReveal:a}=e,[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(void 0),h=c4(r,i),g=l4(r,i),_;t[0]===n?_=t[1]:(_=pR(n),t[0]=n,t[1]=_);let v=_,y=a!=null,b;t[2]!==i||t[3]!==r||t[4]!==n.id?(b={scope:r,context:i,threadId:n.id},t[2]=i,t[3]=r,t[4]=n.id,t[5]=b):b=t[5];let x=b,S;t[6]!==y||t[7]!==a||t[8]!==n.anchor?(S=y?(0,Q.jsxs)(`button`,{type:`button`,onClick:a,title:n.anchor.kind===`change`?`Show the change`:`Show in the code`,className:`flex min-w-0 flex-1 flex-wrap items-center gap-1 rounded px-0.5 font-mono text-foreground hover:underline`,children:[n.anchor.kind!==`change`&&(0,Q.jsx)(`span`,{className:`truncate`,children:FR(n.anchor.filePath)}),(0,Q.jsx)(`span`,{className:`shrink-0 font-sans text-muted-foreground`,children:uR(n.anchor)}),n.anchor.revision!==null&&n.anchor.revision!==void 0&&(0,Q.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`in `,R$(n.anchor.revision)]})]}):(0,Q.jsx)(`span`,{children:uR(n.anchor)}),t[6]=y,t[7]=a,t[8]=n.anchor,t[9]=S):S=t[9];let C=S,w;t[10]!==g||t[11]!==n.id||t[12]!==n.resolved?(w=()=>g.send({threadId:n.id,resolved:!n.resolved}),t[10]=g,t[11]=n.id,t[12]=n.resolved,t[13]=w):w=t[13];let T;t[14]===n.resolved?T=t[15]:(T=n.resolved?(0,Q.jsx)(Mp,{"data-icon":`inline-start`}):(0,Q.jsx)(o,{"data-icon":`inline-start`}),t[14]=n.resolved,t[15]=T);let E=n.resolved?`Reopen`:`Resolve`,D;t[16]!==g.result.waiting||t[17]!==w||t[18]!==T||t[19]!==E?(D=(0,Q.jsxs)(X,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6`,disabled:g.result.waiting,onClick:w,children:[T,E]}),t[16]=g.result.waiting,t[17]=w,t[18]=T,t[19]=E,t[20]=D):D=t[20];let O=D,k;t[21]===g.result?k=t[22]:(k=st(g.result)&&(0,Q.jsx)(`span`,{role:`alert`,className:`max-w-64 text-2xs text-destructive`,children:NR(nt(g.result.cause))}),t[21]=g.result,t[22]=k);let A;t[23]!==O||t[24]!==k?(A=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 flex-wrap items-center gap-1`,children:[O,k]}),t[23]=O,t[24]=k,t[25]=A):A=t[25];let j=A,M;t[26]!==d||t[27]!==p||t[28]!==h||t[29]!==s||t[30]!==n.id?(M=s&&(0,Q.jsx)(`form`,{className:`mt-3`,onSubmit:e=>{if(e.preventDefault(),!hR(d)||h.result.waiting)return;let t=gR(p,d,()=>({body:d,messageId:crypto.randomUUID()}));m(t),h.send({threadId:n.id,body:d,messageId:t.messageId},()=>{m(void 0),f(``),c(!1)})},children:(0,Q.jsxs)(wo,{children:[(0,Q.jsxs)(Ds,{children:[(0,Q.jsx)(_s,{htmlFor:`reply-${n.id}`,children:`Reply`}),(0,Q.jsx)(cH,{id:`reply-${n.id}`,value:d,maxLength:h.bodyLimit,required:!0,disabled:h.result.waiting,onChange:e=>{m(void 0),f(e.target.value)},placeholder:`Add a reply…`})]}),st(h.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-2xs text-destructive`,children:NR(nt(h.result.cause))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(X,{type:`submit`,size:`sm`,disabled:h.result.waiting||!hR(d),children:h.result.waiting?`Replying…`:`Post reply`}),(0,Q.jsx)(X,{type:`button`,size:`sm`,variant:`ghost`,disabled:h.result.waiting,onClick:()=>c(!1),children:`Cancel`})]})]})}),t[26]=d,t[27]=p,t[28]=h,t[29]=s,t[30]=n.id,t[31]=M):M=t[31];let N=M,P;t[32]!==a||t[33]!==g||t[34]!==n.id||t[35]!==n.resolved?(P=e=>{e===`reply`&&c(!0),e===`resolution`&&g.send({threadId:n.id,resolved:!n.resolved}),e===`reveal`&&a?.()},t[32]=a,t[33]=g,t[34]=n.id,t[35]=n.resolved,t[36]=P):P=t[36];let F=P,I=g.result.waiting||h.result.waiting,L;t[37]!==y||t[38]!==I||t[39]!==n.resolved?(L=Tz({kind:`thread`,resolved:n.resolved,pending:I,canReveal:y}),t[37]=y,t[38]=I,t[39]=n.resolved,t[40]=L):L=t[40];let R;t[41]!==l||t[42]!==y||t[43]!==x||t[44]!==N||t[45]!==s||t[46]!==j||t[47]!==v||t[48]!==n||t[49]!==C?(R=e=>y&&!n.resolved?(0,Q.jsxs)(`article`,{className:`min-w-0 rounded-xl border bg-card p-3 select-text`,"aria-label":`Comment thread`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex min-w-0 items-center gap-1.5 text-2xs text-muted-foreground`,children:[(0,Q.jsx)(k4,{thread:n}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`·`}),C,e]}),!l&&n.messages.length>1&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>u(!0),className:`mb-2 text-2xs text-muted-foreground hover:text-foreground hover:underline`,children:[`Show `,n.messages.length-1,` earlier`]}),(0,Q.jsx)(y4,{children:(l?n.messages:n.messages.slice(-1)).map(e=>(0,Q.jsx)(M4,{message:e,owner:x,wide:!0},e.id))}),N,!s&&(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-end gap-1 border-t pt-2`,children:[(0,Q.jsx)(os,{variant:v===`agent-replied`?`secondary`:`outline`,className:`mr-auto h-4`,children:mR(n)}),(0,Q.jsx)(X,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6`,onClick:()=>c(!0),children:`Reply`}),j]})]}):n.resolved?(0,Q.jsxs)(`article`,{className:`flex min-w-0 flex-wrap items-center gap-2 rounded-lg border border-dashed px-2.5 py-1.5 text-2xs text-muted-foreground select-text`,"aria-label":`Resolved comment thread`,children:[(0,Q.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2`,children:[(0,Q.jsx)(o,{className:`size-3.5 shrink-0 text-graph-2`}),y?C:(0,Q.jsx)(k4,{thread:n}),e]}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.messages[0]?.body}),j]}):(0,Q.jsxs)(`article`,{className:`rounded-xl border bg-card p-3 shadow-sm select-text`,"aria-label":`Comment thread`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex min-w-0 flex-wrap items-center gap-1.5 text-2xs text-muted-foreground`,children:[(0,Q.jsx)(k4,{thread:n}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Q.jsx)(`span`,{className:`min-w-0`,children:C}),e,(0,Q.jsx)(os,{variant:v===`agent-replied`?`secondary`:`outline`,className:`h-4`,children:mR(n)}),!s&&(0,Q.jsxs)(`div`,{className:`ml-auto flex gap-0.5`,children:[(0,Q.jsx)(X,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6`,onClick:()=>c(!0),children:`Reply`}),j]})]}),(0,Q.jsx)(y4,{children:n.messages.map(e=>(0,Q.jsx)(M4,{message:e,owner:x},e.id))}),N,v===`awaiting-agent`&&!s&&(0,Q.jsx)(`p`,{className:`mt-2 text-right text-2xs text-muted-foreground`,children:`The agent reads this when you ask it to check its comments.`})]}),t[41]=l,t[42]=y,t[43]=x,t[44]=N,t[45]=s,t[46]=j,t[47]=v,t[48]=n,t[49]=C,t[50]=R):R=t[50];let z;return t[51]!==F||t[52]!==L||t[53]!==R?(z=(0,Q.jsx)(E4,{label:`Thread actions`,actions:L,onAction:F,children:R}),t[51]=F,t[52]=L,t[53]=R,t[54]=z):z=t[54],z}function P4(e){let t=(0,$.c)(12),{threads:n,result:r}=r4(e.scope,e.context),i=n4(e.scope,e.context,F4,e.range),a;t[0]===r?a=t[1]:(a=st(r)&&(0,Q.jsx)(`p`,{role:`alert`,className:`px-3 text-xs text-destructive`,children:`Comments could not be refreshed.`}),t[0]=r,t[1]=a);let o;t[2]!==e.onReview||t[3]!==i?(o=e.onReview??(e=>i.toggle(e.review)),t[2]=e.onReview,t[3]=i,t[4]=o):o=t[4];let s;t[5]!==e||t[6]!==o||t[7]!==n?(s=(0,Q.jsx)(I4,{...e,threads:n,onToggleReviewed:o}),t[5]=e,t[6]=o,t[7]=n,t[8]=s):s=t[8];let c;return t[9]!==a||t[10]!==s?(c=(0,Q.jsxs)(Q.Fragment,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function F4(e){return ul.add(e)}function I4(e){let t=(0,$.c)(16),{entries:n,scope:r,context:i,interaction:a,header:o,footer:s,headerLeading:c,headerActions:l,toolbar:u,threads:d,commentRequest:f,foundLine:p,disableFileHeader:m,fullHeight:h,collapsible:g,onToggleReviewed:_}=e,v=m!==void 0&&m,y=h!==void 0&&h,b=g!==void 0&&g,{dark:x}=Au(),{preferences:S}=Cl(),C=uz(n,S.collapseSpecs),w=K0(a.worktreeId,a.entry),T=Z0(),[E,D]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(0),[M,N]=(0,Z.useState)(null),P=new Set(C.filter(e=>E?.id!==e.id&&R0(w.folds,e.id,C.length>1&&e.review?.reviewed===!0||(b||C.length>1)&&S.collapseSpecs&&lz(e.path))).map(H4)),F=e=>{e?.comment&&(j(C.findIndex(t=>t.id===e.id)),D({id:e.id,anchor:{...e.comment,kind:`file`}}),k(null))},I;t[0]===k?I=t[1]:(I=()=>{D(null),k(null)},t[0]=k,t[1]=I);let L=I,[R,z]=(0,Z.useState)();f!==void 0&&R!==f&&(z(f),F(C[0]));let[B,V]=(0,Z.useState)(),[H,U]=(0,Z.useState)(),W=a.reveal,G=W&&C.find(e=>e.comment&&aR(W.anchor,e.comment)),ee=e=>{let t=C[e];t&&(j(e),T.scrollTo({type:`item`,id:t.id,align:`start`}))},te=new Map(C.map(V4)),K=C.map(e=>{let t=e.comment,n=t?d.filter(n=>aR(n.anchor,t)&&(n.anchor.comparison||C.find(e=>e.comment&&aR(n.anchor,e.comment))?.id===e.id)).map(e=>({kind:`thread`,thread:e,stale:oR(e.anchor,t)})):[];for(let t of e.agentNotes??[])n.push({...t,kind:`agent`});E?.id===e.id&&n.push({kind:`composer`,anchor:E.anchor});let r=n.map(B4);return{id:e.id,collapsed:P.has(e.id),version:hc(JSON.stringify([e.version,P.has(e.id),n])),annotations:r,...Q2(e)}}),ne=C.filter(z4),q=new Set(ne.map(R4)).size,re=ne[0]?.id,ie=new Map;for(let e of C)e.review&&!ie.has(e.review.path)&&ie.set(e.review.path,e.id);let ae={theme:vc,themeType:x?`dark`:`light`,overflow:S.lineOverflow,diffStyle:S.diffStyle,diffIndicators:`classic`,hunkSeparators:`line-info`,stickyHeaders:!v&&!y,disableFileHeader:v,enableLineSelection:!0,enableGutterUtility:!0,onLineClick:(e,t)=>j(C.findIndex(e=>e.id===t.item.id)),onLineNumberClick:(e,t)=>j(C.findIndex(e=>e.id===t.item.id)),onGutterUtilityClick:(e,t)=>{let n=te.get(t.item.id);if(!n?.comment)return;let r=iR(n.comment,e);if(!r){N(`Select lines on one side of the comparison.`);return}j(C.findIndex(e=>e.id===n.id)),N(null),D({id:n.id,anchor:r}),k({id:n.id,range:e})},lineHoverHighlight:`number`,unsafeCSS:`${nl}${fc}${v?`[data-code] { padding-top: 0 !important; }`:Du}`,...v?{itemMetrics:{paddingTop:0}}:{},layout:{paddingTop:v?0:12,paddingBottom:y||s?12:160,gap:12}},oe=C.length>0&&C.every(e=>P.has(e.id)),se=e=>w.setCollapsed(C.map(L4),e),ce=e=>{j(C.findIndex(t=>t.id===e)),w.setCollapsed([e],!P.has(e))},le=C.length>1?(0,Q.jsxs)(X,{size:`sm`,variant:`ghost`,onClick:()=>se(!oe),children:[oe?(0,Q.jsx)(Kd,{"aria-hidden":`true`,"data-icon":`inline-start`}):(0,Q.jsx)(Wd,{"aria-hidden":`true`,"data-icon":`inline-start`}),oe?`Expand all`:`Collapse all`]}):null,ue=U4(O,E!=null,te),de=a.active&&(0,Q.jsx)(W4,{next:()=>ee(Math.min(A+1,C.length-1)),previous:()=>ee(Math.max(A-1,0)),comment:()=>F(C[A]),review:()=>{let e=C[A];e&&_(e)}}),fe=M?(0,Q.jsx)(`p`,{role:`status`,className:`absolute bottom-3 left-3 z-10 rounded-lg border bg-popover p-2 text-xs`,children:M}):ue!=null&&(0,Q.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`pointer-events-none absolute bottom-3 left-3 z-10 flex max-w-[calc(100%-1.5rem)] items-center gap-1.5 rounded-lg border bg-popover/95 px-2.5 py-1 text-xs text-popover-foreground shadow-md`,children:[(0,Q.jsx)(ap,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`truncate`,children:[FR(ue.filePath),` ·`,` `,uR(ue)]}),ue.kind===`codeRange`&&ue.comparison?.kind===`worktree`&&ue.side!==`deletions`&&(ue.comparison.scope===`staged`||ue.comparison.scope===`unstaged`)&&(0,Q.jsx)(`span`,{className:`pointer-events-auto`,children:(0,Q.jsx)(GQ,{scope:r,context:i,path:ue.filePath,hunk:{scope:ue.comparison.scope,startLine:ue.startLine,endLine:ue.endLine},variant:`compact`})})]}),pe;t[2]!==le||t[3]!==u?(pe=u?u(le):le&&(0,Q.jsx)(`div`,{className:`flex shrink-0 justify-end px-3`,children:le}),t[2]=le,t[3]=u,t[4]=pe):pe=t[4];let me;t[5]!==C.length||t[6]!==s||t[7]!==o||t[8]!==l?(me=C.length===0&&(o||l||s)&&(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,"data-testid":`empty-code-document`,children:[o?.(),s?.(),l&&(0,Q.jsx)(`div`,{className:`flex justify-end px-3.5 py-2`,children:(0,Q.jsx)(QQ,{children:l})})]}),t[5]=C.length,t[6]=s,t[7]=o,t[8]=l,t[9]=me):me=t[9];let he=C.length>0&&(0,Q.jsx)(iA,{ref:e=>{if(!e)return;let t=T.attach(e);if(W&&G&&H!==W.nonce&&P.has(G.id))return w.setCollapsed([G.id],!1),t;let n=requestAnimationFrame(()=>{let t=C[0];if(p&&t&&B!==p.nonce&&(k({id:t.id,range:{start:p.line,end:p.line}}),e.scrollTo({type:`line`,id:t.id,lineNumber:p.line,align:`center`}),V(p.nonce)),W&&G&&H!==W.nonce){let t=W.anchor,n=G.comment&&oR(t,G.comment);e.scrollTo(t.kind===`codeRange`&&!n?{type:`line`,id:G.id,lineNumber:t.startLine,...G.kind===`diff`?{side:t.side??`additions`}:{},align:`center`}:{type:`item`,id:G.id,align:`start`}),j(C.findIndex(e=>e.id===G.id)),U(W.nonce)}});return()=>{cancelAnimationFrame(n),t?.()}},items:K,selectedLines:O,onSelectedLinesChange:e=>{E||(k(e),e&&j(C.findIndex(t=>t.id===e.id)))},renderAnnotation:e=>{let t=e.metadata;return t.kind===`agent`?(0,Q.jsx)(h4,{title:t.title,text:t.text,stale:t.stale,...t.marker?{marker:t.marker}:{},...t.tone?{tone:t.tone}:{}}):t.kind===`composer`?(0,Q.jsx)(p4,{scope:r,context:i,anchor:t.anchor,onClose:L},JSON.stringify(t.anchor)):(0,Q.jsxs)(`div`,{className:`m-3 font-sans`,children:[t.stale&&(0,Q.jsx)(`p`,{className:`mb-2 text-xs text-graph-4`,children:`Code changed since this comment`}),(0,Q.jsx)(N4,{scope:r,context:i,thread:t.thread})]})},renderHeaderMetadata:e=>{let t=te.get(e.id);if(v||!t)return null;let n=e.id===C[0]?.id?l:null,r=e.id===C[0]?.id?c:null,i=t.review?.stale?(0,Q.jsx)(`span`,{className:`rounded-md bg-graph-4/15 px-1.5 py-0.5 font-sans text-2xs text-graph-4`,children:`Changed since reviewed`}):null,a=t.comment?(0,Q.jsxs)(X,{variant:`ghost`,size:`xs`,"aria-label":`Comment on ${t.path} (${t.kind===`diff`?t.note??`diff`:`file`})`,onClick:()=>F(t),children:[(0,Q.jsx)(ap,{}),(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:`Comment`})]}):null;return!i&&!r&&!n&&!a?null:(0,Q.jsxs)(`div`,{className:`flex max-w-full flex-wrap items-center justify-end gap-1.5`,children:[i,r,(n||a)&&(0,Q.jsxs)(QQ,{children:[n,a]})]})},options:ae,className:y?`flex-none overflow-visible`:`min-h-0 flex-1 overflow-auto`,...o?{renderCodeViewHeader:o}:{},...s?{renderCodeViewFooter:s}:{},renderHeaderPrefix:e=>{let t=te.get(e.id);if(!t)return null;let n=P.has(e.id),r=t.review,i=r&&ie.get(r.path)===t.id?r.control:null;return(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[S.collapseSpecs&&e.id===re&&C.length>ne.length&&(0,Q.jsxs)(`span`,{className:`mr-2 border-r pr-2 font-sans text-xs font-medium`,children:[`Specs · `,q,` files`]}),(b||C.length>1)&&(0,Q.jsx)(`button`,{type:`button`,"aria-expanded":!n,"aria-label":`${n?`Expand`:`Collapse`} ${t.path}`,onClick:()=>ce(e.id),className:`-ml-1 grid size-5 place-items-center rounded-md font-sans text-muted-foreground hover:bg-accent hover:text-foreground`,children:n?(0,Q.jsx)(Zo,{className:`size-3.5`}):(0,Q.jsx)(Na,{className:`size-3.5`})}),i]})},renderHeaderFilenameSuffix:e=>{let t=te.get(e.id);return t&&t.note?(0,Q.jsx)(`span`,{className:`ml-2 hidden max-w-48 truncate font-sans text-xs text-muted-foreground @code-wide/code:block`,title:t.note,children:t.note}):null}}),ge;return t[10]!==he||t[11]!==de||t[12]!==fe||t[13]!==pe||t[14]!==me?(ge=(0,Q.jsxs)(`div`,{className:`@container/code relative flex min-h-0 flex-1 flex-col`,children:[de,fe,pe,me,he]}),t[10]=he,t[11]=de,t[12]=fe,t[13]=pe,t[14]=me,t[15]=ge):ge=t[15],ge}function L4(e){return e.id}function R4(e){return e.path}function z4(e){return lz(e.path)}function B4(e){if(e.kind===`agent`)return{lineNumber:e.stale?0:e.line,side:`additions`,metadata:e};let t=e.kind===`thread`?e.thread.anchor:e.anchor,n=t.kind===`codeRange`&&!(e.kind===`thread`&&e.stale)?t.endLine:0,r=t.kind===`codeRange`?t.side??`additions`:`additions`;return e.kind,{lineNumber:n,side:r,metadata:e}}function V4(e){return[e.id,e]}function H4(e){return e.id}function U4(e,t,n){if(e==null||t)return null;let r=n.get(e.id);return r?.comment?iR(r.comment,e.range):null}function W4(e){let t=(0,$.c)(1),{next:n,previous:r,comment:i,review:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={ignoreInputs:!0},t[0]=o):o=t[0];let s=o;return xu(Il.nextFile,n,s),xu(Il.previousFile,r,s),xu(Il.commentOnFile,i,s),xu(Il.toggleReviewed,a,s),null}function G4(e){let t=(0,$.c)(16),{title:n,titleLabel:r,subtitle:i,children:a,className:o}=e,s;t[0]===o?s=t[1]:(s=Y(`flex min-h-11 shrink-0 flex-wrap items-center gap-x-2.5 gap-y-1 border-b px-3.5`,o),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==r?(c=(0,Q.jsx)(`h1`,{"aria-label":r,className:`truncate text-ui leading-tight font-semibold`,children:n}),t[2]=n,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=i!=null&&(0,Q.jsx)(`p`,{className:`truncate text-2xs leading-tight text-muted-foreground`,children:i}),t[5]=i,t[6]=l);let u;t[7]!==c||t[8]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-auto flex-col`,children:[c,l]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d;t[10]===a?d=t[11]:(d=(0,Q.jsx)(`div`,{className:`ml-auto flex max-w-full shrink-0 flex-wrap items-center justify-end gap-1.5`,children:a}),t[10]=a,t[11]=d);let f;return t[12]!==s||t[13]!==u||t[14]!==d?(f=(0,Q.jsxs)(`header`,{"data-testid":`document-toolbar`,className:s,children:[u,d]}),t[12]=s,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function K4(e){let t=(0,$.c)(4),{more:n,pending:r,onReadMore:i}=e;if(n<=0)return null;let a=r?`Reading…`:`Read ${Math.min(n,25)} more of ${n}`,o;return t[0]!==i||t[1]!==r||t[2]!==a?(o=(0,Q.jsx)(`div`,{className:`border-t px-4 py-3 text-center`,children:(0,Q.jsx)(X,{variant:`outline`,size:`sm`,onClick:i,disabled:r,children:a})}),t[0]=i,t[1]=r,t[2]=a,t[3]=o):o=t[3],o}function q4(e,t,n){return{path:n.path,fingerprint:n.fingerprint??null,reviewed:n.reviewStatus===`reviewed`,stale:n.reviewStatus===`stale`,control:(0,Q.jsx)(J4,{scope:e,context:t,path:n.path,fingerprint:n.fingerprint,status:n.reviewStatus,compact:!0},`review:${n.path}`)}}function J4(e){let t=(0,$.c)(44),{scope:n,context:r,path:i,fingerprint:a,status:o,compact:s,range:c}=e,l=s!==void 0&&s,u=c===void 0?zR:c,d=$2(n,r,u),f=e4(n,r,u),p=d.result.waiting||f.result.waiting,m,h;if(t[0]!==l||t[1]!==a||t[2]!==d||t[3]!==i||t[4]!==p||t[5]!==o||t[6]!==f){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Yz(d.result,f.result);if(a==null){let e;t[9]===i?e=t[10]:(e=KR([i]),t[9]=i,t[10]=e);let n;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(df,{className:`size-3`,"aria-hidden":`true`}),t[11]=n):n=t[11];let r=l?`Not reviewable`:`Not reviewable: too large or unreadable`,a;t[12]!==e||t[13]!==r?(a=(0,Q.jsxs)(`span`,{title:e,className:`inline-flex items-center gap-1 text-2xs text-muted-foreground`,children:[n,r]}),t[12]=e,t[13]=r,t[14]=a):a=t[14],h=a;break bb0}let n=o===`reviewed`,r;t[15]!==i||t[16]!==o?(r=ZR(i,o),t[15]=i,t[16]=o,t[17]=r):r=t[17];let s=r,c=l?`icon-xs`:`xs`,u=n?`ghost`:`outline`,g=l&&`size-5 `,_=l&&n&&` `,v;t[18]!==g||t[19]!==_?(v=Y(g,_),t[18]=g,t[19]=_,t[20]=v):v=t[20];let y;t[21]!==a||t[22]!==d||t[23]!==i||t[24]!==n||t[25]!==f?(y=()=>{n?f.start(i):d.start({path:i,fingerprint:a})},t[21]=a,t[22]=d,t[23]=i,t[24]=n,t[25]=f,t[26]=y):y=t[26];let b;t[27]!==l||t[28]!==p||t[29]!==o?(b=(0,Q.jsx)(X4,{pending:p,status:o,compact:l}),t[27]=l,t[28]=p,t[29]=o,t[30]=b):b=t[30];let x;t[31]!==l||t[32]!==o?(x=!l&&Z4(o),t[31]=l,t[32]=o,t[33]=x):x=t[33];let S;t[34]!==s||t[35]!==p||t[36]!==n||t[37]!==v||t[38]!==y||t[39]!==b||t[40]!==x||t[41]!==c||t[42]!==u?(S=(0,Q.jsxs)(X,{type:`button`,size:c,variant:u,className:v,"aria-pressed":n,disabled:p,"aria-label":s,title:s,onClick:y,children:[b,x]}),t[34]=s,t[35]=p,t[36]=n,t[37]=v,t[38]=y,t[39]=b,t[40]=x,t[41]=c,t[42]=u,t[43]=S):S=t[43],m=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[S,e!==void 0&&(0,Q.jsx)(`span`,{role:`alert`,className:`max-w-52 truncate text-2xs text-destructive`,children:NR(e)})]})}t[0]=l,t[1]=a,t[2]=d,t[3]=i,t[4]=p,t[5]=o,t[6]=f,t[7]=m,t[8]=h}else m=t[7],h=t[8];return h===Symbol.for(`react.early_return_sentinel`)?m:h}function Y4(e){let t=(0,$.c)(34),{scope:n,context:r,entries:i,compact:a,range:o}=e,s=a!==void 0&&a,c=t4(n,r,o===void 0?zR:o),l,u,d,f,p,m,h,g,_,v,y;if(t[0]!==c||t[1]!==s||t[2]!==i){let e=XR(i),n=c.result.waiting,r=e.blocked||n;f=`inline-flex min-w-0 flex-col items-end gap-1`,l=X,p=`button`,m=s?`icon-xs`:`xs`,h=`outline`,g=r,_=e.label,v=e.label,y=()=>{r||(e.unmarking?c.start({kind:`unmark`,paths:e.reviewedPaths}):c.start({kind:`mark`,entries:e.entries}))},u=(0,Q.jsx)(Q4,{pending:n,unmarking:e.unmarking}),d=!s&&$4(n,e.unmarking,e.text),t[0]=c,t[1]=s,t[2]=i,t[3]=l,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=y}else l=t[3],u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13];let b;t[14]!==l||t[15]!==u||t[16]!==d||t[17]!==p||t[18]!==m||t[19]!==h||t[20]!==g||t[21]!==_||t[22]!==v||t[23]!==y?(b=(0,Q.jsxs)(l,{type:p,size:m,variant:h,disabled:g,"aria-label":_,title:v,onClick:y,children:[u,d]}),t[14]=l,t[15]=u,t[16]=d,t[17]=p,t[18]=m,t[19]=h,t[20]=g,t[21]=_,t[22]=v,t[23]=y,t[24]=b):b=t[24];let x;t[25]===c.report?x=t[26]:(x=c.report&&(0,Q.jsx)(e3,{report:c.report}),t[25]=c.report,t[26]=x);let S;t[27]===c.result?S=t[28]:(S=st(c.result)&&(0,Q.jsx)(`span`,{role:`alert`,className:`max-w-64 text-right text-2xs text-destructive`,children:NR(nt(c.result.cause))}),t[27]=c.result,t[28]=S);let C;return t[29]!==f||t[30]!==b||t[31]!==x||t[32]!==S?(C=(0,Q.jsxs)(`span`,{className:f,children:[b,x,S]}),t[29]=f,t[30]=b,t[31]=x,t[32]=S,t[33]=C):C=t[33],C}function X4(e){let t=(0,$.c)(7),{pending:n,status:r,compact:i}=e;if(n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(ze,{className:`animate-spin`}),t[0]=e):e=t[0],e}if(r===`reviewed`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(o,{}),t[1]=e):e=t[1],e}if(r===`stale`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Mp,{}),t[2]=e):e=t[2],e}let a=i&&`invisible`,s;t[3]===a?s=t[4]:(s=Y(a),t[3]=a,t[4]=s);let c;return t[5]===s?c=t[6]:(c=(0,Q.jsx)(o,{className:s}),t[5]=s,t[6]=c),c}function Z4(e){return e===`reviewed`?`Reviewed`:e===`stale`?`Review again`:`Mark reviewed`}function Q4(e){let t=(0,$.c)(3),{pending:n,unmarking:r}=e;if(n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(ze,{className:`animate-spin`}),t[0]=e):e=t[0],e}if(r){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Mp,{}),t[1]=e):e=t[1],e}let i;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(o,{}),t[2]=i):i=t[2],i}function $4(e,t,n){return e?t?`Unmarking…`:`Marking…`:n}function e3(e){let t=(0,$.c)(11),{report:n}=e,r=n.failed.length,i=r>0?`alert`:`status`,a=r>0?`text-destructive`:`text-muted-foreground`,o;t[0]===a?o=t[1]:(o=Y(`max-w-64 text-right text-2xs leading-tight`,a),t[0]=a,t[1]=o);let s;t[2]===r?s=t[3]:(s=r>0&&(0,Q.jsx)(Jd,{className:`mr-1 inline size-3`}),t[2]=r,t[3]=s);let c;t[4]===n?c=t[5]:(c=GR(n),t[4]=n,t[5]=c);let l;return t[6]!==i||t[7]!==o||t[8]!==s||t[9]!==c?(l=(0,Q.jsxs)(`span`,{role:i,className:o,children:[s,c]}),t[6]=i,t[7]=o,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function t3(e){let t=(0,$.c)(7),{title:n,description:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(Fs,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(Os,{children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsx)(ms,{children:(0,Q.jsxs)(Oo,{children:[i,a]})}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function n3(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(i3,{...e,path:void 0}),t[0]=e,t[1]=n),n}function r3(e){let t=(0,$.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({path:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,Q.jsx)(i3,{...r,path:n}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function i3(e){let t=(0,$.c)(18),{scope:n,context:r,interaction:i,base:a,path:o}=e,{connection:s}=r,c=RF(n,s,a);if(st(c.result)){let e;t[0]===c.result?e=t[1]:(e=ZP(st(c.result)?nt(c.result.cause):void 0),t[0]=c.result,t[1]=e);let n;t[2]===e?n=t[3]:(n=(0,Q.jsx)(t3,{title:`Branch could not be compared`,description:e}),t[2]=e,t[3]=n);let r;t[4]===c.refresh?r=t[5]:(r=(0,Q.jsx)(X,{variant:`outline`,onClick:c.refresh,children:`Compare again`}),t[4]=c.refresh,t[5]=r);let i;return t[6]!==n||t[7]!==r?(i=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center p-4`,children:[n,r]}),t[6]=n,t[7]=r,t[8]=i):i=t[8],i}if(!O(c.result)){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(a3,{}),t[9]=e):e=t[9],e}if(c.result.value.base===void 0){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(t3,{title:`No default branch`,description:`Choose the branch this one is compared against in the Branch list.`}),t[10]=e):e=t[10],e}let l;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(a3,{}),t[11]=l):l=t[11];let u;return t[12]!==c.result.value||t[13]!==r||t[14]!==i||t[15]!==o||t[16]!==n?(u=(0,Q.jsx)(Z.Suspense,{fallback:l,children:(0,Q.jsx)(o3,{scope:n,context:r,interaction:i,branch:c.result.value,path:o})}),t[12]=c.result.value,t[13]=r,t[14]=i,t[15]=o,t[16]=n,t[17]=u):u=t[17],u}function a3(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`p`,{role:`status`,className:`p-4 text-sm`,children:`Comparing the branch…`}),e[0]=t):t=e[0],t}function o3(e){let t=(0,$.c)(26),{scope:n,context:r,interaction:i,branch:a,path:o}=e,s;t[0]===a?s=t[1]:(s=BR(a),t[0]=a,t[1]=s);let c=s,l=H2(n,r,c);if(a.base===null||a.base===void 0)return null;let u;t[2]!==a.files||t[3]!==l||t[4]!==o?(u=MR(a.files,l,o==null?void 0:[o]),t[2]=a.files,t[3]=l,t[4]=o,t[5]=u):u=t[5];let d=u;if(o!=null&&d.length===0){let e;t[6]===a.base.ref?e=t[7]:(e=z$(a.base.ref),t[6]=a.base.ref,t[7]=e);let n=`${o} has no committed change since ${e}.`,r;return t[8]===n?r=t[9]:(r=(0,Q.jsx)(t3,{title:`Not changed on this branch`,description:n}),t[8]=n,t[9]=r),r}let f=o!=null,p=a.base.ref,m=a.head,h=a.mergeBaseOid??``,g=a.commits,_;t[10]===a?_=t[11]:(_=XP(a),t[10]=a,t[11]=_);let v;t[12]!==a.base.ref||t[13]!==a.commits||t[14]!==a.head||t[15]!==h||t[16]!==_?(v={base:p,head:m,mergeBaseOid:h,commits:g,diffRange:_},t[12]=a.base.ref,t[13]=a.commits,t[14]=a.head,t[15]=h,t[16]=_,t[17]=v):v=t[17];let y;return t[18]!==r||t[19]!==i||t[20]!==d||t[21]!==c||t[22]!==n||t[23]!==f||t[24]!==v?(y=(0,Q.jsx)(s3,{scope:n,context:r,interaction:i,range:c,items:d,single:f,branch:v}),t[18]=r,t[19]=i,t[20]=d,t[21]=c,t[22]=n,t[23]=f,t[24]=v,t[25]=y):y=t[25],y}function s3(e){let t=(0,$.c)(51),{scope:n,context:r,interaction:i,range:a,items:o,single:s,branch:c}=e,{connection:l}=r,u=Gn(ar(wF(n,l))),d;t[0]===c.head.oid?d=t[1]:(d={of:c.head.oid,shown:25},t[0]=c.head.oid,t[1]=d);let[f,p]=(0,Z.useState)(d),m=f.of===c.head.oid?f.shown:25,h=o.slice(0,m),g=BF(n,l,c.diffRange,h.map(F$)),_;t[2]===g.patches?_=t[3]:(_=e=>g.patches.get(F$(e).join(`\0`)),t[2]=g.patches,t[3]=_);let v=_,y;t[4]!==r||t[5]!==a||t[6]!==n?(y=(e,t)=>(0,Q.jsx)(J4,{scope:n,context:r,path:e.path,fingerprint:e.fingerprint,status:e.reviewStatus,range:a,compact:t},`review:${e.path}`),t[4]=r,t[5]=a,t[6]=n,t[7]=y):y=t[7];let b=y,x;t[8]!==c.base||t[9]!==c.head.oid||t[10]!==b||t[11]!==v?(x=e=>{let t=AF(c.head.oid,e,v(e));return t==null?[]:[{...t,id:`branch:${e.path}`,comment:{filePath:e.path,comparison:{kind:`branch`,base:c.base},revision:c.head.oid,contentFingerprint:e.fingerprint},review:{path:e.path,fingerprint:e.fingerprint,reviewed:e.reviewStatus===`reviewed`,stale:e.reviewStatus===`stale`,control:b(e,!0)}}]},t[8]=c.base,t[9]=c.head.oid,t[10]=b,t[11]=v,t[12]=x):x=t[12];let S=h.flatMap(x),C=new Set(S.map(c3)),w=h.filter(e=>!C.has(e.path)),T=o.length-h.length,E=u?.changes.length??0,[D]=o,O;t[13]===i.reveal?O=t[14]:(O=i.reveal?.compose?{commentRequest:i.reveal.nonce}:{},t[13]=i.reveal,t[14]=O);let k;t[15]!==r||t[16]!==b||t[17]!==D||t[18]!==o||t[19]!==a||t[20]!==n||t[21]!==s?(k=e=>s&&D?(0,Q.jsx)(G4,{title:FR(D.path),subtitle:`${D.path} · on the branch`,children:b(D,!1)}):(0,Q.jsxs)(G4,{title:`Branch`,subtitle:`${o.length} ${o.length===1?`file`:`files`} changed`,children:[e,(0,Q.jsx)(Y4,{scope:n,context:r,entries:o,range:a})]}),t[15]=r,t[16]=b,t[17]=D,t[18]=o,t[19]=a,t[20]=n,t[21]=s,t[22]=k):k=t[22];let A;t[23]!==c||t[24]!==b||t[25]!==g.failed||t[26]!==g.retry||t[27]!==w||t[28]!==v||t[29]!==s||t[30]!==E?(A=()=>(0,Q.jsx)(l3,{branch:c,single:s,uncommitted:E,omitted:w,patchOf:v,failed:g.failed,onRetry:g.retry,control:e=>b(e,!0)}),t[23]=c,t[24]=b,t[25]=g.failed,t[26]=g.retry,t[27]=w,t[28]=v,t[29]=s,t[30]=E,t[31]=A):A=t[31];let j;t[32]!==r||t[33]!==S||t[34]!==i||t[35]!==a||t[36]!==n||t[37]!==O||t[38]!==k||t[39]!==A?(j=(0,Q.jsx)(P4,{scope:n,context:r,interaction:i,range:a,...O,entries:S,toolbar:k,header:A}),t[32]=r,t[33]=S,t[34]=i,t[35]=a,t[36]=n,t[37]=O,t[38]=k,t[39]=A,t[40]=j):j=t[40];let M;t[41]!==c.head.oid||t[42]!==m?(M=()=>p({of:c.head.oid,shown:m+25}),t[41]=c.head.oid,t[42]=m,t[43]=M):M=t[43];let N;t[44]!==g.pending||t[45]!==T||t[46]!==M?(N=(0,Q.jsx)(K4,{more:T,pending:g.pending,onReadMore:M}),t[44]=g.pending,t[45]=T,t[46]=M,t[47]=N):N=t[47];let P;return t[48]!==N||t[49]!==j?(P=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[j,N]}),t[48]=N,t[49]=j,t[50]=P):P=t[50],P}function c3(e){return e.path}function l3(e){let t=(0,$.c)(24),{branch:n,single:r,uncommitted:i,omitted:a,patchOf:o,failed:s,onRetry:c,control:l}=e,u;t[0]===n.head.branch?u=t[1]:(u=n.head.branch===null||n.head.branch===void 0?`This commit`:z$(n.head.branch),t[0]=n.head.branch,t[1]=u);let d=u,f;t[2]!==n.base||t[3]!==n.commits||t[4]!==n.head.oid||t[5]!==n.mergeBaseOid||t[6]!==d||t[7]!==r?(f=!r&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h2`,{className:`text-sm font-semibold`,children:[d,` since `,z$(n.base)]}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{children:[n.commits,` `,n.commits===1?`commit`:`commits`]}),(0,Q.jsxs)(`span`,{children:[`from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:R$(n.mergeBaseOid)}),` `,`to `,(0,Q.jsx)(`span`,{className:`font-mono`,children:R$(n.head.oid)})]}),(0,Q.jsx)(os,{variant:`secondary`,className:`h-4`,children:z$(n.base)})]})]}),t[2]=n.base,t[3]=n.commits,t[4]=n.head.oid,t[5]=n.mergeBaseOid,t[6]=d,t[7]=r,t[8]=f):f=t[8];let p;t[9]===i?p=t[10]:(p=i>0&&(0,Q.jsx)(`p`,{className:`mt-1 text-2xs text-muted-foreground`,children:`Uncommitted changes are not part of the branch review. Review them under Uncommitted.`}),t[9]=i,t[10]=p);let m;t[11]!==s||t[12]!==c?(m=s&&(0,Q.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-xs text-muted-foreground`,children:[`Some patches could not be read.`,(0,Q.jsx)(X,{size:`xs`,variant:`outline`,onClick:c,children:`Try again`})]}),t[11]=s,t[12]=c,t[13]=m):m=t[13];let h;t[14]!==l||t[15]!==s||t[16]!==a||t[17]!==o?(h=a.length>0&&(0,Q.jsx)(`ul`,{className:`mt-3 space-y-1.5`,"aria-label":`Changes without code preview`,children:a.map(e=>(0,Q.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 rounded-lg border bg-muted/25 px-3 py-2 text-xs`,children:[l(e),(0,Q.jsx)(`span`,{className:`truncate font-mono font-medium`,children:e.path}),(0,Q.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.status,` ·`,` `,UN(e,o(e),s)??`No code change`]})]},e.path))}),t[14]=l,t[15]=s,t[16]=a,t[17]=o,t[18]=h):h=t[18];let g;return t[19]!==f||t[20]!==p||t[21]!==m||t[22]!==h?(g=(0,Q.jsxs)(`section`,{className:`mx-4 mt-3 rounded-xl border px-4 py-3`,children:[f,p,m,h]}),t[19]=f,t[20]=p,t[21]=m,t[22]=h,t[23]=g):g=t[23],g}var u3=e=>F$(e).join(`\0`);function d3(e){let t=(0,$.c)(46),{scope:n,context:r,interaction:i,oid:a}=e,{connection:o}=r,{reveal:s}=i,c=s?.anchor.comparison?.kind===`commit`?s.anchor.comparison.parent:1,l=s?.nonce,u;t[0]!==c||t[1]!==l?(u={nonce:l,parent:c},t[0]=c,t[1]=l,t[2]=u):u=t[2];let[d,f]=(0,Z.useState)(u),p=d.nonce===s?.nonce?d.parent:c,[,m]=(0,Z.useTransition)(),h=v2(o,n,a,p),g=`${a}:${p}`,_;t[3]===g?_=t[4]:(_={of:g,shown:25},t[3]=g,t[4]=_);let[v,y]=(0,Z.useState)(_),b=v.of===`${a}:${p}`?v.shown:25,x;t[5]!==a||t[6]!==p||t[7]!==b?(x=()=>y({of:`${a}:${p}`,shown:b+25}),t[5]=a,t[6]=p,t[7]=b,t[8]=x):x=t[8];let S=x,C=h.files.slice(0,b),w=HF(o,n,a,p,C.map(p3)),T;t[9]===w.patches?T=t[10]:(T=e=>w.patches.get(u3(e)),t[9]=w.patches,t[10]=T);let E=T,D;t[11]!==a||t[12]!==p||t[13]!==E?(D=e=>{let t=AF(a,e,E(e));return t==null?[]:[{...t,id:`${t.id}:${p}`,comment:{filePath:t.path,revision:a,comparison:{kind:`commit`,parent:p}}}]},t[11]=a,t[12]=p,t[13]=E,t[14]=D):D=t[14];let O=C.flatMap(D),k;t[15]!==a||t[16]!==E?(k=e=>(AF(a,e,E(e))??null)===null,t[15]=a,t[16]=E,t[17]=k):k=t[17];let A=C.filter(k),j=h.files.length-C.length,M;t[18]!==h.commit||t[19]!==h.files.length||t[20]!==a||t[21]!==p||t[22]!==s?.nonce||t[23]!==m?(M=e=>(0,Q.jsxs)(G4,{title:(0,Q.jsx)(`span`,{className:`font-mono`,children:R$(a)}),subtitle:`${h.files.length} file${h.files.length===1?``:`s`} changed`,children:[h.commit.parentOids.length>1&&(0,Q.jsx)(fQ,{value:String(p),onValueChange:e=>m(()=>f({nonce:s?.nonce,parent:Number(e)})),children:(0,Q.jsx)(mQ,{className:`h-7`,children:h.commit.parentOids.map(f3)})}),(0,Q.jsxs)(X,{size:`sm`,variant:`ghost`,onClick:()=>At(a,`commit id`),children:[(0,Q.jsx)(Qi,{className:`size-3.5`}),`Copy id`]}),(0,Q.jsxs)(X,{size:`sm`,variant:`ghost`,onClick:()=>At(P$(h.commit),`commit message`),children:[(0,Q.jsx)(Qi,{className:`size-3.5`}),`Copy message`]}),e]}),t[18]=h.commit,t[19]=h.files.length,t[20]=a,t[21]=p,t[22]=s?.nonce,t[23]=m,t[24]=M):M=t[24];let N;t[25]!==h||t[26]!==w.failed||t[27]!==w.retry||t[28]!==a||t[29]!==A||t[30]!==E?(N=()=>(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(m3,{commit:h,oid:a,omitted:A,patchOf:E,failed:w.failed,onRetry:w.retry})}),t[25]=h,t[26]=w.failed,t[27]=w.retry,t[28]=a,t[29]=A,t[30]=E,t[31]=N):N=t[31];let P;t[32]!==r||t[33]!==O||t[34]!==i||t[35]!==n||t[36]!==N||t[37]!==M?(P=(0,Q.jsx)(P4,{toolbar:M,scope:n,context:r,interaction:i,entries:O,header:N}),t[32]=r,t[33]=O,t[34]=i,t[35]=n,t[36]=N,t[37]=M,t[38]=P):P=t[38];let F;t[39]!==w.pending||t[40]!==j||t[41]!==S?(F=(0,Q.jsx)(K4,{more:j,pending:w.pending,onReadMore:S}),t[39]=w.pending,t[40]=j,t[41]=S,t[42]=F):F=t[42];let I;return t[43]!==P||t[44]!==F?(I=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[P,F]}),t[43]=P,t[44]=F,t[45]=I):I=t[45],I}function f3(e,t){return(0,Q.jsxs)(hQ,{value:String(t+1),children:[f2(t+1),` parent ·`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:R$(e)})]},e)}function p3(e){return F$(e)}function m3(e){let t=(0,$.c)(33),{commit:n,oid:r,omitted:i,patchOf:a,failed:o,onRetry:s}=e,c;t[0]===n.commit.subject?c=t[1]:(c=(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:n.commit.subject}),t[0]=n.commit.subject,t[1]=c);let l;t[2]===n.commit.body?l=t[3]:(l=n.commit.body!==null&&n.commit.body!==void 0&&(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-caption leading-relaxed text-muted-foreground`,children:n.commit.body}),t[2]=n.commit.body,t[3]=l);let u;t[4]===n.commit.bodyTruncated?u=t[5]:(u=n.commit.bodyTruncated&&(0,Q.jsx)(`p`,{className:`mt-1 text-2xs text-muted-foreground`,children:`Commit message truncated`}),t[4]=n.commit.bodyTruncated,t[5]=u);let d;t[6]===n.commit?d=t[7]:(d=n.commit!==null&&n.commit!==void 0&&(0,Q.jsxs)(`span`,{children:[n.commit.author.name,` ·`,` `,Uo(n.commit.author.timestamp)]}),t[6]=n.commit,t[7]=d);let f;t[8]===r?f=t[9]:(f=(0,Q.jsx)(`span`,{className:`font-mono`,children:r}),t[8]=r,t[9]=f);let p;t[10]!==n.commit.parentOids||t[11]!==n.comparison.baseOid||t[12]!==n.comparison.kind||t[13]!==n.comparison.parentNumber?(p=n.comparison.kind===`parent`?(0,Q.jsxs)(`span`,{children:[`against`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:R$(n.comparison.baseOid)}),n.commit.parentOids.length>1&&` (${f2(n.comparison.parentNumber)} parent of a merge)`]}):(0,Q.jsx)(`span`,{children:`root commit`}),t[10]=n.commit.parentOids,t[11]=n.comparison.baseOid,t[12]=n.comparison.kind,t[13]=n.comparison.parentNumber,t[14]=p):p=t[14];let m;t[15]===n.commit.refs?m=t[16]:(m=n.commit.refs.map(h3),t[15]=n.commit.refs,t[16]=m);let h;t[17]!==d||t[18]!==f||t[19]!==p||t[20]!==m?(h=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-muted-foreground`,children:[d,f,p,m]}),t[17]=d,t[18]=f,t[19]=p,t[20]=m,t[21]=h):h=t[21];let g;t[22]!==o||t[23]!==i||t[24]!==s||t[25]!==a?(g=i.length>0&&(0,Q.jsx)(g3,{changes:i,patchOf:a,failed:o,onRetry:s}),t[22]=o,t[23]=i,t[24]=s,t[25]=a,t[26]=g):g=t[26];let _;return t[27]!==c||t[28]!==l||t[29]!==u||t[30]!==h||t[31]!==g?(_=(0,Q.jsxs)(`section`,{className:`mx-4 mt-3 rounded-xl border px-4 py-3`,children:[c,l,u,h,g]}),t[27]=c,t[28]=l,t[29]=u,t[30]=h,t[31]=g,t[32]=_):_=t[32],_}function h3(e){return(0,Q.jsx)(os,{title:e,variant:`secondary`,className:`h-4`,children:z$(e)},e)}function g3(e){let t=(0,$.c)(15),{changes:n,patchOf:r,failed:i,onRetry:a}=e,o;t[0]!==i||t[1]!==a?(o=i&&(0,Q.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-xs text-muted-foreground`,children:[`Some patches could not be read.`,(0,Q.jsx)(X,{size:`xs`,variant:`outline`,onClick:a,children:`Try again`})]}),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s;if(t[3]!==n||t[4]!==i||t[5]!==r){let e;t[7]!==i||t[8]!==r?(e=e=>{let t=I$(e),n=r(e),a=RN(e),o=UN(e,n,i)??`No code change`;return(0,Q.jsxs)(`li`,{className:`rounded-lg border bg-muted/25 px-3 py-2 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate font-mono font-medium`,children:t}),(0,Q.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.status,` · `,o]})]}),a&&n?.kind===`text`&&(0,Q.jsx)(`pre`,{className:`mt-1 overflow-x-auto whitespace-pre-wrap font-mono text-2xs text-muted-foreground`,children:n.patch.split(`
1377
+ `).filter(v3).map(_3).join(`
1378
+ `)})]},`${e.oldPath}->${e.newPath}:${e.status}`)},t[7]=i,t[8]=r,t[9]=e):e=t[9],s=n.map(e),t[3]=n,t[4]=i,t[5]=r,t[6]=s}else s=t[6];let c;t[10]===s?c=t[11]:(c=(0,Q.jsx)(`ul`,{className:`mt-3 space-y-1.5`,"aria-label":`Changes without code preview`,children:s}),t[10]=s,t[11]=c);let l;return t[12]!==o||t[13]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[o,c]}),t[12]=o,t[13]=c,t[14]=l):l=t[14],l}function _3(e){return e.slice(1)}function v3(e){return/^[+-]Subproject commit /.test(e)}function y3(e,t,n){if(t===``)return[];let r=t.toLocaleLowerCase(),i=[],a=e.split(`
1379
+ `);for(let[e,t]of a.entries()){let a=t.toLocaleLowerCase(),o=a.indexOf(r);for(;o!==-1;){if(i.length===n)return i;i.push({line:e+1,column:o}),o=a.indexOf(r,o+r.length)}}return i}function b3(e,t){return Math.max(0,Math.min(e,t-1))}function x3(e,t,n){return t===0?0:(b3(e,t)+n+t)%t}function S3(e,t,n){if(t===0)return`No results`;let r=t===n?`+`:``;return`${b3(e,t)+1} of ${t}${r}`}function C3(e){let t=(0,$.c)(56),{text:n,focusRequest:r,onReveal:i,onClose:a}=e,[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(0),u;t[0]!==o||t[1]!==n?(u=y3(n,o,H),t[0]=o,t[1]=n,t[2]=u):u=t[2];let d=u,[f,p]=(0,Z.useState)(),m;t[3]!==d||t[4]!==i?(m=(e,t)=>{let n=t===void 0?d:t;l(e);let r=n[e];r&&i(r.line)},t[3]=d,t[4]=i,t[5]=m):m=t[5];let h=m,g;t[6]!==c||t[7]!==d.length||t[8]!==h?(g=e=>h(x3(c,d.length,e)),t[6]=c,t[7]=d.length,t[8]=h,t[9]=g):g=t[9];let _=g,v;t[10]===a?v=t[11]:(v=e=>{e.key===`Escape`&&(e.preventDefault(),a())},t[10]=a,t[11]=v);let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(dH,{children:(0,Q.jsx)(Pp,{})}),t[12]=y):y=t[12];let b;t[13]!==r||t[14]!==f?(b=e=>{e&&f!==r&&(e.focus(),e.select(),p(r))},t[13]=r,t[14]=f,t[15]=b):b=t[15];let x;t[16]!==h||t[17]!==n?(x=e=>{s(e.target.value),h(0,y3(n,e.target.value,H))},t[16]=h,t[17]=n,t[18]=x):x=t[18];let S;t[19]===_?S=t[20]:(S=e=>{e.key===`Enter`&&(e.preventDefault(),_(e.shiftKey?-1:1))},t[19]=_,t[20]=S);let C;t[21]!==o||t[22]!==b||t[23]!==x||t[24]!==S?(C=(0,Q.jsx)(hH,{ref:b,"aria-label":`Find in file`,placeholder:`Find in file`,value:o,onChange:x,onKeyDown:S}),t[21]=o,t[22]=b,t[23]=x,t[24]=S,t[25]=C):C=t[25];let w;t[26]!==c||t[27]!==d.length||t[28]!==o?(w=o!==``&&(0,Q.jsx)(mH,{role:`status`,children:S3(c,d.length,1e4)}),t[26]=c,t[27]=d.length,t[28]=o,t[29]=w):w=t[29];let T=d.length===0,E;t[30]===_?E=t[31]:(E=()=>_(-1),t[30]=_,t[31]=E);let D;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(Aa,{}),t[32]=D):D=t[32];let O;t[33]!==T||t[34]!==E?(O=(0,Q.jsx)(pH,{size:`icon-xs`,"aria-label":`Previous match`,disabled:T,onClick:E,children:D}),t[33]=T,t[34]=E,t[35]=O):O=t[35];let k=d.length===0,A;t[36]===_?A=t[37]:(A=()=>_(1),t[36]=_,t[37]=A);let j;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(Na,{}),t[38]=j):j=t[38];let M;t[39]!==k||t[40]!==A?(M=(0,Q.jsx)(pH,{size:`icon-xs`,"aria-label":`Next match`,disabled:k,onClick:A,children:j}),t[39]=k,t[40]=A,t[41]=M):M=t[41];let N;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(hl,{}),t[42]=N):N=t[42];let P;t[43]===a?P=t[44]:(P=(0,Q.jsx)(pH,{size:`icon-xs`,"aria-label":`Close find`,onClick:a,children:N}),t[43]=a,t[44]=P);let F;t[45]!==w||t[46]!==O||t[47]!==M||t[48]!==P?(F=(0,Q.jsxs)(dH,{align:`inline-end`,children:[w,O,M,P]}),t[45]=w,t[46]=O,t[47]=M,t[48]=P,t[49]=F):F=t[49];let I;t[50]!==F||t[51]!==C?(I=(0,Q.jsxs)(lH,{className:`w-full max-w-sm`,children:[y,C,F]}),t[50]=F,t[51]=C,t[52]=I):I=t[52];let L;return t[53]!==I||t[54]!==v?(L=(0,Q.jsx)(`div`,{role:`search`,className:`flex shrink-0 justify-end border-b px-3 py-1.5`,onKeyDown:v,children:I}),t[53]=I,t[54]=v,t[55]=L):L=t[55],L}function w3(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=Cw(e.path)?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-auto`,children:[(0,Q.jsx)(A3,{path:e.path,copy:!1,children:(0,Q.jsxs)(QQ,{className:`max-w-full flex-wrap justify-end`,children:[(0,Q.jsx)(j3,{path:e.path,onOpen:e.onOpen}),(0,Q.jsx)(M3,{path:e.path})]})}),(0,Q.jsx)(ww,{scope:e.scope,path:e.path,connection:e.context.connection})]}):(0,Q.jsx)(T3,{...e}),t[0]=e,t[1]=n),n}function T3(e){let t=(0,$.c)(16),n;t[0]===e.path?n=t[1]:(n=e.path.split(`/`).slice(0,-1).join(`/`),t[0]=e.path,t[1]=n);let r=n,{connection:i}=e.context,a=Bj(i,e.scope,r),o;t[2]===e.path?o=t[3]:(o=e.path.split(`/`).at(-1),t[2]=e.path,t[3]=o);let s=o,c;if(t[4]!==a.entries||t[5]!==s){let e;t[7]===s?e=t[8]:(e=e=>e.name===s,t[7]=s,t[8]=e),c=a.entries.find(e),t[4]=a.entries,t[5]=s,t[6]=c}else c=t[6];let l=c;if(l?.kind===`symlink`){let n=`Not followed: symlink to ${l.target??`an unknown target`}`,r;return t[9]!==e.path||t[10]!==n?(r=(0,Q.jsx)(E3,{path:e.path,message:n}),t[9]=e.path,t[10]=n,t[11]=r):r=t[11],r}if(l?.kind===`submodule`){let n;return t[12]===e.path?n=t[13]:(n=(0,Q.jsx)(E3,{path:e.path,message:`Not followed: submodule`}),t[12]=e.path,t[13]=n),n}let u;return t[14]===e?u=t[15]:(u=(0,Q.jsx)(D3,{...e}),t[14]=e,t[15]=u),u}function E3(e){let t=(0,$.c)(7),{path:n,message:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(A3,{path:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(`div`,{className:`grid min-h-48 flex-1 place-items-center p-6`,children:(0,Q.jsx)(t3,{title:`Not shown`,description:r})}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function D3(e){let t=(0,$.c)(19),{scope:n,context:r,interaction:i,path:a,onOpen:o}=e,{connection:s}=r,c=Aj(s,n,a),l=`kind`in c,{draft:u,state:d,reset:f}=ou(s,n,a,l?``:c.text,l?``:c.contentFingerprint??``);if(l&&d.owner===null&&d.text===d.savedText){let e;return t[0]!==c.reason||t[1]!==a?(e=(0,Q.jsx)(E3,{path:a,message:c.reason}),t[0]=c.reason,t[1]=a,t[2]=e):e=t[2],e}let p;t[3]===l?p=t[4]:(p=l&&(0,Q.jsx)(`p`,{role:`alert`,className:`border-b bg-graph-4/10 px-3.5 py-2 text-xs text-graph-4`,children:`The file is no longer readable. Your unsaved draft is still available below.`}),t[3]=l,t[4]=p);let m=l?d.savedText:c.text,h=l?d.fingerprint:c.contentFingerprint,g;t[5]!==r||t[6]!==u||t[7]!==i||t[8]!==o||t[9]!==a||t[10]!==f||t[11]!==n||t[12]!==d||t[13]!==m||t[14]!==h?(g=(0,Q.jsx)(O3,{scope:n,context:r,interaction:i,path:a,text:m,contentFingerprint:h,draft:u,draftState:d,reset:f,onOpen:o}),t[5]=r,t[6]=u,t[7]=i,t[8]=o,t[9]=a,t[10]=f,t[11]=n,t[12]=d,t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;return t[16]!==p||t[17]!==g?(_=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[p,g]}),t[16]=p,t[17]=g,t[18]=_):_=t[18],_}function O3(e){let t=(0,$.c)(71),{scope:n,context:r,interaction:i,path:a,text:o,contentFingerprint:s,draft:c,draftState:l,reset:u,onOpen:d}=e,{preferences:f}=Cl(),{connection:p}=r,m=CF(n,p),h;t[0]===a?h=t[1]:(h=N3(a),t[0]=a,t[1]=h);let g=h,_;if(t[2]!==m.changes||t[3]!==a){let e;t[5]===a?e=t[6]:(e=e=>e.path===a,t[5]=a,t[6]=e),_=m.changes.some(e),t[2]=m.changes,t[3]=a,t[4]=_}else _=t[4];let v=_,y;t[7]!==g||t[8]!==f?(y=()=>P3(g,f),t[7]=g,t[8]=f,t[9]=y):y=t[9];let[b,x]=(0,Z.useState)(y),{reveal:S,active:C}=i,[w,T]=(0,Z.useState)();S&&w!==S.nonce&&S.anchor.comparison?.kind===`file`&&S.anchor.filePath===a&&(T(S.nonce),x(`source`));let[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(),[A,j]=(0,Z.useState)(),M=(0,Z.useId)();LZ(c,M,s);let N=g===`code`||b===`source`,P;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>k(Date.now()),t[10]=P):P=t[10];let F=C&&N&&!E,I;t[11]===F?I=t[12]:(I={enabled:F,ignoreInputs:!1,conflictBehavior:`allow`},t[11]=F,t[12]=I),xu(Il.findInFile,P,I);let L=l.diskChanged.has(M)?`Changed on disk just now`:``,R;t[13]===L?R=t[14]:(R=(0,Q.jsx)(`span`,{"aria-live":`polite`,className:`hidden text-xs text-muted-foreground xl:inline`,children:L}),t[13]=L,t[14]=R);let z;t[15]!==g||t[16]!==b?(z=g!==`code`&&(0,Q.jsx)(fQ,{value:b,onValueChange:e=>{(e===`rendered`||e===`source`)&&x(e)},children:(0,Q.jsxs)(mQ,{className:`h-7`,children:[(0,Q.jsx)(hQ,{value:`rendered`,children:g===`markdown`?`Reader`:`Preview`}),(0,Q.jsx)(hQ,{value:`source`,children:`Source`})]})}),t[15]=g,t[16]=b,t[17]=z):z=t[17];let B;t[18]!==R||t[19]!==z?(B=(0,Q.jsxs)(Q.Fragment,{children:[R,z]}),t[18]=R,t[19]=z,t[20]=B):B=t[20];let V=B,H;t[21]!==s||t[22]!==c||t[23]!==l.owner||t[24]!==l.savedText||t[25]!==l.text||t[26]!==M?(H=s&&(0,Q.jsxs)(X,{variant:`ghost`,size:`xs`,disabled:l.owner!==null&&l.owner!==M,title:l.owner&&l.owner!==M?`Editing in another pane`:void 0,onClick:()=>{c.claim(M)&&D(!0)},children:[(0,Q.jsx)(_p,{}),(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:l.text===l.savedText?`Edit`:`Resume edit`})]}),t[21]=s,t[22]=c,t[23]=l.owner,t[24]=l.savedText,t[25]=l.text,t[26]=M,t[27]=H):H=t[27];let U;t[28]!==v||t[29]!==d||t[30]!==a?(U=v&&(0,Q.jsxs)(X,{variant:`ghost`,size:`xs`,onClick:()=>d({kind:`change`,path:a}),children:[(0,Q.jsx)(_f,{}),(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:`Open diff`})]}),t[28]=v,t[29]=d,t[30]=a,t[31]=U):U=t[31];let W;t[32]!==d||t[33]!==a?(W=(0,Q.jsx)(j3,{path:a,onOpen:d}),t[32]=d,t[33]=a,t[34]=W):W=t[34];let G;t[35]===a?G=t[36]:(G=(0,Q.jsx)(M3,{path:a}),t[35]=a,t[36]=G);let ee;t[37]!==H||t[38]!==U||t[39]!==W||t[40]!==G?(ee=(0,Q.jsxs)(Q.Fragment,{children:[H,U,W,G]}),t[37]=H,t[38]=U,t[39]=W,t[40]=G,t[41]=ee):ee=t[41];let te=ee;if(E){let e;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>D(!1),t[42]=e):e=t[42];let n;t[43]!==s||t[44]!==u||t[45]!==o?(n=()=>{u(o,s??``),D(!1)},t[43]=s,t[44]=u,t[45]=o,t[46]=n):n=t[46];let r;t[47]===a?r=t[48]:(r=e=>(0,Q.jsx)(A3,{path:a,children:e}),t[47]=a,t[48]=r);let i;return t[49]!==C||t[50]!==v||t[51]!==c||t[52]!==l||t[53]!==M||t[54]!==a||t[55]!==n||t[56]!==r?(i=(0,Q.jsx)(Nj,{owner:M,path:a,draft:c,state:l,active:C,changed:v,onDone:e,onDiscard:n,renderToolbar:r}),t[49]=C,t[50]=v,t[51]=c,t[52]=l,t[53]=M,t[54]=a,t[55]=n,t[56]=r,t[57]=i):i=t[57],i}let K;return t[58]!==te||t[59]!==s||t[60]!==r||t[61]!==O||t[62]!==A||t[63]!==i||t[64]!==g||t[65]!==V||t[66]!==b||t[67]!==a||t[68]!==n||t[69]!==o?(K=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-card`,children:b===`rendered`&&g!==`code`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(A3,{path:a,copy:!1,children:[V,(0,Q.jsx)(QQ,{className:`max-w-full flex-wrap justify-end`,children:te})]}),(0,Q.jsx)(k3,{scope:n,context:r,path:a,kind:g,text:o})]}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[O!==void 0&&(0,Q.jsx)(C3,{text:o,focusRequest:O,onReveal:e=>j({line:e,nonce:Date.now()}),onClose:()=>k(void 0)}),(0,Q.jsx)(P4,{scope:n,context:r,interaction:i,headerLeading:V,headerActions:te,...A===void 0?{}:{foundLine:A},entries:[{...Y2(`file:${a}`,a,o),...s?{comment:{filePath:a,comparison:{kind:`file`},contentFingerprint:s}}:{}}]})]})}),t[58]=te,t[59]=s,t[60]=r,t[61]=O,t[62]=A,t[63]=i,t[64]=g,t[65]=V,t[66]=b,t[67]=a,t[68]=n,t[69]=o,t[70]=K):K=t[70],K}function k3(e){let t=(0,$.c)(8),{scope:n,context:r,path:i,kind:a,text:o}=e;if(a===`markdown`){let e;return t[0]===o?e=t[1]:(e=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,Q.jsx)(Dj,{text:o,className:`mx-auto max-w-[78ch] px-6 py-6`})}),t[0]=o,t[1]=e),e}let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(`p`,{className:`border-b bg-muted/40 px-3.5 py-1.5 text-2xs text-muted-foreground`,children:`Sandboxed preview: scripts run, and cannot read Porcelain, your cookies or the review API, load anything from the network, submit a form, or move the page around them. A script can still send what it sees out by sending this frame to another address.`}),t[2]=s):s=t[2];let c;return t[3]!==r.connection||t[4]!==i||t[5]!==n||t[6]!==o?(c=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,children:[s,(0,Q.jsx)(zj,{scope:n,path:i,html:o,connection:r.connection})]}),t[3]=r.connection,t[4]=i,t[5]=n,t[6]=o,t[7]=c):c=t[7],c}function A3(e){let t=(0,$.c)(24),{path:n,children:r,copy:i}=e,a=i===void 0||i,o=n.lastIndexOf(`/`)+1,s;t[0]!==n||t[1]!==o?(s=n.slice(0,o),t[0]=n,t[1]=o,t[2]=s):s=t[2];let c=s,l;t[3]!==n||t[4]!==o?(l=n.slice(o),t[3]=n,t[4]=o,t[5]=l):l=t[5];let u=l,d;t[6]===n?d=t[7]:(d=(0,Q.jsx)(mw,{path:n,className:`size-4 shrink-0`}),t[6]=n,t[7]=d);let f;t[8]===c?f=t[9]:(f=c&&(0,Q.jsx)(`span`,{className:`truncate font-normal text-muted-foreground`,children:c}),t[8]=c,t[9]=f);let p;t[10]===u?p=t[11]:(p=(0,Q.jsx)(`span`,{className:`shrink-0`,children:u}),t[10]=u,t[11]=p);let m;t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[d,f,p]}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==a||t[17]!==n?(h=a&&(0,Q.jsx)(M3,{path:n}),t[16]=a,t[17]=n,t[18]=h):h=t[18];let g;return t[19]!==r||t[20]!==n||t[21]!==m||t[22]!==h?(g=(0,Q.jsxs)(G4,{titleLabel:n,title:m,children:[r,h]}),t[19]=r,t[20]=n,t[21]=m,t[22]=h,t[23]=g):g=t[23],g}function j3(e){let t=(0,$.c)(7),{path:n,onOpen:r}=e,i;t[0]!==r||t[1]!==n?(i=()=>r({kind:`timeline`,path:n}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Ap,{}),o=(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:`Timeline`}),t[3]=a,t[4]=o):(a=t[3],o=t[4]);let s;return t[5]===i?s=t[6]:(s=(0,Q.jsxs)(X,{variant:`ghost`,size:`xs`,"aria-label":`Timeline`,title:`Timeline`,onClick:i,children:[a,o]}),t[5]=i,t[6]=s),s}function M3(e){let t=(0,$.c)(6),{path:n}=e,r;t[0]===n?r=t[1]:(r=()=>At(n,`path`),t[0]=n,t[1]=r);let i,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Qi,{}),a=(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:`Copy path`}),t[2]=i,t[3]=a):(i=t[2],a=t[3]);let o;return t[4]===r?o=t[5]:(o=(0,Q.jsxs)(X,{variant:`ghost`,size:`xs`,"aria-label":`Copy path`,title:`Copy path`,onClick:r,children:[i,a]}),t[4]=r,t[5]=o),o}function N3(e){let t=e.toLowerCase();return t.endsWith(`.md`)||t.endsWith(`.mdx`)?`markdown`:t.endsWith(`.html`)||t.endsWith(`.htm`)?`html`:`code`}function P3(e,t){return e===`markdown`?t.markdownDefault===`reader`?`rendered`:`source`:e===`html`&&t.htmlDefault===`preview`?`rendered`:`source`}function F3(e,t){let n=n=>{if(n.source!==e.contentWindow)return;let r=RR(n.data);r!==null&&t(r)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}var I3=(e,t)=>fetch(e,{...t,credentials:`same-origin`,redirect:`error`,cache:`no-store`});function L3(e){let t=e.toLowerCase().lastIndexOf(`</body>`),n=t===-1?e.length:t,r=e.lastIndexOf(`<style id="porcelain-theme">`,n),i=(r===-1?e:e.slice(0,r)+e.slice(n)).trim();return i.length>0&&i!==`<!doctype html><html><body></body></html>`}function R3(e,t,n){let r=(0,$.c)(15),i,a,o;r[0]!==t.connection||r[1]!==e||r[2]!==n?(o=IR(n,t.connection.address,tr()),i=at,a=iV({connection:t.connection,scope:e,summary:n,delivery:{url:o,transport:I3}}),r[0]=t.connection,r[1]=e,r[2]=n,r[3]=i,r[4]=a,r[5]=o):(i=r[3],a=r[4],o=r[5]);let s=i(a),c,l,u;if(r[6]!==s||r[7]!==o){let e=Gn(ar(s));c=s,l=o,u=e!==void 0&&L3(e),r[6]=s,r[7]=o,r[8]=c,r[9]=l,r[10]=u}else c=r[8],l=r[9],u=r[10];let d;return r[11]!==c||r[12]!==l||r[13]!==u?(d={result:c,url:l,available:u},r[11]=c,r[12]=l,r[13]=u,r[14]=d):d=r[14],d}var z3=It(e=>Er(t=>{if(!e)return;let n=URL.createObjectURL(new Blob([TR(e)],{type:e.mediaType}));return t.addFinalizer(()=>URL.revokeObjectURL(n)),n}));function B3(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=z3(e),t[0]=e,t[1]=n),at(n)}function V3(e,t,n){let r=(0,$.c)(4),i;return r[0]!==t.connection||r[1]!==n||r[2]!==e?(i=e.review?CV({...e.review,connection:t.connection,proofId:n}):oV({scope:e,connection:t.connection,proofId:n}),r[0]=t.connection,r[1]=n,r[2]=e,r[3]=i):i=r[3],at(i)}function H3(e,t,n){let r=t.find(t=>t.id===e.layerId);if(!r)return;let i=r.steps.find(t=>t.id===e.stepId);return n?i?.title:i?`${r.title} · ${i.title}`:r.title}function U3(e){let t=(0,$.c)(13),{scope:n,context:r,proof:i,layers:a,inLayer:o}=e,s=o!==void 0&&o,c;t[0]!==s||t[1]!==a||t[2]!==i.checks?(c=i.checks.length>0&&(0,Q.jsxs)(`section`,{"aria-label":`Checks`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground`,children:`Checks`}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:xR(i.checks).map((e,t)=>(0,Q.jsx)(G3,{check:e,target:H3(e,a,s)},`${e.result}:${e.name}:${t}`))})]}),t[0]=s,t[1]=a,t[2]=i.checks,t[3]=c):c=t[3];let l;t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==i.assets||t[8]!==n?(l=i.assets.length>0&&(0,Q.jsxs)(`section`,{"aria-label":`Attachments`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground`,children:`Attachments`}),(0,Q.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2`,children:i.assets.map(e=>(0,Q.jsx)(`li`,{className:`min-w-0`,children:(0,Q.jsx)(K3,{scope:n,context:r,asset:e,target:H3(e,a,s)})},e.id))})]}),t[4]=r,t[5]=s,t[6]=a,t[7]=i.assets,t[8]=n,t[9]=l):l=t[9];let u;return t[10]!==c||t[11]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[c,l]}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u}function W3(e){return e===`pass`?ac:e===`fail`?Qd:Xd}function G3(e){let t=(0,$.c)(36),{check:n,target:r}=e,i=n.result===`fail`,a;t[0]===n.result?a=t[1]:(a=W3(n.result),t[0]=n.result,t[1]=a);let o=a,s=n.name,c;t[2]===n.result?c=t[3]:(c=wR(n.result),t[2]=n.result,t[3]=c);let l=`${s}: ${c}`,u=n.result,d=i&&`border-destructive/50 bg-destructive/5`,f;t[4]===d?f=t[5]:(f=Y(`rounded-lg border px-3 py-2`,d),t[4]=d,t[5]=f);let p=n.result===`pass`&&`text-graph-2`,m=i&&`text-destructive`,h;t[6]!==p||t[7]!==m?(h=Y(`size-4 shrink-0`,p,m),t[6]=p,t[7]=m,t[8]=h):h=t[8];let g;t[9]!==o||t[10]!==h?(g=(0,Q.jsx)(o,{"aria-hidden":!0,className:h}),t[9]=o,t[10]=h,t[11]=g):g=t[11];let _;t[12]===n.name?_=t[13]:(_=(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:n.name}),t[12]=n.name,t[13]=_);let v=i?`font-medium text-destructive`:`text-muted-foreground`,y;t[14]===v?y=t[15]:(y=Y(`shrink-0 text-xs`,v),t[14]=v,t[15]=y);let b;t[16]===n.result?b=t[17]:(b=wR(n.result),t[16]=n.result,t[17]=b);let x;t[18]!==y||t[19]!==b?(x=(0,Q.jsx)(`span`,{className:y,children:b}),t[18]=y,t[19]=b,t[20]=x):x=t[20];let S;t[21]!==g||t[22]!==_||t[23]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[g,_,x]}),t[21]=g,t[22]=_,t[23]=x,t[24]=S):S=t[24];let C;t[25]===r?C=t[26]:(C=r&&(0,Q.jsx)(`p`,{className:`mt-0.5 truncate pl-6 text-xs text-muted-foreground`,children:r}),t[25]=r,t[26]=C);let w;t[27]===n.output?w=t[28]:(w=n.output&&(0,Q.jsx)(`pre`,{className:`mt-2 max-h-48 overflow-auto rounded-md bg-muted p-2 font-mono text-xs whitespace-pre-wrap`,children:n.output}),t[27]=n.output,t[28]=w);let T;return t[29]!==n.result||t[30]!==S||t[31]!==C||t[32]!==w||t[33]!==l||t[34]!==f?(T=(0,Q.jsxs)(`li`,{"aria-label":l,"data-result":u,className:f,children:[S,C,w]}),t[29]=n.result,t[30]=S,t[31]=C,t[32]=w,t[33]=l,t[34]=f,t[35]=T):T=t[35],T}function K3(e){let t=(0,$.c)(34),{scope:n,context:r,asset:i,target:a}=e,o;t[0]===i.title?o=t[1]:(o=(0,Q.jsx)(`span`,{className:`truncate text-sm`,children:i.title}),t[0]=i.title,t[1]=o);let s;t[2]===a?s=t[3]:(s=a&&(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:a}),t[2]=a,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Q.jsxs)(`figcaption`,{className:`flex min-w-0 flex-col px-1 pt-1.5`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l=c;if(i.kind===`link`){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(lf,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),t[7]=e):e=t[7];let n;t[8]===i.title?n=t[9]:(n=(0,Q.jsx)(`span`,{className:`truncate`,children:i.title}),t[8]=i.title,t[9]=n);let r;t[10]!==i.url||t[11]!==n?(r=(0,Q.jsxs)(`a`,{href:i.url,target:`_blank`,rel:`noopener noreferrer`,className:`flex min-w-0 items-center gap-1.5 px-1 text-sm underline-offset-2 hover:underline`,children:[e,n]}),t[10]=i.url,t[11]=n,t[12]=r):r=t[12];let o;t[13]===i.url?o=t[14]:(o=ER(i.url),t[13]=i.url,t[14]=o);let s;t[15]===o?s=t[16]:(s=(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:o}),t[15]=o,t[16]=s);let c;t[17]===a?c=t[18]:(c=a&&(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:a}),t[17]=a,t[18]=c);let l;t[19]!==s||t[20]!==c?(l=(0,Q.jsxs)(`figcaption`,{className:`flex min-w-0 flex-col px-1 pt-0.5`,children:[s,c]}),t[19]=s,t[20]=c,t[21]=l):l=t[21];let u;return t[22]!==l||t[23]!==r?(u=(0,Q.jsxs)(`figure`,{className:`rounded-lg border p-2`,children:[r,l]}),t[22]=l,t[23]=r,t[24]=u):u=t[24],u}let u=i.kind===`video`,d;t[25]!==i.id||t[26]!==i.title||t[27]!==r||t[28]!==n||t[29]!==u?(d=(0,Q.jsx)(q3,{scope:n,context:r,id:i.id,title:i.title,video:u}),t[25]=i.id,t[26]=i.title,t[27]=r,t[28]=n,t[29]=u,t[30]=d):d=t[30];let f;return t[31]!==l||t[32]!==d?(f=(0,Q.jsxs)(`figure`,{className:`rounded-lg border p-2`,children:[d,l]}),t[31]=l,t[32]=d,t[33]=f):f=t[33],f}function q3(e){let t=(0,$.c)(9),{scope:n,context:r,id:i,title:a,video:o}=e,s=V3(n,r,i),c;t[0]===s?c=t[1]:(c=Gn(ar(s)),t[0]=s,t[1]=c);let l=B3(c);if(st(s)){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-muted-foreground`,children:`This attachment could not be loaded.`}),t[2]=e):e=t[2],e}if(l===void 0){let e=o?`video`:`image`,n;return t[3]===e?n=t[4]:(n=(0,Q.jsxs)(`p`,{role:`status`,className:`p-3 text-xs text-muted-foreground`,children:[`Loading `,e,`…`]}),t[3]=e,t[4]=n),n}let u;return t[5]!==a||t[6]!==l||t[7]!==o?(u=o?(0,Q.jsx)(`video`,{controls:!0,"aria-label":a,src:l,className:`max-h-80 w-full rounded-md bg-muted`}):(0,Q.jsx)(`img`,{src:l,alt:a,className:`max-h-80 w-full rounded-md bg-muted object-contain`}),t[5]=a,t[6]=l,t[7]=o,t[8]=u):u=t[8],u}function J3(e){let t=(0,$.c)(28),{revision:n,scope:r,context:i,onStart:a}=e,o,s,c,l,u,d,f,p;if(t[0]!==i||t[1]!==n||t[2]!==r){o=Ez(n),s=`Verdict`,c=`mx-auto flex w-full max-w-3xl flex-col gap-6 px-4 py-6 sm:px-6`,l=(0,Q.jsxs)(t6,{title:`Asked`,children:[(0,Q.jsx)(`p`,{className:`text-sm whitespace-pre-wrap`,children:o.asked.text}),(0,Q.jsx)(`ul`,{className:`flex flex-wrap gap-3`,children:o.asked.links.map(Q3)})]});let e=o.recommendation.value===`hold`?`border-graph-4/60 bg-graph-4/5`:`border-graph-2/50 bg-graph-2/5`,a;t[11]===e?a=t[12]:(a=Y(`rounded-xl border p-4`,e),t[11]=e,t[12]=a);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(os,{variant:`outline`,className:`mr-2`,children:`Recommendation`}),t[13]=m):m=t[13],u=(0,Q.jsxs)(`div`,{className:a,children:[(0,Q.jsxs)(`h2`,{className:`mb-2 text-lg font-semibold`,children:[m,o.recommendation.label]}),(0,Q.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-sm`,children:o.recommendation.reasons.map(Z3)})]}),d=(0,Q.jsxs)(t6,{title:`Proven at ${o.proven.shortHead}`,children:[(0,Q.jsx)(U3,{scope:r,context:i,proof:{checks:o.proven.checks,assets:o.proven.assets,current:!0},layers:n.content.layers}),o.proven.checks.length+o.proven.assets.length===0&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No proof attached.`})]});let h=o.notProven.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing listed.`}):(0,Q.jsx)(`ul`,{className:`space-y-2 text-sm`,children:o.notProven.map(X3)});t[14]===h?f=t[15]:(f=(0,Q.jsx)(t6,{title:`Not proven`,children:h}),t[14]=h,t[15]=f),p=(o.removed.fileCount>0||o.removed.groups.length>0)&&(0,Q.jsxs)(`section`,{"aria-label":`Removed`,className:`rounded-xl border-2 border-destructive bg-destructive/5 p-4`,children:[(0,Q.jsxs)(`h2`,{className:`mb-3 text-sm font-semibold text-destructive`,children:[`Removed · `,o.removed.fileCount,` `,o.removed.fileCount===1?`file`:`files`]}),o.removed.groups.map(Y3),o.removed.unexplainedPaths.length>0&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-semibold text-destructive`,children:`No removal explanation supplied`}),(0,Q.jsx)($3,{paths:o.removed.unexplainedPaths})]})]}),t[0]=i,t[1]=n,t[2]=r,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p}else o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10];let m;t[16]!==a||t[17]!==o.startHere?(m=o.startHere&&(0,Q.jsx)(X,{className:`h-auto max-w-full min-w-0 self-start text-left whitespace-normal`,onClick:()=>o.startHere&&a(o.startHere.layerId),children:(0,Q.jsxs)(`span`,{className:`min-w-0 wrap-anywhere`,children:[`Start here · `,o.startHere.title,` →`]})}),t[16]=a,t[17]=o.startHere,t[18]=m):m=t[18];let h;return t[19]!==s||t[20]!==c||t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f||t[25]!==p||t[26]!==m?(h=(0,Q.jsxs)(`section`,{"aria-label":s,className:c,children:[l,u,d,f,p,m]}),t[19]=s,t[20]=c,t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=p,t[26]=m,t[27]=h):h=t[27],h}function Y3(e,t){return(0,Q.jsxs)(`div`,{className:`mb-3 text-sm`,children:[(0,Q.jsx)(`p`,{className:`font-semibold`,children:e.behavior}),(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:e.why}),(0,Q.jsx)($3,{paths:e.paths})]},t)}function X3(e,t){return(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`strong`,{children:e.what}),(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.why]})]},t)}function Z3(e,t){return(0,Q.jsx)(`li`,{children:e},t)}function Q3(e){return(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`a`,{className:`text-sm break-all underline underline-offset-2`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:e.title})},e.url)}function $3(e){let t=(0,$.c)(4),{paths:n}=e,r;t[0]===n?r=t[1]:(r=n.map(e6),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1 font-mono text-xs break-all`,children:r}),t[2]=r,t[3]=i),i}function e6(e){return(0,Q.jsxs)(`li`,{children:[`− `,e]},e)}function t6(e){let t=(0,$.c)(5),{title:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function n6(e){let t=(0,$.c)(11),{part:n,action:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Jc,{className:`mt-0.5 size-4 shrink-0 text-graph-4`}),t[0]=i):i=t[0];let a;t[1]===n.label?a=t[2]:(a=(0,Q.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Needs your decision · `,n.label]}),t[1]=n.label,t[2]=a);let o;t[3]===n.problem?o=t[4]:(o=(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.problem}),t[3]=n.problem,t[4]=o);let s;t[5]!==a||t[6]!==o?(s=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7];let c;return t[8]!==r||t[9]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-graph-4/40 bg-graph-4/5 p-3`,children:[i,s,r]}),t[8]=r,t[9]=s,t[10]=c):c=t[10],c}function r6(e){let t=(0,$.c)(107),{review:n,stops:r,items:i,decisions:a,done:s,onGo:c,onOpen:l}=e,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==a||t[1]!==s||t[2]!==i||t[3]!==c||t[4]!==n||t[5]!==r){let e=r.filter(s6),l=r.filter(o6),D;t[23]!==i||t[24]!==r?(D=gz(r.flatMap(a6),i),t[23]=i,t[24]=r,t[25]=D):D=t[25];let O=D,k=e.filter(s).length,A=[...e,...l].find(e=>!s(e)),j=Sz(n),M;t[26]===a?M=t[27]:(M=e=>a.get(e.layer.id)?.stale,t[26]=a,t[27]=M);let N=e.filter(M).length,P;t[28]===r?P=t[29]:(P=r.find(i6),t[28]=r,t[29]=P);let F=P,I=bR(n.proof),L=j.questions.length>0?[`${j.questions.length} to decide`]:[],R;t[30]===N?R=t[31]:(R=N>0?[`${N} moved`]:[],t[30]=N,t[31]=R);let z;t[32]===F?z=t[33]:(z=F?[`unexplained changes`]:[],t[32]=F,t[33]=z);let B;t[34]!==L||t[35]!==R||t[36]!==z?(B=[...L,...R,...z],t[34]=L,t[35]=R,t[36]=z,t[37]=B):B=t[37];let V=B,H=j.added.length+j.changed.length+j.removed.length>0;g=`shrink-0`,_=`Briefing`,v=`region`,f=`mx-auto flex max-w-3xl flex-col gap-9 px-6 pt-8 pb-16`;let U;t[38]===n.revision?U=t[39]:(U=(0,Q.jsxs)(`p`,{className:`text-2xs font-medium tracking-wide text-muted-foreground uppercase`,children:[`Briefing · revision `,n.revision]}),t[38]=n.revision,t[39]=U);let W;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground text-pretty`,children:`Read each decision through its code and mark it reviewed. Every changed file belongs to exactly one stop, and changes no decision explains come last, so finishing the walkthrough means nothing was left out.`}),t[40]=W):W=t[40];let G=`${O.reviewed} / ${O.total}`,ee=O.total===0?0:O.reviewed/O.total,te;t[41]!==G||t[42]!==ee?(te=(0,Q.jsx)(l6,{label:`Files reviewed`,value:G,fraction:ee}),t[41]=G,t[42]=ee,t[43]=te):te=t[43];let K=`${k} / ${e.length}`,ne=e.length===0?0:k/e.length,q;t[44]!==K||t[45]!==ne?(q=(0,Q.jsx)(l6,{label:`Decisions reviewed`,value:K,fraction:ne}),t[44]=K,t[45]=ne,t[46]=q):q=t[46];let re=`${j.questions.length+N+ +!!F}`,ie=V.join(` · `)||`Nothing`,ae=j.questions.length+N>0||F?`warning`:`calm`,oe;t[47]!==re||t[48]!==ie||t[49]!==ae?(oe=(0,Q.jsx)(l6,{label:`Needs attention`,value:re,caption:ie,tone:ae}),t[47]=re,t[48]=ie,t[49]=ae,t[50]=oe):oe=t[50];let se;t[51]!==te||t[52]!==q||t[53]!==oe?(se=(0,Q.jsxs)(`dl`,{className:`grid grid-cols-3 gap-2`,children:[te,q,oe]}),t[51]=te,t[52]=q,t[53]=oe,t[54]=se):se=t[54];let ce=A?(0,Q.jsxs)(X,{className:`h-auto max-w-full min-w-0 text-left whitespace-normal`,onClick:()=>c(A.key),children:[k===0&&O.reviewed===0?`Start with`:`Continue with`,` `,vz(A),(0,Q.jsx)(Bd,{"data-icon":`inline-end`})]}):(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm font-medium text-graph-2`,children:[(0,Q.jsx)(o,{className:`size-4`}),` Everything in this change is reviewed`]}),le;t[55]===ce?le=t[56]:(le=(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:ce}),t[55]=ce,t[56]=le),p=(0,Q.jsxs)(`header`,{className:`flex flex-col gap-4`,children:[U,(0,Q.jsx)(`h2`,{className:`text-2xl leading-tight font-semibold text-balance`,children:fz(e.length)}),W,se,le]}),m=(H||j.questions.length>0)&&(0,Q.jsxs)(`section`,{"aria-labelledby":`briefing-system`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(c6,{id:`briefing-system`,children:`What this adds to the system`}),j.questions.map(e=>(0,Q.jsx)(n6,{part:e,action:(0,Q.jsx)(f6,{part:e,review:n,onGo:c})},`question:${e.id}`)),H&&(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 max-narrow:grid-cols-1`,children:[(0,Q.jsx)(d6,{title:`New`,icon:(0,Q.jsx)(Cp,{className:`size-3.5 text-graph-2`}),parts:j.added,review:n,onGo:c}),(0,Q.jsx)(d6,{title:`Changed`,icon:(0,Q.jsx)(_p,{className:`size-3.5 text-graph-1`}),parts:j.changed,review:n,onGo:c}),(0,Q.jsx)(d6,{title:`Removed`,icon:(0,Q.jsx)(lp,{className:`size-3.5 text-destructive`}),parts:j.removed,review:n,onGo:c,struck:!0})]})]});let ue;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Q.jsx)(c6,{id:`briefing-decisions`,children:`The walkthrough`}),t[57]=ue):ue=t[57];let de;t[58]!==a||t[59]!==s||t[60]!==i||t[61]!==c?(de=e=>{let t=a.get(e.layer.id),n=gz(e.paths,i);return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>c(e.key),className:`flex w-full items-start gap-3 px-3.5 py-3 text-left hover:bg-accent/50`,children:[(0,Q.jsx)(u6,{done:s(e),label:`${e.number}`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium`,children:e.layer.title}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:bz(e.layer).join(` → `)||`No changed code`})]}),(0,Q.jsxs)(`span`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:[n.reviewed,`/`,n.total,` files`]}),t?.stale&&(0,Q.jsxs)(os,{variant:`outline`,children:[(0,Q.jsx)(Jc,{className:`text-graph-4`}),` Code moved`]})]})]})},e.key)},t[58]=a,t[59]=s,t[60]=i,t[61]=c,t[62]=de):de=t[62];let fe=e.map(de),pe;t[63]!==i||t[64]!==c?(pe=e=>{let t=gz(e.paths,i);return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>c(e.key),className:`flex w-full items-start gap-3 px-3.5 py-3 text-left hover:bg-accent/50`,children:[(0,Q.jsx)(`span`,{className:Y(`grid size-6 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground`,e.kind===`unexplained`&&`bg-graph-4/15 text-graph-4`),children:e.kind===`unexplained`?(0,Q.jsx)(xf,{className:`size-3.5`}):(0,Q.jsx)(kf,{className:`size-3.5`})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium`,children:_z(e)}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.kind===`unexplained`?`Changes no decision explains`:`Set apart by your settings`})]}),(0,Q.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:[t.reviewed,`/`,t.total,` files`]})]})},e.key)},t[63]=i,t[64]=c,t[65]=pe):pe=t[65];let me=l.map(pe);t[66]!==fe||t[67]!==me?(h=(0,Q.jsxs)(`section`,{"aria-labelledby":`briefing-decisions`,className:`flex flex-col gap-2`,children:[ue,(0,Q.jsxs)(`ol`,{className:`flex flex-col divide-y rounded-xl border`,children:[fe,me]})]}),t[66]=fe,t[67]=me,t[68]=h):h=t[68],T=`briefing-evidence`,E=`flex flex-col gap-2`,t[69]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(c6,{id:`briefing-evidence`,children:`Evidence`}),t[69]=d):d=t[69],C=`flex items-center gap-3 rounded-xl border px-3.5 py-3`;let he=I.failing>0&&`text-destructive`,ge;t[70]===he?ge=t[71]:(ge=Y(`size-4 shrink-0 text-muted-foreground`,he),t[70]=he,t[71]=ge),t[72]===ge?w=t[73]:(w=(0,Q.jsx)(kf,{className:ge}),t[72]=ge,t[73]=w),b=`min-w-0 flex-1 text-sm`,x=`Checks the agent ran ·`,S=` `;let _e=I.failing>0&&`font-medium text-destructive`;t[74]===_e?u=t[75]:(u=Y(`text-muted-foreground`,_e),t[74]=_e,t[75]=u),y=CR(I),t[0]=a,t[1]=s,t[2]=i,t[3]=c,t[4]=n,t[5]=r,t[6]=u,t[7]=d,t[8]=f,t[9]=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]=C,t[20]=w,t[21]=T,t[22]=E}else u=t[6],d=t[7],f=t[8],p=t[9],m=t[10],h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19],w=t[20],T=t[21],E=t[22];let D;t[76]!==u||t[77]!==y?(D=(0,Q.jsx)(`span`,{className:u,children:y}),t[76]=u,t[77]=y,t[78]=D):D=t[78];let O;t[79]!==D||t[80]!==b||t[81]!==x||t[82]!==S?(O=(0,Q.jsxs)(`p`,{className:b,children:[x,S,D]}),t[79]=D,t[80]=b,t[81]=x,t[82]=S,t[83]=O):O=t[83];let k;t[84]===l?k=t[85]:(k=(0,Q.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>l(d0),children:`Open proof`}),t[84]=l,t[85]=k);let A;t[86]!==O||t[87]!==k||t[88]!==C||t[89]!==w?(A=(0,Q.jsxs)(`div`,{className:C,children:[w,O,k]}),t[86]=O,t[87]=k,t[88]=C,t[89]=w,t[90]=A):A=t[90];let j;t[91]!==d||t[92]!==A||t[93]!==T||t[94]!==E?(j=(0,Q.jsxs)(`section`,{"aria-labelledby":T,className:E,children:[d,A]}),t[91]=d,t[92]=A,t[93]=T,t[94]=E,t[95]=j):j=t[95];let M;t[96]!==f||t[97]!==p||t[98]!==m||t[99]!==h||t[100]!==j?(M=(0,Q.jsxs)(`div`,{className:f,children:[p,m,h,j]}),t[96]=f,t[97]=p,t[98]=m,t[99]=h,t[100]=j,t[101]=M):M=t[101];let N;return t[102]!==g||t[103]!==_||t[104]!==v||t[105]!==M?(N=(0,Q.jsx)(`div`,{className:g,"aria-label":_,role:v,children:M}),t[102]=g,t[103]=_,t[104]=v,t[105]=M,t[106]=N):N=t[106],N}function i6(e){return e.kind===`unexplained`}function a6(e){return e.paths}function o6(e){return e.kind===`unexplained`||e.kind===`specs`}function s6(e){return e.kind===`decision`}function c6(e){let t=(0,$.c)(3),{id:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Q.jsx)(`h3`,{id:n,className:`text-sm font-semibold`,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function l6(e){let t=(0,$.c)(16),{label:n,value:r,fraction:i,caption:a,tone:o}=e,s=o===void 0?`calm`:o,c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n}),t[0]=n,t[1]=c);let l=s===`warning`&&`text-graph-4`,u;t[2]===l?u=t[3]:(u=Y(`text-xl font-semibold tabular-nums`,l),t[2]=l,t[3]=u);let d;t[4]!==u||t[5]!==r?(d=(0,Q.jsx)(`dd`,{className:u,children:r}),t[4]=u,t[5]=r,t[6]=d):d=t[6];let f;t[7]===a?f=t[8]:(f=a&&(0,Q.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:a}),t[7]=a,t[8]=f);let p;t[9]===i?p=t[10]:(p=i!==void 0&&(0,Q.jsx)(`span`,{className:`block h-1 overflow-hidden rounded-full bg-muted`,children:(0,Q.jsx)(`span`,{className:`block h-full rounded-full bg-graph-2`,style:{width:`${Math.round(i*100)}%`}})}),t[9]=i,t[10]=p);let m;return t[11]!==c||t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-xl border px-3.5 py-3`,children:[c,d,f,p]}),t[11]=c,t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function u6(e){let t=(0,$.c)(8),{done:n,label:r}=e,i=n&&`border-graph-2 bg-graph-2 text-background`,a;t[0]===i?a=t[1]:(a=Y(`grid size-6 shrink-0 place-items-center rounded-full border text-2xs font-semibold tabular-nums`,i),t[0]=i,t[1]=a);let s;t[2]!==n||t[3]!==r?(s=n?(0,Q.jsx)(o,{className:`size-3.5`,"aria-label":`Reviewed`}):r,t[2]=n,t[3]=r,t[4]=s):s=t[4];let c;return t[5]!==a||t[6]!==s?(c=(0,Q.jsx)(`span`,{className:a,children:s}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}function d6(e){let t=(0,$.c)(14),{title:n,icon:r,parts:i,review:a,onGo:o,struck:s}=e,c=s!==void 0&&s,l;t[0]===i.length?l=t[1]:(l=(0,Q.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:i.length}),t[0]=i.length,t[1]=l);let u;t[2]!==r||t[3]!==l||t[4]!==n?(u=(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs font-medium`,children:[r,n,l]}),t[2]=r,t[3]=l,t[4]=n,t[5]=u):u=t[5];let d;t[6]!==o||t[7]!==i||t[8]!==a||t[9]!==c?(d=i.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Nothing`}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:i.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:Y(`text-sm font-medium`,c&&`text-muted-foreground line-through`),children:e.label}),e.detail&&(0,Q.jsx)(`span`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:e.detail}),(0,Q.jsx)(f6,{part:e,review:a,onGo:o,inline:!0})]},e.id))}),t[6]=o,t[7]=i,t[8]=a,t[9]=c,t[10]=d):d=t[10];let f;return t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border p-3`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function f6(e){let t=(0,$.c)(10),{part:n,review:r,onGo:i,inline:a}=e,o=a!==void 0&&a,s=n.decision===void 0?void 0:r.layers[n.decision-1];if(!s||n.decision===void 0)return null;let c=o&&`self-start`,l;t[0]===c?l=t[1]:(l=Y(`shrink-0`,c),t[0]=c,t[1]=l);let u;t[2]!==s.id||t[3]!==i?(u=()=>i(dz(s.id)),t[2]=s.id,t[3]=i,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Bd,{"data-icon":`inline-end`}),t[5]=d):d=t[5];let f;return t[6]!==n.decision||t[7]!==l||t[8]!==u?(f=(0,Q.jsxs)(X,{variant:`link`,size:`xs`,className:l,onClick:u,children:[`Decision `,n.decision,d]}),t[6]=n.decision,t[7]=l,t[8]=u,t[9]=f):f=t[9],f}function p6(e){let t=(0,$.c)(15),{stop:n,stops:r,review:i,decision:a,finished:o,onStep:s,onGo:c}=e;if(n.kind===`decision`){let e;t[0]===r?e=t[1]:(e=r.filter(m6),t[0]=r,t[1]=e);let l;return t[2]!==a||t[3]!==o||t[4]!==c||t[5]!==s||t[6]!==i||t[7]!==n||t[8]!==e.length?(l=(0,Q.jsx)(_6,{stop:n,total:e.length,review:i,decision:a,finished:o,onStep:s,onGo:c}),t[2]=a,t[3]=o,t[4]=c,t[5]=s,t[6]=i,t[7]=n,t[8]=e.length,t[9]=l):l=t[9],l}if(n.kind===`unexplained`){let e;return t[10]!==c||t[11]!==n||t[12]!==r?(e=(0,Q.jsx)(D6,{stop:n,stops:r,onGo:c}),t[10]=c,t[11]=n,t[12]=r,t[13]=e):e=t[13],e}let l;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(g6,{eyebrow:(0,Q.jsx)(`span`,{className:`tracking-wide uppercase`,children:`Set apart by your settings`}),title:`Specs`,lead:`Specs are folded because agents follow the project's spec rules. Open the ones that matter to you; the countdown still includes them.`}),t[14]=l):l=t[14],l}function m6(e){return e.kind===`decision`}function h6(e){return e===`new`?`New`:e===`changed`?`Changed`:`Removed`}function g6(e){let t=(0,$.c)(13),{eyebrow:n,title:r,lead:i,children:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 text-2xs font-medium text-muted-foreground`,children:n}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Q.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-balance`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=i&&(0,Q.jsx)(`div`,{className:`max-w-3xl text-sm text-muted-foreground text-pretty`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[o,s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;return t[10]!==a||t[11]!==l?(u=(0,Q.jsx)(`div`,{className:`border-b bg-muted/20`,children:(0,Q.jsxs)(`div`,{className:`mx-auto flex max-w-4xl flex-col gap-4 px-5 pt-6 pb-5 font-sans`,children:[l,a]})}),t[10]=a,t[11]=l,t[12]=u):u=t[12],u}function _6(e){let t=(0,$.c)(32),{stop:n,total:r,review:i,decision:a,finished:s,onStep:c,onGo:l}=e,{layer:u}=n,d;if(t[0]!==a?.stale||t[1]!==s||t[2]!==u||t[3]!==l||t[4]!==c||t[5]!==i||t[6]!==n.elsewhere||t[7]!==n.number||t[8]!==r){let e=bz(u),f=Cz(i,u.id),p=[...Sz(i).questions.filter(e=>e.decision===n.number),...f.flatMap(C6)].filter(S6),m=SR(i.proof,u.id),h;t[10]!==n.number||t[11]!==r?(h=(0,Q.jsxs)(`span`,{className:`tracking-wide uppercase`,children:[`Decision `,n.number,` of `,r]}),t[10]=n.number,t[11]=r,t[12]=h):h=t[12];let g;t[13]===s?g=t[14]:(g=s&&(0,Q.jsxs)(os,{variant:`outline`,children:[(0,Q.jsx)(o,{className:`text-graph-2`}),` Reviewed`]}),t[13]=s,t[14]=g);let _;t[15]===a?.stale?_=t[16]:(_=a?.stale&&(0,Q.jsxs)(os,{variant:`outline`,children:[(0,Q.jsx)(Jc,{className:`text-graph-4`}),` Code moved since it was explained`]}),t[15]=a?.stale,t[16]=_);let v;t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Q.jsxs)(Q.Fragment,{children:[h,g,_]}),t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20];let y=u.title,b;t[21]===u.summary?b=t[22]:(b=(0,Q.jsx)(w6,{text:u.summary}),t[21]=u.summary,t[22]=b);let x;t[23]===p?x=t[24]:(x=p.map(y6),t[23]=p,t[24]=x);let S;t[25]!==u||t[26]!==c?(S=(0,Q.jsx)(E6,{layer:u,onStep:c}),t[25]=u,t[26]=c,t[27]=S):S=t[27];let C;t[28]!==l||t[29]!==i.layers||t[30]!==n.elsewhere?(C=n.elsewhere.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`Also changes`}),n.elsewhere.map(e=>(0,Q.jsxs)(X,{variant:`outline`,size:`xs`,title:e.path,onClick:()=>l(e.stop),children:[FR(e.path),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.stop===`specs`?`· in Specs`:`· shown in decision ${i.layers.findIndex(t=>dz(t.id)===e.stop)+1}`})]},e.path))]}),t[28]=l,t[29]=i.layers,t[30]=n.elsewhere,t[31]=C):C=t[31],d=(0,Q.jsxs)(g6,{eyebrow:v,title:y,lead:b,children:[e.length>0&&(0,Q.jsx)(`ol`,{"aria-label":`Route through the system`,className:`flex flex-wrap items-center gap-1.5`,children:e.map(x6)}),f.length>0&&(0,Q.jsx)(`ul`,{"aria-label":`Connections`,className:`flex flex-wrap gap-1.5`,children:f.map(b6)}),x,S,C,m.checks.length>0&&(0,Q.jsx)(`ul`,{"aria-label":`Checks for this decision`,className:`flex flex-wrap gap-1.5`,children:xR(m.checks).map(v6)})]}),t[0]=a?.stale,t[1]=s,t[2]=u,t[3]=l,t[4]=c,t[5]=i,t[6]=n.elsewhere,t[7]=n.number,t[8]=r,t[9]=d}else d=t[9];return d}function v6(e){return(0,Q.jsxs)(`li`,{className:Y(`rounded-md border px-2 py-1 text-xs`,e.result===`fail`&&`border-destructive/40 text-destructive`),children:[e.name,` · `,wR(e.result)]},e.name)}function y6(e){return(0,Q.jsx)(n6,{part:e},e.id)}function b6(e){return(0,Q.jsxs)(`li`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 text-xs`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.outgoing?e.verb:`${e.part.label} ${e.verb}`}),e.outgoing&&(0,Q.jsx)(`span`,{className:`font-medium`,children:e.part.label}),e.change&&(0,Q.jsx)(`span`,{className:Y(`rounded px-1 text-2xs font-medium`,e.change===`new`&&`bg-graph-2/12 text-graph-2`,e.change===`changed`&&`bg-graph-1/12 text-graph-1`,e.change===`removed`&&`bg-destructive/10 text-destructive`),children:h6(e.change)})]},e.part.id)}function x6(e,t){return(0,Q.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[t>0&&(0,Q.jsx)(Bd,{className:`size-3 text-muted-foreground`,"aria-hidden":`true`}),(0,Q.jsx)(os,{variant:`secondary`,children:e})]},`${e}:${t}`)}function S6(e,t,n){return n.findIndex(t=>t.id===e.id)===t}function C6(e){return e.part.problem?[e.part]:[]}function w6(e){let t=(0,$.c)(11),{text:n}=e,[r,i]=(0,Z.useState)(!1),a=n.length>320,o=a&&!r&&`line-clamp-3`,s;t[0]===o?s=t[1]:(s=Y(`text-sm`,o),t[0]=o,t[1]=s);let c;t[2]!==s||t[3]!==n?(c=(0,Q.jsx)(Dj,{text:n,className:s}),t[2]=s,t[3]=n,t[4]=c):c=t[4];let l;t[5]!==a||t[6]!==r?(l=a&&(0,Q.jsx)(X,{variant:`link`,size:`xs`,onClick:()=>i(T6),children:r?`Show less`:`Read more`}),t[5]=a,t[6]=r,t[7]=l):l=t[7];let u;return t[8]!==c||t[9]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function T6(e){return!e}function E6(e){let t=(0,$.c)(9),{layer:n,onStep:r}=e,i;if(t[0]!==n.lanes||t[1]!==n.steps||t[2]!==r){let e;t[4]!==n.lanes||t[5]!==r?(e=(e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Go to step ${t+1}: ${e.title}`,onClick:()=>r(e),className:`flex w-full items-start gap-2.5 rounded-lg border bg-background px-2.5 py-2 text-left hover:border-foreground/20 hover:bg-accent/40`,children:[(0,Q.jsx)(`span`,{className:Y(`mt-px grid size-5 shrink-0 place-items-center rounded-full bg-graph-1/12 text-2xs font-semibold text-graph-1 tabular-nums`,e.kind===`context`&&`bg-muted text-muted-foreground`),children:t+1}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`span`,{className:`text-caption font-medium`,children:e.title}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-2xs text-muted-foreground`,children:[(0,Q.jsx)(hf,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,title:e.pointer.path,children:e.pointer.path})]}),(0,Q.jsxs)(`span`,{className:`text-2xs text-muted-foreground`,children:[n.lanes[e.lane],e.kind===`context`&&` · existing code`,e.location.state===`changed`&&(0,Q.jsx)(`span`,{className:`text-graph-4`,children:` · code moved`}),e.location.state===`broken`&&(0,Q.jsx)(`span`,{className:`text-graph-4`,children:` · broken pointer`}),e.location.state===`committed`&&` · committed`]})]})]})},e.id),t[4]=n.lanes,t[5]=r,t[6]=e):e=t[6],i=n.steps.map(e),t[0]=n.lanes,t[1]=n.steps,t[2]=r,t[3]=i}else i=t[3];let a;return t[7]===i?a=t[8]:(a=(0,Q.jsx)(`ol`,{"aria-label":`Steps`,className:`grid grid-cols-2 gap-1.5 max-narrow:grid-cols-1`,children:i}),t[7]=i,t[8]=a),a}function D6(e){let t=(0,$.c)(10),{stop:n,stops:r,onGo:i}=e,a;t[0]===r?a=t[1]:(a=e=>{let t=r.find(t=>t.key===e);return t?vz(t):e},t[0]=r,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(`span`,{className:`tracking-wide uppercase`,children:`After the decisions`}),t[2]=s):s=t[2];let c=n.paths.length>0?`${n.paths.length} changed ${n.paths.length===1?`file has`:`files have`} no decision pointing at ${n.paths.length===1?`it`:`them`}. Read ${n.paths.length===1?`it`:`them`} before calling the review done, or ask the agent to explain.`:`Every changed file belongs to a decision, but some lines inside them have no explanation.`,l;t[3]!==i||t[4]!==n.partial||t[5]!==o?(l=n.partial.length>0&&(0,Q.jsx)(`ul`,{"aria-label":`Unexplained lines in explained files`,className:`flex flex-col gap-1.5`,children:n.partial.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2 rounded-lg border border-graph-4/40 bg-graph-4/5 px-3 py-2 text-sm`,children:[(0,Q.jsx)(Jc,{className:`size-4 shrink-0 text-graph-4`}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1 break-all`,title:e.path,children:[e.path,(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.ranges.length>0?GP(e.ranges):`whole file`]})]}),(0,Q.jsxs)(X,{variant:`outline`,size:`xs`,onClick:()=>i(e.stop),children:[`Read in `,o(e.stop)]})]},e.path))}),t[3]=i,t[4]=n.partial,t[5]=o,t[6]=l):l=t[6];let u;return t[7]!==c||t[8]!==l?(u=(0,Q.jsx)(g6,{eyebrow:s,title:`Not explained`,lead:c,children:l}),t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function O6(e){let t=(0,$.c)(6),{revision:n,paths:r,scope:i,context:a,marks:o,steps:s,active:c}=e,l=s===void 0?[]:s,[u,d]=(0,Z.useState)(25),f;t[0]===r?f=t[1]:(f=e=>r.includes(e.path),t[0]=r,t[1]=f);let p=n.files.filter(f),m=p.slice(0,u),h=m.length>0&&(0,Q.jsx)(k6,{revision:n,files:m,scope:i,context:a,marks:o,steps:l,active:c}),g=p.length>u&&(0,Q.jsx)(X,{variant:`outline`,className:`m-3 self-start`,onClick:()=>d(u+25),children:`Read more files`}),_=l.some(e=>!p.some(t=>t.path===e.pointer.path))&&(0,Q.jsxs)(`section`,{"aria-label":`Existing code it relies on`,children:[(0,Q.jsx)(`h3`,{className:`p-4 text-sm font-semibold`,children:`Existing code it relies on`}),l.filter(e=>!p.some(t=>t.path===e.pointer.path)).map((e,t)=>(0,Q.jsx)(P6,{revision:n,scope:i,context:a,path:e.pointer.path,step:e,active:c&&m.length===0&&t===0},e.id))]}),v;return t[2]!==h||t[3]!==g||t[4]!==_?(v=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col`,children:[h,g,_]}),t[2]=h,t[3]=g,t[4]=_,t[5]=v):v=t[5],v}function k6(e){let t=(0,$.c)(21),{revision:n,files:r,scope:i,context:a,marks:o,steps:s,active:c}=e,l;t[0]!==a.connection||t[1]!==r||t[2]!==n.reviewId||t[3]!==n.revision?(l=SV({connection:a.connection,reviewId:n.reviewId,revision:n.revision,paths:r.map(M6)}),t[0]=a.connection,t[1]=r,t[2]=n.reviewId,t[3]=n.revision,t[4]=l):l=t[4];let u=at(l),d=Gn(ar(u)),f=J2(...n.content.layers.map(j6),q2(n.content.notExplained)),p;t[5]!==a.connection||t[6]!==n.reviewId?(p=EV({connection:a.connection,reviewId:n.reviewId}),t[5]=a.connection,t[6]=n.reviewId,t[7]=p):p=t[7];let m=p,[h,g]=Vi(m.mark),[_,v]=Vi(m.unmark),y=r.flatMap(e=>{let t=d?.diffs.find(t=>t.paths.includes(e.path)),r=AF(n.headOid,{...e,oldPath:e.oldPath??(e.status===`added`?void 0:e.path),newPath:e.newPath??(e.status===`deleted`?void 0:e.path)},t?.content);if(!r)return[];let i=e.newOid??e.oldOid??null,a=o.files.some(t=>t.path===e.path&&t.fingerprint===i);return[{...r,agentNotes:f[e.path]??[],comment:{filePath:e.path,revision:n.headOid,comparison:{kind:`branch`,base:n.base}},review:{path:e.path,fingerprint:i,reviewed:a,control:(0,Q.jsx)(X,{size:`xs`,variant:`outline`,"aria-pressed":a,"aria-label":ZR(e.path,a?`reviewed`:`unreviewed`),disabled:!i||h.waiting||_.waiting,onClick:()=>i&&(a?v({kind:`file`,path:e.path,headBlobOid:i}):g({kind:`file`,revision:n.revision,path:e.path,headBlobOid:i})),children:a?`File reviewed`:`Mark file reviewed`})}}]}),b;t[8]===u?b=t[9]:(b=M(u)&&(0,Q.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading revision code…`}),t[8]=u,t[9]=b);let x;t[10]===u?x=t[11]:(x=st(u)&&(0,Q.jsx)(`p`,{role:`alert`,className:`p-4 text-destructive`,children:`Revision code could not be read. The published explanations are still available.`}),t[10]=u,t[11]=x);let S;t[12]!==h||t[13]!==_?(S=(st(h)||st(_))&&(0,Q.jsx)(`p`,{role:`alert`,className:`p-3 text-destructive`,children:`The file mark could not be updated. Try again.`}),t[12]=h,t[13]=_,t[14]=S):S=t[14];let C=y.length>0&&(0,Q.jsx)(P4,{scope:i,context:a,interaction:{active:c,worktreeId:n.reviewId,entry:`revision:${n.revision}`},entries:y,fullHeight:!0,onReview:e=>{let t=e.review;!t?.fingerprint||h.waiting||_.waiting||(t.reviewed?v({kind:`file`,path:t.path,headBlobOid:t.fingerprint}):g({kind:`file`,revision:n.revision,path:t.path,headBlobOid:t.fingerprint}))}}),w=(d||st(u))&&r.filter(e=>!y.some(t=>t.path===e.path)).map(e=>{let t=d?.diffs.find(t=>t.paths.includes(e.path))?.content;return(0,Q.jsxs)(`div`,{className:`p-3 text-sm break-all`,children:[(0,Q.jsxs)(`p`,{children:[e.path,` ·`,` `,t?UN(e,t,!1):`Diff unavailable`]}),s.filter(t=>t.pointer.path===e.path).map(A6)]},e.path)}),T;return t[15]!==b||t[16]!==x||t[17]!==S||t[18]!==C||t[19]!==w?(T=(0,Q.jsxs)(Q.Fragment,{children:[b,x,S,C,w]}),t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T):T=t[20],T}function A6(e){return(0,Q.jsxs)(`article`,{"aria-label":`Step ${e.title}`,children:[(0,Q.jsx)(h4,{title:e.title,text:e.text}),e.published&&(0,Q.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap`,children:e.published.join(`
1380
+ `)})]},e.id)}function j6(e,t){return K2(e,t+1)}function M6(e){return[...new Set([e.oldPath,e.newPath,e.path].filter(N6))]}function N6(e){return e!==void 0}function P6(e){let t=(0,$.c)(27),{revision:n,scope:r,context:i,path:a,step:o,active:s}=e,c;t[0]!==i.connection||t[1]!==a||t[2]!==n.reviewId||t[3]!==n.revision?(c=xV({connection:i.connection,reviewId:n.reviewId,revision:n.revision,path:a}),t[0]=i.connection,t[1]=a,t[2]=n.reviewId,t[3]=n.revision,t[4]=c):c=t[4];let l=at(c),u;if(t[5]!==a||t[6]!==l||t[7]!==n.headOid||t[8]!==n.reviewId||t[9]!==n.revision){let e=Gn(ar(l));u=e?.kind===`text`?{...Y2(`review:${n.reviewId}:${n.revision}:${a}`,a,e.text),comment:{filePath:a,revision:n.headOid,comparison:{kind:`file`}}}:void 0,t[5]=a,t[6]=l,t[7]=n.headOid,t[8]=n.reviewId,t[9]=n.revision,t[10]=u}else u=t[10];let d=u,f=o?`Step ${o.title}`:`File ${a}`,p;t[11]===o?p=t[12]:(p=o&&(0,Q.jsx)(h4,{title:o.title,text:o.text}),t[11]=o,t[12]=p);let m;t[13]!==s||t[14]!==i||t[15]!==d||t[16]!==a||t[17]!==l||t[18]!==n.reviewId||t[19]!==n.revision||t[20]!==r||t[21]!==o?(m=d?(0,Q.jsx)(P4,{scope:r,context:i,interaction:{active:s,worktreeId:n.reviewId,entry:`file:${n.revision}:${a}`},entries:[d],fullHeight:!0}):(0,Q.jsxs)(`div`,{className:`p-4 text-sm break-all`,children:[(0,Q.jsxs)(`p`,{children:[a,` ·`,` `,M(l)?`Loading code…`:`Code unavailable at this revision`]}),o?.published&&(0,Q.jsx)(`pre`,{className:`mt-2 overflow-auto whitespace-pre-wrap`,children:o.published.join(`
1381
+ `)})]}),t[13]=s,t[14]=i,t[15]=d,t[16]=a,t[17]=l,t[18]=n.reviewId,t[19]=n.revision,t[20]=r,t[21]=o,t[22]=m):m=t[22];let h;return t[23]!==f||t[24]!==p||t[25]!==m?(h=(0,Q.jsxs)(`article`,{"aria-label":f,className:`flex min-h-0 shrink-0 flex-col border-t`,children:[p,m]}),t[23]=f,t[24]=p,t[25]=m,t[26]=h):h=t[26],h}function F6(e,t){let n=(0,$.c)(6),r;n[0]!==t.connection||n[1]!==e?(r=EV({connection:t.connection,reviewId:e}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promiseExit`},n[3]=i):i=n[3];let a=Vi(r.remove,i),o;return n[4]===a?o=n[5]:(o=mV(a),n[4]=a,n[5]=o),o}function I6(e){let t=(0,$.c)(44),{reviewId:n,state:r,context:i,onDeleted:a}=e,[o,s]=(0,Z.useState)(!1),c;t[0]!==i.connection||t[1]!==n?(c=EV({connection:i.connection,reviewId:n}),t[0]=i.connection,t[1]=n,t[2]=c):c=t[2];let[l,u]=Vi(c.close),d=F6(n,i),f=d.result,p=l.waiting||f.waiting,m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(TN,{render:(0,Q.jsx)(X,{size:`icon-sm`,variant:`ghost`,"aria-label":`Review actions`}),children:(0,Q.jsx)(sf,{})}),t[3]=m):m=t[3];let h;t[4]!==u||t[5]!==p||t[6]!==r?(h=r===`open`&&(0,Q.jsx)(kN,{disabled:p,onClick:()=>u(),children:`Close review`}),t[4]=u,t[5]=p,t[6]=r,t[7]=h):h=t[7];let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>s(!0),t[8]=g):g=t[8];let _;t[9]===p?_=t[10]:(_=(0,Q.jsx)(kN,{variant:`destructive`,disabled:p,onClick:g,children:`Delete review`}),t[9]=p,t[10]=_);let v;t[11]!==h||t[12]!==_?(v=(0,Q.jsxs)(wN,{children:[m,(0,Q.jsxs)(EN,{align:`end`,children:[h,_]})]}),t[11]=h,t[12]=_,t[13]=v):v=t[13];let y;t[14]===l?y=t[15]:(y=st(l)&&(0,Q.jsx)(`p`,{role:`alert`,className:`w-full text-sm text-destructive`,children:`The review could not be closed. Try again.`}),t[14]=l,t[15]=y);let b;t[16]===f.waiting?b=t[17]:(b=e=>{f.waiting||s(e)},t[16]=f.waiting,t[17]=b);let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsxs)(vM,{children:[(0,Q.jsx)(bM,{children:`Delete review?`}),(0,Q.jsx)(xM,{children:`This permanently deletes every revision, proof asset, comment and mark owned by this review for everyone connected.`})]}),t[18]=x):x=t[18];let S;t[19]===f?S=t[20]:(S=st(f)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`The review could not be deleted. Try again.`}),t[19]=f,t[20]=S);let C;t[21]===f.waiting?C=t[22]:(C=(0,Q.jsx)(CM,{disabled:f.waiting,children:`Cancel`}),t[21]=f.waiting,t[22]=C);let w;t[23]!==d||t[24]!==a?(w=()=>{d.send(void 0,()=>{s(!1),a()})},t[23]=d,t[24]=a,t[25]=w):w=t[25];let T=f.waiting?`Deleting…`:`Delete`,E;t[26]!==f.waiting||t[27]!==w||t[28]!==T?(E=(0,Q.jsx)(X,{variant:`destructive`,disabled:f.waiting,onClick:w,children:T}),t[26]=f.waiting,t[27]=w,t[28]=T,t[29]=E):E=t[29];let D;t[30]!==C||t[31]!==E?(D=(0,Q.jsxs)(yM,{children:[C,E]}),t[30]=C,t[31]=E,t[32]=D):D=t[32];let O;t[33]!==S||t[34]!==D?(O=(0,Q.jsxs)(_M,{children:[x,S,D]}),t[33]=S,t[34]=D,t[35]=O):O=t[35];let k;t[36]!==o||t[37]!==O||t[38]!==b?(k=(0,Q.jsx)(mM,{open:o,onOpenChange:b,children:O}),t[36]=o,t[37]=O,t[38]=b,t[39]=k):k=t[39];let A;return t[40]!==k||t[41]!==v||t[42]!==y?(A=(0,Q.jsxs)(Q.Fragment,{children:[v,y,k]}),t[40]=k,t[41]=v,t[42]=y,t[43]=A):A=t[43],A}function L6(e){let t=(0,$.c)(21),{scope:n,context:r,revision:i,onReveal:a}=e,{threads:o}=r4(n,r),[s,c]=(0,Z.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(X,{variant:`outline`,className:`self-start`,onClick:()=>c(!0),children:`Comment on this review`}),t[0]=l):l=t[0];let u;t[1]!==s||t[2]!==r||t[3]!==i||t[4]!==n?(u=s&&(0,Q.jsx)(p4,{scope:n,context:r,anchor:{kind:`change`,revision:i.headOid,comparison:{kind:`branch`,base:i.base}},onClose:()=>c(!1)}),t[1]=s,t[2]=r,t[3]=i,t[4]=n,t[5]=u):u=t[5];let d;t[6]===o.length?d=t[7]:(d=o.length===0&&(0,Q.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`No comments yet.`}),t[6]=o.length,t[7]=d);let f;if(t[8]!==r||t[9]!==a||t[10]!==n||t[11]!==o){let e;t[13]!==r||t[14]!==a||t[15]!==n?(e=e=>(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-lg border`,children:[(0,Q.jsxs)(`p`,{className:`px-3 pt-2 text-xs text-muted-foreground`,children:[`Written on r`,e.review?.revision,` ·`,` `,e.review?.headOid.slice(0,7)]}),(0,Q.jsx)(N4,{scope:n,context:r,thread:e,onReveal:()=>{let t=cR(e.anchor);t&&a(t)}})]},e.id),t[13]=r,t[14]=a,t[15]=n,t[16]=e):e=t[16],f=o.map(e),t[8]=r,t[9]=a,t[10]=n,t[11]=o,t[12]=f}else f=t[12];let p;return t[17]!==u||t[18]!==d||t[19]!==f?(p=(0,Q.jsxs)(`section`,{"aria-label":`Review comments`,className:`flex flex-col gap-2 p-3`,children:[l,u,d,f]}),t[17]=u,t[18]=d,t[19]=f,t[20]=p):p=t[20],p}function R6(e){let t=(0,$.c)(37),{reviewId:n,navigation:r,revision:i,decision:a,context:o,onRevision:s,onDecision:c,onBack:l,onDeleted:u,liveScope:d,initialView:f,proofCurrent:p,active:m}=e,h=p===void 0||p,g=m===void 0||m,_;t[0]!==o.connection||t[1]!==n||t[2]!==i?(_=_V({connection:o.connection,reviewId:n,...i===void 0?{}:{revision:i}}),t[0]=o.connection,t[1]=n,t[2]=i,t[3]=_):_=t[3];let v=_,y=at(v),b=Ze(v),x;t[4]===y?x=t[5]:(x=Gn(ar(y)),t[4]=y,t[5]=x);let S=x;if(M(y)){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading review…`}),t[6]=e):e=t[6],e}if(st(y)){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{role:`alert`,children:`Review could not be loaded. Check the link and connection.`}),t[7]=e):e=t[7];let n;t[8]===b?n=t[9]:(n=(0,Q.jsx)(X,{variant:`outline`,onClick:b,children:`Try again`}),t[8]=b,t[9]=n);let r;t[10]===l?r=t[11]:(r=(0,Q.jsx)(X,{variant:`ghost`,onClick:l,children:`Back to workspace`}),t[10]=l,t[11]=r);let i;return t[12]!==n||t[13]!==r?(i=(0,Q.jsxs)(`div`,{className:`p-4`,children:[e,n,r]}),t[12]=n,t[13]=r,t[14]=i):i=t[14],i}if(!S?.review||!S.revision){let e=S?.review?`Revision not found`:`Review not found`,n;t[15]===e?n=t[16]:(n=(0,Q.jsx)(t3,{title:e,description:`This link does not identify an available review revision.`}),t[15]=e,t[16]=n);let r;t[17]===l?r=t[18]:(r=(0,Q.jsx)(X,{variant:`outline`,onClick:l,children:`Back to workspace`}),t[17]=l,t[18]=r);let i;return t[19]!==n||t[20]!==r?(i=(0,Q.jsxs)(`div`,{className:`p-4`,children:[n,r]}),t[19]=n,t[20]=r,t[21]=i):i=t[21],i}let C=`${n}:${S.revision.revision}:${a??``}`,w=i===void 0,T;return t[22]!==g||t[23]!==o||t[24]!==S||t[25]!==a||t[26]!==f||t[27]!==d||t[28]!==r||t[29]!==l||t[30]!==c||t[31]!==u||t[32]!==s||t[33]!==h||t[34]!==C||t[35]!==w?(T=(0,Q.jsx)(z6,{navigation:r,data:S,revision:S.revision,context:o,decision:a,latest:w,onRevision:s,onDecision:c,onBack:l,onDeleted:u,liveScope:d,initialView:f,proofCurrent:h,active:g},C),t[22]=g,t[23]=o,t[24]=S,t[25]=a,t[26]=f,t[27]=d,t[28]=r,t[29]=l,t[30]=c,t[31]=u,t[32]=s,t[33]=h,t[34]=C,t[35]=w,t[36]=T):T=t[36],T}function z6(e){let t=(0,$.c)(182),{navigation:n,data:r,revision:i,context:a,decision:o,latest:s,onRevision:c,onDecision:l,onBack:u,onDeleted:d,liveScope:f,initialView:p,proofCurrent:m,active:h}=e,g=m===void 0||m,_=h===void 0||h,v=bI(a.connection),y;if(t[0]!==v.projects||t[1]!==i.branch||t[2]!==i.projectId){let e;t[4]===i.projectId?e=t[5]:(e=e=>e.id===i.projectId,t[4]=i.projectId,t[5]=e),y=v.projects.find(e)?.worktrees.find(e=>e.available&&z$(e.branch??``)===z$(i.branch)),t[0]=v.projects,t[1]=i.branch,t[2]=i.projectId,t[3]=y}else y=t[3];let b=y,x;t[6]!==f||t[7]!==i.projectId||t[8]!==b?(x=f??(b?{projectId:i.projectId,worktreeId:b.id}:void 0),t[6]=f,t[7]=i.projectId,t[8]=b,t[9]=x):x=t[9];let S=x,C;t[10]!==r.review?.latestRevision||t[11]!==r.revisions||t[12]!==i.headOid?(C=r.revisions.find(e=>e.revision===r.review?.latestRevision)?.headOid??i.headOid,t[10]=r.review?.latestRevision,t[11]=r.revisions,t[12]=i.headOid,t[13]=C):C=t[13];let w=C,T=i.content,E;t[14]!==i.reviewId||t[15]!==i.revision?(E={reviewId:i.reviewId,revision:i.revision},t[14]=i.reviewId,t[15]=i.revision,t[16]=E):E=t[16];let D;t[17]!==T.worktreeId||t[18]!==i.projectId||t[19]!==E?(D={projectId:i.projectId,worktreeId:T.worktreeId,review:E},t[17]=T.worktreeId,t[18]=i.projectId,t[19]=E,t[20]=D):D=t[20];let k=D,{result:A,url:j,available:N}=R3(k,a,T.summary),P;t[21]!==a.connection||t[22]!==i.reviewId||t[23]!==i.revision?(P=TV({connection:a.connection,reviewId:i.reviewId,revision:i.revision}),t[21]=a.connection,t[22]=i.reviewId,t[23]=i.revision,t[24]=P):P=t[24],tn(P);let F;t[25]!==a.connection||t[26]!==i.reviewId||t[27]!==i.revision?(F=TV({connection:a.connection,reviewId:i.reviewId,revision:i.revision}),t[25]=a.connection,t[26]=i.reviewId,t[27]=i.revision,t[28]=F):F=t[28];let I=at(F),L;t[29]!==a.connection||t[30]!==i.reviewId?(L=bV({connection:a.connection,reviewId:i.reviewId}),t[29]=a.connection,t[30]=i.reviewId,t[31]=L):L=t[31],tn(L);let R;t[32]!==a.connection||t[33]!==i.reviewId?(R=yV({connection:a.connection,reviewId:i.reviewId}),t[32]=a.connection,t[33]=i.reviewId,t[34]=R):R=t[34];let z=R,B=at(z),V=Ze(z),H=Gn(ar(B)),{preferences:U}=Cl(),{dark:W}=Au(),G=Y0(`${i.reviewId}:${i.revision}`),[ee,te]=(0,Z.useState)(),[K,ne]=(0,Z.useState)(p??`walkthrough`),[q,re]=(0,Z.useState)(),ie=pz(T,i.files.map(U6),{specsApart:U.collapseSpecs}),ae;t[35]!==o||t[36]!==T.layers?(ae=o!==void 0&&!T.layers.some(e=>e.id===o),t[35]=o,t[36]=T.layers,t[37]=ae):ae=t[37];let oe=ae,se=G.place;o&&(se=dz(o)),oe&&(se=`briefing`);let ce=mz(ie,ee??se),le=Oz(i,H),ue=Dz(i,H),de=e=>yz(e,ue,le),fe;t[38]!==l||t[39]!==c||t[40]!==G||t[41]!==T.layers||t[42]!==i.revision||t[43]!==re||t[44]!==ne?(fe=e=>{te(e),G.setPlace(e),ne(`walkthrough`),re(void 0);let t=T.layers.find(t=>dz(t.id)===e);t?l?.(i.revision,t.id):l&&c?.(i.revision)},t[38]=l,t[39]=c,t[40]=G,t[41]=T.layers,t[42]=i.revision,t[43]=re,t[44]=ne,t[45]=fe):fe=t[45];let pe=fe,me=`review:${i.revision}`,he;t[46]!==_||t[47]!==i.reviewId||t[48]!==me?(he={active:_,worktreeId:i.reviewId,entry:me},t[46]=_,t[47]=i.reviewId,t[48]=me,t[49]=he):he=t[49];let ge=he,_e;t[50]!==re||t[51]!==ne?(_e=e=>{e.kind===`proof`?ne(`proof`):e.path&&re({path:e.path})},t[50]=re,t[51]=ne,t[52]=_e):_e=t[52];let ve;t[53]!==a||t[54]!==ge||t[55]!==T||t[56]!==k||t[57]!==_e?(ve={review:T,scope:k,context:a,interaction:ge,onOpen:_e},t[53]=a,t[54]=ge,t[55]=T,t[56]=k,t[57]=_e,t[58]=ve):ve=t[58];let ye=ve,be=r.review,xe=_&&K===`walkthrough`&&(0,Q.jsx)(q6,{stops:ie,current:ce.key,onGo:pe}),Se;t[59]===u?Se=t[60]:(Se=(0,Q.jsx)(X,{variant:`ghost`,size:`sm`,onClick:u,children:`Back`}),t[59]=u,t[60]=Se);let Ce;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Q.jsx)(`span`,{className:`flex-1`}),t[61]=Ce):Ce=t[61];let we=be?.state??`open`,Te;t[62]===we?Te=t[63]:(Te=(0,Q.jsx)(os,{variant:`outline`,children:we}),t[62]=we,t[63]=Te);let Ee=be?.state??`open`,De=d??u,Oe;t[64]!==a||t[65]!==i.reviewId||t[66]!==Ee||t[67]!==De?(Oe=(0,Q.jsx)(I6,{reviewId:i.reviewId,state:Ee,context:a,onDeleted:De}),t[64]=a,t[65]=i.reviewId,t[66]=Ee,t[67]=De,t[68]=Oe):Oe=t[68];let ke;t[69]!==n||t[70]!==Se||t[71]!==Te||t[72]!==Oe?(ke=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n,Se,Ce,Te,Oe]}),t[69]=n,t[70]=Se,t[71]=Te,t[72]=Oe,t[73]=ke):ke=t[73];let Ae;t[74]===be?Ae=t[75]:(Ae=be?.pullRequest&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`a`,{href:be.pullRequest,target:`_blank`,rel:`noopener noreferrer`,children:[`PR #`,be.pullRequest.split(`/`).filter(Boolean).at(-1)]}),` · `]}),t[74]=be,t[75]=Ae);let je=i.branch,Me;t[76]===i.base?Me=t[77]:(Me=z$(i.base),t[76]=i.base,t[77]=Me);let Ne;t[78]===i.headOid?Ne=t[79]:(Ne=i.headOid.slice(0,7),t[78]=i.headOid,t[79]=Ne);let Pe;t[80]===Ne?Pe=t[81]:(Pe=(0,Q.jsx)(`span`,{className:`font-mono whitespace-nowrap`,children:Ne}),t[80]=Ne,t[81]=Pe);let Fe;t[82]!==i.branch||t[83]!==Ae||t[84]!==Me||t[85]!==Pe?(Fe=(0,Q.jsxs)(`h1`,{"aria-label":`Review`,className:`min-w-0 text-sm font-semibold break-words`,children:[Ae,je,` → `,Me,` ·`,` `,Pe]}),t[82]=i.branch,t[83]=Ae,t[84]=Me,t[85]=Pe,t[86]=Fe):Fe=t[86];let Ie;if(t[87]!==r.revisions||t[88]!==s||t[89]!==c||t[90]!==i.revision){let e;t[92]!==s||t[93]!==c||t[94]!==i.revision?(e=e=>(0,Q.jsxs)(X,{size:`xs`,variant:!s&&e.revision===i.revision?`secondary`:`ghost`,"aria-pressed":!s&&e.revision===i.revision,onClick:()=>c?.(e.revision),disabled:!c,children:[`r`,e.revision]},e.revision),t[92]=s,t[93]=c,t[94]=i.revision,t[95]=e):e=t[95],Ie=r.revisions.map(e),t[87]=r.revisions,t[88]=s,t[89]=c,t[90]=i.revision,t[91]=Ie}else Ie=t[91];let Le=s?`secondary`:`ghost`,J;t[96]===c?J=t[97]:(J=()=>c?.(void 0),t[96]=c,t[97]=J);let Re=!c,ze;t[98]!==s||t[99]!==Le||t[100]!==J||t[101]!==Re?(ze=(0,Q.jsx)(X,{size:`xs`,variant:Le,"aria-pressed":s,onClick:J,disabled:Re,children:`latest`}),t[98]=s,t[99]=Le,t[100]=J,t[101]=Re,t[102]=ze):ze=t[102];let Be;t[103]!==Ie||t[104]!==ze?(Be=(0,Q.jsxs)(`nav`,{"aria-label":`Review revisions`,className:`flex w-full flex-wrap gap-1`,children:[Ie,ze]}),t[103]=Ie,t[104]=ze,t[105]=Be):Be=t[105];let Ve;t[106]!==ke||t[107]!==Fe||t[108]!==Be?(Ve=(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-2 border-b px-4 py-3`,children:[ke,Fe,Be]}),t[106]=ke,t[107]=Fe,t[108]=Be,t[109]=Ve):Ve=t[109];let He;t[110]!==a||t[111]!==S||t[112]!==w?(He=S&&(0,Q.jsx)(K6,{scope:S,context:a,headOid:w}),t[110]=a,t[111]=S,t[112]=w,t[113]=He):He=t[113];let Ue;t[114]===I?Ue=t[115]:(Ue=st(I)&&(0,Q.jsx)(`p`,{role:`status`,className:`px-4 py-2 text-sm`,children:`This revision could not be recorded as seen.`}),t[114]=I,t[115]=Ue);let We;t[116]===oe?We=t[117]:(We=oe&&(0,Q.jsx)(`p`,{role:`status`,className:`border-b px-4 py-3 text-sm`,children:`That decision is not in this revision. The briefing is shown below. Choose another decision or revision.`}),t[116]=oe,t[117]=We);let Ge;t[118]===pe?Ge=t[119]:(Ge=e=>pe(dz(e)),t[118]=pe,t[119]=Ge);let Ke;t[120]!==a||t[121]!==i||t[122]!==k||t[123]!==Ge?(Ke=(0,Q.jsx)(J3,{revision:i,scope:k,context:a,onStart:Ge}),t[120]=a,t[121]=i,t[122]=k,t[123]=Ge,t[124]=Ke):Ke=t[124];let qe;t[125]!==re||t[126]!==ne?(qe=e=>{(e===`walkthrough`||e===`summary`||e===`comments`||e===`proof`)&&(ne(e),re(void 0))},t[125]=re,t[126]=ne,t[127]=qe):qe=t[127];let Je;t[128]===A?Je=t[129]:(Je=M(A)||A.waiting,t[128]=A,t[129]=Je);let Ye;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Q.jsx)(hQ,{value:`walkthrough`,children:`Walkthrough`}),t[130]=Ye):Ye=t[130];let Xe;t[131]===N?Xe=t[132]:(Xe=N&&(0,Q.jsx)(hQ,{value:`summary`,children:`Agent summary`}),t[131]=N,t[132]=Xe);let Qe,$e;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Q.jsx)(hQ,{value:`proof`,children:`Proof`}),$e=(0,Q.jsx)(hQ,{value:`comments`,children:`Comments`}),t[133]=Qe,t[134]=$e):(Qe=t[133],$e=t[134]);let et;t[135]!==Je||t[136]!==Xe?(et=(0,Q.jsxs)(mQ,{className:`flex h-auto flex-wrap`,"aria-label":`Review presentation`,"aria-busy":Je,children:[Ye,Xe,Qe,$e]}),t[135]=Je,t[136]=Xe,t[137]=et):et=t[137];let tt;t[138]!==qe||t[139]!==et||t[140]!==K?(tt=(0,Q.jsx)(fQ,{value:K,onValueChange:qe,children:et}),t[138]=qe,t[139]=et,t[140]=K,t[141]=tt):tt=t[141];let nt=Z.Suspense,rt;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Q.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading review content…`}),t[142]=rt):rt=t[142];let it=K===`walkthrough`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`nav`,{"aria-label":`Walkthrough progress`,className:`flex flex-wrap gap-1 border-b p-3`,children:[(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`·`,` `,ie.filter(e=>e.kind===`decision`&&de(e)).length,` `,`of `,T.layers.length,` decisions`]}),(0,Q.jsx)(X,{size:`xs`,variant:`ghost`,"aria-label":`Open the briefing`,onClick:()=>pe(`briefing`),children:`Briefing`}),ie.filter(H6).map(e=>(0,Q.jsxs)(X,{size:`xs`,variant:e.key===ce.key?`secondary`:`ghost`,className:`h-auto max-w-full text-left whitespace-normal`,"aria-pressed":e.key===ce.key,onClick:()=>pe(e.key),children:[vz(e),de(e)?` ✓`:``]},e.key))]}),st(B)&&(0,Q.jsxs)(`p`,{role:`alert`,className:`p-3 text-sm`,children:[`Reviewed marks could not be read.`,` `,(0,Q.jsx)(X,{variant:`outline`,size:`xs`,onClick:V,children:`Try again`})]}),q?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{variant:`ghost`,className:`self-start`,onClick:()=>re(void 0),children:`Back to decision`}),(0,Q.jsx)(P6,{revision:i,scope:k,context:a,path:q.path,step:q.step,active:_})]}):null,!q&&ce.kind===`briefing`&&(0,Q.jsx)(r6,{...ye,stops:ie,items:ue,decisions:le,done:de,onGo:pe}),!q&&ce.kind!==`briefing`&&(0,Q.jsxs)(`section`,{role:`region`,"aria-label":vz(ce),className:`flex flex-col`,children:[(0,Q.jsx)(p6,{stop:ce,stops:ie,review:T,decision:ce.kind===`decision`?le.get(ce.layer.id):void 0,finished:de(ce),onGo:pe,onStep:e=>re({path:e.pointer.path,step:e})}),ce.kind===`decision`&&(0,Q.jsx)(W6,{revision:i,layerId:ce.layer.id,fingerprint:ce.layer.fingerprint,reviewed:de(ce),files:i.files.filter(e=>ce.paths.includes(e.path)),settled:O(B),context:a}),(0,Q.jsx)(O6,{revision:i,paths:ce.paths,scope:k,context:a,active:_,marks:H??{files:[],decisions:[]},steps:ce.kind===`decision`?ce.layer.steps:[]},ce.key)]})]}),ot;t[143]!==a||t[144]!==g||t[145]!==T.layers||t[146]!==T.proof||t[147]!==i.headOid||t[148]!==i.publishedAt||t[149]!==k||t[150]!==K?(ot=K===`proof`&&(0,Q.jsxs)(`section`,{"aria-label":`Proof`,className:`p-4`,children:[(0,Q.jsx)(`h2`,{className:`mb-2 text-sm font-semibold`,children:`Proof`}),(0,Q.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[`Published `,DR(i.publishedAt),` · at`,` `,i.headOid.slice(0,7)]}),!g&&(0,Q.jsx)(`p`,{role:`status`,className:`mb-3 text-sm`,children:`These checks ran before the latest changes`}),T.proof.checks.some(V6)&&(0,Q.jsxs)(`div`,{role:`alert`,className:`mb-3 text-sm text-destructive`,children:[(0,Q.jsxs)(`p`,{children:[T.proof.checks.filter(B6).length,` `,`check failed`]}),(0,Q.jsx)(`p`,{children:`The agent reported this work as not passing yet.`})]}),(0,Q.jsx)(U3,{scope:k,context:a,proof:T.proof,layers:T.layers})]}),t[143]=a,t[144]=g,t[145]=T.layers,t[146]=T.proof,t[147]=i.headOid,t[148]=i.publishedAt,t[149]=k,t[150]=K,t[151]=ot):ot=t[151];let ct;t[152]!==a||t[153]!==i||t[154]!==k||t[155]!==re||t[156]!==ne||t[157]!==K?(ct=K===`comments`&&(0,Q.jsx)(L6,{scope:k,context:a,revision:i,onReveal:e=>{re({path:e}),ne(`walkthrough`)}}),t[152]=a,t[153]=i,t[154]=k,t[155]=re,t[156]=ne,t[157]=K,t[158]=ct):ct=t[158];let lt;t[159]!==W||t[160]!==pe||t[161]!==T.layers||t[162]!==N||t[163]!==j||t[164]!==K?(lt=K===`summary`&&N&&(0,Q.jsx)(`iframe`,{ref:e=>e?F3(e,e=>{let t=T.layers[e-1];t&&pe(dz(t.id))}):void 0,title:`Review summary`,src:`${j}#theme=${W?`dark`:`light`}`,sandbox:`allow-scripts allow-forms allow-popups allow-modals`,referrerPolicy:`no-referrer`,className:`min-h-96 w-full flex-1 border-0`}),t[159]=W,t[160]=pe,t[161]=T.layers,t[162]=N,t[163]=j,t[164]=K,t[165]=lt):lt=t[165];let ut;t[166]!==nt||t[167]!==rt||t[168]!==it||t[169]!==ot||t[170]!==ct||t[171]!==lt?(ut=(0,Q.jsxs)(nt,{fallback:rt,children:[it,ot,ct,lt]}),t[166]=nt,t[167]=rt,t[168]=it,t[169]=ot,t[170]=ct,t[171]=lt,t[172]=ut):ut=t[172];let dt;return t[173]!==xe||t[174]!==Ve||t[175]!==He||t[176]!==Ue||t[177]!==We||t[178]!==Ke||t[179]!==tt||t[180]!==ut?(dt=(0,Q.jsxs)(`section`,{"aria-label":`Review walkthrough`,className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-auto rounded-xl border bg-card`,children:[xe,Ve,He,Ue,We,Ke,tt,ut]}),t[173]=xe,t[174]=Ve,t[175]=He,t[176]=Ue,t[177]=We,t[178]=Ke,t[179]=tt,t[180]=ut,t[181]=dt):dt=t[181],dt}function B6(e){return e.result===`fail`}function V6(e){return e.result===`fail`}function H6(e){return e.kind!==`briefing`}function U6(e){return e.path}function W6(e){let t=(0,$.c)(22),{revision:n,layerId:r,fingerprint:i,reviewed:a,settled:o,context:s,files:c}=e,l;t[0]!==s.connection||t[1]!==n.reviewId?(l=EV({connection:s.connection,reviewId:n.reviewId}),t[0]=s.connection,t[1]=n.reviewId,t[2]=l):l=t[2];let u=l,[d,f]=Vi(u.completeDecision),[p,m]=Vi(u.unmark),h=!o||d.waiting||p.waiting,g;t[3]!==c||t[4]!==i||t[5]!==r||t[6]!==f||t[7]!==a||t[8]!==n.revision||t[9]!==m?(g=()=>a?m({kind:`decision`,layerId:r,fingerprint:i}):f({revision:n.revision,layerId:r,fingerprint:i,files:c.flatMap(G6)}),t[3]=c,t[4]=i,t[5]=r,t[6]=f,t[7]=a,t[8]=n.revision,t[9]=m,t[10]=g):g=t[10];let _=a?`Decision reviewed`:`Mark decision reviewed`,v;t[11]!==a||t[12]!==h||t[13]!==g||t[14]!==_?(v=(0,Q.jsx)(X,{variant:`outline`,size:`sm`,"aria-pressed":a,disabled:h,onClick:g,children:_}),t[11]=a,t[12]=h,t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==p||t[17]!==d?(y=(st(d)||st(p))&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`The decision mark could not be updated. Try again.`}),t[16]=p,t[17]=d,t[18]=y):y=t[18];let b;return t[19]!==v||t[20]!==y?(b=(0,Q.jsxs)(`div`,{className:`px-4 pb-4`,children:[v,y]}),t[19]=v,t[20]=y,t[21]=b):b=t[21],b}function G6(e){let t=e.newOid??e.oldOid;return t?[{path:e.path,headBlobOid:t}]:[]}function K6(e){let t=(0,$.c)(5),{scope:n,context:r,headOid:i}=e,a=RF(n,r.connection,void 0),o;t[0]===a.result?o=t[1]:(o=Gn(ar(a.result)),t[0]=a.result,t[1]=o);let s=o,c;return t[2]!==s||t[3]!==i?(c=s&&s.head.oid!==i?(0,Q.jsx)(`p`,{role:`status`,className:`border-b px-4 py-2 text-sm text-muted-foreground`,children:`The branch tip differs from this review. Publish a revision to include it.`}):null,t[2]=s,t[3]=i,t[4]=c):c=t[4],c}function q6(e){let t=(0,$.c)(10),{stops:n,current:r,onGo:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=e=>{let t=hz(n,r,e);t&&i(t.key)},t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o=a,s;t[4]===o?s=t[5]:(s=()=>o(1),t[4]=o,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c={ignoreInputs:!0},t[6]=c):c=t[6],xu(Il.nextStop,s,c);let l;t[7]===o?l=t[8]:(l=()=>o(-1),t[7]=o,t[8]=l);let u;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u={ignoreInputs:!0},t[9]=u):u=t[9],xu(Il.previousStop,l,u),null}function J6(e){let t=(0,$.c)(20),{scope:n,context:r,initialView:i,active:a}=e,o=a2(n,r),[s,c]=(0,Z.useState)(),l=o.review?.reviewId,u=$0(l??``);if(M(o.result)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading review…`}),t[0]=e):e=t[0],e}if(st(o.result)){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(t3,{title:`Review unavailable`,description:`The branch review could not be read. Try opening it from the project's Reviews list.`}),t[1]=e):e=t[1],e}if(!l||l===s){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(t3,{title:`No review on this branch`,description:`Publish a review for this branch, or open an existing review from the project's Reviews list.`}),t[2]=e):e=t[2],e}let d=o.review?.proof.current,f;t[3]===u?f=t[4]:(f=()=>u.choose(void 0),t[3]=u,t[4]=f);let p;t[5]!==o||t[6]!==l?(p=()=>{c(l),o.refresh()},t[5]=o,t[6]=l,t[7]=p):p=t[7];let m;return t[8]!==a||t[9]!==r||t[10]!==i||t[11]!==l||t[12]!==n||t[13]!==u.choose||t[14]!==u.request||t[15]!==u.revision||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,Q.jsx)(R6,{proofCurrent:d,active:a,reviewId:l,revision:u.revision,context:r,onRevision:u.choose,onBack:f,onDeleted:p,liveScope:n,initialView:i},u.request),t[8]=a,t[9]=r,t[10]=i,t[11]=l,t[12]=n,t[13]=u.choose,t[14]=u.request,t[15]=u.revision,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function Y6(e){let t=(0,$.c)(3),{scope:n,context:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Q.jsx)(J6,{scope:n,context:r,initialView:`proof`}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function X6(e){return[...new Set(e)].join(`, `)}function Z6(e){let t=(0,$.c)(25),{scope:n,context:r,interaction:i,paths:a,files:o,focus:s,header:c,headerActions:l,commentRequest:u,toolbar:d,agentNotes:f,footer:p}=e,m=o===void 0?[]:o,{connection:h}=r;U2(n,r);let g=OR(W2(n,r,CF(n,h),a),m),_=TF(n,h,g[0]?.statusToken??``,g.flatMap(a8),g.flatMap(r8)),v=jj(h,n,g.flatMap(t8)),y;t[0]===_.diffs?y=t[1]:(y=e=>{let t=WN(e);return t?_.diffs.get(JP(t)):void 0},t[0]=_.diffs,t[1]=y);let b=y,x=_.pending||v.pending,S=_.failed||v.failed,C=new Map(m.map(e8)),w;t[2]!==b||t[3]!==v?(w=e=>{let t=e.comparisons.flatMap(e=>{if(e.scope===`unmerged`)return[`Conflict`];if(e.scope===`untracked`)return v.contents.has(e.path)?[]:[`Not readable`];if(!e.supported)return[`Unsupported comparison`];let t=b(e);return t?t.kind===`binary`?[`Binary change`]:t.kind===`omitted`?[`Content omitted: ${VN(t.reason)}`]:kF(e,t)?[]:[`No single-file textual patch`]:[]});return t.length>0?[{item:e,reasons:t}]:[]},t[2]=b,t[3]=v,t[4]=w):w=t[4];let T=g.flatMap(w),E=g.flatMap(e=>e.comparisons.flatMap(t=>{let i=q4(n,r,e);if(t.scope===`untracked`){let n=v.contents.get(t.path);return n===void 0?[]:[{...Y2(YP(t),e.path,n,C.get(e.path)??`${t.scope} · untracked`),review:i,comment:{filePath:e.path,comparison:{kind:`worktree`,scope:`untracked`},...e.fingerprint?{contentFingerprint:e.fingerprint}:{}}}]}if(t.scope===`unmerged`||!t.supported)return[];let a=c8(b(t),s?.[e.path]),o=a?kF(t,a):null,c=C.get(e.path);return o?[{...o,...c?{note:c}:{},review:i,comment:{filePath:e.path,comparison:{kind:`worktree`,scope:t.scope},...e.fingerprint?{contentFingerprint:e.fingerprint}:{}}}]:[]}));for(let[e,t]of Object.entries(f??{})){let n=E.filter(t=>t.path===e),r=n.find($6)??n[0];if(r)for(let e of t){let t=r.kind===`file`?e.line<=r.contents.split(`
1382
+ `).length:r.fileDiff.hunks.some(t=>e.line>=t.additionStart&&e.line<t.additionStart+t.additionCount);r.agentNotes=[...r.agentNotes??[],{...e,line:t?e.line:0}]}}let D=new Set(E.map(Q6)),O=c||x||S||T.length>0?()=>(0,Q.jsxs)(Q.Fragment,{children:[c?.(),(x||S)&&(0,Q.jsx)(l8,{failed:S,retry:()=>{_.retry(),v.retry()}}),T.length>0&&(0,Q.jsx)(u8,{changes:T,renderedPaths:D,scope:n,context:r,...E.length===0&&u!==void 0?{commentRequest:u}:{}})]}):void 0,k;t[5]===u?k=t[6]:(k=u===void 0?{}:{commentRequest:u},t[5]=u,t[6]=k);let A;t[7]===p?A=t[8]:(A=p?{footer:p}:{},t[7]=p,t[8]=A);let j;t[9]===O?j=t[10]:(j=O?{header:O}:{},t[9]=O,t[10]=j);let M;t[11]===l?M=t[12]:(M=l?{headerActions:l}:{},t[11]=l,t[12]=M);let N;t[13]===d?N=t[14]:(N=d?{toolbar:d}:{},t[13]=d,t[14]=N);let P;return t[15]!==r||t[16]!==E||t[17]!==i||t[18]!==n||t[19]!==k||t[20]!==A||t[21]!==j||t[22]!==M||t[23]!==N?(P=(0,Q.jsx)(P4,{scope:n,context:r,interaction:i,...k,entries:E,...A,...j,...M,...N}),t[15]=r,t[16]=E,t[17]=i,t[18]=n,t[19]=k,t[20]=A,t[21]=j,t[22]=M,t[23]=N,t[24]=P):P=t[24],P}function Q6(e){return e.path}function $6(e){return e.comment?.comparison?.kind===`worktree`&&e.comment.comparison.scope===`unstaged`}function e8(e){return[e.path,e.note]}function t8(e){return e.comparisons.flatMap(n8)}function n8(e){return e.scope===`untracked`?[e.path]:[]}function r8(e){return e.comparisons.flatMap(i8)}function i8(e){let t=WN(e);return t?[t]:[]}function a8(e){return e.comparisons.some(o8)?[{path:e.path,fingerprint:e.fingerprint}]:[]}function o8(e){return e.scope===`staged`||e.scope===`unstaged`}var s8=new WeakMap;function c8(e,t){if(!e||!t?.length||e.kind!==`text`)return e;let n=t.map(e=>`${e.startLine}-${e.endLine}`).join(`,`),r=s8.get(e),i=r?.get(n);if(i)return i;let a=KP(e.patch,t),o=a?{...e,patch:a}:e;return r??=new Map,r.set(n,o),s8.set(e,r),o}function l8(e){let t=(0,$.c)(3),{failed:n,retry:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(`section`,{className:`mx-4 mt-3 flex items-center gap-3 rounded-lg border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"aria-live":`polite`,children:n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:`The changes in this document could not be read.`}),(0,Q.jsx)(X,{size:`xs`,variant:`outline`,onClick:r,children:`Load the changes again`})]}):(0,Q.jsx)(`span`,{children:`Loading changes…`})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function u8(e){let t=(0,$.c)(14),{changes:n,renderedPaths:r,scope:i,context:a,commentRequest:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:`Non-text content`}),t[0]=s):s=t[0];let c;if(t[1]!==n||t[2]!==o||t[3]!==a||t[4]!==r||t[5]!==i){let e;t[7]!==o||t[8]!==a||t[9]!==r||t[10]!==i?(e=e=>{let{item:t,reasons:n}=e;return(0,Q.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 basis-full truncate`,children:t.path}),Cw(t.path)&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:`Current worktree image`}),(0,Q.jsx)(ww,{scope:i,path:t.path,connection:a.connection})]}),(0,Q.jsx)(os,{variant:`outline`,className:`h-auto max-w-full text-left whitespace-normal`,children:X6(n)}),!r.has(t.path)&&(0,Q.jsx)(J4,{scope:i,context:a,path:t.path,fingerprint:t.fingerprint,status:t.reviewStatus,compact:!!t.fingerprint}),!r.has(t.path)&&(0,Q.jsx)(d8,{scope:i,context:a,path:t.path,...o===void 0?{}:{commentRequest:o}})]},t.path)},t[7]=o,t[8]=a,t[9]=r,t[10]=i,t[11]=e):e=t[11],c=n.map(e),t[1]=n,t[2]=o,t[3]=a,t[4]=r,t[5]=i,t[6]=c}else c=t[6];let l;return t[12]===c?l=t[13]:(l=(0,Q.jsxs)(`section`,{className:`mx-4 mt-3 rounded-lg border bg-muted/40 px-4 py-3`,children:[s,(0,Q.jsx)(`ul`,{className:`mt-2 flex flex-col gap-2 text-xs text-muted-foreground`,children:c})]}),t[12]=c,t[13]=l),l}function d8(e){let t=(0,$.c)(11),{scope:n,context:r,path:i,commentRequest:a}=e,{threads:o}=r4(n,r),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)();a!==void 0&&l!==a&&(u(a),c(!0));let d;if(t[0]!==s||t[1]!==r||t[2]!==i||t[3]!==n||t[4]!==o){let e;t[6]===i?e=t[7]:(e=e=>e.anchor.kind===`file`&&e.anchor.filePath===i&&!e.anchor.revision,t[6]=i,t[7]=e);let a=o.filter(e),l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>c(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=(0,Q.jsxs)(X,{size:`xs`,variant:`ghost`,className:`h-auto max-w-full text-left whitespace-normal`,onClick:l,children:[`Comment on `,i]}),t[9]=i,t[10]=u),d=(0,Q.jsxs)(Q.Fragment,{children:[u,(a.length>0||s)&&(0,Q.jsxs)(`div`,{className:`w-full space-y-2`,children:[a.map(e=>(0,Q.jsx)(N4,{scope:n,context:r,thread:e},e.id)),s&&(0,Q.jsx)(p4,{scope:n,context:r,anchor:{kind:`file`,filePath:i},onClose:()=>c(!1)})]})]}),t[0]=s,t[1]=r,t[2]=i,t[3]=n,t[4]=o,t[5]=d}else d=t[5];return d}function f8(e){let t=(0,$.c)(43),{scope:n,context:r,document:i,onOpen:a,sideLabel:o,active:s,reveal:c,base:l}=e,u=s!==void 0&&s,d=n.worktreeId,f;t[0]===i?f=t[1]:(f=p0(i),t[0]=i,t[1]=f);let p;t[2]!==u||t[3]!==c||t[4]!==n.worktreeId||t[5]!==f?(p={active:u,worktreeId:d,entry:f,reveal:c},t[2]=u,t[3]=c,t[4]=n.worktreeId,t[5]=f,t[6]=p):p=t[6];let m;t[7]!==r||t[8]!==a||t[9]!==n||t[10]!==o||t[11]!==p?(m={scope:n,context:r,onOpen:a,sideLabel:o,interaction:p},t[7]=r,t[8]=a,t[9]=n,t[10]=o,t[11]=p,t[12]=m):m=t[12];let h=m;switch(i.kind){case`handoff`:{let e;return t[13]===h?e=t[14]:(e=(0,Q.jsx)(h8,{...h}),t[13]=h,t[14]=e),e}case`all-changes`:{let e;return t[15]===h?e=t[16]:(e=(0,Q.jsx)(_8,{...h}),t[15]=h,t[16]=e),e}case`specs`:{let e;return t[17]===h?e=t[18]:(e=(0,Q.jsx)(_8,{...h,specsOnly:!0}),t[17]=h,t[18]=e),e}case`proof`:{let e;return t[19]!==r||t[20]!==n?(e=(0,Q.jsx)(Y6,{scope:n,context:r}),t[19]=r,t[20]=n,t[21]=e):e=t[21],e}case`change`:{let e;return t[22]!==i.path||t[23]!==h?(e=(0,Q.jsx)(C8,{...h,path:i.path}),t[22]=i.path,t[23]=h,t[24]=e):e=t[24],e}case`file`:{let e;return t[25]!==i.path||t[26]!==h?(e=(0,Q.jsx)(w3,{...h,path:i.path}),t[25]=i.path,t[26]=h,t[27]=e):e=t[27],e}case`commit`:{let e;return t[28]!==i.oid||t[29]!==h?(e=(0,Q.jsx)(d3,{...h,oid:i.oid}),t[28]=i.oid,t[29]=h,t[30]=e):e=t[30],e}case`branch`:{let e;return t[31]!==l||t[32]!==h?(e=(0,Q.jsx)(n3,{...h,base:l}),t[31]=l,t[32]=h,t[33]=e):e=t[33],e}case`branch-file`:{let e;return t[34]!==l||t[35]!==i.path||t[36]!==h?(e=(0,Q.jsx)(r3,{...h,base:l,path:i.path}),t[34]=l,t[35]=i.path,t[36]=h,t[37]=e):e=t[37],e}case`timeline`:{let e;return t[38]!==i.path||t[39]!==h?(e=(0,Q.jsx)(m8,{...h,path:i.path}),t[38]=i.path,t[39]=h,t[40]=e):e=t[40],e}case`graph`:{let e;return t[41]===h?e=t[42]:(e=(0,Q.jsx)(p8,{...h}),t[41]=h,t[42]=e),e}}}function p8(e){let t=(0,$.c)(8),{scope:n,context:r,onOpen:i,sideLabel:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(G4,{title:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(Gf,{className:`size-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:`Commit graph`})]}),subtitle:`Commits on this branch with their merges and refs`}),t[0]=o):o=t[0];let s;t[1]===i?s=t[2]:(s=(e,t)=>i({kind:`commit`,oid:e},void 0,{toSide:t===!0}),t[1]=i,t[2]=s);let c;return t[3]!==r.connection||t[4]!==n||t[5]!==a||t[6]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[o,(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,Q.jsx)(z2,{scope:n,connection:r.connection,sideLabel:a,onSelect:s})})]}),t[3]=r.connection,t[4]=n,t[5]=a,t[6]=s,t[7]=c):c=t[7],c}function m8(e){let t=(0,$.c)(17),{scope:n,context:r,path:i,onOpen:a,sideLabel:o}=e,s=`Timeline of ${i}`,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(Ap,{className:`size-4 shrink-0`}),t[0]=c):c=t[0];let l;t[1]===i?l=t[2]:(l=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[c,(0,Q.jsx)(`span`,{className:`truncate`,children:i})]}),t[1]=i,t[2]=l);let u;t[3]!==s||t[4]!==l?(u=(0,Q.jsx)(G4,{titleLabel:s,title:l,subtitle:`Commits that changed this file`}),t[3]=s,t[4]=l,t[5]=u):u=t[5];let d;t[6]===a?d=t[7]:(d=(e,t)=>a({kind:`commit`,oid:e.oid},{kind:`file`,filePath:e.path,revision:e.oid,comparison:{kind:`commit`,parent:1}},{toSide:t===!0}),t[6]=a,t[7]=d);let f;t[8]!==r.connection||t[9]!==i||t[10]!==n||t[11]!==o||t[12]!==d?(f=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,Q.jsx)(V2,{scope:n,connection:r.connection,path:i,sideLabel:o,onSelect:d})}),t[8]=r.connection,t[9]=i,t[10]=n,t[11]=o,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==u||t[15]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[u,f]}),t[14]=u,t[15]=f,t[16]=p):p=t[16],p}function h8(e){let t=(0,$.c)(4);if(a2(e.scope,e.context).review?.reviewId){let n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(J6,{...e,active:e.interaction.active}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,Q.jsx)(_8,{...e}),t[2]=e,t[3]=n),n}function g8(e,t){return e?`Specs`:t===`all-changes`?`All changes`:`Changes`}function _8(e){let t=(0,$.c)(26),{scope:n,context:r,interaction:i,specsOnly:a}=e,o=a!==void 0&&a,{connection:s}=r;U2(n,r);let{preferences:c}=Cl(),l=CF(n,s),u=W2(n,r,l),d=a2(n,r),f=!o&&d.review?.active?d.review:void 0,p;t[0]!==u||t[1]!==o?(p=o?u.filter(S8):u,t[0]=u,t[1]=o,t[2]=p):p=t[2];let m=p,h;t[3]!==l||t[4]!==c||t[5]!==f?(h=f?pz(f,l.changes.map(x8),{specsApart:c.collapseSpecs}).flatMap(b8):[],t[3]=l,t[4]=c,t[5]=f,t[6]=h):h=t[6];let g=h,_;t[7]!==m||t[8]!==o?(_=o?{paths:m.map(y8)}:{},t[7]=m,t[8]=o,t[9]=_):_=t[9];let v;t[10]!==f||t[11]!==g?(v=f?{files:g,agentNotes:J2(...f.layers.map(v8),q2(f.notExplained))}:{},t[10]=f,t[11]=g,t[12]=v):v=t[12];let y;t[13]!==m||t[14]!==r||t[15]!==i.entry||t[16]!==n||t[17]!==o?(y=e=>(0,Q.jsxs)(G4,{title:g8(o,i.entry),subtitle:`${m.length} files`,children:[e,(0,Q.jsx)(Y4,{scope:n,context:r,entries:m})]}),t[13]=m,t[14]=r,t[15]=i.entry,t[16]=n,t[17]=o,t[18]=y):y=t[18];let b;return t[19]!==r||t[20]!==i||t[21]!==n||t[22]!==_||t[23]!==v||t[24]!==y?(b=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Q.jsx)(Z6,{scope:n,context:r,interaction:i,..._,...v,toolbar:y})}),t[19]=r,t[20]=i,t[21]=n,t[22]=_,t[23]=v,t[24]=y,t[25]=b):b=t[25],b}function v8(e,t){return K2(e,t+1)}function y8(e){return e.path}function b8(e){return e.paths.map(t=>({path:t,note:vz(e)}))}function x8(e){return e.path}function S8(e){return lz(e.path)}function C8(e){let t=(0,$.c)(14),{scope:n,context:r,interaction:i,onOpen:a,path:o}=e,{connection:s}=r;U2(n,r);let c=CF(n,s),l;if(t[0]===o?l=t[1]:(l=[o],t[0]=o,t[1]=l),!W2(n,r,c,l).find(e=>e.path===o)){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(t3,{title:`Change no longer present`,description:`Choose a change that is still present in the current review.`}),t[2]=e):e=t[2],e}let u;t[3]!==r||t[4]!==i||t[5]!==a||t[6]!==o||t[7]!==n?(u=e=>(0,Q.jsx)(Z6,{...i.reveal?.compose?{commentRequest:i.reveal.nonce}:{},headerActions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(X,{variant:`ghost`,size:`xs`,onClick:()=>a({kind:`file`,path:o}),children:[(0,Q.jsx)(Tf,{}),(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:`Open file`})]}),e]}),scope:n,context:r,interaction:i,paths:[o]}),t[3]=r,t[4]=i,t[5]=a,t[6]=o,t[7]=n,t[8]=u):u=t[8];let d;return t[9]!==r||t[10]!==o||t[11]!==n||t[12]!==u?(d=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Q.jsx)(GQ,{scope:n,context:r,path:o,variant:`quiet`,children:u})}),t[9]=r,t[10]=o,t[11]=n,t[12]=u,t[13]=d):d=t[13],d}function w8(e,t){let n=(0,$.c)(6),r;n[0]===e?r=n[1]:(r=F(e),n[0]=e,n[1]=r);let i;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promiseExit`},n[2]=i):i=n[2];let a=y(r,i),o;return n[3]!==a||n[4]!==t?(o=e=>{a(t).then(t=>{Nn(t)&&e()})},n[3]=a,n[4]=t,n[5]=o):o=n[5],o}var T8=class extends Z.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,Q.jsx)(`div`,{className:`px-1.5 py-3`,children:(0,Q.jsx)(Ho,{children:(0,Q.jsxs)(bo,{children:[NR(this.state.error),(0,Q.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>{this.props.reset(()=>this.setState({error:null}))},children:`Try again`})]})})}):this.props.children}};function E8(e){let t=(0,$.c)(6),{children:n,connection:r,scope:i}=e,a=w8(r,i),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`div`,{role:`status`,"aria-label":`Loading review`,className:`flex flex-col gap-3 p-4`,children:[(0,Q.jsx)(zL,{className:`h-5 w-2/3`}),(0,Q.jsx)(zL,{className:`h-9 w-full`}),(0,Q.jsx)(zL,{className:`h-9 w-full`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Loading review…`})]}),t[0]=o):o=t[0];let s;t[1]===n?s=t[2]:(s=(0,Q.jsx)(Z.Suspense,{fallback:o,children:n}),t[1]=n,t[2]=s);let c;return t[3]!==a||t[4]!==s?(c=(0,Q.jsx)(T8,{reset:a,children:s}),t[3]=a,t[4]=s,t[5]=c):c=t[5],c}var D8=`flex w-full min-w-0 items-center gap-1.5 rounded-lg px-2 py-1 text-left text-caption transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:font-medium`;function O8(e){let t=(0,$.c)(30),{path:n,document:r,note:i,scopes:a,reviewStatus:o,commentCount:s,active:c,onOpen:l,sideLabel:u,onReview:d,canReview:f,onDiscard:p,indented:m}=e,h=m!==void 0&&m,g;t[0]===n?g=t[1]:(g=FR(n),t[0]=n,t[1]=g);let _;t[2]===a?_=t[3]:(_=a.length>0?` · ${a.join(` + `)}`:``,t[2]=a,t[3]=_);let v=`${g}${_}`,y;t[4]!==r||t[5]!==p||t[6]!==l||t[7]!==d||t[8]!==n?(y=e=>{bb10:switch(e){case`review`:d();break bb10;case`comment`:l(r,{kind:`file`,filePath:n},{compose:!0});break bb10;case`open`:l(r);break bb10;case`open-to-side`:l(r,void 0,{toSide:!0});break bb10;case`open-file`:l({kind:`file`,path:n});break bb10;case`timeline`:l({kind:`timeline`,path:n});break bb10;case`copy-relative`:At(n,`relative path`);break bb10;case`discard`:p?.()}},t[4]=r,t[5]=p,t[6]=l,t[7]=d,t[8]=n,t[9]=y):y=t[9];let b=y,x=`Actions for ${n}`,S=p!==void 0,C;t[10]!==f||t[11]!==o||t[12]!==u||t[13]!==S?(C=Tz({kind:`file`,status:o,canReview:f,sideLabel:u,canDiscard:S}),t[10]=f,t[11]=o,t[12]=u,t[13]=S,t[14]=C):C=t[14];let w;t[15]!==c||t[16]!==s||t[17]!==r||t[18]!==h||t[19]!==v||t[20]!==i||t[21]!==l||t[22]!==n||t[23]!==o?(w=e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":c,"aria-label":v,title:i==null?n:`${n}\n${i}`,className:Y(D8,`flex-1 text-muted-foreground`,h&&`pl-7`,c&&`bg-accent font-medium text-foreground`),onClick:e=>l(r,void 0,{toSide:e.altKey}),children:[(0,Q.jsx)(k8,{status:o}),(0,Q.jsx)(mw,{path:n,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate`,o===`reviewed`&&`line-through decoration-muted-foreground/40`),children:FR(n)}),s>0&&(0,Q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 text-2xs`,children:[(0,Q.jsx)(sp,{className:`size-3`}),s]})]}),e]}),t[15]=c,t[16]=s,t[17]=r,t[18]=h,t[19]=v,t[20]=i,t[21]=l,t[22]=n,t[23]=o,t[24]=w):w=t[24];let T;return t[25]!==b||t[26]!==x||t[27]!==C||t[28]!==w?(T=(0,Q.jsx)(E4,{label:x,actions:C,onAction:b,children:w}),t[25]=b,t[26]=x,t[27]=C,t[28]=w,t[29]=T):T=t[29],T}function k8(e){let t=(0,$.c)(8),{status:n}=e,r=n??`unreviewed`,i;t[0]===n?i=t[1]:(i=j8(n),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(A8,{status:r}),t[2]=r,t[3]=a);let o;return t[4]!==r||t[5]!==i||t[6]!==a?(o=(0,Q.jsx)(`span`,{className:`grid w-3.5 shrink-0 place-items-center`,"data-review-state":r,title:i,children:a}),t[4]=r,t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function A8(e){let t=(0,$.c)(3),{status:n}=e;if(n===`reviewed`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(o,{className:`size-3.5 text-graph-2`}),t[0]=e):e=t[0],e}if(n===`stale`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Mp,{className:`size-3 text-graph-4`}),t[1]=e):e=t[1],e}let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/60`}),t[2]=r):r=t[2],r}function j8(e){return e===`reviewed`?`Reviewed`:e===`stale`?`Changed since review`:`Not reviewed`}function M8(e){let t=(0,$.c)(9),{label:n,active:r,onOpen:i,children:a}=e,o=`Actions for ${n}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=Tz({kind:`section`}),t[0]=s):s=t[0];let c;t[1]!==r||t[2]!==a||t[3]!==i?(c=e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,Q.jsx)(`button`,{type:`button`,className:D8,"aria-pressed":r,onClick:i,children:a}),e]}),t[1]=r,t[2]=a,t[3]=i,t[4]=c):c=t[4];let l;return t[5]!==i||t[6]!==o||t[7]!==c?(l=(0,Q.jsx)(E4,{label:o,actions:s,onAction:i,children:c}),t[5]=i,t[6]=o,t[7]=c,t[8]=l):l=t[8],l}function N8(e){let t=(0,$.c)(17),{name:n,count:r,expanded:i,onExpanded:a,onAll:o,children:s}=e,c=i?Na:Zo,l=`Actions for ${n}`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=Tz({kind:`group`}),t[0]=u):u=t[0];let d;t[1]===o?d=t[2]:(d=e=>o(e===`expand-all`),t[1]=o,t[2]=d);let f;t[3]!==c||t[4]!==r||t[5]!==i||t[6]!==n||t[7]!==a?(f=e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:D8,"aria-label":n,"aria-expanded":i,onClick:()=>a(!i),children:[(0,Q.jsx)(c,{className:`size-3.5 shrink-0`}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[n,` · `,r,` files`]})]}),e]}),t[3]=c,t[4]=r,t[5]=i,t[6]=n,t[7]=a,t[8]=f):f=t[8];let p;t[9]!==l||t[10]!==d||t[11]!==f?(p=(0,Q.jsx)(E4,{label:l,actions:u,onAction:d,children:f}),t[9]=l,t[10]=d,t[11]=f,t[12]=p):p=t[12];let m=i&&s,h;return t[13]!==n||t[14]!==p||t[15]!==m?(h=(0,Q.jsxs)(`section`,{"aria-label":n,className:`mt-3 border-t pt-2`,children:[p,m]}),t[13]=n,t[14]=p,t[15]=m,t[16]=h):h=t[16],h}function P8(e){let t=(0,$.c)(6),{review:n,context:r,onOpen:i,activeEntry:a}=e;if(!n.reviewId)return null;let o;return t[0]!==a||t[1]!==r||t[2]!==i||t[3]!==n.reviewId||t[4]!==n.revision?(o=(0,Q.jsx)(F8,{reviewId:n.reviewId,revision:n.revision,context:r,onOpen:i,activeEntry:a}),t[0]=a,t[1]=r,t[2]=i,t[3]=n.reviewId,t[4]=n.revision,t[5]=o):o=t[5],o}function F8(e){let t=(0,$.c)(38),{reviewId:n,revision:r,context:i,onOpen:a,activeEntry:o}=e,{connection:s}=i,c;t[0]!==s||t[1]!==n?(c=_V({connection:s,reviewId:n}),t[0]=s,t[1]=n,t[2]=c):c=t[2];let l=at(c),u;t[3]!==s||t[4]!==n?(u=yV({connection:s,reviewId:n}),t[3]=s,t[4]=n,t[5]=u):u=t[5];let d=at(u),f=Gn(ar(l)),p=Gn(ar(d)),m;t[6]!==s||t[7]!==n?(m=EV({connection:s,reviewId:n}),t[6]=s,t[7]=n,t[8]=m):m=t[8];let h=m,[g,_]=Vi(h.completeDecision),[v,y]=Vi(h.unmark),b=Y0(`${n}:${r}`),x=$0(n),{preferences:S}=Cl();if(!f?.revision){let e=o===`handoff`,n;t[9]===a?n=t[10]:(n=()=>a({kind:`handoff`}),t[9]=a,t[10]=n);let r;return t[11]!==e||t[12]!==n?(r=(0,Q.jsx)(M8,{label:`Open review`,active:e,onOpen:n,children:`Open review`}),t[11]=e,t[12]=n,t[13]=r):r=t[13],r}let C=f.revision,w=pz(C.content,C.files.map(L8),{specsApart:S.collapseSpecs}),T=Dz(C,p),E=Oz(C,p),D;t[14]!==a||t[15]!==b||t[16]!==x?(D=e=>{x.choose(void 0),b.setPlace(e),a({kind:`handoff`})},t[14]=a,t[15]=b,t[16]=x,t[17]=D):D=t[17];let k=D,A=w.map(e=>{let t=yz(e,T,E),n=gz(e.paths,T),r=T.filter(t=>e.paths.includes(t.path));return(0,Q.jsx)(E4,{label:e.kind===`decision`?`More actions for decision ${e.number}`:`More actions for ${_z(e)}`,...e.kind===`decision`?{description:e.layer.title}:{},actions:Tz(e.kind===`decision`?{kind:`decision`,reviewed:t,stale:!1,settled:O(d),pending:g.waiting||v.waiting,files:r}:{kind:`section`}),onAction:n=>{n===`open`&&k(e.key),n===`review`&&e.kind===`decision`&&(t?y({kind:`decision`,layerId:e.layer.id,fingerprint:e.layer.fingerprint}):_({revision:C.revision,layerId:e.layer.id,fingerprint:e.layer.fingerprint,files:r.flatMap(I8)}))},children:r=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,Q.jsxs)(X,{variant:`ghost`,size:`sm`,className:`min-w-0 flex-1 justify-start`,"aria-pressed":o===`handoff`&&b.place===e.key,onClick:()=>k(e.key),children:[e.kind===`decision`&&(0,Q.jsx)(`span`,{children:t?`✓`:e.number}),(0,Q.jsx)(`span`,{className:`truncate`,children:_z(e)}),e.kind!==`briefing`&&(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[n.reviewed,`/`,n.total]})]}),r]})},e.key)}),j;t[18]!==g||t[19]!==v?(j=(st(g)||st(v))&&(0,Q.jsx)(`p`,{role:`alert`,className:`p-2 text-xs text-destructive`,children:`The review mark could not be updated.`}),t[18]=g,t[19]=v,t[20]=j):j=t[20];let M=M8,N=o===`proof`,P;t[21]===a?P=t[22]:(P=()=>a(d0),t[21]=a,t[22]=P);let F=CR(bR(C.content.proof)),I;t[23]!==M||t[24]!==N||t[25]!==P||t[26]!==F?(I=(0,Q.jsxs)(M,{label:`Proof`,active:N,onOpen:P,children:[`Proof · `,F]}),t[23]=M,t[24]=N,t[25]=P,t[26]=F,t[27]=I):I=t[27];let L=o===`all-changes`,R;t[28]===a?R=t[29]:(R=()=>a(c0),t[28]=a,t[29]=R);let z;t[30]!==L||t[31]!==R?(z=(0,Q.jsx)(M8,{label:`All changes`,active:L,onOpen:R,children:`All changes`}),t[30]=L,t[31]=R,t[32]=z):z=t[32];let B;return t[33]!==I||t[34]!==z||t[35]!==A||t[36]!==j?(B=(0,Q.jsxs)(`nav`,{"aria-label":`Walkthrough`,className:`flex flex-col`,children:[A,j,I,z]}),t[33]=I,t[34]=z,t[35]=A,t[36]=j,t[37]=B):B=t[37],B}function I8(e){return e.fingerprint?[{path:e.path,headBlobOid:e.fingerprint}]:[]}function L8(e){return e.path}function R8({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=z8(B8(r,i),t);if(!n)return Z.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!Z.isValidElement(n))return null;let o=n.props,s={...z8(a,o),ref:U8(a.ref,o.ref)};return Z.cloneElement(n,s)}function z8(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];t[n]=n===`className`?[i,r].filter(Boolean).join(` `):n===`style`?{...i,...r}:n===`ref`?U8(i,r):H8(n)&&typeof i==`function`&&typeof r==`function`?V8(r,i):r}}return t}function B8(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function V8(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function H8(e){return/^on[A-Z]/.test(e)}function U8(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var W8=8,G8=64,K8=0,q8=.5,J8=180,Y8=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),X8={start:!1,end:!1},Z8={currentAnchorId:null,visibleMessageIds:[]};function Q8({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return X8;let i=u5({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function $8({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return Z8;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of e5(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+q8&&(u=e)}return l.length===0&&u===null?Z8:{currentAnchorId:u,visibleMessageIds:l}}function e5(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function t5(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function n5(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function r5(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function i5(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function a5({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of e5(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function o5({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=s5(t,i),o=t.getBoundingClientRect().height,s=p5(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function s5(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function c5(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function l5({content:e,scrollTop:t,spacer:n,viewport:r}){let i=u5({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function u5({content:e,spacer:t,viewport:n}){let r=e5(e,t),i=f5(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function d5(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function f5(e){let t=window.getComputedStyle(e);return{end:h5(t.paddingBlockEnd||t.paddingBottom),start:h5(t.paddingBlockStart||t.paddingTop)}}function p5(e){let t=e?.parentElement;return t?f5(t):{end:0,start:0}}function m5(e){if(!e)return 0;let t=window.getComputedStyle(e);return h5(t.rowGap===`normal`?t.gap:t.rowGap)}function h5(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function g5(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function _5(e,t){return g5(e,t)}function v5(){return g5(Z8,b5)}function y5(e,t){return e.start===t.start&&e.end===t.end}function b5(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function x5({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:r,scrollPreviousItemPeek:i}){let a=Z.useRef(e),o=Z.useRef(!1),s=Z.useRef(null),c=Z.useRef(!1),l=Z.useRef(n),u=Z.useRef(0),d=Z.useRef(null),f=Z.useRef(0),p=Z.useRef(e?`following-bottom`:`free-scrolling`),m=Z.useRef(new Map),h=Z.useRef(null),g=Z.useRef(null),_=Z.useRef(null),v=Z.useRef(i),y=Z.useRef(!0),b=Z.useRef(null),x=Z.useRef(r),S=Z.useRef(null),C=Z.useRef(0),w=Z.useRef(0),T=Z.useRef(null),E=Z.useRef(null),D=Z.useRef(null),O=Z.useRef(null),k=Z.useRef(null),A=Z.useRef(null),j=Z.useRef(null),M=Z.useRef(null),N=Z.useRef(null),P=Z.useRef(new Set),F=Z.useRef(new WeakSet);return D.current===null&&(D.current=_5(t===`end`||t===`last-anchor`,(e,t)=>e===t)),O.current===null&&(O.current=_5(X8,y5)),N.current===null&&(N.current=v5()),a.current=e,l.current=n,x.current=r,v.current=i,{autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:k,streamingTurnRef:_,contentRef:s,defaultScrollPositionAppliedRef:c,firstItemRef:d,itemCountRef:u,lastScrollTopRef:f,messageElementsRef:m,modeRef:p,pendingScrollFrameRef:S,pendingScrollToMessageRef:h,prependRestoreRef:g,preserveScrollOnPrependRef:y,pendingDefaultScrollStore:D.current,rootRef:b,scrollEdgeThresholdRef:l,scrollMarginRef:x,scrollPreviousItemPeekRef:v,spacerGapRef:C,spacerHeightRef:w,spacerRef:T,stateFrameRef:E,stateStore:O.current,viewportRef:A,visibilityFrameRef:j,visibilityObserverRef:M,visibilityStore:N.current,visibleMessageIdsRef:P,handledScrollAnchorsRef:F}}function S5(e){e.pendingDefaultScrollStore.setSnapshot(!1)}function C5(e){e.defaultScrollPositionAppliedRef.current=!0,S5(e)}function w5({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,itemCountRef:l,messageElementsRef:u,modeRef:d,pendingScrollToMessageRef:f,prependRestoreRef:p,scrollMarginRef:m,scrollPreviousItemPeekRef:h,spacerGapRef:g,spacerHeightRef:_,spacerRef:v,viewportRef:y}=e,b=Z.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},J8))},[t]),x=Z.useCallback(e=>{let t=v.current;if(!t)return;let n=Math.max(0,Math.ceil(e));_.current!==n&&(_.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-g.current}px`:``)},[]),S=Z.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=y.current;if(!a)return;let o=Math.max(0,e);if(Math.abs(a.scrollTop-o)<=q8){a.scrollTop=o,t();return}i&&b(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,b]),C=Z.useCallback(({behavior:e=`auto`}={})=>y.current?(x(0),i.current=null,d.current=`free-scrolling`,S(0,{behavior:e}),r(),!0):!1,[r,S,x]),w=Z.useCallback(({behavior:e=`auto`}={})=>{let t=y.current;return t?(x(0),i.current=null,d.current=a.current?`following-bottom`:`free-scrolling`,S(d5(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,S,x]),T=Z.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=m.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=y.current;if(!s||!l||!s.contains(e))return!1;let u=o5({align:t,element:e,scrollMargin:o?a+h.current:a,spacer:v.current,viewport:l}),f=l5({content:s,scrollTop:u,spacer:v.current,viewport:l});return x(f),p.current={element:e,viewportTop:c5(e,l)},d.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,S(u,{behavior:n}),r(),!0},[r,S,x]),E=Z.useCallback(()=>{let e=i.current;return!e||!e.isConnected||d.current!==`anchored-to-message`?!1:T(e,{align:`start`},{keepPreviousPeek:!0})},[T]),D=Z.useCallback((t,n)=>{let r=u.current.get(t);return r?(C5(e),T(r,n)?(f.current=null,!0):(f.current={messageId:t,options:n},!0)):l.current===0&&(f.current={messageId:t,options:n},C5(e),!0)},[T]);return{flushPendingScrollToMessage:Z.useCallback(()=>{let t=f.current;if(!t)return!1;let n=u.current.get(t.messageId);return!n||!T(n,t.options)?!1:(f.current=null,C5(e),!0)},[T]),reanchorToAnchoredMessage:E,scrollToElement:T,scrollToEnd:w,scrollToMessage:D,scrollToStart:C}}function T5(e,t){return Z.useCallback(n=>{e.current=n,n&&t()},[e,t])}function E5({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=W8,scrollPreviousItemPeek:r=G8,scrollMargin:i=K8}){let a=x5({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:v,prependRestoreRef:y,preserveScrollOnPrependRef:b,pendingDefaultScrollStore:x,rootRef:S,scrollEdgeThresholdRef:C,scrollMarginRef:w,scrollPreviousItemPeekRef:T,spacerGapRef:E,spacerHeightRef:D,spacerRef:O,stateFrameRef:k,stateStore:A,viewportRef:j,visibilityFrameRef:M,visibilityObserverRef:N,visibilityStore:P,visibleMessageIdsRef:F,handledScrollAnchorsRef:I}=a,L=Z.useRef(t);L.current!==t&&(L.current=t,d.current=!1);let R=Z.useCallback(e=>{let t=S.current,n=j.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),z=Z.useCallback(e=>{let t=j.current?.scrollTop??0,n=t<m.current-q8;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),B=Z.useCallback(()=>{let e=Q8({content:u.current,scrollEdgeThreshold:C.current,spacer:O.current,viewport:j.current});z(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;R(t),A.setSnapshot(t)},[z,A,R]),V=Z.useCallback(()=>{k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null,B()}))},[B]),H=Z.useCallback(()=>{P.hasListeners()&&M.current===null&&(M.current=window.requestAnimationFrame(()=>{M.current=null,P.hasListeners()&&P.setSnapshot($8({content:u.current,scrollMargin:w.current,scrollPreviousItemPeek:T.current,spacer:O.current,viewport:j.current,visibleMessageIds:F.current}))}))},[P]),{flushPendingScrollToMessage:U,reanchorToAnchoredMessage:W,scrollToElement:G,scrollToEnd:ee,scrollToMessage:te,scrollToStart:K}=w5({refs:a,commitScrollState:B,scheduleStateCommit:V,scheduleVisibilitySync:H}),ne=Z.useCallback(()=>{let e=y.current,t=j.current;if(!e||!t||!e.element.isConnected)return!1;let n=c5(e.element,t)-e.viewportTop;return Math.abs(n)<=q8?!1:(t.scrollTop+=n,e.viewportTop=c5(e.element,t),V(),H(),!0)},[V,H]),q=Z.useCallback(()=>{let e=u.current,t=j.current;if(!e||!t){y.current=null;return}let n=a5({content:e,spacer:O.current,viewport:t});y.current=n?{element:n,viewportTop:c5(n,t)}:null},[]),re=Z.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,U()&&q()}))},[q,U]),ie=Z.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=j.current,r=t&&n?i5(e5(t,O.current)):null;if(!t||!n||!r)e=ee({behavior:`auto`});else{let i=s5(r,n);e=u5({content:t,spacer:O.current,viewport:n})-i<=n.clientHeight?ee({behavior:`auto`}):G(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?ee({behavior:`auto`}):K({behavior:`auto`});return e?(C5(a),!0):!1},[t,G,ee,K]),ae=Z.useCallback(()=>{let e=u.current;if(!e)return;let t=e5(e,O.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(U())return;if(n===0){if(ie()||t.length>0&&s.current&&ee({behavior:`auto`}))return;B(),H();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){ne();return}if(t.length>n){let e=t5(t,n);if(e){if(s.current&&g.current===`following-bottom`&&r5(t,n)){ee({behavior:`auto`});return}G(e,{align:`start`},{keepPreviousPeek:!0}),I.current.add(e);return}}if(t.length===n){let e=n5(t,I.current);if(e){G(e,{align:`start`},{keepPreviousPeek:!0}),I.current.add(e);return}}g.current===`following-bottom`&&s.current?ee({behavior:`auto`}):(B(),H())})(),q()},[ie,q,B,U,ne,H,G,ee]),oe=Z.useCallback(()=>{if(g.current===`following-bottom`&&s.current){ee({behavior:`auto`});return}let e=D.current;if(W()){s.current&&e>0&&D.current===0&&ee({behavior:`auto`});return}V(),H()},[W,V,H,ee]),se=Z.useCallback(()=>{let e=j.current;if(e&&P.hasListeners()){if(typeof IntersectionObserver>`u`){H();return}N.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?F.current.add(e):F.current.delete(e))}H()},{root:e,rootMargin:`${-(w.current+T.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{N.current?.observe(e)}),H()}},[H,P]),ce=Z.useCallback(()=>{M.current!==null&&(window.cancelAnimationFrame(M.current),M.current=null),N.current?.disconnect(),N.current=null,F.current.clear(),P.setSnapshot(Z8)},[P]),le=Z.useCallback((e,t,n)=>{if(t){h.current.set(e,t),N.current?.observe(t),H(),v.current?.messageId===e&&re();return}n&&h.current.get(e)===n&&(h.current.delete(e),F.current.delete(e),N.current?.unobserve(n),H())},[re,H]),ue=Z.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),de=Z.useCallback(()=>R(A.getSnapshot()),[A,R]),fe=T5(S,de),pe=T5(j,de),me=Z.useCallback(e=>{u.current=e},[]),he=Z.useCallback(e=>{O.current=e,E.current=m5(e?.parentElement??null)},[]),ge=Z.useCallback(()=>{B(),H(),q()},[q,B,H]),_e=Z.useMemo(()=>({handleContentChange:ae,handleResize:oe,observeVisibility:se,pendingDefaultScrollStore:x,preserveScrollOnPrependRef:b,scrollToEnd:ee,scrollToMessage:te,scrollToStart:K,setContentElement:me,setRootElement:fe,setSpacerElement:he,setViewportElement:pe,stateStore:A,syncAfterScroll:ge,unobserveVisibility:ce,userScrollIntent:ue,viewportRef:j,visibilityStore:P}),[ae,oe,se,x,ee,te,K,me,fe,he,pe,A,ge,ce,ue,P]);return Z.useLayoutEffect(()=>{ie()||p.current===0&&S5(a)},[ie]),Z.useEffect(()=>()=>{k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),M.current!==null&&(window.cancelAnimationFrame(M.current),M.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),N.current?.disconnect(),N.current=null},[]),Z.useLayoutEffect(()=>{if(e&&g.current===`following-bottom`&&p.current>0){ee({behavior:`auto`});return}B()},[e,B,ee]),{context:_e,registerMessage:le}}function D5(e){let t=Z.useRef(e);return t.current=e,t}var O5=Z.createContext(null),k5=Z.createContext(null);function A5(){let e=Z.useContext(O5);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function j5(){let e=Z.useContext(k5);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function M5({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=E5({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,Q.jsx)(O5.Provider,{value:o,children:(0,Q.jsx)(k5.Provider,{value:s,children:t})})}function N5(){let{pendingDefaultScrollStore:e}=A5();return Z.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function P5({children:e,...t}){let{setRootElement:n}=A5(),r=N5();return(0,Q.jsx)(`div`,{ref:n,...t,...r?{"data-pending-scroll":``}:null,children:e})}function F5({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=A5(),_=N5();f.current=o;let v=Z.useCallback(e=>{p(e),U8(s)?.(e)},[s,p]);function y(e){m(),r?.(e)}function b(e){h(),a?.(e)}function x(e){h(),i?.(e)}function S(e){Y8.has(e.key)&&h(),n?.(e)}return Z.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,Q.jsx)(`div`,{ref:v,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:S,onScroll:y,onTouchMove:x,onWheel:b,...u,..._?{"data-pending-scroll":``}:null,children:t})}function I5({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=A5(),u=Z.useRef(null),d=Z.useCallback(e=>{u.current=e,c(e),U8(n)?.(e)},[n,c]);return Z.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),Z.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,Q.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,Q.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function L5({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=j5(),a=Z.useRef(null),o=Z.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),U8(t)?.(n)},[e,t,i]);return(0,Q.jsx)(`div`,{ref:o,"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function R5({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=A5(),d=D5(r),f=Z.useCallback(e=>u.subscribe(e),[u]),p=Z.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=Z.useSyncExternalStore(f,p,p),h=Z.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return R8({defaultTagName:`button`,props:z8({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,Q.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var z5={Provider:M5,Root:P5,Viewport:F5,Content:I5,Item:L5,Button:R5};function B5(e){return(0,Q.jsx)(z5.Provider,{...e})}function V5({className:e,...t}){return(0,Q.jsx)(z5.Root,{"data-slot":`message-scroller`,className:Y(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,e),...t})}function H5({className:e,...t}){return(0,Q.jsx)(z5.Viewport,{"data-slot":`message-scroller-viewport`,className:Y(`size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent data-pending-scroll:invisible`,e),...t})}function U5({className:e,...t}){return(0,Q.jsx)(z5.Content,{"data-slot":`message-scroller-content`,className:Y(`flex h-max min-h-full flex-col gap-8`,e),...t})}function W5({className:e,scrollAnchor:t=!1,...n}){return(0,Q.jsx)(z5.Item,{"data-slot":`message-scroller-item`,scrollAnchor:t,className:Y(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,e),...n})}function G5({direction:e=`end`,className:t,children:n,render:r,variant:i=`secondary`,size:a=`icon-sm`,...o}){return(0,Q.jsx)(z5.Button,{"data-slot":`message-scroller-button`,"data-direction":e,"data-variant":i,"data-size":a,direction:e,className:Y(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,t),render:r??(0,Q.jsx)(X,{variant:i,size:a}),...o,children:n??(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Id,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:e===`end`?`Scroll to end`:`Scroll to start`})]})})}function K5(e){let t=(0,$.c)(62),{scope:n,connection:r,base:i,onBase:a}=e,[o,s]=(0,Z.useState)(!1),c=zF(n,r,o),l,u,d,f,p,m,h,g,_,v,y,b,x,S,C;if(t[0]!==i||t[1]!==c.refresh||t[2]!==c.result||t[3]!==a||t[4]!==o){let e=Gn(ar(c.result)),n;t[20]===i?n=t[21]:(n=i==null?`the default branch`:z$(i),t[20]=i,t[21]=n);let r=n,w=e?.defaultRef??null,T=i??w,E=[{heading:`Local`,entries:e?.bases.filter(Y5)??[]},{heading:`Remote`,entries:e?.bases.filter(J5)??[]}].filter(q5),D=e=>{a(e===w?void 0:e),s(!1)};f=x$,C=o,m=s;let k=`Compare against ${r}`,A;t[22]===k?A=t[23]:(A=(0,Q.jsx)(X,{variant:`outline`,size:`sm`,className:`w-full justify-between`,"aria-label":k,title:`Choose the branch this one is compared against`}),t[22]=k,t[23]=A);let j;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(Vf,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[24]=j):j=t[24];let N;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Against `}),t[25]=N):N=t[25];let P;t[26]===r?P=t[27]:(P=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[j,(0,Q.jsxs)(`span`,{className:`truncate`,children:[N,r]})]}),t[26]=r,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(Kd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[28]=F):F=t[28],t[29]!==A||t[30]!==P?(h=(0,Q.jsxs)(S$,{render:A,children:[P,F]}),t[29]=A,t[30]=P,t[31]=h):h=t[31],d=C$,x=`start`,S=`w-72`,u=oZ,t[32]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(cZ,{"aria-label":`Find a base branch`,placeholder:`Find a branch`}),t[32]=b):b=t[32],l=lZ,p=`Base branches`,t[33]===c.result?g=t[34]:(g=M(c.result)&&(0,Q.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-muted-foreground`,children:`Reading branches…`}),t[33]=c.result,t[34]=g),t[35]!==c.refresh||t[36]!==c.result?(_=st(c.result)&&(0,Q.jsxs)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`block`,children:`The branches could not be read.`}),(0,Q.jsx)(X,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:c.refresh,children:`Try again`})]}),t[35]=c.refresh,t[36]=c.result,t[37]=_):_=t[37],t[38]===c.result?v=t[39]:(v=O(c.result)&&(0,Q.jsx)(uZ,{children:`No branch matches.`}),t[38]=c.result,t[39]=v),y=E.map(e=>(0,Q.jsx)(dZ,{heading:e.heading,children:e.entries.map(e=>(0,Q.jsxs)(fZ,{value:e.name,"data-checked":e.ref===T,onSelect:()=>D(e.ref),children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),e.ref===w&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`default`})]},e.ref))},e.heading)),t[0]=i,t[1]=c.refresh,t[2]=c.result,t[3]=a,t[4]=o,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=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]=C}else l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],m=t[10],h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19];let w;t[40]!==l||t[41]!==p||t[42]!==g||t[43]!==_||t[44]!==v||t[45]!==y?(w=(0,Q.jsxs)(l,{"aria-label":p,children:[g,_,v,y]}),t[40]=l,t[41]=p,t[42]=g,t[43]=_,t[44]=v,t[45]=y,t[46]=w):w=t[46];let T;t[47]!==u||t[48]!==w||t[49]!==b?(T=(0,Q.jsxs)(u,{children:[b,w]}),t[47]=u,t[48]=w,t[49]=b,t[50]=T):T=t[50];let E;t[51]!==d||t[52]!==T||t[53]!==x||t[54]!==S?(E=(0,Q.jsx)(d,{align:x,className:S,children:T}),t[51]=d,t[52]=T,t[53]=x,t[54]=S,t[55]=E):E=t[55];let D;return t[56]!==f||t[57]!==m||t[58]!==h||t[59]!==E||t[60]!==C?(D=(0,Q.jsxs)(f,{open:C,onOpenChange:m,children:[h,E]}),t[56]=f,t[57]=m,t[58]=h,t[59]=E,t[60]=C,t[61]=D):D=t[61],D}function q5(e){return e.entries.length>0}function J5(e){return e.remote}function Y5(e){return!e.remote}function X5(e){let t=(0,$.c)(16),{scope:n,context:r,base:i,activeEntry:a,threads:o,onOpen:s,sideLabel:c,onBase:l}=e,u;t[0]!==i||t[1]!==r.connection||t[2]!==l||t[3]!==n?(u=(0,Q.jsx)(`div`,{className:`shrink-0 px-2 pt-2`,children:(0,Q.jsx)(K5,{scope:n,connection:r.connection,base:i,onBase:l})}),t[0]=i,t[1]=r.connection,t[2]=l,t[3]=n,t[4]=u):u=t[4];let d;t[5]!==a||t[6]!==i||t[7]!==r||t[8]!==s||t[9]!==n||t[10]!==c||t[11]!==o?(d=(0,Q.jsx)(Z5,{scope:n,context:r,base:i,activeEntry:a,threads:o,onOpen:s,sideLabel:c}),t[5]=a,t[6]=i,t[7]=r,t[8]=s,t[9]=n,t[10]=c,t[11]=o,t[12]=d):d=t[12];let f;return t[13]!==u||t[14]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[u,d]}),t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function Z5(e){let t=(0,$.c)(20),{scope:n,context:r,base:i,activeEntry:a,threads:o,onOpen:s,sideLabel:c}=e,{connection:l}=r,u=RF(n,l,i);if(st(u.result)){let e;t[0]===u.result?e=t[1]:(e=ZP(st(u.result)?nt(u.result.cause):void 0),t[0]=u.result,t[1]=e);let n;t[2]===e?n=t[3]:(n=(0,Q.jsx)(`span`,{className:`block`,children:e}),t[2]=e,t[3]=n);let r;t[4]===u.refresh?r=t[5]:(r=(0,Q.jsx)(X,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:u.refresh,children:`Try again`}),t[4]=u.refresh,t[5]=r);let i;return t[6]!==n||t[7]!==r?(i=(0,Q.jsxs)(`div`,{role:`alert`,className:`p-3 text-xs text-muted-foreground`,children:[n,r]}),t[6]=n,t[7]=r,t[8]=i):i=t[8],i}if(!O(u.result)){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Q5,{}),t[9]=e):e=t[9],e}if(u.result.value.base===void 0){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`div`,{className:`p-3`,children:(0,Q.jsx)(t3,{title:`No default branch`,description:`Choose the branch this one is compared against.`})}),t[10]=e):e=t[10],e}let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Q5,{}),t[11]=d):d=t[11];let f;return t[12]!==a||t[13]!==u.result.value||t[14]!==r||t[15]!==s||t[16]!==n||t[17]!==c||t[18]!==o?(f=(0,Q.jsx)(Z.Suspense,{fallback:d,children:(0,Q.jsx)($5,{scope:n,context:r,branch:u.result.value,activeEntry:a,threads:o,onOpen:s,sideLabel:c})}),t[12]=a,t[13]=u.result.value,t[14]=r,t[15]=s,t[16]=n,t[17]=c,t[18]=o,t[19]=f):f=t[19],f}function Q5(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-muted-foreground`,children:`Comparing the branch…`}),e[0]=t):t=e[0],t}function $5(e){let t=(0,$.c)(49),{scope:n,context:r,branch:i,activeEntry:a,threads:o,onOpen:s,sideLabel:c}=e,{preferences:l}=Cl(),u;t[0]===i?u=t[1]:(u=BR(i),t[0]=i,t[1]=u);let d=u,f=H2(n,r,d),p=n4(n,r,e7,d);if(i.base===null||i.base===void 0)return null;let m,h,g,_,v,y,b;if(t[2]!==a||t[3]!==i.base.ref||t[4]!==i.commits||t[5]!==i.files||t[6]!==i.head.branch||t[7]!==f||t[8]!==s||t[9]!==l.collapseSpecs||t[10]!==p||t[11]!==c||t[12]!==o){let e=MR(i.files,f),n;t[20]===i.head.branch?n=t[21]:(n=i.head.branch===null||i.head.branch===void 0?`this commit`:z$(i.head.branch),t[20]=i.head.branch,t[21]=n);let r=n,u=`${i.commits} ${i.commits===1?`commit`:`commits`}`;m=hL,b=`h-0 min-h-0 flex-1`,h=`p-2 pr-3`;let d;t[22]===i.base.ref?d=t[23]:(d=z$(i.base.ref),t[22]=i.base.ref,t[23]=d),t[24]!==u||t[25]!==r||t[26]!==d?(g=(0,Q.jsxs)(`p`,{className:`px-2 pb-1.5 text-2xs text-muted-foreground`,children:[u,` on `,r,` since `,d]}),t[24]=u,t[25]=r,t[26]=d,t[27]=g):g=t[27];let x;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(x=p0(u0),t[28]=x):x=t[28];let S;t[29]===s?S=t[30]:(S=()=>s(u0),t[29]=s,t[30]=S);let C,w;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(Vf,{className:`size-3.5 shrink-0 text-muted-foreground`}),w=(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`All branch changes`}),t[31]=C,t[32]=w):(C=t[31],w=t[32]),_=(0,Q.jsxs)(M8,{label:`All branch changes`,active:a===x,onOpen:S,children:[C,w,(0,Q.jsx)(`span`,{className:`ml-auto text-2xs text-muted-foreground tabular-nums`,children:e.length})]}),v=e.length===0&&(0,Q.jsxs)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:[`No changes since `,z$(i.base.ref)]});let T;t[33]!==a||t[34]!==s||t[35]!==p||t[36]!==c||t[37]!==o?(T=e=>(0,Q.jsx)(O8,{path:e.path,document:{kind:`branch-file`,path:e.path},note:e.status,scopes:[e.status],reviewStatus:e.reviewStatus,commentCount:o.filter(t=>t.anchor.comparison?.kind===`branch`&&cR(t.anchor)===e.path&&!t.resolved).length,active:a===p0({kind:`branch-file`,path:e.path}),onOpen:s,sideLabel:c,canReview:e.fingerprint!==null&&e.fingerprint!==void 0,onReview:()=>p.toggle({path:e.path,reviewed:e.reviewStatus===`reviewed`,fingerprint:e.fingerprint})},e.path),t[33]=a,t[34]=s,t[35]=p,t[36]=c,t[37]=o,t[38]=T):T=t[38],y=uz(e,l.collapseSpecs).map(T),t[2]=a,t[3]=i.base.ref,t[4]=i.commits,t[5]=i.files,t[6]=i.head.branch,t[7]=f,t[8]=s,t[9]=l.collapseSpecs,t[10]=p,t[11]=c,t[12]=o,t[13]=m,t[14]=h,t[15]=g,t[16]=_,t[17]=v,t[18]=y,t[19]=b}else m=t[13],h=t[14],g=t[15],_=t[16],v=t[17],y=t[18],b=t[19];let x;t[39]!==h||t[40]!==g||t[41]!==_||t[42]!==v||t[43]!==y?(x=(0,Q.jsxs)(`div`,{className:h,children:[g,_,v,y]}),t[39]=h,t[40]=g,t[41]=_,t[42]=v,t[43]=y,t[44]=x):x=t[44];let S;return t[45]!==m||t[46]!==b||t[47]!==x?(S=(0,Q.jsx)(m,{className:b,children:x}),t[45]=m,t[46]=b,t[47]=x,t[48]=S):S=t[48],S}function e7(e){return ul.add(e)}function t7(e){return e===1?`1 resolved thread`:`${e} resolved threads`}function n7(e){let t=(0,$.c)(48),{scope:n,context:r,threads:i}=e,[a,o]=(0,Z.useState)(null),s=f4(n,r),c;t[0]===i?c=t[1]:(c=fR(i),t[0]=i,t[1]=c);let{confirmed:l,kept:u}=c,d;t[2]===s.result?d=t[3]:(d=Gn(ar(s.result))?.skipped.length??0,t[2]=s.result,t[3]=d);let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>o(null),t[4]=p):p=t[4];let m=p,h=l.length===0,g;t[5]!==l||t[6]!==s?(g=()=>{s.reset(),o(l)},t[5]=l,t[6]=s,t[7]=g):g=t[7];let _;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(Gp,{"data-icon":`inline-start`}),t[8]=_):_=t[8];let v;t[9]!==h||t[10]!==g?(v=(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,size:`xs`,className:`ml-auto`,disabled:h,onClick:g,children:[_,`Delete resolved`]}),t[9]=h,t[10]=g,t[11]=v):v=t[11];let y;t[12]!==a||t[13]!==s.result||t[14]!==f?(y=a!==null&&!(O(s.result)&&f===0),t[12]=a,t[13]=s.result,t[14]=f,t[15]=y):y=t[15];let b;t[16]===s.result?b=t[17]:(b=e=>{!e&&!s.result.waiting&&m()},t[16]=s.result,t[17]=b);let x;t[18]!==a?.length||t[19]!==s.result||t[20]!==f?(x=O(s.result)?`Kept ${f===1?`1 thread`:`${f} threads`} that changed`:`Delete ${t7(a?.length??0)}?`,t[18]=a?.length,t[19]=s.result,t[20]=f,t[21]=x):x=t[21];let S;t[22]===x?S=t[23]:(S=(0,Q.jsx)(bM,{children:x}),t[22]=x,t[23]=S);let C;t[24]!==u||t[25]!==s.result?(C=O(s.result)?`The agent answered or someone reopened them after you confirmed, so they stay for you to read first.`:`This deletes the resolved threads you started, with the agent's replies in them, for you and for the agent.${u>0?` ${t7(u)} the agent started ${u===1?`stays`:`stay`}, since you cannot delete what the agent wrote on its own.`:``}`,t[24]=u,t[25]=s.result,t[26]=C):C=t[26];let w;t[27]===C?w=t[28]:(w=(0,Q.jsx)(xM,{children:C}),t[27]=C,t[28]=w);let T;t[29]!==S||t[30]!==w?(T=(0,Q.jsxs)(vM,{children:[S,w]}),t[29]=S,t[30]=w,t[31]=T):T=t[31];let E;t[32]===s.result?E=t[33]:(E=st(s.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:NR(nt(s.result.cause))}),t[32]=s.result,t[33]=E);let D;t[34]!==a||t[35]!==s?(D=(0,Q.jsx)(yM,{children:O(s.result)?(0,Q.jsx)(X,{onClick:m,children:`Close`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(CM,{disabled:s.result.waiting,children:`Cancel`}),(0,Q.jsx)(X,{variant:`destructive`,disabled:s.result.waiting,onClick:()=>s.send(a??[]),children:s.result.waiting?`Deleting…`:`Delete`})]})}),t[34]=a,t[35]=s,t[36]=D):D=t[36];let k;t[37]!==T||t[38]!==E||t[39]!==D?(k=(0,Q.jsxs)(_M,{children:[T,E,D]}),t[37]=T,t[38]=E,t[39]=D,t[40]=k):k=t[40];let A;t[41]!==k||t[42]!==y||t[43]!==b?(A=(0,Q.jsx)(mM,{open:y,onOpenChange:b,children:k}),t[41]=k,t[42]=y,t[43]=b,t[44]=A):A=t[44];let j;return t[45]!==A||t[46]!==v?(j=(0,Q.jsxs)(Q.Fragment,{children:[v,A]}),t[45]=A,t[46]=v,t[47]=j):j=t[47],j}function r7(e){let t=(0,$.c)(10),{files:n,review:r,threads:i,onSelect:a}=e,o;t[0]!==n||t[1]!==r||t[2]!==i?(o=oz({files:n,review:r,explains:!0,threads:i}),t[0]=n,t[1]=r,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==n||t[5]!==a?(s=e=>a(e,n.find(i7)?.path),t[4]=n,t[5]=a,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,Q.jsx)(l7,{items:o,onSelect:s}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function i7(e){return e.reviewStatus===`stale`}function a7(e){let t=(0,$.c)(9),{scope:n,context:r,base:i,review:a,threads:o,onSelect:s}=e,{connection:c}=r,l=RF(n,c,i),u;t[0]===l.result?u=t[1]:(u=Gn(ar(l.result)),t[0]=l.result,t[1]=u);let d=u;if(d?.base===null||d?.base===void 0)return null;let f;return t[2]!==d||t[3]!==r||t[4]!==s||t[5]!==a||t[6]!==n||t[7]!==o?(f=(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(o7,{scope:n,context:r,branch:d,review:a,threads:o,onSelect:s})}),t[2]=d,t[3]=r,t[4]=s,t[5]=a,t[6]=n,t[7]=o,t[8]=f):f=t[8],f}function o7(e){let t=(0,$.c)(16),{scope:n,context:r,branch:i,review:a,threads:o,onSelect:s}=e,c;t[0]===i?c=t[1]:(c=BR(i),t[0]=i,t[1]=c);let l=H2(n,r,c);if(i.base===null||i.base===void 0)return null;let u,d,f;t[2]!==i.files||t[3]!==l||t[4]!==a||t[5]!==o?(d=MR(i.files,l),u=l7,f=oz({files:d,review:a,explains:!1,threads:o}),t[2]=i.files,t[3]=l,t[4]=a,t[5]=o,t[6]=u,t[7]=d,t[8]=f):(u=t[6],d=t[7],f=t[8]);let p;t[9]!==d||t[10]!==s?(p=e=>s(e,d.find(s7)?.path),t[9]=d,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==u||t[13]!==f||t[14]!==p?(m=(0,Q.jsx)(u,{items:f,onSelect:p}),t[12]=u,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function s7(e){return e.reviewStatus===`stale`}function c7(e){return e.some(e=>e.tone===`failing`)?`failing`:e.some(e=>e.tone===`attention`)?`attention`:`ok`}function l7(e){let t=(0,$.c)(27),{items:n,onSelect:r}=e,i;t[0]===n?i=t[1]:(i=c7(n),t[0]=n,t[1]=i);let a=i,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-caption hover:bg-accent`}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,Q.jsx)(u7,{tone:a}),t[3]=a,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`span`,{className:`font-medium`,children:`Readiness`}),t[5]=c):c=t[5];let l=a===`failing`&&`text-destructive`,u;t[6]===l?u=t[7]:(u=Y(`ml-auto truncate text-2xs text-muted-foreground`,l),t[6]=l,t[7]=u);let d;t[8]===n?d=t[9]:(d=sz(n),t[8]=n,t[9]=d);let f;t[10]!==u||t[11]!==d?(f=(0,Q.jsx)(`span`,{className:u,children:d}),t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(Na,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-closed/readiness:-rotate-90`}),t[13]=p):p=t[13];let m;t[14]!==s||t[15]!==f?(m=(0,Q.jsxs)(oH,{render:o,children:[s,c,f,p]}),t[14]=s,t[15]=f,t[16]=m):m=t[16];let h;if(t[17]!==n||t[18]!==r){let e;t[20]===r?e=t[21]:(e=e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,className:Y(`flex w-full min-w-0 items-center gap-1.5 rounded-md px-1.5 py-0.5 text-left text-caption text-muted-foreground hover:bg-accent hover:text-foreground`,e.tone===`failing`&&`font-medium text-destructive`),onClick:()=>r(e.key),children:[(0,Q.jsx)(u7,{tone:e.tone}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label})]})},e.key),t[20]=r,t[21]=e),h=n.map(e),t[17]=n,t[18]=r,t[19]=h}else h=t[19];let g;t[22]===h?g=t[23]:(g=(0,Q.jsx)(sH,{children:(0,Q.jsx)(`ul`,{className:`px-1 pb-1`,children:h})}),t[22]=h,t[23]=g);let _;return t[24]!==m||t[25]!==g?(_=(0,Q.jsx)(`section`,{"aria-label":`Readiness`,className:`mx-2 mt-2 shrink-0 rounded-lg border bg-muted/20`,children:(0,Q.jsxs)(aH,{defaultOpen:!0,className:`group/readiness`,children:[m,g]})}),t[24]=m,t[25]=g,t[26]=_):_=t[26],_}function u7(e){let t=(0,$.c)(3),{tone:n}=e;if(n===`ok`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(ac,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-graph-2`}),t[0]=e):e=t[0],e}if(n===`failing`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Qd,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-destructive`}),t[1]=e):e=t[1],e}let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(Jd,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-graph-4`}),t[2]=r):r=t[2],r}function d7(e){let t=(0,$.c)(74),{scope:n,context:r,activeEntry:i,onOpen:a,sideLabel:o,changeScope:s,base:c,onChangeScope:l,onBase:u}=e,{connection:d}=r,[f,p]=(0,Z.useState)(`layers`);U2(n,r),i4(n,r);let m=CF(n,d),h=a2(n,r).review??null,{setPlace:g}=Y0(`${h?.reviewId??n.worktreeId}:${h?.revision??``}`),{threads:_}=r4(n,r),v=W2(n,r,m),y;t[0]===_?y=t[1]:(y=_.filter(f7),t[0]=_,t[1]=y);let b=y.length,x=s===`branch`,S;t[2]!==x||t[3]!==a||t[4]!==h||t[5]!==g?(S=(e,t)=>{if(e===`comments`||e===`replies`){p(`comments`);return}p(`layers`),e===`checks`&&a(d0),e===`unexplained`&&(h&&g(`unexplained`),a({kind:`handoff`})),e===`files`&&a(x?u0:{kind:`handoff`}),e===`stale`&&t!==void 0&&a(x?{kind:`branch-file`,path:t}:{kind:`change`,path:t})},t[2]=x,t[3]=a,t[4]=h,t[5]=g,t[6]=S):S=t[6];let C=S,w;t[7]===l?w=t[8]:(w=e=>{GZ(e)&&l(e)},t[7]=l,t[8]=w);let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsxs)(mQ,{variant:`line`,className:`w-full`,"aria-label":`Changes to review`,children:[(0,Q.jsx)(hQ,{value:`uncommitted`,className:`flex-1`,children:`Uncommitted`}),(0,Q.jsx)(hQ,{value:`branch`,className:`flex-1`,children:`Branch`})]}),t[9]=T):T=t[9];let E;t[10]!==s||t[11]!==w?(E=(0,Q.jsx)(`div`,{className:`shrink-0 px-2`,children:(0,Q.jsx)(fQ,{value:s,onValueChange:w,children:T})}),t[10]=s,t[11]=w,t[12]=E):E=t[12];let D;t[13]!==c||t[14]!==x||t[15]!==v||t[16]!==r||t[17]!==h||t[18]!==n||t[19]!==C||t[20]!==_?(D=x?(0,Q.jsx)(a7,{scope:n,context:r,base:c,review:h,threads:_,onSelect:C}):(0,Q.jsx)(r7,{files:v,review:h,threads:_,onSelect:C}),t[13]=c,t[14]=x,t[15]=v,t[16]=r,t[17]=h,t[18]=n,t[19]=C,t[20]=_,t[21]=D):D=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>{(e===`layers`||e===`comments`)&&p(e)},t[22]=O):O=t[22];let k=h&&!x?`Explore`:`Changed files`,A;t[23]===k?A=t[24]:(A=(0,Q.jsx)(hQ,{value:`layers`,className:`flex-1`,children:k}),t[23]=k,t[24]=A);let j;t[25]===b?j=t[26]:(j=b>0&&(0,Q.jsx)(os,{variant:`secondary`,className:`h-4 min-w-4`,children:b}),t[25]=b,t[26]=j);let M;t[27]===j?M=t[28]:(M=(0,Q.jsxs)(hQ,{value:`comments`,className:`flex-1`,children:[`Comments`,j]}),t[27]=j,t[28]=M);let N;t[29]!==M||t[30]!==A?(N=(0,Q.jsxs)(mQ,{className:`h-8 w-full`,children:[A,M]}),t[29]=M,t[30]=A,t[31]=N):N=t[31];let P;t[32]!==N||t[33]!==f?(P=(0,Q.jsx)(`div`,{className:`shrink-0 px-2 pt-2`,children:(0,Q.jsx)(fQ,{value:f,onValueChange:O,"aria-label":`Review views`,children:N})}),t[32]=N,t[33]=f,t[34]=P):P=t[34];let F;t[35]!==i||t[36]!==c||t[37]!==x||t[38]!==r||t[39]!==u||t[40]!==a||t[41]!==n||t[42]!==o||t[43]!==_||t[44]!==f?(F=f===`layers`&&x&&(0,Q.jsx)(X5,{scope:n,context:r,base:c,activeEntry:i,threads:_,onOpen:a,sideLabel:o,onBase:u}),t[35]=i,t[36]=c,t[37]=x,t[38]=r,t[39]=u,t[40]=a,t[41]=n,t[42]=o,t[43]=_,t[44]=f,t[45]=F):F=t[45];let I;t[46]!==i||t[47]!==x||t[48]!==v||t[49]!==r||t[50]!==m||t[51]!==a||t[52]!==h||t[53]!==n||t[54]!==o||t[55]!==_||t[56]!==f?(I=f===`layers`&&!x&&(0,Q.jsx)(p7,{scope:n,context:r,activeEntry:i,onOpen:a,sideLabel:o,list:m,review:h,changes:v,threads:_}),t[46]=i,t[47]=x,t[48]=v,t[49]=r,t[50]=m,t[51]=a,t[52]=h,t[53]=n,t[54]=o,t[55]=_,t[56]=f,t[57]=I):I=t[57];let L;t[58]!==c||t[59]!==x||t[60]!==r||t[61]!==m||t[62]!==a||t[63]!==n||t[64]!==_||t[65]!==f?(L=f===`comments`&&(0,Q.jsx)(S7,{list:m,threads:_,branch:x,base:c,scope:n,context:r,onOpen:a}),t[58]=c,t[59]=x,t[60]=r,t[61]=m,t[62]=a,t[63]=n,t[64]=_,t[65]=f,t[66]=L):L=t[66];let R;return t[67]!==P||t[68]!==F||t[69]!==I||t[70]!==L||t[71]!==E||t[72]!==D?(R=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[E,D,P,F,I,L]}),t[67]=P,t[68]=F,t[69]=I,t[70]=L,t[71]=E,t[72]=D,t[73]=R):R=t[73],R}function f7(e){return!e.resolved}function p7(e){let t=(0,$.c)(19),{scope:n,context:r,activeEntry:i,onOpen:a,sideLabel:o,list:s,review:c,changes:l,threads:u}=e,{preferences:d}=Cl(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f={changes:!0,specs:!1},t[0]=f):f=t[0];let[p,m]=(0,Z.useState)(f),h=s.changes.map(v7),g=d.collapseSpecs?h.filter(_7):h,_=d.collapseSpecs?h.filter(lz):[],v=new Map(l.map(g7)),y=n4(n,r,h7),[b,x]=(0,Z.useState)(null),S=e=>(0,Q.jsx)(O8,{path:e,document:{kind:`change`,path:e},note:void 0,scopes:[...new Set(s.changes.find(t=>t.path===e)?.comparisons.map(m7))],reviewStatus:v.get(e)?.reviewStatus,commentCount:u.filter(t=>cR(t.anchor)===e&&!t.resolved).length,active:i===p0({kind:`change`,path:e}),onOpen:a,sideLabel:o,canReview:v.get(e)?.fingerprint!==null&&v.get(e)?.fingerprint!==void 0,onReview:()=>y.toggle({path:e,reviewed:v.get(e)?.reviewStatus===`reviewed`,fingerprint:v.get(e)?.fingerprint}),onDiscard:()=>x(t=>({path:e,nonce:(t?.nonce??0)+1}))},e),C=hL,w;t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==c?(w=c?(0,Q.jsx)(P8,{context:r,review:c,activeEntry:i,onOpen:a}):(0,Q.jsx)(M8,{label:`All changes`,active:i===`handoff`,onOpen:()=>a({kind:`handoff`}),children:`All changes`}),t[1]=i,t[2]=r,t[3]=a,t[4]=c,t[5]=w):w=t[5];let T=h.length===0&&(0,Q.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`No changes`}),E=g.length>0&&(0,Q.jsx)(N8,{name:`Changed files`,count:g.length,expanded:p.changes,onExpanded:e=>m(t=>({...t,changes:e})),onAll:e=>m({changes:e,specs:e}),children:g.map(S)}),D=_.length>0&&(0,Q.jsxs)(N8,{name:`Specs`,count:_.length,expanded:p.specs,onExpanded:e=>m(t=>({...t,specs:e})),onAll:e=>m({changes:e,specs:e}),children:[(0,Q.jsx)(M8,{label:`Open all specs`,active:i===`specs`,onOpen:()=>a(l0),children:`Open all specs`}),_.map(S)]}),O;t[6]!==r||t[7]!==b||t[8]!==n?(O=b&&(0,Q.jsx)(GQ,{scope:n,context:r,path:b.path,signal:b.nonce,hiddenTrigger:!0}),t[6]=r,t[7]=b,t[8]=n,t[9]=O):O=t[9];let k;t[10]!==w||t[11]!==T||t[12]!==E||t[13]!==D||t[14]!==O?(k=(0,Q.jsxs)(`div`,{className:`p-2 pr-3`,children:[w,T,E,D,O]}),t[10]=w,t[11]=T,t[12]=E,t[13]=D,t[14]=O,t[15]=k):k=t[15];let A;return t[16]!==C||t[17]!==k?(A=(0,Q.jsx)(C,{className:`h-0 min-h-0 flex-1`,children:k}),t[16]=C,t[17]=k,t[18]=A):A=t[18],A}function m7(e){return e.scope}function h7(e){return ul.add(e)}function g7(e){return[e.path,e]}function _7(e){return!lz(e)}function v7(e){return e.path}function y7(e){let t=(0,$.c)(10),{scope:n,context:r,anchor:i}=e,[a,o]=(0,Z.useState)(!1),s=i?.comparison?.kind===`branch`;if(a&&i){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>o(!1),t[0]=e):e=t[0];let a;return t[1]!==i||t[2]!==r||t[3]!==n?(a=(0,Q.jsx)(p4,{scope:n,context:r,anchor:i,onClose:e}),t[1]=i,t[2]=r,t[3]=n,t[4]=a):a=t[4],a}let c=i==null,l,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),u=(0,Q.jsx)(ap,{"data-icon":`inline-start`}),t[5]=l,t[6]=u):(l=t[5],u=t[6]);let d=s?`Comment on the whole branch`:`Comment on the whole change`,f;return t[7]!==c||t[8]!==d?(f=(0,Q.jsx)(`div`,{className:`shrink-0 px-2 pt-2`,children:(0,Q.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,className:`w-full`,disabled:c,onClick:l,children:[u,d]})}),t[7]=c,t[8]=d,t[9]=f):f=t[9],f}function b7(e){let t=(0,$.c)(12),{scope:n,context:r,base:i}=e,{connection:a}=r,o=RF(n,a,i),s,c,l,u;if(t[0]!==o.result||t[1]!==r||t[2]!==n){let e=Gn(ar(o.result)),i=e?.base?.ref,a=e?.head.oid;s=y7,c=n,l=r,u=i==null||a==null?void 0:lR({base:i,tip:a}),t[0]=o.result,t[1]=r,t[2]=n,t[3]=s,t[4]=c,t[5]=l,t[6]=u}else s=t[3],c=t[4],l=t[5],u=t[6];let d;return t[7]!==s||t[8]!==c||t[9]!==l||t[10]!==u?(d=(0,Q.jsx)(s,{scope:c,context:l,anchor:u}),t[7]=s,t[8]=c,t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function x7(e,t){return e.comparison?.kind===`branch`?{kind:`branch-file`,path:e.filePath}:e.revision!==null&&e.revision!==void 0?{kind:`commit`,oid:e.revision}:e.comparison?.kind!==`file`&&t.has(e.filePath)?{kind:`change`,path:e.filePath}:{kind:`file`,path:e.filePath}}function S7(e){let t=(0,$.c)(27),{scope:n,context:r,list:i,threads:a,branch:o,base:s,onOpen:c}=e,[l,u]=(0,Z.useState)(`open`),d=new Set(i.changes.map(T7)),f=[...a].filter(e=>e.resolved===(l===`resolved`)).sort(w7),p;t[0]===a?p=t[1]:(p=a.filter(C7),t[0]=a,t[1]=p);let m=p.length,h=a.length-m,g;t[2]!==m||t[3]!==h?(g={open:m,resolved:h},t[2]=m,t[3]=h,t[4]=g):g=t[4];let _=g,v=l===`open`?`No open comments yet.`:`Nothing resolved yet.`;o4(n,r,l);let y=e=>{if(e.kind===`change`){c(e.comparison?.kind===`branch`?u0:{kind:`handoff`},e);return}c(x7(e,d),e)},b;t[5]!==s||t[6]!==o||t[7]!==r||t[8]!==n?(b=o?(0,Q.jsx)(b7,{scope:n,context:r,base:s}):(0,Q.jsx)(y7,{scope:n,context:r,anchor:lR(void 0)}),t[5]=s,t[6]=o,t[7]=r,t[8]=n,t[9]=b):b=t[9];let x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=[`open`,`resolved`],t[10]=x):x=t[10];let S;t[11]!==_||t[12]!==l?(S=x.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":l===e,onClick:()=>u(e),className:Y(`rounded-md px-2 py-1 text-2xs capitalize text-muted-foreground transition-colors hover:bg-accent`,l===e&&`bg-accent text-foreground`),children:[e,` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:_[e]})]},e)),t[11]=_,t[12]=l,t[13]=S):S=t[13];let C;t[14]!==r||t[15]!==l||t[16]!==h||t[17]!==n||t[18]!==a?(C=l===`resolved`&&h>0&&(0,Q.jsx)(n7,{scope:n,context:r,threads:a}),t[14]=r,t[15]=l,t[16]=h,t[17]=n,t[18]=a,t[19]=C):C=t[19];let w;t[20]!==S||t[21]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1 px-2 pt-2`,children:[S,C]}),t[20]=S,t[21]=C,t[22]=w):w=t[22];let T=f.length===0?(0,Q.jsx)(`p`,{className:`px-4 py-6 text-center text-caption text-muted-foreground`,children:v}):(0,Q.jsx)(B5,{autoScroll:!0,defaultScrollPosition:`end`,children:(0,Q.jsxs)(V5,{className:`min-h-0 flex-1`,children:[(0,Q.jsx)(H5,{"aria-label":`Comments`,children:(0,Q.jsx)(U5,{className:Y(``,``),children:f.map((e,t)=>(0,Q.jsx)(W5,{messageId:e.id,scrollAnchor:t===f.length-1,children:(0,Q.jsx)(N4,{thread:e,scope:n,context:r,onReveal:()=>y(e.anchor)})},e.id))})}),(0,Q.jsx)(G5,{})]})},l),E;return t[23]!==b||t[24]!==w||t[25]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[b,w,T]}),t[23]=b,t[24]=w,t[25]=T,t[26]=E):E=t[26],E}function C7(e){return!e.resolved}function w7(e,t){return E7(e).localeCompare(E7(t))}function T7(e){return e.path}function E7(e){return e.messages.at(-1)?.createdAt??``}function D7(e){let t=(0,$.c)(43),{scope:n,context:r,worktreePath:i,surface:a,activeEntry:o,available:s,onSurface:c,onOpen:l,sideLabel:u,changes:d}=e,f;t[0]===c?f=t[1]:(f=e=>{WZ(e)&&c(e)},t[0]=c,t[1]=f);let p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsxs)(hQ,{value:`files`,className:`min-w-0`,children:[(0,Q.jsx)(Df,{className:`size-3.5`}),(0,Q.jsx)(`span`,{className:`truncate`,children:`Files`})]}),t[2]=p):p=t[2];let m;t[3]!==r||t[4]!==n?(m=(0,Q.jsx)(hQ,{value:`changes`,className:`min-w-0`,children:(0,Q.jsx)(O7,{scope:n,context:r})}),t[3]=r,t[4]=n,t[5]=m):m=t[5];let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsxs)(hQ,{value:`history`,className:`min-w-0`,children:[(0,Q.jsx)(Ap,{className:`size-3.5`}),(0,Q.jsx)(`span`,{className:`truncate`,children:`History`})]}),t[6]=h):h=t[6];let g;t[7]===m?g=t[8]:(g=(0,Q.jsx)(`div`,{className:`shrink-0 p-1.5`,children:(0,Q.jsxs)(mQ,{className:`h-8 w-full`,children:[p,m,h]})}),t[7]=m,t[8]=g);let _;t[9]!==o||t[10]!==s||t[11]!==d||t[12]!==r||t[13]!==l||t[14]!==n||t[15]!==u||t[16]!==i?(_=(0,Q.jsx)(gQ,{value:`changes`,className:`min-h-0 overflow-hidden`,children:(0,Q.jsx)(k7,{scope:n,context:r,worktreePath:i,surface:`changes`,activeEntry:o,available:s,onOpen:l,sideLabel:u,changes:d})}),t[9]=o,t[10]=s,t[11]=d,t[12]=r,t[13]=l,t[14]=n,t[15]=u,t[16]=i,t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==s||t[20]!==d||t[21]!==r||t[22]!==l||t[23]!==n||t[24]!==u||t[25]!==i?(v=(0,Q.jsx)(gQ,{value:`files`,className:`min-h-0 overflow-hidden`,children:(0,Q.jsx)(k7,{scope:n,context:r,worktreePath:i,surface:`files`,activeEntry:o,available:s,onOpen:l,sideLabel:u,changes:d})}),t[18]=o,t[19]=s,t[20]=d,t[21]=r,t[22]=l,t[23]=n,t[24]=u,t[25]=i,t[26]=v):v=t[26];let y;t[27]!==o||t[28]!==s||t[29]!==d||t[30]!==r||t[31]!==l||t[32]!==n||t[33]!==u||t[34]!==i?(y=(0,Q.jsx)(gQ,{value:`history`,className:`min-h-0 overflow-hidden`,children:(0,Q.jsx)(k7,{scope:n,context:r,worktreePath:i,surface:`history`,activeEntry:o,available:s,onOpen:l,sideLabel:u,changes:d})}),t[27]=o,t[28]=s,t[29]=d,t[30]=r,t[31]=l,t[32]=n,t[33]=u,t[34]=i,t[35]=y):y=t[35];let b;return t[36]!==a||t[37]!==f||t[38]!==g||t[39]!==_||t[40]!==v||t[41]!==y?(b=(0,Q.jsx)(`aside`,{"aria-label":`Review sidebar`,"data-testid":`review-sidebar`,className:`flex h-full min-h-0 flex-col overflow-hidden rounded-xl border bg-card`,children:(0,Q.jsxs)(fQ,{value:a,onValueChange:f,className:`min-h-0 flex-1`,children:[g,_,v,y]})}),t[36]=a,t[37]=f,t[38]=g,t[39]=_,t[40]=v,t[41]=y,t[42]=b):b=t[42],b}function O7(e){let t=(0,$.c)(9),{scope:n,context:r}=e,{review:i}=a2(n,r),a;t[0]===i?a=t[1]:(a=g0(i),t[0]=i,t[1]=a);let o=a,s=i==null?_f:$f,c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(s,{className:`size-3.5 shrink-0`}),t[2]=s,t[3]=c);let l=o??`Changes`,u;t[4]===l?u=t[5]:(u=(0,Q.jsx)(`span`,{className:`truncate`,children:l}),t[4]=l,t[5]=u);let d;return t[6]!==c||t[7]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[c,u]}),t[6]=c,t[7]=u,t[8]=d):d=t[8],d}function k7(e){let t=(0,$.c)(40),{scope:n,context:r,worktreePath:i,surface:a,activeEntry:o,available:s,onOpen:c,sideLabel:l,changes:u}=e,d=a2(n,r);if(!s){let e;t[0]!==c||t[1]!==d.review||t[2]!==a?(e=d.review&&a===`changes`&&(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>c({kind:`handoff`}),children:`Review`}),t[0]=c,t[1]=d.review,t[2]=a,t[3]=e):e=t[3];let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(t3,{title:`Worktree unavailable`,description:`Restore the checkout and return to Porcelain to browse its files and Git state.`}),t[4]=n):n=t[4];let r;return t[5]===e?r=t[6]:(r=(0,Q.jsxs)(`div`,{className:`p-3`,children:[e,n]}),t[5]=e,t[6]=r),r}let f=`${n.worktreeId}:${a}`,p;t[7]!==o||t[8]!==u||t[9]!==r||t[10]!==c||t[11]!==n||t[12]!==l||t[13]!==a?(p=a===`changes`&&(0,Q.jsx)(d7,{scope:n,context:r,activeEntry:o,onOpen:c,sideLabel:l,changeScope:u.scope,base:u.base,onChangeScope:u.onScope,onBase:u.onBase}),t[7]=o,t[8]=u,t[9]=r,t[10]=c,t[11]=n,t[12]=l,t[13]=a,t[14]=p):p=t[14];let m;t[15]!==o||t[16]!==r.connection||t[17]!==c||t[18]!==n||t[19]!==l||t[20]!==a||t[21]!==i?(m=a===`files`&&(0,Q.jsx)(yZ,{scope:n,connection:r.connection,worktreePath:i,selected:o?.startsWith(`file:`)?o.slice(5):``,onOpen:c,sideLabel:l}),t[15]=o,t[16]=r.connection,t[17]=c,t[18]=n,t[19]=l,t[20]=a,t[21]=i,t[22]=m):m=t[22];let h;t[23]!==o||t[24]!==r.connection||t[25]!==c||t[26]!==n||t[27]!==l||t[28]!==a?(h=a===`history`&&(0,Q.jsx)(I2,{scope:n,connection:r.connection,selected:o?.startsWith(`commit:`)?o.slice(7):``,onSelect:(e,t)=>c({kind:`commit`,oid:e},void 0,{toSide:t===!0}),sideLabel:l,onOpenGraph:()=>c({kind:`graph`})}),t[23]=o,t[24]=r.connection,t[25]=c,t[26]=n,t[27]=l,t[28]=a,t[29]=h):h=t[29];let g;t[30]!==r.connection||t[31]!==n||t[32]!==f||t[33]!==p||t[34]!==m||t[35]!==h?(g=(0,Q.jsxs)(E8,{connection:r.connection,scope:n,children:[p,m,h]},f),t[30]=r.connection,t[31]=n,t[32]=f,t[33]=p,t[34]=m,t[35]=h,t[36]=g):g=t[36];let _=g,v;return t[37]!==_||t[38]!==a?(v=a===`changes`?(0,Q.jsx)(hL,{className:`h-full`,children:_}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:_}),t[37]=_,t[38]=a,t[39]=v):v=t[39],v}function A7(e){let t=(0,$.c)(9),n;t[0]!==e.projectId||t[1]!==e.worktree.id?(n={projectId:e.projectId,worktreeId:e.worktree.id},t[0]=e.projectId,t[1]=e.worktree.id,t[2]=n):n=t[2];let r;t[3]===e?r=t[4]:(r=(0,Q.jsx)(j7,{...e}),t[3]=e,t[4]=r);let i;return t[5]!==e.context.connection||t[6]!==n||t[7]!==r?(i=(0,Q.jsx)(E8,{connection:e.context.connection,scope:n,children:r}),t[5]=e.context.connection,t[6]=n,t[7]=r,t[8]=i):i=t[8],i}function j7(e){let t=(0,$.c)(135),{worktree:n,projectId:r,search:i,onSearch:a,context:o,navigationTrigger:s}=e,[c,l]=(0,Z.useState)(!0),[u,d]=(0,Z.useState)(!1),f=F0(),[p,m]=(0,Z.useState)(0),h=KZ(),g=KZ(),_=KZ(),{isMobile:v,open:y,openMobile:b}=qL(),x=i.surface??`files`,S;t[0]!==r||t[1]!==n.id?(S={projectId:r,worktreeId:n.id},t[0]=r,t[1]=n.id,t[2]=S):S=t[2];let C=S,{saved:w}=G0(n.id),T=wF(C,o.connection),E=a2(C,o),D;t[3]===T?D=t[4]:(D=Ln(ar(T)),t[3]=T,t[4]=D);let O=D,k;t[5]===E.result?k=t[6]:(k=Ln(ar(E.result)),t[5]=E.result,t[6]=k);let A=k,j;t[7]!==w||t[8]!==i.entry||t[9]!==i.side?(j=!w&&!m0(i.entry)&&!m0(i.side),t[7]=w,t[8]=i.entry,t[9]=i.side,t[10]=j):j=t[10];let M=j,N=!M||!O&&!A,P;t[11]!==T||t[12]!==E.review?(P=!!E.review||(Gn(ar(T))?.changes.length??0)>0,t[11]=T,t[12]=E.review,t[13]=P):P=t[13];let F=P,I;t[14]===F?I=t[15]:(I=F?p0({kind:`handoff`}):null,t[14]=F,t[15]=I);let L;t[16]!==p||t[17]!==u||t[18]!==_.element||t[19]!==a||t[20]!==N||t[21]!==i.entry||t[22]!==i.side||t[23]!==I||t[24]!==n.id?(L={worktreeId:n.id,entry:i.entry,side:i.side,onSearch:a,fallback:I,focused:p,setFocused:m,ready:N,focusBoundary:_.element,focusBoundaryOpen:u},t[16]=p,t[17]=u,t[18]=_.element,t[19]=a,t[20]=N,t[21]=i.entry,t[22]=i.side,t[23]=I,t[24]=n.id,t[25]=L):L=t[25];let R=e2(L),z;t[26]!==p||t[27]!==R.split?(z=M0(I7(R.split,p)),t[26]=p,t[27]=R.split,t[28]=z):z=t[28];let B=z,V;t[29]!==h.element||t[30]!==c?(V=()=>{c&&h.element?.focus(),l(N7)},t[29]=h.element,t[30]=c,t[31]=V):V=t[31];let H=V,U;t[32]!==f||t[33]!==H?(U=()=>{f?H():d(M7)},t[32]=f,t[33]=H,t[34]=U):U=t[34];let W;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(W={ignoreInputs:!0},t[35]=W):W=t[35],xu(Il.toggleSidebar,U,W);let[G,ee]=(0,Z.useState)(),te;t[36]!==p||t[37]!==R||t[38]!==a?(te=(e,t,n)=>{let r=p0(e),i=+(p===0),o=n?.toSide?i:R.open(p,r);ee(t?{anchor:t,nonce:Date.now(),pane:o,key:r,...n?.compose?{compose:!0}:{}}:void 0);let s=t?sR(t):void 0;n?.toSide&&R.openToSide(p,r),s!==void 0&&a({base:s}),d(!1)},t[36]=p,t[37]=R,t[38]=a,t[39]=te):te=t[39];let K=te,ne;t[40]===a?ne=t[41]:(ne=e=>{a({surface:e})},t[40]=a,t[41]=ne);let q=ne,re;t[42]===q?re=t[43]:(re=()=>q(`changes`),t[42]=q,t[43]=re);let ie;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ie={ignoreInputs:!0},t[44]=ie):ie=t[44],xu(Il.surfaceReview,re,ie);let ae;t[45]===q?ae=t[46]:(ae=()=>q(`files`),t[45]=q,t[46]=ae);let oe;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(oe={ignoreInputs:!0},t[47]=oe):oe=t[47],xu(Il.surfaceFiles,ae,oe);let se;t[48]===q?se=t[49]:(se=()=>q(`history`),t[48]=q,t[49]=se);let ce;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ce={ignoreInputs:!0},t[50]=ce):ce=t[50],xu(Il.surfaceHistory,se,ce);let le=p===1?i.side:i.entry,ue=i.scope??`uncommitted`,de,fe;t[51]===a?(de=t[52],fe=t[53]):(de=e=>a({scope:e===`branch`?e:void 0}),fe=e=>a({base:e}),t[51]=a,t[52]=de,t[53]=fe);let pe;t[54]!==i.base||t[55]!==ue||t[56]!==de||t[57]!==fe?(pe={scope:ue,base:i.base,onScope:de,onBase:fe},t[54]=i.base,t[55]=ue,t[56]=de,t[57]=fe,t[58]=pe):pe=t[58];let me;t[59]!==o||t[60]!==K||t[61]!==C||t[62]!==q||t[63]!==B||t[64]!==x||t[65]!==le||t[66]!==pe||t[67]!==n.available||t[68]!==n.path?(me=(0,Q.jsx)(D7,{scope:C,context:o,worktreePath:n.path,surface:x,activeEntry:le,available:n.available,onSurface:q,onOpen:K,sideLabel:B,changes:pe}),t[59]=o,t[60]=K,t[61]=C,t[62]=q,t[63]=B,t[64]=x,t[65]=le,t[66]=pe,t[67]=n.available,t[68]=n.path,t[69]=me):me=t[69];let he=me,ge;t[70]!==o||t[71]!==h||t[72]!==R||t[73]!==g||t[74]!==C||t[75]!==c||t[76]!==H?(ge=e=>(0,Q.jsxs)(`div`,{"data-review-controls":``,className:`contents`,children:[(0,Q.jsx)(P1,{scope:C,context:o}),(0,Q.jsx)(X,{ref:e=>h.attach(e),className:`hidden xl:inline-flex`,variant:`ghost`,size:`icon-sm`,"aria-label":c?`Hide review sidebar`:`Show review sidebar`,"aria-expanded":c,"aria-keyshortcuts":Il.toggleSidebar,title:`Toggle review sidebar (${Hl(Il.toggleSidebar)})`,onClick:()=>{R.selectPane(e),H()},children:(0,Q.jsx)(hp,{})}),(0,Q.jsx)(ML,{render:(0,Q.jsx)(X,{variant:`ghost`,size:`icon-sm`,ref:e=>g.attach(e),className:`xl:hidden`,"aria-label":`Review`,"aria-keyshortcuts":Il.toggleSidebar,title:`Toggle review sidebar (${Hl(Il.toggleSidebar)})`,onClick:()=>R.selectPane(e)}),children:(0,Q.jsx)(hp,{})})]}),t[70]=o,t[71]=h,t[72]=R,t[73]=g,t[74]=C,t[75]=c,t[76]=H,t[77]=ge):ge=t[77];let _e=ge,ve;t[78]===R?ve=t[79]:(ve=e=>{e||R.focusDestination()},t[78]=R,t[79]=ve);let ye=v?0:480,be;t[80]!==o||t[81]!==C?(be=(0,Q.jsx)(EQ,{scope:C,context:o}),t[80]=o,t[81]=C,t[82]=be):be=t[82];let xe;t[83]!==o||t[84]!==K||t[85]!==C?(xe=(0,Q.jsx)(DQ,{scope:C,context:o,onOpen:K}),t[83]=o,t[84]=K,t[85]=C,t[86]=xe):xe=t[86];let Se;t[87]!==o||t[88]!==p||t[89]!==F||t[90]!==R||t[91]!==s||t[92]!==v||t[93]!==y||t[94]!==b||t[95]!==M||t[96]!==K||t[97]!==T||t[98]!==E||t[99]!==G||t[100]!==C||t[101]!==i.base||t[102]!==_e?(Se=(0,Q.jsx)(P7,{reveal:G,scope:C,context:o,overview:T,published:E,needsDefault:M,hasHandoff:F,layout:R,base:i.base,focused:p,onOpen:K,navigationTrigger:s,navigatorIsMobile:v,navigatorOpen:y,navigatorOpenMobile:b,tabControls:_e}),t[87]=o,t[88]=p,t[89]=F,t[90]=R,t[91]=s,t[92]=v,t[93]=y,t[94]=b,t[95]=M,t[96]=K,t[97]=T,t[98]=E,t[99]=G,t[100]=C,t[101]=i.base,t[102]=_e,t[103]=Se):Se=t[103];let Ce;t[104]!==be||t[105]!==xe||t[106]!==Se?(Ce=(0,Q.jsxs)(`section`,{"aria-label":`Review content`,className:`flex h-full min-w-0 flex-col overflow-hidden rounded-xl border bg-card`,children:[be,xe,Se]}),t[104]=be,t[105]=xe,t[106]=Se,t[107]=Ce):Ce=t[107];let we;t[108]!==ye||t[109]!==Ce?(we=(0,Q.jsx)(ZG,{id:`review-document`,minSize:ye,children:Ce}),t[108]=ye,t[109]=Ce,t[110]=we):we=t[110];let Te;t[111]!==f||t[112]!==he||t[113]!==c?(Te=c&&f&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(QG,{className:`w-2 bg-transparent after:w-2`}),(0,Q.jsx)(ZG,{id:`review-sidebar`,defaultSize:320,minSize:260,maxSize:520,children:he})]}),t[111]=f,t[112]=he,t[113]=c,t[114]=Te):Te=t[114];let Ee;t[115]!==we||t[116]!==Te?(Ee=(0,Q.jsxs)(XG,{orientation:`horizontal`,className:`min-h-0 flex-1`,children:[we,Te]}),t[115]=we,t[116]=Te,t[117]=Ee):Ee=t[117];let De;t[118]!==R||t[119]!==_?(De=e=>{_.attach(e),e===null&&R.focusDestination()},t[118]=R,t[119]=_,t[120]=De):De=t[120];let Oe;t[121]!==R||t[122]!==_.element||t[123]!==g.element?(Oe=()=>{if(R.hasDestinationFocus())return!1;let e=document.activeElement;return e===document.body||_.element?.contains(e)?g.element:!1},t[121]=R,t[122]=_.element,t[123]=g.element,t[124]=Oe):Oe=t[124];let ke;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Q.jsxs)(IL,{className:`sr-only`,children:[(0,Q.jsx)(LL,{children:`Worktree review`}),(0,Q.jsx)(RL,{children:`Choose a review surface and open a document.`})]}),t[125]=ke):ke=t[125];let Ae;t[126]!==he||t[127]!==De||t[128]!==Oe?(Ae=(0,Q.jsxs)(FL,{ref:De,finalFocus:Oe,className:`w-[min(90vw,22rem)]!`,showCloseButton:!1,children:[ke,he]}),t[126]=he,t[127]=De,t[128]=Oe,t[129]=Ae):Ae=t[129];let je;return t[130]!==u||t[131]!==ve||t[132]!==Ee||t[133]!==Ae?(je=(0,Q.jsxs)(jL,{open:u,onOpenChange:d,onOpenChangeComplete:ve,children:[Ee,Ae]}),t[130]=u,t[131]=ve,t[132]=Ee,t[133]=Ae,t[134]=je):je=t[134],je}function M7(e){return!e}function N7(e){return!e}function P7(e){let t=(0,$.c)(3),n=Ln(ar(e.overview)),r=Ln(ar(e.published.result));if(e.needsDefault&&n&&st(e.overview))throw nt(e.overview.cause);if(e.needsDefault&&r&&st(e.published.result))throw nt(e.published.result.cause);if(e.needsDefault&&(n||r)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`div`,{role:`status`,"aria-label":`Loading review`,className:`p-4`,children:`Loading review…`}),t[0]=e):e=t[0],e}let i;return t[1]===e?i=t[2]:(i=(0,Q.jsx)(F7,{...e}),t[1]=e,t[2]=i),i}function F7(e){let t=(0,$.c)(44),{published:n,hasHandoff:r,layout:i,reveal:a,scope:o,context:s,base:c,focused:l,onOpen:u,navigationTrigger:d,navigatorIsMobile:f,navigatorOpen:p,navigatorOpenMobile:m,tabControls:h}=e,g;t[0]!==l||t[1]!==i.panes?(g=i.panes[l]??{tabs:[],pinned:[],active:null},t[0]=l,t[1]=i.panes,t[2]=g):g=t[2];let _=g,v=i.split||l===0,y;t[3]===v?y=t[4]:(y={ignoreInputs:!0,enabled:v},t[3]=v,t[4]=y);let b=y,x;t[5]!==l||t[6]!==i?(x=()=>i.step(l,1),t[5]=l,t[6]=i,t[7]=x):x=t[7],xu(Il.nextTab,x,b);let S;t[8]!==l||t[9]!==i?(S=()=>i.step(l,-1),t[8]=l,t[9]=i,t[10]=S):S=t[10],xu(Il.previousTab,S,b);let C;t[11]!==l||t[12]!==_.active||t[13]!==i?(C=()=>_.active!==null&&_.active!==void 0&&i.close(l,_.active),t[11]=l,t[12]=_.active,t[13]=i,t[14]=C):C=t[14],xu(Il.closeTab,C,b);let w;t[15]!==l||t[16]!==_.active||t[17]!==i?(w=()=>_.active!==null&&_.active!==void 0&&i.openToSide(l,_.active),t[15]=l,t[16]=_.active,t[17]=i,t[18]=w):w=t[18],xu(Il.openToSide,w,b);let T;t[19]!==c||t[20]!==s||t[21]!==l||t[22]!==r||t[23]!==i||t[24]!==d||t[25]!==f||t[26]!==p||t[27]!==m||t[28]!==u||t[29]!==n.review||t[30]!==a||t[31]!==o||t[32]!==h?(T=e=>({reveal:a,index:e,layout:i,split:i.split,focused:l===e,scope:o,context:s,reviewTitle:g0(n.review),handoff:g0(n.review)??(r?`Changes`:null),base:c,onOpen:u,navigationTrigger:d,navigatorIsMobile:f,navigatorOpen:p,navigatorOpenMobile:m,tabControls:h}),t[19]=c,t[20]=s,t[21]=l,t[22]=r,t[23]=i,t[24]=d,t[25]=f,t[26]=p,t[27]=m,t[28]=u,t[29]=n.review,t[30]=a,t[31]=o,t[32]=h,t[33]=T):T=t[33];let E=T;if(!i.split){let e;return t[34]===E?e=t[35]:(e=(0,Q.jsx)(L7,{...E(0)}),t[34]=E,t[35]=e),e}let D;t[36]===E?D=t[37]:(D=(0,Q.jsx)(ZG,{id:`pane-left`,minSize:320,children:(0,Q.jsx)(L7,{...E(0)})}),t[36]=E,t[37]=D);let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(QG,{withHandle:!0}),t[38]=O):O=t[38];let k;t[39]===E?k=t[40]:(k=(0,Q.jsx)(ZG,{id:`pane-right`,minSize:320,children:(0,Q.jsx)(L7,{...E(1)})}),t[39]=E,t[40]=k);let A;return t[41]!==k||t[42]!==D?(A=(0,Q.jsxs)(XG,{orientation:`horizontal`,className:`min-h-0 flex-1`,children:[D,O,k]}),t[41]=k,t[42]=D,t[43]=A):A=t[43],A}function I7(e,t){return e?t===0?`left`:`right`:null}function L7(e){let t=(0,$.c)(69),{reveal:n,index:r,layout:i,split:a,focused:o,scope:s,context:c,reviewTitle:l,handoff:u,base:d,onOpen:f,navigationTrigger:p,navigatorIsMobile:m,navigatorOpen:h,navigatorOpenMobile:g,tabControls:_}=e,v;t[0]!==r||t[1]!==i.panes?(v=i.panes[r]??{tabs:[],pinned:[],active:null},t[0]=r,t[1]=i.panes,t[2]=v):v=t[2];let y=v,b=y.active??void 0,x;t[3]===b?x=t[4]:(x=m0(b),t[3]=b,t[4]=x);let S=x,C;t[5]!==r||t[6]!==i?(C=e=>{let t=e.target;t instanceof Element&&e.currentTarget.contains(t)&&t.closest(`[data-review-controls]`)===null&&(e.type===`pointerdown`?i.selectPane(r):i.focusPane(r,t))},t[5]=r,t[6]=i,t[7]=C):C=t[7];let w=C,T;t[8]!==r||t[9]!==i?(T=e=>i.bindPane(r,e),t[8]=r,t[9]=i,t[10]=T):T=t[10];let E=a?`${r===0?`Left`:`Right`} pane`:void 0,D=a&&r===1&&`border-l`,O;t[11]===D?O=t[12]:(O=Y(`flex h-full min-h-0 flex-col`,D),t[11]=D,t[12]=O);let k;t[13]!==r||t[14]!==p||t[15]!==m||t[16]!==h||t[17]!==g?(k=r===0?(0,Q.jsx)(XL,{ref:e=>p.attach(e),"aria-label":`Toggle Sidebar`,"aria-expanded":m?g:h,"aria-keyshortcuts":xl()===`mac`?`Meta+B`:`Control+B`,title:`Toggle projects (${Hl(Il.toggleNavigator)})`,onClick:()=>{!m&&h&&requestAnimationFrame(()=>p.element?.focus())}}):void 0,t[13]=r,t[14]=p,t[15]=m,t[16]=h,t[17]=g,t[18]=k):k=t[18];let A=y.tabs,j=y.pinned,M=y.active,N;t[19]!==r||t[20]!==a?(N=I7(a,r),t[19]=r,t[20]=a,t[21]=N):N=t[21];let P,F,I,L,R,z;t[22]!==r||t[23]!==i?(P=e=>i.activate(r,e),F=e=>i.close(r,e),I=e=>i.closeOthers(r,e),L=()=>i.closeUnpinned(r),R=e=>i.togglePin(r,e),z=e=>i.openToSide(r,e),t[22]=r,t[23]=i,t[24]=P,t[25]=F,t[26]=I,t[27]=L,t[28]=R,t[29]=z):(P=t[24],F=t[25],I=t[26],L=t[27],R=t[28],z=t[29]);let B;t[30]!==r||t[31]!==a||t[32]!==_?(B=!a||r===1?_(r):void 0,t[30]=r,t[31]=a,t[32]=_,t[33]=B):B=t[33];let V;t[34]!==o||t[35]!==y.active||t[36]!==y.pinned||t[37]!==y.tabs||t[38]!==l||t[39]!==N||t[40]!==P||t[41]!==F||t[42]!==I||t[43]!==L||t[44]!==R||t[45]!==z||t[46]!==B||t[47]!==k?(V=(0,Q.jsx)(c2,{leading:k,tabs:A,pinned:j,active:M,reviewTitle:l,side:N,focused:o,onActivate:P,onClose:F,onCloseOthers:I,onCloseUnpinned:L,onTogglePin:R,onOpenToSide:z,trailing:B}),t[34]=o,t[35]=y.active,t[36]=y.pinned,t[37]=y.tabs,t[38]=l,t[39]=N,t[40]=P,t[41]=F,t[42]=I,t[43]=L,t[44]=R,t[45]=z,t[46]=B,t[47]=k,t[48]=V):V=t[48];let H;t[49]!==d||t[50]!==c||t[51]!==S||t[52]!==o||t[53]!==u||t[54]!==r||t[55]!==f||t[56]!==y.active||t[57]!==n||t[58]!==s||t[59]!==a?(H=S==null?(0,Q.jsx)(R7,{handoff:u,onOpen:f}):(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,Q.jsx)(E8,{connection:c.connection,scope:s,children:(0,Q.jsx)(f8,{scope:s,context:c,document:S,sideLabel:M0(I7(a,r)),base:d,onOpen:f,active:o,reveal:n?.pane===r&&n.key===y.active?n:void 0})},y.active)}),t[49]=d,t[50]=c,t[51]=S,t[52]=o,t[53]=u,t[54]=r,t[55]=f,t[56]=y.active,t[57]=n,t[58]=s,t[59]=a,t[60]=H):H=t[60];let U;return t[61]!==w||t[62]!==o||t[63]!==V||t[64]!==H||t[65]!==T||t[66]!==E||t[67]!==O?(U=(0,Q.jsxs)(`section`,{ref:T,"aria-label":E,"data-focused":o,onPointerDownCapture:w,onFocusCapture:w,className:O,children:[V,H]}),t[61]=w,t[62]=o,t[63]=V,t[64]=H,t[65]=T,t[66]=E,t[67]=O,t[68]=U):U=t[68],U}function R7(e){let t=(0,$.c)(16),{handoff:n,onOpen:r}=e,i;t[0]===n?i=t[1]:(i=n&&{Review:{opens:`the review`,action:`Open review`},Changes:{opens:`all changes`,action:`Open all changes`}}[n],t[0]=n,t[1]=i);let a=i,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(ns,{children:(0,Q.jsx)(Zf,{})}),t[2]=o):o=t[2];let s=n?`Nothing open`:`No changes to review`,c;t[3]===s?c=t[4]:(c=(0,Q.jsx)(Fs,{children:s}),t[3]=s,t[4]=c);let l=a?`Open ${a.opens}, or choose a file or commit from the right.`:`Browse files or history from the right.`,u;t[5]===l?u=t[6]:(u=(0,Q.jsx)(Os,{children:l}),t[5]=l,t[6]=u);let d;t[7]!==c||t[8]!==u?(d=(0,Q.jsxs)(Oo,{children:[o,c,u]}),t[7]=c,t[8]=u,t[9]=d):d=t[9];let f;t[10]!==r||t[11]!==a?(f=a&&(0,Q.jsx)(X,{onClick:()=>r({kind:`handoff`}),children:a.action}),t[10]=r,t[11]=a,t[12]=f):f=t[12];let p;return t[13]!==d||t[14]!==f?(p=(0,Q.jsx)(`div`,{className:`grid min-h-0 flex-1 place-items-center p-8`,children:(0,Q.jsxs)(ms,{children:[d,f]})}),t[13]=d,t[14]=f,t[15]=p):p=t[15],p}export{lI as A,hL as C,EI as D,kI as E,bm as F,Yf as I,KF as M,WF as N,OI as O,pw as P,DL as S,TI as T,jV as _,o0 as a,qL as b,K1 as c,zZ as d,eK as f,bH as g,RH as h,y0 as i,sI as j,bI as k,KZ as l,JU as m,R6 as n,Y1 as o,$G as p,N0 as r,J1 as s,A7 as t,UZ as u,YL as v,SI as w,zL as x,XL as y};