@fabiofiorita/porcelain 0.76.0 → 0.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/server/src/cli/main.mjs +8291 -7641
- package/web/dist/assets/_-CSJHpFdT.js +1 -0
- package/web/dist/assets/_layerId-DODyO-4v.js +1 -0
- package/web/dist/assets/_paired-BQ0y29Xb.js +1 -0
- package/web/dist/assets/_paired-Bse7nsmg.js +1 -0
- package/web/dist/assets/_paired-CmZDjtRz.js +1 -0
- package/web/dist/assets/_paired-CrNFab02.js +1 -0
- package/web/dist/assets/_reviewId-CBVBAvNp.js +1 -0
- package/web/dist/assets/{_revision-1wivYK0j.js → _revision-BMXAJq_Z.js} +1 -1
- package/web/dist/assets/{_section-BQ20AKhJ.js → _section-DdvA8EEA.js} +1 -1
- package/web/dist/assets/_worktreeId-B27bXYEK.js +1 -0
- package/web/dist/assets/_worktreeId-Bse7nsmg.js +1 -0
- package/web/dist/assets/_worktreeId-C8Q6GcvL.js +1 -0
- package/web/dist/assets/_worktreeId-CmZDjtRz.js +1 -0
- package/web/dist/assets/access-E2mYEqnl.js +19 -0
- package/web/dist/assets/connected-workspace-8ch85vkt.js +1 -0
- package/web/dist/assets/desktop-actions-BPv0J8RL.js +1 -0
- package/web/dist/assets/{edit-file-rWLFkawP.js → edit-file-Bcu9LCmp.js} +20 -20
- package/web/dist/assets/{file-editor-CmaAI7mD.js → file-editor-B_jE48tv.js} +11 -11
- package/web/dist/assets/index-BHlOFndd.js +10 -0
- package/web/dist/assets/index-Bg-CecA5.css +2 -0
- package/web/dist/assets/{lazyRouteComponent-DF1peoaD.js → lazyRouteComponent-C0NLdQ95.js} +1 -1
- package/web/dist/assets/pair-Bse7nsmg.js +1 -0
- package/web/dist/assets/pair-CbpILDh2.js +1 -0
- package/web/dist/assets/review-route-CZyVDwAY.js +1 -0
- package/web/dist/assets/reviews-DCiXZMLG.js +1404 -0
- package/web/dist/assets/useMatch-CPSFM0JI.js +1 -0
- package/web/dist/assets/useRouterState-DtsAJKLm.js +1 -0
- package/web/dist/assets/workspace-error-DIuDMViV.js +1 -0
- package/web/dist/assets/{workspace-pending-DnmDeSe-.js → workspace-pending-DgQgV-cu.js} +1 -1
- package/web/dist/index.html +8 -8
- package/web/dist/assets/_-mTAQQLxa.js +0 -1
- package/web/dist/assets/_layerId-D-Ld4zoA.js +0 -1
- package/web/dist/assets/_paired-DQq2L_lM.js +0 -1
- package/web/dist/assets/_paired-DwQfzpPo.js +0 -1
- package/web/dist/assets/_paired-P-FUnX-y.js +0 -1
- package/web/dist/assets/_paired-VrOGlA1G.js +0 -1
- package/web/dist/assets/_reviewId-CR5Y2cjT.js +0 -1
- package/web/dist/assets/_worktreeId-BPp_s24t.js +0 -1
- package/web/dist/assets/_worktreeId-DQq2L_lM.js +0 -1
- package/web/dist/assets/_worktreeId-Dfp8EiPX.js +0 -1
- package/web/dist/assets/_worktreeId-P-FUnX-y.js +0 -1
- package/web/dist/assets/access-CPhumIOz.js +0 -19
- package/web/dist/assets/connected-workspace-Cqk_MV5h.js +0 -1
- package/web/dist/assets/desktop-actions-DEpOe60L.js +0 -1
- package/web/dist/assets/index-DbOyN2aI.js +0 -10
- package/web/dist/assets/index-Dz_rBtGK.css +0 -2
- package/web/dist/assets/pair-CwRRIQuD.js +0 -1
- package/web/dist/assets/pair-DQq2L_lM.js +0 -1
- package/web/dist/assets/review-route-CilLpBvt.js +0 -1
- package/web/dist/assets/reviews-Knu80SJM.js +0 -1396
- package/web/dist/assets/useMatch-CmjLPEeI.js +0 -1
- package/web/dist/assets/useRouterState-CFV0Nv_N.js +0 -1
- package/web/dist/assets/workspace-error-B0KK7kzA.js +0 -1
|
@@ -1,1396 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/file-editor-CmaAI7mD.js","assets/rolldown-runtime-hePW80VL.js","assets/access-CPhumIOz.js","assets/edit-file-rWLFkawP.js","assets/hastToHtml-DaAciyEx.js","assets/unwrapDefault-ByDmBtHB.js","assets/preload-helper-Czpn1I53.js","assets/lib-B-glQwO_.js","assets/constants-CmGPilXJ.js","assets/formatCSSVariablePrefix-KRh9vnZf.js","assets/utils-BsJaG8cj.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,$a as n,$c as r,$i as i,$n as a,$o as o,$r as s,$t as c,A as l,Aa as u,Ai as d,Al as f,An as p,Ar as m,As as h,At as g,Au as _,B as v,Ba as y,Bi as b,Bl as x,Bn as S,Bo as C,Br as w,Bs as T,Bt as E,Bu as D,C as O,Ca as k,Ci as A,Cl as j,Cr as M,Ct as N,D as P,Da as F,Di as I,Dn as L,Dr as R,Dt as z,Du as B,E as V,Ea as H,Ei as U,El as W,En as G,Eo as K,Er as ee,Es as q,Et as te,Eu as ne,Fa as re,Fi as ie,Fn as ae,Fr as oe,Ft as se,Fu as ce,G as le,Gi as ue,Gl as de,Gn as fe,Gr as pe,Gu as J,H as me,Hi as he,Hl as ge,Hn as _e,Ho as ve,Hs as ye,Ht as be,Hu as xe,I as Se,Ia as Ce,Ii as we,Il as Te,In as Ee,Io as De,It as Oe,Iu as ke,J as Ae,Ja as je,Ji as Me,Jn as Ne,Jo as Pe,Jr as Fe,Js as Ie,Jt as Le,K as Re,Ka as ze,Kl as Be,Kn as Ve,Ko as He,Ks as Ue,Kt as We,L as Ge,La as Ke,Li as qe,Ll as Je,Ln as Ye,Lo as Xe,Lr as Ze,Lt as Qe,Lu as $e,M as et,Ml as tt,Mn as nt,Mr as rt,Ms as it,Mt as at,Mu as ot,N as st,Ni as ct,Nl as lt,Nn as ut,No as dt,Nr as ft,Ns as pt,Nt as mt,Nu as ht,O as gt,Oa as _t,Os as vt,Ot as yt,Ou as bt,P as xt,Pa as St,Pi as Ct,Pl as wt,Pn as Tt,Po as Et,Pr as Dt,Ps as Ot,Pt as kt,Q as At,Qa as jt,Qi as Mt,Ql as Nt,Qn as Pt,Qo as Ft,Qr as It,R as Lt,Ra as Rt,Ri as zt,Rl as Bt,Rn as Vt,Ro as Ht,Rs as Ut,Rt as Wt,Ru as Gt,S as Kt,Sa as qt,Sc as Jt,Si as Yt,So as Xt,Sr as Zt,Ss as Qt,St as $t,Su as en,T as tn,Ta as nn,Ti as rn,Tl as an,Tn as on,To as sn,Ts as cn,Tt as ln,Tu as un,U as dn,Ua as fn,Ui as pn,Ul as mn,Un as hn,Uo as gn,Ur as _n,Us as vn,Ut as yn,Uu as bn,V as xn,Va as Sn,Vi as Cn,Vn as wn,Vo as Tn,Vt as En,Vu as Dn,W as On,Wa as kn,Wi as An,Wl as jn,Wn as Mn,Wo as Nn,Wr as Pn,Ws as Fn,Wt as In,Wu as Ln,X as Rn,Xa as zn,Xl as Bn,Xn as Vn,Xo as Hn,Xr as Un,Xs as Wn,Y as Gn,Ya as Kn,Yl as qn,Yn as Jn,Yo as Yn,Yr as Xn,Ys as Zn,Yt as Qn,Z as $n,Za as er,Zi as tr,Zl as nr,Zn as rr,Zo as ir,Zr as ar,Zs as or,Zt as sr,_ as cr,_a as lr,_c as ur,_l as dr,_n as fr,_r as pr,_s as mr,_t as hr,_u as gr,a as _r,aa as vr,ac as yr,ai as br,al as xr,ao as Sr,ar as Cr,as as wr,at as Tr,au as Er,b as Dr,ba as Or,bi as kr,bl as Ar,bo as jr,br as Mr,bs as Nr,bt as Pr,bu as Fr,c as Ir,ca as Lr,cc as Rr,ci as zr,cl as Br,cn as Vr,co as Hr,cs as Ur,ct as Wr,d as Gr,da as Kr,dc as qr,di as Jr,dl as Yr,do as Xr,dr as Zr,ds as Qr,dt as $r,du as ei,ea as ti,ec as ni,ei as ri,el as ii,eo as ai,er as oi,es as Y,et as si,eu as ci,f as li,fa as ui,fi as di,fl as fi,fn as pi,fo as mi,fr as hi,fs as gi,ft as _i,fu as vi,g as yi,ga as bi,gc as xi,gi as Si,gn as Ci,gr as wi,gs as Ti,gt as Ei,gu as Di,h as Oi,ha as ki,hi as Ai,hr as ji,hs as Mi,ht as Ni,i as Pi,ia as Fi,ic as Ii,ii as Li,il as Ri,in as zi,io as Bi,ir as Vi,is as Hi,it as Ui,iu as Wi,j as Gi,ji as Ki,jl as qi,jn as Ji,jo as Yi,jt as Xi,ju as Zi,k as Qi,ka as $i,kl as ea,kn as ta,ko as na,ks as ra,kt as ia,ku as aa,l as oa,la as sa,li as ca,ll as la,lr as ua,lt as da,lu as fa,m as pa,ma,mi as ha,mr as ga,ms as _a,mt as va,n as ya,na as ba,nc as xa,ni as Sa,nl as Ca,no as wa,nr as Ta,ns as Ea,nt as Da,o as Oa,oa as ka,oc as Aa,oi as ja,ol as Ma,on as Na,oo as Pa,or as Fa,os as Ia,ot as La,ou as Ra,p as za,pa as Ba,pc as Va,pi as Ha,pl as Ua,pn as Wa,po as Ga,pr as Ka,ps as qa,pt as Ja,pu as Ya,q as Xa,qa as Za,qi as Qa,ql as $a,qn as eo,qo as to,qt as no,r as ro,ra as io,rc as ao,ri as oo,rl as so,rn as co,ro as lo,rr as uo,rs as X,rt as fo,s as po,sa as mo,si as ho,sl as go,sn as _o,ss as vo,st as yo,su as bo,t as xo,ta as So,tc as Co,ti as wo,to as To,tr as Eo,ts as Do,tt as Oo,tu as ko,u as Ao,ua as jo,uc as Mo,ui as No,ul as Po,uo as Fo,us as Io,ut as Lo,uu as Ro,v as zo,va as Bo,vc as Vo,vi as Ho,vl as Uo,vr as Wo,vs as Go,vt as Ko,vu as qo,w as Jo,wa as Yo,wi as Xo,wl as Zo,wn as Qo,ws as $o,wt as es,wu as ts,x as ns,xa as rs,xi as is,xl as as,xr as os,xt as ss,xu as cs,y as ls,ya as us,yc as ds,yl as fs,yn as ps,yo as ms,yr as hs,yt as gs,yu as _s,za as vs,zi as ys,zl as bs,zn as xs,zo as Ss,zs as Cs,zt as ws,zu as Ts}from"./access-CPhumIOz.js";import{n as Es}from"./useMatch-CmjLPEeI.js";import{$ as Ds,$n as Os,$t as ks,A as As,An as js,Ar as Ms,At as Ns,Bn as Ps,Bt as Fs,C as Is,Cr as Ls,Ct as Rs,D as zs,Dt as Bs,E as Vs,Er as Hs,Et as Us,F as Ws,Fn as Gs,Fr as Ks,Ft as qs,G as Js,Gn as Ys,Gt as Xs,H as Zs,Hn as Qs,Ht as $s,In as ec,It as tc,J as nc,Jn as rc,Jt as ic,K as ac,Kn as oc,Kt as sc,L as cc,Ln as lc,Lt as uc,M as dc,Mn as fc,Mr as pc,Mt as mc,N as hc,Nn as gc,Nr as _c,Nt as vc,O as yc,On as bc,Or as xc,Ot as Sc,P as Cc,Pn as wc,Pr as Tc,Pt as Ec,Q as Dc,Qn as Oc,Qt as kc,Rn as Ac,Rr as jc,Rt as Mc,S as Nc,Sr as Pc,St as Fc,T as Ic,Tr as Lc,Tt as Rc,U as zc,Un as Bc,Ut as Vc,V as Hc,Vn as Uc,Vt as Wc,W as Gc,Wn as Kc,Wt as qc,X as Jc,Xn as Yc,Xt as Xc,Y as Zc,Yn as Qc,Yt as $c,Z as el,Zn as tl,Zt as nl,_ as rl,_r as il,a as al,an as ol,ar as sl,at as cl,b as ll,br as ul,bt as dl,c as fl,cn as pl,cr as ml,ct as hl,d as gl,dn as _l,dr as vl,dt as yl,en as bl,er as xl,et as Sl,f as Cl,fn as wl,fr as Tl,ft as El,g as Dl,gr as Ol,gt as kl,h as Al,hn as jl,hr as Ml,ht as Nl,in as Pl,ir as Fl,it as Il,j as Ll,jn as Rl,jr as zl,jt as Bl,k as Vl,kn as Hl,kr as Ul,kt as Wl,l as Gl,ln as Kl,lr as ql,lt as Jl,m as Yl,mn as Xl,mr as Zl,mt as Ql,n as $l,nn as eu,nr as tu,nt as nu,o as ru,on as iu,or as au,ot as ou,p as su,pn as cu,pr as lu,pt as uu,q as du,qn as fu,r as pu,rn as mu,rr as hu,rt as gu,sn as _u,sr as vu,st as yu,tn as bu,tr as xu,tt as Su,u as Cu,un as wu,ur as Tu,ut as Eu,v as Du,vr as Ou,w as ku,wr as Au,wt as ju,x as Mu,xr as Nu,xt as Pu,y as Fu,yr as Iu,yt as Lu,zn as Ru}from"./edit-file-rWLFkawP.js";import{a as zu,c as Bu,d as Vu,i as Hu,l as Uu,m as Wu,n as Gu,o as Ku,r as qu,s as Ju,t as Yu,u as Xu,v as Zu}from"./hastToHtml-DaAciyEx.js";import{r as Qu}from"./constants-CmGPilXJ.js";import{t as $u}from"./preload-helper-Czpn1I53.js";import{t as ed}from"./resolveLanguages-D3x2m7LM.js";function td(e){let t=ds();return ur(t.stores.location,Es(e,t))}function nd(){let e=ds();return ur(e.stores.location,e=>e.state.__TSR_index!==0)}var Z=e(r(),1),rd=Vo();function id(e,t){return e===t}function ad(e,t=e=>e,n){let r=n?.compare??id,i=(0,Z.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,Z.useCallback)(()=>e.get(),[e]);return(0,rd.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Q=Jt(),od=e(qr(),1),sd=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(Wn(99,this.componentName,e,this.componentName));t.setOpen(!0,Io(gi,void 0,n))}closePopup(){let e=this.attachedStore;e!==null&&e.setOpen(!1,Io(gi))}},cd={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`}]]};cd.node;var ld=o(cd),ud={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`}]]};ud.node;var dd=o(ud),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 pd=o(fd),md={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};md.node;var hd=o(md),gd={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};gd.node;var _d=o(gd),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 yd=o(vd),bd={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};bd.node;var xd=o(bd),Sd={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};Sd.node;var Cd=o(Sd),wd={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};wd.node;var Td=o(wd),Ed={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`}]]};Ed.node;var Dd=o(Ed),Od={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`}]]};Od.node;var kd=o(Od),Ad={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`]};Ad.node;var jd=o(Ad),Md={name:`circle-dashed`,size:24,node:[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]};Md.node;var Nd=o(Md),Pd={name:`circle-dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};Pd.node;var Fd=o(Pd),Id={name:`circle-minus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]],aliases:[`minus-circle`]};Id.node;var Ld=o(Id),Rd={name:`circle-question-mark`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`help-circle`,`circle-help`]};Rd.node;var zd=o(Rd),Bd={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`]};Bd.node;var Vd=o(Bd),Hd={name:`clipboard`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]};Hd.node;var Ud=o(Hd),Wd={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`]};Wd.node;var Gd=o(Wd),Kd={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`}]]};Kd.node;var qd=o(Kd),Jd={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`]};Jd.node;var Yd=o(Jd),Xd={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`}]]};Xd.node;var Zd=o(Xd),Qd={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`}]]};Qd.node;var $d=o(Qd),ef={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`}]]};ef.node;var tf=o(ef),nf={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`}]]};nf.node;var rf=o(nf),af={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`}]]};af.node;var of=o(af),sf={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`}]]};sf.node;var cf=o(sf),lf={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`]};lf.node;var uf=o(lf),df={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`}]]};df.node;var ff=o(df),pf={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`}]]};pf.node;var mf=o(pf),hf={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`}]]};hf.node;var gf=o(hf),_f={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`}]]};_f.node;var vf=o(_f),yf={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`}]]};yf.node;var bf=o(yf),xf={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`}]]};xf.node;var Sf=o(xf),Cf={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`}]]};Cf.node;var wf=o(Cf),Tf={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`}]]};Tf.node;var Ef=o(Tf),Df={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`}]]};Df.node;var Of=o(Df),kf={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`]};kf.node;var Af=o(kf),jf={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`}]]};jf.node;var Mf=o(jf),Nf={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`}]]};Nf.node;var Pf=o(Nf),Ff={name:`git-pull-request-closed`,size:24,node:[[`path`,{d:`m15.5 3.5 5 5`,key:`1kmx7t`}],[`path`,{d:`m15.5 8.5 5-5`,key:`saftza`}],[`path`,{d:`M18 11.62V15`,key:`1greaj`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}]]};Ff.node;var If=o(Ff),Lf={name:`git-pull-request`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]};Lf.node;var Rf=o(Lf),zf={name:`git-pull-request-draft`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M18 6V5`,key:`1oao2s`}],[`path`,{d:`M18 11v-1`,key:`11c8tz`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]};zf.node;var Bf=o(zf),Vf={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`}]]};Vf.node;var Hf=o(Vf),Uf={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`}]]};Uf.node;var Wf=o(Uf),Gf={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`}]]};Gf.node;var Kf=o(Gf),qf={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};qf.node;var Jf=o(qf),Yf={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`}]]};Yf.node;var Xf=o(Yf),Zf={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`}]]};Zf.node;var Qf=o(Zf),$f={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`}]]};$f.node;var ep=o($f),tp={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`}]]};tp.node;var np=o(tp),rp={name:`pause`,size:24,node:[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]};rp.node;var ip=o(rp),ap={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`}]]};ap.node;var op=o(ap),sp={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`}]]};sp.node;var cp=o(sp),lp={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};lp.node;var up=o(lp),dp={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`}]]};dp.node;var fp=o(dp),pp={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`}]]};pp.node;var mp=o(pp),hp={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`]};hp.node;var gp=o(hp),_p={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};_p.node;var vp=o(_p),yp={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`}]]};yp.node;var bp=o(yp),xp={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};xp.node;var Sp=o(xp),Cp={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};Cp.node;var wp=o(Cp),Tp={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`]};Tp.node;var Ep=o(Tp),Dp={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`]};Dp.node;var Op=o(Dp),kp={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};kp.node;var Ap=o(kp),jp={name:`tag`,size:24,node:[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]};jp.node;var Mp=o(jp),Np={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`]};Np.node;var Pp=o(Np),Fp={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`}]]};Fp.node;var Ip=o(Fp),Lp={name:`unlink`,size:24,node:[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]};Lp.node;var Rp=o(Lp),zp={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};zp.node;var Bp=o(zp),Vp={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`}]]};Vp.node;var Hp=o(Vp),Up=new Set([`spec`,`specs`,`__tests__`,`tests`]);function Wp(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=>Up.has(e))}function Gp(e,t){if(!t)return e;let n=[],r=[];for(let t of e)Wp(t.path)?r.push(t):n.push(t);return[...n,...r]}function Kp(e){return`decision:${e}`}function qp(e){return`${Kr(e,`decision shapes`,`decisions shape`)} this change`}function Jp(e,t,{specsApart:n}){let r=new Set(t),i=e=>n&&Wp(e),a=new Map,o=e.layers.map((e,t)=>{let n=Kp(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 Yp(e,t){return e.find(e=>e.key===t)??e[0]??{kind:`briefing`,key:`briefing`,paths:[]}}function Xp(e,t,n){let r=e.findIndex(e=>e.key===t);return r===-1?void 0:e[r+n]}function Zp(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 Qp(e){switch(e.kind){case`briefing`:return`Briefing`;case`decision`:return e.layer.title;case`unexplained`:return`Not explained`;case`specs`:return`Specs`}}function $p(e){return e.kind===`decision`?`${e.number}. ${Qp(e)}`:Qp(e)}function em(e,t,n){return e.kind===`briefing`?!1:e.kind===`decision`?n.get(e.layer.id)?.reviewed===!0:Zp(e.paths,t).done}function tm(e){return e.codeMoved===!0}function nm(e){if(e.location.state===`changed`)return{text:`code moved`,tone:`warn`};if(e.location.state===`broken`)return{text:`broken pointer`,tone:`warn`};if(e.kind===`context`)return{text:`existing code`,tone:`muted`};if(e.location.state===`committed`)return{text:`committed`,tone:`muted`}}function rm(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 im(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 am(e){let t=im(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 om(e,t){let n=e.diagram?.after;if(!n)return[];let r=im(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 sm(e,t){let n=[...am(e).questions.filter(e=>e.decision===t.number),...om(e,t.layer.id).flatMap(e=>e.part.problem?[e.part]:[])];return n.filter((e,t)=>n.findIndex(t=>t.id===e.id)===t)}function cm(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:ja(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 lm(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 um(e,t){return new Map(e.content.layers.map(e=>[e.id,{stale:tm(e),reviewed:Ba(t?.decisions,e)}]))}function dm(e,t,n){let r=lm(e,t),i=um(e,t);return{reviewed:Jp(e.content,e.files.map(e=>e.path),n).filter(e=>e.kind===`decision`&&em(e,r,i)).length,total:e.content.layers.length}}var $=Mo(),fm=Z.createContext({disabled:!1});function pm(){return Z.useContext(fm)}var mm=Zn(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=et(!0),f=wr(l)??d;if(!f)throw Error(Wn(79));let p=Xe(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=Z.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=Ia(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=Mi({disabled:a,native:o}),S=Ur(m),C=N(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return $o(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[Nr]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:pt})}),hm=class extends sd{constructor(){super(V(),`Dialog`,!1)}open(e){this.openByTrigger(e)}openWithPayload(e){let t=this.attachedStore;t!==null&&(t.set(`payload`,e),t.setOpen(!0,Io(gi)))}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function gm(){return new hm}var _m=`<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>`,vm=`<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>`,ym=`<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>`,bm=`<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>`,xm=`<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>`,Sm=`<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>`,Cm=`<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>`,wm=`<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>`,Tm=`<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>`,Em=`<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>`,Dm=`<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>`,Om=`<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>`,km=`<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>`,Am=`<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>`,jm=`<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>`,Mm=`<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>`,Nm=`<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>`,Pm=`<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>`,Fm=`<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>`,Im=`<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>`,Lm=`<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>`,Rm=`<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>`,zm=`<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>`,Bm=`<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>`,Vm=`<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>`,Hm=`<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>`,Um=`<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>`,Wm=`<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>`,Gm=`<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>`,Km=`<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>`,qm=`<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>`,Jm=`<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>`,Ym=`<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>`,Xm=`<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>`,Zm=`<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>`,Qm=`<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>`,$m=`<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>`,eh=`<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>`,th=`<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>`,nh=`<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>`,rh=`<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>`,ih=`<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>`,ah=`<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>`,oh=`<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>`,sh=`<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>`,ch=`<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>`,lh=`<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>`,uh=`<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>`,dh=`<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>`,fh=`<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>`,ph=`<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>`,mh=`<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>`,hh=`<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>`,gh=[bm,Tm,Dm,Om,km,Am,Nm,Pm,Fm,Lm,Rm,zm,Bm,Vm,Hm,Jm,Xm,Zm,rh,ih,sh,ch,`<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>`],_h=[vm,ym,xm,Sm,Cm,wm,Em,jm,Mm,Im,Um,Wm,Gm,Km,qm,Ym,Qm,$m,eh,th,nh,ah,oh,lh,uh,dh,fh,ph,mh,hh];function vh(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
|
|
169
|
-
`)}\n</svg>`)}var yh=vh(_m,gh),bh={minimal:_m,standard:yh,complete:vh(yh,_h)},xh={".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`},Sh={"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`},Ch={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},wh=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`]),Th=new Set([`complete`]);function Eh(e){return bh[e===`none`?`minimal`:e]}function Dh(e){return`file-tree-builtin-${e}`}function Oh(e){return e!==`none`&&Th.has(e)}function kh(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=xh[t.toLowerCase()];if(i!=null&&(r||wh.has(i)))return i;for(let e of n){if(r){let t=Ch[e];if(t!=null)return t}let t=Sh[e];if(t!=null&&(r||wh.has(t)))return t}return`default`}var Ah=`file-tree-container`,jh=`data-file-tree-style`,Mh=`data-file-tree-unsafe-css`,Nh=`data-file-tree-scrollbar-measure`,Ph=`data-file-tree-scrollbar-gutter-measured`,Fh=`--trees-scrollbar-gutter-measured`,Ih=`header`,Lh=`context-menu`,Rh=`context-menu-trigger`;function zh(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function Bh(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(zh(e)?`none`:`complete`),colored:e.colored??!0}}var Vh=e=>e.trim().toLowerCase(),Hh=e=>e.split(`/`).at(-1)??e,Uh=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 Wh(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function Gh(e){let t=Bh(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(Vh(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=Hh(o),c=s.toLowerCase(),l=r.get(c);if(l!=null)return Wh(l,e);for(let[t,n]of a)if(c.includes(t))return Wh(n,e);let u=Uh(s);for(let t of u){let n=i.get(t);if(n!=null)return Wh(n,e)}let d=kh(t.set,s,u);if(d!=null&&t.set!==`none`){if(d==="default"){let t=n?.[e];if(t!=null)return Wh(t,e)}return{name:Dh(d),remappedFrom:e,token:d}}}let s=n?.[e];return s==null?{name:e}:Wh(s,e)}}}var Kh=5,qh=32,Jh=128;function Yh(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Xh(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Zh(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 Qh(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 $h(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function eg(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 tg(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,ag(e,t)}function ng(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=Qh(e).get(t);if(i===void 0)return;let a=i>>Kh;e.childVisibleChunkSums[a]+=r}function rg(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=og(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=qh}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 ig(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>Kh;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<Kh}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 ag(e,t){if(t.childIds.length<Jh){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/qh),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>>Kh]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function og(e,t,n,r){let i=Math.min(t.childIds.length,n+qh),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 sg=7,cg=3,lg=8,ug=4;function dg(e,t,n=0){return e<<ug|n<<cg|t}function fg(e){return e.depthAndFlags>>>ug}function pg(e){return(e.depthAndFlags&lg)>>cg}function mg(e){return(e.depthAndFlags&lg)!==0}function hg(e){return e.depthAndFlags&sg}function gg(e,t){return(hg(e)&t)!==0}function _g(e,t){e.depthAndFlags|=t}function vg(e,t){e.depthAndFlags=dg(t,hg(e),pg(e))}var yg=Symbol(`benchmarkInstrumentation`);function bg(e,t){return t==null||Object.defineProperty(e,yg,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function xg(e){return e==null?null:e[yg]??null}function Sg(e,t,n){return e==null?n():e.measurePhase(t,n)}function Cg(e,t,n){Number.isFinite(n)&&e!=null&&e.setCounter(t,n)}function wg(e){return e>=48&&e<=57}function Tg(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!wg(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&&wg(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 Eg(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Tg(t)}}function Dg(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 Og(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=Dg(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function kg(e,t,n){let r=Og(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Ag(e,t){return kg(e,t,Eg)}function jg(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Mg(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=jg(e,r);return a===jg(t,r)?Ag(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 Ng(e,t){return Mg(e,t)}function Pg(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Eg(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=jg(e,n);return o===jg(t,n)?kg(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 Fg(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Eg(r);return e.sortKeyById[t]=i,i}function Ig(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Lg(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 Rg(e){let{hasTrailingSlash:t,segments:n}=Lg(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function zg(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Lg(e);return{requiresDirectory:t,segments:n}}function Bg(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[Eg(``)]}}function Vg(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 Hg(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var Ug=Symbol(`pathStorePreparedInputKind`);function Wg(e,t){return e[Ug]=t,e}function Gg(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function Kg(e,t,n){return n==="default"?Ng(e,t):n(Gg(e),Gg(t))}function qg(){return{depthAndFlags:dg(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function Jg(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 Yg(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Xg(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 Zg(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function Qg(e,t={}){return i_(e,t).map(e=>e.path)}function $g(e,t={}){let n=i_(e,t);return Wg({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function e_(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 Wg({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function t_(e){let t=e,n=t.preparedPaths;if(t[Ug]===`prepared`&&n!=null)return n;if(!Xg(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function n_(e){let t=e;return t[Ug]===`presorted`&&t.presortedPaths!=null||Zg(t.presortedPaths)?t.presortedPaths:null}function r_(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function i_(e,t={}){let n=Ig(t),r=xg(t);Cg(r,`workload.inputFiles`,e.length);let i=Sg(r,`store.preparePathEntries.parse`,()=>e.map(e=>Rg(e)));return Sg(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>Kg(e,t,n.sort))),i}var a_=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[qg()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Bg();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=xg(e),this.options=Ig(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,Yh())}appendPaths(e){return Sg(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>Rg(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Sg(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Sg(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:dg(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:dg(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:dg(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=Rg(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:dg(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:dg(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=Rg(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Sg(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Sg(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"?Pg(this.lastPreparedPath,e,this.segmentSortKeyCache):Kg(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=Yg(e),i=n==null?0:Yg(n),a=n==null?0:Jg(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=Vg(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:dg(fg(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),$h(i,s),s}createFileChildUnchecked(e,t){let n=Vg(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:dg(fg(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),$h(r,a),a}getOrCreateDirectoryChild(e,t){let n=Vg(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&&!mg(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:dg(fg(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),$h(r,a),this.directories.set(a,Yh()),a}createDirectoryChild(e,t){let n=Vg(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:dg(fg(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),$h(r,a),this.directories.set(a,Yh()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!mg(n))throw Error(`Path is not a directory: "${t}"`);if(gg(n,1))throw Error(`Duplicate path: "${t}"`);_g(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,Xh());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(mg(a)){let t=Xh();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;mg(n)&&this.directories.set(t,Yh());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),$h(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!mg(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 tg(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function o_(e,t=`closed`,n=null){let r=c_(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 s_(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function c_(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 l_(e,t){return gg(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&fg(t)<=e.defaultExpansion}function u_(e,t,n=e.snapshot.nodes[t]){return n==null||!mg(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:l_(e,n)}function d_(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!mg(r))return;let i=l_(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 f_(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 p_(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function m_(e,t){let n=f_(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 h_(e,t){let n=f_(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function g_(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 __(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function v_(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 y_(e,t){e.directoryLoadInfoById.delete(t)}function b_(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 x_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function S_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function C_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function w_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function T_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function E_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function D_(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 O_(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 k_(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 A_(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 j_(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 M_(e,t,n){return{...n,visibleCountDelta:U_(e)-t}}function N_(e,t){let n=U_(e),r=s_();e.transactionStack.push(r);try{t()}catch(t){throw I_(e,r,!1),t}I_(e,r,!0,U_(e)-n)}function P_(e,t){let n=e.instrumentation;if(n==null){F_(e,t);return}Sg(n,`store.events.record`,()=>F_(e,t))}function F_(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){V_(e,t);return}n.events.push(t),B_(n,t)}function I_(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?z_(i,t):Sg(n,`store.events.batch.merge`,()=>z_(i,t));return}let a=L_(t,r),o=e.instrumentation;if(o==null){V_(e,a);return}Sg(o,`store.events.batch.commit`,()=>V_(e,a))}function L_(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 R_(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function z_(e,t){for(let n of t.events)e.events.push(n);R_(e,t)}function B_(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function V_(e,t){let n=e.instrumentation;if(n==null){H_(e,t);return}Sg(n,`store.events.emit`,()=>H_(e,t))}function H_(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function U_(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function W_(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!mg(n)||gg(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||!mg(a)?null:i}function G_(e,t){let n=t;for(;;){let t=W_(e,n);if(t==null)return n;n=t}}function K_(e,t){let n=[t],r=t;for(;;){let t=W_(e,r);if(t==null)return n;n.push(t),r=t}}function q_(e,t){let n=t==null?e.snapshot.rootId:rv(e,t);return n==null?[]:sv(e,n)}function J_(e,t){let n=Rg(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Sv(e,xv(e,r)),{createdNodeIds:a,directoryId:o}=cv(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=ov(e,o);if(gg(n,1))throw Error(`Path already exists: "${t}"`);_g(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=uv(e,o,n.basename),s.add(c);ev(e,o);let l=Sv(e,o);return x_({affectedAncestorIds:nv(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Cv(i,l)})}function Y_(e,t,n){let r=rv(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=ov(e,r);if(gg(i,2))throw Error(`The root node cannot be removed`);if(mg(i)&&av(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Sv(e,a),s=yv(e,r);pv(e,a,r,i.nameId),bv(e,a),ev(e,a);let c=Sv(e,a);return S_({affectedAncestorIds:nv(e,a),affectedNodeIds:s,path:t,projectionChanged:Cv(o,c),recursive:n.recursive===!0})}function X_(e,t,n,r){let i=rv(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=ov(e,i);if(gg(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=_v(e,i,n),c=Sv(e,a.parentId),l=Sv(e,s.parentId),u=Hg(e.snapshot.segmentTable,a.nameId),d=Vg(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(mg(a)&&Dv(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=Zh(e.snapshot.nodes,av(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&vv(e,p,o,pg(a))===`skip`)return null;let m=a.parentId;pv(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Ev(e,i),fv(e,s.parentId,i),bv(e,m),e.pathCacheVersion++,ev(e,m),s.parentId!==m&&ev(e,s.parentId);let h=Sv(e,m),g=Sv(e,s.parentId);return C_({affectedAncestorIds:[...new Set([...nv(e,m),...nv(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:wv([c,l],[h,g]),to:$_(e,i)})}function Z_(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function Q_(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function $_(e,t){let n=ov(e,t),r=Z_(e,t);if(r!=null)return r;if(gg(n,2))return Q_(e,t,``);let i=$_(e,n.parentId),a=Hg(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return Q_(e,t,mg(n)?`${o}/`:o)}function ev(e,t){let n=e.instrumentation;if(n==null){kv(e,t);return}Sg(n,`store.recomputeCountsUpwardFrom`,()=>kv(e,t))}function tv(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||!mg(o)){Ov(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Ov(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function nv(e,t){let n=[],r=t;for(;r!=null;){let t=ov(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function rv(e,t){if(t.length===0)return e.snapshot.rootId;let n=zg(t);return iv(e,n.segments,n.requiresDirectory)}function iv(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=av(e,r),a=Zh(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=ov(e,r);return n&&!mg(i)?null:r}function av(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 ov(e,t){let n=e.snapshot.nodes[t];if(n===void 0||gg(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function sv(e,t){let n=e.snapshot.nodes[t];if(n===void 0||gg(n,4))return[];if(!mg(n))return[$_(e,t)];if(av(e,t).childIds.length===0)return gg(n,1)&&!gg(n,2)?[$_(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||gg(n,4)){i.pop();continue}if(!mg(n)){r.push($_(e,t.nodeId)),i.pop();continue}let a=av(e,t.nodeId);if(a.childIds.length===0){gg(n,1)&&!gg(n,2)&&r.push($_(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 cv(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=Vg(e.snapshot.segmentTable,i),a=av(e,r),o=Zh(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!mg(ov(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=lv(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function lv(e,t,n){let r=ov(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:dg(fg(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,Yh()),fv(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function uv(e,t,n){let r=Vg(e.snapshot.segmentTable,n),i=av(e,t);if(Zh(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${jv(e,t,n)}"`);let a=ov(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:dg(fg(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),fv(e,t,o),e.activeNodeCount++,o}function dv(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}mv(e,n,o)<0?i=a:r=a+1}return r}function fv(e,t,n){let r=av(e,t),i=ov(e,n);Zh(e.snapshot.nodes,r).set(i.nameId,n),ng(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=dv(e,r,n);r.childIds.splice(a,0,n),eg(r,a),ag(e.snapshot.nodes,r)}function pv(e,t,n,r){let i=av(e,t),a=Qh(i),o=a.get(n)??-1;Zh(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&ng(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),eg(i,o),ag(e.snapshot.nodes,i))}function mv(e,t,n){let r=e.snapshot.options.sort;return r==="default"?hv(e,t,n):r(gv(e,t),gv(e,n))}function hv(e,t,n){let r=ov(e,t),i=ov(e,n),a=mg(r);if(a!==mg(i))return a?-1:1;let o=Og(Fg(e.snapshot.segmentTable,r.nameId),Fg(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=Hg(e.snapshot.segmentTable,r.nameId),c=Hg(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function gv(e,t){let n=ov(e,t),r=$_(e,t),i=mg(n),a=i?r.slice(0,-1):r;return{basename:Hg(e.snapshot.segmentTable,n.nameId),depth:fg(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function _v(e,t,n){let r=ov(e,t),i=rv(e,n);if(i!=null){let t=ov(e,i);if(mg(t))return{basename:Hg(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=zg(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=zg(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:iv(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function vv(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${$_(e,t)}"`);let i=ov(e,t);if(pg(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(mg(i)&&av(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return yv(e,t),pv(e,a,t,o),bv(e,a),ev(e,a),`handled`}function yv(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=ov(e,t.nodeId);if(t.visitedChildren||!mg(i)){mg(i)&&e.snapshot.directories.delete(t.nodeId),_g(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),y_(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=av(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 bv(e,t){let n=t;for(;n!=null;){let t=ov(e,n);if(!mg(t)||gg(t,2)||av(e,n).childIds.length>0)return;_g(t,1),n=t.parentId===n?null:t.parentId}}function xv(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=Zh(e.snapshot.nodes,av(e,n)).get(t);if(i==null||!mg(ov(e,i)))break;n=i}return n}function Sv(e,t){let n=Tv(e,t);if(n==null)return null;let r=G_(e,n),i=ov(e,r),a=n===r?null:K_(e,n).map(t=>$_(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:av(e,r).childIds.length>0,path:$_(e,r),terminalKind:pg(i)})}function Cv(e,t){return wv([e],[t])}function wv(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 Tv(e,t){let n=t;for(;n!=null;){let t=ov(e,n);if(!mg(t)||gg(t,2))return null;if(!u_(e,n,t))return n;n=t.parentId}return null}function Ev(e,t){let n=ov(e,t);if(vg(n,(t===e.snapshot.rootId?-1:fg(ov(e,n.parentId)))+1),!mg(n))return;let r=av(e,t);for(let t of r.childIds)Ev(e,t)}function Dv(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=ov(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Ov(e,t,n=ov(e,t),r=!1){let i=e.instrumentation;if(i==null){Av(e,t,n,r);return}Sg(i,`store.recomputeNodeCounts`,()=>Av(e,t,n,r))}function kv(e,t){let n=t;for(;n!=null;){let t=ov(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Ov(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&ng(av(e,s),n,a,o),n=s}}function Av(e,t,n,r){if(!mg(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=av(e,t);if(r){let t=e.instrumentation;t==null?tg(e.snapshot.nodes,i):Sg(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>tg(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,gg(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=W_(e,t)==null?u_(e,t,n)?1+o:1:o}function jv(e,t,n){let r=$_(e,t);return r.length===0?n:`${r}${n}`}function Mv(e){return e!=null&&!gg(e,4)}function Nv(e,t){let n=e.snapshot.nodes[t];return!Mv(n)||!mg(n)||gg(n,2)?null:n}function Pv(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Mv(e.snapshot.nodes[n])&&(t+=1);return t}function Fv(e){return Math.max(0,e.valueById.length-1)}function Iv(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Pv(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Fv(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Lv(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 Rv(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Nv(e,n)!=null&&t.push($_(e,n));for(let t of e.expandedDirectoryIds)Nv(e,t)!=null&&n.push($_(e,t));return{collapsedPaths:t,expandedPaths:n}}function zv(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Nv(e,n)!=null&&p_(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:$_(e,n)});return t}function Bv(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=rv(e,n);t!=null&&d_(e,t,!0,ov(e,t))}for(let n of t.collapsedPaths){let t=rv(e,n);t!=null&&d_(e,t,!1,ov(e,t))}}function Vv(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=rv(e,n.path);t!=null&&Nv(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function Hv(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function Uv(e){let t=e.snapshot.segmentTable,n=Bg();for(let r of e.snapshot.nodes)if(Mv(r)){if(gg(r,2)){r.nameId=0;continue}r.nameId=Vg(n,Hg(t,r.nameId))}e.snapshot.segmentTable=n}function Wv(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Mv(r)||!mg(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Mv(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[ov(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),tg(e.snapshot.nodes,n)}}function Gv(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Mv(n))break;--t}e.snapshot.nodes.length=t+1}function Kv(e){let t=Rv(e),n=zv(e);Sg(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>Hv(e)),Sg(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>Uv(e)),Sg(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>Wv(e)),Sg(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>Gv(e)),Sg(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>Bv(e,t)),Sg(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>Vv(e,n)),Sg(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>tv(e,e.snapshot.rootId))}function qv(e){let t=Rv(e),n=zv(e),r=Sg(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>q_(e)),i=bg({...e.snapshot.options},e.instrumentation),a=Sg(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new a_(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,Sg(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>Bv(e,t)),Sg(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>Vv(e,n)),Sg(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>tv(e,e.snapshot.rootId))}function Jv(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function Yv(e,t){let n=Iv(e);t===`stable`?Sg(e.instrumentation,`store.cleanup.stable`,()=>Kv(e)):Sg(e.instrumentation,`store.cleanup.aggressive`,()=>qv(e));let r=Iv(e);return Lv(t,t===`stable`,n,r)}var Xv=64;function Zv(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 Qv(e){return ov(e,e.snapshot.rootId).visibleSubtreeCount}function $v(e,t,n,r){let i=ov(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function ey(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:yy(e,t.cursor),setSize:t.setSize,subtreeEndIndex:$v(e,t.cursor,t.index,n)}}function ty(e,t,n,r,i,a){let o=av(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=rg(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return ny(e,u,l,r+c,i+1,s,o.childIds.length,a)}function ny(e,t,n,r,i,a,o,s){if(!mg(ov(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=py(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=ov(e,c.terminalNodeId);if(!mg(l)||!u_(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return ty(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function ry(e,t){let n=Qv(e);if(t<0||t>=n)return null;let r=ty(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>$_(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=ey(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:yy(e,r.cursor),setSize:r.setSize,subtreeEndIndex:$v(e,r.cursor,r.index,n)}}function iy(e,t,n){let r=e.instrumentation,i=Qv(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 vy(e,o+1);let t=[],n=uy(e,a);for(let r=a;r<=o&&n!=null;r++){let r=yy(e,n);t.push(r),n=hy(e,n)}return t}let s=[],c=0,l=0,u=Sg(r,`store.getVisibleSlice.selectFirstRow`,()=>uy(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Sg(r,`store.getVisibleSlice.materializeRow`,()=>yy(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Sg(r,`store.getVisibleSlice.advanceCursor`,()=>hy(e,u))}return Cg(r,`workload.visibleRowsRead`,s.length),Cg(r,`workload.flattenedRowsRead`,c),Cg(r,`workload.flattenedSegmentsRead`,l),s}function ay(e,t=Qv(e)){let n=e.instrumentation;return n==null?_y(e,t):Sg(n,`store.getVisibleTreeProjection`,()=>_y(e,t))}function oy(e){return gy(ay(e))}function sy(e,t){let n=rv(e,t);if(n==null||n===e.snapshot.rootId||mg(ov(e,n))&&G_(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=ov(e,i).parentId,n=av(e,t),s=Qh(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=ig(a,n,s),t!==o){let n=ov(e,t),a=W_(e,t);if(!u_(e,t,n)&&a!==i)return null;G_(e,t)===t&&(r+=1)}i=t}return r}function cy(e,t){let n=rv(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=ov(e,n);if(!mg(r))throw Error(`Path is not a directory: "${t}"`);return u_(e,n,r)?null:(d_(e,n,!0,r),ev(e,n),w_({affectedAncestorIds:nv(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function ly(e,t){let n=rv(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=ov(e,n);if(!mg(r))throw Error(`Path is not a directory: "${t}"`);return u_(e,n,r)?(d_(e,n,!1,r),ev(e,n),T_({affectedAncestorIds:nv(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function uy(e,t){return t<0||t>=Qv(e)?null:dy(e,e.snapshot.rootId,t,-1)}function dy(e,t,n,r){let i=av(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?rg(e.snapshot.nodes,i,n):Sg(a,`store.getVisibleSlice.selectChildIndex`,()=>rg(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return fy(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function fy(e,t,n,r){if(!mg(ov(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=py(e,t,r);if(n===0)return i;let a=ov(e,i.terminalNodeId);if(!mg(a)||!u_(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return dy(e,i.terminalNodeId,n-1,i.visibleDepth)}function py(e,t,n){return mg(ov(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:G_(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Sg(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>G_(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function my(e,t){let n=ov(e,t);if(!mg(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||W_(e,r)!==t}function hy(e,t){let n=ov(e,t.terminalNodeId);if(mg(n)){let r=av(e,t.terminalNodeId);if(u_(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:fy(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=ov(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=av(e,n),o=Qh(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 fy(e,s,0,i);my(e,r)&&i--,r=n}}function gy(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 _y(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(Xv);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=Zv(o,y);let x,S=_;if(mg(v))S=f?G_(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:$_(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&&mg(C)&&u_(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 vy(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(!mg(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:$_(e,f)};continue}let h=l?G_(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=yy(e,g);let _=i[h];_!=null&&mg(_)&&u_(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function yy(e,t){let n=ov(e,t.terminalNodeId),r=mg(n)?by(e,t):null,i=$_(e,t.terminalNodeId),a=Hg(e.snapshot.segmentTable,n.nameId),o=mg(n)&&av(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?K_(e,t.headNodeId).map(n=>{let r=ov(e,n);return{isTerminal:n===t.terminalNodeId,name:Hg(e.snapshot.segmentTable,r.nameId),nodeId:n,path:$_(e,n)}}):Sg(c,`store.getVisibleSlice.flatten.collectSegments`,()=>K_(e,t.headNodeId).map(n=>{let r=ov(e,n);return{isTerminal:n===t.terminalNodeId,name:Hg(e.snapshot.segmentTable,r.nameId),nodeId:n,path:$_(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:mg(n)&&u_(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:mg(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function by(e,t){if(t.headNodeId===t.terminalNodeId)return p_(e,t.terminalNodeId);let n=K_(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=p_(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var xy=8;function Sy(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 Cy(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]&xy)===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]]&xy)===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 wy(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||!mg(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&&ag(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&mg(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,ag(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Ty(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=Sy(e.snapshot);Cy(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)&&ag(n,i)}}function Ey(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Dy=class e{#e;constructor(e={}){let t=xg(e),n=Sg(t,`store.builder.create`,()=>new a_(e));if(e.preparedInput!=null){let t=n_(e.preparedInput);t==null?n.appendPreparedPaths(t_(e.preparedInput),!1):n.appendPresortedPaths(t,r_(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Sg(t,`store.preparePathEntries`,()=>i_(r,e)))}let r=Sg(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Sg(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Sg(t,`store.state.create`,()=>o_(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Sg(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Ey(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Sg(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?Sg(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>Ty(this.#e)):Sg(t,`store.state.initializeOpenVisibleCounts`,()=>wy(this.#e)):Sg(t,`store.state.recomputeCounts`,()=>tv(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return Qg(e,t)}static prepareInput(e,t={}){return $g(e,t)}static preparePresortedInput(e){return e_(e)}list(e){return Sg(this.#e.instrumentation,`store.list`,()=>q_(this.#e,e))}add(e){Sg(this.#e.instrumentation,`store.add`,()=>{let t=Qv(this.#e);P_(this.#e,M_(this.#e,t,J_(this.#e,e)))})}remove(e,t={}){Sg(this.#e.instrumentation,`store.remove`,()=>{let n=Qv(this.#e);P_(this.#e,M_(this.#e,n,Y_(this.#e,e,t)))})}move(e,t,n={}){Sg(this.#e.instrumentation,`store.move`,()=>{let r=Qv(this.#e),i=X_(this.#e,e,t,n);i!=null&&P_(this.#e,M_(this.#e,r,i))})}batch(e){N_(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 Sg(this.#e.instrumentation,`store.getVisibleCount`,()=>Qv(this.#e))}getVisibleSlice(e,t){return Sg(this.#e.instrumentation,`store.getVisibleSlice`,()=>iy(this.#e,e,t))}getVisibleRowContext(e){return Sg(this.#e.instrumentation,`store.getVisibleRowContext`,()=>ry(this.#e,e))}getVisibleTreeProjection(){return oy(this.#e)}getVisibleTreeProjectionData(e){return ay(this.#e,e)}getVisibleIndex(e){return Sg(this.#e.instrumentation,`store.getVisibleIndex`,()=>sy(this.#e,e))}getPathInfo(e){return Sg(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=rv(this.#e,e);if(t==null)return null;let n=ov(this.#e,t);return{depth:fg(n),kind:mg(n)?`directory`:`file`,path:$_(this.#e,t)}})}isExpanded(e){return Sg(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=ov(this.#e,t);return u_(this.#e,t,n)})}expand(e){Sg(this.#e.instrumentation,`store.expand`,()=>{let t=Qv(this.#e),n=cy(this.#e,e);n!=null&&P_(this.#e,M_(this.#e,t,n))})}collapse(e){Sg(this.#e.instrumentation,`store.collapse`,()=>{let t=Qv(this.#e),n=ly(this.#e,e);n!=null&&P_(this.#e,M_(this.#e,t,n))})}on(e,t){return b_(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return p_(this.#e,t)}markDirectoryUnloaded(e){Sg(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(av(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=Qv(this.#e);h_(this.#e,t),P_(this.#e,M_(this.#e,n,E_({affectedAncestorIds:nv(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Sg(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=Qv(this.#e),r=m_(this.#e,t);return P_(this.#e,M_(this.#e,n,D_({affectedAncestorIds:nv(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Sg(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||p_(this.#e,n)!==`loading`||!__(this.#e,n,e.attemptId))return!1;let r=$_(this.#e,n);this.validateChildPatch(r,t);let i=Qv(this.#e),a=[];for(let e of t.operations){Oy(r,e);let t=Qv(this.#e);switch(e.type){case`add`:a.push(M_(this.#e,t,J_(this.#e,e.path)));break;case`remove`:a.push(M_(this.#e,t,Y_(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=X_(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(M_(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return P_(this.#e,M_(this.#e,i,O_({affectedAncestorIds:nv(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:$_(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Sg(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=Qv(this.#e),r=g_(this.#e,t,e.attemptId);return P_(this.#e,M_(this.#e,n,k_({affectedAncestorIds:nv(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:$_(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Sg(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=Qv(this.#e),i=v_(this.#e,n,e.attemptId,t);return P_(this.#e,M_(this.#e,r,A_({affectedAncestorIds:nv(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:$_(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Sg(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(Jv(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=Qv(this.#e),n=Yv(this.#e,e.mode??`stable`);return P_(this.#e,M_(this.#e,t,j_({...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=av(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Eg(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=Og(Fg(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(!mg(ov(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=ov(this.#e,n);u_(this.#e,n,i)||(d_(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=ov(this.#e,e);if(!u_(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=rv(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!mg(ov(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!mg(ov(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=ov(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=ov(this.#e,e),r=W_(this.#e,e);if(!u_(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 Oy(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 ky={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Ay(e,t){if(typeof e==`number`)return{itemHeight:t??ky.default.itemHeight,factor:e};let n=ky[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var jy=ky.default.itemHeight,My=`@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
|
-
`,Ny=`@layer base, unsafe;`;function Py(e){return`${Ny}
|
|
1262
|
-
@layer base {
|
|
1263
|
-
${e}
|
|
1264
|
-
}`}function Fy(e){return`${Ny}
|
|
1265
|
-
@layer unsafe {
|
|
1266
|
-
${e}
|
|
1267
|
-
}`}var Iy=new WeakMap;function Ly(e){let t=Iy.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(Nh,`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(),Iy.set(e,i),i}function Ry(e,t){if(!e.isConnected)return;let n=Ly(t);if(n==null)return;let r=t.querySelector(`style[${Ph}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(Ph,``),t.appendChild(i)),i.textContent=`:host { ${Fh}: ${n}px; }`}var zy;function By(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){zy??(zy=new CSSStyleSheet,zy.replaceSync(Py(My)));let t=!1;try{e.adoptedStyleSheets=[zy],t=!0}catch{}if(t){e.querySelector(`style[${jh}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(jh,``),t.textContent=Py(My),e.prepend(t)}}function Vy(e,t){Hy(e,t),By(t),Ry(e,t)}function Hy(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`});Vy(this,e)}}if(customElements.define(Ah,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(Ah)))e instanceof HTMLElement&&Vy(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Uy=e=>e.startsWith(`f::`)?e.slice(3):e;function Wy(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Gy(e,t){return e===``?t:`${e}/${t}`}function Ky({files:e,path:t,isFolder:n,nextBasename:r}){let i=Uy(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}=Wy(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=Gy(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 qy(e){return e.endsWith(`/`)}function Jy(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 Yy(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 Xy(e,t){return t.includes(e)?Yy(t):[e]}function Zy(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 Qy(e,t){return{draggedPaths:e,target:t}}function $y(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(qy(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function eb(e,t){return t.kind===`root`||t.directoryPath==null?Jy(e):t.directoryPath}function tb(e,t){let n=e.map(e=>{let n=eb(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 nb(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 rb(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(!nb(Dy.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 ib(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function ab(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 ob(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function sb(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 ob(e,t.path)?n?e:null:e;case`move`:return ab(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=sb(r,e,n),r==null)return null;return r}}}function cb(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function lb(e){switch(e.operation){case`add`:return{...cb(e),operation:`add`,path:e.path};case`remove`:return{...cb(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...cb(e),from:e.from,operation:`move`,to:e.to}}}function ub(e){return{...cb(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>lb(e)),operation:`batch`}}function db(e){switch(e.operation){case`add`:case`remove`:case`move`:return lb(e);case`batch`:return ub(e);default:return null}}function fb(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function pb(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 mb(e){return pb(e).at(-1)??null}function hb(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function gb(e){return e.endsWith(`/`)}var _b=e=>e.toLowerCase();function vb(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function yb(e){return e.endsWith(`/`)?e.slice(0,-1):e}function bb(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var xb=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Sb=Symbol(`FILE_TREE_RENAME_VIEW`),Cb=512,wb=512;function Tb(e){return e===`top`||e===`center`?e:`nearest`}function Eb(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=pb(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 Db(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:Eb(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Ob=class e{static{Object.defineProperty(e.prototype,Sb,{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=rb({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=mb(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:Tb(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<=wb){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=Xy(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=Qy(t.draggedPaths,n);($y(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Zy(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=Qy(e.draggedPaths,t);if($y(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=tb(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=gb(r),a=yb(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of pb(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=vb(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,gb(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,gb(e)?{recursive:!0}:void 0);return}let t=gb(e),n=Ky({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:yb(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(bb(n.sourcePath,t),bb(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=rb({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=!fb(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=mb(e),n=hb(e,t),r=null,i=null;for(let e of this.#be()){if(mb(e)!==t)continue;let a=hb(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=pb(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=!fb(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 Dy({...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 pb(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(_b),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(_b),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 pb(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:xb(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 pb(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 pb(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=Db(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Cb)),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=sb(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=sb(this.#c,e,!0),r=[...this.#B].map(t=>sb(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=sb(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return fb(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&&ib(e)&&(this.#i=null);let t=ib(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=db(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},kb=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 Ab(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 jb(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 Mb(e,t){return t?`${e}/`:e}function Nb(e,t=null){let n=kb(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=Fb(t);e!=null&&Rb({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 Pb(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=Ib(e);t!=null&&(c=Lb({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=Fb(e);t!=null&&(c=Rb({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:Vb(i),statusByPath:i}:e}function Fb(e){return Ib(e.path)}function Ib(e){let t=Ab(e);if(t!=null)return{canonicalPath:Mb(t.path,t.isDirectory),isDirectory:t.isDirectory}}function Lb({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),Bb(t,n,e),!0)}function Rb({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??zb(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function zb(e,t,n){for(let r of jb(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function Bb(e,t,n){for(let r of jb(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function Vb(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb={},$b=[],ex=Array.isArray,tx=$b.slice,nx=Object.assign;function rx(e){e&&e.parentNode&&e.remove()}function ix(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?tx.call(arguments,2):n),ax(e,o,r,i,null)}function ax(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??++Ub,__i:-1,__u:0};return i==null&&Hb.vnode!=null&&Hb.vnode(a),a}function ox(e){return e.children}function sx(e,t){this.props=e,this.context=t,this.__g=0}function cx(e,t){if(t==null)return e.__?cx(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`?cx(e):null}function lx(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 lx(e)}}function ux(e){(8&e.__g||!(e.__g|=8)||!Wb.push(e)||Kb++)&&Gb==Hb.debounceRendering||((Gb=Hb.debounceRendering)||queueMicrotask)(dx)}function dx(){for(var e,t,n,r,i,a,o,s,c=1;Wb.length;)Wb.length>c&&Wb.sort(qb),e=Wb.shift(),c=Wb.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=nx({},r)).__v=r.__v+1,Hb.vnode&&Hb.vnode(n),yx(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??cx(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,xx(a,n,o),n.__e!=i&&lx(n)));Kb=0}function fx(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||$b,b=t.length;for(c=px(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?Qb:y[m.__i]||Qb,m.__i=f,_=yx(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&wx(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=mx(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function px(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?ax(null,o,null,null,null):ex(o)?ax(ox,{children:o},null,null,null):o.constructor==null&&o.__b>0?ax(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=hx(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=cx(s)),Tx(s,s));return r}function mx(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=mx(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=cx(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function hx(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 gx(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function _x(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||gx(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||gx(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(Jb,`$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=Yb,e.addEventListener(t,a?Zb:Xb,a)):e.removeEventListener(t,a?Zb:Xb,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 vx(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=Yb++;else if(t.u<n.l)return;return n(Hb.event?Hb.event(t):t)}}}function yx(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=Hb.__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 sx(v,x),f.constructor=M,f.render=Ex),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=nx({},f.__s)),nx(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=Hb.__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=nx({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===ox&&d.key==null&&(E=Sx(d.props.children)),s=fx(e,ex(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--;)rx(a[j]);bx(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||bx(t);Hb.__e(e,t,n)}else s=t.__e=Cx(n.__e,t,n,r,i,a,o,c,l,u);return(d=Hb.diffed)&&d(t),128&t.__u?void 0:s}function bx(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(bx)}function xx(e,t,n){for(var r=0;r<n.length;r++)wx(n[r],n[++r],n[++r]);Hb.__c&&Hb.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Hb.__e(e,t.__v)}})}function Sx(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:ex(e)?e.map(Sx):nx({},e)}function Cx(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&&=(Hb.__m&&Hb.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=tx.call(e.childNodes),v=n.props||Qb,!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;_x(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&&!_||_x(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=``),fx(b==`template`?e.content:e,ex(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&cx(n,0),s,c,l),a!=null)for(u=a.length;u--;)rx(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||_x(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&_x(e,u,g,v[u],i))}return e}function wx(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){Hb.__e(e,n)}}function Tx(e,t,n){var r,i;if(Hb.unmount&&Hb.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||wx(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Hb.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Tx(r[i],t,n||typeof e.type!=`function`);n||rx(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Ex(e,t,n){return this.constructor(e,n)}function Dx(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Hb.__&&Hb.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=ix(ox,null,[e]),i=[],a=[],yx(t,e,r||Qb,Qb,t.namespaceURI,r?null:t.firstChild?tx.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),xx(i,e,a)}function Ox(e,t){e.__u|=32,Dx(e,t)}Hb={__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 Kb=0,e}},Ub=0,sx.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=nx({},this.state);typeof e==`function`&&(e=e(nx({},n),this.props)),e&&nx(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ux(this))},sx.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),ux(this))},sx.prototype.render=ox,Wb=[],Kb=0,qb=function(e,t){return e.__v.__b-t.__v.__b},Jb=/(PointerCapture)$|Capture$/i,Yb=0,Xb=vx(!1),Zb=vx(!0);var kx=0;Array.isArray;function Ax(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:--kx,__i:-1,__u:0,__source:i,__self:a};return Hb.vnode&&Hb.vnode(l),l}var jx=16,Mx=16,Nx={};function Px({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}=Nx[e]??{width:jx,height:Mx},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Ax(`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:Ax(`use`,{href:c})})}var Fx=e=>e!==void 0&&/\s/.test(e),Ix=(e,t)=>{let n=t=>Fx(e[t-1])||Fx(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},Lx=e=>Ix(e,Math.ceil(e.length/2)),Rx=e=>{if(e.length<2)return[e,``];let t=Lx(e);return[e.slice(0,t),e.slice(t)]},zx=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Lx(e);return[e.slice(0,r),e.slice(r)]},Bx=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)]},Vx=(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)]},Hx=(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)]},Ux=(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 Wx({children:e,marker:t,variant:n=`default`}){"use no memo";return Ax(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Ax(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Ax(`span`,{"data-truncate-fade":!0}):t})})}function Gx(e){"use no memo";let{mode:t,children:n}=e;return Ax(`div`,{children:[Ax(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Ax(`span`,{children:n}):n}),Ax(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Ax(`span`,{children:n}):n})]})}function Kx({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Ax(Gx,{mode:t,children:e},`content`),o=Ax(Wx,{marker:n,mode:t,variant:r},`marker`),s=Ax(`div`,{"data-truncate-fill":!0},`fill`);return Ax(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Ax(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function qx({children:e,...t}){"use no memo";return Ax(Kx,{mode:`truncate`,...t,children:e})}function Jx({children:e,...t}){"use no memo";return Ax(Kx,{mode:`fruncate`,...t,children:e})}function Yx({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=Ax(qx,{...s,children:t[0]}),l=Ax(Jx,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Ax(`div`,{className:a,style:o});if(e.length<i)return Ax(n===`end`?Jx:qx,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Rx:r===`extension`?t=zx:r===`leaf-path`&&(t=Bx);else if(typeof r==`number`)t=Vx,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=Hx:e===`first`&&(t=Ux)}else typeof r==`function`&&(t=r);t??=Rx;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=Ax(qx,{...s,..._,children:f}),l=Ax(Jx,{...s,...v,children:p})}return Ax(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Ax(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Ax(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var Xx={endIndex:-1,startIndex:-1};function Zx(e,t,n){return Math.min(Math.max(e,t),n)}function Qx(e,t){return e<0||t<e?Xx:{endIndex:t,startIndex:e}}function $x(e){return e.startIndex<0||e.endIndex<e.startIndex}function eS(e,t){return $x(e)?0:(e.endIndex-e.startIndex+1)*t}function tS(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function nS(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function rS(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 iS(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 aS(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 oS(e,t,n){if(e.length===0||t<=0)return[];let r=aS(e),i=rS(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=iS(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 sS(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=Zx(t.scrollTop,0,o),c=t.stickyRows??oS(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=tS(s,n,t.itemHeight),m=tS(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?Xx:Qx(m,nS(u+d,n,t.itemHeight)),y=g+1,b=$x(v)?Xx:Qx(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=eS(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:$x(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var cS={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},lS={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},uS=`Contains git status items`;function dS(e){return e.current?!0:(e.current=!0,!1)}function fS(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 pS(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return fS({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 mS(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 hS(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 gS(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 _S(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function vS(e,t){return e!=null&&e>0?e:t}function yS(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 bS(e,t,n,r,i=0){let a=fS({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function xS(e,t,n,r,i,a,o=0){let s=pS({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function SS(e,t,n,r,i,a){let o=mS({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function CS(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function wS(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function TS({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Ax(`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 ES(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 DS(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 OS,kS,AS,jS,MS=Object.is,NS=0,PS=[],FS=Hb,IS=FS.__b,LS=FS.__r,RS=FS.diffed,zS=FS.__c,BS=FS.unmount,VS=FS.__;function HS(e,t){FS.__h&&FS.__h(kS,e,NS||t),NS=0;var n=kS.__H||(kS.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function US(e){return NS=1,WS(nC,e)}function WS(e,t,n){var r=HS(OS++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):nC(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);MS(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=kS,!kS.__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,MS(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};kS.__f=!0;var a=kS.shouldComponentUpdate,o=kS.componentWillUpdate;kS.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)},kS.shouldComponentUpdate=i}return r.__N||r.__}function GS(e,t){var n=HS(OS++,3);!FS.__s&&tC(n.__H,t)&&(n.__=e,n.u=t,kS.__H.__h.push(n))}function KS(e,t){var n=HS(OS++,4);!FS.__s&&tC(n.__H,t)&&(n.__=e,n.u=t,kS.__h.push(n))}function qS(e){return NS=5,JS(function(){return{current:e}},[])}function JS(e,t){var n=HS(OS++,7);return tC(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function YS(e,t){return NS=8,JS(function(){return e},t)}function XS(){for(var e;e=PS.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach($S),e.__H.__h.forEach(eC),e.__H.__h=[]}catch(t){e.__H.__h=[],FS.__e(t,e.__v)}}FS.__b=function(e){kS=null,IS&&IS(e)},FS.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),VS&&VS(e,t)},FS.__r=function(e){LS&&LS(e),OS=0;var t=(kS=e.__c).__H;t&&(AS===kS?(t.__h=[],kS.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach($S),t.__h.forEach(eC),t.__h=[],OS=0)),AS=kS},FS.diffed=function(e){RS&&RS(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(PS.push(t)!==1&&jS===FS.requestAnimationFrame||((jS=FS.requestAnimationFrame)||QS)(XS)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),AS=kS=null},FS.__c=function(e,t){t.some(function(e){try{e.__h.forEach($S),e.__h=e.__h.filter(function(e){return!e.__||eC(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],FS.__e(n,e.__v)}}),zS&&zS(e,t)},FS.unmount=function(e){BS&&BS(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{$S(e)}catch(e){t=e}}),n.__H=void 0,t&&FS.__e(t,n.__v))};var ZS=typeof requestAnimationFrame==`function`;function QS(e){var t,n=function(){clearTimeout(r),ZS&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ZS&&(t=requestAnimationFrame(n))}function $S(e){var t=kS,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),kS=t}function eC(e){var t=kS;e.__c=e.__(),kS=t}function tC(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!MS(t,e[n])})}function nC(e,t){return typeof t==`function`?t(e):t}function rC(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Ax(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Ax(ox,{children:[Ax(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Ax(qx,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function iC(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function aC(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function oC(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 sC({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=sS(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:oC(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?oC(u,1,t,o):i&&r<=0&&c.length>0?oS(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 cC=400,lC=40,uC=18;function dC(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))?fC(e,t,n):a instanceof HTMLElement?a:null}function fC(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 pC(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 mC(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 hC(){return navigator.vendor!==`Apple Computer, Inc.`}function gC(e,t){let n=e-t.top;if(n<lC)return-Math.ceil((lC-Math.max(0,n))/lC*uC);let r=t.bottom-e;return r<lC?Math.ceil((lC-Math.max(0,r))/lC*uC):0}function _C(e,t){if(e!=null){let t=cS[e];return t==null?null:{text:t,title:lS[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:uS}:null}function vC(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 yC(e){return e!=null&&`toggle`in e}function bC(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function xC(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function SC(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function CC(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function wC(e,t){return t&&CC(e)||(e.ctrlKey||e.metaKey)&&bC(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var TC=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function EC(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 DC(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 OC(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function kC(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function AC(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function jC(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 MC(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 NC(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 PC(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=NC(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 FC(e,t){return{kind:e.kind,name:aC(e),path:t}}function IC(e){return e==null?void 0:`${e}__tree`}function LC(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function RC(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function zC(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Ax(`span`,{title:e.title,children:e.text}):Ax(`span`,{title:e.title,children:e.parts.map((e,t)=>Ax(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?RC(e.icon)?t(e.icon):{name:e.icon}:RC(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Ax(`span`,{title:e.title,children:Ax(Px,{...n})})}function BC(e){e!=null&&hS(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function VC(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=iC(e);return Ax(ox,{children:[e.depth>0?Ax(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Ax(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Ax(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Ax(Px,{...t(`file-tree-icon-chevron`)}):Ax(Px,{...t(`file-tree-icon-file`,u)})}),Ax(`div`,{"data-item-section":`content`,children:e.isFlattened?rC(e,c,a):c??Ax(Yx,{minimumLength:5,split:`extension`,children:e.name})}),i?Ax(`div`,{"data-item-section":`decoration`,children:r==null?null:zC(r,t)}):null,s?Ax(`div`,{"data-item-section":`git`,children:zC(o,t)}):null,n?Ax(`div`,{"data-item-section":`action`,children:l?Ax(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Ax(Px,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function HC(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=iC(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??vC(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=_C(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,ee=K?a.getValue():``,q=R||!K?null:Ax(TS,{ref:D,ariaLabel:`Rename ${aC(t)}`,isFlattened:t.isFlattened,value:ee,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),te=VC(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:q,showDecorativeActionAffordance:G}),ne={...ES({ariaLabel:aC(t),domId:t.isFocused?LC(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:OC(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&&K?Ax(`div`,{...ne,children:te}):Ax(`button`,{...ne,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:te})}function UC(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(iC(e))).map((n,r)=>HC(e,n,t.start+r))}function WC({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=jy,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 _=qS(null),v=qS(null),y=qS(!1),b=qS(null),x=qS(null),S=qS(null),C=qS(null),w=qS(null),T=qS(new Map),E=qS(new Map),D=qS(()=>{}),O=qS(null),k=qS(0),A=qS(!1),j=qS(null);j.current!==t&&(A.current=!1,j.current=t);let M=qS(!1),N=qS(null),P=qS(null),F=qS(!1),I=qS(null),L=qS(null),R=qS(null),z=qS(null),B=qS(null),V=qS(null),H=qS(null),U=qS(null),W=qS(!1),G=qS(null),K=qS(null),ee=qS(null),q=qS(null),te=JS(()=>new Map,[]),[,ne]=US(0),re=qS(!1),[ie,ae]=US(null),[oe,se]=US(null),[ce,le]=US(null),[ue,de]=US(null),[fe,pe]=US(0),[J,me]=US(null),he=qS(J);he.current=J;let ge=qS(null),_e=qS(null),ve=qS(null),ye=qS(null),be=qS(null),xe=qS(!1),Se=()=>{_e.current=null,ve.current=null,ye.current=null},Ce=(e,t)=>{_e.current=e,ve.current=null,ye.current=t==null?null:{path:e,scrollTop:t}},we=(e,t)=>{_e.current=null,ve.current={path:e,viewportOffset:t},ye.current=null},Te=qS(d===`retain`&&t.isSearchOpen()),[Ee,De]=US(p);GS(()=>{p||De(!1)},[p]);let Oe=qS(!1),ke=YS(()=>{Oe.current=!0,De(e=>e&&!1)},[]),[Ae,je]=US(()=>sC({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Me,Ne]=US(!1);GS(()=>{Ne(!0)},[]);let Pe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Fe=e?.contextMenu?.triggerMode??(Pe?`right-click`:`both`),Ie=Fe===`both`||Fe===`button`,Le=e?.contextMenu?.buttonVisibility??`when-needed`,Re=Fe===`both`||Fe===`right-click`;KS(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;be.current=t,se(t),de(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(xe.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=YS((e,t)=>{AC(T.current,e,t)},[]),Be=YS((e,t)=>{AC(E.current,e,t)},[]),Ve=YS(e=>{x.current=e},[]),He=YS(e=>jC(e,E.current,T.current),[]),Ue=n!=null||r!=null||i!=null,{resolveIcon:We}=JS(()=>Gh(a),[a]),Ge=t[Sb](),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=JS(()=>et==null?null:new Set(et.draggedPaths),[et]),nt=et?.target??null,rt=et?.primaryPath??null,it=IC(o),{overlayHeight:at,overlayRows:ot,snapshot:st,visibleRows:ct}=Ae,lt=st.physical.viewportHeight,ut=JS(()=>({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=JS(()=>new Set(ft.map(e=>iC(e.row))),[ft]),gt=Ze>=0&&Ze>=ut.start&&Ze<=ut.end,_t=YS((e,t)=>u?.({item:FC(e,t),row:e})??null,[u]),vt=YS(e=>hS(e==null?null:T.current.get(e)??null)?!0:hS(S.current),[]),yt=YS(e=>{vt(t.focusNearestPath(e))},[t,vt]),bt=qS(yt);bt.current=yt;let xt=qS(!0),St=qS(()=>{}),Ct=YS((t=!0)=>{let n=he.current;n!=null&&(xt.current=xt.current&&t,me(null),e?.contextMenu?.onClose?.(),xt.current&&yt(n.path))},[e?.contextMenu,yt]);St.current=Ct;let wt=YS(e=>{let t=e==null?null:kC(S.current,e);le(e=>e===t?e:t)},[]),Tt=YS((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;Ce(n,e?.scrollTop??null),M.current=!0,ae(e=>e===n?e:n)}i.focus(),wt(a),xt.current=!0,me({anchorRect:r?.anchorRect??null,item:FC(e,n),path:n,source:r?.source??`keyboard`})},[t,He,wt]),Et=YS(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=_S(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`),ne(e=>e+1))}},[t,Ze,s,l,lt]),Dt=YS((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=_S(i,lt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:sC({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,SS(i,a,s,l,u,d),D.current(),ge.current=n?e:null,!0},[t,s,c,lt,h]),Ot=()=>y.current===!0||q.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,q.current!=null&&(clearTimeout(q.current),q.current=null),W.current=!1,G.current=null,ee.current=null,K.current!=null&&(K.current.setAttribute(`draggable`,`true`),K.current.style.removeProperty(`touch-action`),K.current=null),Mt(),jt(),Nt(),H.current=null},It=(e,n)=>{let r=S.current?.getRootNode(),i=pC(dC(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=yC(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=gC(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),hC())){let t=mC(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(q.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ee.current={clientX:i.clientX,clientY:i.clientY},K.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;q.current!=null&&(clearTimeout(q.current),q.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`),K.current===a&&(K.current=null),ee.current=null)},s=e=>{let t=e.touches[0],n=ee.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,q.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),ee.current=null;return}W.current=!0,K.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=mC(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)},cC)},Ut=e=>{if(J!=null){if(e.key===`Escape`){Ct(),e.preventDefault(),e.stopPropagation();return}TC.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`),ne(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=_S(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`),ne(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&xC(e)){t.openSearch(e.key),ne(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Pe&&CC(e),r=wC(e,Pe),i=r&&S.current!=null?gS(S.current):null,a=r?new Set(MC(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;Ce(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=yC(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=jC(u,E.current,T.current);e==null||n==null?y=!1:Tt(e,u)}else if((e.ctrlKey||e.metaKey)&&bC(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))Ce(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)?(we(b,PC(S.current,v,i,u,s,mt,lt)),M.current=!0,ae(e=>e===b?e:b)):Se()}ne(e=>e+1),e.preventDefault(),e.stopPropagation()};KS(()=>{if(f&&Je){if(Te.current){Te.current=!1;return}hS(w.current)}},[Je,f]),KS(()=>{let e=x.current;switch(wS({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&&(ge.current=null,P.current=Ke,hS(e),e.select());return}},[ut.end,ut.start,Ke,Dt,ht]),KS(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=gS(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,gS(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)}},[]),KS(()=>{let e=S.current;e!=null&&(st.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[st.physical.scrollTop]),KS(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=_S(n,g);let a=()=>{let e=t.getVisibleCount(),r=vS(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),je(sC({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=vS(O.current,g),i=t.getVisibleRows(e,e)[0]??null;bS(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(()=>{dS(re)&&ne(e=>e+1),a()}),l=()=>{xe.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&&xe.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),he.current!=null&&y.current&&St.current(),xe.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:yS(e[0]))??_S(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]),KS(()=>{Pe||J==null||Ct(!1)},[Ct,Pe,J]);let Wt=JS(()=>J==null?null:`${J.path}::${J.source}`,[J]);KS(()=>{if(Wt==null){m?.clearSlotContent(Lh);return}let t=he.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??DC(n.getBoundingClientRect()),close:e=>{St.current(e?.restoreFocus??!0)},restoreFocus:()=>{xt.current&&bt.current(he.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(Lh,i),e?.contextMenu?.onOpen?.(t.item,r),BC(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&BC(i)}),()=>{m?.clearSlotContent(Lh)}},[Wt,e?.contextMenu,m]),KS(()=>{J!=null&&t.getItem(J.path)==null&&Ct()},[Ct,J,t]),KS(()=>{if(J==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(EC(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,J]),KS(()=>{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=gS(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=ge.current,p=_e.current,m=ve.current,g=ye.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=xS(e,n,s,lt,pt,Qe.offset,t)}t.clearScrollRequest(Qe.id)}let A=!E&&l&&SS(e,Ze,s,lt,pt,u),j=!E&&d!=null&&d===Xe&&SS(e,Ze,s,lt,pt,mt),P=!E&&m!=null&&m.path===Xe&&SS(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&&bS(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&&(SS(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)&&(hS(r),d===Xe&&(ge.current=null),p===Xe&&(_e.current=null),m?.path===Xe&&(ve.current=null),g?.path===Xe&&(ye.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=>iC(e.row)===Xe),qt=Gt||Kt,Jt=Ie&&M.current===!0&&qt?Xe:null,Yt=ue===`pointer`?oe:null,Xt=J?.path??be.current??Yt??Jt??oe,Zt=J?.source===`right-click`;KS(()=>{y.current&&J==null||wt(He(Xt))},[J,He,ut,lt,fe,dt,Xt,wt,ct]);let Qt=YS(e=>{if(y.current||EC(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=YS(()=>{se(null)},[]);KS(()=>{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=pC(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:CS(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:CS(pn.index,s,ut,rn),hn=SC((Ze>=0?ct[Ze]??t.getVisibleRows(Ze,Ze)[0]??null:null)?.ancestorPaths.at(-1)??null),gn=Je&&Xe!=null?LC(o,Xe,!gt):void 0,_n=J?.path??(Je?Xe:ie),vn=J?.path??oe,yn=He(Xt),bn=Pe&&Ie&&!Zt&&!qe&&yn!=null&&ce!=null&&Xt!=null,xn=Pe&&(bn||J!=null),Sn=J?.anchorRect,Cn=Sn==null&&yn!=null&&ce!=null&&(J!=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=YS((e,n,r,i)=>{let a=DS({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||!Ie||Xt==null||yn==null)return;let e=t.getItem(Xt);e!=null&&(wt(yn),xt.current=!0,me({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:Ie,contextMenuButtonVisibility:Le,contextMenuEnabled:Pe,contextMenuRightClickEnabled:Re,contextMenuTriggerMode:Fe,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:$e,draggedPathSet:tt,dragTarget:nt,gitLaneActive:Ue,gitStatusByPath:n,handleRowDragEnd:Vt,handleRowDragStart:Bt,handleRowTouchStart:Ht,ignoredGitDirectories:r,ignoredInheritanceCache:te,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 Ax(`div`,{ref:S,id:it,"data-file-tree-context-menu-button-visibility":Pe&&Ie?Le:void 0,"data-file-tree-context-menu-trigger-mode":Pe?Fe:void 0,"data-file-tree-has-context-menu-action-lane":Pe&&Ie?`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:Pe?$t:void 0,onPointerOver:Pe?Qt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Ax(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:hn}}),Ax(`slot`,{name:Ih,"data-type":`header-slot`}),f?Ax(`div`,{"data-file-tree-search-container":!0,"data-open":Je?`true`:`false`,children:Ax(`input`,{ref:w,"aria-activedescendant":gn,"aria-controls":it,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ee?`true`:void 0,value:Ye,onBlur:()=>{(d!==`retain`||Oe.current)&&t.closeSearch()},onFocus:ke,onPointerDown:ke,onInput:e=>{ke();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Ax(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Me&&dt.length>0?Ax(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Ax(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${at}px`},children:dt.map((e,t)=>HC(kn,e.row,`sticky:${iC(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${dt.length-t}`}}))})}):null,Ax(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${pt}px`},children:[Ax(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${an}px`}}),Ax(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${rn}px`,top:`${on}px`,bottom:`${sn}px`},children:[UC(On,ut,ht),ln!=null&&un!=null?HC(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?HC(On,pn,`parked-drag:${pn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${mn}px`}}):null]})]})]}),Pe?Ax(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":xn?`true`:`false`,style:wn,children:[Ax(`button`,{ref:v,type:`button`,"data-type":Rh,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":J==null?`false`:`true`,"data-visible":bn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),J!=null){Ct();return}Dn()},tabIndex:-1,style:Tn,children:Ax(Px,{...We(`file-tree-icon-ellipsis`)})}),J==null?null:Ax(`slot`,{name:Lh})]}):null,J==null?null:Ax(`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 GC={hydrateRoot:(e,t)=>{Ox(ix(WC,t),e)},renderRoot:(e,t)=>{Dx(ix(WC,t),e)},unmountRoot:e=>{Dx(null,e)}};function KC(e,t){GC.renderRoot(e,t)}function qC(e,t){GC.hydrateRoot(e,t)}function JC(e){GC.unmountRoot(e)}var YC=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 XC=0;function ZC(e){return e!=null&&e.length>0?e:(XC+=1,`pst_ft_${XC}`)}function QC({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??jy)}function $C(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 ew(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 tw(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var nw=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new YC;#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=ZC(a),this.#p=Nb(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=Ay(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new Ob({...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&&(JC(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=Pb(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&KC(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(),KC(t.wrapper,this.#w()))}setGitStatus(e){let t=Nb(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&KC(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),KC(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),qC(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),KC(r,this.#w())}#C(){return{initialViewportHeight:QC({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(Ih,e());return}this.#l.setSlotHtml(Ih,this.#e?.header?.html??null)}#k(e){let t=tw(e).find(e=>ew(e)),n=$C(Eh(Bh(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=tw(e),n=t.find(e=>ew(e)),r=t.filter(e=>e!==n),i=Bh(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=$C(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=Bh(this.#m);t.colored&&Oh(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${Mh}]`);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(Mh,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Fy(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 Vy(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)}},rw=e=>e.split(`/`).at(-1)??e,iw={code:`porcelain-file-code`,text:`porcelain-file-text`,symlink:`porcelain-symlink`,submodule:`porcelain-submodule`},aw=[`md`,`mdx`,`txt`],ow=`viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"`,sw=`<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" /><path d="M14 2v5a1 1 0 0 0 1 1h5" />`,cw=`<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
|
|
1268
|
-
<symbol id="${iw.code}" ${ow}>
|
|
1269
|
-
${sw}
|
|
1270
|
-
<path d="M10 12.5 8 15l2 2.5" />
|
|
1271
|
-
<path d="m14 12.5 2 2.5-2 2.5" />
|
|
1272
|
-
</symbol>
|
|
1273
|
-
<symbol id="${iw.text}" ${ow}>
|
|
1274
|
-
${sw}
|
|
1275
|
-
<path d="M10 9H8" />
|
|
1276
|
-
<path d="M16 13H8" />
|
|
1277
|
-
<path d="M16 17H8" />
|
|
1278
|
-
</symbol>
|
|
1279
|
-
<symbol id="${iw.symlink}" ${ow}>
|
|
1280
|
-
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
|
|
1281
|
-
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
|
|
1282
|
-
</symbol>
|
|
1283
|
-
<symbol id="${iw.submodule}" ${ow}>
|
|
1284
|
-
<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" />
|
|
1285
|
-
<circle cx="12" cy="13" r="2" />
|
|
1286
|
-
<path d="M14 13h3" />
|
|
1287
|
-
<path d="M7 13h3" />
|
|
1288
|
-
</symbol>
|
|
1289
|
-
</svg>`;function lw(e=[]){return{set:`minimal`,colored:!1,spriteSheet:cw,remap:{"file-tree-icon-file":iw.code},byFileExtension:Object.fromEntries(aw.map(e=>[e,iw.text])),byFileName:Object.fromEntries(e.flatMap(e=>{let t=e.kind===`symlink`?iw.symlink:e.kind===`submodule`?iw.submodule:null;return t?[[rw(e.path),t]]:[]}))}}var uw=Gh(lw()),dw=`${Eh(`minimal`)}${cw}`;function fw(){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:dw}}),e[0]=t):t=e[0],t}function pw(e){let t=(0,$.c)(11),{path:n,expanded:r,className:i}=e,a;t[0]===n?a=t[1]:(a=uw.resolveIcon(n===void 0?`file-tree-icon-chevron`:`file-tree-icon-file`,n),t[0]=n,t[1]=a);let o=a,s=o.width??16,c=o.height??16,l=o.viewBox??`0 0 ${s} ${c}`,u=r===!1&&`-rotate-90`,d;t[2]!==i||t[3]!==u?(d=X(`pierre-file-icon`,u,i),t[2]=i,t[3]=u,t[4]=d):d=t[4];let f=`#${o.name}`,p;t[5]===f?p=t[6]:(p=(0,Q.jsx)(`use`,{href:f}),t[5]=f,t[6]=p);let m;return t[7]!==l||t[8]!==d||t[9]!==p?(m=(0,Q.jsx)(`svg`,{"aria-hidden":`true`,viewBox:l,className:d,children:p}),t[7]=l,t[8]=d,t[9]=p,t[10]=m):m=t[10],m}var mw=e=>`data:${e.mediaType};base64,${e.base64}`;function hw(e,t,n){let r=(0,$.c)(4),i;return r[0]!==e||r[1]!==n||r[2]!==t?(i=Wo({scope:t,connection:e,path:n}),r[0]=e,r[1]=n,r[2]=t,r[3]=i):i=r[3],Rr(i)}function gw(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=Vi({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],Rr(o)}var _w=e=>/\.(png|jpe?g|gif|webp|avif|svg|ico)$/i.test(e);function vw(e){let t=(0,$.c)(3),{scope:n,path:r,connection:i}=e,a=hw(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)(yw,{query:a,path:r})}),t[0]=r,t[1]=a,t[2]=o):o=t[2],o}function yw(e){let t=(0,$.c)(10),{query:n,path:r}=e;if(qi(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(f(n)){let e;t[1]===n.cause?e=t[2]:(e=Lc(ht(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=mw(Gt(Te(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 bw(e){let t=(0,Z.useRef)(e);return(0,Z.useInsertionEffect)(()=>void(t.current=e)),(0,Z.useCallback)((...e)=>t.current(...e),[])}var xw=(0,Z.createContext)(void 0);function Sw(){return(0,Z.useContext)(xw)}var Cw={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},ww={display:`contents`};function Tw(){return null}function Ew({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function Dw(e,t){return e-(t===0?0:1)}function Ow(e,t){return Dw(e,t)+t}function kw(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:Aw(n,e.startContentIndex)}}function Aw(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 jw({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=Ps}){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:Kc,children:p}),o!=null&&l?.map((t,n)=>(0,Q.jsx)(`div`,{slot:f(t),children:o(t,e)},n)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=Mw(t,e);return(0,Q.jsx)(`div`,{slot:n,style:ww,children:c(t,d)},n)}),s!=null&&(0,Q.jsx)(`div`,{slot:`gutter-utility-slot`,style:Cw,children:s(u)})]})}function Mw(e,t){let n=kw(e,t);return n==null?void 0:Ew({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function Nw({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c,getAnnotationSlotName:l=Ps}){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:Kc,children:u}),a!=null&&o?.map((t,n)=>(0,Q.jsx)(`div`,{slot:l(t),children:a(t,e)},n)),s!=null&&(0,Q.jsx)(`div`,{slot:`gutter-utility-slot`,style:Cw,children:s(c)})]})}function Pw(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function Fw(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Iw(e,t){return wc(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Lw(e){let t=e.lang??Rl(e.name),n=e.lang??(e.prevName==null?`text`:Rl(e.prevName));return t===`text`&&n===`text`}function Rw(e){return[Dw(e.additionStart,e.additionCount)+1,Ow(e.additionStart,e.additionCount)+1]}function zw({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 Bw(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-Ow(t.additionStart,t.additionCount),r=e.deletionLines.length-Ow(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function Vw({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-Ow(n.additionStart,n.additionCount),i=e.deletionLines.length-Ow(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 Hw({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=Vw({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 Uw({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]=Rw(a);if(t<o){let s=zw({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=Hw({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]=Rw(a);return t<o+i.fromStart||t>=o+i.rangeSize}function Ww({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]=Rw(n),l=zw({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=Hw({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 Gw({type:e,metrics:t}){return t.hunkSeparatorHeight??Pl(e)}function Kw({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function qw({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 Jw(e){return e!==`simple`&&e!==`metadata`}function Yw({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!qw({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=Gw({type:e,metrics:t}),a=Kw({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function Xw({type:e,metrics:t}){if(!Jw(e))return;let n=Gw({type:e,metrics:t}),r=Kw({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function Zw({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=Qw({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=Dw(r.deletionStart,r.deletionCount),s=Dw(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=zw({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?Hw({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(tT(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,tT(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(tT(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=nT(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(rT({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(tT(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 Qw({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=$w({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 $w({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=zw({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?Hw({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 eT(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 tT(e,t,n,r,i,a){let[o,s]=eT(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 nT(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 rT({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 iT(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var aT=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}},oT=new class extends aT{};function sT(e,t,n){return oT.diff(e,t,n)}function cT(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 lT(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 uT(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 dT(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 fT(e,t){return uT(e,t,``)}function pT(e,t){return dT(e,t,``)}function mT(e,t){return t.slice(0,hT(e,t))}function hT(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 gT(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 _T(e,t){if(t)return yT(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function vT(e,t){if(t)return yT(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function yT(e,t){if(!t)return[vT(e),_T(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=gT(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var bT=`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}`,xT=RegExp(`[${bT}]+|\\s+|[^${bT}]`,`ug`);new class extends aT{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=gT(e,r)}else n=e.match(xT)||[];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)&&ST(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&ST(n,i,r,null,t.intlSegmenter),e}};function ST(e,t,n,r,i){if(t&&n){let[a,o]=yT(t.value,i),[s,c]=yT(n.value,i);if(e){let r=cT(a,s);e.value=dT(e.value,s,r),t.value=fT(t.value,r),n.value=fT(n.value,r)}if(r){let e=lT(o,c);r.value=uT(r.value,c,e),t.value=pT(t.value,e),n.value=pT(n.value,e)}}else if(n){if(e){let e=vT(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=vT(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=vT(r.value,i),[a,o]=yT(t.value,i),s=cT(n,a);t.value=fT(t.value,s);let c=lT(fT(n,s),o);t.value=pT(t.value,c),r.value=uT(r.value,n,c),e.value=dT(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=vT(r.value,i),n=mT(_T(t.value,i),e);t.value=pT(t.value,n)}else if(e){let n=mT(_T(e.value,i),vT(t.value,i));t.value=fT(t.value,n)}}var CT=new class extends aT{tokenize(e){let t=RegExp(`(\\r?\\n)|[${bT}]+|[^\\S\\n\\r]+|[^${bT}]`,`ug`);return e.match(t)||[]}};function wT(e,t,n){return CT.diff(e,t,n)}var TT=new class extends aT{constructor(){super(...arguments),this.tokenize=DT}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
1290
|
-
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
1291
|
-
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
1292
|
-
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
1293
|
-
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function ET(e,t,n){return TT.diff(e,t,n)}function DT(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
1294
|
-
`));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 OT(e){return e==`.`||e==`!`||e==`?`}new class extends aT{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(OT(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 aT{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends aT{constructor(){super(...arguments),this.tokenize=DT}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(kT(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 kT(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]=kT(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]=kT(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends aT{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function AT(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function jT(e){if(!AT(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 MT={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function NT(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;ET(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(ET(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||IT(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(`
|
|
1295
|
-
`)?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 PT(e,t){if(t||=MT,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=>PT(e,t)).join(`
|
|
1296
|
-
`)}let n=[];if(e.isGit){if(t=MT,!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 `+jT(r)+` `+jT(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 `+jT((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+jT((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+jT((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+jT((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(`--- `+jT(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+jT(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(`
|
|
1297
|
-
`)+`
|
|
1298
|
-
`}function FT(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;NT(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?PT(e,o.headerOptions):void 0)}}))}else{let s=NT(e,t,n,r,i,a,o);return s?PT(s,o?.headerOptions):void 0}}function IT(e){let t=e.endsWith(`
|
|
1299
|
-
`),n=e.split(`
|
|
1300
|
-
`).map(e=>e+`
|
|
1301
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function LT({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 RT({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 zT={forcePlainText:!1};function BT(e,t,n,{forcePlainText:r,lazyLineAST:i=!1,startingLine:a,totalLines:o,expandedHunks:s,collapsedContextThreshold:c=1}=zT){r?(a??=0,o??=1/0):(a=0,o=1/0);let l=a>0||o<1/0;i&&=!r&&!n.useTokenTransformer;let u=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,d=jl({theme:n.theme,highlighter:t}),f=r&&!l&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,p={deletionLines:[],additionLines:[]},{maxLineDiffLength:m}=n,h=!r&&!e.isPartial,g=r?s:void 0,_=new Map;function v(e){let t=h?0:e,n=_.get(t)??UT();return _.set(t,n),n}function y(e,t,n,r){if(l){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)}Zw({diff:e,diffStyle:`both`,startingLine:a,totalLines:o,expandedHunks:!l||g,collapsedContextThreshold:c,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=v(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&HT({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:f,maxLineDiffLength:m}),r!=null&&(y(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&&(y(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 a of _.values()){if(a.deletionContent.length===0&&a.additionContent.length===0)continue;let o={name:e.prevName??e.name,contents:a.deletionContent.value},s={name:e.name,contents:a.additionContent.value},{deletionLines:c,additionLines:l}=WT({deletionFile:o,deletionInfo:a.deletionInfo,deletionDecorations:a.deletionDecorations,additionFile:s,additionInfo:a.additionInfo,additionDecorations:a.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang,lazyLineAST:i});if(h){p.deletionLines=c,p.additionLines=l;continue}for(let[e,t,n]of[[p.deletionLines,c,a.deletionSegments],[p.additionLines,l,a.additionSegments]])if(n.length>0)for(let r of n)for(let n=0;n<r.count;n++)e[r.targetIndex+n]=t[r.originalOffset+n];else if(i){let n=e.length;for(let r=0;r<t.length;r++)qu(e,n+r,()=>t[r])}else Xu(e,t)}return{code:p,themeStyles:d,baseThemeType:u}}function VT(e,{deletionLineIndex:t,additionLineIndex:n,deletionDecorations:r,additionDecorations:i}){let a=0,o=0,s=-1,c=0,l=-1,u=0;for(let{value:t,added:n,removed:r}of e)r?(s===-1&&(s=a),a+=t.length,c=a):n?(l===-1&&(l=o),o+=t.length,u=o):(a+=t.length,o+=t.length);s!==-1&&r.push(LT({line:t,spanStart:s,spanLength:c-s})),l!==-1&&i.push(LT({line:n,spanStart:l,spanLength:u-l}))}function HT({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=iT(e),t=iT(t),e.length>s||t.length>s))return;let c=o===`char`?sT(e,t):wT(e,t);if(o===`word-line`){VT(c,{deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a});return}let l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(RT({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),RT({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?RT({item:e,arr:l,enableJoin:d,isLastItem:t}):RT({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(LT({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(LT({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function UT(){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 WT({lazyLineAST:e,deletionFile:t,additionFile:n,deletionInfo:r,additionInfo:i,highlighter:a,deletionDecorations:o,additionDecorations:s,languageOverride:c,options:{theme:l,useTokenTransformer:u,tokenizeMaxLineLength:d}}){let f=(t,n,r)=>t.contents===``?[]:Gu(a.codeToTokens(iT(t.contents),Xl(c??Rl(t.name),l,d)).tokens,{state:{lineInfo:n},useTokenTransformer:u,decorations:r,lazyLineAST:e,cacheHtmlStyles:a.name===`highlights`});return{deletionLines:f(t,r,o),additionLines:f(n,i,s)}}function GT(e){let t=[];for(let n of e){let e=Qu.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function KT(e){for(let t of Array.isArray(e)?e:[e])if(!Qu.has(t))return!1;return!0}function qT(e,t=Zu()){return Vu(t).getResolvedThemes(e)}function JT(e,t=Zu()){return Vu(t).hasResolvedThemes(e)}function YT(e,t=Zu()){return Vu(t).resolveThemes(e)}var XT=0,ZT=1,QT=2,$T=4,eE=5,tE=6,nE=[void 0,null,!0,!1];function rE(e){if(Array.isArray(e))return e;let{ops:t,offsets:n,strings:r,text:i,extras:a}=e,o=Array(n.length/2),s=0,c=0;function l(e){let n=Array(e);for(let o=0;o<e;o++){let e=t[s++];if(e!==XT){if(e===ZT){let e=c+t[s++];n[o]={type:`text`,value:i.slice(c,e)},c=e}else if(e===QT){let e=r[t[s++]],i={};for(let e=t[s++];e>0;e--){let e=r[t[s++]],n=t[s++],o=n===$T?r[t[s++]]:n===eE?t[s++]:n===tE?a[t[s++]]:nE[n];e===`__proto__`?Object.defineProperty(i,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[e]=o}n[o]={type:`element`,tagName:e,properties:i,children:l(t[s++])}}else n[o]=a[t[s++]]}}return n}for(let e=0;e<o.length;e++)t[n[e*2]]!==XT&&qu(o,e,()=>(s=n[e*2],c=n[e*2+1],l(1)[0]));return o}var iE=e(eu(),1),aE=Symbol(`IGNORE_RESPONSE`),oE=1e4,sE=class{options;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;terminated=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=Yc,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s}){this.options=e,this.preferredHighlighter=Zu(s),this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new iE.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new iE.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed&&!this.terminated}shouldHighlightOnMainThread(e){let{mainThreadMaxCharacters:t=-1}=this.options;return(`contents`in e?e.contents.length:e.deletionCharacterCount+e.additionCharacterCount)<=t}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)}setFileResultCache(e,{result:t,options:n}){return e==null||!fc(n,this.getFileRenderOptions())?!1:(this.fileCache.set(e,{result:t,options:n}),this.queueBroadcastStateChanges(),!0)}setDiffResultCache(e,{result:t,options:n}){return e==null||!Iw(n,this.getDiffRenderOptions())?!1:(this.diffCache.set(e,{result:t,options:n}),this.queueBroadcastStateChanges(),!0)}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??Yc,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())try{await this.initialize()}catch(e){if(!this.workersFailed)throw e}if(!s()||Iw(a,this.renderOptions))return;let o=Ru(e),c=[];if(wc(a.theme,this.renderOptions.theme)||(c=JT(o,this.preferredHighlighter)?qT(o,this.preferredHighlighter):await YT(o,this.preferredHighlighter)),!s()||Gs({theme:e})==null&&(await this.loadSharedHighlighter(o,[`text`]),!s()))return;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 Kl||!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);uE(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){Gs({theme:this.renderOptions.theme})??await this.loadSharedHighlighter(Ru(this.renderOptions.theme),[`text`,...e]);return}if(this.initialized===!1){this.terminated=!1;let{lifecycleGeneration:t}=this,n=new Promise((n,r)=>{(async()=>{try{let r=Ru(this.renderOptions.theme),i=JT(r,this.preferredHighlighter)?qT(r,this.preferredHighlighter):await YT(r,this.preferredHighlighter);if(!this.isCurrentLifecycle(t)){n();return}let a=[];if(this.preferredHighlighter!==`highlights`&&(a=KT(e)?GT(e):await ed(e)),!this.isCurrentLifecycle(t)){n();return}if(await Promise.all([this.loadSharedHighlighter(r,[`text`,...e]),this.initializeWorkers(i,a)]),!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.initialized=!0,this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof Kl||!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,fE(e));this.queueBroadcastStateChanges(),r(e)}})()});return this.initialized=n,this.queueBroadcastStateChanges(),n}return this.initialized}async loadSharedHighlighter(e,t){try{await ec({themes:e,langs:t,preferredHighlighter:this.preferredHighlighter})}catch(e){if(!(e instanceof Wu))throw e}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=js(),i=r>0?Hl():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`,resultFormat:`hast-ops-v1`,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??oE,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){let{onWorkerError:n}=this.options;if(n!=null)try{n(t,e.worker)}catch(e){console.error(`WorkerPoolManager: onWorkerError threw:`,e)}else console.error(`Worker error:`,t,e);let{pendingSetupRequestId:r}=e;if(r==null)return;let i=this.activeTaskById.get(r);if(i?.type!==`initialize`)return;let a=pE(t);n!=null&&wl(a),i.reject(a),this.cleanWorkerAndTask(e,i)}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=lE(t.request),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);bc(t)||n!=null&&fc(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`));if(!this.shouldPrimeFileHighlightCache(e))return Promise.resolve();if(this.shouldHighlightOnMainThread(e)){let t=this.getFileRenderOptions();return this.primeHighlightCacheOnMainThread(lE({type:`file`,file:e}),t.theme,n=>this.setFileResultCache(e.cacheKey,{result:cu(e,n,t),options:t}))}let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}shouldPrimeFileHighlightCache(e){if(e.cacheKey==null)return console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`),!1;let t=this.getFileResultCache(e);return!bc(e)&&(t==null||!fc(t.options,this.getFileRenderOptions()))}getOrCreateFileHighlightCacheTask(e){let t=this.getFileHighlightKey(e);if(t==null)return;let n=this.getTaskByHighlightKey(t);if(n!=null){if(n.type!==`file`)throw Error(`WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task type`);return n.primeCache=!0,n}{let n=this.submitCacheTask({type:`file`,file:e},t);if(n.type!==`file`)throw Error(`WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task created`);return n}}getPlainFileAST(e,t,n,r){let i=Gs({theme:this.renderOptions.theme});if(i==null){this.queueInitialization();return}return cu(e,i,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);Lw(t)||n!=null&&Iw(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`));if(!this.shouldPrimeDiffHighlightCache(e))return Promise.resolve();if(this.shouldHighlightOnMainThread(e)){let t=this.getDiffRenderOptions();return this.primeHighlightCacheOnMainThread(lE({type:`diff`,diff:e}),t.theme,n=>this.setDiffResultCache(e.cacheKey,{result:BT(e,n,t),options:t}))}let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}shouldPrimeDiffHighlightCache(e){if(e.cacheKey==null)return console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`),!1;let t=this.getDiffResultCache(e);return!Lw(e)&&(t==null||!Iw(t.options,this.getDiffRenderOptions()))}primeHighlightCacheOnMainThread(e,t,n){function r(){let r=Gs({theme:t,langs:e});return r!=null&&n(r)}if(r())return Promise.resolve();let{lifecycleGeneration:i}=this;return this.loadSharedHighlighter(Ru(t),[`text`,...e]).then(()=>{if(!this.isCurrentLifecycle(i))throw new Kl;if(!r())throw new pl})}getOrCreateDiffHighlightCacheTask(e){let t=this.getDiffHighlightKey(e);if(t==null)return;let n=this.getTaskByHighlightKey(t);if(n!=null){if(n.type!==`diff`)throw Error(`WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task type`);return n.primeCache=!0,n}{let n=this.submitCacheTask({type:`diff`,diff:e},t);if(n.type!==`diff`)throw Error(`WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task created`);return n}}getPlainDiffAST(e,t,n,r,i){let a=Gs({theme:this.renderOptions.theme});if(a==null){this.queueInitialization();return}return BT(e,a,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new Kl;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.initialized=!1,this.workersFailed=!1,this.terminated=!0,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{_l(e)||console.error(e)})}cancelActiveWorkerTasks(){let e=new Kl;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):uE(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=Gs(),i=n.filter(e=>r==null||!gc(e,r));i.length>0&&this.loadSharedHighlighter(Ru(this.renderOptions.theme),[`text`,...i]).catch(e=>{console.error(e)});let a=this.preferredHighlighter===`highlights`?[]:n.filter(t=>!e.langs.has(t));if(a.length>0&&(KT(a)?t.request.resolvedLanguages=GT(a):t.request.resolvedLanguages=await ed(a)),!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,fE(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 aE;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(uE(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}if(uE(n))for(let{name:t}of n.request.resolvedLanguages??[])e.langs.add(t);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{options:r}=t;if(!this.isCurrentRenderTask(n)||!fc(r,this.getFileRenderOptions()))throw aE;let{request:i}=n,a={...t.result,code:rE(t.result.code)};this.syncCustomExtensionVersion(e,i),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:a,options:r}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,a,r);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{options:r}=t;if(!this.isCurrentRenderTask(n)||!Iw(r,this.getDiffRenderOptions()))throw aE;let{request:i}=n,a={...t.result,code:{deletionLines:rE(t.result.code.deletionLines),additionLines:rE(t.result.code.additionLines)}};this.syncCustomExtensionVersion(e,i),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:a,options:r}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,a,r);break}}}catch(e){e!==aE&&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,uE(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&&(uE(t)&&(this.rejectRenderTaskCallbacks(t,new pl),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){cE(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);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),uE(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,fE(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=js();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=Hl())}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 dE(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 pl),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new pl),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()))uE(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of dE(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 dE(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of dE(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 dE(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)&&Fw(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)&&Pw(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())uE(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function cE(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function lE(e){let t=new Set;switch(e.type){case`file`:t.add(e.file.lang??Rl(e.file.name));break;case`diff`:t.add(e.diff.lang??Rl(e.diff.name)),t.add(e.diff.lang??Rl(e.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function uE(e){return e?.type===`file`||e?.type===`diff`}function dE(e){return e.instances}function fE(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))}function pE(e){let t=`error`in e?e.error:void 0,n=`message`in e&&typeof e.message==`string`&&e.message!==``?e.message:t instanceof Error?t.message:`the worker script failed to load (the error event carries no message)`;return new wu(`WorkerPoolManager: worker failed: ${n}`,t instanceof Error?{cause:t}:void 0)}var mE;function hE({poolOptions:e,highlighterOptions:t}){return mE??=new sE(e,t),mE}function gE(){mE!=null&&(mE.terminate(),mE=void 0)}var _E=(0,Z.createContext)(void 0),vE=0;function yE({children:e,poolOptions:t,highlighterOptions:n}){let[r]=(0,Z.useState)(()=>{if(!(typeof window>`u`))return hE({poolOptions:t,highlighterOptions:n})});return(0,Z.useInsertionEffect)(()=>{if(r!=null)return vE++,()=>{vE--}},[r]),(0,Z.useEffect)(()=>()=>{vE===0&&gE()},[]),(0,Q.jsx)(_E.Provider,{value:r,children:e})}function bE(e){if(e.type===`diff`){let{instance:t,item:n}=e;return t.__getNextRenderData({fileDiff:t.fileDiff??n.fileDiff,lineAnnotations:void 0})}let{instance:t,item:n}=e;return t.__getNextRenderData({file:t.file??n.file,lineAnnotations:void 0})}function xE(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:SE(e.items,t.items)}function SE(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 CE(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(Qs,``),t.before(r)):(r.setAttribute(Uc,``),t.after(r)),n?.observe(r),r}function wE(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function TE(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}async function EE(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function DE({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=iu(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=zw({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=Yw({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=OE(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?Hw({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=Xw({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=Xw({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=_u(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function OE(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 kE(e,t)}function kE(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 AE({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 jE=1;function ME(e,...t){return`ck${jE}:${JSON.stringify([e,...t])}`}function NE(e){return e===``?[]:e.split(ql)}function PE(e,t,n){let r=e===`clone`?Il(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return FE(r,LE(r,n),RE(r,n));case`rename-pure`:{let e=RE(r,n);zE(r,n);let t=NE(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,r.deletionCharacterCount=e.contents.length,r.additionCharacterCount=e.contents.length,VE(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function FE(e,t,n){let r=NE(t.contents),i=NE(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=IE(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,e.deletionCharacterCount=t.contents.length,e.additionCharacterCount=n.contents.length,VE(e,t,n),e}function IE(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(Dw(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=Ow(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=Ow(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function LE(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function RE(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function zE(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function BE(e,t,n){return e.cacheKey==null?HE(t,n):`${e.cacheKey}:hydrated`}function VE(e,t,n){let r=BE(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function HE(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?ME(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}var UE=new TextEncoder,WE=new TextDecoder(`utf-8`,{ignoreBOM:!0}),GE=/[\uD800-\uDFFF]/,KE=1024,qE=new Uint8Array(KE);function JE(){qE.length!==KE&&(qE=new Uint8Array(KE))}function YE(e){if(e.length===0)return e;if(GE.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;qE.length<t&&(qE=new Uint8Array(t));let{written:n}=UE.encodeInto(e,qE);return WE.decode(qE.subarray(0,n))}var XE=new TextDecoder(`utf-8`,{ignoreBOM:!0}),ZE={'"':`"`,"\\":`\\`,a:`\x07`,b:`\b`,t:` `,n:`
|
|
1302
|
-
`,v:`\v`,f:`\f`,r:`\r`};function QE(e){if(e[0]!==`"`)return;let t=``,n=1;for(;n<e.length;){let r=e[n];if(r===`"`)return{fileName:t,rawLength:n+1};if(r!==`\\`){t+=r,n++;continue}let i=ZE[e[n+1]];if(i!=null){t+=i,n+=2;continue}let a=[];do{let t=$E(e,n+1);if(t==null)return;a.push(t),n+=4}while(e[n]===`\\`&&e[n+1]>=`0`&&e[n+1]<=`7`);t+=XE.decode(new Uint8Array(a))}}function $E(e,t){let n=e.charCodeAt(t)-48,r=e.charCodeAt(t+1)-48,i=e.charCodeAt(t+2)-48;if(n>=0&&n<=3&&r>=0&&r<=7&&i>=0&&i<=7)return n*64+r*8+i}var eD=4096,tD=.5;function nD(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=iD(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}}function rD(e,t,n){let{hunkContent:r}=e;for(let e=1;e<r.length;e++){let i=r[e],a=r[e-1];if(i.type!==`change`||i.additions>0&&i.deletions>0||a.type!==`context`)continue;let o=i.additions>0,s=o?t.additionLines:t.deletionLines,c=o?i.additionLineIndex:i.deletionLineIndex,l=o?i.additions:i.deletions,u=s[c]??``;if(u.trim()!==``)continue;let d=!0;for(let e=1;e<l;e++)if(s[c+e]!==u){d=!1;break}if(!d)continue;let f=0;for(;f<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-f]===u;)f++;if(f===0||e===1&&f===a.lines||n!=null&&(f=n(i,f),f===0))continue;i.additionLineIndex-=f,i.deletionLineIndex-=f;let p=i.additionLineIndex+i.additions,m=i.deletionLineIndex+i.deletions,h=r[e+1];h?.type===`context`?(h.lines+=f,h.additionLineIndex=p,h.deletionLineIndex=m):r.splice(e+1,0,{type:`context`,lines:f,additionLineIndex:p,deletionLineIndex:m}),a.lines-=f,a.lines===0&&(r.splice(e-1,1),e--)}}function iD(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)>eD)return null;let c=[];for(let t=0;t<n;t++)c.push(oD(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(oD(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+=sD(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*tD: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 aD=/\s+/g;function oD(e){return e.replace(aD,``)}function sD(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}var cD=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function lD(e,t,n=!1,r){let i=OD(e),a=i?_D(e):vD(e),o,s=[];for(let e of a){if(i&&!Fl.test(e)){if(o==null)o=YE(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!yD(e)){if(o==null)o=YE(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=dD(e,{cacheKey:t==null?void 0:r==null?ME(`patch-file`,t,String(s.length)):ME(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function uD(e,t){try{return dD(e,t)}finally{JE()}}function dD(e,{cacheKey:t,isGitDiff:n=Fl.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=kD(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=gD(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=TD(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?hD(i.contents):[],deletionLines:!l&&r!=null&&i!=null?hD(r.contents):[],additionCharacterCount:!l&&r!=null&&i!=null?i.contents.length:0,deletionCharacterCount:!l&&r!=null&&i!=null?r.contents.length:0,cacheKey:jD(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(cD);if(t==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}let n=pD(t[1],!0),r=pD(t[2],!0);c.name=YE(r),n!==r&&(c.prevName=YE(n));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(hu):null;if(t!=null){let[,e,r]=t,i=pD(r,n);if(e===`---`&&i!==`/dev/null`){let e=YE(i);c.prevName=e,c.name=e}else e===`+++`&&i!==`/dev/null`&&(c.name=YE(i))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=YE(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=YE(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=YE(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=YE(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(ml)??[];t!=null&&(c.prevObjectId=YE(t)),n!=null&&(c.newObjectId=YE(n)),r!=null&&(c.mode=YE(r))}(e.startsWith(`rename from `)||e.startsWith(`copy from `))&&(c.prevName=YE(pD(e.slice(e.startsWith(`rename`)?12:10)))),(e.startsWith(`rename to `)||e.startsWith(`copy to `))&&(c.name=YE(pD(e.slice(e.startsWith(`rename`)?10:8))))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
1303
|
-
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
1304
|
-
`||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:jD(p.hunkContext),hunkSpecs:YE(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(!CD(t)||wD(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=MD(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=ND(t);(g==null||g.type!==`change`)&&(g=PD(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&(c.additionLines.push(e),c.additionCharacterCount+=e.length),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=ND(t);(g==null||g.type!==`change`)&&(g=PD(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&(c.deletionLines.push(e),c.deletionCharacterCount+=e.length),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=ND(t);(g==null||g.type!==`context`)&&(g=PD(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e),c.deletionCharacterCount+=e.length,c.additionCharacterCount+=e.length),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;if(e>=0){let t=c.additionLines[e],n=iT(t);c.additionLines[e]=n,c.additionCharacterCount+=n.length-t.length}}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;if(e>=0){let t=c.deletionLines[e],n=iT(t);c.deletionLines[e]=n,c.deletionCharacterCount+=n.length-t.length}}}}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=Dw(b.additionStart,b.additionCount)+(x===0?0:1),t=Dw(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(Dw(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=Ow(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=Ow(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),nD(c),c}}function fD(e,t,n=!1){let r=[],i=mD(e)?e.split(Bc):[e];for(let e of i)try{r.push(lD(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{JE()}return r}function pD(e,t=!1){let n=e.trim(),r=n.startsWith(`"`)?QE(n)?.fileName??n:n;return t&&(r.startsWith(`a/`)||r.startsWith(`b/`))?r.slice(2):r}function mD(e){return e.startsWith(`From `)||e.includes(`
|
|
1305
|
-
From `)}function hD(e){let t=gD(e);for(let e=0;e<t.length;e++)t[e]=YE(t[e]);return t}function gD(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
1306
|
-
`,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 _D(e){return kD(e,`diff --git`)}function vD(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=SD(e,r);if(i<=0&&a<=0){if(bD(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=SD(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=TD(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 yD(e){return bD(e,0)}function bD(e,t){let n=SD(e,t);return xD(e,t,`---`)&&xD(e,n,`+++`)}function xD(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===`
|
|
1307
|
-
`||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function SD(e,t){let n=e.indexOf(`
|
|
1308
|
-
`,t);return n===-1?e.length:n+1}function CD(e){let t=e[0];return t===`+`||t===`-`||t===` `}function wD(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
1309
|
-
`&&n!==`\r`)return!1}return!0}function TD(e){if(!e.startsWith(`@@ -`))return;let t=4,n=ED(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=ED(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=ED(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=ED(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=DD(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function ED(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 DD(e){return e.endsWith(`\r
|
|
1310
|
-
`)?e.slice(0,-2):e.endsWith(`
|
|
1311
|
-
`)?e.slice(0,-1):e}function OD(e){return e.startsWith(`diff --git`)||e.includes(`
|
|
1312
|
-
diff --git`)}function kD(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:AD(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=AD(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function AD(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function jD(e){return e==null?e:YE(e)}function MD(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function ND(e){let t=e.slice(1);return YE(t===``?`
|
|
1313
|
-
`:t)}function PD(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 FD=`/dev/null`;function ID(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??LD(),a=t??LD(),o=uD(FT(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?ME(`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 LD(){return{name:FD,contents:``}}var RD=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 zD(e,t){let n=ID({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,additionCharacterCount:n.additionCharacterCount,deletionCharacterCount:n.deletionCharacterCount,type:n.type}}function BD(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 VD(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function HD(e,t){return t.length>0&&t.length<e.deletionLines.length&&VD(t)}function UD(e,t,n,r){let i=e.deletionLines.join(``),a=BD(t.length,i),o=ID({name:e.prevName??e.name,contents:i},{name:e.name,contents:a,lang:e.lang},r);return{hunks:o.hunks,splitLineCount:o.splitLineCount,unifiedLineCount:o.unifiedLineCount,additionLines:t,deletionLines:o.deletionLines,additionCharacterCount:n,deletionCharacterCount:o.deletionCharacterCount,type:o.type}}function WD(e,t){return UD(e,[``],0,t)}function GD(e,t){if(e.additionLines.length===0)return WD(e,t);if(HD(e,e.additionLines))return UD(e,e.additionLines,e.additionCharacterCount,t);let n=e.additionLines,r=zD(e,t);return qD(r,n),r}function KD(e){return e.length>1&&e.at(-1)===``}function qD(e,t){if(!KD(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&&Ow(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,rO(e);return}}}function JD(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return YD(e,zD(e,n));let r=Array.from(t);if(r.length===0)return YD(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||iT(r)===iT(i))return YD(e,zD(e,n))}let i=XD(e,r);if(i.size===0)return YD(e,zD(e,n));for(let t of i)if(!QD(e,t,n))return YD(e,zD(e,n));return rO(e),Bw(e)?YD(e,zD(e,n)):YD(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function YD(e,t){return Object.assign(e,t),t}function XD(e,t){let n=new Set;for(let r of t){let t=ZD(e,r);if(t==null)return new Set;n.add(t)}return n}function ZD(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 QD(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=ID({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:(eO(r,s),$D(e,t),!0)}function $D(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(`
|
|
1314
|
-
`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
|
|
1315
|
-
`)}function eO(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>tO(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,nO(e)}function tO(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function nO(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 rO(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Dw(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,nO(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=Ow(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-Ow(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var iO=new WeakMap;function aO(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function oO(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 sO(e,t,n){let r=e.hunks,i=e.additionLines,a=aO(i),o=a===i?e:{...e,additionLines:a},s=vO(r,gO(o,t,n),e.deletionLines.length),c=xO(o,s);if(e.additionLines=a,e.hunks=c,e.editSessionDirty=!0,jO(e),qD(e,i),wO(r,e.hunks))return{regions:s.map(e=>e.previousSpan)}}function cO(e,t,n,r){let i=new Set(t),a=Array.from(i).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(a.length===0)return;let o=t=>i.has(t)?r?.get(t):e.additionLines[t],{hunks:s}=e,c,l=0;for(let t of a){for(;l<s.length;){let e=s[l];if(t<DO(e)+e.additionCount)break;l++}let r=s[l],i=r==null?void 0:DO(r);if(i==null||t<i||c!=null&&c!==l)return sO(e,n,o);c=l}if(c!=null){if(lO(e,a,c,r,n)){e.editSessionDirty=!0;return}return sO(e,n,o)}}function lO(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=uO(e),o=e.hunks[n];if(o.hunkContent.some(dO))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 uO(e){let t=iO.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return iO.set(e,{lines:e.deletionLines,set:n}),n}function dO(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function fO(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 pO(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=zw({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=OO(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=Hw({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=OO(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function mO(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=OO(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,OO(i)+i.deletionCount,e.deletionLines.length),n}function hO(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?zD(e,t):GD(e,t)),!0)}function gO(e,t,n){if(oO(e.deletionLines,e.additionLines)==null)return[];let r=ID({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),i,a=(t,a)=>{i??=_O(e.hunks);for(let e=0;e<=a;e++){let o=i.get(t.deletionLineIndex-e);if(o!=null&&o.additions===t.additions&&o.deletions===t.deletions){if(t.additions>0&&n!=null){for(let e=0;e<t.additions;e++)if(n(o.additionLineIndex+e)!==r.additionLines[t.additionLineIndex+e])return a}return e}}return a},o=[],s=0,c=0;for(let e of r.hunks){rD(e,r,a);let t=e.additionCount>0?e.additionLineIndex-s:e.deletionLineIndex-c;s+=t,c+=t;for(let t of e.hunkContent){if(t.type===`context`){s+=t.lines,c+=t.lines;continue}let e=tO(t,0,0);e.additions===0&&(e.additionLineIndex=s),e.deletions===0&&(e.deletionLineIndex=c),o.push(e),s+=e.additions,c+=e.deletions}}return o}function _O(e){let t=new Map;for(let n of e)for(let e of n.hunkContent)e.type===`change`&&(e.additions===0||e.deletions===0)&&t.set(e.deletionLineIndex,e);return t}function vO(e,t,n){let r=e.map((e,t)=>{let n=OO(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&&yO(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=bO(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 yO(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function bO(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 xO(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`);CO(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`);CO(s,c,i,r),r+=c,i+=c,n.push(SO(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 SO(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:kO(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:AO(t.additionStart,r),deletionStart:kO(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:AO(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${kO(t.deletionStart,i)},${i} +${kO(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return nO(s),s}function CO(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function wO(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(OO(r)!==OO(i)||r.deletionCount!==i.deletionCount||DO(r)!==DO(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!TO(r,i))return!0}return!1}function TO(e,t){let n=EO(e),r=EO(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*EO(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 DO(e){return Dw(e.additionStart,e.additionCount)}function OO(e){return Dw(e.deletionStart,e.deletionCount)}function kO(e,t){return t===0?e:e+1}function AO(e,t){return t===0?e-1:e}function jO(e){rO(e);for(let t=0;t<e.hunks.length;t++)$D(e,t)}function MO(e){return Ju({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function NO(e){return Ju({tagName:`div`,children:[Ju({tagName:`span`,children:[Uu(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function PO(e){return Ju({tagName:`div`,children:[Bu({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 FO({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(Ju({tagName:`div`,children:[Uu(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(PO(`up`)),s++),o||(e.push(PO(`down`)),s++)):(e.push(PO(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(Ju({tagName:`div`,children:[Ju({tagName:`span`,children:[Uu(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(Ju({tagName:`div`,children:[Uu(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(Ju({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(Ju({tagName:`slot`,properties:{name:i}})),Ju({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 IO(e,t){return`hunk-separator-${e}-${t}`}function LO(e){let t=e.at(-1);return t==null?0:Math.max(Ow(t.additionStart,t.additionCount),Ow(t.deletionStart,t.deletionCount))}var RO=-1,zO=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++RO}`;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:Yc},t=Ps,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r}cleanUp(){this.endEditSession(),this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.diff=void 0,this.editSessionActive?(this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0):this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}beginEditSession(e,t){let{editSessionActive:n}=this;this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,n&&this.renderCache!=null&&this.renderCache.diff!==e&&this.clearRenderCache();let{renderCache:r}=this;if(!e.isPartial&&e.additionLines.length===0){Object.assign(e,WD(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&&Pw(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!Iw(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,this.diff??this.clearRenderCache()}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||!Pw(t.diff,e)||Lw(e)||$O(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=>{_l(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||!Pw(n,e)||!Pw(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);Iw(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)??fu}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,r,i){this.pendingStructuralRows=void 0;let{renderCache:a}=this;if(a==null)return!1;let{result:o,diff:s}=a;if(o==null)return!1;if(s.isPartial)throw Error(`Could not update render cache for partial diff`);let c=o.code.additionLines,l=this.pendingStructuralRows=n?new Map:void 0,u=[],d=new Map;if(l==null&&r!=null){let t=s.additionLines.length,n=YO(s.additionLines,i);for(let[i,a]of r){if(i<0||i>t||i===t&&(a===``||!n))continue;let r=s.additionLines[i]??``;r!==a&&(s.additionLines[i]=a,s.additionCharacterCount+=a.length-r.length,u.push(i),d.set(i,r),e.has(i)||(c[i]=XO(i,iT(a))))}}for(let[t,n]of e){let e=c[t]?.properties??{},i=n.map(e=>e[2]).join(``),a=t<s.additionLines.length,o=a?s.additionLines[t]??``:``,f=iT(o);if(l==null&&a&&r?.has(t)!==!0){let e=Ec(o,i);s.additionLines[t]=e,s.additionCharacterCount+=e.length-o.length,f!==i&&(u.push(t),d.set(t,o))}let p={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}]})};l==null?c[t]=p:l.set(t,p)}let f=!1;if(u.length>0){if(this.editSessionActive){if(s.additionLines.length<=1&&s.additionLines.join(``)===``)this.applyRecomputePreservingSessionType(s,WD(s,this.options.parseDiffOptions)),f=!0;else if(HD(s,s.additionLines))this.applyRecomputePreservingSessionType(s,UD(s,s.additionLines,s.additionCharacterCount,this.options.parseDiffOptions)),f=!0;else{let e=cO(s,u,this.options.parseDiffOptions,d);this.applyExpansionRemap(e),f=e!=null}}else Object.assign(s,JD(s,u,this.options.parseDiffOptions))}return o.baseThemeType=t,a.isDirty=!0,f}applyExpansionRemap(e){e!=null&&(this.expandedHunks=fO(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;this.pendingStructuralRows=void 0;let r=this.diff??n?.diff;if(r==null)return;let i=n?.result;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r,{lines:o,characterCount:s}=ZO(e);if(r.additionLines=o,r.additionCharacterCount=s,i!=null&&(i.code.additionLines=JO(a,r.additionLines,i.code.additionLines,e)),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,WD(r,this.options.parseDiffOptions)),i!=null&&(i.code.additionLines[0]=XO(0,e.getLineText(0)))):this.editSessionActive?this.applySessionDocumentChange(r,a):Object.assign(r,GD(r,this.options.parseDiffOptions)),t!=null&&i!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n!=null&&(n.isDirty=!0)}applySessionDocumentChange(e,t){let{parseDiffOptions:n}=this.options,r=e.additionLines;if(HD(e,r)){this.applyRecomputePreservingSessionType(e,UD(e,r,e.additionCharacterCount,n));return}this.applyExpansionRemap(sO(e,n,e=>t[e]))}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=>vc(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=Yc,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=tl,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}}initializeHighlighter(){return ec(Wl(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:Xs(this.workerManager,this.options)}))}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=$O(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!Iw(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!Lw(e),options:t,result:n?void 0:r?.result,renderRange:void 0};let i=this.getHighlightWorkerManager(e);i==null?Gs({theme:this.getLocalHighlightTheme()})??(this.computedLangs=QO(e),this.initializeHighlighter().catch(e=>{e instanceof Wu||this.onHighlightError(e)})):this.renderCache.result==null&&!n&&i.highlightDiffAST(this,this.diff)}getHighlightWorkerManager(e){let{editSessionActive:t,workerManager:n}=this;return!t&&n?.isWorkingPool()===!0&&!n.shouldHighlightOnMainThread(e)?n:void 0}cacheHighlightResult(e,t){let{editSessionActive:n,workerManager:r}=this;!n&&r?.isWorkingPool()===!0&&r.setDiffResultCache(e.cacheKey,t)}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Yc}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||!Pw(e,n.diff)||!Iw(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(Pw(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||Lw(e)||$O(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||Pw(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0&&!this.workerManager.shouldHighlightOnMainThread(e)||Gs({theme:t.theme})!=null:r.result==null&&r.hydrated!==!0?!0:this.getHighlightWorkerManager(e)==null?Gs({theme:t.theme})!=null:!r.highlighted}renderDiff(e=this.diff,t=rc){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||Lw(e)||$O(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!Pw(e,this.renderCache.diff),d=!qs(this.renderCache.renderRange,t),f=this.getHighlightWorkerManager(e);if(f!=null){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&Sc(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=f.getPlainDiffAST(e,t.startingLine,t.totalLines,Sc(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&f.highlightDiffAST(this,e)}else{this.computedLangs=QO(e);let n=Gs(),r=n!=null&&Ac(i.theme,n),o=n!=null&&gc(this.computedLangs,n),s=!c&&o,u=Number.isFinite(t.totalLines);if(l&&n!=null&&r&&(a||c||!this.renderCache.highlighted&&s||this.renderCache.result==null)){let{result:t,options:r}=this.renderDiffWithHighlighter(e,n,c||!o,u);this.renderCache={diff:e,options:r,highlighted:s,result:t,renderRange:void 0},s&&this.cacheHighlightResult(e,{result:t,options:r})}(!r||!c&&!o)&&this.asyncHighlight(e,u).then(({result:t,options:n})=>{c||this.cacheHighlightResult(e,{result:t,options:n}),this.applyHighlightResult(e,t,n,!c)}).catch(e=>{e instanceof Wu||this.onHighlightError(e)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=rc){this.diff=e;let{result:n}=await this.asyncHighlight(e,Number.isFinite(t.totalLines));return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return Ns({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e,t=!1){let n=$O(e,this.getTokenizeMaxLength());this.computedLangs=n?[`text`]:QO(e);let r=Gs(),i=r!=null&&Ac(this.getLocalHighlightTheme(),r),a=n||r!=null&&gc(this.computedLangs,r);return(r==null||!i||!a)&&(r=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,r,n,t)}renderDiffWithHighlighter(e,t,n=!1,r=!1){let{options:i}=this.getRenderOptions(e),{collapsedContextThreshold:a}=this.getOptionsWithDefaults(),o=BT(e,t,i,{forcePlainText:n,lazyLineAST:r,expandedHunks:n?!0:void 0,collapsedContextThreshold:a});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&o.code.additionLines[0]==null){let t;if(Zw({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:a,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);o.code.additionLines[0]=XO(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:o,options:i}}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&&Pw(i,e)&&Iw(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&Iw(a.options,n)&&Pw(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&&Iw(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&Pw(n.diff,e)&&Iw(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&&Pw(e,n.diff)&&Iw(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=ek(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:Ku(),deletionsGutterAST:Ku(),additionsGutterAST:Ku(),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=Vw({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`,Hu(void 0,`buffer`,this.size)),h?.push(MO(this.size))):(x.pushToGutter(`deletions`,Hu(void 0,`buffer`,this.size)),g?.push(MO(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,zu(t,n,r,i))};function T(e){C.flush(),a===`unified`?GO(`unified`,e,x):(GO(`deletions`,e,x),GO(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),Zw({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,h=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 g=a===`unified`?h:l,_={type:c,hunkIndex:t,lineIndex:g,unifiedLineIndex:h,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(_);n?.before!=null&&HO(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,`${h},${l}`,u.gutterProperties),i==null?r!=null&&(r=KO(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${h},${l}`}:void 0)):i=KO(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${h},${l}`}:void 0),WO({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,g),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&HO(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(_);n?.before!=null&&UO(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,g);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=KO(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=KO(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)}WO({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&UO(n.after,x,C)}let v=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,E=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:h===n.unifiedLineStart+n.unifiedLineCount-1),D=v?n.noEOFCRDeletions:!1,O=v?n.noEOFCRAdditions:!1,k=(s?.noEOFCR??!1)||D,A=(o?.noEOFCR??!1)||O;if(A||k){if(a===`split`&&C.flush(),k){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(NO(e)),x.pushToGutter(`unified`,Hu(e,`metadata`,1))):(x.deletionsContentAST.push(NO(e)),x.pushToGutter(`deletions`,Hu(e,`metadata`,1)),A||(x.pushToGutter(`additions`,Hu(void 0,`buffer`,1)),x.additionsContentAST.push(MO(1))))}if(A&&!(f&&k&&c!==`change`)){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(NO(e)),x.pushToGutter(`unified`,Hu(e,`metadata`,1))):(x.additionsContentAST.push(NO(e)),x.pushToGutter(`additions`,Hu(e,`metadata`,1)),k||(x.pushToGutter(`deletions`,Hu(void 0,`buffer`,1)),x.deletionsContentAST.push(MO(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||E&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:E&&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(LO(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=Ku(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,mc(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(Ju({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(Ju({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(Ju({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Yu(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Yu(t==null?e:Ju({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(!Vc(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(Wc(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(Wc(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){WO({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}WO({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 Bl({fileOrDiff:e,mode:t,stickyHeader:n})}},BO=new Intl.PluralRules(`en-US`);function VO(e){return`${e} unmodified line${BO.select(e)===`one`?``:`s`}`}function HO(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function UO(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 WO({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`,Hu(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`,Hu(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`,Hu(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function GO(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,FO({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(FO({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,FO({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(FO({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=IO(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?VO(n):`More unchanged context may be available`;c.pushToGutter(e,FO({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(FO({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 KO(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function qO(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function JO(e,t,n,r){let i=qO(e),a=qO(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]??=XO(e,r.getLineText(e));return l}function YO(e,t){return t===e.length+1&&e.at(-1)?.endsWith(`
|
|
1316
|
-
`)===!0}function XO(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 ZO(e){let t=[],n=0;for(let r=0;r<e.lineCount;r++){let i=e.getLineText(r,!0);t.push(i),n+=i.length}return{lines:t,characterCount:n}}function QO(e){if(e.lang!=null)return[e.lang];let t=Rl(e.prevName??e.name),n=Rl(e.name);return t===n?[n]:[t,n]}function $O(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function ek(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function tk(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function nk(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 rk(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:uu(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,parseDiffOptions:e?.parseDiffOptions,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function ik(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function ak(e){let t={...e};return delete t.cacheKey,t}function ok(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??Rl(e.name),r=t.lang??Rl(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 sk(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function ck(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&sk(n.lines,t.deletionLines)}var lk=-1,uk=class{options;workerManager;requestOwnerRender;static LoadedCustomComponent=!0;__id=`file-diff:${++lk}`;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;get lineAnnotations(){return this.renderedData?.lineAnnotations??xu}managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedData;pendingData;forceRenderOverride;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:Yc},t,n){this.options=e,this.workerManager=t,this.requestOwnerRender=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new tc,this.scrollSyncManager=new RD,this.interactionManager=new uc(`diff`,Mc(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??Yc}getHunksRendererOptions(e){return rk(e)}createHunksRenderer(e){return new zO(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=Dw(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(Mc(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&&!wc(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Nl(this.editSession?.annotations,e,Ps);getLatestAnnotations(){return this.pendingData?.lineAnnotations??this.editSession?.annotations?.current??this.lineAnnotations}getAnnotationsForDiff(e){let{pendingData:t}=this;return t!=null&&Pw(e,t.fileDiff)?t.lineAnnotations:this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.getLatestAnnotations()?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t!=null){if(!this.isNewAnnotations(e))return;kl(t,e,Ps)}let n=this.getWorkingDiff();n!=null&&(this.pendingData={fileDiff:n,lineAnnotations:e})}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.renderedData!=null&&(this.renderedData.lineAnnotations=e),this.pendingData=void 0,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.lineAnnotations.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;kc(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.isComponentManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.renderedData=void 0,this.pendingData=void 0),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.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=AE(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||hk(this.pre,pk({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||gk(this.headerElement,mk({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),Jl(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}){let i=r??this.getLatestAnnotations();this.pendingData=void 0,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?ID(t,n,this.options.parseDiffOptions):void 0),this.renderedData=this.fileDiff==null?void 0:{fileDiff:this.fileDiff,lineAnnotations:i},this.fileDiff!=null&&this.adoptRenderData(this.fileDiff),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.getInputDiff()==null&&this.additionFile==null&&this.deletionFile==null||this.requestRender()||this.render({forceRender:!0,renderRange:this.renderRange})}requestRender(){let{requestOwnerRender:e}=this;return this.editSession!=null||e==null?!1:(this.forceRenderOverride=!0,e(),!0)}get isComponentManaged(){return this.requestOwnerRender!=null}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(e,t,n),this.rerender()};loadFilesIfNecessary(){let e=this.getInputDiff(),{loadDiffFiles:t}=this.options;if(e==null||!ik(e)||this.pendingFiles?.fileDiff===e)return;if(t==null)throw Error(`FileDiff: loadDiffFiles is required to load full files for a partial diff`);let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}__canAttachEditor(){let e=this.getInputDiff();return e!=null&&!e.isPartial}async prepareForEditing(){if(this.__canAttachEditor())return;let e=this.__prepareForEditing();if(e==null){let e=this.getInputDiff();throw e?.isPartial===!0&&!ik(e)?Error(`FileDiff.prepareForEditing: this partial diff cannot be hydrated; provide a complete diff`):Error(`FileDiff.prepareForEditing: a partial diff requires loadDiffFiles`)}if(await e,!this.__canAttachEditor())throw Error(`FileDiff.prepareForEditing: the diff did not finish loading`)}__prepareForEditing(){if(this.__canAttachEditor())return;let e=this.getInputDiff();if(e?.isPartial===!0&&!ik(e))throw Error(`FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit`);return this.loadFilesIfNecessary(),this.pendingFiles?.promise}async loadFilesForDiff(e,t){try{let n=await t(e);if(this.getInputDiff()!==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.getInputDiff()===e&&e.isPartial){if(PE(`merge`,e,t),this.setHydratedState(t),this.installHydratedSessionDiff(e)){this.rerender();return}await EE(()=>this.primeHighlightCache(e)),this.enabled&&this.getInputDiff()===e&&this.rerender()}}installHydratedSessionDiff(e){if(e.isPartial)throw Error(`FileDiff.installHydratedSessionDiff: diffs cannot be partial for editing`);return this.getInputDiff()===e&&this.editSession?.outgoingDiff!=null&&(this.installEditSession(e),!0)}updateInputDiff(e,t){if(Pw(this.getInputDiff(),e))return!1;let n=this.getLatestAnnotations();this.fileDiff=e;let{editSession:r}=this,i=r?.outgoingDiff??r?.diff;return r!=null&&(e.isPartial?r.inputDiff=e:this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=i)),this.editSession?.annotations!=null&&t!=null&&(this.editSession.annotations=Ql(t,Ps,this.editSession.annotations)),this.pendingData={fileDiff:this.editSession?.diff??e,lineAnnotations:this.editSession?.annotations?.current??t??n},i!=null&&e.isPartial&&this.loadFilesIfNecessary(),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:NE(t.contents),a=n!=null&&ck(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=ak(e);t!=null&&i!=null&&!o&&(s.name=t.name,s.lang=t.lang),a&&n!=null&&t!=null&&i!=null&&(s.additionLines=i,s.additionCharacterCount=t.contents.length,s.type=n.type,s.hunks=n.hunks,s.editSessionDirty=!0,rO(s));let c=this.editSession?.annotations??Ql(this.getLatestAnnotations(),Ps);this.editSession={diff:s,inputDiff:e,annotations:c,outgoingDiff:this.editSession?.outgoingDiff},this.pendingData={fileDiff:s,lineAnnotations:c.current},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`);n=this.forceRenderOverride??n,this.forceRenderOverride=void 0;let l=AE(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=_&&(!fk(u,this.deletionFile)||!fk(d,this.additionFile)),y=e!=null&&!Pw(e,this.getInputDiff()),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&qs(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.getInputDiff()==null)&&(x=ID(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.updateInputDiff(e,i):x!=null&&(y=!0,this.updateInputDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getWorkingDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(hO(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.prepareRenderData(this.hunksRenderer.getDiffForNextRender(C));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,tu);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.adoptRenderData(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||!Pw(this.getRenderedDiff(),C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h})){let e=this.getRenderedDiff();e!=null&&this.adoptRenderData(e)}else{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.adoptRenderData(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)}getInputDiff(){return this.fileDiff}getWorkingDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedData?.fileDiff}__getNextRenderData({fileDiff:e,lineAnnotations:t}){let n=this.editSession?.annotations;if(n!=null)return{fileDiff:e,lineAnnotations:t!=null&&this.isNewAnnotations(t)?t:n.provided};let r=this.getWorkingDiff(e)??e,i=this.hunksRenderer.getDiffForNextRender(r);return{fileDiff:i,lineAnnotations:t!=null&&Pw(i,r)?t:this.getAnnotationsForDiff(i)}}prepareRenderData(e){this.hunksRenderer.setLineAnnotations(this.getAnnotationsForDiff(e))}adoptRenderData(e){let{pendingData:t}=this,n=t!=null&&Pw(e,t.fileDiff);this.renderedData={fileDiff:e,lineAnnotations:n?t.lineAnnotations:this.lineAnnotations},n&&(this.pendingData=void 0)}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getWorkingDiff();if(e==null||t==null||i==null||i.isPartial)return;let a=a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getWorkingDiff()!==i)return;let o=this.editSession?.outgoingDiff,s=this.getInputDiff(),c=o!=null&&s!=null&&o!==i,l=c&&o!=null&&s!=null?ok(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??Rl(i.name),c=Gs({theme:o,lang:s});c==null?ec({themes:Ru(o),langs:[`text`,s],preferredHighlighter:Xs(this.workerManager,this.options)}).then(a).catch(e=>{e instanceof Wu||console.error(e)}):a(c)}computeEditorRenderRange(e){let t=this.getWorkingDiff();if(e==null||t==null||Sc(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Zw({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 t=this.getInputDiff(),{diff:n,outgoingDiff:r}=this.editSession??{};if(r!=null&&t!=null){if(!t.isPartial&&ok(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?cl(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`);if(!this.__canAttachEditor())throw Error(`FileDiff.__attachEditor: a complete diff is required before editing`);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 t=this.getInputDiff(),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(dk(r)),e.__getDocumentSessionState()),this.editor=e,this.getInputDiff()?.isPartial===!0&&this.loadFilesIfNecessary();let i=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(i!=null&&this.hunksRenderer.diffCache===i&&this.adoptRenderData(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}=this;if(n==null)return;let{diff:r,inputDiff:i,annotations:a}=n,o=a?.provided??this.lineAnnotations;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let s=a?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=Il(r),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:i,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:o};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===i.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.additionFile!=null&&(this.deletionFile=l,this.additionFile=u),this.editSession=void 0,this.fileDiff=e&&c!=null?c:i,this.pendingData={fileDiff:this.fileDiff,lineAnnotations:e&&c!=null?s??o:o},e&&this.fileContainer!=null&&this.rerender(),d)throw f}finalizeEditSessionHunks(){let e=this.getWorkingDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=pO(e,this.hunksRenderer.getExpandedHunksMap(),t);return hO(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(mO(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()}applySuspendedDocumentChange(e,t){this.applyDocumentChange(e,t),this.hunksRenderer.clearRenderCache()}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,n.changedDocumentLines,n.documentLineCount)){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{diff:e,inputDiff:t}=this.editSession??{};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 Uw({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 Ww({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]=Rw(o);if(e<s){let c=zw({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=Hw({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]=Rw(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(){ks(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.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.getInputDiff()){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Lw(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{_l(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.isComponentManaged||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||!nk(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.isComponentManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderedData:t,options:{renderAnnotation:n}}=this;if(n!=null&&t!=null){let{fileDiff:r,lineAnnotations:i}=t;for(let[t,a]of i.entries()){let i=this.getAnnotationSlotName(a),o=`${t}-${i}`,s=this.annotationCache.get(o);if(s==null||s.fileDiff!==r||!tk(a,s.annotation)){s?.element.remove();let e=n(a,r);if(e==null)continue;s={element:Rc(i),annotation:a,fileDiff:r},s.element.appendChild(e),this.fileContainer.appendChild(s.element),this.annotationCache.set(o,s)}e.delete(o)}}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=ju();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:$c(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):$c(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=Bs;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&&Pw(r,n)?i:void 0)??Yu(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.isComponentManaged)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,Kc,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,vu,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,sl,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,au,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;this.pre?.toggleAttribute(`data-custom-styles`,!!e);let 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??=Rs(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Pu(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=Fc(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=Eu({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:dl(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=Lu(this.themeCSSStyle.textContent??``,Fc(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&ic()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?yl(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=_k(t[0]),a=_k(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=Yu(i),r.content.innerHTML=Yu(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=El({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=El({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=El({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.adoptRenderData(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.getWorkingDiff();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=_k(r?.[0]),a=_k(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.adoptRenderData(t.fileDiff)}refreshUnifiedDiffView(){let e=this.getWorkingDiff();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=_k(r?.[0]),a=_k(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=Yu(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.adoptRenderData(t.fileDiff)};this.shouldGuardRebuildScroll()?yl(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=_k(t[0]),i=_k(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};Us(u,this.appliedPreAttributes)||(hl(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 dk(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function fk(e,t){return e==null||t==null?e==null&&t==null:Fw(e,t)}function pk({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function mk({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function hk(e,t,n=!1){return!n&&e==null&&t}function gk(e,t,n=!1){return e==null&&t&&!n}function _k(e){if(e!=null&&e.type===`element`)return e.children??[]}var vk=3e3,yk=new Map,bk=-1,xk=class extends uk{__id=`little-virtualized-file-diff:${++bk}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:yk,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,n,r,i){super(e,r,i),this.virtualizer=t,this.metrics=mu(n)}setMetrics(e,t=!1){let n=mu(e);(t||!bu(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&(this.forceRenderOverride=!0)}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.forceRenderOverride=!0,!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.getLayoutAnnotations();return $s(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=!bl(t,e),r=n&&kk(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Ak(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=yk,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`},metrics:{lineHeight:n}}=this,r=this.placeHolder==null?this.getRenderedDiff():this.getLayoutDiff();if(this.fileContainer==null||r==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(r,this.editor?.__getGhostTextRows()??yk);let{ghostTextRowsByIndex:i}=this.cache,a=t!==`scroll`||this.lineAnnotations.length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!a&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0)return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified];if(this.renderRange!=null&&Vc(this.renderRange)){let t=Sk(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}for(let t of s){if(t==null)continue;let r=t.children[1];if(!(r instanceof HTMLElement))continue;let s=o===`split`&&t===this.codeDeletions;for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let c=Pk(r,o),l=i.get(c)??0;if(s&&l>0)continue;let u=this.cache.heightDeltas.get(c)??0;if(!a&&u===l*n)continue;let d=t.getBoundingClientRect().height+l*n,f=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(f=!0),d+=t.nextElementSibling.getBoundingClientRect().height);let p=this.getEstimatedLineHeight(f),m=d-p;m!==u&&(e=!0,this.cache.measuredHeightDeltaTotal+=m-u,m===0?this.cache.heightDeltas.delete(c):this.cache.heightDeltas.set(c,m))}}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.installHydratedSessionDiff(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.updateInputDiff(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)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=mu(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=iu(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:ol(this.metrics,i),height:0};let m;return Zw({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=Yw({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=Xw({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??iu(this.metrics,n)+this.cache.fileAnnotationHeight,u;return Zw({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=Yw({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=Xw({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||!Pw(this.getRenderedDiff(),this.getWorkingDiff()));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.getInputDiff()!=null&&(this.loadFilesIfNecessary(),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.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(this.getInputDiff()===e&&e.isPartial){if(this.isAdvancedMode()){let n=PE(`clone`,e,t);if(await EE(()=>this.primeHighlightCache(n)),this.getInputDiff()!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(PE(`merge`,e,t),this.setHydratedState(t),!this.installHydratedSessionDiff(e)&&(await EE(()=>this.primeHighlightCache(e)),this.getInputDiff()!==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.getInputDiff())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 Uw({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.getInputDiff()!=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.getInputDiff()==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getWorkingDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,!(this.isSimpleMode()&&this.requestRender())&&this.virtualizer.instanceChanged(this,!Pw(this.getRenderedDiff(),t))}get isComponentManaged(){return this.getAdvancedVirtualizer()?.isComponentManaged??super.isComponentManaged}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()??yk);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options;if(a){this.height+=ol(this.metrics,i),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()}getLayoutAnnotations(){let{pendingRender:e}=this;return e==null?this.lineAnnotations:this.getAnnotationsForDiff(e.diff)}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}=DE({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:jk(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=AE(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!Nk(s,this.deletionFile)||!Nk(c,this.additionFile)),u=t??this.getInputDiff();t==null&&o&&(l||this.getInputDiff()==null)&&(u=ID(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!Pw(this.getInputDiff(),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.updateInputDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.workingDiff===(this.getWorkingDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(u,r);if(g&&this.resetLayoutCache({includeEstimatedHeights:!0}),f)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(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.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(!Pw(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.getWorkingDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={workingDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!Pw(a,o),renderedDiffChanged:!Pw(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 Mk(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=jk(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=Ck(this.cache.heightDeltas),u=iu(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=Ek(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+Dk(i,e)*this.metrics.lineHeight+wk(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=vk}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+wk(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=zw({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?Yw({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?Hw({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Xw({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:Ok({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}=zw({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=Hw({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=jk(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=iu(this.metrics,i),h=e.hunks.length>0?_u(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(Zw({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?Yw({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=Xw({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 Sk(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===Fs&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Ck(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 wk({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Tk(e,n);return(t[Tk(e,r)]??0)-(t[i]??0)}function Tk(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 Ek(e){return Math.ceil(e/vk)*vk}function Dk(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Ok({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 kk(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 Ak(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 jk(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Mk(e){return typeof e==`function`?`custom`:e??`line-info`}function Nk(e,t){return e==null||t==null?e==null&&t==null:Fw(e,t)}function Pk(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}var Fk=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.parseDiffOptions.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),Ik=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Lk=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],Rk=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],zk=Symbol(`CodeView.itemOptionsState`);function Bk(e,t){Object.defineProperty(e,zk,{configurable:!1,enumerable:!1,value:t})}function Vk(e){return e[zk]}function Hk(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var Uk=120,Wk=1,Gk=`--diffs-overflow-override`;function Kk(e,t,n){return{containerHeight:e,triggerTop:t,targetTop:n,targetBottom:e-n,threshold:e-t}}var qk=Kk(12e6,1e6,2e6),Jk=Kk(2**22,5e5,1e6);function Yk(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var Xk=(()=>{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)})(),Zk=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;scrollRebaseConfig=sc()?Jk:qk;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=Ys;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;isComponentManaged;slotSnapshotStale=!1;constructor(e={theme:Yc},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isComponentManaged=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??oc}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??Ys.hunkLineCount,lineHeight:e?.lineHeight??Ys.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??Ys.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??Ys.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??Qc}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return Os&&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)<Wk||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),Xk&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Gk,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Uk)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(Gk,`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??CE(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isComponentManaged&&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(){kc(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.isComponentManaged||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.isComponentManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(xl),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))nA(e)||e.remove();this.isComponentManaged||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 wE()?`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=Qk(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;$k(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!bu(r,i),o=!bu(n,this.getLayout());o&&this.syncLayout();let s=a||eA(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||tA(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),bl(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isComponentManaged&&(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?(kc(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):ks(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??Yc;return Gs({theme:e})==null?(wc(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return lc({themes:Ru(e),langs:[],preferredHighlighter:Xs(this.workerManager,this.options)}).then(()=>{t||(this.clearReadySubscription(),this.render(!0))},e=>{t||(this.clearReadySubscription(),e instanceof Wu||console.error(e))}),()=>{t=!0}})(),!1):(this.clearReadySubscription(),!0)}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.itemEditors.has(n.item.id)||(this.slotSnapshotStale=!0),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=cA(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 xk(this.createDiffOptions(e.id),this,r,this.workerManager);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 ou(this.createFileOptions(e.id),this,r,this.workerManager);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&&nl(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&&e.type===`diff`&&!e.instance.__canAttachEditor()){e.instance.__prepareForEditing();return}if(r==null){Yk(n);let r=Vk(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 Ik)Hk(e,t,()=>this.options[t]);Hk(e,`stickyHeader`,()=>this.options.stickyHeaders),Hk(e,`collapsed`,e=>{let t=Vk(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),Hk(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Vk(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of Lk)this.defineItemSharedCallback(e,`file`,t);for(let t of Rk)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of Fk)Hk(e,t,()=>this.options[t]);Hk(e,`stickyHeader`,()=>this.options.stickyHeaders),Hk(e,`hunkSeparators`,()=>this.options.hunkSeparators),Hk(e,`collapsed`,e=>{let t=Vk(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),Hk(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Vk(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of Lk)this.defineItemSharedCallback(e,`diff`,t);for(let t of Rk)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return Bk(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return Bk(t,{id:e}),t}updateItemOptionsId(e,t){let n=Vk(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){Hk(e,n,e=>{if(this.options[n]==null)return;let r=Vk(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){Hk(e,n,e=>{let r=Vk(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()>this.scrollRebaseConfig.threshold}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),this.scrollRebaseConfig.containerHeight):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=TE(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=TE(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{scrollPageOffset:t,scrollRebaseConfig:n}=this,r=this.clampScrollPageOffset(t),i=e-r,a=this.getMaxPagedScrollTop(),o=this.getMaxScrollPageOffset(),s=i>n.threshold&&r<o,c=i<n.triggerTop&&r>0;return i<0||i>a||s||c?this.resolveScrollPageWindow(e,c?Math.min(n.targetBottom,a):n.targetTop):{pagedScrollTop:TE(this.clampPagedScrollTop(i)),scrollPageOffset:r}}needsScrollPageUpdate(e){let t=TE(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 ${rA(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 ${rA(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=Xc({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(),oA(this.stickyContainer,t.element,h),n.virtualizedSetup(),aA(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(oA(this.stickyContainer,t.element,h),aA(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=TE(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)>=Wk){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=TE(this.clampScrollTop(e)),i=TE(t),{scrollPageOffset:a}=this,o=TE(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||TE(this.getScrollTop())===TE(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);(this.slotSnapshotStale||!xE(this.slotSnapshot,e))&&(this.slotSnapshotStale=!1,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 Qk(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 $k(e,t){return!wc(e.theme??Yc,t.theme??Yc)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function eA(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 tA(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 nA(e){return e instanceof SVGElement||$c(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function rA(e){let t=iA(e.start,e.side),n=iA(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function iA(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function aA(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 oA(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function sA(e){return(e.item.annotations?.length??0)>0||bE(e).lineAnnotations.length>0}function cA(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)sA(t)&&i.push(t);return i.length>0?i:void 0}function lA(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}var uA=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function dA(e){return{instance:void 0,items:void 0,controlled:e,managedOptions:void 0,disableFlushSync:!1,slotCoordinator:void 0}}function fA(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=Sw(),E=(0,Z.useContext)(_E),D=(0,Z.useRef)(dA(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=bw(e=>{f?.(e)}),I=S!==void 0,L=bw((e,t,n)=>{if(T==null)throw Error(`CodeView: EditContext is not attached`);let r={...a,...t};return T(e,r,n)}),R=bw((e,t)=>{l?.(e,t)}),z=bw((e,t,n)=>u?.(e,t,n)??`reject`),B=(0,Z.useMemo)(()=>vA({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)(()=>_A()),[,H]=(0,Z.useState)({}),U=bw(e=>{D.current.instance!=null&&(e==null||e!==D.current.instance.getContainerElement())&&(D.current.instance.cleanUp(),V.publish(void 0),D.current=dA(w)),e!=null&&e!==D.current.instance?.getContainerElement()&&(D.current.instance=new Zk(B,i?void 0:E,!0),D.current.instance.setup(e)),lA(r,e)}),W=bw(e=>{D.current.disableFlushSync?V.publish(e):(0,od.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 uA(()=>d==null?void 0:D.current.instance?.subscribeToScroll(d)),uA(()=>{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(bl(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&&(hA(n,c)?D.current.items=c:mA(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;gA(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 gA(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 gA(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 gA(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)(yA,{managedContentStore:V,renderCustomHeader:_,renderHeaderPrefix:x,renderHeaderFilenameSuffix:y,renderHeaderMetadata:b,renderAnnotation:m,renderGutterUtility:v,renderCodeViewHeader:g,renderCodeViewFooter:h})]})}var pA=(0,Z.forwardRef)(fA);function mA(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 hA(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 gA(e,t){if(e)throw Error(`CodeView.${t} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`)}function _A(){let e,t=new Set;return{getSnapshot(){return e},publish(n){if(e!==n){e=n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function vA({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=SA),n&&(d.renderGutterUtility=SA),r&&(d.renderCodeViewHeader=SA),i&&(d.renderCodeViewFooter=SA),d}var yA=(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=bw(t=>e.subscribe(t)),u=bw(()=>e.getSnapshot()),d=(0,Z.useSyncExternalStore)(l,u,u),f=(0,Z.useMemo)(()=>{let e={renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o};return d?.items?.map(t=>(0,od.createPortal)(t.type===`diff`?(0,Q.jsx)(bA,{version:t.version??0,item:t.item,getHoveredLine:t.instance.getHoveredLine,getAnnotationSlotName:t.instance.getAnnotationSlotName,...bE(t),...e}):(0,Q.jsx)(xA,{version:t.version??0,item:t.item,getHoveredLine:t.instance.getHoveredLine,getAnnotationSlotName:t.instance.getAnnotationSlotName,...bE(t),...e}),t.element,t.id))},[t,n,r,i,a,o,d?.items]),p=(0,Z.useMemo)(()=>s!=null&&d?.header!=null?(0,od.createPortal)(s(),d.header):null,[s,d?.header]),m=(0,Z.useMemo)(()=>c!=null&&d?.footer!=null?(0,od.createPortal)(c(),d.footer):null,[c,d?.footer]);return(0,Q.jsxs)(Q.Fragment,{children:[f,p,m]})}),bA=(0,Z.memo)(function({item:e,fileDiff:t,lineAnnotations:n,getHoveredLine:r,getAnnotationSlotName:i,renderCustomHeader:a,renderHeaderPrefix:o,renderHeaderFilenameSuffix:s,renderHeaderMetadata:c,renderAnnotation:l,renderGutterUtility:u}){return jw({fileDiff:t,renderCustomHeader:a==null?void 0:()=>a(e),renderHeaderPrefix:o==null?void 0:()=>o(e),renderHeaderFilenameSuffix:s==null?void 0:()=>s(e),renderHeaderMetadata:c==null?void 0:()=>c(e),renderAnnotation:l==null?void 0:(t,n)=>l(t,n,e),lineAnnotations:n,renderGutterUtility:u==null?void 0:t=>u(t,e),getHoveredLine:r,getAnnotationSlotName:i})}),xA=(0,Z.memo)(function({item:e,file:t,lineAnnotations:n,getHoveredLine:r,getAnnotationSlotName:i,renderCustomHeader:a,renderHeaderPrefix:o,renderHeaderFilenameSuffix:s,renderHeaderMetadata:c,renderAnnotation:l,renderGutterUtility:u}){return Nw({file:t,renderCustomHeader:a==null?void 0:()=>a(e),renderHeaderPrefix:o==null?void 0:()=>o(e),renderHeaderFilenameSuffix:s==null?void 0:()=>s(e),renderHeaderMetadata:c==null?void 0:()=>c(e),renderAnnotation:l==null?void 0:(t,n)=>l(t,n,e),lineAnnotations:n,renderGutterUtility:u==null?void 0:t=>u(t,e),getHoveredLine:r,getAnnotationSlotName:i})});function SA(){}function CA(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 wA=(0,Z.createContext)(void 0);function TA(){return(0,Z.useContext)(wA)}function EA(){let[e]=(0,Z.useState)(()=>{let e=0,t;return{getSnapshot:()=>e,subscribe(e){return t=e,()=>{t=void 0}},forceUpdate(){e++,t?.()}}});return(0,Z.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot),e.forceUpdate}function DA(e,t){"use no memo";return e.current?.__getNextRenderData(t)}var OA=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function kA({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=TA(),h=a!==void 0,g=(0,Z.useContext)(_E),_=Sw(),v=bw(e=>f?.(e)),y=f==null?void 0:v,b=(0,Z.useRef)(null),x=bw(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=EA(),T=DA(C,AA(b,e,i))??{file:e,lineAnnotations:i??xu},E=(0,Z.useRef)(null),D=bw(()=>{if(_==null)throw Error(`File: EditContext is not attached`);return _(`file`,n??{},r)}),O=bw(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 yu(NA({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),u?void 0:g,w):C.current=new ou(NA({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),m,s,u?void 0:g,w),d&&E.current==null&&(E.current=PA(C.current,D)),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,E.current=null}});OA(()=>{let{current:n}=C;if(n==null)return;let r=NA({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),o=!bl(n.options,r);if(n.setOptions(r),!d&&E.current!=null){let{current:e}=E;E.current=null,e()}let s=MA(e,i,b);n.render({file:s.file,lineAnnotations:s.lineAnnotations,forceRender:o}),a!==void 0&&n.setSelectedLines(a),d&&E.current==null&&(E.current=PA(n,D),w())});let k=(0,Z.useCallback)(()=>C.current?.getHoveredLine(),[]),A=(0,Z.useCallback)(e=>C.current?.getAnnotationSlotName(e)??Ps(e),[]);return{...T,ref:O,getHoveredLine:k,getAnnotationSlotName:A}}function AA(e,t,n){"use no memo";return jA(t,n,e.current)}function jA(e,t,n){return{file:n?.file!=null&&qc(e,n.file.stale)?n.file.installed:e,lineAnnotations:n?.annotations!=null&&t===n.annotations.stale?n.annotations.installed:t}}function MA(e,t,n){let{current:r}=n,i=jA(e,t,r);return r==null?i:(r.file!=null&&!qc(e,r.file.stale)&&(r.file=null),t!==r.annotations?.stale&&(r.annotations=null),r.file==null&&r.annotations==null&&(n.current=null),i)}function NA({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...e,controlledSelection:t,renderCustomHeader:n?Tw:e?.renderCustomHeader,renderGutterUtility:r?Tw:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function PA(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function FA({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,file:C,lineAnnotations:w}=kA({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}),T=Nw({file:C,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:h,lineAnnotations:w,getHoveredLine:x,getAnnotationSlotName:S});return(0,Q.jsx)(xl,{ref:b,className:s,style:c,children:CA(T,m)})}function IA(e){return e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
|
|
1317
|
-
`)}function LA(e){return/^\s*$/.test(e)}function RA(e,t){let n=0;for(;n<e.length&&n<t&&e[n]===` `;)n++;return e.slice(n)}function zA(e){let t=``;for(let n of e)n.type===`text`||n.type===`inlineCode`?t+=n.value:`children`in n?t+=zA(n.children):n.type===`image`&&(t+=n.alt);return t}function BA(e=VA){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 VA(e){return e.toLowerCase().normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).replace(/&[a-z0-9#]+;/gi,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`section`}function HA(e){let t=e.replace(/[\u0000-\u001F\u007F\s]+/g,``);return/^(?!https?:|mailto:|tel:)[a-z][a-z0-9+.-]*:/i.test(t)?``:t}function UA(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 WA(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}function GA(e){return WA(e).replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)||`footnote`}function KA(e,t=1){return t>1?`${e}-${t}`:e}function qA(e,t={}){let n=ZA(e,t);for(let e of t.extensions??[])n=e.transformInline?.(n,{options:t})??n;return n}var JA=32,YA=16,XA=/[\\`!\[_*~<]/g;function ZA(e,t,n={scans:Math.max(e.length*YA,1024),depth:0,links:0}){if(n.depth>=JA)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===`
|
|
1318
|
-
`){o(),r.push({type:`break`}),i+=2;continue}if(c&&/[!-/:-@\[-`{-~]/.test(c)){a+=c,i+=2;continue}}if(s==="`"){let t=nj(e,i,"`"),s=rj(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===`^`&&QA(e,i,t,n);if(u){o(),r.push(u.node),n.links++,i=u.end;continue}let d=$A(e,i+Number(l),t,n);if(d){let e=n.links,s=ZA(d.label,l?t.references?{references:t.references}:{}:t,n),c=!l&&n.links!==e,u=HA(d.href);if(l||!c&&(u||!d.href))o(),r.push({...l?{type:`image`,src:u,alt:zA(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=ij(e,i+3,`***`,n);if(a!==-1){o(),r.push({type:`emphasis`,children:ZA(e.slice(i+1,a+2),t,n)}),i=a+3;continue}}if(s===`~`&&c===`~`&&e[i+2]===`~`){let t=nj(e,i,`~`);a+=e.slice(i,i+t),i+=t;continue}if(s===`*`||s===`_`||s===`~`){let l=c===s?2:1,u=s===`_`&&!oj(e,i,l,!0)?-1:ij(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:ZA(e.slice(i+l,u),t,n)}),i=u+l);continue}if(s===`<`&&t.allowHtml){let t=aj(e,i+1,`>`,n);if(t!==-1&&ej(e.slice(i,t+1))){o(),r.push({type:`inlineHtml`,value:e.slice(i,t+1)}),i=t+1;continue}}XA.lastIndex=i+1;let l=n.scans>0?XA.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 QA(e,t,n,r){let i=aj(e,t+2,`]`,r);if(i===-1)return;let a=WA(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??GA(o.label),number:s,...c>1?{referenceIndex:c}:{}},end:i+1}}function $A(e,t,n,r){let i=tj(e,t,`[`,`]`,r);if(i===-1)return;let a=e.slice(t+1,i),o=i+1,s;if(e[o]===`(`){let t=tj(e,o,`(`,`)`,r);if(t===-1)return;s=UA(e.slice(o+1,t).trim()),o=t+1}else if(e[o]===`[`){let t=tj(e,o,`[`,`]`,r);if(t===-1)return;s=n.references?.[WA(e.slice(o+1,t)||a)],o=t+1}else s=n.references?.[WA(a)];if(s)return{...s,label:a,end:o}}function ej(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 tj(e,t,n,r,i){if(aj(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 nj(e,t,n,r){let i=0;for(;e[t+i]===n&&!(r&&--r.scans<0);)i++;return i}function rj(e,t,n,r,i){let a=t;for(;(a=aj(e,a,n,i))!==-1;){let t=nj(e,a,n,i);if(t===r)return a;a+=t}return-1}function ij(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=nj(e,i,n,r),a=ij(e,i+t,n.repeat(t),r);if(a>i+t){i=a+t-1;continue}}if(n[0]!==`_`||oj(e,i,n.length,!1))return i}}return-1}function aj(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 oj(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 sj=64;function cj(e,t={}){let n=IA(e),r=t.frontmatter!==!1,i=n.split(`
|
|
1319
|
-
`),a;if(r&&i[0]===`---`){let e=i.findIndex((e,t)=>t>0&&e===`---`);e>0&&(a=i.slice(1,e).join(`
|
|
1320
|
-
`),i=i.slice(e+1))}let o=dj(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=BA(),p=new lj(i,d,f).parse();u&&s.length>0&&p.push(fj(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 lj=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>=sj){let e=this.lines.slice(this.index).join(`
|
|
1321
|
-
`);return this.index=this.lines.length,e?[{type:`paragraph`,children:qA(e,this.options)}]:[]}this.budget.depth++;let e=[];for(;this.index<this.lines.length;){if(LA(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=>qA(e,this.options),parseBlocks:t=>new e(IA(t).split(`
|
|
1322
|
-
`),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(RA(n,e[1].length)),this.index++}return{type:`code`,value:r.join(`
|
|
1323
|
-
`),...uj(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=qA((/^#+[ \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(!LA(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=mj(this.current());if(!t)return;let n=[],r=t.ordered,i=t.indent,a=!1;for(;this.index<this.lines.length;){let r=mj(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=mj(e);if(n&&n.indent===i)break;if(LA(e)){let e=this.index;for(;e<this.lines.length&&LA(this.lines[e]);)e++;let n=this.lines[e];if(n===void 0)break;let o=mj(n);if(o?.indent===i){if(o.marker!==t.marker)break;a=!0,this.index=e;break}if(hj(n)<r.contentIndent)break;for(;this.index<e;)l.push(RA(this.lines[this.index++],r.contentIndent));continue}if(hj(e)>=r.contentIndent){l.push(RA(e,r.contentIndent)),this.index++;continue}if(gj(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||!_j(e,t))return;let n=vj(e),r=vj(t).map(yj),i=n.length,a=[];for(this.index+=2;this.index<this.lines.length;){let e=this.current();if(LA(e)||gj(e,this.next()))break;let t=vj(e);a.push(Array.from({length:i},(e,n)=>bj(t[n]??``,this.options))),this.index++}return{type:`table`,align:r,header:n.map(e=>bj(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(`
|
|
1324
|
-
`)}}for(;this.index<this.lines.length&&!LA(this.current());)e.push(this.current()),this.index++;return{type:`html`,value:e.join(`
|
|
1325
|
-
`)}}parseParagraph(){let e=[];for(;this.index<this.lines.length;){let t=this.current();if(LA(t)||e.length>0&&gj(t,this.next()))break;e.push(t.trim()),this.index++}return{type:`paragraph`,children:qA(e.join(`
|
|
1326
|
-
`),this.options)}}createHeadingId(e){if(this.options.headingIds===!1)return;let t=zA(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 uj(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?pj(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 dj(e){let t=Object.create(null),n=Object.create(null),r=BA(GA),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)&&LA(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=WA(t);n[s]||(n[s]={label:t,content:a.join(`
|
|
1327
|
-
`),id:r(t)});continue}let a=s.match(/^ {0,3}\[([^\]\n]+)\]:[ \t]*(\S.*)$/),c=a&&UA(a[2].trimEnd());if(c){t[WA(a[1])]??=c,o++;continue}}i.push(s),o++}return{lines:i,references:t,footnotes:n}}function fj(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??GA(o.label),number:a+1,children:new lj(IA(o.content).split(`
|
|
1328
|
-
`),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 pj(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 mj(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 hj(e){return e.match(/^ */)?.[0].length??0}function gj(e,t){let n=mj(e);return/^ {0,3}(?:`{3,}|~{3,}|#{1,6}(?:\s|$)|([-*_])(?:\s*\1){2,}\s*$|>)/.test(e)||n!==void 0&&(!n.ordered||n.number===1)||!!t&&_j(e,t)}function _j(e,t){if(!e.includes(`|`))return!1;let n=vj(t);return n.length===vj(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function vj(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 yj(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function bj(e,t){return{type:`tableCell`,children:qA(e,t)}}function xj({children:e,...t}){return(0,Z.createElement)(Z.Fragment,null,Sj(e,t))}function Sj(e,t={}){return(typeof e==`string`?cj(e,t):e).children.map((e,n)=>Cj(e,t,`b:${n}`))}function Cj(e,t={},n){switch(e.type){case`heading`:return Mj(t,`h${e.depth}`,{key:n,...e.id?{id:e.id}:{},...e.framework?{"data-framework":e.framework}:{}},Tj(e.children,t),Pj(e.id,t));case`paragraph`:return Mj(t,`p`,{key:n},Tj(e.children,t));case`code`:return Ej(e,t,n);case`list`:return Mj(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start!==void 0&&e.start!==1?{start:e.start}:{}},e.items.map((n,r)=>Mj(t,`li`,{key:r},Dj(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return Mj(t,`blockquote`,{key:n},e.children.map((e,r)=>Cj(e,t,`${n}:${r}`)));case`table`:return Mj(t,`table`,{key:n},Mj(t,`thead`,null,Mj(t,`tr`,null,e.header.map((n,r)=>Oj(`th`,n,e.align[r],t,r)))),e.rows.length?Mj(t,`tbody`,null,e.rows.map((n,r)=>Mj(t,`tr`,{key:r},n.map((n,r)=>Oj(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return kj(e.items,t,n);case`thematicBreak`:return Mj(t,`hr`,{key:n});case`html`:return t.allowHtml?Mj(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):Mj(t,`p`,{key:n},e.value);case`callout`:return Mj(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},Mj(t,`p`,{className:`markdown-alert-title`},e.title),Mj(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>Cj(e,t,`${n}:${r}`))));case`component`:return Nj(e,t,n)}}function wj(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return Mj(t,`code`,{key:n},e.value);case`strong`:return Mj(t,`strong`,{key:n},Tj(e.children,t));case`emphasis`:return Mj(t,`em`,{key:n},Tj(e.children,t));case`strike`:return Mj(t,`del`,{key:n},Tj(e.children,t));case`footnoteReference`:return Mj(t,`sup`,{key:n},Mj(t,`a`,{id:`user-content-fnref-${KA(e.id,e.referenceIndex)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return Mj(t,`a`,{key:n,href:e.href,...e.title?{title:e.title}:{}},Tj(e.children,t));case`image`:return Mj(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title?{title:e.title}:{}});case`break`:return Mj(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?Mj(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value}}function Tj(e,t){return e.map((e,n)=>wj(e,t,`i:${n}`))}function Ej(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=Mj(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}:{}},Mj(t,`code`,{...a,...s},o));return e.title?Mj(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},Mj(t,`figcaption`,null,e.title),c):Mj(t,Z.Fragment,{key:n},c)}function Dj(e,t,n,r,i){let a=t===void 0?[]:[Mj(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 Tj(o.children,r))a.push(e);n&&(a=[Mj(r,`p`,{key:`${i}:paragraph`},a)])}else a.push(Cj(o,r,`${i}:${t}`))}return a}function Oj(e,t,n,r,i){return Mj(r,e,{key:i,...n?{style:{textAlign:n}}:{}},Tj(t.children,r))}function kj(e,t,n){return Mj(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},Mj(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,Pj(`footnote-label`,t)),Mj(t,`ol`,null,e.map(e=>Mj(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},Aj(e,t)))))}function Aj(e,t){let n=e.children.length-1,r=jj(e,t),i=e.children.map((e,i)=>i===n&&e.type===`paragraph`?Mj(t,`p`,{key:i},Tj(e.children,t),r):Cj(e,t,`${i}`));return e.children[n]?.type!==`paragraph`&&i.push(Mj(t,`p`,{key:`backref-wrapper`},r.slice(1))),i}function jj(e,t){let n=[];for(let r=1;r<=(e.referenceCount??1);r++){let i=KA(e.id,r),a=r===1?`${e.number}`:`${e.number}-${r}`;n.push(` `,Mj(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 Mj(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,Z.createElement)(i,n,...r)}function Nj(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)),Mj(t,r,{key:n,...i},e.children.map((e,r)=>Cj(e,t,`${n}:${r}`)))}function Pj(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return Mj(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}function Fj([e,t]){return{result:e,send:(e,n)=>{t(e).then(e=>{_(e)&&n?.()})},reset:()=>{t(Ca)}}}var Ij={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 Lj(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(Lj).join(``):(0,Z.isValidElement)(e)?Lj(e.props.children):``}function Rj(e){let t=(0,$.c)(11),{dark:n}=Zs(),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=Lj(Z.Children.toArray(e.children)).replace(n,``),t[0]=e.children,t[1]=i}else i=t[1];let a=i,o=`snippet.${Ij[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=gu(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)(FA,{file:s,options:l})}),t[8]=s,t[9]=l,t[10]=u):u=t[10],u}var zj={pre:Rj,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 Bj(e){let t=(0,$.c)(7),{text:n,className:r}=e,i;t[0]===r?i=t[1]:(i=X(`text-ui text-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Q.jsx)(xj,{components:zj,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 Vj=so(e=>Br(t=>e.paths.map(n=>t(M({...e,path:n}))))),Hj=so(e=>xr((t,n)=>{for(let t of e.paths)n.refresh(M({...e,path:t}));return null}));function Uj(e,t,n){let r=(0,$.c)(14),i={connection:e,scope:t,paths:n},a=Rr(Vj(i)),o=Aa(Hj(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?Ts(Te(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(qi),r[5]=a,r[6]=c);let l;r[7]===a?l=r[8]:(l=a.some(f),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 Wj=(0,Z.lazy)(()=>$u(()=>import(`./file-editor-CmaAI7mD.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])));function Gj(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)(Wj,{...e})}),t[1]=e,t[2]=r),r}var Kj=/url\(\s*(['"]?)([^)'"]+)\1\s*\)|@import\s+(['"])([^'"]+)\3/g,qj=`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'; frame-src 'none'`;function Jj(e){let t=window.document.implementation.createHTMLDocument(),n=t.createElement(`meta`);n.httpEquiv=`Content-Security-Policy`,n.content=qj;let r=t.createElement(`style`);r.textContent=`html, body { height: 100%; margin: 0; } iframe { display: block; width: 100%; height: 100%; border: 0; color-scheme: inherit; }`,t.head.replaceChildren(n,r),t.documentElement.style.colorScheme=`light dark`;let i=t.createElement(`iframe`);return i.title=`Preview content`,i.setAttribute(`aria-label`,`Preview content`),i.sandbox.add(`allow-scripts`),i.referrerPolicy=`no-referrer`,i.srcdoc=e,t.body.append(i),`<!doctype html>${t.documentElement.outerHTML}`}var Yj=fa(`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(Kj)){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]))}`:mw(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(Kj)){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 Xj(e.getAttribute(`srcset`)??``))y(t.url);for(let e of _)v.push(...u(e.tagName===`STYLE`?e.textContent??``:e.getAttribute(`style`)??``,t));s=yield*uo(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`,Xj(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=qj,m.head.prepend(b),{html:`<!doctype html>${m.documentElement.outerHTML}`,missing:[...o]}});function Xj(e){return[...e.matchAll(/(data:[^\s]+|[^,\s]+)(?:\s+(\d+(?:\.\d+)?[wx]))?\s*,?/g)].map(e=>({url:(e[1]??``).replace(/,$/,``),descriptor:e[2]??``}))}var Zj=ne(Cr,{render:(e,t,n)=>Yj(e,t,n).pipe(Er(()=>bo(new Fa)))});function Qj(e){let t=(0,$.c)(11),{html:n,title:r,className:i}=e,{dark:a}=Zs(),o;t[0]===n?o=t[1]:(o=Jj(n),t[0]=n,t[1]=o);let s=a?`dark`:`light`,c;t[2]===s?c=t[3]:(c={colorScheme:s},t[2]=s,t[3]=c);let l;t[4]===i?l=t[5]:(l=X(`block min-h-128 w-full border-0 bg-transparent`,i),t[4]=i,t[5]=l);let u;return t[6]!==o||t[7]!==c||t[8]!==l||t[9]!==r?(u=(0,Q.jsx)(`iframe`,{title:r,"aria-label":r,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,srcDoc:o,style:c,className:l}),t[6]=o,t[7]=c,t[8]=l,t[9]=r,t[10]=u):u=t[10],u}function $j(e){let t=(0,$.c)(14),{scope:n,path:r,html:i,connection:a}=e,o=gw(a,n,r,i,Zj);if(qi(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(f(o)){let e;t[1]===o.cause?e=t[2]:(e=Lc(ht(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=Gt(Te(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)(Qj,{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 eM(e,t,n){let r=(0,$.c)(4),i;return r[0]!==e||r[1]!==n||r[2]!==t?(i=os({connection:e,scope:t,path:n}),r[0]=e,r[1]=n,r[2]=t,r[3]=i):i=r[3],su(i).value}function tM(e,t,n){let r=(0,$.c)(9),i={connection:e,scope:t,paths:n},a=Rr(Mr(i)),o=Aa(Zt(i)),s;if(r[0]!==n||r[1]!==a){let e;r[3]===n?e=r[4]:(e=(e,t)=>{let r=n[t]??``;if(f(e))return{path:r,status:`unavailable`};let i=Ts(Te(e));return i?{path:r,status:`loaded`,entries:i.entries}:{path:r,status:`loading`}},r[3]=n,r[4]=e),s=a.map(e),r[0]=n,r[1]=a,r[2]=s}else s=r[2];let c=s,l;return r[5]!==a||r[6]!==o||r[7]!==c?(l={results:a,states:c,retry:o},r[5]=a,r[6]=o,r[7]=c,r[8]=l):l=r[8],l}function nM(e){return tn(`alert-dialog`,e)}var rM=mm,iM=class extends hm{};function aM(){return new iM}function oM({...e}){return(0,Q.jsx)(nM,{"data-slot":`alert-dialog`,...e})}function sM({...e}){return(0,Q.jsx)(rM,{"data-slot":`alert-dialog-trigger`,...e})}function cM({...e}){return(0,Q.jsx)(P,{"data-slot":`alert-dialog-portal`,...e})}function lM({className:e,...t}){return(0,Q.jsx)(Gi,{"data-slot":`alert-dialog-overlay`,className:X(`fixed inset-0 isolate z-50 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function uM({className:e,size:t=`default`,...n}){return(0,Q.jsxs)(cM,{children:[(0,Q.jsx)(lM,{}),(0,Q.jsx)(gt,{"data-slot":`alert-dialog-content`,"data-size":t,className:X(`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-3 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm 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 dM({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:X(`grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 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 fM({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:X(`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 pM({className:e,...t}){return(0,Q.jsx)(O,{"data-slot":`alert-dialog-title`,className:X(`font-heading text-sm 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 mM({className:e,...t}){return(0,Q.jsx)(Qi,{"data-slot":`alert-dialog-description`,className:X(`text-xs/relaxed text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function hM({className:e,...t}){return(0,Q.jsx)(Y,{"data-slot":`alert-dialog-action`,className:X(e),...t})}function gM({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,Q.jsx)(l,{"data-slot":`alert-dialog-cancel`,className:X(e),render:(0,Q.jsx)(Y,{variant:t,size:n}),...r})}var _M=`160000`;function vM(e){return e.oldMode===_M||e.newMode===_M}function yM(e){return e.kind===`text`||e.kind===`metadata-only`}function bM(e,t){return vM(e)||t?.kind!==`text`?null:e.newPath??e.oldPath??null}function xM(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 SM(e){switch(e.kind){case`binary`:return`Binary change`;case`metadata-only`:return`No code change`;case`omitted`:return xM(e.reason);case`text`:return}}function CM(e,t,n){return vM(e)?`Submodule change`:t===void 0?n?`The patch could not be read`:`Reading the patch`:SM(t)}function wM(e){return e.scope===`staged`||e.scope===`unstaged`?{scope:e.scope,oldPath:e.oldPath,newPath:e.newPath}:void 0}var TM=/(?=^From [a-f0-9]+ .+$)/m,EM=/(?=^diff --git)/gm,DM=/^(---|\+\+\+)\s+([^\t\r\n]+)/,OM=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;Object.freeze({fromStart:0,fromEnd:0}),Object.freeze([]);function kM(e,t){return e-(t===0?0:1)}function AM(e,t){return kM(e,t)+t}var jM=1;function MM(e,...t){return`ck${jM}:${JSON.stringify([e,...t])}`}function NM(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var PM=new TextEncoder,FM=new TextDecoder(`utf-8`,{ignoreBOM:!0}),IM=/[\uD800-\uDFFF]/,LM=1024,RM=new Uint8Array(LM);function zM(){RM.length!==LM&&(RM=new Uint8Array(LM))}function BM(e){if(e.length===0)return e;if(IM.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;RM.length<t&&(RM=new Uint8Array(t));let{written:n}=PM.encodeInto(e,RM);return FM.decode(RM.subarray(0,n))}var VM=new TextDecoder(`utf-8`,{ignoreBOM:!0}),HM={'"':`"`,"\\":`\\`,a:`\x07`,b:`\b`,t:` `,n:`
|
|
1329
|
-
`,v:`\v`,f:`\f`,r:`\r`};function UM(e){if(e[0]!==`"`)return;let t=``,n=1;for(;n<e.length;){let r=e[n];if(r===`"`)return{fileName:t,rawLength:n+1};if(r!==`\\`){t+=r,n++;continue}let i=HM[e[n+1]];if(i!=null){t+=i,n+=2;continue}let a=[];do{let t=WM(e,n+1);if(t==null)return;a.push(t),n+=4}while(e[n]===`\\`&&e[n+1]>=`0`&&e[n+1]<=`7`);t+=VM.decode(new Uint8Array(a))}}function WM(e,t){let n=e.charCodeAt(t)-48,r=e.charCodeAt(t+1)-48,i=e.charCodeAt(t+2)-48;if(n>=0&&n<=3&&r>=0&&r<=7&&i>=0&&i<=7)return n*64+r*8+i}var GM=4096,KM=.5;function qM(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=JM(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}}function JM(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)>GM)return null;let c=[];for(let t=0;t<n;t++)c.push(XM(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(XM(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+=ZM(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*KM: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 YM=/\s+/g;function XM(e){return e.replace(YM,``)}function ZM(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}var QM=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function $M(e,t,n=!1,r){let i=_N(e),a=i?oN(e):sN(e),o,s=[];for(let e of a){if(i&&!EM.test(e)){if(o==null)o=BM(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!cN(e)){if(o==null)o=BM(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=eN(e,{cacheKey:t==null?void 0:r==null?MM(`patch-file`,t,String(s.length)):MM(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function eN(e,{cacheKey:t,isGitDiff:n=EM.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=vN(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=aN(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=mN(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?iN(i.contents):[],deletionLines:!l&&r!=null&&i!=null?iN(r.contents):[],additionCharacterCount:!l&&r!=null&&i!=null?i.contents.length:0,deletionCharacterCount:!l&&r!=null&&i!=null?r.contents.length:0,cacheKey:bN(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(QM);if(t==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}let n=nN(t[1],!0),r=nN(t[2],!0);c.name=BM(r),n!==r&&(c.prevName=BM(n));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(DM):null;if(t!=null){let[,e,r]=t,i=nN(r,n);if(e===`---`&&i!==`/dev/null`){let e=BM(i);c.prevName=e,c.name=e}else e===`+++`&&i!==`/dev/null`&&(c.name=BM(i))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=BM(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=BM(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=BM(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=BM(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(OM)??[];t!=null&&(c.prevObjectId=BM(t)),n!=null&&(c.newObjectId=BM(n)),r!=null&&(c.mode=BM(r))}(e.startsWith(`rename from `)||e.startsWith(`copy from `))&&(c.prevName=BM(nN(e.slice(e.startsWith(`rename`)?12:10)))),(e.startsWith(`rename to `)||e.startsWith(`copy to `))&&(c.name=BM(nN(e.slice(e.startsWith(`rename`)?10:8))))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
1330
|
-
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
1331
|
-
`||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:bN(p.hunkContext),hunkSpecs:BM(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(!fN(t)||pN(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=xN(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=SN(t);(g==null||g.type!==`change`)&&(g=CN(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&(c.additionLines.push(e),c.additionCharacterCount+=e.length),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=SN(t);(g==null||g.type!==`change`)&&(g=CN(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&(c.deletionLines.push(e),c.deletionCharacterCount+=e.length),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=SN(t);(g==null||g.type!==`context`)&&(g=CN(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e),c.deletionCharacterCount+=e.length,c.additionCharacterCount+=e.length),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;if(e>=0){let t=c.additionLines[e],n=NM(t);c.additionLines[e]=n,c.additionCharacterCount+=n.length-t.length}}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;if(e>=0){let t=c.deletionLines[e],n=NM(t);c.deletionLines[e]=n,c.deletionCharacterCount+=n.length-t.length}}}}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=kM(b.additionStart,b.additionCount)+(x===0?0:1),t=kM(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(kM(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=AM(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=AM(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),qM(c),c}}function tN(e,t,n=!1){let r=[],i=rN(e)?e.split(TM):[e];for(let e of i)try{r.push($M(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{zM()}return r}function nN(e,t=!1){let n=e.trim(),r=n.startsWith(`"`)?UM(n)?.fileName??n:n;return t&&(r.startsWith(`a/`)||r.startsWith(`b/`))?r.slice(2):r}function rN(e){return e.startsWith(`From `)||e.includes(`
|
|
1332
|
-
From `)}function iN(e){let t=aN(e);for(let e=0;e<t.length;e++)t[e]=BM(t[e]);return t}function aN(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
1333
|
-
`,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 oN(e){return vN(e,`diff --git`)}function sN(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=dN(e,r);if(i<=0&&a<=0){if(lN(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=dN(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=mN(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 cN(e){return lN(e,0)}function lN(e,t){let n=dN(e,t);return uN(e,t,`---`)&&uN(e,n,`+++`)}function uN(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===`
|
|
1334
|
-
`||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function dN(e,t){let n=e.indexOf(`
|
|
1335
|
-
`,t);return n===-1?e.length:n+1}function fN(e){let t=e[0];return t===`+`||t===`-`||t===` `}function pN(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
1336
|
-
`&&n!==`\r`)return!1}return!0}function mN(e){if(!e.startsWith(`@@ -`))return;let t=4,n=hN(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=hN(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=hN(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=hN(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=gN(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function hN(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 gN(e){return e.endsWith(`\r
|
|
1337
|
-
`)?e.slice(0,-2):e.endsWith(`
|
|
1338
|
-
`)?e.slice(0,-1):e}function _N(e){return e.startsWith(`diff --git`)||e.includes(`
|
|
1339
|
-
diff --git`)}function vN(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:yN(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=yN(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function yN(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function bN(e){return e==null?e:BM(e)}function xN(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function SN(e){let t=e.slice(1);return BM(t===``?`
|
|
1340
|
-
`:t)}function CN(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 wN(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===``?`
|
|
1341
|
-
`:n,type:t===` `?`context`:t===`\\`?`metadata`:t===`+`?`addition`:`deletion`}}function TN(e){if(e.trim()===``)return{kind:`empty`};let t=e.split(`
|
|
1342
|
-
`);t.at(-1)===``&&t.pop();let n=t.findIndex(e=>e.startsWith(`@@`));if(n<0)return{kind:`invalid`};try{let r=tN(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=wN(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=wN(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 EN=(e,t,n,r)=>`@@ -${t===0?e-1:e},${t} +${r===0?n-1:n},${r} @@`;function DN(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[EN(t.oldLine,n,t.newLine,r),...e.map(e=>e.text)]}function ON(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 kN(e,t,n=3){let r=TN(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(...DN(t)),t=[])}t.length>0&&s.push(...DN(t))}return s.length===i.length?null:`${s.join(`
|
|
1343
|
-
`)}\n`}function AN(e){return`path`in e?e.path:e.newPath??e.oldPath??``}function jN(e){return`${e.scope}\n${e.oldPath}\n${e.newPath}`}function MN(e){return`change:${e.scope}:${AN(e)}`}function NN(e){return e.mergeBaseOid===null||e.mergeBaseOid===void 0?null:{baseOid:e.mergeBaseOid,headOid:e.head.oid}}function PN(e){return e instanceof Error&&(e.name===`RequestError`||e.name===`ConnectionError`)?e.message:`The branch could not be compared. Try again.`}function FN(e){let t=new Map;for(let n of e){let e=AN(n);t.has(e)||t.set(e,{path:e,paths:[e],kind:`kind`in n?n.kind:`changed`})}return[...t.values()]}var IN=e=>e.newPath??e.oldPath??``;function LN(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(IN(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)=>jN(e).localeCompare(jN(t))))}return a.push(o),a}function RN(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}var zN=so(e=>Sn(e,[`branch`,e.base??null],t=>t.changes.readBranchChanges({params:{worktreeId:e.scope.worktreeId},query:{base:e.base}}),t=>t.worktreeId===e.scope.worktreeId)),BN=so(e=>Sn(e,[`branch-bases`],t=>t.changes.listBranchBases({params:{worktreeId:e.scope.worktreeId}}))),VN=so(({connection:e,scope:t,input:n})=>kn(e,t,[`change-diffs`,n],ei(function*(){let r=yield*(yield*Ga(e)).request(e=>e.changes.readChangeDiffs({params:{worktreeId:t.worktreeId},payload:n}));return yield*Fo(e,r.environmentId===e.environmentId&&r.worktreeId===t.worktreeId&&r.statusToken===n.expectedStatusToken),r}),mi(e),n.expectedFiles.map(e=>e.path))),HN=so(({connection:e,scope:t,input:n})=>kn(e,t,[`branch-diffs`,n],ei(function*(){return yield*(yield*Ga(e)).request(e=>e.changes.readBranchDiffs({params:{worktreeId:t.worktreeId},payload:n}))}),mi(e))),UN=so(({connection:e,scope:t,oid:n,parent:r,paths:i})=>kn(e,t,[`commit-diffs`,n,r,i],ei(function*(){let a=yield*(yield*Ga(e)).request(e=>e.changes.readCommitDiffs({params:{worktreeId:t.worktreeId,oid:n},payload:{...r===1?{}:{parent:r},paths:i.map(e=>[...e])}}));return yield*Fo(e,a.commitOid===n),a}),mi(e)));function WN(e){return new Map(e.diffs.map(e=>[`selection`in e?jN(e.selection):e.paths.join(`\0`),e.content]))}var GN=so(e=>Po(t=>e.map(e=>wt(t(e),WN)),t=>{for(let n of e)t(n)})),KN=so(e=>Br(t=>Ya(Ro(e,e=>Ya(t.result(e,{suspendOnWaiting:!0}),WN),{concurrency:`unbounded`}),e=>new Map(e.flatMap(e=>[...e])))).pipe(Ua(0)));function qN(e,t){return j(t.map(t=>Hr.reviewSurface(e.connection.environmentId,e.scope,[t])))}var JN=so(e=>mi(e.connection).fn(fa(`Changes.readCurrent`)(t=>cs(re(e),()=>qN(e,[`changes`]))))),YN=so(e=>mi(e.connection).fn(fa(`Changes.refreshGitLook`)(t=>cs(re(e),()=>qN(e,[`changes`,`git-status`]))))),XN=so(e=>mi(e.connection).fn(fa(`Changes.readCurrentGitStatus`)(t=>cs(Ke(e),()=>qN(e,[`git-status`]))))),ZN=class e extends ce()(`@porcelain/client/ChangedDiffRecovery`){static layer=ts(e,ei(function*(){let e=yield*fs({attempted:{},pending:{}});return{state:Uo(e),changes:dr(e),begin:fa(`ChangedDiffRecovery.begin`)((t,n)=>Ar(e,e=>e.attempted[t]===n?[!1,e]:[!0,{attempted:{...e.attempted,[t]:n},pending:{...e.pending,[t]:n}}])),finish:fa(`ChangedDiffRecovery.finish`)((t,n)=>as(e,e=>{if(e.pending[t]!==n)return e;let r={...e.pending};return delete r[t],{...e,pending:r}}))}}))},QN=so(e=>e.atoms(t=>un(ZN.layer,t(mi(e).layer)))),$N=so(e=>QN(e.connection).fn(fa(`Changes.recoverDiffs`)(function*(t,n){let r=yield*ZN,i=JSON.stringify([e.scope.projectId,e.scope.worktreeId]);if(!(yield*r.begin(i,t)))return;let a=St(e);return n.refresh(a),yield*Ra(n.result(a,{suspendOnWaiting:!0}),r.finish(i,t))}),{concurrent:!0})),eP=so(({connection:e,scope:t,statusToken:n})=>QN(e).atom(W(Ya(ZN,e=>e.changes)).pipe(Zo(e=>{let r=JSON.stringify([t.projectId,t.worktreeId]);return{pending:e.pending[r]===n,attempted:e.attempted[r]===n}})))),tP=so(e=>{let{connection:t,scope:n,statusToken:r}=e,i=LN(e.expectedFiles,e.selections,200).map(e=>VN({connection:t,scope:n,input:{expectedStatusToken:r,expectedFiles:e.expectedFiles,selections:e.selections}})),a=GN(i),o=KN(i),s=$N({connection:t,scope:n});return Po(t=>{t.mount(s);let n=t(a),i=t(eP(e));return tt(i)&&!i.value.attempted&&n.some(e=>f(e)&&Xr(ht(e.cause)))&&t.set(s,r),{result:t(o),recovery:i}},e=>e(a)).pipe(Ua(0))});function nP(e,t){let n=(0,$.c)(3),r;return n[0]!==t||n[1]!==e?(r=St({scope:e,connection:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],su(r).value}function rP(e,t){let n=(0,$.c)(3),r;return n[0]!==t||n[1]!==e?(r=St({scope:e,connection:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],Rr(r)}function iP(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=tP({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}=Rr(s),u;a[6]===l?u=a[7]:(u=ke(Te(l),aP),a[6]=l,a[7]=u);let d=u,p;a[8]===c?p=a[9]:(p=tt(c)?c.value:new Map,a[8]=c,a[9]=p);let m;a[10]!==d||a[11]!==c?(m=qi(c)||d,a[10]=d,a[11]=c,a[12]=m):m=a[12];let h;a[13]!==d||a[14]!==c?(h=f(c)&&!d,a[13]=d,a[14]=c,a[15]=h):h=a[15];let g=yr(s),_;return a[16]!==p||a[17]!==m||a[18]!==h||a[19]!==g?(_={diffs:p,pending:m,failed:h,retry:g},a[16]=p,a[17]=m,a[18]=h,a[19]=g,a[20]=_):_=a[20],_}function aP(e){return e.pending}var oP=Br(ea());function sP(e,t,n){let r=(0,$.c)(11),i=n===void 0||n,a;r[0]!==t||r[1]!==e?(a=Ce({connection:t,scope:e}),r[0]=t,r[1]=e,r[2]=a):a=r[2];let o=a,s=Rr(i?o:oP),c;r[3]!==t||r[4]!==e?(c=XN({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=Aa(c,l),d=yr(i?o:oP),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 cP(e,t){if(!yM(t))return null;let n=nu(t.patch),r=fD(t.patch,`${MN(e)}:${n}`).flatMap(e=>e.files),i=r.length===1?r[0]:void 0;return i?{id:MN(e),kind:`diff`,path:AN(e),fileDiff:i,version:n,note:`${e.scope} · ${e.kind}`}:null}function lP(e,t,n){let r=bM(t,n);if(!r||n?.kind!==`text`)return null;let i=nu(n.patch),a=fD(n.patch,`${e}:${r}:${i}`).flatMap(e=>e.files),o=a[0];return o?{id:`commit:${e}:${r}`,kind:`diff`,path:r,fileDiff:o,lineCounts:a.flatMap(e=>e.hunks).reduce((e,t)=>({added:e.added+t.additionLines,removed:e.removed+t.deletionLines}),{added:0,removed:0}),version:i,note:t.status}:null}function uP(e,t){let n=(0,$.c)(4),r;n[0]!==t||n[1]!==e?(r=JN({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],Aa(r,i)}function dP(e,t){let n=(0,$.c)(4),r;n[0]!==t||n[1]!==e?(r=YN({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],Aa(r,i)}function fP(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=GN(e),t[0]=e,t[1]=n);let r=n,i=Rr(r),a=yr(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 pP(e){let t=(0,$.c)(11),n=fP(e),r;t[0]===n.results?r=t[1]:(r=new Map(n.results.flatMap(mP)),t[0]=n.results,t[1]=r);let i;t[2]===n.results?i=t[3]:(i=n.results.some(qi),t[2]=n.results,t[3]=i);let a;t[4]===n.results?a=t[5]:(a=n.results.some(f),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 mP(e){return J(Te(e)).flatMap(hP)}function hP(e){return[...e]}var gP=Br(ea()),_P=Br(ea());function vP(e,t,n){let r=(0,$.c)(7),i;r[0]!==n||r[1]!==t||r[2]!==e?(i=e?zN({connection:t,scope:e,...n===void 0?{}:{base:n}}):_P,r[0]=n,r[1]=t,r[2]=e,r[3]=i):i=r[3];let a=i,o=Rr(a),s=yr(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 yP(e,t,n){let r=(0,$.c)(7),i;r[0]!==t||r[1]!==n||r[2]!==e?(i=n?BN({connection:t,scope:e}):gP,r[0]=t,r[1]=n,r[2]=e,r[3]=i):i=r[3];let a=i,o=Rr(a),s=yr(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 bP(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?RN(r,25).map(r=>HN({connection:t,scope:e,input:{baseOid:n.baseOid,headOid:n.headOid,paths:r.map(xP)}})):[],i[0]=t,i[1]=r,i[2]=n,i[3]=e,i[4]=a):a=i[4],pP(a)}function xP(e){return[...e]}function SP(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=>UN({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=RN(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 pP(o)}function CP(e,t){let n=(0,$.c)(7),r;n[0]!==e||n[1]!==t?(r=ze({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]=xa(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 wP(e,t){let n=(0,$.c)(5),r=CP(e,t),i;n[0]===r?i=n[1]:(i=e=>r.submit({path:Tu(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 TP(e,t){let n=(0,$.c)(5),r=CP(e,t),i;n[0]===r?i=n[1]:(i=e=>r.submit({path:Tu(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 EP=Br(void 0);function DP(e,t,n,r){let i=(0,$.c)(13),a;i[0]===e?a=i[1]:(a=Rt(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]=xa(a,o),l=Aa(EP),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=>en({try:()=>r(e),catch:OP})})},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 OP(e){return new na({message:`Could not open the selected worktree.`,cause:e})}function kP(){let e=(0,$.c)(2),t=Aa(EP),n;return e[0]===t?n=e[1]:(n=e=>{e||t(void 0)},e[0]=t,e[1]=n),n}var AP=fi(R.layer).atom(R),jP=so(e=>e.atoms(R.layer).fn((t,n)=>ei(function*(){let r=yield*(yield*R).pickProject(e.address);r!==null&&(yield*n.setResult(Rt(e),{path:r,remote:null,complete:()=>void 0,select:e=>en({try:()=>t(e),catch:e=>new na({message:`Could not open the selected worktree.`,cause:e})})}))})));function MP(e,t,n){let r=(0,$.c)(3),i=Ts(Te(Rr(AP))),a;r[0]===e?a=r[1]:(a=jP(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]=xa(a,o);return i?.canPickProject(e.address)&&(()=>{s.waiting||c(t).then(e=>{if(aa(e)){let t=ht(e.cause);n(t instanceof Error?t:new na({message:`Could not open the selected worktree.`,cause:t}))}})})}var NP=gm(),PP=gm(),FP=aM(),IP=aM(),LP=aM(),RP=gm();function zP(e,t){let n=(0,$.c)(6),r;n[0]!==e||n[1]!==t?(r=y({connection:e,projectId:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a=Rr(i),o=yr(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}function BP(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=y({connection:e,projectId:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],su(r).value}function VP(e,t){let n=(0,$.c)(2),r=BP(e,t),i;return n[0]===r.preferences?i=n[1]:(i=new Set(r.preferences.filter(UP).map(HP)),n[0]=r.preferences,n[1]=i),i}function HP(e){return e.path}function UP(e){return e.hidden}function WP(e,t){let n=(0,$.c)(2),r=BP(e,t),i;return n[0]===r.preferences?i=n[1]:(i=r.preferences.filter(KP).map(GP),n[0]=r.preferences,n[1]=i),i}function GP(e){return e.path}function KP(e){return e.pinned}function qP(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=Bi(e),t[0]=e,t[1]=n),su(n).value}function JP({...e}){return(0,Q.jsx)(Jo,{"data-slot":`dialog`,...e})}function YP({...e}){return(0,Q.jsx)(mm,{"data-slot":`dialog-trigger`,...e})}function XP({...e}){return(0,Q.jsx)(P,{"data-slot":`dialog-portal`,...e})}function ZP({...e}){return(0,Q.jsx)(l,{"data-slot":`dialog-close`,...e})}function QP({className:e,...t}){return(0,Q.jsx)(Gi,{"data-slot":`dialog-overlay`,className:X(`fixed inset-0 isolate z-50 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function $P({className:e,children:t,showCloseButton:n=!0,...r}){return(0,Q.jsxs)(XP,{children:[(0,Q.jsx)(QP,{}),(0,Q.jsxs)(gt,{"data-slot":`dialog-content`,className:X(`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-4 rounded-xl bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm 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)(l,{"data-slot":`dialog-close`,render:(0,Q.jsx)(Y,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,Q.jsx)(Ht,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function eF({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`dialog-header`,className:X(`flex flex-col gap-1`,e),...t})}function tF({className:e,showCloseButton:t=!1,children:n,...r}){return(0,Q.jsxs)(`div`,{"data-slot":`dialog-footer`,className:X(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,Q.jsx)(l,{render:(0,Q.jsx)(Y,{variant:`outline`}),children:`Close`})]})}function nF({className:e,...t}){return(0,Q.jsx)(O,{"data-slot":`dialog-title`,className:X(`font-heading text-sm font-medium`,e),...t})}function rF({className:e,...t}){return(0,Q.jsx)(Qi,{"data-slot":`dialog-description`,className:X(`text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var iF=Z.createContext(void 0);function aF(){let e=Z.useContext(iF);if(e===void 0)throw Error(Wn(53));return e}function oF(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 sF=`data-has-overflow-x`,cF=`data-has-overflow-y`,lF=`data-overflow-x-start`,uF=`data-overflow-x-end`,dF=`data-overflow-y-start`,fF=`data-overflow-y-end`,pF=e=>t=>t?{[e]:``}:null,mF={hasOverflowX:pF(sF),hasOverflowY:pF(cF),overflowXStart:pF(lF),overflowXEnd:pF(uF),overflowYStart:pF(dF),overflowYEnd:pF(fF),cornerHidden:()=>null},hF=`--scroll-area-corner-height`,gF=`--scroll-area-corner-width`,_F=`data-orientation`,vF={x:0,y:0},yF={width:0,height:0},bF={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},xF={x:!0,y:!0,corner:!0},SF=Z.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=CF(i),d=Xe(),f=ye(),p=ye(),{nonce:m,disableStyleElements:h}=Tr(),[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(yF),[O,k]=Z.useState(yF),[A,j]=Z.useState(bF),[M,N]=Z.useState(xF),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),U=Z.useRef(0),W=Z.useRef(0),G=Z.useRef(0),K=Z.useRef(`vertical`),ee=Z.useRef(vF),q=Z.useRef(null);function te(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let ne=Ie(e=>{let t=e.x-ee.current.x,n=e.y-ee.current.y;ee.current=e,n!==0&&te(!0),t!==0&&te(!1)}),re=Ie(()=>{let e=F.current;e&&q.current===null&&(q.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),ie=Ie(e=>{if(e.button!==0||V.current!==null&&(K.current===`vertical`?R.current:z.current)?.hasPointerCapture(V.current))return;V.current=e.pointerId,H.current=e.clientY,U.current=e.clientX,K.current=e.currentTarget.getAttribute(_F);let t=F.current;t&&(W.current=t.scrollTop,G.current=t.scrollLeft,re()),(K.current===`vertical`?R.current:z.current)?.setPointerCapture(e.pointerId)}),ae=Ie(e=>{if(e.pointerId!==V.current)return;V.current=null,(K.current===`vertical`?x:y)(!1),q.current!==null&&(F.current&&(F.current.style.scrollSnapType=q.current),q.current=null);let t=K.current===`vertical`?R.current:z.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),oe=Ie(e=>{if(e.pointerId!==V.current)return;if(e.buttons%2==0){ae(e);return}let t=F.current;if(!t)return;let n=K.current===`vertical`,r=n?R.current:z.current,i=n?I.current:L.current;if(!r||!i)return;let a=n?`y`:`x`,o=oF(i,`padding`,a),s=oF(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-U.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?W.current:G.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),te(n)});function se(e){C(e.pointerType===`touch`)}function ce(e){if(se(e),e.pointerType!==`touch`){let t=Ut(P.current,e.target);_(t)}}let le=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]),ue={role:`presentation`,onPointerEnter:ce,onPointerMove:ce,onPointerDown:se,onPointerLeave(){_(!1)},style:{position:`relative`,[hF]:`${E.height}px`,[gF]:`${E.width}px`}},de=$o(`div`,e,{state:le,ref:[t,P],props:[ue,o],stateAttributesMapping:mF}),fe=Z.useMemo(()=>({handlePointerDown:ie,handlePointerMove:oe,handlePointerUp:ae,handleScroll:ne,disableViewportSnap:re,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:le,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[ie,oe,ae,ne,re,E,O,w,S,v,b,g,d,M,A,le,s,c,l,u]);return(0,Q.jsxs)(iF.Provider,{value:fe,children:[!h&&La.getElement(m),de]})});function CF(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 wF=Z.createContext(void 0),TF=`--scroll-area-overflow-x-start`,EF=`--scroll-area-overflow-x-end`,DF=`--scroll-area-overflow-y-start`,OF=`--scroll-area-overflow-y-end`,kF=`--scroll-area-thumb-height`,AF=`--scroll-area-thumb-width`,jF=[TF,EF,DF,OF],MF=!1;function NF(){MF||T||(typeof CSS<`u`&&`registerProperty`in CSS&&jF.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),MF=!0)}var PF=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}=aF(),T=Hi(),E=Z.useRef(!0),D=Z.useRef([NaN,NaN,NaN,NaN]),O=ye(),k=ye(),A=Ie(()=>{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=FF(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=yo(T===`rtl`?-w:w,P),L=P-I);let R=A?0:yo(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,K=W?U:0,ee=oF(n,`padding`,`x`),q=oF(t,`padding`,`y`),te=oF(i,`margin`,`x`),ne=oF(r,`margin`,`y`),re=B-ee-te,ie=V-q-ne,ae=n?Math.min(n.offsetWidth-G,re):re,oe=t?Math.min(t.offsetHeight-K,ie):ie,se=Math.max(16,ae*M),ce=Math.max(16,oe*N);if(m(e=>IF(e,{width:se,height:ce})),t&&r){let e=LF(r,kF,x,F,h,ce,t.offsetHeight-ce-q-ne);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-se-ee-te,t=LF(i,AF,T===`rtl`?-w:w,P,_,se,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let le=[I,L,R,z];jF.forEach((t,n)=>{e.style.setProperty(t,`${le[n]}px`)}),a&&p(e=>IF(e,{width:H,height:U})),g(e=>IF(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=>IF(e,ue))});or(()=>{NF()},[]),or(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),or(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),or(()=>{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:La.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=$o(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:mF}),P=Z.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,Q.jsx)(wF.Provider,{value:P,children:N})});function FF(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function IF(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function LF(e,t,n,r,i,a,o){let s=Go(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 RF=Z.createContext(void 0);function zF(){let e=Z.useContext(RF);if(e===void 0)throw Error(Wn(54));return e}var BF=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:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:S,hasMeasuredScrollbar:C,viewportState:w}=aF(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=Hi(),O=!C&&!a,k=T?d.y:d.x,A=a||!k;Z.useEffect(()=>{if(!A)return;let e=m.current,t=T?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!T,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&&D===`rtl`?-a:0,s=n&&D===`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)),y({x:e.scrollLeft,y:e.scrollTop}))}return vn(t,`wheel`,n,{passive:!1})},[D,y,T,p,f,A,m]);let j={...x&&{"data-id":`${x}-scrollbar`},"aria-hidden":!0,onPointerDown(e){if(e.button!==0)return;let t=Cs(e.nativeEvent),n=T?h.current:g.current;if(n&&Ut(n,t))return;let r=m.current;if(!r)return;let i=T?f.current:p.current;if(!n||!i)return;let a=T?`y`:`x`,o=oF(n,`margin`,a),s=oF(i,`padding`,a),c=T?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=T?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=T?r.scrollHeight:r.scrollWidth,v=T?r.clientHeight:r.clientWidth,x=(T?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),T?r.scrollTop=S*C:r.scrollLeft=D===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onMouseDown(e){e.preventDefault()},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:O?`hidden`:void 0,...T?{top:0,bottom:`var(${hF})`,insetInlineEnd:0,[kF]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${gF})`,bottom:0,[AF]:`${S.width}px`}}},M=$o(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:mF});return A?(0,Q.jsx)(RF.Provider,{value:i,children:M}):null}),VF=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}=aF(),m=zF(),h=m===`vertical`;return $o(`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]})}),HF=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=aF(),l=$o(`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 UF({className:e,children:t,...n}){return(0,Q.jsxs)(SF,{"data-slot":`scroll-area`,className:X(`relative`,e),...n,children:[(0,Q.jsx)(PF,{"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)(WF,{}),(0,Q.jsx)(HF,{})]})}function WF({className:e,orientation:t=`vertical`,...n}){return(0,Q.jsx)(BF,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:X(`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)(VF,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}function GF({className:e,...t}){return(0,Q.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:X(e),...t})}function KF({className:e,...t}){return(0,Q.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:X(`flex flex-wrap items-center gap-1.5 text-xs/relaxed wrap-break-word text-muted-foreground`,e),...t})}function qF({className:e,...t}){return(0,Q.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:X(`inline-flex items-center gap-1`,e),...t})}function JF({className:e,render:t,...n}){return co({defaultTagName:`a`,props:cn({className:X(`transition-colors hover:text-foreground`,e)},n),render:t,state:{slot:`breadcrumb-link`}})}function YF({className:e,...t}){return(0,Q.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:X(`font-normal text-foreground`,e),...t})}function XF({children:e,className:t,...n}){return(0,Q.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:X(`[&>svg]:size-3.5`,t),...n,children:e??(0,Q.jsx)(Pe,{})})}function ZF(e,t){let n=(0,$.c)(6),r;n[0]!==e||n[1]!==t?(r=vs(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a=Rr(i),o=yr(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 QF(e){let t=(0,$.c)(3),{folder:n,disabled:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Q.jsx)(UF,{className:`h-40`,"aria-label":`Folders`,children:(0,Q.jsx)(`div`,{className:`flex flex-col p-1`,children:(0,Q.jsx)($F,{folder:n,disabled:r})})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function $F(e){let t=(0,$.c)(38),{folder:n,disabled:r}=e,i=Aa(EP),a;t[0]===n.value?a=t[1]:(a=Ts(Te(n.value)),t[0]=n.value,t[1]=a);let o=a;if(qi(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(f(n.value)){let e;t[3]===n.value.cause?e=t[4]:(e=Pa(ht(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)(Y,{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)(Y,{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)(Y,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,onClick:()=>i(o.parent??void 0),disabled:r,children:[(0,Q.jsx)(yd,{"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)(Y,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,title:e.path,onClick:()=>i(e.path),disabled:r,children:[(0,Q.jsx)(Ef,{"data-icon":`inline-start`}),(0,Q.jsx)(fr,{text: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 eI(e){let t=(0,$.c)(44),{connection:n,disabled:r,onOpen:i}=e,a=Rr(EP),o=Aa(EP),s=ZF(n,a),c,l;t[0]===s.value?(c=t[1],l=t[2]):(c=Ts(Te(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 p;t[4]!==u||t[5]!==c||t[6]!==r||t[7]!==o?(p=c&&(0,Q.jsx)(GF,{"aria-label":`Folder path`,children:(0,Q.jsx)(KF,{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)(XF,{}),(0,Q.jsx)(qF,{className:`min-w-0`,children:t===u.length-1?(0,Q.jsx)(YF,{className:`max-w-48`,title:c.path,children:e}):(0,Q.jsx)(JF,{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]=p):p=t[8];let m;t[9]===p?m=t[10]:(m=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 px-3 pt-1`,children:[d,p]}),t[9]=p,t[10]=m);let h;t[11]!==r||t[12]!==s?(h=(0,Q.jsx)(QF,{folder:s,disabled:r}),t[11]=r,t[12]=s,t[13]=h):h=t[13];let g;t[14]===c?.truncated?g=t[15]:(g=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]=g);let _=c?.repository?`Every worktree appears in the sidebar.`:`Pick a folder that is a Git repository.`,v;t[16]===_?v=t[17]:(v=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:_}),t[16]=_,t[17]=v);let y;t[18]!==c?.repository||t[19]!==r||t[20]!==s.value?(y=r||!c?.repository||lt(s.value)||f(s.value),t[18]=c?.repository,t[19]=r,t[20]=s.value,t[21]=y):y=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)(Ci,{}),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=`Open ${S}`,w;t[29]===C?w=t[30]:(w=(0,Q.jsx)(fr,{className:`max-w-36`,text:C}),t[29]=C,t[30]=w);let T;t[31]!==b||t[32]!==x||t[33]!==w||t[34]!==y?(T=(0,Q.jsxs)(Y,{size:`sm`,disabled:y,onClick:b,children:[x,w]}),t[31]=b,t[32]=x,t[33]=w,t[34]=y,t[35]=T):T=t[35];let E;t[36]!==T||t[37]!==v?(E=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-1 pb-1 pl-3`,children:[v,T]}),t[36]=T,t[37]=v,t[38]=E):E=t[38];let D;return t[39]!==E||t[40]!==m||t[41]!==h||t[42]!==g?(D=(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:[m,h,g,E]}),t[39]=E,t[40]=m,t[41]=h,t[42]=g,t[43]=D):D=t[43],D}function tI(e){let t=(0,$.c)(9),{connection:n,remotes:r,onOpened:i}=e,a=kP(),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)($P,{className:`flex max-h-[90svh] flex-col sm:max-w-lg`,children:(0,Q.jsx)(nI,{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)(Jo,{handle:NP,onOpenChangeComplete:a,children:c}),t[6]=a,t[7]=c,t[8]=l):l=t[8],l}function nI(e){let t=(0,$.c)(18),{connection:n,remote:r,name:i,onOpened:a}=e,o=DP(n,r,rI,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)(bf,{"aria-hidden":`true`})}),t[0]=s):s=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(nF,{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)(eF,{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)(rF,{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 p;t[6]!==n||t[7]!==o.result.waiting||t[8]!==d?(p=(0,Q.jsx)(eI,{disabled:o.result.waiting,connection:n,onOpen:d}),t[6]=n,t[7]=o.result.waiting,t[8]=d,t[9]=p):p=t[9];let m;t[10]===o.result?m=t[11]:(m=f(o.result)&&(0,Q.jsx)(no,{variant:`destructive`,children:(0,Q.jsx)(Qn,{children:Pa(ht(o.result.cause))})}),t[10]=o.result,t[11]=m);let h;t[12]!==p||t[13]!==m?(h=(0,Q.jsx)(UF,{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:[p,m]})}),t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;return t[15]!==u||t[16]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[u,h]}),t[15]=u,t[16]=h,t[17]=g):g=t[17],g}function rI(){return NP.close()}function iI(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=mr(),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)(ia.Provider,{value:u,children:(0,Q.jsx)(Xi.Provider,{value:void 0,children:(0,Q.jsx)($t,{...e})})})}var aI=500,oI=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:d,initialCursorPointRef:f,rootId:p}=g(!1),{store:m}=at(!1),_=m.useState(`open`),v=m.useState(`disabled`),y=Z.useRef(null),b=Z.useRef(null),x=ye(),S=ye(),C=Z.useRef(!1),w=Z.useRef(null);function T(e,t,n){let r=n.type.startsWith(`touch`);f.current={x:e,y:t},o({getBoundingClientRect(){return DOMRect.fromRect({width:r?10:0,height:r?10:0,x:e,y:t})}}),C.current=!1,s.current?.setOpen(!0,Io(_a,n)),S.start(aI,()=>{C.current=!0})}function E(e){if(v)return;d.current=!0,h(e),T(e.clientX,e.clientY,e.nativeEvent);let t=Fn(y.current);w.current?.abort();let n=new AbortController;w.current=n,t.addEventListener(`mouseup`,e=>{if(d.current=!1,!C.current)return;S.clear(),C.current=!1;let t=Cs(e);Ut(u.current,t)||p&&t&&ss(t)===p||s.current?.setOpen(!1,Io(Qr,e))},{once:!0,signal:n.signal})}function D(){x.clear(),b.current=null}function O(e){if(v){D();return}if(d.current=!1,e.touches.length!==1){D();return}e.stopPropagation();let t=e.touches[0],n={x:t.clientX,y:t.clientY};b.current=n,x.start(aI,()=>{T(n.x,n.y,e.nativeEvent)})}function k(e){if(e.touches.length!==1){D();return}if(x.isStarted()&&b.current){let t=e.touches[0],n=Math.abs(t.clientX-b.current.x),r=Math.abs(t.clientY-b.current.y);(n>10||r>10)&&D()}}return Z.useEffect(()=>()=>{w.current?.abort()},[]),Z.useEffect(()=>{function e(e){if(v)return;let t=Cs(e);(Ut(y.current,t)||Ut(c.current,t)||Ut(l.current,t))&&e.preventDefault()}let t=Fn(y.current);return vn(t,`contextmenu`,e)},[l,v,c]),$o(`div`,e,{state:{open:_},ref:[y,t],props:[{onContextMenu:E,onTouchStart:O,onTouchMove:k,onTouchEnd:D,onTouchCancel:D,style:{WebkitTouchCallout:`none`}},a],stateAttributesMapping:it})}),sI=es;function cI({...e}){return(0,Q.jsx)(iI,{"data-slot":`context-menu`,...e})}function lI({className:e,...t}){return(0,Q.jsx)(oI,{"data-slot":`context-menu-trigger`,className:X(`select-none`,e),...t})}function uI({className:e,align:t=`start`,alignOffset:n=4,side:r=`right`,sideOffset:i=0,...a}){return(0,Q.jsx)(ln,{children:(0,Q.jsx)(sI,{className:`isolate z-50 outline-none`,align:t,alignOffset:n,side:r,sideOffset:i,children:(0,Q.jsx)(te,{"data-slot":`context-menu-content`,className:X(`z-50 max-h-(--available-height) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 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 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 dI({...e}){return(0,Q.jsx)(yt,{"data-slot":`context-menu-group`,...e})}function fI({className:e,inset:t,variant:n=`default`,...r}){return(0,Q.jsx)(z,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:X(`group/context-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 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-3.5 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function pI({className:e,...t}){return(0,Q.jsx)(pi,{"data-slot":`context-menu-separator`,className:X(`-mx-1 my-1 h-px bg-border/50`,e),...t})}function mI({className:e,...t}){return(0,Q.jsx)(`span`,{"data-slot":`context-menu-shortcut`,className:X(`ml-auto text-[0.625rem] tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground`,e),...t})}function hI(e){let t=(0,$.c)(20),{entry:n,connection:r,children:i}=e,a=n.worktreeId,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 py-0.5`}),t[0]=o):o=t[0];let s;t[1]===i?s=t[2]:(s=(0,Q.jsx)(lI,{render:o,children:i}),t[1]=i,t[2]=s);let c;t[3]===n.path?c=t[4]:(c=n.path&&(0,Q.jsxs)(fI,{className:`cursor-pointer`,onClick:()=>n.path&&Yi(n.path,`worktree path`),children:[(0,Q.jsx)(Ud,{}),`Copy worktree path`]}),t[3]=n.path,t[4]=c);let l;t[5]!==r||t[6]!==n||t[7]!==a?(l=n.kind===`worktree`&&a&&(0,Q.jsxs)(fI,{className:`cursor-pointer`,disabled:!n.available,onClick:()=>RP.openWithPayload({entry:n,connection:r,worktreeId:a,requestId:crypto.randomUUID()}),children:[(0,Q.jsx)(Of,{}),`Switch branch`]}),t[5]=r,t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n||t[11]!==a?(u=!n.main&&n.kind===`worktree`&&a&&(0,Q.jsxs)(fI,{variant:`destructive`,className:`cursor-pointer`,disabled:!n.available,onClick:()=>LP.openWithPayload({entry:n,connection:r,worktreeId:a,requestId:crypto.randomUUID()}),children:[(0,Q.jsx)(Pp,{}),`Delete`]}),t[9]=r,t[10]=n,t[11]=a,t[12]=u):u=t[12];let d;t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Q.jsx)(uI,{children:(0,Q.jsxs)(dI,{children:[c,l,u]})}),t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16];let f;return t[17]!==s||t[18]!==d?(f=(0,Q.jsxs)(cI,{children:[s,d]}),t[17]=s,t[18]=d,t[19]=f):f=t[19],f}function gI({className:e,...t}){return(0,Q.jsx)(`kbd`,{"data-slot":`kbd`,className:X(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-xs bg-muted px-1 font-sans text-[0.625rem] font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,e),...t})}function _I({className:e,...t}){return(0,Q.jsx)(`kbd`,{"data-slot":`kbd-group`,className:X(`inline-flex items-center gap-1`,e),...t})}function vI(){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}function yI({className:e,...t}){return(0,Q.jsx)(`textarea`,{"data-slot":`textarea`,className:X(`flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function bI({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:X(`group/input-group relative flex h-7 w-full min-w-0 items-center rounded-md border border-input bg-input/20 transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-2 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-2 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[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 xI=Ea(`flex h-auto cursor-text items-center justify-center gap-1 py-2 text-xs/relaxed font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem]`,"block-start":`order-first w-full justify-start px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function SI({className:e,align:t=`inline-start`,...n}){return(0,Q.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:X(xI({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var CI=Ea(`flex items-center gap-2 rounded-md text-xs/relaxed shadow-none`,{variants:{size:{xs:`h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3`,sm:`gap-1`,"icon-xs":`size-6 p-0 has-[>svg]:p-0`,"icon-sm":`size-7 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function wI({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,Q.jsx)(Y,{type:t,"data-size":r,variant:n,className:X(CI({size:r}),e),...i})}function TI({className:e,...t}){return(0,Q.jsx)(`span`,{className:X(`flex items-center gap-2 text-xs/relaxed text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function EI({className:e,...t}){return(0,Q.jsx)(se,{"data-slot":`input-group-control`,className:X(`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 DI({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty`,className:X(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,e),...t})}function OI({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty-header`,className:X(`flex max-w-sm flex-col items-center gap-1`,e),...t})}Ea(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function kI({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty-title`,className:X(`font-heading text-sm font-medium tracking-tight`,e),...t})}function AI({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty-description`,className:X(`text-xs/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}var jI=1,MI=.9,NI=.8,PI=.17,FI=.1,II=.999,LI=.9999,RI=.99,zI=/[\\\/_+.#"@\[\(\{&]/,BI=/[\\\/_+.#"@\[\(\{&]/g,VI=/[\s-]/,HI=/[\s-]/g;function UI(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?jI:RI;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=UI(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=jI:zI.test(e.charAt(l-1))?(d*=NI,p=e.slice(i,l-1).match(BI),p&&i>0&&(d*=II**+p.length)):VI.test(e.charAt(l-1))?(d*=MI,m=e.slice(i,l-1).match(HI),m&&i>0&&(d*=II**+m.length)):(d*=PI,i>0&&(d*=II**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=LI)),(d<FI&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=UI(e,t,n,r,l+1,a+2,o),f*FI>d&&(d=f*FI)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function WI(e){return e.toLowerCase().replace(HI,` `)}function GI(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,UI(e,t,WI(e),WI(t),0,0,{})}var KI=Object.defineProperty,qI=(e,t)=>KI(e,`name`,{value:t,configurable:!0}),JI=!!(typeof window<`u`&&window.document&&window.document.createElement);function YI(e,t,{checkForDefaultPrevented:n=!0}={}){return qI(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}qI(YI,`composeEventHandlers`);function XI(e){if(!JI)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}qI(XI,`getOwnerWindow`);function ZI(e){if(!JI)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}qI(ZI,`getOwnerDocument`);function QI(e,t=!1){let{activeElement:n}=ZI(e);if(!n?.nodeName)return null;if($I(n)&&n.contentDocument)return QI(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=ZI(n).getElementById(e);if(t)return t}}return n}qI(QI,`getActiveElement`);function $I(e){return e.tagName===`IFRAME`}qI($I,`isFrame`);var eL=Object.defineProperty,tL=(e,t)=>eL(e,`name`,{value:t,configurable:!0});function nL(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}tL(nL,`setRef`);function rL(...e){return t=>{let n=!1,r=e.map(e=>{let r=nL(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():nL(e[t],null)}}}}tL(rL,`composeRefs`);function iL(...e){return Z.useCallback(rL(...e),e)}tL(iL,`useComposedRefs`);var aL=Object.defineProperty,oL=(e,t)=>aL(e,`name`,{value:t,configurable:!0});function sL(e,t){let n=Z.createContext(t);n.displayName=e+`Context`;let r=oL(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 oL(i,`useContext`),[r,i]}oL(sL,`createContext`);function cL(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=oL(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 oL(s,`useContext`),[o,s]}oL(r,`createContext`);let i=oL(()=>{let t=n.map(e=>Z.createContext(e));return oL(function(n){let r=n?.[e]||t;return Z.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,lL(i,...t)]}oL(cL,`createContextScope`);function lL(...e){let t=e[0];if(e.length===1)return t;let n=oL(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return oL(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}oL(lL,`composeContextScopes`);var uL=globalThis?.document?Z.useLayoutEffect:()=>{},dL=Object.defineProperty,fL=(e,t)=>dL(e,`name`,{value:t,configurable:!0}),pL=Z.useId||(()=>void 0),mL=0;function hL(e){let[t,n]=Z.useState(pL());return uL(()=>{e||n(e=>e??String(mL++))},[e]),e||(t?`radix-${t}`:``)}fL(hL,`useId`);var gL=Object.defineProperty,_L=(e,t)=>gL(e,`name`,{value:t,configurable:!0}),vL=Z.useEffectEvent,yL=Z.useInsertionEffect;function bL(e){if(typeof vL==`function`)return vL(e);let t=Z.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof yL==`function`?yL(()=>{t.current=e}):uL(()=>{t.current=e}),Z.useMemo(()=>((...e)=>t.current?.(...e)),[])}_L(bL,`useEffectEvent`);var xL=Object.defineProperty,SL=(e,t)=>xL(e,`name`,{value:t,configurable:!0}),CL=Z.useInsertionEffect||uL;function wL({prop:e,defaultProp:t,onChange:n=SL(()=>{},`onChange`),caller:r}){let[i,a,o]=TL({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,Z.useCallback(t=>{if(s){let n=EL(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}SL(wL,`useControllableState`);function TL({defaultProp:e,onChange:t}){let[n,r]=Z.useState(e),i=Z.useRef(n),a=Z.useRef(t);return CL(()=>{a.current=t},[t]),Z.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}SL(TL,`useUncontrolledState`);function EL(e){return typeof e==`function`}SL(EL,`isFunction`);var DL=Symbol(`RADIX:SYNC_STATE`);function OL(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=bL(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=Z.useReducer((t,n)=>{if(n.type===DL)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:DL,state:i})},[i,d.state,c]),[h,f]}SL(OL,`useControllableStateReducer`);var kL=Object.defineProperty,AL=(e,t)=>kL(e,`name`,{value:t,configurable:!0});function jL(e){let t=Z.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];zL(r)&&typeof UL==`function`&&(r=UL(r._payload)),Z.Children.forEach(r,e=>{if(LL(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;zL(n)&&typeof UL==`function`&&(n=UL(n._payload)),a=PL(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?IL(a):void 0,l=iL(n,c);if(!a){if(r||r===0)throw Error(o?HL(e):VL(e));return r}let u=FL(i,a.props??{});return a.type!==Z.Fragment&&(u.ref=n?l:c),Z.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}AL(jL,`createSlot`);var ML=Symbol.for(`radix.slottable`);function NL(e){let t=AL(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=ML,t}AL(NL,`createSlottable`);var PL=AL((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 FL(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}}AL(FL,`mergeProps`);function IL(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)}AL(IL,`getElementRef`);function LL(e){return Z.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ML}AL(LL,`isSlottable`);var RL=Symbol.for(`react.lazy`);function zL(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===RL&&`_payload`in e&&BL(e._payload)}AL(zL,`isLazyComponent`);function BL(e){return typeof e==`object`&&!!e&&`then`in e}AL(BL,`isPromiseLike`);var VL=AL(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),HL=AL(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),UL=Z.use,WL=Object.defineProperty,GL=(e,t)=>WL(e,`name`,{value:t,configurable:!0}),KL=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=jL(`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 qL(e,t){e&&od.flushSync(()=>e.dispatchEvent(t))}GL(qL,`dispatchDiscreteCustomEvent`);var JL=Object.defineProperty,YL=(e,t)=>JL(e,`name`,{value:t,configurable:!0});function XL(e){let t=Z.useRef(e);return Z.useEffect(()=>{t.current=e}),Z.useMemo(()=>((...e)=>t.current?.(...e)),[])}YL(XL,`useCallbackRef`);var ZL=Object.defineProperty,QL=(e,t)=>ZL(e,`name`,{value:t,configurable:!0}),$L=`dismissableLayer.update`,eR=`dismissableLayer.pointerDownOutside`,tR=`dismissableLayer.focusOutside`,nR,rR=Z.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),iR=Z.forwardRef(QL(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(rR),[d,f]=Z.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=Z.useState({}),h=iL(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=sR(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=cR(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=XL(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&&(nR=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),lR(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=nR))}},[d,p,n,u]),Z.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),lR())},[d,u]),Z.useEffect(()=>{let e=QL(()=>m({}),`handleUpdate`);return document.addEventListener($L,e),()=>document.removeEventListener($L,e)},[]),(0,Q.jsx)(KL.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:YI(e.onFocusCapture,w.onFocusCapture),onBlurCapture:YI(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:YI(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function aR(){let e=Z.useContext(rR),[t,n]=Z.useState(null);return Z.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}QL(aR,`useDismissableLayerSurface`);var oR=QL(()=>!0,`IS_TRUE`);function sR(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=oR}=t,s=XL(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()}QL(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}QL(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)}QL(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}QL(p,`handleInteractionBubble`);let m=QL(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||uR(eR,s,p,{discrete:!0})};if(QL(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:QL(()=>c.current=!0,`onPointerDownCapture`)}}QL(sR,`usePointerDownOutside`);function cR(e,t=globalThis?.document){let n=XL(e),r=Z.useRef(!1);return Z.useEffect(()=>{let e=QL(e=>{e.target&&!r.current&&uR(tR,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:QL(()=>r.current=!0,`onFocusCapture`),onBlurCapture:QL(()=>r.current=!1,`onBlurCapture`)}}QL(cR,`useFocusOutside`);function lR(){let e=new CustomEvent($L);document.dispatchEvent(e)}QL(lR,`dispatchUpdate`);function uR(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?qL(i,a):i.dispatchEvent(a)}QL(uR,`handleAndDispatchCustomEvent`);var dR=Object.defineProperty,fR=(e,t)=>dR(e,`name`,{value:t,configurable:!0}),pR=`focusScope.autoFocusOnMount`,mR=`focusScope.autoFocusOnUnmount`,hR={bubbles:!1,cancelable:!0},gR=Z.forwardRef(fR(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=Z.useState(null),l=XL(i),u=XL(a),d=Z.useRef(null),f=iL(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:CR(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||CR(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&CR(s)};fR(e,`handleFocusIn`),fR(t,`handleFocusOut`),fR(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){wR.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(pR,hR);s.addEventListener(pR,l),s.dispatchEvent(t),t.defaultPrevented||(_R(DR(yR(s)),{select:!0}),document.activeElement===e&&CR(s))}return()=>{s.removeEventListener(pR,l),setTimeout(()=>{let t=new CustomEvent(mR,hR);s.addEventListener(mR,u),s.dispatchEvent(t),t.defaultPrevented||CR(e??document.body,{select:!0}),s.removeEventListener(mR,u),wR.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]=vR(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&CR(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&CR(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,Q.jsx)(KL.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function _R(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(CR(r,{select:t}),document.activeElement!==n)return}fR(_R,`focusFirst`);function vR(e){let t=yR(e);return[bR(t,e),bR(t.reverse(),e)]}fR(vR,`getTabbableEdges`);function yR(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:fR(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}fR(yR,`getTabbableCandidates`);function bR(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):xR(r,{upTo:t})))return r}fR(bR,`findVisible`);function xR(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}fR(xR,`isHidden`);function SR(e){return e instanceof HTMLInputElement&&`select`in e}fR(SR,`isSelectableInput`);function CR(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&SR(e)&&t&&e.select()}}fR(CR,`focus`);var wR=TR();function TR(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ER(e,t),e.unshift(t)},remove(t){e=ER(e,t),e[0]?.resume()}}}fR(TR,`createFocusScopesStack`);function ER(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}fR(ER,`arrayRemove`);function DR(e){return e.filter(e=>e.tagName!==`A`)}fR(DR,`removeLinks`);var OR=Object.defineProperty,kR=Z.forwardRef(((e,t)=>OR(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=Z.useState(!1);uL(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?od.createPortal((0,Q.jsx)(KL.div,{...r,ref:t}),o):null},`Portal`)),AR=Object.defineProperty,jR=(e,t)=>AR(e,`name`,{value:t,configurable:!0});function MR(e,t){return Z.useReducer((e,n)=>t[e][n]??e,e)}jR(MR,`useStateMachine`);var NR=jR(e=>{let{present:t,children:n}=e,r=PR(t),i=typeof n==`function`?n({present:r.isPresent}):Z.Children.only(n),a=IR(r.ref,RR(i));return typeof n==`function`||r.isPresent?Z.cloneElement(i,{ref:a}):null},`Presence`);function PR(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]=MR(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??LR(r.current),o.current=void 0):a.current=`none`},[s]),uL(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=LR(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]),uL(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=jR(a=>{let o=LR(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=jR(e=>{e.target===t&&(a.current=LR(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=LR(t)}else r.current=null;n(e)},[])}}jR(PR,`usePresence`);function FR(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}jR(FR,`setRef`);function IR(...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=FR(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():FR(n[e],null)}}},[])}jR(IR,`useStableComposedRefs`);function LR(e){return e?.animationName||`none`}jR(LR,`getAnimationName`);function RR(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)}jR(RR,`getElementRef`);var zR=Object.defineProperty,BR=(e,t)=>zR(e,`name`,{value:t,configurable:!0}),VR=0,HR=null;function UR(e){return WR(),e.children}BR(UR,`FocusGuards`);function WR(){Z.useEffect(()=>{HR||={start:GR(),end:GR()};let{start:e,end:t}=HR;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),VR++,()=>{VR===1&&(HR?.start.remove(),HR?.end.remove(),HR=null),VR=Math.max(0,VR-1)}},[])}BR(WR,`useFocusGuards`);function GR(){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}BR(GR,`createFocusGuard`);var KR=function(){return KR=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},KR.apply(this,arguments)};function qR(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 JR(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 YR=`right-scroll-bar-position`,XR=`width-before-scroll-bar`,ZR=`with-scroll-bars-hidden`,QR=`--removed-body-scroll-bar-size`;function $R(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function ez(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 tz=typeof window<`u`?Z.useLayoutEffect:Z.useEffect,nz=new WeakMap;function rz(e,t){var n=ez(t||null,function(t){return e.forEach(function(e){return $R(e,t)})});return tz(function(){var t=nz.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||$R(e,null)}),i.forEach(function(e){r.has(e)||$R(e,a)})}nz.set(n,e)},[e]),n}function iz(e){return e}function az(e,t){t===void 0&&(t=iz);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 oz(e){e===void 0&&(e={});var t=az(null);return t.options=KR({async:!0,ssr:!1},e),t}var sz=function(e){var t=e.sideCar,n=qR(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,KR({},n))};sz.isSideCarExport=!0;function cz(e,t){return e.useMedium(t),sz}var lz=oz(),uz=function(){},dz=Z.forwardRef(function(e,t){var n=Z.useRef(null),r=Z.useState({onScrollCapture:uz,onWheelCapture:uz,onTouchMoveCapture:uz}),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=qR(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=rz([n,t]),C=KR(KR({},b),i);return Z.createElement(Z.Fragment,null,u&&Z.createElement(x,{sideCar:lz,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),KR(KR({},C),{ref:S})):Z.createElement(v,KR({},C,{className:c,ref:S}),s))});dz.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},dz.classNames={fullWidth:XR,zeroRight:YR};var fz=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function pz(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=fz();return t&&e.setAttribute(`nonce`,t),e}function mz(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function hz(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var gz=function(){var e=0,t=null;return{add:function(n){e==0&&(t=pz())&&(mz(t,n),hz(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},_z=function(){var e=gz();return function(t,n){Z.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},vz=function(){var e=_z();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},yz={left:0,top:0,right:0,gap:0},bz=function(e){return parseInt(e||``,10)||0},xz=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[bz(n),bz(r),bz(i)]},Sz=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return yz;var t=xz(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])}},Cz=vz(),wz=`data-scroll-locked`,Tz=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
1344
|
-
.${ZR} {
|
|
1345
|
-
overflow: hidden ${r};
|
|
1346
|
-
padding-right: ${s}px ${r};
|
|
1347
|
-
}
|
|
1348
|
-
body[${wz}] {
|
|
1349
|
-
overflow: hidden ${r};
|
|
1350
|
-
overscroll-behavior: contain;
|
|
1351
|
-
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
1352
|
-
padding-left: ${i}px;
|
|
1353
|
-
padding-top: ${a}px;
|
|
1354
|
-
padding-right: ${o}px;
|
|
1355
|
-
margin-left:0;
|
|
1356
|
-
margin-top:0;
|
|
1357
|
-
margin-right: ${s}px ${r};
|
|
1358
|
-
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
.${YR} {
|
|
1362
|
-
right: ${s}px ${r};
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
.${XR} {
|
|
1366
|
-
margin-right: ${s}px ${r};
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
.${YR} .${YR} {
|
|
1370
|
-
right: 0 ${r};
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
.${XR} .${XR} {
|
|
1374
|
-
margin-right: 0 ${r};
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
body[${wz}] {
|
|
1378
|
-
${QR}: ${s}px;
|
|
1379
|
-
}
|
|
1380
|
-
`},Ez=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Dz=function(){Z.useEffect(function(){return document.body.setAttribute(wz,(Ez()+1).toString()),function(){var e=Ez()-1;e<=0?document.body.removeAttribute(wz):document.body.setAttribute(wz,e.toString())}},[])},Oz=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Dz();var a=Z.useMemo(function(){return Sz(i)},[i]);return Z.createElement(Cz,{styles:Tz(a,!t,i,n?``:`!important`)})},kz=!1;if(typeof window<`u`)try{var Az=Object.defineProperty({},"passive",{get:function(){return kz=!0,!0}});window.addEventListener(`test`,Az,Az),window.removeEventListener(`test`,Az,Az)}catch{kz=!1}var jz=kz?{passive:!1}:!1,Mz=function(e){return e.tagName===`TEXTAREA`},Nz=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Mz(e)&&n[t]===`visible`)},Pz=function(e){return Nz(e,`overflowY`)},Fz=function(e){return Nz(e,`overflowX`)},Iz=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),zz(e,r)){var i=Bz(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Lz=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Rz=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},zz=function(e,t){return e===`v`?Pz(t):Fz(t)},Bz=function(e,t){return e===`v`?Lz(t):Rz(t)},Vz=function(e,t){return e===`h`&&t===`rtl`?-1:1},Hz=function(e,t,n,r,i){var a=Vz(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=Bz(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&zz(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},Uz=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Wz=function(e){return[e.deltaX,e.deltaY]},Gz=function(e){return e&&`current`in e?e.current:e},Kz=function(e,t){return e[0]===t[0]&&e[1]===t[1]},qz=function(e){return`
|
|
1381
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
1382
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
1383
|
-
`},Jz=0,Yz=[];function Xz(e){var t=Z.useRef([]),n=Z.useRef([0,0]),r=Z.useRef(),i=Z.useState(Jz++)[0],a=Z.useState(vz)[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=JR([e.lockRef.current],(e.shards||[]).map(Gz),!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=Uz(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=Iz(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Iz(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 Hz(h,t,e,h===`h`?s:c,!0)},[]),c=Z.useCallback(function(e){var n=e;if(Yz.length&&Yz[Yz.length-1]===a){var r=`deltaY`in n?Wz(n):Uz(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Kz(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Gz).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:Zz(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=Uz(e),r.current=void 0},[]),d=Z.useCallback(function(t){l(t.type,Wz(t),t.target,s(t,e.lockRef.current))},[]),f=Z.useCallback(function(t){l(t.type,Uz(t),t.target,s(t,e.lockRef.current))},[]);Z.useEffect(function(){return Yz.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,jz),document.addEventListener(`touchmove`,c,jz),document.addEventListener(`touchstart`,u,jz),function(){Yz=Yz.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,jz),document.removeEventListener(`touchmove`,c,jz),document.removeEventListener(`touchstart`,u,jz)}},[]);var p=e.removeScrollBar,m=e.inert;return Z.createElement(Z.Fragment,null,m?Z.createElement(a,{styles:qz(i)}):null,p?Z.createElement(Oz,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Zz(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Qz=cz(lz,Xz),$z=Z.forwardRef(function(e,t){return Z.createElement(dz,KR({},e,{ref:t,sideCar:Qz}))});$z.classNames=dz.classNames;var eB=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},tB=new WeakMap,nB=new WeakMap,rB={},iB=0,aB=function(e){return e&&(e.host||aB(e.parentNode))},oB=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=aB(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})},sB=function(e,t,n,r){var i=oB(t,Array.isArray(e)?e:[e]);rB[n]||(rB[n]=new WeakMap);var a=rB[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=(tB.get(e)||0)+1,l=(a.get(e)||0)+1;tB.set(e,c),a.set(e,l),o.push(e),c===1&&i&&nB.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(),iB++,function(){o.forEach(function(e){var t=tB.get(e)-1,i=a.get(e)-1;tB.set(e,t),a.set(e,i),t||(nB.has(e)||e.removeAttribute(r),nB.delete(e)),i||e.removeAttribute(n)}),iB--,iB||(tB=new WeakMap,tB=new WeakMap,nB=new WeakMap,rB={})}},cB=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||eB(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),sB(r,i,n,`aria-hidden`)):function(){return null}},lB=Object.defineProperty,uB=(e,t)=>lB(e,`name`,{value:t,configurable:!0}),dB=`Dialog`,[fB,pB]=cL(dB),[mB,hB]=fB(dB),gB=uB(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]=wL({prop:r,defaultProp:i??!1,onChange:a,caller:dB}),[d,f]=Z.useState(0),[p,m]=Z.useState(0);return(0,Q.jsx)(mB,{scope:t,triggerRef:s,contentRef:c,contentId:hL(),titleId:hL(),descriptionId:hL(),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`),_B=`DialogPortal`,[vB,yB]=fB(_B,{forceMount:void 0}),bB=uB(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=hB(_B,t);return(0,Q.jsx)(vB,{scope:t,forceMount:n,children:Z.Children.map(r,e=>(0,Q.jsx)(NR,{present:n||a.open,children:(0,Q.jsx)(kR,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),xB=`DialogOverlay`,SB=Z.forwardRef(uB(function(e,t){let n=yB(xB,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=hB(xB,e.__scopeDialog);return a.modal?(0,Q.jsx)(NR,{present:r||a.open,children:(0,Q.jsx)(wB,{...i,ref:t})}):null},`DialogOverlay`)),CB=jL(`DialogOverlay.RemoveScroll`),wB=Z.forwardRef(uB(function(e,t){let{__scopeDialog:n,...r}=e,i=hB(xB,n),a=iL(t,aR());return(0,Q.jsx)($z,{as:CB,allowPinchZoom:!0,shards:[i.contentRef],children:(0,Q.jsx)(KL.div,{"data-state":AB(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),TB=`DialogContent`,EB=Z.forwardRef(uB(function(e,t){let n=yB(TB,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=hB(TB,e.__scopeDialog);return(0,Q.jsx)(NR,{present:r||a.open,children:a.modal?(0,Q.jsx)(DB,{...i,ref:t}):(0,Q.jsx)(OB,{...i,ref:t})})},`DialogContent`)),DB=Z.forwardRef(uB(function(e,t){let n=hB(TB,e.__scopeDialog),r=Z.useRef(null),i=iL(t,n.contentRef,r);return Z.useEffect(()=>{let e=r.current;if(e)return cB(e)},[]),(0,Q.jsx)(kB,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:YI(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:YI(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:YI(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),OB=Z.forwardRef(uB(function(e,t){let n=hB(TB,e.__scopeDialog),r=Z.useRef(!1),i=Z.useRef(!1);return(0,Q.jsx)(kB,{...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`)),kB=Z.forwardRef(uB(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=hB(TB,n);return WR(),(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(gR,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,Q.jsx)(iR,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":AB(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`));function AB(e){return e?`open`:`closed`}uB(AB,`getState`);var jB=`[cmdk-group=""]`,MB=`[cmdk-group-items=""]`,NB=`[cmdk-group-heading=""]`,PB=`[cmdk-item=""]`,FB=`${PB}:not([aria-disabled="true"])`,IB=`cmdk-item-select`,LB=`data-value`,RB=(e,t,n)=>GI(e,t,n),zB=Z.createContext(void 0),BB=()=>Z.useContext(zB),VB=Z.createContext(void 0),HB=()=>Z.useContext(VB),UB=Z.createContext(void 0),WB=Z.forwardRef((e,t)=>{let n=iV(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=iV(()=>new Set),i=iV(()=>new Map),a=iV(()=>new Map),o=iV(()=>new Set),s=nV(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=hL(),y=hL(),b=hL(),x=Z.useRef(null),S=sV();rV(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),rV(()=>{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??RB;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(MB);t?t.appendChild(e.parentElement===t?e:e.closest(`${MB} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${MB} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${jB}[${LB}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(LB);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(jB)?.querySelector(NB))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${PB}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(FB)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(LB))}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(LB))}function P(e){let t=A()?.closest(jB),n;for(;t&&!n;)t=e>0?eV(t,jB):tV(t,jB),n=t?.querySelector(FB);n?C.setState(`value`,n.getAttribute(LB)):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(KL.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(IB);t.dispatchEvent(e)}}}}},Z.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:uV},c),lV(e,e=>Z.createElement(VB.Provider,{value:C},Z.createElement(zB.Provider,{value:w},e))))}),GB=Z.forwardRef((e,t)=>{let n=hL(),r=Z.useRef(null),i=Z.useContext(UB),a=BB(),o=nV(e),s=o.current?.forceMount??i?.forceMount;rV(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=oV(n,r,[e.value,e.children,r],e.keywords),l=HB(),u=aV(e=>e.value&&e.value===c.current),d=aV(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(IB,f),()=>t.removeEventListener(IB,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(KL.div,{ref:rL(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)}),KB=Z.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=hL(),s=Z.useRef(null),c=Z.useRef(null),l=hL(),u=BB(),d=aV(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));rV(()=>u.group(o),[]),oV(o,s,[e.value,e.heading,c]);let f=Z.useMemo(()=>({id:o,forceMount:i}),[i]);return Z.createElement(KL.div,{ref:rL(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),lV(e,e=>Z.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},Z.createElement(UB.Provider,{value:f},e))))}),qB=Z.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Z.useRef(null),a=aV(e=>!e.search);return!n&&!a?null:Z.createElement(KL.div,{ref:rL(i,t),...r,"cmdk-separator":``,role:`separator`})}),JB=Z.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=HB(),o=aV(e=>e.search),s=aV(e=>e.selectedItemId),c=BB();return Z.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),Z.createElement(KL.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)}})}),YB=Z.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=Z.useRef(null),o=Z.useRef(null),s=aV(e=>e.selectedItemId),c=BB();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(KL.div,{ref:rL(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},lV(e,e=>Z.createElement(`div`,{ref:rL(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),XB=Z.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return Z.createElement(gB,{open:n,onOpenChange:r},Z.createElement(bB,{container:o},Z.createElement(SB,{"cmdk-overlay":``,className:i}),Z.createElement(EB,{"aria-label":e.label,"cmdk-dialog":``,className:a},Z.createElement(WB,{ref:t,...s}))))}),ZB=Z.forwardRef((e,t)=>aV(e=>e.filtered.count===0)?Z.createElement(KL.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),QB=Z.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return Z.createElement(KL.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},lV(e,e=>Z.createElement(`div`,{"aria-hidden":!0},e)))}),$B=Object.assign(WB,{List:YB,Item:GB,Input:JB,Group:KB,Separator:qB,Dialog:XB,Empty:ZB,Loading:QB});function eV(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function tV(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function nV(e){let t=Z.useRef(e);return rV(()=>{t.current=e}),t}var rV=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function iV(e){let t=Z.useRef();return t.current===void 0&&(t.current=e()),t}function aV(e){let t=HB(),n=()=>e(t.snapshot());return Z.useSyncExternalStore(t.subscribe,n,n)}function oV(e,t,n,r=[]){let i=Z.useRef(),a=BB();return rV(()=>{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(LB,s),i.current=s}),i}var sV=()=>{let[e,t]=Z.useState(),n=iV(()=>new Map);return rV(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function cV(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function lV({asChild:e,children:t},n){return e&&Z.isValidElement(t)?Z.cloneElement(cV(t),{ref:t.ref},n(t.props.children)):n(t)}var uV={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function dV({className:e,...t}){return(0,Q.jsx)($B,{"data-slot":`command`,className:X(`flex size-full flex-col overflow-hidden rounded-xl bg-popover p-1 text-popover-foreground`,e),...t})}function fV({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!1,...a}){return(0,Q.jsxs)(JP,{...a,children:[(0,Q.jsxs)(eF,{className:`sr-only`,children:[(0,Q.jsx)(nF,{children:e}),(0,Q.jsx)(rF,{children:t})]}),(0,Q.jsx)($P,{className:X(`top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0`,r),showCloseButton:i,children:n})]})}function pV({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,Q.jsxs)(bI,{className:`h-8! bg-input/20 dark:bg-input/30`,children:[(0,Q.jsx)($B.Input,{"data-slot":`command-input`,className:X(`w-full text-xs/relaxed outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,Q.jsx)(SI,{children:(0,Q.jsx)(vp,{className:`size-3.5 shrink-0 opacity-50`})})]})})}function mV({className:e,...t}){return(0,Q.jsx)($B.List,{"data-slot":`command-list`,className:X(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function hV({className:e,...t}){return(0,Q.jsx)($B.Empty,{"data-slot":`command-empty`,className:X(`py-6 text-center text-xs/relaxed`,e),...t})}function gV({className:e,...t}){return(0,Q.jsx)($B.Group,{"data-slot":`command-group`,className:X(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2.5 **:[[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 _V({className:e,children:t,...n}){return(0,Q.jsxs)($B.Item,{"data-slot":`command-item`,className:X(`group/command-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2.5 py-1.5 text-xs/relaxed outline-hidden select-none in-data-[slot=dialog-content]:rounded-md 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-3.5 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,Q.jsx)(ir,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}var vV=so(e=>Br(t=>{t.mount(e);let n=t.registry;t.addFinalizer(()=>{n.getNodes().has(e)&&(n.get(e).waiting||n.set(e,Ca))})}));function yV(e){let t=(0,$.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={mode:`promise`},t[0]=n):n=t[0];let r=xa(e,n),i;return t[1]===e?i=t[2]:(i=vV(e),t[1]=e,t[2]=i),ao(i),r}function bV(e,t){let n=(0,$.c)(6),[r,i]=yV(e),a;n[0]!==t||n[1]!==i?(a=e=>i(e).then(t,xV),n[0]=t,n[1]=i,n[2]=a):a=n[2];let o;return n[3]!==r||n[4]!==a?(o={result:r,submit:a},n[3]=r,n[4]=a,n[5]=o):o=n[5],o}function xV(){}function SV(e,t){let n=(0,$.c)(2),r;return n[0]===e?r=n[1]:(r=Kn(e),n[0]=e,n[1]=r),bV(r,t)}function CV(e,t){let n=(0,$.c)(2),r;return n[0]===e?r=n[1]:(r=je(e),n[0]=e,n[1]=r),bV(r,t)}var wV=Xt;function TV(e,t,n){let r=(0,$.c)(13),i;r[0]===e?i=r[1]:(i=ie(e),r[0]=e,r[1]=i);let[a,o]=yV(i),s=on(),c=ds(),l=xi(),u;r[2]!==t||r[3]!==s?.environmentId||r[4]!==l||r[5]!==n||r[6]!==c||r[7]!==o||r[8]!==e?(u=(r,i,a)=>o(r).then(async r=>{if(!r.deleted){i(r.plan);return}n();let a=c.state.matches.at(-1)?.params;if(!r.plan.worktreePath||!a||!(`worktreeId`in a)||!(`projectId`in a)||a.worktreeId!==e.scope.worktreeId||a.projectId!==e.scope.projectId)return;let o=`environmentId`in a?a.environmentId:s?.environmentId;o===e.connection.environmentId&&(t.review.state===`available`?await l({to:`/reviews/$reviewId`,params:{reviewId:t.review.reviewId},search:{environment:o===s?.environmentId?void 0:o,decision:void 0}}):await l({to:`/`}))},a),r[2]=t,r[3]=s?.environmentId,r[4]=l,r[5]=n,r[6]=c,r[7]=o,r[8]=e,r[9]=u):u=r[9];let d;return r[10]!==a||r[11]!==u?(d={result:a,submit:u},r[10]=a,r[11]=u,r[12]=d):d=r[12],d}function EV(e){let t=(0,$.c)(15),n;t[0]===e?n=t[1]:(n=qe(e),t[0]=e,t[1]=n);let[r,i]=yV(n),a;t[2]===e?a=t[3]:(a=we(e),t[2]=e,t[3]=a);let[o,s]=yV(a),[c,l]=(0,Z.useState)(!1),u;t[4]===e?u=t[5]:(u=he(e),t[4]=e,t[5]=u);let{unresolved:d}=Ii(u),f=c?o:r,p=r.waiting||o.waiting,m;t[6]!==s||t[7]!==i||t[8]!==d?(m=(e,t)=>{l(d);let n;if(d)n=s(void 0);else if(e)n=i(e);else return;return n.then(e=>{(e.state===`succeeded`||e.state===`no-change`)&&t()},DV)},t[6]=s,t[7]=i,t[8]=d,t[9]=m):m=t[9];let h;return t[10]!==f||t[11]!==p||t[12]!==m||t[13]!==d?(h={result:f,pending:p,unresolved:d,submit:m},t[10]=f,t[11]=p,t[12]=m,t[13]=d,t[14]=h):h=t[14],h}function DV(){}function OV(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(Jo,{handle:RP,children:kV}),e[0]=t):t=e[0],t}function kV(e){let{payload:t}=e;return t&&(0,Q.jsx)(AV,{...t},t.requestId)}function AV(e){let t=(0,$.c)(66),{connection:n,entry:r,worktreeId:i}=e,[a,o]=(0,Z.useState)(),s;t[0]!==r.projectId||t[1]!==i?(s={projectId:r.projectId,worktreeId:i},t[0]=r.projectId,t[1]=i,t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==s?(c={connection:n,scope:s},t[3]=n,t[4]=s,t[5]=c):c=t[5];let{result:l,pending:u,unresolved:d,submit:p}=EV(c),m;t[6]!==r.projectId||t[7]!==i?(m={projectId:r.projectId,worktreeId:i},t[6]=r.projectId,t[7]=i,t[8]=m):m=t[8];let{result:h}=yP(m,n,!0),g=Ts(Te(h)),_;t[9]===r.projectId?_=t[10]:(_=e=>e.id===r.projectId,t[9]=r.projectId,t[10]=_);let v=qP(n).projects.find(_),y=Ll(g?.bases??[],v?.worktrees??[],i),b;t[11]===a?b=t[12]:(b=e=>e.ref===a&&!e.current&&!e.inUse,t[11]=a,t[12]=b);let x=y.some(b),S=`Switch branch`;d&&(S=`Check outcome`),u&&(S=`Checking switch`);let C=$P,w=!u,T;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(nF,{children:`Switch branch`}),t[13]=T):T=t[13];let E;t[14]===r.name?E=t[15]:(E=(0,Q.jsxs)(eF,{children:[T,(0,Q.jsxs)(rF,{children:[`Choose a branch for `,r.name,`. Branches used by another worktree are unavailable.`]})]}),t[14]=r.name,t[15]=E);let D=dV,O;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(pV,{"aria-label":`Find a branch`,placeholder:`Find a branch`}),t[16]=O):O=t[16];let k=mV,A;t[17]===h?A=t[18]:(A=qi(h)&&(0,Q.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-muted-foreground`,children:`Reading branches`}),t[17]=h,t[18]=A);let j;t[19]===h?j=t[20]:(j=f(h)&&(0,Q.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-muted-foreground`,children:`Branches could not be read.`}),t[19]=h,t[20]=j);let M=g&&(0,Q.jsx)(hV,{children:`No matching branch`}),N=gV,P;t[21]!==a||t[22]!==u||t[23]!==d?(P=e=>(0,Q.jsxs)(_V,{value:e.name,disabled:u||d||e.current||e.inUse,onSelect:()=>o(e.ref),"data-checked":a===e.ref,className:`cursor-pointer`,children:[(0,Q.jsx)(Of,{}),(0,Q.jsx)(fr,{text:e.name,className:`min-w-0 flex-1`}),e.current&&(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Current`}),e.inUse&&(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`In use`}),a===e.ref&&(0,Q.jsx)(ir,{})]},e.ref),t[21]=a,t[22]=u,t[23]=d,t[24]=P):P=t[24];let F=y.map(P),I;t[25]!==N||t[26]!==F?(I=(0,Q.jsx)(N,{children:F}),t[25]=N,t[26]=F,t[27]=I):I=t[27];let L;t[28]!==k||t[29]!==A||t[30]!==j||t[31]!==M||t[32]!==I?(L=(0,Q.jsxs)(k,{"aria-label":`Branches`,children:[A,j,M,I]}),t[28]=k,t[29]=A,t[30]=j,t[31]=M,t[32]=I,t[33]=L):L=t[33];let R;t[34]!==D||t[35]!==L||t[36]!==O?(R=(0,Q.jsxs)(D,{children:[O,L]}),t[34]=D,t[35]=L,t[36]=O,t[37]=R):R=t[37];let z;t[38]===d?z=t[39]:(z=d&&(0,Q.jsx)(`p`,{role:`status`,children:`The previous switch is not confirmed. Check its outcome before switching again.`}),t[38]=d,t[39]=z);let B;t[40]===l?B=t[41]:(B=f(l)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:String(ht(l.cause))}),t[40]=l,t[41]=B);let V;t[42]===l?V=t[43]:(V=tt(l)&&l.value.state!==`succeeded`&&l.value.state!==`no-change`&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:l.value.message??`The branch could not be switched.`}),t[42]=l,t[43]=V);let H;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(Y,{variant:`outline`}),t[44]=H):H=t[44];let U;t[45]===u?U=t[46]:(U=(0,Q.jsx)(ZP,{render:H,disabled:u,children:`Cancel`}),t[45]=u,t[46]=U);let W=u||!d&&!x,G;t[47]!==a||t[48]!==p?(G=()=>void p(a,jV),t[47]=a,t[48]=p,t[49]=G):G=t[49];let K;t[50]!==S||t[51]!==W||t[52]!==G?(K=(0,Q.jsx)(Y,{disabled:W,onClick:G,children:S}),t[50]=S,t[51]=W,t[52]=G,t[53]=K):K=t[53];let ee;t[54]!==U||t[55]!==K?(ee=(0,Q.jsxs)(tF,{children:[U,K]}),t[54]=U,t[55]=K,t[56]=ee):ee=t[56];let q;return t[57]!==C||t[58]!==R||t[59]!==z||t[60]!==B||t[61]!==V||t[62]!==ee||t[63]!==w||t[64]!==E?(q=(0,Q.jsxs)(C,{showCloseButton:w,children:[E,R,z,B,V,ee]}),t[57]=C,t[58]=R,t[59]=z,t[60]=B,t[61]=V,t[62]=ee,t[63]=w,t[64]=E,t[65]=q):q=t[65],q}function jV(){return RP.close()}function MV(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(nM,{handle:LP,children:NV}),e[0]=t):t=e[0],t}function NV(e){let{payload:t}=e;return t&&(0,Q.jsx)(PV,{...t},t.requestId)}function PV(e){let t=(0,$.c)(21),{entry:n,connection:r,worktreeId:i}=e,a=Vs(r),o;t[0]===a?o=t[1]:(o=zc(a),t[0]=a,t[1]=o);let s=o,c;t[2]===a?c=t[3]:(c=Js(a),t[2]=a,t[3]=c);let l=c,u;t[4]===n.name?u=t[5]:(u=(0,Q.jsxs)(pM,{children:[`Delete `,n.name,`?`]}),t[4]=n.name,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(mM,{children:`Choose what to delete this time. Your saved settings won’t change. Review history stays available.`}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Q.jsxs)(dM,{children:[u,d]}),t[7]=u,t[8]=f);let p;t[9]!==l||t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==i?(p=s?(0,Q.jsx)(FV,{settings:s,entry:n,connection:r,worktreeId:i}):(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:l??`Reading deletion settings…`}),t[9]=l,t[10]=r,t[11]=n,t[12]=s,t[13]=i,t[14]=p):p=t[14];let m;t[15]===s?m=t[16]:(m=!s&&(0,Q.jsx)(gM,{children:`Cancel`}),t[15]=s,t[16]=m);let h;return t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,Q.jsxs)(uM,{children:[f,p,m]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function FV(e){let t=(0,$.c)(56),{settings:n,entry:r,connection:i,worktreeId:a}=e,{detached:o}=r,s;t[0]!==o||t[1]!==n?(s=()=>Ws(n,o),t[0]=o,t[1]=n,t[2]=s):s=t[2];let[c,l]=(0,Z.useState)(s),[u,d]=(0,Z.useState)(),[p,m]=(0,Z.useState)(!1),h;t[3]!==r.projectId||t[4]!==a?(h={projectId:r.projectId,worktreeId:a},t[3]=r.projectId,t[4]=a,t[5]=h):h=t[5];let g;t[6]!==i||t[7]!==h?(g={connection:i,scope:h},t[6]=i,t[7]=h,t[8]=g):g=t[8];let{result:_,submit:v}=TV(g,r,IV),y;t[9]!==p||t[10]!==c||t[11]!==u||t[12]!==v?(y=()=>void v({options:c,...u?{confirmation:{plan:u,discardChanges:p}}:{}},d,()=>{d(void 0),m(!1)}),t[9]=p,t[10]=c,t[11]=u,t[12]=v,t[13]=y):y=t[13];let b=y,x=_.waiting,S=Object.values(c).some(Boolean),C=u&&(u.dirty||u.unpushed),w=u&&!u.worktreePath&&!u.localBranch&&!u.remoteBranch,T=`Review deletion`;u&&(T=`Delete`),x&&(T=`Checking`);let E;t[14]!==o||t[15]!==c||t[16]!==x?(E=Cc.map(e=>{let{key:t,label:n}=e;return(0,Q.jsxs)(zi,{orientation:`horizontal`,children:[(0,Q.jsx)(Vr,{htmlFor:`delete-${t}`,children:n}),(0,Q.jsx)(Wr,{id:`delete-${t}`,checked:c[t],disabled:x||o&&t!==`deleteWorktree`,onCheckedChange:e=>{l(n=>({...n,[t]:e})),d(void 0),m(!1)},className:`cursor-pointer`})]},t)}),t[14]=o,t[15]=c,t[16]=x,t[17]=E):E=t[17];let D;t[18]===o?D=t[19]:(D=o&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This worktree is detached: there is no checked-out branch to delete.`}),t[18]=o,t[19]=D);let O;t[20]!==o||t[21]!==c?(O=!o&&!c.deleteWorktree&&c.deleteLocalBranch&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Keep the worktree folder and its files, detach it from the branch, then delete the local branch.`}),t[20]=o,t[21]=c,t[22]=O):O=t[22];let k;t[23]!==o||t[24]!==c?(k=!o&&c.deleteWorktree&&!c.deleteLocalBranch&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The worktree folder will be deleted. The local branch will be kept.`}),t[23]=o,t[24]=c,t[25]=k):k=t[25];let A;t[26]!==E||t[27]!==D||t[28]!==O||t[29]!==k?(A=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[E,D,O,k]}),t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A):A=t[30];let j;t[31]!==r.path||t[32]!==u?(j=u?(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-all text-xs text-muted-foreground`,children:dc(u)}):(0,Q.jsx)(`p`,{className:`break-all text-xs text-muted-foreground`,children:r.path}),t[31]=r.path,t[32]=u,t[33]=j):j=t[33];let M;t[34]!==p||t[35]!==x||t[36]!==C?(M=C&&(0,Q.jsxs)(zi,{orientation:`horizontal`,children:[(0,Q.jsx)(Vr,{htmlFor:`delete-discard-changes`,children:`I understand the risk of losing changes and commits`}),(0,Q.jsx)(Wr,{id:`delete-discard-changes`,checked:p,disabled:x,onCheckedChange:m,className:`cursor-pointer`})]}),t[34]=p,t[35]=x,t[36]=C,t[37]=M):M=t[37];let N;t[38]===_?N=t[39]:(N=f(_)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:hc(ht(_.cause))}),t[38]=_,t[39]=N);let P;t[40]===x?P=t[41]:(P=(0,Q.jsx)(gM,{disabled:x,children:`Cancel`}),t[40]=x,t[41]=P);let F=u?`destructive`:`default`,I=x||!S||!!(w||C&&!p),L;t[42]!==T||t[43]!==b||t[44]!==F||t[45]!==I?(L=(0,Q.jsx)(Y,{variant:F,disabled:I,onClick:b,children:T}),t[42]=T,t[43]=b,t[44]=F,t[45]=I,t[46]=L):L=t[46];let R;t[47]!==P||t[48]!==L?(R=(0,Q.jsxs)(fM,{children:[P,L]}),t[47]=P,t[48]=L,t[49]=R):R=t[49];let z;return t[50]!==j||t[51]!==M||t[52]!==N||t[53]!==R||t[54]!==A?(z=(0,Q.jsxs)(Q.Fragment,{children:[A,j,M,N,R]}),t[50]=j,t[51]=M,t[52]=N,t[53]=R,t[54]=A,t[55]=z):z=t[55],z}function IV(){return LP.close()}function LV(e){let t=(0,$.c)(31),{environmentId:n,environmentName:r,project:i}=e,a;t[0]!==n||t[1]!==i?(a={project:i,remote:n},t[0]=n,t[1]=i,t[2]=a):a=t[2];let o=a,s;t[3]===i?s=t[4]:(s={label:`Copy path`,icon:He,run:()=>Yi(Qa(i),`project path`),destructive:!1},t[3]=i,t[4]=s);let c;t[5]===o?c=t[6]:(c={label:`Rename project`,icon:C,run:()=>PP.openWithPayload(o),destructive:!1},t[5]=o,t[6]=c);let l;t[7]===o?l=t[8]:(l={label:`Remove from Porcelain`,icon:Sf,run:()=>FP.openWithPayload(o),destructive:!0},t[7]=o,t[8]=l);let u;t[9]!==s||t[10]!==c||t[11]!==l?(u=[s,c,l],t[9]=s,t[10]=c,t[11]=l,t[12]=u):u=t[12];let d=u,f=`Project actions: ${i.name} · ${r}`,p;t[13]===f?p=t[14]:(p=(0,Q.jsx)(Pr,{render:(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":f})}),t[13]=f,t[14]=p);let m;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(Yd,{}),t[15]=m):m=t[15];let h;t[16]===p?h=t[17]:(h=(0,Q.jsx)(De,{render:p,children:m}),t[16]=p,t[17]=h);let g;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(Et,{children:`Project actions`}),t[18]=g):g=t[18];let _;t[19]===h?_=t[20]:(_=(0,Q.jsxs)(dt,{disableHoverablePopup:!0,children:[h,g]}),t[19]=h,t[20]=_);let v;t[21]===i?v=t[22]:(v=!i.available&&(0,Q.jsx)(Ko,{children:Me(i)}),t[21]=i,t[22]=v);let y;t[23]===d?y=t[24]:(y=d.map(RV),t[23]=d,t[24]=y);let b;t[25]!==v||t[26]!==y?(b=(0,Q.jsx)(Ni,{className:`w-56 max-w-[calc(100vw-2rem)]`,children:(0,Q.jsxs)(Ei,{children:[v,y]})}),t[25]=v,t[26]=y,t[27]=b):b=t[27];let x;return t[28]!==_||t[29]!==b?(x=(0,Q.jsxs)(Ja,{children:[_,b]}),t[28]=_,t[29]=b,t[30]=x):x=t[30],x}function RV(e){let{label:t,icon:n,run:r,destructive:i}=e;return(0,Q.jsxs)(hr,{className:`cursor-pointer`,variant:i?`destructive`:`default`,onClick:r,children:[(0,Q.jsx)(n,{}),t]},t)}function zV(e){let t=(0,$.c)(20),{projectName:n,environmentName:r,environmentIcon:i,showEnvironment:a}=e,o=`${n}\n${r}`,[s,c]=(0,Z.useState)(),l=s?.names===o,u=`Computer: ${r}`,d;t[0]!==s||t[1]!==l||t[2]!==o||t[3]!==a?(d=e=>{if(!e||!a)return;let t=[...e.querySelectorAll(`[data-truncated]`)],n=!0,r=()=>{if(!n)return;let r=e.clientWidth;l?r>s.width&&c(void 0):t.some(BV)&&c({names:o,width:r})};r();let i=new ResizeObserver(r);i.observe(e);for(let e of t)i.observe(e);let u=()=>c(void 0);return document.fonts.addEventListener(`loadingdone`,u),()=>{n=!1,i.disconnect(),document.fonts.removeEventListener(`loadingdone`,u)}},t[0]=s,t[1]=l,t[2]=o,t[3]=a,t[4]=d):d=t[4];let f=d,p=`${n} · ${r}`,m;t[5]===n?m=t[6]:(m=(0,Q.jsx)(fr,{text:n}),t[5]=n,t[6]=m);let h;t[7]!==p||t[8]!==m?(h=(0,Q.jsx)(li,{"aria-label":p,className:`min-w-0 flex-1`,children:m}),t[7]=p,t[8]=m,t[9]=h):h=t[9];let g;t[10]!==i||t[11]!==u||t[12]!==r||t[13]!==l||t[14]!==a?(g=a&&(l?(0,Q.jsxs)(dt,{disableHoverablePopup:!0,children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(We,{variant:`secondary`,role:`img`,tabIndex:0,"aria-label":u}),children:(0,Q.jsx)(_i,{icon:i})}),(0,Q.jsx)(Et,{children:r})]}):(0,Q.jsxs)(We,{variant:`secondary`,className:`max-w-20`,role:`img`,"aria-label":u,children:[(0,Q.jsx)(_i,{icon:i}),(0,Q.jsx)(fr,{text:r})]})),t[10]=i,t[11]=u,t[12]=r,t[13]=l,t[14]=a,t[15]=g):g=t[15];let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Q.jsxs)(`div`,{ref:f,className:`flex min-w-0 flex-1 items-center gap-1`,children:[h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function BV(e){return e.scrollWidth>e.clientWidth}function VV(e){let t=(0,$.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-col leading-tight`,children:(0,Q.jsx)(fr,{className:`text-sm font-semibold tracking-tight`,text:`Porcelain`})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Q.jsxs)(`header`,{className:`desktop-sidebar-header mt-0.5 flex h-10 shrink-0 items-center gap-2 px-2`,children:[r,n]}),t[1]=n,t[2]=i),i}function HV(e){let t=(0,$.c)(23),{remotes:n,onOpenProject:r}=e;if(!n?.length){let e;t[0]===r?e=t[1]:(e=(0,Q.jsx)(Gr,{className:`relative top-0 right-0 ml-auto w-6 cursor-pointer`,"aria-label":`Open project`,onClick:()=>r(null)}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(up,{className:`text-muted-foreground`}),t[2]=n):n=t[2];let i;t[3]===e?i=t[4]:(i=(0,Q.jsx)(De,{render:e,children:n}),t[3]=e,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Et,{role:`tooltip`,children:`Open project`}),t[5]=a):a=t[5];let o;return t[6]===i?o=t[7]:(o=(0,Q.jsxs)(dt,{disableHoverablePopup:!0,children:[i,a]}),t[6]=i,t[7]=o),o}let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsxs)(dt,{disableHoverablePopup:!0,children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Pr,{render:(0,Q.jsx)(Gr,{className:`relative top-0 right-0 ml-auto w-6 cursor-pointer`,"aria-label":`Open project`})}),children:(0,Q.jsx)(up,{className:`text-muted-foreground`})}),(0,Q.jsx)(Et,{role:`tooltip`,children:`Open project`})]}),t[8]=i):i=t[8];let a;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Ko,{children:`Open project on`}),t[9]=a):a=t[9];let o;t[10]===r?o=t[11]:(o=()=>r(null),t[10]=r,t[11]=o);let s;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Tn,{}),t[12]=s):s=t[12];let c;t[13]===o?c=t[14]:(c=(0,Q.jsxs)(hr,{onClick:o,children:[s,`This computer`]}),t[13]=o,t[14]=c);let l;if(t[15]!==r||t[16]!==n){let e;t[18]===r?e=t[19]:(e=e=>(0,Q.jsx)(UV,{entry:e,onOpen:()=>r(e)},e.remote.environmentId),t[18]=r,t[19]=e),l=n.map(e),t[15]=r,t[16]=n,t[17]=l}else l=t[17];let u;return t[20]!==c||t[21]!==l?(u=(0,Q.jsxs)(Ja,{children:[i,(0,Q.jsx)(Ni,{align:`end`,className:`w-56`,children:(0,Q.jsxs)(Ei,{children:[a,c,l]})})]}),t[20]=c,t[21]=l,t[22]=u):u=t[22],u}function UV(e){let t=(0,$.c)(11),{entry:n,onOpen:r}=e,i=ps(n.remote),a=i.kind===`online`,o=!a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Ss,{}),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)(fr,{className:`min-w-0`,text:c}),t[1]=c,t[2]=l);let u;t[3]!==a||t[4]!==i?(u=!a&&(0,Q.jsx)(We,{variant:ee(i),className:`relative top-0 right-0 ml-auto w-6 cursor-pointer`,children:jr(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)(hr,{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}var WV={passed:`text-add-fg group-hover/button:text-add-fg/70`,running:`text-warn group-hover/button:text-warn/70`,failed:`text-del-fg group-hover/button:text-del-fg/70`,none:`text-muted-foreground group-hover/button:text-foreground`};function GV(e){let t=(0,$.c)(127),{remotes:r,selected:i,openReview:a,onSelect:o,onOpenPullRequest:s,onOpenProject:l,onOpenSettings:u,settingsOpen:d,onOpenShortcuts:f}=e,{connection:p}=Qo(),m=vI(),h=vI(),g=vI(),_=[p,...(r??[]).map(XV)],{projects:v,filters:y,loading:b,messages:x}=Rr(ue(_)),S=Rr(zn),C=Aa(zn),{query:w,filter:T}=S;ao(Za(_));let E=Aa(Cn(_)),D=td(),O;t[0]===D.href?O=t[1]:(O={href:D.href,open:!1},t[0]=D.href,t[1]=O);let[k,A]=(0,Z.useState)(O),j=k.href===D.href&&k.open,M;t[2]===C?M=t[3]:(M=e=>C(t=>({...t,query:e})),t[2]=C,t[3]=M);let N=M,P=T.projects!==void 0||T.environments!==void 0||T.reviews!==void 0||T.older,{setOpenMobile:F,isMobile:I}=cr(),L=i?{kind:`worktree`,worktreeId:i.worktreeId,environmentId:i.remote??p.environmentId}:void 0,R=a?{kind:`review`,reviewId:a.reviewId,environmentId:a.environment??p.environmentId}:L,z,B;if(t[4]!==v){let e=v.flatMap(YV).filter(JV);z=e[0]?.key,B=e.at(-1)?.key,t[4]=v,t[5]=z,t[6]=B}else z=t[5],B=t[6];let V=B,H;t[7]!==p||t[8]!==o||t[9]!==F?(H=e=>{e.worktreeId&&(o({remote:e.environmentId===p.environmentId?null:e.environmentId,projectId:e.projectId,worktreeId:e.worktreeId}),F(!1))},t[7]=p,t[8]=o,t[9]=F,t[10]=H):H=t[10];let U=H,W;t[11]!==l||t[12]!==r?(W=(0,Q.jsx)(VV,{children:(0,Q.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,Q.jsx)(HV,{remotes:r,onOpenProject:l})})}),t[11]=l,t[12]=r,t[13]=W):W=t[13];let G;t[14]===N?G=t[15]:(G=e=>N(e.target.value),t[14]=N,t[15]=G);let K;t[16]!==h||t[17]!==g||t[18]!==w||t[19]!==N?(K=e=>{e.key===`Escape`&&w.length>0&&(e.stopPropagation(),N(``)),(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),(e.key===`ArrowDown`?h:g).element?.focus())},t[16]=h,t[17]=g,t[18]=w,t[19]=N,t[20]=K):K=t[20];let ee;t[21]!==I||t[22]!==w||t[23]!==G||t[24]!==K?(ee=(0,Q.jsx)(EI,{autoFocus:I,type:`search`,"aria-label":`Search reviews and worktrees`,placeholder:`Search`,value:w,onChange:G,onKeyDown:K}),t[21]=I,t[22]=w,t[23]=G,t[24]=K,t[25]=ee):ee=t[25];let q;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Q.jsx)(SI,{children:(0,Q.jsx)(vp,{})}),t[26]=q):q=t[26];let te;t[27]===ee?te=t[28]:(te=(0,Q.jsxs)(bI,{className:`min-w-0 flex-1`,children:[ee,q]}),t[27]=ee,t[28]=te);let ne;t[29]===D.href?ne=t[30]:(ne=e=>A({href:D.href,open:e}),t[29]=D.href,t[30]=ne);let re;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsxs)(dt,{disableHoverablePopup:!0,children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Pr,{render:(0,Q.jsx)(Gr,{"aria-label":`Filter worktrees`,className:`relative top-0 right-0 w-6 cursor-pointer`})}),children:(0,Q.jsx)(Jf,{})}),(0,Q.jsx)(Et,{children:`Filter worktrees`})]}),t[31]=re):re=t[31];let ie;if(t[32]!==y||t[33]!==C){let e;t[35]===C?e=t[36]:(e=e=>(0,Q.jsxs)(Ei,{children:[(0,Q.jsx)(Ko,{children:e.label}),e.items.map(t=>(0,Q.jsxs)(va,{className:`cursor-pointer`,checked:t.checked,closeOnClick:!1,onCheckedChange:()=>C(n=>({...n,filter:{...n.filter,[e.key]:t.next}})),children:[t.icon&&(0,Q.jsx)(_i,{icon:t.icon}),(0,Q.jsx)(fr,{propagateEscape:!0,text:t.label,className:`min-w-0 flex-1`})]},t.id)),(0,Q.jsx)(gs,{})]},e.key),t[35]=C,t[36]=e),ie=y.map(e),t[32]=y,t[33]=C,t[34]=ie}else ie=t[34];let ae;t[37]===C?ae=t[38]:(ae=e=>C(t=>({...t,filter:{...t.filter,older:e}})),t[37]=C,t[38]=ae);let oe;t[39]!==T.older||t[40]!==ae?(oe=(0,Q.jsx)(va,{className:`cursor-pointer`,checked:T.older,closeOnClick:!1,onCheckedChange:ae,children:`Show older reviews`}),t[39]=T.older,t[40]=ae,t[41]=oe):oe=t[41];let se;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Q.jsx)(gs,{}),t[42]=se):se=t[42];let ce;t[43]===C?ce=t[44]:(ce=(0,Q.jsx)(hr,{className:`cursor-pointer`,onClick:()=>C(qV),children:`Clear filters`}),t[43]=C,t[44]=ce);let le;t[45]!==ie||t[46]!==oe||t[47]!==ce?(le=(0,Q.jsx)(Ni,{align:`start`,className:`flex max-h-[min(24rem,var(--available-height))] w-80 max-w-[calc(100vw-2rem)] flex-col overflow-y-hidden`,children:(0,Q.jsxs)(`div`,{className:`-m-1 min-h-0 overflow-y-auto p-1`,children:[ie,oe,se,ce]})}),t[45]=ie,t[46]=oe,t[47]=ce,t[48]=le):le=t[48];let de;t[49]!==j||t[50]!==ne||t[51]!==le?(de=(0,Q.jsxs)(Ja,{open:j,onOpenChange:ne,children:[re,le]}),t[49]=j,t[50]=ne,t[51]=le,t[52]=de):de=t[52];let fe;t[53]!==te||t[54]!==de?(fe=(0,Q.jsxs)(`div`,{className:`navigator-filters mb-2 flex items-center gap-1 px-2`,children:[te,de]}),t[53]=te,t[54]=de,t[55]=fe):fe=t[55];let pe=oa,J;t[56]===b?J=t[57]:(J=b&&(0,Q.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Ci,{"aria-label":`Reading worktrees`}),`Reading worktrees…`]}),t[56]=b,t[57]=J);let me=v.map(e=>(0,Q.jsx)(Ao,{children:(0,Q.jsxs)(da,{open:e.expanded,onOpenChange:t=>C(n=>({...n,expanded:{...n.expanded,[e.key]:t}})),className:`group/project`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(zV,{projectName:e.project.name,environmentName:e.environmentName,environmentIcon:e.environmentIcon,showEnvironment:_.length>1}),(0,Q.jsx)(LV,{project:e.project,environmentId:e.connection.environmentId===p.environmentId?null:e.connection.environmentId,environmentName:e.environmentName}),(0,Q.jsxs)(dt,{disableHoverablePopup:!0,children:[(0,Q.jsx)(De,{render:(0,Q.jsx)($r,{render:(0,Q.jsx)(Gr,{className:`relative top-0 right-0 w-6 cursor-pointer`,"aria-label":`${e.expanded?`Collapse`:`Expand`} ${e.project.name} · ${e.environmentName}`})}),children:(0,Q.jsx)(Hn,{className:`group-data-closed/project:-rotate-90`})}),(0,Q.jsx)(Et,{children:e.expanded?`Collapse project`:`Expand project`})]})]}),(0,Q.jsx)(Lo,{children:(0,Q.jsxs)(za,{children:[e.entries.map(t=>{let r=R!==void 0&&lo(t,R),i=t.review.state===`available`?t.review:void 0,a=i?.checks?.state===`available`?i.checks.result:`none`,o=To(t.changes),l=t.kind===`review`,u=n(t),d=l?``:jt(t.changes),f=l||!t.available&&i!==void 0,m=t.key===V?g.attach:void 0;t.key===z&&(m=h.attach);let v=`${wa(t)}${r?`, Current`:``}`;return(0,Q.jsx)(pa,{children:(0,Q.jsx)(hI,{entry:t,connection:_.find(t=>t.environmentId===e.connection.environmentId)??p,children:(0,Q.jsx)(fr,{text:t.path?`${t.name} · ${t.path}`:t.name,disclose:t.detached?`always`:`clipped`,renderTrigger:(e,n)=>(0,Q.jsxs)(`div`,{"data-navigator-card":``,role:`presentation`,tabIndex:-1,className:r?`relative rounded-md bg-card`:`relative rounded-md hover:bg-card`,children:[(0,Q.jsx)(sr,{className:`absolute inset-0 h-full cursor-pointer`,"data-sidebar":`menu-button`,size:`xs`,"aria-label":v,"aria-current":r?`page`:void 0,onClick:()=>f?F(!1):U(t),render:f&&i?(0,Q.jsx)(Va,{ref:m,to:`/reviews/$reviewId`,params:{reviewId:i.reviewId},search:{environment:t.environmentId===p.environmentId?void 0:t.environmentId,decision:void 0}}):(0,Q.jsx)(`button`,{type:`button`,ref:m,disabled:!f&&!t.available})}),(0,Q.jsx)(sr,{size:`xs`,className:`pointer-events-none`,children:(0,Q.jsxs)(c,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[n(t.name,r?`min-w-0 flex-1 font-semibold`:`min-w-0 flex-1 font-medium`),t.detached&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Detached`}),i?.pullRequestNumber&&(0,Q.jsx)(Y,{variant:`ghost`,size:`xs`,className:`relative pointer-events-auto cursor-pointer`,"aria-label":`Open PR #${i.pullRequestNumber} · ${t.projectName} · ${t.environmentName} · ${ai(i.checks)}`,onClick:()=>{s(t),F(!1)},children:(0,Q.jsxs)(`span`,{className:WV[a],children:[`PR #`,i.pullRequestNumber]})})]}),(u||d)&&(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2 text-xs text-muted-foreground`,children:[u&&n(u,`min-w-0 flex-1`),d&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0`,role:`img`,"aria-label":`Local uncommitted changes: ${d}`,children:o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:`text-add-fg`,children:[`+`,o.additions]}),` `,(0,Q.jsxs)(`span`,{className:`text-del-fg`,children:[`−`,o.deletions]}),o.binaryFiles>0&&` · ${o.binaryFiles} binary`]}):d})]})]})})]})})})},t.key)}),e.entries.length===0&&!b&&(0,Q.jsx)(`p`,{className:`px-2 py-3 text-xs text-muted-foreground`,children:`No matching worktrees`})]})})]})},e.key)),he;t[58]!==P||t[59]!==b||t[60]!==x.length||t[61]!==v.length||t[62]!==w?(he=!b&&x.length===0&&v.length===0&&(0,Q.jsx)(DI,{children:(0,Q.jsxs)(OI,{children:[(0,Q.jsx)(kI,{children:w.trim()||P?`No matching worktrees`:`No projects registered`}),(0,Q.jsx)(AI,{children:w.trim()||P?`Try another search or clear the filters.`:`Open a Git repository to get started.`})]})}),t[58]=P,t[59]=b,t[60]=x.length,t[61]=v.length,t[62]=w,t[63]=he):he=t[63];let ge;t[64]===x?ge=t[65]:(ge=x.map(KV),t[64]=x,t[65]=ge);let _e;t[66]!==b||t[67]!==x.length||t[68]!==E?(_e=x.length>0&&(0,Q.jsx)(Y,{variant:`ghost`,disabled:b,onClick:()=>E(void 0),children:`Read again`}),t[66]=b,t[67]=x.length,t[68]=E,t[69]=_e):_e=t[69];let ve;t[70]!==pe||t[71]!==J||t[72]!==me||t[73]!==he||t[74]!==ge||t[75]!==_e?(ve=(0,Q.jsxs)(pe,{children:[J,me,he,ge,_e]}),t[70]=pe,t[71]=J,t[72]=me,t[73]=he,t[74]=ge,t[75]=_e,t[76]=ve):ve=t[76];let ye;t[77]===m?ye=t[78]:(ye=e=>m.attach(e),t[77]=m,t[78]=ye);let be=d?`Close Settings`:`Settings`,xe=d?`submit`:`button`,Se=d?`close-settings`:void 0,Ce=d?void 0:u,we;t[79]===d?we=t[80]:(we=e=>{d&&e.key===`Escape`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},t[79]=d,t[80]=we);let Te;t[81]!==ye||t[82]!==be||t[83]!==xe||t[84]!==Se||t[85]!==Ce||t[86]!==we?(Te=(0,Q.jsx)(Y,{ref:ye,variant:`ghost`,className:`min-w-0 shrink`,"aria-label":be,type:xe,form:Se,onClick:Ce,onKeyDown:we}),t[81]=ye,t[82]=be,t[83]=xe,t[84]=Se,t[85]=Ce,t[86]=we,t[87]=Te):Te=t[87];let Ee;t[88]===d?Ee=t[89]:(Ee=d?(0,Q.jsx)(Ht,{}):(0,Q.jsx)(bp,{className:`text-muted-foreground`}),t[88]=d,t[89]=Ee);let Oe=d?`Close`:`Settings`,ke;t[90]===Oe?ke=t[91]:(ke=(0,Q.jsx)(fr,{text:Oe}),t[90]=Oe,t[91]=ke);let Ae;t[92]===d?Ae=t[93]:(Ae=d&&(0,Q.jsx)(gI,{children:Ks(cc.closeSettings)}),t[92]=d,t[93]=Ae);let je;t[94]!==Te||t[95]!==Ee||t[96]!==ke||t[97]!==Ae?(je=(0,Q.jsxs)(De,{render:Te,children:[Ee,ke,Ae]}),t[94]=Te,t[95]=Ee,t[96]=ke,t[97]=Ae,t[98]=je):je=t[98];let Me=d?`Close Settings`:`Settings`,Ne=d?cc.closeSettings:cc.openSettings,Pe;t[99]===Ne?Pe=t[100]:(Pe=Ks(Ne),t[99]=Ne,t[100]=Pe);let Fe;t[101]===Pe?Fe=t[102]:(Fe=(0,Q.jsx)(gI,{children:Pe}),t[101]=Pe,t[102]=Fe);let Ie;t[103]!==Me||t[104]!==Fe?(Ie=(0,Q.jsxs)(Et,{role:`tooltip`,children:[Me,` `,Fe]}),t[103]=Me,t[104]=Fe,t[105]=Ie):Ie=t[105];let Le;t[106]!==je||t[107]!==Ie?(Le=(0,Q.jsxs)(dt,{disableHoverablePopup:!0,children:[je,Ie]}),t[106]=je,t[107]=Ie,t[108]=Le):Le=t[108];let Re;t[109]===m?Re=t[110]:(Re=(0,Q.jsx)(xo,{fallbackFocus:m}),t[109]=m,t[110]=Re);let ze;t[111]===f?ze=t[112]:(ze=(0,Q.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":`Keyboard shortcuts`,onClick:f}),t[111]=f,t[112]=ze);let Be;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Q.jsx)(Hf,{className:`text-muted-foreground`}),t[113]=Be):Be=t[113];let Ve;t[114]===ze?Ve=t[115]:(Ve=(0,Q.jsx)(De,{render:ze,children:Be}),t[114]=ze,t[115]=Ve);let He;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Q.jsxs)(Et,{role:`tooltip`,children:[`Keyboard shortcuts`,` `,(0,Q.jsx)(gI,{children:Ks(cc.openShortcuts)})]}),t[116]=He):He=t[116];let Ue;t[117]===Ve?Ue=t[118]:(Ue=(0,Q.jsxs)(dt,{disableHoverablePopup:!0,children:[Ve,He]}),t[117]=Ve,t[118]=Ue);let We;t[119]!==Re||t[120]!==Ue?(We=(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[Re,Ue]}),t[119]=Re,t[120]=Ue,t[121]=We):We=t[121];let Ge;t[122]!==Le||t[123]!==We?(Ge=(0,Q.jsxs)(`footer`,{role:`group`,"aria-label":`Navigator controls`,className:`navigator-footer flex shrink-0 items-center gap-1 p-2`,children:[Le,We]}),t[122]=Le,t[123]=We,t[124]=Ge):Ge=t[124];let Ke,qe;return t[125]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Q.jsx)(MV,{}),qe=(0,Q.jsx)(OV,{}),t[125]=Ke,t[126]=qe):(Ke=t[125],qe=t[126]),(0,Q.jsxs)(`div`,{className:`review-navigator h-full min-h-0 overflow-hidden bg-frame text-ui [--sidebar:var(--frame)] [--sidebar-foreground:var(--foreground)] [--muted:var(--card)] [--secondary:var(--card)] [--sidebar-accent:var(--card)]`,children:[(0,Q.jsxs)(Ir,{role:`navigation`,collapsible:`none`,className:`h-full w-full min-h-0 overflow-hidden`,"aria-label":`Projects and worktrees`,children:[W,fe,ve,Ge]}),Ke,qe]})}function KV(e){return(0,Q.jsx)(`p`,{role:`status`,className:`px-3 text-xs wrap-anywhere`,children:e},e)}function qV(e){return{...e,filter:er}}function JV(e){return e.available||e.kind===`review`||e.review.state===`available`}function YV(e){return e.expanded?e.entries:[]}function XV(e){return e.connection}function ZV(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)(QV,{environmentId:n,children:i}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function QV(e){let t=(0,$.c)(3),{environmentId:n,children:r}=e,i=G(n),a;return t[0]!==r||t[1]!==i?(a=i&&(0,Q.jsx)($V,{entry:i,children:r}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function $V(e){let t=(0,$.c)(6),{entry:n,children:r}=e,i=ps(n.remote),a;t[0]===i?a=t[1]:(a=i.kind===`online`?void 0:`${jr(i)}. ${ms(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 eH(e){let t=(0,$.c)(5),{unavailable:n,result:r}=e,i;t[0]!==r||t[1]!==n?(i=n??(f(r)?Pa(ht(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)(no,{variant:`destructive`,children:(0,Q.jsx)(Qn,{children:a})}),t[3]=a,t[4]=o),o}function tH(e){let t=(0,$.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(nM,{handle:FP,children:e=>{let{payload:t}=e;return t&&(0,Q.jsx)(ZV,{remote:t.remote,connection:n,children:e=>(0,Q.jsx)(uM,{children:(0,Q.jsx)(nH,{project:t.project,...e},t.project.id)})})}}),t[0]=n,t[1]=r),r}function nH(e){let t=(0,$.c)(32),{project:n,connection:r,unavailable:i}=e,a=CV(r,rH),{result:o}=a,s;t[0]===n.name?s=t[1]:(s=(0,Q.jsxs)(pM,{className:`break-all`,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)(mM,{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)(dM,{children:[s,c]}),t[3]=s,t[4]=l);let u;t[5]===n?u=t[6]:(u=Qa(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)(eH,{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)(gM,{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)(Ci,{}),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)(hM,{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)(fM,{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 rH(){return FP.close()}var iH=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 aH(e,t){return new iH(e,t).maybeExecute}var oH=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)}},sH=new class extends oH{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function cH(e,t){return typeof e==`function`?e(t):e}function lH(e,t){return _H(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function uH(e,t,n){let r=_H(t);function i(e){if(!r.length)return cH(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 dH(e,t){let n=_H(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 fH=46,pH=91,mH=93,hH=48,gH=57;function _H(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)===pH),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===fH||s===pH||s===mH){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==hH),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!==mH&&(a!==-1||s!==mH)&&(a!==s||s!==fH&&s!==pH)&&n.push(``);r=o+1,i=!0}else(s<hH||s>gH)&&(i=!1);a=s}return n.length||n.push(``),n}function vH(e){return!(Array.isArray(e)&&e.length===0)}function yH(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 bH(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 xH=e=>!!e&&typeof e==`object`&&`fields`in e;function SH(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)||!SH(e[i],t[i]))return!1;return!0}var CH=({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},wH=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function TH(e,t){return e==null?t:{...e,...t}}for(var EH=256,DH=[],OH;EH--;)DH[EH]=(EH+256).toString(16).substring(1);function kH(){let e=0,t,n=``;if(!OH||EH+16>256){for(OH=Array(256),e=256;e--;)OH[e]=256*Math.random()|0;e=0,EH=0}for(;e<16;e++)t=OH[EH+e],n+=e===6?DH[t&15|64]:e===8?DH[t&63|128]:DH[t],e&1&&e>1&&e<11&&(n+=`-`);return EH++,n}var AH=aH(e=>sH.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function jH(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]=jH(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,jH(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(jH(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=jH(e[n]));return t}function MH(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var NH=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 PH(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 FH=(e,t)=>{let n=PH(e,t);return{form:n,fields:n}},IH={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:FH(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:FH(r.issues,e)}},LH=e=>!!e&&`~standard`in e,RH={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function zH(e){function t(t){let n=e.getFieldMeta(t)??RH;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=()=>RH;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function BH(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 VH=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{AH(this)}),t=sH.on(`request-form-state`,e=>{e.payload.id===this._formId&&sH.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=sH.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=sH.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(),sH.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return sH.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&&!SH(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!SH(e.defaultState,t.defaultState)&&!this.state.isTouched;if(n||r){if(Tc(()=>{this.baseStore.setState(()=>BH(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=zH(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}sH.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=uH(t,e.instance.name,e.instance.options.defaultValue))}),BH({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return Tc(()=>{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 Tc(()=>{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=yH(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||NH}),r=!1,i={};return Tc(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=HH(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=UH(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)??RH,r=a?.[e],{newErrorValue:s,newSource:c}=CH({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=RH)=>({...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=UH(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=UH(`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=bH(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||NH});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=UH(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}=HH(r);s&&(i=i?{...i,...s}:s);let c=UH(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)??RH,r=i?.[e],{newErrorValue:a,newSource:o}=CH({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=RH)=>({...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})),Tc(()=>{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}),sH.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}),sH.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}Tc(()=>{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}),Tc(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),sH.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),sH.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>lH(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]:cH(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=RH,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;Tc(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:uH(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=dH(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),zH(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],TH(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),zH(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),TH(r,{dontValidate:!0})),zH(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),TH(n,{dontValidate:!0})),zH(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 uH(uH(e,`${t}`,i),`${n}`,r)},TH(r,{dontValidate:!0})),zH(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},TH(r,{dontValidate:!0})),zH(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,[],TH(t,{dontValidate:!0})),zH(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=lH(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:RH},values:i===void 0?t.values:uH(t.values,e,i)}})},this.setErrorMap=e=>{Tc(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(xH(t)){let{formError:e,fieldErrors:r}=HH(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=>IH.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>IH.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??kH(),this._devtoolsSubmissionOverride=!1;let t=BH({...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&&xH(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=_c(t);let n;this.fieldMetaDerived=_c(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=lH(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=!vH(u),f=!o.isDirty,p=SH(l,this.getFieldInfo(a)?.instance?.options.defaultValue??lH(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=_c(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||!MH(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&&MH(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=_c(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&&xH(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&&SH(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 LH(e.validate)?IH[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function HH(e){return e?xH(e)?{formError:HH(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function UH(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 WH=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]:{...RH,isTouched:e.fieldMetaBase[this.name]?.isTouched??RH.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??RH.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??RH.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&&(SH(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,TH(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,TH(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,TH(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,TH(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,TH(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,TH(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,TH(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,TH(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=yH(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||NH}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=yH(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||NH});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;Tc(()=>{let e=(e,n)=>{let r=KH(n.cause),a=n.validate?GH(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}=wH({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=KH(`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=bH(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||NH}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=bH(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||NH});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)));Tc(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=KH(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=GH(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=wH({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)),Tc(()=>{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=>MH(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[KH(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[KH(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=>IH.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>IH.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)MH(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=_c(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...RH,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!SH(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 LH(e.validate)?IH[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 GH(e){if(e)return e}function KH(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 qH(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function JH(e){return{...RH,...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 YH=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??qH({});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&&(SH(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,{...RH,...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]??qH({...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;ZH(t)&&(n=t.group,r=t.fields);let i=XH(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]:qH({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,TH(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 WH&&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&&MH(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}=CH({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=RH)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=yH(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||NH}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=yH(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||NH});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;Tc(()=>{let t=(t,r)=>{let i=$H(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&&ZH(s)&&(c=s.group,l=s.fields);let u=XH(c),d=n[i],{newErrorValue:f,newSource:p}=wH({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=$H(`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=bH(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||NH}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=bH(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||NH});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=$H(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&&ZH(o)&&(l=o.group,u=o.fields);let d=XH(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=wH({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 Tc(()=>{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=>MH(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[$H(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>MH(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})),Tc(()=>{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}Tc(()=>{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}),Tc(()=>{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=_c(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??JH(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!SH(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(LH(e.validate)){let t=IH[e.type](e.value,e.validate);return e.type===`validate`?QH(t):t.then(QH)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function XH(e){if(e)return e}function ZH(e){return!!e&&typeof e==`object`&&`fields`in e}function QH(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 $H(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 eU(e,t){if(!t)return;let n=Object.assign({},e,{state:jH(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 Tc(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var tU=typeof window<`u`?Z.useLayoutEffect:Z.useEffect;function nU(e){let[t,n]=(0,Z.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,Z.useState)(()=>new WH({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new WH({...e}),i(a),n({form:e.form,name:e.name}));let o=ad(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=ad(a.store,e=>e.meta.isTouched),c=ad(a.store,e=>e.meta.isBlurred),l=ad(a.store,e=>e.meta.isDirty),u=ad(a.store,e=>e.meta.errorMap),d=ad(a.store,e=>e.meta.errorSourceMap),f=ad(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 tU(a.mount,[a]),tU(()=>{a.update(e)}),p}var rU=(({children:e,...t})=>{let n=nU(t),r=(0,Z.useMemo)(()=>cH(e,n),[e,n]);return(0,Q.jsx)(Q.Fragment,{children:r})});function iU(){return(0,Z.useState)(()=>kH())[0]}var aU=Z,oU=`19.2.8`.split(`.`)[0]===`17`?iU:aU.useId;function sU(e){let[t,n]=(0,Z.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,Z.useState)(()=>new YH({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new YH({...e})),n({form:e.form,name:e.name}));let a=ad(r.store,e=>e.value),o=ad(r.store,e=>e.meta.isTouched),s=ad(r.store,e=>e.meta.isBlurred),c=ad(r.store,e=>e.meta.isDirty),l=ad(r.store,e=>e.meta.errorMap),u=ad(r.store,e=>e.meta.errorSourceMap),d=ad(r.store,e=>e.meta.isValidating),f=ad(r.store,e=>e.meta.isSubmitting),p=ad(r.store,e=>e.meta.isSubmitted),m=ad(r.store,e=>e.meta.submissionAttempts),h=ad(r.store,e=>e.meta.isSubmitSuccessful),g=ad(r.store,e=>e.meta.canSubmit),_=ad(r.store,e=>e.meta.isValid),v=ad(r.store,e=>e.meta.isFieldsValid),y=ad(r.store,e=>e.meta.isFieldsValidating),b=ad(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 tU(r.mount,[r]),tU(()=>{r.update(e)}),x}var cU=(({children:e,...t})=>{let n=sU(t),r=(0,Z.useMemo)(()=>cH(e,n),[e,n]);return(0,Q.jsx)(Q.Fragment,{children:r})});function lU({form:e,selector:t=e=>e,children:n}){let r=ad(e.store,t);return(0,Q.jsx)(Q.Fragment,{children:cH(n,r)})}function uU(e){let t=oU(),[n,r]=(0,Z.useState)(e?.formId),[i,a]=(0,Z.useState)(()=>new VH({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new VH({...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)(rU,{...e,form:i})},e.FormGroup=function(e){return(0,Q.jsx)(cU,{...e,form:i})},e.Subscribe=function(e){return(0,Q.jsx)(lU,{form:i,selector:e.selector,children:e.children})},e},[i]);tU(i.mount,[]),tU(()=>{i.update(e)});let s=(0,Z.useRef)(!1);return tU(()=>{s.current&&e?.transform&&eU(i,e.transform)},[i,e?.transform]),tU(()=>{s.current=!0}),o}function dU(e){let t=(0,$.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(Jo,{handle:PP,children:e=>{let{payload:t}=e;return t&&(0,Q.jsx)(ZV,{remote:t.remote,connection:n,children:e=>(0,Q.jsx)($P,{children:(0,Q.jsx)(fU,{project:t.project,...e},t.project.id)})})}}),t[0]=n,t[1]=r),r}function fU(e){let t=(0,$.c)(40),{project:n,connection:r,unavailable:i}=e,a=SV(r,gU),{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:wV},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=uU(u),f;t[9]===d?f=t[10]:(f=e=>kt(e,()=>d.handleSubmit()),t[9]=d,t[10]=f);let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsxs)(eF,{children:[(0,Q.jsx)(nF,{children:`Rename project`}),(0,Q.jsx)(rF,{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:hU}),t[12]=d.Field,t[13]=m);let h;t[14]===n?h=t[15]:(h=Qa(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)(eH,{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)(Y,{type:`button`,variant:`outline`,disabled:o.waiting,onClick:mU,children:`Cancel`}),t[24]=o.waiting,t[25]=y);let b;t[26]!==o.waiting||t[27]!==i?(b=e=>(0,Q.jsxs)(Y,{type:`submit`,disabled:!e||o.waiting||i!==void 0,children:[o.waiting&&(0,Q.jsx)(Ci,{}),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:pU,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)(tF,{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 pU(e){return e.canSubmit}function mU(){return PP.close()}function hU(e){return(0,Q.jsxs)(zi,{"data-invalid":e.state.meta.isTouched&&!e.state.meta.isValid,children:[(0,Q.jsx)(Wa,{htmlFor:`project-name`,children:`Name`}),(0,Q.jsx)(se,{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)(Na,{id:`project-name-error`,errors:e.state.meta.errors})]})}function gU(){return PP.close()}function _U(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function vU(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function yU(e){return e/100*window.innerHeight}function bU(e){return e/100*window.innerWidth}function xU(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 SU({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=xU(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=vU(t,i);break;case`em`:r=_U(t,i);break;case`vh`:r=yU(i);break;case`vw`:r=bU(i)}return r}function CU(e){return parseFloat(e.toFixed(3))}function wU({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 TU(e){let{panels:t}=e,n=wU({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=CU(SU({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=CU(SU({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=CU(SU({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=CU(SU({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 EU(e,t=`Assertion error`){if(!e)throw Error(t)}function DU(e,t){return Array.from(t).sort(e===`horizontal`?OU:kU)}function OU(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function kU(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function AU(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function jU(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 MU({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}=jU(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return EU(i,`No rect found`),i}var NU;function PU(){return NU===void 0&&(NU=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),NU}function FU(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=DU(n,Array.from(t.children).filter(AU).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,MU({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=PU()?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:wU({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 IU=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)}}},LU={cursorFlags:0,state:`inactive`},RU=new IU;function zU(){return LU}function BU(e){return RU.addListener(`change`,e)}function VU(e){let t=LU,n={...LU};n.cursorFlags=e,LU=n,RU.emit(`change`,{prev:t,next:n})}function HU(e){let t=LU;LU=e,RU.emit(`change`,{prev:t,next:e})}var UU=e=>e,WU=()=>{},GU=1,KU=2,qU=4,JU=8,YU=3,XU=12,ZU;function QU(){return ZU===void 0&&(ZU=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(ZU=!0)),ZU}function $U({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&&QU()){let t=(e&GU)!==0,n=(e&KU)!==0,r=(e&qU)!==0,i=(e&JU)!==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 QU()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var eW=new WeakMap;function tW(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=eW.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=zU();switch(r.state){case`active`:case`hover`:{let e=$U({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)}eW.set(e,{prevStyle:t,styleSheet:n})}var nW=new Map,rW=new IU;function iW(e){nW=new Map(nW),nW.delete(e)}function aW(e,t){for(let[t]of nW)if(t.id===e)return t}function oW(e,t){for(let[t,n]of nW)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function sW(){return nW}function cW(e,t){return rW.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function lW(e,t,n){let r=nW.get(e);nW=new Map(nW),nW.set(e,t),rW.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function uW(e){let t=zU(),n=sW(),r=!1;return t.state===`active`&&(HU({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(tW(e),r=!0,t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=oW(e.group.id,!0);lW(e.group,t,{isUserInteraction:!0})}))),r}function dW(e){e.defaultPrevented||uW(e.currentTarget)}function fW(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=jU(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 pW(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function mW(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:bW(e),b:bW(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();EU(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:yW(vW(n.a)),b:yW(vW(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 hW=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function gW(e){let t=getComputedStyle(xW(e)??e).display;return t===`flex`||t===`inline-flex`}function _W(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||gW(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`||hW.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function vW(e){let t=e.length;for(;t--;){let n=e[t];if(EU(n,`Missing node`),_W(n))return n}return null}function yW(e){return e&&Number(getComputedStyle(e).zIndex)||0}function bW(e){let t=[];for(;e;)t.push(e),e=xW(e);return t}function xW(e){let{parentNode:t}=e;return pW(t)?t.host:t}function SW(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 CW({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!AU(n)||n.contains(e)||e.contains(n))return!0;if(mW(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(SW(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function wW(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=FU(r),a=fW(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&CW({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function TW(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 EW(e,t,n=0){return Math.abs(CU(e)-CU(t))<=n}function DW(e,t){return EW(e,t)?0:e>t?1:-1}function OW({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(DW(r,c)<0){if(a){let e=(i+c)/2;r=DW(r,e)<0?i:c}else r=c}return r=Math.min(s,r),r=CU(r),r}function kW({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(EW(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;EU(u!=null,`Invalid first pivot index`),EU(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];EU(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(EU(n!=null,`Previous layout not found for panel index ${t}`),EW(n,i)){let t=o-n;DW(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];EU(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(EU(n!=null,`Previous layout not found for panel index ${t}`),EW(n,o)){let t=n-i;DW(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];EU(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&DW(i,c)<0){if(e>0){let t=c-o,n=t/2;DW(i+e,c)<0&&(e=DW(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;DW(i-e,c)<0&&(e=DW(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];EU(e!=null,`Previous layout not found for panel index ${r}`);let a=OW({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];EU(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=OW({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!EW(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(TW(c,l))return i;{let t=e<0?d:u,r=s[t];EU(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=OW({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!EW(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];EU(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=OW({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(EW(i,s)||(t-=s-i,l[r]=s),EW(t,0))break;e>0?r--:r++}}}if(!EW(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 AW(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||DW(e[n],t[n])!==0)return!1;return!0}function jW({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(!EW(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];EU(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];EU(i!=null,`No layout data found for index ${e}`);let o=r[e];EU(o!=null,`No layout data found for index ${e}`);let s=OW({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!EW(a,0))for(let e=0;e<t.length;e++){let n=r[e];EU(n!=null,`No layout data found for index ${e}`);let i=n+a,o=OW({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,EW(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function MW({groupId:e,panelId:t}){let n=()=>{let t=sW();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&&EW(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:CU(100-e)}}return kW({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=jW({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});AW(c,u)||lW(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&&EW(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=wU({group:t}),o=CU(SU({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function NW(e){e.defaultPrevented||wW(e,sW()).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=MW({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function PW(e){let t=sW();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 FW({groupId:e}){let t=()=>{let t=sW();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=jW({layout:e,panelConstraints:r});return n?o:(AW(o,c)||lW(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function IW(e,t){let n=PW(e),r=oW(n.id,!0),i=n.separators.find(t=>t.element===e);EU(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);EU(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=FW({groupId:n.id}).getLayout(),c=jW({layout:kW({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});AW(s,c)||lW(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function LW(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=PW(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&IW(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&IW(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&IW(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&IW(t,-5);break;case`End`:e.preventDefault(),IW(t,100);break;case`Enter`:{e.preventDefault();let n=PW(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=oW(n.id,!0),o=n.separators.find(e=>e.element===t);EU(o,`Matching separator not found`);let s=a.get(o);EU(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(EU(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];IW(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=PW(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);EU(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(),IW(t,-100)}}function RW(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=sW(),n=wW(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)}),HU({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function zW({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=kW({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(AW(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?GU:KU;break;case`vertical`:s|=d<0?qU:JU}}else lW(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&YU:c|=s&YU,t.movementY===0?c|=o&XU:c|=s&XU,VU(c),tW(e)}function BW(e){let t=sW(),n=zU();n.state===`active`&&zW({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function VW(e){if(e.defaultPrevented)return;let t=zU(),n=sW();switch(t.state){case`active`:if(e.buttons===0){HU({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=oW(e.group.id,!0);lW(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)}zW({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=wW(e,n);r.length===0?t.state!==`inactive`&&HU({cursorFlags:0,state:`inactive`}):HU({cursorFlags:0,hitRegions:r,state:`hover`}),tW(e.currentTarget);break}}}function HW(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(zU().state){case`hover`:HU({cursorFlags:0,state:`inactive`})}}function UW(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||uW(e.currentTarget)&&e.preventDefault()}function WW(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=CU(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=CU((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function GW(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=wU({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:CU(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function KW(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 qW(e,t){return e.length===t.length&&e.every((e,n)=>KW(e,t[n]))}function JW({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=CU(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]=CU((r[e]??0)/a*l);else{let e=CU(l/c.length);for(let t of c)u[t]=e}return u}function YW(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 XW=new Map;function ZW(e){let t=!0;EU(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=wU({group:e});if(t===0)return;let n=oW(e.id);if(!n)return;let r=TU(e),i=n.defaultLayoutDeferred?WW(r):n.layout,a=jW({layout:JW({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&AW(n.layout,a)&&qW(n.derivedPanelConstraints,r)&&n.groupSize===t)continue;lW(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else GW(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{EU(!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=wU({group:e}),s=TU(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(YW(e.panels,l)||(l=void 0));let u=jW({layout:e.mutableState.layouts[c]??l??WW(s),panelConstraints:s}),d=e.element.ownerDocument;XW.set(d,(XW.get(d)??0)+1);let f=new Map;return FU(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),lW(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{EU(!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`,LW)}),XW.get(d)===1&&(d.addEventListener(`contextmenu`,dW,!0),d.addEventListener(`dblclick`,NW,!0),d.addEventListener(`pointerdown`,RW,!0),d.addEventListener(`pointerleave`,BW),d.addEventListener(`pointermove`,VW),d.addEventListener(`pointerout`,HW),d.addEventListener(`pointerup`,UW,!0)),function(){t=!1,XW.set(d,Math.max(0,(XW.get(d)??0)-1)),iW(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,LW)}),XW.get(d)||(d.removeEventListener(`contextmenu`,dW,!0),d.removeEventListener(`dblclick`,NW,!0),d.removeEventListener(`pointerdown`,RW,!0),d.removeEventListener(`pointerleave`,BW),d.removeEventListener(`pointermove`,VW),d.removeEventListener(`pointerout`,HW),d.removeEventListener(`pointerup`,UW,!0)),a.disconnect()}}function QW(){let[e,t]=(0,Z.useState)({});return[e,(0,Z.useCallback)(()=>t({}),[])]}function $W(e){let t=(0,Z.useId)();return`${e??t}`}var eG=typeof window<`u`?Z.useLayoutEffect:Z.useEffect;function tG(e){let t=(0,Z.useRef)(e);return eG(()=>{t.current=e},[e]),(0,Z.useCallback)((...e)=>t.current?.(...e),[t])}function nG(...e){return tG(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t}})})}function rG(e){let t=(0,Z.useRef)({...e});return eG(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var iG=(0,Z.createContext)(null);function aG(e,t){let n=(0,Z.useRef)({getLayout:()=>({}),setLayout:UU});(0,Z.useImperativeHandle)(t,()=>n.current,[]),eG(()=>{Object.assign(n.current,FW({groupId:e}))})}function oG({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=tG(e=>{AW(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=tG((e,t)=>{AW(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=$W(s),v=(0,Z.useRef)(null),[y,b]=QW(),x=(0,Z.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=nG(v,a);aG(_,o);let C=tG((e,t)=>{let r=zU(),i=aW(e),a=oW(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=rG({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=DU(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=DU(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=aW(_),i=oW(_);r&&i&&lW(r,{...i,derivedPanelConstraints:TU(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 eG(()=>{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=ZW(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=oW(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=cW(_,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=EW(t.collapsedSize,i[t.panelId]),a=EW(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=zU().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)(iG.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})})}oG.displayName=`Group`;function sG(){let e=(0,Z.useContext)(iG);return EU(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function cG(e,t){let{id:n}=sG(),r=(0,Z.useRef)({collapse:WU,expand:WU,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:WU});(0,Z.useImperativeHandle)(t,()=>r.current,[]),eG(()=>{Object.assign(r.current,MW({groupId:n,panelId:e}))})}function lG({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=$W(c),_=rG({disabled:a}),v=(0,Z.useRef)(null),y=nG(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=sG(),T=d!==null,E=tG((e,t,n)=>{d?.(e,c,n)});eG(()=>{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]),cG(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Z.useSyncExternalStore)(e=>cW(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:{...uG,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})})}lG.displayName=`Panel`;var uG={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function dG({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=jW({layout:kW({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=jW({layout:kW({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function fG({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=$W(a),l=rG({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),_=nG(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=sG(),C=b===`horizontal`?`vertical`:`horizontal`;eG(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=BU(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=cW(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(dG({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})}fG.displayName=`Separator`;function pG({className:e,...t}){return(0,Q.jsx)(oG,{"data-slot":`resizable-panel-group`,className:X(`flex h-full w-full aria-[orientation=vertical]:flex-col`,e),...t})}function mG({...e}){return(0,Q.jsx)(lG,{"data-slot":`resizable-panel`,...e})}function hG({withHandle:e,className:t,...n}){return(0,Q.jsx)(fG,{"data-slot":`resizable-handle`,className:X(`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 gG(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)(Oi,{open:n,onOpenChange:r,children:i}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function _G(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=X(`h-svh min-w-0 flex-1 bg-frame 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)(mG,{id:`navigator`,defaultSize:248,minSize:220,maxSize:420,children:(0,Q.jsx)(GV,{...n})}),(0,Q.jsx)(hG,{"aria-label":`Worktree navigator and document panes`,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)(mG,{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)(pG,{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 vG(e,t,n,r){let i=(0,$.c)(14),a;i[0]!==e||i[1]!==t?(a=Ic({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]=xa(a.archive,o),l=xi(),u=on(),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 yG(e){let t=(0,$.c)(29),{connection:n,reviewId:r,beforeLeave:i,menuItem:a}=e,o=i===void 0?bG:i,s=a!==void 0&&a,c=Vs(n),l;t[0]===c?l=t[1]:(l=zc(c),t[0]=c,t[1]=l);let u=l,d;t[2]===c?d=t[3]:(d=Js(c),t[2]=c,t[3]=d);let f=d,{submit:p}=vG(n,r),m;t[4]!==o||t[5]!==n||t[6]!==r||t[7]!==u||t[8]!==p?(m=()=>{if(!u)return;let e=As(u);IP.openWithPayload({connection:n,reviewId:r,options:e,requestId:crypto.randomUUID(),beforeLeave:o}),p({options:e})},t[4]=o,t[5]=n,t[6]=r,t[7]=u,t[8]=p,t[9]=m):m=t[9];let h=m;if(s){let e=!u,n;t[10]!==f||t[11]!==u?(n=!u&&f&&(0,Q.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:f}),t[10]=f,t[11]=u,t[12]=n):n=t[12];let r;t[13]===n?r=t[14]:(r=(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[`Archive`,n]}),t[13]=n,t[14]=r);let i;return t[15]!==h||t[16]!==e||t[17]!==r?(i=(0,Q.jsx)(fI,{disabled:e,onClick:h,children:r}),t[15]=h,t[16]=e,t[17]=r,t[18]=i):i=t[18],i}let g=!u,_;t[19]!==h||t[20]!==g?(_=(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,disabled:g,focusableWhenDisabled:!0,onClick:h,children:`Archive`}),t[19]=h,t[20]=g,t[21]=_):_=t[21];let v=_;if(u||!f)return v;let y;t[22]===v?y=t[23]:(y=(0,Q.jsx)(De,{render:v}),t[22]=v,t[23]=y);let b;t[24]===f?b=t[25]:(b=(0,Q.jsx)(Et,{children:f}),t[24]=f,t[25]=b);let x;return t[26]!==y||t[27]!==b?(x=(0,Q.jsxs)(dt,{children:[y,b]}),t[26]=y,t[27]=b,t[28]=x):x=t[28],x}function bG(){}function xG(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(nM,{handle:IP,children:SG}),e[0]=t):t=e[0],t}function SG(e){let{payload:t}=e;return t&&(0,Q.jsx)(CG,{...t},t.requestId)}function CG(e){let t=(0,$.c)(31),{connection:n,reviewId:r,options:i,beforeLeave:a}=e,{result:o,submit:s}=vG(n,r,wG,a),[c,l]=(0,Z.useState)(!1),u;t[0]===o?u=t[1]:(u=tt(o)?o.value:void 0,t[0]=o,t[1]=u);let d=u?.plan,p=`Checking the worktree and branches…`;if(f(o)&&(p=`Archiving could not be completed.`),d){let e;t[2]===d?e=t[3]:(e=yc(d),t[2]=d,t[3]=e),p=e}let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(pM,{children:`Archive review?`}),t[4]=m):m=t[4];let h;t[5]===p?h=t[6]:(h=(0,Q.jsxs)(dM,{children:[m,(0,Q.jsx)(mM,{className:`whitespace-pre-wrap [overflow-wrap:anywhere]`,children:p})]}),t[5]=p,t[6]=h);let g;t[7]===o?g=t[8]:(g=f(o)?(0,Q.jsx)(`p`,{role:`alert`,children:Vl(ht(o.cause))}):null,t[7]=o,t[8]=g);let _;t[9]!==c||t[10]!==d?(_=d&&(d.dirty||d.unpushed)?(0,Q.jsxs)(zi,{orientation:`horizontal`,children:[(0,Q.jsx)(Wr,{checked:c,onCheckedChange:l,id:`archive-discard-changes`}),(0,Q.jsx)(Vr,{htmlFor:`archive-discard-changes`,children:`I understand the risk of losing changes and commits`})]}):null,t[9]=c,t[10]=d,t[11]=_):_=t[11];let v;t[12]===o.waiting?v=t[13]:(v=(0,Q.jsx)(gM,{disabled:o.waiting,children:`Cancel`}),t[12]=o.waiting,t[13]=v);let y=o.waiting||!d||(d.dirty||d.unpushed)&&!c,b;t[14]!==c||t[15]!==i||t[16]!==d||t[17]!==s?(b=()=>{d&&s({options:i,confirmation:{plan:d,discardChanges:c}})},t[14]=c,t[15]=i,t[16]=d,t[17]=s,t[18]=b):b=t[18];let x=o.waiting?`Checking…`:`Archive review`,S;t[19]!==y||t[20]!==b||t[21]!==x?(S=(0,Q.jsx)(Y,{variant:`destructive`,disabled:y,onClick:b,children:x}),t[19]=y,t[20]=b,t[21]=x,t[22]=S):S=t[22];let C;t[23]!==S||t[24]!==v?(C=(0,Q.jsxs)(fM,{children:[v,S]}),t[23]=S,t[24]=v,t[25]=C):C=t[25];let w;return t[26]!==C||t[27]!==h||t[28]!==g||t[29]!==_?(w=(0,Q.jsxs)(uM,{children:[h,g,_,C]}),t[26]=C,t[27]=h,t[28]=g,t[29]=_,t[30]=w):w=t[30],w}function wG(){return IP.close()}function TG(e,t){return hi(t).filter(t=>{let n=e.getItem(t);return n!==null&&`isExpanded`in n&&n.isExpanded()})}function EG(e){let t=(0,$.c)(32),n=(0,Z.useId)(),r;t[0]===n?r=t[1]:(r=fl(n),t[0]=n,t[1]=r);let i=r,a=Rr(xt),[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=e=>{if(e)return OG(e,a,i,l,s)},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,Ln(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)(lI,{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:DG,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)(cI,{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 DG(){return!1}function OG(e,t,n,r,i){let a=()=>Gt(t.get(n)),o=Gl(a().owner),s=t.get(o),c=new Set(s.expanded),l=s.document===a().selected,u=!0,d=!1,f={selected:s.document,complete:s.document===a().selected},p=null,m,h=new Set;function g(e){let t=requestAnimationFrame(()=>{h.delete(t),u&&e()});h.add(t)}let _=new nw({paths:a().paths,density:`default`,flattenEmptyDirectories:!0,initialExpansion:`closed`,icons:lw(a().links),unsafeCSS:`:not([data-item-git-status="ignored"]) > [data-item-section="icon"] > svg, [data-icon-name="file-tree-icon-chevron"] { color: var(--trees-fg-muted); } [data-item-selected="true"]:not([data-item-git-status="ignored"]) > [data-item-section="icon"] > svg:not([data-icon-name="file-tree-icon-chevron"]) { color: var(--trees-selected-fg); } [data-item-git-status]:not([data-item-git-status="ignored"]) > [data-item-section="content"] { color: inherit; } [data-context-menu-open] { outline: 1px solid var(--trees-fg-muted); outline-offset: -1px; border-radius: 4px; }`,gitStatus:a().gitStatus,search:!1,onSearchChange:e=>{e??a().onFilterChange(``)},renaming:{onError:e=>{p=null,a().onInvalidName(e),queueMicrotask(()=>{u&&_.resetPaths(a().paths)})},onRename:e=>{let t=p;p=null,(t?.path.replace(/\/$/,``)===e.sourcePath.replace(/\/$/,``)?a().onCreate(e.destinationPath,t.kind):a().onMove(e.sourcePath,e.destinationPath)).catch(()=>{u&&_.resetPaths(a().paths)})}},dragAndDrop:{canDrag:()=>(d=!0,queueMicrotask(()=>{d=!1}),!0),canDrop:({draggedPaths:e,target:t})=>Zr(e,t.directoryPath??``),onDropComplete:e=>{let t=a().onMove;gr(ua(e.draggedPaths,e.target.directoryPath??``,(e,n)=>en({try:()=>t(e,n),catch:e=>new ot(e)}))).catch(()=>{u&&_.resetPaths(a().paths)})}},renderRowDecoration:({item:e})=>{let t=a().links.find(t=>t.path===e.path);return t?{text:t.kind===`symlink`?`→ ${t.target??`?`}`:`submodule`,title:`Not followed`}:null},onSelectionChange:([e])=>{!d&&e&&p?.path.replace(/\/$/,``)!==e.replace(/\/$/,``)&&e!==a().selected&&a().onSelect(e)}});function v(){a().bindCollapseAll(()=>{d=!0,c.clear(),l=!1,f={selected:a().selected,complete:!0},_.setSearch(null),_.resetPaths(a().paths,{initialExpandedPaths:[]}),d=!1}),a().bindRename(e=>{g(()=>{d=!0,_.startRenaming(e),d=!1})})}function y(){let{creating:t}=a();if(!t||m===t.nonce)return;m=t.nonce;let n=wi(t.kind,t.folder,e=>_.getItem(e)!==null);p={path:n,kind:t.kind},_.add(n),_.startRenaming(n,{removeIfCanceled:!0}),g(()=>{let t=e.querySelector(`[data-slot="file-tree"]`)?.shadowRoot?.querySelector(`[data-item-rename-input]`);t instanceof HTMLInputElement&&t.focus()})}function b(){let e=TG(_,a().paths).map(e=>e.replace(/\/$/,``));e.length&&a().onExpand(e)}function x(){a().onContentHeight?.(_.getVisibleCount()*_.getItemHeight())}function S(){if(p)return;let{selected:e}=a(),t=a().paths;f.selected!==e&&(f={selected:e,complete:!1});let n=Ls(t.flatMap(e=>{let t=a().kinds.get(e);return t===void 0?[]:[{path:e,kind:t}]}),new Set([...TG(_,t),...c]),new Set(hi(t).filter(e=>_.getItem(e)!==null))).map(e=>`${e}/`);d=!0;{let r=f.complete?[]:pr(e);_.resetPaths(t,{initialExpandedPaths:[...new Set([...n,...r])]});for(let e of c)_.getItem(e)!==null&&c.delete(e);let i=_.getItem(e);!f.complete&&i&&!i.isDirectory()&&(i.select(),f.complete=!0)}if(d=!1,l){d=!0;for(let e of s.selected)_.getItem(e)?.select();s.focused&&_.getItem(s.focused)&&_.focusPath(s.focused),s.anchor&&_.getItem(s.anchor)&&(_.scrollToPath(s.anchor,{focus:!1,offset:`top`}),l=!1),d=!1}b()}let C;function w(){let e=a();v(),d=!0,(!C||C.filter!==e.filter)&&_.setSearch(e.filter===``?null:e.filter),d=!1,(!C||C.paths.join(`\0`)!==e.paths.join(`\0`)||C.selected!==e.selected)&&S(),C?.gitStatus!==e.gitStatus&&_.setGitStatus(e.gitStatus),C?.links!==e.links&&_.setIcons(lw(e.links)),C=e,y(),x()}let T=t.subscribe(n,w),E=_.subscribe(()=>{x(),d||b()});function D(e){let t=p;if(!t)return;let n=e.composedPath().find(e=>e instanceof HTMLInputElement&&e.hasAttribute(`data-item-rename-input`));if(n?.value.trim()===``){p=null,g(S);return}n?.value===ga(t.path)&&(p=null,a().onCreate(t.path,t.kind).catch(()=>{u&&_.resetPaths(a().paths)}))}function O(e){let t=e.composedPath().find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-item-path`)),n=t?.dataset.itemPath,o=n===void 0?null:_.getItem(n);if(!t||!n||!o||t.querySelector(`[data-item-rename-input]`))return!1;let s={restore:!0},{paths:c,filter:l}=a();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,i(!1)},rename:()=>{g(()=>{d=!0,_.startRenaming(n),d=!1})},item:{path:n,name:ga(n),kind:o.isDirectory()?`directory`:`file`}}),!0}function k(e){e.key===`Enter`&&D(e),e.key===`Escape`&&p&&(p=null,g(S))}function A(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||a().kinds.get(n)!==`file`)return;let r=_.getItem(n);if(r&&p?.path!==n){e.preventDefault(),e.stopPropagation(),d=!0;for(let e of _.getSelectedPaths())e!==n&&_.getItem(e)?.deselect();r.select(),d=!1,a().onSelect(n,e.altKey)}}function j(e){O(e)||e.stopPropagation()}return e.addEventListener(`keydown`,k,!0),e.addEventListener(`click`,A,!0),e.addEventListener(`blur`,D,!0),e.addEventListener(`contextmenu`,j,!0),e.addEventListener(`touchstart`,j,!0),_.render({containerWrapper:e}),_.getFileTreeContainer()?.setAttribute(`class`,`min-h-0 flex-1`),_.getFileTreeContainer()?.setAttribute(`data-slot`,`file-tree`),_.getFileTreeContainer()?.setAttribute(`aria-label`,`Worktree files`),w(),()=>{let n=_.getFileTreeContainer(),r=n?.getBoundingClientRect().top??0,i=[...n?.shadowRoot?.querySelectorAll(`[data-item-path]`)??[]].find(e=>e.getBoundingClientRect().bottom>r)?.dataset.itemPath??null;t.set(o,{expanded:[...new Set([...TG(_,a().paths),...c])],selected:_.getSelectedPaths(),focused:_.getFocusedPath(),anchor:i,document:a().selected}),u=!1;for(let e of h)cancelAnimationFrame(e);T(),E(),a().bindRename(()=>void 0),a().bindCollapseAll(()=>void 0),e.removeEventListener(`keydown`,k,!0),e.removeEventListener(`click`,A,!0),e.removeEventListener(`blur`,D,!0),e.removeEventListener(`contextmenu`,j,!0),e.removeEventListener(`touchstart`,j,!0),_.cleanUp(),e.replaceChildren()}}function kG(e,t){if(t.close(e!==`rename`&&e!==`new-file`&&e!==`new-folder`&&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`?Yi(t.path,`relative path`):e===`copy-full`?Yi(`${t.worktreePath.replace(/\/$/,``)}/${t.path}`,`full path`):t.onTrash(t.path)}var AG={"new-file":cf,"new-folder":wf,rename:C,duplicate:qd,open:rf,"open-file":rf,"open-to-side":Gd,"open-diff":of,timeline:gp,pin:op,hide:$d,"copy-relative":He,"copy-full":He,trash:Pp};function jG(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)(NG,{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)(uI,{"aria-label":s,className:`w-max max-w-[calc(100vw-2rem)] whitespace-nowrap`,onKeyDownCapture:MG,finalFocus:r,children:c}),t[4]=r,t[5]=s,t[6]=c,t[7]=l):l=t[7],l}function MG(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 NG({actions:e,hidden:t,onAction:n}){return e.map(e=>(0,Q.jsx)(PG,{action:e,onAction:n,hidden:t},e.id))}function PG(e){let t=(0,$.c)(15),{action:n,onAction:r,hidden:i}=e,a=n.id===`hide`&&i?tf:AG[n.id],o;t[0]===n.id?o=t[1]:(o=(n.id===`hide`||n.id===`copy-relative`||n.id===`trash`)&&(0,Q.jsx)(pI,{}),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)(fI,{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 FG(e){let t=(0,$.c)(7),{label:n,count:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`span`,{className:`flex-1`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r===void 0?null:(0,Q.jsx)(`span`,{className:`tabular-nums`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`h3`,{className:`flex h-7 shrink-0 items-center gap-1 px-6 text-2xs font-medium text-muted-foreground`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var IG={added:`A`,deleted:`D`,modified:`M`,renamed:`R`,untracked:`U`},LG={resolved:`Not followed`,loading:`Loading…`,missing:`Missing`,unavailable:`Listing unavailable · Open as file`};function RG(e){let t=(0,$.c)(32),{entries:n,expanded:r,onExpand:i,onRetry:a,renderDirectory:o,statuses:s,selected:c,onOpen:l,onUnpin:u,menuFor:d}=e,[f,p]=(0,Z.useState)(!1);if(n.length===0)return null;let m;t[0]===s?m=t[1]:(m=new Map(s.flatMap(zG)),t[0]=s,t[1]=m);let h=m,g;t[2]===n.length?g=t[3]:(g=(0,Q.jsx)(FG,{label:`Pinned`,count:n.length}),t[2]=n.length,t[3]=g);let _;if(t[4]!==n||t[5]!==r||t[6]!==h||t[7]!==d||t[8]!==i||t[9]!==l||t[10]!==a||t[11]!==u||t[12]!==f||t[13]!==o||t[14]!==c){let e;t[16]!==r||t[17]!==h||t[18]!==d||t[19]!==i||t[20]!==l||t[21]!==a||t[22]!==u||t[23]!==f||t[24]!==o||t[25]!==c?(e=e=>{let{path:t}=e,n=e.state===`resolved`&&e.entry.kind===`directory`,s=r.includes(t),m=e.state===`unavailable`||e.state===`resolved`&&(e.entry.kind===`file`||n),g=t.lastIndexOf(`/`)+1,_=d(n?`${t}/`:t);return(0,Q.jsxs)(cI,{onOpenChange:e=>{e&&p(!1)},children:[(0,Q.jsxs)(lI,{render:(0,Q.jsx)(`li`,{className:`flex flex-wrap items-center gap-0.5`}),children:[(0,Q.jsx)(fr,{text:t,className:`min-w-0`,renderTrigger:(r,a)=>(0,Q.jsxs)(`button`,{type:`button`,"data-file-tree-row":``,"aria-label":e.state===`unavailable`?`Open ${t} as file`:t,"aria-current":t===c?`page`:void 0,"aria-expanded":n?s:void 0,disabled:!m,className:X(`flex h-7.5 min-w-0 flex-1 items-center gap-1.5 rounded-md px-2 text-left hover:bg-accent`,t===c&&`bg-accent`),onClick:e=>n?i(t,!s):l(t,e.altKey),children:[n?(0,Q.jsx)(pw,{expanded:s,className:`size-4 shrink-0`}):(0,Q.jsx)(pw,{path:t,className:`size-4 shrink-0`}),r,g>0&&a(t.slice(0,g-1),`shrink-[100] text-muted-foreground`),h.has(t)&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:X(`ml-auto shrink-0 pl-1 font-mono text-2xs text-muted-foreground`,h.get(t)===IG.modified&&`text-brand`),children:h.get(t)})]}),children:t.slice(g)}),(!m||e.state===`unavailable`)&&(0,Q.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:LG[e.state]}),e.state===`unavailable`&&(0,Q.jsx)(Y,{variant:`outline`,size:`xs`,onClick:a,children:`Try again`}),(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Y,{size:`icon-xs`,variant:`ghost`,"aria-label":`Unpin ${t}`,onClick:()=>u(t)}),children:(0,Q.jsx)(cp,{})}),(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:`Unpin ${t}`})]}),n&&s&&(0,Q.jsx)(`div`,{className:`w-full`,children:o(t)})]}),(0,Q.jsx)(uI,{finalFocus:!f,children:(0,Q.jsx)(NG,{actions:_.actions,hidden:_.hidden,onAction:e=>{e===`open-to-side`&&(0,od.flushSync)(()=>p(!0)),_.onAction(e)}})})]},t)},t[16]=r,t[17]=h,t[18]=d,t[19]=i,t[20]=l,t[21]=a,t[22]=u,t[23]=f,t[24]=o,t[25]=c,t[26]=e):e=t[26],_=n.map(e),t[4]=n,t[5]=r,t[6]=h,t[7]=d,t[8]=i,t[9]=l,t[10]=a,t[11]=u,t[12]=f,t[13]=o,t[14]=c,t[15]=_}else _=t[15];let v;t[27]===_?v=t[28]:(v=(0,Q.jsx)(`ul`,{className:`px-4`,children:_}),t[27]=_,t[28]=v);let y;return t[29]!==g||t[30]!==v?(y=(0,Q.jsxs)(`section`,{"aria-label":`Pinned files`,className:`shrink-0 pt-1.5 pb-1`,children:[g,v]}),t[29]=g,t[30]=v,t[31]=y):y=t[31],y}function zG(e){let t=IG[e.status];return t===void 0?[]:[[e.path,t]]}function BG(e){let t=(0,$.c)(9),{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s,actionsTarget:c}=e,l=`${r.environmentId}:${n.projectId}:${n.worktreeId}`,u;return t[0]!==c||t[1]!==r||t[2]!==o||t[3]!==n||t[4]!==l||t[5]!==a||t[6]!==s||t[7]!==i?(u=(0,Q.jsx)(VG,{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s,actionsTarget:c},l),t[0]=c,t[1]=r,t[2]=o,t[3]=n,t[4]=l,t[5]=a,t[6]=s,t[7]=i,t[8]=u):u=t[8],u}function VG(e){let t=(0,$.c)(78),{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s,actionsTarget:c}=e,l=eM(r,n,``),u=$l(r,n),d=f(u.result)?ht(u.result.cause):void 0,[p,m]=(0,Z.useState)(),[h,g]=(0,Z.useState)(null),_=Ts(Te(rP(n,r))),v=VP(r,n.projectId),y=wP(r,n.projectId),b=WP(r,n.projectId),x=TP(r,n.projectId),S=`${r.environmentId}:${n.projectId}:${n.worktreeId}`,C=Cu(S),{showHidden:w,query:T,requested:E,pinnedExpanded:D}=C.state,O;t[0]===C?O=t[1]:(O=e=>C.set(t=>({...t,showHidden:e})),t[0]=C,t[1]=O);let k=O,A;t[2]===C?A=t[3]:(A=e=>C.set(t=>({...t,query:e})),t[2]=C,t[3]=A);let j=A,M;t[4]===C?M=t[5]:(M=e=>C.set(t=>{let n=e(t.requested);return n===t.requested?t:{...t,requested:n}}),t[4]=C,t[5]=M);let N=M,P=T===``?`Collapse all`:`Clear search and collapse all`,F;t[6]!==b||t[7]!==E||t[8]!==a?(F=nK(nK(nK(E,Zl(b.map(tK))),[``]),Pc(a)),t[6]=b,t[7]=E,t[8]=a,t[9]=F):F=t[9];let I=tM(r,n,F),L=[l,...I.results.flatMap(eK)],R=Au(L),z=R.map($G),B=Ml(z,v,w),V=new Map(R.map(QG)),H;t[10]===I.results?H=t[11]:(H=I.results.filter(f),t[10]=I.results,t[11]=H);let U=H,W=[{path:``,status:`loaded`,entries:l.entries},...I.states],G=lu(Ml(b,v,w),W),K=[...R.filter(ZG).map(XG),...(_?.changes??[]).flatMap(YG).map(JG)],ee=new Set((_?.changes??[]).map(qG)),q=new Set(R.filter(KG).map(GG)),te;t[12]===o?te=t[13]:(te=(e,t)=>o({kind:`file`,path:e},void 0,{toSide:t!==void 0&&t}),t[12]=o,t[13]=te);let ne=te,re=e=>u.duplicate(e,Ka(e,e=>V.has(e)),ne),ie;t[14]!==re||t[15]!==u.result.waiting||t[16]!==a?(ie=()=>{u.result.waiting||re(a)},t[14]=re,t[15]=u.result.waiting,t[16]=a,t[17]=ie):ie=t[17];let ae=q.has(a),oe;t[18]===ae?oe=t[19]:(oe={enabled:ae,ignoreInputs:!0},t[18]=ae,t[19]=oe),pc(cc.duplicateFile,ie,oe);let ce=(e,t)=>{let n=t!==void 0&&t,r=V.get(e);r===`symlink`||r===`submodule`?o({kind:`file`,path:e},void 0,{toSide:n}):r===`file`&&ne(e,n)},{collapseAll:le,renameFile:ue,bindCollapseAll:de,bindRename:fe}=gl(S),pe=e=>{let t=vl(e,v),n=R.find(t=>Tu(t.path)===Tu(e));return{hidden:t!==null,actions:ji(n,{changed:ee.has(e),openToSideLabel:s,hiddenEntry:t,ownHidden:t===Tu(e),hiddenName:t?.replace(/\/$/,``).split(`/`).at(-1)??``,pinned:n?.kind===`file`||n?.kind===`directory`?b.includes(Tu(e)):void 0}),run:(n,r,a)=>kG(n,{path:e,hiddenEntry:t,worktreePath:i,close:r,rename:a,onStartCreate:(e,t)=>{u.result.waiting||m({kind:e,folder:t,nonce:Date.now()})},onOpenFile:e=>o({kind:`file`,path:e}),onOpenToSide:e=>ne(e,!0),onOpenDiff:e=>o({kind:`change`,path:e}),onOpenTimeline:e=>o({kind:`timeline`,path:e}),onSetHidden:(e,t)=>mt(y.submit({path:e,hidden:t})),onTogglePinned:e=>mt(x.submit({path:e,pinned:!b.includes(Tu(e))})),onTrash:g,onDuplicate:e=>{u.result.waiting||re(e)}})}},J;t[20]!==u||t[21]!==o?(J=(e,t)=>u.create(e,t,e=>o({kind:`file`,path:e})),t[20]=u,t[21]=o,t[22]=J):J=t[22];let me;t[23]===N?me=t[24]:(me=e=>N(t=>nK(t,e)),t[23]=N,t[24]=me);let he={owner:S,filter:T,onFilterChange:j,paths:B,kinds:V,links:R.filter(WG),creating:p,onCreate:J,onMove:u.move,gitStatus:K,selected:a,bindRename:fe,bindCollapseAll:de,onInvalidName:UG,renderMenu:(e,t,n)=>{let r=e.kind===`directory`&&!e.path.endsWith(`/`)?`${e.path}/`:e.path,i=pe(r);return(0,Q.jsx)(jG,{path:r,finalFocus:t.finalFocus,actions:i.actions,hidden:i.hidden,onAction:e=>i.run(e,t.close,n)},r)},onExpand:me,onSelect:ce},ge;t[25]===j?ge=t[26]:(ge=e=>j(e.target.value),t[25]=j,t[26]=ge);let _e;t[27]!==T||t[28]!==ge?(_e=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 px-2 pt-2`,children:(0,Q.jsx)(se,{"aria-label":`Search files`,placeholder:`Search...`,value:T,onChange:ge,className:`h-7 w-auto min-w-0 flex-1`})}),t[27]=T,t[28]=ge,t[29]=_e):_e=t[29];let ve;t[30]!==c||t[31]!==le||t[32]!==P||t[33]!==u.result.waiting?(ve=c&&(0,od.createPortal)((0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Ja,{children:[(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Pr,{render:(0,Q.jsx)(Y,{size:`icon-sm`,variant:`ghost`,"aria-label":`Create file or folder`,disabled:u.result.waiting}),children:(0,Q.jsx)(up,{className:`text-muted-foreground`})})}),(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:`Create file or folder`})]}),(0,Q.jsxs)(Ni,{align:`end`,children:[(0,Q.jsxs)(hr,{onClick:()=>m({kind:`file`,folder:``,nonce:Date.now()}),children:[(0,Q.jsx)(cf,{}),`New file`]}),(0,Q.jsxs)(hr,{onClick:()=>m({kind:`directory`,folder:``,nonce:Date.now()}),children:[(0,Q.jsx)(wf,{}),`New folder`]})]})]}),(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Y,{size:`icon-sm`,variant:`ghost`,"aria-label":P,onClick:()=>le()}),children:(0,Q.jsx)(Kf,{className:`text-muted-foreground`})}),(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:P})]})]}),c),t[30]=c,t[31]=le,t[32]=P,t[33]=u.result.waiting,t[34]=ve):ve=t[34];let ye;t[35]!==C||t[36]!==N?(ye=(e,t)=>{C.set(n=>({...n,pinnedExpanded:t?nK(n.pinnedExpanded,[e]):n.pinnedExpanded.filter(t=>t!==e)})),t&&N(t=>nK(t,[e]))},t[35]=C,t[36]=N,t[37]=ye):ye=t[37];let be;t[38]===I?be=t[39]:(be=()=>I.retry(),t[38]=I,t[39]=be);let xe;t[40]===x?xe=t[41]:(xe=e=>mt(x.submit({path:e,pinned:!1})),t[40]=x,t[41]=xe);let Se;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Q.jsx)(FG,{label:`All files`}),t[42]=Se):Se=t[42];let Ce=h!==null,we;t[43]===u.result.waiting?we=t[44]:(we=e=>{!e&&!u.result.waiting&&g(null)},t[43]=u.result.waiting,t[44]=we);let Ee;t[45]===h?Ee=t[46]:(Ee=(0,Q.jsxs)(pM,{children:[`Move `,h,` to the trash?`]}),t[45]=h,t[46]=Ee);let Oe=h!=null&&ee.has(h)?`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.`,ke;t[47]===Oe?ke=t[48]:(ke=(0,Q.jsx)(mM,{children:Oe}),t[47]=Oe,t[48]=ke);let Ae;t[49]!==Ee||t[50]!==ke?(Ae=(0,Q.jsxs)(dM,{children:[Ee,ke]}),t[49]=Ee,t[50]=ke,t[51]=Ae):Ae=t[51];let je;t[52]===u.result.waiting?je=t[53]:(je=(0,Q.jsx)(gM,{disabled:u.result.waiting,children:`Cancel`}),t[52]=u.result.waiting,t[53]=je);let Me;t[54]!==h||t[55]!==u?(Me=()=>{h&&u.trash(h,()=>g(null))},t[54]=h,t[55]=u,t[56]=Me):Me=t[56];let Ne;t[57]!==u.result.waiting||t[58]!==Me?(Ne=(0,Q.jsx)(Y,{variant:`destructive`,disabled:u.result.waiting,onClick:Me,children:`Move to trash`}),t[57]=u.result.waiting,t[58]=Me,t[59]=Ne):Ne=t[59];let Pe;t[60]!==je||t[61]!==Ne?(Pe=(0,Q.jsxs)(fM,{children:[je,Ne]}),t[60]=je,t[61]=Ne,t[62]=Pe):Pe=t[62];let Fe=d!==void 0&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:Lc(d)}),Ie;t[63]!==Ae||t[64]!==Pe||t[65]!==Fe?(Ie=(0,Q.jsxs)(uM,{children:[Ae,Pe,Fe]}),t[63]=Ae,t[64]=Pe,t[65]=Fe,t[66]=Ie):Ie=t[66];let Le;t[67]!==Ce||t[68]!==we||t[69]!==Ie?(Le=(0,Q.jsx)(oM,{open:Ce,onOpenChange:we,children:Ie}),t[67]=Ce,t[68]=we,t[69]=Ie,t[70]=Le):Le=t[70];let Re;t[71]===x.result?Re=t[72]:(Re=f(x.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`border-t px-3 py-2 text-xs text-destructive`,children:Hs(ht(x.result.cause))}),t[71]=x.result,t[72]=Re);let ze;t[73]===y.result?ze=t[74]:(ze=f(y.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`border-t px-3 py-2 text-xs text-destructive`,children:Hs(ht(y.result.cause))}),t[73]=y.result,t[74]=ze);let Be;return t[75]!==I||t[76]!==U.length?(Be=U.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)(Y,{variant:`outline`,size:`xs`,onClick:()=>I.retry(),children:`Try again`})]}),t[75]=I,t[76]=U.length,t[77]=Be):Be=t[77],(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[_e,ve,(0,Q.jsx)(RG,{entries:G,expanded:D,onExpand:ye,onRetry:be,renderDirectory:e=>(0,Q.jsx)(rK,{prefix:`${e}/`,input:he}),statuses:K,selected:a,onOpen:ne,onUnpin:xe,menuFor:e=>{let t=pe(e);return{actions:G.some(t=>t.path===Tu(e)&&t.state===`resolved`)?t.actions:[],hidden:t.hidden,onAction:n=>t.run(n,HG,()=>ue(e))}}}),(0,Q.jsxs)(`section`,{"aria-label":`All files`,className:`flex min-h-0 flex-1 flex-col pt-1`,children:[Se,(0,Q.jsx)(EG,{...he}),v.size>0&&(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 px-3.5 py-2 text-2xs text-muted-foreground`,children:[(0,Q.jsx)($d,{className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{children:Tl(v,e=>V.get(e)??V.get(`${e}/`))}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsx)(Y,{variant:`link`,size:`xs`,onClick:()=>k(!w),children:w?`Hide`:`Show`})]})]}),Le,d!==void 0&&!h&&(0,Q.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-destructive`,children:Lc(d)}),Re,ze,Be]})}function HG(){}function UG(e){return xc.add({title:`Invalid name`,description:e,type:`error`})}function WG(e){return e.kind===`symlink`||e.kind===`submodule`}function GG(e){return e.path}function KG(e){return e.kind===`file`}function qG(e){return e.path}function JG(e){return{path:AN(e),status:il(e)}}function YG(e){return e.comparisons}function XG(e){return{path:e.path,status:`ignored`}}function ZG(e){return e.ignored}function QG(e){return[e.path,e.kind]}function $G(e){return e.path}function eK(e){return J(Te(e))}function tK(e){return{path:e,pinned:!0,hidden:!1}}function nK(e,t){let n=[...new Set([...e,...t])].sort();return n.length===e.length&&n.every((t,n)=>t===e[n])?e:n}function rK(e){let t=(0,$.c)(69),{prefix:n,input:r}=e,[i,a]=(0,Z.useState)(0),o;t[0]===n.length?o=t[1]:(o=e=>e.slice(n.length),t[0]=n.length,t[1]=o);let s=o,c,l,u,d,f,p,m,h;if(t[2]!==i||t[3]!==r||t[4]!==n||t[5]!==s){let e;t[14]===n?e=t[15]:(e=e=>e.startsWith(n)&&e!==n,t[14]=n,t[15]=e);let o=r.paths.filter(e);m=`flex max-h-52 min-h-0 flex-col pl-1.5`,t[16]===i?h=t[17]:(h={height:i},t[16]=i,t[17]=h),c=EG,l=r,u=a,d=`${r.owner}:pin:${n}`,f=o.map(s);let g;t[18]!==r.kinds||t[19]!==s?(g=e=>{let t=r.kinds.get(e);return t===void 0?[]:[[s(e),t]]},t[18]=r.kinds,t[19]=s,t[20]=g):g=t[20],p=new Map(o.flatMap(g)),t[2]=i,t[3]=r,t[4]=n,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;if(t[21]!==r.links||t[22]!==n||t[23]!==s){let e;t[25]===n?e=t[26]:(e=e=>e.path.startsWith(n),t[25]=n,t[26]=e);let i;t[27]===s?i=t[28]:(i=e=>({...e,path:s(e.path)}),t[27]=s,t[28]=i),g=r.links.filter(e).map(i),t[21]=r.links,t[22]=n,t[23]=s,t[24]=g}else g=t[24];let _;if(t[29]!==r.gitStatus||t[30]!==n||t[31]!==s){let e;t[33]===n?e=t[34]:(e=e=>e.path.startsWith(n),t[33]=n,t[34]=e);let i;t[35]===s?i=t[36]:(i=e=>({...e,path:s(e.path)}),t[35]=s,t[36]=i),_=r.gitStatus.filter(e).map(i),t[29]=r.gitStatus,t[30]=n,t[31]=s,t[32]=_}else _=t[32];let v;t[37]!==r.selected||t[38]!==n||t[39]!==s?(v=r.selected.startsWith(n)?s(r.selected):``,t[37]=r.selected,t[38]=n,t[39]=s,t[40]=v):v=t[40];let y,b,x,S;t[41]!==r||t[42]!==n?(y=(e,t)=>r.onCreate(`${n}${e}`,t),b=(e,t)=>r.onMove(`${n}${e}`,`${n}${t}`),x=(e,t)=>r.onSelect(`${n}${e}`,t),S=e=>r.onExpand(e.map(e=>`${n}${e}`)),t[41]=r,t[42]=n,t[43]=y,t[44]=b,t[45]=x,t[46]=S):(y=t[43],b=t[44],x=t[45],S=t[46]);let C;t[47]!==r||t[48]!==n?(C=(e,t,i)=>r.renderMenu({...e,path:`${n}${e.path}`},t,i),t[47]=r,t[48]=n,t[49]=C):C=t[49];let w;t[50]!==c||t[51]!==_||t[52]!==v||t[53]!==y||t[54]!==b||t[55]!==x||t[56]!==S||t[57]!==C||t[58]!==l||t[59]!==u||t[60]!==d||t[61]!==f||t[62]!==p||t[63]!==g?(w=(0,Q.jsx)(c,{...l,onContentHeight:u,owner:d,paths:f,kinds:p,links:g,gitStatus:_,selected:v,creating:void 0,onCreate:y,onMove:b,onSelect:x,onExpand:S,bindRename:aK,bindCollapseAll:iK,renderMenu:C}),t[50]=c,t[51]=_,t[52]=v,t[53]=y,t[54]=b,t[55]=x,t[56]=S,t[57]=C,t[58]=l,t[59]=u,t[60]=d,t[61]=f,t[62]=p,t[63]=g,t[64]=w):w=t[64];let T;return t[65]!==w||t[66]!==m||t[67]!==h?(T=(0,Q.jsx)(`div`,{className:m,style:h,children:w}),t[65]=w,t[66]=m,t[67]=h,t[68]=T):T=t[68],T}function iK(){}function aK(){}function oK(e,t){let n=(0,$.c)(6),r;n[0]!==e||n[1]!==t?(r=hs({connection:e,scope:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a=Rr(i),o=yr(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 sK=gm(),cK={toggle(){sK.isOpen?sK.close():sK.open(null)},close(){sK.close()}};function lK(e,t){let n=(0,$.c)(9),{query:r,setQuery:i}=Cl(),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 uK(e){let t=(0,$.c)(1),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={enabled:!0},t[0]=n):n=t[0],pc(`Mod+P`,e,n)}function dK(e){let t=(0,$.c)(2);uK(fK);let n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(fV,{handle:sK,title:`Find a file`,description:`Find a file by name, or enter a relative path to open it.`,children:(0,Q.jsx)(pK,{...e})}),t[0]=e,t[1]=n),n}function fK(){return cK.toggle()}function pK(e){let t=(0,$.c)(15),{scope:n,connection:r,openFiles:i,onOpen:a,bindPopup:o}=e,{query:s,setQuery:c,select:l}=lK(a,cK),u=zP(r,n.projectId),d;t[0]===u.result?d=t[1]:(d=tt(u.result)&&!u.result.waiting?u.result.value:void 0,t[0]=u.result,t[1]=d);let p=d,m=new Set(p?.preferences.filter(hK).map(mK)??[]),h=Cu(`${r.environmentId}:${n.projectId}:${n.worktreeId}`).state.showHidden,g=dV,_;t[2]!==s||t[3]!==c?(_=(0,Q.jsx)(pV,{"aria-label":`Find a file by name`,placeholder:`Find a file by name`,value:s,onValueChange:c}),t[2]=s,t[3]=c,t[4]=_):_=t[4];let v;t[5]!==u||t[6]!==p?(v=p===void 0&&(0,Q.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:f(u.result)?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`block`,children:`File visibility preferences could not be loaded.`}),(0,Q.jsx)(Y,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:()=>u.refresh(),children:`Try again`})]}):`Reading file visibility…`}),t[5]=u,t[6]=p,t[7]=v):v=t[7];let y=p!==void 0&&s.trim()===``&&(0,Q.jsx)(gK,{scope:n,connection:r,openFiles:Ml(i,m,h),preferences:p.preferences.filter(e=>h||vl(e.path,m)===null),onSelect:l}),b=p!==void 0&&s.trim()!==``&&(0,Q.jsx)(SK,{scope:n,connection:r,query:s,hidden:m,showHidden:h,onSelect:l}),x;return t[8]!==g||t[9]!==o||t[10]!==_||t[11]!==v||t[12]!==y||t[13]!==b?(x=(0,Q.jsxs)(g,{ref:o,shouldFilter:!1,children:[_,v,y,b]}),t[8]=g,t[9]=o,t[10]=_,t[11]=v,t[12]=y,t[13]=b,t[14]=x):x=t[14],x}function mK(e){return e.path}function hK(e){return e.hidden}function gK(e){let t=(0,$.c)(2),{scope:n,connection:r,openFiles:i,preferences:a,onSelect:o}=e,s=a.filter(xK),c=tM(r,n,s.length===0?[]:[``,...Zl(s)]),l=lu(s.map(bK),c.states).filter(yK).map(vK),u=[...new Set([...i,...l])],d;return t[0]===c?d=t[1]:(d=c.states.some(_K)&&(0,Q.jsxs)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:[`Pinned files could not be loaded.`,(0,Q.jsx)(Y,{variant:`outline`,size:`xs`,className:`ml-2`,onClick:()=>c.retry(),children:`Try again`})]}),t[0]=c,t[1]=d),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(mV,{children:u.map(e=>(0,Q.jsx)(CK,{path:e,onSelect:o},e))}),u.length===0&&(0,Q.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`Type a file name or relative path.`}),d]})}function _K(e){return e.status===`unavailable`}function vK(e){let{path:t}=e;return t}function yK(e){return e.state===`resolved`&&e.entry.kind===`file`}function bK(e){let{path:t}=e;return t}function xK(e){return e.pinned}function SK(e){let t=(0,$.c)(26),{scope:n,connection:r,query:i,hidden:a,showHidden:o,onSelect:s}=e,c=oK(r,n),l,u,d,p,m,h;if(t[0]!==a||t[1]!==c||t[2]!==s||t[3]!==i||t[4]!==o){let e=ul(Ml(Ts(Te(c.result))?.paths??[],a,o),i),n=Nu(i),r=n!==null&&(o||vl(n,a)===null)&&!e.includes(n)?n:null;t[11]===c?p=t[12]:(p=f(c.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)(Y,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:()=>c.refresh(),children:`Try again`})]}),t[11]=c,t[12]=p),t[13]===c.result?m=t[14]:(m=qi(c.result)&&(0,Q.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`Reading file names…`}),t[13]=c.result,t[14]=m),h=!qi(c.result)&&!f(c.result)&&e.length===0&&r===null&&(0,Q.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`No file matches that name.`}),l=mV,u=r!==null&&(0,Q.jsxs)(_V,{value:r,onSelect:()=>s(r),children:[`Open path `,r]});let g;t[15]===s?g=t[16]:(g=e=>(0,Q.jsx)(CK,{path:e,onSelect:s},e),t[15]=s,t[16]=g),d=e.map(g),t[0]=a,t[1]=c,t[2]=s,t[3]=i,t[4]=o,t[5]=l,t[6]=u,t[7]=d,t[8]=p,t[9]=m,t[10]=h}else l=t[5],u=t[6],d=t[7],p=t[8],m=t[9],h=t[10];let g;t[17]!==l||t[18]!==u||t[19]!==d?(g=(0,Q.jsxs)(l,{children:[u,d]}),t[17]=l,t[18]=u,t[19]=d,t[20]=g):g=t[20];let _;return t[21]!==p||t[22]!==m||t[23]!==h||t[24]!==g?(_=(0,Q.jsxs)(Q.Fragment,{children:[p,m,h,g]}),t[21]=p,t[22]=m,t[23]=h,t[24]=g,t[25]=_):_=t[25],_}function CK(e){let t=(0,$.c)(11),{path:n,onSelect:r}=e,i=n.lastIndexOf(`/`)+1,a;t[0]!==r||t[1]!==n||t[2]!==i?(a=(e,t)=>(0,Q.jsxs)(_V,{value:n,"aria-label":n,onSelect:()=>r(n),children:[e,i>0&&t(n.slice(0,i-1),`shrink-[100] text-muted-foreground`)]}),t[0]=r,t[1]=n,t[2]=i,t[3]=a):a=t[3];let o;t[4]!==n||t[5]!==i?(o=n.slice(i),t[4]=n,t[5]=i,t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==a||t[9]!==o?(s=(0,Q.jsx)(fr,{text:n,className:`min-w-0`,renderTrigger:a,children:o}),t[7]=n,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function wK(e,t,n){let r=(0,$.c)(7),i;r[0]!==e||r[1]!==t?(i=ru({draft:e,viewer:t}),r[0]=e,r[1]=t,r[2]=i):i=r[2],ao(i);let a;r[3]!==e||r[4]!==n||r[5]!==t?(a=al({draft:e,viewer:t,fingerprint:n}),r[3]=e,r[4]=n,r[5]=t,r[6]=a):a=r[6],ao(a)}var TK=so(({connection:e,environmentIds:t})=>Br(n=>{if(!e||t.length===0)return;let r=n(Sr(e)),i=Ts(Te(r));if(!i)return;let a=e=>{i.hasUnsaved(t)&&e.preventDefault()};window.addEventListener(`beforeunload`,a),n.addFinalizer(()=>window.removeEventListener(`beforeunload`,a))}));function EK(e,t){let n=(0,$.c)(3),r;n[0]!==e||n[1]!==t?(r=TK({connection:e,environmentIds:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],ao(r)}var DK=bs([`changes`,`files`,`history`]),OK=bs([`uncommitted`,`branch`]),kK=Nt(ge.check(Bn(Ct))).pipe(de(()=>_s(Ln(void 0)))),AK=mn({surface:Nt(DK).pipe(de(()=>_s(Ln(void 0)))),entry:kK,side:kK,scope:Nt(OK).pipe(de(()=>_s(Ln(void 0)))),base:kK}),jK=qn(DK),MK=qn(OK),NK=[{id:`general`,label:`General`,icon:wp},{id:`git`,label:`Reviews & Git`,icon:Of},{id:`computers`,label:`Computers`,icon:Ss}],PK=NK[0].id,FK={reading:`max-w-186 gap-8`,list:`max-w-186 gap-7`,wide:`max-w-240 gap-5.5 md:pt-7.5`};function IK(e){return X(`settings-content wrap-anywhere mx-auto flex w-full flex-col px-4 py-6 md:px-6 md:py-9 lg:pr-10 lg:pl-6`,FK[e])}function LK(e){let t=(0,$.c)(5),{children:n,layout:r}=e,i;t[0]===r?i=t[1]:(i=IK(r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,Q.jsx)(UF,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(`div`,{className:i,children:n})}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function RK(e){let t=(0,$.c)(71),{section:n,environmentId:r}=e,i=xi(),{setOpenMobile:a}=cr(),o=ds(),s=nd(),c;t[0]!==s||t[1]!==o.history.location.state.__TSR_index?(c=()=>({historyIndex:o.history.location.state.__TSR_index,hasPredecessor:s}),t[0]=s,t[1]=o.history.location.state.__TSR_index,t[2]=c):c=t[2];let[l]=(0,Z.useState)(c),u=G(r??``)?.remote,{element:d,attach:f}=vI(),{element:p,attach:m}=vI(),[h,g]=(0,Z.useState)(null),_;t[3]!==h||t[4]!==i||t[5]!==o.history?(_=()=>{h?o.history.back():i({to:`/settings/$section`,params:{section:`computers`},replace:!0})},t[3]=h,t[4]=i,t[5]=o.history,t[6]=_):_=t[6];let v=_,y;t[7]!==d?.scrollTop||t[8]!==i?(y=e=>{g({scroll:d?.scrollTop??0,focus:document.activeElement instanceof HTMLElement?document.activeElement:null}),i({to:`/settings/$section/$environmentId`,params:{section:`computers`,environmentId:e}})},t[7]=d?.scrollTop,t[8]=i,t[9]=y):y=t[9];let b=y,x;t[10]!==r||t[11]!==m?(x=e=>{m(e),r!==void 0&&e?.focus({preventScroll:!0})},t[10]=r,t[11]=m,t[12]=x):x=t[12];let S=x,C;t[13]!==r||t[14]!==h||t[15]!==f?(C=e=>{if(f(e),r===void 0&&e){h&&(e.scrollTop=h.scroll);let t=h?.focus;t?.isConnected?t.focus({preventScroll:!0}):e.focus({preventScroll:!0})}},t[13]=r,t[14]=h,t[15]=f,t[16]=C):C=t[16];let w=C,{connection:T}=Qo(),{environment:E}=qP(T),D;t[17]===n?D=t[18]:(D=NK.find(e=>e.id===n)??NK[0],t[17]=n,t[18]=D);let O=D,k=`Computer unavailable`;if(r===`this-computer`)k=`This computer`;else if(u){let e;t[19]===u?e=t[20]:(e=(0,Q.jsx)(Ge,{remote:u}),t[19]=u,t[20]=e),k=e}let A;t[21]!==l||t[22]!==r||t[23]!==i||t[24]!==v||t[25]!==o.history||t[26]!==a?(A=()=>{a(!1),r===void 0?l.hasPredecessor?o.history.go(-Math.max(1,o.history.location.state.__TSR_index-l.historyIndex+1)):i({to:`/`}):v()},t[21]=l,t[22]=r,t[23]=i,t[24]=v,t[25]=o.history,t[26]=a,t[27]=A):A=t[27];let j=A,M;t[28]===p?M=t[29]:(M={target:p,ignoreInputs:!0},t[28]=p,t[29]=M),pc(cc.closeSettings,j,M);let N;t[30]===j?N=t[31]:(N=(0,Q.jsx)(`form`,{id:`close-settings`,hidden:!0,onSubmit:e=>{e.preventDefault(),j()}}),t[30]=j,t[31]=N);let P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(De,{render:(0,Q.jsx)(yi,{"aria-label":`Toggle Sidebar`})}),t[32]=P):P=t[32];let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(dt,{children:[P,(0,Q.jsxs)(Et,{children:[`Toggle sidebar`,` `,(0,Q.jsx)(gI,{children:Ks(cc.toggleNavigator)})]})]}),t[33]=F):F=t[33];let I,L;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(qF,{children:`Settings`}),L=(0,Q.jsx)(XF,{children:`/`}),t[34]=I,t[35]=L):(I=t[34],L=t[35]);let R;t[36]!==O.label||t[37]!==r||t[38]!==v?(R=(0,Q.jsx)(qF,{children:(0,Q.jsx)(`h2`,{children:r===void 0?(0,Q.jsx)(YF,{children:O.label}):(0,Q.jsx)(JF,{render:(0,Q.jsx)(`button`,{type:`button`,onClick:v}),children:`Computers`})})}),t[36]=O.label,t[37]=r,t[38]=v,t[39]=R):R=t[39];let z;t[40]!==k||t[41]!==r?(z=r!==void 0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(XF,{children:`/`}),(0,Q.jsx)(qF,{className:`min-w-0`,children:(0,Q.jsx)(YF,{className:`min-w-0`,children:k})})]}),t[40]=k,t[41]=r,t[42]=z):z=t[42];let B;t[43]!==R||t[44]!==z?(B=(0,Q.jsxs)(`header`,{className:`settings-bar flex min-h-12 shrink-0 items-center gap-2 border-b px-2`,children:[F,(0,Q.jsx)(GF,{className:`min-w-0 flex-1`,children:(0,Q.jsxs)(KF,{className:`min-w-0 flex-nowrap`,children:[I,L,R,z]})})]}),t[43]=R,t[44]=z,t[45]=B):B=t[45];let V;t[46]!==O.id||t[47]!==r||t[48]!==i||t[49]!==v?(V=NK.map(e=>{let t=e.icon,n=O.id===e.id;return(0,Q.jsxs)(Y,{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===`computers`){v();return}i({to:`/settings/$section`,params:{section:e.id},replace:!0})},children:[(0,Q.jsx)(t,{}),e.label]},e.id)}),t[46]=O.id,t[47]=r,t[48]=i,t[49]=v,t[50]=V):V=t[50];let H;t[51]===V?H=t[52]:(H=(0,Q.jsx)(`div`,{className:`settings-nav flex gap-0.5 overflow-x-auto px-3 py-3 md:flex-col md:py-5`,children:V}),t[51]=V,t[52]=H);let U;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsxs)(`p`,{className:`mt-auto hidden px-5 pb-4 text-xs tabular-nums text-muted-foreground md:block`,children:[`Porcelain `,`0.76.0`]}),t[53]=U):U=t[53];let W;t[54]===H?W=t[55]:(W=(0,Q.jsxs)(`nav`,{"aria-label":`Settings sections`,className:`flex shrink-0 flex-col md:w-52`,children:[H,U]}),t[54]=H,t[55]=W);let K;t[56]!==w||t[57]!==O.id||t[58]!==E||t[59]!==r||t[60]!==b||t[61]!==v?(K=(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:O.id===`computers`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{ref:w,className:r===void 0?`min-h-0 flex-1 overflow-y-auto outline-none`:`hidden`,role:`region`,"aria-label":`Computers list`,tabIndex:-1,children:(0,Q.jsx)(`div`,{className:IK(`list`),children:(0,Q.jsx)(le,{showUpdates:r===void 0,environment:E,onOpen:b})})}),r!==void 0&&(0,Q.jsx)(LK,{layout:`wide`,children:r===`this-computer`?(0,Q.jsx)(Re,{environment:E}):(0,Q.jsx)(Lt,{environmentId:r,onForgotten:v},r)})]}):(0,Q.jsx)(LK,{layout:`reading`,children:O.id===`git`?(0,Q.jsx)(Al,{}):(0,Q.jsx)(Yl,{})})}),t[56]=w,t[57]=O.id,t[58]=E,t[59]=r,t[60]=b,t[61]=v,t[62]=K):K=t[62];let ee;t[63]!==W||t[64]!==K?(ee=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col md:flex-row`,children:[W,K]}),t[63]=W,t[64]=K,t[65]=ee):ee=t[65];let q;return t[66]!==S||t[67]!==B||t[68]!==ee||t[69]!==N?(q=(0,Q.jsxs)(`main`,{ref:S,tabIndex:-1,"aria-label":`Settings`,className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden rounded-paper bg-card shadow-paper outline-none`,children:[N,B,ee]}),t[66]=S,t[67]=B,t[68]=ee,t[69]=N,t[70]=q):q=t[70],q}var zK={added:`Added`,modified:`Modified`,deleted:`Deleted`,renamed:`Renamed`,"type-changed":`Type changed`};function BK(e,t){if(e.status===`renamed`&&e.previousPath!==null&&e.previousPath!==void 0)return`Renamed from ${e.previousPath}`;let n=zK[e.status];return e.path===t?n:`${n} as ${e.path}`}function VK(e){return e.body===null||e.body===void 0?e.subject:`${e.subject}\n\n${e.body}`}function HK(e){return[...new Set([e.oldPath,e.newPath].filter(e=>e!=null))]}function UK(e){return e.newPath??e.oldPath??`Unknown path`}var WK=7;function GK(e){return e.slice(0,WK)}function KK(e){return e.replace(/^refs\/(?:heads|remotes|tags)\//u,``)}function qK(e){return e.filter(e=>e.kind!==`head`)}function JK(e,t){return e.kind===`local-branch`&&`refs/heads/${e.name}`===t}function YK(e){switch(e?.head.kind){case`attached`:return KK(e.head.ref);case`unborn`:return`No commits yet on ${KK(e.head.ref)}`;case`detached`:return`Detached HEAD`;default:return`This branch`}}function XK(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 ZK(e,t){return e==null?{name:YK(t),counts:null,upstream:`Branch status unavailable`}:e.name?e.upstream?{name:e.name,counts:`${e.ahead} ahead · ${e.behind} behind`,upstream:`against ${e.upstream}`}:{name:e.name,counts:null,upstream:`No upstream`}:{name:`Detached HEAD`,counts:null,upstream:`No branch checked out`}}var QK={kind:`handoff`},$K={kind:`all-changes`},eq={kind:`specs`},tq={kind:`branch`},nq={kind:`graph`};function rq(e){switch(e.kind){case`handoff`:return`handoff`;case`all-changes`:return`all-changes`;case`specs`:return`specs`;case`change`:return`change:${e.path}`;case`file`:return`file:${e.path}`;case`review-file`:case`review-change`:return`${e.kind}:${e.reviewId}:${e.revision}:${e.path}`;case`commit`:return`commit:${e.oid}`;case`pull-request`:return`pull-request:${e.reviewId}:${e.number}${e.environmentId?`:environment=${encodeURIComponent(e.environmentId)}`:``}`;case`branch`:return`branch`;case`branch-file`:return`branch:${e.path}`;case`graph`:return`graph`;case`timeline`:return`timeline:${e.path}`}}function iq(e){if(e==null||e===``)return null;if(e===`handoff`)return QK;if(e===`all-changes`)return $K;if(e===`specs`)return eq;if(e===`branch`)return tq;if(e===`graph`)return nq;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`review-file`:case`review-change`:{let[e,t,...i]=r.split(`:`),a=i.join(`:`),o=Number(t);return e&&a&&Number.isSafeInteger(o)&&o>0?{kind:n,reviewId:e,revision:o,path:a}:null}case`branch`:return{kind:`branch-file`,path:r};case`commit`:return/^[0-9a-f]{4,64}$/.test(r)?{kind:n,oid:r}:null;case`pull-request`:{let[e,t,i,a]=r.split(`:`);return e!==void 0&&qn(ge.check(nr()))(e)&&t!==void 0&&a===void 0&&(i===void 0||/^environment=[a-zA-Z0-9_-]+$/.test(i))&&/^[1-9][0-9]*$/.test(t)&&Number.isSafeInteger(Number(t))?{kind:n,reviewId:e,number:Number(t),...i?{environmentId:i.slice(12)}:{}}:null}default:return null}}function aq(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 oq(e){if(e)return`Review`}var sq={changes:`Changes`,files:`Files`,history:`History`};function cq(e){switch(e.kind){case`handoff`:return`Changes`;case`all-changes`:return`All changes`;case`specs`:return`Specs`;case`branch`:return`Branch changes`;case`graph`:return`Commit graph`;case`commit`:return GK(e.oid);case`pull-request`:return`PR #${e.number}`;case`change`:case`file`:case`review-file`:case`review-change`:case`branch-file`:return e.path.split(`/`).at(-1)??e.path;case`timeline`:return`Timeline of ${e.path.split(`/`).at(-1)??e.path}`}}function lq(e){let t=iq(e.entry),n=t?cq(t):sq[e.surface??`files`],r=e.project?`${n} — ${e.project}`:n;return e.environment?`${r} · ${e.environment}`:r}var uq=()=>({tabs:[],pinned:[]});function dq(e){return{tabs:[`handoff`,...e.tabs.filter(e=>e!==`handoff`)],pinned:e.pinned.filter(e=>e!==`handoff`)}}function fq(e,t,n){if(e[t]?.tabs.includes(n))return t;let r=+(t===0);return e[r]?.tabs.includes(n)?r:t}function pq(e){return[...e.tabs.filter(e=>e===`handoff`),...e.pinned.filter(t=>t!==`handoff`&&e.tabs.includes(t)),...e.tabs.filter(t=>t!==`handoff`&&!e.pinned.includes(t))]}function mq(e,t,n){return e.tabs.includes(t)?e:{...e,tabs:aq(e.tabs,t,n)}}function hq(e,t){return t===`handoff`?e:{tabs:e.tabs.filter(e=>e!==t),pinned:e.pinned.filter(e=>e!==t)}}function gq(e,t){return{...e,tabs:e.tabs.filter(n=>n===`handoff`||n===t||e.pinned.includes(n))}}function _q(e){return{...e,tabs:e.tabs.filter(t=>t===`handoff`||e.pinned.includes(t))}}function vq(e,t){return t===`handoff`?e:e.pinned.includes(t)?{...e,pinned:e.pinned.filter(e=>e!==t)}:{...e,pinned:[...e.pinned,t]}}function yq(e,t,n){if(n.tabs.includes(t))return t;let r=pq(e),i=new Set(pq(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 bq(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xq(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&(iq(e)??null)!==null):[]}function Sq(e){if(!bq(e)||!Array.isArray(e.panes))return null;let t=e.panes.map(e=>{let t=xq(bq(e)?e.tabs:void 0);return{tabs:t,pinned:xq(bq(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 Cq(e){return e===null?`Open to the side`:e===`left`?`Open in the right pane`:`Open in the left pane`}function wq(e,t){return{value:`${e}/${t}`,description:`${e} of ${Kr(t,`decision`)} reviewed`}}function Tq(e){if(e!==0)return{value:String(e),description:Kr(e,`uncommitted file`)}}function Eq(e,t,n){let r=t.flatMap(e=>pq(e)),i=n===null?e:[n,...e],a=new Set(r);return[...new Set([...i,...r])].filter(e=>a.has(e))}function Dq(e){let t=(0,$.c)(4),{children:n}=e,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={poolSize:4,workerFactory:Oq},i={theme:Su},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)(yE,{poolOptions:r,highlighterOptions:i,children:n}),t[2]=n,t[3]=a),a}function Oq(){return new Worker(new URL(`/assets/worker-mq0i_Vk_.js`,``+import.meta.url),{type:`module`})}function kq(e,t){let n=(0,$.c)(9),r;n[0]!==t.connection||n[1]!==e?(r=a({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[o,s]=xa(r,i),c;n[4]===s?c=n[5]:(c=e=>{s(e)},n[4]=s,n[5]=c);let l;return n[6]!==o||n[7]!==c?(l={result:o,dismiss:c},n[6]=o,n[7]=c,n[8]=l):l=n[8],l}function Aq(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 jq(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:haiku`)?.id??n?.find(e=>e.id===`claude:sonnet`)?.id}function Mq(e){return e.split(`/`).at(-1)??e}function Nq(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}}function Pq(e,t,n){return{mode:e===`amend`?`amend`:`single`,message:e===`commit`?t:``,amendMessage:e===`amend`?t:n,excluded:new Set,added:new Set,groups:null}}function Fq(e,t,n=new Set){return t.some(t=>!n.has(t.path)&&e.files?.find(e=>e.path===t.path)?.fingerprint!==t.fingerprint)}var Iq=[{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`}],Lq=[{id:`commit`,actions:[Iq[0],Iq[1]]},{id:`sync`,actions:[Iq[2],Iq[3],Iq[4]]},{id:`stash`,actions:[Iq[5],Iq[7]]}];function Rq(e){return Iq.find(t=>t.id===e)?.label}function zq(e){let t=(0,$.c)(17),{scope:n,context:r}=e,{connection:i}=r,a=Ts(Te(rP(n,i))),o=kq(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=f(o.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`mt-1 text-destructive`,children:rr(ht(o.result.cause))}),t[3]=o.result,t[4]=d);let p;t[5]!==d||t[6]!==l?(p=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,u,d]}),t[5]=d,t[6]=l,t[7]=p):p=t[7];let m;t[8]!==o||t[9]!==s.requestId?(m=()=>o.dismiss(s.requestId),t[8]=o,t[9]=s.requestId,t[10]=m):m=t[10];let h;t[11]!==o.result.waiting||t[12]!==m?(h=(0,Q.jsx)(Y,{size:`xs`,variant:`ghost`,disabled:o.result.waiting,onClick:m,children:`Got it`}),t[11]=o.result.waiting,t[12]=m,t[13]=h):h=t[13];let g;return t[14]!==p||t[15]!==h?(g=(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:[p,h]}),t[14]=p,t[15]=h,t[16]=g):g=t[16],g}function Bq(e){let t=(0,$.c)(23),{scope:n,context:r,onOpen:i}=e,{connection:a}=r,o=Ts(Te(rP(n,a))),s=o?.inProgress;if(!s)return null;let c=o.changes.filter(Vq),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)(Y,{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)(Uq,{command:`git rebase --continue`}),t[5]=s,t[6]=g);let _;t[7]!==o||t[8]!==s?(_=s===`merge`&&!o.mergeHeadOid&&(0,Q.jsx)(Uq,{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)(Uq,{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 Vq(e){return e.comparisons.some(Hq)}function Hq(e){return e.scope===`unmerged`}function Uq(e){let t=(0,$.c)(8),{command:n}=e,r=`Copy ${n}`,i,a;t[0]===n?(i=t[1],a=t[2]):(i=()=>Yi(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)(He,{}),t[3]=o):o=t[3];let s;return t[4]!==r||t[5]!==i||t[6]!==a?(s=(0,Q.jsxs)(Y,{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 Wq(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 Gq=so(e=>ii({done:new Set,activeGroup:null,ownHead:null,busy:!1,error:null,drafted:{message:null,groups:null},draftedBy:{message:null,groups:null},editingFiles:!1})),Kq=so(e=>new Set);function qq(e,t,n){let r=(0,$.c)(14),{connection:i}=n,{operations:a}=i,o;r[0]!==t||r[1]!==e?(o=An(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&&pn(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=Wq(a,s),d=u?.requestId===l?null:u,f={connection:i,scope:e,action:t},{value:p}=su(zt(f)),m=b(f),h=ys(f),g=Rr(m),_=Rr(h),v;r[6]===d?v=r[7]:(v=d?.receipt&&pn(d.receipt),r[6]=d,r[7]=v);let y=!!v,x;return r[8]!==p||r[9]!==g||r[10]!==d||r[11]!==_||r[12]!==y?(x={...p,execution:g,recovered:_,operation:d,canStartNew:y},r[8]=p,r[9]=g,r[10]=d,r[11]=_,r[12]=y,r[13]=x):x=r[13],x}var Jq=so(({signal:e,submit:t,recover:n})=>Br(r=>{e!==void 0&&(r.set(t,Ca),r.set(n,Ca))}));function Yq(e,t,n){let r=(0,$.c)(45),{path:i,hunk:a,signal:o,what:s,look:c,readChanges:l,notify:u,dismissNotice:f,close:p}=n,m=qq(e,`discard`,t),h=qq(e,`stash-apply`,t),g=!(!m.operation||m.canStartNew),_;r[0]===l?_=r[1]:(_=()=>en({try:l,catch:tJ}),r[0]=l,r[1]=_);let v;r[2]!==p||r[3]!==f||r[4]!==u||r[5]!==h||r[6]!==_||r[7]!==s?(v={what:s,readChanges:_,notify:u,dismissNotice:f,close:p,restore:h,restoreTimeoutMs:d,run:Di},r[2]=p,r[3]=f,r[4]=u,r[5]=h,r[6]=_,r[7]=s,r[8]=v):v=r[8];let y=v,[b]=(0,Z.useState)($q),[x]=(0,Z.useState)(Zq),S;r[9]===Symbol.for(`react.memo_cache_sentinel`)?(S={mode:`promiseExit`},r[9]=S):S=r[9];let[C,w]=xa(b,S),T;r[10]===Symbol.for(`react.memo_cache_sentinel`)?(T={mode:`promiseExit`},r[10]=T):T=r[10];let[E,D]=xa(x,T),O=Aa(b),k=Aa(x),A;r[11]!==x||r[12]!==o||r[13]!==b?(A=Jq({signal:o,submit:b,recover:x}),r[11]=x,r[12]=o,r[13]=b,r[14]=A):A=r[14],ao(A);let j=C.waiting||E.waiting,M=Xq,N;r[15]!==E||r[16]!==C?(N=M(C)??M(E),r[15]=E,r[16]=C,r[17]=N):N=r[17];let P;r[18]!==k||r[19]!==O?(P=()=>{O(Ca),k(Ca)},r[18]=k,r[19]=O,r[20]=P):P=r[20];let F;r[21]!==j||r[22]!==m||r[23]!==y||r[24]!==a||r[25]!==c||r[26]!==i||r[27]!==k||r[28]!==w||r[29]!==g?(F=()=>{j||g||!c||(k(Ca),w({run:()=>m.run({action:`discard`,path:i,...a?{hunk:a}:{}},Vn(c,[i])),discarding:y}))},r[21]=j,r[22]=m,r[23]=y,r[24]=a,r[25]=c,r[26]=i,r[27]=k,r[28]=w,r[29]=g,r[30]=F):F=r[30];let I;r[31]!==j||r[32]!==m.recover||r[33]!==y||r[34]!==D||r[35]!==O?(I=()=>{j||(O(Ca),D({recover:m.recover,discarding:y}))},r[31]=j,r[32]=m.recover,r[33]=y,r[34]=D,r[35]=O,r[36]=I):I=r[36];let L;return r[37]!==j||r[38]!==m.operation||r[39]!==N||r[40]!==P||r[41]!==F||r[42]!==I||r[43]!==g?(L={operation:m.operation,uncertain:g,busy:j,error:N,reset:P,run:F,checkOutcome:I},r[37]=j,r[38]=m.operation,r[39]=N,r[40]=P,r[41]=F,r[42]=I,r[43]=g,r[44]=L):L=r[44],L}function Xq(e){return Ts(Te(e))??(f(e)?{text:rr(ht(e.cause)),moved:!1}:null)}function Zq(){return Ri(Qq)}function Qq(e){return Ye(e.recover(),e.discarding)}function $q(){return Ri(eJ)}function eJ(e){return Ye(e.run(),e.discarding)}function tJ(e){return new ot(e,rr(e))}function nJ({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 rJ(e){let t=(0,$.c)(6),{text:n,children:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Ul,{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)(nJ,{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 iJ(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=Ts(Te(rP(n,f))),m=uP(n,f),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null),y=p,b=y?hn(y):null,x=y?.changes.find(e=>e.path===i),S=_??b,C;t[0]===a?C=t[1]:(C=a?cJ(a):null,t[0]=a,t[1]=C);let w=C,T;t[2]!==w||t[3]!==i?(T=w?`${w} of ${Mq(i)}`:Mq(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:sJ,dismissNotice:oJ,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=Yq(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)(Y,{size:u===`button`?`sm`:`xs`,variant:u===`button`?`destructive`:`ghost`,"aria-label":a?`Discard ${w} of ${Mq(i)}`:`Discard changes to ${Mq(i)}`,onClick:()=>{k.reset(),v(b),g(!0)},children:[(0,Q.jsx)(Ip,{}),lJ(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)(oM,{open:h,onOpenChange:e=>!A&&g(e),children:(0,Q.jsxs)(uM,{children:[(0,Q.jsxs)(dM,{children:[(0,Q.jsxs)(pM,{children:[`Discard `,E,`?`]}),(0,Q.jsx)(mM,{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)(fr,{className:`rounded-lg bg-muted/50 px-3 py-2 font-mono text-xs`,render:(0,Q.jsx)(`p`,{}),text:i}),j&&(0,Q.jsx)(rJ,{text:j.text,children:j.moved?` Look at the diff again before discarding.`:``}),k.operation?.receipt?.progress.map(aJ),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)(fM,{children:[(0,Q.jsx)(gM,{disabled:A,children:j?.moved?`Look again`:`Cancel`}),!j?.moved&&(M?(0,Q.jsx)(Y,{disabled:A,onClick:k.checkOutcome,children:A?`Checking…`:`Check outcome`}):(0,Q.jsx)(Y,{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 aJ(e){return(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:e},e)}function oJ(e){return xc.close(e)}function sJ(e){return xc.add(e)}function cJ({startLine:e,endLine:t}){return e===t?`line ${e}`:`lines ${e}–${t}`}function lJ(e){return e===`quiet`?(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:`Discard`}):e===`compact`?`Discard selection`:`Discard`}var uJ=Ea(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[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-md! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function dJ({className:e,orientation:t,...n}){return(0,Q.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:X(uJ({orientation:t}),e),...n})}function fJ(e,t,n){let r=(0,$.c)(32),i=qq(e,`fetch`,t),a=qq(e,`pull`,t),o=qq(e,`push`,t),s=qq(e,`stash-apply`,t),c;r[0]===n.details?c=r[1]:(c=()=>en({try:n.details.read,catch:hJ}),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,m;r[8]!==i||r[9]!==a||r[10]!==o?(f={fetch:i,pull:a,push:o},m=[`fetch`,`pull`,`push`].map(e=>({name:e,operation:f[e].operation,canStartNew:f[e].canStartNew,checking:f[e].recovered.waiting})).find(mJ),r[8]=i,r[9]=a,r[10]=o,r[11]=f,r[12]=m):(f=r[11],m=r[12]);let h=m,g;r[13]!==d||r[14]!==f||r[15]!==h?(g=()=>{h&&Di(Ji(d,f[h.name],h.name))},r[13]=d,r[14]=f,r[15]=h,r[16]=g):g=r[16];let _;r[17]!==d||r[18]!==f?(_=(e,t)=>Di(ut(d,f[e],e,t)),r[17]=d,r[18]=f,r[19]=_):_=r[19];let v;r[20]!==d||r[21]!==s?(v=e=>Di(nt(d,s,e)),r[20]=d,r[21]=s,r[22]=v):v=r[22];let y;r[23]!==n.onLooked||r[24]!==n.refreshLook?(y=()=>gr(p(en({try:n.refreshLook,catch:pJ}),n.onLooked)),r[23]=n.onLooked,r[24]=n.refreshLook,r[25]=y):y=r[25];let b;return r[26]!==h||r[27]!==g||r[28]!==_||r[29]!==v||r[30]!==y?(b={running:h,checkOutcome:g,runNetwork:_,restoreDiscarded:v,lookAgain:y},r[26]=h,r[27]=g,r[28]=_,r[29]=v,r[30]=y,r[31]=b):b=r[31],b}function pJ(e){return new ot(e,rr(e))}function mJ(e){let{operation:t,canStartNew:n}=e;return t!=null&&!n}function hJ(e){return new ot(e,rr(e))}function gJ(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)(gp,{className:r}),t[0]=r,t[1]=e),e}case`push`:{let e;return t[2]===r?e=t[3]:(e=(0,Q.jsx)(yd,{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)(pd,{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)(dd,{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)(ld,{className:r}),t[8]=r,t[9]=e),e}default:{let e;return t[10]===r?e=t[11]:(e=(0,Q.jsx)(Af,{className:r}),t[10]=r,t[11]=e),e}}}function _J(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var vJ=`data-checked`,yJ=`data-unchecked`;function bJ(e){return{checked(t){return e.indeterminate?{}:t?{[vJ]:``}:{[yJ]:``}},...In}}var xJ=Z.createContext(void 0);function SJ(){return Z.useContext(xJ)}var CJ=Z.createContext(void 0);function wJ(){let e=Z.useContext(CJ);if(e===void 0)throw Error(Wn(14));return e}var TJ=`data-parent`,EJ=Z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:g=!1,uncheckedValue:_,value:v,nativeButton:y=!1,style:b,...x}=e,{clearErrors:S}=be(),{disabled:C,name:w,setDirty:T,setFilled:D,setFocused:O,setTouched:k,state:A,validationMode:j,validityData:M,validation:N}=yn(),P=pm(),{labelId:F,registerControlId:I,getDescriptionProps:L}=En(),R=SJ(),z=R?.allValues===void 0?void 0:R.parent,B=z!==void 0,V=C||P.disabled||R?.disabled||o,H=w??d,U=v??H,W=Xe(),G=R?.registerControlId!==I,K=ws({id:c||void 0,enabled:G}),ee=y?K:W,te={};B&&(p?te=z.getParentProps():U!==void 0&&(te=z.getChildProps(U)));let{checked:ne=n,indeterminate:re=l,onCheckedChange:ie,...ae}=te,oe=R?.value,se=Z.useRef(null),{getButtonProps:ce,buttonRef:le}=Mi({disabled:V,native:y}),ue=R?.validation??N,[de,fe]=Wt({controlled:U!==void 0&&oe!==void 0&&!p?oe.includes(U):ne,default:i,name:`Checkbox`,state:`checked`}),pe=B?!!ne:de,J=B&&re||l;Qe(se,W,de,void 0,!R&&!V,d);let me=z?.registerChildId,he=Z.useRef(null),ge=ue.registerInput,_e=R?U:void 0,ve=Z.useCallback(e=>ge(e,{controlRef:se,value:_e}),[ge,_e]),ye=q(u,he,p?void 0:ve),xe=E(a,F,he,!y,K);or(()=>{he.current&&(he.current.indeterminate=J),R||D(de)},[de,J,R,D]),Oe(de,()=>{R||(S(H),T(de!==M.initialValue),ue.change(de))});let Se=cn({checked:de,disabled:V,form:s,name:p?void 0:H,id:y?void 0:K,required:g,ref:ye,style:H?ra:vt,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=Io(qa,e.nativeEvent);if(f?.(t,n),!n.isCanceled&&(ie?.(t,n),!n.isCanceled&&(fe(t),U!==void 0&&R!==void 0&&!p&&!B))){let e=t?[...R.value,U]:R.value.filter(e=>e!==U);R.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){se.current?.focus()}},v===void 0?ni:{value:(R?de&&v:v)||``},L,e=>ue.getValidationProps(V,e));Z.useEffect(()=>{if(!z||U===void 0)return;let e=z.disabledStatesRef.current;return e.set(U,V),()=>{e.delete(U)}},[z,V,U]);let Ce=Z.useMemo(()=>({...A,checked:pe,disabled:V,readOnly:m,required:g,indeterminate:J}),[A,pe,V,m,g,J]),we=bJ(Ce),Te=$o(`span`,e,{state:Ce,ref:[le,se,t],props:[{id:ee,role:`checkbox`,"aria-checked":J?`mixed`:pe,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":xe,[TJ]:p?``:void 0,onFocus(){V||O(!0)},onBlur(){let e=he.current;e&&(k(!0),O(!1),j===`onBlur`&&ue.commit(R?oe:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=he.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),Ue(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||_J(t)?.click()})},onClick(e){if(m||V)return;e.preventDefault();let t=he.current;t&&Ti(t,e)}},x,ae,ce,L,e=>ue.getValidationProps(V,e)],stateAttributesMapping:we}),Ee=Te.props.id;return or(()=>{if(me&&!p&&U!==void 0&&Ee!==void 0)return me(U,Ee)},[me,p,U,Ee]),(0,Q.jsxs)(CJ.Provider,{value:Ce,children:[Te,!de&&!R&&H&&!p&&_!==void 0&&(0,Q.jsx)(`input`,{type:`hidden`,form:s,name:H,value:_,disabled:V}),(0,Q.jsx)(`input`,{...Se,suppressHydrationWarning:!0})]})}),DJ=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=wJ(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=vo(c),f=Z.useRef(null),p={...s,transitionStatus:u};Qt({batch:!0,enabled:!c,open:c,ref:f,onComplete(){c||d(!1)}});let m={...bJ(s),...Ot},h=a||l,g=$o(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function OJ({className:e,...t}){return(0,Q.jsx)(EJ,{"data-slot":`checkbox`,className:X(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-shadow outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary`,e),...t,children:(0,Q.jsx)(DJ,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,Q.jsx)(ir,{})})})}function kJ(e,t,n,r){let i=(0,$.c)(29),{expectedStatus:a,onBusy:o,onLookAgain:s}=r,c=qq(e,t,n),[l]=(0,Z.useState)(NJ),u;i[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={mode:`promiseExit`},i[0]=u):u=i[0];let[d,f]=xa(l,u),p=Aa(l),m=c.execution.waiting||c.recovered.waiting||d.waiting,h=!(!c.operation||c.canStartNew),g=MJ,_=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 y;i[5]!==m||i[6]!==a||i[7]!==c||i[8]!==o||i[9]!==p||i[10]!==h?(y=e=>{m||h||(o(!0),p(Ca),c.reset(),Di(c.run(e,Vn(a,a.files?.map(jJ)??[],void 0,!0)).pipe(Ra(Fr(()=>o(!1))),vi)))},i[5]=m,i[6]=a,i[7]=c,i[8]=o,i[9]=p,i[10]=h,i[11]=y):y=i[11];let b;i[12]!==m||i[13]!==c||i[14]!==s||i[15]!==f?(b=()=>{s&&!m&&(c.reset(),f({read:en({try:s,catch:AJ}),startNew:c.startNew()}))},i[12]=m,i[13]=c,i[14]=s,i[15]=f,i[16]=b):b=i[16];let x;i[17]!==c||i[18]!==p?(x=()=>{c.reset(),p(Ca),Di(c.recover().pipe(vi))},i[17]=c,i[18]=p,i[19]=x):x=i[19];let S;return i[20]!==m||i[21]!==c.operation||i[22]!==_||i[23]!==v||i[24]!==y||i[25]!==b||i[26]!==x||i[27]!==h?(S={operation:c.operation,messageLimit:K,outcome:_,busy:m,uncertain:h,error:v,onSubmit:y,lookAgain:b,checkOutcome:x},i[20]=m,i[21]=c.operation,i[22]=_,i[23]=v,i[24]=y,i[25]=b,i[26]=x,i[27]=h,i[28]=S):S=i[28],S}function AJ(e){return new ot(e,rr(e))}function jJ(e){return e.path}function MJ(e){return f(e)?ht(e.cause):null}function NJ(){return Ri(PJ)}function PJ(e){return ta(e.read,e.startNew)}function FJ(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 IJ(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 LJ(e){let t=e%100;return`${e}${t>=11&&t<=13?`th`:[`th`,`st`,`nd`,`rd`][e%10]??`th`}`}function RJ(e){let t=BJ(e),n=t.at(-1);return{snapshot:t[0]?.snapshot??null,commits:t.flatMap(e=>e.commits),nextAfter:n?.nextAfter??null,boundary:n?.boundary??null,restarted:n?.restarted??!1}}function zJ(e){let t=BJ(e),n=t.at(-1);return{commits:t.flatMap(e=>e.commits),tip:t[0]?.tip??null,nextAfter:n?.nextAfter??null,boundary:n?.boundary??null,restarted:t[0]?.restarted??!1}}function BJ(e){let t=e.findLastIndex(e=>e.restarted);return t===-1?e:e.slice(t)}var VJ=so(e=>Br({loaded:0,selected:void 0,scrollOffset:0,graphScrollOffset:0,resetId:0}).pipe(Ma)),HJ=so(({connection:e,scope:t})=>fn(e,t,[`history`],n=>GJ(n,VJ({connection:e,scope:t,kind:`commits`}),n=>ei(function*(){let r=yield*(yield*Ga(e)).request(e=>e.changes.listCommits({params:{worktreeId:t.worktreeId},query:{after:n?.after,tip:n?.tip}}));return yield*Fo(e),r}),e=>e.nextAfter&&e.tip?{after:e.nextAfter,tip:e.tip}:void 0),mi(e))),UJ=so(({connection:e,scope:t,oid:n,parent:r=1})=>kn(e,t,[`commit`,n,r],ei(function*(){let i=yield*(yield*Ga(e)).request(e=>e.changes.readCommitFiles({params:{worktreeId:t.worktreeId,oid:n},query:r===1?{}:{parent:r}}));return yield*Fo(e,i.commit.oid===n&&(i.comparison.kind===`empty-tree`||i.comparison.parentNumber===r)),i}),mi(e))),WJ=so(({connection:e,scope:t,path:n})=>fn(e,t,[`history`,`file`,n],r=>GJ(r,VJ({connection:e,scope:t,kind:`file`,path:n}),r=>ei(function*(){let i=yield*(yield*Ga(e)).request(e=>e.changes.listFileCommits({params:{worktreeId:t.worktreeId},query:{path:n,limit:100,after:r}}));return yield*Fo(e),i}),e=>e.nextAfter),mi(e)));function GJ(e,t,n,r){let i=e.once(t).loaded,a=0;return an(void 0,o=>ei(function*(){let s=[],c=a,l=o,u=!1;do{let e=yield*n(l);e.restarted&&(c=0,u=!0),c+=e.commits.length,s.push(e),l=r(e)}while(o===void 0&&c<i&&l!==void 0&&!u);a=c;let d=e.once(t);return e.set(t,{...d,loaded:a,...u?{selected:void 0,scrollOffset:0,graphScrollOffset:0,resetId:d.resetId+1}:{}}),[s,l===void 0?bn():Ln(l)]}))}var KJ=so(e=>la(WJ(e),e=>wt(e,e=>zJ(e.items))).pipe(Ua(0))),qJ=so(e=>la(HJ(e),e=>wt(e,e=>RJ(e.items))).pipe(Ua(0)));so(e=>xr((t,n)=>{let r=VJ({...e,kind:`commit`,oid:t.oid,parent:t.parent}),i=n(r);n.set(r,{...i,selected:t.path,scrollOffset:0,resetId:i.resetId+1})}));function JJ(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=UJ({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],su(o).value}function YJ(e){let t=(0,$.c)(13),{tracking:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(Of,{className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),t[0]=r):r=t[0];let i;t[1]===n.name?i=t[2]:(i=(0,Q.jsx)(fr,{className:`min-w-0 flex-1 font-mono text-caption font-medium text-foreground`,text:n.name}),t[1]=n.name,t[2]=i);let a;t[3]===n.counts?a=t[4]:(a=n.counts!==null&&(0,Q.jsx)(`span`,{className:`shrink-0 text-2xs text-muted-foreground tabular-nums`,children:n.counts}),t[3]=n.counts,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7];let s;t[8]===n.upstream?s=t[9]:(s=(0,Q.jsx)(fr,{className:`text-2xs text-muted-foreground`,text:n.upstream}),t[8]=n.upstream,t[9]=s);let c;return t[10]!==o||t[11]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2`,children:[r,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[o,s]})]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function XJ(e,t){let n=(0,$.c)(19),r;n[0]!==e||n[1]!==t?(r=HJ({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=qJ({connection:e,scope:t}),n[3]=e,n[4]=t,n[5]=a):a=n[5];let{result:o,value:s}=su(a),c=Aa(i),l;n[6]!==e||n[7]!==t?(l=VJ({connection:e,scope:t,kind:`commits`}),n[6]=e,n[7]=t,n[8]=l):l=n[8];let u=l,d=Rr(u,ZJ),f=Aa(u),p;n[9]===f?p=n[10]:(p=e=>f(t=>({...t,selected:e})),n[9]=f,n[10]=p);let m;n[11]===c?m=n[12]:(m=()=>c(void 0),n[11]=c,n[12]=m);let h;return n[13]!==o||n[14]!==d||n[15]!==p||n[16]!==m||n[17]!==s?(h={...s,result:o,selected:d,select:p,readMore:m},n[13]=o,n[14]=d,n[15]=p,n[16]=m,n[17]=s,n[18]=h):h=n[18],h}function ZJ(e){return e.selected}function QJ(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 $J(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,tY),a=i.pop()??0,o=Number.parseFloat(getComputedStyle(t).columnGap),s=t.getBoundingClientRect().width;if(i.reduce(eY,0)+Math.max(0,i.length-1)*o<=s){r(e);return}let c=0,l=0;for(let t of i){c+=t+(l===0?0:o);let n=l+1===e?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 eY(e,t){return e+t}function tY(e){return e.getBoundingClientRect().width}var nY=`min-w-0 max-w-40`;function rY(e){let t=(0,$.c)(21),{refs:n,current:r,onOpenCommit:i}=e,a=r===void 0?oY:r,{row:o,visibleCount:s}=$J(n.length),c;if(t[0]!==a||t[1]!==i||t[2]!==n||t[3]!==o||t[4]!==s){let e=n.slice(s),r;t[6]===n?r=t[7]:(r=n.map(aY),t[6]=n,t[7]=r);let l;t[8]===n.length?l=t[9]:(l=(0,Q.jsxs)(We,{variant:`secondary`,className:nY,children:[`+`,n.length]}),t[8]=n.length,t[9]=l);let u;t[10]!==r||t[11]!==l?(u=(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:[r,l]})}),t[10]=r,t[11]=l,t[12]=u):u=t[12];let d;if(t[13]!==a||t[14]!==i||t[15]!==n||t[16]!==s){let e;t[18]!==a||t[19]!==i?(e=e=>(0,Q.jsx)(fr,{text:e.name,renderTrigger:t=>(0,Q.jsxs)(We,{render:(0,Q.jsx)(`button`,{type:`button`,onClick:i}),variant:a(e)?`brand-soft`:`outline`,className:`${nY} pointer-events-auto shrink`,children:[e.kind===`tag`&&(0,Q.jsx)(Mp,{"aria-hidden":`true`}),t]}),children:e.name},`${e.kind}:${e.name}`),t[18]=a,t[19]=i,t[20]=e):e=t[20],d=n.slice(0,s).map(e),t[13]=a,t[14]=i,t[15]=n,t[16]=s,t[17]=d}else d=t[17];c=(0,Q.jsxs)(`div`,{ref:o,className:`pointer-events-none relative flex min-w-0 items-center gap-1`,children:[u,d,e.length>0&&(0,Q.jsxs)(ya,{children:[(0,Q.jsxs)(po,{render:(0,Q.jsx)(We,{render:(0,Q.jsx)(`button`,{type:`button`}),variant:`secondary`,className:`${nY} pointer-events-auto`,"aria-label":`Show ${e.length} more ${ui(e.length,`ref`)}`}),children:[`+`,e.length]}),(0,Q.jsxs)(ro,{align:`start`,className:`max-w-[calc(100vw-2rem)]`,children:[(0,Q.jsx)(Oa,{children:`More refs`}),(0,Q.jsx)(`ul`,{className:`max-h-64 overflow-y-auto text-xs`,children:e.map(iY)})]})]})]}),t[0]=a,t[1]=i,t[2]=n,t[3]=o,t[4]=s,t[5]=c}else c=t[5];return c}function iY(e){return(0,Q.jsxs)(`li`,{className:`flex items-center gap-1 py-1 break-all`,children:[e.kind===`tag`&&(0,Q.jsx)(Mp,{"aria-hidden":`true`,className:`size-3 shrink-0`}),e.name]},`${e.kind}:${e.name}`)}function aY(e){return(0,Q.jsxs)(We,{variant:`secondary`,className:nY,children:[e.kind===`tag`&&(0,Q.jsx)(Mp,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"data-label":e.name,className:`before:content-[attr(data-label)]`})]},`${e.kind}:${e.name}`)}function oY(){return!1}function sY(e){let t=(0,$.c)(74),{commit:n,selected:r,height:i,inset:a,layout:o,head:s,headRef:c,onSelect:l,openToSide:u,children:d}=e,f=o===void 0?`stacked`:o,p=s!==void 0&&s,[m,h]=(0,Z.useState)(!1),g;t[0]!==l||t[1]!==u?(g=e=>l(u!==void 0&&e.altKey),t[0]=l,t[1]=u,t[2]=g):g=t[2];let _=g,v;t[3]===c?v=t[4]:(v=e=>JK(e,c),t[3]=c,t[4]=v);let y=v,b;if(t[5]!==n.refs||t[6]!==y){let e;t[8]===y?e=t[9]:(e=(e,t)=>Number(y(t))-Number(y(e)),t[8]=y,t[9]=e),b=qK(n.refs).toSorted(e),t[5]=n.refs,t[6]=y,t[7]=b}else b=t[7];let x=b,S;t[10]===p?S=t[11]:(S=p?(0,Q.jsx)(We,{variant:`brand`,className:`relative shrink-0`,children:`HEAD`}):null,t[10]=p,t[11]=S);let C=S,w=f===`stacked`&&`font-medium`,T=(p||r)&&`font-semibold`,E;t[12]!==w||t[13]!==T?(E=X(`flex min-w-0 items-center gap-1 text-ui leading-4.5 font-normal`,w,T),t[12]=w,t[13]=T,t[14]=E):E=t[14];let D;t[15]===n.parentOids.length?D=t[16]:(D=n.parentOids.length>1&&(0,Q.jsx)(Pf,{"aria-label":`Merge commit`,className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=n.parentOids.length,t[16]=D);let O;t[17]===n.subject?O=t[18]:(O=(0,Q.jsx)(fr,{text:n.subject}),t[17]=n.subject,t[18]=O);let k=f===`stacked`&&C,A;t[19]!==D||t[20]!==O||t[21]!==k||t[22]!==E?(A=(0,Q.jsxs)(`span`,{className:E,children:[D,O,k]}),t[19]=D,t[20]=O,t[21]=k,t[22]=E,t[23]=A):A=t[23];let j=A,M;t[24]===n.author.timestamp?M=t[25]:(M=Xa(n.author.timestamp),t[24]=n.author.timestamp,t[25]=M);let N=M,P;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{e&&h(!1)},t[26]=P):P=t[26];let F;t[27]!==i||t[28]!==a?(F={height:i,paddingLeft:a},t[27]=i,t[28]=a,t[29]=F):F=t[29];let I=f===`stacked`?`flex-col justify-center gap-0.5`:`items-center gap-3`,L=i===void 0&&`py-1.5`,R=r&&`bg-muted ring-1 ring-border ring-inset`,z=p&&`bg-muted ring-1 ring-border ring-inset`,B;t[30]!==I||t[31]!==L||t[32]!==R||t[33]!==z?(B=X(`relative flex w-full rounded-lg px-2 text-left transition-colors hover:bg-accent`,I,L,R,z),t[30]=I,t[31]=L,t[32]=R,t[33]=z,t[34]=B):B=t[34];let V;t[35]!==F||t[36]!==B?(V=(0,Q.jsx)(`div`,{style:F,className:B}),t[35]=F,t[36]=B,t[37]=V):V=t[37];let H;t[38]!==N||t[39]!==d||t[40]!==n.author.name||t[41]!==n.oid||t[42]!==y||t[43]!==C||t[44]!==a||t[45]!==f||t[46]!==x||t[47]!==_||t[48]!==r||t[49]!==j?(H=f===`stacked`?(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":r,onClick:_,className:X(`block min-w-0 text-left before:absolute before:inset-0 before:rounded-lg`,x.length>0?`max-w-3/5`:`flex-1`),children:[j,(0,Q.jsxs)(`span`,{style:{left:a},className:`absolute inset-x-2 mt-0.5 flex min-w-0 gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`code`,{className:`font-mono`,children:GK(n.oid)}),(0,Q.jsx)(fr,{text:n.author.name}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:N})]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 block h-4`}),d!==void 0&&(0,Q.jsx)(`span`,{className:`flex min-w-0`,children:d})]}),x.length>0&&(0,Q.jsx)(`div`,{className:`flex h-4.5 min-w-0 flex-1 flex-col justify-center`,children:(0,Q.jsx)(rY,{refs:x,current:y,onOpenCommit:_})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`code`,{className:`hidden w-16 shrink-0 font-mono text-xs text-muted-foreground @md/graph:block`,children:GK(n.oid)}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":r,onClick:_,className:`flex max-w-3/5 min-w-0 shrink-0 items-center text-left before:absolute before:inset-0 before:rounded-lg`,children:[j,(0,Q.jsx)(`span`,{className:`sr-only`,children:` ${GK(n.oid)} ${n.author.name} ${N}`})]}),C,(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:x.length>0&&(0,Q.jsx)(rY,{refs:x,current:y,onOpenCommit:_})})]}),(0,Q.jsx)(fr,{className:`hidden w-28 shrink-0 text-xs text-muted-foreground @2xl/graph:block`,text:n.author.name}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-right text-xs whitespace-nowrap text-muted-foreground tabular-nums`,children:N})]}),t[38]=N,t[39]=d,t[40]=n.author.name,t[41]=n.oid,t[42]=y,t[43]=C,t[44]=a,t[45]=f,t[46]=x,t[47]=_,t[48]=r,t[49]=j,t[50]=H):H=t[50];let U;t[51]!==V||t[52]!==H?(U=(0,Q.jsx)(lI,{render:V,children:H}),t[51]=V,t[52]=H,t[53]=U):U=t[53];let W=!m,G;t[54]===u?G=t[55]:(G=u&&(0,Q.jsxs)(fI,{onClick:()=>{(0,od.flushSync)(()=>h(!0)),u.open()},children:[(0,Q.jsx)(Gd,{}),u.label]}),t[54]=u,t[55]=G);let K;t[56]===n.oid?K=t[57]:(K=()=>Yi(n.oid,`commit id`),t[56]=n.oid,t[57]=K);let ee;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(He,{}),t[58]=ee):ee=t[58];let q;t[59]===K?q=t[60]:(q=(0,Q.jsxs)(fI,{onClick:K,children:[ee,`Copy commit id`]}),t[59]=K,t[60]=q);let te;t[61]===n?te=t[62]:(te=()=>Yi(VK(n),`commit message`),t[61]=n,t[62]=te);let ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(He,{}),t[63]=ne):ne=t[63];let re;t[64]===te?re=t[65]:(re=(0,Q.jsxs)(fI,{onClick:te,children:[ne,`Copy message`]}),t[64]=te,t[65]=re);let ie;t[66]!==W||t[67]!==G||t[68]!==q||t[69]!==re?(ie=(0,Q.jsxs)(uI,{finalFocus:W,children:[G,q,re]}),t[66]=W,t[67]=G,t[68]=q,t[69]=re,t[70]=ie):ie=t[70];let ae;return t[71]!==U||t[72]!==ie?(ae=(0,Q.jsxs)(cI,{onOpenChange:P,children:[U,ie]}),t[71]=U,t[72]=ie,t[73]=ae):ae=t[73],ae}var cY=[`text-graph-1`,`text-graph-2`,`text-graph-3`,`text-graph-4`,`text-graph-5`,`text-graph-6`],lY=e=>13+e*16,uY=e=>cY[e%cY.length]??cY[0];function dY(e){let t=(0,$.c)(7),{rows:n,width:r,rowHeight:i}=e,a=n.length*i,o;t[0]!==i||t[1]!==n?(o=n.map((e,t)=>{let r=t*i+i*.5,a=n[t+1],o=e.lanesAfter.flatMap((t,n)=>t==null||a==null?[]:[{lane:n,startX:e.outgoing.includes(n)?lY(e.lane):lY(n),endX:t===a.commit.oid?lY(a.lane):lY(n)}]),s=e.commit.parentOids.length>1;return(0,Q.jsxs)(`g`,{children:[o.map(e=>{let{lane:t,startX:n,endX:a}=e;return(0,Q.jsx)(`path`,{d:n===a?`M ${n} ${r} L ${a} ${r+i}`:`M ${n} ${r} C ${n} ${r+i*.5}, ${a} ${r+i*.5}, ${a} ${r+i}`,fill:`none`,stroke:`currentColor`,strokeWidth:ct,className:uY(t)},t)}),(0,Q.jsx)(`circle`,{cx:lY(e.lane),cy:r,r:s?5:4,fill:s?`var(--card)`:`currentColor`,stroke:`currentColor`,strokeWidth:2,className:uY(e.lane)})]},e.commit.oid)}),t[0]=i,t[1]=n,t[2]=o):o=t[2];let s;return t[3]!==a||t[4]!==o||t[5]!==r?(s=(0,Q.jsx)(`svg`,{"aria-hidden":`true`,className:`pointer-events-none absolute top-2 left-1.5`,"data-testid":`history-graph`,width:r,height:a,children:o}),t[3]=a,t[4]=o,t[5]=r,t[6]=s):s=t[6],s}function fY(e){let t=(0,$.c)(45),{label:n,layout:r,history:i,selected:a,onSelect:o,sideLabel:s,highlightHead:c}=e,l=c!==void 0&&c,u,d,f,p,m,h,g;if(t[0]!==l||t[1]!==i.commits||t[2]!==i.snapshot||t[3]!==n||t[4]!==r||t[5]!==o||t[6]!==a||t[7]!==s){d=FJ(i.commits),g=IJ(d),u=r===`columns`?30:44;let e=i.snapshot?.tipOid,c=i.snapshot?.head.kind===`attached`?i.snapshot.head.ref:void 0;h=`relative py-2 pr-3 pl-1.5`,f=n,p=`flex flex-col`;let _;t[15]!==c||t[16]!==l||t[17]!==r||t[18]!==o||t[19]!==u||t[20]!==a||t[21]!==s||t[22]!==e||t[23]!==g?(_=t=>{let{commit:n}=t;return(0,Q.jsx)(`li`,{children:(0,Q.jsx)(sY,{commit:n,selected:a===n.oid,height:u,inset:g+8,layout:r,head:l&&n.oid===e,headRef:c,onSelect:e=>o(n.oid,e),openToSide:{label:s,open:()=>o(n.oid,!0)}})},n.oid)},t[15]=c,t[16]=l,t[17]=r,t[18]=o,t[19]=u,t[20]=a,t[21]=s,t[22]=e,t[23]=g,t[24]=_):_=t[24],m=d.map(_),t[0]=l,t[1]=i.commits,t[2]=i.snapshot,t[3]=n,t[4]=r,t[5]=o,t[6]=a,t[7]=s,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14];let _;t[25]!==f||t[26]!==p||t[27]!==m?(_=(0,Q.jsx)(`ol`,{"aria-label":f,className:p,children:m}),t[25]=f,t[26]=p,t[27]=m,t[28]=_):_=t[28];let v;t[29]!==u||t[30]!==d||t[31]!==g?(v=(0,Q.jsx)(dY,{rows:d,width:g,rowHeight:u}),t[29]=u,t[30]=d,t[31]=g,t[32]=v):v=t[32];let y;t[33]===g?y=t[34]:(y={paddingLeft:g},t[33]=g,t[34]=y);let b;t[35]===i?b=t[36]:(b=(0,Q.jsx)(pY,{history:i}),t[35]=i,t[36]=b);let x;t[37]!==y||t[38]!==b?(x=(0,Q.jsx)(`div`,{style:y,children:b}),t[37]=y,t[38]=b,t[39]=x):x=t[39];let S;return t[40]!==x||t[41]!==h||t[42]!==_||t[43]!==v?(S=(0,Q.jsxs)(`div`,{className:h,children:[_,v,x]}),t[40]=x,t[41]=h,t[42]=_,t[43]=v,t[44]=S):S=t[44],S}function pY(e){let t=(0,$.c)(11),{history:n}=e,r;t[0]===n?r=t[1]:(r=(0,Q.jsx)(mY,{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&&!f(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)(QJ,{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 mY(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)(Ci,{className:`size-3.5`}),`Loading older commits…`]}),t[0]=e):e=t[0],e}if(f(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)(Y,{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=XK(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 hY(e,t){let n=(0,$.c)(4),r=t===void 0?`scrollOffset`:t,i=Rr(xt),a;return n[0]!==e||n[1]!==r||n[2]!==i?(a={ref:t=>{if(!t)return;let n=t.querySelector(`[data-slot="scroll-area-viewport"]`)??t;n.scrollTop=i.get(e)[r]},onScrollCapture:t=>{t.target instanceof HTMLElement&&i.set(e,{...i.get(e),[r]:t.target.scrollTop})}},n[0]=e,n[1]=r,n[2]=i,n[3]=a):a=n[3],a}function gY(e){let t=(0,$.c)(18),{scope:n,connection:r,selected:i,onSelect:a,sideLabel:o,onOpenGraph:s,onOpenChanges:c}=e,l=XJ(r,n),u=Ts(Te(rP(n,r))),d=ZK(u?.branch,l.snapshot),f=u?.changes.length??0,p;t[0]!==r||t[1]!==n?(p=VJ({connection:r,scope:n,kind:`commits`}),t[0]=r,t[1]=n,t[2]=p):p=t[2];let m=hY(p),h;t[3]===l?h=t[4]:(h=(0,Q.jsx)(vY,{history:l}),t[3]=l,t[4]=h);let g=UF,_=f>0&&(0,Q.jsx)(`div`,{className:`pt-2 pr-3 pl-1.5`,children:(0,Q.jsxs)(`button`,{type:`button`,onClick:c,className:`flex h-9 w-full items-center gap-2 rounded-lg px-2 text-left text-caption transition-colors hover:bg-accent`,children:[(0,Q.jsx)(Nd,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(fr,{className:`flex-1`,text:`Uncommitted changes`}),(0,Q.jsx)(`span`,{className:`text-2xs text-muted-foreground tabular-nums`,children:Kr(f,`file`)})]})}),v;t[5]!==l||t[6]!==a||t[7]!==i||t[8]!==o?(v=l.commits.length===0?(0,Q.jsx)(yY,{}):(0,Q.jsx)(fY,{label:`Commits`,layout:`stacked`,history:l,selected:i||l.selected||``,onSelect:(e,t)=>{l.select(e),a(e,t)},sideLabel:o}),t[5]=l,t[6]=a,t[7]=i,t[8]=o,t[9]=v):v=t[9];let y;t[10]!==g||t[11]!==m||t[12]!==_||t[13]!==v?(y=(0,Q.jsxs)(g,{className:`min-h-0 flex-initial`,role:`region`,"aria-label":`History reading area`,...m,children:[_,v]}),t[10]=g,t[11]=m,t[12]=_,t[13]=v,t[14]=y):y=t[14];let b;return t[15]!==l.commits.length||t[16]!==s?(b=l.commits.length>0&&(0,Q.jsx)(`div`,{className:`shrink-0 border-t p-1.5`,children:(0,Q.jsxs)(Y,{variant:`ghost`,className:`w-full justify-start`,onClick:s,children:[(0,Q.jsx)(Mf,{}),`Open graph`,(0,Q.jsx)(Pe,{className:`ml-auto text-muted-foreground`})]})}),t[15]=l.commits.length,t[16]=s,t[17]=b):b=t[17],(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsx)(`section`,{"aria-label":`Branch`,className:`flex shrink-0 border-b px-3.5 py-2.5`,children:(0,Q.jsx)(YJ,{tracking:d})}),h,y,b]})}function _Y(e){let t=(0,$.c)(7),{history:n}=e,r;t[0]===n.snapshot?r=t[1]:(r=n.snapshot!==null&&n.snapshot!==void 0&&(0,Q.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b px-3.5 font-mono text-caption leading-4 text-muted-foreground`,children:[(0,Q.jsx)(Of,{className:`size-3.5 shrink-0`}),(0,Q.jsx)(fr,{className:`min-w-0 flex-1 font-medium text-foreground`,text:YK(n.snapshot)})]}),t[0]=n.snapshot,t[1]=r);let i;t[2]===n?i=t[3]:(i=(0,Q.jsx)(vY,{history:n}),t[2]=n,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,Q.jsxs)(Q.Fragment,{children:[r,i]}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function vY(e){let t=(0,$.c)(1),{history:n}=e;if(!n.restarted)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(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[0]=r):r=t[0],r}function yY(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(DI,{children:(0,Q.jsxs)(OI,{children:[(0,Q.jsx)(kI,{children:`No commits yet`}),(0,Q.jsx)(AI,{children:`Commits will appear here once this worktree has history.`})]})}),e[0]=t):t=e[0],t}function bY(e){let t=(0,$.c)(14),{scope:n,connection:r,onSelect:i,sideLabel:a}=e,o=XJ(r,n),s=st(),c;t[0]!==r||t[1]!==n?(c=VJ({connection:r,scope:n,kind:`commits`}),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=hY(c,`graphScrollOffset`),u;t[3]===o?u=t[4]:(u=(0,Q.jsx)(_Y,{history:o}),t[3]=o,t[4]=u);let d;t[5]!==o||t[6]!==i||t[7]!==s||t[8]!==a?(d=o.commits.length===0?(0,Q.jsx)(yY,{}):(0,Q.jsx)(fY,{label:`Commit graph`,highlightHead:!0,layout:s?`stacked`:`columns`,history:o,selected:o.selected??``,onSelect:(e,t)=>{o.select(e),i(e,t)},sideLabel:a}),t[5]=o,t[6]=i,t[7]=s,t[8]=a,t[9]=d):d=t[9];let f;return t[10]!==l||t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(`div`,{className:`@container/graph flex min-h-0 flex-1 flex-col overflow-auto`,role:`region`,"aria-label":`Graph reading area`,...l,children:[u,d]}),t[10]=l,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function xY(e,t,n){let r=(0,$.c)(6),i={connection:e,scope:t,path:n},{value:a,result:o}=su(KJ(i)),s=Aa(WJ(i)),c;r[0]===s?c=r[1]:(c=()=>s(void 0),r[0]=s,r[1]=c);let l;return r[2]!==o||r[3]!==c||r[4]!==a?(l={...a,result:o,readMore:c},r[2]=o,r[3]=c,r[4]=a,r[5]=l):l=r[5],l}function SY(e){let t=(0,$.c)(34),{scope:n,connection:r,path:i,onSelect:a,sideLabel:o}=e,s=xY(r,n,i),c;t[0]!==r||t[1]!==i||t[2]!==n?(c=VJ({connection:r,scope:n,kind:`file`,path:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=c):c=t[3];let l=c,u=Rr(l,CY),d=Aa(l),f=hY(l),p;t[4]!==a||t[5]!==d?(p=(e,t)=>{d(t=>({...t,selected:e.commit.oid})),a({oid:e.commit.oid,path:e.path},t)},t[4]=a,t[5]=d,t[6]=p):p=t[6];let m=p;if(s.commits.length===0&&s.nextAfter===null){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(DI,{children:(0,Q.jsxs)(OI,{children:[(0,Q.jsx)(kI,{children:`No commits touch this file`}),(0,Q.jsx)(AI,{children:`Its timeline starts with the first commit that includes it.`})]})}),t[7]=e):e=t[7],e}let h=`Timeline of ${i}`,g;if(t[8]!==m||t[9]!==i||t[10]!==u||t[11]!==o||t[12]!==s.commits){let e;t[14]!==m||t[15]!==i||t[16]!==u||t[17]!==o?(e=e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(sY,{commit:e.commit,selected:u===e.commit.oid,onSelect:t=>m(e,t),openToSide:{label:o,open:()=>m(e,!0)},children:(0,Q.jsx)(fr,{className:`text-2xs text-muted-foreground`,text:BK(e,i)})})},e.commit.oid),t[14]=m,t[15]=i,t[16]=u,t[17]=o,t[18]=e):e=t[18],g=s.commits.map(e),t[8]=m,t[9]=i,t[10]=u,t[11]=o,t[12]=s.commits,t[13]=g}else g=t[13];let _;t[19]===s.restarted?_=t[20]:(_=s.restarted&&(0,Q.jsx)(`span`,{role:`status`,children:`History changed. Showing it from the top.`}),t[19]=s.restarted,t[20]=_);let v;t[21]===s?v=t[22]:(v=(0,Q.jsx)(wY,{timeline:s}),t[21]=s,t[22]=v);let y;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(`span`,{children:`A merge appears only when its own result changed the file.`}),t[23]=y):y=t[23];let b;t[24]!==_||t[25]!==v?(b=(0,Q.jsxs)(`li`,{className:`flex flex-col gap-1 px-2 py-3 text-2xs text-muted-foreground`,children:[_,v,y]}),t[24]=_,t[25]=v,t[26]=b):b=t[26];let x;t[27]!==h||t[28]!==g||t[29]!==b?(x=(0,Q.jsxs)(`ol`,{"aria-label":h,className:`flex flex-col p-2`,children:[g,b]}),t[27]=h,t[28]=g,t[29]=b,t[30]=x):x=t[30];let S;return t[31]!==f||t[32]!==x?(S=(0,Q.jsx)(`div`,{role:`region`,"aria-label":`Timeline reading area`,className:`min-h-0 flex-1 overflow-auto`,...f,children:x}),t[31]=f,t[32]=x,t[33]=S):S=t[33],S}function CY(e){return e.selected}function wY(e){let t=(0,$.c)(8),{timeline:n}=e;if(f(n.result)){let e;return t[0]===n.readMore?e=t[1]:(e=(0,Q.jsxs)(`div`,{role:`status`,children:[`Couldn't load older commits`,(0,Q.jsx)(Y,{size:`xs`,variant:`outline`,onClick:n.readMore,children:`Retry`})]}),t[0]=n.readMore,t[1]=e),e}if(n.nextAfter){let e=n.result.waiting?`Loading older commits…`:`Load older commits`,r;return t[2]!==e||t[3]!==n.readMore||t[4]!==n.result.waiting?(r=(0,Q.jsx)(Y,{size:`sm`,variant:`outline`,disabled:n.result.waiting,onClick:n.readMore,children:e}),t[2]=e,t[3]=n.readMore,t[4]=n.result.waiting,t[5]=r):r=t[5],r}let r=n.boundary===`shallow`?`Shallow clone: older history is not available.`:`Start of this file’s history.`,i;return t[6]===r?i=t[7]:(i=(0,Q.jsx)(`span`,{children:r}),t[6]=r,t[7]=i),i}function TY(){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)}function EY(e){let t=(0,$.c)(2),n;return t[0]===e.connection?n=t[1]:(n=Ta(e.connection),t[0]=e.connection,t[1]=n),Rr(n)}var DY=fa(`BrowserCommitDraft.submit`)(function*(e,t,n){return yield*qo(ei(function*(){let r=yield*Wi(bt(),e=>B(e,Zi)),i=new AbortController,a=()=>{Di(B(r,Zi))};return yield*Wi(Fr(()=>{t.add(i),i.signal.addEventListener(`abort`,a,{once:!0})}),()=>Fr(()=>{i.signal.removeEventListener(`abort`,a),t.delete(i)})),yield*e(n,r)}))});function OY(e,t,n){let r=(0,$.c)(12),i;r[0]!==t.connection||r[1]!==e?(i=Eo({connection:t.connection,scope:e}),r[0]=t.connection,r[1]=e,r[2]=i):i=r[2];let{value:a}=su(i),o;r[3]!==t.connection||r[4]!==e?(o=oi({connection:t.connection,scope:e}),r[3]=t.connection,r[4]=e,r[5]=o):o=r[5];let s=Rr(o),c;r[6]!==n||r[7]!==a?(c=e=>DY(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 kY(e,t,n,r){let i=(0,$.c)(121),{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=Pq(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 _=uU(g),v;i[6]===_?v=i[7]:(v=Gq(_),i[6]=_,i[7]=v);let y=v,b;i[8]===_?b=i[9]:(b=Kq(_),i[8]=_,i[9]=b);let x=b,{mode:S,message:C,amendMessage:w,excluded:T,added:E,groups:D}=ad(_.store,FY),{done:O,activeGroup:k,ownHead:A,busy:j,error:M,drafted:N,draftedBy:P,editingFiles:F}=Ii(y),I;i[10]===_?I=i[11]:(I=e=>_.setFieldValue(`mode`,e),i[10]=_,i[11]=I);let L=I,R;i[12]===_?R=i[13]:(R=e=>_.setFieldValue(`message`,e),i[12]=_,i[13]=R);let z=R,B;i[14]===_?B=i[15]:(B=e=>_.setFieldValue(`amendMessage`,e),i[14]=_,i[15]=B);let V=B,H;i[16]===_?H=i[17]:(H=e=>_.setFieldValue(`excluded`,e),i[16]=_,i[17]=H);let U=H,W;i[18]===_?W=i[19]:(W=e=>_.setFieldValue(`added`,e),i[18]=_,i[19]=W);let G=W,K;i[20]===_?K=i[21]:(K=e=>_.setFieldValue(`groups`,e),i[20]=_,i[21]=K);let ee=K,q;i[22]===y?q=i[23]:(q=e=>y.update(t=>({...t,done:typeof e==`function`?e(t.done):e})),i[22]=y,i[23]=q);let te=q,ne;i[24]===y?ne=i[25]:(ne=e=>y.update(t=>({...t,activeGroup:e})),i[24]=y,i[25]=ne);let re=ne,ie;i[26]===y?ie=i[27]:(ie=e=>y.update(t=>({...t,ownHead:e})),i[26]=y,i[27]=ie);let ae=ie,oe;i[28]===y?oe=i[29]:(oe=e=>y.update(t=>({...t,busy:e})),i[28]=y,i[29]=oe);let se=oe,ce;i[30]===y?ce=i[31]:(ce=e=>y.update(t=>({...t,error:e})),i[30]=y,i[31]=ce);let le=ce,ue=(e,t)=>{let n=t?.length===1?`1 selected file`:`${t?.length} selected files`;y.update(r=>({...r,drafted:{...r.drafted,[e]:t},draftedBy:{...r.draftedBy,[e]:t?`Generated by ${Ts(Te(J))?.find(e=>e.id===me)?.label??me} from ${n}`:null}}))},de=S===`amend`?`amend`:`commit`,fe=qq(a,de,t),pe=OY(a,t,x),J=EY(t),me=jq(Ts(Te(J)),r.value),he;if(i[32]!==T||i[33]!==n){let e;i[35]===T?e=i[36]:(e=e=>!T.has(e.path),i[35]=T,i[36]=e),he=new Set(n.filter(e).flatMap(PY)),i[32]=T,i[33]=n,i[34]=he}else he=i[34];let ge;i[37]===he?ge=i[38]:(ge=[...he],i[37]=he,i[38]=ge);let _e=ge,ve;if(i[39]!==E||i[40]!==n){let e;i[42]===E?e=i[43]:(e=e=>E.has(e.path),i[42]=E,i[43]=e),ve=new Set(n.filter(e).flatMap(NY)),i[39]=E,i[40]=n,i[41]=ve}else ve=i[41];let ye;i[44]===ve?ye=i[45]:(ye=[...ve],i[44]=ve,i[45]=ye);let be=de===`amend`?ye:_e,xe=de===`amend`?w:C,Se=!(!fe.operation||fe.canStartNew),Ce=fe.operation?.receipt,we=j||pe.result.waiting||fe.recovered.waiting,Ee=D?N.groups:N.message,De;i[46]!==Ee||i[47]!==de||i[48]!==O||i[49]!==D||i[50]!==o?(De=de===`commit`&&Ee!=null&&Fq(o,Ee,new Set((D??[]).filter(e=>O.has(e.id)).flatMap(MY))),i[46]=Ee,i[47]=de,i[48]=O,i[49]=D,i[50]=o,i[51]=De):De=i[51];let Oe=De,ke;i[52]!==n||i[53]!==D?(ke=D?n.filter(e=>!D.some(t=>t.paths.includes(e.path))):[],i[52]=n,i[53]=D,i[54]=ke):ke=i[54];let Ae=ke,je;i[55]!==de||i[56]!==xe||i[57]!==O||i[58]!==D||i[59]!==S||i[60]!==be||i[61]!==Oe||i[62]!==o?(je=Oe||(S===`groups`?!D?.length||D.filter(e=>!O.has(e.id)).some(jY):!xe.trim()||de!==`amend`&&o.inProgress!==`merge`&&!be.length),i[55]=de,i[56]=xe,i[57]=O,i[58]=D,i[59]=S,i[60]=be,i[61]=Oe,i[62]=o,i[63]=je):je=i[63];let Me=je,Ne;i[64]===o?Ne=i[65]:(Ne=xs(`commit`,o),i[64]=o,i[65]=Ne);let Pe=Ne,Fe;i[66]===o?Fe=i[67]:(Fe=xs(`amend`,o),i[66]=o,i[67]=Fe);let Ie=Fe,Le;i[68]===l?Le=i[69]:(Le=l?en({try:l,catch:AY}):void 0,i[68]=l,i[69]=Le);let Re;return i[70]!==k||i[71]!==E||i[72]!==w||i[73]!==Ie||i[74]!==Me||i[75]!==j||i[76]!==de||i[77]!==Pe||i[78]!==_e||i[79]!==x||i[80]!==xe||i[81]!==O||i[82]!==N||i[83]!==P||i[84]!==F||i[85]!==M||i[86]!==T||i[87]!==n||i[88]!==_||i[89]!==pe||i[90]!==fe||i[91]!==D||i[92]!==Ae||i[93]!==C||i[94]!==S||i[95]!==me||i[96]!==J||i[97]!==c||i[98]!==A||i[99]!==be||i[100]!==Ce||i[101]!==a||i[102]!==re||i[103]!==G||i[104]!==V||i[105]!==se||i[106]!==te||i[107]!==ue||i[108]!==le||i[109]!==U||i[110]!==ee||i[111]!==z||i[112]!==L||i[113]!==ae||i[114]!==Oe||i[115]!==y||i[116]!==o||i[117]!==Le||i[118]!==Se||i[119]!==we?(Re={scope:a,status:o,onBusy:c,onLookAgain:Le,createId:TY,mode:S,commitAction:de,git:fe,generator:pe,models:J,model:me,message:C,amendMessage:w,editingFiles:F,excluded:T,added:E,groups:D,done:O,activeGroup:k,ownHead:A,busy:j,error:M,drafted:N,draftedBy:P,files:n,commitPaths:_e,paths:be,currentMessage:xe,uncertain:Se,receipt:Ce,working:we,staleDraft:Oe,leftUncommitted:Ae,blocker:Me,commitModeBlocker:Pe,amendModeBlocker:Ie,controllers:x,form:_,setMode:L,setMessage:z,setAmendMessage:V,setExcluded:U,setAdded:G,setGroups:ee,setDone:te,setActiveGroup:re,setOwnHead:ae,setBusy:se,setError:le,setDrafted:ue,state:y},i[70]=k,i[71]=E,i[72]=w,i[73]=Ie,i[74]=Me,i[75]=j,i[76]=de,i[77]=Pe,i[78]=_e,i[79]=x,i[80]=xe,i[81]=O,i[82]=N,i[83]=P,i[84]=F,i[85]=M,i[86]=T,i[87]=n,i[88]=_,i[89]=pe,i[90]=fe,i[91]=D,i[92]=Ae,i[93]=C,i[94]=S,i[95]=me,i[96]=J,i[97]=c,i[98]=A,i[99]=be,i[100]=Ce,i[101]=a,i[102]=re,i[103]=G,i[104]=V,i[105]=se,i[106]=te,i[107]=ue,i[108]=le,i[109]=U,i[110]=ee,i[111]=z,i[112]=L,i[113]=ae,i[114]=Oe,i[115]=y,i[116]=o,i[117]=Le,i[118]=Se,i[119]=we,i[120]=Re):Re=i[120],Re}function AY(e){return new ot(e,rr(e))}function jY(e){return!e.message.trim()||!e.paths.length}function MY(e){return e.paths}function NY(e){return e.paths}function PY(e){return e.paths}function FY(e){return e.values}function IY(e,t,n,r){let i=(0,$.c)(46),a=kY(e,t,n,r),{state:o,form:s,commitAction:c,setMode:l,setGroups:u,setDrafted:d,setAmendMessage:f,setMessage:p,setAdded:m,setExcluded:h}=a,g,_,v,y;i[0]===a?(g=i[1],_=i[2],v=i[3],y=i[4]):(g=()=>Di(fe(a)),_=()=>Di(Ve(a,a.mode===`groups`?`groups`:`message`)),v=()=>Di(eo(a)),y=()=>Di(Ne(a)),i[0]=a,i[1]=g,i[2]=_,i[3]=v,i[4]=y);let b;i[5]===o?b=i[6]:(b=()=>o.update(LY),i[5]=o,i[6]=b);let x;i[7]!==c||i[8]!==f||i[9]!==p?(x=e=>{c===`amend`?f(e):p(e)},i[7]=c,i[8]=f,i[9]=p,i[10]=x):x=i[10];let S;i[11]!==d||i[12]!==u||i[13]!==l?(S=e=>{(e===`single`||e===`amend`||e===`groups`)&&(l(e),e===`single`&&(u(null),d(`groups`,null)))},i[11]=d,i[12]=u,i[13]=l,i[14]=S):S=i[14];let C;i[15]!==c||i[16]!==s||i[17]!==m||i[18]!==h?(C=(e,t)=>{if(c===`amend`){let n=new Set(s.state.values.added);t?n.add(e):n.delete(e),m(n)}else{let n=new Set(s.state.values.excluded);t?n.delete(e):n.add(e),h(n)}},i[15]=c,i[16]=s,i[17]=m,i[18]=h,i[19]=C):C=i[19];let w,T,E,D;i[20]!==s||i[21]!==u?(E=e=>u(s.state.values.groups?.filter(t=>t.id!==e)??null),D=(e,t)=>u(s.state.values.groups?.map(n=>n.id===e?{...n,message:t}:n)??null),w=(e,t)=>u(s.state.values.groups?.map(n=>({...n,paths:[...n.paths.filter(t=>!e.includes(t)),...n.id===t?e:[]]}))??null),T=()=>u([...s.state.values.groups??[],{id:TY(),message:``,paths:[]}]),i[20]=s,i[21]=u,i[22]=w,i[23]=T,i[24]=E,i[25]=D):(w=i[22],T=i[23],E=i[24],D=i[25]);let O;i[26]!==d||i[27]!==u||i[28]!==l?(O=()=>{l(`single`),u(null),d(`groups`,null)},i[26]=d,i[27]=u,i[28]=l,i[29]=O):O=i[29];let k;return i[30]!==r.set||i[31]!==a||i[32]!==g||i[33]!==_||i[34]!==w||i[35]!==T||i[36]!==O||i[37]!==v||i[38]!==y||i[39]!==b||i[40]!==x||i[41]!==S||i[42]!==C||i[43]!==E||i[44]!==D?(k={...a,messageLimit:K,groupLimit:20,commit:g,generate:_,lookAgain:v,checkOutcome:y,setModel:r.set,toggleEditingFiles:b,setCurrentMessage:x,setMode:S,setIncluded:C,removeGroup:E,setGroupMessage:D,moveFile:w,addGroup:T,clearGroups:O},i[30]=r.set,i[31]=a,i[32]=g,i[33]=_,i[34]=w,i[35]=T,i[36]=O,i[37]=v,i[38]=y,i[39]=b,i[40]=x,i[41]=S,i[42]=C,i[43]=E,i[44]=D,i[45]=k):k=i[45],k}function LY(e){return{...e,editingFiles:!e.editingFiles}}var RY=so(e=>Br(t=>{t.addFinalizer(()=>{for(let t of e)t.abort();e.clear()})}));function zY(e){let t=(0,$.c)(2),n;t[0]===e?n=t[1]:(n=RY(e),t[0]=e,t[1]=n),ao(n)}function BY(e){let t=(0,$.c)(102),{status:n,liveBranch:r,onLookAgain:i}=e,{preferences:a,setPreference:o}=Hc(),s=e.context,c;t[0]===e.status.changes?c=t[1]:(c=FN(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=IY(e,s,c,u);zY(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,O;t[7]!==w||t[8]!==d||t[9]!==y||t[10]!==x?(D=e=>{e.preventDefault(),!w&&!x&&!y&&d.commit()},O=e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),!w&&!x&&!y&&d.commit())},t[7]=w,t[8]=d,t[9]=y,t[10]=x,t[11]=D,t[12]=O):(D=t[11],O=t[12]);let k=p===`amend`?`Amend last commit`:`Commit changes`,A;t[13]===k?A=t[14]:(A=(0,Q.jsx)(nF,{children:k}),t[13]=k,t[14]=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[15]===j?M=t[16]:(M=(0,Q.jsx)(rF,{children:j}),t[15]=j,t[16]=M);let N;t[17]!==A||t[18]!==M?(N=(0,Q.jsxs)(eF,{children:[A,M]}),t[17]=A,t[18]=M,t[19]=N):N=t[19];let P=r??void 0,F;t[20]===P?F=t[21]:(F=ZK(P,null),t[20]=P,t[21]=F);let I;t[22]===F?I=t[23]:(I=(0,Q.jsx)(`div`,{className:`flex items-center gap-2 rounded-xl bg-muted/50 px-3 py-2 text-caption`,children:(0,Q.jsx)(YJ,{tracking:F})}),t[22]=F,t[23]=I);let L;t[24]!==E||t[25]!==T||t[26]!==v||t[27]!==d.setMode||t[28]!==f||t[29]!==h||t[30]!==n.inProgress||t[31]!==x?(L=n.inProgress!==`merge`&&(0,Q.jsx)(Ae,{value:f,onValueChange:d.setMode,children:(0,Q.jsxs)(Rn,{className:`w-full`,children:[(0,Q.jsx)($n,{value:`single`,className:`flex-1`,disabled:x||T!=null,children:`Single commit`}),(0,Q.jsx)($n,{value:`amend`,className:`flex-1`,disabled:x||E!=null,children:`Amend last`}),(0,Q.jsx)($n,{value:`groups`,className:`flex-1`,disabled:x||T!=null||!h||!v.length,children:`Use groups`})]})}),t[24]=E,t[25]=T,t[26]=v,t[27]=d.setMode,t[28]=f,t[29]=h,t[30]=n.inProgress,t[31]=x,t[32]=L):L=t[32];let R=x||y,z;t[33]!==d||t[34]!==f?(z=f===`groups`?(0,Q.jsx)(ZY,{form:d}):(0,Q.jsx)(UY,{form:d}),t[33]=d,t[34]=f,t[35]=z):z=t[35];let B;t[36]!==R||t[37]!==z?(B=(0,Q.jsx)(`fieldset`,{disabled:R,className:`flex min-w-0 flex-col gap-3`,children:z}),t[36]=R,t[37]=z,t[38]=B):B=t[38];let V;t[39]!==p||t[40]!==d?(V=p===`commit`&&(0,Q.jsx)(WY,{form:d}),t[39]=p,t[40]=d,t[41]=V):V=t[41];let H;t[42]!==d.currentMessage||t[43]!==f?(H=f!==`groups`&&!d.currentMessage.trim()&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:`Write or generate a message before committing.`}),t[42]=d.currentMessage,t[43]=f,t[44]=H):H=t[44];let U;t[45]===C?U=t[46]:(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[45]=C,t[46]=U);let W;t[47]!==p||t[48]!==e?(W=rX(e,p),t[47]=p,t[48]=e,t[49]=W):W=t[49];let G;t[50]===W?G=t[51]:(G=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:W}),t[50]=W,t[51]=G);let K;t[52]!==S||t[53]!==b?(K=b&&!(S&&Pt(b))&&(0,Q.jsxs)(`div`,{role:`status`,className:`text-sm`,children:[(0,Q.jsx)(`p`,{children:b.state}),b.progress.map(HY)]}),t[52]=S,t[53]=b,t[54]=K):K=t[54];let ee;t[55]!==b||t[56]!==y?(ee=y&&!b&&(0,Q.jsx)(`p`,{role:`status`,children:`Outcome not yet confirmed`}),t[55]=b,t[56]=y,t[57]=ee):ee=t[57];let q;t[58]===S?q=t[59]:(q=S?(0,Q.jsx)(rJ,{text:rr(S)}):null,t[58]=S,t[59]=q);let te;t[60]!==d.lookAgain||t[61]!==i||t[62]!==b||t[63]!==C||t[64]!==x?(te=(C||b&&Jn(b))&&i&&(0,Q.jsx)(Y,{type:`button`,variant:`outline`,disabled:x,onClick:d.lookAgain,children:`Look again`}),t[60]=d.lookAgain,t[61]=i,t[62]=b,t[63]=C,t[64]=x,t[65]=te):te=t[65];let ne;t[66]!==d.checkOutcome||t[67]!==m.operation||t[68]!==x?(ne=m.operation&&!x&&(0,Q.jsx)(Y,{type:`button`,variant:`outline`,onClick:d.checkOutcome,children:`Check outcome`}),t[66]=d.checkOutcome,t[67]=m.operation,t[68]=x,t[69]=ne):ne=t[69];let re;t[70]!==w||t[71]!==_||t[72]!==g||t[73]!==f||t[74]!==b||t[75]!==n.changes||t[76]!==n.inProgress||t[77]!==y||t[78]!==x?(re=x||y||!!(b&&Jn(b))||w||n.inProgress!==`merge`&&n.changes.some(VY)||!!(f===`groups`&&g?.every(e=>_.has(e.id))),t[70]=w,t[71]=_,t[72]=g,t[73]=f,t[74]=b,t[75]=n.changes,t[76]=n.inProgress,t[77]=y,t[78]=x,t[79]=re):re=t[79];let ie;t[80]===d?ie=t[81]:(ie=iX(d),t[80]=d,t[81]=ie);let ae;t[82]!==re||t[83]!==ie?(ae=(0,Q.jsx)(Y,{type:`submit`,disabled:re,children:ie}),t[82]=re,t[83]=ie,t[84]=ae):ae=t[84];let oe;return t[85]!==N||t[86]!==I||t[87]!==L||t[88]!==B||t[89]!==V||t[90]!==H||t[91]!==U||t[92]!==G||t[93]!==K||t[94]!==ee||t[95]!==q||t[96]!==te||t[97]!==ne||t[98]!==ae||t[99]!==D||t[100]!==O?(oe=(0,Q.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:D,onKeyDown:O,children:[N,I,L,B,V,H,U,G,K,ee,q,te,ne,ae]}),t[85]=N,t[86]=I,t[87]=L,t[88]=B,t[89]=V,t[90]=H,t[91]=U,t[92]=G,t[93]=K,t[94]=ee,t[95]=q,t[96]=te,t[97]=ne,t[98]=ae,t[99]=D,t[100]=O,t[101]=oe):oe=t[101],oe}function VY(e){return e.scope===`unmerged`}function HY(e){return(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function UY(e){let t=(0,$.c)(47),{form:n}=e,{commitAction:r,editingFiles:i,excluded:a,added:o,files:s,paths:c,currentMessage:l,working:u}=n,d=r===`amend`?`Files to add`:`Files`,f;t[0]===d?f=t[1]:(f=(0,Q.jsx)(`span`,{className:`font-medium`,children:d}),t[0]=d,t[1]=f);let p;t[2]!==s.length||t[3]!==c.length?(p=(0,Q.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[`(`,c.length,` of `,s.length,`)`]}),t[2]=s.length,t[3]=c.length,t[4]=p):p=t[4];let m;t[5]!==r||t[6]!==i||t[7]!==s.length||t[8]!==n||t[9]!==u?(m=r===`commit`&&s.length>0&&(0,Q.jsx)(Y,{type:`button`,size:`xs`,variant:`ghost`,className:`ml-auto`,disabled:u,onClick:()=>n.toggleEditingFiles(),children:i?`Done`:`Edit`}),t[5]=r,t[6]=i,t[7]=s.length,t[8]=n,t[9]=u,t[10]=m):m=t[10];let h;t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-caption`,children:[f,p,m]}),t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;if(t[15]!==o||t[16]!==r||t[17]!==i||t[18]!==a||t[19]!==s||t[20]!==n){let e;t[22]!==o||t[23]!==r||t[24]!==i||t[25]!==a||t[26]!==n?(e=e=>{let t=r===`amend`?o.has(e.path):!a.has(e.path),s=r===`amend`||i,c=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pw,{path:e.path,className:`size-3.5 shrink-0`}),(0,Q.jsx)(fr,{className:`min-w-0 flex-1`,text:e.path}),(0,Q.jsx)(`span`,{"aria-hidden":s,className:`shrink-0 text-muted-foreground`,children:tX(e.kind,t,r)})]});return s?(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)(OJ,{checked:t,onCheckedChange:t=>n.setIncluded(e.path,t)}),c]},e.path):(0,Q.jsx)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-xs`,children:c},e.path)},t[22]=o,t[23]=r,t[24]=i,t[25]=a,t[26]=n,t[27]=e):e=t[27],g=s.map(e),t[15]=o,t[16]=r,t[17]=i,t[18]=a,t[19]=s,t[20]=n,t[21]=g}else g=t[21];let _;t[28]===g?_=t[29]:(_=(0,Q.jsx)(`div`,{className:`max-h-40 overflow-auto rounded-xl border p-1`,children:g}),t[28]=g,t[29]=_);let v;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(Vr,{htmlFor:`commit-message`,children:`Message`}),t[30]=v):v=t[30];let y;t[31]!==r||t[32]!==n.draftedBy?(y=r===`commit`&&n.draftedBy.message&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.draftedBy.message}),t[31]=r,t[32]=n.draftedBy,t[33]=y):y=t[33];let b;t[34]===n?b=t[35]:(b=e=>n.setCurrentMessage(e.target.value),t[34]=n,t[35]=b);let x;t[36]!==l||t[37]!==n.messageLimit||t[38]!==b?(x=(0,Q.jsx)(yI,{id:`commit-message`,value:l,onChange:b,rows:4,maxLength:n.messageLimit,placeholder:`Describe what changed and why`}),t[36]=l,t[37]=n.messageLimit,t[38]=b,t[39]=x):x=t[39];let S;t[40]!==x||t[41]!==y?(S=(0,Q.jsxs)(zi,{children:[v,y,x]}),t[40]=x,t[41]=y,t[42]=S):S=t[42];let C;return t[43]!==S||t[44]!==h||t[45]!==_?(C=(0,Q.jsxs)(Q.Fragment,{children:[h,_,S]}),t[43]=S,t[44]=h,t[45]=_,t[46]=C):C=t[46],C}function WY(e){let n=(0,$.c)(57),{form:r}=e,{models:i,model:a}=r,o,s,c,l,u,d,p,m,h,g,_,v;if(n[0]!==r||n[1]!==a||n[2]!==i){let e=Ts(Te(i));c=e?.find(e=>e.id===a);let f;n[15]===r?f=n[16]:(f=YY(r),n[15]=r,n[16]=f),l=f,_=`flex flex-wrap items-center gap-2`;let y=!!l||r.working||r.uncertain,b;n[17]===r?b=n[18]:(b=()=>r.generate(),n[17]=r,n[18]=b);let x;n[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(Ep,{}),n[19]=x):x=n[19];let S=r.generator.result.waiting?`Generating…`:`Generate with AI`;n[20]!==y||n[21]!==b||n[22]!==S?(v=(0,Q.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,disabled:y,onClick:b,children:[x,S]}),n[20]=y,n[21]=b,n[22]=S,n[23]=v):v=n[23],s=At,d=e?.map(JY)??[],p=a??null,m=!e?.length||r.working||r.uncertain,n[24]===r?h=n[25]:(h=e=>{e&&r.setModel(e)},n[24]=r,n[25]=h);let C=e?.length?`Choose a model`:`No coding CLI available`;n[26]===C?g=n[27]:(g=(0,Q.jsx)(fo,{"aria-label":`Commit model`,className:`w-auto max-w-48`,size:`sm`,children:(0,Q.jsx)(Ui,{placeholder:C})}),n[26]=C,n[27]=g),o=t,u=Aq(e?.filter(qY)??[]).map(GY),n[0]=r,n[1]=a,n[2]=i,n[3]=o,n[4]=s,n[5]=c,n[6]=l,n[7]=u,n[8]=d,n[9]=p,n[10]=m,n[11]=h,n[12]=g,n[13]=_,n[14]=v}else o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],d=n[8],p=n[9],m=n[10],h=n[11],g=n[12],_=n[13],v=n[14];let y;n[28]!==o||n[29]!==u?(y=(0,Q.jsx)(o,{children:u}),n[28]=o,n[29]=u,n[30]=y):y=n[30];let b;n[31]!==s||n[32]!==d||n[33]!==p||n[34]!==m||n[35]!==h||n[36]!==g||n[37]!==y?(b=(0,Q.jsxs)(s,{items:d,value:p,disabled:m,onValueChange:h,children:[g,y]}),n[31]=s,n[32]=d,n[33]=p,n[34]=m,n[35]=h,n[36]=g,n[37]=y,n[38]=b):b=n[38];let x;n[39]!==c?.label||n[40]!==a||n[41]!==l?(x=l??`Sends the selected changes to ${c?.label} through ${a?.split(`:`)[0]===`claude`?`Claude Code`:`Codex`}.`,n[39]=c?.label,n[40]=a,n[41]=l,n[42]=x):x=n[42];let S;n[43]===x?S=n[44]:(S=(0,Q.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,role:`status`,children:x}),n[43]=x,n[44]=S);let C;n[45]!==r.generate||n[46]!==r.generator.result||n[47]!==r.uncertain||n[48]!==r.working||n[49]!==l?(C=f(r.generator.result)&&!r.working&&(0,Q.jsx)(Y,{type:`button`,variant:`outline`,size:`sm`,disabled:!!l||r.uncertain,onClick:r.generate,children:`Try again`}),n[45]=r.generate,n[46]=r.generator.result,n[47]=r.uncertain,n[48]=r.working,n[49]=l,n[50]=C):C=n[50];let w;return n[51]!==b||n[52]!==S||n[53]!==C||n[54]!==_||n[55]!==v?(w=(0,Q.jsxs)(`div`,{className:_,children:[v,b,S,C]}),n[51]=b,n[52]=S,n[53]=C,n[54]=_,n[55]=v,n[56]=w):w=n[56],w}function GY(e){let[t,n]=e;return(0,Q.jsxs)(si,{children:[(0,Q.jsx)(Da,{children:t}),n.map(KY)]},t)}function KY(e){return(0,Q.jsx)(Oo,{value:e.id,children:e.label},e.id)}function qY(e){return!e.id.endsWith(`:default`)}function JY(e){return{value:e.id,label:e.label}}function YY({models:e,model:t,paths:n}){if(f(e))return`Could not load coding CLI models. You can still commit manually.`;let r=Ts(Te(e));return r?!t&&r.some(e=>!e.id.endsWith(`:default`))?`Choose a model to generate a message.`:t?n.length?null:`Select files to generate a message.`:`No coding CLI available. Write a message to commit manually.`:`Loading coding CLI models…`}function XY(e,t){return e?`Groups were not proposed.`:t?`Proposing commits…`:`Generate groups with AI, then review each message and file before committing.`}function ZY(e){let n=(0,$.c)(34),{form:r}=e,{groups:i,done:a,activeGroup:o,files:s,leftUncommitted:c,error:l}=r;if(i===null){let e;n[0]!==l||n[1]!==r.working?(e=XY(l,r.working),n[0]=l,n[1]=r.working,n[2]=e):e=n[2];let t;return n[3]===e?t=n[4]:(t=(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:e}),n[3]=e,n[4]=t),t}let u;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={value:`uncommitted`,label:`Leave uncommitted`},n[5]=u):u=n[5];let d;n[6]===i?d=n[7]:(d=[u,...i.map(eX)],n[6]=i,n[7]=d);let f=d,p;n[8]===r.draftedBy.groups?p=n[9]:(p=r.draftedBy.groups&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r.draftedBy.groups}),n[8]=r.draftedBy.groups,n[9]=p);let m;n[10]!==o||n[11]!==f||n[12]!==a||n[13]!==s||n[14]!==r||n[15]!==i?(m=i.map((e,n)=>(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2 rounded-lg border p-3`,"aria-label":`Commit ${n+1}`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Commit `,n+1,nX(e.id,a,o)]}),e.paths.length===0&&a.size===0&&(0,Q.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r.removeGroup(e.id),children:`Remove empty group`}),(0,Q.jsx)(yI,{"aria-label":`Message for commit ${n+1}`,value:e.message,disabled:a.has(e.id),required:!0,maxLength:r.messageLimit,onChange:t=>r.setGroupMessage(e.id,t.target.value)}),s.filter(t=>e.paths.includes(t.path)).map(n=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs`,children:[(0,Q.jsx)(fr,{className:`min-w-0 flex-1`,text:n.path}),(0,Q.jsxs)(At,{items:f,value:e.id,disabled:a.size>0,onValueChange:e=>{e&&r.moveFile(n.paths,e)},children:[(0,Q.jsx)(fo,{size:`sm`,"aria-label":`Commit for ${n.path}`,children:(0,Q.jsx)(Ui,{})}),(0,Q.jsxs)(t,{children:[(0,Q.jsx)(Oo,{value:`uncommitted`,children:`Leave uncommitted`}),i.map($Y)]})]})]},n.path))]},e.id)),n[10]=o,n[11]=f,n[12]=a,n[13]=s,n[14]=r,n[15]=i,n[16]=m):m=n[16];let h;n[17]!==f||n[18]!==a.size||n[19]!==r||n[20]!==i||n[21]!==c?(h=c.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`}),c.map(e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs`,children:[(0,Q.jsx)(fr,{className:`min-w-0 flex-1`,text:e.path}),(0,Q.jsxs)(At,{items:f,value:`uncommitted`,disabled:a.size>0,onValueChange:t=>{t&&r.moveFile(e.paths,t)},children:[(0,Q.jsx)(fo,{size:`sm`,"aria-label":`Commit for ${e.path}`,children:(0,Q.jsx)(Ui,{})}),(0,Q.jsxs)(t,{children:[(0,Q.jsx)(Oo,{value:`uncommitted`,children:`Leave uncommitted`}),i.map(QY)]})]})]},e.path))]}),n[17]=f,n[18]=a.size,n[19]=r,n[20]=i,n[21]=c,n[22]=h):h=n[22];let g;n[23]!==a.size||n[24]!==r.addGroup||n[25]!==r.clearGroups||n[26]!==r.groupLimit||n[27]!==i.length?(g=a.size===0&&(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,disabled:i.length>=r.groupLimit,onClick:r.addGroup,children:[(0,Q.jsx)(up,{}),`Add group`]}),(0,Q.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:r.clearGroups,children:`Single commit`})]}),n[23]=a.size,n[24]=r.addGroup,n[25]=r.clearGroups,n[26]=r.groupLimit,n[27]=i.length,n[28]=g):g=n[28];let _;return n[29]!==p||n[30]!==m||n[31]!==h||n[32]!==g?(_=(0,Q.jsxs)(Q.Fragment,{children:[p,m,h,g]}),n[29]=p,n[30]=m,n[31]=h,n[32]=g,n[33]=_):_=n[33],_}function QY(e,t){return(0,Q.jsxs)(Oo,{value:e.id,children:[`Commit `,t+1]},e.id)}function $Y(e,t){return(0,Q.jsxs)(Oo,{value:e.id,children:[`Commit `,t+1]},e.id)}function eX(e,t){return{value:e.id,label:`Commit ${t+1}`}}function tX(e,t,n){return t?e.replaceAll(`-`,` `):n===`amend`?`Not added`:`Excluded`}function nX(e,t,n){return t.has(e)?` · committed`:n===e?` · in progress`:``}function rX({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 iX({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 aX(e){let t=(0,$.c)(14),{scope:n,context:r,entry:i,status:a,onBusy:o,onLookAgain:s}=e;if(i===`switch`||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)(oX,{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)(cX,{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 oX(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)(sX,{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)(sX,{action:i}),(0,Q.jsx)(`p`,{role:`alert`,children:`The last commit could not be read. Close and try again.`})]}):(0,Q.jsx)(BY,{scope:n,context:r,action:i,status:a,liveBranch:e.branch??a.branch,initialMessage:i===`amend`&&t?[t.subject,t.body].filter(Boolean).join(`
|
|
1384
|
-
|
|
1385
|
-
`):``,lastCommitMessage:t?[t.subject,t.body].filter(Boolean).join(`
|
|
1386
|
-
|
|
1387
|
-
`):``,...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)(lX,{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 sX(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)(nF,{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)(rF,{children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(eF,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function cX(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)(uX,{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)(lX,{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 lX(e){let t=(0,$.c)(12),{scope:n,context:r,pending:i,children:a}=e,o=sP(n,r.connection);if(f(o.result)){let e;t[0]===o.result.cause?e=t[1]:(e=rr(ht(o.result.cause)),t[0]=o.result.cause,t[1]=e);let n;t[2]===e?n=t[3]:(n=(0,Q.jsx)(rJ,{text:e}),t[2]=e,t[3]=n);let r;t[4]===o.refresh?r=t[5]:(r=(0,Q.jsx)(Y,{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(!tt(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 uX(e){let n=(0,$.c)(67),{scope:r,context:i,action:a,status:o,expectedStatus:s,onBusy:c,onLookAgain:l}=e,u=s===void 0?o:s,d=o.branch,[f,p]=(0,Z.useState)(`Porcelain review`),[m,h]=(0,Z.useState)(d?.stashes?.[0]?.oid??``),[g,_]=(0,Z.useState)(a===`stash-create`),v;n[0]!==u||n[1]!==c||n[2]!==l?(v={expectedStatus:u,onBusy:c,onLookAgain:l},n[0]=u,n[1]=c,n[2]=l,n[3]=v):v=n[3];let y=kJ(r,a,i,v),{busy:b,uncertain:x,outcome:S,error:C}=y,w;n[4]!==a||n[5]!==y||n[6]!==f||n[7]!==g||n[8]!==m?(w=e=>{e.preventDefault(),y.onSubmit(Nq(a,{message:f,stashOid:m,option:g}))},n[4]=a,n[5]=y,n[6]=f,n[7]=g,n[8]=m,n[9]=w):w=n[9];let T=b||x,E;n[10]!==a||n[11]!==g?(E=a===`stash-create`&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:g?`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.`}),n[10]=a,n[11]=g,n[12]=E):E=n[12];let D;n[13]!==a||n[14]!==y.messageLimit||n[15]!==f?(D=a===`stash-create`&&(0,Q.jsxs)(zi,{children:[(0,Q.jsx)(Vr,{htmlFor:`git-message`,children:`Message`}),(0,Q.jsx)(yI,{id:`git-message`,value:f,onChange:e=>p(e.target.value),required:!0,maxLength:y.messageLimit})]}),n[13]=a,n[14]=y.messageLimit,n[15]=f,n[16]=D):D=n[16];let O;n[17]!==a||n[18]!==d||n[19]!==m?(O=(a===`stash-apply`||a===`stash-pop`)&&(0,Q.jsxs)(zi,{children:[(0,Q.jsx)(Vr,{htmlFor:`git-stash`,children:`Stash`}),d?.stashes?.length?(0,Q.jsxs)(At,{items:d.stashes.map(fX),value:m,onValueChange:e=>{e&&h(e)},children:[(0,Q.jsx)(fo,{id:`git-stash`,children:(0,Q.jsx)(Ui,{})}),(0,Q.jsx)(t,{children:d.stashes.map(dX)})]}):(0,Q.jsx)(se,{id:`git-stash`,value:m,onChange:e=>h(e.target.value),required:!0,pattern:`([a-f0-9]{40}|[a-f0-9]{64})`})]}),n[17]=a,n[18]=d,n[19]=m,n[20]=O):O=n[20];let k;n[21]===g?k=n[22]:(k=(0,Q.jsx)(OJ,{checked:g,onCheckedChange:_}),n[21]=g,n[22]=k);let A=a===`stash-create`?`Include untracked files`:`Restore staged changes`,j;n[23]!==k||n[24]!==A?(j=(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[k,A]}),n[23]=k,n[24]=A,n[25]=j):j=n[25];let M;n[26]!==j||n[27]!==T||n[28]!==E||n[29]!==D||n[30]!==O?(M=(0,Q.jsxs)(`fieldset`,{disabled:T,className:`flex min-w-0 flex-col gap-4`,children:[E,D,O,j]}),n[26]=j,n[27]=T,n[28]=E,n[29]=D,n[30]=O,n[31]=M):M=n[31];let N;n[32]===S?N=n[33]:(N=(0,Q.jsx)(pX,{outcome:S}),n[32]=S,n[33]=N);let P;n[34]!==S||n[35]!==x?(P=x&&!S&&(0,Q.jsx)(`p`,{role:`status`,children:`Outcome not yet confirmed`}),n[34]=S,n[35]=x,n[36]=P):P=n[36];let F;n[37]===C?F=n[38]:(F=C?(0,Q.jsx)(rJ,{text:rr(C)}):null,n[37]=C,n[38]=F);let I;n[39]!==b||n[40]!==y.lookAgain||n[41]!==l||n[42]!==S?(I=S&&Jn(S)&&l&&(0,Q.jsx)(Y,{type:`button`,variant:`outline`,disabled:b,onClick:y.lookAgain,children:`Look again`}),n[39]=b,n[40]=y.lookAgain,n[41]=l,n[42]=S,n[43]=I):I=n[43];let L;n[44]!==b||n[45]!==y.checkOutcome||n[46]!==y.operation?(L=y.operation&&!b&&(0,Q.jsx)(Y,{type:`button`,variant:`outline`,onClick:y.checkOutcome,children:`Check outcome`}),n[44]=b,n[45]=y.checkOutcome,n[46]=y.operation,n[47]=L):L=n[47];let R;n[48]!==b||n[49]!==S||n[50]!==x?(R=b||x||!!(S&&Jn(S)),n[48]=b,n[49]=S,n[50]=x,n[51]=R):R=n[51];let z;n[52]!==a||n[53]!==b?(z=b?`Working…`:Rq(a),n[52]=a,n[53]=b,n[54]=z):z=n[54];let B;n[55]!==R||n[56]!==z?(B=(0,Q.jsx)(Y,{type:`submit`,disabled:R,children:z}),n[55]=R,n[56]=z,n[57]=B):B=n[57];let V;return n[58]!==M||n[59]!==N||n[60]!==P||n[61]!==F||n[62]!==I||n[63]!==L||n[64]!==B||n[65]!==w?(V=(0,Q.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:w,children:[M,N,P,F,I,L,B]}),n[58]=M,n[59]=N,n[60]=P,n[61]=F,n[62]=I,n[63]=L,n[64]=B,n[65]=w,n[66]=V):V=n[66],V}function dX(e){return(0,Q.jsxs)(Oo,{value:e.oid,children:[e.message,` · `,GK(e.oid)]},e.oid)}function fX(e){return{value:e.oid,label:`${e.message} · ${GK(e.oid)}`}}function pX(e){let t=(0,$.c)(7),{outcome:n}=e;if(!n)return null;if(n.message&&Pt(n)&&n.state!==`conflicted`){let e;return t[0]===n.message?e=t[1]:(e=(0,Q.jsx)(rJ,{text:n.message}),t[0]=n.message,t[1]=e),e}let r=n.state,i;t[2]===n?i=t[3]:(i=mX(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 mX({message:e,reason:t}){return e?` · ${e}`:t?` · ${t.replaceAll(`_`,` `).toLowerCase()}`:``}function hX(e){let t=(0,$.c)(53),{scope:n,context:r}=e,{connection:i}=r,a=Ts(Te(rP(n,i))),[o,s]=(0,Z.useState)(!1),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>e=>{if(!e)return;let t=()=>s(e.getClientRects().length===0);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},t[0]=c):c=t[0];let[l]=(0,Z.useState)(c),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),m=a!=null&&wn(hn(a)).kind===`hint`,h=u||m,g=sP(n,i,h),_=Ts(Te(g.result)),v=dP(n,i),y=Vs(i),b;t[1]===y?b=t[2]:(b=Gc(y),t[1]=y,t[2]=b);let x=b,C;t[3]!==x||t[4]!==y?(C=x?void 0:Js(y),t[3]=x,t[4]=y,t[5]=C):C=t[5];let w=C,[T,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(!1),[k,A]=(0,Z.useState)(null),[j,M]=(0,Z.useState)(null),[N,P]=(0,Z.useState)(null),F;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>d(!0),t[6]=F):F=t[6];let I;t[7]!==w||t[8]!==x?(I=x?{kind:`ready`,strategy:x}:{kind:`blocked`,reason:w??`Reviews & Git settings for this computer are unavailable.`},t[7]=w,t[8]=x,t[9]=I):I=t[9];let L;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{e&&A(null),O(e)},t[10]=L):L=t[10];let R;t[11]!==g||t[12]!==v||t[13]!==I?(R={details:g,enableDetails:F,pull:I,notify:yX,onProgress:L,onResult:A,refreshLook:v,onLooked:P},t[11]=g,t[12]=v,t[13]=I,t[14]=R):R=t[14];let z=fJ(n,r,R);if(a==null)return null;let B={...hn(a),branch:_e(a.branch,h?_?.branch:void 0)},V;t[15]===j?V=t[16]:(V=e=>e.id===j,t[15]=j,t[16]=V);let H=Iq.find(V),U=wn(B),W=U.kind===`run`&&U.action===`pull`&&!x,G=W&&w?w:Ee(U,B),K=Mn(U,B),ee=Vt(B),q=z.running,te;t[17]!==g.result||t[18]!==h?(te=h&&qi(g.result),t[17]=g.result,t[18]=h,t[19]=te):te=t[19];let ne=te,re=ne?Lq.slice(0,1):Lq,ie=e=>{if(Tt(e)){z.runNetwork(e,B.branch);return}P(B),M(e)},oe;t[20]===q?oe=t[21]:(oe=e=>{e||A(null),q&&O(e)},t[20]=q,t[21]=oe);let se=q?`${ae(q.name)}…`:U.label,ce=!q&&K!=null&&` ${K}`,le;t[22]!==se||t[23]!==ce?(le=(0,Q.jsxs)(`span`,{ref:l,"aria-hidden":`true`,className:`hidden @min-lg/pane:inline`,children:[se,ce]}),t[22]=se,t[23]=ce,t[24]=le):le=t[24];let ue;t[25]!==z.checkOutcome||t[26]!==k||t[27]!==q?(ue=(0,Q.jsx)(ro,{align:`end`,className:`w-80`,children:k&&!q?(0,Q.jsxs)(_r,{children:[(0,Q.jsx)(Oa,{children:k.title}),k.description!==void 0&&(k.type===`error`?(0,Q.jsx)(rJ,{text:k.description}):(0,Q.jsx)(Pi,{children:(0,Q.jsx)(nJ,{text:k.description})}))]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Oa,{children:q?`${ae(q.name)}…`:`Git action…`}),(0,Q.jsx)(`ol`,{className:`flex flex-col gap-0.5 font-mono text-2xs leading-4`,children:q?.operation?.receipt?.progress.length?q.operation.receipt.progress.slice(-4).map(vX):(0,Q.jsx)(`li`,{className:`text-muted-foreground`,children:`Waiting for Git…`})}),q&&k?.description&&(0,Q.jsx)(rJ,{text:k.description}),q&&(0,Q.jsx)(Y,{variant:`outline`,disabled:q.checking,onClick:z.checkOutcome,children:q.checking?`Checking…`:`Check outcome`})]})}),t[25]=z.checkOutcome,t[26]=k,t[27]=q,t[28]=ue):ue=t[28];let de;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(de=e=>{p(e),e&&d(!0)},t[29]=de):de=t[29];let fe=q!=null,pe;t[30]===fe?pe=t[31]:(pe=(0,Q.jsx)(Pr,{render:(0,Q.jsx)(Y,{variant:`outline`,size:`icon`,"aria-label":`Git actions`,disabled:fe})}),t[30]=fe,t[31]=pe);let J;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(Hn,{className:`size-3.5`}),t[32]=J):J=t[32];let me;t[33]===pe?me=t[34]:(me=(0,Q.jsx)(De,{render:pe,children:J}),t[33]=pe,t[34]=me);let he;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:`Git actions`}),t[35]=he):he=t[35];let ge;t[36]===me?ge=t[37]:(ge=(0,Q.jsxs)(dt,{children:[me,he]}),t[36]=me,t[37]=ge);let ve=ee?(0,Q.jsx)(YJ,{tracking:ZK(ee,null)}):(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Of,{className:`size-3.5 shrink-0`}),`Git actions`]}),ye;t[38]===ve?ye=t[39]:(ye=(0,Q.jsx)(Ei,{children:(0,Q.jsx)(Ko,{children:ve})}),t[38]=ve,t[39]=ye);let be;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Q.jsx)(gs,{}),t[40]=be):be=t[40];let xe=re.map((e,t)=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(Ei,{children:e.actions.map(e=>{let t=e.id===`pull`&&!x?w:xs(e.id,B),n=t??S(e.id,B);return(0,Q.jsxs)(dt,{onOpenChange:_X,children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(`span`,{className:`block`}),children:(0,Q.jsxs)(hr,{disabled:t!=null,onClick:()=>ie(e.id),children:[(0,Q.jsx)(gJ,{action:e.id}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(fr,{text:e.label}),t&&(0,Q.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:t})]})]})}),(0,Q.jsxs)(Et,{children:[e.description,n&&` ${n}`]})]},e.id)})}),(ne||t<re.length-1)&&(0,Q.jsx)(gs,{})]},e.id)),Se;t[41]===ne?Se=t[42]:(Se=ne&&(0,Q.jsx)(`p`,{role:`status`,className:`px-2 py-1 text-xs text-muted-foreground`,children:`Reading Git status…`}),t[41]=ne,t[42]=Se);let Ce=!ne&&(ee?.discarded?.length??0)>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gs,{}),(0,Q.jsxs)(Ei,{children:[(0,Q.jsx)(Ko,{children:`Discarded`}),ee?.discarded?.map(e=>{let t=e.kind===`rename`?`Restore discarded rename of ${e.path}`:`Restore discarded hunk of ${e.path}`;return(0,Q.jsxs)(dt,{onOpenChange:gX,children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(`span`,{className:`block`}),children:(0,Q.jsxs)(hr,{onClick:()=>{p(!1),z.restoreDiscarded(e)},children:[(0,Q.jsx)(Ip,{}),(0,Q.jsx)(fr,{className:`min-w-0`,text:t,propagateEscape:!0})]})}),(0,Q.jsxs)(Et,{children:[t,` · Kept until you restore it`]})]},e.oid)})]})]}),we;t[43]!==ne||t[44]!==ye||t[45]!==xe||t[46]!==Se||t[47]!==Ce?(we=(0,Q.jsxs)(Ni,{align:`end`,className:`w-76`,"aria-busy":ne,children:[ye,be,xe,Se,Ce]}),t[43]=ne,t[44]=ye,t[45]=xe,t[46]=Se,t[47]=Ce,t[48]=we):we=t[48];let Oe;return t[49]!==f||t[50]!==ge||t[51]!==we?(Oe=(0,Q.jsxs)(Ja,{open:f,onOpenChange:de,children:[ge,we]}),t[49]=f,t[50]=ge,t[51]=we,t[52]=Oe):Oe=t[52],(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(dJ,{"aria-label":`Git controls`,className:`shrink-0`,children:[(0,Q.jsxs)(dt,{children:[(0,Q.jsxs)(ya,{open:q!=null&&D||k!=null,onOpenChange:oe,children:[(0,Q.jsxs)(De,{render:(0,Q.jsx)(po,{render:(0,Q.jsx)(Y,{variant:`outline`,size:o?`icon`:`default`,"aria-label":q?`${ae(q.name)} in progress: show progress`:U.label,disabled:q==null&&(U.kind===`hint`||W),focusableWhenDisabled:!0,className:`aria-disabled:cursor-default`,onClick:()=>{q||k||(U.kind===`commit`?ie(`commit`):U.kind===`stash`?ie(`stash-apply`):U.kind===`run`&&z.runNetwork(U.action,B.branch))}})}),children:[q?(0,Q.jsx)(Ci,{className:`size-3.5`}):(0,Q.jsx)(gJ,{action:bX(U),className:`size-3.5`}),le]}),ue]}),(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:q?`${ae(q.name)} in progress: show progress`:G})]}),Oe]}),j==null?null:(0,Q.jsx)(JP,{open:!0,disablePointerDismissal:!0,onOpenChange:e=>{!e&&!T&&M(null)},children:(0,Q.jsxs)($P,{"aria-busy":T,className:`max-h-[min(90svh,48rem)] overflow-y-auto sm:max-w-2xl`,children:[H?.id!==`commit`&&H?.id!==`amend`&&(0,Q.jsxs)(eF,{children:[(0,Q.jsx)(nF,{children:H?.label??`Git action`}),(0,Q.jsx)(rF,{children:xX(H?.id)})]}),(0,Q.jsx)(aX,{scope:n,context:r,entry:j,status:N??B,onBusy:E,onLookAgain:z.lookAgain})]})})]})}function gX(e,t){t.reason===`escape-key`&&t.allowPropagation()}function _X(e,t){t.reason===`escape-key`&&t.allowPropagation()}function vX(e){return(0,Q.jsx)(fr,{render:(0,Q.jsx)(`li`,{}),text:e},e)}function yX(e){let{title:t,description:n,type:r}=e;return xc.add({title:t,description:n===void 0?void 0:(0,Q.jsx)(nJ,{text:n}),type:r})}function bX(e){return e.kind===`run`?e.action:e.kind===`stash`?`stash-apply`:`commit`}function xX(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 SX(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=Se(`(min-width: 1280px)`),e[0]=t):t=e[0],Rr(t)}function CX(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function wX(e){return!e||typeof e!=`object`||!(`folded`in e)||!(`expanded`in e)?{folded:[],expanded:[]}:CX(e.folded)&&CX(e.expanded)?{folded:e.folded,expanded:e.expanded}:{folded:[],expanded:[]}}function TX(e,t,n=!1){return e.folded.includes(t)||n&&!e.expanded.includes(t)}function EX(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 DX=$a(mn({saved:Bt}));function OX(e,t,n){let r=n.kind===`create`?n.anchor:void 0,i=n.kind===`create`&&r?.kind===`change`&&r.comparison?.kind===`branch`&&!t.review?{...n,anchor:{...r,revision:void 0}}:n;return JSON.stringify([e,t.review?.reviewId??t.worktreeId,t.review?.revision,i])}var kX=so(e=>Br({body:``}).pipe(Ma)),AX=so(e=>Br({body:``}).pipe(Ma)),jX=so(e=>Br(void 0).pipe(Ma)),MX=$a(mn({focused:bs([0,1])})),NX=jn.pipe(Be(mn({panes:x(Je(mn({tabs:Je(ge),pinned:Je(ge)}))),saved:Bt,focused:bs([0,1])}),{decode:ko(e=>({panes:Sq(e),saved:DX(e).pipe(xe(e=>e.saved),$e(()=>!0)),focused:MX(e).pipe(xe(e=>e.focused),$e(()=>0))})),encode:ci()})),PX=jn.pipe(Be(mn({folded:Je(ge),expanded:Je(ge)}),{decode:ko(wX),encode:ci()})),FX=so(e=>go({runtime:ac,key:`porcelain.tabs.${e}`,schema:NX,defaultValue:()=>({panes:null,saved:!1,focused:0})})),IX=so(e=>Br([]).pipe(Ma)),LX=so(e=>go({runtime:ac,key:e,schema:PX,defaultValue:()=>({folded:[],expanded:[]})}));function RX(e){let t=(0,$.c)(13),n;t[0]===e?n=t[1]:(n=FX(e),t[0]=e,t[1]=n);let r=n,{panes:i,saved:a,focused:o}=Rr(r),s=Aa(r),c=Rr(xt),l;t[2]!==r||t[3]!==c?(l=e=>{let t=c.get(r);t.focused!==e&&c.set(r,{...t,focused:e})},t[2]=r,t[3]=c,t[4]=l):l=t[4];let u;t[5]===s?u=t[6]:(u=e=>s(t=>({...t,panes:e,saved:!0})),t[5]=s,t[6]=u);let d;return t[7]!==o||t[8]!==i||t[9]!==a||t[10]!==l||t[11]!==u?(d={panes:i,saved:a,focused:o,setFocused:l,save:u},t[7]=o,t[8]=i,t[9]=a,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function zX(e,t){let n=(0,$.c)(7),r=`porcelain.folds.${e}.${t}`,i;n[0]===r?i=n[1]:(i=LX(r),n[0]=r,n[1]=i);let a=i,o=Rr(a),s=Aa(a),c;n[2]===s?c=n[3]:(c=(e,t)=>s(n=>EX(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 BX=so(e=>go({runtime:ac,key:`porcelain.walkthrough.${e}`,schema:ge,defaultValue:()=>`briefing`})),VX=so(e=>Br(`walkthrough`).pipe(Ma));function HX(e){let t=(0,$.c)(12),n;t[0]===e?n=t[1]:(n=BX(e),t[0]=e,t[1]=n);let r=n,i;t[2]===e?i=t[3]:(i=VX(e),t[2]=e,t[3]=i);let a=i,o=Aa(r),s=Aa(a),c=Rr(r),l=Rr(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 UX=so(e=>Br(25).pipe(Ma)),WX=so(e=>Br(null)),GX=so(e=>Br({scrollTop:0,selection:null,focused:void 0}).pipe(Ma));function KX(e){let t=(0,$.c)(25),n=(0,Z.useId)(),r;t[0]===n?r=t[1]:(r=WX(n),t[0]=n,t[1]=r);let i=r;ao(i);let a=Rr(xt),o;t[2]===e?o=t[3]:(o=GX(e),t[2]=e,t[3]=o);let s=o,c,l,u,d,f,p;t[4]!==s||t[5]!==a?(c=()=>a.get(s).scrollTop,l=()=>a.get(s).selection,u=()=>a.get(s).focused,d=e=>a.set(s,{...a.get(s),focused:e}),f=e=>{a.set(s,{...a.get(s),scrollTop:e})},p=e=>{a.set(s,{...a.get(s),selection:e})},t[4]=s,t[5]=a,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p):(c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11]);let m,h;t[12]!==i||t[13]!==a?(h=e=>a.get(i)?.scrollTo(e),m=e=>{if(e)return a.set(i,e),()=>{a.get(i)===e&&a.set(i,null)}},t[12]=i,t[13]=a,t[14]=m,t[15]=h):(m=t[14],h=t[15]);let g;return t[16]!==m||t[17]!==c||t[18]!==l||t[19]!==u||t[20]!==d||t[21]!==f||t[22]!==p||t[23]!==h?(g={position:c,selection:l,focused:u,rememberFocus:d,rememberPosition:f,rememberSelection:p,scrollTo:h,attach:m},t[16]=m,t[17]=c,t[18]=l,t[19]=u,t[20]=d,t[21]=f,t[22]=p,t[23]=h,t[24]=g):g=t[24],g}var qX=so(e=>Br({revision:void 0,request:0}).pipe(Ma));function JX(e){let t=(0,$.c)(7),n;t[0]===e?n=t[1]:(n=qX(e),t[0]=e,t[1]=n);let r=n,i=Rr(r),a=Aa(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}var YX=so(e=>Br(!0).pipe(Ma));function XX(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=YX(e),t[0]=e,t[1]=n);let r=n,i=Rr(r),a=Aa(r),o;return t[2]!==i||t[3]!==a?(o={open:i,setOpen:a},t[2]=i,t[3]=a,t[4]=o):o=t[4],o}var ZX=so(e=>Br(`layers`).pipe(Ma));function QX(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=ZX(e),t[0]=e,t[1]=n);let r=n,i=Rr(r),a=Aa(r),o;return t[2]!==i||t[3]!==a?(o={view:i,setView:a},t[2]=i,t[3]=a,t[4]=o):o=t[4],o}var $X=so(e=>Br(!1).pipe(Ma));function eZ(e){let t=(0,$.c)(10),n;t[0]===e?n=t[1]:(n=$X(e),t[0]=e,t[1]=n);let r=n,i=Rr(r),a=Aa(r),o;t[2]===a?o=t[3]:(o=()=>a(!0),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==a?(s=e=>{e&&i&&!e.disabled&&(e.focus(),a(!1))},t[4]=i,t[5]=a,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c={request:o,attach:s},t[7]=o,t[8]=s,t[9]=c):c=t[9],c}var tZ=so(e=>Br({}).pipe(Ma));function nZ(e,t){let n=(0,$.c)(7),r=`${e}:${t}`,i;n[0]===r?i=n[1]:(i=tZ(r),n[0]=r,n[1]=i);let a=i,o=Aa(a),s=Rr(a),c;n[2]===o?c=n[3]:(c=(e,t)=>o(n=>({...n,[e]:t})),n[2]=o,n[3]=c);let l;return n[4]!==s||n[5]!==c?(l={steps:s,choose:c},n[4]=s,n[5]=c,n[6]=l):l=n[6],l}function rZ(e){let t=(0,$.c)(18),{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}=RX(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=aZ(x),t[2]=x,t[3]=S);let C=Rr(S),w=C.cancel,T=[r!=null&&(iq(r)??null)!==null?r:void 0,i!=null&&(iq(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=oZ({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],ao(E);let D=e=>{let t=g[e];return t===void 0?T[e]:t??void 0},O=[dq(f?.[0]??uq()),...f?.slice(1)??[]],k=[D(0)??(f==null?o??`handoff`:pq(O[0]??uq()).at(-1)??null),D(1)??(D(0)!==void 0||O[1]===null||O[1]===void 0?null:pq(O[1]).at(-1)??null)],A=[mq(O[0]??uq(),k[0]??``,y[0])];(k[0]===null||k[0]===void 0)&&(A[0]=O[0]??uq()),k[1]!==null&&k[1]!==void 0&&(A[1]=mq(O[1]??uq(),k[1],y[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)}ao(sZ({worktreeId:n,panes:A,ready:l}));let M;t[11]===n?M=t[12]:(M=IX(n),t[11]=n,t[12]=M);let N=Rr(M),P=k[s]??null;ao(cZ({worktreeId:n,panes:A,active:P,ready:l}));let F=Eq(N,A,P).flatMap(iZ),I;t[13]!==w||t[14]!==a?(I=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[13]=w,t[14]=a,t[15]=I):I=t[15];let L=I,R;t[16]===L?R=t[17]:(R=(e,t)=>L(e===0?{entry:t}:{side:t}),t[16]=L,t[17]=R);let z=R,B=(e,t)=>A.map((n,r)=>r===e?t:n),V=(e,t,n)=>{if(w(),j&&t.tabs.length===0){let t=+(e===0);m([A[t]??uq()]),c(0),L({entry:k[t],side:null});return}m(B(e,t)),n!==k[e]&&z(e,n)};return{recentFiles:F,bindQuickOpen:C.bindQuickOpen,focusDestination:C.schedule,hasDestinationFocus(){return C.current()!==null},selectPane(e){w(),c(e)},focusPane(e,t){if(d||C.restoringQuickOpen&&t.getAttribute(`role`)===`tab`)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:pq(e),pinned:e.pinned,active:k[t]??null})),activate(e,t){c(e),z(e,t)},open(e,t){let n=fq(A,e,t);return z(n,t),C.request({pane:n,key:t}),c(n),n},closePane(e){j&&V(e,uq(),null)},close(e,t){let n=A[e]??uq(),r=hq(n,t);V(e,r,t===k[e]?yq(n,t,r):k[e])},closeOthers(e,t){V(e,gq(A[e]??uq(),t),t)},closeUnpinned(e){let t=_q(A[e]??uq()),n=k[e];V(e,t,n!=null&&t.tabs.includes(n)?n:pq(t)[0]??null)},togglePin(e,t){m(B(e,vq(A[e]??uq(),t)))},openToSide(e,t){let n=+(e===0),r=[...A];r[n]=mq(A[n]??uq(),t,k[n]),m(r),z(n,t),C.request({pane:n,key:t}),c(n)},step(e,t){w();let n=pq(A[e]??uq());if(n.length===0)return;let r=k[e]===null||k[e]===void 0?-1:n.indexOf(k[e]);z(e,n[(r+t+n.length)%n.length]??null)}}}function iZ(e){let t=iq(e);return t?.kind===`file`?[t.path]:[]}var aZ=so(e=>Br(e=>{let t=[null,null],n=null,r=!1,i=null,a,o=null,s=()=>{o!==null&&cancelAnimationFrame(o),o=null},c=()=>{i=null,r=!1,s()},l=()=>i&&a&&(a.focused!==i.pane||a.actives[i.pane]!==i.key||!a.panes[i.pane]?.tabs.includes(i.key))?null:i,u=()=>{i&&o===null&&(o=requestAnimationFrame(()=>{o=null;let e=l();if(!e||a?.focusBoundary?.isConnected||n?.isConnected)return;let s=[...t[e.pane]?.querySelectorAll(`[role="tab"]`)??[]].find(t=>t.dataset.entry===e.key);s?.isConnected&&(s.focus(),s.ownerDocument.activeElement===s&&i===e&&(i=null,r=!1))}))};return e.addFinalizer(c),{get destination(){return i},get restoringQuickOpen(){return r},current:l,cancel:c,schedule:u,bindQuickOpen:e=>{n=e,e===null&&u()},request(e){i=e,r=n?.isConnected===!0},bind(e,n,r){if(s(),a=r,t[e]=n,l(),n)return u(),()=>{t[e]===n&&(t[e]=null),s()}}}})),oZ=so(({ready:e,entry:t,side:n,onSearch:r,fallback:i,saved:a})=>Br(()=>{e&&(t!==void 0&&iq(t)===null&&r({entry:void 0},{replace:!0}),n!==void 0&&iq(n)===null&&r({side:void 0},{replace:!0}),!a&&t===void 0&&n===void 0&&i!==null&&r({entry:i},{replace:!0}))})),sZ=so(({worktreeId:e,panes:t,ready:n})=>Br(r=>{if(!n)return;let i=FX(e),a=r.once(i);a.saved&&JSON.stringify(a.panes)===JSON.stringify(t)&&(t.length>1||a.focused===0)||r.set(i,{...a,panes:t,saved:!0,focused:t.length>1?a.focused:0})})),cZ=so(({worktreeId:e,panes:t,active:n,ready:r})=>Br(i=>{if(!r)return;let a=IX(e),o=i.once(a),s=Eq(o,t,n);o.length===s.length&&o.every((e,t)=>e===s[t])||i.set(a,s)}));function lZ(e,t){return{onActivate:n=>e.activate(t,n),onClose:n=>e.close(t,n),onCloseOthers:n=>e.closeOthers(t,n),onCloseUnpinned:()=>e.closeUnpinned(t),onTogglePin:n=>e.togglePin(t,n),onOpenToSide:n=>e.openToSide(t,n),onClosePane:e.split?()=>e.closePane(t):void 0}}var uZ=so(e=>Nc(e).pipe(Yr,Ua(0)));function dZ(e,t){let n=(0,$.c)(9),r;n[0]!==t.connection||n[1]!==e?(r=uZ({scope:e,connection:t.connection}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i=r,a=Rr(i),o;n[3]===a?o=n[4]:(o=Ts(Te(a)),n[3]=a,n[4]=o);let s=yr(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 fZ=Br(ea()),pZ=Br(ea());function mZ(e){let t=(0,$.c)(15),{scope:n,context:r,review:i,reviewTitle:a}=e,o=rP(n,r.connection),s=JX(i?.reviewId??``),c=zs(r.connection),l;t[0]!==r.connection||t[1]!==i||t[2]!==s?(l=i?.reviewId?k({connection:r.connection,reviewId:i.reviewId,...s.revision===void 0?{}:{revision:s.revision}}):fZ,t[0]=r.connection,t[1]=i,t[2]=s,t[3]=l):l=t[3];let u=Rr(l),d;t[4]!==r.connection||t[5]!==i?(d=i?.reviewId?nn({connection:r.connection,reviewId:i.reviewId}):pZ,t[4]=r.connection,t[5]=i,t[6]=d):d=t[6];let f=Rr(d);if(!i?.reviewId){let e;if(t[7]!==o||t[8]!==a){let n=Ts(Te(o))?.changes.length??0;e=a?void 0:Tq(n),t[7]=o,t[8]=a,t[9]=e}else e=t[9];return e}let p;if(t[10]!==u||t[11]!==f||t[12]!==i||t[13]!==c){let e=Ts(Te(u))?.revision,n=Ts(Te(f));p=wq(e?dm(e,n,{specsApart:c}).reviewed:0,e?.content.layers.length??i.layers.length),t[10]=u,t[11]=f,t[12]=i,t[13]=c,t[14]=p}else p=t[14];return p}function hZ(e){let t=e?.closest(`[data-tab-viewport]`);if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.left<r.left?n.left-r.left:Math.max(0,n.right-r.right);t.scrollBy({left:i})}function gZ(e,t,n){let r=iq(e);switch(r?.kind){case`handoff`:{let e=t??`Changes`;return{Icon:t?Wf:of,title:e,hint:n?`${e} · ${n.description}`:e}}case`all-changes`:return{Icon:of,title:`All changes`,hint:`Every changed file, including specs`};case`specs`:return{Icon:vf,title:`Specs`,hint:`Changed spec and test files`};case`change`:return{Icon:rf,title:Xn(r.path),accessibleName:r.path,hint:`${r.path} · changes`};case`file`:case`review-file`:case`review-change`:return{Icon:rf,title:Xn(r.path),accessibleName:r.path,hint:`${r.path} · file`};case`commit`:return{Icon:Af,title:GK(r.oid),hint:`Commit ${r.oid}`};case`branch`:return{Icon:Of,title:`Branch`,hint:`Every change on the branch`};case`branch-file`:return{Icon:rf,title:Xn(r.path),accessibleName:r.path,hint:`${r.path} · branch`};case`pull-request`:return{Icon:Rf,title:`PR #${r.number}`,hint:`Pull request #${r.number}`};case`graph`:return{Icon:Of,title:`Graph`,hint:`Commit graph of the checked-out branch`};case`timeline`:return{Icon:gp,title:`Timeline of ${Xn(r.path)}`,accessibleName:`Timeline of ${r.path}`,hint:`${r.path} · timeline`};default:return{Icon:ff,title:e,hint:e}}}function _Z(e){let t=(0,$.c)(49),n,r,i,a,o,s,c,l,u,d,f;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],d=t[10],f=t[11]):({tabs:d,pinned:c,active:r,reviewTitle:l,side:u,focused:o,leading:s,trailing:f,firstTabCount:a,commitContext:i,...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,t[10]=d,t[11]=f);let p=u!=null&&`gap-2`,m=u!=null&&o&&`bg-muted/40`,h;t[12]!==p||t[13]!==m?(h=X(`flex h-12 shrink-0 items-center gap-1.5 border-b px-2.5 text-[length:var(--text-ui)] leading-[1.4]`,p,m),t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===s?g=t[16]:(g=s!=null&&(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center`,children:s}),t[15]=s,t[16]=g);let _=u==null?`Open documents`:`Open documents, ${u} pane`,v;t[17]!==n||t[18]!==r||t[19]!==a||t[20]!==c||t[21]!==l||t[22]!==u||t[23]!==d?(v=d.includes(`handoff`)&&(0,Q.jsx)(`span`,{className:`flex shrink-0`,children:(0,Q.jsx)(bZ,{tabKey:`handoff`,count:a,active:r===`handoff`,pinned:!1,hasUnpinned:d.some(e=>e!==`handoff`&&!c.includes(e)),reviewTitle:l,side:u,...n})}),t[17]=n,t[18]=r,t[19]=a,t[20]=c,t[21]=l,t[22]=u,t[23]=d,t[24]=v):v=t[24];let y;t[25]!==n||t[26]!==r||t[27]!==i||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d?(y=d.filter(vZ).map((e,t)=>{let a=c.includes(e),o=a&&!c.includes(d[t+1]??``)&&t<d.length-1,s=iq(e),f={tabKey:e,count:void 0,active:e===r,pinned:a,hasUnpinned:d.some(e=>e!==`handoff`&&!c.includes(e)),reviewTitle:l,side:u,...n};return(0,Q.jsxs)(`span`,{className:`flex min-w-0 shrink-0 items-center`,children:[i&&s?.kind===`commit`?(0,Q.jsx)(xZ,{...f,commitContext:i,oid:s.oid}):(0,Q.jsx)(bZ,{...f}),o&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-4 w-px shrink-0 bg-border`})]},e)}),t[25]=n,t[26]=r,t[27]=i,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=y):y=t[32];let b;t[33]===y?b=t[34]:(b=(0,Q.jsx)(PF,{"data-tab-viewport":``,className:`size-full overflow-y-hidden`,ref:yZ,children:(0,Q.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center gap-1 px-1.5`,children:y})}),t[33]=y,t[34]=b);let x;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(WF,{orientation:`horizontal`,className:`absolute inset-x-0 bottom-0 data-horizontal:h-1.5`}),t[35]=x):x=t[35];let S;t[36]===b?S=t[37]:(S=(0,Q.jsxs)(SF,{className:`@container/tabs relative h-full min-w-0 flex-1`,children:[b,x]}),t[36]=b,t[37]=S);let C;t[38]!==S||t[39]!==_||t[40]!==v?(C=(0,Q.jsxs)(`div`,{role:`tablist`,"aria-label":_,className:`flex h-full min-w-0 flex-1 items-center gap-1`,children:[v,S]}),t[38]=S,t[39]=_,t[40]=v,t[41]=C):C=t[41];let w;t[42]===f?w=t[43]:(w=f!=null&&(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:f}),t[42]=f,t[43]=w);let T;return t[44]!==C||t[45]!==w||t[46]!==h||t[47]!==g?(T=(0,Q.jsxs)(`div`,{"data-pane-bar":``,className:h,children:[g,C,w]}),t[44]=C,t[45]=w,t[46]=h,t[47]=g,t[48]=T):T=t[48],T}function vZ(e){return e!==`handoff`}function yZ(e){if(!e)return;let t=()=>hZ(e.querySelector(`[role="tab"][aria-selected="true"]`)),n=0,r=new ResizeObserver(()=>{cancelAnimationFrame(n),n=requestAnimationFrame(t)});return r.observe(e),()=>{cancelAnimationFrame(n),r.disconnect()}}function bZ(e){let t=(0,$.c)(89),{tabKey:n,count:r,commitSubject:i,active:a,pinned:o,hasUnpinned:s,reviewTitle:c,side:l,onActivate:u,onClose:d,onCloseOthers:f,onCloseUnpinned:p,onTogglePin:m,onOpenToSide:h,onClosePane:g}=e,_;t[0]!==r||t[1]!==c||t[2]!==n?(_=gZ(n,c,r),t[0]=r,t[1]=c,t[2]=n,t[3]=_):_=t[3];let{Icon:v,title:y,hint:b,accessibleName:x}=_,S=x===void 0?y:x,C=(0,Z.useId)(),w=i?`${y} ${i}`:y,T=i?`${b} · ${i}`:b,[E,D]=(0,Z.useState)(!1),O;t[4]===l?O=t[5]:(O=Cq(l),t[4]=l,t[5]=O);let k=O,A;t[6]!==u||t[7]!==n?(A=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u(n))},t[6]=u,t[7]=n,t[8]=A):A=t[8];let j=A,M;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{e&&D(!1)},t[9]=M):M=t[9];let N;t[10]===n?N=t[11]:(N=X(`min-w-0 flex-1`,n.startsWith(`file:`)&&`italic`),t[10]=n,t[11]=N);let P=o?`${T} · pinned`:T,F;t[12]!==v||t[13]!==S||t[14]!==j||t[15]!==a||t[16]!==i||t[17]!==r||t[18]!==C||t[19]!==u||t[20]!==d||t[21]!==m||t[22]!==o||t[23]!==n||t[24]!==w||t[25]!==y?(F=e=>(0,Q.jsxs)(lI,{render:(0,Q.jsx)(`div`,{ref:e=>{a&&hZ(e)},role:`tab`,tabIndex:0,"aria-selected":a,"aria-label":i?w:S,"aria-describedby":r?C:void 0,"data-entry":n,className:X(`group flex h-7 min-w-0 max-w-[min(100cqw,calc(var(--spacing)*45))] cursor-default items-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors`,a?`bg-muted text-foreground ring-1 ring-border ring-inset`:`text-muted-foreground hover:bg-accent/50`,a&&n!==`handoff`&&!o&&`pr-0.5`),onClick:()=>u(n),onAuxClick:e=>{e.button===1&&!o&&n!==`handoff`&&(e.preventDefault(),d(n))},onKeyDown:e=>{e.target===e.currentTarget&&j(e)}}),children:[(0,Q.jsx)(v,{className:`size-3.5 shrink-0`,strokeWidth:n===`handoff`?1.75:void 0}),e,r&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-2xs leading-4 whitespace-nowrap text-muted-foreground tabular-nums`,children:r.value}),n!==`handoff`&&o&&(0,Q.jsxs)(dt,{disableHoverablePopup:!0,children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Y,{type:`button`,"aria-label":`Unpin ${y}`,onClick:e=>{e.stopPropagation(),m(n)},variant:`ghost`,size:`icon-xs`}),children:(0,Q.jsx)(op,{className:`size-3`})}),(0,Q.jsx)(Et,{children:`Unpin ${y}`})]}),n!==`handoff`&&a&&(0,Q.jsxs)(dt,{disableHoverablePopup:!0,children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Y,{type:`button`,"aria-label":`Close ${y}`,onClick:e=>{e.stopPropagation(),d(n)},variant:`ghost`,size:`icon-xs`,className:`mr-0.5`}),children:(0,Q.jsx)(Ht,{className:`size-3`})}),(0,Q.jsxs)(Et,{children:[`Close ${y}`,(0,Q.jsx)(gI,{children:Ks(cc.closeTab)})]})]})]}),t[12]=v,t[13]=S,t[14]=j,t[15]=a,t[16]=i,t[17]=r,t[18]=C,t[19]=u,t[20]=d,t[21]=m,t[22]=o,t[23]=n,t[24]=w,t[25]=y,t[26]=F):F=t[26];let I;t[27]!==N||t[28]!==P||t[29]!==F||t[30]!==w?(I=(0,Q.jsx)(fr,{className:N,text:P,disclose:`always`,renderTrigger:F,children:w}),t[27]=N,t[28]=P,t[29]=F,t[30]=w,t[31]=I):I=t[31];let L=!E,R=n===`handoff`,z;t[32]!==m||t[33]!==n?(z=()=>m(n),t[32]=m,t[33]=n,t[34]=z):z=t[34];let B;t[35]===o?B=t[36]:(B=o?(0,Q.jsx)(cp,{}):(0,Q.jsx)(op,{}),t[35]=o,t[36]=B);let V=o?`Unpin`:`Pin`,H;t[37]!==R||t[38]!==z||t[39]!==B||t[40]!==V?(H=(0,Q.jsxs)(fI,{disabled:R,onClick:z,children:[B,V]}),t[37]=R,t[38]=z,t[39]=B,t[40]=V,t[41]=H):H=t[41];let U=h===void 0,W;t[42]!==h||t[43]!==n?(W=()=>{(0,od.flushSync)(()=>D(!0)),h?.(n)},t[42]=h,t[43]=n,t[44]=W):W=t[44];let G;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(Gd,{}),t[45]=G):G=t[45];let K;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(mI,{children:Ks(cc.openToSide)}),t[46]=K):K=t[46];let ee;t[47]!==k||t[48]!==U||t[49]!==W?(ee=(0,Q.jsxs)(fI,{disabled:U,onClick:W,children:[G,k,K]}),t[47]=k,t[48]=U,t[49]=W,t[50]=ee):ee=t[50];let q;t[51]===g?q=t[52]:(q=g&&(0,Q.jsxs)(fI,{onClick:g,children:[(0,Q.jsx)(Gd,{}),`Close pane`]}),t[51]=g,t[52]=q);let te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(pI,{}),t[53]=te):te=t[53];let ne=n===`handoff`,re;t[54]!==d||t[55]!==n?(re=()=>d(n),t[54]=d,t[55]=n,t[56]=re):re=t[56];let ie;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Q.jsx)(Ht,{}),t[57]=ie):ie=t[57];let ae;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(mI,{children:Ks(cc.closeTab)}),t[58]=ae):ae=t[58];let oe;t[59]!==ne||t[60]!==re?(oe=(0,Q.jsxs)(fI,{disabled:ne,onClick:re,children:[ie,`Close`,ae]}),t[59]=ne,t[60]=re,t[61]=oe):oe=t[61];let se;t[62]!==f||t[63]!==n?(se=()=>f(n),t[62]=f,t[63]=n,t[64]=se):se=t[64];let ce;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Q.jsx)(Op,{}),t[65]=ce):ce=t[65];let le;t[66]===se?le=t[67]:(le=(0,Q.jsxs)(fI,{onClick:se,children:[ce,`Close others`]}),t[66]=se,t[67]=le);let ue=!s,de;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Q.jsx)(Xf,{}),t[68]=de):de=t[68];let fe;t[69]!==p||t[70]!==ue?(fe=(0,Q.jsxs)(fI,{disabled:ue,onClick:p,children:[de,`Close unpinned`]}),t[69]=p,t[70]=ue,t[71]=fe):fe=t[71];let pe;t[72]!==L||t[73]!==H||t[74]!==ee||t[75]!==q||t[76]!==oe||t[77]!==le||t[78]!==fe?(pe=(0,Q.jsxs)(uI,{className:`min-w-52`,finalFocus:L,children:[H,ee,q,te,oe,le,fe]}),t[72]=L,t[73]=H,t[74]=ee,t[75]=q,t[76]=oe,t[77]=le,t[78]=fe,t[79]=pe):pe=t[79];let J;t[80]!==pe||t[81]!==I?(J=(0,Q.jsxs)(cI,{onOpenChange:M,children:[I,pe]}),t[80]=pe,t[81]=I,t[82]=J):J=t[82];let me;t[83]!==r||t[84]!==C?(me=r&&(0,Q.jsx)(`span`,{id:C,hidden:!0,children:r.description}),t[83]=r,t[84]=C,t[85]=me):me=t[85];let he;return t[86]!==J||t[87]!==me?(he=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1`,children:[J,me]}),t[86]=J,t[87]=me,t[88]=he):he=t[88],he}function xZ(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({commitContext:n,oid:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=UJ({...n,oid:r,parent:1}),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o=Rr(a),s;t[7]===o?s=t[8]:(s=Ts(Te(o)),t[7]=o,t[8]=s);let c=s?.commit.subject,l;return t[9]!==c||t[10]!==i?(l=(0,Q.jsx)(bZ,{...i,commitSubject:c}),t[9]=c,t[10]=i,t[11]=l):l=t[11],l}function SZ(e){let t=(0,$.c)(13),{label:n,description:r,icon:i,shortcut:a,onClick:o,disabled:s,pressed:c,variant:l,iconOnly:u}=e,d=s!==void 0&&s,f=l===void 0?`ghost`:l,p=u!==void 0&&u,m;t[0]===p?m=t[1]:(m=p?[`compact`]:[`compact`,`key`,`full`],t[0]=p,t[1]=m);let h;return t[2]!==i||t[3]!==r||t[4]!==d||t[5]!==p||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==a||t[10]!==m||t[11]!==f?(h=(0,Q.jsx)(Q.Fragment,{children:m.map(e=>(0,Q.jsxs)(dt,{children:[(0,Q.jsxs)(De,{render:(0,Q.jsx)(Y,{variant:f,size:e===`compact`?`icon`:`default`,className:X(!p&&e===`compact`&&`@min-lg/pane:hidden`,e===`key`&&`hidden @min-lg/pane:inline-flex @min-3xl/pane:hidden`,e===`full`&&`hidden @min-3xl/pane:inline-flex`),"aria-label":n,"aria-keyshortcuts":a,"aria-pressed":c,disabled:d,focusableWhenDisabled:!0,onClick:o}),children:[c===!1?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-3.5 shrink-0 rounded-sm border-[--spacing(0.375)] border-border-strong bg-background`}):(0,Q.jsx)(i,{className:`size-3.5`}),e===`full`&&(0,Q.jsx)(`span`,{children:n}),a&&e!==`compact`&&(0,Q.jsx)(gI,{children:Ks(a)})]}),(0,Q.jsxs)(Et,{role:`tooltip`,children:[r??n,a&&(0,Q.jsx)(gI,{children:Ks(a)})]})]},e))}),t[2]=i,t[3]=r,t[4]=d,t[5]=p,t[6]=n,t[7]=o,t[8]=c,t[9]=a,t[10]=m,t[11]=f,t[12]=h):h=t[12],h}function CZ(e,t,n){let r=(0,$.c)(4),i=n===void 0?oe:n,a;return r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=ku({scope:e,connection:t.connection,range:i}),r[0]=t.connection,r[1]=i,r[2]=e,r[3]=a):a=r[3],su(a).value}function wZ(e,t,n){let r=(0,$.c)(4),i=n===void 0?oe:n,a;r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=ku({scope:e,connection:t.connection,range:i}),r[0]=t.connection,r[1]=i,r[2]=e,r[3]=a):a=r[3],ao(a)}function TZ(e,t,n,r){let i=(0,$.c)(4),a=CZ(e,t),o;return i[0]!==n||i[1]!==r||i[2]!==a?(o=ar(n,a,r),i[0]=n,i[1]=r,i[2]=a,i[3]=o):o=i[3],o}function EZ(e,t,n){(e[t]??=[]).push(n)}function DZ(e,t){let n={};return e.steps.forEach((r,i)=>{switch(r.location.state){case`committed`:case`broken`:return}let a=`${i+1}`;EZ(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 OZ(e){let t={};for(let n of e)for(let e of n.ranges)EZ(t,n.path,{title:`Not explained`,text:`${ON([e])} changed without an explanation from the agent.`,line:e.endLine,stale:!1,tone:`gap`});return t}function kZ(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n))for(let n of r)EZ(t,e,n);return t}function AZ(e){let t=(0,$.c)(13),{scope:n,context:r,base:i,children:a}=e,o=vP(n,r.connection,i);if(f(o.result)){let e;t[0]===o.result.cause?e=t[1]:(e=PN(ht(o.result.cause)),t[0]=o.result.cause,t[1]=e);let n;return t[2]!==o.refresh||t[3]!==e?(n=(0,Q.jsx)(v,{description:e,onRetry:o.refresh}),t[2]=o.refresh,t[3]=e,t[4]=n):n=t[4],n}if(!tt(o.result)){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(dn,{label:`Comparing the branch`}),t[5]=e):e=t[5],e}if(o.result.value.base===void 0){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(me,{title:`No default branch`,description:`Choose the branch this one is compared against in the Branch list.`}),t[6]=e):e=t[6],e}let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(dn,{label:`Comparing the branch`}),t[7]=s):s=t[7];let c;t[8]!==o.result.value||t[9]!==a?(c=a(o.result.value),t[8]=o.result.value,t[9]=a,t[10]=c):c=t[10];let l;return t[11]===c?l=t[12]:(l=(0,Q.jsx)(Z.Suspense,{fallback:s,children:c}),t[11]=c,t[12]=l),l}function jZ(e){return e?e.hunks.flatMap(e=>{let t=e.additionStart;return e.hunkContent.flatMap(e=>{if(e.type===`context`)return t+=e.lines,[];let n=t;return t+=e.additions,Array.from({length:e.additions},(e,t)=>`[data-code] [data-line="${n+t}"] { box-shadow: inset calc(var(--spacing) * 0.75) 0 var(--add-fg); }`)})}).join(`
|
|
1388
|
-
`):``}function MZ(e,t,n,r){return{id:e,kind:`file`,path:t,contents:n,version:nu(n),...r?{note:r}:{}}}var NZ=new Map,PZ=new Map;function FZ(e){if(e.kind===`diff`){let t=NZ.get(e.id);return t?.cacheKey!==void 0&&t.cacheKey===e.fileDiff.cacheKey?{type:`diff`,fileDiff:t}:(NZ.set(e.id,e.fileDiff),{type:`diff`,fileDiff:e.fileDiff})}let t=PZ.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 PZ.set(e.id,n),{type:`file`,file:n}}function IZ(e){let t=new Map;for(let n of e){let e=t.get(n.path)??{additions:0,deletions:0},r=LZ(n);e.additions+=r.additions,e.deletions+=r.deletions,t.set(n.path,e)}return t}function LZ(e){return e.kind===`file`?{additions:e.contents.split(`
|
|
1389
|
-
`).filter((e,t,n)=>t<n.length-1||e).length,deletions:0}:e.fileDiff.hunks.reduce((e,t)=>({additions:e.additions+t.additionLines,deletions:e.deletions+t.deletionLines}),{additions:0,deletions:0})}function RZ(e,t,n){let r=(0,$.c)(9),i=n===void 0?oe:n,a;r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=rl({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]=xa(o,s),u=Aa(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 zZ(e,t,n){let r=(0,$.c)(9),i=n===void 0?oe:n,a;r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=rl({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]=xa(o,s),u=Aa(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 BZ(e,t,n){let r=(0,$.c)(10),i=n===void 0?oe:n,a;r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=rl({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]=xa(a.bulk),c;r[4]===o?c=r[5]:(c=Ts(Te(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 VZ(e,t,n,r){let i=(0,$.c)(4),a=r===void 0?oe:r,o=RZ(e,t,a),c=zZ(e,t,a),l;return i[0]!==o||i[1]!==n||i[2]!==c?(l={toggle(e){let t=Pn(e,o.result.waiting||c.result.waiting);t&&(t.kind===`unmark`?c.submit(t.path):o.submit(t.input)).then(e=>{aa(e)&&n({title:`Could not update review`,description:s(ht(e.cause)),type:`error`})})}},i[0]=o,i[1]=n,i[2]=c,i[3]=l):l=i[3],l}function HZ(e){let t=(0,$.c)(7),{counts:n}=e,r;t[0]===n.deletions?r=t[1]:(r=(0,Q.jsxs)(`span`,{className:`text-del-fg`,children:[`−`,n.deletions]}),t[0]=n.deletions,t[1]=r);let i;t[2]===n.additions?i=t[3]:(i=(0,Q.jsxs)(`span`,{className:`text-add-fg`,children:[`+`,n.additions]}),t[2]=n.additions,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,Q.jsxs)(`span`,{className:`shrink-0 font-mono text-xs leading-4 font-medium tabular-nums`,children:[r,` `,i]}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function UZ(e,t,n){let r=(0,$.c)(7),i;r[0]!==t.connection||r[1]!==e||r[2]!==n?(i=e.review?Yo({reviewId:e.review.reviewId,connection:t.connection,...n?{worktree:n}:{}}):u({scope:e,connection:t.connection}),r[0]=t.connection,r[1]=e,r[2]=n,r[3]=i):i=r[3];let{result:a,value:o}=su(i),s;return r[4]!==a||r[5]!==o?(s={threads:o,result:a},r[4]=a,r[5]=o,r[6]=s):s=r[6],s}function WZ(e,t){let n=(0,$.c)(3),r;n[0]!==t.connection||n[1]!==e?(r=e.review?Yo({reviewId:e.review.reviewId,connection:t.connection}):u({scope:e,connection:t.connection}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2],ao(r)}var GZ=12;function KZ(e,t=GZ){let n=e.map(()=>0),r=-1/0;for(let i of e.map((e,t)=>t).toSorted((t,n)=>(e[t]?.top??0)-(e[n]?.top??0))){let a=e[i];if(!a)continue;let o=Math.max(0,r-a.top);n[i]=o,r=a.top+o+a.height+t}return n}function qZ(){let e=(0,$.c)(4),[t,n]=(0,Z.useState)(0),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>JZ(n),e[0]=r):r=e[0];let[i]=(0,Z.useState)(r),a;return e[1]!==i||e[2]!==t?(a={card:i,reserve:t},e[1]=i,e[2]=t,e[3]=a):a=e[3],a}function JZ(e){let t=new Set,n=0,r=()=>{cancelAnimationFrame(n),n=0;for(let e of t)e.style.translate=``;let r=[...t].filter(e=>{let t=e.isConnected&&getComputedStyle(e).position===`absolute`;return t||XZ(e,void 0),t}),i=r.map(e=>e.getBoundingClientRect()),a=KZ(i.map(e=>({top:e.top,height:e.height}))),o=0;r.forEach((e,t)=>{let n=a[t]??0;XZ(e,n),n>0&&(e.style.translate=`0 ${n}px`);let r=e.offsetParent?.getBoundingClientRect().bottom,s=(i[t]?.bottom??0)+n;r!==void 0&&(o=Math.max(o,s-r))}),e(Math.ceil(o))},i=()=>{n||=requestAnimationFrame(r)},a=new ResizeObserver(r);return r=>{if(r)return t.add(r),a.observe(r),r.offsetParent&&a.observe(r.offsetParent),i(),()=>{if(t.delete(r),a.unobserve(r),t.size>0)return i();a.disconnect(),cancelAnimationFrame(n),n=0,e(0)}}}function YZ(e){e.closest(`diffs-container`)?.shadowRoot?.querySelector(`[data-code] [data-selected-line]`)?.scrollIntoView({block:`center`,inline:`nearest`})}function XZ(e,t){[...e.children].forEach((e,n)=>{e instanceof HTMLElement&&(e.dataset.displaced=String(t!==void 0&&(t>0||n>0)))})}function ZZ(e,t){return{filePath:t,revision:e.headOid,comparison:{kind:`branch`,base:e.base}}}function QZ(e,t,n){return n?e.kind!==`change`&&e.filePath===t.filePath:Ho(e,t)}function $Z(e,t,n){return n!==void 0&&(n.kind===`file`&&e.kind===`codeRange`&&e.side===`deletions`||n.commentRevision!==n.revision||e.revision!==t.revision||e.comparison?.kind!==t.comparison?.kind||e.comparison?.kind===`branch`&&t.comparison?.kind===`branch`&&e.comparison.base!==t.comparison.base)||Si(e,t)}function eQ(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=xa(e,n),i;return t[1]===r?i=t[2]:(i=Fj(r),t[1]=r,t[2]=i),i}function tQ(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=ll({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],ao(a)}function nQ(e,t){let n=(0,$.c)(5),r;n[0]!==t.connection||n[1]!==e?(r=e.review?Ic({reviewId:e.review.reviewId,connection:t.connection}).createComment:Du({scope:e,connection:t.connection}).create,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i=eQ(r),a;return n[3]===i?a=n[4]:(a={...i,bodyLimit:sn},n[3]=i,n[4]=a),a}function rQ(e,t){let n=(0,$.c)(5),r;n[0]!==t.connection||n[1]!==e?(r=e.review?Ic({reviewId:e.review.reviewId,connection:t.connection}).reply:Du({scope:e,connection:t.connection}).reply,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i=eQ(r),a;return n[3]===i?a=n[4]:(a={...i,bodyLimit:sn},n[3]=i,n[4]=a),a}function iQ(e,t){let n=(0,$.c)(3),r;return n[0]!==t.connection||n[1]!==e?(r=e.review?Ic({reviewId:e.review.reviewId,connection:t.connection}).resolve:Du({scope:e,connection:t.connection}).resolve,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2],eQ(r)}function aQ(e,t){let n=(0,$.c)(5),r;n[0]!==t.connection||n[1]!==e?(r=e.review?Ic({reviewId:e.review.reviewId,connection:t.connection}).edit:Du({scope:e,connection:t.connection}).edit,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i=eQ(r),a;return n[3]===i?a=n[4]:(a={...i,bodyLimit:sn},n[3]=i,n[4]=a),a}function oQ(e,t){let n=(0,$.c)(3),r;return n[0]!==t.connection||n[1]!==e?(r=e.review?Ic({reviewId:e.review.reviewId,connection:t.connection}).deleteComment:Du({scope:e,connection:t.connection}).remove,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2],eQ(r)}function sQ(e,t){let n=(0,$.c)(9),r;n[0]!==t.connection||n[1]!==e?(r=Fu({scope:e,connection:t.connection}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let[i,a]=xa(r),o;n[3]===a?o=n[4]:(o=()=>a(Ca),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 cQ(e,t,n){e.nativeEvent.isComposing||t||((e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit()),e.key===`Escape`&&n&&(e.stopPropagation(),n()))}function lQ(e){let t=(0,$.c)(68),{scope:n,context:r,anchor:i,onClose:a,quote:o,questionId:c,variant:l,autoFocus:u,closable:d,inputRef:p}=e,m=l===void 0?`comment`:l,h=u===void 0||u,g=d===void 0||d,_=(0,Z.useId)(),v;t[0]!==i||t[1]!==r.connection.environmentId||t[2]!==c||t[3]!==o||t[4]!==n?(v=kX(OX(r.connection.environmentId,n,{kind:`create`,anchor:i,quote:o,questionId:c})),t[0]=i,t[1]=r.connection.environmentId,t[2]=c,t[3]=o,t[4]=n,t[5]=v):v=t[5];let[y,b]=xa(v),{body:x,pending:S}=y,C=nQ(n,r),w;t[6]!==x||t[7]!==o?(w=o===void 0?x:kr(o,x),t[6]=x,t[7]=o,t[8]=w):w=t[8];let T=w,E=S?.body===T?S.anchor:i,D=T.length-x.length,O;t[9]!==x||t[10]!==T?(O=Ai(x)&&Ai(T),t[9]=x,t[10]=T,t[11]=O):O=t[11];let k=O,j;t[12]!==C.result.waiting||t[13]!==a||t[14]!==b?(j=()=>{C.result.waiting||(b({body:``}),a())},t[12]=C.result.waiting,t[13]=a,t[14]=b,t[15]=j):j=t[15];let M=j,N;t[16]!==i||t[17]!==y||t[18]!==T||t[19]!==C||t[20]!==a||t[21]!==S||t[22]!==n||t[23]!==b||t[24]!==k?(N=e=>{if(!k||C.result.waiting)return;let t=A(S,T,()=>({body:T,anchor:i,threadId:crypto.randomUUID(),messageId:crypto.randomUUID(),...n.review?{reviewRevision:n.review.revision}:{}}));b({...y,pending:t}),C.send(t,()=>{b({body:``,pending:void 0}),e.isConnected&&a()})},t[16]=i,t[17]=y,t[18]=T,t[19]=C,t[20]=a,t[21]=S,t[22]=n,t[23]=b,t[24]=k,t[25]=N):N=t[25];let P=N,F=m===`answer`,I=Math.max(0,C.bodyLimit-D),L;t[26]===b?L=t[27]:(L=e=>{b({body:e.target.value,pending:void 0})},t[26]=b,t[27]=L);let R;t[28]!==M||t[29]!==g||t[30]!==C.result.waiting?(R=e=>{cQ(e,C.result.waiting,g?M:void 0)},t[28]=M,t[29]=g,t[30]=C.result.waiting,t[31]=R):R=t[31];let z;t[32]!==h||t[33]!==x||t[34]!==_||t[35]!==p||t[36]!==C.result.waiting||t[37]!==L||t[38]!==R||t[39]!==I?(z={id:_,ref:p,autoFocus:h,value:x,maxLength:I,disabled:C.result.waiting,onChange:L,onKeyDown:R},t[32]=h,t[33]=x,t[34]=_,t[35]=p,t[36]=C.result.waiting,t[37]=L,t[38]=R,t[39]=I,t[40]=z):z=t[40];let B=z,V=F?`flex flex-col gap-1.5 font-sans`:`m-3 flex flex-col gap-2 rounded-lg border bg-card p-3 font-sans`,H;t[41]===P?H=t[42]:(H=e=>{e.preventDefault(),P(e.currentTarget)},t[41]=P,t[42]=H);let U=F?`text-xs leading-4 font-medium text-muted-foreground`:`text-xs text-muted-foreground`,W;t[43]!==F||t[44]!==E?(W=F?`Answer the agent`:[Ha(E),di(E),E.kind===`change`&&E.revision!==null&&E.revision!==void 0?`at ${GK(E.revision)}`:void 0].filter(uQ).join(` · `),t[43]=F,t[44]=E,t[45]=W):W=t[45];let G;t[46]!==_||t[47]!==U||t[48]!==W?(G=(0,Q.jsx)(`label`,{htmlFor:_,className:U,children:W}),t[46]=_,t[47]=U,t[48]=W,t[49]=G):G=t[49];let K;t[50]!==F||t[51]!==B?(K=F?(0,Q.jsx)(yI,{...B,rows:4,placeholder:`Your answer…`}):(0,Q.jsx)(yI,{...B,"aria-label":`Comment`,placeholder:`Share feedback…`}),t[50]=F,t[51]=B,t[52]=K):K=t[52];let ee;t[53]===C.result?ee=t[54]:(ee=f(C.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:s(ht(C.result.cause))}),t[53]=C.result,t[54]=ee);let q;t[55]!==F||t[56]!==M||t[57]!==g||t[58]!==C.result.waiting||t[59]!==k?(q=F?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-xs leading-4 text-muted-foreground`,children:`via MCP`}),g&&(0,Q.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,className:`ml-auto`,disabled:C.result.waiting,onClick:M,children:`Cancel`}),(0,Q.jsxs)(Y,{type:`submit`,size:`sm`,className:X(!g&&`ml-auto`),disabled:!k||C.result.waiting,children:[(0,Q.jsx)(yd,{}),C.result.waiting?`Sending…`:`Send answer`]})]}):(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(Y,{type:`button`,size:`sm`,variant:`ghost`,disabled:C.result.waiting,onClick:M,children:`Cancel`}),(0,Q.jsx)(Y,{type:`submit`,size:`sm`,disabled:!k||C.result.waiting,children:C.result.waiting?`Posting…`:`Comment`})]}),t[55]=F,t[56]=M,t[57]=g,t[58]=C.result.waiting,t[59]=k,t[60]=q):q=t[60];let te;return t[61]!==V||t[62]!==H||t[63]!==G||t[64]!==K||t[65]!==ee||t[66]!==q?(te=(0,Q.jsxs)(`form`,{className:V,onSubmit:H,children:[G,K,ee,q]}),t[61]=V,t[62]=H,t[63]=G,t[64]=K,t[65]=ee,t[66]=q,t[67]=te):te=t[67],te}function uQ(e){return e!=null}function dQ(e){let t=(0,$.c)(32),{title:n,text:r,stale:i,marker:a,tone:o,compact:s}=e,c=i!==void 0&&i,l=o===void 0?`agent`:o,u=s!==void 0&&s,d=l===`gap`,f=u&&`[&_p]:my-0`,p;t[0]===f?p=t[1]:(p=X(`text-sm`,f),t[0]=f,t[1]=p);let m;t[2]!==p||t[3]!==r?(m=(0,Q.jsx)(Bj,{text:r,className:p}),t[2]=p,t[3]=r,t[4]=m):m=t[4];let h=m,g=`${d?`Not explained`:`Agent note`}${n?` · ${n}`:``}`,_=u?`mx-3 my-1 flex gap-2 border-l-2 border-brand-soft py-1 pl-3 font-sans`:`m-3 flex max-w-3xl gap-2.5 rounded-lg border bg-background px-3 py-2.5 font-sans shadow-xs`,v=d&&`border-graph-4/40 bg-graph-4/5`,y;t[5]!==_||t[6]!==v?(y=X(_,v),t[5]=_,t[6]=v,t[7]=y):y=t[7];let b=d&&`bg-graph-4/15 text-graph-4`,x;t[8]===b?x=t[9]:(x=X(`mt-px grid h-5 min-w-5 shrink-0 place-items-center rounded-full bg-brand-soft px-1 text-2xs font-semibold text-brand tabular-nums`,b),t[8]=b,t[9]=x);let S;t[10]!==d||t[11]!==a?(S=d?(0,Q.jsx)(Ul,{className:`size-3`}):a??`•`,t[10]=d,t[11]=a,t[12]=S):S=t[12];let C;t[13]!==x||t[14]!==S?(C=(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:x,children:S}),t[13]=x,t[14]=S,t[15]=C):C=t[15];let w;t[16]===n?w=t[17]:(w=n&&(0,Q.jsx)(`p`,{className:`text-caption font-medium`,children:n}),t[16]=n,t[17]=w);let T;t[18]===c?T=t[19]:(T=c&&(0,Q.jsx)(`p`,{role:`status`,className:`text-caption text-graph-4`,children:`Code changed since the review was written.`}),t[18]=c,t[19]=T);let E;t[20]!==h||t[21]!==r.length?(E=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`}),h]}):(0,Q.jsx)(`div`,{className:`text-muted-foreground`,children:h}),t[20]=h,t[21]=r.length,t[22]=E):E=t[22];let D;t[23]!==w||t[24]!==T||t[25]!==E?(D=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,T,E]}),t[23]=w,t[24]=T,t[25]=E,t[26]=D):D=t[26];let O;return t[27]!==y||t[28]!==C||t[29]!==D||t[30]!==g?(O=(0,Q.jsxs)(`aside`,{"aria-label":g,className:y,children:[C,D]}),t[27]=y,t[28]=C,t[29]=D,t[30]=g,t[31]=O):O=t[31],O}var fQ=Ea(`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 pQ({variant:e=`default`,align:t=`start`,className:n,...r}){return(0,Q.jsx)(`div`,{"data-slot":`bubble`,"data-variant":e,"data-align":t,className:X(fQ({variant:e}),n),...r})}function mQ({className:e,render:t,...n}){return co({defaultTagName:`div`,props:cn({className:X(`w-fit max-w-full min-w-0 overflow-hidden rounded-lg border border-transparent px-2.5 py-1.5 text-xs/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-2 [button,a]:focus-visible:ring-ring/30`,e)},n),render:t,state:{slot:`bubble-content`}})}Ea(`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-xs ring-2 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 hQ({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-group`,className:X(`flex min-w-0 flex-col gap-1.5`,e),...t})}function gQ({className:e,align:t=`start`,...n}){return(0,Q.jsx)(`div`,{"data-slot":`message`,"data-align":t,className:X(`group/message relative flex w-full min-w-0 gap-1.5 text-xs/relaxed data-[align=end]:flex-row-reverse`,e),...n})}function _Q({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-avatar`,className:X(`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 vQ({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-content`,className:X(`flex w-full min-w-0 flex-col gap-2 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end`,e),...t})}function yQ({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-header`,className:X(`flex max-w-full min-w-0 items-center px-2.5 text-[0.625rem] font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0`,e),...t})}var bQ={open:of,review:ir,comment:Qf,"open-to-side":Gd,"open-file":mf,timeline:gp,"copy-relative":He,discard:Ip,"expand-all":kd,"collapse-all":Dd,reply:mp,resolution:ir,reveal:mf};function xQ(e){let t=(0,$.c)(2),{action:n}=e,r=n.id===`resolution`&&n.label===`Reopen`?Ms:bQ[n.id],i;return t[0]===r?i=t[1]:(i=(0,Q.jsx)(r,{}),t[0]=r,t[1]=i),i}function SQ(e){let t=(0,$.c)(46),{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,od.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)(Y,{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)(Yd,{}),t[10]=v):v=t[10];let y;t[11]===_?y=t[12]:(y=(0,Q.jsx)(De,{render:(0,Q.jsx)(Pr,{render:_,children:v})}),t[11]=_,t[12]=y);let b;t[13]===r?b=t[14]:(b=(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:r}),t[13]=r,t[14]=b);let x;t[15]!==y||t[16]!==b?(x=(0,Q.jsxs)(dt,{children:[y,b]}),t[15]=y,t[16]=b,t[17]=x):x=t[17];let S=!c,C;if(t[18]!==d||t[19]!==n){let e;t[21]===d?e=t[22]:(e=e=>(0,Q.jsxs)(hr,{disabled:e.disabled,variant:e.destructive?`destructive`:`default`,onClick:()=>d(e.id),children:[(0,Q.jsx)(xQ,{action:e}),e.label]},e.id),t[21]=d,t[22]=e),C=n.map(e),t[18]=d,t[19]=n,t[20]=C}else C=t[20];let w;t[23]!==S||t[24]!==C?(w=(0,Q.jsx)(Ni,{align:`end`,finalFocus:S,children:C}),t[23]=S,t[24]=C,t[25]=w):w=t[25];let T;t[26]!==x||t[27]!==w||t[28]!==h?(T=(0,Q.jsxs)(Ja,{onOpenChange:p,children:[h,x,w]}),t[26]=x,t[27]=w,t[28]=h,t[29]=T):T=t[29];let E;t[30]!==o||t[31]!==T?(E=o(T),t[30]=o,t[31]=T,t[32]=E):E=t[32];let D;t[33]===E?D=t[34]:(D=(0,Q.jsx)(lI,{render:m,children:E}),t[33]=E,t[34]=D);let O=!c,k;if(t[35]!==d||t[36]!==n){let e;t[38]===d?e=t[39]:(e=e=>(0,Q.jsxs)(fI,{disabled:e.disabled,variant:e.destructive?`destructive`:`default`,onClick:()=>d(e.id),children:[(0,Q.jsx)(xQ,{action:e}),e.label]},e.id),t[38]=d,t[39]=e),k=n.map(e),t[35]=d,t[36]=n,t[37]=k}else k=t[37];let A;t[40]!==O||t[41]!==k?(A=(0,Q.jsx)(uI,{finalFocus:O,children:k}),t[40]=O,t[41]=k,t[42]=A):A=t[42];let j;return t[43]!==D||t[44]!==A?(j=(0,Q.jsxs)(cI,{onOpenChange:p,children:[D,A]}),t[43]=D,t[44]=A,t[45]=j):j=t[45],j}var CQ=e=>e==null?null:Xa(e);function wQ(e){let t=(0,$.c)(2),{author:n}=e,r=n===`agent`,i;return t[0]===r?i=t[1]:(i=(0,Q.jsx)(_Q,{children:r?(0,Q.jsx)(Ep,{className:`size-3.5`}):(0,Q.jsx)(Hp,{className:`size-3.5`})}),t[0]=r,t[1]=i),i}function TQ(e){let t=(0,$.c)(10),{thread:n}=e,r;t[0]===n?r=t[1]:(r=rn(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=X(`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)(Ep,{className:`size-3`}):(0,Q.jsx)(Hp,{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 EQ(e){let t=(0,$.c)(29),{owner:n,messageId:r,onEdit:i}=e,a=oQ(n.scope,n.context),o;t[0]===a.result.waiting?o=t[1]:(o=(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":`Comment actions`,disabled:a.result.waiting}),t[0]=a.result.waiting,t[1]=o);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(Yd,{}),t[2]=c):c=t[2];let l;t[3]===o?l=t[4]:(l=(0,Q.jsx)(De,{render:(0,Q.jsx)(Pr,{render:o,children:c})}),t[3]=o,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:`Comment actions`}),t[5]=u):u=t[5];let d;t[6]===l?d=t[7]:(d=(0,Q.jsxs)(dt,{children:[l,u]}),t[6]=l,t[7]=d);let p;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(C,{}),t[8]=p):p=t[8];let m;t[9]===i?m=t[10]:(m=(0,Q.jsxs)(hr,{onClick:i,children:[p,`Edit`]}),t[9]=i,t[10]=m);let h;t[11]!==r||t[12]!==n.threadId||t[13]!==a?(h=()=>a.send({threadId:n.threadId,messageId:r}),t[11]=r,t[12]=n.threadId,t[13]=a,t[14]=h):h=t[14];let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(Pp,{}),t[15]=g):g=t[15];let _;t[16]===h?_=t[17]:(_=(0,Q.jsxs)(hr,{variant:`destructive`,onClick:h,children:[g,`Delete`]}),t[16]=h,t[17]=_);let v;t[18]!==_||t[19]!==m?(v=(0,Q.jsxs)(Ni,{align:`end`,children:[m,_]}),t[18]=_,t[19]=m,t[20]=v):v=t[20];let y;t[21]!==v||t[22]!==d?(y=(0,Q.jsxs)(Ja,{children:[d,v]}),t[21]=v,t[22]=d,t[23]=y):y=t[23];let b;t[24]===a.result?b=t[25]:(b=f(a.result)&&(0,Q.jsx)(`span`,{role:`alert`,className:`font-normal text-destructive`,children:s(ht(a.result.cause))}),t[24]=a.result,t[25]=b);let x;return t[26]!==y||t[27]!==b?(x=(0,Q.jsxs)(Q.Fragment,{children:[y,b]}),t[26]=y,t[27]=b,t[28]=x):x=t[28],x}function DQ(e){let t=(0,$.c)(44),{owner:n,message:r,onDone:i}=e,a;t[0]!==r.id||t[1]!==n.context.connection.environmentId||t[2]!==n.scope||t[3]!==n.threadId?(a=jX(OX(n.context.connection.environmentId,n.scope,{kind:`edit`,threadId:n.threadId,messageId:r.id})),t[0]=r.id,t[1]=n.context.connection.environmentId,t[2]=n.scope,t[3]=n.threadId,t[4]=a):a=t[4];let[o,c]=xa(a),l=o??r.body,u;t[5]!==i||t[6]!==c?(u=()=>{c(void 0),i()},t[5]=i,t[6]=c,t[7]=u):u=t[7];let d=u,p=aQ(n.scope,n.context),m;t[8]===l?m=t[9]:(m=Ai(l),t[8]=l,t[9]=m);let h=m,g;t[10]!==l||t[11]!==p||t[12]!==d||t[13]!==r.id||t[14]!==n.threadId||t[15]!==h?(g=e=>{e.preventDefault(),h&&!p.result.waiting&&p.send({threadId:n.threadId,messageId:r.id,body:l},d)},t[10]=l,t[11]=p,t[12]=d,t[13]=r.id,t[14]=n.threadId,t[15]=h,t[16]=g):g=t[16];let _;t[17]===c?_=t[18]:(_=e=>c(e.target.value),t[17]=c,t[18]=_);let v;t[19]!==p.result.waiting||t[20]!==d?(v=e=>{cQ(e,p.result.waiting,d)},t[19]=p.result.waiting,t[20]=d,t[21]=v):v=t[21];let y;t[22]!==l||t[23]!==p.bodyLimit||t[24]!==p.result.waiting||t[25]!==_||t[26]!==v?(y=(0,Q.jsx)(yI,{autoFocus:!0,"aria-label":`Edit comment`,value:l,maxLength:p.bodyLimit,disabled:p.result.waiting,onChange:_,onKeyDown:v}),t[22]=l,t[23]=p.bodyLimit,t[24]=p.result.waiting,t[25]=_,t[26]=v,t[27]=y):y=t[27];let b;t[28]===p.result?b=t[29]:(b=f(p.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-2xs text-destructive`,children:s(ht(p.result.cause))}),t[28]=p.result,t[29]=b);let x;t[30]!==p.result.waiting||t[31]!==d?(x=(0,Q.jsx)(Y,{type:`button`,size:`sm`,variant:`ghost`,disabled:p.result.waiting,onClick:d,children:`Cancel`}),t[30]=p.result.waiting,t[31]=d,t[32]=x):x=t[32];let S=p.result.waiting||!h,C=p.result.waiting?`Saving…`:`Save`,w;t[33]!==S||t[34]!==C?(w=(0,Q.jsx)(Y,{type:`submit`,size:`sm`,disabled:S,children:C}),t[33]=S,t[34]=C,t[35]=w):w=t[35];let T;t[36]!==w||t[37]!==x?(T=(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[x,w]}),t[36]=w,t[37]=x,t[38]=T):T=t[38];let E;return t[39]!==T||t[40]!==g||t[41]!==y||t[42]!==b?(E=(0,Q.jsxs)(`form`,{className:`flex w-full flex-col gap-2`,onSubmit:g,children:[y,b,T]}),t[39]=T,t[40]=g,t[41]=y,t[42]=b,t[43]=E):E=t[43],E}function OQ(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=CQ(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)(wQ,{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)(EQ,{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)(yQ,{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)(DQ,{owner:r,message:n,onDone:()=>s(!1)}):(0,Q.jsx)(pQ,{variant:c?`tinted`:`muted`,align:c?`end`:`start`,className:a?`max-w-full`:`max-w-[85%]`,children:(0,Q.jsx)(mQ,{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)(vQ,{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)(gQ,{align:d,children:[f,y]}),t[28]=y,t[29]=d,t[30]=f,t[31]=b):b=t[31],b}function kQ(e){let t=(0,$.c)(45),{thread:n,scope:r,context:i,onReveal:a,location:o}=e,c={projectId:r.projectId,worktreeId:n.worktreeId,...n.review?{review:n.review}:{}},[l,u]=(0,Z.useState)(!1),[d,p]=(0,Z.useState)(!1),[m,h]=xa(AX(OX(i.connection.environmentId,c,{kind:`reply`,threadId:n.id}))),{body:g,pending:_}=m,v=rQ(c,i),y=iQ(c,i),b;t[0]===n?b=t[1]:(b=U(n),t[0]=n,t[1]=b);let x=b,S=a!=null,C={scope:c,context:i,threadId:n.id},w;t[2]!==S||t[3]!==o||t[4]!==a||t[5]!==n.anchor?(w=o??(S?(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)(fr,{text:Xn(n.anchor.filePath)}),(0,Q.jsx)(`span`,{className:`shrink-0 font-sans text-muted-foreground`,children:di(n.anchor)}),n.anchor.revision!==null&&n.anchor.revision!==void 0&&(0,Q.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`in `,GK(n.anchor.revision)]})]}):(0,Q.jsx)(`span`,{children:di(n.anchor)})),t[2]=S,t[3]=o,t[4]=a,t[5]=n.anchor,t[6]=w):w=t[6];let T=w,E;t[7]!==y||t[8]!==n.id||t[9]!==n.resolved?(E=()=>y.send({threadId:n.id,resolved:!n.resolved}),t[7]=y,t[8]=n.id,t[9]=n.resolved,t[10]=E):E=t[10];let D;t[11]===n.resolved?D=t[12]:(D=n.resolved?(0,Q.jsx)(Ms,{"data-icon":`inline-start`}):(0,Q.jsx)(ir,{"data-icon":`inline-start`}),t[11]=n.resolved,t[12]=D);let O=n.resolved?`Reopen`:`Resolve`,k;t[13]!==y.result.waiting||t[14]!==E||t[15]!==D||t[16]!==O?(k=(0,Q.jsxs)(Y,{type:`button`,size:`sm`,variant:`ghost`,disabled:y.result.waiting,onClick:E,children:[D,O]}),t[13]=y.result.waiting,t[14]=E,t[15]=D,t[16]=O,t[17]=k):k=t[17];let j=k,M;t[18]===y.result?M=t[19]:(M=f(y.result)&&(0,Q.jsx)(`span`,{role:`alert`,className:`max-w-64 text-2xs text-destructive`,children:s(ht(y.result.cause))}),t[18]=y.result,t[19]=M);let N;t[20]!==j||t[21]!==M?(N=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 flex-wrap items-center gap-1`,children:[j,M]}),t[20]=j,t[21]=M,t[22]=N):N=t[22];let P=N,F;t[23]!==g||t[24]!==_||t[25]!==v||t[26]!==l||t[27]!==h||t[28]!==u||t[29]!==n.id?(F=l&&(0,Q.jsx)(`form`,{className:`mt-3`,onSubmit:e=>{if(e.preventDefault(),!Ai(g)||v.result.waiting)return;let t=A(_,g,()=>({body:g,messageId:crypto.randomUUID()}));h({body:g,pending:t}),v.send({threadId:n.id,body:g,messageId:t.messageId},()=>{h({body:``}),u(!1)})},children:(0,Q.jsxs)(_o,{children:[(0,Q.jsxs)(zi,{children:[(0,Q.jsx)(Vr,{htmlFor:`reply-${n.id}`,children:`Reply`}),(0,Q.jsx)(yI,{id:`reply-${n.id}`,autoFocus:!0,value:g,maxLength:v.bodyLimit,required:!0,disabled:v.result.waiting,onChange:e=>{h({body:e.target.value})},onKeyDown:e=>{cQ(e,v.result.waiting,()=>u(!1))},placeholder:`Add a reply…`})]}),f(v.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-2xs text-destructive`,children:s(ht(v.result.cause))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(Y,{type:`submit`,size:`sm`,disabled:v.result.waiting||!Ai(g),children:v.result.waiting?`Replying…`:`Post reply`}),(0,Q.jsx)(Y,{type:`button`,size:`sm`,variant:`ghost`,disabled:v.result.waiting,onClick:()=>u(!1),children:`Cancel`})]})]})}),t[23]=g,t[24]=_,t[25]=v,t[26]=l,t[27]=h,t[28]=u,t[29]=n.id,t[30]=F):F=t[30];let L=F,R;t[31]!==a||t[32]!==y||t[33]!==u||t[34]!==n.id||t[35]!==n.resolved?(R=e=>{e===`reply`&&u(!0),e===`resolution`&&y.send({threadId:n.id,resolved:!n.resolved}),e===`reveal`&&a?.()},t[31]=a,t[32]=y,t[33]=u,t[34]=n.id,t[35]=n.resolved,t[36]=R):R=t[36];let z=R,B=y.result.waiting||v.result.waiting,V;t[37]!==S||t[38]!==B||t[39]!==n.resolved?(V=ft({kind:`thread`,resolved:n.resolved,pending:B,canReveal:S}),t[37]=S,t[38]=B,t[39]=n.resolved,t[40]=V):V=t[40];let H=e=>S&&!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)(TQ,{thread:n}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`·`}),T,e]}),!d&&n.messages.length>1&&(0,Q.jsxs)(Y,{type:`button`,onClick:()=>p(!0),variant:`ghost`,size:`sm`,className:`mb-2`,children:[`Show `,n.messages.length-1,` earlier`]}),(0,Q.jsx)(hQ,{children:(d?n.messages:n.messages.slice(-1)).map(e=>(0,Q.jsx)(OQ,{message:e,owner:C,wide:!0},e.id))}),L,!l&&(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-end gap-1 border-t pt-2`,children:[(0,Q.jsx)(We,{variant:x===`agent-replied`?`secondary`:`outline`,className:`mr-auto`,children:I(n)}),(0,Q.jsx)(Y,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>u(!0),children:`Reply`}),P]})]}):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)(ir,{className:`size-3.5 shrink-0 text-graph-2`}),o||S?T:(0,Q.jsx)(TQ,{thread:n}),e]}),(0,Q.jsx)(fr,{className:`min-w-0 flex-1`,text:n.messages[0]?.body??``}),P]}):(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)(TQ,{thread:n}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Q.jsx)(`span`,{className:`min-w-0 max-w-full`,children:T}),e,(0,Q.jsx)(We,{variant:x===`agent-replied`?`secondary`:`outline`,children:I(n)}),!l&&(0,Q.jsxs)(`div`,{className:`ml-auto flex gap-0.5`,children:[(0,Q.jsx)(Y,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>u(!0),children:`Reply`}),P]})]}),(0,Q.jsx)(hQ,{children:n.messages.map(e=>(0,Q.jsx)(OQ,{message:e,owner:C},e.id))}),L,x===`awaiting-agent`&&!l&&(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.`})]}),W;return t[41]!==z||t[42]!==V||t[43]!==H?(W=(0,Q.jsx)(SQ,{label:`Thread actions`,actions:V,onAction:z,children:H}),t[41]=z,t[42]=V,t[43]=H,t[44]=W):W=t[44],W}function AQ(e){let t=(0,$.c)(17),{anchor:n,onReveal:r}=e,i=`${n.side===`deletions`?`−`:``}${n.startLine}${n.endLine===n.startLine?``:`–${n.endLine}`}`,a=`${n.filePath}:${i}`,o;t[0]===n?o=t[1]:(o=di(n),t[0]=n,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,Q.jsx)(`span`,{className:`group-data-[displaced=true]/margin-thread:hidden`,children:o}),t[2]=o,t[3]=s);let c=`Show ${a} in the code`,l;t[4]!==a||t[5]!==r?(l=e=>(0,Q.jsx)(Y,{variant:`ghost`,size:`xs`,className:`hidden min-w-0 max-w-full shrink group-data-[displaced=true]/margin-thread:inline-flex`,"aria-label":`Show ${a} in the code`,onClick:e=>r(e.currentTarget),children:e}),t[4]=a,t[5]=r,t[6]=l):l=t[6];let u;t[7]===n.filePath?u=t[8]:(u=Xn(n.filePath),t[7]=n.filePath,t[8]=u);let d;t[9]!==i||t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Q.jsxs)(fr,{text:c,disclose:`always`,className:`font-mono`,renderTrigger:l,children:[u,`:`,i]}),t[9]=i,t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==s||t[15]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[s,d]}),t[14]=s,t[15]=d,t[16]=f):f=t[16],f}function jQ(e){let t=(0,$.c)(16),{threads:n,result:r}=UZ(e.scope,e.context),i=VZ(e.scope,e.context,MQ,e.range),a;t[0]===r?a=t[1]:(a=f(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.interaction.entry||t[3]!==e.range?(o=JSON.stringify([e.interaction.entry,e.range]),t[2]=e.interaction.entry,t[3]=e.range,t[4]=o):o=t[4];let s;t[5]!==e.onReview||t[6]!==i?(s=e.onReview??(e=>i.toggle(e.review)),t[5]=e.onReview,t[6]=i,t[7]=s):s=t[7];let c;t[8]!==e||t[9]!==o||t[10]!==s||t[11]!==n?(c=(0,Q.jsx)(NQ,{...e,threads:n,onToggleReviewed:s},o),t[8]=e,t[9]=o,t[10]=s,t[11]=n,t[12]=c):c=t[12];let l;return t[13]!==a||t[14]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[a,c]}),t[13]=a,t[14]=c,t[15]=l):l=t[15],l}function MQ(e){return xc.add(e)}function NQ(e){let t=(0,$.c)(119),{entries:n,scope:r,context:i,interaction:a,header:o,footer:s,headerLeading:c,headerActions:l,emptyActions:u,toolbar:d,threads:f,commentRequest:p,foundLine:m,disableFileHeader:h,fileDiff:g,compactThreads:_,fullHeight:v,collapsible:y,threadMargin:b,decision:x,column:S,framed:C,commentLabel:w,range:T,onToggleReviewed:E}=e,D=h!==void 0&&h,O=_!==void 0&&_,k=v!==void 0&&v,A=y!==void 0&&y,j=b!==void 0&&b,M=x!==void 0&&x,N=S!==void 0&&S,P=C!==void 0&&C,{dark:F}=Zs(),I;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(I=new Set,t[0]=I):I=t[0];let[L,R]=(0,Z.useState)(I),{preferences:z}=Hc(),B=zs(i.connection),V=M?n:Gp(n,B),H=zX(a.worktreeId,a.entry),U;t[1]!==i.connection.environmentId||t[2]!==a.entry||t[3]!==a.worktreeId||t[4]!==T?(U=JSON.stringify([i.connection.environmentId,a.worktreeId,a.entry,T]),t[1]=i.connection.environmentId,t[2]=a.entry,t[3]=a.worktreeId,t[4]=T,t[5]=U):U=t[5];let W=KX(U),G=qZ(),[K,ee]=(0,Z.useState)(null),q;t[6]===W?q=t[7]:(q=()=>W.selection(),t[6]=W,t[7]=q);let[te,ne]=(0,Z.useState)(q),re=te?V.find(e=>e.id===te.lines.id):void 0,ie=te?.anchor&&re?.comment?$Z(te.anchor,re.comment):!1,ae=ie?null:te?.lines??null,oe=e=>{let t=e?V.find(t=>t.id===e.id):void 0,n=e?{lines:e,anchor:t?.comment?is(t.comment,e.range):null}:null;ne(n),W.rememberSelection(n)},se;t[8]===W?se=t[9]:(se=()=>W.focused(),t[8]=W,t[9]=se);let[ce,le]=(0,Z.useState)(se),ue;t[10]===W?ue=t[11]:(ue=e=>{le(e),W.rememberFocus(e)},t[10]=W,t[11]=ue);let de=ue,fe;t[12]===ce?fe=t[13]:(fe=e=>e.id===ce,t[12]=ce,t[13]=fe);let pe=Math.max(V.findIndex(fe),0),[J,he]=(0,Z.useState)(null),ge=new Set(V.filter(e=>K?.id!==e.id&&TX(H.folds,e.id,V.length>1&&e.review?.reviewed===!0||(A||V.length>1)&&B&&Wp(e.path))).map(GQ)),_e;t[14]!==ee||t[15]!==de?(_e=(e,t)=>{de(e.id),ee({id:e.id,anchor:t,focusRequested:!0})},t[14]=ee,t[15]=de,t[16]=_e):_e=t[16];let ve=_e,ye;t[17]!==ve||t[18]!==oe?(ye=e=>{e?.comment&&(ve(e,{...e.comment,kind:`file`}),oe(null))},t[17]=ve,t[18]=oe,t[19]=ye):ye=t[19];let be=ye,xe;t[20]!==ee||t[21]!==oe?(xe=()=>{ee(null),oe(null)},t[20]=ee,t[21]=oe,t[22]=xe):xe=t[22];let Se=xe,[Ce,we]=(0,Z.useState)();p!==void 0&&Ce!==p&&(we(p),be(V[0]));let[Te,Ee]=(0,Z.useState)(),[De,Oe]=(0,Z.useState)(),ke=a.reveal,Ae=ke&&V.find(e=>e.comment&&QZ(ke.anchor,e.comment,r.review!==void 0)),je=e=>{let t=V[e];t&&(de(t.id),W.scrollTo({type:`item`,id:t.id,align:`start`}))},Me=new Map(V.map(WQ)),Ne=V.map(e=>{let t=e.comment,n=[],i=new Map,a=t?f.filter(n=>QZ(n.anchor,t,r.review!==void 0)&&(n.anchor.comparison||V.find(e=>e.comment&&QZ(n.anchor,e.comment,r.review!==void 0))?.id===e.id)).map(n=>({thread:n,stale:$Z(n.anchor,t,r.review&&{revision:r.review.revision,commentRevision:n.review?.revision,kind:e.kind})})):[];for(let e of a){let t=e.thread.anchor,r=t.kind===`codeRange`&&!e.stale?t.endLine:0,a=t.kind===`codeRange`?t.side??`additions`:`additions`,o=r===0?e.thread.id:`${a}:${r}`,s=i.get(o);if(s)s.threads.push(e);else{let t={kind:`thread`,lineNumber:r,side:a,threads:[e]};i.set(o,t),n.push(t)}}for(let t of e.agentNotes??[])n.push({...t,kind:`agent`});K?.id===e.id&&n.push({kind:`composer`,anchor:K.anchor});let o=n.map(UQ);return{id:e.id,collapsed:ge.has(e.id),version:nu(JSON.stringify([e.version,ge.has(e.id),n])),annotations:o,...FZ(e)}}),Fe=V.filter(HQ),Ie=new Set(Fe.map(VQ)).size,Le=Fe[0]?.id,Re=new Map;for(let e of V)e.review&&!Re.has(e.review.path)&&Re.set(e.review.path,e.id);let ze=M||N||O||P?Jc:Su,Be=F?`dark`:`light`,Ve=z.lineOverflow,He=z.diffStyle,Ue=!D&&!k,We,Ge;t[23]===de?(We=t[24],Ge=t[25]):(We=(e,t)=>de(t.item.id),Ge=(e,t)=>de(t.item.id),t[23]=de,t[24]=We,t[25]=Ge);let Ke=(e,t)=>{let n=Me.get(t.item.id);if(!n?.comment)return;let r=is(n.comment,e);if(!r){he(`Select lines on one side of the comparison.`);return}he(null),ve(n,r),oe({id:n.id,range:e})},qe;t[26]===g?qe=t[27]:(qe=jZ(g),t[26]=g,t[27]=qe);let Je=`${O?`[data-line-annotation]:has([data-file-thread-marker]) { margin-left: 0; }`:``}${qe}${M||N||P?Zc:``}${N?du:``}${Sl}${nc}${j?Ds:``}${D?`[data-code] { padding-top: 0 !important; }`:Dc}${O?el:``}`,Ye;t[28]===N?Ye=t[29]:(Ye=N?{itemMetrics:{lineHeight:22,diffHeaderHeight:41}}:{},t[28]=N,t[29]=Ye);let Xe;t[30]===D?Xe=t[31]:(Xe=D?{itemMetrics:{paddingTop:0}}:{},t[30]=D,t[31]=Xe);let Ze=D?0:12,Qe=k||s?12:160,$e;t[32]!==Ze||t[33]!==Qe?($e={paddingTop:Ze,paddingBottom:Qe,gap:12},t[32]=Ze,t[33]=Qe,t[34]=$e):$e=t[34];let et;t[35]!==D||t[36]!==z.diffStyle||t[37]!==z.lineOverflow||t[38]!==ze||t[39]!==Be||t[40]!==Ue||t[41]!==We||t[42]!==Ge||t[43]!==Ke||t[44]!==Je||t[45]!==Ye||t[46]!==Xe||t[47]!==$e?(et={theme:ze,themeType:Be,overflow:Ve,diffStyle:He,diffIndicators:`classic`,hunkSeparators:`line-info`,stickyHeaders:Ue,disableFileHeader:D,enableLineSelection:!0,enableGutterUtility:!0,onLineClick:We,onLineNumberClick:Ge,onGutterUtilityClick:Ke,lineHoverHighlight:`number`,unsafeCSS:Je,...Ye,...Xe,layout:$e},t[35]=D,t[36]=z.diffStyle,t[37]=z.lineOverflow,t[38]=ze,t[39]=Be,t[40]=Ue,t[41]=We,t[42]=Ge,t[43]=Ke,t[44]=Je,t[45]=Ye,t[46]=Xe,t[47]=$e,t[48]=et):et=t[48];let tt=et,nt=V.length>0&&V.every(e=>ge.has(e.id)),rt;t[49]!==V||t[50]!==H?(rt=e=>H.setCollapsed(V.map(BQ),e),t[49]=V,t[50]=H,t[51]=rt):rt=t[51];let it=rt,at=e=>{de(e),H.setCollapsed([e],!ge.has(e))},ot;t[52]===nt?ot=t[53]:(ot=nt?(0,Q.jsx)(kd,{"aria-hidden":`true`,"data-icon":`inline-start`}):(0,Q.jsx)(Dd,{"aria-hidden":`true`,"data-icon":`inline-start`}),t[52]=nt,t[53]=ot);let st=ot,ct=nt?`Expand all files`:`Collapse all files`,lt;t[54]!==nt||t[55]!==it?(lt=()=>it(!nt),t[54]=nt,t[55]=it,t[56]=lt):lt=t[56];let ut;t[57]!==st||t[58]!==ct||t[59]!==lt?(ut=(0,Q.jsxs)(Y,{size:`sm`,variant:`ghost`,onClick:lt,children:[st,ct]}),t[57]=st,t[58]=ct,t[59]=lt,t[60]=ut):ut=t[60];let dt=ut,ft=V.length>1?dt:null,pt;t[61]!==a.entry||t[62]!==a.toolbarTarget?(pt=a.toolbarTarget!==void 0&&/^(file|review-file|review-change|change|branch):/.test(a.entry),t[61]=a.entry,t[62]=a.toolbarTarget,t[63]=pt):pt=t[63];let mt=pt,ht=V[pe]??V[0],gt;t[64]!==u||t[65]!==ht||t[66]!==l||t[67]!==E||t[68]!==be||t[69]!==mt?(gt=mt&&(ht?(0,Q.jsxs)(Q.Fragment,{children:[ht.review&&(0,Q.jsx)(SZ,{label:`Reviewed`,variant:`outline`,icon:ht?.review?.reviewed?ir:Ap,shortcut:cc.toggleReviewed,disabled:!ht?.review?.fingerprint,pressed:ht?.review?.reviewed,onClick:()=>{ht&&E(ht)}}),(0,Q.jsx)(SZ,{label:`Comment`,icon:Qf,shortcut:cc.commentOnFile,disabled:!ht?.comment,onClick:()=>be(ht)}),l]}):u??l),t[64]=u,t[65]=ht,t[66]=l,t[67]=E,t[68]=be,t[69]=mt,t[70]=gt):gt=t[70];let _t=gt,vt;t[71]!==ft||t[72]!==V||t[73]!==je||t[74]!==pe||t[75]!==H||t[76]!==o?(vt=o&&(()=>o({collapse:ft,current:V[pe]?.path,counts:IZ(V),open:e=>{let t=V.findIndex(t=>t.path===e),n=V[t];n&&H.setCollapsed([n.id],!1),je(t)}})),t[71]=ft,t[72]=V,t[73]=je,t[74]=pe,t[75]=H,t[76]=o,t[77]=vt):vt=t[77];let yt=vt,bt=K||ie?null:te?.anchor,xt=(M||N||O||P)&&`decision-code`,St=O&&`file-code`,Ct=P&&`commit-code`,wt;t[78]!==xt||t[79]!==St||t[80]!==Ct?(wt=X(`@container/code relative flex min-h-0 flex-1 flex-col`,xt,St,Ct),t[78]=xt,t[79]=St,t[80]=Ct,t[81]=wt):wt=t[81];let Tt;t[82]!==a.toolbarTarget||t[83]!==_t?(Tt=a.toolbarTarget&&_t&&(0,od.createPortal)(_t,a.toolbarTarget),t[82]=a.toolbarTarget,t[83]=_t,t[84]=Tt):Tt=t[84];let Et;t[85]!==V||t[86]!==je||t[87]!==pe||t[88]!==a.active||t[89]!==E||t[90]!==be?(Et=a.active&&V.length>0&&(0,Q.jsx)(JQ,{next:()=>je(Math.min(pe+1,V.length-1)),previous:()=>je(Math.max(pe-1,0)),comment:()=>be(V[pe]),review:()=>{let e=V[pe];e?.review&&E(e)}}),t[85]=V,t[86]=je,t[87]=pe,t[88]=a.active,t[89]=E,t[90]=be,t[91]=Et):Et=t[91];let Dt;t[92]!==i||t[93]!==J||t[94]!==r||t[95]!==bt||t[96]!==ie?(Dt=ie||J?(0,Q.jsx)(`p`,{role:`status`,className:`absolute bottom-3 left-3 z-10 rounded-lg border bg-popover p-2 text-xs`,children:ie?`Code changed since these lines were selected. Select lines again.`:J}):bt!=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)(Qf,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(fr,{className:`pointer-events-auto`,text:`${Xn(bt.filePath)} · ${di(bt)}`}),bt.kind===`codeRange`&&bt.comparison?.kind===`worktree`&&bt.side!==`deletions`&&(bt.comparison.scope===`staged`||bt.comparison.scope===`unstaged`)&&(0,Q.jsx)(`span`,{className:`pointer-events-auto`,children:(0,Q.jsx)(iJ,{scope:r,context:i,path:bt.filePath,hunk:{scope:bt.comparison.scope,startLine:bt.startLine,endLine:bt.endLine},variant:`compact`})})]}),t[92]=i,t[93]=J,t[94]=r,t[95]=bt,t[96]=ie,t[97]=Dt):Dt=t[97];let Ot;t[98]!==ft||t[99]!==N||t[100]!==d?(Ot=d?d(ft):!N&&ft&&(0,Q.jsx)(`div`,{className:`flex shrink-0 justify-end px-3`,children:ft}),t[98]=ft,t[99]=N,t[100]=d,t[101]=Ot):Ot=t[101];let kt;t[102]!==N||t[103]!==V.length||t[104]!==s||t[105]!==o||t[106]!==l||t[107]!==c||t[108]!==mt||t[109]!==yt?(kt=V.length===0&&(o||l||s)&&(0,Q.jsxs)(`div`,{className:X(`min-h-0 flex-1 overflow-auto`,N&&KQ),"data-testid":`empty-code-document`,children:[c&&(0,Q.jsx)(`div`,{className:`flex items-center gap-1 px-3.5 py-2`,children:c}),yt?.(),s?.(),!mt&&l&&(0,Q.jsx)(`div`,{className:`flex justify-end px-3.5 py-2`,children:(0,Q.jsx)(dJ,{children:l})})]}),t[102]=N,t[103]=V.length,t[104]=s,t[105]=o,t[106]=l,t[107]=c,t[108]=mt,t[109]=yt,t[110]=kt):kt=t[110];let At=V.length>0&&(0,Q.jsx)(pA,{ref:e=>{if(!e)return;let t=W.attach(e);if(ke&&Ae&&De!==ke.nonce&&ge.has(Ae.id))return H.setCollapsed([Ae.id],!1),t;let n=requestAnimationFrame(()=>{let t=W.position();e.scrollTo({type:`position`,position:t+(tt.stickyHeaders&&!tt.disableFileHeader?tt.itemMetrics?.diffHeaderHeight??Oc.diffHeaderHeight:0),behavior:`instant`});let n=V[0];if(m&&n&&Te!==m.nonce&&(oe({id:n.id,range:{start:m.line,end:m.line}}),e.scrollTo({type:`line`,id:n.id,lineNumber:m.line,align:`center`}),Ee(m.nonce)),ke&&Ae&&De!==ke.nonce){let t=ke.anchor,n=Ae.comment&&$Z(t,Ae.comment,r.review&&{revision:r.review.revision,commentRevision:f.find(e=>e.anchor===t)?.review?.revision,kind:Ae.kind});e.scrollTo(t.kind===`codeRange`&&!n?{type:`line`,id:Ae.id,lineNumber:t.startLine,...Ae.kind===`diff`?{side:t.side??`additions`}:{},align:`center`}:{type:`item`,id:Ae.id,align:`start`}),de(Ae.id),Oe(ke.nonce)}});return()=>{cancelAnimationFrame(n),t?.()}},items:Ne,onScroll:W.rememberPosition,selectedLines:ae,onSelectedLinesChange:e=>{K||(oe(e),e&&de(e.id))},renderAnnotation:(...e)=>{let[t,,n]=e,a=t.metadata;return a.kind===`agent`?(0,Q.jsx)(dQ,{compact:M,title:a.title,text:a.text,stale:a.stale,...a.marker?{marker:a.marker}:{},...a.tone?{tone:a.tone}:{}}):a.kind===`thread`&&a.threads.every(zQ)&&O&&n.type===`file`&&!L.has(`${n.id}:${a.lineNumber}`)?(0,Q.jsxs)(Y,{type:`button`,"data-file-thread-marker":``,"aria-expanded":!1,variant:`ghost`,className:`ml-3 w-[calc(100%-var(--spacing)*5.5)] justify-start`,onClick:()=>R(e=>new Set([...e,`${n.id}:${a.lineNumber}`])),children:[(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0 items-center`,children:[(0,Q.jsx)(`span`,{className:`grid size-4.5 place-items-center rounded-full bg-foreground text-background`,children:(0,Q.jsx)(Hp,{})}),a.threads.some(LQ)&&(0,Q.jsx)(`span`,{className:`-ml-1 grid size-4.5 place-items-center rounded-[--spacing(1)] border bg-card text-foreground`,children:(0,Q.jsx)(Cd,{})})]}),Kr(a.threads.length,`comment`),a.threads.some(FQ)&&` · Agent replied`,(0,Q.jsx)(Pe,{})]}):a.kind===`composer`?K?.id===n.id&&(0,Q.jsx)(lQ,{scope:r,context:i,anchor:K.anchor,inputRef:e=>{e&&K.focusRequested&&(e.focus(),ee(e=>e===K?{...e,focusRequested:!1}:e))},onClose:Se},JSON.stringify(K.anchor)):(0,Q.jsxs)(`div`,{...j&&a.lineNumber>0?{ref:G.card}:{},className:X(`m-3 flex flex-col gap-3 font-sans`,j&&a.lineNumber>0&&`@5xl/review:absolute @5xl/review:left-full @5xl/review:z-10 @5xl/review:my-0 @5xl/review:mr-0 @5xl/review:ml-7 @5xl/review:w-51`),children:[O&&n.type===`file`&&L.has(`${n.id}:${a.lineNumber}`)&&(0,Q.jsxs)(Y,{type:`button`,"aria-expanded":!0,variant:`link`,size:`sm`,className:`self-start`,onClick:()=>R(e=>new Set([...e].filter(e=>e!==`${n.id}:${a.lineNumber}`))),children:[`Collapse comments on line `,a.lineNumber]}),a.threads.map(e=>{let{thread:t,stale:o}=e;return(0,Q.jsxs)(`div`,{className:`group/margin-thread`,children:[o&&!t.review&&(0,Q.jsx)(`p`,{className:`mb-2 text-xs text-graph-4`,children:`Code changed since this comment`}),o&&t.review&&(0,Q.jsx)(me,{role:`status`,title:`Code changed since this comment`,description:`Written on r${t.review.revision}. Read the original code before acting on this thread.`,children:(0,Q.jsxs)(Va,{to:`/reviews/$reviewId/$revision`,params:{reviewId:t.review.reviewId,revision:String(t.review.revision)},search:PQ,className:X(Do({variant:`outline`,size:`xs`})),children:[`Open r`,t.review.revision]})}),(0,Q.jsx)(kQ,{scope:r,context:i,thread:t,...j&&a.lineNumber>0&&t.anchor.kind===`codeRange`?{location:(0,Q.jsx)(AQ,{anchor:t.anchor,onReveal:e=>{let r=t.anchor;if(r.kind!==`codeRange`)return;let i=n.type===`diff`?{side:r.side??`additions`}:{};(0,od.flushSync)(()=>{oe({id:n.id,range:{start:r.startLine,end:r.endLine,...i}}),de(n.id)}),YZ(e)}})}:{}})]},t.id)})]})},renderHeaderMetadata:e=>{let t=Me.get(e.id);if(D||!t)return null;let n=e.id===V[0]?.id,r=V.findIndex(t=>t.id===e.id),i=!mt&&n?l:null,a=M&&V.length>1?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(qQ,{label:`Previous file`,keys:cc.previousFile,disabled:r===0,onClick:()=>je(r-1),children:(0,Q.jsx)(Yn,{})}),(0,Q.jsx)(qQ,{label:`Next file`,keys:cc.nextFile,disabled:r===V.length-1,onClick:()=>je(r+1),children:(0,Q.jsx)(Hn,{})})]}):null,o=e.id===V[0]?.id?c:null,s=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,u=w?`${w} about ${t.path}`:`Comment on ${t.path} (${t.kind===`diff`?t.note??`diff`:`file`})`,d=M?(0,Q.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":u,onClick:()=>be(t),children:[(0,Q.jsx)(ep,{}),(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:w??`Comment`})]}):(0,Q.jsxs)(Y,{variant:`ghost`,size:`xs`,"aria-label":u,onClick:()=>be(t),children:[(0,Q.jsx)(Qf,{}),(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:w??`Comment`})]}),f=t.comment&&!mt&&!N?d:null;return N?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[s,t.comment&&d,(0,Q.jsx)(HZ,{counts:LZ(t)}),(0,Q.jsxs)(`span`,{className:`ml-1 flex h-4 items-center gap-2 border-l border-border-strong pl-2 text-muted-foreground`,children:[(0,Q.jsx)(YQ,{label:`Previous file`,icon:Yn,shortcut:cc.previousFile,onClick:()=>je(Math.max(V.findIndex(e=>e.id===t.id)-1,0))}),(0,Q.jsx)(YQ,{label:`Next file`,icon:Hn,shortcut:cc.nextFile,onClick:()=>je(Math.min(V.findIndex(e=>e.id===t.id)+1,V.length-1))})]})]}):!s&&!o&&!i&&!f&&!a?null:(0,Q.jsxs)(`div`,{className:`flex max-w-full flex-wrap items-center justify-end gap-1.5`,children:[s,o,M?(0,Q.jsxs)(Q.Fragment,{children:[i&&(0,Q.jsx)(dJ,{children:i}),f]}):(i||f)&&(0,Q.jsxs)(dJ,{children:[i,f]}),a&&(0,Q.jsx)(`span`,{className:`flex items-center max-narrow:hidden`,children:a})]})},disableWorkerPool:M||N||O||P,options:tt,...G.reserve>0?{style:{paddingBottom:G.reserve}}:{},className:X(k?`flex-none overflow-visible`:`min-h-0 flex-1 overflow-auto`,N&&KQ),...yt?{renderCodeViewHeader:yt}:{},...s?{renderCodeViewFooter:s}:{},renderHeaderPrefix:e=>{let t=Me.get(e.id);if(!t)return null;let n=ge.has(e.id),r=t.review,i=r&&!mt&&Re.get(r.path)===t.id?r.control:null;return(0,Q.jsxs)(`span`,{className:X(`flex items-center`,N?`gap-2`:`gap-1`),children:[!M&&B&&e.id===Le&&V.length>Fe.length&&(0,Q.jsxs)(`span`,{className:`mr-2 border-r pr-2 font-sans text-xs font-medium`,children:[`Specs · `,Kr(Ie,`file`)]}),(N||A||V.length>1)&&(0,Q.jsx)(YQ,{label:`${n?`Expand`:`Collapse`} ${t.path}`,icon:n?Pe:Hn,expanded:!n,onClick:()=>at(e.id)}),i]})},renderHeaderFilenameSuffix:e=>{let t=Me.get(e.id);return t&&t.note?(0,Q.jsx)(fr,{className:`ml-2 hidden max-w-48 font-sans text-xs text-muted-foreground @code-wide/code:block`,text:t.note}):null}}),jt;return t[111]!==wt||t[112]!==Tt||t[113]!==Et||t[114]!==Dt||t[115]!==Ot||t[116]!==kt||t[117]!==At?(jt=(0,Q.jsxs)(`div`,{role:`region`,"aria-label":`Code content`,className:wt,children:[Tt,Et,Dt,Ot,kt,At]}),t[111]=wt,t[112]=Tt,t[113]=Et,t[114]=Dt,t[115]=Ot,t[116]=kt,t[117]=At,t[118]=jt):jt=t[118],jt}function PQ(e){return{environment:e.environment,decision:void 0}}function FQ(e){let{thread:t}=e;return t.messages.some(IQ)}function IQ(e){return e.author===`agent`}function LQ(e){let{thread:t}=e;return t.messages.some(RQ)}function RQ(e){return e.author===`agent`}function zQ(e){let{stale:t}=e;return!t}function BQ(e){return e.id}function VQ(e){return e.path}function HQ(e){return Wp(e.path)}function UQ(e){if(e.kind===`agent`)return{lineNumber:e.stale?0:e.line,side:`additions`,metadata:e};if(e.kind===`thread`)return{lineNumber:e.lineNumber,side:e.side,metadata:e};let t=e.anchor;return t.kind===`codeRange`?{lineNumber:t.endLine,side:t.side??`additions`,metadata:e}:{lineNumber:0,side:`additions`,metadata:e}}function WQ(e){return[e.id,e]}function GQ(e){return e.id}var KQ=`px-[max(--spacing(4),calc((100%-var(--container-reading))/2))] @2xl/pane:px-[max(--spacing(7),calc((100%-var(--container-reading))/2))]`;function qQ(e){let t=(0,$.c)(17),{label:n,keys:r,disabled:i,onClick:a,children:o}=e,s;t[0]!==i||t[1]!==n||t[2]!==a?(s=(0,Q.jsx)(Y,{type:`button`,"aria-label":n,disabled:i,onClick:a,variant:`ghost`,size:`icon-sm`}),t[0]=i,t[1]=n,t[2]=a,t[3]=s):s=t[3];let c;t[4]!==o||t[5]!==s?(c=(0,Q.jsx)(De,{render:s,children:o}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=Ks(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(gI,{children:l}),t[9]=l,t[10]=u);let d;t[11]!==n||t[12]!==u?(d=(0,Q.jsxs)(Et,{children:[n,` `,u]}),t[11]=n,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==c||t[15]!==d?(f=(0,Q.jsxs)(dt,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function JQ(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 pc(cc.nextFile,n,s),pc(cc.previousFile,r,s),pc(cc.commentOnFile,i,s),pc(cc.toggleReviewed,a,s),null}function YQ(e){let t=(0,$.c)(18),{label:n,icon:r,shortcut:i,expanded:a,onClick:o}=e,s;t[0]!==a||t[1]!==n||t[2]!==o||t[3]!==i?(s=(0,Q.jsx)(Y,{size:`icon-xs`,variant:`ghost`,"aria-label":n,"aria-keyshortcuts":i,"aria-expanded":a,onClick:o}),t[0]=a,t[1]=n,t[2]=o,t[3]=i,t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=(0,Q.jsx)(r,{}),t[5]=r,t[6]=c);let l;t[7]!==s||t[8]!==c?(l=(0,Q.jsx)(De,{render:s,children:c}),t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===i?u=t[11]:(u=i&&(0,Q.jsx)(gI,{children:Ks(i)}),t[10]=i,t[11]=u);let d;t[12]!==n||t[13]!==u?(d=(0,Q.jsxs)(Et,{children:[n,u]}),t[12]=n,t[13]=u,t[14]=d):d=t[14];let f;return t[15]!==l||t[16]!==d?(f=(0,Q.jsxs)(dt,{children:[l,d]}),t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function XQ(e){let t=(0,$.c)(37),{target:n,barActions:r,title:i,titleLabel:a,subtitle:o,children:s,className:c}=e;if(n!==void 0){let e;t[0]!==r||t[1]!==s||t[2]!==n?(e=n&&(0,od.createPortal)(r===void 0?s:r,n),t[0]=r,t[1]=s,t[2]=n,t[3]=e):e=t[3];let c=a??(typeof i==`string`?i:``),l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(`h1`,{}),t[4]=l):l=t[4];let u;t[5]!==c||t[6]!==i?(u=(0,Q.jsx)(fr,{text:c,render:l,className:`text-ui font-semibold`,children:i}),t[5]=c,t[6]=i,t[7]=u):u=t[7];let d;t[8]===o?d=t[9]:(d=o&&(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:o}),t[8]=o,t[9]=d);let f;t[10]!==r||t[11]!==s?(f=r!==void 0&&(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:s}),t[10]=r,t[11]=s,t[12]=f):f=t[12];let p;t[13]!==u||t[14]!==d||t[15]!==f?(p=(0,Q.jsxs)(`div`,{className:`shrink-0 px-3.5 py-2`,children:[u,d,f]}),t[13]=u,t[14]=d,t[15]=f,t[16]=p):p=t[16];let m;return t[17]!==e||t[18]!==p?(m=(0,Q.jsxs)(Q.Fragment,{children:[e,p]}),t[17]=e,t[18]=p,t[19]=m):m=t[19],m}let l;t[20]===c?l=t[21]:(l=X(`flex min-h-11 shrink-0 flex-wrap items-center gap-x-2.5 gap-y-1 border-b px-3.5`,c),t[20]=c,t[21]=l);let u=a??(typeof i==`string`?i:``),d;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`h1`,{}),t[22]=d):d=t[22];let f;t[23]!==u||t[24]!==i?(f=(0,Q.jsx)(fr,{text:u,render:d,className:`text-ui leading-tight font-semibold`,children:i}),t[23]=u,t[24]=i,t[25]=f):f=t[25];let p;t[26]===o?p=t[27]:(p=o!=null&&(0,Q.jsx)(fr,{text:o,render:(0,Q.jsx)(`p`,{}),className:`text-2xs leading-tight text-muted-foreground`}),t[26]=o,t[27]=p);let m;t[28]!==f||t[29]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-auto flex-col`,children:[f,p]}),t[28]=f,t[29]=p,t[30]=m):m=t[30];let h;t[31]===s?h=t[32]:(h=(0,Q.jsx)(`div`,{className:`ml-auto flex max-w-full shrink-0 flex-wrap items-center justify-end gap-1.5`,children:s}),t[31]=s,t[32]=h);let g;return t[33]!==l||t[34]!==m||t[35]!==h?(g=(0,Q.jsxs)(`header`,{"data-testid":`document-toolbar`,className:l,children:[m,h]}),t[33]=l,t[34]=m,t[35]=h,t[36]=g):g=t[36],g}function ZQ(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)(Y,{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 QQ(e,t,n){return{path:n.path,fingerprint:n.fingerprint??null,reviewed:n.reviewStatus===`reviewed`,stale:n.reviewStatus===`stale`,control:(0,Q.jsx)($Q,{scope:e,context:t,path:n.path,fingerprint:n.fingerprint,status:n.reviewStatus,compact:!0},`review:${n.path}`)}}function $Q(e){let t=(0,$.c)(45),{scope:n,context:r,path:i,fingerprint:a,status:o,compact:c,range:l}=e,u=c!==void 0&&c,d=l===void 0?oe:l,f=RZ(n,r,d),p=zZ(n,r,d),m=f.result.waiting||p.result.waiting,h,g;if(t[0]!==u||t[1]!==a||t[2]!==f||t[3]!==i||t[4]!==m||t[5]!==o||t[6]!==p){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Dl(f.result,p.result);if(a==null){let e;t[9]===i?e=t[10]:(e=Fe([i]),t[9]=i,t[10]=e);let n;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)($d,{className:`size-3`,"aria-hidden":`true`}),t[11]=n):n=t[11];let r=u?`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],g=a;break bb0}let n=o===`reviewed`,r;t[15]!==i||t[16]!==o?(r=pe(i,o),t[15]=i,t[16]=o,t[17]=r):r=t[17];let c=r,l=u?`icon-xs`:`xs`,d=n?`ghost`:`outline`,_;t[18]!==a||t[19]!==f||t[20]!==i||t[21]!==n||t[22]!==p?(_=()=>{n?p.start(i):f.start({path:i,fingerprint:a})},t[18]=a,t[19]=f,t[20]=i,t[21]=n,t[22]=p,t[23]=_):_=t[23];let v;t[24]!==u||t[25]!==m||t[26]!==o?(v=(0,Q.jsx)(n$,{pending:m,status:o,compact:u}),t[24]=u,t[25]=m,t[26]=o,t[27]=v):v=t[27];let y;t[28]!==u||t[29]!==o?(y=!u&&r$(o),t[28]=u,t[29]=o,t[30]=y):y=t[30];let b;t[31]!==c||t[32]!==m||t[33]!==n||t[34]!==y||t[35]!==l||t[36]!==d||t[37]!==_||t[38]!==v?(b=(0,Q.jsx)(De,{render:(0,Q.jsxs)(Y,{type:`button`,size:l,variant:d,"aria-pressed":n,disabled:m,"aria-label":c,onClick:_,children:[v,y]})}),t[31]=c,t[32]=m,t[33]=n,t[34]=y,t[35]=l,t[36]=d,t[37]=_,t[38]=v,t[39]=b):b=t[39];let x;t[40]===c?x=t[41]:(x=(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:c}),t[40]=c,t[41]=x);let S;t[42]!==b||t[43]!==x?(S=(0,Q.jsxs)(dt,{children:[b,x]}),t[42]=b,t[43]=x,t[44]=S):S=t[44],h=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[S,e!==void 0&&(0,Q.jsx)(fr,{className:`max-w-52 text-2xs text-destructive`,render:(0,Q.jsx)(`span`,{role:`alert`}),text:s(e)})]})}t[0]=u,t[1]=a,t[2]=f,t[3]=i,t[4]=m,t[5]=o,t[6]=p,t[7]=h,t[8]=g}else h=t[7],g=t[8];return g===Symbol.for(`react.early_return_sentinel`)?h:g}function e$(e){let t=(0,$.c)(23),{scope:n,context:r,path:i,fingerprint:a,status:o,latest:c,onStart:l}=e,u=RZ(n,r,oe),d=zZ(n,r,oe),f=u.result.waiting||d.result.waiting,p=Dl(u.result,d.result),m=c?p:void 0,h=(0,Z.useId)(),g=o===`reviewed`,_=a!=null,v=o===`stale`?`Changed since reviewed`:`Toggle reviewed`,y;t[0]!==i||t[1]!==_||t[2]!==v?(y=_?v:Fe([i]),t[0]=i,t[1]=_,t[2]=v,t[3]=y):y=t[3];let b=y,x=`${i} reviewed`,S=m!==void 0,C=f||!_,w;t[4]!==f||t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==i||t[9]!==g||t[10]!==d?(w=()=>{f||a==null||(l(),g?d.start(i):u.start({path:i,fingerprint:a}))},t[4]=f,t[5]=a,t[6]=u,t[7]=l,t[8]=i,t[9]=g,t[10]=d,t[11]=w):w=t[11];let T;t[12]!==f||t[13]!==h||t[14]!==g||t[15]!==x||t[16]!==S||t[17]!==C||t[18]!==w?(T=(0,Q.jsx)(De,{render:(0,Q.jsx)(OJ,{checked:g,"aria-label":x,"aria-describedby":h,"aria-invalid":S,disabled:C,"aria-busy":f,onCheckedChange:w})}),t[12]=f,t[13]=h,t[14]=g,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T):T=t[19];let E;return t[20]!==b||t[21]!==h?(E=(0,Q.jsx)(`span`,{id:h,hidden:!0,children:b}),t[20]=b,t[21]=h,t[22]=E):E=t[22],(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(dt,{children:[T,(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:m===void 0?b:s(m)})]}),E,m!==void 0&&(0,Q.jsx)(`span`,{role:`alert`,className:`sr-only`,children:s(m)})]})}function t$(e){let t=(0,$.c)(44),{scope:n,context:r,entries:i,compact:a,range:o}=e,c=a!==void 0&&a,l=BZ(n,r,o===void 0?oe:o),u,d,p,m,h,g,_,v,y,b,x,S,C;if(t[0]!==l||t[1]!==c||t[2]!==i){m=_n(i);let e=l.result.waiting,n=m.blocked||e;g=`inline-flex min-w-0 flex-col items-end gap-1`,p=dt,d=De,u=Y,_=`button`,v=c?`icon-xs`:`xs`,y=`outline`,b=n,x=m.label,S=()=>{n||(m.unmarking?l.start({kind:`unmark`,paths:m.reviewedPaths}):l.start({kind:`mark`,entries:m.entries}))},C=(0,Q.jsx)(i$,{pending:e,unmarking:m.unmarking}),h=!c&&a$(e,m.unmarking,m.text),t[0]=l,t[1]=c,t[2]=i,t[3]=u,t[4]=d,t[5]=p,t[6]=m,t[7]=h,t[8]=g,t[9]=_,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C}else u=t[3],d=t[4],p=t[5],m=t[6],h=t[7],g=t[8],_=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15];let w;t[16]!==u||t[17]!==h||t[18]!==_||t[19]!==v||t[20]!==y||t[21]!==b||t[22]!==x||t[23]!==S||t[24]!==C?(w=(0,Q.jsxs)(u,{type:_,size:v,variant:y,disabled:b,"aria-label":x,onClick:S,children:[C,h]}),t[16]=u,t[17]=h,t[18]=_,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=S,t[24]=C,t[25]=w):w=t[25];let T;t[26]!==d||t[27]!==w?(T=(0,Q.jsx)(d,{render:w}),t[26]=d,t[27]=w,t[28]=T):T=t[28];let E;t[29]===m.label?E=t[30]:(E=(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:m.label}),t[29]=m.label,t[30]=E);let D;t[31]!==p||t[32]!==T||t[33]!==E?(D=(0,Q.jsxs)(p,{children:[T,E]}),t[31]=p,t[32]=T,t[33]=E,t[34]=D):D=t[34];let O;t[35]===l.report?O=t[36]:(O=l.report&&(0,Q.jsx)(o$,{report:l.report}),t[35]=l.report,t[36]=O);let k;t[37]===l.result?k=t[38]:(k=f(l.result)&&(0,Q.jsx)(`span`,{role:`alert`,className:`max-w-64 text-right text-2xs text-destructive`,children:s(ht(l.result.cause))}),t[37]=l.result,t[38]=k);let A;return t[39]!==g||t[40]!==D||t[41]!==O||t[42]!==k?(A=(0,Q.jsxs)(`span`,{className:g,children:[D,O,k]}),t[39]=g,t[40]=D,t[41]=O,t[42]=k,t[43]=A):A=t[43],A}function n$(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)(gn,{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)(ir,{}),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)(Ms,{}),t[2]=e):e=t[2],e}let a=i&&`invisible`,o;t[3]===a?o=t[4]:(o=X(a),t[3]=a,t[4]=o);let s;return t[5]===o?s=t[6]:(s=(0,Q.jsx)(ir,{className:o}),t[5]=o,t[6]=s),s}function r$(e){return e===`reviewed`?`Reviewed`:e===`stale`?`Review again`:`Mark reviewed`}function i$(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)(gn,{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)(Ms,{}),t[1]=e):e=t[1],e}let i;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(ir,{}),t[2]=i):i=t[2],i}function a$(e,t,n){return e?t?`Unmarking…`:`Marking…`:n}function o$(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=X(`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=w(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 s$(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(l$,{...e,path:void 0}),t[0]=e,t[1]=n),n}function c$(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)(l$,{...r,path:n}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function l$(e){let t=(0,$.c)(11),{scope:n,context:r,interaction:i,base:a,path:o,onOpen:s}=e,c;t[0]!==r||t[1]!==i||t[2]!==s||t[3]!==o||t[4]!==n?(c=e=>(0,Q.jsx)(u$,{scope:n,context:r,interaction:i,onOpen:s,branch:e,path:o}),t[0]=r,t[1]=i,t[2]=s,t[3]=o,t[4]=n,t[5]=c):c=t[5];let l;return t[6]!==a||t[7]!==r||t[8]!==n||t[9]!==c?(l=(0,Q.jsx)(AZ,{scope:n,context:r,base:a,children:c}),t[6]=a,t[7]=r,t[8]=n,t[9]=c,t[10]=l):l=t[10],l}function u$(e){let t=(0,$.c)(27),{scope:n,context:r,interaction:i,branch:a,path:o,onOpen:s}=e,c;t[0]===a?c=t[1]:(c=Ze(a),t[0]=a,t[1]=c);let l=c,u=CZ(n,r,l);if(a.base===null||a.base===void 0)return null;let d;t[2]!==a.files||t[3]!==u||t[4]!==o?(d=Un(a.files,u,o==null?void 0:[o]),t[2]=a.files,t[3]=u,t[4]=o,t[5]=d):d=t[5];let f=d;if(o!=null&&f.length===0){let e;t[6]===a.base.ref?e=t[7]:(e=KK(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)(me,{title:`Not changed on this branch`,description:n}),t[8]=n,t[9]=r),r}let p=o!=null,m=a.base.ref,h=a.head,g=a.mergeBaseOid??``,_=a.commits,v;t[10]===a?v=t[11]:(v=NN(a),t[10]=a,t[11]=v);let y;t[12]!==a.base.ref||t[13]!==a.commits||t[14]!==a.head||t[15]!==g||t[16]!==v?(y={base:m,head:h,mergeBaseOid:g,commits:_,diffRange:v},t[12]=a.base.ref,t[13]=a.commits,t[14]=a.head,t[15]=g,t[16]=v,t[17]=y):y=t[17];let b;return t[18]!==r||t[19]!==i||t[20]!==f||t[21]!==s||t[22]!==l||t[23]!==n||t[24]!==p||t[25]!==y?(b=(0,Q.jsx)(d$,{scope:n,context:r,interaction:i,onOpen:s,range:l,items:f,single:p,branch:y}),t[18]=r,t[19]=i,t[20]=f,t[21]=s,t[22]=l,t[23]=n,t[24]=p,t[25]=y,t[26]=b):b=t[26],b}function d$(e){let t=(0,$.c)(55),{scope:n,context:r,interaction:i,range:a,items:o,single:s,branch:c,onOpen:l}=e,{connection:u}=r,d=Ts(Te(rP(n,u))),f=JSON.stringify([c.base,c.head.branch]),[p,m]=xa(UX(JSON.stringify([u.environmentId,n.projectId,n.worktreeId,f]))),h=o.slice(0,p),g=bP(n,u,c.diffRange,h.map(HK)),_=JSON.stringify([c.diffRange,h.map(p$)]),[v,y]=(0,Z.useState)({version:``,comparison:f,patches:new Map});if(!g.pending&&!g.failed&&v.version!==_){let e;t[0]===g.patches?e=t[1]:(e=e=>{let t=g.patches.get(HK(e).join(`\0`));return t?[[e.fingerprint,t]]:[]},t[0]=g.patches,t[1]=e),y({version:_,comparison:f,patches:new Map(h.flatMap(e))})}let b=e=>g.patches.get(HK(e).join(`\0`))??(v.comparison===f?v.patches.get(e.fingerprint):void 0),x;t[2]!==r||t[3]!==a||t[4]!==n?(x=(e,t)=>(0,Q.jsx)($Q,{scope:n,context:r,path:e.path,fingerprint:e.fingerprint,status:e.reviewStatus,range:a,compact:t},`review:${e.path}`),t[2]=r,t[3]=a,t[4]=n,t[5]=x):x=t[5];let S=x,C;t[6]!==c.base||t[7]!==c.head.oid||t[8]!==S||t[9]!==b?(C=e=>{let t=lP(c.head.oid,e,b(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:S(e,!0)}}]},t[6]=c.base,t[7]=c.head.oid,t[8]=S,t[9]=b,t[10]=C):C=t[10];let w=h.flatMap(C),T=new Set(w.map(f$)),E=h.filter(e=>!T.has(e.path)),D=o.length-h.length,O=d?.changes.length??0,[k]=o,A;t[11]!==k||t[12]!==l||t[13]!==s?(A=s&&k?(0,Q.jsx)(SZ,{label:`Timeline`,iconOnly:!0,icon:gp,onClick:()=>l({kind:`timeline`,path:k.path})}):void 0,t[11]=k,t[12]=l,t[13]=s,t[14]=A):A=t[14];let j;t[15]===i.reveal?j=t[16]:(j=i.reveal?.compose?{commentRequest:i.reveal.nonce}:{},t[15]=i.reveal,t[16]=j);let M;t[17]!==r||t[18]!==S||t[19]!==k||t[20]!==i.toolbarTarget||t[21]!==o||t[22]!==a||t[23]!==n||t[24]!==s?(M=e=>s&&k?(0,Q.jsx)(XQ,{target:i.toolbarTarget,barActions:null,title:Xn(k.path),subtitle:`${k.path} · on the branch`,children:S(k,!1)}):(0,Q.jsxs)(XQ,{target:i.toolbarTarget,barActions:null,title:`Branch`,subtitle:`${Kr(o.length,`file`)} changed`,children:[e,(0,Q.jsx)(t$,{scope:n,context:r,entries:o,range:a})]}),t[17]=r,t[18]=S,t[19]=k,t[20]=i.toolbarTarget,t[21]=o,t[22]=a,t[23]=n,t[24]=s,t[25]=M):M=t[25];let N;t[26]!==c||t[27]!==S||t[28]!==g.failed||t[29]!==g.retry||t[30]!==E||t[31]!==b||t[32]!==s||t[33]!==O?(N=()=>(0,Q.jsx)(m$,{branch:c,single:s,uncommitted:O,omitted:E,patchOf:b,failed:g.failed,onRetry:g.retry,control:e=>S(e,!0)}),t[26]=c,t[27]=S,t[28]=g.failed,t[29]=g.retry,t[30]=E,t[31]=b,t[32]=s,t[33]=O,t[34]=N):N=t[34];let P;t[35]!==r||t[36]!==w||t[37]!==i||t[38]!==a||t[39]!==n||t[40]!==A||t[41]!==j||t[42]!==M||t[43]!==N?(P=(0,Q.jsx)(jQ,{scope:n,context:r,interaction:i,range:a,headerActions:A,...j,entries:w,toolbar:M,header:N}),t[35]=r,t[36]=w,t[37]=i,t[38]=a,t[39]=n,t[40]=A,t[41]=j,t[42]=M,t[43]=N,t[44]=P):P=t[44];let F;t[45]!==m||t[46]!==p?(F=()=>m(p+25),t[45]=m,t[46]=p,t[47]=F):F=t[47];let I;t[48]!==g.pending||t[49]!==D||t[50]!==F?(I=(0,Q.jsx)(ZQ,{more:D,pending:g.pending,onReadMore:F}),t[48]=g.pending,t[49]=D,t[50]=F,t[51]=I):I=t[51];let L;return t[52]!==P||t[53]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[P,I]}),t[52]=P,t[53]=I,t[54]=L):L=t[54],L}function f$(e){return e.path}function p$(e){return e.fingerprint}function m$(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`:KK(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 `,KK(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.jsx)(`span`,{children:Kr(n.commits,`commit`)}),(0,Q.jsxs)(`span`,{children:[`from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:GK(n.mergeBaseOid)}),` `,`to `,(0,Q.jsx)(`span`,{className:`font-mono`,children:GK(n.head.oid)})]}),(0,Q.jsx)(We,{variant:`secondary`,children:KK(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)(Y,{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)(fr,{className:`font-mono font-medium`,text:e.path}),(0,Q.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.status,` ·`,` `,CM(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 h$=e=>HK(e).join(`\0`);function g$(e){let t=(0,$.c)(55),{scope:n,context:r,interaction:i,oid:a,onOpen:o}=e,{connection:s}=r,{reveal:c}=i,l=c?.anchor.comparison?.kind===`commit`?c.anchor.comparison.parent:1,u=c?.nonce,d;t[0]!==l||t[1]!==u?(d={nonce:u,parent:l},t[0]=l,t[1]=u,t[2]=d):d=t[2];let[f,p]=(0,Z.useState)(d),m=f.nonce===c?.nonce?f.parent:l,[,h]=(0,Z.useTransition)(),g=JJ(s,n,a,m),_;t[3]!==s||t[4]!==n?(_=qJ({connection:s,scope:n}),t[3]=s,t[4]=n,t[5]=_):_=t[5];let v=Ts(Te(Rr(_))),y=v?.snapshot?.head.kind===`attached`&&v.commits.some(e=>e.oid===a)?KK(v.snapshot.head.ref):void 0,b=`${a}:${m}`,x;t[6]===b?x=t[7]:(x={of:b,shown:25},t[6]=b,t[7]=x);let[S,C]=(0,Z.useState)(x),w=S.of===`${a}:${m}`?S.shown:25,T;t[8]!==a||t[9]!==m||t[10]!==w?(T=()=>C({of:`${a}:${m}`,shown:w+25}),t[8]=a,t[9]=m,t[10]=w,t[11]=T):T=t[11];let E=T,D=g.files.slice(0,w),O=SP(s,n,a,m,D.map(b$)),k;t[12]===O.patches?k=t[13]:(k=e=>O.patches.get(h$(e)),t[12]=O.patches,t[13]=k);let A=k,j;t[14]!==a||t[15]!==m||t[16]!==A?(j=e=>{let t=lP(a,e,A(e));return t==null?[]:[{...t,id:`${t.id}:${m}`,comment:{filePath:t.path,revision:a,comparison:{kind:`commit`,parent:m}}}]},t[14]=a,t[15]=m,t[16]=A,t[17]=j):j=t[17];let M=D.flatMap(j),N;t[18]!==a||t[19]!==A?(N=e=>(lP(a,e,A(e))??null)===null,t[18]=a,t[19]=A,t[20]=N):N=t[20];let P=D.filter(N),F=g.files.length-D.length,I;t[21]!==g.commit.subject||t[22]!==a?(I=g.commit.subject||`Commit ${GK(a)}`,t[21]=g.commit.subject,t[22]=a,t[23]=I):I=t[23];let L=I,R=new Map(M.map(y$));for(let e of D)A(e)?.kind===`metadata-only`&&R.set(UK(e),{added:0,removed:0});let z=F===0&&g.files.every(e=>{let t=A(e);return R.has(UK(e))||t?.kind===`binary`})?[...R.values()].reduce(v$,{added:0,removed:0}):void 0,B;t[24]===a?B=t[25]:(B=(0,Q.jsx)(SZ,{label:`Copy hash`,icon:He,onClick:()=>Yi(a,`commit id`)}),t[24]=a,t[25]=B);let V;t[26]===o?V=t[27]:(V=(0,Q.jsx)(SZ,{label:`Open in graph`,icon:Of,onClick:()=>o({kind:`graph`})}),t[26]=o,t[27]=V);let H;t[28]!==B||t[29]!==V?(H=(0,Q.jsxs)(Q.Fragment,{children:[B,V]}),t[28]=B,t[29]=V,t[30]=H):H=t[30];let U=H,W;t[31]!==U||t[32]!==y||t[33]!==g.commit||t[34]!==i.toolbarTarget||t[35]!==a||t[36]!==m||t[37]!==c?.nonce||t[38]!==h||t[39]!==L?(W=e=>(0,Q.jsxs)(`header`,{className:`mx-auto w-full max-w-commit px-7 pt-10`,children:[i.toolbarTarget?(0,od.createPortal)(U,i.toolbarTarget):(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:U}),(0,Q.jsxs)(`div`,{className:`flex min-h-5.5 min-w-0 flex-wrap items-center gap-x-2 text-ui leading-5.5 font-medium text-muted-foreground`,children:[(0,Q.jsx)(Af,{className:`size-3.5 shrink-0`}),(0,Q.jsxs)(`span`,{children:[`Commit`,` `,(0,Q.jsx)(fr,{text:a,disclose:`always`,className:`font-mono text-caption text-foreground`,children:GK(a)})]}),y&&(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[`on`,` `,(0,Q.jsx)(fr,{text:y,className:`font-mono text-caption font-normal`})]})]}),(0,Q.jsx)(fr,{text:L,render:(0,Q.jsx)(`h1`,{}),className:`mt-3 text-2xl leading-tight font-semibold tracking-tight`}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[g.commit.parentOids.length>1&&(0,Q.jsx)(Ae,{value:String(m),onValueChange:e=>h(()=>p({nonce:c?.nonce,parent:Number(e)})),children:(0,Q.jsx)(Rn,{children:g.commit.parentOids.map(_$)})}),(0,Q.jsx)(SZ,{label:`Copy message`,icon:He,onClick:()=>Yi(VK(g.commit),`commit message`)}),e]})]}),t[31]=U,t[32]=y,t[33]=g.commit,t[34]=i.toolbarTarget,t[35]=a,t[36]=m,t[37]=c?.nonce,t[38]=h,t[39]=L,t[40]=W):W=t[40];let G=()=>(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(x$,{commit:g,branch:y,counts:R,total:z,omitted:P,patchOf:A,failed:O.failed,onRetry:O.retry})}),K;t[41]!==r||t[42]!==M||t[43]!==i||t[44]!==n||t[45]!==W||t[46]!==G?(K=(0,Q.jsx)(jQ,{toolbar:W,framed:!0,scope:n,context:r,interaction:i,entries:M,header:G}),t[41]=r,t[42]=M,t[43]=i,t[44]=n,t[45]=W,t[46]=G,t[47]=K):K=t[47];let ee;t[48]!==O.pending||t[49]!==F||t[50]!==E?(ee=(0,Q.jsx)(ZQ,{more:F,pending:O.pending,onReadMore:E}),t[48]=O.pending,t[49]=F,t[50]=E,t[51]=ee):ee=t[51];let q;return t[52]!==K||t[53]!==ee?(q=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[K,ee]}),t[52]=K,t[53]=ee,t[54]=q):q=t[54],q}function _$(e,t){return(0,Q.jsxs)($n,{value:String(t+1),children:[LJ(t+1),` parent ·`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:GK(e)})]},e)}function v$(e,t){return{added:e.added+t.added,removed:e.removed+t.removed}}function y$(e){return[e.path,e.lineCounts]}function b$(e){return HK(e)}function x$(e){let t=(0,$.c)(67),{commit:n,omitted:r,patchOf:i,failed:a,onRetry:o,branch:s,counts:c,total:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-5 shrink-0 place-items-center rounded-sm border border-border-strong text-foreground`,children:(0,Q.jsx)(Bp,{className:`size-3`})}),t[0]=u):u=t[0];let d;t[1]===n.commit.author.name?d=t[2]:(d=(0,Q.jsx)(fr,{text:n.commit.author.name,className:`font-medium text-foreground`}),t[1]=n.commit.author.name,t[2]=d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t[3]=f):f=t[3];let p;t[4]===n.commit.author.timestamp?p=t[5]:(p=Xa(n.commit.author.timestamp),t[4]=n.commit.author.timestamp,t[5]=p);let m;t[6]===p?m=t[7]:(m=(0,Q.jsx)(`span`,{children:p}),t[6]=p,t[7]=m);let h;t[8]!==n.commit.parentOids||t[9]!==n.comparison.baseOid||t[10]!==n.comparison.kind||t[11]!==n.comparison.parentNumber?(h=n.comparison.kind===`parent`?(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`· `}),`parent`,` `,(0,Q.jsx)(`span`,{className:`font-mono text-caption leading-5 text-foreground`,children:GK(n.comparison.baseOid)}),n.commit.parentOids.length>1&&` (${LJ(n.comparison.parentNumber)} parent of a merge)`]}):(0,Q.jsx)(`span`,{children:`root commit`}),t[8]=n.commit.parentOids,t[9]=n.comparison.baseOid,t[10]=n.comparison.kind,t[11]=n.comparison.parentNumber,t[12]=h):h=t[12];let g;t[13]!==d||t[14]!==m||t[15]!==h?(g=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-ui leading-5 text-muted-foreground`,children:[u,d,f,m,h]}),t[13]=d,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;if(t[17]!==s||t[18]!==n.commit.refs){let e;t[20]===s?e=t[21]:(e=e=>e.kind!==`local-branch`||e.name!==s,t[20]=s,t[21]=e),_=qK(n.commit.refs).filter(e).map(S$),t[17]=s,t[18]=n.commit.refs,t[19]=_}else _=t[19];let v;t[22]===_?v=t[23]:(v=(0,Q.jsx)(`div`,{className:`mt-2 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-caption text-muted-foreground`,children:_}),t[22]=_,t[23]=v);let y;t[24]===n.commit.body?y=t[25]:(y=n.commit.body!==null&&n.commit.body!==void 0&&(0,Q.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap text-ui leading-relaxed wrap-anywhere text-muted-foreground`,children:n.commit.body}),t[24]=n.commit.body,t[25]=y);let b;t[26]!==n.commit.bodyTruncated||t[27]!==n.commit.subjectTruncated?(b=(n.commit.subjectTruncated||n.commit.bodyTruncated)&&(0,Q.jsx)(`p`,{className:`mt-1 text-caption text-muted-foreground`,children:`Commit message truncated`}),t[26]=n.commit.bodyTruncated,t[27]=n.commit.subjectTruncated,t[28]=b):b=t[28];let x;t[29]===n.files.length?x=t[30]:(x=Kr(n.files.length,`file`),t[29]=n.files.length,t[30]=x);let S;t[31]===x?S=t[32]:(S=(0,Q.jsxs)(`span`,{children:[x,` changed`]}),t[31]=x,t[32]=S);let C;t[33]===l?C=t[34]:(C=l&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`mx-2 font-normal text-muted-foreground`,children:`·`}),(0,Q.jsx)(E$,{count:l})]}),t[33]=l,t[34]=C);let w;t[35]!==n.files.length||t[36]!==a||t[37]!==l?(w=!l&&n.files.length>0&&(0,Q.jsx)(`span`,{className:`ml-2 font-normal text-muted-foreground`,children:a?`Line counts unavailable`:`Line counts incomplete`}),t[35]=n.files.length,t[36]=a,t[37]=l,t[38]=w):w=t[38];let T;t[39]!==S||t[40]!==C||t[41]!==w?(T=(0,Q.jsxs)(`p`,{className:`border-b pb-1.5 text-xs font-medium tabular-nums`,children:[S,C,w]}),t[39]=S,t[40]=C,t[41]=w,t[42]=T):T=t[42];let E;if(t[43]!==n.files||t[44]!==c||t[45]!==i){let e;t[47]!==c||t[48]!==i?(e=e=>(0,Q.jsxs)(`li`,{className:`flex h-8 min-w-0 items-center gap-2.5 rounded-sm pr-1.5 pl-1 text-caption leading-4`,children:[(0,Q.jsx)(`span`,{"aria-label":e.status,className:`w-4 shrink-0 text-center font-mono text-xs font-semibold text-brand`,children:e.status.slice(0,1).toUpperCase()}),(0,Q.jsx)(fr,{text:HK(e).join(` → `),className:`flex-1 font-mono font-medium`}),(0,Q.jsx)(E$,{count:c.get(UK(e))}),i(e)?.kind===`binary`&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Binary`})]},h$(e)),t[47]=c,t[48]=i,t[49]=e):e=t[49],E=n.files.map(e),t[43]=n.files,t[44]=c,t[45]=i,t[46]=E}else E=t[46];let D;t[50]===E?D=t[51]:(D=(0,Q.jsx)(`ul`,{className:`max-h-64 divide-y overflow-y-auto border-b`,"aria-label":`Changed files`,children:E}),t[50]=E,t[51]=D);let O;t[52]!==T||t[53]!==D?(O=(0,Q.jsxs)(`section`,{"aria-label":`Files changed`,className:`mt-7`,children:[T,D]}),t[52]=T,t[53]=D,t[54]=O):O=t[54];let k;t[55]!==a||t[56]!==r||t[57]!==o||t[58]!==i?(k=r.length>0&&(0,Q.jsx)(C$,{changes:r,patchOf:i,failed:a,onRetry:o}),t[55]=a,t[56]=r,t[57]=o,t[58]=i,t[59]=k):k=t[59];let A;return t[60]!==y||t[61]!==b||t[62]!==O||t[63]!==k||t[64]!==g||t[65]!==v?(A=(0,Q.jsxs)(`section`,{className:`mx-auto mt-1 mb-6 w-full max-w-commit min-w-0 px-7`,children:[g,v,y,b,O,k]}),t[60]=y,t[61]=b,t[62]=O,t[63]=k,t[64]=g,t[65]=v,t[66]=A):A=t[66],A}function S$(e){return(0,Q.jsx)(fr,{text:e.name,className:`font-mono`},`${e.kind}:${e.name}`)}function C$(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)(Y,{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=UK(e),n=r(e),a=vM(e),o=CM(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)(fr,{className:`font-mono font-medium`,text: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(`
|
|
1390
|
-
`).filter(T$).map(w$).join(`
|
|
1391
|
-
`)})]},`${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 w$(e){return e.slice(1)}function T$(e){return/^[+-]Subproject commit /.test(e)}function E$(e){let t=(0,$.c)(7),{count:n}=e;if(!n)return null;let r;t[0]===n.added?r=t[1]:(r=(0,Q.jsxs)(`span`,{className:`text-add-fg`,children:[`+`,n.added]}),t[0]=n.added,t[1]=r);let i;t[2]===n.removed?i=t[3]:(i=(0,Q.jsxs)(`span`,{className:`text-del-fg`,children:[`−`,n.removed]}),t[2]=n.removed,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,Q.jsxs)(`span`,{className:`shrink-0 space-x-1 font-mono text-xs font-medium tabular-nums`,children:[r,i]}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function D$(e){let t=(0,$.c)(39),{scope:n,context:r,label:i,items:a,controls:o,actions:s,actionsOpen:c,onActionsOpenChange:l}=e,[u,d]=(0,Z.useState)(),f;t[0]===a?f=t[1]:(f=a.filter(O$),t[0]=a,t[1]=f);let p=f.length,m;t[2]===a.length?m=t[3]:(m=Kr(a.length,`file`),t[2]=a.length,t[3]=m);let h=`${p} of ${m} reviewed`,g;t[4]===i?g=t[5]:(g=(0,Q.jsx)(`h2`,{className:`text-ui leading-4 font-medium text-foreground`,children:i}),t[4]=i,t[5]=g);let _=`File review actions: ${h}`,v;t[6]===_?v=t[7]:(v=(0,Q.jsx)(Y,{type:`button`,size:`xs`,variant:`ghost`,className:`ml-auto`,"aria-label":_}),t[6]=_,t[7]=v);let y;t[8]!==h||t[9]!==v?(y=(0,Q.jsx)(po,{render:v,children:h}),t[8]=h,t[9]=v,t[10]=y):y=t[10];let b;t[11]!==s||t[12]!==o.collapse?(b=(0,Q.jsxs)(ro,{"aria-label":`File review actions`,align:`end`,children:[o.collapse,s]}),t[11]=s,t[12]=o.collapse,t[13]=b):b=t[13];let x;t[14]!==c||t[15]!==l||t[16]!==y||t[17]!==b?(x=(0,Q.jsxs)(ya,{open:c,onOpenChange:l,children:[y,b]}),t[14]=c,t[15]=l,t[16]=y,t[17]=b,t[18]=x):x=t[18];let S;t[19]!==g||t[20]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-h-6 flex-wrap items-center gap-x-3.5 gap-y-1 border-b pb-1.5 text-xs text-muted-foreground tabular-nums`,children:[g,x]}),t[19]=g,t[20]=x,t[21]=S):S=t[21];let C;if(t[22]!==r||t[23]!==o||t[24]!==a||t[25]!==u||t[26]!==n){let e;t[28]!==r||t[29]!==o||t[30]!==u||t[31]!==n?(e=e=>{let t=e.path.lastIndexOf(`/`)+1,i=o.counts.get(e.path);return(0,Q.jsxs)(`li`,{className:`box-content flex h-8 items-center gap-3 border-t pl-1 first:border-t-0 last:border-b`,children:[(0,Q.jsx)(e$,{scope:n,context:r,path:e.path,fingerprint:e.fingerprint,status:e.reviewStatus,latest:u===e.path,onStart:()=>d(e.path)}),(0,Q.jsxs)(k$,{current:o.current===e.path,onOpen:()=>o.open(e.path),children:[(0,Q.jsxs)(fr,{className:`min-w-0 font-mono text-caption leading-4`,text:e.path,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.path.slice(0,t)}),e.path.slice(t)]}),i&&(0,Q.jsx)(`span`,{className:`ml-auto`,children:(0,Q.jsx)(HZ,{counts:i})})]})]},e.path)},t[28]=r,t[29]=o,t[30]=u,t[31]=n,t[32]=e):e=t[32],C=a.map(e),t[22]=r,t[23]=o,t[24]=a,t[25]=u,t[26]=n,t[27]=C}else C=t[27];let w;t[33]===C?w=t[34]:(w=(0,Q.jsx)(`ol`,{children:C}),t[33]=C,t[34]=w);let T;return t[35]!==i||t[36]!==w||t[37]!==S?(T=(0,Q.jsxs)(`section`,{"aria-label":i,className:`pb-3.25`,children:[S,w]}),t[35]=i,t[36]=w,t[37]=S,t[38]=T):T=t[38],T}function O$(e){return e.reviewStatus===`reviewed`}function k$(e){let t=(0,$.c)(4),{current:n,onOpen:r,children:i}=e,a=n?`true`:void 0,o;return t[0]!==i||t[1]!==r||t[2]!==a?(o=(0,Q.jsx)(`button`,{type:`button`,"aria-current":a,onClick:r,className:`flex h-8 min-w-0 flex-1 items-center gap-3 rounded-sm px-1.5 text-left whitespace-nowrap text-foreground outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring`,children:i}),t[0]=i,t[1]=r,t[2]=a,t[3]=o):o=t[3],o}function A$(e){return[...new Set([e.oldPath,e.newPath,e.path].filter(e=>e!==void 0))]}function j$(e,t,n,r){let i=e.flatMap((e,n)=>e.steps.flatMap((r,i)=>r.pointer.path===t?[{decision:n,stop:i,stepId:r.id,place:Kp(e.id)}]:[]));return i.find(e=>e.stepId===n)??i.find(e=>e.place===r)??i[0]}function M$(e){let t=(0,$.c)(41),{path:n,note:r,diff:i,children:a}=e,o,s,c,l,u,d,f,p,m,h;if(t[0]!==i?.hunks||t[1]!==n){let e=n.split(`/`);l=e.pop()??n;let r;t[12]===i?.hunks?r=t[13]:(r=i?.hunks.reduce(P$,0),t[12]=i?.hunks,t[13]=r),s=r;let a;t[14]===i?.hunks?a=t[15]:(a=i?.hunks.reduce(N$,0),t[14]=i?.hunks,t[15]=a),c=a,m=``,h=`@container/file-heading flex min-h-11 shrink-0 items-center gap-2.5 px-4 text-ui leading-[1.4] whitespace-nowrap text-foreground`,o=fr,u=n,d=`min-w-0 font-mono text-[length:var(--text-caption)] leading-4 text-muted-foreground`,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`h1`,{}),t[16]=f):f=t[16],p=e.length>0&&(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.join(` / `),` / `]}),t[0]=i?.hunks,t[1]=n,t[2]=o,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m,t[11]=h}else o=t[2],s=t[3],c=t[4],l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],m=t[10],h=t[11];let g;t[17]===l?g=t[18]:(g=(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:l}),t[17]=l,t[18]=g);let _;t[19]!==o||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==g?(_=(0,Q.jsxs)(o,{text:u,className:d,render:f,children:[p,g]}),t[19]=o,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=g,t[25]=_):_=t[25];let v;t[26]===r?v=t[27]:(v=r&&(0,Q.jsx)(`span`,{className:`hidden shrink-0 text-xs text-muted-foreground @md/file-heading:inline`,children:r}),t[26]=r,t[27]=v);let y;t[28]!==s||t[29]!==c||t[30]!==i?(y=i&&(0,Q.jsxs)(`span`,{"aria-label":`${c} deletions, ${s} additions`,className:`font-mono text-xs font-medium tabular-nums`,children:[(0,Q.jsxs)(`span`,{className:`text-del-fg`,children:[`−`,c]}),` `,(0,Q.jsxs)(`span`,{className:`text-add-fg`,children:[`+`,s]})]}),t[28]=s,t[29]=c,t[30]=i,t[31]=y):y=t[31];let b;t[32]!==a||t[33]!==y?(b=(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[y,a]}),t[32]=a,t[33]=y,t[34]=b):b=t[34];let x;return t[35]!==b||t[36]!==m||t[37]!==h||t[38]!==_||t[39]!==v?(x=(0,Q.jsxs)(`header`,{"data-file-heading":m,className:h,children:[_,v,b]}),t[35]=b,t[36]=m,t[37]=h,t[38]=_,t[39]=v,t[40]=x):x=t[40],x}function N$(e,t){return e+t.deletionLines}function P$(e,t){return e+t.additionLines}function F$(e){let t=(0,$.c)(16),{document:n,context:r,interaction:i,onOpen:a}=e,o;t[0]!==r.connection||t[1]!==n.reviewId||t[2]!==n.revision?(o=k({connection:r.connection,reviewId:n.reviewId,revision:n.revision}),t[0]=r.connection,t[1]=n.reviewId,t[2]=n.revision,t[3]=o):o=t[3];let s=o,c=Rr(s),l=yr(s),u;t[4]===c?u=t[5]:(u=Ts(Te(c))?.revision,t[4]=c,t[5]=u);let d=u;if(!d){if(f(c)){let e;return t[6]===l?e=t[7]:(e=(0,Q.jsx)(v,{description:`The review file could not be read.`,onRetry:l}),t[6]=l,t[7]=e),e}if(qi(c)){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(dn,{label:`Loading review file`}),t[8]=e):e=t[8],e}let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(me,{title:`Revision not found`,description:`This retained file's revision is no longer available.`}),t[9]=e):e=t[9],e}let p;return t[10]!==r||t[11]!==n||t[12]!==i||t[13]!==a||t[14]!==d?(p=(0,Q.jsx)(I$,{document:n,revision:d,context:r,interaction:i,onOpen:a}),t[10]=r,t[11]=n,t[12]=i,t[13]=a,t[14]=d,t[15]=p):p=t[15],p}function I$(e){let t=(0,$.c)(74),{document:n,revision:r,context:i,interaction:a,onOpen:o}=e,{path:s}=n,c;t[0]!==r.reviewId||t[1]!==r.revision?(c={reviewId:r.reviewId,revision:r.revision},t[0]=r.reviewId,t[1]=r.revision,t[2]=c):c=t[2];let l;t[3]!==r.content.worktreeId||t[4]!==r.projectId||t[5]!==c?(l={projectId:r.projectId,worktreeId:r.content.worktreeId,review:c},t[3]=r.content.worktreeId,t[4]=r.projectId,t[5]=c,t[6]=l):l=t[6];let u=l,d={connection:i.connection,reviewId:r.reviewId,revision:r.revision},p=_t({...d,path:s}),m=Rr(p),h=yr(p),g=Ts(Te(m)),_;t[7]===s?_=t[8]:(_=e=>e.path===s,t[7]=s,t[8]=_);let y=r.files.find(_),b=F({...d,paths:y?[A$(y)]:[]}),x=Rr(b),S=yr(b),C;t[9]!==x||t[10]!==n.kind||t[11]!==m?(C=n.kind===`review-change`?f(x):f(m),t[9]=x,t[10]=n.kind,t[11]=m,t[12]=C):C=t[12];let w=C,T;t[13]!==x||t[14]!==n.kind||t[15]!==m?(T=n.kind===`review-change`?qi(x):qi(m),t[13]=x,t[14]=n.kind,t[15]=m,t[16]=T):T=t[16];let E=T,D=n.kind===`review-change`?S:h,O=y?lP(r.headOid,{...y,oldPath:y.oldPath,newPath:y.newPath},Ts(Te(x))?.diffs[0]?.content):void 0,k=O?.fileDiff,A=(()=>{if(n.kind===`review-change`)return O;if(g?.kind===`text`)return MZ(`review:${r.reviewId}:${r.revision}:${s}`,s,g.text)})(),j=Ts(Te(Rr(nn(d)))),M=Ic(d),N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N={mode:`promiseExit`},t[17]=N):N=t[17];let[P,I]=xa(M.mark,N),L;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(L={mode:`promiseExit`},t[18]=L):L=t[18];let[R,z]=xa(M.unmark,L),B=y?.newOid??y?.oldOid,V=j?.files.some(e=>e.path===s&&e.fingerprint===B)??!1,H=HX(`${r.reviewId}:${r.revision}`),U=r.content.layers,W=j$(U,s,nZ(r.reviewId,r.revision).steps[s],H.place),G=W?U[W.decision]:void 0,K=W?G?.steps[W.stop]:void 0,ee;t[19]===K?ee=t[20]:(ee=K?.published&&(0,Q.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap`,children:K.published.join(`
|
|
1392
|
-
`)}),t[19]=K,t[20]=ee);let q=ee,te;t[21]!==w||t[22]!==E||t[23]!==q||t[24]!==g?.kind||t[25]!==s||t[26]!==D?(te=()=>w?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(v,{description:`${s} · Code unavailable at this revision`,onRetry:D}),q]}):E?(0,Q.jsx)(dn,{label:`Loading retained file`}):g?.kind===`too-large`?(0,Q.jsx)(me,{title:`Not shown`,description:`This file is too large to display.`}):g?.kind===`unsupported`?(0,Q.jsx)(me,{title:`Not shown`,description:`This file cannot be displayed as text.`}):(0,Q.jsx)(me,{title:`Not shown`,description:`${s} · Code unavailable at this revision`,children:q}),t[21]=w,t[22]=E,t[23]=q,t[24]=g?.kind,t[25]=s,t[26]=D,t[27]=te):te=t[27];let ne=te,re=K?`Step ${K.title}`:`File ${s}`,ie;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Q.jsx)(Wf,{className:`size-3.5 shrink-0`}),t[28]=ie):ie=t[28];let ae=G&&K?`Part of the review · Decision ${U.indexOf(G)+1}, stop ${G.steps.indexOf(K)+1} · ${K.title}`:`Part of the review`,oe;t[29]!==U||t[30]!==G||t[31]!==K?(oe=G&&K&&(0,Q.jsxs)(Q.Fragment,{children:[` `,`· Decision `,U.indexOf(G)+1,`, stop`,` `,G.steps.indexOf(K)+1,` ·`,` `,(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:K.title})]}),t[29]=U,t[30]=G,t[31]=K,t[32]=oe):oe=t[32];let se;t[33]!==ae||t[34]!==oe?(se=(0,Q.jsxs)(fr,{className:`min-w-0 flex-1`,text:ae,children:[`Part of the review`,oe]}),t[33]=ae,t[34]=oe,t[35]=se):se=t[35];let ce;t[36]===o?ce=t[37]:(ce=()=>o({kind:`handoff`}),t[36]=o,t[37]=ce);let le;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Q.jsx)(hd,{}),t[38]=le):le=t[38];let ue;t[39]===ce?ue=t[40]:(ue=(0,Q.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:ce,children:[le,`Back to the walkthrough`]}),t[39]=ce,t[40]=ue);let de;t[41]!==se||t[42]!==ue?(de=(0,Q.jsxs)(`div`,{"data-review-file-banner":``,className:`flex min-h-9 shrink-0 items-center gap-2 border-b bg-muted pr-2 pl-4 text-xs leading-4 text-muted-foreground`,children:[ie,se,ue]}),t[41]=se,t[42]=ue,t[43]=de):de=t[43];let fe=y?.status,pe;t[44]!==k||t[45]!==s||t[46]!==fe?(pe=(0,Q.jsx)(M$,{path:s,note:fe,diff:k}),t[44]=k,t[45]=s,t[46]=fe,t[47]=pe):pe=t[47];let J;t[48]!==P||t[49]!==R?(J=(f(P)||f(R))&&(0,Q.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-destructive`,children:`The file mark could not be updated. Try again.`}),t[48]=P,t[49]=R,t[50]=J):J=t[50];let he;t[51]!==i||t[52]!==k||t[53]!==n.kind||t[54]!==A||t[55]!==B||t[56]!==a||t[57]!==I||t[58]!==P||t[59]!==o||t[60]!==s||t[61]!==V||t[62]!==r||t[63]!==u||t[64]!==ne||t[65]!==z||t[66]!==R?(he=A?(0,Q.jsx)(jQ,{scope:u,context:i,interaction:a,disableFileHeader:!0,compactThreads:n.kind===`review-file`,fileDiff:n.kind===`review-file`?k:void 0,headerActions:(0,Q.jsx)(SZ,{label:`Timeline`,iconOnly:!0,icon:gp,onClick:()=>o({kind:`timeline`,path:s})}),entries:[{...A,comment:ZZ(r,s),...B?{review:{path:s,fingerprint:B,reviewed:V,control:null}}:{}}],onReview:()=>{!B||P.waiting||R.waiting||(V?z({kind:`file`,path:s,headBlobOid:B}):I({kind:`file`,revision:r.revision,path:s,headBlobOid:B}))}}):ne(),t[51]=i,t[52]=k,t[53]=n.kind,t[54]=A,t[55]=B,t[56]=a,t[57]=I,t[58]=P,t[59]=o,t[60]=s,t[61]=V,t[62]=r,t[63]=u,t[64]=ne,t[65]=z,t[66]=R,t[67]=he):he=t[67];let ge;return t[68]!==re||t[69]!==de||t[70]!==pe||t[71]!==J||t[72]!==he?(ge=(0,Q.jsxs)(`article`,{"aria-label":re,className:`flex min-h-0 flex-1 flex-col`,children:[de,pe,J,he]}),t[68]=re,t[69]=de,t[70]=pe,t[71]=J,t[72]=he,t[73]=ge):ge=t[73],ge}function L$(e,t,n){if(t===``)return[];let r=t.toLocaleLowerCase(),i=[],a=e.split(`
|
|
1393
|
-
`);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 R$(e,t){return Math.max(0,Math.min(e,t-1))}function z$(e,t,n){return t===0?0:(R$(e,t)+n+t)%t}function B$(e,t,n){if(t===0)return`No results`;let r=t===n?`+`:``;return`${R$(e,t)+1} of ${t}${r}`}function V$(e){let t=(0,$.c)(65),{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=L$(n,o,Ki),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(z$(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)(SI,{children:(0,Q.jsx)(vp,{})}),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,L$(n,e.target.value,Ki))},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)(EI,{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)(TI,{role:`status`,children:B$(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)(Yn,{}),t[32]=D):D=t[32];let O;t[33]!==T||t[34]!==E?(O=(0,Q.jsx)(De,{render:(0,Q.jsx)(wI,{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;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:`Previous match`}),t[36]=k):k=t[36];let A;t[37]===O?A=t[38]:(A=(0,Q.jsxs)(dt,{children:[O,k]}),t[37]=O,t[38]=A);let j=d.length===0,M;t[39]===_?M=t[40]:(M=()=>_(1),t[39]=_,t[40]=M);let N;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(Hn,{}),t[41]=N):N=t[41];let P;t[42]!==j||t[43]!==M?(P=(0,Q.jsx)(De,{render:(0,Q.jsx)(wI,{size:`icon-xs`,"aria-label":`Next match`,disabled:j,onClick:M,children:N})}),t[42]=j,t[43]=M,t[44]=P):P=t[44];let F;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:`Next match`}),t[45]=F):F=t[45];let I;t[46]===P?I=t[47]:(I=(0,Q.jsxs)(dt,{children:[P,F]}),t[46]=P,t[47]=I);let L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(Ht,{}),t[48]=L):L=t[48];let R;t[49]===a?R=t[50]:(R=(0,Q.jsx)(De,{render:(0,Q.jsx)(wI,{size:`icon-xs`,"aria-label":`Close find`,onClick:a,children:L})}),t[49]=a,t[50]=R);let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(Et,{role:`tooltip`,className:`break-all`,children:`Close find`}),t[51]=z):z=t[51];let B;t[52]===R?B=t[53]:(B=(0,Q.jsxs)(dt,{children:[R,z]}),t[52]=R,t[53]=B);let V;t[54]!==w||t[55]!==A||t[56]!==I||t[57]!==B?(V=(0,Q.jsxs)(SI,{align:`inline-end`,children:[w,A,I,B]}),t[54]=w,t[55]=A,t[56]=I,t[57]=B,t[58]=V):V=t[58];let H;t[59]!==V||t[60]!==C?(H=(0,Q.jsxs)(bI,{className:`w-full max-w-sm`,children:[y,C,V]}),t[59]=V,t[60]=C,t[61]=H):H=t[61];let U;return t[62]!==H||t[63]!==v?(U=(0,Q.jsx)(`div`,{role:`search`,className:`flex shrink-0 justify-end border-b px-3 py-1.5`,onKeyDown:v,children:H}),t[62]=H,t[63]=v,t[64]=U):U=t[64],U}function H$(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=_w(e.path)?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-auto`,children:[(0,Q.jsx)(e1,{...e}),(0,Q.jsx)(Y$,{path:e.path,copy:!1,children:(0,Q.jsxs)(dJ,{className:`max-w-full flex-wrap justify-end`,children:[(0,Q.jsx)(X$,{path:e.path,onOpen:e.onOpen}),(0,Q.jsx)(Z$,{path:e.path})]})}),(0,Q.jsx)(vw,{scope:e.scope,path:e.path,connection:e.context.connection})]}):(0,Q.jsx)(U$,{...e}),t[0]=e,t[1]=n),n}function U$(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=eM(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||t[10]!==n?(r=(0,Q.jsx)(W$,{...e,message:n}),t[9]=e,t[10]=n,t[11]=r):r=t[11],r}if(l?.kind===`submodule`){let n;return t[12]===e?n=t[13]:(n=(0,Q.jsx)(W$,{...e,message:`Not followed: submodule`}),t[12]=e,t[13]=n),n}let u;return t[14]===e?u=t[15]:(u=(0,Q.jsx)(G$,{...e}),t[14]=e,t[15]=u),u}function W$(e){let t=(0,$.c)(13),n,r;t[0]===e?(n=t[1],r=t[2]):({message:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===r?i=t[4]:(i=(0,Q.jsx)(e1,{...r}),t[3]=r,t[4]=i);let a;t[5]===r.path?a=t[6]:(a=(0,Q.jsx)(Y$,{path:r.path}),t[5]=r.path,t[6]=a);let o;t[7]===n?o=t[8]:(o=(0,Q.jsx)(`div`,{className:`grid min-h-48 flex-1 place-items-center p-6`,children:(0,Q.jsx)(me,{title:`Not shown`,description:n})}),t[7]=n,t[8]=o);let s;return t[9]!==i||t[10]!==a||t[11]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[i,a,o]}),t[9]=i,t[10]=a,t[11]=o,t[12]=s):s=t[12],s}function G$(e){let t=(0,$.c)(24),{scope:n,context:r,interaction:i,path:a,onOpen:o}=e,{connection:s}=r,{file:c,draft:l,state:u,reset:d,edit:f}=pu(s,n,a),p=`kind`in c;if(p&&u.owner===null&&u.text===u.savedText){let e;return t[0]!==r||t[1]!==c.reason||t[2]!==i||t[3]!==o||t[4]!==a||t[5]!==n?(e=(0,Q.jsx)(W$,{scope:n,context:r,interaction:i,onOpen:o,path:a,message:c.reason}),t[0]=r,t[1]=c.reason,t[2]=i,t[3]=o,t[4]=a,t[5]=n,t[6]=e):e=t[6],e}let m;t[7]===p?m=t[8]:(m=p&&(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[7]=p,t[8]=m);let h=p?u.savedText:c.text,g=p?u.fingerprint:c.contentFingerprint,_;t[9]!==r||t[10]!==l||t[11]!==f||t[12]!==i||t[13]!==o||t[14]!==a||t[15]!==d||t[16]!==n||t[17]!==u||t[18]!==h||t[19]!==g?(_=(0,Q.jsx)(K$,{scope:n,context:r,interaction:i,path:a,text:h,contentFingerprint:g,draft:l,draftState:u,reset:d,edit:f,onOpen:o}),t[9]=r,t[10]=l,t[11]=f,t[12]=i,t[13]=o,t[14]=a,t[15]=d,t[16]=n,t[17]=u,t[18]=h,t[19]=g,t[20]=_):_=t[20];let v;return t[21]!==m||t[22]!==_?(v=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[m,_]}),t[21]=m,t[22]=_,t[23]=v):v=t[23],v}function K$(e){let t=(0,$.c)(94),{scope:n,context:r,interaction:i,path:a,text:o,contentFingerprint:s,draft:c,draftState:l,reset:u,edit:d,onOpen:f}=e,{preferences:p}=Hc(),{connection:m}=r,h=nP(n,m),g;t[0]===a?g=t[1]:(g=Q$(a),t[0]=a,t[1]=g);let _=g,v;t[2]===a?v=t[3]:(v=[a],t[2]=a,t[3]=v);let y=TZ(n,r,h,v)[0],b=y?.comparisons??[],x=b.find(q$)??b[0],S=x?wM(x):void 0,w;t[4]!==a||t[5]!==y?(w=y?[{path:a,fingerprint:y.fingerprint}]:[],t[4]=a,t[5]=y,t[6]=w):w=t[6];let T=iP(n,m,y?.statusToken??``,w,S?[S]:[]),E=S?T.diffs.get(jN(S)):void 0,D=x&&x.scope!==`untracked`&&x.scope!==`unmerged`&&E?cP(x,E)?.fileDiff:void 0,O=x&&`kind`in x?`${x.scope} · ${x.kind}`:x?.scope,k;if(t[7]!==h.changes||t[8]!==a){let e;t[10]===a?e=t[11]:(e=e=>e.path===a,t[10]=a,t[11]=e),k=h.changes.some(e),t[7]=h.changes,t[8]=a,t[9]=k}else k=t[9];let A=k,j;t[12]!==_||t[13]!==p?(j=()=>$$(_,p),t[12]=_,t[13]=p,t[14]=j):j=t[14];let[M,N]=(0,Z.useState)(j),{reveal:P,active:F}=i,[I,L]=(0,Z.useState)();P&&I!==P.nonce&&P.anchor.comparison?.kind===`file`&&P.anchor.filePath===a&&(L(P.nonce),N(`source`));let[R,z]=(0,Z.useState)(),[B,V]=(0,Z.useState)(!1),[H,U]=(0,Z.useState)(),[W,G]=(0,Z.useState)(),K=(0,Z.useId)();wK(c,K,s);let ee=_===`code`||M===`source`,q;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>U(Date.now()),t[15]=q):q=t[15];let te=F&&ee&&!B,ne;t[16]===te?ne=t[17]:(ne={enabled:te,ignoreInputs:!1,conflictBehavior:`allow`},t[16]=te,t[17]=ne),pc(cc.findInFile,q,ne);let re=l.diskChanged.has(K)?`Changed on disk just now`:``,ie;t[18]===re?ie=t[19]:(ie=(0,Q.jsx)(`span`,{"aria-live":`polite`,className:`hidden text-xs text-muted-foreground xl:inline`,children:re}),t[18]=re,t[19]=ie);let ae;t[20]!==_||t[21]!==M?(ae=_!==`code`&&(0,Q.jsx)(Ae,{value:M,onValueChange:e=>{(e===`rendered`||e===`source`)&&N(e)},children:(0,Q.jsxs)(Rn,{children:[(0,Q.jsx)($n,{value:`rendered`,children:_===`markdown`?`Reader`:`Preview`}),(0,Q.jsx)($n,{value:`source`,children:`Source`})]})}),t[20]=_,t[21]=M,t[22]=ae):ae=t[22];let oe;t[23]!==ie||t[24]!==ae?(oe=(0,Q.jsxs)(Q.Fragment,{children:[ie,ae]}),t[23]=ie,t[24]=ae,t[25]=oe):oe=t[25];let se=oe,ce;t[26]!==s||t[27]!==l.owner||t[28]!==l.savedText||t[29]!==l.text||t[30]!==d||t[31]!==K?(ce=s&&(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-sm`,disabled:l.owner!==null&&l.owner!==K,"aria-label":l.text===l.savedText?`Edit`:`Resume edit`,onClick:()=>{d(K)&&V(!0)}}),children:(0,Q.jsx)(C,{})}),(0,Q.jsx)(Et,{role:`tooltip`,children:l.owner!==null&&l.owner!==K?`Editing in another pane`:`Edit`})]}),t[26]=s,t[27]=l.owner,t[28]=l.savedText,t[29]=l.text,t[30]=d,t[31]=K,t[32]=ce):ce=t[32];let le;t[33]!==A||t[34]!==f||t[35]!==a?(le=A&&(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":`Open diff`,onClick:()=>f({kind:`change`,path:a})}),children:(0,Q.jsx)(of,{})}),(0,Q.jsx)(Et,{role:`tooltip`,children:`Open diff`})]}),t[33]=A,t[34]=f,t[35]=a,t[36]=le):le=t[36];let ue;t[37]!==i.toolbarTarget||t[38]!==f||t[39]!==a?(ue=i.toolbarTarget===void 0&&(0,Q.jsx)(X$,{path:a,onOpen:f}),t[37]=i.toolbarTarget,t[38]=f,t[39]=a,t[40]=ue):ue=t[40];let de;t[41]===a?de=t[42]:(de=(0,Q.jsx)(Z$,{path:a}),t[41]=a,t[42]=de);let fe;t[43]!==ce||t[44]!==le||t[45]!==ue||t[46]!==de?(fe=(0,Q.jsxs)(Q.Fragment,{children:[ce,le,ue,de]}),t[43]=ce,t[44]=le,t[45]=ue,t[46]=de,t[47]=fe):fe=t[47];let pe=fe;if(B){let e;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>V(!1),t[48]=e):e=t[48];let n;t[49]!==s||t[50]!==u||t[51]!==o?(n=()=>{u(o,s??``),V(!1)},t[49]=s,t[50]=u,t[51]=o,t[52]=n):n=t[52];let r;t[53]===a?r=t[54]:(r=e=>(0,Q.jsx)(Y$,{path:a,children:e}),t[53]=a,t[54]=r);let i;return t[55]!==F||t[56]!==A||t[57]!==c||t[58]!==l||t[59]!==K||t[60]!==a||t[61]!==n||t[62]!==r?(i=(0,Q.jsx)(Gj,{owner:K,path:a,draft:c,state:l,active:F,changed:A,onDone:e,onDiscard:n,renderToolbar:r}),t[55]=F,t[56]=A,t[57]=c,t[58]=l,t[59]=K,t[60]=a,t[61]=n,t[62]=r,t[63]=i):i=t[63],i}let J;t[64]!==F||t[65]!==B||t[66]!==ee?(J=F&&!ee&&!B&&(0,Q.jsx)(t1,{onComment:()=>{N(`source`),z(Date.now())}}),t[64]=F,t[65]=B,t[66]=ee,t[67]=J):J=t[67];let me;t[68]!==i.toolbarTarget||t[69]!==f||t[70]!==a||t[71]!==ee?(me=i.toolbarTarget&&!ee&&(0,od.createPortal)((0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(SZ,{label:`Comment`,icon:Qf,shortcut:cc.commentOnFile,onClick:()=>{N(`source`),z(Date.now())}}),(0,Q.jsx)(X$,{path:a,onOpen:f})]}),i.toolbarTarget),t[68]=i.toolbarTarget,t[69]=f,t[70]=a,t[71]=ee,t[72]=me):me=t[72];let he;t[73]!==pe||t[74]!==R||t[75]!==s||t[76]!==r||t[77]!==D||t[78]!==H||t[79]!==W||t[80]!==i||t[81]!==_||t[82]!==se||t[83]!==M||t[84]!==O||t[85]!==f||t[86]!==a||t[87]!==n||t[88]!==o?(he=M===`rendered`&&_!==`code`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Y$,{path:a,copy:!1,children:[se,(0,Q.jsx)(dJ,{className:`max-w-full flex-wrap justify-end`,children:pe})]}),(0,Q.jsx)(J$,{scope:n,context:r,path:a,kind:_,text:o})]}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[H!==void 0&&(0,Q.jsx)(V$,{text:o,focusRequest:H,onReveal:e=>G({line:e,nonce:Date.now()}),onClose:()=>U(void 0)}),(0,Q.jsxs)(M$,{path:a,note:O,diff:D,children:[se,pe]}),(0,Q.jsx)(jQ,{disableFileHeader:!0,compactThreads:!0,fileDiff:D,scope:n,context:r,interaction:i,headerActions:i.toolbarTarget===void 0?void 0:(0,Q.jsx)(X$,{path:a,onOpen:f}),...R===void 0?{}:{commentRequest:R},...W===void 0?{}:{foundLine:W},entries:[{...MZ(`file:${a}`,a,o),...s?{comment:{filePath:a,comparison:{kind:`file`},contentFingerprint:s}}:{}}]})]}),t[73]=pe,t[74]=R,t[75]=s,t[76]=r,t[77]=D,t[78]=H,t[79]=W,t[80]=i,t[81]=_,t[82]=se,t[83]=M,t[84]=O,t[85]=f,t[86]=a,t[87]=n,t[88]=o,t[89]=he):he=t[89];let ge;return t[90]!==J||t[91]!==me||t[92]!==he?(ge=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-card`,children:[J,me,he]}),t[90]=J,t[91]=me,t[92]=he,t[93]=ge):ge=t[93],ge}function q$(e){return e.scope===`unstaged`}function J$(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)(Bj,{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.`}),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)($j,{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 Y$(e){let t=(0,$.c)(7),{path:n,children:r,copy:i}=e,a=i===void 0||i,o;t[0]!==a||t[1]!==n?(o=a&&(0,Q.jsx)(Z$,{path:n}),t[0]=a,t[1]=n,t[2]=o):o=t[2];let s;return t[3]!==r||t[4]!==n||t[5]!==o?(s=(0,Q.jsxs)(M$,{path:n,children:[r,o]}),t[3]=r,t[4]=n,t[5]=o,t[6]=s):s=t[6],s}function X$(e){let t=(0,$.c)(3),{path:n,onOpen:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Q.jsx)(SZ,{label:`Timeline`,iconOnly:!0,icon:gp,onClick:()=>r({kind:`timeline`,path:n})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Z$(e){let t=(0,$.c)(8),{path:n}=e,r;t[0]===n?r=t[1]:(r=(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":`Copy path`,onClick:()=>Yi(n,`path`)}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(He,{}),t[2]=i):i=t[2];let a;t[3]===r?a=t[4]:(a=(0,Q.jsx)(De,{render:r,children:i}),t[3]=r,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(Et,{role:`tooltip`,children:`Copy path`}),t[5]=o):o=t[5];let s;return t[6]===a?s=t[7]:(s=(0,Q.jsxs)(dt,{children:[a,o]}),t[6]=a,t[7]=s),s}function Q$(e){let t=e.toLowerCase();return t.endsWith(`.md`)||t.endsWith(`.mdx`)?`markdown`:t.endsWith(`.html`)||t.endsWith(`.htm`)?`html`:`code`}function $$(e,t){return e===`markdown`||e===`html`?t.documentsDefault:`source`}function e1(e){let t=(0,$.c)(25),{scope:n,context:r,interaction:i,path:a,onOpen:o}=e,s=nP(n,r.connection),c;t[0]===a?c=t[1]:(c=[a],t[0]=a,t[1]=c);let l=TZ(n,r,s,c)[0],u;t[2]!==l||t[3]!==o||t[4]!==a?(u=()=>{l&&o({kind:`change`,path:a},{kind:`file`,filePath:a},{compose:!0})},t[2]=l,t[3]=o,t[4]=a,t[5]=u):u=t[5];let d=u;if(!i.toolbarTarget)return null;let f;t[6]!==d||t[7]!==i.active?(f=i.active&&(0,Q.jsx)(t1,{onComment:d}),t[6]=d,t[7]=i.active,t[8]=f):f=t[8];let p=!l,m=l?`Comment`:`Comments for this preview are available from its diff.`,h;t[9]!==d||t[10]!==p||t[11]!==m?(h=(0,Q.jsx)(SZ,{label:`Comment`,icon:Qf,shortcut:cc.commentOnFile,disabled:p,description:m,onClick:d}),t[9]=d,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==o||t[14]!==a?(g=(0,Q.jsx)(X$,{path:a,onOpen:o}),t[13]=o,t[14]=a,t[15]=g):g=t[15];let _;t[16]!==h||t[17]!==g?(_=(0,Q.jsxs)(Q.Fragment,{children:[h,g]}),t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==i.toolbarTarget||t[20]!==_?(v=(0,od.createPortal)(_,i.toolbarTarget),t[19]=i.toolbarTarget,t[20]=_,t[21]=v):v=t[21];let y;return t[22]!==f||t[23]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[f,v]}),t[22]=f,t[23]=v,t[24]=y):y=t[24],y}function t1(e){let t=(0,$.c)(1),{onComment:n}=e,r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={ignoreInputs:!0},t[0]=r):r=t[0],pc(cc.commentOnFile,n,r),null}function n1(e){return[...new Set(e)].join(`, `)}function r1(e){let t=(0,$.c)(37),{scope:n,context:r,interaction:i,paths:a,files:o,focus:s,header:c,headerActions:l,headerLeading:u,commentRequest:d,toolbar:f,agentNotes:p,footer:m,column:h}=e,g=o===void 0?[]:o,_=h!==void 0&&h,{connection:v}=r,[y,b]=(0,Z.useState)(0),[x]=(0,Z.useState)(m1);wZ(n,r);let S=nP(n,v),C=It(TZ(n,r,S,a),g),w=iP(n,v,C[0]?.statusToken??``,C.flatMap(f1),C.flatMap(u1)),T=Uj(v,n,C.flatMap(c1)),E;t[0]===w.diffs?E=t[1]:(E=e=>{let t=wM(e);return t?w.diffs.get(jN(t)):void 0},t[0]=w.diffs,t[1]=E);let D=E,O=w.pending||T.pending,k=w.failed||T.failed,A=new Map(g.map(s1)),j;t[2]!==D||t[3]!==T?(j=e=>{let t=e.comparisons.flatMap(e=>{if(e.scope===`unmerged`)return[`Conflict`];if(e.scope===`untracked`)return T.contents.has(e.path)?[]:[`Not readable`];if(!e.supported)return[`Unsupported comparison`];let t=D(e);return t?t.kind===`binary`?[`Binary change`]:t.kind===`omitted`?[`Content omitted: ${xM(t.reason)}`]:cP(e,t)?[]:[`No single-file textual patch`]:[]});return t.length>0?[{item:e,reasons:t}]:[]},t[2]=D,t[3]=T,t[4]=j):j=t[4];let M=C.flatMap(j),N=C.flatMap(e=>e.comparisons.flatMap(t=>{let i=QQ(n,r,e);if(t.scope===`untracked`){let n=T.contents.get(t.path);return n===void 0?[]:[{...MZ(MN(t),e.path,n,A.get(e.path)??`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=g1(D(t),s?.[e.path]),o=a?cP(t,a):null,c=A.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(p??{})){let n=N.filter(t=>t.path===e),r=n.find(o1)??n[0];if(r)for(let e of t){let t=r.kind===`file`?e.line<=r.contents.split(`
|
|
1394
|
-
`).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 P=new Set(N.map(a1)),F=i.toolbarTarget!==void 0&&/^(file|change|branch):/.test(i.entry)&&N.length===0&&C.length===1?M[0]?.item:void 0,I=c||O||k||M.length>0?e=>(0,Q.jsxs)(Q.Fragment,{children:[c?.({...e,open:t=>{let n=x.get(t);!P.has(t)&&n?(n.focus({preventScroll:!0}),n.scrollIntoView({block:`start`})):e.open(t)}}),(O||k)&&(0,Q.jsx)(_1,{failed:k,retry:()=>{w.retry(),T.retry()}}),M.length>0&&(0,Q.jsx)(v1,{changes:M,column:_,onTarget:(e,t)=>{t?x.set(e,t):x.delete(e)},renderedPaths:P,scope:n,context:r,paneFile:!!F,...N.length===0&&(d!==void 0||y>0)?{commentRequest:(d??0)+y}:{}})]}):void 0,L;t[5]!==r||t[6]!==l||t[7]!==i.active||t[8]!==F||t[9]!==n||t[10]!==b?(L=F?(0,Q.jsx)(b1,{scope:n,context:r,item:F,active:i.active,onComment:()=>b(i1),children:l}):void 0,t[5]=r,t[6]=l,t[7]=i.active,t[8]=F,t[9]=n,t[10]=b,t[11]=L):L=t[11];let R;t[12]===d?R=t[13]:(R=d===void 0?{}:{commentRequest:d},t[12]=d,t[13]=R);let z;t[14]===m?z=t[15]:(z=m?{footer:m}:{},t[14]=m,t[15]=z);let B;t[16]===I?B=t[17]:(B=I?{header:I}:{},t[16]=I,t[17]=B);let V;t[18]===l?V=t[19]:(V=l?{headerActions:l}:{},t[18]=l,t[19]=V);let H;t[20]===u?H=t[21]:(H=u?{headerLeading:u}:{},t[20]=u,t[21]=H);let U;t[22]===f?U=t[23]:(U=f?{toolbar:f}:{},t[22]=f,t[23]=U);let W;return t[24]!==_||t[25]!==r||t[26]!==N||t[27]!==i||t[28]!==n||t[29]!==H||t[30]!==U||t[31]!==L||t[32]!==R||t[33]!==z||t[34]!==B||t[35]!==V?(W=(0,Q.jsx)(jQ,{emptyActions:L,scope:n,context:r,interaction:i,...R,entries:N,column:_,...z,...B,...V,...H,...U}),t[24]=_,t[25]=r,t[26]=N,t[27]=i,t[28]=n,t[29]=H,t[30]=U,t[31]=L,t[32]=R,t[33]=z,t[34]=B,t[35]=V,t[36]=W):W=t[36],W}function i1(e){return e+1}function a1(e){return e.path}function o1(e){return e.comment?.comparison?.kind===`worktree`&&e.comment.comparison.scope===`unstaged`}function s1(e){return[e.path,e.note]}function c1(e){return e.comparisons.flatMap(l1)}function l1(e){return e.scope===`untracked`?[e.path]:[]}function u1(e){return e.comparisons.flatMap(d1)}function d1(e){let t=wM(e);return t?[t]:[]}function f1(e){return e.comparisons.some(p1)?[{path:e.path,fingerprint:e.fingerprint}]:[]}function p1(e){return e.scope===`staged`||e.scope===`unstaged`}function m1(){return new Map}var h1=new WeakMap;function g1(e,t){if(!e||!t?.length||e.kind!==`text`)return e;let n=t.map(e=>`${e.startLine}-${e.endLine}`).join(`,`),r=h1.get(e),i=r?.get(n);if(i)return i;let a=kN(e.patch,t),o=a?{...e,patch:a}:e;return r??=new Map,r.set(n,o),h1.set(e,r),o}function _1(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)(Y,{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 v1(e){let t=(0,$.c)(23),{changes:n,column:r,onTarget:i,renderedPaths:a,scope:o,context:s,commentRequest:c,paneFile:l}=e,u=!r&&`mx-4`,d;t[0]===u?d=t[1]:(d=X(`mt-3 rounded-lg border bg-muted/40 px-4 py-3`,u),t[0]=u,t[1]=d);let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:`Non-text content`}),t[2]=f):f=t[2];let p;if(t[3]!==n||t[4]!==c||t[5]!==s||t[6]!==i||t[7]!==l||t[8]!==a||t[9]!==o){let e;t[11]!==c||t[12]!==s||t[13]!==i||t[14]!==l||t[15]!==a||t[16]!==o?(e=e=>{let{item:t,reasons:n}=e;return(0,Q.jsxs)(`li`,{"aria-label":`${t.path}: ${n1(n)}`,tabIndex:-1,ref:e=>i(t.path,e),className:`flex min-w-0 scroll-mt-3 flex-wrap items-center gap-2 outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,Q.jsx)(fr,{className:`min-w-0 basis-full`,text:t.path}),_w(t.path)&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:`Current worktree image`}),(0,Q.jsx)(vw,{scope:o,path:t.path,connection:s.connection})]}),(0,Q.jsx)(We,{variant:`outline`,className:`h-auto max-w-full text-left whitespace-normal`,children:n1(n)}),!l&&!a.has(t.path)&&(0,Q.jsx)($Q,{scope:o,context:s,path:t.path,fingerprint:t.fingerprint,status:t.reviewStatus,compact:!!t.fingerprint}),!a.has(t.path)&&(0,Q.jsx)(y1,{scope:o,context:s,path:t.path,paneFile:l,...c===void 0?{}:{commentRequest:c}})]},t.path)},t[11]=c,t[12]=s,t[13]=i,t[14]=l,t[15]=a,t[16]=o,t[17]=e):e=t[17],p=n.map(e),t[3]=n,t[4]=c,t[5]=s,t[6]=i,t[7]=l,t[8]=a,t[9]=o,t[10]=p}else p=t[10];let m;t[18]===p?m=t[19]:(m=(0,Q.jsx)(`ul`,{className:`mt-2 flex flex-col gap-2 text-xs text-muted-foreground`,children:p}),t[18]=p,t[19]=m);let h;return t[20]!==d||t[21]!==m?(h=(0,Q.jsxs)(`section`,{className:d,children:[f,m]}),t[20]=d,t[21]=m,t[22]=h):h=t[22],h}function y1(e){let t=(0,$.c)(16),{scope:n,context:r,path:i,commentRequest:a,paneFile:o}=e,{threads:s}=UZ(n,r),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)();a!==void 0&&u!==a&&(d(a),l(!0));let f,p;if(t[0]!==c||t[1]!==r||t[2]!==o||t[3]!==i||t[4]!==n||t[5]!==s){let e;t[8]===i?e=t[9]:(e=e=>e.anchor.kind===`file`&&e.anchor.filePath===i&&!e.anchor.revision,t[8]=i,t[9]=e);let a=s.filter(e);t[10]!==o||t[11]!==i?(f=!o&&(0,Q.jsxs)(Y,{size:`xs`,variant:`ghost`,className:`h-auto max-w-full text-left whitespace-normal`,onClick:()=>l(!0),children:[`Comment on `,i]}),t[10]=o,t[11]=i,t[12]=f):f=t[12],p=(a.length>0||c)&&(0,Q.jsxs)(`div`,{className:`w-full space-y-2`,children:[a.map(e=>(0,Q.jsx)(kQ,{scope:n,context:r,thread:e},e.id)),c&&(0,Q.jsx)(lQ,{scope:n,context:r,anchor:{kind:`file`,filePath:i},onClose:()=>l(!1)})]}),t[0]=c,t[1]=r,t[2]=o,t[3]=i,t[4]=n,t[5]=s,t[6]=f,t[7]=p}else f=t[6],p=t[7];let m;return t[13]!==f||t[14]!==p?(m=(0,Q.jsxs)(Q.Fragment,{children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function b1(e){let t=(0,$.c)(22),{scope:n,context:r,item:i,active:a,onComment:o,children:s}=e,c=VZ(n,r,x1),l;t[0]!==r||t[1]!==i||t[2]!==n?(l=QQ(n,r,i),t[0]=r,t[1]=i,t[2]=n,t[3]=l):l=t[3];let u=l,d;t[4]!==c||t[5]!==u?(d=()=>c.toggle(u),t[4]=c,t[5]=u,t[6]=d):d=t[6];let f=d,p;t[7]===a?p=t[8]:(p={enabled:a,ignoreInputs:!0},t[7]=a,t[8]=p),pc(cc.toggleReviewed,f,p);let m;t[9]===a?m=t[10]:(m={enabled:a,ignoreInputs:!0},t[9]=a,t[10]=m),pc(cc.commentOnFile,o,m);let h=u.reviewed?ir:Ap,g=!u.fingerprint,_;t[11]!==h||t[12]!==g||t[13]!==u.reviewed||t[14]!==f?(_=(0,Q.jsx)(SZ,{label:`Reviewed`,variant:`outline`,icon:h,shortcut:cc.toggleReviewed,disabled:g,pressed:u.reviewed,onClick:f}),t[11]=h,t[12]=g,t[13]=u.reviewed,t[14]=f,t[15]=_):_=t[15];let v;t[16]===o?v=t[17]:(v=(0,Q.jsx)(SZ,{label:`Comment`,icon:Qf,shortcut:cc.commentOnFile,onClick:o}),t[16]=o,t[17]=v);let y;return t[18]!==s||t[19]!==_||t[20]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[_,v,s]}),t[18]=s,t[19]=_,t[20]=v,t[21]=y):y=t[21],y}function x1(e){return xc.add(e)}var S1=Z.createContext(void 0);function C1(){let e=Z.useContext(S1);if(e===void 0)throw Error(Wn(13));return e}var w1={imageLoadingStatus:()=>null},T1=Z.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,[o,s]=Z.useState(`idle`),c={imageLoadingStatus:o},l=Z.useMemo(()=>({imageLoadingStatus:o,setImageLoadingStatus:s}),[o,s]),u=$o(`span`,e,{state:c,ref:t,props:a,stateAttributesMapping:w1});return(0,Q.jsx)(S1.Provider,{value:l,children:u})});function E1(e,{referrerPolicy:t,crossOrigin:n,sizes:r,srcSet:i},a){let o=Z.useState(`idle`),s=o[1];return or(()=>{if(!a)return Co;if(!e&&!i)return s(`error`),Co;let o=!0,c=new window.Image,l=e=>()=>{o&&s(e)};return s(`loading`),c.onload=l(`loaded`),c.onerror=l(`error`),t&&(c.referrerPolicy=t),c.crossOrigin=n??null,r&&(c.sizes=r),i&&(c.srcset=i),e&&(c.src=e),c.complete&&s(c.naturalWidth>0?`loaded`:`error`),()=>{o=!1}},[a,e,i,r,n,t,s]),o}var D1={...w1,...Ot},O1=Z.forwardRef(function(e,t){let{className:n,render:r,onLoadingStatusChange:i,keepMounted:a=!1,style:o,sizes:s,srcSet:c,src:l,...u}=e,{setImageLoadingStatus:d}=C1(),[f,p]=E1(l,e,!a),m=f===`loaded`,{mounted:h,transitionStatus:g,setMounted:_}=vo(m),v=Z.useRef(null),y=Z.useRef(!0);or(()=>{if(!a)return;let e=y.current;y.current=!1;let t=v.current;if(!t)return;if(!t.complete){p(`loading`);return}let n=t.naturalWidth>0?`loaded`:`error`;p(n),n===`loaded`&&e&&_(!0)},[a,l,c,s,u.crossOrigin,u.referrerPolicy,r,p,_]);let b=a?{"data-loading":f===`loading`?``:void 0,"data-error":f===`error`?``:void 0,"aria-hidden":f!==`loaded`||void 0,onLoad(){p(`loaded`)},onError(){p(`error`)}}:void 0,x=Ie(e=>{i?.(e),d(e)});or(()=>{f!==`idle`&&x(f)},[f,x]),or(()=>()=>d(`idle`),[d]),Qt({enabled:!m,open:m,ref:v,onComplete(){m||_(!1)}});let S={imageLoadingStatus:f,transitionStatus:a&&g===`ending`?void 0:g},C=a||h,w={};s!==void 0&&(w.sizes=s),c!==void 0&&(w.srcSet=c),l!==void 0&&(w.src=l);let T=$o(`img`,e,{state:S,ref:[t,v],props:[b,u,w],stateAttributesMapping:D1,enabled:C});return C?T:null}),k1=Z.forwardRef(function(e,t){let{className:n,render:r,delay:i=0,style:a,...o}=e,{imageLoadingStatus:s}=C1(),[c,l]=Z.useState(i===0),u=ye();return Z.useEffect(()=>(i>0?u.start(i,()=>l(!0)):l(!0),u.clear),[u,i]),$o(`span`,e,{state:{imageLoadingStatus:s},ref:t,props:o,stateAttributesMapping:w1,enabled:s!==`loaded`&&(i===0||c)})});function A1({className:e,size:t=`default`,...n}){return(0,Q.jsx)(T1,{"data-slot":`avatar`,"data-size":t,className:X(`group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten`,e),...n})}function j1({className:e,...t}){return(0,Q.jsx)(O1,{"data-slot":`avatar-image`,className:X(`aspect-square size-full rounded-full object-cover`,e),...t})}function M1({className:e,...t}){return(0,Q.jsx)(k1,{"data-slot":`avatar-fallback`,className:X(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}var N1={open:Rf,draft:Bf,merged:Pf,closed:If},P1={open:`text-add-fg`,draft:`text-muted-foreground`,merged:`text-brand`,closed:`text-del-fg`};function F1(e){return N1[Lr(e)]}function I1(e){return P1[Lr(e)]}function L1(e){let t=(0,$.c)(10),{pull:n}=e,r;t[0]===n?r=t[1]:(r=Lr(n),t[0]=n,t[1]=r);let i=r,a=N1[i],o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(a,{"aria-hidden":`true`}),t[2]=a,t[3]=o);let s;t[4]===n?s=t[5]:(s=sa(n),t[4]=n,t[5]=s);let c;return t[6]!==i||t[7]!==o||t[8]!==s?(c=(0,Q.jsxs)(We,{variant:i,children:[o,s]}),t[6]=i,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function R1(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(We,{variant:`outline`,children:[(0,Q.jsx)(Ul,{"aria-hidden":`true`}),`GitHub unavailable`]}),e[0]=t):t=e[0],t}var z1={passed:(0,Q.jsx)(ir,{"aria-hidden":`true`,strokeWidth:2.5,className:`size-3 shrink-0 text-add-fg`}),running:(0,Q.jsx)(gn,{"aria-hidden":`true`,className:`size-3 shrink-0`}),failed:(0,Q.jsx)(Ht,{"aria-hidden":`true`,strokeWidth:2.5,className:`size-3 shrink-0 text-del-fg`})};function B1(e){let t=(0,$.c)(6),{tone:n,label:r,className:i}=e,a;t[0]===i?a=t[1]:(a=X(`inline-flex items-center gap-1`,i),t[0]=i,t[1]=a);let o=n!==`none`&&z1[n],s;return t[2]!==r||t[3]!==a||t[4]!==o?(s=(0,Q.jsxs)(`span`,{className:a,children:[o,r]}),t[2]=r,t[3]=a,t[4]=o,t[5]=s):s=t[5],s}function V1(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`·`}),e[0]=t):t=e[0],t}function H1(e){let t=(0,$.c)(16),{variant:n,description:r,icon:i,onClick:a,disabled:o,children:s}=e,c=o!==void 0&&o,l=i??up,u=n===`empty`?`ghost`:`outline`,d;t[0]!==r||t[1]!==c||t[2]!==a||t[3]!==u?(d=(0,Q.jsx)(Y,{type:`button`,size:`sm`,variant:u,"aria-label":r,disabled:c,onClick:a,className:`ml-auto`}),t[0]=r,t[1]=c,t[2]=a,t[3]=u,t[4]=d):d=t[4];let f;t[5]===l?f=t[6]:(f=(0,Q.jsx)(l,{"aria-hidden":`true`}),t[5]=l,t[6]=f);let p;t[7]!==s||t[8]!==d||t[9]!==f?(p=(0,Q.jsxs)(De,{render:d,children:[f,s]}),t[7]=s,t[8]=d,t[9]=f,t[10]=p):p=t[10];let m;t[11]===r?m=t[12]:(m=(0,Q.jsx)(Et,{children:r}),t[11]=r,t[12]=m);let h;return t[13]!==p||t[14]!==m?(h=(0,Q.jsxs)(dt,{children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15],h}var U1={passed:`open`,failed:`closed`,none:`outline`};function W1(e){let t=(0,$.c)(66),{reviewId:n,number:r,context:i,toolbarTarget:a,onBack:o,onFile:s}=e,c;t[0]!==i.connection||t[1]!==n?(c=H({connection:i.connection,reviewId:n}),t[0]=i.connection,t[1]=n,t[2]=c):c=t[2];let l=c,u=Rr(l),d=yr(l),p;t[3]===u?p=t[4]:(p=Ts(Te(u)),t[3]=u,t[4]=p);let m=p;if(f(u)){let e;return t[5]!==o||t[6]!==d?(e=(0,Q.jsx)(v,{description:`The pull request could not be read.`,onRetry:d,onBack:o}),t[5]=o,t[6]=d,t[7]=e):e=t[7],e}if(!m){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(dn,{label:`Loading pull request`}),t[8]=e):e=t[8],e}if(m.kind===`unavailable`){let e;return t[9]!==o||t[10]!==u.waiting||t[11]!==d||t[12]!==m.reason?(e=(0,Q.jsx)(t0,{reason:m.reason,retrying:u.waiting,onRetry:d,onBack:o}),t[9]=o,t[10]=u.waiting,t[11]=d,t[12]=m.reason,t[13]=e):e=t[13],e}if(m.kind===`not-linked`||m.pullRequest.number!==r){let e=m.kind===`not-linked`?`Pull request no longer linked`:`This review follows another pull request`,n;t[14]===o?n=t[15]:(n=(0,Q.jsx)(Y,{variant:`outline`,onClick:o,children:`Back to the review`}),t[14]=o,t[15]=n);let r;return t[16]!==e||t[17]!==n?(r=(0,Q.jsx)(me,{title:e,description:`Return to the review to see its current pull request.`,children:n}),t[16]=e,t[17]=n,t[18]=r):r=t[18],r}let h=m.pullRequest,g;t[19]!==i.connection||t[20]!==h.state||t[21]!==n?(g=h.state===`merged`||h.state===`closed`?(0,Q.jsx)(yG,{connection:i.connection,reviewId:n}):void 0,t[19]=i.connection,t[20]=h.state,t[21]=n,t[22]=g):g=t[22];let _;t[23]!==h.url||t[24]!==g||t[25]!==a?(_=(0,Q.jsx)(K1,{url:h.url,target:a,archive:g}),t[23]=h.url,t[24]=g,t[25]=a,t[26]=_):_=t[26];let y=`Pull request #${r}`,b;t[27]===h?b=t[28]:(b=(0,Q.jsx)(q1,{pull:h}),t[27]=h,t[28]=b);let x;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(`h2`,{children:`Description`}),t[29]=x):x=t[29];let S;t[30]===h.author?S=t[31]:(S=h.author&&(0,Q.jsx)(fr,{text:`by ${h.author}`}),t[30]=h.author,t[31]=S);let C;t[32]!==h.author||t[33]!==h.createdAt?(C=h.author&&h.createdAt&&(0,Q.jsx)(V1,{}),t[32]=h.author,t[33]=h.createdAt,t[34]=C):C=t[34];let w;t[35]===h.createdAt?w=t[36]:(w=h.createdAt&&(0,Q.jsx)(`time`,{dateTime:h.createdAt,children:n0(h.createdAt)}),t[35]=h.createdAt,t[36]=w);let T;t[37]!==w||t[38]!==S||t[39]!==C?(T=(0,Q.jsxs)(`div`,{className:G1,children:[x,(0,Q.jsxs)(`div`,{className:`ml-auto flex min-w-0 items-center gap-1.5 font-normal`,children:[S,C,w]})]}),t[37]=w,t[38]=S,t[39]=C,t[40]=T):T=t[40];let E;t[41]===h.description?E=t[42]:(E=h.description.trim()?(0,Q.jsx)(Bj,{text:h.description,className:`pt-3.5 text-(length:--text-prose) leading-6 wrap-anywhere text-foreground-2 [&_h1]:text-foreground [&_h2]:text-foreground [&_h3]:text-base [&_h3]:leading-6 [&_h3]:text-foreground [&_code]:text-ui [&_code]:leading-5 [&_p]:leading-6 [&_p]:mt-1 [&_p]:mb-0 [&_ul]:mt-2 [&_ul]:mb-0 [&_ol]:mt-2 [&_ol]:mb-0 [&_li]:my-0 [&_h1]:mb-0 [&_h2]:mb-0 [&_h3]:mb-0 [&_h1]:tracking-pr-subheading [&_h2]:tracking-pr-subheading [&_h3]:tracking-pr-subheading [&_code]:rounded-sm [&_code]:px-1.25 [&_code]:py-px [&_code]:ring-1 [&_code]:ring-border [&_code]:ring-inset`}):(0,Q.jsx)(`p`,{className:`pt-3.5 text-ui text-muted-foreground`,children:`No description provided.`}),t[41]=h.description,t[42]=E);let D;t[43]!==T||t[44]!==E?(D=(0,Q.jsxs)(`section`,{"aria-label":`Description`,children:[T,E]}),t[43]=T,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==o||t[47]!==s||t[48]!==h?(O=(0,Q.jsx)(Y1,{pull:h,onBack:o,onFile:s}),t[46]=o,t[47]=s,t[48]=h,t[49]=O):O=t[49];let k;t[50]!==D||t[51]!==O?(k=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[D,O]}),t[50]=D,t[51]=O,t[52]=k):k=t[52];let A;t[53]===h?A=t[54]:(A=(0,Q.jsx)(`aside`,{"aria-label":`Checks and details`,className:`min-w-0 shrink-0 @min-4xl/pr:w-68`,children:(0,Q.jsx)($1,{pull:h})}),t[53]=h,t[54]=A);let j;t[55]!==k||t[56]!==A?(j=(0,Q.jsxs)(`div`,{className:`mt-7 flex min-w-0 flex-col gap-x-11 gap-y-7 @min-4xl/pr:flex-row`,children:[k,A]}),t[55]=k,t[56]=A,t[57]=j):j=t[57];let M;t[58]!==u.waiting||t[59]!==j||t[60]!==y||t[61]!==b?(M=(0,Q.jsxs)(`article`,{"aria-busy":u.waiting,"aria-label":y,className:`mx-auto w-full max-w-280 min-w-0 px-4 pt-9 pb-12 text-ui @min-3xl/pr:px-7`,children:[b,j]}),t[58]=u.waiting,t[59]=j,t[60]=y,t[61]=b,t[62]=M):M=t[62];let N;return t[63]!==M||t[64]!==_?(N=(0,Q.jsxs)(`div`,{className:`@container/pr flex min-h-0 min-w-0 flex-1 flex-col overflow-auto`,children:[_,M]}),t[63]=M,t[64]=_,t[65]=N):N=t[65],N}var G1=`flex min-h-6 min-w-0 flex-wrap items-center gap-x-2 gap-y-1 border-b pb-1.5 text-xs leading-4 font-medium text-muted-foreground`;function K1(e){let t=(0,$.c)(21),{url:n,target:r,archive:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(Y,{variant:`ghost`,size:`sm`,nativeButton:!1,render:(0,Q.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`}),"aria-label":`Open on GitHub`,className:``}),t[0]=n,t[1]=a);let o=r!==void 0&&`hidden @min-3xl/pane:inline`,s;t[2]===o?s=t[3]:(s=X(o),t[2]=o,t[3]=s);let c;t[4]===s?c=t[5]:(c=(0,Q.jsx)(`span`,{className:s,children:`Open on GitHub`}),t[4]=s,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(Ft,{"aria-hidden":`true`,className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==a||t[8]!==c?(u=(0,Q.jsxs)(De,{render:a,children:[c,l]}),t[7]=a,t[8]=c,t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Et,{children:`Open on GitHub`}),t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,Q.jsxs)(dt,{children:[u,d]}),t[11]=u,t[12]=f);let p;t[13]!==i||t[14]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[i,f]}),t[13]=i,t[14]=f,t[15]=p):p=t[15];let m=p;if(r!==void 0){let e;return t[16]!==m||t[17]!==r?(e=r?(0,od.createPortal)(m,r):null,t[16]=m,t[17]=r,t[18]=e):e=t[18],e}let h;return t[19]===m?h=t[20]:(h=(0,Q.jsx)(`div`,{className:`flex h-12 shrink-0 items-center justify-end border-b px-3`,children:m}),t[19]=m,t[20]=h),h}function q1(e){let t=(0,$.c)(53),{pull:n}=e,r;t[0]===n.url?r=t[1]:(r=ka(n.url)?.split(`/`).at(-1),t[0]=n.url,t[1]=r);let i=r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Rf,{"aria-hidden":`true`,strokeWidth:1.75,className:`size-3.5 shrink-0`}),o=(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Pull request`}),t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===i?s=t[5]:(s=i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(V1,{}),(0,Q.jsx)(fr,{text:i})]}),t[4]=i,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,Q.jsxs)(`div`,{className:`flex h-5.5 min-w-0 items-center gap-2 text-ui leading-5.5 font-medium text-muted-foreground`,children:[a,o,s]}),t[6]=s,t[7]=c);let l;t[8]===n.number?l=t[9]:(l=(0,Q.jsxs)(`span`,{className:`text-title-dim tabular-nums`,children:[`#`,n.number]}),t[8]=n.number,t[9]=l);let u;t[10]!==n.title||t[11]!==l?(u=(0,Q.jsxs)(`h1`,{className:`mt-3 text-4xl leading-10 font-semibold tracking-pr-title wrap-anywhere`,children:[l,` `,n.title]}),t[10]=n.title,t[11]=l,t[12]=u):u=t[12];let d;t[13]===n?d=t[14]:(d=(0,Q.jsx)(L1,{pull:n}),t[13]=n,t[14]=d);let f;t[15]!==n.author||t[16]!==n.authorAvatarUrl?(f=n.author&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X1,{author:n.author,url:n.authorAvatarUrl}),(0,Q.jsx)(fr,{text:n.author,className:`font-medium text-foreground`}),(0,Q.jsx)(V1,{})]}),t[15]=n.author,t[16]=n.authorAvatarUrl,t[17]=f):f=t[17];let p;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex max-w-full min-w-0 items-center gap-1.5 font-mono text-caption text-foreground outline-none`}),t[18]=p):p=t[18];let m;t[19]===n.baseBranch?m=t[20]:(m=(0,Q.jsx)(fr,{text:n.baseBranch}),t[19]=n.baseBranch,t[20]=m);let h;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(hd,{"aria-hidden":`true`,strokeWidth:1.75,className:`size-3 shrink-0 text-muted-foreground`}),t[21]=h):h=t[21];let g;t[22]===n.headBranch?g=t[23]:(g=(0,Q.jsx)(fr,{text:n.headBranch}),t[22]=n.headBranch,t[23]=g);let _;t[24]!==m||t[25]!==g?(_=(0,Q.jsxs)(De,{render:p,children:[m,h,g]}),t[24]=m,t[25]=g,t[26]=_):_=t[26];let v;t[27]!==n.baseBranch||t[28]!==n.headBranch?(v=(0,Q.jsxs)(Et,{children:[`Merges `,n.headBranch,` into `,n.baseBranch]}),t[27]=n.baseBranch,t[28]=n.headBranch,t[29]=v):v=t[29];let y;t[30]!==_||t[31]!==v?(y=(0,Q.jsxs)(dt,{children:[_,v]}),t[30]=_,t[31]=v,t[32]=y):y=t[32];let b;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(V1,{}),t[33]=b):b=t[33];let x;t[34]===n.updatedAt?x=t[35]:(x=n0(n.updatedAt),t[34]=n.updatedAt,t[35]=x);let S;t[36]===x?S=t[37]:(S=(0,Q.jsxs)(`span`,{children:[`updated `,x]}),t[36]=x,t[37]=S);let C;t[38]===n?C=t[39]:(C=n.matchesReviewHead?(0,Q.jsxs)(dt,{children:[(0,Q.jsxs)(De,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1.5 text-foreground outline-none @min-4xl/pr:ml-auto`}),children:[(0,Q.jsx)(ir,{"aria-hidden":`true`,strokeWidth:2.25,className:`size-3.5 text-add-fg`}),io(n)]}),(0,Q.jsxs)(Et,{children:[`The pull request’s head, `,GK(n.headSha),`, is the commit this review reads`]})]}):(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-warn @min-4xl/pr:ml-auto`,children:[(0,Q.jsx)(Ul,{"aria-hidden":`true`,className:`size-3.5`}),io(n)]}),t[38]=n,t[39]=C);let w;t[40]!==y||t[41]!==S||t[42]!==C||t[43]!==d||t[44]!==f?(w=(0,Q.jsxs)(`div`,{className:`mt-3.5 flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-2 text-ui leading-5 text-muted-foreground`,children:[d,f,y,b,S,C]}),t[40]=y,t[41]=S,t[42]=C,t[43]=d,t[44]=f,t[45]=w):w=t[45];let T;t[46]===n.labels?T=t[47]:(T=n.labels.length>0&&(0,Q.jsx)(`ul`,{"aria-label":`Labels`,className:`mt-3 flex min-w-0 flex-wrap gap-1.5`,children:n.labels.map(J1)}),t[46]=n.labels,t[47]=T);let E;return t[48]!==w||t[49]!==T||t[50]!==c||t[51]!==u?(E=(0,Q.jsxs)(`header`,{className:`min-w-0`,children:[c,u,w,T]}),t[48]=w,t[49]=T,t[50]=c,t[51]=u,t[52]=E):E=t[52],E}function J1(e,t){return(0,Q.jsx)(`li`,{className:`min-w-0 max-w-full`,children:(0,Q.jsx)(We,{variant:`outline`,className:`max-w-full`,children:(0,Q.jsx)(fr,{text:e.name})})},`${e.name}:${t}`)}function Y1(e){let t=(0,$.c)(23),{pull:n,onBack:r,onFile:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`h2`,{children:`Conversation`}),t[0]=a):a=t[0];let o;t[1]===n.timeline.length?o=t[2]:(o=(0,Q.jsx)(`span`,{className:`font-normal tabular-nums`,children:n.timeline.length}),t[1]=n.timeline.length,t[2]=o);let s=`${n.url}#issue-comment-box`,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(ve,{"aria-hidden":`true`,className:`size-3 shrink-0`}),t[3]=c):c=t[3];let l,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsxs)(`span`,{children:[`Comments on GitHub ·`,` `,(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:`reply there`})]}),u=(0,Q.jsx)(Ft,{"aria-hidden":`true`,className:`size-3 shrink-0`}),t[4]=l,t[5]=u):(l=t[4],u=t[5]);let d;t[6]===s?d=t[7]:(d=(0,Q.jsxs)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,className:`ml-auto inline-flex max-w-full min-w-0 flex-wrap items-center gap-1 font-normal outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[c,l,u]}),t[6]=s,t[7]=d);let f;t[8]!==o||t[9]!==d?(f=(0,Q.jsxs)(`div`,{className:G1,children:[a,o,d]}),t[8]=o,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==i||t[12]!==n.timeline?(p=n.timeline.length>0?(0,Q.jsx)(`ol`,{"aria-label":`Timeline`,className:`relative mt-3.5 flex min-w-0 flex-col gap-4 before:absolute before:top-4 before:bottom-2.5 before:left-2.5 before:w-px before:bg-border`,children:ba(n.timeline).map(e=>{let{item:t,comments:n}=e;return(0,Q.jsx)(Z1,{item:t,onFile:i,children:n.length>0&&(0,Q.jsx)(`ol`,{"aria-label":`Comments on review by ${t.author??`Unknown author`}`,className:`mt-3 flex min-w-0 flex-col gap-3 border-l pl-3`,children:n.map(e=>(0,Q.jsx)(Z1,{item:e,onFile:i},e.id))})},t.id)})}):(0,Q.jsx)(`p`,{className:`pt-3.5 text-ui text-muted-foreground`,children:`No comments or reviews on GitHub yet.`}),t[11]=i,t[12]=n.timeline,t[13]=p):p=t[13];let m;t[14]===n.truncated?m=t[15]:(m=n.truncated&&(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Some labels or conversation items are not shown. Open on GitHub to see everything.`}),t[14]=n.truncated,t[15]=m);let h;t[16]===r?h=t[17]:(h=(0,Q.jsxs)(`p`,{className:`mt-4 flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs leading-4 text-muted-foreground @min-3xl/pr:ml-7.5`,children:[`Comments to the agent stay in the review.`,(0,Q.jsx)(Y,{variant:`link`,size:`sm`,onClick:r,children:`Back to the review`})]}),t[16]=r,t[17]=h);let g;return t[18]!==m||t[19]!==h||t[20]!==f||t[21]!==p?(g=(0,Q.jsxs)(`section`,{"aria-label":`Conversation on GitHub`,className:`mt-7 min-w-0`,children:[f,p,m,h]}),t[18]=m,t[19]=h,t[20]=f,t[21]=p,t[22]=g):g=t[22],g}function X1(e){let t=(0,$.c)(9),{author:n,url:r}=e,i;t[0]===r?i=t[1]:(i=r&&(0,Q.jsx)(j1,{src:r,alt:``}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=n.slice(0,1).toUpperCase(),t[2]=n,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Q.jsx)(M1,{children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,Q.jsxs)(A1,{size:`sm`,"aria-hidden":`true`,children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function Z1(e){let t=(0,$.c)(51),{item:n,onFile:r,children:i}=e,{dark:a}=Zs(),o;t[0]===n.reviewState?o=t[1]:(o=jo(n.reviewState),t[0]=n.reviewState,t[1]=o);let s=o,c=n.author??`Unknown author`,l=n.line??n.originalLine,u=n.path,d=n.path===void 0?void 0:`${n.path}${l===void 0?``:`:${l}`}`,f;t[2]!==c||t[3]!==n.authorAvatarUrl?(f=(0,Q.jsx)(`div`,{className:`z-1 shrink-0 bg-background`,children:(0,Q.jsx)(X1,{author:c,url:n.authorAvatarUrl})}),t[2]=c,t[3]=n.authorAvatarUrl,t[4]=f):f=t[4];let p;t[5]===c?p=t[6]:(p=(0,Q.jsx)(fr,{text:c,className:`text-ui leading-4.5 font-semibold text-foreground`}),t[5]=c,t[6]=p);let m;t[7]===s?m=t[8]:(m=s&&(0,Q.jsx)(We,{variant:U1[s.tone],children:s.label}),t[7]=s,t[8]=m);let h=!s&&n.kind===`comment`?`commented · `:``,g;t[9]===n.time?g=t[10]:(g=n0(n.time),t[9]=n.time,t[10]=g);let _;t[11]!==h||t[12]!==g?(_=(0,Q.jsxs)(`span`,{children:[h,g]}),t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]===n.url?v=t[15]:(v=(0,Q.jsx)(`a`,{href:n.url,target:`_blank`,rel:`noreferrer`}),t[14]=n.url,t[15]=v);let y=`Open this ${n.kind===`review`?`review`:`comment`} on GitHub`,b;t[16]!==v||t[17]!==y?(b=(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-sm`,nativeButton:!1,render:v,"aria-label":y,className:`ml-auto`}),t[16]=v,t[17]=y,t[18]=b):b=t[18];let x;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(Ft,{"aria-hidden":`true`,className:`size-3`}),t[19]=x):x=t[19];let S;t[20]===b?S=t[21]:(S=(0,Q.jsx)(De,{render:b,children:x}),t[20]=b,t[21]=S);let C;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(Et,{children:`Open on GitHub`}),t[22]=C):C=t[22];let w;t[23]===S?w=t[24]:(w=(0,Q.jsxs)(dt,{children:[S,C]}),t[23]=S,t[24]=w);let T;t[25]!==w||t[26]!==p||t[27]!==m||t[28]!==_?(T=(0,Q.jsxs)(`div`,{className:`flex min-h-5 min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs leading-4 text-muted-foreground`,children:[p,m,_,w]}),t[25]=w,t[26]=p,t[27]=m,t[28]=_,t[29]=T):T=t[29];let E;t[30]!==d||t[31]!==n.path||t[32]!==r||t[33]!==u?(E=d&&(0,Q.jsxs)(`div`,{className:`mt-2.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 rounded-t-lg border bg-muted px-2 py-1.5`,children:[r&&n.path!==void 0?(0,Q.jsxs)(Y,{variant:`ghost`,size:`sm`,"aria-label":`Open ${d}`,className:`max-w-full min-w-0 justify-start`,onClick:()=>{u!==void 0&&r(u)},children:[(0,Q.jsx)(rf,{"aria-hidden":`true`}),(0,Q.jsx)(fr,{text:d})]}):(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-xs`,children:[(0,Q.jsx)(rf,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(fr,{text:d})]}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`review comment`})]}),t[30]=d,t[31]=n.path,t[32]=r,t[33]=u,t[34]=E):E=t[34];let D;t[35]!==a||t[36]!==n.diffHunk||t[37]!==u?(D=n.diffHunk&&(0,Q.jsx)(`div`,{role:`region`,"aria-label":`Code excerpt for ${u??`review comment`}`,className:`max-h-64 min-w-0 overflow-auto border-x`,children:(0,Q.jsx)(FA,{file:{name:u??`review.diff`,contents:n.diffHunk,lang:`diff`},options:{theme:Su,themeType:a?`dark`:`light`,disableFileHeader:!0,disableLineNumbers:!0,overflow:`wrap`}})}),t[35]=a,t[36]=n.diffHunk,t[37]=u,t[38]=D):D=t[38];let O;t[39]!==d||t[40]!==n.body?(O=n.body.trim()&&(0,Q.jsx)(Bj,{text:n.body,className:X(`mt-1 text-sm leading-5.5 wrap-anywhere [&_p]:my-0 [&_p]:leading-5.5`,d&&`mt-0 rounded-b-lg border border-t-0 px-3 py-2.5 text-ui [&_p]:leading-4.75`)}),t[39]=d,t[40]=n.body,t[41]=O):O=t[41];let k;t[42]!==i||t[43]!==T||t[44]!==E||t[45]!==D||t[46]!==O?(k=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[T,E,D,O,i]}),t[42]=i,t[43]=T,t[44]=E,t[45]=D,t[46]=O,t[47]=k):k=t[47];let A;return t[48]!==k||t[49]!==f?(A=(0,Q.jsxs)(`li`,{className:`relative flex min-w-0 items-start gap-2.5`,children:[f,k]}),t[48]=k,t[49]=f,t[50]=A):A=t[50],A}var Q1={passed:{Icon:zl,label:`Passed`,color:`text-add-fg`},failed:{Icon:Vd,label:`Failed`,color:`text-del-fg`},running:{Icon:gn,label:`Running`,color:`text-muted-foreground`}};function $1(e){let t=(0,$.c)(34),{pull:n}=e,r;t[0]!==n.checks||t[1]!==n.checksSummary||t[2]!==n.checksTruncated?(r=So(n.checks,n.checksTruncated,n.checksSummary),t[0]=n.checks,t[1]=n.checksSummary,t[2]=n.checksTruncated,t[3]=r):r=t[3];let i=r,a;t[4]===n.mergeable?a=t[5]:(a=Fi(n.mergeable),t[4]=n.mergeable,t[5]=a);let o=a,s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(`h2`,{children:`Checks`}),t[6]=s):s=t[6];let c=i.tone===`passed`?`${n.checks.length}${n.checksTruncated?`+`:``} passed`:i.label,l;t[7]!==i.tone||t[8]!==c?(l=(0,Q.jsxs)(`div`,{className:G1,children:[s,(0,Q.jsx)(B1,{tone:i.tone,label:c,className:`ml-auto text-foreground tabular-nums`})]}),t[7]=i.tone,t[8]=c,t[9]=l):l=t[9];let u;t[10]===n.checks?u=t[11]:(u=n.checks.length===0?(0,Q.jsx)(`p`,{className:`pt-3 text-ui text-muted-foreground`,children:`No checks reported by GitHub.`}):(0,Q.jsx)(`ul`,{className:`mt-1`,"aria-label":`Pull request checks`,children:n.checks.map(e0)}),t[10]=n.checks,t[11]=u);let d;t[12]===n.checksTruncated?d=t[13]:(d=n.checksTruncated&&(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`More checks are available on GitHub.`}),t[12]=n.checksTruncated,t[13]=d);let f;t[14]!==l||t[15]!==u||t[16]!==d?(f=(0,Q.jsxs)(`section`,{"aria-label":`GitHub checks`,children:[l,u,d]}),t[14]=l,t[15]=u,t[16]=d,t[17]=f):f=t[17];let p;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Head`}),t[18]=p):p=t[18];let m=n.headSha,h;t[19]===n.headSha?h=t[20]:(h=GK(n.headSha),t[19]=n.headSha,t[20]=h);let g;t[21]!==n.headSha||t[22]!==h?(g=(0,Q.jsxs)(`div`,{className:`flex h-7 min-w-0 items-center gap-2`,children:[p,(0,Q.jsx)(`dd`,{className:`ml-auto min-w-0 font-mono text-caption font-medium`,children:(0,Q.jsx)(fr,{text:m,disclose:`always`,children:h})})]}),t[21]=n.headSha,t[22]=h,t[23]=g):g=t[23];let _;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Mergeable`}),t[24]=_):_=t[24];let v;t[25]!==o.label||t[26]!==o.tone?(v=(0,Q.jsxs)(`div`,{className:`flex h-7 items-center gap-2 border-t`,children:[_,(0,Q.jsx)(`dd`,{className:`ml-auto font-medium`,children:(0,Q.jsx)(B1,{tone:o.tone,label:o.label,className:`gap-1.5`})})]}),t[25]=o.label,t[26]=o.tone,t[27]=v):v=t[27];let y;t[28]!==g||t[29]!==v?(y=(0,Q.jsxs)(`dl`,{"aria-label":`Merge`,className:`mt-5 border-y text-ui leading-4.5`,children:[g,v]}),t[28]=g,t[29]=v,t[30]=y):y=t[30];let b;return t[31]!==y||t[32]!==f?(b=(0,Q.jsxs)(Q.Fragment,{children:[f,y]}),t[31]=y,t[32]=f,t[33]=b):b=t[33],b}function e0(e,t){let n=ti(e),r=i(e.durationMs),a=Q1[n],o=a.Icon;return(0,Q.jsxs)(`li`,{className:`flex h-7 min-w-0 items-center gap-2 text-ui leading-4.5`,children:[(0,Q.jsx)(o,{role:`img`,"aria-label":a.label,className:X(`size-3.5 shrink-0`,a.color)}),(0,Q.jsx)(fr,{text:e.name,className:`min-w-0 flex-1`}),r&&(0,Q.jsx)(`span`,{className:`shrink-0 text-xs leading-4 text-muted-foreground tabular-nums`,children:r}),e.detailsUrl&&(0,Q.jsxs)(dt,{children:[(0,Q.jsxs)(De,{render:(0,Q.jsx)(`a`,{href:e.detailsUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Details for ${e.name} on GitHub`,className:Do({variant:`ghost`,size:`sm`})}),children:[`Details`,(0,Q.jsx)(Ft,{"aria-hidden":`true`,className:`size-2.75`})]}),(0,Q.jsxs)(Et,{children:[`Details for `,e.name,` on GitHub`]})]})]},`${e.name}:${t}`)}function t0(e){let t=(0,$.c)(28),{reason:n,retrying:r,onRetry:i,onBack:a}=e,o=xi(),s;t[0]===n?s=t[1]:(s=Mt(n),t[0]=n,t[1]=s);let{description:c,action:l}=s,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(R1,{}),t[2]=u):u=t[2];let d;t[3]!==l.kind||t[4]!==l.label||t[5]!==o?(d=l.kind===`settings`&&(0,Q.jsxs)(Y,{variant:`outline`,onClick:()=>void o({to:`/settings/$section`,params:{section:`git`}}),children:[(0,Q.jsx)(bp,{}),l.label]}),t[3]=l.kind,t[4]=l.label,t[5]=o,t[6]=d):d=t[6];let f;t[7]!==l.kind||t[8]!==l.label||t[9]!==l.url?(f=l.kind===`install`&&(0,Q.jsxs)(Y,{variant:`outline`,nativeButton:!1,render:(0,Q.jsx)(`a`,{href:l.url,target:`_blank`,rel:`noreferrer`}),children:[(0,Q.jsx)(Ft,{}),l.label]}),t[7]=l.kind,t[8]=l.label,t[9]=l.url,t[10]=f):f=t[10];let p;t[11]!==l.kind||t[12]!==l.label||t[13]!==l.text?(p=l.kind===`copy`&&(0,Q.jsxs)(Y,{variant:`outline`,onClick:()=>Yi(l.text,`command`),children:[(0,Q.jsx)(He,{}),l.label]}),t[11]=l.kind,t[12]=l.label,t[13]=l.text,t[14]=p):p=t[14];let m;t[15]!==l.kind||t[16]!==i||t[17]!==r?(m=l.kind!==`install`&&(0,Q.jsx)(Y,{variant:`outline`,disabled:r,onClick:i,children:`Try again`}),t[15]=l.kind,t[16]=i,t[17]=r,t[18]=m):m=t[18];let h;t[19]===a?h=t[20]:(h=(0,Q.jsx)(Y,{variant:`ghost`,onClick:a,children:`Back to the review`}),t[19]=a,t[20]=h);let g;return t[21]!==c||t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==m||t[26]!==h?(g=(0,Q.jsxs)(me,{title:`Pull request unavailable`,description:c,children:[u,d,f,p,m,h]}),t[21]=c,t[22]=d,t[23]=f,t[24]=p,t[25]=m,t[26]=h,t[27]=g):g=t[27],g}function n0(e){return Number.isFinite(Date.parse(e))?Xa(e):`unknown time`}var r0=qn(ge.check(Bn(Ct)));function i0(e,t,n){return{to:`/reviews/$reviewId`,params:{reviewId:e.reviewId},search:{environment:e.environmentId===t?void 0:e.environmentId,entry:rq(n),decision:void 0}}}function a0(e){return{entry:r0(e.entry)?e.entry:void 0,side:r0(e.side)?e.side:void 0,decision:typeof e.decision==`string`?e.decision:void 0,environment:typeof e.environment==`string`?e.environment:void 0}}function o0(e){let t=(0,$.c)(51),{scope:n,context:r,document:i,onOpen:a,onBrowse:o,sideLabel:s,active:c,reveal:l,base:u,toolbarTarget:d,handoff:f}=e,p=c!==void 0&&c,m=n.worktreeId,h;t[0]===i?h=t[1]:(h=rq(i),t[0]=i,t[1]=h);let g;t[2]!==p||t[3]!==l||t[4]!==n.worktreeId||t[5]!==h||t[6]!==d?(g={toolbarTarget:d,active:p,worktreeId:m,entry:h,reveal:l},t[2]=p,t[3]=l,t[4]=n.worktreeId,t[5]=h,t[6]=d,t[7]=g):g=t[7];let _;t[8]!==r||t[9]!==o||t[10]!==a||t[11]!==n||t[12]!==s||t[13]!==g?(_={scope:n,context:r,onOpen:a,onBrowse:o,sideLabel:s,interaction:g},t[8]=r,t[9]=o,t[10]=a,t[11]=n,t[12]=s,t[13]=g,t[14]=_):_=t[14];let v=_;switch(i.kind){case`handoff`:{let e;return t[15]!==f||t[16]!==v?(e=f?(0,Q.jsx)(f,{...v}):null,t[15]=f,t[16]=v,t[17]=e):e=t[17],e}case`all-changes`:{let e;return t[18]===v?e=t[19]:(e=(0,Q.jsx)(p0,{...v}),t[18]=v,t[19]=e),e}case`specs`:{let e;return t[20]===v?e=t[21]:(e=(0,Q.jsx)(p0,{...v,specsOnly:!0}),t[20]=v,t[21]=e),e}case`change`:{let e;return t[22]!==i.path||t[23]!==v?(e=(0,Q.jsx)(y0,{...v,path:i.path}),t[22]=i.path,t[23]=v,t[24]=e):e=t[24],e}case`review-file`:case`review-change`:{let e;return t[25]!==i||t[26]!==v?(e=(0,Q.jsx)(F$,{...v,document:i}),t[25]=i,t[26]=v,t[27]=e):e=t[27],e}case`file`:{let e;return t[28]!==i.path||t[29]!==v?(e=(0,Q.jsx)(H$,{...v,path:i.path}),t[28]=i.path,t[29]=v,t[30]=e):e=t[30],e}case`commit`:{let e;return t[31]!==i.oid||t[32]!==v?(e=(0,Q.jsx)(g$,{...v,oid:i.oid}),t[31]=i.oid,t[32]=v,t[33]=e):e=t[33],e}case`branch`:{let e;return t[34]!==u||t[35]!==v?(e=(0,Q.jsx)(s$,{...v,base:u}),t[34]=u,t[35]=v,t[36]=e):e=t[36],e}case`branch-file`:{let e;return t[37]!==u||t[38]!==i.path||t[39]!==v?(e=(0,Q.jsx)(c$,{...v,base:u,path:i.path}),t[37]=u,t[38]=i.path,t[39]=v,t[40]=e):e=t[40],e}case`timeline`:{let e;return t[41]!==i.path||t[42]!==v?(e=(0,Q.jsx)(u0,{...v,path:i.path}),t[41]=i.path,t[42]=v,t[43]=e):e=t[43],e}case`graph`:{let e;return t[44]===v?e=t[45]:(e=(0,Q.jsx)(l0,{...v}),t[44]=v,t[45]=e),e}case`pull-request`:{let e;return t[46]!==r||t[47]!==i||t[48]!==a||t[49]!==d?(e=(0,Q.jsx)(s0,{document:i,context:r,toolbarTarget:d,onOpen:a}),t[46]=r,t[47]=i,t[48]=a,t[49]=d,t[50]=e):e=t[50],e}}}function s0(e){let t=(0,$.c)(23),{document:n,context:r,toolbarTarget:i,onOpen:a}=e,o=Qo(),s=L(),c=xi(),l;t[0]!==r||t[1]!==n.environmentId||t[2]!==o||t[3]!==s?(l=n.environmentId===void 0?r.connection:[o.connection,...s.map(c0)].find(e=>e.environmentId===n.environmentId),t[0]=r,t[1]=n.environmentId,t[2]=o,t[3]=s,t[4]=l):l=t[4];let u=l;if(!u){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(me,{title:`Computer not paired`,description:`Pair this pull request's computer in Settings to read it.`}),t[5]=e):e=t[5],e}let d;t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==a?(d=e=>{n.environmentId===void 0?a(e):c(i0(n,o.connection.environmentId,e))},t[6]=n,t[7]=o,t[8]=c,t[9]=a,t[10]=d):d=t[10];let f=d,p;t[11]===u?p=t[12]:(p={connection:u},t[11]=u,t[12]=p);let m,h;t[13]===f?(m=t[14],h=t[15]):(m=()=>f({kind:`handoff`}),h=e=>f({kind:`file`,path:e}),t[13]=f,t[14]=m,t[15]=h);let g;return t[16]!==n.number||t[17]!==n.reviewId||t[18]!==p||t[19]!==m||t[20]!==h||t[21]!==i?(g=(0,Q.jsx)(W1,{reviewId:n.reviewId,number:n.number,context:p,toolbarTarget:i,onBack:m,onFile:h}),t[16]=n.number,t[17]=n.reviewId,t[18]=p,t[19]=m,t[20]=h,t[21]=i,t[22]=g):g=t[22],g}function c0(e){return e.connection}function l0(e){let t=(0,$.c)(7),{scope:n,context:r,onOpen:i,sideLabel:a}=e,o;t[0]===i?o=t[1]:(o=(e,t)=>i({kind:`commit`,oid:e},void 0,{toSide:t===!0}),t[0]=i,t[1]=o);let s;return t[2]!==r.connection||t[3]!==n||t[4]!==a||t[5]!==o?(s=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Q.jsx)(bY,{scope:n,connection:r.connection,sideLabel:a,onSelect:o})}),t[2]=r.connection,t[3]=n,t[4]=a,t[5]=o,t[6]=s):s=t[6],s}function u0(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)(gp,{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)(fr,{text:i})]}),t[1]=i,t[2]=l);let u;t[3]!==s||t[4]!==l?(u=(0,Q.jsx)(XQ,{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)(SY,{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 d0(e){let t=(0,$.c)(14),{scope:n,context:r,branch:i}=e,a=qP(r.connection),o;if(t[0]!==n||t[1]!==a.projects){let e;t[3]===n?e=t[4]:(e=e=>e.id===n.projectId,t[3]=n,t[4]=e),o=a.projects.find(e),t[0]=n,t[1]=a.projects,t[2]=o}else o=t[2];let s=o?.name,c;t[5]!==i||t[6]!==s?(c=[i,s].filter(Boolean),t[5]=i,t[6]=s,t[7]=c):c=t[7];let l=c.join(` · `),u;t[8]===l?u=t[9]:(u=l&&(0,Q.jsx)(`div`,{className:`text-ui leading-5.5 font-medium text-muted-foreground`,children:(0,Q.jsx)(fr,{text:l,className:`block min-w-0`})}),t[8]=l,t[9]=u);let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`h2`,{className:`text-4xl not-first:mt-3.5 font-semibold tracking-title`,children:`No review yet`}),t[10]=d):d=t[10];let f;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(`p`,{className:`mt-4 max-w-180 text-lg leading-7 tracking-lead text-foreground-2`,children:[`The agent has not published a review for this worktree. Ask it to publish one (it calls`,` `,(0,Q.jsx)(`code`,{className:`font-mono text-base leading-7 text-foreground`,children:`publish_review`}),` `,`through Porcelain’s MCP server), or read the changes below.`]}),t[11]=f):f=t[11];let p;return t[12]===u?p=t[13]:(p=(0,Q.jsxs)(`header`,{className:`flex min-w-0 flex-col pb-9`,children:[u,d,f]}),t[12]=u,t[13]=p),p}function f0(e,t){return Kr(t,e?`uncommitted spec change`:`uncommitted change`)}function p0(e){let t=(0,$.c)(44),{scope:n,context:r,interaction:i,onBrowse:a,specsOnly:o,intro:s}=e,c=o!==void 0&&o,l=s!==void 0&&s,[u,d]=(0,Z.useState)(!1),{connection:f}=r;wZ(n,r);let p=zs(r.connection),m=nP(n,f),h=TZ(n,r,m),g=dZ(n,r),_=!c&&g.review?.active?g.review:void 0,v;t[0]!==h||t[1]!==c?(v=c?h.filter(v0):h,t[0]=h,t[1]=c,t[2]=v):v=t[2];let y=v;if(!c&&y.length===0&&u&&d(!1),!c&&y.length===0){let e=m.branch?.name??`This worktree`,n;t[3]===e?n=t[4]:(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`font-mono text-foreground`,children:e}),` `,`matches its last commit. Browse files or history from the right.`]}),t[3]=e,t[4]=n);let r;t[5]===a?r=t[6]:(r=e=>a(`files`,e.currentTarget),t[5]=a,t[6]=r);let i;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(gI,{children:Ks(cc.surfaceFiles)}),t[7]=i):i=t[7];let o;t[8]===r?o=t[9]:(o=(0,Q.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:r,children:[`Files `,i]}),t[8]=r,t[9]=o);let s;t[10]===a?s=t[11]:(s=e=>a(`history`,e.currentTarget),t[10]=a,t[11]=s);let c;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(gI,{children:Ks(cc.surfaceHistory)}),t[12]=c):c=t[12];let l;t[13]===s?l=t[14]:(l=(0,Q.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:s,children:[`History `,c]}),t[13]=s,t[14]=l);let u;return t[15]!==l||t[16]!==n||t[17]!==o?(u=(0,Q.jsx)(`div`,{className:`mx-auto w-full max-w-xl`,children:(0,Q.jsxs)(me,{title:`No changes to review`,description:n,children:[o,l]})}),t[15]=l,t[16]=n,t[17]=o,t[18]=u):u=t[18],u}let b;t[19]!==m||t[20]!==_||t[21]!==p?(b=_?Jp(_,m.changes.map(_0),{specsApart:p}).flatMap(g0):[],t[19]=m,t[20]=_,t[21]=p,t[22]=b):b=t[22];let x=b,S;t[23]!==y||t[24]!==c?(S=c?{paths:y.map(h0)}:{},t[23]=y,t[24]=c,t[25]=S):S=t[25];let C;t[26]!==u||t[27]!==y||t[28]!==r||t[29]!==l||t[30]!==m||t[31]!==n||t[32]!==c?(C=e=>(0,Q.jsxs)(`div`,{className:l?`pt-14`:`pt-6`,children:[l&&(0,Q.jsx)(d0,{scope:n,context:r,branch:m.branch?.name}),(0,Q.jsx)(D$,{scope:n,context:r,label:f0(c,y.length),items:y,controls:e,actionsOpen:u,onActionsOpenChange:d,actions:(0,Q.jsx)(t$,{scope:n,context:r,entries:y})})]}),t[26]=u,t[27]=y,t[28]=r,t[29]=l,t[30]=m,t[31]=n,t[32]=c,t[33]=C):C=t[33];let w;t[34]!==_||t[35]!==x?(w=_?{files:x,agentNotes:kZ(..._.layers.map(m0),OZ(_.notExplained))}:{},t[34]=_,t[35]=x,t[36]=w):w=t[36];let T;return t[37]!==r||t[38]!==i||t[39]!==n||t[40]!==S||t[41]!==C||t[42]!==w?(T=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Q.jsx)(r1,{scope:n,context:r,interaction:i,...S,column:!0,header:C,...w})}),t[37]=r,t[38]=i,t[39]=n,t[40]=S,t[41]=C,t[42]=w,t[43]=T):T=t[43],T}function m0(e,t){return DZ(e,t+1)}function h0(e){return e.path}function g0(e){return e.paths.map(t=>({path:t,note:$p(e)}))}function _0(e){return e.path}function v0(e){return Wp(e.path)}function y0(e){let t=(0,$.c)(14),{scope:n,context:r,interaction:i,onOpen:a,path:o}=e,{connection:s}=r;wZ(n,r);let c=nP(n,s),l;if(t[0]===o?l=t[1]:(l=[o],t[0]=o,t[1]=l),!TZ(n,r,c,l).find(e=>e.path===o)){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(me,{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)(r1,{...i.reveal?.compose?{commentRequest:i.reveal.nonce}:{},headerActions:(0,Q.jsx)(SZ,{label:`Timeline`,iconOnly:!0,icon:gp,onClick:()=>a({kind:`timeline`,path:o})}),headerLeading:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Y,{variant:`ghost`,size:`xs`,"aria-label":`Open file`,onClick:()=>a({kind:`file`,path:o}),children:[(0,Q.jsx)(mf,{}),(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)(iJ,{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}var b0=(e,t)=>fetch(e,{...t,credentials:`same-origin`,redirect:`error`,cache:`no-store`});function x0(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 S0(e,t,n){let r=(0,$.c)(17),i,a,o;r[0]!==t.connection||r[1]!==e||r[2]!==n?(o=ri(n,t.connection.address,m()),i=Rr,a=Is({connection:t.connection,scope:e,summary:n,delivery:{url:o,transport:b0}}),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,d;if(r[6]!==s||r[7]!==o){let e=Ts(Te(s));c=s,l=e,u=o,d=e!==void 0&&x0(e),r[6]=s,r[7]=o,r[8]=c,r[9]=l,r[10]=u,r[11]=d}else c=r[8],l=r[9],u=r[10],d=r[11];let f;return r[12]!==c||r[13]!==l||r[14]!==u||r[15]!==d?(f={result:c,page:l,url:u,available:d},r[12]=c,r[13]=l,r[14]=u,r[15]=d,r[16]=f):f=r[16],f}function C0(e){let t=(0,$.c)(10),{label:n,value:r,max:i,className:a}=e,o;t[0]===a?o=t[1]:(o=X(`h-1 w-16 shrink-0 overflow-hidden rounded-full bg-border`,a),t[0]=a,t[1]=o);let s=`${i===0?0:r/i*100}%`,c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(`span`,{className:`block h-full rounded-full bg-brand`,style:{width:s}}),t[2]=s,t[3]=c);let l;return t[4]!==n||t[5]!==i||t[6]!==o||t[7]!==c||t[8]!==r?(l=(0,Q.jsx)(`span`,{role:`progressbar`,"aria-label":n,"aria-valuemin":0,"aria-valuemax":i,"aria-valuenow":r,className:o,children:c}),t[4]=n,t[5]=i,t[6]=o,t[7]=c,t[8]=r,t[9]=l):l=t[9],l}function w0(e,t){let n=(0,$.c)(6),r;n[0]!==t.connection||n[1]!==e?(r=Ic({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=xa(r.remove,i),o;return n[4]===a?o=n[5]:(o=Fj(a),n[4]=a,n[5]=o),o}function T0(e){let t=(0,$.c)(42),{reviewId:n,state:r,context:i,onDeleted:a}=e,[o,s]=(0,Z.useState)(!1),c;t[0]!==i.connection||t[1]!==n?(c=Ic({connection:i.connection,reviewId:n}),t[0]=i.connection,t[1]=n,t[2]=c):c=t[2];let[l,u]=xa(c.close),d=w0(n,i),p=d.result,m=l.waiting||p.waiting,h;t[3]===p.waiting?h=t[4]:(h=e=>{p.waiting||s(e)},t[3]=p.waiting,t[4]=h);let g;t[5]!==u||t[6]!==m||t[7]!==r?(g=r===`open`&&(0,Q.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,onClick:()=>u(),children:[(0,Q.jsx)(dd,{}),`Close review`]}),t[5]=u,t[6]=m,t[7]=r,t[8]=g):g=t[8];let _,v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(Y,{type:`button`,variant:`destructive`,size:`sm`}),v=(0,Q.jsx)(Pp,{}),t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y;t[11]===m?y=t[12]:(y=(0,Q.jsxs)(sM,{disabled:m,render:_,children:[v,`Delete review…`]}),t[11]=m,t[12]=y);let b;t[13]!==g||t[14]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex flex-col items-start`,children:[g,y]}),t[13]=g,t[14]=y,t[15]=b):b=t[15];let x;t[16]===l?x=t[17]:(x=f(l)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`The review could not be closed. Try again.`}),t[16]=l,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(dM,{children:[(0,Q.jsx)(pM,{children:`Delete review?`}),(0,Q.jsx)(mM,{children:`This permanently deletes every revision, proof asset, comment and mark owned by this review for everyone connected.`})]}),t[18]=S):S=t[18];let C;t[19]===p?C=t[20]:(C=f(p)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`The review could not be deleted. Try again.`}),t[19]=p,t[20]=C);let w;t[21]===p.waiting?w=t[22]:(w=(0,Q.jsx)(gM,{disabled:p.waiting,children:`Cancel`}),t[21]=p.waiting,t[22]=w);let T;t[23]!==d||t[24]!==a?(T=()=>{d.send(void 0,()=>{s(!1),a()})},t[23]=d,t[24]=a,t[25]=T):T=t[25];let E=p.waiting?`Deleting…`:`Delete`,D;t[26]!==p.waiting||t[27]!==T||t[28]!==E?(D=(0,Q.jsx)(Y,{variant:`destructive`,disabled:p.waiting,onClick:T,children:E}),t[26]=p.waiting,t[27]=T,t[28]=E,t[29]=D):D=t[29];let O;t[30]!==w||t[31]!==D?(O=(0,Q.jsxs)(fM,{children:[w,D]}),t[30]=w,t[31]=D,t[32]=O):O=t[32];let k;t[33]!==C||t[34]!==O?(k=(0,Q.jsxs)(uM,{children:[S,C,O]}),t[33]=C,t[34]=O,t[35]=k):k=t[35];let A;return t[36]!==o||t[37]!==k||t[38]!==h||t[39]!==b||t[40]!==x?(A=(0,Q.jsxs)(oM,{open:o,onOpenChange:h,children:[b,x,k]}),t[36]=o,t[37]=k,t[38]=h,t[39]=b,t[40]=x,t[41]=A):A=t[41],A}function E0(e){let t=(0,$.c)(67),{data:n,revision:r,context:i,onRevision:a,onDeleted:o,onBack:s}=e,c;t[0]===r?c=t[1]:(c=cm(r),t[0]=r,t[1]=c);let l=c,u=n.review?.latestRevision??r.revision,d,f,p,m,h,g,_;if(t[2]!==n.revisions||t[3]!==u||t[4]!==a||t[5]!==r.revision){let e=[...n.revisions].sort(D0);g=`Review details`,_=`flex min-w-0 flex-col gap-8 text-xs`,m=`flex flex-col`,t[13]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(O0,{children:`Revisions`}),t[13]=h):h=t[13],p=`Review revisions`,d=`flex flex-col divide-y border-y`;let i;t[14]!==u||t[15]!==a||t[16]!==r.revision?(i=e=>{let t=e.revision===u,n=e.revision===r.revision;return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":t?`Revision ${e.revision}, the latest`:`Revision ${e.revision}`,"aria-pressed":n,disabled:!a,onClick:()=>a?.(t?void 0:e.revision),className:`flex h-7.5 w-full items-center gap-2 text-left text-xs leading-4 outline-none focus-visible:ring-3 focus-visible:ring-ring/30 enabled:hover:bg-accent`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:X(`size-1.5 shrink-0 rounded-full`,t&&`bg-brand`)}),(0,Q.jsxs)(`span`,{className:X(`text-ui leading-4 tabular-nums`,n?`font-semibold`:`font-medium`),children:[`r`,e.revision]}),t&&(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Latest`}),(0,Q.jsx)(`span`,{className:`ml-auto text-muted-foreground tabular-nums`,children:Xa(e.publishedAt)})]})},e.revision)},t[14]=u,t[15]=a,t[16]=r.revision,t[17]=i):i=t[17],f=e.map(i),t[2]=n.revisions,t[3]=u,t[4]=a,t[5]=r.revision,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12];let v;t[18]!==d||t[19]!==f?(v=(0,Q.jsx)(`ol`,{className:d,children:f}),t[18]=d,t[19]=f,t[20]=v):v=t[20];let y;t[21]!==p||t[22]!==v?(y=(0,Q.jsx)(`nav`,{"aria-label":p,children:v}),t[21]=p,t[22]=v,t[23]=y):y=t[23];let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`p`,{className:`mt-2 leading-4.25 text-muted-foreground`,children:`An older revision opens as it was published. Comments carry across revisions.`}),t[24]=b):b=t[24];let x;t[25]!==y||t[26]!==m||t[27]!==h?(x=(0,Q.jsxs)(`section`,{className:m,children:[h,y,b]}),t[25]=y,t[26]=m,t[27]=h,t[28]=x):x=t[28];let S;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(O0,{children:`This review`}),t[29]=S):S=t[29];let C=r.branch,w;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),t[30]=w):w=t[30];let T;t[31]===r.base?T=t[32]:(T=KK(r.base),t[31]=r.base,t[32]=T);let E;t[33]!==r.branch||t[34]!==T?(E=(0,Q.jsxs)(`p`,{className:`font-mono wrap-anywhere`,children:[C,` `,w,` `,T]}),t[33]=r.branch,t[34]=T,t[35]=E):E=t[35];let D;t[36]===l.header.shortHead?D=t[37]:(D=(0,Q.jsx)(`span`,{className:`font-mono text-foreground`,children:l.header.shortHead}),t[36]=l.header.shortHead,t[37]=D);let O;t[38]===r.publishedAt?O=t[39]:(O=Xa(r.publishedAt),t[38]=r.publishedAt,t[39]=O);let k;t[40]!==D||t[41]!==O?(k=(0,Q.jsxs)(`p`,{className:`text-muted-foreground wrap-anywhere`,children:[`Head`,` `,D,` `,`· `,O]}),t[40]=D,t[41]=O,t[42]=k):k=t[42];let A;t[43]===n.review?.state?A=t[44]:(A=n.review?.state===`closed`&&(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:`Closed`}),t[43]=n.review?.state,t[44]=A);let j;t[45]!==E||t[46]!==k||t[47]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex flex-col border-t pt-2 leading-4.5`,children:[E,k,A]}),t[45]=E,t[46]=k,t[47]=A,t[48]=j):j=t[48];let M;t[49]===s?M=t[50]:(M=s&&(0,Q.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:s,children:`Back to workspace`}),t[49]=s,t[50]=M);let N=n.review?.state??`open`,P;t[51]!==i||t[52]!==o||t[53]!==r.reviewId||t[54]!==N?(P=(0,Q.jsx)(T0,{reviewId:r.reviewId,state:N,context:i,onDeleted:o}),t[51]=i,t[52]=o,t[53]=r.reviewId,t[54]=N,t[55]=P):P=t[55];let F;t[56]!==M||t[57]!==P?(F=(0,Q.jsxs)(`div`,{className:`mt-2.5 flex flex-col items-start`,children:[M,P]}),t[56]=M,t[57]=P,t[58]=F):F=t[58];let I;t[59]!==j||t[60]!==F?(I=(0,Q.jsxs)(`section`,{className:`flex flex-col`,children:[S,j,F]}),t[59]=j,t[60]=F,t[61]=I):I=t[61];let L;return t[62]!==x||t[63]!==I||t[64]!==g||t[65]!==_?(L=(0,Q.jsxs)(`aside`,{"aria-label":g,className:_,children:[x,I]}),t[62]=x,t[63]=I,t[64]=g,t[65]=_,t[66]=L):L=t[66],L}function D0(e,t){return t.revision-e.revision}function O0(e){let t=(0,$.c)(5),{children:n,count:r}=e,i;t[0]===r?i=t[1]:(i=r!==void 0&&(0,Q.jsx)(`span`,{className:`ml-auto tabular-nums`,children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,Q.jsxs)(`h3`,{className:`mb-2 flex items-center gap-1.5 text-xs leading-4 font-medium text-muted-foreground`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function k0(e){let t=(0,$.c)(19),{revision:n}=e,r,i,a,o,s,c,l;if(t[0]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{if(r=cm(n),r.removed.fileCount===0&&r.removed.groups.length===0){l=null;break bb0}o=`Removed`,s=`flex min-w-0 flex-col text-xs`,c=(0,Q.jsx)(O0,{count:Kr(r.removed.fileCount,`file`),children:`Removed`}),i=`flex flex-col divide-y border-y`,a=r.removed.groups.map(A0)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[8]===r.removed.unexplainedPaths?u=t[9]:(u=r.removed.unexplainedPaths.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,Q.jsx)(N0,{paths:r.removed.unexplainedPaths}),(0,Q.jsx)(`p`,{className:`text-destructive`,children:`No removal explanation supplied`})]}),t[8]=r.removed.unexplainedPaths,t[9]=u);let d;t[10]!==i||t[11]!==a||t[12]!==u?(d=(0,Q.jsxs)(`div`,{className:i,children:[a,u]}),t[10]=i,t[11]=a,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==o||t[15]!==s||t[16]!==c||t[17]!==d?(f=(0,Q.jsxs)(`section`,{"aria-label":o,className:s,children:[c,d]}),t[14]=o,t[15]=s,t[16]=c,t[17]=d,t[18]=f):f=t[18],f}function A0(e,t){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2 wrap-anywhere`,children:[(0,Q.jsx)(N0,{paths:e.paths}),(0,Q.jsxs)(`p`,{className:`text-ui leading-4.75`,children:[(0,Q.jsx)(`strong`,{className:`font-medium`,children:e.behavior}),` ·`,` `,e.why]})]},t)}function j0(e){let t=(0,$.c)(2),{revision:n}=e,r;if(t[0]!==n){let e=cm(n);r=(0,Q.jsxs)(`section`,{"aria-label":`Not proven`,className:`flex min-w-0 flex-col text-xs`,children:[(0,Q.jsx)(O0,{count:e.notProven.length,children:`Not proven`}),e.notProven.length===0?(0,Q.jsx)(`p`,{className:`border-t pt-2 text-muted-foreground`,children:`Nothing listed.`}):(0,Q.jsx)(`ul`,{className:`flex flex-col divide-y border-y`,children:e.notProven.map(M0)})]}),t[0]=n,t[1]=r}else r=t[1];return r}function M0(e,t){return(0,Q.jsxs)(`li`,{className:`flex gap-1.5 py-2 wrap-anywhere`,children:[(0,Q.jsx)(Nd,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`strong`,{className:`text-ui leading-4.5 font-medium`,children:e.what}),(0,Q.jsx)(`span`,{className:`leading-4.25 text-muted-foreground`,children:e.why})]})]},t)}function N0(e){let t=(0,$.c)(4),{paths:n}=e,r;t[0]===n?r=t[1]:(r=n.map(P0),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`ul`,{className:`space-y-1 font-mono text-xs wrap-anywhere text-destructive`,children:r}),t[2]=r,t[3]=i),i}function P0(e){return(0,Q.jsxs)(`li`,{className:`flex min-w-0 gap-1`,children:[(0,Q.jsx)(`span`,{children:`− `}),(0,Q.jsx)(`span`,{className:`min-w-0 wrap-anywhere`,children:e})]},e)}function F0(e){let t=(0,$.c)(24),{stops:n,current:r,done:i,onGo:a,page:o}=e,s=n.findLastIndex(i),c;t[0]!==r||t[1]!==s||t[2]!==n?(c=r===void 0?s+1:Math.max(n.findIndex(e=>e.key===r),s),t[0]=r,t[1]=s,t[2]=n,t[3]=c):c=t[3];let l=c,[u,d]=(0,Z.useState)(),f;t[4]!==r||t[5]!==o?.scrollTop||t[6]!==u?(f=e=>t=>{if(!t||e!==r||t.getClientRects().length===0)return;let n=t.closest(`[data-slot=scroll-area-viewport]`);if(!n)return;let i=t.getBoundingClientRect(),a=n.getBoundingClientRect(),s=Math.max(a.top,0),c=Math.min(a.bottom,window.innerHeight),l=i.top>=s&&i.bottom<=c;if(u?.key===e&&(l||u.scrollTop!==n.scrollTop||u.pageTop!==(o?.scrollTop??0)))return;l||n.scrollBy({top:i.top-s-(c-s-i.height)/2}),t.scrollIntoView({block:`nearest`});let f=o?.scrollTop??0;(u?.key!==e||u.scrollTop!==n.scrollTop||u.pageTop!==f)&&d({key:e,scrollTop:n.scrollTop,pageTop:f})},t[4]=r,t[5]=o?.scrollTop,t[6]=u,t[7]=f):f=t[7];let p=f,m;if(t[8]!==r||t[9]!==i||t[10]!==a||t[11]!==l||t[12]!==p||t[13]!==n){let e;t[15]!==r||t[16]!==i||t[17]!==a||t[18]!==l||t[19]!==p||t[20]!==n.length?(e=(e,t)=>(0,Q.jsxs)(`div`,{ref:p(e.key),className:`relative flex flex-col items-center`,children:[t<n.length-1&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:X(`absolute top-full left-1/2 h-7 -translate-x-1/2 -translate-y-0.5`,t<l?`w-0.75 bg-brand`:`w-px bg-border-strong`)}),(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-sm`,className:`relative`,"aria-label":L0(e),"aria-current":e.key===r?`step`:void 0,onClick:()=>a(e.key)}),children:(0,Q.jsx)(`span`,{className:X(`grid size-6 place-items-center rounded-full border border-border-strong bg-card text-muted-foreground`,e.key===r&&`border-brand text-brand ring-4 ring-brand-soft`,i(e)&&`border-brand bg-brand text-brand-foreground`),children:(0,Q.jsx)(I0,{stop:e,done:i(e)})})}),(0,Q.jsx)(Et,{side:`right`,children:L0(e)})]})]},e.key),t[15]=r,t[16]=i,t[17]=a,t[18]=l,t[19]=p,t[20]=n.length,t[21]=e):e=t[21],m=n.map(e),t[8]=r,t[9]=i,t[10]=a,t[11]=l,t[12]=p,t[13]=n,t[14]=m}else m=t[14];let h;return t[22]===m?h=t[23]:(h=(0,Q.jsx)(`div`,{className:`sticky top-0 hidden h-fit max-h-[100cqh] w-14 shrink-0 grid-rows-[minmax(0,1fr)] border-r @2xl/review:grid @5xl/review:w-18`,children:(0,Q.jsx)(UF,{className:`min-h-0`,children:(0,Q.jsx)(`nav`,{"aria-label":`Walkthrough progress`,className:`flex flex-col items-center gap-6 py-6`,children:m})})}),t[22]=m,t[23]=h),h}function I0(e){let t=(0,$.c)(6),{stop:n,done:r}=e;if(r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(ir,{className:`size-3.5`}),t[0]=e):e=t[0],e}switch(n.kind){case`briefing`:{let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(xd,{className:`size-3.5`}),t[1]=e):e=t[1],e}case`decision`:{let e;return t[2]===n.number?e=t[3]:(e=(0,Q.jsx)(`span`,{className:`text-xs tabular-nums`,children:n.number}),t[2]=n.number,t[3]=e),e}case`unexplained`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(uf,{className:`size-3.5 text-graph-4`}),t[4]=e):e=t[4],e}case`specs`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(vf,{className:`size-3.5`}),t[5]=e):e=t[5],e}}}function L0(e){return e.kind===`briefing`?`Open the briefing`:`Go to ${$p(e)}`}function R0(e){let t=(0,$.c)(26),{revision:n}=e,r,i,a,o,s,c,l;if(t[0]!==n){let e=cm(n),{recommendation:u}=e,d=u.value===`merge`,f=d?ir:ip;s=`Verdict`,c=`flex min-w-0 flex-col gap-6`;let p;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`You asked: `}),t[8]=p):p=t[8],l=(0,Q.jsxs)(`section`,{"aria-label":`You asked`,className:`flex flex-col items-start`,children:[(0,Q.jsxs)(`p`,{className:`text-lead whitespace-pre-wrap wrap-anywhere text-foreground-2`,children:[p,`“`,e.asked.text,`”`]}),e.asked.links.length>0&&(0,Q.jsx)(`ul`,{className:`mt-1.5 flex flex-wrap gap-x-3`,children:e.asked.links.map(B0)})]}),r=`Recommendation`,i=`flex min-w-0 flex-col`;let m=!d&&`fill-current stroke-0`,h;t[9]===m?h=t[10]:(h=X(`size-3`,m),t[9]=m,t[10]=h);let g;t[11]!==f||t[12]!==h?(g=(0,Q.jsx)(f,{"aria-hidden":`true`,className:h}),t[11]=f,t[12]=h,t[13]=g):g=t[13];let _=d?`merging`:`holding`,v;t[14]===_?v=t[15]:(v=(0,Q.jsxs)(`span`,{className:`text-reading leading-5 font-medium`,children:[`The agent recommends `,_,` this change`]}),t[14]=_,t[15]=v),a=(0,Q.jsxs)(`h3`,{"aria-label":`Recommendation: ${u.label}`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 rounded-full border pr-3 pl-2.5 text-ui leading-6.5 font-semibold ${d?`border-brand-soft bg-brand-soft text-brand`:`border-warn-border bg-warn-soft text-warn`}`,children:[g,u.label]}),v]}),o=u.reasons.length>0&&(0,Q.jsx)(`ol`,{className:`mt-3 flex flex-col border-b`,children:u.reasons.map(z0)}),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];let u;t[16]!==r||t[17]!==i||t[18]!==a||t[19]!==o?(u=(0,Q.jsxs)(`section`,{"aria-label":r,className:i,children:[a,o]}),t[16]=r,t[17]=i,t[18]=a,t[19]=o,t[20]=u):u=t[20];let d;return t[21]!==s||t[22]!==c||t[23]!==l||t[24]!==u?(d=(0,Q.jsxs)(`section`,{"aria-label":s,className:c,children:[l,u]}),t[21]=s,t[22]=c,t[23]=l,t[24]=u,t[25]=d):d=t[25],d}function z0(e,t){return(0,Q.jsxs)(`li`,{className:`flex min-w-0 border-t py-1 text-reading`,children:[(0,Q.jsx)(`span`,{className:`w-5.5 shrink-0 text-xs leading-5.5 font-medium text-muted-foreground tabular-nums`,children:t+1}),(0,Q.jsx)(`span`,{className:`min-w-0 wrap-anywhere`,children:e})]},t)}function B0(e){return(0,Q.jsx)(`li`,{className:`min-w-0`,children:(0,Q.jsxs)(`a`,{className:`-ml-1.5 inline-flex h-6.5 max-w-full items-center gap-1.5 rounded-md pr-2 pl-1.5 text-ui leading-4 font-medium wrap-anywhere hover:bg-accent`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:[(0,Q.jsx)(Fd,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:`min-w-0`,children:e.title}),(0,Q.jsx)(Ft,{className:`size-3 shrink-0 text-muted-foreground`})]})},e.url)}var V0=so(e=>Br(t=>{if(!e)return;let n=URL.createObjectURL(new Blob([ho(e)],{type:e.mediaType}));return t.addFinalizer(()=>URL.revokeObjectURL(n)),n}));function H0(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=V0(e),t[0]=e,t[1]=n),Rr(n)}function U0(e,t,n){let r=(0,$.c)(4),i;return r[0]!==t.connection||r[1]!==n||r[2]!==e?(i=e.review?$i({...e.review,connection:t.connection,proofId:n}):Mu({scope:e,connection:t.connection,proofId:n}),r[0]=t.connection,r[1]=n,r[2]=e,r[3]=i):i=r[3],Rr(i)}function W0(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 G0(e){let t=(0,$.c)(16),{scope:n,context:r,proof:i,layers:a,inLayer:o,layout:s}=e,c=o!==void 0&&o,l=(s===void 0?`stacked`:s)===`columns`&&`@2xl/review:grid @2xl/review:grid-cols-2 @2xl/review:items-start`,u;t[0]===l?u=t[1]:(u=X(`flex min-w-0 flex-col gap-5`,l),t[0]=l,t[1]=u);let d;t[2]!==c||t[3]!==a||t[4]!==i.checks?(d=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:ja(i.checks).map((e,t)=>(0,Q.jsx)(q0,{check:e,target:W0(e,a,c)},`${e.result}:${e.name}:${t}`))})]}),t[2]=c,t[3]=a,t[4]=i.checks,t[5]=d):d=t[5];let f;t[6]!==r||t[7]!==c||t[8]!==a||t[9]!==i.assets||t[10]!==n?(f=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 @lg/review:grid-cols-2`,children:i.assets.map(e=>(0,Q.jsx)(`li`,{className:`min-w-0`,children:(0,Q.jsx)(J0,{scope:n,context:r,asset:e,target:W0(e,a,c)})},e.id))})]}),t[6]=r,t[7]=c,t[8]=a,t[9]=i.assets,t[10]=n,t[11]=f):f=t[11];let p;return t[12]!==u||t[13]!==d||t[14]!==f?(p=(0,Q.jsxs)(`div`,{className:u,children:[d,f]}),t[12]=u,t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function K0(e){return e===`pass`?zl:e===`fail`?Vd:Ld}function q0(e){let t=(0,$.c)(36),{check:n,target:r}=e,i=n.result===`fail`,a;t[0]===n.result?a=t[1]:(a=K0(n.result),t[0]=n.result,t[1]=a);let o=a,s=n.name,c;t[2]===n.result?c=t[3]:(c=Li(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=X(`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=X(`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 text-sm wrap-anywhere 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=X(`shrink-0 text-xs`,v),t[14]=v,t[15]=y);let b;t[16]===n.result?b=t[17]:(b=Li(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 pl-6 wrap-anywhere 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 J0(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:`text-sm wrap-anywhere`,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:`text-xs wrap-anywhere 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)(Zd,{"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)(fr,{text: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=br(i.url),t[13]=i.url,t[14]=o);let s;t[15]===o?s=t[16]:(s=(0,Q.jsx)(`span`,{className:`text-xs wrap-anywhere 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:`text-xs wrap-anywhere 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)(Y0,{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 Y0(e){let t=(0,$.c)(10),{scope:n,context:r,id:i,title:a,video:o}=e,[s,c]=(0,Z.useState)(!1),l=U0(n,r,i),u;t[0]===l?u=t[1]:(u=Ts(Te(l)),t[0]=l,t[1]=u);let d=H0(u);if(f(l)){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(d===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 p;return t[5]!==s||t[6]!==a||t[7]!==d||t[8]!==o?(p=o?(0,Q.jsx)(`video`,{controls:!0,"aria-label":a,src:d,className:`max-h-80 w-full rounded-md bg-muted`}):(0,Q.jsxs)(JP,{onOpenChange:e=>!e&&c(!1),children:[(0,Q.jsx)(YP,{render:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Enlarge ${a}`,className:`block w-full cursor-zoom-in rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,Q.jsx)(`img`,{src:d,alt:a,className:`max-h-80 w-full rounded-md bg-muted object-contain`})}),(0,Q.jsxs)($P,{className:`max-h-[92svh] overflow-auto sm:max-w-[min(92vw,90rem)]`,children:[(0,Q.jsxs)(eF,{children:[(0,Q.jsx)(nF,{children:a}),(0,Q.jsx)(rF,{children:`Published image attached to this review.`})]}),(0,Q.jsx)(`div`,{className:`max-h-[75svh] min-w-0 overflow-auto`,children:(0,Q.jsx)(`img`,{src:d,alt:a,className:s?`max-w-none`:`max-h-[75svh] w-full object-contain`})}),(0,Q.jsx)(Y,{variant:`outline`,className:`w-fit`,onClick:()=>c(!s),children:s?`Fit image`:`View original size`})]})]}),t[5]=s,t[6]=a,t[7]=d,t[8]=o,t[9]=p):p=t[9],p}function X0(e){let t=(0,$.c)(8),{id:n,children:r,aside:i}=e,a;t[0]!==r||t[1]!==n?(a=(0,Q.jsx)(`h3`,{id:n,className:`min-w-0 text-section font-semibold`,children:r}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=i!==void 0&&(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground tabular-nums`,children:i}),t[3]=i,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1 border-b pb-2.5`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Z0(e){let t=(0,$.c)(40),{revision:n,scope:r,context:i,current:a,title:o,columns:s}=e,c=s!==void 0&&s,l,u,d;t[0]===n?(l=t[1],u=t[2],d=t[3]):(u=cm(n),l=u.proven.checks.length+u.proven.assets.length===0,d=u.proven.checks.filter(Q0),t[0]=n,t[1]=l,t[2]=u,t[3]=d);let f=d.length,p=u.proven.checks.length-f,m=u.proven.assets.length,h;t[4]!==m||t[5]!==l||t[6]!==f||t[7]!==p?(h=l?void 0:[`${Kr(p,`check`)} passed`,f>0&&`${f} failed`,m>0&&Kr(m,`asset`)].filter(Boolean).join(` · `),t[4]=m,t[5]=l,t[6]=f,t[7]=p,t[8]=h):h=t[8];let g;t[9]===u.proven.shortHead?g=t[10]:(g=(0,Q.jsx)(`span`,{className:`font-mono text-sm leading-5.5 font-medium tracking-normal`,children:u.proven.shortHead}),t[9]=u.proven.shortHead,t[10]=g);let _;t[11]!==h||t[12]!==g?(_=(0,Q.jsxs)(X0,{aside:h,children:[`Proven at`,` `,g]}),t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]===n.publishedAt?v=t[15]:(v=No(n.publishedAt),t[14]=n.publishedAt,t[15]=v);let y;t[16]!==u.proven.shortHead||t[17]!==v?(y=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Published `,v,` · at`,` `,u.proven.shortHead]}),t[16]=u.proven.shortHead,t[17]=v,t[18]=y):y=t[18];let b;t[19]!==a||t[20]!==l?(b=!a&&!l&&(0,Q.jsx)(me,{role:`status`,title:`These checks ran before the latest changes`,description:`The code changed after the agent published this proof. Ask it to run the checks again.`}),t[19]=a,t[20]=l,t[21]=b):b=t[21];let x;t[22]===f?x=t[23]:(x=f>0&&(0,Q.jsxs)(`div`,{role:`alert`,className:`text-sm text-destructive`,children:[(0,Q.jsxs)(`p`,{children:[f,` check failed`]}),(0,Q.jsx)(`p`,{children:`The agent reported this work as not passing yet.`})]}),t[22]=f,t[23]=x);let S=c?`columns`:`stacked`,C;t[24]!==i||t[25]!==n.content.layers||t[26]!==n.content.proof||t[27]!==r||t[28]!==S?(C=(0,Q.jsx)(G0,{scope:r,context:i,proof:n.content.proof,layout:S,layers:n.content.layers}),t[24]=i,t[25]=n.content.layers,t[26]=n.content.proof,t[27]=r,t[28]=S,t[29]=C):C=t[29];let w;t[30]===l?w=t[31]:(w=l&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No proof attached.`}),t[30]=l,t[31]=w);let T;return t[32]!==C||t[33]!==w||t[34]!==_||t[35]!==y||t[36]!==b||t[37]!==x||t[38]!==o?(T=(0,Q.jsxs)(`section`,{"aria-label":o,className:`flex min-w-0 flex-col gap-3`,children:[_,y,b,x,C,w]}),t[32]=C,t[33]=w,t[34]=_,t[35]=y,t[36]=b,t[37]=x,t[38]=o,t[39]=T):T=t[39],T}function Q0(e){return e.result===`fail`}function $0(e){let t=(0,$.c)(12),{part:n,revision:r,scope:i,context:a,autoFocus:o,onClose:s}=e,c=s!==void 0,l=n.problem,u=n.id,d;t[0]!==r.base||t[1]!==r.headOid?(d=ha({base:r.base,tip:r.headOid}),t[0]=r.base,t[1]=r.headOid,t[2]=d):d=t[2];let f=s??e2,p;return t[3]!==o||t[4]!==a||t[5]!==n.id||t[6]!==n.problem||t[7]!==i||t[8]!==c||t[9]!==d||t[10]!==f?(p=(0,Q.jsx)(lQ,{variant:`answer`,autoFocus:o,closable:c,scope:i,context:a,quote:l,questionId:u,anchor:d,onClose:f}),t[3]=o,t[4]=a,t[5]=n.id,t[6]=n.problem,t[7]=i,t[8]=c,t[9]=d,t[10]=f,t[11]=p):p=t[11],p}function e2(){}function t2(e){let t=(0,$.c)(28),{part:n,revision:r,scope:i,context:a,action:o,decisionTitle:s}=e,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(zd,{className:`size-3.5 shrink-0`}),t[0]=f):f=t[0];let p=n.decision===void 0?void 0:`Decision ${n.decision}`,m;t[1]!==s||t[2]!==n.label||t[3]!==p?(m=[n.label,p,s].filter(Boolean),t[1]=s,t[2]=n.label,t[3]=p,t[4]=m):m=t[4];let h=m.join(` · `),g;t[5]===h?g=t[6]:(g=(0,Q.jsxs)(`p`,{className:`flex min-w-0 items-start gap-2 text-xs leading-4 font-medium text-brand`,children:[f,(0,Q.jsx)(`span`,{className:`min-w-0 wrap-anywhere`,children:h})]}),t[5]=h,t[6]=g);let _;t[7]===n.problem?_=t[8]:(_=(0,Q.jsx)(`p`,{className:`mt-2 text-reading leading-6 whitespace-pre-wrap wrap-anywhere`,children:n.problem}),t[7]=n.problem,t[8]=_);let v,y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>l(!0),y=(0,Q.jsx)(ep,{}),t[9]=v,t[10]=y):(v=t[9],y=t[10]);let b;t[11]===c?b=t[12]:(b=(0,Q.jsxs)(Y,{ref:d,type:`button`,variant:`ghost`,size:`sm`,"aria-expanded":c,onClick:v,children:[y,`Answer the agent`]}),t[11]=c,t[12]=b);let x;t[13]!==o||t[14]!==b?(x=(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[o,b]}),t[13]=o,t[14]=b,t[15]=x):x=t[15];let S;t[16]!==u||t[17]!==c||t[18]!==a||t[19]!==n||t[20]!==r||t[21]!==i?(S=c&&(0,Q.jsx)(`div`,{className:`mt-3 rounded-lg border bg-card p-3`,children:(0,Q.jsx)($0,{part:n,revision:r,scope:i,context:a,autoFocus:!0,onClose:()=>{l(!1),u?.focus()}})}),t[16]=u,t[17]=c,t[18]=a,t[19]=n,t[20]=r,t[21]=i,t[22]=S):S=t[22];let C;return t[23]!==x||t[24]!==S||t[25]!==g||t[26]!==_?(C=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col rounded-paper border border-brand/40 bg-brand-soft px-4 py-3.5`,children:[g,_,x,S]}),t[23]=x,t[24]=S,t[25]=g,t[26]=_,t[27]=C):C=t[27],C}function n2(e){let t=(0,$.c)(17),{part:n,revision:r,scope:i,context:a}=e,o=`Needs your decision: ${n.label}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs leading-4 font-semibold text-brand`,children:[(0,Q.jsx)(zd,{className:`size-3.5 shrink-0`}),`Needs your decision`]}),t[0]=s):s=t[0];let c;t[1]===n.label?c=t[2]:(c=(0,Q.jsx)(`p`,{className:`text-ui leading-4.5 font-semibold`,children:n.label}),t[1]=n.label,t[2]=c);let l;t[3]===n.problem?l=t[4]:(l=(0,Q.jsx)(`p`,{className:`mt-0.75 text-ui leading-4.75 whitespace-pre-wrap`,children:n.problem}),t[3]=n.problem,t[4]=l);let u;t[5]!==c||t[6]!==l?(u=(0,Q.jsxs)(`div`,{className:`min-w-0 wrap-anywhere`,children:[c,l]}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]!==a||t[9]!==n||t[10]!==r||t[11]!==i?(d=(0,Q.jsx)(`div`,{className:`border-t pt-2.5`,children:(0,Q.jsx)($0,{part:n,revision:r,scope:i,context:a,autoFocus:!1})}),t[8]=a,t[9]=n,t[10]=r,t[11]=i,t[12]=d):d=t[12];let f;return t[13]!==o||t[14]!==u||t[15]!==d?(f=(0,Q.jsxs)(`section`,{"aria-label":o,className:`flex min-w-0 flex-col gap-2.5 rounded-paper border bg-card p-3 shadow-pop`,children:[s,u,d]}),t[13]=o,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function r2(e){let t=(0,$.c)(5),{children:n,margin:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`div`,{className:`min-w-0`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-8 @5xl/review:grid-cols-[minmax(0,1fr)_--spacing(51)] @5xl/review:gap-7`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function i2(e){let t=(0,$.c)(119),{review:n,stops:r,items:i,decisions:a,done:o,onGo:s,revision:c,latestRevision:l,title:u,margin:d,proofCurrent:f,pullRequestChip:p,scope:m,context:h}=e,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A;if(t[0]!==h||t[1]!==a||t[2]!==o||t[3]!==i||t[4]!==l||t[5]!==d||t[6]!==s||t[7]!==f||t[8]!==p||t[9]!==n||t[10]!==c||t[11]!==m||t[12]!==r||t[13]!==u){let e=r.filter(l2),j=r.filter(c2),M=Zp(r.flatMap(s2),i),N=e.filter(o).length,P=[...e,...j].find(e=>!o(e)),F=am(n),I;t[29]===a?I=t[30]:(I=e=>a.get(e.layer.id)?.stale,t[29]=a,t[30]=I);let L=e.filter(I).length,R;t[31]===r?R=t[32]:(R=r.find(o2),t[31]=r,t[32]=R);let z=R,B=new Set(F.questions.flatMap(a2)),V=e.find(e=>B.has(e.number)),H=F.added.length+F.changed.length+F.removed.length>0;b=`shrink-0`,x=`Briefing`,S=`region`,k=`mx-auto flex w-full max-w-264 flex-col gap-9 px-4 pt-8 pb-16 @2xl/review:px-6 @5xl/review:pr-9 @5xl/review:pl-5.5`;let U,W;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(`span`,{children:`Briefing`}),W=(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t[33]=U,t[34]=W):(U=t[33],W=t[34]);let G;t[35]!==l||t[36]!==n.revision?(G=(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[`Revision `,n.revision,` of `,l]}),t[35]=l,t[36]=n.revision,t[37]=G):G=t[37];let K;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t[38]=K):K=t[38];let ee;t[39]===c.publishedAt?ee=t[40]:(ee=Xa(c.publishedAt),t[39]=c.publishedAt,t[40]=ee);let q;t[41]===ee?q=t[42]:(q=(0,Q.jsx)(`span`,{children:ee}),t[41]=ee,t[42]=q);let te;t[43]!==p||t[44]!==G||t[45]!==q?(te=(0,Q.jsxs)(`p`,{className:`flex flex-wrap gap-x-2 text-ui leading-5.5 font-medium text-muted-foreground`,children:[U,W,G,K,q,p]}),t[43]=p,t[44]=G,t[45]=q,t[46]=te):te=t[46];let ne;t[47]===u?ne=t[48]:(ne=(0,Q.jsx)(fr,{text:u,lines:3,className:`min-w-0 text-title-dim`}),t[47]=u,t[48]=ne);let re;t[49]===c?re=t[50]:(re=(0,Q.jsx)(R0,{revision:c}),t[49]=c,t[50]=re);let ie;t[51]===L?ie=t[52]:(ie=L>0&&(0,Q.jsxs)(`span`,{className:`px-3 text-ui leading-4 text-warn`,children:[Kr(L,`decision has`,`decisions have`),` code moved`]}),t[51]=L,t[52]=ie);let ae;t[53]===z?ae=t[54]:(ae=z&&(0,Q.jsx)(`span`,{className:`px-3 text-ui leading-4 text-muted-foreground`,children:`Changes remain not explained`}),t[53]=z,t[54]=ae);let oe=(0,Q.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-5`,children:[te,(0,Q.jsxs)(`h2`,{className:`text-briefing-title font-semibold wrap-anywhere`,children:[ne,(0,Q.jsxs)(`span`,{className:`block`,children:[qp(e.length),`.`]})]}),re,(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[P?(0,Q.jsxs)(Y,{type:`button`,size:`lg`,className:`min-w-0 max-w-full whitespace-normal`,onClick:()=>s(P.key),children:[(0,Q.jsx)(`span`,{className:`min-w-0 wrap-anywhere`,children:P.kind===`decision`?`Continue at decision ${P.number}`:`Continue at ${$p(P)}`}),(0,Q.jsx)(_d,{})]}):(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm font-medium text-graph-2`,children:[(0,Q.jsx)(ir,{className:`size-4`}),`Everything in this change is reviewed`]}),V&&(0,Q.jsxs)(Y,{type:`button`,variant:`ghost`,size:`lg`,onClick:()=>s(V.key),children:[(0,Q.jsx)(Ul,{}),`Decision `,V.number,` needs you`]}),ie,ae]})]}),se=F.questions.length>0&&(0,Q.jsxs)(`section`,{"aria-label":`Needs your decision`,className:`flex flex-col gap-3.5`,children:[(0,Q.jsx)(X0,{id:`briefing-questions`,aside:F.questions.length,children:`Needs your decision`}),F.questions.map(e=>(0,Q.jsx)(t2,{part:e,revision:c,scope:m,context:h,decisionTitle:e.decision===void 0?void 0:n.layers[e.decision-1]?.title,action:(0,Q.jsx)(m2,{part:e,review:n,onGo:s,label:`Open decision ${e.decision}`})},e.id))]}),ce;t[55]!==oe||t[56]!==se?(ce=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-10`,children:[oe,se]}),t[55]=oe,t[56]=se,t[57]=ce):ce=t[57],t[58]!==d||t[59]!==ce?(A=(0,Q.jsx)(r2,{margin:d,children:ce}),t[58]=d,t[59]=ce,t[60]=A):A=t[60];let le;t[61]===c?le=t[62]:(le=(0,Q.jsx)(k0,{revision:c}),t[61]=c,t[62]=le);let ue;t[63]!==H||t[64]!==F?(ue=H?[`${F.added.length} new`,`${F.changed.length} changed`,`${F.removed.length} removed`].join(` · `):void 0,t[63]=H,t[64]=F,t[65]=ue):ue=t[65];let de;t[66]===ue?de=t[67]:(de=(0,Q.jsx)(X0,{id:`briefing-system`,aside:ue,children:`What this adds to the system`}),t[66]=ue,t[67]=de);let fe;t[68]!==H||t[69]!==s||t[70]!==F||t[71]!==n?(fe=H?(0,Q.jsxs)(`div`,{className:`flex flex-col divide-y`,children:[(0,Q.jsx)(p2,{title:`New`,parts:F.added,review:n,onGo:s}),(0,Q.jsx)(p2,{title:`Changed`,parts:F.changed,review:n,onGo:s}),(0,Q.jsx)(p2,{title:`Removed`,parts:F.removed,review:n,onGo:s,struck:!0})]}):(0,Q.jsx)(`p`,{className:`pt-3 text-sm text-muted-foreground`,children:`No system owners listed.`}),t[68]=H,t[69]=s,t[70]=F,t[71]=n,t[72]=fe):fe=t[72];let pe;t[73]!==de||t[74]!==fe?(pe=(0,Q.jsxs)(`section`,{"aria-labelledby":`briefing-system`,className:`flex flex-col`,children:[de,fe]}),t[73]=de,t[74]=fe,t[75]=pe):pe=t[75],t[76]!==le||t[77]!==pe?(v=(0,Q.jsx)(r2,{margin:le,children:pe}),t[76]=le,t[77]=pe,t[78]=v):v=t[78];let J;t[79]===c?J=t[80]:(J=(0,Q.jsx)(j0,{revision:c}),t[79]=c,t[80]=J);let me;t[81]===c.headOid?me=t[82]:(me=c.headOid.slice(0,7),t[81]=c.headOid,t[82]=me);let he=`Proven at ${me}`,ge;t[83]!==h||t[84]!==f||t[85]!==c||t[86]!==m||t[87]!==he?(ge=(0,Q.jsx)(Z0,{columns:!0,revision:c,scope:m,context:h,current:f,title:he}),t[83]=h,t[84]=f,t[85]=c,t[86]=m,t[87]=he,t[88]=ge):ge=t[88],t[89]!==J||t[90]!==ge?(y=(0,Q.jsx)(r2,{margin:J,children:ge}),t[89]=J,t[90]=ge,t[91]=y):y=t[91],g=r2,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(`p`,{className:`text-ui leading-5 text-muted-foreground`,children:`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[92]=O):O=t[92],T=`briefing-decisions`,E=`flex min-w-0 flex-col`;let _e=`${N} of ${Kr(e.length,`decision`)} · ${M.reviewed} of ${Kr(M.total,`file`)} reviewed`;t[93]===_e?D=t[94]:(D=(0,Q.jsx)(X0,{id:`briefing-decisions`,aside:_e,children:`The walkthrough`}),t[93]=_e,t[94]=D),_=`flex flex-col divide-y`,C=e.map(e=>{let t=a.get(e.layer.id),n=Zp(e.paths,i),r=rm(e.layer).join(` → `)||`No changed code`,c=B.has(e.number);return(0,Q.jsx)(u2,{stop:e,onGo:s,detail:r,current:e.key===P?.key,children:i=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d2,{done:o(e),current:e.key===P?.key,label:`${e.number}`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 @2xl/review:flex-row @2xl/review:items-baseline @2xl/review:gap-3`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 text-sm leading-4.5 font-medium wrap-anywhere @2xl/review:flex-1`,children:[e.layer.title,(c||t?.stale)&&(0,Q.jsxs)(`span`,{className:`ml-2 inline-flex items-center gap-1 text-xs font-medium text-warn`,children:[c&&(0,Q.jsx)(Ul,{className:`size-3`}),[c&&`needs you`,t?.stale&&`code moved`].filter(Boolean).join(` · `)]})]}),i(r,`text-xs text-muted-foreground @2xl/review:max-w-1/2`)]}),(0,Q.jsxs)(`span`,{className:`w-9 shrink-0 text-right text-xs font-medium text-muted-foreground tabular-nums`,children:[n.reviewed,`/`,n.total]})]})},e.key)}),w=j.map(e=>{let t=Zp(e.paths,i);return(0,Q.jsx)(u2,{stop:e,onGo:s,current:e.key===P?.key,children:()=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:X(`grid size-5 shrink-0 place-items-center rounded-full border text-muted-foreground`,e.kind===`unexplained`&&`border-warn-border bg-warn-soft text-warn`),children:e.kind===`unexplained`?(0,Q.jsx)(uf,{className:`size-3`}):(0,Q.jsx)(vf,{className:`size-3`})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 @2xl/review:flex-row @2xl/review:items-baseline @2xl/review:gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 text-sm leading-4.5 font-medium wrap-anywhere @2xl/review:flex-1`,children:Qp(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:`w-9 shrink-0 text-right text-xs font-medium text-muted-foreground tabular-nums`,children:[t.reviewed,`/`,t.total]})]})},e.key)}),t[0]=h,t[1]=a,t[2]=o,t[3]=i,t[4]=l,t[5]=d,t[6]=s,t[7]=f,t[8]=p,t[9]=n,t[10]=c,t[11]=m,t[12]=r,t[13]=u,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k,t[28]=A}else g=t[14],_=t[15],v=t[16],y=t[17],b=t[18],x=t[19],S=t[20],C=t[21],w=t[22],T=t[23],E=t[24],D=t[25],O=t[26],k=t[27],A=t[28];let j;t[95]!==_||t[96]!==C||t[97]!==w?(j=(0,Q.jsxs)(`ol`,{className:_,children:[C,w]}),t[95]=_,t[96]=C,t[97]=w,t[98]=j):j=t[98];let M;t[99]!==j||t[100]!==T||t[101]!==E||t[102]!==D?(M=(0,Q.jsxs)(`section`,{"aria-labelledby":T,className:E,children:[D,j]}),t[99]=j,t[100]=T,t[101]=E,t[102]=D,t[103]=M):M=t[103];let N;t[104]!==g||t[105]!==M||t[106]!==O?(N=(0,Q.jsx)(g,{margin:O,children:M}),t[104]=g,t[105]=M,t[106]=O,t[107]=N):N=t[107];let P;t[108]!==v||t[109]!==y||t[110]!==N||t[111]!==k||t[112]!==A?(P=(0,Q.jsxs)(`div`,{className:k,children:[A,v,y,N]}),t[108]=v,t[109]=y,t[110]=N,t[111]=k,t[112]=A,t[113]=P):P=t[113];let F;return t[114]!==b||t[115]!==x||t[116]!==S||t[117]!==P?(F=(0,Q.jsx)(`div`,{className:b,"aria-label":x,role:S,children:P}),t[114]=b,t[115]=x,t[116]=S,t[117]=P,t[118]=F):F=t[118],F}function a2(e){return e.decision===void 0?[]:[e.decision]}function o2(e){return e.kind===`unexplained`}function s2(e){return e.paths}function c2(e){return e.kind===`unexplained`||e.kind===`specs`}function l2(e){return e.kind===`decision`}function u2(e){let t=(0,$.c)(15),{stop:n,onGo:r,children:i,detail:a,current:o}=e,s;t[0]!==a||t[1]!==n?(s=a===void 0?$p(n):`${$p(n)} · ${a}`,t[0]=a,t[1]=n,t[2]=s):s=t[2];let c=s,l;t[3]!==a||t[4]!==n?(l=a??$p(n),t[3]=a,t[4]=n,t[5]=l):l=t[5];let u;t[6]!==i||t[7]!==o||t[8]!==c||t[9]!==r||t[10]!==n.key?(u=(e,t)=>(0,Q.jsx)(`button`,{type:`button`,"aria-label":c,"aria-current":o?`step`:void 0,onClick:()=>r(n.key),className:X(`flex min-h-8.5 w-full items-center gap-3 rounded-md px-1.5 py-2 text-left hover:bg-accent`,o&&`bg-brand-soft hover:bg-brand-soft`),children:i(t)}),t[6]=i,t[7]=o,t[8]=c,t[9]=r,t[10]=n.key,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,Q.jsx)(`li`,{children:(0,Q.jsx)(fr,{text:l,renderTrigger:u})}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function d2(e){let t=(0,$.c)(9),{done:n,current:r,label:i}=e,a=r&&`border-brand bg-background font-semibold text-brand`,o=n&&`border-brand bg-brand text-brand-foreground`,s;t[0]!==a||t[1]!==o?(s=X(`grid size-5 shrink-0 place-items-center rounded-full border border-border-strong text-2xs leading-none font-medium text-muted-foreground tabular-nums`,a,o),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==i?(c=n?(0,Q.jsx)(ir,{className:`size-3`,"aria-label":`Reviewed`}):i,t[3]=n,t[4]=i,t[5]=c):c=t[5];let l;return t[6]!==s||t[7]!==c?(l=(0,Q.jsx)(`span`,{className:s,children:c}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l}var f2={New:`default`,Changed:`outline`,Removed:`destructive`};function p2(e){let t=(0,$.c)(14),{title:n,parts:r,review:i,onGo:a,struck:o}=e,s=o!==void 0&&o;if(r.length===0)return null;let c;if(t[0]!==a||t[1]!==r||t[2]!==i||t[3]!==s||t[4]!==n){let e;t[6]!==a||t[7]!==i||t[8]!==s||t[9]!==n?(e=(e,t)=>(0,Q.jsxs)(`li`,{className:`flex min-h-8.5 min-w-0 flex-col items-stretch gap-1 py-2 @2xl/review:flex-row @2xl/review:items-center @2xl/review:gap-3`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 @2xl/review:w-21`,children:t===0&&(0,Q.jsx)(We,{variant:f2[n],children:n})}),(0,Q.jsxs)(fr,{className:`min-w-0 flex-1 leading-4.5`,text:e.detail?`${e.label} · ${e.detail}`:e.label,children:[(0,Q.jsx)(`span`,{className:X(`text-sm leading-4.5 font-medium`,s&&`text-muted-foreground line-through`),children:e.label}),e.detail&&(0,Q.jsxs)(`span`,{className:`text-ui text-muted-foreground`,children:[` `,`· `,e.detail]})]}),(0,Q.jsx)(m2,{part:e,review:i,onGo:a,inline:!0})]},e.id),t[6]=a,t[7]=i,t[8]=s,t[9]=n,t[10]=e):e=t[10],c=r.map(e),t[0]=a,t[1]=r,t[2]=i,t[3]=s,t[4]=n,t[5]=c}else c=t[5];let l;return t[11]!==c||t[12]!==n?(l=(0,Q.jsx)(`ul`,{"aria-label":n,className:`flex min-w-0 flex-col`,children:c}),t[11]=c,t[12]=n,t[13]=l):l=t[13],l}function m2(e){let t=(0,$.c)(11),{part:n,review:r,onGo:i,inline:a,label:o}=e,s=a!==void 0&&a,c=n.decision===void 0?void 0:r.layers[n.decision-1];if(!c||n.decision===void 0)return null;let l=s?`ghost`:`outline`,u=s&&`self-start @2xl/review:self-center`,d;t[0]===u?d=t[1]:(d=X(u),t[0]=u,t[1]=d);let f;t[2]!==c.id||t[3]!==i?(f=()=>i(Kp(c.id)),t[2]=c.id,t[3]=i,t[4]=f):f=t[4];let p=o??`Decision ${n.decision}`,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(_d,{}),t[5]=m):m=t[5];let h;return t[6]!==l||t[7]!==d||t[8]!==f||t[9]!==p?(h=(0,Q.jsxs)(Y,{type:`button`,variant:l,size:`sm`,className:d,onClick:f,children:[p,m]}),t[6]=l,t[7]=d,t[8]=f,t[9]=p,t[10]=h):h=t[10],h}function h2(e){let t=(0,$.c)(79),{stop:n,total:r,review:i,revision:a,scope:o,context:s,decision:c,finished:l,items:u,proofCurrent:d,pullRequestChip:f,onStep:p,onGo:m}=e,{layer:h}=n,g;t[0]!==h.id||t[1]!==i?(g=om(i,h.id),t[0]=h.id,t[1]=i,t[2]=g):g=t[2];let _=g,v,y,b,x,S,C,w,T;if(t[3]!==s||t[4]!==u||t[5]!==h.id||t[6]!==_||t[7]!==m||t[8]!==d||t[9]!==i||t[10]!==a||t[11]!==o||t[12]!==n){b=sm(i,n);let e=zr(i.proof,h.id),r;t[21]!==u||t[22]!==n.paths?(r=Zp(n.paths,u),t[21]=u,t[22]=n.paths,t[23]=r):r=t[23],y=r,v=r2,x=`Decision details`,S=`flex min-w-0 flex-col gap-6 text-xs`;let c;t[24]!==s||t[25]!==a||t[26]!==o?(c=e=>(0,Q.jsx)(n2,{part:e,revision:a,scope:o,context:s},e.id),t[24]=s,t[25]=a,t[26]=o,t[27]=c):c=t[27],C=b.map(c),t[28]===_?w=t[29]:(w=_.length>0&&(0,Q.jsx)(y2,{links:_}),t[28]=_,t[29]=w),T=e.checks.length>0&&(0,Q.jsxs)(`section`,{"aria-label":`Proof`,className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`h3`,{className:`flex items-baseline justify-between border-b pb-2 font-medium text-muted-foreground`,children:[`Proof`,(0,Q.jsxs)(`span`,{className:`font-mono font-normal`,children:[`at `,a.headOid.slice(0,7)]})]}),!d&&(0,Q.jsx)(`p`,{className:`text-graph-4`,children:`These checks ran before the latest changes`}),(0,Q.jsx)(`ul`,{"aria-label":`Checks for this decision`,className:`flex flex-col gap-1.5`,children:ja(e.checks).map(g2)}),(0,Q.jsxs)(Y,{variant:`link`,size:`xs`,className:`self-start`,onClick:()=>m(`briefing`),children:[`All proof for this review`,(0,Q.jsx)(_d,{"data-icon":`inline-end`})]})]}),t[3]=s,t[4]=u,t[5]=h.id,t[6]=_,t[7]=m,t[8]=d,t[9]=i,t[10]=a,t[11]=o,t[12]=n,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T}else v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20];let E;t[30]!==x||t[31]!==S||t[32]!==C||t[33]!==w||t[34]!==T?(E=(0,Q.jsxs)(`aside`,{"aria-label":x,className:S,children:[C,w,T]}),t[30]=x,t[31]=S,t[32]=C,t[33]=w,t[34]=T,t[35]=E):E=t[35];let D;t[36]!==n.number||t[37]!==r?(D=(0,Q.jsxs)(`span`,{className:`text-ui leading-5.5 font-medium text-muted-foreground tabular-nums`,children:[`Decision `,n.number,` of `,r]}),t[36]=n.number,t[37]=r,t[38]=D):D=t[38];let O;t[39]===b.length?O=t[40]:(O=b.length>0&&(0,Q.jsxs)(We,{variant:`brand-soft`,children:[(0,Q.jsx)(zd,{}),` Needs your decision`]}),t[39]=b.length,t[40]=O);let k;t[41]===c?.stale?k=t[42]:(k=c?.stale&&(0,Q.jsxs)(We,{variant:`warn`,title:`Lines this decision points at changed after the agent explained them. Read the diff below, or ask the agent to publish a revision.`,children:[(0,Q.jsx)(Ul,{}),` Code moved since it was explained`]}),t[41]=c?.stale,t[42]=k);let A;t[43]===l?A=t[44]:(A=l&&(0,Q.jsxs)(We,{variant:`outline`,children:[(0,Q.jsx)(ir,{}),` Reviewed`]}),t[43]=l,t[44]=A);let j;t[45]!==f||t[46]!==k||t[47]!==A||t[48]!==D||t[49]!==O?(j=(0,Q.jsxs)(`div`,{className:`flex min-h-5.5 flex-wrap items-center gap-2.5`,children:[D,O,k,A,f]}),t[45]=f,t[46]=k,t[47]=A,t[48]=D,t[49]=O,t[50]=j):j=t[50];let M;t[51]===n.number?M=t[52]:(M=(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:`text-title-dim`,children:[n.number,`.`,` `]}),t[51]=n.number,t[52]=M);let N;t[53]!==h.title||t[54]!==M?(N=(0,Q.jsxs)(`h2`,{className:`text-page-title font-semibold wrap-anywhere`,children:[M,h.title]}),t[53]=h.title,t[54]=M,t[55]=N):N=t[55];let P;t[56]===h.summary?P=t[57]:(P=(0,Q.jsx)(x2,{text:h.summary}),t[56]=h.summary,t[57]=P);let F;t[58]!==j||t[59]!==N||t[60]!==P?(F=(0,Q.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-3.5`,children:[j,N,P]}),t[58]=j,t[59]=N,t[60]=P,t[61]=F):F=t[61];let I;t[62]!==h||t[63]!==p||t[64]!==y.reviewed||t[65]!==y.total?(I=(0,Q.jsx)(C2,{layer:h,reviewed:y.reviewed,total:y.total,onStep:p}),t[62]=h,t[63]=p,t[64]=y.reviewed,t[65]=y.total,t[66]=I):I=t[66];let L;t[67]!==m||t[68]!==i.layers||t[69]!==n.elsewhere?(L=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)(Y,{variant:`outline`,size:`xs`,className:`max-w-full`,onClick:()=>m(e.stop),children:[(0,Q.jsx)(fr,{text:Xn(e.path)}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.stop===`specs`?`· in Specs`:`· shown in decision ${i.layers.findIndex(t=>Kp(t.id)===e.stop)+1}`})]},e.path))]}),t[67]=m,t[68]=i.layers,t[69]=n.elsewhere,t[70]=L):L=t[70];let R;t[71]!==F||t[72]!==I||t[73]!==L?(R=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[F,I,L]}),t[71]=F,t[72]=I,t[73]=L,t[74]=R):R=t[74];let z;return t[75]!==v||t[76]!==R||t[77]!==E?(z=(0,Q.jsx)(v,{margin:E,children:R}),t[75]=v,t[76]=R,t[77]=E,t[78]=z):z=t[78],z}function g2(e){return(0,Q.jsxs)(`li`,{className:X(`flex items-start gap-1.5 wrap-anywhere`,e.result===`fail`&&`text-destructive`),children:[e.result===`fail`?(0,Q.jsx)(Vd,{className:`mt-px size-3.5 shrink-0`}):(0,Q.jsx)(zl,{className:`mt-px size-3.5 shrink-0 text-graph-2`}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[e.name,` · `,Li(e.result)]})]},e.name)}function _2(e){return e===`new`?`New`:e===`changed`?`Changed`:`Removed`}var v2={new:`default`,changed:`outline`,removed:`destructive`};function y2(e){let t=(0,$.c)(5),{links:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(`h3`,{className:`leading-4 font-medium text-muted-foreground`,children:`Contracts`}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=n.map(b2),t[1]=n,t[2]=i);let a;return t[3]===i?a=t[4]:(a=(0,Q.jsxs)(`section`,{"aria-label":`Contracts`,className:`flex min-w-0 flex-col gap-2`,children:[r,(0,Q.jsx)(`ul`,{"aria-label":`Connections`,className:`flex flex-wrap gap-1.5 @5xl/review:flex-col @5xl/review:gap-0 @5xl/review:divide-y @5xl/review:border-y`,children:i})]}),t[3]=i,t[4]=a),a}function b2(e){return(0,Q.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1.5 rounded-md border bg-background px-2 py-1 @5xl/review:items-start @5xl/review:justify-between @5xl/review:rounded-none @5xl/review:border-0 @5xl/review:bg-transparent @5xl/review:px-0 @5xl/review:py-2`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5 wrap-anywhere @5xl/review:flex-col @5xl/review:gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`leading-4.5 text-muted-foreground`,children:e.outgoing?e.verb:`${e.part.label} ${e.verb}`}),e.outgoing&&(0,Q.jsx)(`span`,{className:`text-ui leading-4.5 font-medium text-foreground`,children:e.part.label})]}),e.change&&(0,Q.jsx)(We,{variant:v2[e.change],children:_2(e.change)})]},e.part.id)}function x2(e){let t=(0,$.c)(9),{text:n}=e,[r,i]=(0,Z.useState)(!1),a=n.length>320,o=`text-lead text-pretty [&_p]:leading-7 ${a&&!r?`line-clamp-3`:``}`,s;t[0]!==o||t[1]!==n?(s=(0,Q.jsx)(Bj,{text:n,className:o}),t[0]=o,t[1]=n,t[2]=s):s=t[2];let c;t[3]!==a||t[4]!==r?(c=a&&(0,Q.jsx)(Y,{variant:`link`,size:`xs`,onClick:()=>i(S2),children:r?`Show less`:`Read more`}),t[3]=a,t[4]=r,t[5]=c):c=t[5];let l;return t[6]!==s||t[7]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-1 text-foreground-2`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function S2(e){return!e}function C2(e){let t=(0,$.c)(31),{layer:n,reviewed:r,total:i,onStep:a}=e;if(n.steps.length===0)return null;let o,s,c,l,u;if(t[0]!==n){let e=rm(n);l=`Route through the system`,u=`flex flex-col`,o=`flex flex-wrap items-center gap-x-3.5 gap-y-1 border-b pb-1.5 text-xs text-muted-foreground`;let r;t[6]===n.steps.length?r=t[7]:(r=Kr(n.steps.length,`stop`),t[6]=n.steps.length,t[7]=r),t[8]===r?s=t[9]:(s=(0,Q.jsx)(`span`,{className:`font-medium tabular-nums`,children:r}),t[8]=r,t[9]=s),c=e.length>0&&(0,Q.jsx)(`ol`,{className:`order-last flex min-w-0 basis-full flex-wrap items-center gap-1.5 text-ui leading-4 font-medium text-foreground @2xl/review:order-none @2xl/review:flex-1 @2xl/review:basis-auto`,children:e.map(w2)}),t[0]=n,t[1]=o,t[2]=s,t[3]=c,t[4]=l,t[5]=u}else o=t[1],s=t[2],c=t[3],l=t[4],u=t[5];let d;t[10]===i?d=t[11]:(d=Kr(i,`file`),t[10]=i,t[11]=d);let f;t[12]!==r||t[13]!==d?(f=(0,Q.jsxs)(`span`,{className:`ml-auto tabular-nums`,children:[r,` of `,d,` reviewed here`]}),t[12]=r,t[13]=d,t[14]=f):f=t[14];let p;t[15]!==o||t[16]!==s||t[17]!==c||t[18]!==f?(p=(0,Q.jsxs)(`div`,{className:o,children:[s,c,f]}),t[15]=o,t[16]=s,t[17]=c,t[18]=f,t[19]=p):p=t[19];let m;t[20]!==n.lanes||t[21]!==n.steps||t[22]!==a?(m=n.steps.map((e,t)=>{let r=t===0||n.steps[t-1]?.lane!==e.lane?n.lanes[e.lane]:void 0;return(0,Q.jsx)(`li`,{className:r!==void 0&&t>0?`border-t`:``,children:(0,Q.jsx)(T2,{step:e,index:t,lane:r,current:t===0,onStep:a})},e.id)}),t[20]=n.lanes,t[21]=n.steps,t[22]=a,t[23]=m):m=t[23];let h;t[24]===m?h=t[25]:(h=(0,Q.jsx)(`ol`,{"aria-label":`Steps`,className:`flex flex-col`,children:m}),t[24]=m,t[25]=h);let g;return t[26]!==h||t[27]!==l||t[28]!==u||t[29]!==p?(g=(0,Q.jsxs)(`section`,{"aria-label":l,className:u,children:[p,h]}),t[26]=h,t[27]=l,t[28]=u,t[29]=p,t[30]=g):g=t[30],g}function w2(e,t){return(0,Q.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1.5`,children:[t>0&&(0,Q.jsx)(_d,{className:`size-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0`,children:e})]},`${e}:${t}`)}function T2(e){let t=(0,$.c)(13),{step:n,index:r,lane:i,current:a,onStep:o}=e,s;t[0]!==i||t[1]!==n.pointer.path?(s=[i,n.pointer.path].filter(Boolean),t[0]=i,t[1]=n.pointer.path,t[2]=s):s=t[2];let c=s.join(` · `),l;t[3]!==a||t[4]!==r||t[5]!==i||t[6]!==o||t[7]!==n||t[8]!==c?(l=(e,t)=>(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Go to step ${r+1}: ${n.title} · ${c}`,"aria-current":a?`step`:void 0,onClick:()=>o(n),className:X(`flex min-h-8 w-full min-w-0 items-start gap-3 rounded-md py-1.5 pr-1.5 text-left hover:bg-accent @2xl/review:items-center`),children:[t(i??``,`hidden w-22 shrink-0 text-xs text-muted-foreground @2xl/review:block`),(0,Q.jsx)(`span`,{className:X(`grid size-5 shrink-0 place-items-center rounded-full text-2xs leading-none tabular-nums`,a?`bg-brand-soft font-semibold text-brand`:`border border-border-strong font-medium text-muted-foreground`,n.kind===`context`&&`border border-dashed border-border-strong`),children:r+1}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 @2xl/review:flex-row @2xl/review:items-baseline @2xl/review:gap-3`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 text-sm leading-4.5 font-medium wrap-anywhere @2xl/review:flex-1`,children:[n.title,(0,Q.jsx)(E2,{step:n})]}),t(n.pointer.path,`font-mono text-xs text-muted-foreground @2xl/review:max-w-1/2`)]})]}),t[3]=a,t[4]=r,t[5]=i,t[6]=o,t[7]=n,t[8]=c,t[9]=l):l=t[9];let u;return t[10]!==l||t[11]!==c?(u=(0,Q.jsx)(fr,{text:c,renderTrigger:l}),t[10]=l,t[11]=c,t[12]=u):u=t[12],u}function E2(e){let t=(0,$.c)(7),{step:n}=e,r;t[0]===n?r=t[1]:(r=nm(n),t[0]=n,t[1]=r);let i=r;if(!i)return null;let a=i.tone===`warn`&&`font-medium text-warn`,o;t[2]===a?o=t[3]:(o=X(`ml-2 text-xs font-normal text-muted-foreground`,a),t[2]=a,t[3]=o);let s;return t[4]!==i.text||t[5]!==o?(s=(0,Q.jsx)(`span`,{className:o,children:i.text}),t[4]=i.text,t[5]=o,t[6]=s):s=t[6],s}function D2(e){let t=(0,$.c)(3),{current:n,onGo:r,code:i,...a}=e,{stops:o,items:s}=a,c=o.find(k2),l=o.find(O2),[u,d]=(0,Z.useState)(),f=e=>t=>{if(!t||e!==n.key||u===e)return;let r=u!==void 0;d(e),(r||e===`specs`&&c)&&t.scrollIntoView({block:`start`})},p=c&&(0,Q.jsxs)(`section`,{ref:f(c.key),"aria-label":$p(c),className:`flex min-w-0 scroll-mt-4 flex-col gap-5`,children:[(0,Q.jsx)(j2,{eyebrow:`After the decisions`,title:`Not explained`,lead:c.paths.length>0?`${c.paths.length} changed ${ui(c.paths.length,`file has`,`files have`)} no decision pointing at ${ui(c.paths.length,`it`,`them`)}. Read ${ui(c.paths.length,`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.`}),c.partial.length>0&&(0,Q.jsxs)(`section`,{"aria-labelledby":`closing-partial`,children:[(0,Q.jsxs)(`h3`,{id:`closing-partial`,className:`flex justify-between gap-3.5 border-b pb-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`font-medium tabular-nums`,children:[Kr(c.partial.length,`place`),` inside explained files`]}),(0,Q.jsx)(`span`,{className:`hidden @2xl/review:inline`,children:`no step covers these lines`})]}),(0,Q.jsx)(`ul`,{"aria-label":`Unexplained lines in explained files`,className:`flex flex-col`,children:c.partial.map(e=>(0,Q.jsxs)(`li`,{className:`flex min-h-7.5 min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 py-1 pr-1.5 pl-0.5`,children:[(0,Q.jsx)(Ul,{className:`size-3.5 shrink-0 text-warn`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 font-mono text-caption leading-4 break-all`,title:e.path,children:e.path}),(0,Q.jsx)(`span`,{className:`text-xs leading-4 text-muted-foreground tabular-nums`,children:e.ranges.length>0?ON(e.ranges):`whole file`}),(0,Q.jsxs)(Y,{type:`button`,variant:`link`,size:`sm`,onClick:()=>r(e.stop),children:[`Read in `,A2(o,e.stop),(0,Q.jsx)(Pe,{})]})]},e.path))})]}),c.paths.length>0&&(0,Q.jsxs)(`section`,{"aria-labelledby":`closing-files`,className:`flex min-w-0 flex-col`,children:[(0,Q.jsxs)(`h3`,{id:`closing-files`,className:`flex justify-between pb-1 text-xs leading-4 text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`font-medium`,children:[Kr(c.paths.length,`file`),` no decision points at`]}),(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[Zp(c.paths,s).reviewed,` of`,` `,c.paths.length,` reviewed`]})]}),i(c)]})]}),m=l&&(0,Q.jsxs)(`section`,{ref:f(l.key),"aria-label":$p(l),className:`flex min-w-0 scroll-mt-4 flex-col gap-5`,children:[(0,Q.jsx)(j2,{size:`subpage`,eyebrow:`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.`}),i(l)]}),h;return t[0]!==p||t[1]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-12`,children:[p,m]}),t[0]=p,t[1]=m,t[2]=h):h=t[2],(0,Q.jsx)(r2,{margin:(0,Q.jsx)(`aside`,{"aria-label":`Completion`,className:`min-w-0 @5xl/review:sticky @5xl/review:top-4 @5xl/review:self-start`,children:(0,Q.jsx)(M2,{...a})}),children:h})}function O2(e){return e.kind===`specs`}function k2(e){return e.kind===`unexplained`}function A2(e,t){let n=e.find(e=>e.key===t);return n?n.kind===`decision`?`decision ${n.number}`:$p(n):t}function j2(e){let t=(0,$.c)(17),{eyebrow:n,title:r,lead:i,size:a}=e,o=a===void 0?`page`:a,s=o===`page`?`gap-2.5`:`gap-1.5`,c;t[0]===s?c=t[1]:(c=X(`flex min-w-0 flex-col`,s),t[0]=s,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,Q.jsx)(`p`,{className:`text-ui leading-5.5 font-medium text-muted-foreground`,children:n}),t[2]=n,t[3]=l);let u=o===`page`?`text-page-title`:`text-subpage-title`,d;t[4]===u?d=t[5]:(d=X(`font-semibold text-balance`,u),t[4]=u,t[5]=d);let f;t[6]!==d||t[7]!==r?(f=(0,Q.jsx)(`h2`,{className:d,children:r}),t[6]=d,t[7]=r,t[8]=f):f=t[8];let p=`text-pretty text-foreground-2 ${o===`page`?`text-lead`:`text-reading`}`,m;t[9]!==i||t[10]!==p?(m=(0,Q.jsx)(`p`,{className:p,children:i}),t[9]=i,t[10]=p,t[11]=m):m=t[11];let h;return t[12]!==c||t[13]!==l||t[14]!==f||t[15]!==m?(h=(0,Q.jsxs)(`header`,{className:c,children:[l,f,m]}),t[12]=c,t[13]=l,t[14]=f,t[15]=m,t[16]=h):h=t[16],h}function M2(e){let t=(0,$.c)(106),{stops:n,revision:r,record:i,items:a,threads:o,pullRequest:s,archivable:c,status:l,scope:u,context:d}=e,[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),g=l.total>0&&l.reviewed===l.total,_,v,y,b,x,S,C,w,T,E,D,O,k,A;if(t[0]!==g||t[1]!==a||t[2]!==r||t[3]!==l.reviewed||t[4]!==l.total||t[5]!==n||t[6]!==o){v=Zp(n.flatMap(F2),a);let e=n.find(P2),i=n.find(N2),s;t[21]===o?s=t[22]:(s=Xo(o),t[21]=o,t[22]=s),y=s.open;let c;t[23]===r?c=t[24]:(c=cm(r),t[23]=r,t[24]=c);let u=c.notProven.length,d;t[25]===r.content.proof?d=t[26]:(d=ca(r.content.proof),t[25]=r.content.proof,t[26]=d);let f=d;O=`Review completion`,k=`flex min-w-0 flex-col gap-3 rounded-paper border bg-card px-3 pt-3.5 pb-3 text-xs shadow-sm`;let p;t[27]===g?p=t[28]:(p=g?(0,Q.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center rounded-full bg-brand text-brand-foreground`,children:(0,Q.jsx)(ir,{className:`size-2.75`,strokeWidth:3})}):(0,Q.jsx)(to,{className:`size-5 shrink-0 text-muted-foreground`}),t[27]=g,t[28]=p);let m;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(`h3`,{className:`text-card-title font-semibold`,children:`Decisions reviewed`}),t[29]=m):m=t[29];let h=l.reviewed,j;t[30]===l.total?j=t[31]:(j=Kr(l.total,`decision`),t[30]=l.total,t[31]=j);let M;t[32]!==l.reviewed||t[33]!==j?(M=(0,Q.jsxs)(`p`,{className:`text-muted-foreground tabular-nums`,children:[h,` of `,j]}),t[32]=l.reviewed,t[33]=j,t[34]=M):M=t[34];let N=v.reviewed,P=Kr(v.total,`file`),F;t[35]!==v.reviewed||t[36]!==P?(F=(0,Q.jsxs)(`p`,{className:`text-muted-foreground tabular-nums`,children:[N,` of `,P,` reviewed`]}),t[35]=v.reviewed,t[36]=P,t[37]=F):F=t[37];let I;t[38]!==M||t[39]!==F?(I=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[m,M,F]}),t[38]=M,t[39]=F,t[40]=I):I=t[40],t[41]!==p||t[42]!==I?(A=(0,Q.jsxs)(`header`,{className:`flex items-start gap-2`,children:[p,I]}),t[41]=p,t[42]=I,t[43]=A):A=t[43];let L;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(`h4`,{className:`font-medium text-muted-foreground`,children:`Agent recommendation`}),t[44]=L):L=t[44];let R=r.verdict.recommendation===`merge`?`Merge`:`Hold`;t[45]!==r.revision||t[46]!==R?(x=(0,Q.jsxs)(`section`,{"aria-label":`Agent recommendation`,className:`flex flex-col gap-1.25 border-t pt-3`,children:[L,(0,Q.jsxs)(`p`,{className:`font-medium`,children:[R,` · r`,r.revision]})]}),t[45]=r.revision,t[46]=R,t[47]=x):x=t[47];let z;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(`h4`,{className:`mb-1 font-medium text-muted-foreground`,children:`Published proof`}),t[48]=z):z=t[48];let B=f.passing+f.failing===0?`None published`:`${f.passing} passed · ${f.failing} failed`,V;t[49]===B?V=t[50]:(V=(0,Q.jsx)(I2,{label:`Checks`,children:B}),t[49]=B,t[50]=V);let H;t[51]===u?H=t[52]:(H=(0,Q.jsx)(I2,{label:`Not proven`,children:u}),t[51]=u,t[52]=H),t[53]!==V||t[54]!==H?(S=(0,Q.jsxs)(`section`,{"aria-label":`Published proof`,className:`flex flex-col gap-0.5 border-t pt-3`,children:[z,V,H]}),t[53]=V,t[54]=H,t[55]=S):S=t[55],w=`Still open`,T=`flex flex-col gap-0.5 border-t pt-3`,t[56]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(`h4`,{className:`mb-1 font-medium text-muted-foreground`,children:`Still open`}),t[56]=E):E=t[56];let U=Kr(e?.paths.length??0,`file`);t[57]===U?D=t[58]:(D=(0,Q.jsx)(I2,{label:`Not explained`,children:U}),t[57]=U,t[58]=D),_=I2,b=`Specs`,C=Kr(i?.paths.length??0,`file`),t[0]=g,t[1]=a,t[2]=r,t[3]=l.reviewed,t[4]=l.total,t[5]=n,t[6]=o,t[7]=_,t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=D,t[18]=O,t[19]=k,t[20]=A}else _=t[7],v=t[8],y=t[9],b=t[10],x=t[11],S=t[12],C=t[13],w=t[14],T=t[15],E=t[16],D=t[17],O=t[18],k=t[19],A=t[20];let j;t[59]!==_||t[60]!==b||t[61]!==C?(j=(0,Q.jsx)(_,{label:b,children:C}),t[59]=_,t[60]=b,t[61]=C,t[62]=j):j=t[62];let M=y===0?`None open`:`${y} open`,N;t[63]===M?N=t[64]:(N=(0,Q.jsx)(I2,{label:`Comments`,children:M}),t[63]=M,t[64]=N);let P=v.total-v.reviewed,F;t[65]===P?F=t[66]:(F=(0,Q.jsx)(I2,{label:`Files left`,children:P}),t[65]=P,t[66]=F);let I;t[67]!==j||t[68]!==N||t[69]!==F||t[70]!==w||t[71]!==T||t[72]!==E||t[73]!==D?(I=(0,Q.jsxs)(`section`,{"aria-label":w,className:T,children:[E,D,j,N,F]}),t[67]=j,t[68]=N,t[69]=F,t[70]=w,t[71]=T,t[72]=E,t[73]=D,t[74]=I):I=t[74];let L,R;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>p(!0),R=(0,Q.jsx)(ep,{}),t[75]=L,t[76]=R):(L=t[75],R=t[76]);let z;t[77]===f?z=t[78]:(z=(0,Q.jsxs)(Y,{ref:h,type:`button`,variant:`default`,"aria-expanded":f,onClick:L,children:[R,`Ask the agent`]}),t[77]=f,t[78]=z);let B;t[79]!==m||t[80]!==f||t[81]!==d||t[82]!==r.base||t[83]!==r.headOid||t[84]!==u?(B=f&&(0,Q.jsx)(lQ,{scope:u,context:d,anchor:ha({base:r.base,tip:r.headOid}),onClose:()=>{p(!1),m?.focus()}}),t[79]=m,t[80]=f,t[81]=d,t[82]=r.base,t[83]=r.headOid,t[84]=u,t[85]=B):B=t[85];let V;t[86]===s?V=t[87]:(V=s?.state===`open`&&(0,Q.jsxs)(`a`,{href:s.url,target:`_blank`,rel:`noopener noreferrer`,className:Do({variant:`outline`}),children:[`Merge on GitHub`,(0,Q.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[`#`,s.number]}),(0,Q.jsx)(Zd,{})]}),t[86]=s,t[87]=V);let H;t[88]!==c||t[89]!==d||t[90]!==s||t[91]!==i?(H=c&&i?(0,Q.jsx)(yG,{connection:d.connection,reviewId:i.reviewId}):s?.state===`open`&&(0,Q.jsxs)(`p`,{className:`flex items-start gap-1.5 text-muted-foreground`,children:[(0,Q.jsx)(dd,{className:`mt-px size-3.5 shrink-0`}),`Archive appears here once #`,s.number,` is merged.`]}),t[88]=c,t[89]=d,t[90]=s,t[91]=i,t[92]=H):H=t[92];let U;t[93]!==z||t[94]!==B||t[95]!==V||t[96]!==H?(U=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t pt-3`,children:[z,B,V,H]}),t[93]=z,t[94]=B,t[95]=V,t[96]=H,t[97]=U):U=t[97];let W;return t[98]!==x||t[99]!==S||t[100]!==I||t[101]!==U||t[102]!==O||t[103]!==k||t[104]!==A?(W=(0,Q.jsxs)(`section`,{"aria-label":O,className:k,children:[A,x,S,I,U]}),t[98]=x,t[99]=S,t[100]=I,t[101]=U,t[102]=O,t[103]=k,t[104]=A,t[105]=W):W=t[105],W}function N2(e){return e.kind===`specs`}function P2(e){return e.kind===`unexplained`}function F2(e){return e.paths}function I2(e){let t=(0,$.c)(7),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`p`,{className:`flex items-baseline justify-between gap-3 text-ui leading-4.5`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function L2(e,t){let n=n=>{if(n.source!==e.contentWindow)return;let r=Sa(n.data);r!==null&&t(r)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function R2(e){let t=(0,$.c)(56),{revision:n,page:r,url:i,dark:a,stops:o,done:s,onGo:c}=e,l=n.content.layers,u,d,f,p,m,h,g,_,v;if(t[0]!==s||t[1]!==l||t[2]!==c||t[3]!==r||t[4]!==n.revision||t[5]!==o){let e=wo(r??``),i;t[15]!==l||t[16]!==c?(i=e=>{let t=l[e-1];t&&c(Kp(t.id))},t[15]=l,t[16]=c,t[17]=i):i=t[17],d=i,u=r2,g=`About the agent summary`,_=`flex min-w-0 flex-col gap-8 text-xs @5xl/review:pt-8`;let a;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`h3`,{className:`mb-2 leading-4 font-medium text-muted-foreground`,children:`The agent's page`}),t[18]=a):a=t[18];let y;t[19]===n.revision?y=t[20]:(y=(0,Q.jsxs)(`p`,{className:`border-t pt-2 text-ui leading-4.75`,children:[`The agent wrote this page for revision `,n.revision,`, for what the walkthrough cannot hold: a diagram, a screenshot.`]}),t[19]=n.revision,t[20]=y);let b;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`p`,{className:`mt-2 text-ui leading-4.75 text-muted-foreground`,children:`It runs in a sandbox, apart from Porcelain: it cannot reach your session, your files or the code. It only receives your theme.`}),t[21]=b):b=t[21],t[22]===y?v=t[23]:(v=(0,Q.jsxs)(`section`,{className:`flex flex-col`,children:[a,y,b]}),t[22]=y,t[23]=v),f=`Links in this page`,p=`flex flex-col`,m=(0,Q.jsxs)(`h3`,{className:`mb-2 flex justify-between leading-4 font-medium text-muted-foreground`,children:[`Links in this page`,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:e.length})]}),h=e.length===0?(0,Q.jsx)(`p`,{className:`py-2 text-muted-foreground`,children:`This page links to no decisions.`}):(0,Q.jsx)(`ul`,{className:`flex flex-col divide-y border-y`,children:e.map(e=>{let t=l[e-1],n=o.find(e=>e.kind===`decision`&&e.layer.id===t?.id),r=n!==void 0&&s(n);return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,disabled:!t,onClick:()=>d(e),className:`flex min-h-7.5 w-full items-start gap-2 rounded-md py-1.5 pr-1 text-left text-ui leading-4.5 hover:bg-accent disabled:text-muted-foreground disabled:hover:bg-transparent`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:X(`grid size-4.5 shrink-0 place-items-center rounded-full border border-border-strong text-2xs leading-none font-medium text-muted-foreground tabular-nums`,r&&`border-brand bg-brand text-brand-foreground`),children:r?(0,Q.jsx)(ir,{className:`size-3`}):e}),(0,Q.jsx)(`span`,{className:`min-w-0 wrap-anywhere`,children:t?t.title:`Decision ${e} is not in this revision`})]})},e)})}),t[0]=s,t[1]=l,t[2]=c,t[3]=r,t[4]=n.revision,t[5]=o,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}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];let y;t[24]!==f||t[25]!==p||t[26]!==m||t[27]!==h?(y=(0,Q.jsxs)(`section`,{"aria-label":f,className:p,children:[m,h]}),t[24]=f,t[25]=p,t[26]=m,t[27]=h,t[28]=y):y=t[28];let b;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`p`,{className:`text-ui leading-4.75 text-muted-foreground`,children:`A decision link, here or in the page, opens that decision in the Walkthrough.`}),t[29]=b):b=t[29];let x;t[30]!==g||t[31]!==_||t[32]!==v||t[33]!==y?(x=(0,Q.jsxs)(`aside`,{"aria-label":g,className:_,children:[v,y,b]}),t[30]=g,t[31]=_,t[32]=v,t[33]=y,t[34]=x):x=t[34];let S;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-5.5 shrink-0 place-items-center rounded-md border border-border-strong`,children:(0,Q.jsx)(Cd,{className:`size-3.25`})}),t[35]=S):S=t[35];let C;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(`strong`,{className:`font-semibold`,children:`The agent`}),t[36]=C):C=t[36];let w=n.revision,T;t[37]===n.publishedAt?T=t[38]:(T=Xa(n.publishedAt),t[37]=n.publishedAt,t[38]=T);let E;t[39]!==n.revision||t[40]!==T?(E=(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[C,(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,`wrote this page · revision `,w,` ·`,` `,T]})]}),t[39]=n.revision,t[40]=T,t[41]=E):E=t[41];let D;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(We,{variant:`outline`,title:`The agent's page runs in an opaque sandbox: it cannot reach Porcelain, your session, your files or the code. It receives only your theme.`,children:[(0,Q.jsx)(Sp,{}),`Sandboxed`]}),t[42]=D):D=t[42];let O;t[43]===E?O=t[44]:(O=(0,Q.jsxs)(`div`,{className:`flex min-h-7 min-w-0 flex-wrap items-center gap-2 text-ui leading-4.5`,children:[S,E,D]}),t[43]=E,t[44]=O);let k;t[45]!==a||t[46]!==d||t[47]!==i?(k=i===void 0?(0,Q.jsx)(`div`,{className:`min-h-96 rounded-xl border bg-background`,children:(0,Q.jsx)(dn,{label:`Loading the agent's page`})}):(0,Q.jsx)(`iframe`,{ref:e=>e?L2(e,d):void 0,title:`Review summary`,src:`${i}#theme=${a?`dark`:`light`}`,sandbox:`allow-scripts allow-forms allow-popups allow-modals`,referrerPolicy:`no-referrer`,className:`h-svh max-h-screen min-h-96 w-full rounded-xl border bg-background`}),t[45]=a,t[46]=d,t[47]=i,t[48]=k):k=t[48];let A;t[49]!==O||t[50]!==k?(A=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[O,k]}),t[49]=O,t[50]=k,t[51]=A):A=t[51];let j;return t[52]!==u||t[53]!==x||t[54]!==A?(j=(0,Q.jsx)(u,{margin:x,children:A}),t[52]=u,t[53]=x,t[54]=A,t[55]=j):j=t[55],j}function z2(e){let t=(0,$.c)(42),{label:n,shortLabel:r,compactLabel:i,stops:a,current:o,onGo:s,onPrevious:c,onNext:l,children:u}=e,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Td,{}),t[0]=d):d=t[0];let f;t[1]===c?f=t[2]:(f=(0,Q.jsx)(B2,{label:`Previous stop`,keys:cc.previousStop,onClick:c,children:d}),t[1]=c,t[2]=f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(Pe,{}),t[3]=p):p=t[3];let m;t[4]===l?m=t[5]:(m=(0,Q.jsx)(B2,{label:`Next stop`,keys:cc.nextStop,onClick:l,children:p}),t[4]=l,t[5]=m);let h=`${n}, jump to a stop`,g;t[6]===h?g=t[7]:(g=(0,Q.jsx)(Y,{type:`button`,variant:`ghost`,className:`min-w-0 shrink-0 @md/review:shrink`,"aria-label":h}),t[6]=h,t[7]=g);let _=`${n}, jump to a stop`,v;t[8]===i?v=t[9]:(v=(0,Q.jsx)(`span`,{className:`@md/review:hidden`,children:i}),t[8]=i,t[9]=v);let y;t[10]===r?y=t[11]:(y=(0,Q.jsx)(`span`,{className:`hidden @md/review:inline @2xl/review:hidden`,children:r}),t[10]=r,t[11]=y);let b;t[12]===n?b=t[13]:(b=(0,Q.jsx)(`span`,{className:`hidden @2xl/review:inline`,children:n}),t[12]=n,t[13]=b);let x;t[14]!==b||t[15]!==_||t[16]!==v||t[17]!==y?(x=(0,Q.jsxs)(fr,{className:`min-w-0 tabular-nums`,text:_,children:[v,y,b]}),t[14]=b,t[15]=_,t[16]=v,t[17]=y,t[18]=x):x=t[18];let S;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(Hn,{className:`hidden @md/review:block`,"data-icon":`inline-end`}),t[19]=S):S=t[19];let C;t[20]!==x||t[21]!==g?(C=(0,Q.jsxs)(Pr,{render:g,children:[x,S]}),t[20]=x,t[21]=g,t[22]=C):C=t[22];let w;if(t[23]!==o||t[24]!==s||t[25]!==a){let e;t[27]!==o||t[28]!==s?(e=e=>(0,Q.jsx)(hr,{"aria-current":e.key===o?`step`:void 0,onClick:()=>s(e.key),children:e.kind===`briefing`?`Open the briefing`:$p(e)},e.key),t[27]=o,t[28]=s,t[29]=e):e=t[29],w=a.map(e),t[23]=o,t[24]=s,t[25]=a,t[26]=w}else w=t[26];let T;t[30]===w?T=t[31]:(T=(0,Q.jsx)(Ni,{side:`top`,children:w}),t[30]=w,t[31]=T);let E;t[32]!==C||t[33]!==T?(E=(0,Q.jsxs)(Ja,{children:[C,T]}),t[32]=C,t[33]=T,t[34]=E):E=t[34];let D;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(gI,{children:Ks(cc.previousStop)}),t[35]=D):D=t[35];let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsxs)(_I,{className:`mr-1.5 hidden @2xl/review:inline-flex`,children:[D,(0,Q.jsx)(gI,{children:Ks(cc.nextStop)})]}),t[36]=O):O=t[36];let k;return t[37]!==u||t[38]!==E||t[39]!==f||t[40]!==m?(k=(0,Q.jsx)(`div`,{className:`flex justify-center pt-4`,children:(0,Q.jsxs)(`nav`,{"aria-label":`Walkthrough dock`,className:`pointer-events-auto flex max-w-full min-w-0 items-center gap-0 rounded-full border bg-background p-1 @md/review:gap-1 @md/review:p-1.5 shadow-lg`,children:[f,m,E,O,u]})}),t[37]=u,t[38]=E,t[39]=f,t[40]=m,t[41]=k):k=t[41],k}function B2(e){let t=(0,$.c)(17),{label:n,keys:r,onClick:i,children:a}=e,o=!i,s;t[0]!==n||t[1]!==i||t[2]!==o?(s=(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-lg`,"aria-label":n,disabled:o,onClick:i}),t[0]=n,t[1]=i,t[2]=o,t[3]=s):s=t[3];let c;t[4]!==a||t[5]!==s?(c=(0,Q.jsx)(De,{render:s,children:a}),t[4]=a,t[5]=s,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=Ks(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(gI,{children:l}),t[9]=l,t[10]=u);let d;t[11]!==n||t[12]!==u?(d=(0,Q.jsxs)(Et,{children:[n,u]}),t[11]=n,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==c||t[15]!==d?(f=(0,Q.jsxs)(dt,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function V2(e,t){let n=(0,$.c)(6),r;n[0]===e?r=n[1]:(r=rt(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=Aa(r,i),o;return n[3]!==a||n[4]!==t?(o=e=>{a(t).then(t=>{_(t)&&e()})},n[3]=a,n[4]=t,n[5]=o):o=n[5],o}var H2=class extends Z.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,Q.jsx)(v,{description:s(this.state.error),onRetry:()=>this.props.reset(()=>this.setState({error:null}))}):this.props.children}};function U2(e){let t=(0,$.c)(9),{children:n,connection:r,scope:i,loadingLabel:a,documentKey:o}=e,s=a===void 0?`Loading review`:a,c=V2(r,i),l;t[0]===s?l=t[1]:(l=(0,Q.jsx)(dn,{label:s}),t[0]=s,t[1]=l);let u;t[2]!==n||t[3]!==o||t[4]!==c?(u=(0,Q.jsx)(H2,{reset:c,children:n},o),t[2]=n,t[3]=o,t[4]=c,t[5]=u):u=t[5];let d;return t[6]!==l||t[7]!==u?(d=(0,Q.jsx)(Z.Suspense,{fallback:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8],d}function W2(e){let t=(0,$.c)(41),{revision:n,context:r,navigation:i,layout:a,focused:o,onOpen:s,review:c,reviewActions:l,panelControl:u}=e,d=a.panes[o],f;t[0]!==o||t[1]!==a?(f=()=>a.step(o,-1),t[0]=o,t[1]=a,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p={ignoreInputs:!0},t[3]=p):p=t[3],pc(cc.previousTab,f,p);let m;t[4]!==o||t[5]!==a?(m=()=>a.step(o,1),t[4]=o,t[5]=a,t[6]=m):m=t[6];let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h={ignoreInputs:!0},t[7]=h):h=t[7],pc(cc.nextTab,m,h);let g;t[8]!==o||t[9]!==a||t[10]!==d?(g=()=>{d?.active&&a.close(o,d.active)},t[8]=o,t[9]=a,t[10]=d,t[11]=g):g=t[11];let _;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(_={ignoreInputs:!0},t[12]=_):_=t[12],pc(cc.closeTab,g,_);let v;t[13]!==o||t[14]!==a||t[15]!==d?(v=()=>{d?.active&&d.active!==`handoff`&&a.openToSide(o,d.active)},t[13]=o,t[14]=a,t[15]=d,t[16]=v):v=t[16];let y;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(y={ignoreInputs:!0},t[17]=y):y=t[17],pc(cc.openToSide,v,y);let b=qP(r.connection),x;if(t[18]!==b.projects||t[19]!==n.content.worktreeId||t[20]!==n.projectId){let e;t[22]!==n.content.worktreeId||t[23]!==n.projectId?(e=e=>e.id===n.projectId&&e.worktrees.some(e=>e.id===n.content.worktreeId&&e.available),t[22]=n.content.worktreeId,t[23]=n.projectId,t[24]=e):e=t[24],x=b.projects.some(e),t[18]=b.projects,t[19]=n.content.worktreeId,t[20]=n.projectId,t[21]=x}else x=t[21];let S=x,C;t[25]!==n.content.worktreeId||t[26]!==n.projectId?(C={projectId:n.projectId,worktreeId:n.content.worktreeId},t[25]=n.content.worktreeId,t[26]=n.projectId,t[27]=C):C=t[27];let w=C,T;t[28]!==r.connection||t[29]!==n.reviewId?(T=nn({connection:r.connection,reviewId:n.reviewId}),t[28]=r.connection,t[29]=n.reviewId,t[30]=T):T=t[30];let E=dm(n,Ts(Te(Rr(T))),{specsApart:zs(r.connection)}),D;t[31]!==S||t[32]!==r.connection||t[33]!==a.bindQuickOpen||t[34]!==a.recentFiles||t[35]!==s||t[36]!==w?(D=S&&(0,Q.jsx)(dK,{bindPopup:a.bindQuickOpen,openFiles:a.recentFiles,scope:w,connection:r.connection,onOpen:e=>s({kind:`file`,path:e})}),t[31]=S,t[32]=r.connection,t[33]=a.bindQuickOpen,t[34]=a.recentFiles,t[35]=s,t[36]=w,t[37]=D):D=t[37];let O=a.panes.map((e,t)=>(0,Q.jsx)(G2,{index:t===0?0:1,focused:o===t,layout:a,available:S,scope:w,context:r,navigation:t===0?i:void 0,onOpen:s,review:c,reviewActions:l,panelControl:u,firstTabCount:wq(E.reviewed,E.total)},t)),k;return t[38]!==D||t[39]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-paper border bg-card md:flex-row`,children:[D,O]}),t[38]=D,t[39]=O,t[40]=k):k=t[40],k}function G2(e){let t=(0,$.c)(73),{index:n,layout:r,scope:i,context:a,navigation:o,onOpen:s,review:c,reviewActions:l,panelControl:u,firstTabCount:d,available:f,focused:p}=e,{element:m,attach:h}=vI(),g=r.panes[n],_=(0,Z.useDeferredValue)(g?.active??null);if(!g)return null;let v;t[0]!==_||t[1]!==g.active||t[2]!==g.tabs?(v=g.active!==`handoff`&&g.tabs.includes(_??``)?_:g.active,t[0]=_,t[1]=g.active,t[2]=g.tabs,t[3]=v):v=t[3];let y=v,b=y!==g.active,x;t[4]!==n||t[5]!==r.split?(x=r.split?q2(n):null,t[4]=n,t[5]=r.split,t[6]=x):x=t[6];let S=x,C=y??void 0,w;t[7]===C?w=t[8]:(w=iq(C),t[7]=C,t[8]=w);let T=w,E=T?.kind===`handoff`,D;t[9]!==n||t[10]!==r?(D=e=>r.bindPane(n,e),t[9]=n,t[10]=r,t[11]=D):D=t[11];let O=S?`${n===0?`Left`:`Right`} pane`:void 0,k,A;t[12]!==n||t[13]!==r?(k=()=>r.selectPane(n),A=e=>r.focusPane(n,e.target),t[12]=n,t[13]=r,t[14]=k,t[15]=A):(k=t[14],A=t[15]);let j=n===1&&`border-t md:border-t-0 md:border-l`,M=n===1&&`motion-safe:animate-in motion-safe:fade-in-0 duration-150`,N;t[16]!==M||t[17]!==j?(N=X(`@container/pane relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,j,M),t[16]=M,t[17]=j,t[18]=N):N=t[18];let P=g.tabs,F=g.pinned,I;t[19]!==n||t[20]!==r?(I=lZ(r,n),t[19]=n,t[20]=r,t[21]=I):I=t[21];let L;t[22]!==l||t[23]!==h||t[24]!==E?(L=E?l:(0,Q.jsx)(`div`,{ref:h,role:`toolbar`,"aria-label":`Document controls`,className:`flex items-center gap-1`}),t[22]=l,t[23]=h,t[24]=E,t[25]=L):L=t[25];let R;t[26]!==f||t[27]!==a||t[28]!==n||t[29]!==r.split||t[30]!==i?(R=f&&(!r.split||n===1)&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-5 w-px bg-border`}),(0,Q.jsx)(hX,{scope:i,context:a})]}),t[26]=f,t[27]=a,t[28]=n,t[29]=r.split,t[30]=i,t[31]=R):R=t[31];let z;t[32]!==u||t[33]!==L||t[34]!==R?(z=(0,Q.jsxs)(Q.Fragment,{children:[L,u,R]}),t[32]=u,t[33]=L,t[34]=R,t[35]=z):z=t[35];let B;t[36]!==d||t[37]!==p||t[38]!==o||t[39]!==g.pinned||t[40]!==g.tabs||t[41]!==y||t[42]!==S||t[43]!==I||t[44]!==z?(B=(0,Q.jsx)(_Z,{tabs:P,pinned:F,active:y,reviewTitle:`Review`,firstTabCount:d,side:S,focused:p,leading:o,...I,trailing:z}),t[36]=d,t[37]=p,t[38]=o,t[39]=g.pinned,t[40]=g.tabs,t[41]=y,t[42]=S,t[43]=I,t[44]=z,t[45]=B):B=t[45];let V;t[46]!==g.tabs||t[47]!==b||t[48]!==c||t[49]!==E?(V=g.tabs.includes(`handoff`)&&(0,Q.jsx)(`div`,{"aria-hidden":!E,inert:!E||b,className:X(`flex min-h-0 flex-1 flex-col`,!E&&`pointer-events-none invisible absolute opacity-0 inset-x-0 top-12 bottom-0`),children:c}),t[46]=g.tabs,t[47]=b,t[48]=c,t[49]=E,t[50]=V):V=t[50];let H;t[51]!==a||t[52]!==T||t[53]!==p||t[54]!==s||t[55]!==b||t[56]!==i||t[57]!==E||t[58]!==y||t[59]!==S||t[60]!==m?(H=T&&!E&&(0,Q.jsx)(`div`,{inert:b,className:`flex min-h-0 flex-1 flex-col`,children:(0,Q.jsx)(U2,{documentKey:y??void 0,connection:a.connection,scope:i,children:(0,Q.jsx)(o0,{scope:i,context:a,document:T,onOpen:s,onBrowse:K2,sideLabel:Cq(S),active:p&&!b,toolbarTarget:b?null:m})})}),t[51]=a,t[52]=T,t[53]=p,t[54]=s,t[55]=b,t[56]=i,t[57]=E,t[58]=y,t[59]=S,t[60]=m,t[61]=H):H=t[61];let U;return t[62]!==p||t[63]!==b||t[64]!==N||t[65]!==B||t[66]!==V||t[67]!==H||t[68]!==D||t[69]!==O||t[70]!==k||t[71]!==A?(U=(0,Q.jsxs)(`section`,{ref:D,"aria-label":O,"data-focused":p,"aria-busy":b,onPointerDownCapture:k,onFocusCapture:A,className:N,children:[B,V,H]}),t[62]=p,t[63]=b,t[64]=N,t[65]=B,t[66]=V,t[67]=H,t[68]=D,t[69]=O,t[70]=k,t[71]=A,t[72]=U):U=t[72],U}function K2(){}function q2(e){return e===0?`left`:`right`}function J2(e){let t=(0,$.c)(6),{revision:n,place:r,paths:i,scope:a,context:o,marks:s,steps:c,active:l,decision:u,card:d,gaps:f,explanations:p,commentLabel:m}=e,h=c===void 0?[]:c,g=u!==void 0&&u,_=d===void 0?g:d,v=f===void 0||f,y=p===void 0||p,[b,x]=(0,Z.useState)(25),S;t[0]===n?S=t[1]:(S=e=>n.files.filter(t=>t.path===e),t[0]=n,t[1]=S);let C=i.flatMap(S),w=C.slice(0,b),T=w.length>0&&(0,Q.jsx)(Y2,{entry:JSON.stringify([`revision`,n.revision,r]),revision:n,files:w,scope:a,context:o,marks:s,steps:h,active:l,decision:g,card:_,gaps:v,explanations:y,commentLabel:m}),E=C.length>b&&(0,Q.jsx)(Y,{variant:`outline`,className:`m-3 self-start`,onClick:()=>x(b+25),children:`Read more files`}),D=h.some(e=>!C.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`}),h.filter(e=>!C.some(t=>t.path===e.pointer.path)).map((e,t)=>(0,Q.jsx)(Z2,{revision:n,scope:a,context:o,path:e.pointer.path,compact:g,step:e,active:l&&w.length===0&&t===0},e.id))]}),O;return t[2]!==D||t[3]!==T||t[4]!==E?(O=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col`,children:[T,E,D]}),t[2]=D,t[3]=T,t[4]=E,t[5]=O):O=t[5],O}function Y2(e){let t=(0,$.c)(21),{entry:n,revision:r,files:i,scope:a,context:o,marks:s,steps:c,active:l,decision:u,card:d,gaps:p,explanations:m,commentLabel:h}=e,g;t[0]!==o.connection||t[1]!==i||t[2]!==r.reviewId||t[3]!==r.revision?(g=F({connection:o.connection,reviewId:r.reviewId,revision:r.revision,paths:i.map(A$)}),t[0]=o.connection,t[1]=i,t[2]=r.reviewId,t[3]=r.revision,t[4]=g):g=t[4];let _=Rr(g),v=Ts(Te(_)),y=kZ(...(m?r.content.layers:[]).map(X2),p?OZ(r.content.notExplained):{}),b;t[5]!==o.connection||t[6]!==r.reviewId?(b=Ic({connection:o.connection,reviewId:r.reviewId}),t[5]=o.connection,t[6]=r.reviewId,t[7]=b):b=t[7];let x=b,[S,C]=xa(x.mark),[w,T]=xa(x.unmark),E=i.flatMap(e=>{let t=v?.diffs.find(t=>t.paths.includes(e.path)),n=lP(r.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(!n)return[];let i=e.newOid??e.oldOid??null,a=s.files.some(t=>t.path===e.path&&t.fingerprint===i),o=c.findIndex(t=>t.pointer.path===e.path);return[{...n,agentNotes:y[e.path]??[],comment:ZZ(r,e.path),review:{path:e.path,fingerprint:i,reviewed:a,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(OJ,{className:`cursor-pointer`,checked:a,"aria-label":pe(e.path,a?`reviewed`:`unreviewed`),disabled:!i||S.waiting||w.waiting,onCheckedChange:()=>i&&(a?T({kind:`file`,path:e.path,headBlobOid:i}):C({kind:`file`,revision:r.revision,path:e.path,headBlobOid:i}))})}),(0,Q.jsx)(Et,{children:pe(e.path,a?`reviewed`:`unreviewed`)})]}),o>=0&&(0,Q.jsx)(We,{variant:`brand-soft`,title:`Stop ${o+1}`,className:`ml-1`,children:o+1})]})}}]}),D;t[8]===_?D=t[9]:(D=qi(_)&&(0,Q.jsxs)(`div`,{role:`status`,className:`flex min-h-64 flex-col gap-3 p-4`,children:[(0,Q.jsx)(`span`,{children:`Loading revision code…`}),(0,Q.jsx)(On,{className:`h-7 w-full`}),(0,Q.jsx)(On,{className:`h-44 w-full`})]}),t[8]=_,t[9]=D);let O;t[10]===_?O=t[11]:(O=f(_)&&(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]=_,t[11]=O);let k;t[12]!==S||t[13]!==w?(k=(f(S)||f(w))&&(0,Q.jsx)(`p`,{role:`alert`,className:`p-3 text-destructive`,children:`The file mark could not be updated. Try again.`}),t[12]=S,t[13]=w,t[14]=k):k=t[14];let A=E.length>0&&(0,Q.jsx)(jQ,{scope:a,context:o,interaction:{active:l,worktreeId:r.reviewId,entry:n},entries:E,fullHeight:!0,threadMargin:u,decision:d,...h?{commentLabel:h}:{},onReview:e=>{let t=e.review;!t?.fingerprint||S.waiting||w.waiting||(t.reviewed?T({kind:`file`,path:t.path,headBlobOid:t.fingerprint}):C({kind:`file`,revision:r.revision,path:t.path,headBlobOid:t.fingerprint}))}}),j=(v||f(_))&&i.filter(e=>!E.some(t=>t.path===e.path)).map(e=>{let t=v?.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?CM(e,t,!1):`Diff unavailable`]}),c.filter(t=>t.pointer.path===e.path).map(e=>(0,Q.jsxs)(`article`,{"aria-label":`Step ${e.title}`,children:[(0,Q.jsx)(dQ,{compact:u,title:e.title,text:e.text}),e.published&&(0,Q.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap`,children:e.published.join(`
|
|
1395
|
-
`)})]},e.id))]},e.path)}),M;return t[15]!==D||t[16]!==O||t[17]!==k||t[18]!==A||t[19]!==j?(M=(0,Q.jsxs)(Q.Fragment,{children:[D,O,k,A,j]}),t[15]=D,t[16]=O,t[17]=k,t[18]=A,t[19]=j,t[20]=M):M=t[20],M}function X2(e,t){return DZ(e,t+1)}function Z2(e){let t=(0,$.c)(27),{revision:n,scope:r,context:i,path:a,step:o,active:s,compact:c}=e,l=c!==void 0&&c,u;t[0]!==i.connection||t[1]!==a||t[2]!==n.reviewId||t[3]!==n.revision?(u=_t({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]=u):u=t[4];let d=Rr(u),f;if(t[5]!==a||t[6]!==d||t[7]!==n){let e=Ts(Te(d));f=e?.kind===`text`?{...MZ(`review:${n.reviewId}:${n.revision}:${a}`,a,e.text),comment:ZZ(n,a)}:void 0,t[5]=a,t[6]=d,t[7]=n,t[8]=f}else f=t[8];let p=f,m=o?`Step ${o.title}`:`File ${a}`,h;t[9]!==l||t[10]!==o?(h=o&&(0,Q.jsx)(dQ,{compact:l,title:o.title,text:o.text}),t[9]=l,t[10]=o,t[11]=h):h=t[11];let g;t[12]!==s||t[13]!==l||t[14]!==i||t[15]!==p||t[16]!==a||t[17]!==d||t[18]!==n.reviewId||t[19]!==n.revision||t[20]!==r||t[21]!==o?(g=p?(0,Q.jsx)(`div`,{className:l?`max-h-48 overflow-auto`:void 0,children:(0,Q.jsx)(jQ,{decision:l,scope:r,context:i,interaction:{active:s,worktreeId:n.reviewId,entry:`file:${n.revision}:${a}`},entries:[p],fullHeight:!0})}):(0,Q.jsxs)(`div`,{className:`p-4 text-sm break-all`,children:[(0,Q.jsxs)(`p`,{children:[a,` ·`,` `,qi(d)?`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(`
|
|
1396
|
-
`)})]}),t[12]=s,t[13]=l,t[14]=i,t[15]=p,t[16]=a,t[17]=d,t[18]=n.reviewId,t[19]=n.revision,t[20]=r,t[21]=o,t[22]=g):g=t[22];let _;return t[23]!==m||t[24]!==h||t[25]!==g?(_=(0,Q.jsxs)(`article`,{"aria-label":m,className:`flex min-h-0 shrink-0 flex-col border-t`,children:[h,g]}),t[23]=m,t[24]=h,t[25]=g,t[26]=_):_=t[26],_}function Q2(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=e.url?(0,Q.jsx)($2,{...e,url:e.url}):(0,Q.jsx)(t4,{...e}),t[0]=e,t[1]=n),n}function $2(e){let t=(0,$.c)(28),{reviewId:n,context:r,url:i,onOpen:a,onShowPanel:o}=e,s;t[0]!==r.connection||t[1]!==n?(s=H({connection:r.connection,reviewId:n}),t[0]=r.connection,t[1]=n,t[2]=s):s=t[2];let c=Rr(s),l;t[3]===c?l=t[4]:(l=f(c)?void 0:Ts(Te(c)),t[3]=c,t[4]=l);let u=l,d;t[5]===i?d=t[6]:(d=vr(i),t[5]=i,t[6]=d);let p=d;if(u?.kind===`available`){let e;return t[7]!==a||t[8]!==u.pullRequest?(e=(0,Q.jsx)(e4,{pull:u.pullRequest,onOpen:a}),t[7]=a,t[8]=u.pullRequest,t[9]=e):e=t[9],e}let m;t[10]!==c||t[11]!==u?(m=!f(c)&&(u===void 0||u.kind===`not-linked`),t[10]=c,t[11]=u,t[12]=m):m=t[12];let h=m,g=h?`Reading pull request`:`GitHub unavailable. Open the Review panel to recover.`,_;t[13]===o?_=t[14]:(_=e=>o(e.currentTarget,!1),t[13]=o,t[14]=_);let v;t[15]===p?v=t[16]:(v=p&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{children:[`#`,p]}),(0,Q.jsx)(V1,{})]}),t[15]=p,t[16]=v);let y=h?`text-muted-foreground`:`inline-flex items-center gap-1 text-warn`,b;t[17]===h?b=t[18]:(b=!h&&(0,Q.jsx)(Ul,{"aria-hidden":`true`,className:`size-3`}),t[17]=h,t[18]=b);let x=h?`Reading…`:`GitHub unavailable`,S;t[19]!==x||t[20]!==y||t[21]!==b?(S=(0,Q.jsxs)(`span`,{className:y,children:[b,x]}),t[19]=x,t[20]=y,t[21]=b,t[22]=S):S=t[22];let C;return t[23]!==S||t[24]!==g||t[25]!==_||t[26]!==v?(C=(0,Q.jsxs)(H1,{variant:`linked`,description:g,icon:Rf,onClick:_,children:[v,S]}),t[23]=S,t[24]=g,t[25]=_,t[26]=v,t[27]=C):C=t[27],C}function e4(e){let t=(0,$.c)(39),{pull:n,onOpen:r}=e,i;t[0]!==n.checks||t[1]!==n.checksSummary||t[2]!==n.checksTruncated?(i=So(n.checks,n.checksTruncated,n.checksSummary),t[0]=n.checks,t[1]=n.checksSummary,t[2]=n.checksTruncated,t[3]=i):i=t[3];let a=i,o=n.state===`open`&&!n.matchesReviewHead,s=n.state===`open`?a.label:`Review closed`,c;t[4]!==a||t[5]!==o||t[6]!==n?(c=()=>n.state===`open`?o?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-warn`,children:[(0,Q.jsx)(Ul,{"aria-hidden":`true`,className:`size-3`}),io(n)]}):(0,Q.jsx)(B1,{tone:a.tone,label:a.short,className:`text-muted-foreground`}):(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`review closed`}),t[4]=a,t[5]=o,t[6]=n,t[7]=c):c=t[7];let l=c,u=n.number,d;t[8]===n?d=t[9]:(d=sa(n),t[8]=n,t[9]=d);let f;t[10]!==s||t[11]!==o||t[12]!==n?(f=o?io(n):s,t[10]=s,t[11]=o,t[12]=n,t[13]=f):f=t[13];let p=`Open pull request #${u}: ${d}. ${f}.`,m;t[14]===n?m=t[15]:(m=F1(n),t[14]=n,t[15]=m);let h;t[16]!==r||t[17]!==n.number?(h=()=>r(n.number),t[16]=r,t[17]=n.number,t[18]=h):h=t[18];let g;t[19]===n.number?g=t[20]:(g=(0,Q.jsxs)(`span`,{children:[`#`,n.number]}),t[19]=n.number,t[20]=g);let _;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(V1,{}),t[21]=_):_=t[21];let v;t[22]===n?v=t[23]:(v=I1(n),t[22]=n,t[23]=v);let y;t[24]===n?y=t[25]:(y=sa(n),t[24]=n,t[25]=y);let b;t[26]!==v||t[27]!==y?(b=(0,Q.jsx)(`span`,{className:v,children:y}),t[26]=v,t[27]=y,t[28]=b):b=t[28];let x;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(V1,{}),t[29]=x):x=t[29];let S;t[30]===l?S=t[31]:(S=l(),t[30]=l,t[31]=S);let C;return t[32]!==b||t[33]!==S||t[34]!==p||t[35]!==m||t[36]!==h||t[37]!==g?(C=(0,Q.jsxs)(H1,{variant:`linked`,description:p,icon:m,onClick:h,children:[g,_,b,x,S]}),t[32]=b,t[33]=S,t[34]=p,t[35]=m,t[36]=h,t[37]=g,t[38]=C):C=t[38],C}function t4(e){let t=(0,$.c)(24),{context:n,projectId:r,reviewId:i,branch:a,onShowPanel:o}=e,s;t[0]!==n.connection||t[1]!==r?(s=qt({connection:n.connection,projectId:r}),t[0]=n.connection,t[1]=r,t[2]=s):s=t[2];let c=Rr(s),l,u,d,p,m,h;if(t[3]!==a||t[4]!==c||t[5]!==i){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e=f(c)?void 0:Ts(Te(c));if(ma(void 0,e)){h=null;break bb0}u=e?.kind===`available`?tr(e.pullRequests,a,i).find(n4)?.pull:void 0,l=H1,d=u?`found`:`empty`,p=u?`Link pull request #${u.number} from the Review panel`:`Link pull request`,m=u?F1(u):void 0}t[3]=a,t[4]=c,t[5]=i,t[6]=l,t[7]=u,t[8]=d,t[9]=p,t[10]=m,t[11]=h}else l=t[6],u=t[7],d=t[8],p=t[9],m=t[10],h=t[11];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;t[12]!==u||t[13]!==o?(g=e=>o(e.currentTarget,u===void 0),t[12]=u,t[13]=o,t[14]=g):g=t[14];let _;t[15]===u?_=t[16]:(_=u?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{children:[`#`,u.number,` found`]}),(0,Q.jsx)(V1,{}),(0,Q.jsx)(`span`,{className:`text-brand`,children:`Link`})]}):`Link pull request`,t[15]=u,t[16]=_);let v;return t[17]!==l||t[18]!==d||t[19]!==p||t[20]!==m||t[21]!==g||t[22]!==_?(v=(0,Q.jsx)(l,{variant:d,description:p,icon:m,onClick:g,children:_}),t[17]=l,t[18]=d,t[19]=p,t[20]=m,t[21]=g,t[22]=_,t[23]=v):v=t[23],v}function n4(e){return e.heldBy===void 0}function r4(e,t,n,r){e&&n===t&&!e.matches(`:disabled`)&&(r(),document.activeElement===document.body&&e.focus())}function i4(e){let t=(0,$.c)(60),{reviewId:n,context:r,onOpenPullRequest:i}=e,a=eZ(n),o={connection:r.connection,reviewId:n},c=k(o),l=Rr(c),u=yr(c),d=H(o),p=Rr(d),m=yr(d),[h,g]=xa(Ic(o).setPullRequest),[_,v]=(0,Z.useState)(),y,b,x,S,C,w,T;if(t[0]!==r||t[1]!==_||t[2]!==a||t[3]!==h||t[4]!==l||t[5]!==p||t[6]!==n||t[7]!==g){T=Symbol.for(`react.early_return_sentinel`);bb0:{y=Ts(Te(l));let e;t[15]===p?e=t[16]:(e=f(p)?{kind:`failed`}:Ts(Te(p)),t[15]=p,t[16]=e),C=e,x=y?.review?.pullRequest;let i=Ts(Te(h));b=_!==void 0&&!h.waiting&&(f(h)||i?.kind===`unavailable`)?x?`linked`:`unlinked`:_;let o;t[17]===h?o=t[18]:(o=f(h)&&(0,Q.jsx)(no,{variant:`destructive`,className:`mt-2`,children:(0,Q.jsx)(Qn,{children:s(ht(h.cause))})}),t[17]=h,t[18]=o);let c=i?.kind===`unavailable`&&(0,Q.jsx)(no,{className:`mt-2`,children:(0,Q.jsxs)(Qn,{children:[Mt(i.reason).description,` Try again after GitHub is available.`]})}),u;if(t[19]!==o||t[20]!==c?(u=(0,Q.jsxs)(Q.Fragment,{children:[o,c]}),t[19]=o,t[20]=c,t[21]=u):u=t[21],S=u,!f(l)&&y?.review&&!x){let e;t[22]!==b||t[23]!==a?(e=e=>{r4(e,`unlinked`,b,()=>v(void 0)),a.attach(e)},t[22]=b,t[23]=a,t[24]=e):e=t[24];let i;t[25]===g?i=t[26]:(i=e=>{v(`linked`),g({pullRequest:e})},t[25]=g,t[26]=i),T=(0,Q.jsx)(_4,{context:r,reviewId:n,projectId:y.review.projectId,branch:y.review.branch,pending:h.waiting,outcome:S,controlRef:e,onLink:i});break bb0}w=x?vr(x):void 0}t[0]=r,t[1]=_,t[2]=a,t[3]=h,t[4]=l,t[5]=p,t[6]=n,t[7]=g,t[8]=y,t[9]=b,t[10]=x,t[11]=S,t[12]=C,t[13]=w,t[14]=T}else y=t[8],b=t[9],x=t[10],S=t[11],C=t[12],w=t[13],T=t[14];if(T!==Symbol.for(`react.early_return_sentinel`))return T;let E=w,D=y?.review?.state===`closed`,O;t[27]!==D||t[28]!==b||t[29]!==x||t[30]!==h.waiting||t[31]!==E||t[32]!==g?(O=x&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(p4,{url:x,number:E}),(0,Q.jsxs)(Ja,{children:[(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Pr,{render:(0,Q.jsx)(Y,{ref:e=>r4(e,`linked`,b,()=>v(void 0)),variant:`ghost`,size:`icon-sm`,"aria-label":`Pull request actions`,disabled:h.waiting}),children:(0,Q.jsx)(Yd,{})})}),(0,Q.jsx)(Et,{children:`Pull request actions`})]}),(0,Q.jsxs)(Ni,{align:`end`,className:`w-59`,children:[(0,Q.jsxs)(hr,{render:(0,Q.jsx)(`a`,{href:x,target:`_blank`,rel:`noreferrer`}),children:[(0,Q.jsx)(Ft,{}),`Open on GitHub`]}),(0,Q.jsxs)(hr,{onClick:()=>Yi(x,`pull request link`),children:[(0,Q.jsx)(He,{}),`Copy link`]}),(0,Q.jsx)(gs,{}),(0,Q.jsxs)(hr,{className:`items-start`,onClick:()=>{v(`unlinked`),g({pullRequest:void 0})},children:[(0,Q.jsx)(Rp,{className:`mt-0.5`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsxs)(`span`,{children:[`Unlink `,E?`#${E}`:`pull request`]}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:D?`The review stays closed and readable under Closed.`:`The review stays and follows its branch again.`})]})]})]})]})]}),t[27]=D,t[28]=b,t[29]=x,t[30]=h.waiting,t[31]=E,t[32]=g,t[33]=O):O=t[33];let A;t[34]!==l||t[35]!==u?(A=f(l)&&(0,Q.jsx)(no,{variant:`destructive`,className:`mt-1`,children:(0,Q.jsxs)(Qn,{children:[`Could not display this review.`,(0,Q.jsx)(Y,{variant:`outline`,size:`xs`,onClick:u,children:`Try again`})]})}),t[34]=l,t[35]=u,t[36]=A):A=t[36];let j;t[37]!==y?.review||t[38]!==l?(j=!f(l)&&!y?.review&&(0,Q.jsx)(On,{className:`mt-1 h-8 w-full`}),t[37]=y?.review,t[38]=l,t[39]=j):j=t[39];let M;t[40]!==x||t[41]!==h.waiting?(M=h.waiting&&x&&(0,Q.jsx)(`p`,{role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Unlinking…`}),t[40]=x,t[41]=h.waiting,t[42]=M):M=t[42];let N;t[43]!==r||t[44]!==y||t[45]!==x||t[46]!==E||t[47]!==i||t[48]!==C||t[49]!==l||t[50]!==m||t[51]!==p?(N=!f(l)&&y?.review&&x&&(0,Q.jsx)(a4,{url:x,projectId:y.review.projectId,context:r,number:E,pull:C,reviewHead:y.revision?.headOid,retrying:p.waiting,onRetry:m,onOpen:i}),t[43]=r,t[44]=y,t[45]=x,t[46]=E,t[47]=i,t[48]=C,t[49]=l,t[50]=m,t[51]=p,t[52]=N):N=t[52];let P;return t[53]!==S||t[54]!==O||t[55]!==A||t[56]!==j||t[57]!==M||t[58]!==N?(P=(0,Q.jsxs)(m4,{trailing:O,children:[A,j,M,N,S]}),t[53]=S,t[54]=O,t[55]=A,t[56]=j,t[57]=M,t[58]=N,t[59]=P):P=t[59],P}function a4(e){let t=(0,$.c)(26),{url:n,projectId:r,context:i,number:a,pull:o,reviewHead:s,retrying:c,onRetry:l,onOpen:u}=e,d;t[0]!==i.connection||t[1]!==r?(d=rs({connection:i.connection,projectId:r}),t[0]=i.connection,t[1]=r,t[2]=d):d=t[2];let f=Rr(d),p;if(t[3]!==f||t[4]!==n){let e=Ts(Te(f))?.repository,r=ka(n);p=e!==void 0&&r!==void 0&&e.toLowerCase()===r.toLowerCase()?e:r,t[3]=f,t[4]=n,t[5]=p}else p=t[5];let m=p;if(o?.kind===`available`){let e;t[6]!==a||t[7]!==u||t[8]!==n?(e=(0,Q.jsx)(s4,{url:n,number:a,onOpen:u}),t[6]=a,t[7]=u,t[8]=n,t[9]=e):e=t[9];let r;return t[10]!==o.pullRequest||t[11]!==s||t[12]!==e?(r=(0,Q.jsx)(o4,{pull:o.pullRequest,reviewHead:s,children:e}),t[10]=o.pullRequest,t[11]=s,t[12]=e,t[13]=r):r=t[13],r}let h=m??n,g;t[14]===h?g=t[15]:(g=(0,Q.jsx)(fr,{text:h,className:`font-mono text-xs leading-4.5 text-muted-foreground`}),t[14]=h,t[15]=g);let _;t[16]!==a||t[17]!==g?(_=(0,Q.jsx)(d4,{number:a,title:g}),t[16]=a,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==l||t[20]!==o||t[21]!==c?(v=o===void 0||o.kind===`not-linked`?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Reading pull request…`}):(0,Q.jsx)(u4,{reason:o.kind===`unavailable`?o.reason:void 0,retrying:c,onRetry:l}),t[19]=l,t[20]=o,t[21]=c,t[22]=v):v=t[22];let y;return t[23]!==_||t[24]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[_,v]}),t[23]=_,t[24]=v,t[25]=y):y=t[25],y}function o4(e){let t=(0,$.c)(37),{pull:n,reviewHead:r,children:i}=e,a;t[0]!==n.checks||t[1]!==n.checksSummary||t[2]!==n.checksTruncated?(a=So(n.checks,n.checksTruncated,n.checksSummary),t[0]=n.checks,t[1]=n.checksSummary,t[2]=n.checksTruncated,t[3]=a):a=t[3];let o=a,s=n.state===`open`&&!n.matchesReviewHead,c;t[4]!==n.number||t[5]!==n.title?(c=(0,Q.jsx)(d4,{number:n.number,title:n.title}),t[4]=n.number,t[5]=n.title,t[6]=c):c=t[6];let l;t[7]===n?l=t[8]:(l=(0,Q.jsx)(L1,{pull:n}),t[7]=n,t[8]=l);let u;t[9]!==n.baseBranch||t[10]!==n.state?(u=n.state===`merged`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{children:[`into `,(0,Q.jsx)(`span`,{className:`font-mono`,children:n.baseBranch})]}),(0,Q.jsx)(V1,{})]}),t[9]=n.baseBranch,t[10]=n.state,t[11]=u):u=t[11];let d;t[12]!==o||t[13]!==n.state?(d=n.state===`closed`?(0,Q.jsx)(`span`,{children:`not merged`}):(0,Q.jsx)(B1,{tone:o.tone,label:o.label}),t[12]=o,t[13]=n.state,t[14]=d):d=t[14];let f;t[15]!==n.headSha||t[16]!==n.matchesReviewHead||t[17]!==n.state?(f=n.state===`open`&&n.matchesReviewHead&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(V1,{}),(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`outline-none`}),children:`Same head`}),(0,Q.jsxs)(Et,{children:[`The pull request’s head, `,GK(n.headSha),`, is the commit this review reads`]})]})]}),t[15]=n.headSha,t[16]=n.matchesReviewHead,t[17]=n.state,t[18]=f):f=t[18];let p;t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==f?(p=(0,Q.jsxs)(f4,{children:[l,u,d,f]}),t[19]=l,t[20]=u,t[21]=d,t[22]=f,t[23]=p):p=t[23];let m;t[24]!==s||t[25]!==n||t[26]!==r?(m=s&&(0,Q.jsxs)(`p`,{className:`mt-2 flex items-start gap-1.5 text-xs leading-4.25 font-medium text-warn`,children:[(0,Q.jsx)(Ul,{"aria-hidden":`true`,className:`mt-0.5 size-3 shrink-0`}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[io(n),`.`,(0,Q.jsxs)(`span`,{className:`block font-mono font-normal wrap-anywhere text-muted-foreground`,children:[`PR at `,GK(n.headSha),` · review read`,` `,r?GK(r):`unknown`]})]})]}),t[24]=s,t[25]=n,t[26]=r,t[27]=m):m=t[27];let h;t[28]!==n.number||t[29]!==n.state?(h=n.state!==`open`&&(0,Q.jsx)(`p`,{className:`mt-2 text-xs leading-4.25 text-muted-foreground`,children:n.state===`merged`?`This review closed when #${n.number} merged. It stays readable under Closed.`:`This review closed with the pull request. It stays readable under Closed.`}),t[28]=n.number,t[29]=n.state,t[30]=h):h=t[30];let g;return t[31]!==i||t[32]!==c||t[33]!==p||t[34]!==m||t[35]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[c,p,m,h,i]}),t[31]=i,t[32]=c,t[33]=p,t[34]=m,t[35]=h,t[36]=g):g=t[36],g}function s4(e){let t=(0,$.c)(5),{url:n,number:r,onOpen:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(c4,{}),`Open pull request`]}),t[0]=a):a=t[0];let o=a,s;return t[1]!==r||t[2]!==i||t[3]!==n?(s=i&&r!==void 0?(0,Q.jsx)(Y,{variant:`outline`,className:l4,onClick:()=>i(r),children:o}):(0,Q.jsx)(Y,{variant:`outline`,className:l4,nativeButton:!1,render:(0,Q.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`}),children:o}),t[1]=r,t[2]=i,t[3]=n,t[4]=s):s=t[4],s}function c4(){let e=(0,$.c)(1),t;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)){let n=F1({state:`open`,draft:!1});t=(0,Q.jsx)(n,{"aria-hidden":`true`,className:`text-muted-foreground`}),e[0]=t}else t=e[0];return t}var l4=`mt-2.5 w-full`;function u4(e){let t=(0,$.c)(27),{reason:n,retrying:r,onRetry:i}=e,a=xi(),o;t[0]===n?o=t[1]:(o=n?Mt(n):{description:`Porcelain could not read the pull request.`,action:{kind:`retry`,label:`Try again`}},t[0]=n,t[1]=o);let s=o,{action:c}=s,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(f4,{children:(0,Q.jsx)(R1,{})}),t[2]=l):l=t[2];let u;t[3]===s.description?u=t[4]:(u=(0,Q.jsx)(`p`,{className:`mt-2 text-xs leading-4.25 text-foreground-2`,children:s.description}),t[3]=s.description,t[4]=u);let d;t[5]!==c.kind||t[6]!==c.label||t[7]!==a?(d=c.kind===`settings`&&(0,Q.jsxs)(Y,{variant:`outline`,className:X(l4,`mt-2`),onClick:()=>void a({to:`/settings/$section`,params:{section:`git`}}),children:[(0,Q.jsx)(bp,{"aria-hidden":`true`,strokeWidth:1.75,className:`size-3.5 text-muted-foreground`}),c.label]}),t[5]=c.kind,t[6]=c.label,t[7]=a,t[8]=d):d=t[8];let f;t[9]!==c.kind||t[10]!==c.label||t[11]!==c.url?(f=c.kind===`install`&&(0,Q.jsxs)(Y,{variant:`outline`,className:X(l4,`mt-2`),nativeButton:!1,render:(0,Q.jsx)(`a`,{href:c.url,target:`_blank`,rel:`noreferrer`}),children:[(0,Q.jsx)(Ft,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),c.label]}),t[9]=c.kind,t[10]=c.label,t[11]=c.url,t[12]=f):f=t[12];let p;t[13]!==c.kind||t[14]!==c.label||t[15]!==c.text?(p=c.kind===`copy`&&(0,Q.jsxs)(Y,{variant:`outline`,className:X(l4,`mt-2`),onClick:()=>Yi(c.text,`command`),children:[(0,Q.jsx)(He,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),c.label]}),t[13]=c.kind,t[14]=c.label,t[15]=c.text,t[16]=p):p=t[16];let m;t[17]!==c.kind||t[18]!==i||t[19]!==r?(m=c.kind!==`install`&&(0,Q.jsxs)(Y,{variant:c.kind===`retry`?`outline`:`ghost`,className:X(l4,`mt-2`),disabled:r,onClick:i,children:[(0,Q.jsx)(fp,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),`Try again`]}),t[17]=c.kind,t[18]=i,t[19]=r,t[20]=m):m=t[20];let h;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==m?(h=(0,Q.jsxs)(Q.Fragment,{children:[l,u,d,f,p,m]}),t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=m,t[26]=h):h=t[26],h}function d4(e){let t=(0,$.c)(7),{number:n,title:r}=e,i;t[0]===n?i=t[1]:(i=n!==void 0&&(0,Q.jsxs)(`span`,{className:`shrink-0 font-medium text-muted-foreground tabular-nums`,children:[`#`,n]}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=typeof r==`string`?(0,Q.jsx)(fr,{text:r,className:`min-w-0 font-semibold`}):r,t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-baseline gap-1.5 text-ui leading-4.5 whitespace-nowrap`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function f4(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`mt-2 flex min-h-5 min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs leading-4 whitespace-nowrap text-muted-foreground tabular-nums`,children:n}),t[0]=n,t[1]=r),r}function p4(e){let t=(0,$.c)(10),{url:n,number:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(Y,{variant:`ghost`,size:`sm`,className:`ml-auto`,nativeButton:!1,render:(0,Q.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`})}),t[0]=n,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Ft,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Q.jsxs)(De,{render:i,children:[`On GitHub`,a]}),t[3]=i,t[4]=o);let s=r?`#${r}`:`the pull request`,c;t[5]===s?c=t[6]:(c=(0,Q.jsxs)(Et,{children:[`Open `,s,` on github.com`]}),t[5]=s,t[6]=c);let l;return t[7]!==o||t[8]!==c?(l=(0,Q.jsxs)(dt,{children:[o,c]}),t[7]=o,t[8]=c,t[9]=l):l=t[9],l}function m4(e){let t=(0,$.c)(6),{trailing:n,children:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(`h3`,{className:`text-xs leading-6 font-medium text-muted-foreground`,children:`Pull request`}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,Q.jsxs)(`div`,{className:`flex h-6 shrink-0 items-center gap-0.5`,children:[i,n]}),t[1]=n,t[2]=a);let o;return t[3]!==r||t[4]!==a?(o=(0,Q.jsxs)(`section`,{"aria-label":`Pull request`,className:`mx-2.5 mt-3 mb-3 flex max-h-96 min-w-0 shrink-0 flex-col overflow-y-auto border-b px-1 pb-3`,children:[a,r]}),t[3]=r,t[4]=a,t[5]=o):o=t[5],o}function h4(e){let t=(0,$.c)(28),{pull:n,heldBy:r,context:i,pending:a,onLink:o,linkRef:s}=e,c;t[0]===n.checksSummary?c=t[1]:(c=mo(n.checksSummary),t[0]=n.checksSummary,t[1]=c);let l=c,u;t[2]!==n.number||t[3]!==n.title?(u=(0,Q.jsx)(d4,{number:n.number,title:n.title}),t[2]=n.number,t[3]=n.title,t[4]=u):u=t[4];let d;t[5]===n?d=t[6]:(d=(0,Q.jsx)(L1,{pull:n}),t[5]=n,t[6]=d);let f;t[7]!==l.label||t[8]!==l.tone?(f=(0,Q.jsx)(B1,{tone:l.tone,label:l.label}),t[7]=l.label,t[8]=l.tone,t[9]=f):f=t[9];let p;t[10]===n.author?p=t[11]:(p=n.author&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(V1,{}),(0,Q.jsx)(fr,{text:n.author,className:`min-w-0`})]}),t[10]=n.author,t[11]=p);let m;t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,Q.jsxs)(f4,{children:[d,f,p]}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==i||t[17]!==r||t[18]!==s||t[19]!==o||t[20]!==a||t[21]!==n.number||t[22]!==n.url?(h=r?(0,Q.jsx)(g4,{reviewId:r,number:n.number,context:i}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`mt-2 text-xs leading-4.25 text-muted-foreground`,children:`GitHub has it for this branch. Link it so the review follows it.`}),(0,Q.jsxs)(Y,{ref:s,className:`mt-2.5 w-full`,disabled:a,onClick:()=>o(n.url),children:[(0,Q.jsx)(Nn,{"aria-hidden":`true`,className:`size-3.5`}),`Link to this review`]})]}),t[16]=i,t[17]=r,t[18]=s,t[19]=o,t[20]=a,t[21]=n.number,t[22]=n.url,t[23]=h):h=t[23];let g;return t[24]!==u||t[25]!==m||t[26]!==h?(g=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[u,m,h]}),t[24]=u,t[25]=m,t[26]=h,t[27]=g):g=t[27],g}function g4(e){let t=(0,$.c)(9),{reviewId:n,number:r,context:i}=e,a;t[0]!==i.connection||t[1]!==n?(a=k({connection:i.connection,reviewId:n}),t[0]=i.connection,t[1]=n,t[2]=a):a=t[2];let o=Ts(Te(Rr(a))),s=o?.review?us(o.review,o.revision??void 0,void 0):void 0,c;t[3]!==n||t[4]!==s?(c=s?(0,Q.jsxs)(Q.Fragment,{children:[`the open review “`,(0,Q.jsx)(`span`,{className:`font-medium`,children:s}),`”`]}):`review ${n}`,t[3]=n,t[4]=s,t[5]=c):c=t[5];let l;return t[6]!==r||t[7]!==c?(l=(0,Q.jsxs)(`p`,{className:`mt-2 text-xs leading-4.25 wrap-anywhere text-foreground-2`,children:[`#`,r,` is already linked to`,` `,c,`. Unlink it there from the Pull request menu, then link it here.`]}),t[6]=r,t[7]=c,t[8]=l):l=t[8],l}function _4(e){let t=(0,$.c)(74),{context:n,reviewId:r,projectId:i,branch:a,pending:o,outcome:s,controlRef:c,onLink:l}=e,u;t[0]!==n.connection||t[1]!==i?(u=rs({connection:n.connection,projectId:i}),t[0]=n.connection,t[1]=i,t[2]=u):u=t[2];let d=Rr(u),p;t[3]===d?p=t[4]:(p=f(d)?void 0:Ts(Te(d))?.repository,t[3]=d,t[4]=p);let m=p,[h,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),x;t[5]===l?x=t[6]:(x=e=>{b(!1),l(e)},t[5]=l,t[6]=x);let S=x,C;t[7]!==n.connection||t[8]!==i?(C=qt({connection:n.connection,projectId:i}),t[7]=n.connection,t[8]=i,t[9]=C):C=t[9];let w=C,T=Rr(w),E=yr(w),D;t[10]!==c||t[11]!==o||t[12]!==T?(D=e=>{!o&&!T.waiting&&!qi(T)&&c(e)},t[10]=c,t[11]=o,t[12]=T,t[13]=D):D=t[13];let O=D,k,A,j,M,N,P,F,I,L,R;if(t[14]!==O||t[15]!==a||t[16]!==n||t[17]!==o||t[18]!==m||t[19]!==T||t[20]!==r||t[21]!==S){N=Symbol.for(`react.early_return_sentinel`);bb0:{R=f(T)?void 0:Ts(Te(T)),A=R?.kind===`available`?tr(R.pullRequests,a,r):[],j=A.find(v4);let e=A[0]?.pull;if(ma(void 0,R)){N=null;break bb0}let i=()=>{if(e&&A.length===1)return(0,Q.jsx)(p4,{url:e.url,number:e.number});if(m&&A.length===0)return(0,Q.jsxs)(Y,{variant:`ghost`,size:`sm`,nativeButton:!1,render:(0,Q.jsx)(`a`,{href:`https://github.com/${m}/compare/${encodeURIComponent(a)}?expand=1`,target:`_blank`,rel:`noreferrer`}),className:`ml-auto`,children:[`Create on GitHub`,(0,Q.jsx)(Ft,{"aria-hidden":`true`})]})};k=m4,t[32]===i?I=t[33]:(I=i(),t[32]=i,t[33]=I),L=A.length===0&&R?.kind===`available`&&(0,Q.jsxs)(`p`,{className:`mt-1 text-ui leading-4.75 wrap-anywhere text-foreground-2`,children:[`No pull request for`,` `,(0,Q.jsx)(`span`,{className:`font-mono text-xs leading-4.75 text-foreground`,children:a}),` `,`on GitHub.`]}),t[34]===T?M=t[35]:(M=qi(T)&&(0,Q.jsx)(On,{"aria-label":`Finding pull requests`,className:`mt-1 h-16 w-full`}),t[34]=T,t[35]=M),P=`flex min-w-0 flex-col gap-3`,F=A.map(e=>{let{pull:t,heldBy:r}=e;return(0,Q.jsx)(h4,{pull:t,heldBy:r,linkRef:j?.pull.number===t.number?O:void 0,context:n,pending:o,onLink:S},t.number)})}t[14]=O,t[15]=a,t[16]=n,t[17]=o,t[18]=m,t[19]=T,t[20]=r,t[21]=S,t[22]=k,t[23]=A,t[24]=j,t[25]=M,t[26]=N,t[27]=P,t[28]=F,t[29]=I,t[30]=L,t[31]=R}else k=t[22],A=t[23],j=t[24],M=t[25],N=t[26],P=t[27],F=t[28],I=t[29],L=t[30],R=t[31];if(N!==Symbol.for(`react.early_return_sentinel`))return N;let z;t[36]!==P||t[37]!==F?(z=(0,Q.jsx)(`div`,{className:P,children:F}),t[36]=P,t[37]=F,t[38]=z):z=t[38];let B;t[39]===T.waiting?B=t[40]:(B=T.waiting&&(0,Q.jsx)(`p`,{role:`status`,className:`mt-1.5 text-xs text-muted-foreground`,children:`Finding pull requests…`}),t[39]=T.waiting,t[40]=B);let V;t[41]!==A||t[42]!==R?.kind?(V=R?.kind===`available`&&A.length===0&&(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs leading-4.25 text-muted-foreground`,children:`When Porcelain finds one, it offers to link it. Or paste its link:`}),t[41]=A,t[42]=R?.kind,t[43]=V):V=t[43];let H;t[44]===R?H=t[45]:(H=R?.kind===`available`&&R.truncated&&(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs leading-4.25 text-muted-foreground`,children:`Some pull requests are not listed. Paste the link to choose one.`}),t[44]=R,t[45]=H);let U;t[46]!==o||t[47]!==E||t[48]!==T||t[49]!==R?(U=(f(T)||R?.kind===`unavailable`)&&(0,Q.jsx)(u4,{reason:R?.kind===`unavailable`?R.reason:void 0,retrying:T.waiting||o,onRetry:E}),t[46]=o,t[47]=E,t[48]=T,t[49]=R,t[50]=U):U=t[50];let W;t[51]!==O||t[52]!==j||t[53]!==_||t[54]!==o||t[55]!==S||t[56]!==h||t[57]!==R?(W=(!j||R?.kind===`available`&&R.truncated)&&(0,Q.jsxs)(`form`,{noValidate:!0,className:`mt-2 flex min-w-0 items-center gap-1.5`,onSubmit:e=>{e.preventDefault();let t=ki(h);v(t===void 0),t===void 0?b(!0):o||S(t)},children:[(0,Q.jsx)(se,{ref:O,"aria-label":`Pull request link`,type:`url`,required:!0,placeholder:`https://github.com/…/pull/482`,value:h,onChange:e=>{g(e.target.value),v(!1)},disabled:o,"aria-invalid":_||void 0,className:`min-w-0 flex-1`}),(0,Q.jsxs)(Y,{type:`submit`,variant:`outline`,"aria-label":`Link pull request`,className:`shrink-0`,disabled:o||h.trim()===``,children:[(0,Q.jsx)(Nn,{"aria-hidden":`true`,className:`size-3.5`}),o?`Linking…`:`Link`]})]}),t[51]=O,t[52]=j,t[53]=_,t[54]=o,t[55]=S,t[56]=h,t[57]=R,t[58]=W):W=t[58];let G;t[59]===_?G=t[60]:(G=_&&(0,Q.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-destructive`,children:`Paste a GitHub pull request link, such as https://github.com/owner/repo/pull/482.`}),t[59]=_,t[60]=G);let K=!y&&s,ee;return t[61]!==k||t[62]!==M||t[63]!==z||t[64]!==B||t[65]!==V||t[66]!==H||t[67]!==U||t[68]!==W||t[69]!==G||t[70]!==K||t[71]!==I||t[72]!==L?(ee=(0,Q.jsxs)(k,{trailing:I,children:[L,M,z,B,V,H,U,W,G,K]}),t[61]=k,t[62]=M,t[63]=z,t[64]=B,t[65]=V,t[66]=H,t[67]=U,t[68]=W,t[69]=G,t[70]=K,t[71]=I,t[72]=L,t[73]=ee):ee=t[73],ee}function v4(e){return e.heldBy===void 0}var y4=`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 b4(e){let t=(0,$.c)(31),{path:n,document:r,note:i,scopes:a,changeStatus:o,reviewStatus:s,commentCount:c,active:l,onOpen:u,sideLabel:d,onReview:f,canReview:p,onDiscard:m,indented:h}=e,g=h!==void 0&&h,_;t[0]===n?_=t[1]:(_=Xn(n),t[0]=n,t[1]=_);let v;t[2]===a?v=t[3]:(v=a.length>0?` · ${a.join(` + `)}`:``,t[2]=a,t[3]=v);let y=`${_}${v}`,b;t[4]!==r||t[5]!==m||t[6]!==u||t[7]!==f||t[8]!==n?(b=e=>{bb10:switch(e){case`review`:f();break bb10;case`comment`:u(r,{kind:`file`,filePath:n},{compose:!0});break bb10;case`open`:u(r);break bb10;case`open-to-side`:u(r,void 0,{toSide:!0});break bb10;case`open-file`:u({kind:`file`,path:n});break bb10;case`timeline`:u({kind:`timeline`,path:n});break bb10;case`copy-relative`:Yi(n,`relative path`);break bb10;case`discard`:m?.()}},t[4]=r,t[5]=m,t[6]=u,t[7]=f,t[8]=n,t[9]=b):b=t[9];let x=b,S=`Actions for ${n}`,C=m!==void 0,w;t[10]!==p||t[11]!==s||t[12]!==d||t[13]!==C?(w=ft({kind:`file`,status:s,canReview:p,sideLabel:d,canDiscard:C}),t[10]=p,t[11]=s,t[12]=d,t[13]=C,t[14]=w):w=t[14];let T;t[15]!==l||t[16]!==o||t[17]!==c||t[18]!==r||t[19]!==g||t[20]!==y||t[21]!==i||t[22]!==u||t[23]!==n||t[24]!==s?(T=e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":l,"aria-label":y,"aria-description":S4(o,s),title:i==null?n:`${n}\n${i}`,className:X(y4,`flex-1 text-muted-foreground`,g&&`pl-7`,l&&`bg-accent font-medium text-foreground`),onClick:e=>u(r,void 0,{toSide:e.altKey}),children:[(0,Q.jsx)(x4,{status:o,reviewStatus:s}),(0,Q.jsx)(pw,{path:n,className:`size-3.5 shrink-0`}),(0,Q.jsx)(fr,{className:X(`min-w-0 flex-1 `,s===`reviewed`&&`line-through decoration-muted-foreground/40`),text:Xn(n)}),c>0&&(0,Q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 text-2xs`,children:[(0,Q.jsx)(ep,{className:`size-3`}),c]})]}),e]}),t[15]=l,t[16]=o,t[17]=c,t[18]=r,t[19]=g,t[20]=y,t[21]=i,t[22]=u,t[23]=n,t[24]=s,t[25]=T):T=t[25];let E;return t[26]!==x||t[27]!==S||t[28]!==w||t[29]!==T?(E=(0,Q.jsx)(SQ,{label:S,actions:w,onAction:x,children:T}),t[26]=x,t[27]=S,t[28]=w,t[29]=T,t[30]=E):E=t[30],E}function x4(e){let t=(0,$.c)(16),{status:n,reviewStatus:r}=e,i=r??`unreviewed`,a;t[0]!==r||t[1]!==n?(a=S4(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,s=n===void 0&&`bg-muted-foreground/60`,c=(n===`added`||n===`untracked`)&&`bg-graph-2`,l=n===`modified`&&`bg-graph-4`,u=n===`deleted`&&`bg-destructive`,d=n===`renamed`&&`bg-graph-1`,f;t[3]!==s||t[4]!==c||t[5]!==l||t[6]!==u||t[7]!==d?(f=X(`size-1.5 rounded-full`,s,c,l,u,d),t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f):f=t[8];let p;t[9]===f?p=t[10]:(p=(0,Q.jsx)(`span`,{className:f}),t[9]=f,t[10]=p);let m;return t[11]!==o||t[12]!==i||t[13]!==n||t[14]!==p?(m=(0,Q.jsx)(`span`,{role:`img`,"aria-label":o,className:`grid w-3.5 shrink-0 place-items-center`,"data-review-state":i,"data-change-status":n,title:o,children:p}),t[11]=o,t[12]=i,t[13]=n,t[14]=p,t[15]=m):m=t[15],m}function S4(e,t){return`${e===void 0?`Change type unavailable`:Ou[e].label} · ${C4(t)}`}function C4(e){return e===`reviewed`?`Reviewed`:e===`stale`?`Changed since review`:`Not reviewed`}function w4(e){let t=(0,$.c)(10),{label:n,active:r,onOpen:i,className:a,children:o}=e,s=a===void 0?y4:a,c=`Actions for ${n}`,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=ft({kind:`section`}),t[0]=l):l=t[0];let u;t[1]!==r||t[2]!==o||t[3]!==s||t[4]!==i?(u=e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,Q.jsx)(`button`,{type:`button`,className:s,"aria-pressed":r,onClick:i,children:o}),e]}),t[1]=r,t[2]=o,t[3]=s,t[4]=i,t[5]=u):u=t[5];let d;return t[6]!==i||t[7]!==c||t[8]!==u?(d=(0,Q.jsx)(SQ,{label:c,actions:l,onAction:i,children:u}),t[6]=i,t[7]=c,t[8]=u,t[9]=d):d=t[9],d}function T4(e){let t=(0,$.c)(15),{name:n,count:r,expanded:i,onExpanded:a,onAll:o,action:s,children:c}=e,l=i?Hn:Pe,u;t[0]!==l||t[1]!==r||t[2]!==i||t[3]!==n||t[4]!==a?(u=e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:y4,"aria-label":n,"aria-expanded":i,onClick:()=>a(!i),children:[(0,Q.jsx)(fr,{className:`min-w-0 flex-1`,text:`${n} · ${Kr(r,`file`)}`}),(0,Q.jsx)(l,{className:`size-3.5 shrink-0`})]}),e]}),t[0]=l,t[1]=r,t[2]=i,t[3]=n,t[4]=a,t[5]=u):u=t[5];let d=u,f;t[6]!==s||t[7]!==n||t[8]!==o||t[9]!==d?(f=s?d(s):(0,Q.jsx)(SQ,{label:`Actions for ${n}`,actions:ft({kind:`group`}),onAction:e=>o(e===`expand-all`),children:d}),t[6]=s,t[7]=n,t[8]=o,t[9]=d,t[10]=f):f=t[10];let p=i&&c,m;return t[11]!==n||t[12]!==f||t[13]!==p?(m=(0,Q.jsxs)(`section`,{"aria-label":n,className:`mt-3 border-t pt-2`,children:[f,p]}),t[11]=n,t[12]=f,t[13]=p,t[14]=m):m=t[14],m}function E4(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)(D4,{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 D4(e){let t=(0,$.c)(39),{reviewId:n,revision:r,context:i,onOpen:a,activeEntry:o}=e,{connection:s}=i,c;t[0]!==s||t[1]!==n?(c=k({connection:s,reviewId:n}),t[0]=s,t[1]=n,t[2]=c):c=t[2];let l=Rr(c),u;t[3]!==s||t[4]!==n?(u=nn({connection:s,reviewId:n}),t[3]=s,t[4]=n,t[5]=u):u=t[5];let d=Rr(u),f;t[6]===l?f=t[7]:(f=Ts(Te(l)),t[6]=l,t[7]=f);let p=f,m;t[8]===d?m=t[9]:(m=Ts(Te(d)),t[8]=d,t[9]=m);let h=m,g=HX(`${n}:${r}`),_=JX(n),v=nZ(n,r);if(!p?.revision){let e=o===`handoff`,n;t[10]===a?n=t[11]:(n=()=>a({kind:`handoff`}),t[10]=a,t[11]=n);let r;return t[12]!==e||t[13]!==n?(r=(0,Q.jsx)(w4,{label:`Open review`,active:e,onOpen:n,children:`Open review`}),t[12]=e,t[13]=n,t[14]=r):r=t[14],r}let y=p.revision,b;t[15]!==a||t[16]!==g||t[17]!==_?(b=e=>{_.choose(void 0),g.setPlace(e),a({kind:`handoff`})},t[15]=a,t[16]=g,t[17]=_,t[18]=b):b=t[18];let x=b,S=o===`handoff`?g.place:void 0,C;t[19]!==a||t[20]!==v||t[21]!==g||t[22]!==y.content.layers||t[23]!==y.reviewId||t[24]!==y.revision?(C=e=>{let t=y.content.layers.find(t=>t.steps.some(t=>t.id===e.id));t&&g.setPlace(`decision:${t.id}`),v.choose(e.pointer.path,e.id),a({kind:`review-file`,reviewId:y.reviewId,revision:y.revision,path:e.pointer.path})},t[19]=a,t[20]=v,t[21]=g,t[22]=y.content.layers,t[23]=y.reviewId,t[24]=y.revision,t[25]=C):C=t[25];let w=o===`all-changes`,T;t[26]===a?T=t[27]:(T=()=>a($K),t[26]=a,t[27]=T);let E;t[28]!==w||t[29]!==T?(E={active:w,onOpen:T},t[28]=w,t[29]=T,t[30]=E):E=t[30];let D;return t[31]!==i||t[32]!==h||t[33]!==x||t[34]!==y||t[35]!==E||t[36]!==S||t[37]!==C?(D=(0,Q.jsx)(k4,{revision:y,marks:h,context:i,activeStop:S,onStop:x,onStep:C,allChanges:E}),t[31]=i,t[32]=h,t[33]=x,t[34]=y,t[35]=E,t[36]=S,t[37]=C,t[38]=D):D=t[38],D}var O4=`flex h-7 w-full min-w-0 items-center gap-2 rounded-md pr-1.5 pl-1 text-left text-ui leading-4.5 transition-colors hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring`;function k4(e){let t=(0,$.c)(21),{revision:n,marks:r,context:i,activeStop:a,onStop:o,onStep:s,allChanges:c}=e,l;t[0]!==i.connection||t[1]!==n.reviewId?(l=Ic({connection:i.connection,reviewId:n.reviewId}),t[0]=i.connection,t[1]=n.reviewId,t[2]=l):l=t[2];let u=l,[d,p]=xa(u.completeDecision),[m,h]=xa(u.unmark),[g,_]=xa(u.mark),v=zs(i.connection),y;if(t[3]!==a||t[4]!==c||t[5]!==p||t[6]!==d||t[7]!==_||t[8]!==g||t[9]!==r||t[10]!==s||t[11]!==o||t[12]!==n||t[13]!==v||t[14]!==h||t[15]!==m){let e=Jp(n.content,n.files.map(F4),{specsApart:v}),i=lm(n,r),l=um(n,r),u=d.waiting||m.waiting||g.waiting,b=e.filter(P4),x=e.filter(N4),S=e=>{let t=i.find(t=>t.path===e);t?.fingerprint&&(t.reviewStatus===`reviewed`?h({kind:`file`,path:e,headBlobOid:t.fingerprint}):_({kind:`file`,revision:n.revision,path:e,headBlobOid:t.fingerprint}))},C;t[17]!==d||t[18]!==g||t[19]!==m?(C=(f(d)||f(m)||f(g))&&(0,Q.jsx)(`p`,{role:`alert`,className:`p-2 text-caption text-destructive`,children:`The review mark could not be updated.`}),t[17]=d,t[18]=g,t[19]=m,t[20]=C):C=t[20],y=(0,Q.jsxs)(`nav`,{"aria-label":`Walkthrough`,className:`flex min-w-0 flex-col text-ui`,children:[(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-col gap-px`,children:b.map(e=>{let t=em(e,i,l),c=a===e.key,d=Zp(e.paths,i),f=i.filter(t=>e.paths.includes(t.path)),m=l.get(e.layer.id)?.stale===!0;return(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(SQ,{label:`More actions for decision ${e.number}`,description:e.layer.title,actions:ft({kind:`decision`,reviewed:t,stale:m,settled:r!==void 0,pending:u,files:f}),onAction:r=>{r===`open`&&o(e.key),r===`review`&&(t?h({kind:`decision`,layerId:e.layer.id,fingerprint:e.layer.fingerprint}):p({revision:n.revision,layerId:e.layer.id,fingerprint:e.layer.fingerprint,files:f.flatMap(M4)}))},children:n=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:X(O4,`flex-1`,t&&!c&&`text-muted-foreground`,c&&`bg-muted inset-ring inset-ring-border`),"aria-label":`${t?`✓`:e.number} ${Qp(e)}${m?` code moved`:``} ${d.reviewed}/${d.total}`,"aria-pressed":c,"aria-expanded":c,onClick:()=>o(e.key),children:[(0,Q.jsx)(L4,{number:e.number,reviewed:t,active:c}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[(0,Q.jsx)(fr,{className:X(`min-w-0 text-left`,c&&`font-semibold`),text:Qp(e)}),m&&(0,Q.jsx)(R4,{text:`code moved`,tone:`warn`})]}),c?(0,Q.jsx)(Hn,{"aria-hidden":!0,className:`size-3 shrink-0 text-muted-foreground`}):(0,Q.jsx)(Pe,{"aria-hidden":!0,className:`size-3 shrink-0 text-muted-foreground`})]}),n]})}),c&&(0,Q.jsx)(`ol`,{"aria-label":`Stops of decision ${e.number}`,className:`mt-0.5 mb-1 min-w-0`,children:e.layer.steps.map((e,t)=>{let n=i.find(t=>t.path===e.pointer.path),a=nm(e);return(0,Q.jsxs)(`li`,{className:`flex h-7 min-w-0 items-center gap-2 pl-7.5`,children:[n?.fingerprint?(0,Q.jsx)(z4,{path:e.pointer.path,checked:n.reviewStatus===`reviewed`,disabled:u||r===void 0,onToggle:()=>S(e.pointer.path)}):(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),(0,Q.jsx)(fr,{text:`${e.title} · ${e.pointer.path}`,renderTrigger:(n,r)=>(0,Q.jsxs)(`button`,{type:`button`,className:X(O4,`flex-1`),onClick:()=>s(e),children:[(0,Q.jsx)(`span`,{className:`w-2.5 shrink-0 text-right text-xs leading-4.5 font-medium text-muted-foreground tabular-nums`,children:t+1}),r(e.title,`min-w-0`),a&&(0,Q.jsx)(R4,{text:a.text,tone:a.tone})]})})]},e.id)})})]},e.key)})}),C,(x.length>0||c)&&(0,Q.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-col gap-px border-t pt-1.5`,children:[x.filter(j4).map(e=>(0,Q.jsx)(B4,{label:Qp(e),icon:uf,count:I4(e.paths,i),active:a===e.key,onOpen:()=>o(e.key)},e.key)),c&&(0,Q.jsx)(B4,{label:`All changes`,icon:gf,count:Kr(n.files.length,`file`),active:c.active,onOpen:c.onOpen}),x.filter(A4).map(e=>(0,Q.jsx)(B4,{label:`Open all specs`,icon:vf,count:I4(e.paths,i),active:a===e.key,onOpen:()=>o(e.key)},e.key))]})]}),t[3]=a,t[4]=c,t[5]=p,t[6]=d,t[7]=_,t[8]=g,t[9]=r,t[10]=s,t[11]=o,t[12]=n,t[13]=v,t[14]=h,t[15]=m,t[16]=y}else y=t[16];return y}function A4(e){return e.kind===`specs`}function j4(e){return e.kind===`unexplained`}function M4(e){return e.fingerprint?[{path:e.path,headBlobOid:e.fingerprint}]:[]}function N4(e){return e.kind===`unexplained`||e.kind===`specs`}function P4(e){return e.kind===`decision`}function F4(e){return e.path}function I4(e,t){let n=Zp(e,t);return n.total>0?`${n.reviewed}/${n.total}`:void 0}function L4(e){let t=(0,$.c)(6),{number:n,reviewed:r,active:i}=e;if(r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4.5 shrink-0 items-center justify-center rounded-full bg-brand text-brand-foreground`,children:(0,Q.jsx)(ir,{strokeWidth:3,className:`size-2.5`})}),t[0]=e):e=t[0],e}let a=i?`border border-brand bg-background font-semibold text-brand`:`border border-border-strong font-medium text-muted-foreground`,o;t[1]===a?o=t[2]:(o=X(`flex size-4.5 shrink-0 items-center justify-center rounded-full text-3xs leading-none tabular-nums`,a),t[1]=a,t[2]=o);let s;return t[3]!==n||t[4]!==o?(s=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:o,children:n}),t[3]=n,t[4]=o,t[5]=s):s=t[5],s}function R4(e){let t=(0,$.c)(5),{text:n,tone:r}=e,i=r===`warn`?`font-medium text-warn`:`text-muted-foreground`,a;t[0]===i?a=t[1]:(a=X(`shrink-0 text-xs leading-4`,i),t[0]=i,t[1]=a);let o;return t[2]!==a||t[3]!==n?(o=(0,Q.jsx)(`span`,{className:a,children:n}),t[2]=a,t[3]=n,t[4]=o):o=t[4],o}function z4(e){let t=(0,$.c)(5),{path:n,checked:r,disabled:i,onToggle:a}=e,o=`${n} reviewed`,s;return t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o?(s=(0,Q.jsx)(OJ,{checked:r,"aria-label":o,disabled:i,onCheckedChange:a}),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s):s=t[4],s}function B4(e){let t=(0,$.c)(17),{label:n,icon:r,count:i,active:a,onOpen:o}=e,s=a&&`bg-muted inset-ring inset-ring-border`,c;t[0]===s?c=t[1]:(c=X(`flex h-7 w-full min-w-0 flex-1 items-center gap-2 rounded-md px-1.5 text-left text-ui leading-4.5 font-medium transition-colors hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring`,s),t[0]=s,t[1]=c);let l;t[2]===r?l=t[3]:(l=(0,Q.jsx)(r,{strokeWidth:1.75,"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),t[2]=r,t[3]=l);let u;t[4]===n?u=t[5]:(u=(0,Q.jsx)(fr,{className:`min-w-0 flex-1`,text:n}),t[4]=n,t[5]=u);let d;t[6]===i?d=t[7]:(d=i&&(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-xs leading-4 font-normal text-muted-foreground tabular-nums`,children:i}),t[6]=i,t[7]=d);let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(Pe,{"aria-hidden":!0,className:`size-3 shrink-0 text-muted-foreground`}),t[8]=f):f=t[8];let p;return t[9]!==a||t[10]!==n||t[11]!==o||t[12]!==c||t[13]!==l||t[14]!==u||t[15]!==d?(p=(0,Q.jsxs)(w4,{label:n,active:a,onOpen:o,className:c,children:[l,u,d,f]}),t[9]=a,t[10]=n,t[11]=o,t[12]=c,t[13]=l,t[14]=u,t[15]=d,t[16]=p):p=t[16],p}function V4({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=H4(U4(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={...H4(a,o),ref:K4(a.ref,o.ref)};return Z.cloneElement(n,s)}function H4(...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`?K4(i,r):G4(n)&&typeof i==`function`&&typeof r==`function`?W4(r,i):r}}return t}function U4(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 W4(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function G4(e){return/^on[A-Z]/.test(e)}function K4(...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 q4=8,J4=64,Y4=0,X4=.5,Z4=180,Q4=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),$4={start:!1,end:!1},e3={currentAnchorId:null,visibleMessageIds:[]};function t3({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return $4;let i=p3({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function n3({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return e3;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of r3(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+X4&&(u=e)}return l.length===0&&u===null?e3:{currentAnchorId:u,visibleMessageIds:l}}function r3(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function i3(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function a3(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function o3(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 s3(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function c3({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of r3(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 l3({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=u3(t,i),o=t.getBoundingClientRect().height,s=g3(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 u3(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function d3(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function f3({content:e,scrollTop:t,spacer:n,viewport:r}){let i=p3({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function p3({content:e,spacer:t,viewport:n}){let r=r3(e,t),i=h3(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 m3(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function h3(e){let t=window.getComputedStyle(e);return{end:v3(t.paddingBlockEnd||t.paddingBottom),start:v3(t.paddingBlockStart||t.paddingTop)}}function g3(e){let t=e?.parentElement;return t?h3(t):{end:0,start:0}}function _3(e){if(!e)return 0;let t=window.getComputedStyle(e);return v3(t.rowGap===`normal`?t.gap:t.rowGap)}function v3(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function y3(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 b3(e,t){return y3(e,t)}function x3(){return y3(e3,C3)}function S3(e,t){return e.start===t.start&&e.end===t.end}function C3(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function w3({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=b3(t===`end`||t===`last-anchor`,(e,t)=>e===t)),O.current===null&&(O.current=b3($4,S3)),N.current===null&&(N.current=x3()),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 T3(e){e.pendingDefaultScrollStore.setSnapshot(!1)}function E3(e){e.defaultScrollPositionAppliedRef.current=!0,T3(e)}function D3({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()},Z4))},[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)<=X4){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(m3(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=l3({align:t,element:e,scrollMargin:o?a+h.current:a,spacer:v.current,viewport:l}),f=f3({content:s,scrollTop:u,spacer:v.current,viewport:l});return x(f),p.current={element:e,viewportTop:d3(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?(E3(e),T(r,n)?(f.current=null,!0):(f.current={messageId:t,options:n},!0)):l.current===0&&(f.current={messageId:t,options:n},E3(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,E3(e),!0)},[T]),reanchorToAnchoredMessage:E,scrollToElement:T,scrollToEnd:w,scrollToMessage:D,scrollToStart:C}}function O3(e,t){return Z.useCallback(n=>{e.current=n,n&&t()},[e,t])}function k3({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=q4,scrollPreviousItemPeek:r=J4,scrollMargin:i=Y4}){let a=w3({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-X4;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=t3({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(n3({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:K,scrollToMessage:ee,scrollToStart:q}=D3({refs:a,commitScrollState:B,scheduleStateCommit:V,scheduleVisibilitySync:H}),te=Z.useCallback(()=>{let e=y.current,t=j.current;if(!e||!t||!e.element.isConnected)return!1;let n=d3(e.element,t)-e.viewportTop;return Math.abs(n)<=X4?!1:(t.scrollTop+=n,e.viewportTop=d3(e.element,t),V(),H(),!0)},[V,H]),ne=Z.useCallback(()=>{let e=u.current,t=j.current;if(!e||!t){y.current=null;return}let n=c3({content:e,spacer:O.current,viewport:t});y.current=n?{element:n,viewportTop:d3(n,t)}:null},[]),re=Z.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,U()&&ne()}))},[ne,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?s3(r3(t,O.current)):null;if(!t||!n||!r)e=K({behavior:`auto`});else{let i=u3(r,n);e=p3({content:t,spacer:O.current,viewport:n})-i<=n.clientHeight?K({behavior:`auto`}):G(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?K({behavior:`auto`}):q({behavior:`auto`});return e?(E3(a),!0):!1},[t,G,K,q]),ae=Z.useCallback(()=>{let e=u.current;if(!e)return;let t=r3(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&&K({behavior:`auto`}))return;B(),H();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){te();return}if(t.length>n){let e=i3(t,n);if(e){if(s.current&&g.current===`following-bottom`&&o3(t,n)){K({behavior:`auto`});return}G(e,{align:`start`},{keepPreviousPeek:!0}),I.current.add(e);return}}if(t.length===n){let e=a3(t,I.current);if(e){G(e,{align:`start`},{keepPreviousPeek:!0}),I.current.add(e);return}}g.current===`following-bottom`&&s.current?K({behavior:`auto`}):(B(),H())})(),ne()},[ie,ne,B,U,te,H,G,K]),oe=Z.useCallback(()=>{if(g.current===`following-bottom`&&s.current){K({behavior:`auto`});return}let e=D.current;if(W()){s.current&&e>0&&D.current===0&&K({behavior:`auto`});return}V(),H()},[W,V,H,K]),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(e3)},[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=O3(S,de),pe=O3(j,de),J=Z.useCallback(e=>{u.current=e},[]),me=Z.useCallback(e=>{O.current=e,E.current=_3(e?.parentElement??null)},[]),he=Z.useCallback(()=>{B(),H(),ne()},[ne,B,H]),ge=Z.useMemo(()=>({handleContentChange:ae,handleResize:oe,observeVisibility:se,pendingDefaultScrollStore:x,preserveScrollOnPrependRef:b,scrollToEnd:K,scrollToMessage:ee,scrollToStart:q,setContentElement:J,setRootElement:fe,setSpacerElement:me,setViewportElement:pe,stateStore:A,syncAfterScroll:he,unobserveVisibility:ce,userScrollIntent:ue,viewportRef:j,visibilityStore:P}),[ae,oe,se,x,K,ee,q,J,fe,me,pe,A,he,ce,ue,P]);return Z.useLayoutEffect(()=>{ie()||p.current===0&&T3(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){K({behavior:`auto`});return}B()},[e,B,K]),{context:ge,registerMessage:le}}function A3(e){let t=Z.useRef(e);return t.current=e,t}var j3=Z.createContext(null),M3=Z.createContext(null);function N3(){let e=Z.useContext(j3);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function P3(){let e=Z.useContext(M3);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function F3({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=k3({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,Q.jsx)(j3.Provider,{value:o,children:(0,Q.jsx)(M3.Provider,{value:s,children:t})})}function I3(){let{pendingDefaultScrollStore:e}=N3();return Z.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function L3({children:e,...t}){let{setRootElement:n}=N3(),r=I3();return(0,Q.jsx)(`div`,{ref:n,...t,...r?{"data-pending-scroll":``}:null,children:e})}function R3({"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}=N3(),_=I3();f.current=o;let v=Z.useCallback(e=>{p(e),K4(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){Q4.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 z3({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=N3(),u=Z.useRef(null),d=Z.useCallback(e=>{u.current=e,c(e),K4(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 B3({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=P3(),a=Z.useRef(null),o=Z.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),K4(t)?.(n)},[e,t,i]);return(0,Q.jsx)(`div`,{ref:o,"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function V3({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}=N3(),d=A3(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 V4({defaultTagName:`button`,props:H4({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 H3={Provider:F3,Root:L3,Viewport:R3,Content:z3,Item:B3,Button:V3};function U3(e){return(0,Q.jsx)(H3.Provider,{...e})}function W3({className:e,...t}){return(0,Q.jsx)(H3.Root,{"data-slot":`message-scroller`,className:X(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,e),...t})}function G3({className:e,...t}){return(0,Q.jsx)(H3.Viewport,{"data-slot":`message-scroller-viewport`,className:X(`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 K3({className:e,...t}){return(0,Q.jsx)(H3.Content,{"data-slot":`message-scroller-content`,className:X(`flex h-max min-h-full flex-col gap-6`,e),...t})}function q3({className:e,scrollAnchor:t=!1,...n}){return(0,Q.jsx)(H3.Item,{"data-slot":`message-scroller-item`,scrollAnchor:t,className:X(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,e),...n})}function J3({direction:e=`end`,className:t,children:n,render:r,variant:i=`secondary`,size:a=`icon-sm`,...o}){return(0,Q.jsx)(H3.Button,{"data-slot":`message-scroller-button`,"data-direction":e,"data-variant":i,"data-size":a,direction:e,className:X(`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)(Y,{variant:i,size:a}),...o,children:n??(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pd,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:e===`end`?`Scroll to end`:`Scroll to start`})]})})}function Y3(e){return Kr(e,`resolved thread`)}function X3(e){let t=(0,$.c)(57),{scope:n,context:r,threads:i}=e,[a,o]=(0,Z.useState)(null),c=sQ(n,r),l;t[0]===i?l=t[1]:(l=Yt(i),t[0]=i,t[1]=l);let{confirmed:u,kept:d}=l,p,m,h,g,_,v,y,b,x;if(t[2]!==u||t[3]!==a||t[4]!==c||t[5]!==i){let e=Ts(Te(c.result))?.skipped.length??0,n;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>o(null),t[15]=n):n=t[15],_=n;let r=u.length===0,s;t[16]!==u||t[17]!==c||t[18]!==i?(s=()=>{c.reset();let e=new Set(u.map(Z3));o(i.filter(t=>e.has(t.id)))},t[16]=u,t[17]=c,t[18]=i,t[19]=s):s=t[19];let l;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(Pp,{"data-icon":`inline-start`}),t[20]=l):l=t[20],t[21]!==r||t[22]!==s?(x=(0,Q.jsxs)(Y,{type:`button`,variant:`ghost`,size:`xs`,className:`ml-auto`,disabled:r,onClick:s,children:[l,`Delete resolved`]}),t[21]=r,t[22]=s,t[23]=x):x=t[23],g=oM,y=a!==null&&!(tt(c.result)&&e===0),t[24]===c.result?b=t[25]:(b=e=>{!e&&!c.result.waiting&&_()},t[24]=c.result,t[25]=b),h=uM,m=dM,p=pM,v=tt(c.result)?`Kept ${Kr(e,`thread`)} that changed`:`Delete ${Y3(a?.length??0)}?`,t[2]=u,t[3]=a,t[4]=c,t[5]=i,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}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14];let S;t[26]!==p||t[27]!==v?(S=(0,Q.jsx)(p,{children:v}),t[26]=p,t[27]=v,t[28]=S):S=t[28];let C;t[29]!==d||t[30]!==c.result?(C=tt(c.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.${d>0?` ${Y3(d)} the agent started ${ui(d,`stays`,`stay`)}, since you cannot delete what the agent wrote on its own.`:``}`,t[29]=d,t[30]=c.result,t[31]=C):C=t[31];let w;t[32]===C?w=t[33]:(w=(0,Q.jsx)(mM,{children:C}),t[32]=C,t[33]=w);let T;t[34]!==m||t[35]!==S||t[36]!==w?(T=(0,Q.jsxs)(m,{children:[S,w]}),t[34]=m,t[35]=S,t[36]=w,t[37]=T):T=t[37];let E;t[38]===c.result?E=t[39]:(E=f(c.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:s(ht(c.result.cause))}),t[38]=c.result,t[39]=E);let D;t[40]!==_||t[41]!==a||t[42]!==c?(D=(0,Q.jsx)(fM,{children:tt(c.result)?(0,Q.jsx)(Y,{onClick:_,children:`Close`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gM,{disabled:c.result.waiting,children:`Cancel`}),(0,Q.jsx)(Y,{variant:`destructive`,disabled:c.result.waiting,onClick:()=>c.send(a??[]),children:c.result.waiting?`Deleting…`:`Delete`})]})}),t[40]=_,t[41]=a,t[42]=c,t[43]=D):D=t[43];let O;t[44]!==h||t[45]!==E||t[46]!==D||t[47]!==T?(O=(0,Q.jsxs)(h,{children:[T,E,D]}),t[44]=h,t[45]=E,t[46]=D,t[47]=T,t[48]=O):O=t[48];let k;t[49]!==g||t[50]!==O||t[51]!==y||t[52]!==b?(k=(0,Q.jsx)(g,{open:y,onOpenChange:b,children:O}),t[49]=g,t[50]=O,t[51]=y,t[52]=b,t[53]=k):k=t[53];let A;return t[54]!==k||t[55]!==x?(A=(0,Q.jsxs)(Q.Fragment,{children:[x,k]}),t[54]=k,t[55]=x,t[56]=A):A=t[56],A}function Z3(e){return e.threadId}function Q3(e){let t=(0,$.c)(17),{label:n,value:r,options:i,onValue:a,className:o}=e,s;t[0]===o?s=t[1]:(s=X(`shrink-0`,o),t[0]=o,t[1]=s);let c;t[2]!==a||t[3]!==i?(c=e=>{let t=i.find(t=>t.value===e);t&&a(t.value)},t[2]=a,t[3]=i,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=i.map($3),t[5]=i,t[6]=l);let u;t[7]!==n||t[8]!==l?(u=(0,Q.jsx)(Rn,{"aria-label":n,className:`w-full`,children:l}),t[7]=n,t[8]=l,t[9]=u):u=t[9];let d;t[10]!==c||t[11]!==u||t[12]!==r?(d=(0,Q.jsx)(Ae,{value:r,onValueChange:c,children:u}),t[10]=c,t[11]=u,t[12]=r,t[13]=d):d=t[13];let f;return t[14]!==s||t[15]!==d?(f=(0,Q.jsx)(`div`,{className:s,children:d}),t[14]=s,t[15]=d,t[16]=f):f=t[16],f}function $3(e){return(0,Q.jsx)($n,{value:e.value,className:`min-w-0`,children:e.label},e.value)}function e6(e){let t=(0,$.c)(13),{view:n,onView:r,filesLabel:i,openComments:a}=e,o;t[0]===i?o=t[1]:(o={value:`layers`,label:i},t[0]=i,t[1]=o);let s;t[2]===a?s=t[3]:(s=a>0?(0,Q.jsxs)(`span`,{children:[`Comments `,(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[`(`,a,`)`]})]}):`Comments`,t[2]=a,t[3]=s);let c;t[4]===s?c=t[5]:(c={value:`comments`,label:s},t[4]=s,t[5]=c);let l;t[6]!==o||t[7]!==c?(l=[o,c],t[6]=o,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==r||t[10]!==l||t[11]!==n?(u=(0,Q.jsx)(Q3,{label:`Review views`,className:`px-2.5 pt-3.5`,value:n,onValue:r,options:l}),t[9]=r,t[10]=l,t[11]=n,t[12]=u):u=t[12],u}function t6(e){let t=(0,$.c)(14),{target:n,branch:r,onCompose:i}=e;if(!n)return null;let a=r?`Comment on the whole branch`:`Comment on the whole change`,o;t[0]!==a||t[1]!==i?(o=(0,Q.jsx)(Y,{size:`icon-sm`,variant:`ghost`,"aria-label":a,onClick:i}),t[0]=a,t[1]=i,t[2]=o):o=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Qf,{strokeWidth:1.75,className:`text-muted-foreground`}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=(0,Q.jsx)(De,{render:o,children:s}),t[4]=o,t[5]=c);let l;t[6]===a?l=t[7]:(l=(0,Q.jsx)(Et,{role:`tooltip`,children:a}),t[6]=a,t[7]=l);let u;t[8]!==c||t[9]!==l?(u=(0,Q.jsxs)(dt,{children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;return t[11]!==u||t[12]!==n?(d=(0,od.createPortal)(u,n),t[11]=u,t[12]=n,t[13]=d):d=t[13],d}function n6(e){let t=(0,$.c)(14),{scope:n,context:r,anchor:i,open:a,setOpen:o}=e,s=i?.comparison?.kind===`branch`;if(a&&i){let e;t[0]===o?e=t[1]:(e=()=>o(!1),t[0]=o,t[1]=e);let a;return t[2]!==i||t[3]!==r||t[4]!==n||t[5]!==e?(a=(0,Q.jsx)(lQ,{scope:n,context:r,anchor:i,onClose:e}),t[2]=i,t[3]=r,t[4]=n,t[5]=e,t[6]=a):a=t[6],a}let c=i==null,l;t[7]===o?l=t[8]:(l=()=>o(!0),t[7]=o,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(Qf,{"data-icon":`inline-start`}),t[9]=u):u=t[9];let d=s?`Comment on the whole branch`:`Comment on the whole change`,f;return t[10]!==c||t[11]!==l||t[12]!==d?(f=(0,Q.jsx)(`div`,{className:`shrink-0 px-2 pt-2`,children:(0,Q.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,className:`w-full`,disabled:c,onClick:l,children:[u,d]})}),t[10]=c,t[11]=l,t[12]=d,t[13]=f):f=t[13],f}function r6(e){let t=(0,$.c)(19),{scope:n,context:r,threads:i,composer:a,onReveal:o}=e,[s,c]=(0,Z.useState)(`open`),l=[...i].filter(e=>e.resolved===(s===`resolved`)).sort(i6),u;t[0]===i?u=t[1]:(u=Xo(i),t[0]=i,t[1]=u);let d=u,f=s===`open`?`No open comments yet.`:`Nothing resolved yet.`;tQ(n,r,n.review?void 0:s);let p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=[`open`,`resolved`],t[2]=p):p=t[2];let m;t[3]!==d||t[4]!==s?(m=p.map(e=>(0,Q.jsxs)(Y,{type:`button`,"aria-pressed":s===e,onClick:()=>c(e),variant:s===e?`secondary`:`ghost`,size:`sm`,children:[e,` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:d[e]})]},e)),t[3]=d,t[4]=s,t[5]=m):m=t[5];let h;t[6]!==r||t[7]!==d||t[8]!==s||t[9]!==n||t[10]!==i?(h=s===`resolved`&&d.resolved>0&&(0,Q.jsx)(X3,{scope:n,context:r,threads:i}),t[6]=r,t[7]=d,t[8]=s,t[9]=n,t[10]=i,t[11]=h):h=t[11];let g;t[12]!==m||t[13]!==h?(g=(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1 px-2 pt-2 pb-2`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14];let _=l.length===0?(0,Q.jsx)(`p`,{className:`px-4 py-6 text-center text-caption text-muted-foreground`,children:f}):(0,Q.jsx)(U3,{autoScroll:!0,defaultScrollPosition:`end`,children:(0,Q.jsxs)(W3,{className:`min-h-0 flex-1`,children:[(0,Q.jsx)(G3,{"aria-label":`Comments`,children:(0,Q.jsx)(K3,{children:l.map((e,t)=>(0,Q.jsx)(q3,{messageId:e.id,scrollAnchor:t===l.length-1,children:(0,Q.jsx)(`div`,{className:`mx-2`,children:(0,Q.jsx)(kQ,{thread:e,scope:n,context:r,onReveal:()=>o(e.anchor)})})},e.id))})}),(0,Q.jsx)(J3,{})]})},s),v;return t[15]!==a||t[16]!==g||t[17]!==_?(v=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[a,g,_]}),t[15]=a,t[16]=g,t[17]=_,t[18]=v):v=t[18],v}function i6(e,t){return a6(e).localeCompare(a6(t))}function a6(e){return e.messages.at(-1)?.createdAt??``}function o6(e){let t=(0,$.c)(13),{files:n,review:r,threads:i,onSelect:a,context:o,marks:s}=e,c;t[0]!==n||t[1]!==r||t[2]!==i?(c=Dt({files:n,review:r,explains:!0,threads:i}),t[0]=n,t[1]=r,t[2]=i,t[3]=c):c=t[3];let l=c,u;t[4]!==n||t[5]!==a?(u=e=>a(e,n.find(s6)?.path),t[4]=n,t[5]=a,t[6]=u):u=t[6];let d;return t[7]!==o||t[8]!==l||t[9]!==s||t[10]!==r||t[11]!==u?(d=(0,Q.jsx)(d6,{items:l,review:r,context:o,marks:s,onSelect:u}),t[7]=o,t[8]=l,t[9]=s,t[10]=r,t[11]=u,t[12]=d):d=t[12],d}function s6(e){return e.reviewStatus===`stale`}function c6(e){let t=(0,$.c)(9),{scope:n,context:r,base:i,review:a,threads:o,onSelect:s}=e,{connection:c}=r,l=vP(n,c,i),u;t[0]===l.result?u=t[1]:(u=Ts(Te(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)(l6,{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 l6(e){let t=(0,$.c)(18),{scope:n,context:r,branch:i,review:a,threads:o,onSelect:s}=e,c;t[0]===i?c=t[1]:(c=Ze(i),t[0]=i,t[1]=c);let l=CZ(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=Un(i.files,l),u=d6,f=Dt({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(u6)?.path),t[9]=d,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==u||t[13]!==r||t[14]!==a||t[15]!==f||t[16]!==p?(m=(0,Q.jsx)(u,{items:f,review:a,context:r,onSelect:p}),t[12]=u,t[13]=r,t[14]=a,t[15]=f,t[16]=p,t[17]=m):m=t[17],m}function u6(e){return e.reviewStatus===`stale`}function d6(e){let t=(0,$.c)(10),{items:n,review:r,context:i,marks:a,onSelect:o}=e,s=!!r?.reviewId,c;t[0]!==i||t[1]!==a||t[2]!==o||t[3]!==r?(c=r?.reviewId&&(0,Q.jsx)(f6,{review:r,reviewId:r.reviewId,context:i,marks:a,onSelect:o}),t[0]=i,t[1]=a,t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Q.jsx)(g6,{items:n,published:s,onSelect:o,children:c}),t[5]=n,t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function f6(e){let t=(0,$.c)(33),{review:n,reviewId:r,context:i,marks:a,onSelect:o}=e,s;t[0]!==i||t[1]!==a||t[2]!==n||t[3]!==r?(s={review:n,reviewId:r,context:i,marks:a},t[0]=i,t[1]=a,t[2]=n,t[3]=r,t[4]=s):s=t[4];let{progress:c,failed:l,retry:u}=m6(s),d=l?`Unavailable · Try again`:`Loading…`,f=c?`${c.reviewed} of ${c.total} reviewed`:d,p=n.proof,m=p.current&&p.checks.length>0&&p.checks.every(p6),h=p.current?`Incomplete`:`Outdated`,g;t[5]===n.headOid?g=t[6]:(g=n.headOid?.slice(0,7),t[5]=n.headOid,t[6]=g);let _=g,v=m?`Proven at ${_??`published head`}`:h,y=p.current?`Proof is incomplete`:`Proof predates the latest changes`,b=m?v:y,x=m&&_?`Proven at`:v,S=m?_:void 0,C=m?`ok`:`attention`,w;t[7]===o?w=t[8]:(w=()=>o(`checks`),t[7]=o,t[8]=w);let T;t[9]!==b||t[10]!==x||t[11]!==S||t[12]!==C||t[13]!==w?(T=(0,Q.jsx)(b6,{name:`Proof`,label:b,value:x,code:S,tone:C,onSelect:w}),t[9]=b,t[10]=x,t[11]=S,t[12]=C,t[13]=w,t[14]=T):T=t[14];let E;t[15]!==c||t[16]!==d?(E=c?`${c.reviewed} of ${Kr(c.total,`decision`)} reviewed`:`Decisions ${d}`,t[15]=c,t[16]=d,t[17]=E):E=t[17];let D=c||!l?`progress`:`attention`,O;t[18]===c?O=t[19]:(O=c&&(0,Q.jsx)(C0,{label:`Decisions reviewed`,value:c.reviewed,max:c.total,className:`w-14`}),t[18]=c,t[19]=O);let k;t[20]!==l||t[21]!==o||t[22]!==u?(k=l?u:()=>o(`files`),t[20]=l,t[21]=o,t[22]=u,t[23]=k):k=t[23];let A;t[24]!==f||t[25]!==O||t[26]!==k||t[27]!==E||t[28]!==D?(A=(0,Q.jsx)(b6,{name:`Decisions`,label:E,value:f,tone:D,meter:O,onSelect:k}),t[24]=f,t[25]=O,t[26]=k,t[27]=E,t[28]=D,t[29]=A):A=t[29];let j;return t[30]!==A||t[31]!==T?(j=(0,Q.jsxs)(Q.Fragment,{children:[T,A]}),t[30]=A,t[31]=T,t[32]=j):j=t[32],j}function p6(e){return e.result===`pass`}function m6(e){let t=(0,$.c)(28),{review:n,reviewId:r,context:i,marks:a}=e,o;t[0]!==i.connection||t[1]!==n.revision||t[2]!==r?(o=k({connection:i.connection,reviewId:r,revision:n.revision}),t[0]=i.connection,t[1]=n.revision,t[2]=r,t[3]=o):o=t[3];let s=o,c;t[4]!==i.connection||t[5]!==r?(c=nn({connection:i.connection,reviewId:r}),t[4]=i.connection,t[5]=r,t[6]=c):c=t[6];let l=c,u=Rr(s),d=Rr(l),p=yr(s),m;t[7]!==i.connection||t[8]!==r?(m=k({connection:i.connection,reviewId:r}),t[7]=i.connection,t[8]=r,t[9]=m):m=t[9];let h=yr(m),g=yr(l),_=zs(i.connection),v,y;if(t[10]!==d||t[11]!==a||t[12]!==u||t[13]!==_){let e=Ts(Te(u))?.revision,n=a??Ts(Te(d)),r;t[16]!==d||t[17]!==a||t[18]!==u?(r=f(u)||a===void 0&&f(d),t[16]=d,t[17]=a,t[18]=u,t[19]=r):r=t[19],v=r,y=!v&&e&&n?dm(e,n,{specsApart:_}):void 0,t[10]=d,t[11]=a,t[12]=u,t[13]=_,t[14]=v,t[15]=y}else v=t[14],y=t[15];let b;t[20]!==p||t[21]!==h||t[22]!==g?(b=()=>{p(),h(),g()},t[20]=p,t[21]=h,t[22]=g,t[23]=b):b=t[23];let x;return t[24]!==v||t[25]!==y||t[26]!==b?(x={progress:y,failed:v,retry:b},t[24]=v,t[25]=y,t[26]=b,t[27]=x):x=t[27],x}var h6={files:`Files`,stale:`Code moved`,unexplained:`Explanation`,comments:`Comments`,replies:`Replies`,checks:`Checks`};function g6(e){let t=(0,$.c)(20),{items:n,published:r,onSelect:i,children:a}=e,o,s,c;t[0]!==n||t[1]!==r?(o=n.filter(v6),s=n.filter(_6),c=r?[]:n.filter(e=>!o.includes(e)&&!s.includes(e)),t[0]=n,t[1]=r,t[2]=o,t[3]=s,t[4]=c):(o=t[2],s=t[3],c=t[4]);let l=c,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`h3`,{className:`h-6 text-xs leading-6 font-medium text-muted-foreground`,children:`Readiness`}),t[5]=u):u=t[5];let d;t[6]!==o||t[7]!==i?(d=(0,Q.jsx)(y6,{items:o,onSelect:i}),t[6]=o,t[7]=i,t[8]=d):d=t[8];let f;t[9]!==l||t[10]!==i?(f=(0,Q.jsx)(y6,{items:l,onSelect:i}),t[9]=l,t[10]=i,t[11]=f):f=t[11];let p;t[12]!==s||t[13]!==i?(p=(0,Q.jsx)(y6,{items:s,onSelect:i}),t[12]=s,t[13]=i,t[14]=p):p=t[14];let m;return t[15]!==a||t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,Q.jsxs)(`section`,{"aria-label":`Readiness`,className:`mx-3.5 mt-3.5 shrink-0 text-ui`,children:[u,(0,Q.jsxs)(`div`,{className:`border-b`,children:[d,a,f,p]})]}),t[15]=a,t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function _6(e){return e.key===`comments`||e.key===`replies`}function v6(e){return e.key===`checks`}function y6({items:e,onSelect:t}){return e.map(e=>(0,Q.jsx)(b6,{name:h6[e.key],label:e.label,value:e.value,tone:(e.key===`comments`||e.key===`replies`)&&e.tone===`attention`?`open`:e.tone,onSelect:()=>t(e.key)},e.key))}function b6(e){let t=(0,$.c)(15),{name:n,label:r,value:i,code:a,tone:o,meter:s,onSelect:c}=e,l;t[0]!==a||t[1]!==r||t[2]!==s||t[3]!==n||t[4]!==c||t[5]!==o||t[6]!==i?(l=(e,t)=>(0,Q.jsxs)(`button`,{type:`button`,"aria-label":r,onClick:c,className:`flex h-7.25 w-full min-w-0 items-center gap-2 border-t text-left leading-4.5 hover:bg-accent`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:n}),(0,Q.jsxs)(`span`,{className:X(`ml-auto flex min-w-0 items-center font-medium tabular-nums`,s?`gap-2`:`gap-1.5`,o===`failing`&&`text-destructive`,o===`open`&&`text-brand`),children:[s,(0,Q.jsx)(x6,{tone:o}),a?e:t(i)]})]}),t[0]=a,t[1]=r,t[2]=s,t[3]=n,t[4]=c,t[5]=o,t[6]=i,t[7]=l):l=t[7];let u;t[8]!==a||t[9]!==i?(u=a?(0,Q.jsxs)(Q.Fragment,{children:[i,` `,(0,Q.jsx)(`span`,{className:`font-mono text-xs leading-4.5`,children:a})]}):void 0,t[8]=a,t[9]=i,t[10]=u):u=t[10];let d;return t[11]!==r||t[12]!==l||t[13]!==u?(d=(0,Q.jsx)(fr,{text:r,renderTrigger:l,children:u}),t[11]=r,t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function x6(e){let t=(0,$.c)(3),{tone:n}=e;if(n===`progress`||n===`open`)return null;if(n===`ok`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(ir,{strokeWidth:1.75,"aria-hidden":!0,className:`size-3.5 shrink-0 text-add-fg`}),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)(Vd,{strokeWidth:1.75,"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,{strokeWidth:1.75,"aria-hidden":!0,className:`size-3.5 shrink-0 text-warn`}),t[2]=r):r=t[2],r}function S6(e){let t=(0,$.c)(63),{revision:n,scope:r,context:i,threads:a,marks:o,file:s,onFile:c,onChange:l,onAllChanges:u,onStop:d,onProof:f,onOpenPullRequest:p,activeStop:m,onStep:h,actionsTarget:g}=e,{view:_,setView:v}=QX(n.reviewId),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1),C;t[0]!==o||t[1]!==n?(C=lm(n,o),t[0]=o,t[1]=n,t[2]=C):C=t[2];let w=C,T;t[3]===n.files?T=t[4]:(T=new Map(n.files.map(C6)),t[3]=n.files,t[4]=T);let E=T,D;t[5]!==i||t[6]!==p||t[7]!==n.reviewId?(D=(0,Q.jsx)(i4,{reviewId:n.reviewId,context:i,onOpenPullRequest:p}),t[5]=i,t[6]=p,t[7]=n.reviewId,t[8]=D):D=t[8];let O=_===`layers`?g:null,k;t[9]===v?k=t[10]:(k=()=>{v(`comments`),S(!0)},t[9]=v,t[10]=k);let A;t[11]!==O||t[12]!==k?(A=(0,Q.jsx)(t6,{target:O,branch:!0,onCompose:k}),t[11]=O,t[12]=k,t[13]=A):A=t[13];let j;t[14]!==l||t[15]!==f||t[16]!==d||t[17]!==v?(j=(e,t)=>{v(e===`comments`||e===`replies`?`comments`:`layers`),e===`files`&&d(`briefing`),e===`unexplained`&&d(`unexplained`),e===`checks`&&f(),e===`stale`&&t!==void 0&&l(t)},t[14]=l,t[15]=f,t[16]=d,t[17]=v,t[18]=j):j=t[18];let M;t[19]!==i||t[20]!==w||t[21]!==o||t[22]!==n.content||t[23]!==j||t[24]!==a?(M=(0,Q.jsx)(o6,{context:i,marks:o,files:w,review:n.content,threads:a,onSelect:j}),t[19]=i,t[20]=w,t[21]=o,t[22]=n.content,t[23]=j,t[24]=a,t[25]=M):M=t[25];let N;t[26]===a?N=t[27]:(N=Xo(a),t[26]=a,t[27]=N);let P;t[28]!==v||t[29]!==N.open||t[30]!==_?(P=(0,Q.jsx)(e6,{view:_,onView:v,filesLabel:`Explore`,openComments:N.open}),t[28]=v,t[29]=N.open,t[30]=_,t[31]=P):P=t[31];let F;t[32]!==m||t[33]!==E||t[34]!==i||t[35]!==y||t[36]!==s||t[37]!==w||t[38]!==o||t[39]!==u||t[40]!==l||t[41]!==h||t[42]!==d||t[43]!==n||t[44]!==_?(F=_===`layers`&&(0,Q.jsx)(UF,{className:`h-0 min-h-0 flex-1`,children:(0,Q.jsxs)(`div`,{className:`px-2.5 pt-2 pb-3`,children:[(0,Q.jsx)(k4,{revision:n,marks:o,context:i,activeStop:m,onStop:d,onStep:h}),(0,Q.jsx)(T4,{name:`Changed files`,count:w.length,expanded:y,onExpanded:b,onAll:b,action:(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":`Open all changes`,onClick:u}),children:(0,Q.jsx)(of,{})}),(0,Q.jsx)(Et,{children:`Open all changes`})]}),children:w.map(e=>(0,Q.jsxs)(w4,{label:e.path,active:s===e.path,onOpen:()=>l(e.path),children:[(0,Q.jsx)(x4,{status:E.get(e.path),reviewStatus:e.reviewStatus}),(0,Q.jsx)(pw,{path:e.path,className:`size-3.5 shrink-0`}),(0,Q.jsx)(fr,{className:X(`min-w-0 flex-1`,e.reviewStatus===`reviewed`&&`line-through decoration-muted-foreground/40`),text:Xn(e.path)})]},e.path))})]})}),t[32]=m,t[33]=E,t[34]=i,t[35]=y,t[36]=s,t[37]=w,t[38]=o,t[39]=u,t[40]=l,t[41]=h,t[42]=d,t[43]=n,t[44]=_,t[45]=F):F=t[45];let I;t[46]!==x||t[47]!==i||t[48]!==c||t[49]!==d||t[50]!==n.base||t[51]!==n.headOid||t[52]!==r||t[53]!==a||t[54]!==_?(I=_===`comments`&&(0,Q.jsx)(r6,{scope:r,context:i,threads:a,composer:(0,Q.jsx)(n6,{scope:r,context:i,anchor:{kind:`change`,revision:n.headOid,comparison:{kind:`branch`,base:n.base}},open:x,setOpen:S}),onReveal:e=>e.kind===`change`?d(`briefing`):c(e.filePath)}),t[46]=x,t[47]=i,t[48]=c,t[49]=d,t[50]=n.base,t[51]=n.headOid,t[52]=r,t[53]=a,t[54]=_,t[55]=I):I=t[55];let L;return t[56]!==P||t[57]!==F||t[58]!==I||t[59]!==D||t[60]!==A||t[61]!==M?(L=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[D,A,M,P,F,I]}),t[56]=P,t[57]=F,t[58]=I,t[59]=D,t[60]=A,t[61]=M,t[62]=L):L=t[62],L}function C6(e){return[e.path,Ol(e)]}function w6(e){let t=(0,$.c)(80),{scope:n,connection:r,base:i,onBase:a,compact:o}=e,s=o!==void 0&&o,[c,l]=(0,Z.useState)(!1),u=yP(n,r,c),d=vP(n,r,i),p,m,h,g,_,v,y,b,x,S,C,w,T,E,D;if(t[0]!==i||t[1]!==u.refresh||t[2]!==u.result||t[3]!==s||t[4]!==d.result||t[5]!==a||t[6]!==c){let e=Ts(Te(u.result)),n;t[22]===d.result?n=t[23]:(n=Ts(Te(d.result)),t[22]=d.result,t[23]=n);let r=i??n?.base?.ref,o;t[24]===r?o=t[25]:(o=r===void 0?`the default branch`:KK(r),t[24]=r,t[25]=o);let O=o,k=e?.defaultRef??null,A=i??k,j=[{heading:`Local`,entries:e?.bases.filter(D6)??[]},{heading:`Remote`,entries:e?.bases.filter(E6)??[]}].filter(T6),M=e=>{a(e===k?void 0:e),l(!1)};g=ya,_=c,v=l;let N=s?`max-w-24 @min-3xl/pane:max-w-40`:`w-full`,P;t[26]===N?P=t[27]:(P=X(`justify-between`,N),t[26]=N,t[27]=P);let F=`Compare against ${O}`,I;t[28]!==P||t[29]!==F?(I=(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,className:P,"aria-label":F,title:`Choose the branch this one is compared against`}),t[28]=P,t[29]=F,t[30]=I):I=t[30];let L=s&&`hidden @min-3xl/pane:block`,R;t[31]===L?R=t[32]:(R=X(`size-3.5 shrink-0 text-muted-foreground`,L),t[31]=L,t[32]=R);let z;t[33]===R?z=t[34]:(z=(0,Q.jsx)(Of,{className:R}),t[33]=R,t[34]=z);let B=`Against ${O}`,V=s&&`hidden @min-3xl/pane:inline`,H;t[35]===V?H=t[36]:(H=X(`text-muted-foreground`,V),t[35]=V,t[36]=H);let U;t[37]===H?U=t[38]:(U=(0,Q.jsxs)(`span`,{className:H,children:[`Against`,` `]}),t[37]=H,t[38]=U);let W;t[39]!==O||t[40]!==B||t[41]!==U?(W=(0,Q.jsxs)(fr,{text:B,children:[U,O]}),t[39]=O,t[40]=B,t[41]=U,t[42]=W):W=t[42];let G;t[43]!==z||t[44]!==W?(G=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[z,W]}),t[43]=z,t[44]=W,t[45]=G):G=t[45];let K;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(kd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[46]=K):K=t[46],t[47]!==I||t[48]!==G?(y=(0,Q.jsxs)(po,{render:I,children:[G,K]}),t[47]=I,t[48]=G,t[49]=y):y=t[49],h=ro,E=`start`,D=`w-72`,m=dV,t[50]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(pV,{"aria-label":`Find a base branch`,placeholder:`Find a branch`}),t[50]=T):T=t[50],p=mV,b=`Base branches`,t[51]===u.result?x=t[52]:(x=qi(u.result)&&(0,Q.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-muted-foreground`,children:`Reading branches…`}),t[51]=u.result,t[52]=x),t[53]!==u.refresh||t[54]!==u.result?(S=f(u.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)(Y,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:u.refresh,children:`Try again`})]}),t[53]=u.refresh,t[54]=u.result,t[55]=S):S=t[55],t[56]===u.result?C=t[57]:(C=tt(u.result)&&(0,Q.jsx)(hV,{children:`No branch matches.`}),t[56]=u.result,t[57]=C),w=j.map(e=>(0,Q.jsx)(gV,{heading:e.heading,children:e.entries.map(e=>(0,Q.jsxs)(_V,{value:e.name,"data-checked":e.ref===A,onSelect:()=>M(e.ref),children:[(0,Q.jsx)(fr,{text:e.name}),e.ref===k&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`default`})]},e.ref))},e.heading)),t[0]=i,t[1]=u.refresh,t[2]=u.result,t[3]=s,t[4]=d.result,t[5]=a,t[6]=c,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,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E,t[21]=D}else 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],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20],D=t[21];let O;t[58]!==p||t[59]!==b||t[60]!==x||t[61]!==S||t[62]!==C||t[63]!==w?(O=(0,Q.jsxs)(p,{"aria-label":b,children:[x,S,C,w]}),t[58]=p,t[59]=b,t[60]=x,t[61]=S,t[62]=C,t[63]=w,t[64]=O):O=t[64];let k;t[65]!==m||t[66]!==O||t[67]!==T?(k=(0,Q.jsxs)(m,{children:[T,O]}),t[65]=m,t[66]=O,t[67]=T,t[68]=k):k=t[68];let A;t[69]!==h||t[70]!==k||t[71]!==E||t[72]!==D?(A=(0,Q.jsx)(h,{align:E,className:D,children:k}),t[69]=h,t[70]=k,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;return t[74]!==g||t[75]!==_||t[76]!==v||t[77]!==y||t[78]!==A?(j=(0,Q.jsxs)(g,{open:_,onOpenChange:v,children:[y,A]}),t[74]=g,t[75]=_,t[76]=v,t[77]=y,t[78]=A,t[79]=j):j=t[79],j}function T6(e){return e.entries.length>0}function E6(e){return e.remote}function D6(e){return!e.remote}function O6(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)(w6,{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)(k6,{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 k6(e){let t=(0,$.c)(12),{scope:n,context:r,base:i,activeEntry:a,threads:o,onOpen:s,sideLabel:c}=e,l;t[0]!==a||t[1]!==r||t[2]!==s||t[3]!==n||t[4]!==c||t[5]!==o?(l=e=>(0,Q.jsx)(A6,{scope:n,context:r,branch:e,activeEntry:a,threads:o,onOpen:s,sideLabel:c}),t[0]=a,t[1]=r,t[2]=s,t[3]=n,t[4]=c,t[5]=o,t[6]=l):l=t[6];let u;return t[7]!==i||t[8]!==r||t[9]!==n||t[10]!==l?(u=(0,Q.jsx)(AZ,{scope:n,context:r,base:i,children:l}),t[7]=i,t[8]=r,t[9]=n,t[10]=l,t[11]=u):u=t[11],u}function A6(e){let t=(0,$.c)(51),{scope:n,context:r,branch:i,activeEntry:a,threads:o,onOpen:s,sideLabel:c}=e,l=zs(r.connection),u;t[0]===i?u=t[1]:(u=Ze(i),t[0]=i,t[1]=u);let d=u,f=CZ(n,r,d),p=VZ(n,r,j6,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]!==p||t[10]!==c||t[11]!==l||t[12]!==o){let e=Un(i.files,f),n;t[20]===i.head.branch?n=t[21]:(n=i.head.branch===null||i.head.branch===void 0?`this commit`:KK(i.head.branch),t[20]=i.head.branch,t[21]=n);let r=n,u;t[22]===i.commits?u=t[23]:(u=Kr(i.commits,`commit`),t[22]=i.commits,t[23]=u);let d=u;m=UF,b=`h-0 min-h-0 flex-1`,h=`p-2 pr-3`;let x;t[24]===i.base.ref?x=t[25]:(x=KK(i.base.ref),t[24]=i.base.ref,t[25]=x),t[26]!==d||t[27]!==r||t[28]!==x?(g=(0,Q.jsxs)(`p`,{className:`px-2 pb-1.5 text-2xs text-muted-foreground`,children:[d,` on `,r,` since `,x]}),t[26]=d,t[27]=r,t[28]=x,t[29]=g):g=t[29];let S;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(S=rq(tq),t[30]=S):S=t[30];let C;t[31]===s?C=t[32]:(C=()=>s(tq),t[31]=s,t[32]=C);let w,T;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(Of,{className:`size-3.5 shrink-0 text-muted-foreground`}),T=(0,Q.jsx)(fr,{className:`min-w-0 flex-1`,text:`All branch changes`}),t[33]=w,t[34]=T):(w=t[33],T=t[34]),_=(0,Q.jsxs)(w4,{label:`All branch changes`,active:a===S,onOpen:C,children:[w,T,(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 `,KK(i.base.ref)]});let E;t[35]!==a||t[36]!==s||t[37]!==p||t[38]!==c||t[39]!==o?(E=e=>(0,Q.jsx)(b4,{path:e.path,document:{kind:`branch-file`,path:e.path},note:e.status,changeStatus:Ol(e),scopes:[e.status],reviewStatus:e.reviewStatus,commentCount:o.filter(t=>t.anchor.comparison?.kind===`branch`&&Ha(t.anchor)===e.path&&!t.resolved).length,active:a===rq({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[35]=a,t[36]=s,t[37]=p,t[38]=c,t[39]=o,t[40]=E):E=t[40],y=Gp(e,l).map(E),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]=p,t[10]=c,t[11]=l,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[41]!==h||t[42]!==g||t[43]!==_||t[44]!==v||t[45]!==y?(x=(0,Q.jsxs)(`div`,{className:h,children:[g,_,v,y]}),t[41]=h,t[42]=g,t[43]=_,t[44]=v,t[45]=y,t[46]=x):x=t[46];let S;return t[47]!==m||t[48]!==b||t[49]!==x?(S=(0,Q.jsx)(m,{className:b,children:x}),t[47]=m,t[48]=b,t[49]=x,t[50]=S):S=t[50],S}function j6(e){return xc.add(e)}var M6=[{value:`uncommitted`,label:`Uncommitted`},{value:`branch`,label:`Branch`}];function N6(e){let t=(0,$.c)(77),{scope:n,context:r,activeEntry:i,onOpen:a,sideLabel:o,changeScope:s,base:c,onChangeScope:l,onBase:u,actionsTarget:d}=e,{connection:f}=r,[p,m]=(0,Z.useState)(`layers`),[h,g]=(0,Z.useState)(!1);wZ(n,r),WZ(n,r);let _=nP(n,f),v=dZ(n,r).review??null,{setPlace:y}=HX(`${v?.reviewId??n.worktreeId}:${v?.revision??``}`),b=JX(v?.reviewId??``),{threads:x}=UZ(n,r),S=TZ(n,r,_),C;t[0]===x?C=t[1]:(C=Xo(x),t[0]=x,t[1]=C);let w=C.open,T=s===`branch`,E;t[2]!==T||t[3]!==a||t[4]!==v||t[5]!==b||t[6]!==y?(E=(e,t)=>{if(e===`comments`||e===`replies`){m(`comments`);return}m(`layers`),e===`checks`&&(b.choose(void 0),y(`briefing`),a({kind:`handoff`})),e===`unexplained`&&(v&&y(`unexplained`),a({kind:`handoff`})),e===`files`&&a(T?tq:{kind:`handoff`}),e===`stale`&&t!==void 0&&a(T?{kind:`branch-file`,path:t}:{kind:`change`,path:t})},t[2]=T,t[3]=a,t[4]=v,t[5]=b,t[6]=y,t[7]=E):E=t[7];let D=E,O;t[8]!==r||t[9]!==a||t[10]!==v?(O=v?.reviewId&&(0,Q.jsx)(i4,{reviewId:v.reviewId,context:r,onOpenPullRequest:e=>v.reviewId&&a({kind:`pull-request`,reviewId:v.reviewId,number:e})}),t[8]=r,t[9]=a,t[10]=v,t[11]=O):O=t[11];let k=p===`layers`?d:null,A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{m(`comments`),g(!0)},t[12]=A):A=t[12];let j;t[13]!==T||t[14]!==k?(j=(0,Q.jsx)(t6,{target:k,branch:T,onCompose:A}),t[13]=T,t[14]=k,t[15]=j):j=t[15];let M;t[16]===l?M=t[17]:(M=e=>{g(!1),l(e)},t[16]=l,t[17]=M);let N;t[18]!==s||t[19]!==M?(N=(0,Q.jsx)(Q3,{label:`Changes to review`,className:`px-2.5 pt-3`,value:s,onValue:M,options:M6}),t[18]=s,t[19]=M,t[20]=N):N=t[20];let P;t[21]!==c||t[22]!==T||t[23]!==S||t[24]!==r||t[25]!==v||t[26]!==n||t[27]!==D||t[28]!==x?(P=T?(0,Q.jsx)(c6,{scope:n,context:r,base:c,review:v,threads:x,onSelect:D}):(0,Q.jsx)(o6,{context:r,files:S,review:v,threads:x,onSelect:D}),t[21]=c,t[22]=T,t[23]=S,t[24]=r,t[25]=v,t[26]=n,t[27]=D,t[28]=x,t[29]=P):P=t[29];let F;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{g(!1),m(e)},t[30]=F):F=t[30];let I=v&&!T?`Explore`:`Changed files`,L;t[31]!==w||t[32]!==I||t[33]!==p?(L=(0,Q.jsx)(e6,{view:p,onView:F,filesLabel:I,openComments:w}),t[31]=w,t[32]=I,t[33]=p,t[34]=L):L=t[34];let R;t[35]!==i||t[36]!==c||t[37]!==T||t[38]!==r||t[39]!==u||t[40]!==a||t[41]!==n||t[42]!==o||t[43]!==x||t[44]!==p?(R=p===`layers`&&T&&(0,Q.jsx)(O6,{scope:n,context:r,base:c,activeEntry:i,threads:x,onOpen:a,sideLabel:o,onBase:u}),t[35]=i,t[36]=c,t[37]=T,t[38]=r,t[39]=u,t[40]=a,t[41]=n,t[42]=o,t[43]=x,t[44]=p,t[45]=R):R=t[45];let z;t[46]!==i||t[47]!==T||t[48]!==S||t[49]!==r||t[50]!==_||t[51]!==a||t[52]!==v||t[53]!==n||t[54]!==o||t[55]!==x||t[56]!==p?(z=p===`layers`&&!T&&(0,Q.jsx)(F6,{scope:n,context:r,activeEntry:i,onOpen:a,sideLabel:o,list:_,review:v,changes:S,threads:x}),t[46]=i,t[47]=T,t[48]=S,t[49]=r,t[50]=_,t[51]=a,t[52]=v,t[53]=n,t[54]=o,t[55]=x,t[56]=p,t[57]=z):z=t[57];let B;t[58]!==c||t[59]!==T||t[60]!==h||t[61]!==r||t[62]!==_||t[63]!==a||t[64]!==n||t[65]!==x||t[66]!==p?(B=p===`comments`&&(0,Q.jsx)(r6,{threads:x,scope:n,context:r,composer:T?(0,Q.jsx)(V6,{scope:n,context:r,base:c,open:h,setOpen:g}):(0,Q.jsx)(n6,{scope:n,context:r,anchor:ha(void 0),open:h,setOpen:g}),onReveal:e=>{if(e.kind===`change`){a(e.comparison?.kind===`branch`?tq:{kind:`handoff`},e);return}a(H6(e,new Set(_.changes.map(P6))),e)}}),t[58]=c,t[59]=T,t[60]=h,t[61]=r,t[62]=_,t[63]=a,t[64]=n,t[65]=x,t[66]=p,t[67]=B):B=t[67];let V;return t[68]!==L||t[69]!==R||t[70]!==z||t[71]!==B||t[72]!==O||t[73]!==j||t[74]!==N||t[75]!==P?(V=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[O,j,N,P,L,R,z,B]}),t[68]=L,t[69]=R,t[70]=z,t[71]=B,t[72]=O,t[73]=j,t[74]=N,t[75]=P,t[76]=V):V=t[76],V}function P6(e){return e.path}function F6(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,d=zs(r.connection),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(B6),g=d?h.filter(z6):h,_=d?h.filter(Wp):[],v=new Map(l.map(R6)),y=Iu(s.changes),b=VZ(n,r,L6),[x,S]=(0,Z.useState)(null),C=e=>(0,Q.jsx)(b4,{path:e,document:{kind:`change`,path:e},note:void 0,changeStatus:y.files.get(e),scopes:[...new Set(s.changes.find(t=>t.path===e)?.comparisons.map(I6))],reviewStatus:v.get(e)?.reviewStatus,commentCount:u.filter(t=>Ha(t.anchor)===e&&!t.resolved).length,active:i===rq({kind:`change`,path:e}),onOpen:a,sideLabel:o,canReview:v.get(e)?.fingerprint!==null&&v.get(e)?.fingerprint!==void 0,onReview:()=>b.toggle({path:e,reviewed:v.get(e)?.reviewStatus===`reviewed`,fingerprint:v.get(e)?.fingerprint}),onDiscard:()=>S(t=>({path:e,nonce:(t?.nonce??0)+1}))},e),w=UF,T;t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==c?(T=c?(0,Q.jsx)(E4,{context:r,review:c,activeEntry:i,onOpen:a}):(0,Q.jsx)(w4,{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]=T):T=t[5];let E=!c&&h.length===0&&(0,Q.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`No changes`}),D=g.length>0&&(0,Q.jsx)(T4,{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(C)}),O=_.length>0&&(0,Q.jsxs)(T4,{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)(w4,{label:`Open all specs`,active:i===`specs`,onOpen:()=>a(eq),children:`Open all specs`}),_.map(C)]}),k;t[6]!==r||t[7]!==x||t[8]!==n?(k=x&&(0,Q.jsx)(iJ,{scope:n,context:r,path:x.path,signal:x.nonce,hiddenTrigger:!0}),t[6]=r,t[7]=x,t[8]=n,t[9]=k):k=t[9];let A;t[10]!==T||t[11]!==E||t[12]!==D||t[13]!==O||t[14]!==k?(A=(0,Q.jsxs)(`div`,{className:`px-2.5 pt-2 pb-3`,children:[T,E,D,O,k]}),t[10]=T,t[11]=E,t[12]=D,t[13]=O,t[14]=k,t[15]=A):A=t[15];let j;return t[16]!==w||t[17]!==A?(j=(0,Q.jsx)(w,{className:`h-0 min-h-0 flex-1`,children:A}),t[16]=w,t[17]=A,t[18]=j):j=t[18],j}function I6(e){return e.scope}function L6(e){return xc.add(e)}function R6(e){return[e.path,e]}function z6(e){return!Wp(e)}function B6(e){return e.path}function V6(e){let t=(0,$.c)(14),{scope:n,context:r,base:i,open:a,setOpen:o}=e,{connection:s}=r,c=vP(n,s,i),l,u,d,f;if(t[0]!==c.result||t[1]!==r||t[2]!==n){let e=Ts(Te(c.result)),i=e?.base?.ref,a=e?.head.oid;l=n6,u=n,d=r,f=i==null||a==null?void 0:ha({base:i,tip:a}),t[0]=c.result,t[1]=r,t[2]=n,t[3]=l,t[4]=u,t[5]=d,t[6]=f}else l=t[3],u=t[4],d=t[5],f=t[6];let p;return t[7]!==l||t[8]!==a||t[9]!==o||t[10]!==u||t[11]!==d||t[12]!==f?(p=(0,Q.jsx)(l,{scope:u,context:d,anchor:f,open:a,setOpen:o}),t[7]=l,t[8]=a,t[9]=o,t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13],p}function H6(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 U6(e){let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({layout:n,onSurface:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{review:a}=dZ(i.scope,i.context),o;t[4]===a?o=t[5]:(o=K6(a),t[4]=a,t[5]=o);let s=!!a,c;t[6]===i?c=t[7]:(c=e=>(0,Q.jsx)(J6,{...i,actionsTarget:e}),t[6]=i,t[7]=c);let l;return t[8]!==n||t[9]!==r||t[10]!==i.surface||t[11]!==o||t[12]!==s||t[13]!==c?(l=(0,Q.jsx)(W6,{layout:n,surfaces:G6,names:o,published:s,surface:i.surface,onSurface:r,children:c}),t[8]=n,t[9]=r,t[10]=i.surface,t[11]=o,t[12]=s,t[13]=c,t[14]=l):l=t[14],l}function W6(e){let t=(0,$.c)(19),{layout:n,surfaces:r,names:i,published:a,surface:o,onSurface:s,children:c}=e,{element:l,attach:u}=vI(),d;t[0]===u?d=t[1]:(d=(0,Q.jsx)(`div`,{ref:u,className:`ml-auto flex shrink-0 items-center gap-0.5`}),t[0]=u,t[1]=d);let f=d,p;t[2]!==l||t[3]!==c?(p=c(l),t[2]=l,t[3]=c,t[4]=p):p=t[4];let m=p,h=n===`docked`&&`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-right-1 duration-150`,g;t[5]===h?g=t[6]:(g=X(`flex h-full min-h-0 flex-col overflow-hidden rounded-paper bg-background shadow-paper`,h),t[5]=h,t[6]=g);let _;t[7]!==m||t[8]!==n||t[9]!==i||t[10]!==s||t[11]!==a||t[12]!==o||t[13]!==r||t[14]!==f?(_=n===`docked`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-1 border-b pr-2.5 pl-4`,children:[(0,Q.jsx)(fr,{className:`text-ui leading-5 font-semibold`,render:(0,Q.jsx)(`h2`,{}),text:i[o]}),f]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 text-sm`,children:m})]}):(0,Q.jsxs)(Ae,{value:o,onValueChange:e=>{jK(e)&&s(e)},className:`min-h-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-1 border-b px-1.5`,children:[(0,Q.jsx)(Rn,{className:`h-8 min-w-0 flex-1`,children:r.map(e=>(0,Q.jsx)(fr,{propagateEscape:!0,text:i[e],renderTrigger:t=>(0,Q.jsxs)($n,{value:e,className:`min-w-0`,children:[(0,Q.jsx)(q6,{published:a,surface:e,className:`size-3.5 shrink-0`}),t]})},e))}),f]}),(0,Q.jsx)(Gn,{value:o,className:`min-h-0 overflow-hidden`,children:m})]}),t[7]=m,t[8]=n,t[9]=i,t[10]=s,t[11]=a,t[12]=o,t[13]=r,t[14]=f,t[15]=_):_=t[15];let v;return t[16]!==g||t[17]!==_?(v=(0,Q.jsx)(`aside`,{"aria-label":`Review sidebar`,"data-testid":`review-sidebar`,className:g,children:_}),t[16]=g,t[17]=_,t[18]=v):v=t[18],v}var G6=[`files`,`changes`,`history`];function K6(e){return{...sq,changes:oq(e)??sq.changes}}function q6(e){let t=(0,$.c)(7),{published:n,surface:r,className:i}=e;if(r===`files`){let e;return t[0]===i?e=t[1]:(e=(0,Q.jsx)(gf,{className:i}),t[0]=i,t[1]=e),e}if(r===`history`){let e;return t[2]===i?e=t[3]:(e=(0,Q.jsx)(gp,{className:i}),t[2]=i,t[3]=e),e}let a;return t[4]!==i||t[5]!==n?(a=n?(0,Q.jsx)(Wf,{className:i}):(0,Q.jsx)(of,{className:i}),t[4]=i,t[5]=n,t[6]=a):a=t[6],a}function J6(e){let t=(0,$.c)(43),{scope:n,context:r,worktreePath:i,surface:a,activeEntry:o,available:s,onOpen:c,sideLabel:l,changes:u,actionsTarget:d}=e,f=dZ(n,r);if(!s){let e;t[0]!==c||t[1]!==f.review||t[2]!==a?(e=f.review&&a===`changes`&&(0,Q.jsx)(Y,{variant:`ghost`,onClick:()=>c({kind:`handoff`}),children:`Review`}),t[0]=c,t[1]=f.review,t[2]=a,t[3]=e):e=t[3];let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(me,{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 p=a===`files`?`Loading files`:`Loading review`,m=`${n.worktreeId}:${a}`,h;t[7]!==d||t[8]!==o||t[9]!==u||t[10]!==r||t[11]!==c||t[12]!==n||t[13]!==l||t[14]!==a?(h=a===`changes`&&(0,Q.jsx)(N6,{scope:n,context:r,activeEntry:o,onOpen:c,sideLabel:l,changeScope:u.scope,base:u.base,onChangeScope:u.onScope,onBase:u.onBase,actionsTarget:d}),t[7]=d,t[8]=o,t[9]=u,t[10]=r,t[11]=c,t[12]=n,t[13]=l,t[14]=a,t[15]=h):h=t[15];let g;t[16]!==d||t[17]!==o||t[18]!==r.connection||t[19]!==c||t[20]!==n||t[21]!==l||t[22]!==a||t[23]!==i?(g=a===`files`&&(0,Q.jsx)(BG,{scope:n,connection:r.connection,worktreePath:i,selected:o?.startsWith(`file:`)?o.slice(5):``,onOpen:c,sideLabel:l,actionsTarget:d}),t[16]=d,t[17]=o,t[18]=r.connection,t[19]=c,t[20]=n,t[21]=l,t[22]=a,t[23]=i,t[24]=g):g=t[24];let _;t[25]!==o||t[26]!==r.connection||t[27]!==c||t[28]!==n||t[29]!==l||t[30]!==a?(_=a===`history`&&(0,Q.jsx)(gY,{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`}),onOpenChanges:()=>c($K)}),t[25]=o,t[26]=r.connection,t[27]=c,t[28]=n,t[29]=l,t[30]=a,t[31]=_):_=t[31];let v;t[32]!==r.connection||t[33]!==n||t[34]!==p||t[35]!==m||t[36]!==h||t[37]!==g||t[38]!==_?(v=(0,Q.jsxs)(U2,{connection:r.connection,scope:n,loadingLabel:p,children:[h,g,_]},m),t[32]=r.connection,t[33]=n,t[34]=p,t[35]=m,t[36]=h,t[37]=g,t[38]=_,t[39]=v):v=t[39];let y=v,b;return t[40]!==y||t[41]!==a?(b=a===`changes`?(0,Q.jsx)(UF,{className:`h-full`,children:y}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:y}),t[40]=y,t[41]=a,t[42]=b):b=t[42],b}var Y6={files:cc.surfaceFiles,changes:cc.surfaceReview,history:cc.surfaceHistory};function X6(e){let t=(0,$.c)(32),{surfaces:n,names:r,published:i,surface:a,open:o,onSelect:s,onHide:c,onToggle:l,toggleRef:u}=e,d=o?`Hide side panel`:`Show side panel`,f;if(t[0]!==r||t[1]!==c||t[2]!==s||t[3]!==o||t[4]!==i||t[5]!==a||t[6]!==n){let e;t[8]!==r||t[9]!==c||t[10]!==s||t[11]!==o||t[12]!==i||t[13]!==a?(e=e=>{let t=o&&a===e;return(0,Q.jsx)(`span`,{"data-selected":t||void 0,className:`workspace-choice inline-flex rounded-lg data-selected:text-foreground`,children:(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":r[e],"aria-pressed":t,"aria-keyshortcuts":Y6[e],onClick:()=>t?c():s(e)}),children:(0,Q.jsx)(q6,{published:i,surface:e})}),(0,Q.jsxs)(Et,{side:`left`,children:[r[e],` `,(0,Q.jsx)(gI,{children:Ks(Y6[e])})]})]})},e)},t[8]=r,t[9]=c,t[10]=s,t[11]=o,t[12]=i,t[13]=a,t[14]=e):e=t[14],f=n.map(e),t[0]=r,t[1]=c,t[2]=s,t[3]=o,t[4]=i,t[5]=a,t[6]=n,t[7]=f}else f=t[7];let p;t[15]!==l||t[16]!==o||t[17]!==d||t[18]!==u?(p=(0,Q.jsx)(Y,{ref:u,variant:`ghost`,size:`icon`,className:`mt-auto`,"aria-label":d,"aria-expanded":o,"aria-keyshortcuts":cc.toggleSidebar,onClick:l}),t[15]=l,t[16]=o,t[17]=d,t[18]=u,t[19]=p):p=t[19];let m;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(np,{}),t[20]=m):m=t[20];let h;t[21]===p?h=t[22]:(h=(0,Q.jsx)(De,{render:p,children:m}),t[21]=p,t[22]=h);let g;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(gI,{children:Ks(cc.toggleSidebar)}),t[23]=g):g=t[23];let _;t[24]===d?_=t[25]:(_=(0,Q.jsxs)(Et,{side:`left`,children:[d,` `,g]}),t[24]=d,t[25]=_);let v;t[26]!==h||t[27]!==_?(v=(0,Q.jsxs)(dt,{children:[h,_]}),t[26]=h,t[27]=_,t[28]=v):v=t[28];let y;return t[29]!==f||t[30]!==v?(y=(0,Q.jsxs)(`nav`,{"aria-label":`Side panel`,className:`flex w-11 shrink-0 flex-col items-center gap-1 pt-2.5 pb-2 pl-1 text-muted-foreground`,children:[f,v]}),t[29]=f,t[30]=v,t[31]=y):y=t[31],y}function Z6(e){let t=(0,$.c)(42),{reviewId:n,documentNavigation:r,onOpen:i,toolbarTarget:a,navigation:o,revision:s,decision:c,context:l,onRevision:u,onStop:d,onBack:p,onDeleted:m,liveScope:h,proofCurrent:g,onShowReviewPanel:_,active:v}=e,y=g===void 0||g,b=v===void 0||v,x;t[0]!==l.connection||t[1]!==n||t[2]!==s?(x=k({connection:l.connection,reviewId:n,...s===void 0?{}:{revision:s}}),t[0]=l.connection,t[1]=n,t[2]=s,t[3]=x):x=t[3];let S=x,C=Rr(S),w=yr(S),T;t[4]===C?T=t[5]:(T=Ts(Te(C)),t[4]=C,t[5]=T);let E=T,D;t[6]!==o||t[7]!==p||t[8]!==C||t[9]!==w?(D=$6(C,o,w,p),t[6]=o,t[7]=p,t[8]=C,t[9]=w,t[10]=D):D=t[10];let O=D;if(O)return O;if(!E?.review||!E.revision){let e;return t[11]!==l||t[12]!==o||t[13]!==p||t[14]!==u||t[15]!==n||t[16]!==s?(e=(0,Q.jsx)(Q6,{navigation:o,reviewId:n,revision:s,context:l,onRevision:u,onBack:p}),t[11]=l,t[12]=o,t[13]=p,t[14]=u,t[15]=n,t[16]=s,t[17]=e):e=t[17],e}let A=`${n}:${E.revision.revision}`,j=E.revision,M;t[18]===C?M=t[19]:(M=f(C),t[18]=C,t[19]=M);let N;t[20]!==C.waiting||t[21]!==w||t[22]!==M?(N={run:w,failed:M,waiting:C.waiting},t[20]=C.waiting,t[21]=w,t[22]=M,t[23]=N):N=t[23];let P;return t[24]!==b||t[25]!==l||t[26]!==E||t[27]!==c||t[28]!==r||t[29]!==h||t[30]!==o||t[31]!==p||t[32]!==m||t[33]!==i||t[34]!==u||t[35]!==_||t[36]!==d||t[37]!==y||t[38]!==A||t[39]!==N||t[40]!==a?(P=(0,Q.jsx)(n8,{toolbarTarget:a,documentNavigation:r,navigation:o,onOpen:i,data:E,revision:j,context:l,decision:c,onRevision:u,onStop:d,onBack:p,onDeleted:m,liveScope:h,proofCurrent:y,active:b,onShowReviewPanel:_,reread:N},A),t[24]=b,t[25]=l,t[26]=E,t[27]=c,t[28]=r,t[29]=h,t[30]=o,t[31]=p,t[32]=m,t[33]=i,t[34]=u,t[35]=_,t[36]=d,t[37]=y,t[38]=A,t[39]=N,t[40]=a,t[41]=P):P=t[41],P}function Q6(e){let t=(0,$.c)(23),{navigation:n,reviewId:r,revision:i,context:a,onRevision:o,onBack:s}=e,c;t[0]!==a.connection||t[1]!==r?(c=k({connection:a.connection,reviewId:r}),t[0]=a.connection,t[1]=r,t[2]=c):c=t[2];let l=c,u=Rr(l),d=yr(l),f;t[3]===u?f=t[4]:(f=Ts(Te(u))?.review,t[3]=u,t[4]=f);let p=f,m;t[5]!==n||t[6]!==s||t[7]!==u||t[8]!==d?(m=$6(u,n,d,s),t[5]=n,t[6]=s,t[7]=u,t[8]=d,t[9]=m):m=t[9];let h=m;if(h)return h;let g=p?`Revision not found`:`Review not found`,_=p?`This review has revisions r1 to r${p.latestRevision}. This link asks for r${i}.`:`This link does not identify an available review.`,v;t[10]!==p||t[11]!==o?(v=p&&o&&(0,Q.jsxs)(Y,{onClick:()=>o(void 0),children:[`Open r`,p.latestRevision,`, the latest`]}),t[10]=p,t[11]=o,t[12]=v):v=t[12];let y;t[13]===s?y=t[14]:(y=(0,Q.jsx)(Y,{variant:`outline`,onClick:s,children:`Back to workspace`}),t[13]=s,t[14]=y);let b;t[15]!==g||t[16]!==_||t[17]!==v||t[18]!==y?(b=(0,Q.jsxs)(me,{title:g,description:_,children:[v,y]}),t[15]=g,t[16]=_,t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;return t[20]!==n||t[21]!==b?(x=(0,Q.jsx)(xn,{navigation:n,title:`Review`,children:b}),t[20]=n,t[21]=b,t[22]=x):x=t[22],x}function $6(e,t,n,r){if(qi(e))return(0,Q.jsx)(e8,{navigation:t});if(f(e)&&D(Te(e)))return(0,Q.jsx)(t8,{navigation:t,retry:n,onBack:r})}function e8(e){let t=(0,$.c)(3),{navigation:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(dn,{label:`Loading review`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Q.jsx)(xn,{navigation:n,title:`Review`,children:r}),t[1]=n,t[2]=i),i}function t8(e){let t=(0,$.c)(6),{navigation:n,retry:r,onBack:i}=e,a;t[0]!==i||t[1]!==r?(a=(0,Q.jsx)(v,{description:`Review could not be loaded. Check the link and connection.`,onRetry:r,onBack:i}),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==a?(o=(0,Q.jsx)(xn,{navigation:n,title:`Review`,children:a}),t[3]=n,t[4]=a,t[5]=o):o=t[5],o}function n8(e){let t=(0,$.c)(170),{documentNavigation:n,toolbarTarget:r,navigation:i,onOpen:a,data:o,revision:s,context:c,decision:l,onRevision:u,onStop:d,onBack:p,onDeleted:m,liveScope:h,proofCurrent:g,onShowReviewPanel:_,active:y,reread:b}=e,x=g===void 0||g,S=y===void 0||y,C=qP(c.connection),w;t[0]===s.projectId?w=t[1]:(w=e=>e.id===s.projectId,t[0]=s.projectId,t[1]=w);let T=C.projects.find(w)?.worktrees.find(e=>e.available&&e.id===s.content.worktreeId),E=h??(T?{projectId:s.projectId,worktreeId:T.id}:void 0),D;t[2]!==o.review?.latestRevision||t[3]!==o.revisions||t[4]!==s.headOid?(D=o.revisions.find(e=>e.revision===o.review?.latestRevision)?.headOid??s.headOid,t[2]=o.review?.latestRevision,t[3]=o.revisions,t[4]=s.headOid,t[5]=D):D=t[5];let O=D,A=Ts(Te(vP(E,c.connection,void 0).result)),j=s.content,M;t[6]!==s.reviewId||t[7]!==s.revision?(M={reviewId:s.reviewId,revision:s.revision},t[6]=s.reviewId,t[7]=s.revision,t[8]=M):M=t[8];let N;t[9]!==j.worktreeId||t[10]!==s.projectId||t[11]!==M?(N={projectId:s.projectId,worktreeId:j.worktreeId,review:M},t[9]=j.worktreeId,t[10]=s.projectId,t[11]=M,t[12]=N):N=t[12];let P=N,{result:F,page:I,url:L,available:R}=S0(P,c,j.summary),[z,B]=(0,Z.useState)(),V;t[13]!==b||t[14]!==j.summary.expires?(V=()=>{B(j.summary.expires),b.run()},t[13]=b,t[14]=j.summary.expires,t[15]=V):V=t[15];let U=V,W;t[16]!==c.connection||t[17]!==s.reviewId||t[18]!==s.revision?(W=Or({connection:c.connection,reviewId:s.reviewId,revision:s.revision}),t[16]=c.connection,t[17]=s.reviewId,t[18]=s.revision,t[19]=W):W=t[19];let G=W,K=Rr(G),ee=yr(G),q;t[20]!==c.connection||t[21]!==s.reviewId?(q=Yo({connection:c.connection,reviewId:s.reviewId}),t[20]=c.connection,t[21]=s.reviewId,t[22]=q):q=t[22],ao(q);let te;t[23]!==c.connection||t[24]!==s.reviewId?(te=nn({connection:c.connection,reviewId:s.reviewId}),t[23]=c.connection,t[24]=s.reviewId,t[25]=te):te=t[25];let ne=te,re=Rr(ne),ie=yr(ne),ae=Ts(Te(re)),oe=zs(c.connection),{dark:se}=Zs(),ce=HX(`${s.reviewId}:${s.revision}`),le=nZ(s.reviewId,s.revision),[ue,de]=(0,Z.useState)(),[fe,pe]=(0,Z.useState)(`walkthrough`),J=n!==void 0,he=`review:${s.reviewId}:${s.revision}`,{focused:ge,setFocused:_e}=RX(he),ve=n?.search.entry??`handoff`,ye=n?.search.side,be;t[26]===n?be=t[27]:(be=(e,t)=>n?.onSearch(e,t),t[26]=n,t[27]=be);let xe;t[28]!==ge||t[29]!==_e||t[30]!==J||t[31]!==ve||t[32]!==ye||t[33]!==be||t[34]!==he?(xe={worktreeId:he,entry:ve,side:ye,onSearch:be,fallback:`handoff`,ready:J,focused:ge,setFocused:_e,focusBoundary:null,focusBoundaryOpen:!1},t[28]=ge,t[29]=_e,t[30]=J,t[31]=ve,t[32]=ye,t[33]=be,t[34]=he,t[35]=xe):xe=t[35];let Se=rZ(xe),Ce;t[36]!==ge||t[37]!==a||t[38]!==J||t[39]!==Se?(Ce=(e,t,n)=>{if(!J){a?.(e,t,n);return}n?.toSide?Se.openToSide(ge,rq(e)):Se.open(ge,rq(e))},t[36]=ge,t[37]=a,t[38]=J,t[39]=Se,t[40]=Ce):Ce=t[40];let we=Ce,Ee=S&&(!J||Se.panes[ge]?.active===`handoff`),Oe=SX(),{open:ke,setOpen:je}=XX(s.reviewId),Me=eZ(s.reviewId),Ne;t[41]!==we||t[42]!==s.reviewId?(Ne=e=>we({kind:`pull-request`,reviewId:s.reviewId,number:e}),t[41]=we,t[42]=s.reviewId,t[43]=Ne):Ne=t[43];let Pe=Ne,[Fe,Ie]=(0,Z.useState)(!1),Re=vI(),ze=vI(),[Be,Ve]=(0,Z.useState)(l);Be!==l&&(Ve(l),de(void 0),pe(`walkthrough`));let He=Jp(j,s.files.map(s8),{specsApart:oe}),Ue;t[44]!==l||t[45]!==j.layers?(Ue=l!==void 0&&!j.layers.some(e=>e.id===l),t[44]=l,t[45]=j.layers,t[46]=Ue):Ue=t[46];let We=Ue,Ge=ce.place;l&&(Ge=Kp(l)),We&&(Ge=`briefing`);let Ke=Yp(He,ue??Ge),qe=um(s,ae),Je=lm(s,ae),Ye=Je.filter(o8).length,Xe=He.filter(e=>e.kind===`decision`&&em(e,Je,qe)).length,Ze=e=>em(e,Je,qe),Qe=j.layers.length,$e=e=>{let t=Xp(He,Ke.key,e);return t?()=>et(t.key):void 0},et=e=>{ze.element?.scrollTo({top:0}),de(e),ce.setPlace(e),pe(`walkthrough`),J&&Se.selectPane(0),d?.(j.layers.find(t=>Kp(t.id)===e)?.id)},nt={active:Ee&&fe===`walkthrough`,worktreeId:s.reviewId,entry:`review:${s.revision}`},rt=e=>{le.choose(e.pointer.path,e.id),it(e.pointer.path)},it=e=>we({kind:`review-file`,reviewId:s.reviewId,revision:s.revision,path:e}),at={review:j,scope:P,context:c,interaction:nt,onOpen:e=>{e.path&&it(e.path)}},ot;t[47]!==U||t[48]!==j.summary?(ot=e=>{(e===`walkthrough`||e===`summary`||e===`changes`)&&(e===`summary`&&oo(j.summary,Date.now())&&U(),pe(e))},t[47]=U,t[48]=j.summary,t[49]=ot):ot=t[49];let st;t[50]===F?st=t[51]:(st=qi(F)||F.waiting,t[50]=F,t[51]=st);let ct;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Q.jsxs)(dt,{children:[(0,Q.jsxs)(De,{render:(0,Q.jsx)($n,{value:`walkthrough`,"aria-label":`Walkthrough`}),children:[(0,Q.jsx)(Wf,{className:`size-3.5 @min-3xl/pane:hidden`}),(0,Q.jsx)(`span`,{className:`hidden whitespace-nowrap @min-3xl/pane:inline`,children:`Walkthrough`})]}),(0,Q.jsx)(Et,{children:`Walkthrough`})]}),t[52]=ct):ct=t[52];let lt;t[53]===R?lt=t[54]:(lt=R&&(0,Q.jsxs)(dt,{children:[(0,Q.jsxs)(De,{render:(0,Q.jsx)($n,{value:`summary`,"aria-label":`Agent summary`}),children:[(0,Q.jsx)(ff,{className:`size-3.5 @min-3xl/pane:hidden`}),(0,Q.jsx)(`span`,{className:`hidden whitespace-nowrap @min-3xl/pane:inline`,children:`Agent summary`})]}),(0,Q.jsx)(Et,{children:`Agent summary`})]}),t[53]=R,t[54]=lt);let ut;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,Q.jsxs)(dt,{children:[(0,Q.jsxs)(De,{render:(0,Q.jsx)($n,{value:`changes`,"aria-label":`All changes`}),children:[(0,Q.jsx)(of,{className:`size-3.5 @min-3xl/pane:hidden`}),(0,Q.jsx)(`span`,{className:`hidden whitespace-nowrap @min-3xl/pane:inline`,children:`All changes`})]}),(0,Q.jsx)(Et,{children:`All changes in this revision`})]}),t[55]=ut):ut=t[55];let ft;t[56]!==st||t[57]!==lt?(ft=(0,Q.jsxs)(Rn,{"aria-label":`Review presentation`,"aria-busy":st,children:[ct,lt,ut]}),t[56]=st,t[57]=lt,t[58]=ft):ft=t[58];let pt;t[59]!==ot||t[60]!==ft||t[61]!==fe?(pt=(0,Q.jsx)(Ae,{className:`shrink-0`,value:fe,onValueChange:ot,children:ft}),t[59]=ot,t[60]=ft,t[61]=fe,t[62]=pt):pt=t[62];let mt=pt,ht=Kr(Je.length,`file`),gt;t[63]===j.layers.length?gt=t[64]:(gt=Kr(j.layers.length,`decision`),t[63]=j.layers.length,t[64]=gt);let _t=(0,Q.jsxs)(Q.Fragment,{children:[mt,(0,Q.jsxs)(`span`,{"aria-label":`Review progress`,className:`mx-1.5 hidden shrink-0 items-center gap-2 text-xs whitespace-nowrap text-muted-foreground tabular-nums @min-2xl/pane:inline-flex`,children:[Ye,` of `,ht,(0,Q.jsx)(C0,{label:`Files reviewed`,value:Ye,max:Je.length}),(0,Q.jsxs)(`span`,{children:[Xe,` of `,gt]})]})]}),vt={connection:c.connection,reviewId:s.reviewId},yt=Ts(Te(Rr(k(vt)))),bt=H(vt),xt=Rr(bt),St=f(xt)?{kind:`failed`}:Ts(Te(xt))??{kind:`loading`},Ct=o.review?.pullRequest?St:void 0,wt=us(o.review??s,yt?.revision??s,Ct?.kind===`available`?Ct.pullRequest.title:void 0),Tt=o.review,{threads:Dt}=UZ(h??P,c,E),Ot;t[65]!==Oe||t[66]!==je||t[67]!==Ie?(Ot=()=>{Oe?je(!0):Ie(!0)},t[65]=Oe,t[66]=je,t[67]=Ie,t[68]=Ot):Ot=t[68];let kt=Ot,At=o.review?.pullRequest,jt;t[69]!==Me||t[70]!==_||t[71]!==kt?(jt=(e,t)=>{t&&Me.request(),_?_(e):kt()},t[69]=Me,t[70]=_,t[71]=kt,t[72]=jt):jt=t[72];let Mt;t[73]!==c||t[74]!==Pe||t[75]!==s.branch||t[76]!==s.projectId||t[77]!==s.reviewId||t[78]!==At||t[79]!==jt?(Mt=(0,Q.jsx)(Q2,{reviewId:s.reviewId,projectId:s.projectId,branch:s.branch,url:At,context:c,onOpen:Pe,onShowPanel:jt}),t[73]=c,t[74]=Pe,t[75]=s.branch,t[76]=s.projectId,t[77]=s.reviewId,t[78]=At,t[79]=jt,t[80]=Mt):Mt=t[80];let Nt=Mt,Pt;t[81]!==Oe||t[82]!==ke||t[83]!==Re||t[84]!==je||t[85]!==Ie?(Pt=()=>{if(!Oe){Ie(a8);return}ke&&Re.element?.focus(),je(i8)},t[81]=Oe,t[82]=ke,t[83]=Re,t[84]=je,t[85]=Ie,t[86]=Pt):Pt=t[86];let Ft=Pt,It;t[87]===Ie?It=t[88]:(It=e=>{e(),Ie(!1)},t[87]=Ie,t[88]=It);let Lt=It,Rt;t[89]===s.content?Rt=t[90]:(Rt=K6(s.content),t[89]=s.content,t[90]=Rt);let zt=Rt,Bt=e=>(0,Q.jsx)(W6,{layout:e,surfaces:c8,names:zt,published:!0,surface:`changes`,onSurface:kt,children:e=>(0,Q.jsx)(U2,{connection:c.connection,scope:P,children:(0,Q.jsx)(S6,{actionsTarget:e,revision:s,scope:P,context:c,threads:Dt,marks:ae,activeStop:Ke.key,onStep:e=>Lt(()=>{pe(`walkthrough`),rt(e)}),file:void 0,onFile:e=>Lt(()=>{pe(`walkthrough`),it(e)}),onChange:e=>Lt(()=>{pe(`walkthrough`),we({kind:`review-change`,reviewId:s.reviewId,revision:s.revision,path:e})}),onStop:e=>Lt(()=>et(e)),onAllChanges:()=>Lt(()=>{pe(`changes`),J&&Se.activate(0,`handoff`)}),onProof:()=>Lt(()=>et(`briefing`)),onOpenPullRequest:e=>Lt(()=>Pe(e))})})}),Vt;t[91]!==Oe||t[92]!==zt||t[93]!==Ie||t[94]!==Ft?(Vt=Oe?null:(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":zt.changes,onClick:()=>Oe?Ft():Ie(!0)}),children:(0,Q.jsx)(np,{className:`size-3.5`})}),(0,Q.jsxs)(Et,{children:[zt.changes,(0,Q.jsx)(gI,{children:Ks(cc.toggleSidebar)})]})]}),t[91]=Oe,t[92]=zt,t[93]=Ie,t[94]=Ft,t[95]=Vt):Vt=t[95];let Ht=Vt,Ut;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Ut={containerName:`pane review`},t[96]=Ut):Ut=t[96];let Wt;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(Wt=(0,Q.jsx)(`h2`,{className:`text-2xl font-semibold`,children:`All changes`}),t[97]=Wt):Wt=t[97];let Gt=s.revision,qt;t[98]===s.headOid?qt=t[99]:(qt=s.headOid.slice(0,7),t[98]=s.headOid,t[99]=qt);let Jt;t[100]===s.files.length?Jt=t[101]:(Jt=Kr(s.files.length,`file`),t[100]=s.files.length,t[101]=Jt);let Yt;t[102]!==s.revision||t[103]!==qt||t[104]!==Jt?(Yt=(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Revision `,Gt,` · `,qt,` ·`,` `,Jt,`, including specs`]}),t[102]=s.revision,t[103]=qt,t[104]=Jt,t[105]=Yt):Yt=t[105];let Xt;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Xt=(0,Q.jsx)(Y,{variant:`outline`,className:`self-start`,onClick:()=>pe(`walkthrough`),children:`Back to the walkthrough`}),t[106]=Xt):Xt=t[106];let Zt;t[107]===Yt?Zt=t[108]:(Zt=(0,Q.jsxs)(`header`,{className:`mb-5 flex flex-col gap-2`,children:[Wt,Yt,Xt]}),t[107]=Yt,t[108]=Zt);let Qt;t[109]===s.files?Qt=t[110]:(Qt=s.files.map(r8),t[109]=s.files,t[110]=Qt);let $t=(0,Q.jsxs)(`section`,{"aria-label":`All changes in this revision`,className:`@container-size/review min-h-0 min-w-0 flex-1 overflow-auto bg-card px-4 py-6`,style:Ut,children:[Zt,(0,Q.jsx)(J2,{revision:s,place:`changes`,paths:Qt,scope:P,context:c,active:Ee,marks:ae??{files:[],decisions:[]},gaps:!1,explanations:!1})]}),en;t[111]===ze?en=t[112]:(en=e=>ze.attach(e),t[111]=ze,t[112]=en);let tn=fe===`changes`,rn=fe===`changes`,an=!J&&`border`,on=fe===`changes`&&`pointer-events-none invisible absolute inset-0`,sn;t[113]!==an||t[114]!==on?(sn=X(`@container-size/review flex min-h-0 min-w-0 flex-1 flex-col overflow-auto bg-card wrap-anywhere`,an,on),t[113]=an,t[114]=on,t[115]=sn):sn=t[115];let cn;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(cn={containerName:`pane review`},t[116]=cn):cn=t[116];let ln=r&&(0,od.createPortal)(_t,r),un=Ee&&fe===`walkthrough`&&(0,Q.jsx)(m8,{stops:He,current:Ke.key,onGo:et}),dn;t[117]!==A||t[118]!==O?(dn=A&&A.head.oid!==O&&(0,Q.jsx)(`div`,{className:`px-4 pt-3`,children:(0,Q.jsx)(me,{role:`status`,title:`The branch tip differs from this review.`,description:`Publish a revision to include it.`})}),t[117]=A,t[118]=O,t[119]=dn):dn=t[119];let fn;t[120]!==z||t[121]!==b.failed||t[122]!==b.run||t[123]!==b.waiting||t[124]!==j.summary.expires||t[125]!==fe?(fn=b.failed&&(fe!==`summary`||z!==j.summary.expires)&&(0,Q.jsx)(`div`,{className:`px-4 py-2`,children:(0,Q.jsxs)(no,{variant:`destructive`,children:[(0,Q.jsx)(Qn,{children:`This review could not be refreshed. Showing the last loaded revision.`}),(0,Q.jsx)(Le,{children:(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,disabled:b.waiting,onClick:b.run,children:`Try again`})})]})}),t[120]=z,t[121]=b.failed,t[122]=b.run,t[123]=b.waiting,t[124]=j.summary.expires,t[125]=fe,t[126]=fn):fn=t[126];let pn;t[127]!==ee||t[128]!==K?(pn=f(K)&&(0,Q.jsx)(`div`,{className:`px-4 py-2`,children:(0,Q.jsxs)(no,{variant:`destructive`,children:[(0,Q.jsx)(Qn,{children:`This revision could not be recorded as seen.`}),(0,Q.jsx)(Le,{children:(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,disabled:K.waiting,onClick:ee,children:`Try again`})})]})}),t[127]=ee,t[128]=K,t[129]=pn):pn=t[129];let mn;t[130]===We?mn=t[131]:(mn=We&&(0,Q.jsx)(`div`,{className:`px-4 pt-3`,children:(0,Q.jsx)(me,{role:`status`,title:`That decision is not in this revision.`,description:`The briefing is shown below. Choose another decision or revision.`})}),t[130]=We,t[131]=mn);let hn;t[132]===Symbol.for(`react.memo_cache_sentinel`)?(hn=(0,Q.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading review content…`}),t[132]=hn):hn=t[132];let gn=(fe!==`summary`||R)&&(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start`,children:[(0,Q.jsx)(F0,{stops:He,current:fe===`summary`?void 0:Ke.key,done:Ze,onGo:et,page:ze.element}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[f(re)&&(0,Q.jsxs)(`p`,{role:`alert`,className:`p-3 text-sm`,children:[`Reviewed marks could not be read.`,` `,(0,Q.jsx)(Y,{variant:`outline`,size:`xs`,onClick:ie,children:`Try again`})]}),fe===`summary`&&z===j.summary.expires&&b.failed&&(0,Q.jsx)(v,{description:`A fresh link to the agent's page could not be read. Check the connection and try again.`,onRetry:b.run}),fe===`summary`&&!(z===j.summary.expires&&b.failed)&&(0,Q.jsx)(`div`,{className:`mx-auto w-full max-w-264 px-4 pt-6 pb-8 @2xl/review:px-6 @5xl/review:pr-9 @5xl/review:pl-5.5`,children:(0,Q.jsx)(R2,{revision:s,page:I,url:z===j.summary.expires?void 0:L,dark:se,stops:He,done:Ze,onGo:et})}),fe!==`summary`&&Ke.kind===`briefing`&&(0,Q.jsx)(i2,{...at,revision:s,latestRevision:o.review?.latestRevision??s.revision,title:wt,pullRequestChip:Nt,proofCurrent:x&&s.headOid===O,margin:(0,Q.jsx)(E0,{data:o,revision:s,context:c,onRevision:u,onDeleted:m??p,onBack:J?p:void 0}),stops:He,items:Je,decisions:qe,done:Ze,onGo:et}),fe!==`summary`&&Ke.kind!==`briefing`&&(0,Q.jsxs)(`section`,{role:`region`,"aria-label":Ke.kind===`decision`?$p(Ke):`After the decisions`,className:`flex min-w-0 animate-in flex-col fade-in-0 duration-200 motion-reduce:animate-none`,children:[(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-264 flex-col gap-8 px-4 pt-8 @2xl/review:px-6 @5xl/review:pr-9 @5xl/review:pl-5.5`,children:Ke.kind===`decision`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(h2,{proofCurrent:x&&s.headOid===O,stop:Ke,total:Qe,pullRequestChip:Nt,review:j,revision:s,scope:P,context:c,decision:qe.get(Ke.layer.id),finished:Ze(Ke),items:Je,onGo:et,onStep:rt},Ke.key),(0,Q.jsx)(r2,{children:(0,Q.jsx)(J2,{revision:s,place:Ke.key,paths:Ke.paths,scope:P,context:c,active:Ee&&fe===`walkthrough`,marks:ae??{files:[],decisions:[]},steps:Ke.layer.steps,decision:!0},Ke.key)})]}):(0,Q.jsx)(D2,{stops:He,current:Ke,revision:s,record:Tt,items:Je,threads:Dt,pullRequest:Ct?.kind===`available`?Ct.pullRequest:void 0,archivable:Tt?bi(Tt,Ct):!1,status:Tt&&lr(Tt,Ct)?{...Bo({revision:s,marks:ae,status:T?.status,pull:Ct}),group:`Closed`}:Bo({revision:s,marks:ae,status:T?.status,pull:Ct}),scope:P,context:c,onGo:et,code:e=>(0,Q.jsx)(J2,{revision:s,place:e.key,paths:e.paths,scope:P,context:c,active:Ee&&fe===`walkthrough`&&e.key===Ke.key,marks:ae??{files:[],decisions:[]},card:!0,gaps:!1,commentLabel:e.kind===`unexplained`?`Ask why`:void 0})})}),(0,Q.jsx)(u8,{children:(0,Q.jsx)(z2,{label:Ke.kind===`decision`?`Decision ${Ke.number} of ${Qe}`:Qp(Ke),shortLabel:Ke.kind===`decision`?`${Ke.number} of ${Qe}`:Qp(Ke),compactLabel:Ke.kind===`decision`?`${Ke.number}/${Qe}`:`${He.findIndex(e=>e.key===Ke.key)+1}/${He.length}`,stops:He,current:Ke.key,onGo:et,onPrevious:$e(-1),onNext:$e(1),children:Ke.kind===`decision`?(0,Q.jsx)(f8,{revision:s,layerId:Ke.layer.id,fingerprint:Ke.layer.fingerprint,reviewed:Ze(Ke),files:s.files.filter(e=>Ke.paths.includes(e.path)),settled:tt(re),context:c}):(0,Q.jsx)(p8,{revision:s,files:s.files.filter(e=>(e.newOid??e.oldOid)!==void 0&&Ke.paths.includes(e.path)&&Je.find(t=>t.path===e.path)?.reviewStatus!==`reviewed`),settled:tt(re),context:c})})})]},Ke.key)]})]}),_n;t[133]===gn?_n=t[134]:(_n=(0,Q.jsx)(Z.Suspense,{fallback:hn,children:gn}),t[133]=gn,t[134]=_n);let vn;t[135]!==en||t[136]!==tn||t[137]!==rn||t[138]!==sn||t[139]!==ln||t[140]!==un||t[141]!==dn||t[142]!==fn||t[143]!==pn||t[144]!==mn||t[145]!==_n?(vn=(0,Q.jsxs)(`section`,{ref:en,"aria-label":`Review walkthrough`,"aria-hidden":tn,inert:rn,className:sn,style:cn,children:[ln,un,dn,fn,pn,mn,_n]}),t[135]=en,t[136]=tn,t[137]=rn,t[138]=sn,t[139]=ln,t[140]=un,t[141]=dn,t[142]=fn,t[143]=pn,t[144]=mn,t[145]=_n,t[146]=vn):vn=t[146];let yn=vn,bn=fe===`changes`&&$t,xn;t[147]!==bn||t[148]!==yn?(xn=(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[bn,yn]}),t[147]=bn,t[148]=yn,t[149]=xn):xn=t[149];let Sn=xn;if(!J)return Sn;let Cn;t[150]!==kt||t[151]!==Ft?(Cn=(0,Q.jsx)(l8,{onShow:kt,onToggle:Ft}),t[150]=kt,t[151]=Ft,t[152]=Cn):Cn=t[152];let wn;t[153]!==Oe||t[154]!==zt||t[155]!==ke||t[156]!==Re||t[157]!==je||t[158]!==kt||t[159]!==Ft?(wn=Oe&&(0,Q.jsx)(X6,{surfaces:c8,names:zt,published:!0,surface:`changes`,open:ke,onSelect:kt,onHide:()=>je(!1),onToggle:Ft,toggleRef:e=>Re.attach(e)}),t[153]=Oe,t[154]=zt,t[155]=ke,t[156]=Re,t[157]=je,t[158]=kt,t[159]=Ft,t[160]=wn):wn=t[160];let Tn=ls,En;t[161]===zt.changes?En=t[162]:(En=(0,Q.jsx)(Kt,{children:zt.changes}),t[161]=zt.changes,t[162]=En);let Dn;t[163]===Symbol.for(`react.memo_cache_sentinel`)?(Dn=(0,Q.jsx)(Dr,{children:`Readiness, changed files and comments of this review.`}),t[163]=Dn):Dn=t[163];let On;t[164]===En?On=t[165]:(On=(0,Q.jsxs)(ns,{className:`sr-only`,children:[En,Dn]}),t[164]=En,t[165]=On);let kn=!Oe&&Bt(`sheet`),An;return t[166]!==Tn||t[167]!==On||t[168]!==kn?(An=(0,Q.jsxs)(Tn,{className:`w-[min(90vw,22rem)]!`,showCloseButton:!1,children:[On,kn]}),t[166]=Tn,t[167]=On,t[168]=kn,t[169]=An):An=t[169],(0,Q.jsxs)(zo,{open:Fe&&!Oe,onOpenChange:Ie,children:[Cn,(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:[(0,Q.jsx)(W2,{revision:s,context:c,navigation:i,layout:Se,focused:ge,onOpen:we,review:Sn,reviewActions:_t,panelControl:Ht}),Oe&&ke&&(0,Q.jsx)(`div`,{className:`ml-2 w-80 shrink-0`,children:Bt(`docked`)}),wn]}),An]})}function r8(e){return e.path}function i8(e){return!e}function a8(e){return!e}function o8(e){return e.reviewStatus===`reviewed`}function s8(e){return e.path}var c8=[`changes`];function l8(e){let t=(0,$.c)(2),{onShow:n,onToggle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={ignoreInputs:!0},t[0]=i):i=t[0],pc(cc.surfaceReview,n,i);let a;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a={ignoreInputs:!0},t[1]=a):a=t[1],pc(cc.toggleSidebar,r,a),null}function u8(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`pointer-events-none sticky bottom-0 z-20 mx-auto w-full max-w-264 px-2 pb-4 @md/review:px-4 @2xl/review:px-6 @5xl/review:pr-9 @5xl/review:pl-5.5`,children:(0,Q.jsx)(r2,{children:n})}),t[0]=n,t[1]=r),r}function d8(e){return e.flatMap(e=>{let t=e.newOid??e.oldOid;return t?[{path:e.path,headBlobOid:t}]:[]})}function f8(e){let t=(0,$.c)(24),{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=Ic({connection:s.connection,reviewId:n.reviewId}),t[0]=s.connection,t[1]=n.reviewId,t[2]=l):l=t[2];let u=l,[d,p]=xa(u.completeDecision),[m,h]=xa(u.unmark),g=a?`outline`:`default`,_=!o||d.waiting||m.waiting,v;t[3]!==c||t[4]!==i||t[5]!==r||t[6]!==p||t[7]!==a||t[8]!==n.revision||t[9]!==h?(v=()=>a?h({kind:`decision`,layerId:r,fingerprint:i}):p({revision:n.revision,layerId:r,fingerprint:i,files:d8(c)}),t[3]=c,t[4]=i,t[5]=r,t[6]=p,t[7]=a,t[8]=n.revision,t[9]=h,t[10]=v):v=t[10];let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(ir,{}),t[11]=y):y=t[11];let b=a?`Decision reviewed`:`Mark decision reviewed`,x;t[12]!==a||t[13]!==g||t[14]!==_||t[15]!==v||t[16]!==b?(x=(0,Q.jsxs)(Y,{type:`button`,variant:g,"aria-pressed":a,disabled:_,onClick:v,children:[y,b]}),t[12]=a,t[13]=g,t[14]=_,t[15]=v,t[16]=b,t[17]=x):x=t[17];let S;t[18]!==m||t[19]!==d?(S=(f(d)||f(m))&&(0,Q.jsx)(`p`,{role:`alert`,className:`px-2 text-xs text-destructive`,children:`Not saved. Try again.`}),t[18]=m,t[19]=d,t[20]=S):S=t[20];let C;return t[21]!==x||t[22]!==S?(C=(0,Q.jsxs)(Q.Fragment,{children:[x,S]}),t[21]=x,t[22]=S,t[23]=C):C=t[23],C}function p8(e){let t=(0,$.c)(19),{revision:n,files:r,settled:i,context:a}=e,o;t[0]!==a.connection||t[1]!==n.reviewId?(o=Ic({connection:a.connection,reviewId:n.reviewId}),t[0]=a.connection,t[1]=n.reviewId,t[2]=o):o=t[2];let[s,c]=xa(o.markFiles),l=!i||r.length===0||s.waiting,u;t[3]!==r||t[4]!==c||t[5]!==n.revision?(u=()=>c({revision:n.revision,files:d8(r)}),t[3]=r,t[4]=c,t[5]=n.revision,t[6]=u):u=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(ir,{}),t[7]=d):d=t[7];let p;t[8]===r.length?p=t[9]:(p=r.length===0?`Every file reviewed`:`Mark ${Kr(r.length,`file`)} reviewed`,t[8]=r.length,t[9]=p);let m;t[10]!==l||t[11]!==u||t[12]!==p?(m=(0,Q.jsxs)(Y,{type:`button`,variant:`default`,disabled:l,onClick:u,children:[d,p]}),t[10]=l,t[11]=u,t[12]=p,t[13]=m):m=t[13];let h;t[14]===s?h=t[15]:(h=f(s)&&(0,Q.jsx)(`p`,{role:`alert`,className:`px-2 text-xs text-destructive`,children:`Some files were not marked. Try again.`}),t[14]=s,t[15]=h);let g;return t[16]!==m||t[17]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function m8(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=Xp(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],pc(cc.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],pc(cc.previousStop,l,u),null}function h8(e){let t=(0,$.c)(25),{scope:n,context:r,active:i,toolbarTarget:a,onOpen:o,onBrowse:s}=e,c=dZ(n,r),[l,u]=(0,Z.useState)(),d=c.review?.reviewId,p=JX(d??``);if(qi(c.result)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(dn,{label:`Loading review`}),t[0]=e):e=t[0],e}if(f(c.result)){let e;return t[1]===c.refresh?e=t[2]:(e=(0,Q.jsx)(v,{description:`The branch review could not be read.`,onRetry:c.refresh}),t[1]=c.refresh,t[2]=e),e}if(!d||d===l){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(me,{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[3]=e):e=t[3],e}let m=c.review?.proof.current,h;t[4]===p?h=t[5]:(h=()=>p.choose(void 0),t[4]=p,t[5]=h);let g;t[6]!==c||t[7]!==d?(g=()=>{u(d),c.refresh()},t[6]=c,t[7]=d,t[8]=g):g=t[8];let _;t[9]===s?_=t[10]:(_=e=>s(`changes`,e),t[9]=s,t[10]=_);let y;return t[11]!==i||t[12]!==r||t[13]!==o||t[14]!==d||t[15]!==n||t[16]!==p.choose||t[17]!==p.request||t[18]!==p.revision||t[19]!==m||t[20]!==h||t[21]!==g||t[22]!==_||t[23]!==a?(y=(0,Q.jsx)(Z6,{toolbarTarget:a,onOpen:o,proofCurrent:m,active:i,reviewId:d,revision:p.revision,context:r,onRevision:p.choose,onBack:h,onDeleted:g,onShowReviewPanel:_,liveScope:n},p.request),t[11]=i,t[12]=r,t[13]=o,t[14]=d,t[15]=n,t[16]=p.choose,t[17]=p.request,t[18]=p.revision,t[19]=m,t[20]=h,t[21]=g,t[22]=_,t[23]=a,t[24]=y):y=t[24],y}function g8(e){let t=(0,$.c)(8),n=dZ(e.scope,e.context);if(n.review?.reviewId){let n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(h8,{...e,toolbarTarget:e.interaction.toolbarTarget,active:e.interaction.active}),t[0]=e,t[1]=n),n}let r;t[2]!==n.result||t[3]!==n.review?(r=Dn(Te(n.result))&&!n.review,t[2]=n.result,t[3]=n.review,t[4]=r):r=t[4];let i;return t[5]!==e||t[6]!==r?(i=(0,Q.jsx)(p0,{...e,intro:r}),t[5]=e,t[6]=r,t[7]=i):i=t[7],i}var _8=[{value:`uncommitted`,label:`Uncommitted`,Icon:of},{value:`branch`,label:`Branch`,Icon:Of}];function v8(e){let t=(0,$.c)(6),{value:n,onValueChange:r}=e,i;t[0]===r?i=t[1]:(i=e=>{MK(e)&&r(e)},t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Rn,{"aria-label":`Compare`,children:_8.map(y8)}),t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==n?(o=(0,Q.jsx)(Ae,{className:`shrink-0`,value:n,onValueChange:i,children:a}),t[3]=i,t[4]=n,t[5]=o):o=t[5],o}function y8(e){let{value:t,label:n,Icon:r}=e;return(0,Q.jsxs)(dt,{children:[(0,Q.jsxs)(De,{render:(0,Q.jsx)($n,{value:t,"aria-label":n}),children:[(0,Q.jsx)(r,{className:`@min-3xl/pane:hidden`}),(0,Q.jsx)(`span`,{className:`hidden whitespace-nowrap @min-3xl/pane:inline`,children:n})]}),(0,Q.jsx)(Et,{children:n})]},t)}function b8(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)(x8,{...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)(U2,{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 x8(e){let t=(0,$.c)(174),{worktree:n,projectId:r,search:i,onSearch:a,context:o,navigationTrigger:s}=e,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),f=SX(),[p,m]=(0,Z.useState)(f);p!==f&&(m(f),f&&u&&(l(!0),d(!1)));let h=vI(),g=vI(),_=vI(),{isMobile:v,open:y,openMobile:b}=cr(),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,focused:T,setFocused:E}=RX(n.id),O=rP(C,o.connection),k=dZ(C,o),A;t[3]===O?A=t[4]:(A=D(Te(O)),t[3]=O,t[4]=A);let j=A,M;t[5]===k.result?M=t[6]:(M=D(Te(k.result)),t[5]=k.result,t[6]=M);let N=M,P;t[7]!==w||t[8]!==i.entry||t[9]!==i.side?(P=!w&&!iq(i.entry)&&!iq(i.side),t[7]=w,t[8]=i.entry,t[9]=i.side,t[10]=P):P=t[10];let F=P,I=!F||!j&&!N,L;t[11]!==O||t[12]!==k.review?(L=k.review||(Ts(Te(O))?.changes.length??0)>0?rq({kind:`handoff`}):null,t[11]=O,t[12]=k.review,t[13]=L):L=t[13];let R=L,z=u&&!f,B;t[14]!==R||t[15]!==T||t[16]!==_.element||t[17]!==a||t[18]!==I||t[19]!==i.entry||t[20]!==i.side||t[21]!==E||t[22]!==z||t[23]!==n.id?(B={worktreeId:n.id,entry:i.entry,side:i.side,onSearch:a,fallback:R,focused:T,setFocused:E,ready:I,focusBoundary:_.element,focusBoundaryOpen:z},t[14]=R,t[15]=T,t[16]=_.element,t[17]=a,t[18]=I,t[19]=i.entry,t[20]=i.side,t[21]=E,t[22]=z,t[23]=n.id,t[24]=B):B=t[24];let V=rZ(B),H;t[25]!==T||t[26]!==V.split?(H=Cq(E8(V.split,T)),t[25]=T,t[26]=V.split,t[27]=H):H=t[27];let U=H,W;t[28]!==c||t[29]!==h?(W=()=>{c&&h.element?.focus(),l(C8)},t[28]=c,t[29]=h,t[30]=W):W=t[30];let G=W,K;t[31]!==f||t[32]!==G?(K=()=>{f?G():d(S8)},t[31]=f,t[32]=G,t[33]=K):K=t[33];let ee;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ee={ignoreInputs:!0},t[34]=ee):ee=t[34],pc(cc.toggleSidebar,K,ee);let[q,te]=(0,Z.useState)(),ne;t[35]!==T||t[36]!==V||t[37]!==a?(ne=(e,t,n)=>{let r=rq(e),i=+(T===0),o=n?.toSide?i:V.open(T,r);te(t?{anchor:t,nonce:Date.now(),pane:o,key:r,...n?.compose?{compose:!0}:{}}:void 0);let s=t?Jr(t):void 0;n?.toSide&&V.openToSide(T,r),s!==void 0&&a({base:s}),d(!1)},t[35]=T,t[36]=V,t[37]=a,t[38]=ne):ne=t[38];let re=ne,ie;t[39]===a?ie=t[40]:(ie=e=>{a({surface:e})},t[39]=a,t[40]=ie);let ae=ie,oe;t[41]!==f||t[42]!==ae?(oe=e=>{ae(e),f?l(!0):d(!0)},t[41]=f,t[42]=ae,t[43]=oe):oe=t[43];let se=oe,ce;t[44]===se?ce=t[45]:(ce=()=>se(`changes`),t[44]=se,t[45]=ce);let le;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(le={ignoreInputs:!0},t[46]=le):le=t[46],pc(cc.surfaceReview,ce,le);let ue;t[47]===se?ue=t[48]:(ue=()=>se(`files`),t[47]=se,t[48]=ue);let de;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(de={ignoreInputs:!0},t[49]=de):de=t[49],pc(cc.surfaceFiles,ue,de);let fe;t[50]===se?fe=t[51]:(fe=()=>se(`history`),t[50]=se,t[51]=fe);let pe;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(pe={ignoreInputs:!0},t[52]=pe):pe=t[52],pc(cc.surfaceHistory,fe,pe);let J=vI(),me;t[53]!==J||t[54]!==se?(me=(e,t)=>{J.attach(t),se(e)},t[53]=J,t[54]=se,t[55]=me):me=t[55];let he=me,ge=i.scope??`uncommitted`,_e,ve;t[56]===a?(_e=t[57],ve=t[58]):(_e=e=>a({scope:e===`branch`?e:void 0}),ve=e=>a({base:e}),t[56]=a,t[57]=_e,t[58]=ve);let ye,be,xe,Se,Ce,we,Ee,Oe,ke,Ae,je,Me,Ne;if(t[59]!==he||t[60]!==J||t[61]!==o||t[62]!==f||t[63]!==T||t[64]!==V||t[65]!==u||t[66]!==_||t[67]!==g||t[68]!==s||t[69]!==v||t[70]!==y||t[71]!==b||t[72]!==F||t[73]!==a||t[74]!==re||t[75]!==O||t[76]!==c||t[77]!==k||t[78]!==h||t[79]!==q||t[80]!==C||t[81]!==i.base||t[82]!==ae||t[83]!==se||t[84]!==U||t[85]!==x||t[86]!==ge||t[87]!==_e||t[88]!==ve||t[89]!==G||t[90]!==n.available||t[91]!==n.path){let e={scope:ge,onScope:_e,onBase:ve},r=V.panes[T]?.active??void 0,p=t=>(0,Q.jsx)(U6,{layout:t,scope:C,context:o,worktreePath:n.path,surface:x,activeEntry:r,available:n.available,onSurface:ae,onOpen:re,sideLabel:U,changes:{...e,base:i.base,onBase:e=>a({base:e})}}),m;t[105]!==J||t[106]!==o||t[107]!==f||t[108]!==V||t[109]!==u||t[110]!==g||t[111]!==C?(m=e=>(0,Q.jsxs)(`div`,{"data-review-controls":``,className:`contents`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-5 w-px bg-border`}),(0,Q.jsx)(hX,{scope:C,context:o}),(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-sm`,ref:e=>g.attach(e),className:`xl:hidden`,"aria-label":`Review`,"aria-haspopup":`dialog`,"aria-expanded":u&&!f,"aria-keyshortcuts":cc.toggleSidebar,onClick:()=>{J.attach(null),V.selectPane(e),d(!0)},children:(0,Q.jsx)(np,{})})}),(0,Q.jsxs)(Et,{role:`tooltip`,className:`break-all`,children:[`Review `,(0,Q.jsx)(gI,{children:Ks(cc.toggleSidebar)})]})]})]}),t[105]=J,t[106]=o,t[107]=f,t[108]=V,t[109]=u,t[110]=g,t[111]=C,t[112]=m):m=t[112];let S=m,w;t[113]===re?w=t[114]:(w=e=>re({kind:`file`,path:e}),t[113]=re,t[114]=w),t[115]!==o.connection||t[116]!==V.bindQuickOpen||t[117]!==V.recentFiles||t[118]!==C||t[119]!==w?(Me=(0,Q.jsx)(dK,{bindPopup:V.bindQuickOpen,openFiles:V.recentFiles,scope:C,connection:o.connection,onOpen:w}),t[115]=o.connection,t[116]=V.bindQuickOpen,t[117]=V.recentFiles,t[118]=C,t[119]=w,t[120]=Me):Me=t[120];let E=v?0:480,D;t[121]!==o||t[122]!==C?(D=(0,Q.jsx)(zq,{scope:C,context:o}),t[121]=o,t[122]=C,t[123]=D):D=t[123];let A;t[124]!==o||t[125]!==re||t[126]!==C?(A=(0,Q.jsx)(Bq,{scope:C,context:o,onOpen:re}),t[124]=o,t[125]=re,t[126]=C,t[127]=A):A=t[127];let j=(0,Q.jsxs)(`section`,{"aria-label":`Review content`,className:`flex h-full min-w-0 flex-col overflow-hidden rounded-paper border bg-card`,children:[D,A,(0,Q.jsx)(w8,{reveal:q,scope:C,context:o,overview:O,published:k,needsDefault:F,layout:V,base:i.base,changes:e,focused:T,onOpen:re,onBrowse:he,navigationTrigger:s,navigatorIsMobile:v,navigatorOpen:y,navigatorOpenMobile:b,tabControls:S})]}),M;t[128]!==E||t[129]!==j?(M=(0,Q.jsx)(mG,{id:`review-document`,minSize:E,children:j}),t[128]=E,t[129]=j,t[130]=M):M=t[130];let N=c&&f&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hG,{"aria-label":`Document panes and side panel`,className:`w-2 bg-transparent after:w-2`}),(0,Q.jsx)(mG,{id:`review-sidebar`,defaultSize:320,minSize:260,maxSize:520,children:p(`docked`)})]}),P;t[131]!==M||t[132]!==N?(P=(0,Q.jsxs)(pG,{orientation:`horizontal`,className:`min-h-0 flex-1`,children:[M,N]}),t[131]=M,t[132]=N,t[133]=P):P=t[133];let I;t[134]!==f||t[135]!==c||t[136]!==k.review||t[137]!==h||t[138]!==se||t[139]!==x||t[140]!==G?(I=f&&(0,Q.jsx)(X6,{surfaces:G6,names:K6(k.review),published:!!k.review,surface:x,open:c,onSelect:se,onHide:()=>l(!1),onToggle:G,toggleRef:e=>h.attach(e)}),t[134]=f,t[135]=c,t[136]=k.review,t[137]=h,t[138]=se,t[139]=x,t[140]=G,t[141]=I):I=t[141],t[142]!==P||t[143]!==I?(Ne=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[P,I]}),t[142]=P,t[143]=I,t[144]=Ne):Ne=t[144],be=zo,ke=u&&!f,Ae=d,t[145]===V?je=t[146]:(je=e=>{e||V.focusDestination()},t[145]=V,t[146]=je),ye=ls,t[147]!==V||t[148]!==_?(xe=e=>{_.attach(e),e===null&&V.focusDestination()},t[147]=V,t[148]=_,t[149]=xe):xe=t[149],t[150]!==J.element||t[151]!==V||t[152]!==_.element||t[153]!==g.element?(Se=()=>{if(V.hasDestinationFocus())return!1;let e=document.activeElement;return e===document.body||_.element?.contains(e)?J.element?.isConnected?J.element:g.element:!1},t[150]=J.element,t[151]=V,t[152]=_.element,t[153]=g.element,t[154]=Se):Se=t[154],Ce=`w-[min(90vw,22rem)]!`,we=!1,t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsxs)(ns,{className:`sr-only`,children:[(0,Q.jsx)(Kt,{children:`Worktree review`}),(0,Q.jsx)(Dr,{children:`Choose a review surface and open a document.`})]}),t[155]=Ee):Ee=t[155],Oe=!f&&p(`sheet`),t[59]=he,t[60]=J,t[61]=o,t[62]=f,t[63]=T,t[64]=V,t[65]=u,t[66]=_,t[67]=g,t[68]=s,t[69]=v,t[70]=y,t[71]=b,t[72]=F,t[73]=a,t[74]=re,t[75]=O,t[76]=c,t[77]=k,t[78]=h,t[79]=q,t[80]=C,t[81]=i.base,t[82]=ae,t[83]=se,t[84]=U,t[85]=x,t[86]=ge,t[87]=_e,t[88]=ve,t[89]=G,t[90]=n.available,t[91]=n.path,t[92]=ye,t[93]=be,t[94]=xe,t[95]=Se,t[96]=Ce,t[97]=we,t[98]=Ee,t[99]=Oe,t[100]=ke,t[101]=Ae,t[102]=je,t[103]=Me,t[104]=Ne}else ye=t[92],be=t[93],xe=t[94],Se=t[95],Ce=t[96],we=t[97],Ee=t[98],Oe=t[99],ke=t[100],Ae=t[101],je=t[102],Me=t[103],Ne=t[104];let Pe;t[156]!==ye||t[157]!==xe||t[158]!==Se||t[159]!==Ce||t[160]!==we||t[161]!==Ee||t[162]!==Oe?(Pe=(0,Q.jsxs)(ye,{ref:xe,finalFocus:Se,className:Ce,showCloseButton:we,children:[Ee,Oe]}),t[156]=ye,t[157]=xe,t[158]=Se,t[159]=Ce,t[160]=we,t[161]=Ee,t[162]=Oe,t[163]=Pe):Pe=t[163];let Fe;t[164]!==be||t[165]!==ke||t[166]!==Ae||t[167]!==je||t[168]!==Pe?(Fe=(0,Q.jsx)(be,{open:ke,onOpenChange:Ae,onOpenChangeComplete:je,children:Pe}),t[164]=be,t[165]=ke,t[166]=Ae,t[167]=je,t[168]=Pe,t[169]=Fe):Fe=t[169];let Ie;return t[170]!==Me||t[171]!==Ne||t[172]!==Fe?(Ie=(0,Q.jsxs)(Q.Fragment,{children:[Me,Ne,Fe]}),t[170]=Me,t[171]=Ne,t[172]=Fe,t[173]=Ie):Ie=t[173],Ie}function S8(e){return!e}function C8(e){return!e}function w8(e){let t=(0,$.c)(3),n=D(Te(e.overview)),r=D(Te(e.published.result));if(e.needsDefault&&n&&f(e.overview))throw ht(e.overview.cause);if(e.needsDefault&&r&&f(e.published.result))throw ht(e.published.result.cause);if(e.needsDefault&&(n||r)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(dn,{label:`Loading review`}),t[0]=e):e=t[0],e}let i;return t[1]===e?i=t[2]:(i=(0,Q.jsx)(T8,{...e}),t[1]=e,t[2]=i),i}function T8(e){let t=(0,$.c)(48),{published:n,layout:r,reveal:i,scope:a,context:o,base:s,changes:c,focused:l,onOpen:u,onBrowse:d,navigationTrigger:f,navigatorIsMobile:p,navigatorOpen:m,navigatorOpenMobile:h,tabControls:g}=e,_;t[0]!==l||t[1]!==r.panes?(_=r.panes[l]??{tabs:[],pinned:[],active:null},t[0]=l,t[1]=r.panes,t[2]=_):_=t[2];let v=_,y=r.split||l===0,b;t[3]===y?b=t[4]:(b={ignoreInputs:!0,enabled:y},t[3]=y,t[4]=b);let x=b,S;t[5]!==l||t[6]!==r?(S=()=>r.step(l,1),t[5]=l,t[6]=r,t[7]=S):S=t[7],pc(cc.nextTab,S,x);let C;t[8]!==l||t[9]!==r?(C=()=>r.step(l,-1),t[8]=l,t[9]=r,t[10]=C):C=t[10],pc(cc.previousTab,C,x);let w;t[11]!==l||t[12]!==v.active||t[13]!==r?(w=()=>v.active!==null&&v.active!==void 0&&r.close(l,v.active),t[11]=l,t[12]=v.active,t[13]=r,t[14]=w):w=t[14],pc(cc.closeTab,w,x);let T;t[15]!==l||t[16]!==v.active||t[17]!==r?(T=()=>v.active!==null&&v.active!==void 0&&r.openToSide(l,v.active),t[15]=l,t[16]=v.active,t[17]=r,t[18]=T):T=t[18],pc(cc.openToSide,T,x);let E;t[19]!==s||t[20]!==c||t[21]!==o||t[22]!==l||t[23]!==r||t[24]!==f||t[25]!==p||t[26]!==m||t[27]!==h||t[28]!==d||t[29]!==u||t[30]!==n.review||t[31]!==i||t[32]!==a||t[33]!==g?(E=e=>({reveal:i,index:e,layout:r,split:r.split,focused:l===e,scope:a,context:o,reviewTitle:oq(n.review),review:n.review??void 0,base:s,changes:c,onOpen:u,onBrowse:d,navigationTrigger:f,navigatorIsMobile:p,navigatorOpen:m,navigatorOpenMobile:h,tabControls:g}),t[19]=s,t[20]=c,t[21]=o,t[22]=l,t[23]=r,t[24]=f,t[25]=p,t[26]=m,t[27]=h,t[28]=d,t[29]=u,t[30]=n.review,t[31]=i,t[32]=a,t[33]=g,t[34]=E):E=t[34];let D=E,O=p?`vertical`:`horizontal`,k=p?200:320,A;t[35]===D?A=t[36]:(A=(0,Q.jsx)(D8,{...D(0)}),t[35]=D,t[36]=A);let j;t[37]!==k||t[38]!==A?(j=(0,Q.jsx)(mG,{id:`pane-left`,minSize:k,children:A}),t[37]=k,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==r.split||t[41]!==p||t[42]!==D?(M=r.split&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hG,{"aria-label":p?`Top and bottom document panes`:`Left and right document panes`,withHandle:!0}),(0,Q.jsx)(mG,{id:`pane-right`,minSize:p?200:320,children:(0,Q.jsx)(D8,{...D(1)})})]}),t[40]=r.split,t[41]=p,t[42]=D,t[43]=M):M=t[43];let N;return t[44]!==j||t[45]!==M||t[46]!==O?(N=(0,Q.jsxs)(pG,{orientation:O,className:`min-h-0 flex-1`,children:[j,M]}),t[44]=j,t[45]=M,t[46]=O,t[47]=N):N=t[47],N}function E8(e,t){return e?t===0?`left`:`right`:null}function D8(e){let t=(0,$.c)(40),{reveal:n,index:r,layout:i,split:a,focused:o,scope:s,context:c,reviewTitle:l,review:u,base:d,changes:f,onOpen:p,onBrowse:m,navigationTrigger:h,navigatorIsMobile:g,navigatorOpen:_,navigatorOpenMobile:v,tabControls:y}=e,{element:b,attach:x}=vI(),S=i.panes[r]??{tabs:[],pinned:[],active:null},C=(0,Z.useDeferredValue)(S.active),w=S.active!==`handoff`&&S.tabs.includes(C??``)?C:S.active,T=w!==S.active,E=iq(w??void 0),D;t[0]!==r||t[1]!==i?(D=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[0]=r,t[1]=i,t[2]=D):D=t[2];let O=D,k;t[3]!==c||t[4]!==u||t[5]!==l||t[6]!==s?(k={scope:s,context:c,review:u,reviewTitle:l},t[3]=c,t[4]=u,t[5]=l,t[6]=s,t[7]=k):k=t[7];let A=mZ(k),j;t[8]!==r||t[9]!==i?(j=e=>i.bindPane(r,e),t[8]=r,t[9]=i,t[10]=j):j=t[10];let M=a&&r===1&&`border-l`,N=r===1&&`motion-safe:animate-in motion-safe:fade-in-0 duration-150`,P;t[11]!==M||t[12]!==N?(P=X(`@container/pane relative flex h-full min-h-0 min-w-0 flex-col`,M,N),t[11]=M,t[12]=N,t[13]=P):P=t[13];let F;t[14]!==c.connection||t[15]!==s?(F={connection:c.connection,scope:s},t[14]=c.connection,t[15]=s,t[16]=F):F=t[16];let I;t[17]!==r||t[18]!==h||t[19]!==g||t[20]!==_||t[21]!==v?(I=r===0?(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(De,{render:(0,Q.jsx)(`span`,{className:`inline-flex`}),children:(0,Q.jsx)(yi,{ref:e=>h.attach(e),"aria-label":`Toggle Sidebar`,"aria-expanded":g?v:_,"aria-keyshortcuts":jc()===`mac`?`Meta+B`:`Control+B`,onClick:()=>{!g&&_&&requestAnimationFrame(()=>h.element?.focus())}})}),(0,Q.jsxs)(Et,{role:`tooltip`,className:`break-all`,children:[`Toggle Sidebar`,` `,(0,Q.jsx)(gI,{children:Ks(cc.toggleNavigator)})]})]}):void 0,t[17]=r,t[18]=h,t[19]=g,t[20]=_,t[21]=v,t[22]=I):I=t[22];let L=S.tabs,R=S.pinned,z;t[23]!==r||t[24]!==a?(z=E8(a,r),t[23]=r,t[24]=a,t[25]=z):z=t[25];let B;t[26]!==r||t[27]!==i?(B=lZ(i,r),t[26]=r,t[27]=i,t[28]=B):B=t[28];let V=E?.kind===`handoff`&&!u&&(0,Q.jsx)(v8,{value:f.scope,onValueChange:f.onScope}),H=(E?.kind===`branch`||E?.kind===`handoff`&&!u&&f.scope===`branch`)&&(0,Q.jsx)(w6,{scope:s,connection:c.connection,base:d,onBase:f.onBase,compact:!0}),U;t[29]!==x||t[30]!==V||t[31]!==H?(U=(0,Q.jsxs)(`div`,{ref:x,"data-pane-controls":``,role:`toolbar`,"aria-label":`Document controls`,className:`flex items-center gap-1`,children:[V,H]}),t[29]=x,t[30]=V,t[31]=H,t[32]=U):U=t[32];let W;t[33]!==r||t[34]!==a||t[35]!==y?(W=(!a||r===1)&&y(r),t[33]=r,t[34]=a,t[35]=y,t[36]=W):W=t[36];let G;return t[37]!==U||t[38]!==W?(G=(0,Q.jsxs)(Q.Fragment,{children:[U,W]}),t[37]=U,t[38]=W,t[39]=G):G=t[39],(0,Q.jsxs)(`section`,{ref:j,"aria-label":a?`${r===0?`Left`:`Right`} pane`:void 0,"data-focused":o,"aria-busy":T,onPointerDownCapture:O,onFocusCapture:O,className:P,children:[(0,Q.jsx)(_Z,{commitContext:F,firstTabCount:A,leading:I,tabs:L,pinned:R,active:w,reviewTitle:l,side:z,focused:o,...B,trailing:G}),E?.kind===`branch-file`&&(0,Q.jsxs)(`div`,{role:`group`,"aria-label":`Branch comparison`,className:`flex items-center gap-2 border-b px-3.5 py-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`Branch comparison`}),(0,Q.jsx)(w6,{scope:s,connection:c.connection,base:d,onBase:f.onBase,compact:!0})]}),S.tabs.filter(e=>e===w||e===`handoff`&&u!==void 0).map(e=>{let t=iq(e);if(!t)return null;let i=e===w,l=t.kind===`handoff`&&!u&&f.scope===`branch`?{kind:`branch`}:t;return(0,Q.jsx)(`div`,{"aria-hidden":!i,inert:!i||T,className:X(`flex min-h-0 flex-1 flex-col overflow-hidden`,!i&&`pointer-events-none invisible absolute opacity-0 inset-x-0 top-12 bottom-0`),children:(0,Q.jsx)(U2,{documentKey:e,connection:c.connection,scope:s,children:(0,Q.jsx)(o0,{handoff:g8,scope:s,context:c,document:l,sideLabel:Cq(E8(a,r)),base:d,onOpen:p,onBrowse:m,active:i&&o&&!T,toolbarTarget:i&&!T?b:null,reveal:i&&n?.pane===r&&n.key===w?n:void 0})})},t.kind===`handoff`?`handoff`:`document`)})]})}export{NP as A,UF as C,eF as D,rF as E,fw as M,Hf as N,nF as O,Of as P,tI as S,$P as T,tH as _,Dq as a,gI as b,RK as c,AK as d,EK as f,dU as g,gG as h,a0 as i,MP as j,qP as k,PK as l,_G as m,Q6 as n,rq as o,xG as p,Z6 as r,lq as s,b8 as t,NK as u,GV as v,JP as w,_I as x,vI as y};
|