@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.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/server/src/cli/main.mjs +8291 -7641
  4. package/web/dist/assets/_-CSJHpFdT.js +1 -0
  5. package/web/dist/assets/_layerId-DODyO-4v.js +1 -0
  6. package/web/dist/assets/_paired-BQ0y29Xb.js +1 -0
  7. package/web/dist/assets/_paired-Bse7nsmg.js +1 -0
  8. package/web/dist/assets/_paired-CmZDjtRz.js +1 -0
  9. package/web/dist/assets/_paired-CrNFab02.js +1 -0
  10. package/web/dist/assets/_reviewId-CBVBAvNp.js +1 -0
  11. package/web/dist/assets/{_revision-1wivYK0j.js → _revision-BMXAJq_Z.js} +1 -1
  12. package/web/dist/assets/{_section-BQ20AKhJ.js → _section-DdvA8EEA.js} +1 -1
  13. package/web/dist/assets/_worktreeId-B27bXYEK.js +1 -0
  14. package/web/dist/assets/_worktreeId-Bse7nsmg.js +1 -0
  15. package/web/dist/assets/_worktreeId-C8Q6GcvL.js +1 -0
  16. package/web/dist/assets/_worktreeId-CmZDjtRz.js +1 -0
  17. package/web/dist/assets/access-E2mYEqnl.js +19 -0
  18. package/web/dist/assets/connected-workspace-8ch85vkt.js +1 -0
  19. package/web/dist/assets/desktop-actions-BPv0J8RL.js +1 -0
  20. package/web/dist/assets/{edit-file-rWLFkawP.js → edit-file-Bcu9LCmp.js} +20 -20
  21. package/web/dist/assets/{file-editor-CmaAI7mD.js → file-editor-B_jE48tv.js} +11 -11
  22. package/web/dist/assets/index-BHlOFndd.js +10 -0
  23. package/web/dist/assets/index-Bg-CecA5.css +2 -0
  24. package/web/dist/assets/{lazyRouteComponent-DF1peoaD.js → lazyRouteComponent-C0NLdQ95.js} +1 -1
  25. package/web/dist/assets/pair-Bse7nsmg.js +1 -0
  26. package/web/dist/assets/pair-CbpILDh2.js +1 -0
  27. package/web/dist/assets/review-route-CZyVDwAY.js +1 -0
  28. package/web/dist/assets/reviews-DCiXZMLG.js +1404 -0
  29. package/web/dist/assets/useMatch-CPSFM0JI.js +1 -0
  30. package/web/dist/assets/useRouterState-DtsAJKLm.js +1 -0
  31. package/web/dist/assets/workspace-error-DIuDMViV.js +1 -0
  32. package/web/dist/assets/{workspace-pending-DnmDeSe-.js → workspace-pending-DgQgV-cu.js} +1 -1
  33. package/web/dist/index.html +8 -8
  34. package/web/dist/assets/_-mTAQQLxa.js +0 -1
  35. package/web/dist/assets/_layerId-D-Ld4zoA.js +0 -1
  36. package/web/dist/assets/_paired-DQq2L_lM.js +0 -1
  37. package/web/dist/assets/_paired-DwQfzpPo.js +0 -1
  38. package/web/dist/assets/_paired-P-FUnX-y.js +0 -1
  39. package/web/dist/assets/_paired-VrOGlA1G.js +0 -1
  40. package/web/dist/assets/_reviewId-CR5Y2cjT.js +0 -1
  41. package/web/dist/assets/_worktreeId-BPp_s24t.js +0 -1
  42. package/web/dist/assets/_worktreeId-DQq2L_lM.js +0 -1
  43. package/web/dist/assets/_worktreeId-Dfp8EiPX.js +0 -1
  44. package/web/dist/assets/_worktreeId-P-FUnX-y.js +0 -1
  45. package/web/dist/assets/access-CPhumIOz.js +0 -19
  46. package/web/dist/assets/connected-workspace-Cqk_MV5h.js +0 -1
  47. package/web/dist/assets/desktop-actions-DEpOe60L.js +0 -1
  48. package/web/dist/assets/index-DbOyN2aI.js +0 -10
  49. package/web/dist/assets/index-Dz_rBtGK.css +0 -2
  50. package/web/dist/assets/pair-CwRRIQuD.js +0 -1
  51. package/web/dist/assets/pair-DQq2L_lM.js +0 -1
  52. package/web/dist/assets/review-route-CilLpBvt.js +0 -1
  53. package/web/dist/assets/reviews-Knu80SJM.js +0 -1396
  54. package/web/dist/assets/useMatch-CmjLPEeI.js +0 -1
  55. package/web/dist/assets/useRouterState-CFV0Nv_N.js +0 -1
  56. package/web/dist/assets/workspace-error-B0KK7kzA.js +0 -1
@@ -0,0 +1,1404 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/file-editor-B_jE48tv.js","assets/rolldown-runtime-hePW80VL.js","assets/access-E2mYEqnl.js","assets/edit-file-Bcu9LCmp.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,$i as r,$n as i,$o as a,$r as o,$s as s,$t as c,A as l,Aa as u,Al as d,An as f,Ar as p,At as m,Au as h,B as g,Ba as _,Bi as v,Bn as y,Bo as b,Bt as x,Bu as S,C,Ca as w,Ci as T,Cl as E,Co as D,Cr as O,Cs as k,Ct as A,Cu as j,D as M,Da as N,Di as P,Dn as F,Dr as I,Ds as L,Dt as R,Du as z,E as B,Ea as V,Ei as H,El as U,En as W,Er as G,Et as K,Eu as ee,Fi as te,Fl as q,Fn as ne,Fr as re,Fs as ie,Ft as ae,Fu as oe,G as se,Ga as ce,Gi as le,Gl as ue,Gn as de,Go as fe,Gr as pe,Gs as J,Gu as me,H as he,Ha as ge,Hi as _e,Hl as ve,Hn as ye,Ho as be,Hs as xe,Ht as Se,Hu as Ce,I as we,Ia as Te,Ii as Ee,Il as De,In as Oe,Io as ke,Ir as Ae,Is as je,It as Me,Iu as Ne,J as Pe,Ja as Fe,Ji as Ie,Jl as Le,Jn as Re,Jt as ze,Ju as Be,K as Ve,Ka as He,Ki as Ue,Kn as We,Ko as Ge,Kr as Ke,Ks as qe,Kt as Je,Ku as Ye,L as Xe,La as Ze,Li as Qe,Ll as $e,Ln as et,Lo as tt,Ls as nt,Lt as rt,Lu as it,M as at,Ma as ot,Mi as st,Mn as ct,Mo as lt,Mr as ut,Ms as dt,Mt as ft,Mu as pt,N as mt,Nn as ht,Ns as gt,Nt as _t,Nu as vt,O as yt,Oa as bt,Oi as xt,Ol as St,Oo as Ct,Os as wt,Ot as Tt,P as Et,Pi as Dt,Pl as Ot,Pn as kt,Po as At,Pr as jt,Pt as Mt,Pu as Nt,Q as Pt,Qa as Ft,Qi as It,Ql as Lt,Qn as Rt,Qo as zt,Qr as Bt,Qs as Vt,R as Ht,Ra as Ut,Ri as Wt,Rl as Gt,Rn as Kt,Rr as qt,Rt as Jt,Ru as Yt,S as Xt,Sa as Zt,Sc as Qt,Si as $t,Sl as en,So as tn,Sr as nn,St as rn,Su as an,T as on,Tc as sn,Ti as cn,Tl as ln,Tn as un,To as dn,Ts as fn,Tt as pn,Tu as mn,U as hn,Ua as gn,Ui as _n,Ul as vn,Un as yn,Uo as bn,Us as xn,Ut as Sn,Uu as Cn,V as wn,Va as Tn,Vi as En,Vl as Dn,Vn as On,Vo as kn,Vr as An,Vs as jn,Vt as Mn,Vu as Nn,W as Pn,Wi as Fn,Wl as In,Wn as Ln,Wo as Rn,Wr as zn,Wt as Bn,Wu as Vn,X as Hn,Xa as Un,Xl as Wn,Xn as Gn,Xo as Kn,Xr as qn,Xu as Jn,Y as Yn,Ya as Xn,Yi as Zn,Yl as Qn,Yn as $n,Yo as er,Yr as tr,Ys as nr,Yt as rr,Yu as ir,Z as ar,Za as or,Zl as sr,Zn as cr,Zo as lr,Zr as ur,Zs as dr,Zt as fr,_ as pr,_a as mr,_i as hr,_l as gr,_n as _r,_r as vr,_s as yr,_t as br,_u as xr,a as Sr,aa as Cr,ac as wr,ai as Tr,al as Er,ao as Dr,ar as Or,as as kr,at as Ar,au as jr,b as Mr,ba as Nr,bc as Pr,br as Fr,bs as Ir,bt as Lr,c as Rr,ca as zr,cc as Br,ci as Vr,cl as Hr,cn as Ur,co as Wr,cs as Gr,ct as Kr,d as qr,da as Jr,dc as Yr,di as Xr,dl as Zr,do as Qr,dr as $r,ds as ei,dt as ti,du as ni,ea as ri,ec as ii,ei as ai,eo as oi,er as si,es as ci,et as li,eu as ui,f as di,fa as fi,fi as pi,fl as mi,fn as hi,fr as gi,ft as _i,fu as vi,g as yi,ga as bi,gc as xi,gi as Si,gl as Ci,gn as wi,go as Ti,gr as Ei,gs as Di,gt as Oi,gu as ki,h as Ai,ha as ji,hi as Mi,hl as Ni,ho as Pi,hr as Fi,hs as Ii,ht as Li,hu as Ri,i as zi,ia as Bi,ic as Vi,ii as Hi,in as Ui,io as Wi,ir as Gi,is as Ki,it as qi,j as Ji,ja as Yi,ji as Xi,jl as Zi,jn as Qi,js as $i,jt as ea,ju as ta,k as na,ka as ra,kl as ia,kn as aa,ko as oa,ks as sa,kt as ca,ku as la,l as ua,la as da,lc as fa,li as pa,ll as ma,lo as ha,lr as ga,ls as _a,lt as va,lu as ya,m as ba,ma as xa,mc as Sa,mi as Ca,mo as wa,mr as Ta,ms as Ea,mt as Da,mu as Oa,n as ka,na as Aa,ni as ja,nl as Ma,no as Na,nr as Pa,ns as Fa,nt as Ia,nu as La,o as Ra,oa as za,oc as Ba,oi as Va,ol as Ha,on as Ua,oo as Wa,or as Ga,os as Y,ot as Ka,ou as qa,p as Ja,pa as Ya,pc as Xa,pi as Za,pl as Qa,pn as $a,po as eo,pr as to,ps as no,pt as ro,q as io,ql as ao,qn as oo,qo as so,qs as co,qt as lo,qu as uo,r as fo,ra as po,rc as mo,ri as ho,rl as go,rn as _o,ro as vo,rr as yo,rs as X,rt as bo,ru as xo,s as So,sa as Co,sc as wo,si as To,sl as Eo,sn as Do,so as Oo,ss as ko,st as Ao,t as jo,ta as Mo,ti as No,to as Po,tr as Fo,ts as Io,tt as Lo,tu as Ro,u as zo,ua as Bo,ui as Vo,ul as Ho,us as Uo,ut as Wo,uu as Go,v as Ko,va as qo,vr as Jo,vs as Yo,vt as Xo,vu as Zo,w as Qo,wa as $o,wi as es,wl as ts,wn as ns,wt as rs,wu as is,x as as,xa as os,xc as ss,xi as cs,xr as ls,xs as us,xt as ds,xu as fs,y as ps,ya as ms,yc as hs,yi as gs,yn as _s,yr as vs,ys,yt as bs,za as xs,zi as Ss,zl as Cs,zn as ws,zo as Ts,zt as Es}from"./access-E2mYEqnl.js";import{n as Ds}from"./useMatch-CPSFM0JI.js";import{$ as Os,$n as ks,$t as As,A as js,An as Ms,Ar as Ns,At as Ps,Bn as Fs,Br as Is,C as Ls,Cr as Rs,Ct as zs,D as Bs,Dr as Vs,Dt as Hs,E as Us,Er as Ws,Et as Gs,F as Ks,Fn as qs,Fr as Js,Ft as Ys,G as Xs,Gn as Zs,Gr as Qs,Gt as $s,H as ec,Hn as tc,Hr as nc,Ht as rc,I as ic,In as ac,Ir as oc,It as sc,J as cc,Jn as lc,Jr as uc,K as dc,Kn as fc,Kr as pc,Kt as mc,Ln as hc,Lr as gc,Lt as _c,M as vc,Mn as yc,Mr as bc,Mt as xc,N as Sc,Nn as Cc,Nr as wc,Nt as Tc,O as Ec,Or as Dc,Ot as Oc,P as kc,Pn as Ac,Pr as jc,Pt as Mc,Q as Nc,Qn as Pc,Qt as Fc,R as Ic,Rn as Lc,Rt as Rc,S as zc,Sr as Bc,St as Vc,T as Hc,Tr as Uc,Tt as Wc,U as Gc,Un as Kc,Ur as qc,Ut as Jc,Vn as Yc,Vr as Xc,Vt as Zc,W as Qc,Wn as $c,Wr as el,Wt as tl,X as nl,Xn as rl,Xt as il,Y as al,Yn as ol,Yt as sl,Z as cl,Zn as ll,Zr as ul,Zt as dl,_ as fl,_r as pl,_t as ml,a as hl,an as gl,ar as _l,at as vl,b as yl,br as bl,bt as xl,c as Sl,cn as Cl,cr as wl,ct as Tl,d as El,dn as Dl,dr as Ol,dt as kl,en as Al,er as jl,et as Ml,f as Nl,fn as Pl,fr as Fl,ft as Il,g as Ll,gn as Rl,gr as zl,gt as Bl,h as Vl,hn as Hl,hr as Ul,ht as Wl,in as Gl,ir as Kl,it as ql,j as Jl,jn as Yl,jr as Xl,jt as Zl,k as Ql,kn as $l,kr as eu,kt as tu,l as nu,ln as ru,lr as iu,lt as au,m as ou,mn as su,mr as cu,mt as lu,n as uu,nn as du,nr as fu,nt as pu,o as mu,on as hu,or as gu,ot as _u,p as vu,pn as yu,pr as bu,pt as xu,q as Su,qn as Cu,qr as wu,qt as Tu,r as Eu,rn as Du,rr as Ou,rt as ku,sn as Au,sr as ju,st as Mu,tn as Nu,tr as Pu,tt as Fu,u as Iu,un as Lu,ur as Ru,ut as zu,v as Bu,vr as Vu,w as Hu,wr as Uu,wt as Wu,x as Gu,xr as Ku,xt as qu,y as Ju,yr as Yu,zn as Xu,zr as Zu,zt as Qu}from"./edit-file-Bcu9LCmp.js";import{a as $u,c as ed,d as td,i as nd,l as rd,m as id,n as ad,o as od,r as sd,s as cd,t as ld,u as ud,v as dd}from"./hastToHtml-DaAciyEx.js";import{r as fd}from"./constants-CmGPilXJ.js";import{t as pd}from"./preload-helper-Czpn1I53.js";import{t as md}from"./resolveLanguages-D3x2m7LM.js";function hd(e){let t=Qt();return Pr(t.stores.location,Ds(e,t))}function gd(){let e=Qt();return Pr(e.stores.location,e=>e.state.__TSR_index!==0)}var Z=e(Ma(),1),_d=ss();function vd(e,t){return e===t}function yd(e,t=e=>e,n){let r=n?.compare??vd,i=(0,Z.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,Z.useCallback)(()=>e.get(),[e]);return(0,_d.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Q=sn(),bd=e(Sa(),1),xd=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(s(99,this.componentName,e,this.componentName));t.setOpen(!0,no(Ii,void 0,n))}closePopup(){let e=this.attachedStore;e!==null&&e.setOpen(!1,no(Ii))}},Sd={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`}]]};Sd.node;var Cd=Fa(Sd),wd={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`}]]};wd.node;var Td=Fa(wd),Ed={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};Ed.node;var Dd=Fa(Ed),Od={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};Od.node;var kd=Fa(Od),Ad={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Ad.node;var jd=Fa(Ad),Md={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Md.node;var Nd=Fa(Md),Pd={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`}]]};Pd.node;var Fd=Fa(Pd),Id={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`}]]};Id.node;var Ld=Fa(Id),Rd={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Rd.node;var zd=Fa(Rd),Bd={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`}]]};Bd.node;var Vd=Fa(Bd),Hd={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`}]]};Hd.node;var Ud=Fa(Hd),Wd={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`]};Wd.node;var Gd=Fa(Wd),Kd={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`}]]};Kd.node;var qd=Fa(Kd),Jd={name:`circle-dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};Jd.node;var Yd=Fa(Jd),Xd={name:`circle-minus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]],aliases:[`minus-circle`]};Xd.node;var Zd=Fa(Xd),Qd={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`]};Qd.node;var $d=Fa(Qd),ef={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`]};ef.node;var tf=Fa(ef),nf={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`}]]};nf.node;var rf=Fa(nf),af={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`]};af.node;var of=Fa(af),sf={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`}]]};sf.node;var cf=Fa(sf),lf={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`]};lf.node;var uf=Fa(lf),df={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`}]]};df.node;var ff=Fa(df),pf={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`}]]};pf.node;var mf=Fa(pf),hf={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`}]]};hf.node;var gf=Fa(hf),_f={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`}]]};_f.node;var vf=Fa(_f),yf={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`}]]};yf.node;var bf=Fa(yf),xf={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`}]]};xf.node;var Sf=Fa(xf),Cf={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`]};Cf.node;var wf=Fa(Cf),Tf={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`}]]};Tf.node;var Ef=Fa(Tf),Df={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`}]]};Df.node;var Of=Fa(Df),kf={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`}]]};kf.node;var Af=Fa(kf),jf={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`}]]};jf.node;var Mf=Fa(jf),Nf={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`}]]};Nf.node;var Pf=Fa(Nf),Ff={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`}]]};Ff.node;var If=Fa(Ff),Lf={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`}]]};Lf.node;var Rf=Fa(Lf),zf={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`}]]};zf.node;var Bf=Fa(zf),Vf={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`}]]};Vf.node;var Hf=Fa(Vf),Uf={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`]};Uf.node;var Wf=Fa(Uf),Gf={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`}]]};Gf.node;var Kf=Fa(Gf),qf={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`}]]};qf.node;var Jf=Fa(qf),Yf={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`}]]};Yf.node;var Xf=Fa(Yf),Zf={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`}]]};Zf.node;var Qf=Fa(Zf),$f={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`}]]};$f.node;var ep=Fa($f),tp={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`}]]};tp.node;var np=Fa(tp),rp={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`}]]};rp.node;var ip=Fa(rp),ap={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`}]]};ap.node;var op=Fa(ap),sp={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};sp.node;var cp=Fa(sp),lp={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`}]]};lp.node;var up=Fa(lp),dp={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`}]]};dp.node;var fp=Fa(dp),pp={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`}]]};pp.node;var mp=Fa(pp),hp={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`}]]};hp.node;var gp=Fa(hp),_p={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`}]]};_p.node;var vp=Fa(_p),yp={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`}]]};yp.node;var bp=Fa(yp),xp={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`}]]};xp.node;var Sp=Fa(xp),Cp={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Cp.node;var wp=Fa(Cp),Tp={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};Tp.node;var Ep=Fa(Tp),Dp={name:`reply`,size:24,node:[[`path`,{d:`M20 18v-2a4 4 0 0 0-4-4H4`,key:`5vmcpk`}],[`path`,{d:`m9 17-5-5 5-5`,key:`nvlc11`}]]};Dp.node;var Op=Fa(Dp),kp={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};kp.node;var Ap=Fa(kp),jp={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};jp.node;var Mp=Fa(jp),Np={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`}]]};Np.node;var Pp=Fa(Np),Fp={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`}]]};Fp.node;var Ip=Fa(Fp),Lp={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`}]]};Lp.node;var Rp=Fa(Lp),zp={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`]};zp.node;var Bp=Fa(zp),Vp={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`]};Vp.node;var Hp=Fa(Vp),Up={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};Up.node;var Wp=Fa(Up),Gp={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`}]]};Gp.node;var Kp=Fa(Gp),qp={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`]};qp.node;var Jp=Fa(qp),Yp={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`}]]};Yp.node;var Xp=Fa(Yp),Zp={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`}]]};Zp.node;var Qp=Fa(Zp),$p={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`]};$p.node;var em=Fa($p),tm={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`}]]};tm.node;var nm=Fa(tm),rm=new Set([`spec`,`specs`,`__tests__`,`tests`]);function im(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=>rm.has(e))}function am(e,t){if(!t)return e;let n=[],r=[];for(let t of e)im(t.path)?r.push(t):n.push(t);return[...n,...r]}function om(e){return`decision:${e}`}function sm(e){return`${fi(e,`decision shapes`,`decisions shape`)} this change`}function cm(e,t,{specsApart:n}){let r=new Set(t),i=e=>n&&im(e),a=new Map,o=e.layers.map((e,t)=>{let n=om(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 lm(e,t){return e.find(e=>e.key===t)??e[0]??{kind:`briefing`,key:`briefing`,paths:[]}}function um(e,t,n){let r=e.findIndex(e=>e.key===t);return r===-1?void 0:e[r+n]}function dm(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 fm(e){switch(e.kind){case`briefing`:return`Briefing`;case`decision`:return e.layer.title;case`unexplained`:return`Not explained`;case`specs`:return`Specs`}}function pm(e){return e.kind===`decision`?`${e.number}. ${fm(e)}`:fm(e)}function mm(e,t,n){return e.kind===`briefing`?!1:e.kind===`decision`?n.get(e.layer.id)?.reviewed===!0:dm(e.paths,t).done}function hm(e){return e.codeMoved===!0}function gm(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 _m(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 vm(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 ym(e){let t=vm(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 bm(e,t){let n=e.diagram?.after;if(!n)return[];let r=vm(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 xm(e,t){let n=[...ym(e).questions.filter(e=>e.decision===t.number),...bm(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 Sm(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:To(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 Cm(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 wm(e,t){return new Map(e.content.layers.map(e=>[e.id,{stale:hm(e),reviewed:xa(t?.decisions,e)}]))}function Tm(e,t,n){let r=Cm(e,t),i=wm(e,t);return{reviewed:cm(e.content,e.files.map(e=>e.path),n).filter(e=>e.kind===`decision`&&mm(e,r,i)).length,total:e.content.layers.length}}var $=Xa(),Em=Z.createContext({disabled:!1});function Dm(){return Z.useContext(Em)}var Om=Vt(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:c,payload:l,handle:u,...d}=e,f=at(!0),p=Gr(u)??f;if(!p)throw Error(s(79));let m=b(c),h=p.useState(`floatingRootContext`),g=p.useState(`isOpenedByTrigger`,m),_=p.useState(`triggerPopupId`,m),v=Z.useRef(null),{registerTrigger:y,isMountedByThisTrigger:x}=_a(m,v,p,{payload:l}),{getButtonProps:S,buttonRef:C}=Yo({disabled:a,native:o}),w=ei(h),T=A(()=>p.select(`open`),e=>{p.set(`openMethod`,e)}),E={disabled:a,open:g},D=p.useState(`triggerProps`,x);return L(`button`,e,{state:E,ref:[C,t,y,v],props:[w.reference,D,T,{[k]:``,id:m,"aria-haspopup":`dialog`,"aria-expanded":g,"aria-controls":_},d,S],stateAttributesMapping:je})}),km=class extends xd{constructor(){super(B(),`Dialog`,!1)}open(e){this.openByTrigger(e)}openWithPayload(e){let t=this.attachedStore;t!==null&&(t.set(`payload`,e),t.setOpen(!0,no(Ii)))}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function Am(){return new km}var jm=`<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>`,Mm=`<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>`,Nm=`<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>`,Pm=`<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>`,Fm=`<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>`,Im=`<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>`,Lm=`<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>`,Rm=`<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>`,zm=`<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>`,Bm=`<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>`,Vm=`<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>`,Hm=`<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>`,Um=`<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>`,Wm=`<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>`,Gm=`<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>`,Km=`<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>`,qm=`<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>`,Jm=`<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>`,Ym=`<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>`,Xm=`<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>`,Zm=`<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>`,Qm=`<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>`,$m=`<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>`,eh=`<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>`,th=`<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>`,nh=`<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>`,rh=`<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>`,ih=`<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>`,ah=`<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>`,oh=`<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>`,sh=`<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>`,ch=`<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>`,lh=`<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>`,uh=`<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>`,dh=`<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>`,fh=`<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>`,ph=`<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>`,mh=`<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>`,hh=`<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>`,gh=`<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>`,_h=`<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>`,vh=`<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>`,yh=`<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>`,bh=`<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>`,xh=`<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>`,Sh=`<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>`,Ch=`<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>`,wh=`<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>`,Th=`<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>`,Eh=`<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>`,Dh=`<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>`,Oh=`<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>`,kh=`<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>`,Ah=[Pm,zm,Vm,Hm,Um,Wm,qm,Jm,Ym,Zm,Qm,$m,eh,th,nh,ch,uh,dh,_h,vh,xh,Sh,`<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>`],jh=[Mm,Nm,Fm,Im,Lm,Rm,Bm,Gm,Km,Xm,rh,ih,ah,oh,sh,lh,fh,ph,mh,hh,gh,yh,bh,Ch,wh,Th,Eh,Dh,Oh,kh];function Mh(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
169
+ `)}\n</svg>`)}var Nh=Mh(jm,Ah),Ph={minimal:jm,standard:Nh,complete:Mh(Nh,jh)},Fh={".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`},Ih={"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`},Lh={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},Rh=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`]),zh=new Set([`complete`]);function Bh(e){return Ph[e===`none`?`minimal`:e]}function Vh(e){return`file-tree-builtin-${e}`}function Hh(e){return e!==`none`&&zh.has(e)}function Uh(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=Fh[t.toLowerCase()];if(i!=null&&(r||Rh.has(i)))return i;for(let e of n){if(r){let t=Lh[e];if(t!=null)return t}let t=Ih[e];if(t!=null&&(r||Rh.has(t)))return t}return`default`}var Wh=`file-tree-container`,Gh=`data-file-tree-style`,Kh=`data-file-tree-unsafe-css`,qh=`data-file-tree-scrollbar-measure`,Jh=`data-file-tree-scrollbar-gutter-measured`,Yh=`--trees-scrollbar-gutter-measured`,Xh=`header`,Zh=`context-menu`,Qh=`context-menu-trigger`;function $h(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function eg(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??($h(e)?`none`:`complete`),colored:e.colored??!0}}var tg=e=>e.trim().toLowerCase(),ng=e=>e.split(`/`).at(-1)??e,rg=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 ig(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function ag(e){let t=eg(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(tg(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=ng(o),c=s.toLowerCase(),l=r.get(c);if(l!=null)return ig(l,e);for(let[t,n]of a)if(c.includes(t))return ig(n,e);let u=rg(s);for(let t of u){let n=i.get(t);if(n!=null)return ig(n,e)}let d=Uh(t.set,s,u);if(d!=null&&t.set!==`none`){if(d==="default"){let t=n?.[e];if(t!=null)return ig(t,e)}return{name:Vh(d),remappedFrom:e,token:d}}}let s=n?.[e];return s==null?{name:e}:ig(s,e)}}}var og=5,sg=32,cg=128;function lg(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function ug(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function dg(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 fg(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 pg(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function mg(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 hg(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,yg(e,t)}function gg(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=fg(e).get(t);if(i===void 0)return;let a=i>>og;e.childVisibleChunkSums[a]+=r}function _g(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=bg(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=sg}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 vg(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>og;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<og}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 yg(e,t){if(t.childIds.length<cg){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/sg),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>>og]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function bg(e,t,n,r){let i=Math.min(t.childIds.length,n+sg),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 xg=7,Sg=3,Cg=8,wg=4;function Tg(e,t,n=0){return e<<wg|n<<Sg|t}function Eg(e){return e.depthAndFlags>>>wg}function Dg(e){return(e.depthAndFlags&Cg)>>Sg}function Og(e){return(e.depthAndFlags&Cg)!==0}function kg(e){return e.depthAndFlags&xg}function Ag(e,t){return(kg(e)&t)!==0}function jg(e,t){e.depthAndFlags|=t}function Mg(e,t){e.depthAndFlags=Tg(t,kg(e),Dg(e))}var Ng=Symbol(`benchmarkInstrumentation`);function Pg(e,t){return t==null||Object.defineProperty(e,Ng,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Fg(e){return e==null?null:e[Ng]??null}function Ig(e,t,n){return e==null?n():e.measurePhase(t,n)}function Lg(e,t,n){Number.isFinite(n)&&e!=null&&e.setCounter(t,n)}function Rg(e){return e>=48&&e<=57}function zg(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Rg(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&&Rg(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 Bg(e){let t=e.toLowerCase();return{lowerValue:t,tokens:zg(t)}}function Vg(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 Hg(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=Vg(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Ug(e,t,n){let r=Hg(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Wg(e,t){return Ug(e,t,Bg)}function Gg(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Kg(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=Gg(e,r);return a===Gg(t,r)?Wg(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 qg(e,t){return Kg(e,t)}function Jg(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Bg(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=Gg(e,n);return o===Gg(t,n)?Ug(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 Yg(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Bg(r);return e.sortKeyById[t]=i,i}function Xg(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Zg(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 Qg(e){let{hasTrailingSlash:t,segments:n}=Zg(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function $g(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Zg(e);return{requiresDirectory:t,segments:n}}function e_(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[Bg(``)]}}function t_(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 n_(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var r_=Symbol(`pathStorePreparedInputKind`);function i_(e,t){return e[r_]=t,e}function a_(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function o_(e,t,n){return n==="default"?qg(e,t):n(a_(e),a_(t))}function s_(){return{depthAndFlags:Tg(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function c_(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 l_(e){return e.isDirectory?e.segments.length:e.segments.length-1}function u_(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 d_(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function f_(e,t={}){return v_(e,t).map(e=>e.path)}function p_(e,t={}){let n=v_(e,t);return i_({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function m_(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 i_({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function h_(e){let t=e,n=t.preparedPaths;if(t[r_]===`prepared`&&n!=null)return n;if(!u_(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function g_(e){let t=e;return t[r_]===`presorted`&&t.presortedPaths!=null||d_(t.presortedPaths)?t.presortedPaths:null}function __(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function v_(e,t={}){let n=Xg(t),r=Fg(t);Lg(r,`workload.inputFiles`,e.length);let i=Ig(r,`store.preparePathEntries.parse`,()=>e.map(e=>Qg(e)));return Ig(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>o_(e,t,n.sort))),i}var y_=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[s_()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=e_();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Fg(e),this.options=Xg(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,lg())}appendPaths(e){return Ig(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>Qg(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Ig(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Ig(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:Tg(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:Tg(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:Tg(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=Qg(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:Tg(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:Tg(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=Qg(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Ig(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Ig(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"?Jg(this.lastPreparedPath,e,this.segmentSortKeyCache):o_(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=l_(e),i=n==null?0:l_(n),a=n==null?0:c_(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=t_(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:Tg(Eg(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),pg(i,s),s}createFileChildUnchecked(e,t){let n=t_(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:Tg(Eg(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),pg(r,a),a}getOrCreateDirectoryChild(e,t){let n=t_(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&&!Og(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:Tg(Eg(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),pg(r,a),this.directories.set(a,lg()),a}createDirectoryChild(e,t){let n=t_(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:Tg(Eg(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),pg(r,a),this.directories.set(a,lg()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Og(n))throw Error(`Path is not a directory: "${t}"`);if(Ag(n,1))throw Error(`Duplicate path: "${t}"`);jg(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,ug());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(Og(a)){let t=ug();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;Og(n)&&this.directories.set(t,lg());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),pg(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Og(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 hg(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function b_(e,t=`closed`,n=null){let r=S_(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 x_(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function S_(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 C_(e,t){return Ag(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&Eg(t)<=e.defaultExpansion}function w_(e,t,n=e.snapshot.nodes[t]){return n==null||!Og(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:C_(e,n)}function T_(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Og(r))return;let i=C_(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 E_(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 D_(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function O_(e,t){let n=E_(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 k_(e,t){let n=E_(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function A_(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 j_(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function M_(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 N_(e,t){e.directoryLoadInfoById.delete(t)}function P_(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 F_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function I_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function L_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function R_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function z_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function B_(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function V_(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 H_(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 U_(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 W_(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 G_(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 K_(e,t,n){return{...n,visibleCountDelta:rv(e)-t}}function q_(e,t){let n=rv(e),r=x_();e.transactionStack.push(r);try{t()}catch(t){throw X_(e,r,!1),t}X_(e,r,!0,rv(e)-n)}function J_(e,t){let n=e.instrumentation;if(n==null){Y_(e,t);return}Ig(n,`store.events.record`,()=>Y_(e,t))}function Y_(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){tv(e,t);return}n.events.push(t),ev(n,t)}function X_(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?$_(i,t):Ig(n,`store.events.batch.merge`,()=>$_(i,t));return}let a=Z_(t,r),o=e.instrumentation;if(o==null){tv(e,a);return}Ig(o,`store.events.batch.commit`,()=>tv(e,a))}function Z_(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 Q_(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function $_(e,t){for(let n of t.events)e.events.push(n);Q_(e,t)}function ev(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function tv(e,t){let n=e.instrumentation;if(n==null){nv(e,t);return}Ig(n,`store.events.emit`,()=>nv(e,t))}function nv(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function rv(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function iv(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Og(n)||Ag(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||!Og(a)?null:i}function av(e,t){let n=t;for(;;){let t=iv(e,n);if(t==null)return n;n=t}}function ov(e,t){let n=[t],r=t;for(;;){let t=iv(e,r);if(t==null)return n;n.push(t),r=t}}function sv(e,t){let n=t==null?e.snapshot.rootId:_v(e,t);return n==null?[]:xv(e,n)}function cv(e,t){let n=Qg(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Iv(e,Fv(e,r)),{createdNodeIds:a,directoryId:o}=Sv(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=bv(e,o);if(Ag(n,1))throw Error(`Path already exists: "${t}"`);jg(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=wv(e,o,n.basename),s.add(c);mv(e,o);let l=Iv(e,o);return F_({affectedAncestorIds:gv(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Lv(i,l)})}function lv(e,t,n){let r=_v(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=bv(e,r);if(Ag(i,2))throw Error(`The root node cannot be removed`);if(Og(i)&&yv(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Iv(e,a),s=Nv(e,r);Dv(e,a,r,i.nameId),Pv(e,a),mv(e,a);let c=Iv(e,a);return I_({affectedAncestorIds:gv(e,a),affectedNodeIds:s,path:t,projectionChanged:Lv(o,c),recursive:n.recursive===!0})}function uv(e,t,n,r){let i=_v(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=bv(e,i);if(Ag(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=jv(e,i,n),c=Iv(e,a.parentId),l=Iv(e,s.parentId),u=n_(e.snapshot.segmentTable,a.nameId),d=t_(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(Og(a)&&Vv(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=dg(e.snapshot.nodes,yv(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Mv(e,p,o,Dg(a))===`skip`)return null;let m=a.parentId;Dv(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Bv(e,i),Ev(e,s.parentId,i),Pv(e,m),e.pathCacheVersion++,mv(e,m),s.parentId!==m&&mv(e,s.parentId);let h=Iv(e,m),g=Iv(e,s.parentId);return L_({affectedAncestorIds:[...new Set([...gv(e,m),...gv(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Rv([c,l],[h,g]),to:pv(e,i)})}function dv(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function fv(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function pv(e,t){let n=bv(e,t),r=dv(e,t);if(r!=null)return r;if(Ag(n,2))return fv(e,t,``);let i=pv(e,n.parentId),a=n_(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return fv(e,t,Og(n)?`${o}/`:o)}function mv(e,t){let n=e.instrumentation;if(n==null){Uv(e,t);return}Ig(n,`store.recomputeCountsUpwardFrom`,()=>Uv(e,t))}function hv(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||!Og(o)){Hv(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Hv(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function gv(e,t){let n=[],r=t;for(;r!=null;){let t=bv(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function _v(e,t){if(t.length===0)return e.snapshot.rootId;let n=$g(t);return vv(e,n.segments,n.requiresDirectory)}function vv(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=yv(e,r),a=dg(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=bv(e,r);return n&&!Og(i)?null:r}function yv(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 bv(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Ag(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function xv(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Ag(n,4))return[];if(!Og(n))return[pv(e,t)];if(yv(e,t).childIds.length===0)return Ag(n,1)&&!Ag(n,2)?[pv(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||Ag(n,4)){i.pop();continue}if(!Og(n)){r.push(pv(e,t.nodeId)),i.pop();continue}let a=yv(e,t.nodeId);if(a.childIds.length===0){Ag(n,1)&&!Ag(n,2)&&r.push(pv(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 Sv(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=t_(e.snapshot.segmentTable,i),a=yv(e,r),o=dg(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!Og(bv(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=Cv(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function Cv(e,t,n){let r=bv(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Tg(Eg(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,lg()),Ev(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function wv(e,t,n){let r=t_(e.snapshot.segmentTable,n),i=yv(e,t);if(dg(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Gv(e,t,n)}"`);let a=bv(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Tg(Eg(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Ev(e,t,o),e.activeNodeCount++,o}function Tv(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}Ov(e,n,o)<0?i=a:r=a+1}return r}function Ev(e,t,n){let r=yv(e,t),i=bv(e,n);dg(e.snapshot.nodes,r).set(i.nameId,n),gg(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=Tv(e,r,n);r.childIds.splice(a,0,n),mg(r,a),yg(e.snapshot.nodes,r)}function Dv(e,t,n,r){let i=yv(e,t),a=fg(i),o=a.get(n)??-1;dg(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&gg(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),mg(i,o),yg(e.snapshot.nodes,i))}function Ov(e,t,n){let r=e.snapshot.options.sort;return r==="default"?kv(e,t,n):r(Av(e,t),Av(e,n))}function kv(e,t,n){let r=bv(e,t),i=bv(e,n),a=Og(r);if(a!==Og(i))return a?-1:1;let o=Hg(Yg(e.snapshot.segmentTable,r.nameId),Yg(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=n_(e.snapshot.segmentTable,r.nameId),c=n_(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function Av(e,t){let n=bv(e,t),r=pv(e,t),i=Og(n),a=i?r.slice(0,-1):r;return{basename:n_(e.snapshot.segmentTable,n.nameId),depth:Eg(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function jv(e,t,n){let r=bv(e,t),i=_v(e,n);if(i!=null){let t=bv(e,i);if(Og(t))return{basename:n_(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=$g(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=$g(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:vv(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Mv(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${pv(e,t)}"`);let i=bv(e,t);if(Dg(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(Og(i)&&yv(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Nv(e,t),Dv(e,a,t,o),Pv(e,a),mv(e,a),`handled`}function Nv(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=bv(e,t.nodeId);if(t.visitedChildren||!Og(i)){Og(i)&&e.snapshot.directories.delete(t.nodeId),jg(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),N_(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=yv(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 Pv(e,t){let n=t;for(;n!=null;){let t=bv(e,n);if(!Og(t)||Ag(t,2)||yv(e,n).childIds.length>0)return;jg(t,1),n=t.parentId===n?null:t.parentId}}function Fv(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=dg(e.snapshot.nodes,yv(e,n)).get(t);if(i==null||!Og(bv(e,i)))break;n=i}return n}function Iv(e,t){let n=zv(e,t);if(n==null)return null;let r=av(e,n),i=bv(e,r),a=n===r?null:ov(e,n).map(t=>pv(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:yv(e,r).childIds.length>0,path:pv(e,r),terminalKind:Dg(i)})}function Lv(e,t){return Rv([e],[t])}function Rv(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 zv(e,t){let n=t;for(;n!=null;){let t=bv(e,n);if(!Og(t)||Ag(t,2))return null;if(!w_(e,n,t))return n;n=t.parentId}return null}function Bv(e,t){let n=bv(e,t);if(Mg(n,(t===e.snapshot.rootId?-1:Eg(bv(e,n.parentId)))+1),!Og(n))return;let r=yv(e,t);for(let t of r.childIds)Bv(e,t)}function Vv(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=bv(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Hv(e,t,n=bv(e,t),r=!1){let i=e.instrumentation;if(i==null){Wv(e,t,n,r);return}Ig(i,`store.recomputeNodeCounts`,()=>Wv(e,t,n,r))}function Uv(e,t){let n=t;for(;n!=null;){let t=bv(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Hv(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&gg(yv(e,s),n,a,o),n=s}}function Wv(e,t,n,r){if(!Og(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=yv(e,t);if(r){let t=e.instrumentation;t==null?hg(e.snapshot.nodes,i):Ig(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>hg(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Ag(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=iv(e,t)==null?w_(e,t,n)?1+o:1:o}function Gv(e,t,n){let r=pv(e,t);return r.length===0?n:`${r}${n}`}function Kv(e){return e!=null&&!Ag(e,4)}function qv(e,t){let n=e.snapshot.nodes[t];return!Kv(n)||!Og(n)||Ag(n,2)?null:n}function Jv(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Kv(e.snapshot.nodes[n])&&(t+=1);return t}function Yv(e){return Math.max(0,e.valueById.length-1)}function Xv(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Jv(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Yv(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Zv(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 Qv(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)qv(e,n)!=null&&t.push(pv(e,n));for(let t of e.expandedDirectoryIds)qv(e,t)!=null&&n.push(pv(e,t));return{collapsedPaths:t,expandedPaths:n}}function $v(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)qv(e,n)!=null&&D_(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:pv(e,n)});return t}function ey(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=_v(e,n);t!=null&&T_(e,t,!0,bv(e,t))}for(let n of t.collapsedPaths){let t=_v(e,n);t!=null&&T_(e,t,!1,bv(e,t))}}function ty(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=_v(e,n.path);t!=null&&qv(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function ny(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function ry(e){let t=e.snapshot.segmentTable,n=e_();for(let r of e.snapshot.nodes)if(Kv(r)){if(Ag(r,2)){r.nameId=0;continue}r.nameId=t_(n,n_(t,r.nameId))}e.snapshot.segmentTable=n}function iy(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Kv(r)||!Og(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Kv(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[bv(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),hg(e.snapshot.nodes,n)}}function ay(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Kv(n))break;--t}e.snapshot.nodes.length=t+1}function oy(e){let t=Qv(e),n=$v(e);Ig(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>ny(e)),Ig(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>ry(e)),Ig(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>iy(e)),Ig(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>ay(e)),Ig(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>ey(e,t)),Ig(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>ty(e,n)),Ig(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>hv(e,e.snapshot.rootId))}function sy(e){let t=Qv(e),n=$v(e),r=Ig(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>sv(e)),i=Pg({...e.snapshot.options},e.instrumentation),a=Ig(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new y_(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,Ig(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>ey(e,t)),Ig(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>ty(e,n)),Ig(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>hv(e,e.snapshot.rootId))}function cy(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function ly(e,t){let n=Xv(e);t===`stable`?Ig(e.instrumentation,`store.cleanup.stable`,()=>oy(e)):Ig(e.instrumentation,`store.cleanup.aggressive`,()=>sy(e));let r=Xv(e);return Zv(t,t===`stable`,n,r)}var uy=64;function dy(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 fy(e){return bv(e,e.snapshot.rootId).visibleSubtreeCount}function py(e,t,n,r){let i=bv(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function my(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Ny(e,t.cursor),setSize:t.setSize,subtreeEndIndex:py(e,t.cursor,t.index,n)}}function hy(e,t,n,r,i,a){let o=yv(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=_g(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return gy(e,u,l,r+c,i+1,s,o.childIds.length,a)}function gy(e,t,n,r,i,a,o,s){if(!Og(bv(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=Dy(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=bv(e,c.terminalNodeId);if(!Og(l)||!w_(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return hy(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function _y(e,t){let n=fy(e);if(t<0||t>=n)return null;let r=hy(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>pv(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=my(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Ny(e,r.cursor),setSize:r.setSize,subtreeEndIndex:py(e,r.cursor,r.index,n)}}function vy(e,t,n){let r=e.instrumentation,i=fy(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 My(e,o+1);let t=[],n=wy(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Ny(e,n);t.push(r),n=ky(e,n)}return t}let s=[],c=0,l=0,u=Ig(r,`store.getVisibleSlice.selectFirstRow`,()=>wy(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Ig(r,`store.getVisibleSlice.materializeRow`,()=>Ny(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Ig(r,`store.getVisibleSlice.advanceCursor`,()=>ky(e,u))}return Lg(r,`workload.visibleRowsRead`,s.length),Lg(r,`workload.flattenedRowsRead`,c),Lg(r,`workload.flattenedSegmentsRead`,l),s}function yy(e,t=fy(e)){let n=e.instrumentation;return n==null?jy(e,t):Ig(n,`store.getVisibleTreeProjection`,()=>jy(e,t))}function by(e){return Ay(yy(e))}function xy(e,t){let n=_v(e,t);if(n==null||n===e.snapshot.rootId||Og(bv(e,n))&&av(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=bv(e,i).parentId,n=yv(e,t),s=fg(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=vg(a,n,s),t!==o){let n=bv(e,t),a=iv(e,t);if(!w_(e,t,n)&&a!==i)return null;av(e,t)===t&&(r+=1)}i=t}return r}function Sy(e,t){let n=_v(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=bv(e,n);if(!Og(r))throw Error(`Path is not a directory: "${t}"`);return w_(e,n,r)?null:(T_(e,n,!0,r),mv(e,n),R_({affectedAncestorIds:gv(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function Cy(e,t){let n=_v(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=bv(e,n);if(!Og(r))throw Error(`Path is not a directory: "${t}"`);return w_(e,n,r)?(T_(e,n,!1,r),mv(e,n),z_({affectedAncestorIds:gv(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function wy(e,t){return t<0||t>=fy(e)?null:Ty(e,e.snapshot.rootId,t,-1)}function Ty(e,t,n,r){let i=yv(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?_g(e.snapshot.nodes,i,n):Ig(a,`store.getVisibleSlice.selectChildIndex`,()=>_g(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Ey(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Ey(e,t,n,r){if(!Og(bv(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=Dy(e,t,r);if(n===0)return i;let a=bv(e,i.terminalNodeId);if(!Og(a)||!w_(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Ty(e,i.terminalNodeId,n-1,i.visibleDepth)}function Dy(e,t,n){return Og(bv(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:av(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Ig(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>av(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Oy(e,t){let n=bv(e,t);if(!Og(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||iv(e,r)!==t}function ky(e,t){let n=bv(e,t.terminalNodeId);if(Og(n)){let r=yv(e,t.terminalNodeId);if(w_(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Ey(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=bv(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=yv(e,n),o=fg(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 Ey(e,s,0,i);Oy(e,r)&&i--,r=n}}function Ay(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 jy(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(uy);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=dy(o,y);let x,S=_;if(Og(v))S=f?av(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:pv(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&&Og(C)&&w_(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 My(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(!Og(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:pv(e,f)};continue}let h=l?av(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Ny(e,g);let _=i[h];_!=null&&Og(_)&&w_(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Ny(e,t){let n=bv(e,t.terminalNodeId),r=Og(n)?Py(e,t):null,i=pv(e,t.terminalNodeId),a=n_(e.snapshot.segmentTable,n.nameId),o=Og(n)&&yv(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?ov(e,t.headNodeId).map(n=>{let r=bv(e,n);return{isTerminal:n===t.terminalNodeId,name:n_(e.snapshot.segmentTable,r.nameId),nodeId:n,path:pv(e,n)}}):Ig(c,`store.getVisibleSlice.flatten.collectSegments`,()=>ov(e,t.headNodeId).map(n=>{let r=bv(e,n);return{isTerminal:n===t.terminalNodeId,name:n_(e.snapshot.segmentTable,r.nameId),nodeId:n,path:pv(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:Og(n)&&w_(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:Og(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Py(e,t){if(t.headNodeId===t.terminalNodeId)return D_(e,t.terminalNodeId);let n=ov(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=D_(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var Fy=8;function Iy(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 Ly(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]&Fy)===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]]&Fy)===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 Ry(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||!Og(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&&yg(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&Og(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,yg(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function zy(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=Iy(e.snapshot);Ly(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)&&yg(n,i)}}function By(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Vy=class e{#e;constructor(e={}){let t=Fg(e),n=Ig(t,`store.builder.create`,()=>new y_(e));if(e.preparedInput!=null){let t=g_(e.preparedInput);t==null?n.appendPreparedPaths(h_(e.preparedInput),!1):n.appendPresortedPaths(t,__(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Ig(t,`store.preparePathEntries`,()=>v_(r,e)))}let r=Ig(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Ig(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Ig(t,`store.state.create`,()=>b_(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Ig(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||By(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Ig(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?Ig(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>zy(this.#e)):Ig(t,`store.state.initializeOpenVisibleCounts`,()=>Ry(this.#e)):Ig(t,`store.state.recomputeCounts`,()=>hv(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return f_(e,t)}static prepareInput(e,t={}){return p_(e,t)}static preparePresortedInput(e){return m_(e)}list(e){return Ig(this.#e.instrumentation,`store.list`,()=>sv(this.#e,e))}add(e){Ig(this.#e.instrumentation,`store.add`,()=>{let t=fy(this.#e);J_(this.#e,K_(this.#e,t,cv(this.#e,e)))})}remove(e,t={}){Ig(this.#e.instrumentation,`store.remove`,()=>{let n=fy(this.#e);J_(this.#e,K_(this.#e,n,lv(this.#e,e,t)))})}move(e,t,n={}){Ig(this.#e.instrumentation,`store.move`,()=>{let r=fy(this.#e),i=uv(this.#e,e,t,n);i!=null&&J_(this.#e,K_(this.#e,r,i))})}batch(e){q_(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 Ig(this.#e.instrumentation,`store.getVisibleCount`,()=>fy(this.#e))}getVisibleSlice(e,t){return Ig(this.#e.instrumentation,`store.getVisibleSlice`,()=>vy(this.#e,e,t))}getVisibleRowContext(e){return Ig(this.#e.instrumentation,`store.getVisibleRowContext`,()=>_y(this.#e,e))}getVisibleTreeProjection(){return by(this.#e)}getVisibleTreeProjectionData(e){return yy(this.#e,e)}getVisibleIndex(e){return Ig(this.#e.instrumentation,`store.getVisibleIndex`,()=>xy(this.#e,e))}getPathInfo(e){return Ig(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=_v(this.#e,e);if(t==null)return null;let n=bv(this.#e,t);return{depth:Eg(n),kind:Og(n)?`directory`:`file`,path:pv(this.#e,t)}})}isExpanded(e){return Ig(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=bv(this.#e,t);return w_(this.#e,t,n)})}expand(e){Ig(this.#e.instrumentation,`store.expand`,()=>{let t=fy(this.#e),n=Sy(this.#e,e);n!=null&&J_(this.#e,K_(this.#e,t,n))})}collapse(e){Ig(this.#e.instrumentation,`store.collapse`,()=>{let t=fy(this.#e),n=Cy(this.#e,e);n!=null&&J_(this.#e,K_(this.#e,t,n))})}on(e,t){return P_(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return D_(this.#e,t)}markDirectoryUnloaded(e){Ig(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(yv(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=fy(this.#e);k_(this.#e,t),J_(this.#e,K_(this.#e,n,B_({affectedAncestorIds:gv(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Ig(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=fy(this.#e),r=O_(this.#e,t);return J_(this.#e,K_(this.#e,n,V_({affectedAncestorIds:gv(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Ig(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||D_(this.#e,n)!==`loading`||!j_(this.#e,n,e.attemptId))return!1;let r=pv(this.#e,n);this.validateChildPatch(r,t);let i=fy(this.#e),a=[];for(let e of t.operations){Hy(r,e);let t=fy(this.#e);switch(e.type){case`add`:a.push(K_(this.#e,t,cv(this.#e,e.path)));break;case`remove`:a.push(K_(this.#e,t,lv(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=uv(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(K_(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return J_(this.#e,K_(this.#e,i,H_({affectedAncestorIds:gv(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:pv(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Ig(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=fy(this.#e),r=A_(this.#e,t,e.attemptId);return J_(this.#e,K_(this.#e,n,U_({affectedAncestorIds:gv(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:pv(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Ig(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=fy(this.#e),i=M_(this.#e,n,e.attemptId,t);return J_(this.#e,K_(this.#e,r,W_({affectedAncestorIds:gv(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:pv(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Ig(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(cy(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=fy(this.#e),n=ly(this.#e,e.mode??`stable`);return J_(this.#e,K_(this.#e,t,G_({...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=yv(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Bg(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=Hg(Yg(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(!Og(bv(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=bv(this.#e,n);w_(this.#e,n,i)||(T_(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=bv(this.#e,e);if(!w_(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=_v(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!Og(bv(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!Og(bv(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=bv(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=bv(this.#e,e),r=iv(this.#e,e);if(!w_(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 Hy(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 Uy={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Wy(e,t){if(typeof e==`number`)return{itemHeight:t??Uy.default.itemHeight,factor:e};let n=Uy[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Gy=Uy.default.itemHeight,Ky=`@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
+ `,qy=`@layer base, unsafe;`;function Jy(e){return`${qy}
1262
+ @layer base {
1263
+ ${e}
1264
+ }`}function Yy(e){return`${qy}
1265
+ @layer unsafe {
1266
+ ${e}
1267
+ }`}var Xy=new WeakMap;function Zy(e){let t=Xy.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(qh,`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(),Xy.set(e,i),i}function Qy(e,t){if(!e.isConnected)return;let n=Zy(t);if(n==null)return;let r=t.querySelector(`style[${Jh}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(Jh,``),t.appendChild(i)),i.textContent=`:host { ${Yh}: ${n}px; }`}var $y;function eb(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){$y??($y=new CSSStyleSheet,$y.replaceSync(Jy(Ky)));let t=!1;try{e.adoptedStyleSheets=[$y],t=!0}catch{}if(t){e.querySelector(`style[${Gh}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(Gh,``),t.textContent=Jy(Ky),e.prepend(t)}}function tb(e,t){nb(e,t),eb(t),Qy(e,t)}function nb(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`});tb(this,e)}}if(customElements.define(Wh,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(Wh)))e instanceof HTMLElement&&tb(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var rb=e=>e.startsWith(`f::`)?e.slice(3):e;function ib(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function ab(e,t){return e===``?t:`${e}/${t}`}function ob({files:e,path:t,isFolder:n,nextBasename:r}){let i=rb(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}=ib(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=ab(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 sb(e){return e.endsWith(`/`)}function cb(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 lb(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 ub(e,t){return t.includes(e)?lb(t):[e]}function db(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 fb(e,t){return{draggedPaths:e,target:t}}function pb(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(sb(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function mb(e,t){return t.kind===`root`||t.directoryPath==null?cb(e):t.directoryPath}function hb(e,t){let n=e.map(e=>{let n=mb(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 gb(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 _b(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(!gb(Vy.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 vb(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function yb(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 bb(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function xb(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 bb(e,t.path)?n?e:null:e;case`move`:return yb(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=xb(r,e,n),r==null)return null;return r}}}function Sb(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Cb(e){switch(e.operation){case`add`:return{...Sb(e),operation:`add`,path:e.path};case`remove`:return{...Sb(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Sb(e),from:e.from,operation:`move`,to:e.to}}}function wb(e){return{...Sb(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Cb(e)),operation:`batch`}}function Tb(e){switch(e.operation){case`add`:case`remove`:case`move`:return Cb(e);case`batch`:return wb(e);default:return null}}function Eb(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Db(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 Ob(e){return Db(e).at(-1)??null}function kb(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function Ab(e){return e.endsWith(`/`)}var jb=e=>e.toLowerCase();function Mb(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function Nb(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Pb(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Fb=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Ib=Symbol(`FILE_TREE_RENAME_VIEW`),Lb=512,Rb=512;function zb(e){return e===`top`||e===`center`?e:`nearest`}function Bb(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Db(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 Vb(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:Bb(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Hb=class e{static{Object.defineProperty(e.prototype,Ib,{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=_b({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=Ob(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:zb(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<=Rb){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=ub(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=fb(t.draggedPaths,n);(pb(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}db(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=fb(e.draggedPaths,t);if(pb(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=hb(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=Ab(r),a=Nb(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Db(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=Mb(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,Ab(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,Ab(e)?{recursive:!0}:void 0);return}let t=Ab(e),n=ob({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:Nb(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(Pb(n.sourcePath,t),Pb(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=_b({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=!Eb(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=Ob(e),n=kb(e,t),r=null,i=null;for(let e of this.#be()){if(Ob(e)!==t)continue;let a=kb(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=Db(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=!Eb(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 Vy({...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 Db(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(jb),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(jb),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 Db(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:Fb(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 Db(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 Db(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=Vb(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Lb)),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=xb(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=xb(this.#c,e,!0),r=[...this.#B].map(t=>xb(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=xb(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return Eb(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&&vb(e)&&(this.#i=null);let t=vb(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=Tb(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},Ub=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 Wb(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 Gb(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 Kb(e,t){return t?`${e}/`:e}function qb(e,t=null){let n=Ub(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=Yb(t);e!=null&&Qb({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 Jb(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=Xb(e);t!=null&&(c=Zb({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=Yb(e);t!=null&&(c=Qb({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:tx(i),statusByPath:i}:e}function Yb(e){return Xb(e.path)}function Xb(e){let t=Wb(e);if(t!=null)return{canonicalPath:Kb(t.path,t.isDirectory),isDirectory:t.isDirectory}}function Zb({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),ex(t,n,e),!0)}function Qb({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??$b(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function $b(e,t,n){for(let r of Gb(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function ex(e,t,n){for(let r of Gb(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function tx(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var nx,rx,ix,ax,ox,sx,cx,lx,ux,dx,fx={},px=[],mx=Array.isArray,hx=px.slice,gx=Object.assign;function _x(e){e&&e.parentNode&&e.remove()}function vx(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?hx.call(arguments,2):n),yx(e,o,r,i,null)}function yx(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??++rx,__i:-1,__u:0};return i==null&&nx.vnode!=null&&nx.vnode(a),a}function bx(e){return e.children}function xx(e,t){this.props=e,this.context=t,this.__g=0}function Sx(e,t){if(t==null)return e.__?Sx(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`?Sx(e):null}function Cx(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 Cx(e)}}function wx(e){(8&e.__g||!(e.__g|=8)||!ix.push(e)||ox++)&&ax==nx.debounceRendering||((ax=nx.debounceRendering)||queueMicrotask)(Tx)}function Tx(){for(var e,t,n,r,i,a,o,s,c=1;ix.length;)ix.length>c&&ix.sort(sx),e=ix.shift(),c=ix.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=gx({},r)).__v=r.__v+1,nx.vnode&&nx.vnode(n),Nx(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??Sx(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Fx(a,n,o),n.__e!=i&&Cx(n)));ox=0}function Ex(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||px,b=t.length;for(c=Dx(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?fx:y[m.__i]||fx,m.__i=f,_=Nx(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Rx(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=Ox(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function Dx(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?yx(null,o,null,null,null):mx(o)?yx(bx,{children:o},null,null,null):o.constructor==null&&o.__b>0?yx(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=kx(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=Sx(s)),zx(s,s));return r}function Ox(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=Ox(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Sx(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function kx(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 Ax(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function jx(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||Ax(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Ax(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(cx,`$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=lx,e.addEventListener(t,a?dx:ux,a)):e.removeEventListener(t,a?dx:ux,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 Mx(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=lx++;else if(t.u<n.l)return;return n(nx.event?nx.event(t):t)}}}function Nx(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=nx.__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 xx(v,x),f.constructor=M,f.render=Bx),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=gx({},f.__s)),gx(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=nx.__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=gx({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===bx&&d.key==null&&(E=Ix(d.props.children)),s=Ex(e,mx(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--;)_x(a[j]);Px(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||Px(t);nx.__e(e,t,n)}else s=t.__e=Lx(n.__e,t,n,r,i,a,o,c,l,u);return(d=nx.diffed)&&d(t),128&t.__u?void 0:s}function Px(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(Px)}function Fx(e,t,n){for(var r=0;r<n.length;r++)Rx(n[r],n[++r],n[++r]);nx.__c&&nx.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){nx.__e(e,t.__v)}})}function Ix(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:mx(e)?e.map(Ix):gx({},e)}function Lx(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&&=(nx.__m&&nx.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=hx.call(e.childNodes),v=n.props||fx,!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;jx(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&&!_||jx(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=``),Ex(b==`template`?e.content:e,mx(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&Sx(n,0),s,c,l),a!=null)for(u=a.length;u--;)_x(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||jx(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&jx(e,u,g,v[u],i))}return e}function Rx(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){nx.__e(e,n)}}function zx(e,t,n){var r,i;if(nx.unmount&&nx.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Rx(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){nx.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&zx(r[i],t,n||typeof e.type!=`function`);n||_x(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Bx(e,t,n){return this.constructor(e,n)}function Vx(e,t){var n,r,i,a;t==document&&(t=document.documentElement),nx.__&&nx.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=vx(bx,null,[e]),i=[],a=[],Nx(t,e,r||fx,fx,t.namespaceURI,r?null:t.firstChild?hx.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),Fx(i,e,a)}function Hx(e,t){e.__u|=32,Vx(e,t)}nx={__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 ox=0,e}},rx=0,xx.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=gx({},this.state);typeof e==`function`&&(e=e(gx({},n),this.props)),e&&gx(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),wx(this))},xx.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),wx(this))},xx.prototype.render=bx,ix=[],ox=0,sx=function(e,t){return e.__v.__b-t.__v.__b},cx=/(PointerCapture)$|Capture$/i,lx=0,ux=Mx(!1),dx=Mx(!0);var Ux=0;Array.isArray;function Wx(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:--Ux,__i:-1,__u:0,__source:i,__self:a};return nx.vnode&&nx.vnode(l),l}var Gx=16,Kx=16,qx={};function Jx({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}=qx[e]??{width:Gx,height:Kx},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Wx(`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:Wx(`use`,{href:c})})}var Yx=e=>e!==void 0&&/\s/.test(e),Xx=(e,t)=>{let n=t=>Yx(e[t-1])||Yx(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},Zx=e=>Xx(e,Math.ceil(e.length/2)),Qx=e=>{if(e.length<2)return[e,``];let t=Zx(e);return[e.slice(0,t),e.slice(t)]},$x=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Zx(e);return[e.slice(0,r),e.slice(r)]},eS=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)]},tS=(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)]},nS=(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)]},rS=(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 iS({children:e,marker:t,variant:n=`default`}){"use no memo";return Wx(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Wx(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Wx(`span`,{"data-truncate-fade":!0}):t})})}function aS(e){"use no memo";let{mode:t,children:n}=e;return Wx(`div`,{children:[Wx(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Wx(`span`,{children:n}):n}),Wx(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Wx(`span`,{children:n}):n})]})}function oS({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Wx(aS,{mode:t,children:e},`content`),o=Wx(iS,{marker:n,mode:t,variant:r},`marker`),s=Wx(`div`,{"data-truncate-fill":!0},`fill`);return Wx(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Wx(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function sS({children:e,...t}){"use no memo";return Wx(oS,{mode:`truncate`,...t,children:e})}function cS({children:e,...t}){"use no memo";return Wx(oS,{mode:`fruncate`,...t,children:e})}function lS({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=Wx(sS,{...s,children:t[0]}),l=Wx(cS,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Wx(`div`,{className:a,style:o});if(e.length<i)return Wx(n===`end`?cS:sS,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Qx:r===`extension`?t=$x:r===`leaf-path`&&(t=eS);else if(typeof r==`number`)t=tS,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=nS:e===`first`&&(t=rS)}else typeof r==`function`&&(t=r);t??=Qx;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=Wx(sS,{...s,..._,children:f}),l=Wx(cS,{...s,...v,children:p})}return Wx(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Wx(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Wx(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var uS={endIndex:-1,startIndex:-1};function dS(e,t,n){return Math.min(Math.max(e,t),n)}function fS(e,t){return e<0||t<e?uS:{endIndex:t,startIndex:e}}function pS(e){return e.startIndex<0||e.endIndex<e.startIndex}function mS(e,t){return pS(e)?0:(e.endIndex-e.startIndex+1)*t}function hS(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function gS(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function _S(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 vS(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 yS(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 bS(e,t,n){if(e.length===0||t<=0)return[];let r=yS(e),i=_S(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=vS(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 xS(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=dS(t.scrollTop,0,o),c=t.stickyRows??bS(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=hS(s,n,t.itemHeight),m=hS(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?uS:fS(m,gS(u+d,n,t.itemHeight)),y=g+1,b=pS(v)?uS:fS(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=mS(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:pS(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var SS={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},CS={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},wS=`Contains git status items`;function TS(e){return e.current?!0:(e.current=!0,!1)}function ES(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 DS(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return ES({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 OS(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 kS(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 AS(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 jS(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function MS(e,t){return e!=null&&e>0?e:t}function NS(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 PS(e,t,n,r,i=0){let a=ES({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function FS(e,t,n,r,i,a,o=0){let s=DS({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function IS(e,t,n,r,i,a){let o=OS({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function LS(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function RS(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function zS({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Wx(`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 BS(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 VS(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 HS,US,WS,GS,KS=Object.is,qS=0,JS=[],YS=nx,XS=YS.__b,ZS=YS.__r,QS=YS.diffed,$S=YS.__c,eC=YS.unmount,tC=YS.__;function nC(e,t){YS.__h&&YS.__h(US,e,qS||t),qS=0;var n=US.__H||(US.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function rC(e){return qS=1,iC(gC,e)}function iC(e,t,n){var r=nC(HS++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):gC(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);KS(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=US,!US.__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,KS(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};US.__f=!0;var a=US.shouldComponentUpdate,o=US.componentWillUpdate;US.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)},US.shouldComponentUpdate=i}return r.__N||r.__}function aC(e,t){var n=nC(HS++,3);!YS.__s&&hC(n.__H,t)&&(n.__=e,n.u=t,US.__H.__h.push(n))}function oC(e,t){var n=nC(HS++,4);!YS.__s&&hC(n.__H,t)&&(n.__=e,n.u=t,US.__h.push(n))}function sC(e){return qS=5,cC(function(){return{current:e}},[])}function cC(e,t){var n=nC(HS++,7);return hC(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function lC(e,t){return qS=8,cC(function(){return e},t)}function uC(){for(var e;e=JS.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(pC),e.__H.__h.forEach(mC),e.__H.__h=[]}catch(t){e.__H.__h=[],YS.__e(t,e.__v)}}YS.__b=function(e){US=null,XS&&XS(e)},YS.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),tC&&tC(e,t)},YS.__r=function(e){ZS&&ZS(e),HS=0;var t=(US=e.__c).__H;t&&(WS===US?(t.__h=[],US.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(pC),t.__h.forEach(mC),t.__h=[],HS=0)),WS=US},YS.diffed=function(e){QS&&QS(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(JS.push(t)!==1&&GS===YS.requestAnimationFrame||((GS=YS.requestAnimationFrame)||fC)(uC)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),WS=US=null},YS.__c=function(e,t){t.some(function(e){try{e.__h.forEach(pC),e.__h=e.__h.filter(function(e){return!e.__||mC(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],YS.__e(n,e.__v)}}),$S&&$S(e,t)},YS.unmount=function(e){eC&&eC(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{pC(e)}catch(e){t=e}}),n.__H=void 0,t&&YS.__e(t,n.__v))};var dC=typeof requestAnimationFrame==`function`;function fC(e){var t,n=function(){clearTimeout(r),dC&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);dC&&(t=requestAnimationFrame(n))}function pC(e){var t=US,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),US=t}function mC(e){var t=US;e.__c=e.__(),US=t}function hC(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!KS(t,e[n])})}function gC(e,t){return typeof t==`function`?t(e):t}function _C(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Wx(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Wx(bx,{children:[Wx(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Wx(sS,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function vC(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function yC(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function bC(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 xC({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=xS(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:bC(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?bC(u,1,t,o):i&&r<=0&&c.length>0?bS(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 SC=400,CC=40,wC=18;function TC(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))?EC(e,t,n):a instanceof HTMLElement?a:null}function EC(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 DC(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 OC(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 kC(){return navigator.vendor!==`Apple Computer, Inc.`}function AC(e,t){let n=e-t.top;if(n<CC)return-Math.ceil((CC-Math.max(0,n))/CC*wC);let r=t.bottom-e;return r<CC?Math.ceil((CC-Math.max(0,r))/CC*wC):0}function jC(e,t){if(e!=null){let t=SS[e];return t==null?null:{text:t,title:CS[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:wS}:null}function MC(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 NC(e){return e!=null&&`toggle`in e}function PC(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function FC(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function IC(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function LC(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function RC(e,t){return t&&LC(e)||(e.ctrlKey||e.metaKey)&&PC(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var zC=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function BC(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 VC(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 HC(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function UC(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function WC(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function GC(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 KC(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 qC(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 JC(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=qC(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 YC(e,t){return{kind:e.kind,name:yC(e),path:t}}function XC(e){return e==null?void 0:`${e}__tree`}function ZC(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function QC(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function $C(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Wx(`span`,{title:e.title,children:e.text}):Wx(`span`,{title:e.title,children:e.parts.map((e,t)=>Wx(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?QC(e.icon)?t(e.icon):{name:e.icon}:QC(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Wx(`span`,{title:e.title,children:Wx(Jx,{...n})})}function ew(e){e!=null&&kS(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function tw(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=vC(e);return Wx(bx,{children:[e.depth>0?Wx(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Wx(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Wx(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Wx(Jx,{...t(`file-tree-icon-chevron`)}):Wx(Jx,{...t(`file-tree-icon-file`,u)})}),Wx(`div`,{"data-item-section":`content`,children:e.isFlattened?_C(e,c,a):c??Wx(lS,{minimumLength:5,split:`extension`,children:e.name})}),i?Wx(`div`,{"data-item-section":`decoration`,children:r==null?null:$C(r,t)}):null,s?Wx(`div`,{"data-item-section":`git`,children:$C(o,t)}):null,n?Wx(`div`,{"data-item-section":`action`,children:l?Wx(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Wx(Jx,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function nw(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=vC(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??MC(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=jC(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,ee=K?a.getValue():``,te=R||!K?null:Wx(zS,{ref:D,ariaLabel:`Rename ${yC(t)}`,isFlattened:t.isFlattened,value:ee,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),q=tw(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:te,showDecorativeActionAffordance:G}),ne={...BS({ariaLabel:yC(t),domId:t.isFocused?ZC(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:HC(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?Wx(`div`,{...ne,children:q}):Wx(`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:q})}function rw(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(vC(e))).map((n,r)=>nw(e,n,t.start+r))}function iw({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Gy,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 _=sC(null),v=sC(null),y=sC(!1),b=sC(null),x=sC(null),S=sC(null),C=sC(null),w=sC(null),T=sC(new Map),E=sC(new Map),D=sC(()=>{}),O=sC(null),k=sC(0),A=sC(!1),j=sC(null);j.current!==t&&(A.current=!1,j.current=t);let M=sC(!1),N=sC(null),P=sC(null),F=sC(!1),I=sC(null),L=sC(null),R=sC(null),z=sC(null),B=sC(null),V=sC(null),H=sC(null),U=sC(null),W=sC(!1),G=sC(null),K=sC(null),ee=sC(null),te=sC(null),q=cC(()=>new Map,[]),[,ne]=rC(0),re=sC(!1),[ie,ae]=rC(null),[oe,se]=rC(null),[ce,le]=rC(null),[ue,de]=rC(null),[fe,pe]=rC(0),[J,me]=rC(null),he=sC(J);he.current=J;let ge=sC(null),_e=sC(null),ve=sC(null),ye=sC(null),be=sC(null),xe=sC(!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=sC(d===`retain`&&t.isSearchOpen()),[Ee,De]=rC(p);aC(()=>{p||De(!1)},[p]);let Oe=sC(!1),ke=lC(()=>{Oe.current=!0,De(e=>e&&!1)},[]),[Ae,je]=rC(()=>xC({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Me,Ne]=rC(!1);aC(()=>{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`;oC(()=>{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=lC((e,t)=>{WC(T.current,e,t)},[]),Be=lC((e,t)=>{WC(E.current,e,t)},[]),Ve=lC(e=>{x.current=e},[]),He=lC(e=>GC(e,E.current,T.current),[]),Ue=n!=null||r!=null||i!=null,{resolveIcon:We}=cC(()=>ag(a),[a]),Ge=t[Ib](),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=cC(()=>et==null?null:new Set(et.draggedPaths),[et]),nt=et?.target??null,rt=et?.primaryPath??null,it=XC(o),{overlayHeight:at,overlayRows:ot,snapshot:st,visibleRows:ct}=Ae,lt=st.physical.viewportHeight,ut=cC(()=>({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=cC(()=>new Set(ft.map(e=>vC(e.row))),[ft]),gt=Ze>=0&&Ze>=ut.start&&Ze<=ut.end,_t=lC((e,t)=>u?.({item:YC(e,t),row:e})??null,[u]),vt=lC(e=>kS(e==null?null:T.current.get(e)??null)?!0:kS(S.current),[]),yt=lC(e=>{vt(t.focusNearestPath(e))},[t,vt]),bt=sC(yt);bt.current=yt;let xt=sC(!0),St=sC(()=>{}),Ct=lC((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=lC(e=>{let t=e==null?null:UC(S.current,e);le(e=>e===t?e:t)},[]),Tt=lC((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:YC(e,n),path:n,source:r?.source??`keyboard`})},[t,He,wt]),Et=lC(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=jS(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=lC((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=jS(i,lt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:xC({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,IS(i,a,s,l,u,d),D.current(),ge.current=n?e:null,!0},[t,s,c,lt,h]),Ot=()=>y.current===!0||te.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,te.current!=null&&(clearTimeout(te.current),te.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=DC(TC(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=NC(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=AC(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),kC())){let t=OC(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(te.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;te.current!=null&&(clearTimeout(te.current),te.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,te.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=OC(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)},SC)},Ut=e=>{if(J!=null){if(e.key===`Escape`){Ct(),e.preventDefault(),e.stopPropagation();return}zC.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=jS(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&&FC(e)){t.openSearch(e.key),ne(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Pe&&LC(e),r=RC(e,Pe),i=r&&S.current!=null?AS(S.current):null,a=r?new Set(KC(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=NC(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=GC(u,E.current,T.current);e==null||n==null?y=!1:Tt(e,u)}else if((e.ctrlKey||e.metaKey)&&PC(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,JC(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()};oC(()=>{if(f&&Je){if(Te.current){Te.current=!1;return}kS(w.current)}},[Je,f]),oC(()=>{let e=x.current;switch(RS({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,kS(e),e.select());return}},[ut.end,ut.start,Ke,Dt,ht]),oC(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=AS(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,AS(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)}},[]),oC(()=>{let e=S.current;e!=null&&(st.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[st.physical.scrollTop]),oC(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=jS(n,g);let a=()=>{let e=t.getVisibleCount(),r=MS(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),je(xC({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=MS(O.current,g),i=t.getVisibleRows(e,e)[0]??null;PS(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(()=>{TS(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:NS(e[0]))??jS(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]),oC(()=>{Pe||J==null||Ct(!1)},[Ct,Pe,J]);let Wt=cC(()=>J==null?null:`${J.path}::${J.source}`,[J]);oC(()=>{if(Wt==null){m?.clearSlotContent(Zh);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??VC(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(Zh,i),e?.contextMenu?.onOpen?.(t.item,r),ew(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&ew(i)}),()=>{m?.clearSlotContent(Zh)}},[Wt,e?.contextMenu,m]),oC(()=>{J!=null&&t.getItem(J.path)==null&&Ct()},[Ct,J,t]),oC(()=>{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&&(BC(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]),oC(()=>{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=AS(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=FS(e,n,s,lt,pt,Qe.offset,t)}t.clearScrollRequest(Qe.id)}let A=!E&&l&&IS(e,Ze,s,lt,pt,u),j=!E&&d!=null&&d===Xe&&IS(e,Ze,s,lt,pt,mt),P=!E&&m!=null&&m.path===Xe&&IS(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&&PS(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&&(IS(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)&&(kS(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=>vC(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`;oC(()=>{y.current&&J==null||wt(He(Xt))},[J,He,ut,lt,fe,dt,Xt,wt,ct]);let Qt=lC(e=>{if(y.current||BC(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=lC(()=>{se(null)},[]);oC(()=>{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=DC(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:LS(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:LS(pn.index,s,ut,rn),hn=IC((Ze>=0?ct[Ze]??t.getVisibleRows(Ze,Ze)[0]??null:null)?.ancestorPaths.at(-1)??null),gn=Je&&Xe!=null?ZC(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=lC((e,n,r,i)=>{let a=VS({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:q,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 Wx(`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:[Wx(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:hn}}),Wx(`slot`,{name:Xh,"data-type":`header-slot`}),f?Wx(`div`,{"data-file-tree-search-container":!0,"data-open":Je?`true`:`false`,children:Wx(`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,Wx(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Me&&dt.length>0?Wx(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Wx(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${at}px`},children:dt.map((e,t)=>nw(kn,e.row,`sticky:${vC(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${dt.length-t}`}}))})}):null,Wx(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${pt}px`},children:[Wx(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${an}px`}}),Wx(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${rn}px`,top:`${on}px`,bottom:`${sn}px`},children:[rw(On,ut,ht),ln!=null&&un!=null?nw(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?nw(On,pn,`parked-drag:${pn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${mn}px`}}):null]})]})]}),Pe?Wx(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":xn?`true`:`false`,style:wn,children:[Wx(`button`,{ref:v,type:`button`,"data-type":Qh,"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:Wx(Jx,{...We(`file-tree-icon-ellipsis`)})}),J==null?null:Wx(`slot`,{name:Zh})]}):null,J==null?null:Wx(`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 aw={hydrateRoot:(e,t)=>{Hx(vx(iw,t),e)},renderRoot:(e,t)=>{Vx(vx(iw,t),e)},unmountRoot:e=>{Vx(null,e)}};function ow(e,t){aw.renderRoot(e,t)}function sw(e,t){aw.hydrateRoot(e,t)}function cw(e){aw.unmountRoot(e)}var lw=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 uw=0;function dw(e){return e!=null&&e.length>0?e:(uw+=1,`pst_ft_${uw}`)}function fw({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Gy)}function pw(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 mw(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 hw(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var gw=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new lw;#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=dw(a),this.#p=qb(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=Wy(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new Hb({...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&&(cw(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=Jb(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&ow(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(),ow(t.wrapper,this.#w()))}setGitStatus(e){let t=qb(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&ow(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),ow(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),sw(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),ow(r,this.#w())}#C(){return{initialViewportHeight:fw({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(Xh,e());return}this.#l.setSlotHtml(Xh,this.#e?.header?.html??null)}#k(e){let t=hw(e).find(e=>mw(e)),n=pw(Bh(eg(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=hw(e),n=t.find(e=>mw(e)),r=t.filter(e=>e!==n),i=eg(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=pw(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=eg(this.#m);t.colored&&Hh(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${Kh}]`);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(Kh,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Yy(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 tb(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)}},_w=e=>e.split(`/`).at(-1)??e,vw={code:`porcelain-file-code`,text:`porcelain-file-text`,symlink:`porcelain-symlink`,submodule:`porcelain-submodule`},yw=[`md`,`mdx`,`txt`],bw=`viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"`,xw=`<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" />`,Sw=`<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
1268
+ <symbol id="${vw.code}" ${bw}>
1269
+ ${xw}
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="${vw.text}" ${bw}>
1274
+ ${xw}
1275
+ <path d="M10 9H8" />
1276
+ <path d="M16 13H8" />
1277
+ <path d="M16 17H8" />
1278
+ </symbol>
1279
+ <symbol id="${vw.symlink}" ${bw}>
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="${vw.submodule}" ${bw}>
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 Cw(e=[]){return{set:`minimal`,colored:!1,spriteSheet:Sw,remap:{"file-tree-icon-file":vw.code},byFileExtension:Object.fromEntries(yw.map(e=>[e,vw.text])),byFileName:Object.fromEntries(e.flatMap(e=>{let t=e.kind===`symlink`?vw.symlink:e.kind===`submodule`?vw.submodule:null;return t?[[_w(e.path),t]]:[]}))}}var ww=ag(Cw()),Tw=`${Bh(`minimal`)}${Sw}`;function Ew(){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:Tw}}),e[0]=t):t=e[0],t}function Dw(e){let t=(0,$.c)(11),{path:n,expanded:r,className:i}=e,a;t[0]===n?a=t[1]:(a=ww.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=Y(`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 Ow=e=>`data:${e.mediaType};base64,${e.base64}`;function kw(e,t,n){let r=(0,$.c)(4),i;return r[0]!==e||r[1]!==n||r[2]!==t?(i=Jo({scope:t,connection:e,path:n}),r[0]=e,r[1]=n,r[2]=t,r[3]=i):i=r[3],Yr(i)}function Aw(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=Gi({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],Yr(o)}var jw=e=>/\.(png|jpe?g|gif|webp|avif|svg|ico)$/i.test(e);function Mw(e){let t=(0,$.c)(3),{scope:n,path:r,connection:i}=e,a=kw(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)(Nw,{query:a,path:r})}),t[0]=r,t[1]=a,t[2]=o):o=t[2],o}function Nw(e){let t=(0,$.c)(10),{query:n,path:r}=e;if(De(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(q(n)){let e;t[1]===n.cause?e=t[2]:(e=Vs(Yt(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=Ow(Cn(Dn(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 Pw(e){let t=(0,Z.useRef)(e);return(0,Z.useInsertionEffect)(()=>void(t.current=e)),(0,Z.useCallback)((...e)=>t.current(...e),[])}var Fw=(0,Z.createContext)(void 0);function Iw(){return(0,Z.useContext)(Fw)}var Lw={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},Rw={display:`contents`};function zw(){return null}function Bw({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function Vw(e,t){return e-(t===0?0:1)}function Hw(e,t){return Vw(e,t)+t}function Uw(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:Ww(n,e.startContentIndex)}}function Ww(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 Gw({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=Yc}){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:Zs,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=Kw(t,e);return(0,Q.jsx)(`div`,{slot:n,style:Rw,children:c(t,d)},n)}),s!=null&&(0,Q.jsx)(`div`,{slot:`gutter-utility-slot`,style:Lw,children:s(u)})]})}function Kw(e,t){let n=Uw(e,t);return n==null?void 0:Bw({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function qw({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c,getAnnotationSlotName:l=Yc}){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:Zs,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:Lw,children:s(c)})]})}function Jw(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function Yw(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Xw(e,t){return qs(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Zw(e){let t=e.lang??yc(e.name),n=e.lang??(e.prevName==null?`text`:yc(e.prevName));return t===`text`&&n===`text`}function Qw(e){return[Vw(e.additionStart,e.additionCount)+1,Hw(e.additionStart,e.additionCount)+1]}function $w({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 eT(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-Hw(t.additionStart,t.additionCount),r=e.deletionLines.length-Hw(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function tT({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-Hw(n.additionStart,n.additionCount),i=e.deletionLines.length-Hw(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 nT({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=tT({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 rT({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]=Qw(a);if(t<o){let s=$w({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=nT({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]=Qw(a);return t<o+i.fromStart||t>=o+i.rangeSize}function iT({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]=Qw(n),l=$w({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=nT({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 aT({type:e,metrics:t}){return t.hunkSeparatorHeight??gl(e)}function oT({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function sT({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 cT(e){return e!==`simple`&&e!==`metadata`}function lT({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!sT({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=aT({type:e,metrics:t}),a=oT({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function uT({type:e,metrics:t}){if(!cT(e))return;let n=aT({type:e,metrics:t}),r=oT({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function dT({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=fT({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=Vw(r.deletionStart,r.deletionCount),s=Vw(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=$w({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?nT({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(hT(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,hT(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(hT(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=gT(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(_T({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(hT(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 fT({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=pT({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 pT({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=$w({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?nT({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 mT(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 hT(e,t,n,r,i,a){let[o,s]=mT(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 gT(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 _T({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 vT(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var yT=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}},bT=new class extends yT{};function xT(e,t,n){return bT.diff(e,t,n)}function ST(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 CT(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 wT(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 TT(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 ET(e,t){return wT(e,t,``)}function DT(e,t){return TT(e,t,``)}function OT(e,t){return t.slice(0,kT(e,t))}function kT(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 AT(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 jT(e,t){if(t)return NT(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function MT(e,t){if(t)return NT(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function NT(e,t){if(!t)return[MT(e),jT(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=AT(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var PT=`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}`,FT=RegExp(`[${PT}]+|\\s+|[^${PT}]`,`ug`);new class extends yT{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=AT(e,r)}else n=e.match(FT)||[];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)&&IT(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&IT(n,i,r,null,t.intlSegmenter),e}};function IT(e,t,n,r,i){if(t&&n){let[a,o]=NT(t.value,i),[s,c]=NT(n.value,i);if(e){let r=ST(a,s);e.value=TT(e.value,s,r),t.value=ET(t.value,r),n.value=ET(n.value,r)}if(r){let e=CT(o,c);r.value=wT(r.value,c,e),t.value=DT(t.value,e),n.value=DT(n.value,e)}}else if(n){if(e){let e=MT(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=MT(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=MT(r.value,i),[a,o]=NT(t.value,i),s=ST(n,a);t.value=ET(t.value,s);let c=CT(ET(n,s),o);t.value=DT(t.value,c),r.value=wT(r.value,n,c),e.value=TT(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=MT(r.value,i),n=OT(jT(t.value,i),e);t.value=DT(t.value,n)}else if(e){let n=OT(jT(e.value,i),MT(t.value,i));t.value=ET(t.value,n)}}var LT=new class extends yT{tokenize(e){let t=RegExp(`(\\r?\\n)|[${PT}]+|[^\\S\\n\\r]+|[^${PT}]`,`ug`);return e.match(t)||[]}};function RT(e,t,n){return LT.diff(e,t,n)}var zT=new class extends yT{constructor(){super(...arguments),this.tokenize=VT}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 BT(e,t,n){return zT.diff(e,t,n)}function VT(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 HT(e){return e==`.`||e==`!`||e==`?`}new class extends yT{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(HT(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 yT{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends yT{constructor(){super(...arguments),this.tokenize=VT}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(UT(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 UT(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]=UT(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]=UT(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends yT{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function WT(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function GT(e){if(!WT(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 KT={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function qT(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;BT(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(BT(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||XT(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 JT(e,t){if(t||=KT,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=>JT(e,t)).join(`
1296
+ `)}let n=[];if(e.isGit){if(t=KT,!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 `+GT(r)+` `+GT(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 `+GT((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+GT((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+GT((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+GT((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(`--- `+GT(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+GT(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 YT(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;qT(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?JT(e,o.headerOptions):void 0)}}))}else{let s=qT(e,t,n,r,i,a,o);return s?JT(s,o?.headerOptions):void 0}}function XT(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 ZT({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 QT({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 $T={forcePlainText:!1};function eE(e,t,n,{forcePlainText:r,lazyLineAST:i=!1,startingLine:a,totalLines:o,expandedHunks:s,collapsedContextThreshold:c=1}=$T){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=Rl({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)??rE();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)}dT({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&&nE({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}=iE({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++)sd(e,n+r,()=>t[r])}else ud(e,t)}return{code:p,themeStyles:d,baseThemeType:u}}function tE(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(ZT({line:t,spanStart:s,spanLength:c-s})),l!==-1&&i.push(ZT({line:n,spanStart:l,spanLength:u-l}))}function nE({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=vT(e),t=vT(t),e.length>s||t.length>s))return;let c=o===`char`?xT(e,t):RT(e,t);if(o===`word-line`){tE(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?(QT({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),QT({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?QT({item:e,arr:l,enableJoin:d,isLastItem:t}):QT({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(ZT({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(ZT({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function rE(){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 iE({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===``?[]:ad(a.codeToTokens(vT(t.contents),Hl(c??yc(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 aE(e){let t=[];for(let n of e){let e=fd.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function oE(e){for(let t of Array.isArray(e)?e:[e])if(!fd.has(t))return!1;return!0}function sE(e,t=dd()){return td(t).getResolvedThemes(e)}function cE(e,t=dd()){return td(t).hasResolvedThemes(e)}function lE(e,t=dd()){return td(t).resolveThemes(e)}var uE=0,dE=1,fE=2,pE=4,mE=5,hE=6,gE=[void 0,null,!0,!1];function _E(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!==uE){if(e===dE){let e=c+t[s++];n[o]={type:`text`,value:i.slice(c,e)},c=e}else if(e===fE){let e=r[t[s++]],i={};for(let e=t[s++];e>0;e--){let e=r[t[s++]],n=t[s++],o=n===pE?r[t[s++]]:n===mE?t[s++]:n===hE?a[t[s++]]:gE[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]]!==uE&&sd(o,e,()=>(s=n[e*2],c=n[e*2+1],l(1)[0]));return o}var vE=e(Du(),1),yE=Symbol(`IGNORE_RESPONSE`),bE=1e4,xE=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=ll,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s}){this.options=e,this.preferredHighlighter=dd(s),this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new vE.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new vE.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||!Cc(n,this.getFileRenderOptions())?!1:(this.fileCache.set(e,{result:t,options:n}),this.queueBroadcastStateChanges(),!0)}setDiffResultCache(e,{result:t,options:n}){return e==null||!Xw(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??ll,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()||Xw(a,this.renderOptions))return;let o=Fs(e),c=[];if(qs(a.theme,this.renderOptions.theme)||(c=cE(o,this.preferredHighlighter)?sE(o,this.preferredHighlighter):await lE(o,this.preferredHighlighter)),!s()||ac({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 Lu||!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);wE(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){ac({theme:this.renderOptions.theme})??await this.loadSharedHighlighter(Fs(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=Fs(this.renderOptions.theme),i=cE(r,this.preferredHighlighter)?sE(r,this.preferredHighlighter):await lE(r,this.preferredHighlighter);if(!this.isCurrentLifecycle(t)){n();return}let a=[];if(this.preferredHighlighter!==`highlights`&&(a=oE(e)?aE(e):await md(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 Lu||!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,EE(e));this.queueBroadcastStateChanges(),r(e)}})()});return this.initialized=n,this.queueBroadcastStateChanges(),n}return this.initialized}async loadSharedHighlighter(e,t){try{await hc({themes:e,langs:t,preferredHighlighter:this.preferredHighlighter})}catch(e){if(!(e instanceof id))throw e}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=Yl(),i=r>0?Ms():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??bE,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=DE(t);n!=null&&yu(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=CE(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);$l(t)||n!=null&&Cc(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(CE({type:`file`,file:e}),t.theme,n=>this.setFileResultCache(e.cacheKey,{result:su(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!$l(e)&&(t==null||!Cc(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=ac({theme:this.renderOptions.theme});if(i==null){this.queueInitialization();return}return su(e,i,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);Zw(t)||n!=null&&Xw(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(CE({type:`diff`,diff:e}),t.theme,n=>this.setDiffResultCache(e.cacheKey,{result:eE(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!Zw(e)&&(t==null||!Xw(t.options,this.getDiffRenderOptions()))}primeHighlightCacheOnMainThread(e,t,n){function r(){let r=ac({theme:t,langs:e});return r!=null&&n(r)}if(r())return Promise.resolve();let{lifecycleGeneration:i}=this;return this.loadSharedHighlighter(Fs(t),[`text`,...e]).then(()=>{if(!this.isCurrentLifecycle(i))throw new Lu;if(!r())throw new ru})}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=ac({theme:this.renderOptions.theme});if(a==null){this.queueInitialization();return}return eE(e,a,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new Lu;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=>{Pl(e)||console.error(e)})}cancelActiveWorkerTasks(){let e=new Lu;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):wE(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=ac(),i=n.filter(e=>r==null||!Ac(e,r));i.length>0&&this.loadSharedHighlighter(Fs(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&&(oE(a)?t.request.resolvedLanguages=aE(a):t.request.resolvedLanguages=await md(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,EE(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 yE;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(wE(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}if(wE(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)||!Cc(r,this.getFileRenderOptions()))throw yE;let{request:i}=n,a={...t.result,code:_E(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)||!Xw(r,this.getDiffRenderOptions()))throw yE;let{request:i}=n,a={...t.result,code:{deletionLines:_E(t.result.code.deletionLines),additionLines:_E(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!==yE&&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,wE(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&&(wE(t)&&(this.rejectRenderTaskCallbacks(t,new ru),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){SE(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);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),wE(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,EE(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=Yl();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=Ms())}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 TE(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 ru),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new ru),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()))wE(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of TE(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 TE(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of TE(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 TE(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)&&Yw(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)&&Jw(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())wE(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function SE(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function CE(e){let t=new Set;switch(e.type){case`file`:t.add(e.file.lang??yc(e.file.name));break;case`diff`:t.add(e.diff.lang??yc(e.diff.name)),t.add(e.diff.lang??yc(e.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function wE(e){return e?.type===`file`||e?.type===`diff`}function TE(e){return e.instances}function EE(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 DE(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 Dl(`WorkerPoolManager: worker failed: ${n}`,t instanceof Error?{cause:t}:void 0)}var OE;function kE({poolOptions:e,highlighterOptions:t}){return OE??=new xE(e,t),OE}function AE(){OE!=null&&(OE.terminate(),OE=void 0)}var jE=(0,Z.createContext)(void 0),ME=0;function NE({children:e,poolOptions:t,highlighterOptions:n}){let[r]=(0,Z.useState)(()=>{if(!(typeof window>`u`))return kE({poolOptions:t,highlighterOptions:n})});return(0,Z.useInsertionEffect)(()=>{if(r!=null)return ME++,()=>{ME--}},[r]),(0,Z.useEffect)(()=>()=>{ME===0&&AE()},[]),(0,Q.jsx)(jE.Provider,{value:r,children:e})}function PE(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 FE(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:IE(e.items,t.items)}function IE(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 LE(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(Kc,``),t.before(r)):(r.setAttribute(tc,``),t.after(r)),n?.observe(r),r}function RE(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function zE(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}async function BE(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function VE({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=Au(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=$w({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=lT({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=HE(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?nT({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=uT({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=uT({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=Cl(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function HE(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 UE(e,t)}function UE(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 WE({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 GE=1;function KE(e,...t){return`ck${GE}:${JSON.stringify([e,...t])}`}function qE(e){return e===``?[]:e.split(Ru)}function JE(e,t,n){let r=e===`clone`?vl(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return YE(r,ZE(r,n),QE(r,n));case`rename-pure`:{let e=QE(r,n);$E(r,n);let t=qE(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,r.deletionCharacterCount=e.contents.length,r.additionCharacterCount=e.contents.length,tD(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function YE(e,t,n){let r=qE(t.contents),i=qE(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=XE(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,tD(e,t,n),e}function XE(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(Vw(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=Hw(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=Hw(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function ZE(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function QE(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function $E(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function eD(e,t,n){return e.cacheKey==null?nD(t,n):`${e.cacheKey}:hydrated`}function tD(e,t,n){let r=eD(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function nD(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?KE(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}var rD=new TextEncoder,iD=new TextDecoder(`utf-8`,{ignoreBOM:!0}),aD=/[\uD800-\uDFFF]/,oD=1024,sD=new Uint8Array(oD);function cD(){sD.length!==oD&&(sD=new Uint8Array(oD))}function lD(e){if(e.length===0)return e;if(aD.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;sD.length<t&&(sD=new Uint8Array(t));let{written:n}=rD.encodeInto(e,sD);return iD.decode(sD.subarray(0,n))}var uD=new TextDecoder(`utf-8`,{ignoreBOM:!0}),dD={'"':`"`,"\\":`\\`,a:`\x07`,b:`\b`,t:` `,n:`
1302
+ `,v:`\v`,f:`\f`,r:`\r`};function fD(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=dD[e[n+1]];if(i!=null){t+=i,n+=2;continue}let a=[];do{let t=pD(e,n+1);if(t==null)return;a.push(t),n+=4}while(e[n]===`\\`&&e[n+1]>=`0`&&e[n+1]<=`7`);t+=uD.decode(new Uint8Array(a))}}function pD(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 mD=4096,hD=.5;function gD(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=vD(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}}function _D(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 vD(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)>mD)return null;let c=[];for(let t=0;t<n;t++)c.push(bD(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(bD(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+=xD(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*hD: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 yD=/\s+/g;function bD(e){return e.replace(yD,``)}function xD(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 SD=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function CD(e,t,n=!1,r){let i=HD(e),a=i?jD(e):MD(e),o,s=[];for(let e of a){if(i&&!_l.test(e)){if(o==null)o=lD(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!ND(e)){if(o==null)o=lD(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=TD(e,{cacheKey:t==null?void 0:r==null?KE(`patch-file`,t,String(s.length)):KE(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function wD(e,t){try{return TD(e,t)}finally{cD()}}function TD(e,{cacheKey:t,isGitDiff:n=_l.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=UD(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=AD(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=zD(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?kD(i.contents):[],deletionLines:!l&&r!=null&&i!=null?kD(r.contents):[],additionCharacterCount:!l&&r!=null&&i!=null?i.contents.length:0,deletionCharacterCount:!l&&r!=null&&i!=null?r.contents.length:0,cacheKey:GD(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(SD);if(t==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}let n=DD(t[1],!0),r=DD(t[2],!0);c.name=lD(r),n!==r&&(c.prevName=lD(n));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(Kl):null;if(t!=null){let[,e,r]=t,i=DD(r,n);if(e===`---`&&i!==`/dev/null`){let e=lD(i);c.prevName=e,c.name=e}else e===`+++`&&i!==`/dev/null`&&(c.name=lD(i))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=lD(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=lD(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=lD(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=lD(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(iu)??[];t!=null&&(c.prevObjectId=lD(t)),n!=null&&(c.newObjectId=lD(n)),r!=null&&(c.mode=lD(r))}(e.startsWith(`rename from `)||e.startsWith(`copy from `))&&(c.prevName=lD(DD(e.slice(e.startsWith(`rename`)?12:10)))),(e.startsWith(`rename to `)||e.startsWith(`copy to `))&&(c.name=lD(DD(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:GD(p.hunkContext),hunkSpecs:lD(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(!LD(t)||RD(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=KD(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=qD(t);(g==null||g.type!==`change`)&&(g=JD(`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=qD(t);(g==null||g.type!==`change`)&&(g=JD(`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=qD(t);(g==null||g.type!==`context`)&&(g=JD(`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=vT(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=vT(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=Vw(b.additionStart,b.additionCount)+(x===0?0:1),t=Vw(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(Vw(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=Hw(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=Hw(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),gD(c),c}}function ED(e,t,n=!1){let r=[],i=OD(e)?e.split($c):[e];for(let e of i)try{r.push(CD(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{cD()}return r}function DD(e,t=!1){let n=e.trim(),r=n.startsWith(`"`)?fD(n)?.fileName??n:n;return t&&(r.startsWith(`a/`)||r.startsWith(`b/`))?r.slice(2):r}function OD(e){return e.startsWith(`From `)||e.includes(`
1305
+ From `)}function kD(e){let t=AD(e);for(let e=0;e<t.length;e++)t[e]=lD(t[e]);return t}function AD(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 jD(e){return UD(e,`diff --git`)}function MD(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=ID(e,r);if(i<=0&&a<=0){if(PD(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=ID(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=zD(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 ND(e){return PD(e,0)}function PD(e,t){let n=ID(e,t);return FD(e,t,`---`)&&FD(e,n,`+++`)}function FD(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
1307
+ `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function ID(e,t){let n=e.indexOf(`
1308
+ `,t);return n===-1?e.length:n+1}function LD(e){let t=e[0];return t===`+`||t===`-`||t===` `}function RD(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 zD(e){if(!e.startsWith(`@@ -`))return;let t=4,n=BD(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=BD(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=BD(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=BD(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=VD(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function BD(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function VD(e){return e.endsWith(`\r
1310
+ `)?e.slice(0,-2):e.endsWith(`
1311
+ `)?e.slice(0,-1):e}function HD(e){return e.startsWith(`diff --git`)||e.includes(`
1312
+ diff --git`)}function UD(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:WD(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=WD(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function WD(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function GD(e){return e==null?e:lD(e)}function KD(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function qD(e){let t=e.slice(1);return lD(t===``?`
1313
+ `:t)}function JD(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 YD=`/dev/null`;function XD(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??ZD(),a=t??ZD(),o=wD(YT(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey,r=t?.cacheKey;return n!=null&&r!=null?KE(`diff`,n,r):void 0})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function ZD(){return{name:YD,contents:``}}var QD=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 $D(e,t){let n=XD({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 eO(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 tO(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function nO(e,t){return t.length>0&&t.length<e.deletionLines.length&&tO(t)}function rO(e,t,n,r){let i=e.deletionLines.join(``),a=eO(t.length,i),o=XD({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 iO(e,t){return rO(e,[``],0,t)}function aO(e,t){if(e.additionLines.length===0)return iO(e,t);if(nO(e,e.additionLines))return rO(e,e.additionLines,e.additionCharacterCount,t);let n=e.additionLines,r=$D(e,t);return sO(r,n),r}function oO(e){return e.length>1&&e.at(-1)===``}function sO(e,t){if(!oO(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&&Hw(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,_O(e);return}}}function cO(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return lO(e,$D(e,n));let r=Array.from(t);if(r.length===0)return lO(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||vT(r)===vT(i))return lO(e,$D(e,n))}let i=uO(e,r);if(i.size===0)return lO(e,$D(e,n));for(let t of i)if(!fO(e,t,n))return lO(e,$D(e,n));return _O(e),eT(e)?lO(e,$D(e,n)):lO(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function lO(e,t){return Object.assign(e,t),t}function uO(e,t){let n=new Set;for(let r of t){let t=dO(e,r);if(t==null)return new Set;n.add(t)}return n}function dO(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 fO(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=XD({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:(mO(r,s),pO(e,t),!0)}function pO(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 mO(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>hO(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,gO(e)}function hO(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function gO(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 _O(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Vw(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,gO(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=Hw(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-Hw(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var vO=new WeakMap;function yO(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function bO(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 xO(e,t,n){let r=e.hunks,i=e.additionLines,a=yO(i),o=a===i?e:{...e,additionLines:a},s=MO(r,AO(o,t,n),e.deletionLines.length),c=FO(o,s);if(e.additionLines=a,e.hunks=c,e.editSessionDirty=!0,GO(e),sO(e,i),RO(r,e.hunks))return{regions:s.map(e=>e.previousSpan)}}function SO(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<VO(e)+e.additionCount)break;l++}let r=s[l],i=r==null?void 0:VO(r);if(i==null||t<i||c!=null&&c!==l)return xO(e,n,o);c=l}if(c!=null){if(CO(e,a,c,r,n)){e.editSessionDirty=!0;return}return xO(e,n,o)}}function CO(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=wO(e),o=e.hunks[n];if(o.hunkContent.some(TO))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 wO(e){let t=vO.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return vO.set(e,{lines:e.deletionLines,set:n}),n}function TO(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function EO(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 DO(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=$w({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=HO(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=nT({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=HO(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function OO(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=HO(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,HO(i)+i.deletionCount,e.deletionLines.length),n}function kO(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?$D(e,t):aO(e,t)),!0)}function AO(e,t,n){if(bO(e.deletionLines,e.additionLines)==null)return[];let r=XD({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??=jO(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){_D(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=hO(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 jO(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 MO(e,t,n){let r=e.map((e,t)=>{let n=HO(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&&NO(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=PO(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 NO(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function PO(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 FO(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`);LO(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`);LO(s,c,i,r),r+=c,i+=c,n.push(IO(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 IO(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:UO(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:WO(t.additionStart,r),deletionStart:UO(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:WO(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${UO(t.deletionStart,i)},${i} +${UO(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return gO(s),s}function LO(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function RO(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(HO(r)!==HO(i)||r.deletionCount!==i.deletionCount||VO(r)!==VO(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!zO(r,i))return!0}return!1}function zO(e,t){let n=BO(e),r=BO(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*BO(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 VO(e){return Vw(e.additionStart,e.additionCount)}function HO(e){return Vw(e.deletionStart,e.deletionCount)}function UO(e,t){return t===0?e:e+1}function WO(e,t){return t===0?e-1:e}function GO(e){_O(e);for(let t=0;t<e.hunks.length;t++)pO(e,t)}function KO(e){return cd({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function qO(e){return cd({tagName:`div`,children:[cd({tagName:`span`,children:[rd(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function JO(e){return cd({tagName:`div`,children:[ed({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 YO({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(cd({tagName:`div`,children:[rd(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(JO(`up`)),s++),o||(e.push(JO(`down`)),s++)):(e.push(JO(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(cd({tagName:`div`,children:[cd({tagName:`span`,children:[rd(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(cd({tagName:`div`,children:[rd(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(cd({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(cd({tagName:`slot`,properties:{name:i}})),cd({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 XO(e,t){return`hunk-separator-${e}-${t}`}function ZO(e){let t=e.at(-1);return t==null?0:Math.max(Hw(t.additionStart,t.additionCount),Hw(t.deletionStart,t.deletionCount))}var QO=-1,$O=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++QO}`;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:ll},t=Yc,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,iO(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&&Jw(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!Xw(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||!Jw(t.diff,e)||Zw(e)||pk(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=>{Pl(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||!Jw(n,e)||!Jw(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);Xw(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)??lc}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=lk(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]=uk(i,vT(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=vT(o);if(l==null&&a&&r?.has(t)!==!0){let e=Ys(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,iO(s,this.options.parseDiffOptions)),f=!0;else if(nO(s,s.additionLines))this.applyRecomputePreservingSessionType(s,rO(s,s.additionLines,s.additionCharacterCount,this.options.parseDiffOptions)),f=!0;else{let e=SO(s,u,this.options.parseDiffOptions,d);this.applyExpansionRemap(e),f=e!=null}}else Object.assign(s,cO(s,u,this.options.parseDiffOptions))}return o.baseThemeType=t,a.isDirty=!0,f}applyExpansionRemap(e){e!=null&&(this.expandedHunks=EO(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}=dk(e);if(r.additionLines=o,r.additionCharacterCount=s,i!=null&&(i.code.additionLines=ck(a,r.additionLines,i.code.additionLines,e)),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,iO(r,this.options.parseDiffOptions)),i!=null&&(i.code.additionLines[0]=uk(0,e.getLineText(0)))):this.editSessionActive?this.applySessionDocumentChange(r,a):Object.assign(r,aO(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(nO(e,r)){this.applyRecomputePreservingSessionType(e,rO(e,r,e.additionCharacterCount,n));return}this.applyExpansionRemap(xO(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=>Mc(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=ll,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=Pc,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 hc(Ps(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:mc(this.workerManager,this.options)}))}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=pk(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!Xw(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!Zw(e),options:t,result:n?void 0:r?.result,renderRange:void 0};let i=this.getHighlightWorkerManager(e);i==null?ac({theme:this.getLocalHighlightTheme()})??(this.computedLangs=fk(e),this.initializeHighlighter().catch(e=>{e instanceof id||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??ll}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||!Jw(e,n.diff)||!Xw(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(Jw(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||Zw(e)||pk(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||Jw(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0&&!this.workerManager.shouldHighlightOnMainThread(e)||ac({theme:t.theme})!=null:r.result==null&&r.hydrated!==!0?!0:this.getHighlightWorkerManager(e)==null?ac({theme:t.theme})!=null:!r.highlighted}renderDiff(e=this.diff,t=ol){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||Zw(e)||pk(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!Jw(e,this.renderCache.diff),d=!sc(this.renderCache.renderRange,t),f=this.getHighlightWorkerManager(e);if(f!=null){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&tu(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,tu(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&f.highlightDiffAST(this,e)}else{this.computedLangs=fk(e);let n=ac(),r=n!=null&&Xu(i.theme,n),o=n!=null&&Ac(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 id||this.onHighlightError(e)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=ol){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 Zl({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e,t=!1){let n=pk(e,this.getTokenizeMaxLength());this.computedLangs=n?[`text`]:fk(e);let r=ac(),i=r!=null&&Xu(this.getLocalHighlightTheme(),r),a=n||r!=null&&Ac(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=eE(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(dT({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]=uk(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&&Jw(i,e)&&Xw(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&Xw(a.options,n)&&Jw(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&&Xw(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&Jw(n.diff,e)&&Xw(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&&Jw(e,n.diff)&&Xw(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=mk(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:od(),deletionsGutterAST:od(),additionsGutterAST:od(),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=tT({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`,nd(void 0,`buffer`,this.size)),h?.push(KO(this.size))):(x.pushToGutter(`deletions`,nd(void 0,`buffer`,this.size)),g?.push(KO(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,$u(t,n,r,i))};function T(e){C.flush(),a===`unified`?ak(`unified`,e,x):(ak(`deletions`,e,x),ak(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),dT({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&&nk(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=ok(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${h},${l}`}:void 0)):i=ok(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${h},${l}`}:void 0),ik({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&&nk(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(_);n?.before!=null&&rk(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=ok(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=ok(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)}ik({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&rk(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(qO(e)),x.pushToGutter(`unified`,nd(e,`metadata`,1))):(x.deletionsContentAST.push(qO(e)),x.pushToGutter(`deletions`,nd(e,`metadata`,1)),A||(x.pushToGutter(`additions`,nd(void 0,`buffer`,1)),x.additionsContentAST.push(KO(1))))}if(A&&!(f&&k&&c!==`change`)){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(qO(e)),x.pushToGutter(`unified`,nd(e,`metadata`,1))):(x.additionsContentAST.push(qO(e)),x.pushToGutter(`additions`,nd(e,`metadata`,1)),k||(x.pushToGutter(`deletions`,nd(void 0,`buffer`,1)),x.deletionsContentAST.push(KO(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(ZO(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=od(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,Tc(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(cd({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(cd({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(cd({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return ld(this.renderFullAST(e,t))}renderPartialHTML(e,t){return ld(t==null?e:cd({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(!tl(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(rc(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(rc(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){ik({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}ik({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 xc({fileOrDiff:e,mode:t,stickyHeader:n})}},ek=new Intl.PluralRules(`en-US`);function tk(e){return`${e} unmodified line${ek.select(e)===`one`?``:`s`}`}function nk(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function rk(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 ik({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`,nd(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`,nd(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`,nd(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function ak(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,YO({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(YO({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,YO({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(YO({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=XO(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?tk(n):`More unchanged context may be available`;c.pushToGutter(e,YO({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(YO({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 ok(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function sk(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function ck(e,t,n,r){let i=sk(e),a=sk(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]??=uk(e,r.getLineText(e));return l}function lk(e,t){return t===e.length+1&&e.at(-1)?.endsWith(`
1316
+ `)===!0}function uk(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 dk(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 fk(e){if(e.lang!=null)return[e.lang];let t=yc(e.prevName??e.name),n=yc(e.name);return t===n?[n]:[t,n]}function pk(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function mk(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function hk(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function gk(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 _k(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:lu(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 vk(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function yk(e){let t={...e};return delete t.cacheKey,t}function bk(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??yc(e.name),r=t.lang??yc(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 xk(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Sk(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&xk(n.lines,t.deletionLines)}var Ck=-1,wk=class{options;workerManager;requestOwnerRender;static LoadedCustomComponent=!0;__id=`file-diff:${++Ck}`;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??fu}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:ll},t,n){this.options=e,this.workerManager=t,this.requestOwnerRender=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new _c,this.scrollSyncManager=new QD,this.interactionManager=new Rc(`diff`,Qu(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??ll}getHunksRendererOptions(e){return _k(e)}createHunksRenderer(e){return new $O(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=Vw(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(Qu(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&&!qs(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Bl(this.editSession?.annotations,e,Yc);getLatestAnnotations(){return this.pendingData?.lineAnnotations??this.editSession?.annotations?.current??this.lineAnnotations}getAnnotationsForDiff(e){let{pendingData:t}=this;return t!=null&&Jw(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;ml(t,e,Yc)}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;As(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=WE(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||kk(this.pre,Dk({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||Ak(this.headerElement,Ok({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),zu(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?XD(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||!vk(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&&!vk(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&&!vk(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(JE(`merge`,e,t),this.setHydratedState(t),this.installHydratedSessionDiff(e)){this.rerender();return}await BE(()=>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(Jw(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=Wl(t,Yc,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:qE(t.contents),a=n!=null&&Sk(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=yk(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,_O(s));let c=this.editSession?.annotations??Wl(this.getLatestAnnotations(),Yc);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=WE(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=_&&(!Ek(u,this.deletionFile)||!Ek(d,this.additionFile)),y=e!=null&&!Jw(e,this.getInputDiff()),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&sc(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=XD(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()&&(kO(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,Ou);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||!Jw(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&&Jw(i,r)?t:this.getAnnotationsForDiff(i)}}prepareRenderData(e){this.hunksRenderer.setLineAnnotations(this.getAnnotationsForDiff(e))}adoptRenderData(e){let{pendingData:t}=this,n=t!=null&&Jw(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?bk(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??yc(i.name),c=ac({theme:o,lang:s});c==null?hc({themes:Fs(o),langs:[`text`,s],preferredHighlighter:mc(this.workerManager,this.options)}).then(a).catch(e=>{e instanceof id||console.error(e)}):a(c)}computeEditorRenderRange(e){let t=this.getWorkingDiff();if(e==null||t==null||tu(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return dT({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&&bk(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?_u(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(Tk(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=vl(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=DO(e,this.hunksRenderer.getExpandedHunksMap(),t);return kO(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(OO(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 rT({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 iT({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]=Qw(o);if(e<s){let c=$w({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=nT({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]=Qw(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(){Al(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||Zw(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{Pl(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||!gk(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||!hk(a,s.annotation)){s?.element.remove();let e=n(a,r);if(e==null)continue;s={element:Gs(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=Wc();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:il(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):il(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=Oc;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&&Jw(r,n)?i:void 0)??ld(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,Zs,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,wl,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,gu,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,ju,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??=Wu(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Vc(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=zs(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=kl({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:qu(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=xl(this.themeCSSStyle.textContent??``,zs(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&sl()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Il(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=jk(t[0]),a=jk(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=ld(i),r.content.innerHTML=ld(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=xu({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=xu({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=xu({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=jk(r?.[0]),a=jk(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=jk(r?.[0]),a=jk(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=ld(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.adoptRenderData(t.fileDiff)};this.shouldGuardRebuildScroll()?Il(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=jk(t[0]),i=jk(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};Hs(u,this.appliedPreAttributes)||(au(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 Tk(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function Ek(e,t){return e==null||t==null?e==null&&t==null:Yw(e,t)}function Dk({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Ok({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function kk(e,t,n=!1){return!n&&e==null&&t}function Ak(e,t,n=!1){return e==null&&t&&!n}function jk(e){if(e!=null&&e.type===`element`)return e.children??[]}var Mk=3e3,Nk=new Map,Pk=-1,Fk=class extends wk{__id=`little-virtualized-file-diff:${++Pk}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:Nk,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=Gl(n)}setMetrics(e,t=!1){let n=Gl(e);(t||!du(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 Jc(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=!Nu(t,e),r=n&&Uk(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Wk(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=Nk,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()??Nk);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&&tl(this.renderRange)){let t=Ik(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=Jk(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=Gl(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=Au(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:hu(this.metrics,i),height:0};let m;return dT({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=lT({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=uT({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??Au(this.metrics,n)+this.cache.fileAnnotationHeight,u;return dT({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=lT({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=uT({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||!Jw(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=JE(`clone`,e,t);if(await BE(()=>this.primeHighlightCache(n)),this.getInputDiff()!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(JE(`merge`,e,t),this.setHydratedState(t),!this.installHydratedSessionDiff(e)&&(await BE(()=>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 rT({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,!Jw(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()??Nk);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options;if(a){this.height+=hu(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}=VE({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Gk(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=WE(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!qk(s,this.deletionFile)||!qk(c,this.additionFile)),u=t??this.getInputDiff();t==null&&o&&(l||this.getInputDiff()==null)&&(u=XD(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!Jw(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(!Jw(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:!Jw(a,o),renderedDiffChanged:!Jw(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 Kk(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=Gk(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=Lk(this.cache.heightDeltas),u=Au(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=Bk(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+Vk(i,e)*this.metrics.lineHeight+Rk(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=Mk}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Rk(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=$w({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?lT({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?nT({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?uT({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:Hk({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}=$w({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=nT({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=Gk(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=Au(this.metrics,i),h=e.hunks.length>0?Cl(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(dT({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?lT({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=uT({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 Ik(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===Zc&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Lk(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 Rk({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=zk(e,n);return(t[zk(e,r)]??0)-(t[i]??0)}function zk(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 Bk(e){return Math.ceil(e/Mk)*Mk}function Vk(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Hk({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 Uk(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 Wk(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 Gk(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Kk(e){return typeof e==`function`?`custom`:e??`line-info`}function qk(e,t){return e==null||t==null?e==null&&t==null:Yw(e,t)}function Jk(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}var Yk=`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(`.`),Xk=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Zk=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],Qk=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],$k=Symbol(`CodeView.itemOptionsState`);function eA(e,t){Object.defineProperty(e,$k,{configurable:!1,enumerable:!1,value:t})}function tA(e){return e[$k]}function nA(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var rA=120,iA=1,aA=`--diffs-overflow-override`;function oA(e,t,n){return{containerHeight:e,triggerTop:t,targetTop:n,targetBottom:e-n,threshold:e-t}}var sA=oA(12e6,1e6,2e6),cA=oA(2**22,5e5,1e6);function lA(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var uA=(()=>{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)})(),dA=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=Tu()?cA:sA;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=fc;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:ll},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??Cu}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??fc.hunkLineCount,lineHeight:e?.lineHeight??fc.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??fc.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??fc.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??rl}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return jl&&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)<iA||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),uA&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(aA,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,rA)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(aA,`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??LE(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(){As(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(Pu),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))gA(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 RE()?`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=fA(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;pA(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!du(r,i),o=!du(n,this.getLayout());o&&this.syncLayout();let s=a||mA(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||hA(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),Nu(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?(As(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):Al(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??ll;return ac({theme:e})==null?(qs(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return Lc({themes:Fs(e),langs:[],preferredHighlighter:mc(this.workerManager,this.options)}).then(()=>{t||(this.clearReadySubscription(),this.render(!0))},e=>{t||(this.clearReadySubscription(),e instanceof id||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=SA(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 Fk(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 Mu(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&&Fc(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){lA(n);let r=tA(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 Xk)nA(e,t,()=>this.options[t]);nA(e,`stickyHeader`,()=>this.options.stickyHeaders),nA(e,`collapsed`,e=>{let t=tA(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),nA(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=tA(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of Zk)this.defineItemSharedCallback(e,`file`,t);for(let t of Qk)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of Yk)nA(e,t,()=>this.options[t]);nA(e,`stickyHeader`,()=>this.options.stickyHeaders),nA(e,`hunkSeparators`,()=>this.options.hunkSeparators),nA(e,`collapsed`,e=>{let t=tA(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),nA(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=tA(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of Zk)this.defineItemSharedCallback(e,`diff`,t);for(let t of Qk)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return eA(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return eA(t,{id:e}),t}updateItemOptionsId(e,t){let n=tA(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){nA(e,n,e=>{if(this.options[n]==null)return;let r=tA(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){nA(e,n,e=>{let r=tA(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=zE(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=zE(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:zE(this.clampPagedScrollTop(i)),scrollPageOffset:r}}needsScrollPageUpdate(e){let t=zE(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 ${_A(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 ${_A(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=dl({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(),bA(this.stickyContainer,t.element,h),n.virtualizedSetup(),yA(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(bA(this.stickyContainer,t.element,h),yA(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=zE(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)>=iA){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=zE(this.clampScrollTop(e)),i=zE(t),{scrollPageOffset:a}=this,o=zE(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||zE(this.getScrollTop())===zE(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||!FE(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 fA(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 pA(e,t){return!qs(e.theme??ll,t.theme??ll)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function mA(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 hA(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 gA(e){return e instanceof SVGElement||il(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function _A(e){let t=vA(e.start,e.side),n=vA(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function vA(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function yA(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 bA(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function xA(e){return(e.item.annotations?.length??0)>0||PE(e).lineAnnotations.length>0}function SA(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)xA(t)&&i.push(t);return i.length>0?i:void 0}function CA(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}var wA=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function TA(e){return{instance:void 0,items:void 0,controlled:e,managedOptions:void 0,disableFlushSync:!1,slotCoordinator:void 0}}function EA(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=Iw(),E=(0,Z.useContext)(jE),D=(0,Z.useRef)(TA(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=Pw(e=>{f?.(e)}),I=S!==void 0,L=Pw((e,t,n)=>{if(T==null)throw Error(`CodeView: EditContext is not attached`);let r={...a,...t};return T(e,r,n)}),R=Pw((e,t)=>{l?.(e,t)}),z=Pw((e,t,n)=>u?.(e,t,n)??`reject`),B=(0,Z.useMemo)(()=>MA({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)(()=>jA()),[,H]=(0,Z.useState)({}),U=Pw(e=>{D.current.instance!=null&&(e==null||e!==D.current.instance.getContainerElement())&&(D.current.instance.cleanUp(),V.publish(void 0),D.current=TA(w)),e!=null&&e!==D.current.instance?.getContainerElement()&&(D.current.instance=new dA(B,i?void 0:E,!0),D.current.instance.setup(e)),CA(r,e)}),W=Pw(e=>{D.current.disableFlushSync?V.publish(e):(0,bd.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 wA(()=>d==null?void 0:D.current.instance?.subscribeToScroll(d)),wA(()=>{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(Nu(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&&(kA(n,c)?D.current.items=c:OA(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;AA(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 AA(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 AA(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 AA(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)(NA,{managedContentStore:V,renderCustomHeader:_,renderHeaderPrefix:x,renderHeaderFilenameSuffix:y,renderHeaderMetadata:b,renderAnnotation:m,renderGutterUtility:v,renderCodeViewHeader:g,renderCodeViewFooter:h})]})}var DA=(0,Z.forwardRef)(EA);function OA(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 kA(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 AA(e,t){if(e)throw Error(`CodeView.${t} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`)}function jA(){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 MA({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=IA),n&&(d.renderGutterUtility=IA),r&&(d.renderCodeViewHeader=IA),i&&(d.renderCodeViewFooter=IA),d}var NA=(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=Pw(t=>e.subscribe(t)),u=Pw(()=>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,bd.createPortal)(t.type===`diff`?(0,Q.jsx)(PA,{version:t.version??0,item:t.item,getHoveredLine:t.instance.getHoveredLine,getAnnotationSlotName:t.instance.getAnnotationSlotName,...PE(t),...e}):(0,Q.jsx)(FA,{version:t.version??0,item:t.item,getHoveredLine:t.instance.getHoveredLine,getAnnotationSlotName:t.instance.getAnnotationSlotName,...PE(t),...e}),t.element,t.id))},[t,n,r,i,a,o,d?.items]),p=(0,Z.useMemo)(()=>s!=null&&d?.header!=null?(0,bd.createPortal)(s(),d.header):null,[s,d?.header]),m=(0,Z.useMemo)(()=>c!=null&&d?.footer!=null?(0,bd.createPortal)(c(),d.footer):null,[c,d?.footer]);return(0,Q.jsxs)(Q.Fragment,{children:[f,p,m]})}),PA=(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 Gw({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})}),FA=(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 qw({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 IA(){}function LA(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 RA=(0,Z.createContext)(void 0);function zA(){return(0,Z.useContext)(RA)}function BA(){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 VA(e,t){"use no memo";return e.current?.__getNextRenderData(t)}var HA=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function UA({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=zA(),h=a!==void 0,g=(0,Z.useContext)(jE),_=Iw(),v=Pw(e=>f?.(e)),y=f==null?void 0:v,b=(0,Z.useRef)(null),x=Pw(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=BA(),T=VA(C,WA(b,e,i))??{file:e,lineAnnotations:i??fu},E=(0,Z.useRef)(null),D=Pw(()=>{if(_==null)throw Error(`File: EditContext is not attached`);return _(`file`,n??{},r)}),O=Pw(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 Tl(qA({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),u?void 0:g,w):C.current=new Mu(qA({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=JA(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}});HA(()=>{let{current:n}=C;if(n==null)return;let r=qA({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),o=!Nu(n.options,r);if(n.setOptions(r),!d&&E.current!=null){let{current:e}=E;E.current=null,e()}let s=KA(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=JA(n,D),w())});let k=(0,Z.useCallback)(()=>C.current?.getHoveredLine(),[]),A=(0,Z.useCallback)(e=>C.current?.getAnnotationSlotName(e)??Yc(e),[]);return{...T,ref:O,getHoveredLine:k,getAnnotationSlotName:A}}function WA(e,t,n){"use no memo";return GA(t,n,e.current)}function GA(e,t,n){return{file:n?.file!=null&&$s(e,n.file.stale)?n.file.installed:e,lineAnnotations:n?.annotations!=null&&t===n.annotations.stale?n.annotations.installed:t}}function KA(e,t,n){let{current:r}=n,i=GA(e,t,r);return r==null?i:(r.file!=null&&!$s(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 qA({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...e,controlledSelection:t,renderCustomHeader:n?zw:e?.renderCustomHeader,renderGutterUtility:r?zw:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function JA(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function YA({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}=UA({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=qw({file:C,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:h,lineAnnotations:w,getHoveredLine:x,getAnnotationSlotName:S});return(0,Q.jsx)(Pu,{ref:b,className:s,style:c,children:LA(T,m)})}var XA={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`};function ZA(e){return e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
1317
+ `)}function QA(e){return e.replace(/[&<>"']/g,e=>XA[e])}function $A(e){return QA(e).replace(/`/g,`&#96;`)}function ej(e){return/^\s*$/.test(e)}function tj(e,t){let n=0;for(;n<e.length&&n<t&&e[n]===` `;)n++;return e.slice(n)}function nj(e){let t=``;for(let n of e)n.type===`text`||n.type===`inlineCode`?t+=n.value:`children`in n?t+=nj(n.children):n.type===`image`&&(t+=n.alt);return t}function rj(e=ij){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 ij(e){return e.toLowerCase().normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).replace(/&[a-z0-9#]+;/gi,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`section`}function aj(e){let t=e.replace(/[\u0000-\u001F\u007F\s]+/g,``);return/^(?!https?:|mailto:|tel:)[a-z][a-z0-9+.-]*:/i.test(t)?``:t}function oj(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 sj(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}function cj(e){return sj(e).replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)||`footnote`}function lj(e,t=1){return t>1?`${e}-${t}`:e}function uj(e,t={}){let n=mj(e,t);for(let e of t.extensions??[])n=e.transformInline?.(n,{options:t})??n;return n}var dj=32,fj=16,pj=/[\\`!\[_*~<]/g;function mj(e,t,n={scans:Math.max(e.length*fj,1024),depth:0,links:0}){if(n.depth>=dj)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=yj(e,i,"`"),s=bj(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===`^`&&hj(e,i,t,n);if(u){o(),r.push(u.node),n.links++,i=u.end;continue}let d=gj(e,i+Number(l),t,n);if(d){let e=n.links,s=mj(d.label,l?t.references?{references:t.references}:{}:t,n),c=!l&&n.links!==e,u=aj(d.href);if(l||!c&&(u||!d.href))o(),r.push({...l?{type:`image`,src:u,alt:nj(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=xj(e,i+3,`***`,n);if(a!==-1){o(),r.push({type:`emphasis`,children:mj(e.slice(i+1,a+2),t,n)}),i=a+3;continue}}if(s===`~`&&c===`~`&&e[i+2]===`~`){let t=yj(e,i,`~`);a+=e.slice(i,i+t),i+=t;continue}if(s===`*`||s===`_`||s===`~`){let l=c===s?2:1,u=s===`_`&&!Cj(e,i,l,!0)?-1:xj(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:mj(e.slice(i+l,u),t,n)}),i=u+l);continue}if(s===`<`&&t.allowHtml){let t=Sj(e,i+1,`>`,n);if(t!==-1&&_j(e.slice(i,t+1))){o(),r.push({type:`inlineHtml`,value:e.slice(i,t+1)}),i=t+1;continue}}pj.lastIndex=i+1;let l=n.scans>0?pj.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 hj(e,t,n,r){let i=Sj(e,t+2,`]`,r);if(i===-1)return;let a=sj(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??cj(o.label),number:s,...c>1?{referenceIndex:c}:{}},end:i+1}}function gj(e,t,n,r){let i=vj(e,t,`[`,`]`,r);if(i===-1)return;let a=e.slice(t+1,i),o=i+1,s;if(e[o]===`(`){let t=vj(e,o,`(`,`)`,r);if(t===-1)return;s=oj(e.slice(o+1,t).trim()),o=t+1}else if(e[o]===`[`){let t=vj(e,o,`[`,`]`,r);if(t===-1)return;s=n.references?.[sj(e.slice(o+1,t)||a)],o=t+1}else s=n.references?.[sj(a)];if(s)return{...s,label:a,end:o}}function _j(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 vj(e,t,n,r,i){if(Sj(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 yj(e,t,n,r){let i=0;for(;e[t+i]===n&&!(r&&--r.scans<0);)i++;return i}function bj(e,t,n,r,i){let a=t;for(;(a=Sj(e,a,n,i))!==-1;){let t=yj(e,a,n,i);if(t===r)return a;a+=t}return-1}function xj(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=yj(e,i,n,r),a=xj(e,i+t,n.repeat(t),r);if(a>i+t){i=a+t-1;continue}}if(n[0]!==`_`||Cj(e,i,n.length,!1))return i}}return-1}function Sj(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 Cj(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 wj=64;function Tj(e,t={}){let n=ZA(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=Oj(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=rj(),p=new Ej(i,d,f).parse();u&&s.length>0&&p.push(kj(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 Ej=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>=wj){let e=this.lines.slice(this.index).join(`
1321
+ `);return this.index=this.lines.length,e?[{type:`paragraph`,children:uj(e,this.options)}]:[]}this.budget.depth++;let e=[];for(;this.index<this.lines.length;){if(ej(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=>uj(e,this.options),parseBlocks:t=>new e(ZA(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(tj(n,e[1].length)),this.index++}return{type:`code`,value:r.join(`
1323
+ `),...Dj(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=uj((/^#+[ \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(!ej(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=jj(this.current());if(!t)return;let n=[],r=t.ordered,i=t.indent,a=!1;for(;this.index<this.lines.length;){let r=jj(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=jj(e);if(n&&n.indent===i)break;if(ej(e)){let e=this.index;for(;e<this.lines.length&&ej(this.lines[e]);)e++;let n=this.lines[e];if(n===void 0)break;let o=jj(n);if(o?.indent===i){if(o.marker!==t.marker)break;a=!0,this.index=e;break}if(Mj(n)<r.contentIndent)break;for(;this.index<e;)l.push(tj(this.lines[this.index++],r.contentIndent));continue}if(Mj(e)>=r.contentIndent){l.push(tj(e,r.contentIndent)),this.index++;continue}if(Nj(e,this.next()))break;l.push(e.trimStart()),this.index++}let u=new e(l,this.options,this.slugger,this.budget),d=u.parse();a||=u.loose;let f={type:`listItem`,children:d};c!==void 0&&(f.checked=c),n.push(f)}return{type:`list`,ordered:r,...r&&{start:t.number},...a&&{loose:!0},items:n}}parseTable(){let e=this.current(),t=this.next();if(!t||!Pj(e,t))return;let n=Fj(e),r=Fj(t).map(Ij),i=n.length,a=[];for(this.index+=2;this.index<this.lines.length;){let e=this.current();if(ej(e)||Nj(e,this.next()))break;let t=Fj(e);a.push(Array.from({length:i},(e,n)=>Lj(t[n]??``,this.options))),this.index++}return{type:`table`,align:r,header:n.map(e=>Lj(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&&!ej(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(ej(t)||e.length>0&&Nj(t,this.next()))break;e.push(t.trim()),this.index++}return{type:`paragraph`,children:uj(e.join(`
1326
+ `),this.options)}}createHeadingId(e){if(this.options.headingIds===!1)return;let t=nj(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 Dj(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?Aj(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 Oj(e){let t=Object.create(null),n=Object.create(null),r=rj(cj),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)&&ej(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=sj(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&&oj(a[2].trimEnd());if(c){t[sj(a[1])]??=c,o++;continue}}i.push(s),o++}return{lines:i,references:t,footnotes:n}}function kj(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??cj(o.label),number:a+1,children:new Ej(ZA(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 Aj(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 jj(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 Mj(e){return e.match(/^ */)?.[0].length??0}function Nj(e,t){let n=jj(e);return/^ {0,3}(?:`{3,}|~{3,}|#{1,6}(?:\s|$)|([-*_])(?:\s*\1){2,}\s*$|>)/.test(e)||n!==void 0&&(!n.ordered||n.number===1)||!!t&&Pj(e,t)}function Pj(e,t){if(!e.includes(`|`))return!1;let n=Fj(t);return n.length===Fj(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function Fj(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 Ij(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function Lj(e,t){return{type:`tableCell`,children:uj(e,t)}}function Rj(e,t={}){return(typeof e==`string`?Tj(e,t):e).children.map(e=>zj(e,t)).join(`
1329
+ `)}function zj(e,t={}){let n=Xj(e,t);if(n!==void 0)return n;switch(e.type){case`heading`:{let n=e.id?` id="${$A(e.id)}"`:``,r=e.framework?` data-framework="${$A(e.framework)}"`:``;return`<h${e.depth}${n}${r}>${Vj(e.children,t)}${Zj(e.id,t)}</h${e.depth}>`}case`paragraph`:return`<p>${Vj(e.children,t)}</p>`;case`code`:return Hj(e,t);case`list`:{let n=e.ordered?`ol`:`ul`;return`<${n}${e.ordered&&e.start!==void 0&&e.start!==1?` start="${e.start}"`:``}>\n${e.items.map(n=>`<li>${Uj(n.children,n.checked,e.loose,t)}</li>`).join(`
1330
+ `)}\n</${n}>`}case`blockquote`:return`<blockquote>\n${e.children.map(e=>zj(e,t)).join(`
1331
+ `)}\n</blockquote>`;case`table`:return`<table>${`<thead><tr>${e.header.map((n,r)=>Yj(`th`,n,e.align[r],t)).join(``)}</tr></thead>`}${e.rows.length?`<tbody>${e.rows.map(n=>`<tr>${n.map((n,r)=>Yj(`td`,n,e.align[r],t)).join(``)}</tr>`).join(``)}</tbody>`:``}</table>`;case`footnotes`:return Gj(e.items,t);case`thematicBreak`:return`<hr>`;case`html`:return t.allowHtml?e.value:QA(e.value);case`callout`:return Wj(e,t);case`component`:return Jj(e,t)}}function Bj(e,t={}){let n=Xj(e,t);if(n!==void 0)return n;switch(e.type){case`text`:return QA(e.value);case`inlineCode`:return`<code>${QA(e.value)}</code>`;case`strong`:return`<strong>${Vj(e.children,t)}</strong>`;case`emphasis`:return`<em>${Vj(e.children,t)}</em>`;case`strike`:return`<del>${Vj(e.children,t)}</del>`;case`footnoteReference`:return`<sup><a id="user-content-fnref-${$A(lj(e.id,e.referenceIndex))}" data-footnote-ref="" aria-describedby="footnote-label" href="#user-content-fn-${$A(e.id)}">${e.number}</a></sup>`;case`link`:return`<a href="${$A(e.href)}"${e.title?` title="${$A(e.title)}"`:``}>${Vj(e.children,t)}</a>`;case`image`:return`<img src="${$A(e.src)}" alt="${$A(e.alt)}"${e.title?` title="${$A(e.title)}"`:``}>`;case`break`:return`<br>`;case`inlineHtml`:return t.allowHtml?e.value:QA(e.value)}}function Vj(e,t){return e.map(e=>Bj(e,t)).join(``)}function Hj(e,t){let n=e.lang??`plaintext`,r=`class="tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}" data-lang="${$A(n)}"`+(e.title?` data-code-title="${$A(e.title)}"`:``)+(e.file?` data-filename="${$A(e.file)}"`:``)+(e.framework?` data-framework="${$A(e.framework)}"`:``),i=t.highlighter?.(e.value,n,{...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})??QA(e.value),a=`<pre ${r}><code class="language-${$A(n)}">${i}</code></pre>`;return e.title?`<figure class="tm-code-frame" data-lang="${$A(n)}"><figcaption>${QA(e.title)}</figcaption>${a}</figure>`:a}function Uj(e,t,n,r){let i=t===void 0?``:`<input type="checkbox" disabled${t?` checked`:``}> `;for(let t=0;t<e.length;t++){let a=e[t];a.type===`paragraph`&&(!n||t===0)?(i+=Vj(a.children,r),n&&(i=`<p>${i}</p>`)):i+=(t?`
1332
+ `:``)+zj(a,r)}return i}function Wj(e,t){let n=e.kind.toLowerCase(),r=e.children.map(e=>zj(e,t)).join(`
1333
+ `);return`<div class="markdown-alert markdown-alert-${$A(n)}"><p class="markdown-alert-title">${QA(e.title)}</p><div class="markdown-alert-content">${r}</div></div>`}function Gj(e,t){let n=e.map(e=>`<li id="user-content-fn-${$A(e.id)}">\n${Kj(e,t)}\n</li>`).join(`
1334
+ `);return`<section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes${Zj(`footnote-label`,t)}</h2>\n<ol>\n${n}\n</ol>\n</section>`}function Kj(e,t){let n=qj(e),r=e.children.length-1,i=e.children.map((e,i)=>i===r&&e.type===`paragraph`?`<p>${Vj(e.children,t)}${n}</p>`:zj(e,t));return e.children[r]?.type!==`paragraph`&&i.push(`<p>${n.trimStart()}</p>`),i.join(`
1335
+ `)}function qj(e){let t=``;for(let n=1;n<=(e.referenceCount??1);n++){let r=lj(e.id,n),i=n===1?`${e.number}`:`${e.number}-${n}`;t+=` <a data-footnote-backref="" aria-label="Back to reference ${i}" class="data-footnote-backref" href="#user-content-fnref-${$A(r)}">&#8617;</a>`}return t}function Jj(e,t){let n=e.tagName??`md-comment-component`;return`<${n}${Qj(e)}>${e.children.map(e=>zj(e,t)).join(`
1336
+ `)}</${n}>`}function Yj(e,t,n,r){return`<${e}${n?` style="text-align:${n}"`:``}>${Vj(t.children,r)}</${e}>`}function Xj(e,t){for(let n of t.extensions??[]){let r=n.renderHtml?.(e,{options:t,renderBlock:e=>zj(e,t),renderInline:e=>Bj(e,t)});if(r!==void 0)return r}}function Zj(e,t){let n=t.headingAnchors;if(!e||!n)return``;let r=typeof n==`object`?n:{};return`<a href="#${$A(e)}" aria-hidden="${r.ariaHidden??!0}" class="${$A(r.className??`anchor-heading anchor-heading-link`)}" tabindex="${r.tabIndex??-1}">${QA(r.content??`#`)}</a>`}function Qj(e){let t={...e.properties};return e.tagName||(t[`data-component`]=e.name,t[`data-attributes`]||=JSON.stringify(e.attributes)),Object.entries(t).map(([e,t])=>` ${e}="${$A(t)}"`).join(``)}function $j(e,t={}){return(typeof e==`string`?Tj(e,t):e).children.map((e,n)=>eM(e,t,`b:${n}`))}function eM(e,t={},n){switch(e.type){case`heading`:return lM(t,`h${e.depth}`,{key:n,...e.id?{id:e.id}:{},...e.framework?{"data-framework":e.framework}:{}},nM(e.children,t),dM(e.id,t));case`paragraph`:return lM(t,`p`,{key:n},nM(e.children,t));case`code`:return rM(e,t,n);case`list`:return lM(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start!==void 0&&e.start!==1?{start:e.start}:{}},e.items.map((n,r)=>lM(t,`li`,{key:r},iM(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return lM(t,`blockquote`,{key:n},e.children.map((e,r)=>eM(e,t,`${n}:${r}`)));case`table`:return lM(t,`table`,{key:n},lM(t,`thead`,null,lM(t,`tr`,null,e.header.map((n,r)=>aM(`th`,n,e.align[r],t,r)))),e.rows.length?lM(t,`tbody`,null,e.rows.map((n,r)=>lM(t,`tr`,{key:r},n.map((n,r)=>aM(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return oM(e.items,t,n);case`thematicBreak`:return lM(t,`hr`,{key:n});case`html`:return t.allowHtml?lM(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):lM(t,`p`,{key:n},e.value);case`callout`:return lM(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},lM(t,`p`,{className:`markdown-alert-title`},e.title),lM(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>eM(e,t,`${n}:${r}`))));case`component`:return uM(e,t,n)}}function tM(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return lM(t,`code`,{key:n},e.value);case`strong`:return lM(t,`strong`,{key:n},nM(e.children,t));case`emphasis`:return lM(t,`em`,{key:n},nM(e.children,t));case`strike`:return lM(t,`del`,{key:n},nM(e.children,t));case`footnoteReference`:return lM(t,`sup`,{key:n},lM(t,`a`,{id:`user-content-fnref-${lj(e.id,e.referenceIndex)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return lM(t,`a`,{key:n,href:e.href,...e.title?{title:e.title}:{}},nM(e.children,t));case`image`:return lM(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title?{title:e.title}:{}});case`break`:return lM(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?lM(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value}}function nM(e,t){return e.map((e,n)=>tM(e,t,`i:${n}`))}function rM(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=lM(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}:{}},lM(t,`code`,{...a,...s},o));return e.title?lM(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},lM(t,`figcaption`,null,e.title),c):lM(t,Z.Fragment,{key:n},c)}function iM(e,t,n,r,i){let a=t===void 0?[]:[lM(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 nM(o.children,r))a.push(e);n&&(a=[lM(r,`p`,{key:`${i}:paragraph`},a)])}else a.push(eM(o,r,`${i}:${t}`))}return a}function aM(e,t,n,r,i){return lM(r,e,{key:i,...n?{style:{textAlign:n}}:{}},nM(t.children,r))}function oM(e,t,n){return lM(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},lM(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,dM(`footnote-label`,t)),lM(t,`ol`,null,e.map(e=>lM(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},sM(e,t)))))}function sM(e,t){let n=e.children.length-1,r=cM(e,t),i=e.children.map((e,i)=>i===n&&e.type===`paragraph`?lM(t,`p`,{key:i},nM(e.children,t),r):eM(e,t,`${i}`));return e.children[n]?.type!==`paragraph`&&i.push(lM(t,`p`,{key:`backref-wrapper`},r.slice(1))),i}function cM(e,t){let n=[];for(let r=1;r<=(e.referenceCount??1);r++){let i=lj(e.id,r),a=r===1?`${e.number}`:`${e.number}-${r}`;n.push(` `,lM(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 lM(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,Z.createElement)(i,n,...r)}function uM(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)),lM(t,r,{key:n,...i},e.children.map((e,r)=>eM(e,t,`${n}:${r}`)))}function dM(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return lM(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}function fM(e){try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`||t.protocol===`mailto:`)&&t.username===``&&t.password===``}catch{return!1}}var pM=new Set(`details.summary.img.br.p.div.span.strong.b.em.i.del.s.a.ul.ol.li.blockquote.pre.code.h1.h2.h3.h4.h5.h6.table.thead.tbody.tr.th.td.hr.sup.sub.kbd.input`.split(`.`)),mM=new Set([`script`,`style`,`iframe`,`object`,`embed`,`svg`,`math`,`template`]);function hM(e,t){let n=new DOMParser().parseFromString(Rj(e,{allowHtml:!0}),`text/html`),r=e=>Array.from(e.childNodes,(e,t)=>i(e,t)),i=(e,n)=>{if(e.nodeType===Node.TEXT_NODE){let n=e.textContent??``;return e.parentElement?.tagName===`DETAILS`&&n.trim()?$j(n,{components:t}):n}if(!(e instanceof Element))return null;let i=e.tagName.toLowerCase();if(mM.has(i))return null;if(!pM.has(i))return r(e);let a={key:n};if(i===`input`){if(e.getAttribute(`type`)!==`checkbox`)return null;a.type=`checkbox`,a.disabled=!0,a.checked=e.hasAttribute(`checked`)}i===`ol`&&/^\d+$/.test(e.getAttribute(`start`)??``)&&(a.start=Number(e.getAttribute(`start`)));let o=e.getAttribute(`id`);if(o&&/^[A-Za-z][\w:.-]*$/.test(o)&&(a.id=o),i===`img`&&(a.src=e.getAttribute(`src`)??``,a.alt=e.getAttribute(`alt`)??``),i===`a`){let t=e.getAttribute(`href`)??``;(fM(t)||/^(?:#[^\s]*|\/(?![/\\])[^\s]*)$/.test(t))&&(a.href=t)}return i===`pre`&&(a[`data-lang`]=e.getAttribute(`data-lang`)??`text`),(0,Z.createElement)(t[i]??i,a,...[`img`,`br`,`hr`,`input`].includes(i)?[]:r(e))};return r(n.body)}function gM([e,t]){return{result:e,send:(e,n)=>{t(e).then(e=>{oe(e)&&n?.()})},reset:()=>{t(Er)}}}var _M={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 vM(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(vM).join(``):(0,Z.isValidElement)(e)?vM(e.props.children):``}function yM(e){let t=(0,$.c)(11),{dark:n}=Gc(),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=vM(Z.Children.toArray(e.children)).replace(n,``),t[0]=e.children,t[1]=i}else i=t[1];let a=i,o=`snippet.${_M[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=ql(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)(YA,{file:s,options:l})}),t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function bM(e){let t=(0,$.c)(8),{src:n,alt:r}=e,[i,a]=(0,Z.useState)();if(!n||!fM(n)||i===n){let e=r?`: ${r}`:``,n;return t[0]===e?n=t[1]:(n=(0,Q.jsxs)(`span`,{className:`inline-block rounded border px-2 py-1 text-caption text-muted-foreground`,children:[`Image unavailable`,e]}),t[0]=e,t[1]=n),n}let o=r??``,s;t[2]===n?s=t[3]:(s=()=>a(n),t[2]=n,t[3]=s);let c;return t[4]!==n||t[5]!==o||t[6]!==s?(c=(0,Q.jsx)(`img`,{src:n,alt:o,className:`my-2 h-auto max-w-full rounded`,referrerPolicy:`no-referrer`,onError:s}),t[4]=n,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}var xM={img:bM,details:e=>(0,Q.jsx)(`details`,{className:`my-3 rounded border p-3`,...e}),summary:e=>(0,Q.jsx)(`summary`,{className:`cursor-pointer font-medium`,...e}),pre:yM,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 SM(e){let t=(0,$.c)(7),{text:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Y(`text-ui text-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=hM(n,xM),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 CM=Ha(e=>Zr(t=>e.paths.map(n=>t(O({...e,path:n}))))),wM=Ha(e=>Hr((t,n)=>{for(let t of e.paths)n.refresh(O({...e,path:t}));return null}));function TM(e,t,n){let r=(0,$.c)(14),i={connection:e,scope:t,paths:n},a=Yr(CM(i)),o=fa(wM(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?Vn(Dn(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(De),r[5]=a,r[6]=c);let l;r[7]===a?l=r[8]:(l=a.some(q),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 EM=(0,Z.lazy)(()=>pd(()=>import(`./file-editor-B_jE48tv.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])));function DM(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)(EM,{...e})}),t[1]=e,t[2]=r),r}var OM=/url\(\s*(['"]?)([^)'"]+)\1\s*\)|@import\s+(['"])([^'"]+)\3/g,kM=`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 AM(e){let t=window.document.implementation.createHTMLDocument(),n=t.createElement(`meta`);n.httpEquiv=`Content-Security-Policy`,n.content=kM;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 jM=Oa(`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(OM)){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]))}`:Ow(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(OM)){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 MM(e.getAttribute(`srcset`)??``))y(t.url);for(let e of _)v.push(...u(e.tagName===`STYLE`?e.textContent??``:e.getAttribute(`style`)??``,t));s=yield*yo(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`,MM(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=kM,m.head.prepend(b),{html:`<!doctype html>${m.documentElement.outerHTML}`,missing:[...o]}});function MM(e){return[...e.matchAll(/(data:[^\s]+|[^,\s]+)(?:\s+(\d+(?:\.\d+)?[wx]))?\s*,?/g)].map(e=>({url:(e[1]??``).replace(/,$/,``),descriptor:e[2]??``}))}var NM=ta(Or,{render:(e,t,n)=>jM(e,t,n).pipe(Go(()=>vi(new Ga)))});function PM(e){let t=(0,$.c)(11),{html:n,title:r,className:i}=e,{dark:a}=Gc(),o;t[0]===n?o=t[1]:(o=AM(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=Y(`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 FM(e){let t=(0,$.c)(14),{scope:n,path:r,html:i,connection:a}=e,o=Aw(a,n,r,i,NM);if(De(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(q(o)){let e;t[1]===o.cause?e=t[2]:(e=Vs(Yt(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=Cn(Dn(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)(PM,{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 IM(e,t,n){let r=(0,$.c)(4),i;return r[0]!==e||r[1]!==n||r[2]!==t?(i=ls({connection:e,scope:t,path:n}),r[0]=e,r[1]=n,r[2]=t,r[3]=i):i=r[3],vu(i).value}function LM(e,t,n){let r=(0,$.c)(9),i={connection:e,scope:t,paths:n},a=Yr(Fr(i)),o=fa(nn(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(q(e))return{path:r,status:`unavailable`};let i=Vn(Dn(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 RM(e){return on(`alert-dialog`,e)}var zM=Om,BM=class extends km{};function VM(){return new BM}function HM({...e}){return(0,Q.jsx)(RM,{"data-slot":`alert-dialog`,...e})}function UM({...e}){return(0,Q.jsx)(zM,{"data-slot":`alert-dialog-trigger`,...e})}function WM({...e}){return(0,Q.jsx)(M,{"data-slot":`alert-dialog-portal`,...e})}function GM({className:e,...t}){return(0,Q.jsx)(Ji,{"data-slot":`alert-dialog-overlay`,className:Y(`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 KM({className:e,size:t=`default`,...n}){return(0,Q.jsxs)(WM,{children:[(0,Q.jsx)(GM,{}),(0,Q.jsx)(yt,{"data-slot":`alert-dialog-content`,"data-size":t,className:Y(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-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 qM({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:Y(`grid grid-rows-[auto_1fr] place-items-center gap-1 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 JM({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:Y(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function YM({className:e,...t}){return(0,Q.jsx)(C,{"data-slot":`alert-dialog-title`,className:Y(`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 XM({className:e,...t}){return(0,Q.jsx)(na,{"data-slot":`alert-dialog-description`,className:Y(`text-xs/relaxed text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function ZM({className:e,...t}){return(0,Q.jsx)(X,{"data-slot":`alert-dialog-action`,className:Y(e),...t})}function QM({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,Q.jsx)(l,{"data-slot":`alert-dialog-cancel`,className:Y(e),render:(0,Q.jsx)(X,{variant:t,size:n}),...r})}var $M=`160000`;function eN(e){return e.oldMode===$M||e.newMode===$M}function tN(e){return e.kind===`text`||e.kind===`metadata-only`}function nN(e,t){return eN(e)||t?.kind!==`text`?null:e.newPath??e.oldPath??null}function rN(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 iN(e){switch(e.kind){case`binary`:return`Binary change`;case`metadata-only`:return`No code change`;case`omitted`:return rN(e.reason);case`text`:return}}function aN(e,t,n){return eN(e)?`Submodule change`:t===void 0?n?`The patch could not be read`:`Reading the patch`:iN(t)}function oN(e){return e.scope===`staged`||e.scope===`unstaged`?{scope:e.scope,oldPath:e.oldPath,newPath:e.newPath}:void 0}var sN=/(?=^From [a-f0-9]+ .+$)/m,cN=/(?=^diff --git)/gm,lN=/^(---|\+\+\+)\s+([^\t\r\n]+)/,uN=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;Object.freeze({fromStart:0,fromEnd:0}),Object.freeze([]);function dN(e,t){return e-(t===0?0:1)}function fN(e,t){return dN(e,t)+t}var pN=1;function mN(e,...t){return`ck${pN}:${JSON.stringify([e,...t])}`}function hN(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var gN=new TextEncoder,_N=new TextDecoder(`utf-8`,{ignoreBOM:!0}),vN=/[\uD800-\uDFFF]/,yN=1024,bN=new Uint8Array(yN);function xN(){bN.length!==yN&&(bN=new Uint8Array(yN))}function SN(e){if(e.length===0)return e;if(vN.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;bN.length<t&&(bN=new Uint8Array(t));let{written:n}=gN.encodeInto(e,bN);return _N.decode(bN.subarray(0,n))}var CN=new TextDecoder(`utf-8`,{ignoreBOM:!0}),wN={'"':`"`,"\\":`\\`,a:`\x07`,b:`\b`,t:` `,n:`
1337
+ `,v:`\v`,f:`\f`,r:`\r`};function TN(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=wN[e[n+1]];if(i!=null){t+=i,n+=2;continue}let a=[];do{let t=EN(e,n+1);if(t==null)return;a.push(t),n+=4}while(e[n]===`\\`&&e[n+1]>=`0`&&e[n+1]<=`7`);t+=CN.decode(new Uint8Array(a))}}function EN(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 DN=4096,ON=.5;function kN(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=AN(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}}function AN(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)>DN)return null;let c=[];for(let t=0;t<n;t++)c.push(MN(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(MN(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+=NN(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*ON: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 jN=/\s+/g;function MN(e){return e.replace(jN,``)}function NN(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 PN=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function FN(e,t,n=!1,r){let i=$N(e),a=i?HN(e):UN(e),o,s=[];for(let e of a){if(i&&!cN.test(e)){if(o==null)o=SN(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!WN(e)){if(o==null)o=SN(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=IN(e,{cacheKey:t==null?void 0:r==null?mN(`patch-file`,t,String(s.length)):mN(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function IN(e,{cacheKey:t,isGitDiff:n=cN.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=eP(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=VN(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=XN(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?BN(i.contents):[],deletionLines:!l&&r!=null&&i!=null?BN(r.contents):[],additionCharacterCount:!l&&r!=null&&i!=null?i.contents.length:0,deletionCharacterCount:!l&&r!=null&&i!=null?r.contents.length:0,cacheKey:nP(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(PN);if(t==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}let n=RN(t[1],!0),r=RN(t[2],!0);c.name=SN(r),n!==r&&(c.prevName=SN(n));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(lN):null;if(t!=null){let[,e,r]=t,i=RN(r,n);if(e===`---`&&i!==`/dev/null`){let e=SN(i);c.prevName=e,c.name=e}else e===`+++`&&i!==`/dev/null`&&(c.name=SN(i))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=SN(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=SN(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=SN(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=SN(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(uN)??[];t!=null&&(c.prevObjectId=SN(t)),n!=null&&(c.newObjectId=SN(n)),r!=null&&(c.mode=SN(r))}(e.startsWith(`rename from `)||e.startsWith(`copy from `))&&(c.prevName=SN(RN(e.slice(e.startsWith(`rename`)?12:10)))),(e.startsWith(`rename to `)||e.startsWith(`copy to `))&&(c.name=SN(RN(e.slice(e.startsWith(`rename`)?10:8))))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
1338
+ `||s[s.length-1]===`\r`||s[s.length-1]===`\r
1339
+ `||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:nP(p.hunkContext),hunkSpecs:SN(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(!JN(t)||YN(t))break;if(a)throw Error(`parsePatchContent: hunk has more lines than expected`)}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=rP(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=iP(t);(g==null||g.type!==`change`)&&(g=aP(`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=iP(t);(g==null||g.type!==`change`)&&(g=aP(`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=iP(t);(g==null||g.type!==`context`)&&(g=aP(`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=hN(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=hN(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=dN(b.additionStart,b.additionCount)+(x===0?0:1),t=dN(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(dN(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=fN(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=fN(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),kN(c),c}}function LN(e,t,n=!1){let r=[],i=zN(e)?e.split(sN):[e];for(let e of i)try{r.push(FN(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{xN()}return r}function RN(e,t=!1){let n=e.trim(),r=n.startsWith(`"`)?TN(n)?.fileName??n:n;return t&&(r.startsWith(`a/`)||r.startsWith(`b/`))?r.slice(2):r}function zN(e){return e.startsWith(`From `)||e.includes(`
1340
+ From `)}function BN(e){let t=VN(e);for(let e=0;e<t.length;e++)t[e]=SN(t[e]);return t}function VN(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
1341
+ `,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 HN(e){return eP(e,`diff --git`)}function UN(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=qN(e,r);if(i<=0&&a<=0){if(GN(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=qN(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=XN(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 WN(e){return GN(e,0)}function GN(e,t){let n=qN(e,t);return KN(e,t,`---`)&&KN(e,n,`+++`)}function KN(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===`
1342
+ `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function qN(e,t){let n=e.indexOf(`
1343
+ `,t);return n===-1?e.length:n+1}function JN(e){let t=e[0];return t===`+`||t===`-`||t===` `}function YN(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
1344
+ `&&n!==`\r`)return!1}return!0}function XN(e){if(!e.startsWith(`@@ -`))return;let t=4,n=ZN(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=ZN(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=ZN(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=ZN(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=QN(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function ZN(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 QN(e){return e.endsWith(`\r
1345
+ `)?e.slice(0,-2):e.endsWith(`
1346
+ `)?e.slice(0,-1):e}function $N(e){return e.startsWith(`diff --git`)||e.includes(`
1347
+ diff --git`)}function eP(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:tP(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=tP(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function tP(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function nP(e){return e==null?e:SN(e)}function rP(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function iP(e){let t=e.slice(1);return SN(t===``?`
1348
+ `:t)}function aP(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 oP(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===``?`
1349
+ `:n,type:t===` `?`context`:t===`\\`?`metadata`:t===`+`?`addition`:`deletion`}}function sP(e){if(e.trim()===``)return{kind:`empty`};let t=e.split(`
1350
+ `);t.at(-1)===``&&t.pop();let n=t.findIndex(e=>e.startsWith(`@@`));if(n<0)return{kind:`invalid`};try{let r=LN(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=oP(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=oP(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 cP=(e,t,n,r)=>`@@ -${t===0?e-1:e},${t} +${r===0?n-1:n},${r} @@`;function lP(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[cP(t.oldLine,n,t.newLine,r),...e.map(e=>e.text)]}function uP(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 dP(e,t,n=3){let r=sP(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(...lP(t)),t=[])}t.length>0&&s.push(...lP(t))}return s.length===i.length?null:`${s.join(`
1351
+ `)}\n`}function fP(e){return`path`in e?e.path:e.newPath??e.oldPath??``}function pP(e){return`${e.scope}\n${e.oldPath}\n${e.newPath}`}function mP(e){return`change:${e.scope}:${fP(e)}`}function hP(e){return e.mergeBaseOid===null||e.mergeBaseOid===void 0?null:{baseOid:e.mergeBaseOid,headOid:e.head.oid}}function gP(e){return e instanceof Error&&(e.name===`RequestError`||e.name===`ConnectionError`)?e.message:`The branch could not be compared. Try again.`}function _P(e){let t=new Map;for(let n of e){let e=fP(n);t.has(e)||t.set(e,{path:e,paths:[e],kind:`kind`in n?n.kind:`changed`})}return[...t.values()]}var vP=e=>e.newPath??e.oldPath??``;function yP(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(vP(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)=>pP(e).localeCompare(pP(t))))}return a.push(o),a}function bP(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}var xP=Ha(e=>gn(e,[`branch`,e.base??null],t=>t.changes.readBranchChanges({params:{worktreeId:e.scope.worktreeId},query:{base:e.base}}),t=>t.worktreeId===e.scope.worktreeId)),SP=Ha(e=>gn(e,[`branch-bases`],t=>t.changes.listBranchBases({params:{worktreeId:e.scope.worktreeId}}))),CP=Ha(({connection:e,scope:t,input:n})=>He(e,t,[`change-diffs`,n],ki(function*(){let r=yield*(yield*Ti(e)).request(e=>e.changes.readChangeDiffs({params:{worktreeId:t.worktreeId},payload:n}));return yield*eo(e,r.environmentId===e.environmentId&&r.worktreeId===t.worktreeId&&r.statusToken===n.expectedStatusToken),r}),Pi(e),n.expectedFiles.map(e=>e.path))),wP=Ha(({connection:e,scope:t,input:n})=>He(e,t,[`branch-diffs`,n],ki(function*(){return yield*(yield*Ti(e)).request(e=>e.changes.readBranchDiffs({params:{worktreeId:t.worktreeId},payload:n}))}),Pi(e))),TP=Ha(({connection:e,scope:t,oid:n,parent:r,paths:i})=>He(e,t,[`commit-diffs`,n,r,i],ki(function*(){let a=yield*(yield*Ti(e)).request(e=>e.changes.readCommitDiffs({params:{worktreeId:t.worktreeId,oid:n},payload:{...r===1?{}:{parent:r},paths:i.map(e=>[...e])}}));return yield*eo(e,a.commitOid===n),a}),Pi(e)));function EP(e){return new Map(e.diffs.map(e=>[`selection`in e?pP(e.selection):e.paths.join(`\0`),e.content]))}var DP=Ha(e=>Qa(t=>e.map(e=>Cs(t(e),EP)),t=>{for(let n of e)t(n)})),OP=Ha(e=>Zr(t=>Zo(Ri(e,e=>Zo(t.result(e,{suspendOnWaiting:!0}),EP),{concurrency:`unbounded`}),e=>new Map(e.flatMap(e=>[...e])))).pipe(gr(0)));function kP(e,t){return St(t.map(t=>Qr.reviewSurface(e.connection.environmentId,e.scope,[t])))}var AP=Ha(e=>Pi(e.connection).fn(Oa(`Changes.readCurrent`)(t=>ee(Ze(e),()=>kP(e,[`changes`]))))),jP=Ha(e=>Pi(e.connection).fn(Oa(`Changes.refreshGitLook`)(t=>ee(Ze(e),()=>kP(e,[`changes`,`git-status`]))))),MP=Ha(e=>Pi(e.connection).fn(Oa(`Changes.readCurrentGitStatus`)(t=>ee(xs(e),()=>kP(e,[`git-status`]))))),NP=class e extends S()(`@porcelain/client/ChangedDiffRecovery`){static layer=la(e,ki(function*(){let e=yield*ts({attempted:{},pending:{}});return{state:E(e),changes:en(e),begin:Oa(`ChangedDiffRecovery.begin`)((t,n)=>ln(e,e=>e.attempted[t]===n?[!1,e]:[!0,{attempted:{...e.attempted,[t]:n},pending:{...e.pending,[t]:n}}])),finish:Oa(`ChangedDiffRecovery.finish`)((t,n)=>U(e,e=>{if(e.pending[t]!==n)return e;let r={...e.pending};return delete r[t],{...e,pending:r}}))}}))},PP=Ha(e=>e.atoms(t=>h(NP.layer,t(Pi(e).layer)))),FP=Ha(e=>PP(e.connection).fn(Oa(`Changes.recoverDiffs`)(function*(t,n){let r=yield*NP,i=JSON.stringify([e.scope.projectId,e.scope.worktreeId]);if(!(yield*r.begin(i,t)))return;let a=Te(e);return n.refresh(a),yield*ni(n.result(a,{suspendOnWaiting:!0}),r.finish(i,t))}),{concurrent:!0})),IP=Ha(({connection:e,scope:t,statusToken:n})=>PP(e).atom(Zi(Zo(NP,e=>e.changes)).pipe(ia(e=>{let r=JSON.stringify([t.projectId,t.worktreeId]);return{pending:e.pending[r]===n,attempted:e.attempted[r]===n}})))),LP=Ha(e=>{let{connection:t,scope:n,statusToken:r}=e,i=yP(e.expectedFiles,e.selections,200).map(e=>CP({connection:t,scope:n,input:{expectedStatusToken:r,expectedFiles:e.expectedFiles,selections:e.selections}})),a=DP(i),o=OP(i),s=FP({connection:t,scope:n});return Qa(t=>{t.mount(s);let n=t(a),i=t(IP(e));return $e(i)&&!i.value.attempted&&n.some(e=>q(e)&&wa(Yt(e.cause)))&&t.set(s,r),{result:t(o),recovery:i}},e=>e(a)).pipe(gr(0))});function RP(e,t){let n=(0,$.c)(3),r;return n[0]!==t||n[1]!==e?(r=Te({scope:e,connection:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],vu(r).value}function zP(e,t){let n=(0,$.c)(3),r;return n[0]!==t||n[1]!==e?(r=Te({scope:e,connection:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],Yr(r)}function BP(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=LP({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}=Yr(s),u;a[6]===l?u=a[7]:(u=Nn(Dn(l),VP),a[6]=l,a[7]=u);let d=u,f;a[8]===c?f=a[9]:(f=$e(c)?c.value:new Map,a[8]=c,a[9]=f);let p;a[10]!==d||a[11]!==c?(p=De(c)||d,a[10]=d,a[11]=c,a[12]=p):p=a[12];let m;a[13]!==d||a[14]!==c?(m=q(c)&&!d,a[13]=d,a[14]=c,a[15]=m):m=a[15];let h=Br(s),g;return a[16]!==f||a[17]!==p||a[18]!==m||a[19]!==h?(g={diffs:f,pending:p,failed:m,retry:h},a[16]=f,a[17]=p,a[18]=m,a[19]=h,a[20]=g):g=a[20],g}function VP(e){return e.pending}var HP=Zr(Ot());function UP(e,t,n){let r=(0,$.c)(11),i=n===void 0||n,a;r[0]!==t||r[1]!==e?(a=Ut({connection:t,scope:e}),r[0]=t,r[1]=e,r[2]=a):a=r[2];let o=a,s=Yr(i?o:HP),c;r[3]!==t||r[4]!==e?(c=MP({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=fa(c,l),d=Br(i?o:HP),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 WP(e,t){if(!tN(t))return null;let n=ku(t.patch),r=ED(t.patch,`${mP(e)}:${n}`).flatMap(e=>e.files),i=r.length===1?r[0]:void 0;return i?{id:mP(e),kind:`diff`,path:fP(e),fileDiff:i,version:n,note:`${e.scope} · ${e.kind}`}:null}function GP(e,t,n){let r=nN(t,n);if(!r||n?.kind!==`text`)return null;let i=ku(n.patch),a=ED(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 KP(e,t){let n=(0,$.c)(4),r;n[0]!==t||n[1]!==e?(r=AP({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],fa(r,i)}function qP(e,t){let n=(0,$.c)(4),r;n[0]!==t||n[1]!==e?(r=jP({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],fa(r,i)}function JP(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=DP(e),t[0]=e,t[1]=n);let r=n,i=Yr(r),a=Br(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 YP(e){let t=(0,$.c)(11),n=JP(e),r;t[0]===n.results?r=t[1]:(r=new Map(n.results.flatMap(XP)),t[0]=n.results,t[1]=r);let i;t[2]===n.results?i=t[3]:(i=n.results.some(De),t[2]=n.results,t[3]=i);let a;t[4]===n.results?a=t[5]:(a=n.results.some(q),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 XP(e){return Jn(Dn(e)).flatMap(ZP)}function ZP(e){return[...e]}var QP=Zr(Ot()),$P=Zr(Ot());function eF(e,t,n){let r=(0,$.c)(7),i;r[0]!==n||r[1]!==t||r[2]!==e?(i=e?xP({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=Yr(a),s=Br(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 tF(e,t,n){let r=(0,$.c)(7),i;r[0]!==t||r[1]!==n||r[2]!==e?(i=n?SP({connection:t,scope:e}):QP,r[0]=t,r[1]=n,r[2]=e,r[3]=i):i=r[3];let a=i,o=Yr(a),s=Br(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 nF(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?bP(r,25).map(r=>wP({connection:t,scope:e,input:{baseOid:n.baseOid,headOid:n.headOid,paths:r.map(rF)}})):[],i[0]=t,i[1]=r,i[2]=n,i[3]=e,i[4]=a):a=i[4],YP(a)}function rF(e){return[...e]}function iF(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=>TP({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=bP(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 YP(o)}function aF(e,t){let n=(0,$.c)(7),r;n[0]!==e||n[1]!==t?(r=Fe({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]=wr(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 oF(e,t){let n=(0,$.c)(5),r=aF(e,t),i;n[0]===r?i=n[1]:(i=e=>r.submit({path:Ol(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 sF(e,t){let n=(0,$.c)(5),r=aF(e,t),i;n[0]===r?i=n[1]:(i=e=>r.submit({path:Ol(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 cF=Zr(void 0);function lF(e,t,n,r){let i=(0,$.c)(13),a;i[0]===e?a=i[1]:(a=_(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]=wr(a,o),l=fa(cF),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=>z({try:()=>r(e),catch:uF})})},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 uF(e){return new lt({message:`Could not open the selected worktree.`,cause:e})}function dF(){let e=(0,$.c)(2),t=fa(cF),n;return e[0]===t?n=e[1]:(n=e=>{e||t(void 0)},e[0]=t,e[1]=n),n}var fF=Ci(I.layer).atom(I),pF=Ha(e=>e.atoms(I.layer).fn((t,n)=>ki(function*(){let r=yield*(yield*I).pickProject(e.address);r!==null&&(yield*n.setResult(_(e),{path:r,remote:null,complete:()=>void 0,select:e=>z({try:()=>t(e),catch:e=>new lt({message:`Could not open the selected worktree.`,cause:e})})}))})));function mF(e,t,n){let r=(0,$.c)(3),i=Vn(Dn(Yr(fF))),a;r[0]===e?a=r[1]:(a=pF(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]=wr(a,o);return i?.canPickProject(e.address)&&(()=>{s.waiting||c(t).then(e=>{if(Nt(e)){let t=Yt(e.cause);n(t instanceof Error?t:new lt({message:`Could not open the selected worktree.`,cause:t}))}})})}var hF=Am(),gF=Am(),_F=VM(),vF=VM(),yF=VM(),bF=Am();function xF(e,t){let n=(0,$.c)(6),r;n[0]!==e||n[1]!==t?(r=ge({connection:e,projectId:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a=Yr(i),o=Br(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 SF(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=ge({connection:e,projectId:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],vu(r).value}function CF(e,t){let n=(0,$.c)(2),r=SF(e,t),i;return n[0]===r.preferences?i=n[1]:(i=new Set(r.preferences.filter(TF).map(wF)),n[0]=r.preferences,n[1]=i),i}function wF(e){return e.path}function TF(e){return e.hidden}function EF(e,t){let n=(0,$.c)(2),r=SF(e,t),i;return n[0]===r.preferences?i=n[1]:(i=r.preferences.filter(OF).map(DF),n[0]=r.preferences,n[1]=i),i}function DF(e){return e.path}function OF(e){return e.pinned}function kF(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=Oo(e),t[0]=e,t[1]=n),vu(n).value}function AF({...e}){return(0,Q.jsx)(Qo,{"data-slot":`dialog`,...e})}function jF({...e}){return(0,Q.jsx)(Om,{"data-slot":`dialog-trigger`,...e})}function MF({...e}){return(0,Q.jsx)(M,{"data-slot":`dialog-portal`,...e})}function NF({...e}){return(0,Q.jsx)(l,{"data-slot":`dialog-close`,...e})}function PF({className:e,...t}){return(0,Q.jsx)(Ji,{"data-slot":`dialog-overlay`,className:Y(`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 FF({className:e,children:t,showCloseButton:n=!0,...r}){return(0,Q.jsxs)(MF,{children:[(0,Q.jsx)(PF,{}),(0,Q.jsxs)(yt,{"data-slot":`dialog-content`,className:Y(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-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)(X,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,Q.jsx)(kn,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function IF({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`dialog-header`,className:Y(`flex flex-col gap-1`,e),...t})}function LF({className:e,showCloseButton:t=!1,children:n,...r}){return(0,Q.jsxs)(`div`,{"data-slot":`dialog-footer`,className:Y(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,Q.jsx)(l,{render:(0,Q.jsx)(X,{variant:`outline`}),children:`Close`})]})}function RF({className:e,...t}){return(0,Q.jsx)(C,{"data-slot":`dialog-title`,className:Y(`font-heading text-sm font-medium`,e),...t})}function zF({className:e,...t}){return(0,Q.jsx)(na,{"data-slot":`dialog-description`,className:Y(`text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var BF=Z.createContext(void 0);function VF(){let e=Z.useContext(BF);if(e===void 0)throw Error(s(53));return e}function HF(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 UF=`data-has-overflow-x`,WF=`data-has-overflow-y`,GF=`data-overflow-x-start`,KF=`data-overflow-x-end`,qF=`data-overflow-y-start`,JF=`data-overflow-y-end`,YF=e=>t=>t?{[e]:``}:null,XF={hasOverflowX:YF(UF),hasOverflowY:YF(WF),overflowXStart:YF(GF),overflowXEnd:YF(KF),overflowYStart:YF(qF),overflowYEnd:YF(JF),cornerHidden:()=>null},ZF=`--scroll-area-corner-height`,QF=`--scroll-area-corner-width`,$F=`data-orientation`,eI={x:0,y:0},tI={width:0,height:0},nI={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},rI={x:!0,y:!0,corner:!0},iI=Z.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=aI(i),d=b(),f=J(),p=J(),{nonce:m,disableStyleElements:h}=Ar(),[g,_]=Z.useState(!1),[v,y]=Z.useState(!1),[x,S]=Z.useState(!1),[C,w]=Z.useState(!1),[T,E]=Z.useState(!1),[D,O]=Z.useState(tI),[k,A]=Z.useState(tI),[j,M]=Z.useState(nI),[N,P]=Z.useState(rI),F=Z.useRef(null),I=Z.useRef(null),R=Z.useRef(null),z=Z.useRef(null),B=Z.useRef(null),V=Z.useRef(null),H=Z.useRef(null),U=Z.useRef(null),W=Z.useRef(0),G=Z.useRef(0),K=Z.useRef(0),ee=Z.useRef(0),te=Z.useRef(`vertical`),q=Z.useRef(eI),ne=Z.useRef(null);function re(e){let t=e?S:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let ie=dr(e=>{let t=e.x-q.current.x,n=e.y-q.current.y;q.current=e,n!==0&&re(!0),t!==0&&re(!1)}),ae=dr(()=>{let e=I.current;e&&ne.current===null&&(ne.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),oe=dr(e=>{if(e.button!==0||U.current!==null&&(te.current===`vertical`?B.current:V.current)?.hasPointerCapture(U.current))return;U.current=e.pointerId,W.current=e.clientY,G.current=e.clientX,te.current=e.currentTarget.getAttribute($F);let t=I.current;t&&(K.current=t.scrollTop,ee.current=t.scrollLeft,ae()),(te.current===`vertical`?B.current:V.current)?.setPointerCapture(e.pointerId)}),se=dr(e=>{if(e.pointerId!==U.current)return;U.current=null,(te.current===`vertical`?S:y)(!1),ne.current!==null&&(I.current&&(I.current.style.scrollSnapType=ne.current),ne.current=null);let t=te.current===`vertical`?B.current:V.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),ce=dr(e=>{if(e.pointerId!==U.current)return;if(e.buttons%2==0){se(e);return}let t=I.current;if(!t)return;let n=te.current===`vertical`,r=n?B.current:V.current,i=n?R.current:z.current;if(!r||!i)return;let a=n?`y`:`x`,o=HF(i,`padding`,a),s=HF(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-W.current:e.clientX-G.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?K.current:ee.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),re(n)});function le(e){w(e.pointerType===`touch`)}function ue(e){if(le(e),e.pointerType!==`touch`){let t=jn(F.current,e.target);_(t)}}let de=Z.useMemo(()=>({scrolling:v||x,hasOverflowX:!N.x,hasOverflowY:!N.y,overflowXStart:j.xStart,overflowXEnd:j.xEnd,overflowYStart:j.yStart,overflowYEnd:j.yEnd,cornerHidden:N.corner}),[v,x,N.x,N.y,N.corner,j]),fe={role:`presentation`,onPointerEnter:ue,onPointerMove:ue,onPointerDown:le,onPointerLeave(){_(!1)},style:{position:`relative`,[ZF]:`${D.height}px`,[QF]:`${D.width}px`}},pe=L(`div`,e,{state:de,ref:[t,F],props:[fe,o],stateAttributesMapping:XF}),me=Z.useMemo(()=>({handlePointerDown:oe,handlePointerMove:ce,handlePointerUp:se,handleScroll:ie,disableViewportSnap:ae,cornerSize:D,setCornerSize:O,thumbSize:k,setThumbSize:A,hasMeasuredScrollbar:T,setHasMeasuredScrollbar:E,touchModality:C,cornerRef:H,scrollingX:v,scrollingY:x,hovering:g,setHovering:_,viewportRef:I,scrollbarYRef:R,scrollbarXRef:z,thumbYRef:B,thumbXRef:V,rootId:d,hiddenState:N,setHiddenState:P,overflowEdges:j,setOverflowEdges:M,viewportState:de,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[oe,ce,se,ie,ae,D,k,T,C,v,x,g,d,N,j,de,s,c,l,u]);return(0,Q.jsxs)(BF.Provider,{value:me,children:[!h&&Ka.getElement(m),pe]})});function aI(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 oI=Z.createContext(void 0),sI=`--scroll-area-overflow-x-start`,cI=`--scroll-area-overflow-x-end`,lI=`--scroll-area-overflow-y-start`,uI=`--scroll-area-overflow-y-end`,dI=`--scroll-area-thumb-height`,fI=`--scroll-area-thumb-width`,pI=[sI,cI,lI,uI],mI=!1;function hI(){mI||xn||(typeof CSS<`u`&&`registerProperty`in CSS&&pI.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),mI=!0)}var gI=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}=VF(),T=ko(),E=Z.useRef(!0),D=Z.useRef([NaN,NaN,NaN,NaN]),O=J(),k=J(),A=dr(()=>{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=_I(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=Ao(T===`rtl`?-w:w,P),L=P-I);let R=A?0:Ao(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=HF(n,`padding`,`x`),te=HF(t,`padding`,`y`),q=HF(i,`margin`,`x`),ne=HF(r,`margin`,`y`),re=B-ee-q,ie=V-te-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=>vI(e,{width:se,height:ce})),t&&r){let e=yI(r,dI,x,F,h,ce,t.offsetHeight-ce-te-ne);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-se-ee-q,t=yI(i,fI,T===`rtl`?-w:w,P,_,se,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let le=[I,L,R,z];pI.forEach((t,n)=>{e.style.setProperty(t,`${le[n]}px`)}),a&&p(e=>vI(e,{width:H,height:U})),g(e=>vI(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=>vI(e,ue))});ii(()=>{hI()},[]),ii(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),ii(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),ii(()=>{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:Ka.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=L(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:XF}),P=Z.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,Q.jsx)(oI.Provider,{value:P,children:N})});function _I(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function vI(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function yI(e,t,n,r,i,a,o){let s=us(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 bI=Z.createContext(void 0);function xI(){let e=Z.useContext(bI);if(e===void 0)throw Error(s(54));return e}var SI=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}=VF(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=ko(),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 qe(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=xe(e.nativeEvent),n=T?h.current:g.current;if(n&&jn(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=HF(n,`margin`,a),s=HF(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(${ZF})`,insetInlineEnd:0,[dI]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${QF})`,bottom:0,[fI]:`${S.width}px`}}},M=L(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:XF});return A?(0,Q.jsx)(bI.Provider,{value:i,children:M}):null}),CI=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}=VF(),m=xI(),h=m===`vertical`;return L(`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]})}),wI=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=VF(),l=L(`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 TI({className:e,children:t,...n}){return(0,Q.jsxs)(iI,{"data-slot":`scroll-area`,className:Y(`relative`,e),...n,children:[(0,Q.jsx)(gI,{"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)(EI,{}),(0,Q.jsx)(wI,{})]})}function EI({className:e,orientation:t=`vertical`,...n}){return(0,Q.jsx)(SI,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:Y(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,Q.jsx)(CI,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}function DI({className:e,...t}){return(0,Q.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:Y(e),...t})}function OI({className:e,...t}){return(0,Q.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:Y(`flex flex-wrap items-center gap-1.5 text-xs/relaxed wrap-break-word text-muted-foreground`,e),...t})}function kI({className:e,...t}){return(0,Q.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:Y(`inline-flex items-center gap-1`,e),...t})}function AI({className:e,render:t,...n}){return _o({defaultTagName:`a`,props:wt({className:Y(`transition-colors hover:text-foreground`,e)},n),render:t,state:{slot:`breadcrumb-link`}})}function jI({className:e,...t}){return(0,Q.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:Y(`font-normal text-foreground`,e),...t})}function MI({children:e,className:t,...n}){return(0,Q.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:Y(`[&>svg]:size-3.5`,t),...n,children:e??(0,Q.jsx)(lr,{})})}function NI(e,t){let n=(0,$.c)(6),r;n[0]!==e||n[1]!==t?(r=Tn(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a=Yr(i),o=Br(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 PI(e){let t=(0,$.c)(3),{folder:n,disabled:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Q.jsx)(TI,{className:`h-40`,"aria-label":`Folders`,children:(0,Q.jsx)(`div`,{className:`flex flex-col p-1`,children:(0,Q.jsx)(FI,{folder:n,disabled:r})})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function FI(e){let t=(0,$.c)(38),{folder:n,disabled:r}=e,i=fa(cF),a;t[0]===n.value?a=t[1]:(a=Vn(Dn(n.value)),t[0]=n.value,t[1]=a);let o=a;if(De(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(q(n.value)){let e;t[3]===n.value.cause?e=t[4]:(e=ha(Yt(n.value.cause)),t[3]=n.value.cause,t[4]=e);let a;t[5]===e?a=t[6]:(a=(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:e}),t[5]=e,t[6]=a);let o;t[7]!==r||t[8]!==n.refresh?(o=(0,Q.jsx)(X,{variant:`outline`,size:`xs`,onClick:n.refresh,disabled:r,children:`Try again`}),t[7]=r,t[8]=n.refresh,t[9]=o):o=t[9];let s;t[10]===i?s=t[11]:(s=()=>i(void 0),t[10]=i,t[11]=s);let c;t[12]!==r||t[13]!==s?(c=(0,Q.jsx)(X,{variant:`ghost`,size:`xs`,onClick:s,disabled:r,children:`Home folder`}),t[12]=r,t[13]=s,t[14]=c):c=t[14];let l;t[15]!==o||t[16]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[o,c]}),t[15]=o,t[16]=c,t[17]=l):l=t[17];let u;return t[18]!==a||t[19]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-2 px-2 py-1.5`,children:[a,l]}),t[18]=a,t[19]=l,t[20]=u):u=t[20],u}if(!o)return null;let s;t[21]!==o.parent||t[22]!==r||t[23]!==i?(s=o.parent&&(0,Q.jsxs)(X,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,onClick:()=>i(o.parent??void 0),disabled:r,children:[(0,Q.jsx)(Nd,{"data-icon":`inline-start`}),`Up`]}),t[21]=o.parent,t[22]=r,t[23]=i,t[24]=s):s=t[24];let c;if(t[25]!==o.directories||t[26]!==r||t[27]!==i){let e;t[29]!==r||t[30]!==i?(e=e=>(0,Q.jsxs)(X,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,title:e.path,onClick:()=>i(e.path),disabled:r,children:[(0,Q.jsx)(Bf,{"data-icon":`inline-start`}),(0,Q.jsx)(_r,{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 II(e){let t=(0,$.c)(44),{connection:n,disabled:r,onOpen:i}=e,a=Yr(cF),o=fa(cF),s=NI(n,a),c,l;t[0]===s.value?(c=t[1],l=t[2]):(c=Vn(Dn(s.value)),l=c?[`/`,...c.path.split(`/`).filter(Boolean)]:[],t[0]=s.value,t[1]=c,t[2]=l);let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Browse for a folder`}),t[3]=d):d=t[3];let f;t[4]!==u||t[5]!==c||t[6]!==r||t[7]!==o?(f=c&&(0,Q.jsx)(DI,{"aria-label":`Folder path`,children:(0,Q.jsx)(OI,{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)(MI,{}),(0,Q.jsx)(kI,{className:`min-w-0`,children:t===u.length-1?(0,Q.jsx)(jI,{className:`max-w-48`,title:c.path,children:e}):(0,Q.jsx)(AI,{render:(0,Q.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>o(n)}),title:n,children:e})})]},n)})})}),t[4]=u,t[5]=c,t[6]=r,t[7]=o,t[8]=f):f=t[8];let p;t[9]===f?p=t[10]:(p=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 px-3 pt-1`,children:[d,f]}),t[9]=f,t[10]=p);let m;t[11]!==r||t[12]!==s?(m=(0,Q.jsx)(PI,{folder:s,disabled:r}),t[11]=r,t[12]=s,t[13]=m):m=t[13];let h;t[14]===c?.truncated?h=t[15]:(h=c?.truncated&&(0,Q.jsx)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:`This folder is large; some entries are not shown.`}),t[14]=c?.truncated,t[15]=h);let g=c?.repository?`Every worktree appears in the sidebar.`:`Pick a folder that is a Git repository.`,_;t[16]===g?_=t[17]:(_=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:g}),t[16]=g,t[17]=_);let v;t[18]!==c?.repository||t[19]!==r||t[20]!==s.value?(v=r||!c?.repository||Gt(s.value)||q(s.value),t[18]=c?.repository,t[19]=r,t[20]=s.value,t[21]=v):v=t[21];let y;t[22]!==c||t[23]!==i?(y=()=>{c&&i(c.path)},t[22]=c,t[23]=i,t[24]=y):y=t[24];let b;t[25]===r?b=t[26]:(b=r&&(0,Q.jsx)(wi,{}),t[25]=r,t[26]=b);let x;t[27]===c?.path?x=t[28]:(x=c?.path.split(`/`).filter(Boolean).at(-1)??`folder`,t[27]=c?.path,t[28]=x);let S=`Open ${x}`,C;t[29]===S?C=t[30]:(C=(0,Q.jsx)(_r,{className:`max-w-36`,text:S}),t[29]=S,t[30]=C);let w;t[31]!==y||t[32]!==b||t[33]!==C||t[34]!==v?(w=(0,Q.jsxs)(X,{size:`sm`,disabled:v,onClick:y,children:[b,C]}),t[31]=y,t[32]=b,t[33]=C,t[34]=v,t[35]=w):w=t[35];let T;t[36]!==w||t[37]!==_?(T=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-1 pb-1 pl-3`,children:[_,w]}),t[36]=w,t[37]=_,t[38]=T):T=t[38];let E;return t[39]!==T||t[40]!==p||t[41]!==m||t[42]!==h?(E=(0,Q.jsxs)(`section`,{"aria-label":`Browse for a folder`,className:`flex flex-col gap-2 rounded-2xl border bg-muted/30 p-2`,children:[p,m,h,T]}),t[39]=T,t[40]=p,t[41]=m,t[42]=h,t[43]=E):E=t[43],E}function LI(e){let t=(0,$.c)(9),{connection:n,remotes:r,onOpened:i}=e,a=dF(),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)(FF,{className:`flex max-h-[90svh] flex-col sm:max-w-lg`,children:(0,Q.jsx)(RI,{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)(Qo,{handle:hF,onOpenChangeComplete:a,children:c}),t[6]=a,t[7]=c,t[8]=l):l=t[8],l}function RI(e){let t=(0,$.c)(18),{connection:n,remote:r,name:i,onOpened:a}=e,o=lF(n,r,zI,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)(Pf,{"aria-hidden":`true`})}),t[0]=s):s=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(RF,{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)(IF,{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)(zF,{children:l})]})]}),t[2]=l,t[3]=u);let d;t[4]===o?d=t[5]:(d=e=>void o.submit(e),t[4]=o,t[5]=d);let f;t[6]!==n||t[7]!==o.result.waiting||t[8]!==d?(f=(0,Q.jsx)(II,{disabled:o.result.waiting,connection:n,onOpen:d}),t[6]=n,t[7]=o.result.waiting,t[8]=d,t[9]=f):f=t[9];let p;t[10]===o.result?p=t[11]:(p=q(o.result)&&(0,Q.jsx)(lo,{variant:`destructive`,children:(0,Q.jsx)(rr,{children:ha(Yt(o.result.cause))})}),t[10]=o.result,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Q.jsx)(TI,{className:`min-h-0 [&>[data-slot=scroll-area-viewport]]:max-h-[calc(90svh-8rem)]`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[f,p]})}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==u||t[16]!==m?(h=(0,Q.jsxs)(Q.Fragment,{children:[u,m]}),t[15]=u,t[16]=m,t[17]=h):h=t[17],h}function zI(){return hF.close()}var BI=Zu(),VI=Ha(e=>Zr(t=>{let r=new Map,i=t.registry,a=_e(e.connections),o=e=>({children:i.get(a).waiting?`Retrying…`:`Retry`,disabled:i.get(a).waiting,onClick:()=>i.set(a,{environmentId:e})});t.subscribe(n,t=>{let a=t.filter(t=>!t.dismissed&&e.connections.some(e=>e.environmentId===t.environmentId));for(let[e,t]of r)a.some(t=>t.environmentId===e)||(r.delete(e),BI.close(t.id));for(let t of a){let a=t.environmentId,s=JSON.stringify([t.environmentName,t.failures.map(({entry:e,detail:t})=>[e.key,e.name,t])]),c=r.get(a),l={title:`Couldn’t check changes on ${t.environmentName}`,description:e.description(t)};if(c){c.signature!==s&&(BI.update(c.id,l),c.signature=s);continue}let u=BI.add({...l,priority:`low`,actionProps:o(a),onClose:()=>i.update(n,e=>e.some(e=>e.environmentId===a&&!e.dismissed)?e.map(e=>e.environmentId===a?{...e,dismissed:!0}:e):e)});r.set(a,{id:u,signature:s})}},{immediate:!0}),t.subscribe(a,()=>{for(let[e,t]of r)BI.update(t.id,{actionProps:o(e)})}),t.addFinalizer(()=>{for(let e of r.values())BI.close(e.id)})}));function HI(e){let[t,n]=Z.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),r=Z.useRef(null),i=Z.useRef(null),a=Z.useRef(null),o=Z.useRef(null),s=Z.useRef(!0),c=Z.useRef(null),l=Ir(),u=Z.useMemo(()=>({anchor:t,setAnchor:n,actionsRef:a,backdropRef:r,internalBackdropRef:i,positionerRef:o,allowMouseUpTriggerRef:s,initialCursorPointRef:c,rootId:l}),[t,l]);return(0,Q.jsx)(ca.Provider,{value:u,children:(0,Q.jsx)(ea.Provider,{value:void 0,children:(0,Q.jsx)(rn,{...e})})})}var UI=500,WI=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}=m(!1),{store:h}=ft(!1),g=h.useState(`open`),_=h.useState(`disabled`),v=Z.useRef(null),y=Z.useRef(null),b=J(),x=J(),S=Z.useRef(!1),C=Z.useRef(null);function w(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})}}),S.current=!1,s.current?.setOpen(!0,no(yr,n)),x.start(UI,()=>{S.current=!0})}function T(e){if(_)return;d.current=!0,gt(e),w(e.clientX,e.clientY,e.nativeEvent);let t=co(v.current);C.current?.abort();let n=new AbortController;C.current=n,t.addEventListener(`mouseup`,e=>{if(d.current=!1,!S.current)return;x.clear(),S.current=!1;let t=xe(e);jn(u.current,t)||p&&t&&ds(t)===p||s.current?.setOpen(!1,no(Ea,e))},{once:!0,signal:n.signal})}function E(){b.clear(),y.current=null}function D(e){if(_){E();return}if(d.current=!1,e.touches.length!==1){E();return}e.stopPropagation();let t=e.touches[0],n={x:t.clientX,y:t.clientY};y.current=n,b.start(UI,()=>{w(n.x,n.y,e.nativeEvent)})}function O(e){if(e.touches.length!==1){E();return}if(b.isStarted()&&y.current){let t=e.touches[0],n=Math.abs(t.clientX-y.current.x),r=Math.abs(t.clientY-y.current.y);(n>10||r>10)&&E()}}return Z.useEffect(()=>()=>{C.current?.abort()},[]),Z.useEffect(()=>{function e(e){if(_)return;let t=xe(e);(jn(v.current,t)||jn(c.current,t)||jn(l.current,t))&&e.preventDefault()}let t=co(v.current);return qe(t,`contextmenu`,e)},[l,_,c]),L(`div`,e,{state:{open:g},ref:[v,t],props:[{onContextMenu:T,onTouchStart:D,onTouchMove:O,onTouchEnd:E,onTouchCancel:E,style:{WebkitTouchCallout:`none`}},a],stateAttributesMapping:ie})}),GI=rs;function KI({...e}){return(0,Q.jsx)(HI,{"data-slot":`context-menu`,...e})}function qI({className:e,...t}){return(0,Q.jsx)(WI,{"data-slot":`context-menu-trigger`,className:Y(`select-none`,e),...t})}function JI({className:e,align:t=`start`,alignOffset:n=4,side:r=`right`,sideOffset:i=0,...a}){return(0,Q.jsx)(pn,{children:(0,Q.jsx)(GI,{className:`isolate z-50 outline-none`,align:t,alignOffset:n,side:r,sideOffset:i,children:(0,Q.jsx)(K,{"data-slot":`context-menu-content`,className:Y(`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 YI({...e}){return(0,Q.jsx)(Tt,{"data-slot":`context-menu-group`,...e})}function XI({className:e,inset:t,variant:n=`default`,...r}){return(0,Q.jsx)(R,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:Y(`group/context-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-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 ZI({className:e,...t}){return(0,Q.jsx)(hi,{"data-slot":`context-menu-separator`,className:Y(`-mx-1 my-1 h-px bg-border/50`,e),...t})}function QI({className:e,...t}){return(0,Q.jsx)(`span`,{"data-slot":`context-menu-shortcut`,className:Y(`ml-auto text-[0.625rem] tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground`,e),...t})}function $I(e){let t=(0,$.c)(26),{entry:n,connection:r,children:i,onRetryChanges:a}=e,o=n.worktreeId,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 py-0.5`}),t[0]=s):s=t[0];let c;t[1]===i?c=t[2]:(c=(0,Q.jsx)(qI,{render:s,children:i}),t[1]=i,t[2]=c);let l;t[3]!==n.available||t[4]!==n.changes||t[5]!==n.kind||t[6]!==a?(l=n.available&&n.kind===`worktree`&&n.changes.state===`unavailable`&&(0,Q.jsxs)(XI,{onClick:a,children:[(0,Q.jsx)(Ep,{}),`Retry changes`]}),t[3]=n.available,t[4]=n.changes,t[5]=n.kind,t[6]=a,t[7]=l):l=t[7];let u;t[8]===n.path?u=t[9]:(u=n.path&&(0,Q.jsxs)(XI,{className:`cursor-pointer`,onClick:()=>n.path&&At(n.path,`worktree path`),children:[(0,Q.jsx)(rf,{}),`Copy worktree path`]}),t[8]=n.path,t[9]=u);let d;t[10]!==r||t[11]!==n||t[12]!==o?(d=n.kind===`worktree`&&o&&(0,Q.jsxs)(XI,{className:`cursor-pointer`,disabled:!n.available,onClick:()=>bF.openWithPayload({entry:n,connection:r,worktreeId:o,requestId:crypto.randomUUID()}),children:[(0,Q.jsx)(Hf,{}),`Switch branch`]}),t[10]=r,t[11]=n,t[12]=o,t[13]=d):d=t[13];let f;t[14]!==r||t[15]!==n||t[16]!==o?(f=!n.main&&n.kind===`worktree`&&o&&(0,Q.jsxs)(XI,{variant:`destructive`,className:`cursor-pointer`,disabled:!n.available,onClick:()=>yF.openWithPayload({entry:n,connection:r,worktreeId:o,requestId:crypto.randomUUID()}),children:[(0,Q.jsx)(Jp,{}),`Delete`]}),t[14]=r,t[15]=n,t[16]=o,t[17]=f):f=t[17];let p;t[18]!==l||t[19]!==u||t[20]!==d||t[21]!==f?(p=(0,Q.jsx)(JI,{children:(0,Q.jsxs)(YI,{children:[l,u,d,f]})}),t[18]=l,t[19]=u,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m;return t[23]!==c||t[24]!==p?(m=(0,Q.jsxs)(KI,{children:[c,p]}),t[23]=c,t[24]=p,t[25]=m):m=t[25],m}function eL({className:e,...t}){return(0,Q.jsx)(`kbd`,{"data-slot":`kbd`,className:Y(`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 tL({className:e,...t}){return(0,Q.jsx)(`kbd`,{"data-slot":`kbd-group`,className:Y(`inline-flex items-center gap-1`,e),...t})}function nL(){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 rL({className:e,...t}){return(0,Q.jsx)(`textarea`,{"data-slot":`textarea`,className:Y(`flex field-sizing-content min-h-16 w-full resize-none rounded-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 iL({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:Y(`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 aL=kr(`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 oL({className:e,align:t=`inline-start`,...n}){return(0,Q.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:Y(aL({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var sL=kr(`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 cL({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,Q.jsx)(X,{type:t,"data-size":r,variant:n,className:Y(sL({size:r}),e),...i})}function lL({className:e,...t}){return(0,Q.jsx)(`span`,{className:Y(`flex items-center gap-2 text-xs/relaxed text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function uL({className:e,...t}){return(0,Q.jsx)(ae,{"data-slot":`input-group-control`,className:Y(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}function dL({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty`,className:Y(`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 fL({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty-header`,className:Y(`flex max-w-sm flex-col items-center gap-1`,e),...t})}kr(`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 pL({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty-title`,className:Y(`font-heading text-sm font-medium tracking-tight`,e),...t})}function mL({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty-description`,className:Y(`text-xs/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}var hL=1,gL=.9,_L=.8,vL=.17,yL=.1,bL=.999,xL=.9999,SL=.99,CL=/[\\\/_+.#"@\[\(\{&]/,wL=/[\\\/_+.#"@\[\(\{&]/g,TL=/[\s-]/,EL=/[\s-]/g;function DL(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?hL:SL;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=DL(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=hL:CL.test(e.charAt(l-1))?(d*=_L,p=e.slice(i,l-1).match(wL),p&&i>0&&(d*=bL**+p.length)):TL.test(e.charAt(l-1))?(d*=gL,m=e.slice(i,l-1).match(EL),m&&i>0&&(d*=bL**+m.length)):(d*=vL,i>0&&(d*=bL**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=xL)),(d<yL&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=DL(e,t,n,r,l+1,a+2,o),f*yL>d&&(d=f*yL)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function OL(e){return e.toLowerCase().replace(EL,` `)}function kL(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,DL(e,t,OL(e),OL(t),0,0,{})}var AL=Object.defineProperty,jL=(e,t)=>AL(e,`name`,{value:t,configurable:!0}),ML=!!(typeof window<`u`&&window.document&&window.document.createElement);function NL(e,t,{checkForDefaultPrevented:n=!0}={}){return jL(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}jL(NL,`composeEventHandlers`);function PL(e){if(!ML)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}jL(PL,`getOwnerWindow`);function FL(e){if(!ML)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}jL(FL,`getOwnerDocument`);function IL(e,t=!1){let{activeElement:n}=FL(e);if(!n?.nodeName)return null;if(LL(n)&&n.contentDocument)return IL(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=FL(n).getElementById(e);if(t)return t}}return n}jL(IL,`getActiveElement`);function LL(e){return e.tagName===`IFRAME`}jL(LL,`isFrame`);var RL=Object.defineProperty,zL=(e,t)=>RL(e,`name`,{value:t,configurable:!0});function BL(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}zL(BL,`setRef`);function VL(...e){return t=>{let n=!1,r=e.map(e=>{let r=BL(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():BL(e[t],null)}}}}zL(VL,`composeRefs`);function HL(...e){return Z.useCallback(VL(...e),e)}zL(HL,`useComposedRefs`);var UL=Object.defineProperty,WL=(e,t)=>UL(e,`name`,{value:t,configurable:!0});function GL(e,t){let n=Z.createContext(t);n.displayName=e+`Context`;let r=WL(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 WL(i,`useContext`),[r,i]}WL(GL,`createContext`);function KL(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=WL(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 WL(s,`useContext`),[o,s]}WL(r,`createContext`);let i=WL(()=>{let t=n.map(e=>Z.createContext(e));return WL(function(n){let r=n?.[e]||t;return Z.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,qL(i,...t)]}WL(KL,`createContextScope`);function qL(...e){let t=e[0];if(e.length===1)return t;let n=WL(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return WL(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}WL(qL,`composeContextScopes`);var JL=globalThis?.document?Z.useLayoutEffect:()=>{},YL=Object.defineProperty,XL=(e,t)=>YL(e,`name`,{value:t,configurable:!0}),ZL=Z.useId||(()=>void 0),QL=0;function $L(e){let[t,n]=Z.useState(ZL());return JL(()=>{e||n(e=>e??String(QL++))},[e]),e||(t?`radix-${t}`:``)}XL($L,`useId`);var eR=Object.defineProperty,tR=(e,t)=>eR(e,`name`,{value:t,configurable:!0}),nR=Z.useEffectEvent,rR=Z.useInsertionEffect;function iR(e){if(typeof nR==`function`)return nR(e);let t=Z.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof rR==`function`?rR(()=>{t.current=e}):JL(()=>{t.current=e}),Z.useMemo(()=>((...e)=>t.current?.(...e)),[])}tR(iR,`useEffectEvent`);var aR=Object.defineProperty,oR=(e,t)=>aR(e,`name`,{value:t,configurable:!0}),sR=Z.useInsertionEffect||JL;function cR({prop:e,defaultProp:t,onChange:n=oR(()=>{},`onChange`),caller:r}){let[i,a,o]=lR({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,Z.useCallback(t=>{if(s){let n=uR(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}oR(cR,`useControllableState`);function lR({defaultProp:e,onChange:t}){let[n,r]=Z.useState(e),i=Z.useRef(n),a=Z.useRef(t);return sR(()=>{a.current=t},[t]),Z.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}oR(lR,`useUncontrolledState`);function uR(e){return typeof e==`function`}oR(uR,`isFunction`);var dR=Symbol(`RADIX:SYNC_STATE`);function fR(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=iR(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=Z.useReducer((t,n)=>{if(n.type===dR)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:dR,state:i})},[i,d.state,c]),[h,f]}oR(fR,`useControllableStateReducer`);var pR=Object.defineProperty,mR=(e,t)=>pR(e,`name`,{value:t,configurable:!0});function hR(e){let t=Z.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];CR(r)&&typeof DR==`function`&&(r=DR(r._payload)),Z.Children.forEach(r,e=>{if(xR(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;CR(n)&&typeof DR==`function`&&(n=DR(n._payload)),a=vR(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?bR(a):void 0,l=HL(n,c);if(!a){if(r||r===0)throw Error(o?ER(e):TR(e));return r}let u=yR(i,a.props??{});return a.type!==Z.Fragment&&(u.ref=n?l:c),Z.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}mR(hR,`createSlot`);var gR=Symbol.for(`radix.slottable`);function _R(e){let t=mR(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=gR,t}mR(_R,`createSlottable`);var vR=mR((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 yR(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}}mR(yR,`mergeProps`);function bR(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)}mR(bR,`getElementRef`);function xR(e){return Z.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===gR}mR(xR,`isSlottable`);var SR=Symbol.for(`react.lazy`);function CR(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===SR&&`_payload`in e&&wR(e._payload)}mR(CR,`isLazyComponent`);function wR(e){return typeof e==`object`&&!!e&&`then`in e}mR(wR,`isPromiseLike`);var TR=mR(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),ER=mR(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),DR=Z.use,OR=Object.defineProperty,kR=(e,t)=>OR(e,`name`,{value:t,configurable:!0}),AR=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=hR(`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 jR(e,t){e&&bd.flushSync(()=>e.dispatchEvent(t))}kR(jR,`dispatchDiscreteCustomEvent`);var MR=Object.defineProperty,NR=(e,t)=>MR(e,`name`,{value:t,configurable:!0});function PR(e){let t=Z.useRef(e);return Z.useEffect(()=>{t.current=e}),Z.useMemo(()=>((...e)=>t.current?.(...e)),[])}NR(PR,`useCallbackRef`);var FR=Object.defineProperty,IR=(e,t)=>FR(e,`name`,{value:t,configurable:!0}),LR=`dismissableLayer.update`,RR=`dismissableLayer.pointerDownOutside`,zR=`dismissableLayer.focusOutside`,BR,VR=Z.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),HR=Z.forwardRef(IR(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(VR),[d,f]=Z.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=Z.useState({}),h=HL(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=GR(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=KR(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=PR(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&&(BR=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),qR(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=BR))}},[d,p,n,u]),Z.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),qR())},[d,u]),Z.useEffect(()=>{let e=IR(()=>m({}),`handleUpdate`);return document.addEventListener(LR,e),()=>document.removeEventListener(LR,e)},[]),(0,Q.jsx)(AR.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:NL(e.onFocusCapture,w.onFocusCapture),onBlurCapture:NL(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:NL(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function UR(){let e=Z.useContext(VR),[t,n]=Z.useState(null);return Z.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}IR(UR,`useDismissableLayerSurface`);var WR=IR(()=>!0,`IS_TRUE`);function GR(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=WR}=t,s=PR(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()}IR(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}IR(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)}IR(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}IR(p,`handleInteractionBubble`);let m=IR(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||JR(RR,s,p,{discrete:!0})};if(IR(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:IR(()=>c.current=!0,`onPointerDownCapture`)}}IR(GR,`usePointerDownOutside`);function KR(e,t=globalThis?.document){let n=PR(e),r=Z.useRef(!1);return Z.useEffect(()=>{let e=IR(e=>{e.target&&!r.current&&JR(zR,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:IR(()=>r.current=!0,`onFocusCapture`),onBlurCapture:IR(()=>r.current=!1,`onBlurCapture`)}}IR(KR,`useFocusOutside`);function qR(){let e=new CustomEvent(LR);document.dispatchEvent(e)}IR(qR,`dispatchUpdate`);function JR(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?jR(i,a):i.dispatchEvent(a)}IR(JR,`handleAndDispatchCustomEvent`);var YR=Object.defineProperty,XR=(e,t)=>YR(e,`name`,{value:t,configurable:!0}),ZR=`focusScope.autoFocusOnMount`,QR=`focusScope.autoFocusOnUnmount`,$R={bubbles:!1,cancelable:!0},ez=Z.forwardRef(XR(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=Z.useState(null),l=PR(i),u=PR(a),d=Z.useRef(null),f=HL(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:sz(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||sz(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&sz(s)};XR(e,`handleFocusIn`),XR(t,`handleFocusOut`),XR(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){cz.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(ZR,$R);s.addEventListener(ZR,l),s.dispatchEvent(t),t.defaultPrevented||(tz(dz(rz(s)),{select:!0}),document.activeElement===e&&sz(s))}return()=>{s.removeEventListener(ZR,l),setTimeout(()=>{let t=new CustomEvent(QR,$R);s.addEventListener(QR,u),s.dispatchEvent(t),t.defaultPrevented||sz(e??document.body,{select:!0}),s.removeEventListener(QR,u),cz.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]=nz(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&sz(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&sz(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,Q.jsx)(AR.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function tz(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(sz(r,{select:t}),document.activeElement!==n)return}XR(tz,`focusFirst`);function nz(e){let t=rz(e);return[iz(t,e),iz(t.reverse(),e)]}XR(nz,`getTabbableEdges`);function rz(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:XR(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}XR(rz,`getTabbableCandidates`);function iz(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):az(r,{upTo:t})))return r}XR(iz,`findVisible`);function az(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}XR(az,`isHidden`);function oz(e){return e instanceof HTMLInputElement&&`select`in e}XR(oz,`isSelectableInput`);function sz(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&oz(e)&&t&&e.select()}}XR(sz,`focus`);var cz=lz();function lz(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=uz(e,t),e.unshift(t)},remove(t){e=uz(e,t),e[0]?.resume()}}}XR(lz,`createFocusScopesStack`);function uz(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}XR(uz,`arrayRemove`);function dz(e){return e.filter(e=>e.tagName!==`A`)}XR(dz,`removeLinks`);var fz=Object.defineProperty,pz=Z.forwardRef(((e,t)=>fz(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=Z.useState(!1);JL(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?bd.createPortal((0,Q.jsx)(AR.div,{...r,ref:t}),o):null},`Portal`)),mz=Object.defineProperty,hz=(e,t)=>mz(e,`name`,{value:t,configurable:!0});function gz(e,t){return Z.useReducer((e,n)=>t[e][n]??e,e)}hz(gz,`useStateMachine`);var _z=hz(e=>{let{present:t,children:n}=e,r=vz(t),i=typeof n==`function`?n({present:r.isPresent}):Z.Children.only(n),a=bz(r.ref,Sz(i));return typeof n==`function`||r.isPresent?Z.cloneElement(i,{ref:a}):null},`Presence`);function vz(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]=gz(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??xz(r.current),o.current=void 0):a.current=`none`},[s]),JL(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=xz(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]),JL(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=hz(a=>{let o=xz(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=hz(e=>{e.target===t&&(a.current=xz(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=xz(t)}else r.current=null;n(e)},[])}}hz(vz,`usePresence`);function yz(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}hz(yz,`setRef`);function bz(...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=yz(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():yz(n[e],null)}}},[])}hz(bz,`useStableComposedRefs`);function xz(e){return e?.animationName||`none`}hz(xz,`getAnimationName`);function Sz(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)}hz(Sz,`getElementRef`);var Cz=Object.defineProperty,wz=(e,t)=>Cz(e,`name`,{value:t,configurable:!0}),Tz=0,Ez=null;function Dz(e){return Oz(),e.children}wz(Dz,`FocusGuards`);function Oz(){Z.useEffect(()=>{Ez||={start:kz(),end:kz()};let{start:e,end:t}=Ez;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Tz++,()=>{Tz===1&&(Ez?.start.remove(),Ez?.end.remove(),Ez=null),Tz=Math.max(0,Tz-1)}},[])}wz(Oz,`useFocusGuards`);function kz(){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}wz(kz,`createFocusGuard`);var Az=function(){return Az=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},Az.apply(this,arguments)};function jz(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 Mz(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 Nz=`right-scroll-bar-position`,Pz=`width-before-scroll-bar`,Fz=`with-scroll-bars-hidden`,Iz=`--removed-body-scroll-bar-size`;function Lz(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Rz(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 zz=typeof window<`u`?Z.useLayoutEffect:Z.useEffect,Bz=new WeakMap;function Vz(e,t){var n=Rz(t||null,function(t){return e.forEach(function(e){return Lz(e,t)})});return zz(function(){var t=Bz.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Lz(e,null)}),i.forEach(function(e){r.has(e)||Lz(e,a)})}Bz.set(n,e)},[e]),n}function Hz(e){return e}function Uz(e,t){t===void 0&&(t=Hz);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 Wz(e){e===void 0&&(e={});var t=Uz(null);return t.options=Az({async:!0,ssr:!1},e),t}var Gz=function(e){var t=e.sideCar,n=jz(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,Az({},n))};Gz.isSideCarExport=!0;function Kz(e,t){return e.useMedium(t),Gz}var qz=Wz(),Jz=function(){},Yz=Z.forwardRef(function(e,t){var n=Z.useRef(null),r=Z.useState({onScrollCapture:Jz,onWheelCapture:Jz,onTouchMoveCapture:Jz}),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=jz(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Vz([n,t]),C=Az(Az({},b),i);return Z.createElement(Z.Fragment,null,u&&Z.createElement(x,{sideCar:qz,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),Az(Az({},C),{ref:S})):Z.createElement(v,Az({},C,{className:c,ref:S}),s))});Yz.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Yz.classNames={fullWidth:Pz,zeroRight:Nz};var Xz=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Zz(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Xz();return t&&e.setAttribute(`nonce`,t),e}function Qz(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $z(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var eB=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Zz())&&(Qz(t,n),$z(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},tB=function(){var e=eB();return function(t,n){Z.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},nB=function(){var e=tB();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},rB={left:0,top:0,right:0,gap:0},iB=function(e){return parseInt(e||``,10)||0},aB=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[iB(n),iB(r),iB(i)]},oB=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return rB;var t=aB(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])}},sB=nB(),cB=`data-scroll-locked`,lB=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
1352
+ .${Fz} {
1353
+ overflow: hidden ${r};
1354
+ padding-right: ${s}px ${r};
1355
+ }
1356
+ body[${cB}] {
1357
+ overflow: hidden ${r};
1358
+ overscroll-behavior: contain;
1359
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
1360
+ padding-left: ${i}px;
1361
+ padding-top: ${a}px;
1362
+ padding-right: ${o}px;
1363
+ margin-left:0;
1364
+ margin-top:0;
1365
+ margin-right: ${s}px ${r};
1366
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
1367
+ }
1368
+
1369
+ .${Nz} {
1370
+ right: ${s}px ${r};
1371
+ }
1372
+
1373
+ .${Pz} {
1374
+ margin-right: ${s}px ${r};
1375
+ }
1376
+
1377
+ .${Nz} .${Nz} {
1378
+ right: 0 ${r};
1379
+ }
1380
+
1381
+ .${Pz} .${Pz} {
1382
+ margin-right: 0 ${r};
1383
+ }
1384
+
1385
+ body[${cB}] {
1386
+ ${Iz}: ${s}px;
1387
+ }
1388
+ `},uB=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},dB=function(){Z.useEffect(function(){return document.body.setAttribute(cB,(uB()+1).toString()),function(){var e=uB()-1;e<=0?document.body.removeAttribute(cB):document.body.setAttribute(cB,e.toString())}},[])},fB=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;dB();var a=Z.useMemo(function(){return oB(i)},[i]);return Z.createElement(sB,{styles:lB(a,!t,i,n?``:`!important`)})},pB=!1;if(typeof window<`u`)try{var mB=Object.defineProperty({},"passive",{get:function(){return pB=!0,!0}});window.addEventListener(`test`,mB,mB),window.removeEventListener(`test`,mB,mB)}catch{pB=!1}var hB=pB?{passive:!1}:!1,gB=function(e){return e.tagName===`TEXTAREA`},_B=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!gB(e)&&n[t]===`visible`)},vB=function(e){return _B(e,`overflowY`)},yB=function(e){return _B(e,`overflowX`)},bB=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),CB(e,r)){var i=wB(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},xB=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},SB=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},CB=function(e,t){return e===`v`?vB(t):yB(t)},wB=function(e,t){return e===`v`?xB(t):SB(t)},TB=function(e,t){return e===`h`&&t===`rtl`?-1:1},EB=function(e,t,n,r,i){var a=TB(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=wB(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&CB(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},DB=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},OB=function(e){return[e.deltaX,e.deltaY]},kB=function(e){return e&&`current`in e?e.current:e},AB=function(e,t){return e[0]===t[0]&&e[1]===t[1]},jB=function(e){return`
1389
+ .block-interactivity-${e} {pointer-events: none;}
1390
+ .allow-interactivity-${e} {pointer-events: all;}
1391
+ `},MB=0,NB=[];function PB(e){var t=Z.useRef([]),n=Z.useRef([0,0]),r=Z.useRef(),i=Z.useState(MB++)[0],a=Z.useState(nB)[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=Mz([e.lockRef.current],(e.shards||[]).map(kB),!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=DB(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=bB(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=bB(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 EB(h,t,e,h===`h`?s:c,!0)},[]),c=Z.useCallback(function(e){var n=e;if(NB.length&&NB[NB.length-1]===a){var r=`deltaY`in n?OB(n):DB(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&AB(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(kB).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:FB(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=DB(e),r.current=void 0},[]),d=Z.useCallback(function(t){l(t.type,OB(t),t.target,s(t,e.lockRef.current))},[]),f=Z.useCallback(function(t){l(t.type,DB(t),t.target,s(t,e.lockRef.current))},[]);Z.useEffect(function(){return NB.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,hB),document.addEventListener(`touchmove`,c,hB),document.addEventListener(`touchstart`,u,hB),function(){NB=NB.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,hB),document.removeEventListener(`touchmove`,c,hB),document.removeEventListener(`touchstart`,u,hB)}},[]);var p=e.removeScrollBar,m=e.inert;return Z.createElement(Z.Fragment,null,m?Z.createElement(a,{styles:jB(i)}):null,p?Z.createElement(fB,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function FB(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var IB=Kz(qz,PB),LB=Z.forwardRef(function(e,t){return Z.createElement(Yz,Az({},e,{ref:t,sideCar:IB}))});LB.classNames=Yz.classNames;var RB=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},zB=new WeakMap,BB=new WeakMap,VB={},HB=0,UB=function(e){return e&&(e.host||UB(e.parentNode))},WB=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=UB(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})},GB=function(e,t,n,r){var i=WB(t,Array.isArray(e)?e:[e]);VB[n]||(VB[n]=new WeakMap);var a=VB[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=(zB.get(e)||0)+1,l=(a.get(e)||0)+1;zB.set(e,c),a.set(e,l),o.push(e),c===1&&i&&BB.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(),HB++,function(){o.forEach(function(e){var t=zB.get(e)-1,i=a.get(e)-1;zB.set(e,t),a.set(e,i),t||(BB.has(e)||e.removeAttribute(r),BB.delete(e)),i||e.removeAttribute(n)}),HB--,HB||(zB=new WeakMap,zB=new WeakMap,BB=new WeakMap,VB={})}},KB=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||RB(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),GB(r,i,n,`aria-hidden`)):function(){return null}},qB=Object.defineProperty,JB=(e,t)=>qB(e,`name`,{value:t,configurable:!0}),YB=`Dialog`,[XB,ZB]=KL(YB),[QB,$B]=XB(YB),eV=JB(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]=cR({prop:r,defaultProp:i??!1,onChange:a,caller:YB}),[d,f]=Z.useState(0),[p,m]=Z.useState(0);return(0,Q.jsx)(QB,{scope:t,triggerRef:s,contentRef:c,contentId:$L(),titleId:$L(),descriptionId:$L(),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`),tV=`DialogPortal`,[nV,rV]=XB(tV,{forceMount:void 0}),iV=JB(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=$B(tV,t);return(0,Q.jsx)(nV,{scope:t,forceMount:n,children:Z.Children.map(r,e=>(0,Q.jsx)(_z,{present:n||a.open,children:(0,Q.jsx)(pz,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),aV=`DialogOverlay`,oV=Z.forwardRef(JB(function(e,t){let n=rV(aV,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=$B(aV,e.__scopeDialog);return a.modal?(0,Q.jsx)(_z,{present:r||a.open,children:(0,Q.jsx)(cV,{...i,ref:t})}):null},`DialogOverlay`)),sV=hR(`DialogOverlay.RemoveScroll`),cV=Z.forwardRef(JB(function(e,t){let{__scopeDialog:n,...r}=e,i=$B(aV,n),a=HL(t,UR());return(0,Q.jsx)(LB,{as:sV,allowPinchZoom:!0,shards:[i.contentRef],children:(0,Q.jsx)(AR.div,{"data-state":mV(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),lV=`DialogContent`,uV=Z.forwardRef(JB(function(e,t){let n=rV(lV,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=$B(lV,e.__scopeDialog);return(0,Q.jsx)(_z,{present:r||a.open,children:a.modal?(0,Q.jsx)(dV,{...i,ref:t}):(0,Q.jsx)(fV,{...i,ref:t})})},`DialogContent`)),dV=Z.forwardRef(JB(function(e,t){let n=$B(lV,e.__scopeDialog),r=Z.useRef(null),i=HL(t,n.contentRef,r);return Z.useEffect(()=>{let e=r.current;if(e)return KB(e)},[]),(0,Q.jsx)(pV,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:NL(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:NL(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:NL(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),fV=Z.forwardRef(JB(function(e,t){let n=$B(lV,e.__scopeDialog),r=Z.useRef(!1),i=Z.useRef(!1);return(0,Q.jsx)(pV,{...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`)),pV=Z.forwardRef(JB(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=$B(lV,n);return Oz(),(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(ez,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,Q.jsx)(HR,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":mV(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`));function mV(e){return e?`open`:`closed`}JB(mV,`getState`);var hV=`[cmdk-group=""]`,gV=`[cmdk-group-items=""]`,_V=`[cmdk-group-heading=""]`,vV=`[cmdk-item=""]`,yV=`${vV}:not([aria-disabled="true"])`,bV=`cmdk-item-select`,xV=`data-value`,SV=(e,t,n)=>kL(e,t,n),CV=Z.createContext(void 0),wV=()=>Z.useContext(CV),TV=Z.createContext(void 0),EV=()=>Z.useContext(TV),DV=Z.createContext(void 0),OV=Z.forwardRef((e,t)=>{let n=HV(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=HV(()=>new Set),i=HV(()=>new Map),a=HV(()=>new Map),o=HV(()=>new Set),s=BV(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=$L(),y=$L(),b=$L(),x=Z.useRef(null),S=GV();VV(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),VV(()=>{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??SV;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(gV);t?t.appendChild(e.parentElement===t?e:e.closest(`${gV} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${gV} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${hV}[${xV}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(xV);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(hV)?.querySelector(_V))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${vV}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(yV)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(xV))}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(xV))}function P(e){let t=A()?.closest(hV),n;for(;t&&!n;)t=e>0?RV(t,hV):zV(t,hV),n=t?.querySelector(yV);n?C.setState(`value`,n.getAttribute(xV)):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(AR.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(bV);t.dispatchEvent(e)}}}}},Z.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:JV},c),qV(e,e=>Z.createElement(TV.Provider,{value:C},Z.createElement(CV.Provider,{value:w},e))))}),kV=Z.forwardRef((e,t)=>{let n=$L(),r=Z.useRef(null),i=Z.useContext(DV),a=wV(),o=BV(e),s=o.current?.forceMount??i?.forceMount;VV(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=WV(n,r,[e.value,e.children,r],e.keywords),l=EV(),u=UV(e=>e.value&&e.value===c.current),d=UV(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(bV,f),()=>t.removeEventListener(bV,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(AR.div,{ref:VL(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)}),AV=Z.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=$L(),s=Z.useRef(null),c=Z.useRef(null),l=$L(),u=wV(),d=UV(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));VV(()=>u.group(o),[]),WV(o,s,[e.value,e.heading,c]);let f=Z.useMemo(()=>({id:o,forceMount:i}),[i]);return Z.createElement(AR.div,{ref:VL(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),qV(e,e=>Z.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},Z.createElement(DV.Provider,{value:f},e))))}),jV=Z.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Z.useRef(null),a=UV(e=>!e.search);return!n&&!a?null:Z.createElement(AR.div,{ref:VL(i,t),...r,"cmdk-separator":``,role:`separator`})}),MV=Z.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=EV(),o=UV(e=>e.search),s=UV(e=>e.selectedItemId),c=wV();return Z.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),Z.createElement(AR.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)}})}),NV=Z.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=Z.useRef(null),o=Z.useRef(null),s=UV(e=>e.selectedItemId),c=wV();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(AR.div,{ref:VL(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},qV(e,e=>Z.createElement(`div`,{ref:VL(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),PV=Z.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return Z.createElement(eV,{open:n,onOpenChange:r},Z.createElement(iV,{container:o},Z.createElement(oV,{"cmdk-overlay":``,className:i}),Z.createElement(uV,{"aria-label":e.label,"cmdk-dialog":``,className:a},Z.createElement(OV,{ref:t,...s}))))}),FV=Z.forwardRef((e,t)=>UV(e=>e.filtered.count===0)?Z.createElement(AR.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),IV=Z.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return Z.createElement(AR.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},qV(e,e=>Z.createElement(`div`,{"aria-hidden":!0},e)))}),LV=Object.assign(OV,{List:NV,Item:kV,Input:MV,Group:AV,Separator:jV,Dialog:PV,Empty:FV,Loading:IV});function RV(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function zV(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function BV(e){let t=Z.useRef(e);return VV(()=>{t.current=e}),t}var VV=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function HV(e){let t=Z.useRef();return t.current===void 0&&(t.current=e()),t}function UV(e){let t=EV(),n=()=>e(t.snapshot());return Z.useSyncExternalStore(t.subscribe,n,n)}function WV(e,t,n,r=[]){let i=Z.useRef(),a=wV();return VV(()=>{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(xV,s),i.current=s}),i}var GV=()=>{let[e,t]=Z.useState(),n=HV(()=>new Map);return VV(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function KV(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function qV({asChild:e,children:t},n){return e&&Z.isValidElement(t)?Z.cloneElement(KV(t),{ref:t.ref},n(t.props.children)):n(t)}var JV={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function YV({className:e,...t}){return(0,Q.jsx)(LV,{"data-slot":`command`,className:Y(`flex size-full flex-col overflow-hidden rounded-xl bg-popover p-1 text-popover-foreground`,e),...t})}function XV({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!1,...a}){return(0,Q.jsxs)(AF,{...a,children:[(0,Q.jsxs)(IF,{className:`sr-only`,children:[(0,Q.jsx)(RF,{children:e}),(0,Q.jsx)(zF,{children:t})]}),(0,Q.jsx)(FF,{className:Y(`top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0`,r),showCloseButton:i,children:n})]})}function ZV({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,Q.jsxs)(iL,{className:`h-8! bg-input/20 dark:bg-input/30`,children:[(0,Q.jsx)(LV.Input,{"data-slot":`command-input`,className:Y(`w-full text-xs/relaxed outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,Q.jsx)(oL,{children:(0,Q.jsx)(Mp,{className:`size-3.5 shrink-0 opacity-50`})})]})})}function QV({className:e,...t}){return(0,Q.jsx)(LV.List,{"data-slot":`command-list`,className:Y(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function $V({className:e,...t}){return(0,Q.jsx)(LV.Empty,{"data-slot":`command-empty`,className:Y(`py-6 text-center text-xs/relaxed`,e),...t})}function eH({className:e,...t}){return(0,Q.jsx)(LV.Group,{"data-slot":`command-group`,className:Y(`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 tH({className:e,children:t,...n}){return(0,Q.jsxs)(LV.Item,{"data-slot":`command-item`,className:Y(`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)(ci,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}var nH=Ha(e=>Zr(t=>{t.mount(e);let n=t.registry;t.addFinalizer(()=>{n.getNodes().has(e)&&(n.get(e).waiting||n.set(e,Er))})}));function rH(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=wr(e,n),i;return t[1]===e?i=t[2]:(i=nH(e),t[1]=e,t[2]=i),Ba(i),r}function iH(e,t){let n=(0,$.c)(6),[r,i]=rH(e),a;n[0]!==t||n[1]!==i?(a=e=>i(e).then(t,aH),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 aH(){}function oH(e,t){let n=(0,$.c)(2),r;return n[0]===e?r=n[1]:(r=or(e),n[0]=e,n[1]=r),iH(r,t)}function sH(e,t){let n=(0,$.c)(2),r;return n[0]===e?r=n[1]:(r=Un(e),n[0]=e,n[1]=r),iH(r,t)}var cH=dn;function lH(e,t,n){let r=(0,$.c)(13),i;r[0]===e?i=r[1]:(i=Ee(e),r[0]=e,r[1]=i);let[a,o]=rH(i),s=un(),c=Qt(),l=hs(),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 uH(e){let t=(0,$.c)(15),n;t[0]===e?n=t[1]:(n=Wt(e),t[0]=e,t[1]=n);let[r,i]=rH(n),a;t[2]===e?a=t[3]:(a=Qe(e),t[2]=e,t[3]=a);let[o,s]=rH(a),[c,l]=(0,Z.useState)(!1),u;t[4]===e?u=t[5]:(u=_n(e),t[4]=e,t[5]=u);let{unresolved:d}=wo(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()},dH)},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 dH(){}function fH(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(Qo,{handle:bF,children:pH}),e[0]=t):t=e[0],t}function pH(e){let{payload:t}=e;return t&&(0,Q.jsx)(mH,{...t},t.requestId)}function mH(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:f}=uH(c),p;t[6]!==r.projectId||t[7]!==i?(p={projectId:r.projectId,worktreeId:i},t[6]=r.projectId,t[7]=i,t[8]=p):p=t[8];let{result:m}=tF(p,n,!0),h=Vn(Dn(m)),g;t[9]===r.projectId?g=t[10]:(g=e=>e.id===r.projectId,t[9]=r.projectId,t[10]=g);let _=kF(n).projects.find(g),v=vc(h?.bases??[],_?.worktrees??[],i),y;t[11]===a?y=t[12]:(y=e=>e.ref===a&&!e.current&&!e.inUse,t[11]=a,t[12]=y);let b=v.some(y),x=`Switch branch`;d&&(x=`Check outcome`),u&&(x=`Checking switch`);let S=FF,C=!u,w;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(RF,{children:`Switch branch`}),t[13]=w):w=t[13];let T;t[14]===r.name?T=t[15]:(T=(0,Q.jsxs)(IF,{children:[w,(0,Q.jsxs)(zF,{children:[`Choose a branch for `,r.name,`. Branches used by another worktree are unavailable.`]})]}),t[14]=r.name,t[15]=T);let E=YV,D;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(ZV,{"aria-label":`Find a branch`,placeholder:`Find a branch`}),t[16]=D):D=t[16];let O=QV,k;t[17]===m?k=t[18]:(k=De(m)&&(0,Q.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-muted-foreground`,children:`Reading branches`}),t[17]=m,t[18]=k);let A;t[19]===m?A=t[20]:(A=q(m)&&(0,Q.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-muted-foreground`,children:`Branches could not be read.`}),t[19]=m,t[20]=A);let j=h&&(0,Q.jsx)($V,{children:`No matching branch`}),M=eH,N;t[21]!==a||t[22]!==u||t[23]!==d?(N=e=>(0,Q.jsxs)(tH,{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)(Hf,{}),(0,Q.jsx)(_r,{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)(ci,{})]},e.ref),t[21]=a,t[22]=u,t[23]=d,t[24]=N):N=t[24];let P=v.map(N),F;t[25]!==M||t[26]!==P?(F=(0,Q.jsx)(M,{children:P}),t[25]=M,t[26]=P,t[27]=F):F=t[27];let I;t[28]!==O||t[29]!==k||t[30]!==A||t[31]!==j||t[32]!==F?(I=(0,Q.jsxs)(O,{"aria-label":`Branches`,children:[k,A,j,F]}),t[28]=O,t[29]=k,t[30]=A,t[31]=j,t[32]=F,t[33]=I):I=t[33];let L;t[34]!==E||t[35]!==I||t[36]!==D?(L=(0,Q.jsxs)(E,{children:[D,I]}),t[34]=E,t[35]=I,t[36]=D,t[37]=L):L=t[37];let R;t[38]===d?R=t[39]:(R=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]=R);let z;t[40]===l?z=t[41]:(z=q(l)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:String(Yt(l.cause))}),t[40]=l,t[41]=z);let B;t[42]===l?B=t[43]:(B=$e(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]=B);let V;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(X,{variant:`outline`}),t[44]=V):V=t[44];let H;t[45]===u?H=t[46]:(H=(0,Q.jsx)(NF,{render:V,disabled:u,children:`Cancel`}),t[45]=u,t[46]=H);let U=u||!d&&!b,W;t[47]!==a||t[48]!==f?(W=()=>void f(a,hH),t[47]=a,t[48]=f,t[49]=W):W=t[49];let G;t[50]!==x||t[51]!==U||t[52]!==W?(G=(0,Q.jsx)(X,{disabled:U,onClick:W,children:x}),t[50]=x,t[51]=U,t[52]=W,t[53]=G):G=t[53];let K;t[54]!==H||t[55]!==G?(K=(0,Q.jsxs)(LF,{children:[H,G]}),t[54]=H,t[55]=G,t[56]=K):K=t[56];let ee;return t[57]!==S||t[58]!==L||t[59]!==R||t[60]!==z||t[61]!==B||t[62]!==K||t[63]!==C||t[64]!==T?(ee=(0,Q.jsxs)(S,{showCloseButton:C,children:[T,L,R,z,B,K]}),t[57]=S,t[58]=L,t[59]=R,t[60]=z,t[61]=B,t[62]=K,t[63]=C,t[64]=T,t[65]=ee):ee=t[65],ee}function hH(){return bF.close()}function gH(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(RM,{handle:yF,children:_H}),e[0]=t):t=e[0],t}function _H(e){let{payload:t}=e;return t&&(0,Q.jsx)(vH,{...t},t.requestId)}function vH(e){let t=(0,$.c)(21),{entry:n,connection:r,worktreeId:i}=e,a=Bs(r),o;t[0]===a?o=t[1]:(o=Qc(a),t[0]=a,t[1]=o);let s=o,c;t[2]===a?c=t[3]:(c=dc(a),t[2]=a,t[3]=c);let l=c,u;t[4]===n.name?u=t[5]:(u=(0,Q.jsxs)(YM,{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)(XM,{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)(qM,{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)(yH,{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)(QM,{children:`Cancel`}),t[15]=s,t[16]=m);let h;return t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,Q.jsxs)(KM,{children:[f,p,m]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function yH(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=()=>ic(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)(),[f,p]=(0,Z.useState)(!1),m;t[3]!==r.projectId||t[4]!==a?(m={projectId:r.projectId,worktreeId:a},t[3]=r.projectId,t[4]=a,t[5]=m):m=t[5];let h;t[6]!==i||t[7]!==m?(h={connection:i,scope:m},t[6]=i,t[7]=m,t[8]=h):h=t[8];let{result:g,submit:_}=lH(h,r,bH),v;t[9]!==f||t[10]!==c||t[11]!==u||t[12]!==_?(v=()=>void _({options:c,...u?{confirmation:{plan:u,discardChanges:f}}:{}},d,()=>{d(void 0),p(!1)}),t[9]=f,t[10]=c,t[11]=u,t[12]=_,t[13]=v):v=t[13];let y=v,b=g.waiting,x=Object.values(c).some(Boolean),S=u&&(u.dirty||u.unpushed),C=u&&!u.worktreePath&&!u.localBranch&&!u.remoteBranch,w=`Review deletion`;u&&(w=`Delete`),b&&(w=`Checking`);let T;t[14]!==o||t[15]!==c||t[16]!==b?(T=Ks.map(e=>{let{key:t,label:n}=e;return(0,Q.jsxs)(Ui,{orientation:`horizontal`,children:[(0,Q.jsx)(Ur,{htmlFor:`delete-${t}`,children:n}),(0,Q.jsx)(Kr,{id:`delete-${t}`,checked:c[t],disabled:b||o&&t!==`deleteWorktree`,onCheckedChange:e=>{l(n=>({...n,[t]:e})),d(void 0),p(!1)},className:`cursor-pointer`})]},t)}),t[14]=o,t[15]=c,t[16]=b,t[17]=T):T=t[17];let E;t[18]===o?E=t[19]:(E=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]=E);let D;t[20]!==o||t[21]!==c?(D=!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]=D):D=t[22];let O;t[23]!==o||t[24]!==c?(O=!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]=O):O=t[25];let k;t[26]!==T||t[27]!==E||t[28]!==D||t[29]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[T,E,D,O]}),t[26]=T,t[27]=E,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]!==r.path||t[32]!==u?(A=u?(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-all text-xs text-muted-foreground`,children:Sc(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]=A):A=t[33];let j;t[34]!==f||t[35]!==b||t[36]!==S?(j=S&&(0,Q.jsxs)(Ui,{orientation:`horizontal`,children:[(0,Q.jsx)(Ur,{htmlFor:`delete-discard-changes`,children:`I understand the risk of losing changes and commits`}),(0,Q.jsx)(Kr,{id:`delete-discard-changes`,checked:f,disabled:b,onCheckedChange:p,className:`cursor-pointer`})]}),t[34]=f,t[35]=b,t[36]=S,t[37]=j):j=t[37];let M;t[38]===g?M=t[39]:(M=q(g)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:kc(Yt(g.cause))}),t[38]=g,t[39]=M);let N;t[40]===b?N=t[41]:(N=(0,Q.jsx)(QM,{disabled:b,children:`Cancel`}),t[40]=b,t[41]=N);let P=u?`destructive`:`default`,F=b||!x||!!(C||S&&!f),I;t[42]!==w||t[43]!==y||t[44]!==P||t[45]!==F?(I=(0,Q.jsx)(X,{variant:P,disabled:F,onClick:y,children:w}),t[42]=w,t[43]=y,t[44]=P,t[45]=F,t[46]=I):I=t[46];let L;t[47]!==N||t[48]!==I?(L=(0,Q.jsxs)(JM,{children:[N,I]}),t[47]=N,t[48]=I,t[49]=L):L=t[49];let R;return t[50]!==A||t[51]!==j||t[52]!==M||t[53]!==L||t[54]!==k?(R=(0,Q.jsxs)(Q.Fragment,{children:[k,A,j,M,L]}),t[50]=A,t[51]=j,t[52]=M,t[53]=L,t[54]=k,t[55]=R):R=t[55],R}function bH(){return yF.close()}function xH(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:er,run:()=>At(Ie(i),`project path`),destructive:!1},t[3]=i,t[4]=s);let c;t[5]===o?c=t[6]:(c={label:`Rename project`,icon:bn,run:()=>gF.openWithPayload(o),destructive:!1},t[5]=o,t[6]=c);let l;t[7]===o?l=t[8]:(l={label:`Remove from Porcelain`,icon:If,run:()=>_F.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)(Lr,{render:(0,Q.jsx)(X,{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)(uf,{}),t[15]=m):m=t[15];let h;t[16]===p?h=t[17]:(h=(0,Q.jsx)(Ts,{render:p,children:m}),t[16]=p,t[17]=h);let g;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(tt,{children:`Project actions`}),t[18]=g):g=t[18];let _;t[19]===h?_=t[20]:(_=(0,Q.jsxs)(ke,{disableHoverablePopup:!0,children:[h,g]}),t[19]=h,t[20]=_);let v;t[21]===i?v=t[22]:(v=!i.available&&(0,Q.jsx)(Xo,{children:Zn(i)}),t[21]=i,t[22]=v);let y;t[23]===d?y=t[24]:(y=d.map(SH),t[23]=d,t[24]=y);let b;t[25]!==v||t[26]!==y?(b=(0,Q.jsx)(Li,{className:`w-56 max-w-[calc(100vw-2rem)]`,children:(0,Q.jsxs)(Oi,{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)(ro,{children:[_,b]}),t[28]=_,t[29]=b,t[30]=x):x=t[30],x}function SH(e){let{label:t,icon:n,run:r,destructive:i}=e;return(0,Q.jsxs)(br,{className:`cursor-pointer`,variant:i?`destructive`:`default`,onClick:r,children:[(0,Q.jsx)(n,{}),t]},t)}function CH(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(wH)&&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)(_r,{text:n}),t[5]=n,t[6]=m);let h;t[7]!==p||t[8]!==m?(h=(0,Q.jsx)(di,{"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)(ke,{disableHoverablePopup:!0,children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(Je,{variant:`secondary`,role:`img`,tabIndex:0,"aria-label":u}),children:(0,Q.jsx)(_i,{icon:i})}),(0,Q.jsx)(tt,{children:r})]}):(0,Q.jsxs)(Je,{variant:`secondary`,className:`max-w-20`,role:`img`,"aria-label":u,children:[(0,Q.jsx)(_i,{icon:i}),(0,Q.jsx)(_r,{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 wH(e){return e.scrollWidth>e.clientWidth}function TH(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)(_r,{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 EH(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)(qr,{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)(wp,{className:`text-muted-foreground`}),t[2]=n):n=t[2];let i;t[3]===e?i=t[4]:(i=(0,Q.jsx)(Ts,{render:e,children:n}),t[3]=e,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(tt,{role:`tooltip`,children:`Open project`}),t[5]=a):a=t[5];let o;return t[6]===i?o=t[7]:(o=(0,Q.jsxs)(ke,{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)(ke,{disableHoverablePopup:!0,children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(Lr,{render:(0,Q.jsx)(qr,{className:`relative top-0 right-0 ml-auto w-6 cursor-pointer`,"aria-label":`Open project`})}),children:(0,Q.jsx)(wp,{className:`text-muted-foreground`})}),(0,Q.jsx)(tt,{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)(Xo,{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)(Rn,{}),t[12]=s):s=t[12];let c;t[13]===o?c=t[14]:(c=(0,Q.jsxs)(br,{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)(DH,{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)(ro,{children:[i,(0,Q.jsx)(Li,{align:`end`,className:`w-56`,children:(0,Q.jsxs)(Oi,{children:[a,c,l]})})]}),t[20]=c,t[21]=l,t[22]=u):u=t[22],u}function DH(e){let t=(0,$.c)(11),{entry:n,onOpen:r}=e,i=_s(n.remote),a=i.kind===`online`,o=!a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(be,{}),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)(_r,{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)(Je,{variant:G(i),className:`relative top-0 right-0 ml-auto w-6 cursor-pointer`,children:D(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)(br,{disabled:o,onClick:r,children:[s,l,u]}),t[6]=r,t[7]=o,t[8]=l,t[9]=u,t[10]=d):d=t[10],d}function OH(e){let t=(0,$.c)(7),{container:n}=e,{toasts:r}=Xc();if(!n)return null;let i;t[0]===r?i=t[1]:(i=r.map(kH),t[0]=r,t[1]=i);let a;t[2]===i?a=t[3]:(a=(0,Q.jsx)(gc,{children:i}),t[2]=i,t[3]=a);let o;return t[4]!==n||t[5]!==a?(o=(0,Q.jsx)(jc,{container:n,children:a}),t[4]=n,t[5]=a,t[6]=o):o=t[6],o}function kH(e){return(0,Q.jsx)(eu,{toast:e,children:(0,Q.jsxs)(bc,{children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 wrap-anywhere`,children:[(0,Q.jsx)(oc,{}),(0,Q.jsx)(wc,{})]}),(0,Q.jsx)(Ns,{}),(0,Q.jsx)(Xl,{})]})},e.id)}function AH(e){return(0,Q.jsxs)(va,{render:(0,Q.jsx)(`span`,{className:`block`}),children:[(0,Q.jsxs)(`span`,{className:`block`,children:[e.failures.length,` `,e.failures.length===1?`worktree`:`worktrees`,` ·`,` `,(0,Q.jsx)(ti,{render:(0,Q.jsx)(X,{variant:`link`,size:`sm`}),children:`Details`})]}),(0,Q.jsx)(Wo,{render:(0,Q.jsx)(`span`,{className:`block`}),children:(0,Q.jsx)(`span`,{role:`list`,tabIndex:0,"aria-label":`Affected worktrees`,className:`mt-2 block max-h-48 space-y-2 overflow-y-auto`,children:e.failures.map(({entry:e,detail:t})=>(0,Q.jsxs)(`span`,{role:`listitem`,className:`block wrap-anywhere`,children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:e.name}),t&&(0,Q.jsx)(`span`,{className:`block`,children:t})]},e.key))})})]})}var jH={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 MH(e){let t=(0,$.c)(129),{remotes:n,selected:r,openReview:i,onSelect:o,onOpenPullRequest:s,onOpenProject:l,onOpenSettings:u,settingsOpen:d,onOpenShortcuts:f}=e,{connection:p}=ns(),[m,h]=(0,Z.useState)(null),g=nL(),_=nL(),v=nL(),y=[p,...(n??[]).map(LH)],{projects:b,filters:x,loading:S,messages:C}=Yr(Ue(y)),w=Yr(Ft),T=fa(Ft),{query:E,filter:D}=w;Ba(Xn(y));let O=fa(_e(y));Ba(VI({connections:y,description:AH}));let k=hd(),A;t[0]===k.href?A=t[1]:(A={href:k.href,open:!1},t[0]=k.href,t[1]=A);let[j,M]=(0,Z.useState)(A),N=j.href===k.href&&j.open,P;t[2]===T?P=t[3]:(P=e=>T(t=>({...t,query:e})),t[2]=T,t[3]=P);let F=P,I=D.projects!==void 0||D.environments!==void 0||D.reviews!==void 0||D.older,{setOpenMobile:L,isMobile:R}=pr(),z=r?{kind:`worktree`,worktreeId:r.worktreeId,environmentId:r.remote??p.environmentId}:void 0,B=i?{kind:`review`,reviewId:i.reviewId,environmentId:i.environment??p.environmentId}:z,V,H;if(t[4]!==b){let e=b.flatMap(IH).filter(FH);V=e[0]?.key,H=e.at(-1)?.key,t[4]=b,t[5]=V,t[6]=H}else V=t[5],H=t[6];let U=H,W;t[7]!==p||t[8]!==o||t[9]!==L?(W=e=>{e.worktreeId&&(o({remote:e.environmentId===p.environmentId?null:e.environmentId,projectId:e.projectId,worktreeId:e.worktreeId}),L(!1))},t[7]=p,t[8]=o,t[9]=L,t[10]=W):W=t[10];let G=W,K;t[11]!==l||t[12]!==n?(K=(0,Q.jsx)(TH,{children:(0,Q.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,Q.jsx)(EH,{remotes:n,onOpenProject:l})})}),t[11]=l,t[12]=n,t[13]=K):K=t[13];let ee;t[14]===F?ee=t[15]:(ee=e=>F(e.target.value),t[14]=F,t[15]=ee);let te;t[16]!==_||t[17]!==v||t[18]!==E||t[19]!==F?(te=e=>{e.key===`Escape`&&E.length>0&&(e.stopPropagation(),F(``)),(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),(e.key===`ArrowDown`?_:v).element?.focus())},t[16]=_,t[17]=v,t[18]=E,t[19]=F,t[20]=te):te=t[20];let q;t[21]!==R||t[22]!==E||t[23]!==ee||t[24]!==te?(q=(0,Q.jsx)(uL,{autoFocus:R,type:`search`,"aria-label":`Search reviews and worktrees`,placeholder:`Search`,value:E,onChange:ee,onKeyDown:te}),t[21]=R,t[22]=E,t[23]=ee,t[24]=te,t[25]=q):q=t[25];let ne;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(oL,{children:(0,Q.jsx)(Mp,{})}),t[26]=ne):ne=t[26];let re;t[27]===q?re=t[28]:(re=(0,Q.jsxs)(iL,{className:`min-w-0 flex-1`,children:[q,ne]}),t[27]=q,t[28]=re);let ie;t[29]===k.href?ie=t[30]:(ie=e=>M({href:k.href,open:e}),t[29]=k.href,t[30]=ie);let ae;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsxs)(ke,{disableHoverablePopup:!0,children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(Lr,{render:(0,Q.jsx)(qr,{"aria-label":`Filter worktrees`,className:`relative top-0 right-0 w-6 cursor-pointer`})}),children:(0,Q.jsx)(cp,{})}),(0,Q.jsx)(tt,{children:`Filter worktrees`})]}),t[31]=ae):ae=t[31];let oe;if(t[32]!==x||t[33]!==T){let e;t[35]===T?e=t[36]:(e=e=>(0,Q.jsxs)(Oi,{children:[(0,Q.jsx)(Xo,{children:e.label}),e.items.map(t=>(0,Q.jsxs)(Da,{className:`cursor-pointer`,checked:t.checked,closeOnClick:!1,onCheckedChange:()=>T(n=>({...n,filter:{...n.filter,[e.key]:t.next}})),children:[t.icon&&(0,Q.jsx)(_i,{icon:t.icon}),(0,Q.jsx)(_r,{propagateEscape:!0,text:t.label,className:`min-w-0 flex-1`})]},t.id)),(0,Q.jsx)(bs,{})]},e.key),t[35]=T,t[36]=e),oe=x.map(e),t[32]=x,t[33]=T,t[34]=oe}else oe=t[34];let se;t[37]===T?se=t[38]:(se=e=>T(t=>({...t,filter:{...t.filter,older:e}})),t[37]=T,t[38]=se);let ce;t[39]!==D.older||t[40]!==se?(ce=(0,Q.jsx)(Da,{className:`cursor-pointer`,checked:D.older,closeOnClick:!1,onCheckedChange:se,children:`Show older reviews`}),t[39]=D.older,t[40]=se,t[41]=ce):ce=t[41];let le;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Q.jsx)(bs,{}),t[42]=le):le=t[42];let ue;t[43]===T?ue=t[44]:(ue=(0,Q.jsx)(br,{className:`cursor-pointer`,onClick:()=>T(PH),children:`Clear filters`}),t[43]=T,t[44]=ue);let de;t[45]!==oe||t[46]!==ce||t[47]!==ue?(de=(0,Q.jsx)(Li,{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:[oe,ce,le,ue]})}),t[45]=oe,t[46]=ce,t[47]=ue,t[48]=de):de=t[48];let fe;t[49]!==N||t[50]!==ie||t[51]!==de?(fe=(0,Q.jsxs)(ro,{open:N,onOpenChange:ie,children:[ae,de]}),t[49]=N,t[50]=ie,t[51]=de,t[52]=fe):fe=t[52];let pe;t[53]!==re||t[54]!==fe?(pe=(0,Q.jsxs)(`div`,{className:`navigator-filters mb-2 flex items-center gap-1 px-2`,children:[re,fe]}),t[53]=re,t[54]=fe,t[55]=pe):pe=t[55];let J=ua,me;t[56]===S?me=t[57]:(me=S&&(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)(wi,{"aria-label":`Reading worktrees`}),`Reading worktrees…`]}),t[56]=S,t[57]=me);let he=b.map(e=>(0,Q.jsx)(zo,{children:(0,Q.jsxs)(va,{open:e.expanded,onOpenChange:t=>T(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)(CH,{projectName:e.project.name,environmentName:e.environmentName,environmentIcon:e.environmentIcon,showEnvironment:y.length>1}),(0,Q.jsx)(xH,{project:e.project,environmentId:e.connection.environmentId===p.environmentId?null:e.connection.environmentId,environmentName:e.environmentName}),(0,Q.jsxs)(ke,{disableHoverablePopup:!0,children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(ti,{render:(0,Q.jsx)(qr,{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)(a,{className:`group-data-closed/project:-rotate-90`})}),(0,Q.jsx)(tt,{children:e.expanded?`Collapse project`:`Expand project`})]})]}),(0,Q.jsx)(Wo,{children:(0,Q.jsxs)(Ja,{children:[e.entries.map(t=>{let n=B!==void 0&&Wa(t,B),r=t.review.state===`available`?t.review:void 0,i=r?.checks?.state===`available`?r.checks.result:`none`,a=Wi(t.changes),o=t.kind===`review`,l=Na(t),u=o?``:Po(t.changes),d=t.changes.state===`unavailable`?`—`:u,f=o||!t.available&&r!==void 0,m=t.key===U?v.attach:void 0;t.key===V&&(m=_.attach);let h=`${Dr(t)}${n?`, Current`:``}`;return(0,Q.jsx)(ba,{children:(0,Q.jsx)($I,{onRetryChanges:()=>O({environmentId:t.environmentId}),entry:t,connection:y.find(t=>t.environmentId===e.connection.environmentId)??p,children:(0,Q.jsx)(_r,{text:t.path?`${t.name} · ${t.path}`:t.name,disclose:t.detached?`always`:`clipped`,renderTrigger:(e,o)=>(0,Q.jsxs)(`div`,{"data-navigator-card":``,role:`presentation`,tabIndex:-1,className:n?`relative rounded-md bg-card`:`relative rounded-md hover:bg-card`,children:[(0,Q.jsx)(fr,{className:`absolute inset-0 h-full cursor-pointer`,"data-sidebar":`menu-button`,size:`xs`,"aria-label":h,"aria-current":n?`page`:void 0,onClick:()=>f?L(!1):G(t),render:f&&r?(0,Q.jsx)(xi,{ref:m,to:`/reviews/$reviewId`,params:{reviewId:r.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)(fr,{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:[o(t.name,n?`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`}),r?.pullRequestNumber&&(0,Q.jsx)(X,{variant:`ghost`,size:`xs`,className:`relative pointer-events-auto cursor-pointer`,"aria-label":`Open PR #${r.pullRequestNumber} · ${t.projectName} · ${t.environmentName} · ${vo(r.checks)}`,onClick:()=>{s(t),L(!1)},children:(0,Q.jsxs)(`span`,{className:jH[i],children:[`PR #`,r.pullRequestNumber]})})]}),(l||u)&&(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2 text-xs text-muted-foreground`,children:[l&&o(l,`min-w-0 flex-1`),u&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0`,role:`img`,"aria-label":`Local uncommitted changes: ${u}`,children:a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:`text-add-fg`,children:[`+`,a.additions]}),` `,(0,Q.jsxs)(`span`,{className:`text-del-fg`,children:[`−`,a.deletions]}),a.binaryFiles>0&&` · ${a.binaryFiles} binary`]}):d})]})]})})]})})})},t.key)}),e.entries.length===0&&!S&&(0,Q.jsx)(`p`,{className:`px-2 py-3 text-xs text-muted-foreground`,children:`No matching worktrees`})]})})]})},e.key)),ge;t[58]!==I||t[59]!==S||t[60]!==C.length||t[61]!==b.length||t[62]!==E?(ge=!S&&C.length===0&&b.length===0&&(0,Q.jsx)(dL,{children:(0,Q.jsxs)(fL,{children:[(0,Q.jsx)(pL,{children:E.trim()||I?`No matching worktrees`:`No projects registered`}),(0,Q.jsx)(mL,{children:E.trim()||I?`Try another search or clear the filters.`:`Open a Git repository to get started.`})]})}),t[58]=I,t[59]=S,t[60]=C.length,t[61]=b.length,t[62]=E,t[63]=ge):ge=t[63];let ve;t[64]===C?ve=t[65]:(ve=C.map(NH),t[64]=C,t[65]=ve);let ye;t[66]!==S||t[67]!==C.length||t[68]!==O?(ye=C.length>0&&(0,Q.jsx)(X,{variant:`ghost`,disabled:S,onClick:()=>O(void 0),children:`Read again`}),t[66]=S,t[67]=C.length,t[68]=O,t[69]=ye):ye=t[69];let be;t[70]!==J||t[71]!==me||t[72]!==he||t[73]!==ge||t[74]!==ve||t[75]!==ye?(be=(0,Q.jsxs)(J,{children:[me,he,ge,ve,ye]}),t[70]=J,t[71]=me,t[72]=he,t[73]=ge,t[74]=ve,t[75]=ye,t[76]=be):be=t[76];let xe;t[77]===m?xe=t[78]:(xe=(0,Q.jsx)(`div`,{ref:h,children:(0,Q.jsx)(Js,{toastManager:BI,children:(0,Q.jsx)(OH,{container:m})})}),t[77]=m,t[78]=xe);let Se;t[79]===g?Se=t[80]:(Se=e=>g.attach(e),t[79]=g,t[80]=Se);let Ce=d?`Close Settings`:`Settings`,we=d?`submit`:`button`,Te=d?`close-settings`:void 0,Ee=d?void 0:u,De;t[81]===d?De=t[82]:(De=e=>{d&&e.key===`Escape`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},t[81]=d,t[82]=De);let Oe;t[83]!==Se||t[84]!==Ce||t[85]!==we||t[86]!==Te||t[87]!==Ee||t[88]!==De?(Oe=(0,Q.jsx)(X,{ref:Se,variant:`ghost`,className:`min-w-0 shrink`,"aria-label":Ce,type:we,form:Te,onClick:Ee,onKeyDown:De}),t[83]=Se,t[84]=Ce,t[85]=we,t[86]=Te,t[87]=Ee,t[88]=De,t[89]=Oe):Oe=t[89];let Ae;t[90]===d?Ae=t[91]:(Ae=d?(0,Q.jsx)(kn,{}):(0,Q.jsx)(Pp,{className:`text-muted-foreground`}),t[90]=d,t[91]=Ae);let je=d?`Close`:`Settings`,Me;t[92]===je?Me=t[93]:(Me=(0,Q.jsx)(_r,{text:je}),t[92]=je,t[93]=Me);let Ne;t[94]===d?Ne=t[95]:(Ne=d&&(0,Q.jsx)(eL,{children:uc(Ic.closeSettings)}),t[94]=d,t[95]=Ne);let Pe;t[96]!==Oe||t[97]!==Ae||t[98]!==Me||t[99]!==Ne?(Pe=(0,Q.jsxs)(Ts,{render:Oe,children:[Ae,Me,Ne]}),t[96]=Oe,t[97]=Ae,t[98]=Me,t[99]=Ne,t[100]=Pe):Pe=t[100];let Fe=d?`Close Settings`:`Settings`,Ie=d?Ic.closeSettings:Ic.openSettings,Le;t[101]===Ie?Le=t[102]:(Le=uc(Ie),t[101]=Ie,t[102]=Le);let Re;t[103]===Le?Re=t[104]:(Re=(0,Q.jsx)(eL,{children:Le}),t[103]=Le,t[104]=Re);let ze;t[105]!==Fe||t[106]!==Re?(ze=(0,Q.jsxs)(tt,{role:`tooltip`,children:[Fe,` `,Re]}),t[105]=Fe,t[106]=Re,t[107]=ze):ze=t[107];let Be;t[108]!==Pe||t[109]!==ze?(Be=(0,Q.jsxs)(ke,{disableHoverablePopup:!0,children:[Pe,ze]}),t[108]=Pe,t[109]=ze,t[110]=Be):Be=t[110];let Ve;t[111]===g?Ve=t[112]:(Ve=(0,Q.jsx)(jo,{fallbackFocus:g}),t[111]=g,t[112]=Ve);let He;t[113]===f?He=t[114]:(He=(0,Q.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":`Keyboard shortcuts`,onClick:f}),t[113]=f,t[114]=He);let We;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Q.jsx)(np,{className:`text-muted-foreground`}),t[115]=We):We=t[115];let Ge;t[116]===He?Ge=t[117]:(Ge=(0,Q.jsx)(Ts,{render:He,children:We}),t[116]=He,t[117]=Ge);let Ke;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Q.jsxs)(tt,{role:`tooltip`,children:[`Keyboard shortcuts`,` `,(0,Q.jsx)(eL,{children:uc(Ic.openShortcuts)})]}),t[118]=Ke):Ke=t[118];let qe;t[119]===Ge?qe=t[120]:(qe=(0,Q.jsxs)(ke,{disableHoverablePopup:!0,children:[Ge,Ke]}),t[119]=Ge,t[120]=qe);let Je;t[121]!==Ve||t[122]!==qe?(Je=(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[Ve,qe]}),t[121]=Ve,t[122]=qe,t[123]=Je):Je=t[123];let Ye;t[124]!==Be||t[125]!==Je?(Ye=(0,Q.jsxs)(`footer`,{role:`group`,"aria-label":`Navigator controls`,className:`navigator-footer flex shrink-0 items-center gap-1 p-2`,children:[Be,Je]}),t[124]=Be,t[125]=Je,t[126]=Ye):Ye=t[126];let Xe,Ze;return t[127]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,Q.jsx)(gH,{}),Ze=(0,Q.jsx)(fH,{}),t[127]=Xe,t[128]=Ze):(Xe=t[127],Ze=t[128]),(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)(Rr,{role:`navigation`,collapsible:`none`,className:`h-full w-full min-h-0 overflow-hidden`,"aria-label":`Projects and worktrees`,children:[K,pe,be,xe,Ye]}),Xe,Ze]})}function NH(e){return(0,Q.jsx)(`p`,{role:`status`,className:`px-3 text-xs wrap-anywhere`,children:e},e)}function PH(e){return{...e,filter:oi}}function FH(e){return e.available||e.kind===`review`||e.review.state===`available`}function IH(e){return e.expanded?e.entries:[]}function LH(e){return e.connection}function RH(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)(zH,{environmentId:n,children:i}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function zH(e){let t=(0,$.c)(3),{environmentId:n,children:r}=e,i=W(n),a;return t[0]!==r||t[1]!==i?(a=i&&(0,Q.jsx)(BH,{entry:i,children:r}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function BH(e){let t=(0,$.c)(6),{entry:n,children:r}=e,i=_s(n.remote),a;t[0]===i?a=t[1]:(a=i.kind===`online`?void 0:`${D(i)}. ${tn(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 VH(e){let t=(0,$.c)(5),{unavailable:n,result:r}=e,i;t[0]!==r||t[1]!==n?(i=n??(q(r)?ha(Yt(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)(lo,{variant:`destructive`,children:(0,Q.jsx)(rr,{children:a})}),t[3]=a,t[4]=o),o}function HH(e){let t=(0,$.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(RM,{handle:_F,children:e=>{let{payload:t}=e;return t&&(0,Q.jsx)(RH,{remote:t.remote,connection:n,children:e=>(0,Q.jsx)(KM,{children:(0,Q.jsx)(UH,{project:t.project,...e},t.project.id)})})}}),t[0]=n,t[1]=r),r}function UH(e){let t=(0,$.c)(32),{project:n,connection:r,unavailable:i}=e,a=sH(r,WH),{result:o}=a,s;t[0]===n.name?s=t[1]:(s=(0,Q.jsxs)(YM,{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)(XM,{children:`Removes this project and its reviews and comments from Porcelain; files and Git history stay on disk.`}),t[2]=c):c=t[2];let l;t[3]===s?l=t[4]:(l=(0,Q.jsxs)(qM,{children:[s,c]}),t[3]=s,t[4]=l);let u;t[5]===n?u=t[6]:(u=Ie(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)(VH,{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)(QM,{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)(wi,{}),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)(ZM,{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)(JM,{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 WH(){return _F.close()}var GH=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 KH(e,t){return new GH(e,t).maybeExecute}var qH=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)}},JH=new class extends qH{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function YH(e,t){return typeof e==`function`?e(t):e}function XH(e,t){return iU(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function ZH(e,t,n){let r=iU(t);function i(e){if(!r.length)return YH(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 QH(e,t){let n=iU(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 $H=46,eU=91,tU=93,nU=48,rU=57;function iU(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)===eU),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===$H||s===eU||s===tU){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==nU),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!==tU&&(a!==-1||s!==tU)&&(a!==s||s!==$H&&s!==eU)&&n.push(``);r=o+1,i=!0}else(s<nU||s>rU)&&(i=!1);a=s}return n.length||n.push(``),n}function aU(e){return!(Array.isArray(e)&&e.length===0)}function oU(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 sU(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 cU=e=>!!e&&typeof e==`object`&&`fields`in e;function lU(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)||!lU(e[i],t[i]))return!1;return!0}var uU=({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},dU=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function fU(e,t){return e==null?t:{...e,...t}}for(var pU=256,mU=[],hU;pU--;)mU[pU]=(pU+256).toString(16).substring(1);function gU(){let e=0,t,n=``;if(!hU||pU+16>256){for(hU=Array(256),e=256;e--;)hU[e]=256*Math.random()|0;e=0,pU=0}for(;e<16;e++)t=hU[pU+e],n+=e===6?mU[t&15|64]:e===8?mU[t&63|128]:mU[t],e&1&&e>1&&e<11&&(n+=`-`);return pU++,n}var _U=KH(e=>JH.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function vU(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]=vU(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,vU(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(vU(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=vU(e[n]));return t}function yU(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var bU=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 xU(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 SU=(e,t)=>{let n=xU(e,t);return{form:n,fields:n}},CU={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:SU(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:SU(r.issues,e)}},wU=e=>!!e&&`~standard`in e,TU={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function EU(e){function t(t){let n=e.getFieldMeta(t)??TU;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=()=>TU;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function DU(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 OU=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{_U(this)}),t=JH.on(`request-form-state`,e=>{e.payload.id===this._formId&&JH.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=JH.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=JH.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(),JH.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return JH.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&&!lU(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!lU(e.defaultState,t.defaultState)&&!this.state.isTouched;if(n||r){if(wu(()=>{this.baseStore.setState(()=>DU(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=EU(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}JH.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=ZH(t,e.instance.name,e.instance.options.defaultValue))}),DU({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return wu(()=>{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 wu(()=>{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=oU(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||bU}),r=!1,i={};return wu(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=kU(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=AU(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)??TU,r=a?.[e],{newErrorValue:s,newSource:c}=uU({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=TU)=>({...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=AU(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=AU(`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=sU(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||bU});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=AU(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}=kU(r);s&&(i=i?{...i,...s}:s);let c=AU(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)??TU,r=i?.[e],{newErrorValue:a,newSource:o}=uU({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=TU)=>({...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})),wu(()=>{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}),JH.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}),JH.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}wu(()=>{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}),wu(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),JH.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),JH.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>XH(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]:YH(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=TU,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;wu(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:ZH(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=QH(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),EU(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],fU(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),EU(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),fU(r,{dontValidate:!0})),EU(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),fU(n,{dontValidate:!0})),EU(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 ZH(ZH(e,`${t}`,i),`${n}`,r)},fU(r,{dontValidate:!0})),EU(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},fU(r,{dontValidate:!0})),EU(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,[],fU(t,{dontValidate:!0})),EU(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=XH(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:TU},values:i===void 0?t.values:ZH(t.values,e,i)}})},this.setErrorMap=e=>{wu(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(cU(t)){let{formError:e,fieldErrors:r}=kU(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=>CU.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>CU.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??gU(),this._devtoolsSubmissionOverride=!1;let t=DU({...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&&cU(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=pc(t);let n;this.fieldMetaDerived=pc(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=XH(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=!aU(u),f=!o.isDirty,p=lU(l,this.getFieldInfo(a)?.instance?.options.defaultValue??XH(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=pc(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||!yU(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&&yU(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=pc(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&&cU(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&&lU(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 wU(e.validate)?CU[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function kU(e){return e?cU(e)?{formError:kU(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function AU(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 jU=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]:{...TU,isTouched:e.fieldMetaBase[this.name]?.isTouched??TU.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??TU.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??TU.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&&(lU(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,fU(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,fU(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,fU(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,fU(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,fU(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,fU(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,fU(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,fU(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=oU(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||bU}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=oU(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||bU});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;wu(()=>{let e=(e,n)=>{let r=NU(n.cause),a=n.validate?MU(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}=dU({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=NU(`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=sU(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||bU}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=sU(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||bU});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)));wu(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=NU(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=MU(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=dU({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)),wu(()=>{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=>yU(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[NU(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[NU(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=>CU.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>CU.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)yU(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=pc(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...TU,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!lU(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 wU(e.validate)?CU[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 MU(e){if(e)return e}function NU(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 PU(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function FU(e){return{...TU,...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 IU=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??PU({});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&&(lU(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,{...TU,...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]??PU({...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;RU(t)&&(n=t.group,r=t.fields);let i=LU(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]:PU({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,fU(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 jU&&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&&yU(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}=uU({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=TU)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=oU(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||bU}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=oU(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||bU});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;wu(()=>{let t=(t,r)=>{let i=BU(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&&RU(s)&&(c=s.group,l=s.fields);let u=LU(c),d=n[i],{newErrorValue:f,newSource:p}=dU({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=BU(`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=sU(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||bU}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=sU(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||bU});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=BU(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&&RU(o)&&(l=o.group,u=o.fields);let d=LU(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=dU({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 wu(()=>{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=>yU(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[BU(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>yU(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})),wu(()=>{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}wu(()=>{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}),wu(()=>{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=pc(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??FU(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!lU(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(wU(e.validate)){let t=CU[e.type](e.value,e.validate);return e.type===`validate`?zU(t):t.then(zU)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function LU(e){if(e)return e}function RU(e){return!!e&&typeof e==`object`&&`fields`in e}function zU(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 BU(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 VU(e,t){if(!t)return;let n=Object.assign({},e,{state:vU(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 wu(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var HU=typeof window<`u`?Z.useLayoutEffect:Z.useEffect;function UU(e){let[t,n]=(0,Z.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,Z.useState)(()=>new jU({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new jU({...e}),i(a),n({form:e.form,name:e.name}));let o=yd(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=yd(a.store,e=>e.meta.isTouched),c=yd(a.store,e=>e.meta.isBlurred),l=yd(a.store,e=>e.meta.isDirty),u=yd(a.store,e=>e.meta.errorMap),d=yd(a.store,e=>e.meta.errorSourceMap),f=yd(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 HU(a.mount,[a]),HU(()=>{a.update(e)}),p}var WU=(({children:e,...t})=>{let n=UU(t),r=(0,Z.useMemo)(()=>YH(e,n),[e,n]);return(0,Q.jsx)(Q.Fragment,{children:r})});function GU(){return(0,Z.useState)(()=>gU())[0]}var KU=Z,qU=`19.2.8`.split(`.`)[0]===`17`?GU:KU.useId;function JU(e){let[t,n]=(0,Z.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,Z.useState)(()=>new IU({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new IU({...e})),n({form:e.form,name:e.name}));let a=yd(r.store,e=>e.value),o=yd(r.store,e=>e.meta.isTouched),s=yd(r.store,e=>e.meta.isBlurred),c=yd(r.store,e=>e.meta.isDirty),l=yd(r.store,e=>e.meta.errorMap),u=yd(r.store,e=>e.meta.errorSourceMap),d=yd(r.store,e=>e.meta.isValidating),f=yd(r.store,e=>e.meta.isSubmitting),p=yd(r.store,e=>e.meta.isSubmitted),m=yd(r.store,e=>e.meta.submissionAttempts),h=yd(r.store,e=>e.meta.isSubmitSuccessful),g=yd(r.store,e=>e.meta.canSubmit),_=yd(r.store,e=>e.meta.isValid),v=yd(r.store,e=>e.meta.isFieldsValid),y=yd(r.store,e=>e.meta.isFieldsValidating),b=yd(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 HU(r.mount,[r]),HU(()=>{r.update(e)}),x}var YU=(({children:e,...t})=>{let n=JU(t),r=(0,Z.useMemo)(()=>YH(e,n),[e,n]);return(0,Q.jsx)(Q.Fragment,{children:r})});function XU({form:e,selector:t=e=>e,children:n}){let r=yd(e.store,t);return(0,Q.jsx)(Q.Fragment,{children:YH(n,r)})}function ZU(e){let t=qU(),[n,r]=(0,Z.useState)(e?.formId),[i,a]=(0,Z.useState)(()=>new OU({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new OU({...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)(WU,{...e,form:i})},e.FormGroup=function(e){return(0,Q.jsx)(YU,{...e,form:i})},e.Subscribe=function(e){return(0,Q.jsx)(XU,{form:i,selector:e.selector,children:e.children})},e},[i]);HU(i.mount,[]),HU(()=>{i.update(e)});let s=(0,Z.useRef)(!1);return HU(()=>{s.current&&e?.transform&&VU(i,e.transform)},[i,e?.transform]),HU(()=>{s.current=!0}),o}function QU(e){let t=(0,$.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(Qo,{handle:gF,children:e=>{let{payload:t}=e;return t&&(0,Q.jsx)(RH,{remote:t.remote,connection:n,children:e=>(0,Q.jsx)(FF,{children:(0,Q.jsx)($U,{project:t.project,...e},t.project.id)})})}}),t[0]=n,t[1]=r),r}function $U(e){let t=(0,$.c)(40),{project:n,connection:r,unavailable:i}=e,a=oH(r,rW),{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:cH},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=ZU(u),f;t[9]===d?f=t[10]:(f=e=>Mt(e,()=>d.handleSubmit()),t[9]=d,t[10]=f);let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsxs)(IF,{children:[(0,Q.jsx)(RF,{children:`Rename project`}),(0,Q.jsx)(zF,{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:nW}),t[12]=d.Field,t[13]=m);let h;t[14]===n?h=t[15]:(h=Ie(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)(VH,{unavailable:i,result:o}),t[21]=o,t[22]=i,t[23]=v):v=t[23];let y;t[24]===o.waiting?y=t[25]:(y=(0,Q.jsx)(X,{type:`button`,variant:`outline`,disabled:o.waiting,onClick:tW,children:`Cancel`}),t[24]=o.waiting,t[25]=y);let b;t[26]!==o.waiting||t[27]!==i?(b=e=>(0,Q.jsxs)(X,{type:`submit`,disabled:!e||o.waiting||i!==void 0,children:[o.waiting&&(0,Q.jsx)(wi,{}),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:eW,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)(LF,{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 eW(e){return e.canSubmit}function tW(){return gF.close()}function nW(e){return(0,Q.jsxs)(Ui,{"data-invalid":e.state.meta.isTouched&&!e.state.meta.isValid,children:[(0,Q.jsx)($a,{htmlFor:`project-name`,children:`Name`}),(0,Q.jsx)(ae,{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)(Ua,{id:`project-name-error`,errors:e.state.meta.errors})]})}function rW(){return gF.close()}function iW(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function aW(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function oW(e){return e/100*window.innerHeight}function sW(e){return e/100*window.innerWidth}function cW(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 lW({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=cW(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=aW(t,i);break;case`em`:r=iW(t,i);break;case`vh`:r=oW(i);break;case`vw`:r=sW(i)}return r}function uW(e){return parseFloat(e.toFixed(3))}function dW({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 fW(e){let{panels:t}=e,n=dW({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=uW(lW({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=uW(lW({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=uW(lW({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=uW(lW({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 pW(e,t=`Assertion error`){if(!e)throw Error(t)}function mW(e,t){return Array.from(t).sort(e===`horizontal`?hW:gW)}function hW(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function gW(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function _W(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function vW(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 yW({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}=vW(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return pW(i,`No rect found`),i}var bW;function xW(){return bW===void 0&&(bW=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),bW}function SW(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=mW(n,Array.from(t.children).filter(_W).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,yW({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=xW()?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:dW({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 CW=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)}}},wW={cursorFlags:0,state:`inactive`},TW=new CW;function EW(){return wW}function DW(e){return TW.addListener(`change`,e)}function OW(e){let t=wW,n={...wW};n.cursorFlags=e,wW=n,TW.emit(`change`,{prev:t,next:n})}function kW(e){let t=wW;wW=e,TW.emit(`change`,{prev:t,next:e})}var AW=e=>e,jW=()=>{},MW=1,NW=2,PW=4,FW=8,IW=3,LW=12,RW;function zW(){return RW===void 0&&(RW=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(RW=!0)),RW}function BW({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&&zW()){let t=(e&MW)!==0,n=(e&NW)!==0,r=(e&PW)!==0,i=(e&FW)!==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 zW()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var VW=new WeakMap;function HW(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=VW.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=EW();switch(r.state){case`active`:case`hover`:{let e=BW({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)}VW.set(e,{prevStyle:t,styleSheet:n})}var UW=new Map,WW=new CW;function GW(e){UW=new Map(UW),UW.delete(e)}function KW(e,t){for(let[t]of UW)if(t.id===e)return t}function qW(e,t){for(let[t,n]of UW)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function JW(){return UW}function YW(e,t){return WW.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function XW(e,t,n){let r=UW.get(e);UW=new Map(UW),UW.set(e,t),WW.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function ZW(e){let t=EW(),n=JW(),r=!1;return t.state===`active`&&(kW({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(HW(e),r=!0,t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=qW(e.group.id,!0);XW(e.group,t,{isUserInteraction:!0})}))),r}function QW(e){e.defaultPrevented||ZW(e.currentTarget)}function $W(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=vW(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 eG(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function tG(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:sG(e),b:sG(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();pW(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:oG(aG(n.a)),b:oG(aG(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 nG=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function rG(e){let t=getComputedStyle(cG(e)??e).display;return t===`flex`||t===`inline-flex`}function iG(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||rG(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`||nG.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function aG(e){let t=e.length;for(;t--;){let n=e[t];if(pW(n,`Missing node`),iG(n))return n}return null}function oG(e){return e&&Number(getComputedStyle(e).zIndex)||0}function sG(e){let t=[];for(;e;)t.push(e),e=cG(e);return t}function cG(e){let{parentNode:t}=e;return eG(t)?t.host:t}function lG(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 uG({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!_W(n)||n.contains(e)||e.contains(n))return!0;if(tG(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(lG(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function dG(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=SW(r),a=$W(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&uG({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function fG(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 pG(e,t,n=0){return Math.abs(uW(e)-uW(t))<=n}function mG(e,t){return pG(e,t)?0:e>t?1:-1}function hG({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(mG(r,c)<0){if(a){let e=(i+c)/2;r=mG(r,e)<0?i:c}else r=c}return r=Math.min(s,r),r=uW(r),r}function gG({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(pG(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;pW(u!=null,`Invalid first pivot index`),pW(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];pW(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(pW(n!=null,`Previous layout not found for panel index ${t}`),pG(n,i)){let t=o-n;mG(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];pW(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(pW(n!=null,`Previous layout not found for panel index ${t}`),pG(n,o)){let t=n-i;mG(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];pW(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&mG(i,c)<0){if(e>0){let t=c-o,n=t/2;mG(i+e,c)<0&&(e=mG(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;mG(i-e,c)<0&&(e=mG(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];pW(e!=null,`Previous layout not found for panel index ${r}`);let a=hG({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];pW(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=hG({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!pG(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(fG(c,l))return i;{let t=e<0?d:u,r=s[t];pW(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=hG({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!pG(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];pW(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=hG({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(pG(i,s)||(t-=s-i,l[r]=s),pG(t,0))break;e>0?r--:r++}}}if(!pG(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 _G(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||mG(e[n],t[n])!==0)return!1;return!0}function vG({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(!pG(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];pW(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];pW(i!=null,`No layout data found for index ${e}`);let o=r[e];pW(o!=null,`No layout data found for index ${e}`);let s=hG({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!pG(a,0))for(let e=0;e<t.length;e++){let n=r[e];pW(n!=null,`No layout data found for index ${e}`);let i=n+a,o=hG({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,pG(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function yG({groupId:e,panelId:t}){let n=()=>{let t=JW();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&&pG(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:uW(100-e)}}return gG({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=vG({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});_G(c,u)||XW(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&&pG(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=dW({group:t}),o=uW(lW({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function bG(e){e.defaultPrevented||dG(e,JW()).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=yG({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function xG(e){let t=JW();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 SG({groupId:e}){let t=()=>{let t=JW();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=vG({layout:e,panelConstraints:r});return n?o:(_G(o,c)||XW(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function CG(e,t){let n=xG(e),r=qW(n.id,!0),i=n.separators.find(t=>t.element===e);pW(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);pW(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=SG({groupId:n.id}).getLayout(),c=vG({layout:gG({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});_G(s,c)||XW(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function wG(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=xG(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&CG(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&CG(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&CG(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&CG(t,-5);break;case`End`:e.preventDefault(),CG(t,100);break;case`Enter`:{e.preventDefault();let n=xG(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=qW(n.id,!0),o=n.separators.find(e=>e.element===t);pW(o,`Matching separator not found`);let s=a.get(o);pW(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(pW(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];CG(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=xG(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);pW(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(),CG(t,-100)}}function TG(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=JW(),n=dG(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)}),kW({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function EG({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=gG({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(_G(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?MW:NW;break;case`vertical`:s|=d<0?PW:FW}}else XW(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&IW:c|=s&IW,t.movementY===0?c|=o&LW:c|=s&LW,OW(c),HW(e)}function DG(e){let t=JW(),n=EW();n.state===`active`&&EG({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function OG(e){if(e.defaultPrevented)return;let t=EW(),n=JW();switch(t.state){case`active`:if(e.buttons===0){kW({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=qW(e.group.id,!0);XW(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)}EG({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=dG(e,n);r.length===0?t.state!==`inactive`&&kW({cursorFlags:0,state:`inactive`}):kW({cursorFlags:0,hitRegions:r,state:`hover`}),HW(e.currentTarget);break}}}function kG(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(EW().state){case`hover`:kW({cursorFlags:0,state:`inactive`})}}function AG(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||ZW(e.currentTarget)&&e.preventDefault()}function jG(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=uW(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=uW((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function MG(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=dW({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:uW(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function NG(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 PG(e,t){return e.length===t.length&&e.every((e,n)=>NG(e,t[n]))}function FG({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=uW(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]=uW((r[e]??0)/a*l);else{let e=uW(l/c.length);for(let t of c)u[t]=e}return u}function IG(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 LG=new Map;function RG(e){let t=!0;pW(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=dW({group:e});if(t===0)return;let n=qW(e.id);if(!n)return;let r=fW(e),i=n.defaultLayoutDeferred?jG(r):n.layout,a=vG({layout:FG({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&_G(n.layout,a)&&PG(n.derivedPanelConstraints,r)&&n.groupSize===t)continue;XW(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else MG(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{pW(!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=dW({group:e}),s=fW(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(IG(e.panels,l)||(l=void 0));let u=vG({layout:e.mutableState.layouts[c]??l??jG(s),panelConstraints:s}),d=e.element.ownerDocument;LG.set(d,(LG.get(d)??0)+1);let f=new Map;return SW(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),XW(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{pW(!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`,wG)}),LG.get(d)===1&&(d.addEventListener(`contextmenu`,QW,!0),d.addEventListener(`dblclick`,bG,!0),d.addEventListener(`pointerdown`,TG,!0),d.addEventListener(`pointerleave`,DG),d.addEventListener(`pointermove`,OG),d.addEventListener(`pointerout`,kG),d.addEventListener(`pointerup`,AG,!0)),function(){t=!1,LG.set(d,Math.max(0,(LG.get(d)??0)-1)),GW(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,wG)}),LG.get(d)||(d.removeEventListener(`contextmenu`,QW,!0),d.removeEventListener(`dblclick`,bG,!0),d.removeEventListener(`pointerdown`,TG,!0),d.removeEventListener(`pointerleave`,DG),d.removeEventListener(`pointermove`,OG),d.removeEventListener(`pointerout`,kG),d.removeEventListener(`pointerup`,AG,!0)),a.disconnect()}}function zG(){let[e,t]=(0,Z.useState)({});return[e,(0,Z.useCallback)(()=>t({}),[])]}function BG(e){let t=(0,Z.useId)();return`${e??t}`}var VG=typeof window<`u`?Z.useLayoutEffect:Z.useEffect;function HG(e){let t=(0,Z.useRef)(e);return VG(()=>{t.current=e},[e]),(0,Z.useCallback)((...e)=>t.current?.(...e),[t])}function UG(...e){return HG(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t}})})}function WG(e){let t=(0,Z.useRef)({...e});return VG(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var GG=(0,Z.createContext)(null);function KG(e,t){let n=(0,Z.useRef)({getLayout:()=>({}),setLayout:AW});(0,Z.useImperativeHandle)(t,()=>n.current,[]),VG(()=>{Object.assign(n.current,SG({groupId:e}))})}function qG({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=HG(e=>{_G(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=HG((e,t)=>{_G(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=BG(s),v=(0,Z.useRef)(null),[y,b]=zG(),x=(0,Z.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=UG(v,a);KG(_,o);let C=HG((e,t)=>{let r=EW(),i=KW(e),a=qW(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=WG({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=mW(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=mW(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=KW(_),i=qW(_);r&&i&&XW(r,{...i,derivedPanelConstraints:fW(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 VG(()=>{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=RG(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=qW(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=YW(_,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=pG(t.collapsedSize,i[t.panelId]),a=pG(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=EW().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)(GG.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})})}qG.displayName=`Group`;function JG(){let e=(0,Z.useContext)(GG);return pW(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function YG(e,t){let{id:n}=JG(),r=(0,Z.useRef)({collapse:jW,expand:jW,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:jW});(0,Z.useImperativeHandle)(t,()=>r.current,[]),VG(()=>{Object.assign(r.current,yG({groupId:n,panelId:e}))})}function XG({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=BG(c),_=WG({disabled:a}),v=(0,Z.useRef)(null),y=UG(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=JG(),T=d!==null,E=HG((e,t,n)=>{d?.(e,c,n)});VG(()=>{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]),YG(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Z.useSyncExternalStore)(e=>YW(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:{...ZG,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})})}XG.displayName=`Panel`;var ZG={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function QG({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=vG({layout:gG({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=vG({layout:gG({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function $G({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=BG(a),l=WG({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),_=UG(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=JG(),C=b===`horizontal`?`vertical`:`horizontal`;VG(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=DW(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=YW(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(QG({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})}$G.displayName=`Separator`;function eK({className:e,...t}){return(0,Q.jsx)(qG,{"data-slot":`resizable-panel-group`,className:Y(`flex h-full w-full aria-[orientation=vertical]:flex-col`,e),...t})}function tK({...e}){return(0,Q.jsx)(XG,{"data-slot":`resizable-panel`,...e})}function nK({withHandle:e,className:t,...n}){return(0,Q.jsx)($G,{"data-slot":`resizable-handle`,className:Y(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,t),...n,children:e&&(0,Q.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`})})}function rK(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)(Ai,{open:n,onOpenChange:r,children:i}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function iK(e){let t=(0,$.c)(17),{navigator:n,isMobile:r,open:i,children:a}=e,o=(r||!i)&&`desktop-workspace-without-navigator`,s;t[0]===o?s=t[1]:(s=Y(`h-svh min-w-0 flex-1 bg-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)(tK,{id:`navigator`,defaultSize:248,minSize:220,maxSize:420,children:(0,Q.jsx)(MH,{...n})}),(0,Q.jsx)(nK,{"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)(tK,{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)(eK,{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 aK(e,t,n,r){let i=(0,$.c)(14),a;i[0]!==e||i[1]!==t?(a=Us({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]=wr(a.archive,o),l=hs(),u=un(),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 oK(e){let t=(0,$.c)(29),{connection:n,reviewId:r,beforeLeave:i,menuItem:a}=e,o=i===void 0?sK:i,s=a!==void 0&&a,c=Bs(n),l;t[0]===c?l=t[1]:(l=Qc(c),t[0]=c,t[1]=l);let u=l,d;t[2]===c?d=t[3]:(d=dc(c),t[2]=c,t[3]=d);let f=d,{submit:p}=aK(n,r),m;t[4]!==o||t[5]!==n||t[6]!==r||t[7]!==u||t[8]!==p?(m=()=>{if(!u)return;let e=Jl(u);vF.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)(XI,{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)(X,{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)(Ts,{render:v}),t[22]=v,t[23]=y);let b;t[24]===f?b=t[25]:(b=(0,Q.jsx)(tt,{children:f}),t[24]=f,t[25]=b);let x;return t[26]!==y||t[27]!==b?(x=(0,Q.jsxs)(ke,{children:[y,b]}),t[26]=y,t[27]=b,t[28]=x):x=t[28],x}function sK(){}function cK(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(RM,{handle:vF,children:lK}),e[0]=t):t=e[0],t}function lK(e){let{payload:t}=e;return t&&(0,Q.jsx)(uK,{...t},t.requestId)}function uK(e){let t=(0,$.c)(31),{connection:n,reviewId:r,options:i,beforeLeave:a}=e,{result:o,submit:s}=aK(n,r,dK,a),[c,l]=(0,Z.useState)(!1),u;t[0]===o?u=t[1]:(u=$e(o)?o.value:void 0,t[0]=o,t[1]=u);let d=u?.plan,f=`Checking the worktree and branches…`;if(q(o)&&(f=`Archiving could not be completed.`),d){let e;t[2]===d?e=t[3]:(e=Ql(d),t[2]=d,t[3]=e),f=e}let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(YM,{children:`Archive review?`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Q.jsxs)(qM,{children:[p,(0,Q.jsx)(XM,{className:`whitespace-pre-wrap [overflow-wrap:anywhere]`,children:f})]}),t[5]=f,t[6]=m);let h;t[7]===o?h=t[8]:(h=q(o)?(0,Q.jsx)(`p`,{role:`alert`,children:js(Yt(o.cause))}):null,t[7]=o,t[8]=h);let g;t[9]!==c||t[10]!==d?(g=d&&(d.dirty||d.unpushed)?(0,Q.jsxs)(Ui,{orientation:`horizontal`,children:[(0,Q.jsx)(Kr,{checked:c,onCheckedChange:l,id:`archive-discard-changes`}),(0,Q.jsx)(Ur,{htmlFor:`archive-discard-changes`,children:`I understand the risk of losing changes and commits`})]}):null,t[9]=c,t[10]=d,t[11]=g):g=t[11];let _;t[12]===o.waiting?_=t[13]:(_=(0,Q.jsx)(QM,{disabled:o.waiting,children:`Cancel`}),t[12]=o.waiting,t[13]=_);let v=o.waiting||!d||(d.dirty||d.unpushed)&&!c,y;t[14]!==c||t[15]!==i||t[16]!==d||t[17]!==s?(y=()=>{d&&s({options:i,confirmation:{plan:d,discardChanges:c}})},t[14]=c,t[15]=i,t[16]=d,t[17]=s,t[18]=y):y=t[18];let b=o.waiting?`Checking…`:`Archive review`,x;t[19]!==v||t[20]!==y||t[21]!==b?(x=(0,Q.jsx)(X,{variant:`destructive`,disabled:v,onClick:y,children:b}),t[19]=v,t[20]=y,t[21]=b,t[22]=x):x=t[22];let S;t[23]!==x||t[24]!==_?(S=(0,Q.jsxs)(JM,{children:[_,x]}),t[23]=x,t[24]=_,t[25]=S):S=t[25];let C;return t[26]!==S||t[27]!==m||t[28]!==h||t[29]!==g?(C=(0,Q.jsxs)(KM,{children:[m,h,g,S]}),t[26]=S,t[27]=m,t[28]=h,t[29]=g,t[30]=C):C=t[30],C}function dK(){return vF.close()}function fK(e,t){return gi(t).filter(t=>{let n=e.getItem(t);return n!==null&&`isExpanded`in n&&n.isExpanded()})}function pK(e){let t=(0,$.c)(30),n=(0,Z.useId)(),r;t[0]===n?r=t[1]:(r=Sl(n),t[0]=n,t[1]=r);let i=r,a=Yr(Et),[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 hK(e,a,i,l,s)},t[6]=i,t[7]=a,t[8]=f):f=t[8];let[p]=(0,Z.useState)(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,ir(e))}}),t[10]=i,t[11]=e,t[12]=a,t[13]=g):g=t[13];let _;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`div`,{ref:p,className:`flex min-h-0 flex-1 flex-col`}),t[14]=_):_=t[14];let v;t[15]===g?v=t[16]:(v=(0,Q.jsxs)(qI,{render:h,children:[g,_]}),t[15]=g,t[16]=v);let y;t[17]!==d||t[18]!==o||t[19]!==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[17]=d,t[18]=o,t[19]=c,t[20]=y):y=t[20];let b;t[21]!==d||t[22]!==c||t[23]!==e.renderMenu?(b=c&&e.renderMenu(c.item,{finalFocus:d?c.finalFocus:mK,close:c.close},c.rename),t[21]=d,t[22]=c,t[23]=e.renderMenu,t[24]=b):b=t[24];let x;return t[25]!==b||t[26]!==m||t[27]!==v||t[28]!==y?(x=(0,Q.jsxs)(KI,{open:m,onOpenChange:s,children:[v,y,b]}),t[25]=b,t[26]=m,t[27]=v,t[28]=y,t[29]=x):x=t[29],x}function mK(){return!1}function hK(e,t,n,r,i){let a=()=>Cn(t.get(n)),o=nu(a().owner),s=t.get(o),c=new Set(s.expanded),l=!a().filter&&s.document===a().selected&&!(document.activeElement instanceof HTMLInputElement),u=!0,d=!1,f=!1,p={selected:s.document,complete:s.document===a().selected},m=null,h,g,_=new Set;function v(e){let t=requestAnimationFrame(()=>{_.delete(t),u&&e()});_.add(t)}let y=new gw({paths:a().paths,density:`default`,flattenEmptyDirectories:!0,initialExpansion:a().filter?`open`:`closed`,icons:Cw(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,renaming:{onError:e=>{m=null,a().onInvalidName(e),queueMicrotask(()=>{u&&y.resetPaths(a().paths)})},onRename:e=>{f=!0;let t=m;m=null,(t?.path.replace(/\/$/,``)===e.sourcePath.replace(/\/$/,``)?a().onCreate(e.destinationPath,t.kind):a().onMove(e.sourcePath,e.destinationPath)).catch(()=>{u&&y.resetPaths(a().paths)})}},dragAndDrop:{canDrag:()=>(d=!0,queueMicrotask(()=>{d=!1}),!0),canDrop:({draggedPaths:e,target:t})=>$r(e,t.directoryPath??``),onDropComplete:e=>{let t=a().onMove;an(ga(e.draggedPaths,e.target.directoryPath??``,(e,n)=>z({try:()=>t(e,n),catch:e=>new it(e)}))).catch(()=>{u&&y.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&&!f&&e&&m?.path.replace(/\/$/,``)!==e.replace(/\/$/,``)&&e!==a().selected&&a().onSelect(e)}});function b(){a().bindCollapseAll(()=>{d=!0,c.clear(),l=!1,p={selected:a().selected,complete:!0};let e=nu(a().owner.replace(/:search$/,``));t.set(e,{...t.get(e),expanded:[],document:a().selected,focused:null,anchor:null}),a().onFilterChange(``),y.resetPaths(a().paths,{initialExpandedPaths:[]}),d=!1}),a().bindRename(e=>a().onRequestRename(e))}function x(){let e=a().renameRequest;e&&!a().filter&&g!==e.nonce&&y.getItem(e.path)!==null&&(g=e.nonce,v(()=>{d=!0,y.startRenaming(e.path)&&e.onStart(),d=!1}))}function S(){let{creating:t}=a();if(!t||h===t.nonce)return;h=t.nonce;let n=Ei(t.kind,t.folder,e=>y.getItem(e)!==null);m={path:n,kind:t.kind},y.add(n),y.startRenaming(n,{removeIfCanceled:!0}),v(()=>{let t=e.querySelector(`[data-slot="file-tree"]`)?.shadowRoot?.querySelector(`[data-item-rename-input]`);t instanceof HTMLInputElement&&t.focus()})}function C(){let e=fK(y,a().paths).map(e=>e.replace(/\/$/,``));e.length&&!a().filter&&a().onExpand(e)}function w(){a().onContentHeight?.(y.getVisibleCount()*y.getItemHeight())}function T(){if(m)return;let{selected:e}=a(),t=a().paths;p.selected!==e&&(p={selected:e,complete:!1});let n=Uc(t.flatMap(e=>{let t=a().kinds.get(e);return t===void 0?[]:[{path:e,kind:t}]}),new Set([...fK(y,t),...c]),new Set(gi(t).filter(e=>y.getItem(e)!==null))).map(e=>`${e}/`);d=!0;{let r=p.complete?[]:vr(e);y.resetPaths(t,{initialExpandedPaths:a().filter?gi(t):[...new Set([...n,...r])]});for(let e of c)y.getItem(e)!==null&&c.delete(e);let i=y.getItem(e);!p.complete&&i&&!i.isDirectory()&&(i.select(),p.complete=!0)}if(d=!1,l){d=!0;for(let e of s.selected)y.getItem(e)?.select();s.focused&&y.getItem(s.focused)&&y.focusPath(s.focused),s.anchor&&y.getItem(s.anchor)&&(y.scrollToPath(s.anchor,{focus:!1,offset:`top`}),l=!1),d=!1}C()}let E;function D(){let e=a();b(),(!E||E.paths.join(`\0`)!==e.paths.join(`\0`)||E.selected!==e.selected)&&T(),E?.gitStatus!==e.gitStatus&&y.setGitStatus(e.gitStatus),E?.links!==e.links&&y.setIcons(Cw(e.links)),E=e,S(),x(),w()}let O=y.onMutation(`move`,()=>{f=!1}),k=t.subscribe(n,D),A=y.subscribe(()=>{w(),d||C()});function j(e){let t=m;if(!t)return;let n=e.composedPath().find(e=>e instanceof HTMLInputElement&&e.hasAttribute(`data-item-rename-input`));if(n?.value.trim()===``){m=null,v(T);return}n?.value===Ta(t.path)&&(m=null,a().onCreate(t.path,t.kind).catch(()=>{u&&y.resetPaths(a().paths)}))}function M(e){let t=e.composedPath().find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-item-path`)),n=t?.dataset.itemPath,o=n===void 0?null:y.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:()=>a().onRequestRename(n),item:{path:n,name:Ta(n),kind:o.isDirectory()?`directory`:`file`}}),!0}function N(e){if(e.key===`F2`&&!m){let t=y.getFocusedPath();t&&(e.preventDefault(),e.stopPropagation(),a().onRequestRename(t))}e.key===`Enter`&&j(e),e.key===`Escape`&&m&&(m=null,v(T))}function P(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=y.getItem(n);if(r&&m?.path!==n){e.preventDefault(),e.stopPropagation(),d=!0;for(let e of y.getSelectedPaths())e!==n&&y.getItem(e)?.deselect();r.select(),d=!1,a().onSelect(n,e.altKey)}}function F(e){M(e)||e.stopPropagation()}return e.addEventListener(`keydown`,N,!0),e.addEventListener(`click`,P,!0),e.addEventListener(`blur`,j,!0),e.addEventListener(`contextmenu`,F,!0),e.addEventListener(`touchstart`,F,!0),y.render({containerWrapper:e}),y.getFileTreeContainer()?.setAttribute(`class`,`min-h-0 flex-1`),y.getFileTreeContainer()?.setAttribute(`data-slot`,`file-tree`),y.getFileTreeContainer()?.setAttribute(`aria-label`,`Worktree files`),D(),()=>{let n=y.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([...fK(y,a().paths),...c])],selected:y.getSelectedPaths(),focused:y.getFocusedPath(),anchor:i,document:a().selected}),u=!1;for(let e of _)cancelAnimationFrame(e);k(),A(),O(),a().bindRename(()=>void 0),a().bindCollapseAll(()=>void 0),e.removeEventListener(`keydown`,N,!0),e.removeEventListener(`click`,P,!0),e.removeEventListener(`blur`,j,!0),e.removeEventListener(`contextmenu`,F,!0),e.removeEventListener(`touchstart`,F,!0),y.cleanUp(),e.replaceChildren()}}function gK(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`?At(t.path,`relative path`):e===`copy-full`?At(`${t.worktreePath.replace(/\/$/,``)}/${t.path}`,`full path`):t.onTrash(t.path)}var _K=Zr(Ot());function vK(e,t,n){let r=(0,$.c)(7),i=n===void 0||n,a;r[0]!==e||r[1]!==i||r[2]!==t?(a=i?vs({connection:e,scope:t}):_K,r[0]=e,r[1]=i,r[2]=t,r[3]=a):a=r[3];let o=a,s=Yr(o),c=Br(o),l;return r[4]!==s||r[5]!==c?(l={result:s,refresh:c},r[4]=s,r[5]=c,r[6]=l):l=r[6],l}var yK={"new-file":Sf,"new-folder":Rf,rename:bn,duplicate:cf,open:vf,"open-file":vf,"open-to-side":of,"open-diff":bf,timeline:Ap,pin:bp,hide:mf,"copy-relative":er,"copy-full":er,trash:Jp};function bK(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)(SK,{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)(JI,{"aria-label":s,className:`w-max max-w-[calc(100vw-2rem)] whitespace-nowrap`,onKeyDownCapture:xK,finalFocus:r,children:c}),t[4]=r,t[5]=s,t[6]=c,t[7]=l):l=t[7],l}function xK(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 SK({actions:e,hidden:t,onAction:n}){return e.map(e=>(0,Q.jsx)(CK,{action:e,onAction:n,hidden:t},e.id))}function CK(e){let t=(0,$.c)(15),{action:n,onAction:r,hidden:i}=e,a=n.id===`hide`&&i?gf:yK[n.id],o;t[0]===n.id?o=t[1]:(o=(n.id===`hide`||n.id===`copy-relative`||n.id===`trash`)&&(0,Q.jsx)(ZI,{}),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)(XI,{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 wK(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 TK={added:`A`,deleted:`D`,modified:`M`,renamed:`R`,untracked:`U`},EK={resolved:`Not followed`,loading:`Loading…`,missing:`Missing`,unavailable:`Listing unavailable · Open as file`};function DK(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(OK)),t[0]=s,t[1]=m);let h=m,g;t[2]===n.length?g=t[3]:(g=(0,Q.jsx)(wK,{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)(KI,{onOpenChange:e=>{e&&p(!1)},children:[(0,Q.jsxs)(qI,{render:(0,Q.jsx)(`li`,{className:`flex flex-wrap items-center gap-0.5`}),children:[(0,Q.jsx)(_r,{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:Y(`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)(Dw,{expanded:s,className:`size-4 shrink-0`}):(0,Q.jsx)(Dw,{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:Y(`ml-auto shrink-0 pl-1 font-mono text-2xs text-muted-foreground`,h.get(t)===TK.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:EK[e.state]}),e.state===`unavailable`&&(0,Q.jsx)(X,{variant:`outline`,size:`xs`,onClick:a,children:`Try again`}),(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(X,{size:`icon-xs`,variant:`ghost`,"aria-label":`Unpin ${t}`,onClick:()=>u(t)}),children:(0,Q.jsx)(Sp,{})}),(0,Q.jsx)(tt,{role:`tooltip`,className:`break-all`,children:`Unpin ${t}`})]}),n&&s&&(0,Q.jsx)(`div`,{className:`w-full`,children:o(t)})]}),(0,Q.jsx)(JI,{finalFocus:!f,children:(0,Q.jsx)(SK,{actions:_.actions,hidden:_.hidden,onAction:e=>{e===`open-to-side`&&(0,bd.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 OK(e){let t=TK[e.status];return t===void 0?[]:[[e.path,t]]}function kK(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)(AK,{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 AK(e){let t=(0,$.c)(86),{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s,actionsTarget:c}=e,l=IM(r,n,``),u=uu(r,n),d=q(u.result)?Yt(u.result.cause):void 0,[f,p]=(0,Z.useState)(),[m,h]=(0,Z.useState)(),[g,_]=(0,Z.useState)(null),v=Vn(Dn(zP(n,r))),y=CF(r,n.projectId),b=oF(r,n.projectId),x=EF(r,n.projectId),S=sF(r,n.projectId),C=`${r.environmentId}:${n.projectId}:${n.worktreeId}`,w=Iu(C),{showHidden:T,query:E,requested:D,pinnedExpanded:O}=w.state,k;t[0]===E?k=t[1]:(k=E.trim(),t[0]=E,t[1]=k);let A=k!==``,j=vK(r,n,A),M;t[2]===w?M=t[3]:(M=e=>w.set(t=>({...t,showHidden:e})),t[2]=w,t[3]=M);let N=M,P;t[4]===w?P=t[5]:(P=e=>w.set(t=>({...t,query:e})),t[4]=w,t[5]=P);let F=P,I;t[6]===w?I=t[7]:(I=e=>w.set(t=>{let n=e(t.requested);return n===t.requested?t:{...t,requested:n}}),t[6]=w,t[7]=I);let L=I,R=E===``?`Collapse all`:`Clear search and collapse all`,z;t[8]!==x||t[9]!==D||t[10]!==a?(z=JK(JK(JK(D,Ul(x.map(qK))),[``]),Uu(a)),t[8]=x,t[9]=D,t[10]=a,t[11]=z):z=t[11];let B=LM(r,n,z),V=[l,...B.results.flatMap(KK)],H=Ws(V),U=A?Ku(zl(Vn(Dn(j.result))?.paths??[],y,T),E):[],W=JK(U,U.flatMap(WK)),G=[...H,...W.filter(e=>!H.some(t=>t.path===e)).map(UK)],K=A?W:G.map(HK),ee=zl(K,y,T),te=new Map(G.map(VK)),ne;t[12]===B.results?ne=t[13]:(ne=B.results.filter(q),t[12]=B.results,t[13]=ne);let re=ne,ie=[{path:``,status:`loaded`,entries:l.entries},...B.states],oe=cu(zl(x,y,T),ie),se=[...G.filter(BK).map(zK),...(v?.changes??[]).flatMap(RK).map(LK)],ce=new Set((v?.changes??[]).map(IK)),le=new Set(G.filter(FK).map(PK)),ue;t[14]===o?ue=t[15]:(ue=(e,t)=>o({kind:`file`,path:e},void 0,{toSide:t!==void 0&&t}),t[14]=o,t[15]=ue);let de=ue,fe=e=>u.duplicate(e,to(e,e=>te.has(e)),de),pe;t[16]!==fe||t[17]!==u.result.waiting||t[18]!==a?(pe=()=>{u.result.waiting||fe(a)},t[16]=fe,t[17]=u.result.waiting,t[18]=a,t[19]=pe):pe=t[19];let J=le.has(a),me;t[20]===J?me=t[21]:(me={enabled:J,ignoreInputs:!0},t[20]=J,t[21]=me),Qs(Ic.duplicateFile,pe,me);let he=(e,t)=>{let n=t!==void 0&&t,r=te.get(e);r===`symlink`||r===`submodule`?o({kind:`file`,path:e},void 0,{toSide:n}):r===`file`&&de(e,n)},{collapseAll:ge,renameFile:_e,bindCollapseAll:ve,bindRename:ye}=El(C),be=e=>{let t=Fl(e,y),n=G.find(t=>Ol(t.path)===Ol(e));return{hidden:t!==null,actions:Fi(n,{changed:ce.has(e),openToSideLabel:s,hiddenEntry:t,ownHidden:t===Ol(e),hiddenName:t?.replace(/\/$/,``).split(`/`).at(-1)??``,pinned:n?.kind===`file`||n?.kind===`directory`?x.includes(Ol(e)):void 0}),run:(n,r,a)=>gK(n,{path:e,hiddenEntry:t,worktreePath:i,close:r,rename:a,onStartCreate:(e,t)=>{u.result.waiting||p({kind:e,folder:t,nonce:Date.now()})},onOpenFile:e=>o({kind:`file`,path:e}),onOpenToSide:e=>de(e,!0),onOpenDiff:e=>o({kind:`change`,path:e}),onOpenTimeline:e=>o({kind:`timeline`,path:e}),onSetHidden:(e,t)=>_t(b.submit({path:e,hidden:t})),onTogglePinned:e=>_t(S.submit({path:e,pinned:!x.includes(Ol(e))})),onTrash:_,onDuplicate:e=>{u.result.waiting||fe(e)}})}},xe;t[22]!==F||t[23]!==L?(xe=e=>{L(t=>JK(t,Uu(e))),F(``),h({path:e,nonce:Date.now()})},t[22]=F,t[23]=L,t[24]=xe):xe=t[24];let Se;t[25]!==u||t[26]!==o?(Se=(e,t)=>u.create(e,t,e=>o({kind:`file`,path:e})),t[25]=u,t[26]=o,t[27]=Se):Se=t[27];let Ce;t[28]===L?Ce=t[29]:(Ce=e=>L(t=>JK(t,e)),t[28]=L,t[29]=Ce);let we={owner:A?`${C}:search`:C,filter:A?E:``,onFilterChange:F,paths:ee,kinds:te,links:G.filter(NK),creating:f,renameRequest:m?{...m,onStart:()=>h(void 0)}:void 0,onRequestRename:xe,onCreate:Se,onMove:u.move,gitStatus:se,selected:a,bindRename:ye,bindCollapseAll:ve,onInvalidName:MK,renderMenu:(e,t,n)=>{let r=e.kind===`directory`&&!e.path.endsWith(`/`)?`${e.path}/`:e.path,i=be(r);return(0,Q.jsx)(bK,{path:r,finalFocus:t.finalFocus,actions:i.actions,hidden:i.hidden,onAction:e=>i.run(e,t.close,n)},r)},onExpand:Ce,onSelect:he},Te;t[30]===F?Te=t[31]:(Te=e=>F(e.target.value),t[30]=F,t[31]=Te);let Ee;t[32]!==E||t[33]!==Te?(Ee=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 px-2 pt-2`,children:(0,Q.jsx)(ae,{"aria-label":`Search files`,placeholder:`Search...`,value:E,onChange:Te,className:`h-7 w-auto min-w-0 flex-1`})}),t[32]=E,t[33]=Te,t[34]=Ee):Ee=t[34];let De;t[35]!==c||t[36]!==ge||t[37]!==R||t[38]!==u.result.waiting?(De=c&&(0,bd.createPortal)((0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(ro,{children:[(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(Lr,{render:(0,Q.jsx)(X,{size:`icon-sm`,variant:`ghost`,"aria-label":`Create file or folder`,disabled:u.result.waiting}),children:(0,Q.jsx)(wp,{className:`text-muted-foreground`})})}),(0,Q.jsx)(tt,{role:`tooltip`,className:`break-all`,children:`Create file or folder`})]}),(0,Q.jsxs)(Li,{align:`end`,children:[(0,Q.jsxs)(br,{onClick:()=>p({kind:`file`,folder:``,nonce:Date.now()}),children:[(0,Q.jsx)(Sf,{}),`New file`]}),(0,Q.jsxs)(br,{onClick:()=>p({kind:`directory`,folder:``,nonce:Date.now()}),children:[(0,Q.jsx)(Rf,{}),`New folder`]})]})]}),(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(X,{size:`icon-sm`,variant:`ghost`,"aria-label":R,onClick:()=>ge()}),children:(0,Q.jsx)(op,{className:`text-muted-foreground`})}),(0,Q.jsx)(tt,{role:`tooltip`,className:`break-all`,children:R})]})]}),c),t[35]=c,t[36]=ge,t[37]=R,t[38]=u.result.waiting,t[39]=De):De=t[39];let Oe;t[40]!==w||t[41]!==L?(Oe=(e,t)=>{w.set(n=>({...n,pinnedExpanded:t?JK(n.pinnedExpanded,[e]):n.pinnedExpanded.filter(t=>t!==e)})),t&&L(t=>JK(t,[e]))},t[40]=w,t[41]=L,t[42]=Oe):Oe=t[42];let Ae;t[43]===B?Ae=t[44]:(Ae=()=>B.retry(),t[43]=B,t[44]=Ae);let je;t[45]===S?je=t[46]:(je=e=>_t(S.submit({path:e,pinned:!1})),t[45]=S,t[46]=je);let Me;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Q.jsx)(wK,{label:`All files`}),t[47]=Me):Me=t[47];let Ne;t[48]!==j||t[49]!==A?(Ne=A&&q(j.result)&&(0,Q.jsxs)(`div`,{role:`alert`,className:`px-3 py-2 text-xs`,children:[`Could not search files.`,(0,Q.jsx)(X,{variant:`link`,size:`xs`,onClick:()=>j.refresh(),children:`Try again`})]}),t[48]=j,t[49]=A,t[50]=Ne):Ne=t[50];let Pe=g!==null,Fe;t[51]===u.result.waiting?Fe=t[52]:(Fe=e=>{!e&&!u.result.waiting&&_(null)},t[51]=u.result.waiting,t[52]=Fe);let Ie;t[53]===g?Ie=t[54]:(Ie=(0,Q.jsxs)(YM,{children:[`Move `,g,` to the trash?`]}),t[53]=g,t[54]=Ie);let Le=g!=null&&ce.has(g)?`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.`,Re;t[55]===Le?Re=t[56]:(Re=(0,Q.jsx)(XM,{children:Le}),t[55]=Le,t[56]=Re);let ze;t[57]!==Ie||t[58]!==Re?(ze=(0,Q.jsxs)(qM,{children:[Ie,Re]}),t[57]=Ie,t[58]=Re,t[59]=ze):ze=t[59];let Be;t[60]===u.result.waiting?Be=t[61]:(Be=(0,Q.jsx)(QM,{disabled:u.result.waiting,children:`Cancel`}),t[60]=u.result.waiting,t[61]=Be);let Ve;t[62]!==g||t[63]!==u?(Ve=()=>{g&&u.trash(g,()=>_(null))},t[62]=g,t[63]=u,t[64]=Ve):Ve=t[64];let He;t[65]!==u.result.waiting||t[66]!==Ve?(He=(0,Q.jsx)(X,{variant:`destructive`,disabled:u.result.waiting,onClick:Ve,children:`Move to trash`}),t[65]=u.result.waiting,t[66]=Ve,t[67]=He):He=t[67];let Ue;t[68]!==Be||t[69]!==He?(Ue=(0,Q.jsxs)(JM,{children:[Be,He]}),t[68]=Be,t[69]=He,t[70]=Ue):Ue=t[70];let We=d!==void 0&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:Vs(d)}),Ge;t[71]!==ze||t[72]!==Ue||t[73]!==We?(Ge=(0,Q.jsxs)(KM,{children:[ze,Ue,We]}),t[71]=ze,t[72]=Ue,t[73]=We,t[74]=Ge):Ge=t[74];let Ke;t[75]!==Pe||t[76]!==Fe||t[77]!==Ge?(Ke=(0,Q.jsx)(HM,{open:Pe,onOpenChange:Fe,children:Ge}),t[75]=Pe,t[76]=Fe,t[77]=Ge,t[78]=Ke):Ke=t[78];let qe;t[79]===S.result?qe=t[80]:(qe=q(S.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`border-t px-3 py-2 text-xs text-destructive`,children:Dc(Yt(S.result.cause))}),t[79]=S.result,t[80]=qe);let Je;t[81]===b.result?Je=t[82]:(Je=q(b.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`border-t px-3 py-2 text-xs text-destructive`,children:Dc(Yt(b.result.cause))}),t[81]=b.result,t[82]=Je);let Ye;return t[83]!==B||t[84]!==re.length?(Ye=re.length>0&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t px-3 py-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Some folders could not be loaded.`}),(0,Q.jsx)(X,{variant:`outline`,size:`xs`,onClick:()=>B.retry(),children:`Try again`})]}),t[83]=B,t[84]=re.length,t[85]=Ye):Ye=t[85],(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ee,De,(0,Q.jsx)(DK,{entries:oe,expanded:O,onExpand:Oe,onRetry:Ae,renderDirectory:e=>(0,Q.jsx)(YK,{prefix:`${e}/`,input:we}),statuses:se,selected:a,onOpen:de,onUnpin:je,menuFor:e=>{let t=be(e);return{actions:oe.some(t=>t.path===Ol(e)&&t.state===`resolved`)?t.actions:[],hidden:t.hidden,onAction:n=>t.run(n,jK,()=>_e(e))}}}),(0,Q.jsxs)(`section`,{"aria-label":`All files`,className:`flex min-h-0 flex-1 flex-col pt-1`,children:[Me,Ne,(0,Q.jsx)(pK,{...we},we.owner),y.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)(mf,{className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{children:bu(y,e=>te.get(e)??te.get(`${e}/`))}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsx)(X,{variant:`link`,size:`xs`,onClick:()=>N(!T),children:T?`Hide`:`Show`})]})]}),Ke,d!==void 0&&!g&&(0,Q.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-destructive`,children:Vs(d)}),qe,Je,Ye]})}function jK(){}function MK(e){return Is.add({title:`Invalid name`,description:e,type:`error`})}function NK(e){return e.kind===`symlink`||e.kind===`submodule`}function PK(e){return e.path}function FK(e){return e.kind===`file`}function IK(e){return e.path}function LK(e){return{path:fP(e),status:Vu(e)}}function RK(e){return e.comparisons}function zK(e){return{path:e.path,status:`ignored`}}function BK(e){return e.ignored}function VK(e){return[e.path,e.kind]}function HK(e){return e.path}function UK(e){return{path:e,kind:e.endsWith(`/`)?`directory`:`file`}}function WK(e){return Uu(e).map(GK)}function GK(e){return`${e}/`}function KK(e){return Jn(Dn(e))}function qK(e){return{path:e,pinned:!0,hidden:!1}}function JK(e,t){let n=[...new Set([...e,...t])].sort();return n.length===e.length&&n.every((t,n)=>t===e[n])?e:n}function YK(e){let t=(0,$.c)(73),{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,g;if(t[2]!==i||t[3]!==r||t[4]!==n||t[5]!==s){let e;t[15]===n?e=t[16]:(e=e=>e.startsWith(n)&&e!==n,t[15]=n,t[16]=e);let o=r.paths.filter(e);h=`flex max-h-52 min-h-0 flex-col pl-1.5`,t[17]===i?g=t[18]:(g={height:i},t[17]=i,t[18]=g),c=pK,l=r.owner,u=r,d=a,f=`${r.owner}:pin:${n}`,p=o.map(s);let _;t[19]!==r.kinds||t[20]!==s?(_=e=>{let t=r.kinds.get(e);return t===void 0?[]:[[s(e),t]]},t[19]=r.kinds,t[20]=s,t[21]=_):_=t[21],m=new Map(o.flatMap(_)),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,t[14]=g}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],g=t[14];let _;if(t[22]!==r.links||t[23]!==n||t[24]!==s){let e;t[26]===n?e=t[27]:(e=e=>e.path.startsWith(n),t[26]=n,t[27]=e);let i;t[28]===s?i=t[29]:(i=e=>({...e,path:s(e.path)}),t[28]=s,t[29]=i),_=r.links.filter(e).map(i),t[22]=r.links,t[23]=n,t[24]=s,t[25]=_}else _=t[25];let v;if(t[30]!==r.gitStatus||t[31]!==n||t[32]!==s){let e;t[34]===n?e=t[35]:(e=e=>e.path.startsWith(n),t[34]=n,t[35]=e);let i;t[36]===s?i=t[37]:(i=e=>({...e,path:s(e.path)}),t[36]=s,t[37]=i),v=r.gitStatus.filter(e).map(i),t[30]=r.gitStatus,t[31]=n,t[32]=s,t[33]=v}else v=t[33];let y;t[38]!==r.selected||t[39]!==n||t[40]!==s?(y=r.selected.startsWith(n)?s(r.selected):``,t[38]=r.selected,t[39]=n,t[40]=s,t[41]=y):y=t[41];let b,x,S,C,w;t[42]!==r||t[43]!==n?(b=e=>r.onRequestRename(`${n}${e}`),x=(e,t)=>r.onCreate(`${n}${e}`,t),S=(e,t)=>r.onMove(`${n}${e}`,`${n}${t}`),C=(e,t)=>r.onSelect(`${n}${e}`,t),w=e=>r.onExpand(e.map(e=>`${n}${e}`)),t[42]=r,t[43]=n,t[44]=b,t[45]=x,t[46]=S,t[47]=C,t[48]=w):(b=t[44],x=t[45],S=t[46],C=t[47],w=t[48]);let T;t[49]!==r||t[50]!==n?(T=(e,t,i)=>r.renderMenu({...e,path:`${n}${e.path}`},t,i),t[49]=r,t[50]=n,t[51]=T):T=t[51];let E;t[52]!==c||t[53]!==_||t[54]!==v||t[55]!==y||t[56]!==b||t[57]!==x||t[58]!==S||t[59]!==C||t[60]!==w||t[61]!==T||t[62]!==l||t[63]!==u||t[64]!==d||t[65]!==f||t[66]!==p||t[67]!==m?(E=(0,Q.jsx)(c,{...u,onContentHeight:d,owner:f,paths:p,kinds:m,links:_,gitStatus:v,selected:y,creating:void 0,renameRequest:void 0,onRequestRename:b,onCreate:x,onMove:S,onSelect:C,onExpand:w,bindRename:ZK,bindCollapseAll:XK,renderMenu:T},l),t[52]=c,t[53]=_,t[54]=v,t[55]=y,t[56]=b,t[57]=x,t[58]=S,t[59]=C,t[60]=w,t[61]=T,t[62]=l,t[63]=u,t[64]=d,t[65]=f,t[66]=p,t[67]=m,t[68]=E):E=t[68];let D;return t[69]!==E||t[70]!==h||t[71]!==g?(D=(0,Q.jsx)(`div`,{className:h,style:g,children:E}),t[69]=E,t[70]=h,t[71]=g,t[72]=D):D=t[72],D}function XK(){}function ZK(){}var QK=Am(),$K={toggle(){QK.isOpen?QK.close():QK.open(null)},close(){QK.close()}};function eq(e,t){let n=(0,$.c)(9),{query:r,setQuery:i}=Nl(),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 tq(e){let t=(0,$.c)(1),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={enabled:!0},t[0]=n):n=t[0],Qs(`Mod+P`,e,n)}function nq(e){let t=(0,$.c)(2);tq(rq);let n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(XV,{handle:QK,title:`Find a file`,description:`Find a file by name, or enter a relative path to open it.`,children:(0,Q.jsx)(iq,{...e})}),t[0]=e,t[1]=n),n}function rq(){return $K.toggle()}function iq(e){let t=(0,$.c)(15),{scope:n,connection:r,openFiles:i,onOpen:a,bindPopup:o}=e,{query:s,setQuery:c,select:l}=eq(a,$K),u=xF(r,n.projectId),d;t[0]===u.result?d=t[1]:(d=$e(u.result)&&!u.result.waiting?u.result.value:void 0,t[0]=u.result,t[1]=d);let f=d,p=new Set(f?.preferences.filter(oq).map(aq)??[]),m=Iu(`${r.environmentId}:${n.projectId}:${n.worktreeId}`).state.showHidden,h=YV,g;t[2]!==s||t[3]!==c?(g=(0,Q.jsx)(ZV,{"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]=g):g=t[4];let _;t[5]!==u||t[6]!==f?(_=f===void 0&&(0,Q.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:q(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)(X,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:()=>u.refresh(),children:`Try again`})]}):`Reading file visibility…`}),t[5]=u,t[6]=f,t[7]=_):_=t[7];let v=f!==void 0&&s.trim()===``&&(0,Q.jsx)(sq,{scope:n,connection:r,openFiles:zl(i,p,m),preferences:f.preferences.filter(e=>m||Fl(e.path,p)===null),onSelect:l}),y=f!==void 0&&s.trim()!==``&&(0,Q.jsx)(pq,{scope:n,connection:r,query:s,hidden:p,showHidden:m,onSelect:l}),b;return t[8]!==h||t[9]!==o||t[10]!==g||t[11]!==_||t[12]!==v||t[13]!==y?(b=(0,Q.jsxs)(h,{ref:o,shouldFilter:!1,children:[g,_,v,y]}),t[8]=h,t[9]=o,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function aq(e){return e.path}function oq(e){return e.hidden}function sq(e){let t=(0,$.c)(2),{scope:n,connection:r,openFiles:i,preferences:a,onSelect:o}=e,s=a.filter(fq),c=LM(r,n,s.length===0?[]:[``,...Ul(s)]),l=cu(s.map(dq),c.states).filter(uq).map(lq),u=[...new Set([...i,...l])],d;return t[0]===c?d=t[1]:(d=c.states.some(cq)&&(0,Q.jsxs)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:[`Pinned files could not be loaded.`,(0,Q.jsx)(X,{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)(QV,{children:u.map(e=>(0,Q.jsx)(mq,{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 cq(e){return e.status===`unavailable`}function lq(e){let{path:t}=e;return t}function uq(e){return e.state===`resolved`&&e.entry.kind===`file`}function dq(e){let{path:t}=e;return t}function fq(e){return e.pinned}function pq(e){let t=(0,$.c)(26),{scope:n,connection:r,query:i,hidden:a,showHidden:o,onSelect:s}=e,c=vK(r,n),l,u,d,f,p,m;if(t[0]!==a||t[1]!==c||t[2]!==s||t[3]!==i||t[4]!==o){let e=Bc(zl(Vn(Dn(c.result))?.paths??[],a,o),i),n=Rs(i),r=n!==null&&(o||Fl(n,a)===null)&&!e.includes(n)?n:null;t[11]===c?f=t[12]:(f=q(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)(X,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:()=>c.refresh(),children:`Try again`})]}),t[11]=c,t[12]=f),t[13]===c.result?p=t[14]:(p=De(c.result)&&(0,Q.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`Reading file names…`}),t[13]=c.result,t[14]=p),m=!De(c.result)&&!q(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=QV,u=r!==null&&(0,Q.jsxs)(tH,{value:r,onSelect:()=>s(r),children:[`Open path `,r]});let h;t[15]===s?h=t[16]:(h=e=>(0,Q.jsx)(mq,{path:e,onSelect:s},e),t[15]=s,t[16]=h),d=e.map(h),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]=f,t[9]=p,t[10]=m}else l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],m=t[10];let h;t[17]!==l||t[18]!==u||t[19]!==d?(h=(0,Q.jsxs)(l,{children:[u,d]}),t[17]=l,t[18]=u,t[19]=d,t[20]=h):h=t[20];let g;return t[21]!==f||t[22]!==p||t[23]!==m||t[24]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[f,p,m,h]}),t[21]=f,t[22]=p,t[23]=m,t[24]=h,t[25]=g):g=t[25],g}function mq(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)(tH,{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)(_r,{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 hq(e,t,n){let r=(0,$.c)(7),i;r[0]!==e||r[1]!==t?(i=mu({draft:e,viewer:t}),r[0]=e,r[1]=t,r[2]=i):i=r[2],Ba(i);let a;r[3]!==e||r[4]!==n||r[5]!==t?(a=hl({draft:e,viewer:t,fingerprint:n}),r[3]=e,r[4]=n,r[5]=t,r[6]=a):a=r[6],Ba(a)}var gq=Ha(({connection:e,environmentIds:t})=>Zr(n=>{if(!e||t.length===0)return;let r=n(Wr(e)),i=Vn(Dn(r));if(!i)return;let a=e=>{i.hasUnsaved(t)&&e.preventDefault()};window.addEventListener(`beforeunload`,a),n.addFinalizer(()=>window.removeEventListener(`beforeunload`,a))}));function _q(e,t){let n=(0,$.c)(3),r;n[0]!==e||n[1]!==t?(r=gq({connection:e,environmentIds:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],Ba(r)}var vq=In([`changes`,`files`,`history`]),yq=In([`uncommitted`,`branch`]),bq=xo(ao.check(Ro(te))).pipe(Wn(()=>is(ir(void 0)))),xq=Le({surface:xo(vq).pipe(Wn(()=>is(ir(void 0)))),entry:bq,side:bq,scope:xo(yq).pipe(Wn(()=>is(ir(void 0)))),base:bq}),Sq=ui(vq),Cq=ui(yq),wq=[{id:`general`,label:`General`,icon:Rp},{id:`git`,label:`Reviews & Git`,icon:Hf},{id:`computers`,label:`Computers`,icon:be}],Tq=wq[0].id,Eq={reading:`max-w-186 gap-8`,list:`max-w-186 gap-7`,wide:`max-w-240 gap-5.5 md:pt-7.5`};function Dq(e){return Y(`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`,Eq[e])}function Oq(e){let t=(0,$.c)(5),{children:n,layout:r}=e,i;t[0]===r?i=t[1]:(i=Dq(r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,Q.jsx)(TI,{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 kq(e){let t=(0,$.c)(71),{section:n,environmentId:r}=e,i=hs(),{setOpenMobile:a}=pr(),o=Qt(),s=gd(),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=W(r??``)?.remote,{element:d,attach:f}=nL(),{element:p,attach:m}=nL(),[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}=ns(),{environment:E}=kF(T),D;t[17]===n?D=t[18]:(D=wq.find(e=>e.id===n)??wq[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)(Xe,{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),Qs(Ic.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)(Ts,{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)(ke,{children:[P,(0,Q.jsxs)(tt,{children:[`Toggle sidebar`,` `,(0,Q.jsx)(eL,{children:uc(Ic.toggleNavigator)})]})]}),t[33]=F):F=t[33];let I,L;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(kI,{children:`Settings`}),L=(0,Q.jsx)(MI,{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)(kI,{children:(0,Q.jsx)(`h2`,{children:r===void 0?(0,Q.jsx)(jI,{children:O.label}):(0,Q.jsx)(AI,{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)(MI,{children:`/`}),(0,Q.jsx)(kI,{className:`min-w-0`,children:(0,Q.jsx)(jI,{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)(DI,{className:`min-w-0 flex-1`,children:(0,Q.jsxs)(OI,{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=wq.map(e=>{let t=e.icon,n=O.id===e.id;return(0,Q.jsxs)(X,{variant:n?`secondary`:`ghost`,size:`sm`,className:`shrink-0 justify-start md:w-full`,"aria-current":n?`page`:void 0,onClick:()=>{if(r!==void 0&&e.id===`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.78.0`]}),t[53]=U):U=t[53];let G;t[54]===H?G=t[55]:(G=(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]=G);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:Dq(`list`),children:(0,Q.jsx)(se,{showUpdates:r===void 0,environment:E,onOpen:b})})}),r!==void 0&&(0,Q.jsx)(Oq,{layout:`wide`,children:r===`this-computer`?(0,Q.jsx)(Ve,{environment:E}):(0,Q.jsx)(Ht,{environmentId:r,onForgotten:v},r)})]}):(0,Q.jsx)(Oq,{layout:`reading`,children:O.id===`git`?(0,Q.jsx)(Vl,{}):(0,Q.jsx)(ou,{})})}),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]!==G||t[64]!==K?(ee=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col md:flex-row`,children:[G,K]}),t[63]=G,t[64]=K,t[65]=ee):ee=t[65];let te;return t[66]!==S||t[67]!==B||t[68]!==ee||t[69]!==N?(te=(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]=te):te=t[70],te}var Aq={added:`Added`,modified:`Modified`,deleted:`Deleted`,renamed:`Renamed`,"type-changed":`Type changed`};function jq(e,t){if(e.status===`renamed`&&e.previousPath!==null&&e.previousPath!==void 0)return`Renamed from ${e.previousPath}`;let n=Aq[e.status];return e.path===t?n:`${n} as ${e.path}`}function Mq(e){return e.body===null||e.body===void 0?e.subject:`${e.subject}\n\n${e.body}`}function Nq(e){return[...new Set([e.oldPath,e.newPath].filter(e=>e!=null))]}function Pq(e){return e.newPath??e.oldPath??`Unknown path`}var Fq=7;function Iq(e){return e.slice(0,Fq)}function Lq(e){return e.replace(/^refs\/(?:heads|remotes|tags)\//u,``)}function Rq(e){return e.filter(e=>e.kind!==`head`)}function zq(e,t){return e.kind===`local-branch`&&`refs/heads/${e.name}`===t}function Bq(e){switch(e?.head.kind){case`attached`:return Lq(e.head.ref);case`unborn`:return`No commits yet on ${Lq(e.head.ref)}`;case`detached`:return`Detached HEAD`;default:return`This branch`}}function Vq(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 Hq(e,t){return e==null?{name:Bq(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 Uq={kind:`handoff`},Wq={kind:`all-changes`},Gq={kind:`specs`},Kq={kind:`branch`},qq={kind:`graph`};function Jq(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 Yq(e){if(e==null||e===``)return null;if(e===`handoff`)return Uq;if(e===`all-changes`)return Wq;if(e===`specs`)return Gq;if(e===`branch`)return Kq;if(e===`graph`)return qq;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&&ui(ao.check(La()))(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 Xq(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 Zq(e){if(e)return`Review`}var Qq={changes:`Changes`,files:`Files`,history:`History`};function $q(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 Iq(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 eJ(e){let t=Yq(e.entry),n=t?$q(t):Qq[e.surface??`files`],r=e.project?`${n} — ${e.project}`:n;return e.environment?`${r} · ${e.environment}`:r}var tJ=()=>({tabs:[],pinned:[]});function nJ(e){return{tabs:[`handoff`,...e.tabs.filter(e=>e!==`handoff`)],pinned:e.pinned.filter(e=>e!==`handoff`)}}function rJ(e,t,n){if(e[t]?.tabs.includes(n))return t;let r=+(t===0);return e[r]?.tabs.includes(n)?r:t}function iJ(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 aJ(e,t,n){return e.tabs.includes(t)?e:{...e,tabs:Xq(e.tabs,t,n)}}function oJ(e,t){return t===`handoff`?e:{tabs:e.tabs.filter(e=>e!==t),pinned:e.pinned.filter(e=>e!==t)}}function sJ(e,t){return{...e,tabs:e.tabs.filter(n=>n===`handoff`||n===t||e.pinned.includes(n))}}function cJ(e){return{...e,tabs:e.tabs.filter(t=>t===`handoff`||e.pinned.includes(t))}}function lJ(e,t){return t===`handoff`?e:e.pinned.includes(t)?{...e,pinned:e.pinned.filter(e=>e!==t)}:{...e,pinned:[...e.pinned,t]}}function uJ(e,t,n){if(n.tabs.includes(t))return t;let r=iJ(e),i=new Set(iJ(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 dJ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fJ(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&(Yq(e)??null)!==null):[]}function pJ(e){if(!dJ(e)||!Array.isArray(e.panes))return null;let t=e.panes.map(e=>{let t=fJ(dJ(e)?e.tabs:void 0);return{tabs:t,pinned:fJ(dJ(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 mJ(e){return e===null?`Open to the side`:e===`left`?`Open in the right pane`:`Open in the left pane`}function hJ(e,t){return{value:`${e}/${t}`,description:`${e} of ${fi(t,`decision`)} reviewed`}}function gJ(e){if(e!==0)return{value:String(e),description:fi(e,`uncommitted file`)}}function _J(e,t,n){let r=t.flatMap(e=>iJ(e)),i=n===null?e:[n,...e],a=new Set(r);return[...new Set([...i,...r])].filter(e=>a.has(e))}function vJ(e){let t=(0,$.c)(4),{children:n}=e,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={poolSize:4,workerFactory:yJ},i={theme:pu},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)(NE,{poolOptions:r,highlighterOptions:i,children:n}),t[2]=n,t[3]=a),a}function yJ(){return new Worker(new URL(`/assets/worker-mq0i_Vk_.js`,``+import.meta.url),{type:`module`})}function bJ(e,t){let n=(0,$.c)(9),r;n[0]!==t.connection||n[1]!==e?(r=i({connection:t.connection,scope:e}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a={mode:`promiseExit`},n[3]=a):a=n[3];let[o,s]=wr(r,a),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 xJ(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 SJ(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 CJ(e){return e.split(`/`).at(-1)??e}function wJ(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 TJ(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 EJ(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 DJ=[{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`}],OJ=[{id:`commit`,actions:[DJ[0],DJ[1]]},{id:`sync`,actions:[DJ[2],DJ[3],DJ[4]]},{id:`stash`,actions:[DJ[5],DJ[7]]}];function kJ(e){return DJ.find(t=>t.id===e)?.label}function AJ(e){let t=(0,$.c)(17),{scope:n,context:r}=e,{connection:i}=r,a=Vn(Dn(zP(n,i))),o=bJ(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=q(o.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`mt-1 text-destructive`,children:cr(Yt(o.result.cause))}),t[3]=o.result,t[4]=d);let f;t[5]!==d||t[6]!==l?(f=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,u,d]}),t[5]=d,t[6]=l,t[7]=f):f=t[7];let p;t[8]!==o||t[9]!==s.requestId?(p=()=>o.dismiss(s.requestId),t[8]=o,t[9]=s.requestId,t[10]=p):p=t[10];let m;t[11]!==o.result.waiting||t[12]!==p?(m=(0,Q.jsx)(X,{size:`xs`,variant:`ghost`,disabled:o.result.waiting,onClick:p,children:`Got it`}),t[11]=o.result.waiting,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==f||t[15]!==m?(h=(0,Q.jsxs)(`div`,{role:`status`,className:`flex shrink-0 items-start gap-3 border-b border-graph-4/20 bg-graph-4/10 px-3 py-2 text-xs`,children:[f,m]}),t[14]=f,t[15]=m,t[16]=h):h=t[16],h}function jJ(e){let t=(0,$.c)(23),{scope:n,context:r,onOpen:i}=e,{connection:a}=r,o=Vn(Dn(zP(n,a))),s=o?.inProgress;if(!s)return null;let c=o.changes.filter(MJ),l=`${s===`merge`?`Merge`:`Rebase`} recovery`,u=s===`merge`?`Merge`:`Rebase`,d=c.length?`is waiting for conflict resolution`:`is ready to finish`,f;t[0]!==u||t[1]!==d?(f=(0,Q.jsxs)(`p`,{className:`font-medium`,children:[u,` `,d]}),t[0]=u,t[1]=d,t[2]=f):f=t[2];let p=c.length>0&&(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:c.map(e=>(0,Q.jsx)(X,{size:`xs`,variant:`outline`,onClick:()=>i({kind:`file`,path:e.path}),children:e.path},e.path))}),m=s===`merge`&&o.mergeHeadOid?`Use Commit from the Git menu to finish. The merge commit includes every staged resolution.`:`Stage the resolved files, then continue in a terminal in this worktree.`,h;t[3]===m?h=t[4]:(h=(0,Q.jsxs)(`p`,{children:[`Resolve the files in your editor or with your agent.`,` `,m]}),t[3]=m,t[4]=h);let g;t[5]===s?g=t[6]:(g=s===`rebase`&&(0,Q.jsx)(PJ,{command:`git rebase --continue`}),t[5]=s,t[6]=g);let _;t[7]!==o||t[8]!==s?(_=s===`merge`&&!o.mergeHeadOid&&(0,Q.jsx)(PJ,{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)(PJ,{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 MJ(e){return e.comparisons.some(NJ)}function NJ(e){return e.scope===`unmerged`}function PJ(e){let t=(0,$.c)(8),{command:n}=e,r=`Copy ${n}`,i,a;t[0]===n?(i=t[1],a=t[2]):(i=()=>At(n,`command`),a=(0,Q.jsx)(`code`,{children:n}),t[0]=n,t[1]=i,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(er,{}),t[3]=o):o=t[3];let s;return t[4]!==r||t[5]!==i||t[6]!==a?(s=(0,Q.jsxs)(X,{size:`xs`,variant:`outline`,"aria-label":r,onClick:i,children:[a,o]}),t[4]=r,t[5]=i,t[6]=a,t[7]=s):s=t[7],s}function FJ(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 wo(r)}var IJ=Ha(e=>go({done:new Set,activeGroup:null,ownHead:null,busy:!1,error:null,drafted:{message:null,groups:null},draftedBy:{message:null,groups:null},editingFiles:!1})),LJ=Ha(e=>new Set);function RJ(e,t,n){let r=(0,$.c)(14),{connection:i}=n,{operations:a}=i,o;r[0]!==t||r[1]!==e?(o=le(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&&Fn(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=FJ(a,s),d=u?.requestId===l?null:u,f={connection:i,scope:e,action:t},{value:p}=vu(Ss(f)),m=En(f),h=v(f),g=Yr(m),_=Yr(h),y;r[6]===d?y=r[7]:(y=d?.receipt&&Fn(d.receipt),r[6]=d,r[7]=y);let b=!!y,x;return r[8]!==p||r[9]!==g||r[10]!==d||r[11]!==_||r[12]!==b?(x={...p,execution:g,recovered:_,operation:d,canStartNew:b},r[8]=p,r[9]=g,r[10]=d,r[11]=_,r[12]=b,r[13]=x):x=r[13],x}var zJ=Ha(({signal:e,submit:t,recover:n})=>Zr(r=>{e!==void 0&&(r.set(t,Er),r.set(n,Er))}));function BJ(e,t,n){let r=(0,$.c)(45),{path:i,hunk:a,signal:o,what:s,look:c,readChanges:l,notify:u,dismissNotice:d,close:f}=n,p=RJ(e,`discard`,t),m=RJ(e,`stash-apply`,t),h=!(!p.operation||p.canStartNew),g;r[0]===l?g=r[1]:(g=()=>z({try:l,catch:KJ}),r[0]=l,r[1]=g);let _;r[2]!==f||r[3]!==d||r[4]!==u||r[5]!==m||r[6]!==g||r[7]!==s?(_={what:s,readChanges:g,notify:u,dismissNotice:d,close:f,restore:m,restoreTimeoutMs:Xi,run:fs},r[2]=f,r[3]=d,r[4]=u,r[5]=m,r[6]=g,r[7]=s,r[8]=_):_=r[8];let v=_,[y]=(0,Z.useState)(WJ),[b]=(0,Z.useState)(HJ),x;r[9]===Symbol.for(`react.memo_cache_sentinel`)?(x={mode:`promiseExit`},r[9]=x):x=r[9];let[S,C]=wr(y,x),w;r[10]===Symbol.for(`react.memo_cache_sentinel`)?(w={mode:`promiseExit`},r[10]=w):w=r[10];let[T,E]=wr(b,w),D=fa(y),O=fa(b),k;r[11]!==b||r[12]!==o||r[13]!==y?(k=zJ({signal:o,submit:y,recover:b}),r[11]=b,r[12]=o,r[13]=y,r[14]=k):k=r[14],Ba(k);let A=S.waiting||T.waiting,j=VJ,M;r[15]!==T||r[16]!==S?(M=j(S)??j(T),r[15]=T,r[16]=S,r[17]=M):M=r[17];let N;r[18]!==O||r[19]!==D?(N=()=>{D(Er),O(Er)},r[18]=O,r[19]=D,r[20]=N):N=r[20];let P;r[21]!==A||r[22]!==p||r[23]!==v||r[24]!==a||r[25]!==c||r[26]!==i||r[27]!==O||r[28]!==C||r[29]!==h?(P=()=>{A||h||!c||(O(Er),C({run:()=>p.run({action:`discard`,path:i,...a?{hunk:a}:{}},Gn(c,[i])),discarding:v}))},r[21]=A,r[22]=p,r[23]=v,r[24]=a,r[25]=c,r[26]=i,r[27]=O,r[28]=C,r[29]=h,r[30]=P):P=r[30];let F;r[31]!==A||r[32]!==p.recover||r[33]!==v||r[34]!==E||r[35]!==D?(F=()=>{A||(D(Er),E({recover:p.recover,discarding:v}))},r[31]=A,r[32]=p.recover,r[33]=v,r[34]=E,r[35]=D,r[36]=F):F=r[36];let I;return r[37]!==A||r[38]!==p.operation||r[39]!==M||r[40]!==N||r[41]!==P||r[42]!==F||r[43]!==h?(I={operation:p.operation,uncertain:h,busy:A,error:M,reset:N,run:P,checkOutcome:F},r[37]=A,r[38]=p.operation,r[39]=M,r[40]=N,r[41]=P,r[42]=F,r[43]=h,r[44]=I):I=r[44],I}function VJ(e){return Vn(Dn(e))??(q(e)?{text:cr(Yt(e.cause)),moved:!1}:null)}function HJ(){return Eo(UJ)}function UJ(e){return et(e.recover(),e.discarding)}function WJ(){return Eo(GJ)}function GJ(e){return et(e.run(),e.discarding)}function KJ(e){return new it(e,cr(e))}function qJ({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 JJ(e){let t=(0,$.c)(6),{text:n,children:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(nc,{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)(qJ,{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 YJ(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=Vn(Dn(zP(n,f))),m=KP(n,f),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null),y=p,b=y?yn(y):null,x=y?.changes.find(e=>e.path===i),S=_??b,C;t[0]===a?C=t[1]:(C=a?$J(a):null,t[0]=a,t[1]=C);let w=C,T;t[2]!==w||t[3]!==i?(T=w?`${w} of ${CJ(i)}`:CJ(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:QJ,dismissNotice:ZJ,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=BJ(n,r,O),{busy:A,error:j,uncertain:M}=k,N=!!(S&&(x||h)),[P,F]=(0,Z.useState)();s!==void 0&&s!==P&&b&&(F(s),v(b),g(!0));let I;t[15]!==k||t[16]!==d||t[17]!==a||t[18]!==w||t[19]!==i||t[20]!==g||t[21]!==v||t[22]!==N||t[23]!==b||t[24]!==u?(I=N&&!d?(0,Q.jsxs)(X,{size:u===`button`?`sm`:`xs`,variant:u===`button`?`destructive`:`ghost`,"aria-label":a?`Discard ${w} of ${CJ(i)}`:`Discard changes to ${CJ(i)}`,onClick:()=>{k.reset(),v(b),g(!0)},children:[(0,Q.jsx)(Xp,{}),eY(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)(HM,{open:h,onOpenChange:e=>!A&&g(e),children:(0,Q.jsxs)(KM,{children:[(0,Q.jsxs)(qM,{children:[(0,Q.jsxs)(YM,{children:[`Discard `,E,`?`]}),(0,Q.jsx)(XM,{children:a?`Select one complete changed hunk. Only that hunk is reverted; partial selections are refused. A recovery copy is saved first.`:`The file goes back to the last commit. You can restore the changes.`})]}),(0,Q.jsx)(_r,{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)(JJ,{text:j.text,children:j.moved?` Look at the diff again before discarding.`:``}),k.operation?.receipt?.progress.map(XJ),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)(JM,{children:[(0,Q.jsx)(QM,{disabled:A,children:j?.moved?`Look again`:`Cancel`}),!j?.moved&&(M?(0,Q.jsx)(X,{disabled:A,onClick:k.checkOutcome,children:A?`Checking…`:`Check outcome`}):(0,Q.jsx)(X,{variant:`destructive`,disabled:A,onClick:k.run,children:A?`Discarding…`:`Discard`}))]})]})}):null,t[26]=A,t[27]=k.checkOutcome,t[28]=k.operation?.receipt,t[29]=k.run,t[30]=j,t[31]=a,t[32]=h,t[33]=i,t[34]=g,t[35]=N,t[36]=M,t[37]=E,t[38]=R):R=t[38];let z=R;if(l){let e;t[39]!==l||t[40]!==L?(e=l(L),t[39]=l,t[40]=L,t[41]=e):e=t[41];let n;return t[42]!==z||t[43]!==e?(n=(0,Q.jsxs)(Q.Fragment,{children:[e,z]}),t[42]=z,t[43]=e,t[44]=n):n=t[44],n}let B;return t[45]!==z||t[46]!==L?(B=(0,Q.jsxs)(Q.Fragment,{children:[L,z]}),t[45]=z,t[46]=L,t[47]=B):B=t[47],B}function XJ(e){return(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:e},e)}function ZJ(e){return Is.close(e)}function QJ(e){return Is.add(e)}function $J({startLine:e,endLine:t}){return e===t?`line ${e}`:`lines ${e}–${t}`}function eY(e){return e===`quiet`?(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:`Discard`}):e===`compact`?`Discard selection`:`Discard`}var tY=kr(`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 nY({className:e,orientation:t,...n}){return(0,Q.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:Y(tY({orientation:t}),e),...n})}function rY(e,t,n){let r=(0,$.c)(32),i=RJ(e,`fetch`,t),a=RJ(e,`pull`,t),o=RJ(e,`push`,t),s=RJ(e,`stash-apply`,t),c;r[0]===n.details?c=r[1]:(c=()=>z({try:n.details.read,catch:oY}),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,p,m;r[8]!==i||r[9]!==a||r[10]!==o?(p={fetch:i,pull:a,push:o},m=[`fetch`,`pull`,`push`].map(e=>({name:e,operation:p[e].operation,canStartNew:p[e].canStartNew,checking:p[e].recovered.waiting})).find(aY),r[8]=i,r[9]=a,r[10]=o,r[11]=p,r[12]=m):(p=r[11],m=r[12]);let h=m,g;r[13]!==d||r[14]!==p||r[15]!==h?(g=()=>{h&&fs(Qi(d,p[h.name],h.name))},r[13]=d,r[14]=p,r[15]=h,r[16]=g):g=r[16];let _;r[17]!==d||r[18]!==p?(_=(e,t)=>fs(ht(d,p[e],e,t)),r[17]=d,r[18]=p,r[19]=_):_=r[19];let v;r[20]!==d||r[21]!==s?(v=e=>fs(ct(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=()=>an(f(z({try:n.refreshLook,catch:iY}),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 iY(e){return new it(e,cr(e))}function aY(e){let{operation:t,canStartNew:n}=e;return t!=null&&!n}function oY(e){return new it(e,cr(e))}function sY(e){let t=(0,$.c)(12),{action:n,className:r}=e;switch(n){case`amend`:{let e;return t[0]===r?e=t[1]:(e=(0,Q.jsx)(Ap,{className:r}),t[0]=r,t[1]=e),e}case`push`:{let e;return t[2]===r?e=t[3]:(e=(0,Q.jsx)(Nd,{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)(Dd,{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)(Td,{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)(Cd,{className:r}),t[8]=r,t[9]=e),e}default:{let e;return t[10]===r?e=t[11]:(e=(0,Q.jsx)(Wf,{className:r}),t[10]=r,t[11]=e),e}}}function cY(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 lY=`data-checked`,uY=`data-unchecked`;function dY(e){return{checked(t){return e.indeterminate?{}:t?{[lY]:``}:{[uY]:``}},...Bn}}var fY=Z.createContext(void 0);function pY(){return Z.useContext(fY)}var mY=Z.createContext(void 0);function hY(){let e=Z.useContext(mY);if(e===void 0)throw Error(s(14));return e}var gY=`data-parent`,_Y=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:S,...C}=e,{clearErrors:w}=Se(),{disabled:T,name:E,setDirty:D,setFilled:O,setFocused:k,setTouched:A,state:j,validationMode:M,validityData:N,validation:P}=Sn(),F=Dm(),{labelId:I,registerControlId:R,getDescriptionProps:z}=Mn(),B=pY(),V=B?.allValues===void 0?void 0:B.parent,H=V!==void 0,U=T||F.disabled||B?.disabled||o,W=E??d,G=v??W,K=b(),ee=B?.registerControlId!==R,te=Es({id:c||void 0,enabled:ee}),q=y?te:K,ne={};H&&(p?ne=V.getParentProps():G!==void 0&&(ne=V.getChildProps(G)));let{checked:re=n,indeterminate:ie=l,onCheckedChange:ae,...oe}=ne,se=B?.value,ce=Z.useRef(null),{getButtonProps:le,buttonRef:ue}=Yo({disabled:U,native:y}),de=B?.validation??P,[fe,pe]=Jt({controlled:G!==void 0&&se!==void 0&&!p?se.includes(G):re,default:i,name:`Checkbox`,state:`checked`}),J=H?!!re:fe,me=H&&ie||l;rt(ce,K,fe,void 0,!B&&!U,d);let he=V?.registerChildId,ge=Z.useRef(null),_e=de.registerInput,ve=B?G:void 0,ye=Z.useCallback(e=>_e(e,{controlRef:ce,value:ve}),[_e,ve]),be=sa(u,ge,p?void 0:ye),xe=x(a,I,ge,!y,te);ii(()=>{ge.current&&(ge.current.indeterminate=me),B||O(fe)},[fe,me,B,O]),Me(fe,()=>{B||(w(W),D(fe!==N.initialValue),de.change(fe))});let Ce=wt({checked:fe,disabled:U,form:s,name:p?void 0:W,id:y?void 0:te,required:g,ref:be,style:W?dt:$i,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=no(Di,e.nativeEvent);if(f?.(t,n),!n.isCanceled&&(ae?.(t,n),!n.isCanceled&&(pe(t),G!==void 0&&B!==void 0&&!p&&!H))){let e=t?[...B.value,G]:B.value.filter(e=>e!==G);B.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){ce.current?.focus()}},v===void 0?mo:{value:(B?fe&&v:v)||``},z,e=>de.getValidationProps(U,e));Z.useEffect(()=>{if(!V||G===void 0)return;let e=V.disabledStatesRef.current;return e.set(G,U),()=>{e.delete(G)}},[V,U,G]);let we=Z.useMemo(()=>({...j,checked:J,disabled:U,readOnly:m,required:g,indeterminate:me}),[j,J,U,m,g,me]),Te=dY(we),Ee=L(`span`,e,{state:we,ref:[ue,ce,t],props:[{id:q,role:`checkbox`,"aria-checked":me?`mixed`:J,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":xe,[gY]:p?``:void 0,onFocus(){U||k(!0)},onBlur(){let e=ge.current;e&&(A(!0),k(!1),M===`onBlur`&&de.commit(B?se:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=ge.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),nr(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||cY(t)?.click()})},onClick(e){if(m||U)return;e.preventDefault();let t=ge.current;t&&ys(t,e)}},C,oe,le,z,e=>de.getValidationProps(U,e)],stateAttributesMapping:Te}),De=Ee.props.id;return ii(()=>{if(he&&!p&&G!==void 0&&De!==void 0)return he(G,De)},[he,p,G,De]),(0,Q.jsxs)(mY.Provider,{value:we,children:[Ee,!fe&&!B&&W&&!p&&_!==void 0&&(0,Q.jsx)(`input`,{type:`hidden`,form:s,name:W,value:_,disabled:U}),(0,Q.jsx)(`input`,{...Ce,suppressHydrationWarning:!0})]})}),vY=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=hY(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=Uo(c),f=Z.useRef(null),p={...s,transitionStatus:u};fn({batch:!0,enabled:!c,open:c,ref:f,onComplete(){c||d(!1)}});let m={...dY(s),...nt},h=a||l,g=L(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function yY({className:e,...t}){return(0,Q.jsx)(_Y,{"data-slot":`checkbox`,className:Y(`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)(vY,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,Q.jsx)(ci,{})})})}function bY(e,t,n,r){let i=(0,$.c)(29),{expectedStatus:a,onBusy:o,onLookAgain:s}=r,c=RJ(e,t,n),[l]=(0,Z.useState)(wY),u;i[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={mode:`promiseExit`},i[0]=u):u=i[0];let[d,f]=wr(l,u),p=fa(l),m=c.execution.waiting||c.recovered.waiting||d.waiting,h=!(!c.operation||c.canStartNew),g=CY,_=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(Er),c.reset(),fs(c.run(e,Gn(a,a.files?.map(SY)??[],void 0,!0)).pipe(ni(mn(()=>o(!1))),xr)))},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:z({try:s,catch:xY}),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(Er),fs(c.recover().pipe(xr))},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:oa,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 xY(e){return new it(e,cr(e))}function SY(e){return e.path}function CY(e){return q(e)?Yt(e.cause):null}function wY(){return Eo(TY)}function TY(e){return aa(e.read,e.startNew)}function EY(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 DY(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 OY(e){let t=e%100;return`${e}${t>=11&&t<=13?`th`:[`th`,`st`,`nd`,`rd`][e%10]??`th`}`}function kY(e){let t=jY(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 AY(e){let t=jY(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 jY(e){let t=e.findLastIndex(e=>e.restarted);return t===-1?e:e.slice(t)}var MY=Ha(e=>Zr({loaded:0,selected:void 0,scrollOffset:0,graphScrollOffset:0,resetId:0}).pipe(ma)),NY=Ha(({connection:e,scope:t})=>ce(e,t,[`history`],n=>IY(n,MY({connection:e,scope:t,kind:`commits`}),n=>ki(function*(){let r=yield*(yield*Ti(e)).request(e=>e.changes.listCommits({params:{worktreeId:t.worktreeId},query:{after:n?.after,tip:n?.tip}}));return yield*eo(e),r}),e=>e.nextAfter&&e.tip?{after:e.nextAfter,tip:e.tip}:void 0),Pi(e))),PY=Ha(({connection:e,scope:t,oid:n,parent:r=1})=>He(e,t,[`commit`,n,r],ki(function*(){let i=yield*(yield*Ti(e)).request(e=>e.changes.readCommitFiles({params:{worktreeId:t.worktreeId,oid:n},query:r===1?{}:{parent:r}}));return yield*eo(e,i.commit.oid===n&&(i.comparison.kind===`empty-tree`||i.comparison.parentNumber===r)),i}),Pi(e))),FY=Ha(({connection:e,scope:t,path:n})=>ce(e,t,[`history`,`file`,n],r=>IY(r,MY({connection:e,scope:t,kind:`file`,path:n}),r=>ki(function*(){let i=yield*(yield*Ti(e)).request(e=>e.changes.listFileCommits({params:{worktreeId:t.worktreeId},query:{path:n,limit:100,after:r}}));return yield*eo(e),i}),e=>e.nextAfter),Pi(e)));function IY(e,t,n,r){let i=e.once(t).loaded,a=0;return d(void 0,o=>ki(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?Be():ir(l)]}))}var LY=Ha(e=>mi(FY(e),e=>Cs(e,e=>AY(e.items))).pipe(gr(0))),RY=Ha(e=>mi(NY(e),e=>Cs(e,e=>kY(e.items))).pipe(gr(0)));Ha(e=>Hr((t,n)=>{let r=MY({...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 zY(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=PY({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],vu(o).value}function BY(e){let t=(0,$.c)(13),{tracking:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(Hf,{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)(_r,{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)(_r,{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 VY(e,t){let n=(0,$.c)(19),r;n[0]!==e||n[1]!==t?(r=NY({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=RY({connection:e,scope:t}),n[3]=e,n[4]=t,n[5]=a):a=n[5];let{result:o,value:s}=vu(a),c=fa(i),l;n[6]!==e||n[7]!==t?(l=MY({connection:e,scope:t,kind:`commits`}),n[6]=e,n[7]=t,n[8]=l):l=n[8];let u=l,d=Yr(u,HY),f=fa(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 HY(e){return e.selected}function UY(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 WY(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,KY),a=i.pop()??0,o=Number.parseFloat(getComputedStyle(t).columnGap),s=t.getBoundingClientRect().width;if(i.reduce(GY,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 GY(e,t){return e+t}function KY(e){return e.getBoundingClientRect().width}var qY=`min-w-0 max-w-40`;function JY(e){let t=(0,$.c)(21),{refs:n,current:r,onOpenCommit:i}=e,a=r===void 0?ZY:r,{row:o,visibleCount:s}=WY(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(XY),t[6]=n,t[7]=r);let l;t[8]===n.length?l=t[9]:(l=(0,Q.jsxs)(Je,{variant:`secondary`,className:qY,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)(_r,{text:e.name,renderTrigger:t=>(0,Q.jsxs)(Je,{render:(0,Q.jsx)(`button`,{type:`button`,onClick:i}),variant:a(e)?`brand-soft`:`outline`,className:`${qY} pointer-events-auto shrink`,children:[e.kind===`tag`&&(0,Q.jsx)(Kp,{"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)(ka,{children:[(0,Q.jsxs)(So,{render:(0,Q.jsx)(Je,{render:(0,Q.jsx)(`button`,{type:`button`}),variant:`secondary`,className:`${qY} pointer-events-auto`,"aria-label":`Show ${e.length} more ${Ya(e.length,`ref`)}`}),children:[`+`,e.length]}),(0,Q.jsxs)(fo,{align:`start`,className:`max-w-[calc(100vw-2rem)]`,children:[(0,Q.jsx)(Ra,{children:`More refs`}),(0,Q.jsx)(`ul`,{className:`max-h-64 overflow-y-auto text-xs`,children:e.map(YY)})]})]})]}),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 YY(e){return(0,Q.jsxs)(`li`,{className:`flex items-center gap-1 py-1 break-all`,children:[e.kind===`tag`&&(0,Q.jsx)(Kp,{"aria-hidden":`true`,className:`size-3 shrink-0`}),e.name]},`${e.kind}:${e.name}`)}function XY(e){return(0,Q.jsxs)(Je,{variant:`secondary`,className:qY,children:[e.kind===`tag`&&(0,Q.jsx)(Kp,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"data-label":e.name,className:`before:content-[attr(data-label)]`})]},`${e.kind}:${e.name}`)}function ZY(){return!1}function QY(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=>zq(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=Rq(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)(Je,{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=Y(`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)(Jf,{"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)(_r,{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=io(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=Y(`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:Y(`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:Iq(n.oid)}),(0,Q.jsx)(_r,{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)(JY,{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:Iq(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:` ${Iq(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)(JY,{refs:x,current:y,onOpenCommit:_})})]}),(0,Q.jsx)(_r,{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)(qI,{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)(XI,{onClick:()=>{(0,bd.flushSync)(()=>h(!0)),u.open()},children:[(0,Q.jsx)(of,{}),u.label]}),t[54]=u,t[55]=G);let K;t[56]===n.oid?K=t[57]:(K=()=>At(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)(er,{}),t[58]=ee):ee=t[58];let te;t[59]===K?te=t[60]:(te=(0,Q.jsxs)(XI,{onClick:K,children:[ee,`Copy commit id`]}),t[59]=K,t[60]=te);let q;t[61]===n?q=t[62]:(q=()=>At(Mq(n),`commit message`),t[61]=n,t[62]=q);let ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(er,{}),t[63]=ne):ne=t[63];let re;t[64]===q?re=t[65]:(re=(0,Q.jsxs)(XI,{onClick:q,children:[ne,`Copy message`]}),t[64]=q,t[65]=re);let ie;t[66]!==W||t[67]!==G||t[68]!==te||t[69]!==re?(ie=(0,Q.jsxs)(JI,{finalFocus:W,children:[G,te,re]}),t[66]=W,t[67]=G,t[68]=te,t[69]=re,t[70]=ie):ie=t[70];let ae;return t[71]!==U||t[72]!==ie?(ae=(0,Q.jsxs)(KI,{onOpenChange:P,children:[U,ie]}),t[71]=U,t[72]=ie,t[73]=ae):ae=t[73],ae}var $Y=[`text-graph-1`,`text-graph-2`,`text-graph-3`,`text-graph-4`,`text-graph-5`,`text-graph-6`],eX=e=>13+e*16,tX=e=>$Y[e%$Y.length]??$Y[0];function nX(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)?eX(e.lane):eX(n),endX:t===a.commit.oid?eX(a.lane):eX(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:Dt,className:tX(t)},t)}),(0,Q.jsx)(`circle`,{cx:eX(e.lane),cy:r,r:s?5:4,fill:s?`var(--card)`:`currentColor`,stroke:`currentColor`,strokeWidth:2,className:tX(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 rX(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=EY(i.commits),g=DY(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)(QY,{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)(nX,{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)(iX,{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 iX(e){let t=(0,$.c)(11),{history:n}=e,r;t[0]===n?r=t[1]:(r=(0,Q.jsx)(aX,{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&&!q(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)(UY,{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 aX(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)(wi,{className:`size-3.5`}),`Loading older commits…`]}),t[0]=e):e=t[0],e}if(q(n.result)){let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`span`,{children:`Couldn't load older commits`}),t[1]=e):e=t[1];let r;return t[2]===n.readMore?r=t[3]:(r=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-2 text-2xs text-muted-foreground`,children:[e,(0,Q.jsx)(X,{size:`xs`,variant:`outline`,onClick:n.readMore,children:`Retry`})]}),t[2]=n.readMore,t[3]=r),r}if(n.nextAfter===null||n.nextAfter===void 0){let e;t[4]===n.boundary?e=t[5]:(e=Vq(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 oX(e,t){let n=(0,$.c)(4),r=t===void 0?`scrollOffset`:t,i=Yr(Et),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 sX(e){let t=(0,$.c)(18),{scope:n,connection:r,selected:i,onSelect:a,sideLabel:o,onOpenGraph:s,onOpenChanges:c}=e,l=VY(r,n),u=Vn(Dn(zP(n,r))),d=Hq(u?.branch,l.snapshot),f=u?.changes.length??0,p;t[0]!==r||t[1]!==n?(p=MY({connection:r,scope:n,kind:`commits`}),t[0]=r,t[1]=n,t[2]=p):p=t[2];let m=oX(p),h;t[3]===l?h=t[4]:(h=(0,Q.jsx)(lX,{history:l}),t[3]=l,t[4]=h);let g=TI,_=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)(qd,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(_r,{className:`flex-1`,text:`Uncommitted changes`}),(0,Q.jsx)(`span`,{className:`text-2xs text-muted-foreground tabular-nums`,children:fi(f,`file`)})]})}),v;t[5]!==l||t[6]!==a||t[7]!==i||t[8]!==o?(v=l.commits.length===0?(0,Q.jsx)(uX,{}):(0,Q.jsx)(rX,{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)(X,{variant:`ghost`,className:`w-full justify-start`,onClick:s,children:[(0,Q.jsx)(Kf,{}),`Open graph`,(0,Q.jsx)(lr,{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)(BY,{tracking:d})}),h,y,b]})}function cX(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)(Hf,{className:`size-3.5 shrink-0`}),(0,Q.jsx)(_r,{className:`min-w-0 flex-1 font-medium text-foreground`,text:Bq(n.snapshot)})]}),t[0]=n.snapshot,t[1]=r);let i;t[2]===n?i=t[3]:(i=(0,Q.jsx)(lX,{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 lX(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 uX(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(dL,{children:(0,Q.jsxs)(fL,{children:[(0,Q.jsx)(pL,{children:`No commits yet`}),(0,Q.jsx)(mL,{children:`Commits will appear here once this worktree has history.`})]})}),e[0]=t):t=e[0],t}function dX(e){let t=(0,$.c)(14),{scope:n,connection:r,onSelect:i,sideLabel:a}=e,o=VY(r,n),s=mt(),c;t[0]!==r||t[1]!==n?(c=MY({connection:r,scope:n,kind:`commits`}),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=oX(c,`graphScrollOffset`),u;t[3]===o?u=t[4]:(u=(0,Q.jsx)(cX,{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)(uX,{}):(0,Q.jsx)(rX,{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 fX(e,t,n){let r=(0,$.c)(6),i={connection:e,scope:t,path:n},{value:a,result:o}=vu(LY(i)),s=fa(FY(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 pX(e){let t=(0,$.c)(34),{scope:n,connection:r,path:i,onSelect:a,sideLabel:o}=e,s=fX(r,n,i),c;t[0]!==r||t[1]!==i||t[2]!==n?(c=MY({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=Yr(l,mX),d=fa(l),f=oX(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)(dL,{children:(0,Q.jsxs)(fL,{children:[(0,Q.jsx)(pL,{children:`No commits touch this file`}),(0,Q.jsx)(mL,{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)(QY,{commit:e.commit,selected:u===e.commit.oid,onSelect:t=>m(e,t),openToSide:{label:o,open:()=>m(e,!0)},children:(0,Q.jsx)(_r,{className:`text-2xs text-muted-foreground`,text:jq(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)(hX,{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 mX(e){return e.selected}function hX(e){let t=(0,$.c)(8),{timeline:n}=e;if(q(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)(X,{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)(X,{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 gX(){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 _X(e){let t=(0,$.c)(2),n;return t[0]===e.connection?n=t[1]:(n=Pa(e.connection),t[0]=e.connection,t[1]=n),Yr(n)}var vX=Oa(`BrowserCommitDraft.submit`)(function*(e,t,n){return yield*j(ki(function*(){let r=yield*ya(vt(),e=>pt(e,Ne)),i=new AbortController,a=()=>{fs(pt(r,Ne))};return yield*ya(mn(()=>{t.add(i),i.signal.addEventListener(`abort`,a,{once:!0})}),()=>mn(()=>{i.signal.removeEventListener(`abort`,a),t.delete(i)})),yield*e(n,r)}))});function yX(e,t,n){let r=(0,$.c)(12),i;r[0]!==t.connection||r[1]!==e?(i=Fo({connection:t.connection,scope:e}),r[0]=t.connection,r[1]=e,r[2]=i):i=r[2];let{value:a}=vu(i),o;r[3]!==t.connection||r[4]!==e?(o=si({connection:t.connection,scope:e}),r[3]=t.connection,r[4]=e,r[5]=o):o=r[5];let s=Yr(o),c;r[6]!==n||r[7]!==a?(c=e=>vX(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 bX(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=TJ(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 _=ZU(g),v;i[6]===_?v=i[7]:(v=IJ(_),i[6]=_,i[7]=v);let y=v,b;i[8]===_?b=i[9]:(b=LJ(_),i[8]=_,i[9]=b);let x=b,{mode:S,message:C,amendMessage:w,excluded:T,added:E,groups:D}=yd(_.store,EX),{done:O,activeGroup:k,ownHead:A,busy:j,error:M,drafted:N,draftedBy:P,editingFiles:F}=wo(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 B=R,V;i[14]===_?V=i[15]:(V=e=>_.setFieldValue(`amendMessage`,e),i[14]=_,i[15]=V);let H=V,U;i[16]===_?U=i[17]:(U=e=>_.setFieldValue(`excluded`,e),i[16]=_,i[17]=U);let W=U,G;i[18]===_?G=i[19]:(G=e=>_.setFieldValue(`added`,e),i[18]=_,i[19]=G);let K=G,ee;i[20]===_?ee=i[21]:(ee=e=>_.setFieldValue(`groups`,e),i[20]=_,i[21]=ee);let te=ee,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 ne=q,re;i[24]===y?re=i[25]:(re=e=>y.update(t=>({...t,activeGroup:e})),i[24]=y,i[25]=re);let ie=re,ae;i[26]===y?ae=i[27]:(ae=e=>y.update(t=>({...t,ownHead:e})),i[26]=y,i[27]=ae);let oe=ae,se;i[28]===y?se=i[29]:(se=e=>y.update(t=>({...t,busy:e})),i[28]=y,i[29]=se);let ce=se,le;i[30]===y?le=i[31]:(le=e=>y.update(t=>({...t,error:e})),i[30]=y,i[31]=le);let ue=le,de=(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 ${Vn(Dn(me))?.find(e=>e.id===he)?.label??he} from ${n}`:null}}))},fe=S===`amend`?`amend`:`commit`,pe=RJ(a,fe,t),J=yX(a,t,x),me=_X(t),he=SJ(Vn(Dn(me)),r.value),ge;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),ge=new Set(n.filter(e).flatMap(TX)),i[32]=T,i[33]=n,i[34]=ge}else ge=i[34];let _e;i[37]===ge?_e=i[38]:(_e=[...ge],i[37]=ge,i[38]=_e);let ve=_e,ye;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),ye=new Set(n.filter(e).flatMap(wX)),i[39]=E,i[40]=n,i[41]=ye}else ye=i[41];let be;i[44]===ye?be=i[45]:(be=[...ye],i[44]=ye,i[45]=be);let xe=fe===`amend`?be:ve,Se=fe===`amend`?w:C,Ce=!(!pe.operation||pe.canStartNew),we=pe.operation?.receipt,Te=j||J.result.waiting||pe.recovered.waiting,Ee=D?N.groups:N.message,De;i[46]!==Ee||i[47]!==fe||i[48]!==O||i[49]!==D||i[50]!==o?(De=fe===`commit`&&Ee!=null&&EJ(o,Ee,new Set((D??[]).filter(e=>O.has(e.id)).flatMap(CX))),i[46]=Ee,i[47]=fe,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]!==fe||i[56]!==Se||i[57]!==O||i[58]!==D||i[59]!==S||i[60]!==xe||i[61]!==Oe||i[62]!==o?(je=Oe||(S===`groups`?!D?.length||D.filter(e=>!O.has(e.id)).some(SX):!Se.trim()||fe!==`amend`&&o.inProgress!==`merge`&&!xe.length),i[55]=fe,i[56]=Se,i[57]=O,i[58]=D,i[59]=S,i[60]=xe,i[61]=Oe,i[62]=o,i[63]=je):je=i[63];let Me=je,Ne;i[64]===o?Ne=i[65]:(Ne=ws(`commit`,o),i[64]=o,i[65]=Ne);let Pe=Ne,Fe;i[66]===o?Fe=i[67]:(Fe=ws(`amend`,o),i[66]=o,i[67]=Fe);let Ie=Fe,Le;i[68]===l?Le=i[69]:(Le=l?z({try:l,catch:xX}):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]!==fe||i[77]!==Pe||i[78]!==ve||i[79]!==x||i[80]!==Se||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]!==J||i[90]!==pe||i[91]!==D||i[92]!==Ae||i[93]!==C||i[94]!==S||i[95]!==he||i[96]!==me||i[97]!==c||i[98]!==A||i[99]!==xe||i[100]!==we||i[101]!==a||i[102]!==ie||i[103]!==K||i[104]!==H||i[105]!==ce||i[106]!==ne||i[107]!==de||i[108]!==ue||i[109]!==W||i[110]!==te||i[111]!==B||i[112]!==L||i[113]!==oe||i[114]!==Oe||i[115]!==y||i[116]!==o||i[117]!==Le||i[118]!==Ce||i[119]!==Te?(Re={scope:a,status:o,onBusy:c,onLookAgain:Le,createId:gX,mode:S,commitAction:fe,git:pe,generator:J,models:me,model:he,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:ve,paths:xe,currentMessage:Se,uncertain:Ce,receipt:we,working:Te,staleDraft:Oe,leftUncommitted:Ae,blocker:Me,commitModeBlocker:Pe,amendModeBlocker:Ie,controllers:x,form:_,setMode:L,setMessage:B,setAmendMessage:H,setExcluded:W,setAdded:K,setGroups:te,setDone:ne,setActiveGroup:ie,setOwnHead:oe,setBusy:ce,setError:ue,setDrafted:de,state:y},i[70]=k,i[71]=E,i[72]=w,i[73]=Ie,i[74]=Me,i[75]=j,i[76]=fe,i[77]=Pe,i[78]=ve,i[79]=x,i[80]=Se,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]=J,i[90]=pe,i[91]=D,i[92]=Ae,i[93]=C,i[94]=S,i[95]=he,i[96]=me,i[97]=c,i[98]=A,i[99]=xe,i[100]=we,i[101]=a,i[102]=ie,i[103]=K,i[104]=H,i[105]=ce,i[106]=ne,i[107]=de,i[108]=ue,i[109]=W,i[110]=te,i[111]=B,i[112]=L,i[113]=oe,i[114]=Oe,i[115]=y,i[116]=o,i[117]=Le,i[118]=Ce,i[119]=Te,i[120]=Re):Re=i[120],Re}function xX(e){return new it(e,cr(e))}function SX(e){return!e.message.trim()||!e.paths.length}function CX(e){return e.paths}function wX(e){return e.paths}function TX(e){return e.paths}function EX(e){return e.values}function DX(e,t,n,r){let i=(0,$.c)(46),a=bX(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=()=>fs(de(a)),_=()=>fs(We(a,a.mode===`groups`?`groups`:`message`)),v=()=>fs(oo(a)),y=()=>fs(Re(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(OX),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:gX(),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:oa,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 OX(e){return{...e,editingFiles:!e.editingFiles}}var kX=Ha(e=>Zr(t=>{t.addFinalizer(()=>{for(let t of e)t.abort();e.clear()})}));function AX(e){let t=(0,$.c)(2),n;t[0]===e?n=t[1]:(n=kX(e),t[0]=e,t[1]=n),Ba(n)}function jX(e){let t=(0,$.c)(102),{status:n,liveBranch:r,onLookAgain:i}=e,{preferences:a,setPreference:o}=ec(),s=e.context,c;t[0]===e.status.changes?c=t[1]:(c=_P(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=DX(e,s,c,u);AX(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)(RF,{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)(zF,{children:j}),t[15]=j,t[16]=M);let N;t[17]!==A||t[18]!==M?(N=(0,Q.jsxs)(IF,{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=Hq(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)(BY,{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)(Pe,{value:f,onValueChange:d.setMode,children:(0,Q.jsxs)(Hn,{className:`w-full`,children:[(0,Q.jsx)(ar,{value:`single`,className:`flex-1`,disabled:x||T!=null,children:`Single commit`}),(0,Q.jsx)(ar,{value:`amend`,className:`flex-1`,disabled:x||E!=null,children:`Amend last`}),(0,Q.jsx)(ar,{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)(HX,{form:d}):(0,Q.jsx)(PX,{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)(FX,{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=JX(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&&Rt(b))&&(0,Q.jsxs)(`div`,{role:`status`,className:`text-sm`,children:[(0,Q.jsx)(`p`,{children:b.state}),b.progress.map(NX)]}),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 te;t[58]===S?te=t[59]:(te=S?(0,Q.jsx)(JJ,{text:cr(S)}):null,t[58]=S,t[59]=te);let q;t[60]!==d.lookAgain||t[61]!==i||t[62]!==b||t[63]!==C||t[64]!==x?(q=(C||b&&$n(b))&&i&&(0,Q.jsx)(X,{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]=q):q=t[65];let ne;t[66]!==d.checkOutcome||t[67]!==m.operation||t[68]!==x?(ne=m.operation&&!x&&(0,Q.jsx)(X,{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&&$n(b))||w||n.inProgress!==`merge`&&n.changes.some(MX)||!!(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=YX(d),t[80]=d,t[81]=ie);let ae;t[82]!==re||t[83]!==ie?(ae=(0,Q.jsx)(X,{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]!==te||t[96]!==q||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,te,q,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]=te,t[96]=q,t[97]=ne,t[98]=ae,t[99]=D,t[100]=O,t[101]=oe):oe=t[101],oe}function MX(e){return e.scope===`unmerged`}function NX(e){return(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function PX(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)(X,{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)(Dw,{path:e.path,className:`size-3.5 shrink-0`}),(0,Q.jsx)(_r,{className:`min-w-0 flex-1`,text:e.path}),(0,Q.jsx)(`span`,{"aria-hidden":s,className:`shrink-0 text-muted-foreground`,children:KX(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)(yY,{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)(Ur,{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)(rL,{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)(Ui,{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 FX(e){let n=(0,$.c)(57),{form:r}=e,{models:i,model:a}=r,o,s,c,l,u,d,f,p,m,h,g,_;if(n[0]!==r||n[1]!==a||n[2]!==i){let e=Vn(Dn(i));c=e?.find(e=>e.id===a);let v;n[15]===r?v=n[16]:(v=BX(r),n[15]=r,n[16]=v),l=v,g=`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)(Bp,{}),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?(_=(0,Q.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,disabled:y,onClick:b,children:[x,S]}),n[20]=y,n[21]=b,n[22]=S,n[23]=_):_=n[23],s=Pt,d=e?.map(zX)??[],f=a??null,p=!e?.length||r.working||r.uncertain,n[24]===r?m=n[25]:(m=e=>{e&&r.setModel(e)},n[24]=r,n[25]=m);let C=e?.length?`Choose a model`:`No coding CLI available`;n[26]===C?h=n[27]:(h=(0,Q.jsx)(bo,{"aria-label":`Commit model`,className:`w-auto max-w-48`,size:`sm`,children:(0,Q.jsx)(qi,{placeholder:C})}),n[26]=C,n[27]=h),o=t,u=xJ(e?.filter(RX)??[]).map(IX),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]=f,n[10]=p,n[11]=m,n[12]=h,n[13]=g,n[14]=_}else o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],d=n[8],f=n[9],p=n[10],m=n[11],h=n[12],g=n[13],_=n[14];let v;n[28]!==o||n[29]!==u?(v=(0,Q.jsx)(o,{children:u}),n[28]=o,n[29]=u,n[30]=v):v=n[30];let y;n[31]!==s||n[32]!==d||n[33]!==f||n[34]!==p||n[35]!==m||n[36]!==h||n[37]!==v?(y=(0,Q.jsxs)(s,{items:d,value:f,disabled:p,onValueChange:m,children:[h,v]}),n[31]=s,n[32]=d,n[33]=f,n[34]=p,n[35]=m,n[36]=h,n[37]=v,n[38]=y):y=n[38];let b;n[39]!==c?.label||n[40]!==a||n[41]!==l?(b=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]=b):b=n[42];let x;n[43]===b?x=n[44]:(x=(0,Q.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,role:`status`,children:b}),n[43]=b,n[44]=x);let S;n[45]!==r.generate||n[46]!==r.generator.result||n[47]!==r.uncertain||n[48]!==r.working||n[49]!==l?(S=q(r.generator.result)&&!r.working&&(0,Q.jsx)(X,{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]=S):S=n[50];let C;return n[51]!==y||n[52]!==x||n[53]!==S||n[54]!==g||n[55]!==_?(C=(0,Q.jsxs)(`div`,{className:g,children:[_,y,x,S]}),n[51]=y,n[52]=x,n[53]=S,n[54]=g,n[55]=_,n[56]=C):C=n[56],C}function IX(e){let[t,n]=e;return(0,Q.jsxs)(li,{children:[(0,Q.jsx)(Ia,{children:t}),n.map(LX)]},t)}function LX(e){return(0,Q.jsx)(Lo,{value:e.id,children:e.label},e.id)}function RX(e){return!e.id.endsWith(`:default`)}function zX(e){return{value:e.id,label:e.label}}function BX({models:e,model:t,paths:n}){if(q(e))return`Could not load coding CLI models. You can still commit manually.`;let r=Vn(Dn(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 VX(e,t){return e?`Groups were not proposed.`:t?`Proposing commits…`:`Generate groups with AI, then review each message and file before committing.`}function HX(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=VX(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(GX)],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,qX(e.id,a,o)]}),e.paths.length===0&&a.size===0&&(0,Q.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r.removeGroup(e.id),children:`Remove empty group`}),(0,Q.jsx)(rL,{"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)(_r,{className:`min-w-0 flex-1`,text:n.path}),(0,Q.jsxs)(Pt,{items:f,value:e.id,disabled:a.size>0,onValueChange:e=>{e&&r.moveFile(n.paths,e)},children:[(0,Q.jsx)(bo,{size:`sm`,"aria-label":`Commit for ${n.path}`,children:(0,Q.jsx)(qi,{})}),(0,Q.jsxs)(t,{children:[(0,Q.jsx)(Lo,{value:`uncommitted`,children:`Leave uncommitted`}),i.map(WX)]})]})]},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)(_r,{className:`min-w-0 flex-1`,text:e.path}),(0,Q.jsxs)(Pt,{items:f,value:`uncommitted`,disabled:a.size>0,onValueChange:t=>{t&&r.moveFile(e.paths,t)},children:[(0,Q.jsx)(bo,{size:`sm`,"aria-label":`Commit for ${e.path}`,children:(0,Q.jsx)(qi,{})}),(0,Q.jsxs)(t,{children:[(0,Q.jsx)(Lo,{value:`uncommitted`,children:`Leave uncommitted`}),i.map(UX)]})]})]},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)(X,{type:`button`,variant:`outline`,size:`sm`,disabled:i.length>=r.groupLimit,onClick:r.addGroup,children:[(0,Q.jsx)(wp,{}),`Add group`]}),(0,Q.jsx)(X,{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 UX(e,t){return(0,Q.jsxs)(Lo,{value:e.id,children:[`Commit `,t+1]},e.id)}function WX(e,t){return(0,Q.jsxs)(Lo,{value:e.id,children:[`Commit `,t+1]},e.id)}function GX(e,t){return{value:e.id,label:`Commit ${t+1}`}}function KX(e,t,n){return t?e.replaceAll(`-`,` `):n===`amend`?`Not added`:`Excluded`}function qX(e,t,n){return t.has(e)?` · committed`:n===e?` · in progress`:``}function JX({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 YX({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 XX(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)(ZX,{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)($X,{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 ZX(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)(QX,{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)(QX,{action:i}),(0,Q.jsx)(`p`,{role:`alert`,children:`The last commit could not be read. Close and try again.`})]}):(0,Q.jsx)(jX,{scope:n,context:r,action:i,status:a,liveBranch:e.branch??a.branch,initialMessage:i===`amend`&&t?[t.subject,t.body].filter(Boolean).join(`
1392
+
1393
+ `):``,lastCommitMessage:t?[t.subject,t.body].filter(Boolean).join(`
1394
+
1395
+ `):``,...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)(eZ,{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 QX(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)(RF,{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)(zF,{children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(IF,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function $X(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)(tZ,{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)(eZ,{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 eZ(e){let t=(0,$.c)(12),{scope:n,context:r,pending:i,children:a}=e,o=UP(n,r.connection);if(q(o.result)){let e;t[0]===o.result.cause?e=t[1]:(e=cr(Yt(o.result.cause)),t[0]=o.result.cause,t[1]=e);let n;t[2]===e?n=t[3]:(n=(0,Q.jsx)(JJ,{text:e}),t[2]=e,t[3]=n);let r;t[4]===o.refresh?r=t[5]:(r=(0,Q.jsx)(X,{variant:`outline`,onClick:o.refresh,children:`Read status again`}),t[4]=o.refresh,t[5]=r);let i;return t[6]!==n||t[7]!==r?(i=(0,Q.jsxs)(Q.Fragment,{children:[n,r]}),t[6]=n,t[7]=r,t[8]=i):i=t[8],i}if(!$e(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 tZ(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=bY(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(wJ(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)(Ui,{children:[(0,Q.jsx)(Ur,{htmlFor:`git-message`,children:`Message`}),(0,Q.jsx)(rL,{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)(Ui,{children:[(0,Q.jsx)(Ur,{htmlFor:`git-stash`,children:`Stash`}),d?.stashes?.length?(0,Q.jsxs)(Pt,{items:d.stashes.map(rZ),value:m,onValueChange:e=>{e&&h(e)},children:[(0,Q.jsx)(bo,{id:`git-stash`,children:(0,Q.jsx)(qi,{})}),(0,Q.jsx)(t,{children:d.stashes.map(nZ)})]}):(0,Q.jsx)(ae,{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)(yY,{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)(iZ,{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)(JJ,{text:cr(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&&$n(S)&&l&&(0,Q.jsx)(X,{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)(X,{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&&$n(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…`:kJ(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)(X,{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 nZ(e){return(0,Q.jsxs)(Lo,{value:e.oid,children:[e.message,` · `,Iq(e.oid)]},e.oid)}function rZ(e){return{value:e.oid,label:`${e.message} · ${Iq(e.oid)}`}}function iZ(e){let t=(0,$.c)(7),{outcome:n}=e;if(!n)return null;if(n.message&&Rt(n)&&n.state!==`conflicted`){let e;return t[0]===n.message?e=t[1]:(e=(0,Q.jsx)(JJ,{text:n.message}),t[0]=n.message,t[1]=e),e}let r=n.state,i;t[2]===n?i=t[3]:(i=aZ(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 aZ({message:e,reason:t}){return e?` · ${e}`:t?` · ${t.replaceAll(`_`,` `).toLowerCase()}`:``}function oZ(e){let t=(0,$.c)(53),{scope:n,context:r}=e,{connection:i}=r,o=Vn(Dn(zP(n,i))),[s,c]=(0,Z.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>e=>{if(!e)return;let t=()=>c(e.getClientRects().length===0);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},t[0]=l):l=t[0];let[u]=(0,Z.useState)(l),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),h=o!=null&&On(yn(o)).kind===`hint`,g=d||h,_=UP(n,i,g),v=Vn(Dn(_.result)),b=qP(n,i),x=Bs(i),S;t[1]===x?S=t[2]:(S=Xs(x),t[1]=x,t[2]=S);let C=S,w;t[3]!==C||t[4]!==x?(w=C?void 0:dc(x),t[3]=C,t[4]=x,t[5]=w):w=t[5];let T=w,[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(null),[M,N]=(0,Z.useState)(null),[P,F]=(0,Z.useState)(null),I;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>f(!0),t[6]=I):I=t[6];let L;t[7]!==T||t[8]!==C?(L=C?{kind:`ready`,strategy:C}:{kind:`blocked`,reason:T??`Reviews & Git settings for this computer are unavailable.`},t[7]=T,t[8]=C,t[9]=L):L=t[9];let R;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e&&j(null),k(e)},t[10]=R):R=t[10];let z;t[11]!==_||t[12]!==b||t[13]!==L?(z={details:_,enableDetails:I,pull:L,notify:uZ,onProgress:R,onResult:j,refreshLook:b,onLooked:F},t[11]=_,t[12]=b,t[13]=L,t[14]=z):z=t[14];let B=rY(n,r,z);if(o==null)return null;let V={...yn(o),branch:ye(o.branch,g?v?.branch:void 0)},H;t[15]===M?H=t[16]:(H=e=>e.id===M,t[15]=M,t[16]=H);let U=DJ.find(H),W=On(V),G=W.kind===`run`&&W.action===`pull`&&!C,K=G&&T?T:Oe(W,V),ee=Ln(W,V),te=Kt(V),q=B.running,re;t[17]!==_.result||t[18]!==g?(re=g&&De(_.result),t[17]=_.result,t[18]=g,t[19]=re):re=t[19];let ie=re,ae=ie?OJ.slice(0,1):OJ,oe=e=>{if(kt(e)){B.runNetwork(e,V.branch);return}F(V),N(e)},se;t[20]===q?se=t[21]:(se=e=>{e||j(null),q&&k(e)},t[20]=q,t[21]=se);let ce=q?`${ne(q.name)}…`:W.label,le=!q&&ee!=null&&` ${ee}`,ue;t[22]!==ce||t[23]!==le?(ue=(0,Q.jsxs)(`span`,{ref:u,"aria-hidden":`true`,className:`hidden @min-lg/pane:inline`,children:[ce,le]}),t[22]=ce,t[23]=le,t[24]=ue):ue=t[24];let de;t[25]!==B.checkOutcome||t[26]!==A||t[27]!==q?(de=(0,Q.jsx)(fo,{align:`end`,className:`w-80`,children:A&&!q?(0,Q.jsxs)(Sr,{children:[(0,Q.jsx)(Ra,{children:A.title}),A.description!==void 0&&(A.type===`error`?(0,Q.jsx)(JJ,{text:A.description}):(0,Q.jsx)(zi,{children:(0,Q.jsx)(qJ,{text:A.description})}))]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ra,{children:q?`${ne(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(lZ):(0,Q.jsx)(`li`,{className:`text-muted-foreground`,children:`Waiting for Git…`})}),q&&A?.description&&(0,Q.jsx)(JJ,{text:A.description}),q&&(0,Q.jsx)(X,{variant:`outline`,disabled:q.checking,onClick:B.checkOutcome,children:q.checking?`Checking…`:`Check outcome`})]})}),t[25]=B.checkOutcome,t[26]=A,t[27]=q,t[28]=de):de=t[28];let fe;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>{m(e),e&&f(!0)},t[29]=fe):fe=t[29];let pe=q!=null,J;t[30]===pe?J=t[31]:(J=(0,Q.jsx)(Lr,{render:(0,Q.jsx)(X,{variant:`outline`,size:`icon`,"aria-label":`Git actions`,disabled:pe})}),t[30]=pe,t[31]=J);let me;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Q.jsx)(a,{className:`size-3.5`}),t[32]=me):me=t[32];let he;t[33]===J?he=t[34]:(he=(0,Q.jsx)(Ts,{render:J,children:me}),t[33]=J,t[34]=he);let ge;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Q.jsx)(tt,{role:`tooltip`,className:`break-all`,children:`Git actions`}),t[35]=ge):ge=t[35];let _e;t[36]===he?_e=t[37]:(_e=(0,Q.jsxs)(ke,{children:[he,ge]}),t[36]=he,t[37]=_e);let ve=te?(0,Q.jsx)(BY,{tracking:Hq(te,null)}):(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Hf,{className:`size-3.5 shrink-0`}),`Git actions`]}),be;t[38]===ve?be=t[39]:(be=(0,Q.jsx)(Oi,{children:(0,Q.jsx)(Xo,{children:ve})}),t[38]=ve,t[39]=be);let xe;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Q.jsx)(bs,{}),t[40]=xe):xe=t[40];let Se=ae.map((e,t)=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(Oi,{children:e.actions.map(e=>{let t=e.id===`pull`&&!C?T:ws(e.id,V),n=t??y(e.id,V);return(0,Q.jsxs)(ke,{onOpenChange:cZ,children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(`span`,{className:`block`}),children:(0,Q.jsxs)(br,{disabled:t!=null,onClick:()=>oe(e.id),children:[(0,Q.jsx)(sY,{action:e.id}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(_r,{text:e.label}),t&&(0,Q.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:t})]})]})}),(0,Q.jsxs)(tt,{children:[e.description,n&&` ${n}`]})]},e.id)})}),(ie||t<ae.length-1)&&(0,Q.jsx)(bs,{})]},e.id)),Ce;t[41]===ie?Ce=t[42]:(Ce=ie&&(0,Q.jsx)(`p`,{role:`status`,className:`px-2 py-1 text-xs text-muted-foreground`,children:`Reading Git status…`}),t[41]=ie,t[42]=Ce);let we=!ie&&(te?.discarded?.length??0)>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(bs,{}),(0,Q.jsxs)(Oi,{children:[(0,Q.jsx)(Xo,{children:`Discarded`}),te?.discarded?.map(e=>{let t=e.kind===`rename`?`Restore discarded rename of ${e.path}`:`Restore discarded hunk of ${e.path}`;return(0,Q.jsxs)(ke,{onOpenChange:sZ,children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(`span`,{className:`block`}),children:(0,Q.jsxs)(br,{onClick:()=>{m(!1),B.restoreDiscarded(e)},children:[(0,Q.jsx)(Xp,{}),(0,Q.jsx)(_r,{className:`min-w-0`,text:t,propagateEscape:!0})]})}),(0,Q.jsxs)(tt,{children:[t,` · Kept until you restore it`]})]},e.oid)})]})]}),Te;t[43]!==ie||t[44]!==be||t[45]!==Se||t[46]!==Ce||t[47]!==we?(Te=(0,Q.jsxs)(Li,{align:`end`,className:`w-76`,"aria-busy":ie,children:[be,xe,Se,Ce,we]}),t[43]=ie,t[44]=be,t[45]=Se,t[46]=Ce,t[47]=we,t[48]=Te):Te=t[48];let Ee;return t[49]!==p||t[50]!==_e||t[51]!==Te?(Ee=(0,Q.jsxs)(ro,{open:p,onOpenChange:fe,children:[_e,Te]}),t[49]=p,t[50]=_e,t[51]=Te,t[52]=Ee):Ee=t[52],(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(nY,{"aria-label":`Git controls`,className:`shrink-0`,children:[(0,Q.jsxs)(ke,{children:[(0,Q.jsxs)(ka,{open:q!=null&&O||A!=null,onOpenChange:se,children:[(0,Q.jsxs)(Ts,{render:(0,Q.jsx)(So,{render:(0,Q.jsx)(X,{variant:`outline`,size:s?`icon`:`default`,"aria-label":q?`${ne(q.name)} in progress: show progress`:W.label,disabled:q==null&&(W.kind===`hint`||G),focusableWhenDisabled:!0,className:`aria-disabled:cursor-default`,onClick:()=>{q||A||(W.kind===`commit`?oe(`commit`):W.kind===`stash`?oe(`stash-apply`):W.kind===`run`&&B.runNetwork(W.action,V.branch))}})}),children:[q?(0,Q.jsx)(wi,{className:`size-3.5`}):(0,Q.jsx)(sY,{action:dZ(W),className:`size-3.5`}),ue]}),de]}),(0,Q.jsx)(tt,{role:`tooltip`,className:`break-all`,children:q?`${ne(q.name)} in progress: show progress`:K})]}),Ee]}),M==null?null:(0,Q.jsx)(AF,{open:!0,disablePointerDismissal:!0,onOpenChange:e=>{!e&&!E&&N(null)},children:(0,Q.jsxs)(FF,{"aria-busy":E,className:`max-h-[min(90svh,48rem)] overflow-y-auto sm:max-w-2xl`,children:[U?.id!==`commit`&&U?.id!==`amend`&&(0,Q.jsxs)(IF,{children:[(0,Q.jsx)(RF,{children:U?.label??`Git action`}),(0,Q.jsx)(zF,{children:fZ(U?.id)})]}),(0,Q.jsx)(XX,{scope:n,context:r,entry:M,status:P??V,onBusy:D,onLookAgain:B.lookAgain})]})})]})}function sZ(e,t){t.reason===`escape-key`&&t.allowPropagation()}function cZ(e,t){t.reason===`escape-key`&&t.allowPropagation()}function lZ(e){return(0,Q.jsx)(_r,{render:(0,Q.jsx)(`li`,{}),text:e},e)}function uZ(e){let{title:t,description:n,type:r}=e;return Is.add({title:t,description:n===void 0?void 0:(0,Q.jsx)(qJ,{text:n}),type:r})}function dZ(e){return e.kind===`run`?e.action:e.kind===`stash`?`stash-apply`:`commit`}function fZ(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 pZ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=we(`(min-width: 1280px)`),e[0]=t):t=e[0],Yr(t)}function mZ(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function hZ(e){return!e||typeof e!=`object`||!(`folded`in e)||!(`expanded`in e)?{folded:[],expanded:[]}:mZ(e.folded)&&mZ(e.expanded)?{folded:e.folded,expanded:e.expanded}:{folded:[],expanded:[]}}function gZ(e,t,n=!1){return e.folded.includes(t)||n&&!e.expanded.includes(t)}function _Z(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 vZ=Lt(Le({saved:vn}));function yZ(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 bZ=Ha(e=>Zr({body:``}).pipe(ma)),xZ=Ha(e=>Zr({body:``}).pipe(ma)),SZ=Ha(e=>Zr(void 0).pipe(ma)),CZ=Lt(Le({focused:In([0,1])})),wZ=Qn.pipe(sr(Le({panes:ue(ve(Le({tabs:ve(ao),pinned:ve(ao)}))),saved:vn,focused:In([0,1])}),{decode:qa(e=>({panes:pJ(e),saved:vZ(e).pipe(uo(e=>e.saved),Ce(()=>!0)),focused:CZ(e).pipe(uo(e=>e.focused),Ce(()=>0))})),encode:jr()})),TZ=Qn.pipe(sr(Le({folded:ve(ao),expanded:ve(ao)}),{decode:qa(hZ),encode:jr()})),EZ=Ha(e=>Ho({runtime:Su,key:`porcelain.tabs.${e}`,schema:wZ,defaultValue:()=>({panes:null,saved:!1,focused:0})})),DZ=Ha(e=>Zr([]).pipe(ma)),OZ=Ha(e=>Ho({runtime:Su,key:e,schema:TZ,defaultValue:()=>({folded:[],expanded:[]})}));function kZ(e){let t=(0,$.c)(13),n;t[0]===e?n=t[1]:(n=EZ(e),t[0]=e,t[1]=n);let r=n,{panes:i,saved:a,focused:o}=Yr(r),s=fa(r),c=Yr(Et),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 AZ(e,t){let n=(0,$.c)(7),r=`porcelain.folds.${e}.${t}`,i;n[0]===r?i=n[1]:(i=OZ(r),n[0]=r,n[1]=i);let a=i,o=Yr(a),s=fa(a),c;n[2]===s?c=n[3]:(c=(e,t)=>s(n=>_Z(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 jZ=Ha(e=>Ho({runtime:Su,key:`porcelain.walkthrough.${e}`,schema:ao,defaultValue:()=>`briefing`})),MZ=Ha(e=>Zr(`walkthrough`).pipe(ma));function NZ(e){let t=(0,$.c)(12),n;t[0]===e?n=t[1]:(n=jZ(e),t[0]=e,t[1]=n);let r=n,i;t[2]===e?i=t[3]:(i=MZ(e),t[2]=e,t[3]=i);let a=i,o=fa(r),s=fa(a),c=Yr(r),l=Yr(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 PZ=Ha(e=>Zr(25).pipe(ma)),FZ=Ha(e=>Zr(null)),IZ=Ha(e=>Zr({scrollTop:0,selection:null,focused:void 0}).pipe(ma));function LZ(e){let t=(0,$.c)(25),n=(0,Z.useId)(),r;t[0]===n?r=t[1]:(r=FZ(n),t[0]=n,t[1]=r);let i=r;Ba(i);let a=Yr(Et),o;t[2]===e?o=t[3]:(o=IZ(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 RZ=Ha(e=>Zr({revision:void 0,request:0}).pipe(ma));function zZ(e){let t=(0,$.c)(7),n;t[0]===e?n=t[1]:(n=RZ(e),t[0]=e,t[1]=n);let r=n,i=Yr(r),a=fa(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 BZ=Ha(e=>Zr(!0).pipe(ma));function VZ(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=BZ(e),t[0]=e,t[1]=n);let r=n,i=Yr(r),a=fa(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 HZ=Ha(e=>Zr(`layers`).pipe(ma));function UZ(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=HZ(e),t[0]=e,t[1]=n);let r=n,i=Yr(r),a=fa(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 WZ=Ha(e=>Zr(!1).pipe(ma));function GZ(e){let t=(0,$.c)(10),n;t[0]===e?n=t[1]:(n=WZ(e),t[0]=e,t[1]=n);let r=n,i=Yr(r),a=fa(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 KZ=Ha(e=>Zr({}).pipe(ma));function qZ(e,t){let n=(0,$.c)(7),r=`${e}:${t}`,i;n[0]===r?i=n[1]:(i=KZ(r),n[0]=r,n[1]=i);let a=i,o=fa(a),s=Yr(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 JZ(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}=kZ(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=XZ(x),t[2]=x,t[3]=S);let C=Yr(S),w=C.cancel,T=[r!=null&&(Yq(r)??null)!==null?r:void 0,i!=null&&(Yq(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=ZZ({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],Ba(E);let D=e=>{let t=g[e];return t===void 0?T[e]:t??void 0},O=[nJ(f?.[0]??tJ()),...f?.slice(1)??[]],k=[D(0)??(f==null?o??`handoff`:iJ(O[0]??tJ()).at(-1)??null),D(1)??(D(0)!==void 0||O[1]===null||O[1]===void 0?null:iJ(O[1]).at(-1)??null)],A=[aJ(O[0]??tJ(),k[0]??``,y[0])];(k[0]===null||k[0]===void 0)&&(A[0]=O[0]??tJ()),k[1]!==null&&k[1]!==void 0&&(A[1]=aJ(O[1]??tJ(),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)}Ba(QZ({worktreeId:n,panes:A,ready:l}));let M;t[11]===n?M=t[12]:(M=DZ(n),t[11]=n,t[12]=M);let N=Yr(M),P=k[s]??null;Ba($Z({worktreeId:n,panes:A,active:P,ready:l}));let F=_J(N,A,P).flatMap(YZ),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]??tJ()]),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:iJ(e),pinned:e.pinned,active:k[t]??null})),activate(e,t){c(e),z(e,t)},open(e,t){let n=rJ(A,e,t);return z(n,t),C.request({pane:n,key:t}),c(n),n},closePane(e){j&&V(e,tJ(),null)},close(e,t){let n=A[e]??tJ(),r=oJ(n,t);V(e,r,t===k[e]?uJ(n,t,r):k[e])},closeOthers(e,t){V(e,sJ(A[e]??tJ(),t),t)},closeUnpinned(e){let t=cJ(A[e]??tJ()),n=k[e];V(e,t,n!=null&&t.tabs.includes(n)?n:iJ(t)[0]??null)},togglePin(e,t){m(B(e,lJ(A[e]??tJ(),t)))},openToSide(e,t){let n=+(e===0),r=[...A];r[n]=aJ(A[n]??tJ(),t,k[n]),m(r),z(n,t),C.request({pane:n,key:t}),c(n)},step(e,t){w();let n=iJ(A[e]??tJ());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 YZ(e){let t=Yq(e);return t?.kind===`file`?[t.path]:[]}var XZ=Ha(e=>Zr(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()}}}})),ZZ=Ha(({ready:e,entry:t,side:n,onSearch:r,fallback:i,saved:a})=>Zr(()=>{e&&(t!==void 0&&Yq(t)===null&&r({entry:void 0},{replace:!0}),n!==void 0&&Yq(n)===null&&r({side:void 0},{replace:!0}),!a&&t===void 0&&n===void 0&&i!==null&&r({entry:i},{replace:!0}))})),QZ=Ha(({worktreeId:e,panes:t,ready:n})=>Zr(r=>{if(!n)return;let i=EZ(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})})),$Z=Ha(({worktreeId:e,panes:t,active:n,ready:r})=>Zr(i=>{if(!r)return;let a=DZ(e),o=i.once(a),s=_J(o,t,n);o.length===s.length&&o.every((e,t)=>e===s[t])||i.set(a,s)}));function eQ(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 tQ=Ha(e=>Ls(e).pipe(Ni,gr(0)));function nQ(e,t){let n=(0,$.c)(9),r;n[0]!==t.connection||n[1]!==e?(r=tQ({scope:e,connection:t.connection}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i=r,a=Yr(i),o;n[3]===a?o=n[4]:(o=Vn(Dn(a)),n[3]=a,n[4]=o);let s=Br(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 rQ=Zr(Ot()),iQ=Zr(Ot());function aQ(e){let t=(0,$.c)(15),{scope:n,context:r,review:i,reviewTitle:a}=e,o=zP(n,r.connection),s=zZ(i?.reviewId??``),c=Ec(r.connection),l;t[0]!==r.connection||t[1]!==i||t[2]!==s?(l=i?.reviewId?$o({connection:r.connection,reviewId:i.reviewId,...s.revision===void 0?{}:{revision:s.revision}}):rQ,t[0]=r.connection,t[1]=i,t[2]=s,t[3]=l):l=t[3];let u=Yr(l),d;t[4]!==r.connection||t[5]!==i?(d=i?.reviewId?N({connection:r.connection,reviewId:i.reviewId}):iQ,t[4]=r.connection,t[5]=i,t[6]=d):d=t[6];let f=Yr(d);if(!i?.reviewId){let e;if(t[7]!==o||t[8]!==a){let n=Vn(Dn(o))?.changes.length??0;e=a?void 0:gJ(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=Vn(Dn(u))?.revision,n=Vn(Dn(f));p=hJ(e?Tm(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 oQ(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 sQ(e,t,n){let r=Yq(e);switch(r?.kind){case`handoff`:{let e=t??`Changes`;return{Icon:t?ip:bf,title:e,hint:n?`${e} · ${n.description}`:e}}case`all-changes`:return{Icon:bf,title:`All changes`,hint:`Every changed file, including specs`};case`specs`:return{Icon:Mf,title:`Specs`,hint:`Changed spec and test files`};case`change`:return{Icon:vf,title:qn(r.path),accessibleName:r.path,hint:`${r.path} · changes`};case`file`:case`review-file`:case`review-change`:return{Icon:vf,title:qn(r.path),accessibleName:r.path,hint:`${r.path} · file`};case`commit`:return{Icon:Wf,title:Iq(r.oid),hint:`Commit ${r.oid}`};case`branch`:return{Icon:Hf,title:`Branch`,hint:`Every change on the branch`};case`branch-file`:return{Icon:vf,title:qn(r.path),accessibleName:r.path,hint:`${r.path} · branch`};case`pull-request`:return{Icon:Qf,title:`PR #${r.number}`,hint:`Pull request #${r.number}`};case`graph`:return{Icon:Hf,title:`Graph`,hint:`Commit graph of the checked-out branch`};case`timeline`:return{Icon:Ap,title:`Timeline of ${qn(r.path)}`,accessibleName:`Timeline of ${r.path}`,hint:`${r.path} · timeline`};default:return{Icon:Ef,title:e,hint:e}}}function cQ(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=Y(`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)(dQ,{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(lQ).map((e,t)=>{let a=c.includes(e),o=a&&!c.includes(d[t+1]??``)&&t<d.length-1,s=Yq(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)(fQ,{...f,commitContext:i,oid:s.oid}):(0,Q.jsx)(dQ,{...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)(gI,{"data-tab-viewport":``,className:`size-full overflow-y-hidden`,ref:uQ,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)(EI,{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)(iI,{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 lQ(e){return e!==`handoff`}function uQ(e){if(!e)return;let t=()=>oQ(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 dQ(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?(_=sQ(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=mJ(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=Y(`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)(qI,{render:(0,Q.jsx)(`div`,{ref:e=>{a&&oQ(e)},role:`tab`,tabIndex:0,"aria-selected":a,"aria-label":i?w:S,"aria-describedby":r?C:void 0,"data-entry":n,className:Y(`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)(ke,{disableHoverablePopup:!0,children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(X,{type:`button`,"aria-label":`Unpin ${y}`,onClick:e=>{e.stopPropagation(),m(n)},variant:`ghost`,size:`icon-xs`}),children:(0,Q.jsx)(bp,{className:`size-3`})}),(0,Q.jsx)(tt,{children:`Unpin ${y}`})]}),n!==`handoff`&&a&&(0,Q.jsxs)(ke,{disableHoverablePopup:!0,children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(X,{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)(kn,{className:`size-3`})}),(0,Q.jsxs)(tt,{children:[`Close ${y}`,(0,Q.jsx)(eL,{children:uc(Ic.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)(_r,{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)(Sp,{}):(0,Q.jsx)(bp,{}),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)(XI,{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,bd.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)(of,{}),t[45]=G):G=t[45];let K;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(QI,{children:uc(Ic.openToSide)}),t[46]=K):K=t[46];let ee;t[47]!==k||t[48]!==U||t[49]!==W?(ee=(0,Q.jsxs)(XI,{disabled:U,onClick:W,children:[G,k,K]}),t[47]=k,t[48]=U,t[49]=W,t[50]=ee):ee=t[50];let te;t[51]===g?te=t[52]:(te=g&&(0,Q.jsxs)(XI,{onClick:g,children:[(0,Q.jsx)(of,{}),`Close pane`]}),t[51]=g,t[52]=te);let q;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Q.jsx)(ZI,{}),t[53]=q):q=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)(kn,{}),t[57]=ie):ie=t[57];let ae;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(QI,{children:uc(Ic.closeTab)}),t[58]=ae):ae=t[58];let oe;t[59]!==ne||t[60]!==re?(oe=(0,Q.jsxs)(XI,{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)(Hp,{}),t[65]=ce):ce=t[65];let le;t[66]===se?le=t[67]:(le=(0,Q.jsxs)(XI,{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)(up,{}),t[68]=de):de=t[68];let fe;t[69]!==p||t[70]!==ue?(fe=(0,Q.jsxs)(XI,{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]!==te||t[76]!==oe||t[77]!==le||t[78]!==fe?(pe=(0,Q.jsxs)(JI,{className:`min-w-52`,finalFocus:L,children:[H,ee,te,q,oe,le,fe]}),t[72]=L,t[73]=H,t[74]=ee,t[75]=te,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)(KI,{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 fQ(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=PY({...n,oid:r,parent:1}),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o=Yr(a),s;t[7]===o?s=t[8]:(s=Vn(Dn(o)),t[7]=o,t[8]=s);let c=s?.commit.subject,l;return t[9]!==c||t[10]!==i?(l=(0,Q.jsx)(dQ,{...i,commitSubject:c}),t[9]=c,t[10]=i,t[11]=l):l=t[11],l}function pQ(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)(ke,{children:[(0,Q.jsxs)(Ts,{render:(0,Q.jsx)(X,{variant:f,size:e===`compact`?`icon`:`default`,className:Y(!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)(eL,{children:uc(a)})]}),(0,Q.jsxs)(tt,{role:`tooltip`,children:[r??n,a&&(0,Q.jsx)(eL,{children:uc(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 mQ(e,t,n){let r=(0,$.c)(4),i=n===void 0?Ae:n,a;return r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=Hc({scope:e,connection:t.connection,range:i}),r[0]=t.connection,r[1]=i,r[2]=e,r[3]=a):a=r[3],vu(a).value}function hQ(e,t,n){let r=(0,$.c)(4),i=n===void 0?Ae:n,a;r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=Hc({scope:e,connection:t.connection,range:i}),r[0]=t.connection,r[1]=i,r[2]=e,r[3]=a):a=r[3],Ba(a)}function gQ(e,t,n,r){let i=(0,$.c)(4),a=mQ(e,t),o;return i[0]!==n||i[1]!==r||i[2]!==a?(o=Bt(n,a,r),i[0]=n,i[1]=r,i[2]=a,i[3]=o):o=i[3],o}function _Q(e,t,n){(e[t]??=[]).push(n)}function vQ(e,t){let n={};return e.steps.forEach((r,i)=>{switch(r.location.state){case`committed`:case`broken`:return}let a=`${i+1}`;_Q(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 yQ(e){let t={};for(let n of e)for(let e of n.ranges)_Q(t,n.path,{title:`Not explained`,text:`${uP([e])} changed without an explanation from the agent.`,line:e.endLine,stale:!1,tone:`gap`});return t}function bQ(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n))for(let n of r)_Q(t,e,n);return t}function xQ(e){let t=(0,$.c)(13),{scope:n,context:r,base:i,children:a}=e,o=eF(n,r.connection,i);if(q(o.result)){let e;t[0]===o.result.cause?e=t[1]:(e=gP(Yt(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)(g,{description:e,onRetry:o.refresh}),t[2]=o.refresh,t[3]=e,t[4]=n):n=t[4],n}if(!$e(o.result)){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(hn,{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)(he,{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)(hn,{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 SQ(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(`
1396
+ `):``}function CQ(e,t,n,r){return{id:e,kind:`file`,path:t,contents:n,version:ku(n),...r?{note:r}:{}}}var wQ=new Map,TQ=new Map;function EQ(e){if(e.kind===`diff`){let t=wQ.get(e.id);return t?.cacheKey!==void 0&&t.cacheKey===e.fileDiff.cacheKey?{type:`diff`,fileDiff:t}:(wQ.set(e.id,e.fileDiff),{type:`diff`,fileDiff:e.fileDiff})}let t=TQ.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 TQ.set(e.id,n),{type:`file`,file:n}}function DQ(e){let t=new Map;for(let n of e){let e=t.get(n.path)??{additions:0,deletions:0},r=OQ(n);e.additions+=r.additions,e.deletions+=r.deletions,t.set(n.path,e)}return t}function OQ(e){return e.kind===`file`?{additions:e.contents.split(`
1397
+ `).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 kQ(e,t,n){let r=(0,$.c)(9),i=n===void 0?Ae:n,a;r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=Bu({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]=wr(o,s),u=fa(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 AQ(e,t,n){let r=(0,$.c)(9),i=n===void 0?Ae:n,a;r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=Bu({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]=wr(o,s),u=fa(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 jQ(e,t,n){let r=(0,$.c)(10),i=n===void 0?Ae:n,a;r[0]!==t.connection||r[1]!==i||r[2]!==e?(a=Bu({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]=wr(a.bulk),c;r[4]===o?c=r[5]:(c=Vn(Dn(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 MQ(e,t,n,r){let i=(0,$.c)(4),a=r===void 0?Ae:r,o=kQ(e,t,a),s=AQ(e,t,a),c;return i[0]!==o||i[1]!==n||i[2]!==s?(c={toggle(e){let t=pe(e,o.result.waiting||s.result.waiting);t&&(t.kind===`unmark`?s.submit(t.path):o.submit(t.input)).then(e=>{Nt(e)&&n({title:`Could not update review`,description:ai(Yt(e.cause)),type:`error`})})}},i[0]=o,i[1]=n,i[2]=s,i[3]=c):c=i[3],c}function NQ(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 PQ(e,t,n){let r=(0,$.c)(7),i;r[0]!==t.connection||r[1]!==e||r[2]!==n?(i=e.review?V({reviewId:e.review.reviewId,connection:t.connection,...n?{worktree:n}:{}}):ot({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}=vu(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 FQ(e,t){let n=(0,$.c)(3),r;n[0]!==t.connection||n[1]!==e?(r=e.review?V({reviewId:e.review.reviewId,connection:t.connection}):ot({scope:e,connection:t.connection}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2],Ba(r)}var IQ=12;function LQ(e,t=IQ){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 RQ(){let e=(0,$.c)(4),[t,n]=(0,Z.useState)(0),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>zQ(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 zQ(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||VQ(e,void 0),t}),i=r.map(e=>e.getBoundingClientRect()),a=LQ(i.map(e=>({top:e.top,height:e.height}))),o=0;r.forEach((e,t)=>{let n=a[t]??0;VQ(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 BQ(e){e.closest(`diffs-container`)?.shadowRoot?.querySelector(`[data-code] [data-selected-line]`)?.scrollIntoView({block:`center`,inline:`nearest`})}function VQ(e,t){[...e.children].forEach((e,n)=>{e instanceof HTMLElement&&(e.dataset.displaced=String(t!==void 0&&(t>0||n>0)))})}function HQ(e,t){return{filePath:t,revision:e.headOid,comparison:{kind:`branch`,base:e.base}}}function UQ(e,t,n){return n?e.kind!==`change`&&e.filePath===t.filePath:gs(e,t)}function WQ(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)||hr(e,t)}function GQ(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=wr(e,n),i;return t[1]===r?i=t[2]:(i=gM(r),t[1]=r,t[2]=i),i}function KQ(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=Gu({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],Ba(a)}function qQ(e,t){let n=(0,$.c)(5),r;n[0]!==t.connection||n[1]!==e?(r=e.review?Us({reviewId:e.review.reviewId,connection:t.connection}).createComment:Ju({scope:e,connection:t.connection}).create,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i=GQ(r),a;return n[3]===i?a=n[4]:(a={...i,bodyLimit:Ct},n[3]=i,n[4]=a),a}function JQ(e,t){let n=(0,$.c)(5),r;n[0]!==t.connection||n[1]!==e?(r=e.review?Us({reviewId:e.review.reviewId,connection:t.connection}).reply:Ju({scope:e,connection:t.connection}).reply,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i=GQ(r),a;return n[3]===i?a=n[4]:(a={...i,bodyLimit:Ct},n[3]=i,n[4]=a),a}function YQ(e,t){let n=(0,$.c)(3),r;return n[0]!==t.connection||n[1]!==e?(r=e.review?Us({reviewId:e.review.reviewId,connection:t.connection}).resolve:Ju({scope:e,connection:t.connection}).resolve,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2],GQ(r)}function XQ(e,t){let n=(0,$.c)(5),r;n[0]!==t.connection||n[1]!==e?(r=e.review?Us({reviewId:e.review.reviewId,connection:t.connection}).edit:Ju({scope:e,connection:t.connection}).edit,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let i=GQ(r),a;return n[3]===i?a=n[4]:(a={...i,bodyLimit:Ct},n[3]=i,n[4]=a),a}function ZQ(e,t){let n=(0,$.c)(3),r;return n[0]!==t.connection||n[1]!==e?(r=e.review?Us({reviewId:e.review.reviewId,connection:t.connection}).deleteComment:Ju({scope:e,connection:t.connection}).remove,n[0]=t.connection,n[1]=e,n[2]=r):r=n[2],GQ(r)}function QQ(e,t){let n=(0,$.c)(9),r;n[0]!==t.connection||n[1]!==e?(r=yl({scope:e,connection:t.connection}),n[0]=t.connection,n[1]=e,n[2]=r):r=n[2];let[i,a]=wr(r),o;n[3]===a?o=n[4]:(o=()=>a(Er),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 $Q(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 e$(e){let t=(0,$.c)(68),{scope:n,context:r,anchor:i,onClose:a,quote:o,questionId:s,variant:c,autoFocus:l,closable:u,inputRef:d}=e,f=c===void 0?`comment`:c,p=l===void 0||l,m=u===void 0||u,h=(0,Z.useId)(),g;t[0]!==i||t[1]!==r.connection.environmentId||t[2]!==s||t[3]!==o||t[4]!==n?(g=bZ(yZ(r.connection.environmentId,n,{kind:`create`,anchor:i,quote:o,questionId:s})),t[0]=i,t[1]=r.connection.environmentId,t[2]=s,t[3]=o,t[4]=n,t[5]=g):g=t[5];let[_,v]=wr(g),{body:y,pending:b}=_,x=qQ(n,r),S;t[6]!==y||t[7]!==o?(S=o===void 0?y:cs(o,y),t[6]=y,t[7]=o,t[8]=S):S=t[8];let C=S,w=b?.body===C?b.anchor:i,T=C.length-y.length,E;t[9]!==y||t[10]!==C?(E=Si(y)&&Si(C),t[9]=y,t[10]=C,t[11]=E):E=t[11];let D=E,O;t[12]!==x.result.waiting||t[13]!==a||t[14]!==v?(O=()=>{x.result.waiting||(v({body:``}),a())},t[12]=x.result.waiting,t[13]=a,t[14]=v,t[15]=O):O=t[15];let k=O,A;t[16]!==i||t[17]!==_||t[18]!==C||t[19]!==x||t[20]!==a||t[21]!==b||t[22]!==n||t[23]!==v||t[24]!==D?(A=e=>{if(!D||x.result.waiting)return;let t=es(b,C,()=>({body:C,anchor:i,threadId:crypto.randomUUID(),messageId:crypto.randomUUID(),...n.review?{reviewRevision:n.review.revision}:{}}));v({..._,pending:t}),x.send(t,()=>{v({body:``,pending:void 0}),e.isConnected&&a()})},t[16]=i,t[17]=_,t[18]=C,t[19]=x,t[20]=a,t[21]=b,t[22]=n,t[23]=v,t[24]=D,t[25]=A):A=t[25];let j=A,M=f===`answer`,N=Math.max(0,x.bodyLimit-T),P;t[26]===v?P=t[27]:(P=e=>{v({body:e.target.value,pending:void 0})},t[26]=v,t[27]=P);let F;t[28]!==k||t[29]!==m||t[30]!==x.result.waiting?(F=e=>{$Q(e,x.result.waiting,m?k:void 0)},t[28]=k,t[29]=m,t[30]=x.result.waiting,t[31]=F):F=t[31];let I;t[32]!==p||t[33]!==y||t[34]!==h||t[35]!==d||t[36]!==x.result.waiting||t[37]!==P||t[38]!==F||t[39]!==N?(I={id:h,ref:d,autoFocus:p,value:y,maxLength:N,disabled:x.result.waiting,onChange:P,onKeyDown:F},t[32]=p,t[33]=y,t[34]=h,t[35]=d,t[36]=x.result.waiting,t[37]=P,t[38]=F,t[39]=N,t[40]=I):I=t[40];let L=I,R=M?`flex flex-col gap-1.5 font-sans`:`m-3 flex flex-col gap-2 rounded-lg border bg-card p-3 font-sans`,z;t[41]===j?z=t[42]:(z=e=>{e.preventDefault(),j(e.currentTarget)},t[41]=j,t[42]=z);let B=M?`text-xs leading-4 font-medium text-muted-foreground`:`text-xs text-muted-foreground`,V;t[43]!==M||t[44]!==w?(V=M?`Answer the agent`:[Ca(w),Za(w),w.kind===`change`&&w.revision!==null&&w.revision!==void 0?`at ${Iq(w.revision)}`:void 0].filter(t$).join(` · `),t[43]=M,t[44]=w,t[45]=V):V=t[45];let H;t[46]!==h||t[47]!==B||t[48]!==V?(H=(0,Q.jsx)(`label`,{htmlFor:h,className:B,children:V}),t[46]=h,t[47]=B,t[48]=V,t[49]=H):H=t[49];let U;t[50]!==M||t[51]!==L?(U=M?(0,Q.jsx)(rL,{...L,rows:4,placeholder:`Your answer…`}):(0,Q.jsx)(rL,{...L,"aria-label":`Comment`,placeholder:`Share feedback…`}),t[50]=M,t[51]=L,t[52]=U):U=t[52];let W;t[53]===x.result?W=t[54]:(W=q(x.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:ai(Yt(x.result.cause))}),t[53]=x.result,t[54]=W);let G;t[55]!==M||t[56]!==k||t[57]!==m||t[58]!==x.result.waiting||t[59]!==D?(G=M?(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`}),m&&(0,Q.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`ml-auto`,disabled:x.result.waiting,onClick:k,children:`Cancel`}),(0,Q.jsxs)(X,{type:`submit`,size:`sm`,className:Y(!m&&`ml-auto`),disabled:!D||x.result.waiting,children:[(0,Q.jsx)(Nd,{}),x.result.waiting?`Sending…`:`Send answer`]})]}):(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(X,{type:`button`,size:`sm`,variant:`ghost`,disabled:x.result.waiting,onClick:k,children:`Cancel`}),(0,Q.jsx)(X,{type:`submit`,size:`sm`,disabled:!D||x.result.waiting,children:x.result.waiting?`Posting…`:`Comment`})]}),t[55]=M,t[56]=k,t[57]=m,t[58]=x.result.waiting,t[59]=D,t[60]=G):G=t[60];let K;return t[61]!==R||t[62]!==z||t[63]!==H||t[64]!==U||t[65]!==W||t[66]!==G?(K=(0,Q.jsxs)(`form`,{className:R,onSubmit:z,children:[H,U,W,G]}),t[61]=R,t[62]=z,t[63]=H,t[64]=U,t[65]=W,t[66]=G,t[67]=K):K=t[67],K}function t$(e){return e!=null}function n$(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=Y(`text-sm`,f),t[0]=f,t[1]=p);let m;t[2]!==p||t[3]!==r?(m=(0,Q.jsx)(SM,{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=Y(_,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=Y(`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)(nc,{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 r$=kr(`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 i$({variant:e=`default`,align:t=`start`,className:n,...r}){return(0,Q.jsx)(`div`,{"data-slot":`bubble`,"data-variant":e,"data-align":t,className:Y(r$({variant:e}),n),...r})}function a$({className:e,render:t,...n}){return _o({defaultTagName:`div`,props:wt({className:Y(`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`}})}kr(`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 o$({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-group`,className:Y(`flex min-w-0 flex-col gap-1.5`,e),...t})}function s$({className:e,align:t=`start`,...n}){return(0,Q.jsx)(`div`,{"data-slot":`message`,"data-align":t,className:Y(`group/message relative flex w-full min-w-0 gap-1.5 text-xs/relaxed data-[align=end]:flex-row-reverse`,e),...n})}function c$({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-avatar`,className:Y(`flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8`,e),...t})}function l$({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-content`,className:Y(`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 u$({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-header`,className:Y(`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 d$={open:bf,review:ci,comment:fp,"open-to-side":of,"open-file":Of,timeline:Ap,"copy-relative":er,discard:Xp,"expand-all":Ud,"collapse-all":Vd,reply:Op,resolution:ci,reveal:Of};function f$(e){let t=(0,$.c)(2),{action:n}=e,r=n.id===`resolution`&&n.label===`Reopen`?qc:d$[n.id],i;return t[0]===r?i=t[1]:(i=(0,Q.jsx)(r,{}),t[0]=r,t[1]=i),i}function p$(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,bd.flushSync)(()=>l(!0)),a(e)},t[0]=a,t[1]=u);let d=u,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e&&l(!1)},t[2]=f):f=t[2];let p=f,m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(`div`,{className:`min-w-0`}),t[3]=m):m=t[3];let h;t[4]!==i||t[5]!==s?(h=i&&(0,Q.jsx)(`span`,{id:s,className:`sr-only`,children:i}),t[4]=i,t[5]=s,t[6]=h):h=t[6];let g=i?s:void 0,_;t[7]!==r||t[8]!==g?(_=(0,Q.jsx)(X,{variant:`ghost`,size:`icon-xs`,className:`shrink-0`,"aria-label":r,"aria-describedby":g}),t[7]=r,t[8]=g,t[9]=_):_=t[9];let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(uf,{}),t[10]=v):v=t[10];let y;t[11]===_?y=t[12]:(y=(0,Q.jsx)(Ts,{render:(0,Q.jsx)(Lr,{render:_,children:v})}),t[11]=_,t[12]=y);let b;t[13]===r?b=t[14]:(b=(0,Q.jsx)(tt,{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)(ke,{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)(br,{disabled:e.disabled,variant:e.destructive?`destructive`:`default`,onClick:()=>d(e.id),children:[(0,Q.jsx)(f$,{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)(Li,{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)(ro,{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)(qI,{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)(XI,{disabled:e.disabled,variant:e.destructive?`destructive`:`default`,onClick:()=>d(e.id),children:[(0,Q.jsx)(f$,{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)(JI,{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)(KI,{onOpenChange:p,children:[D,A]}),t[43]=D,t[44]=A,t[45]=j):j=t[45],j}var m$=e=>e==null?null:io(e);function h$(e){let t=(0,$.c)(2),{author:n}=e,r=n===`agent`,i;return t[0]===r?i=t[1]:(i=(0,Q.jsx)(c$,{children:r?(0,Q.jsx)(Bp,{className:`size-3.5`}):(0,Q.jsx)(nm,{className:`size-3.5`})}),t[0]=r,t[1]=i),i}function g$(e){let t=(0,$.c)(10),{thread:n}=e,r;t[0]===n?r=t[1]:(r=H(n),t[0]=n,t[1]=r);let i=r===`agent`,a=i?`font-medium text-foreground`:`text-muted-foreground`,o;t[2]===a?o=t[3]:(o=Y(`flex shrink-0 items-center gap-1`,a),t[2]=a,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,Q.jsx)(Bp,{className:`size-3`}):(0,Q.jsx)(nm,{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 _$(e){let t=(0,$.c)(29),{owner:n,messageId:r,onEdit:i}=e,a=ZQ(n.scope,n.context),o;t[0]===a.result.waiting?o=t[1]:(o=(0,Q.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Comment actions`,disabled:a.result.waiting}),t[0]=a.result.waiting,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(uf,{}),t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=(0,Q.jsx)(Ts,{render:(0,Q.jsx)(Lr,{render:o,children:s})}),t[3]=o,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(tt,{role:`tooltip`,className:`break-all`,children:`Comment actions`}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,Q.jsxs)(ke,{children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(bn,{}),t[8]=d):d=t[8];let f;t[9]===i?f=t[10]:(f=(0,Q.jsxs)(br,{onClick:i,children:[d,`Edit`]}),t[9]=i,t[10]=f);let p;t[11]!==r||t[12]!==n.threadId||t[13]!==a?(p=()=>a.send({threadId:n.threadId,messageId:r}),t[11]=r,t[12]=n.threadId,t[13]=a,t[14]=p):p=t[14];let m;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(Jp,{}),t[15]=m):m=t[15];let h;t[16]===p?h=t[17]:(h=(0,Q.jsxs)(br,{variant:`destructive`,onClick:p,children:[m,`Delete`]}),t[16]=p,t[17]=h);let g;t[18]!==h||t[19]!==f?(g=(0,Q.jsxs)(Li,{align:`end`,children:[f,h]}),t[18]=h,t[19]=f,t[20]=g):g=t[20];let _;t[21]!==g||t[22]!==u?(_=(0,Q.jsxs)(ro,{children:[u,g]}),t[21]=g,t[22]=u,t[23]=_):_=t[23];let v;t[24]===a.result?v=t[25]:(v=q(a.result)&&(0,Q.jsx)(`span`,{role:`alert`,className:`font-normal text-destructive`,children:ai(Yt(a.result.cause))}),t[24]=a.result,t[25]=v);let y;return t[26]!==_||t[27]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[_,v]}),t[26]=_,t[27]=v,t[28]=y):y=t[28],y}function v$(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=SZ(yZ(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,s]=wr(a),c=o??r.body,l;t[5]!==i||t[6]!==s?(l=()=>{s(void 0),i()},t[5]=i,t[6]=s,t[7]=l):l=t[7];let u=l,d=XQ(n.scope,n.context),f;t[8]===c?f=t[9]:(f=Si(c),t[8]=c,t[9]=f);let p=f,m;t[10]!==c||t[11]!==d||t[12]!==u||t[13]!==r.id||t[14]!==n.threadId||t[15]!==p?(m=e=>{e.preventDefault(),p&&!d.result.waiting&&d.send({threadId:n.threadId,messageId:r.id,body:c},u)},t[10]=c,t[11]=d,t[12]=u,t[13]=r.id,t[14]=n.threadId,t[15]=p,t[16]=m):m=t[16];let h;t[17]===s?h=t[18]:(h=e=>s(e.target.value),t[17]=s,t[18]=h);let g;t[19]!==d.result.waiting||t[20]!==u?(g=e=>{$Q(e,d.result.waiting,u)},t[19]=d.result.waiting,t[20]=u,t[21]=g):g=t[21];let _;t[22]!==c||t[23]!==d.bodyLimit||t[24]!==d.result.waiting||t[25]!==h||t[26]!==g?(_=(0,Q.jsx)(rL,{autoFocus:!0,"aria-label":`Edit comment`,value:c,maxLength:d.bodyLimit,disabled:d.result.waiting,onChange:h,onKeyDown:g}),t[22]=c,t[23]=d.bodyLimit,t[24]=d.result.waiting,t[25]=h,t[26]=g,t[27]=_):_=t[27];let v;t[28]===d.result?v=t[29]:(v=q(d.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-2xs text-destructive`,children:ai(Yt(d.result.cause))}),t[28]=d.result,t[29]=v);let y;t[30]!==d.result.waiting||t[31]!==u?(y=(0,Q.jsx)(X,{type:`button`,size:`sm`,variant:`ghost`,disabled:d.result.waiting,onClick:u,children:`Cancel`}),t[30]=d.result.waiting,t[31]=u,t[32]=y):y=t[32];let b=d.result.waiting||!p,x=d.result.waiting?`Saving…`:`Save`,S;t[33]!==b||t[34]!==x?(S=(0,Q.jsx)(X,{type:`submit`,size:`sm`,disabled:b,children:x}),t[33]=b,t[34]=x,t[35]=S):S=t[35];let C;t[36]!==S||t[37]!==y?(C=(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[y,S]}),t[36]=S,t[37]=y,t[38]=C):C=t[38];let w;return t[39]!==C||t[40]!==m||t[41]!==_||t[42]!==v?(w=(0,Q.jsxs)(`form`,{className:`flex w-full flex-col gap-2`,onSubmit:m,children:[_,v,C]}),t[39]=C,t[40]=m,t[41]=_,t[42]=v,t[43]=w):w=t[43],w}function y$(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=m$(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)(h$,{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)(_$,{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)(u$,{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)(v$,{owner:r,message:n,onDone:()=>s(!1)}):(0,Q.jsx)(i$,{variant:c?`tinted`:`muted`,align:c?`end`:`start`,className:a?`max-w-full`:`max-w-[85%]`,children:(0,Q.jsx)(a$,{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)(l$,{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)(s$,{align:d,children:[f,y]}),t[28]=y,t[29]=d,t[30]=f,t[31]=b):b=t[31],b}function b$(e){let t=(0,$.c)(45),{thread:n,scope:r,context:i,onReveal:a,location:o}=e,s={projectId:r.projectId,worktreeId:n.worktreeId,...n.review?{review:n.review}:{}},[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,p]=wr(xZ(yZ(i.connection.environmentId,s,{kind:`reply`,threadId:n.id}))),{body:m,pending:h}=f,g=JQ(s,i),_=YQ(s,i),v;t[0]===n?v=t[1]:(v=P(n),t[0]=n,t[1]=v);let y=v,b=a!=null,x={scope:s,context:i,threadId:n.id},S;t[2]!==b||t[3]!==o||t[4]!==a||t[5]!==n.anchor?(S=o??(b?(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)(_r,{text:qn(n.anchor.filePath)}),(0,Q.jsx)(`span`,{className:`shrink-0 font-sans text-muted-foreground`,children:Za(n.anchor)}),n.anchor.revision!==null&&n.anchor.revision!==void 0&&(0,Q.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`in `,Iq(n.anchor.revision)]})]}):(0,Q.jsx)(`span`,{children:Za(n.anchor)})),t[2]=b,t[3]=o,t[4]=a,t[5]=n.anchor,t[6]=S):S=t[6];let C=S,w;t[7]!==_||t[8]!==n.id||t[9]!==n.resolved?(w=()=>_.send({threadId:n.id,resolved:!n.resolved}),t[7]=_,t[8]=n.id,t[9]=n.resolved,t[10]=w):w=t[10];let T;t[11]===n.resolved?T=t[12]:(T=n.resolved?(0,Q.jsx)(qc,{"data-icon":`inline-start`}):(0,Q.jsx)(ci,{"data-icon":`inline-start`}),t[11]=n.resolved,t[12]=T);let E=n.resolved?`Reopen`:`Resolve`,D;t[13]!==_.result.waiting||t[14]!==w||t[15]!==T||t[16]!==E?(D=(0,Q.jsxs)(X,{type:`button`,size:`sm`,variant:`ghost`,disabled:_.result.waiting,onClick:w,children:[T,E]}),t[13]=_.result.waiting,t[14]=w,t[15]=T,t[16]=E,t[17]=D):D=t[17];let O=D,k;t[18]===_.result?k=t[19]:(k=q(_.result)&&(0,Q.jsx)(`span`,{role:`alert`,className:`max-w-64 text-2xs text-destructive`,children:ai(Yt(_.result.cause))}),t[18]=_.result,t[19]=k);let A;t[20]!==O||t[21]!==k?(A=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 flex-wrap items-center gap-1`,children:[O,k]}),t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=A,M;t[23]!==m||t[24]!==h||t[25]!==g||t[26]!==c||t[27]!==p||t[28]!==l||t[29]!==n.id?(M=c&&(0,Q.jsx)(`form`,{className:`mt-3`,onSubmit:e=>{if(e.preventDefault(),!Si(m)||g.result.waiting)return;let t=es(h,m,()=>({body:m,messageId:crypto.randomUUID()}));p({body:m,pending:t}),g.send({threadId:n.id,body:m,messageId:t.messageId},()=>{p({body:``}),l(!1)})},children:(0,Q.jsxs)(Do,{children:[(0,Q.jsxs)(Ui,{children:[(0,Q.jsx)(Ur,{htmlFor:`reply-${n.id}`,children:`Reply`}),(0,Q.jsx)(rL,{id:`reply-${n.id}`,autoFocus:!0,value:m,maxLength:g.bodyLimit,required:!0,disabled:g.result.waiting,onChange:e=>{p({body:e.target.value})},onKeyDown:e=>{$Q(e,g.result.waiting,()=>l(!1))},placeholder:`Add a reply…`})]}),q(g.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-2xs text-destructive`,children:ai(Yt(g.result.cause))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(X,{type:`submit`,size:`sm`,disabled:g.result.waiting||!Si(m),children:g.result.waiting?`Replying…`:`Post reply`}),(0,Q.jsx)(X,{type:`button`,size:`sm`,variant:`ghost`,disabled:g.result.waiting,onClick:()=>l(!1),children:`Cancel`})]})]})}),t[23]=m,t[24]=h,t[25]=g,t[26]=c,t[27]=p,t[28]=l,t[29]=n.id,t[30]=M):M=t[30];let N=M,F;t[31]!==a||t[32]!==_||t[33]!==l||t[34]!==n.id||t[35]!==n.resolved?(F=e=>{e===`reply`&&l(!0),e===`resolution`&&_.send({threadId:n.id,resolved:!n.resolved}),e===`reveal`&&a?.()},t[31]=a,t[32]=_,t[33]=l,t[34]=n.id,t[35]=n.resolved,t[36]=F):F=t[36];let I=F,L=_.result.waiting||g.result.waiting,R;t[37]!==b||t[38]!==L||t[39]!==n.resolved?(R=jt({kind:`thread`,resolved:n.resolved,pending:L,canReveal:b}),t[37]=b,t[38]=L,t[39]=n.resolved,t[40]=R):R=t[40];let z=e=>b&&!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)(g$,{thread:n}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`·`}),C,e]}),!u&&n.messages.length>1&&(0,Q.jsxs)(X,{type:`button`,onClick:()=>d(!0),variant:`ghost`,size:`sm`,className:`mb-2`,children:[`Show `,n.messages.length-1,` earlier`]}),(0,Q.jsx)(o$,{children:(u?n.messages:n.messages.slice(-1)).map(e=>(0,Q.jsx)(y$,{message:e,owner:x,wide:!0},e.id))}),N,!c&&(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-end gap-1 border-t pt-2`,children:[(0,Q.jsx)(Je,{variant:y===`agent-replied`?`secondary`:`outline`,className:`mr-auto`,children:xt(n)}),(0,Q.jsx)(X,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>l(!0),children:`Reply`}),j]})]}):n.resolved?(0,Q.jsxs)(`article`,{className:`flex min-w-0 flex-wrap items-center gap-2 rounded-lg border border-dashed px-2.5 py-1.5 text-2xs text-muted-foreground select-text`,"aria-label":`Resolved comment thread`,children:[(0,Q.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2`,children:[(0,Q.jsx)(ci,{className:`size-3.5 shrink-0 text-graph-2`}),o||b?C:(0,Q.jsx)(g$,{thread:n}),e]}),(0,Q.jsx)(_r,{className:`min-w-0 flex-1`,text:n.messages[0]?.body??``}),j]}):(0,Q.jsxs)(`article`,{className:`rounded-xl border bg-card p-3 shadow-sm select-text`,"aria-label":`Comment thread`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex min-w-0 flex-wrap items-center gap-1.5 text-2xs text-muted-foreground`,children:[(0,Q.jsx)(g$,{thread:n}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Q.jsx)(`span`,{className:`min-w-0 max-w-full`,children:C}),e,(0,Q.jsx)(Je,{variant:y===`agent-replied`?`secondary`:`outline`,children:xt(n)}),!c&&(0,Q.jsxs)(`div`,{className:`ml-auto flex gap-0.5`,children:[(0,Q.jsx)(X,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>l(!0),children:`Reply`}),j]})]}),(0,Q.jsx)(o$,{children:n.messages.map(e=>(0,Q.jsx)(y$,{message:e,owner:x},e.id))}),N,y===`awaiting-agent`&&!c&&(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.`})]}),B;return t[41]!==I||t[42]!==R||t[43]!==z?(B=(0,Q.jsx)(p$,{label:`Thread actions`,actions:R,onAction:I,children:z}),t[41]=I,t[42]=R,t[43]=z,t[44]=B):B=t[44],B}function x$(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=Za(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)(X,{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=qn(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)(_r,{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 S$(e){let t=(0,$.c)(16),{threads:n,result:r}=PQ(e.scope,e.context),i=MQ(e.scope,e.context,C$,e.range),a;t[0]===r?a=t[1]:(a=q(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)(w$,{...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 C$(e){return Is.add(e)}function w$(e){let t=(0,$.c)(126),{entries:n,scope:r,context:i,interaction:o,header:s,footer:c,headerLeading:l,headerActions:u,emptyActions:d,toolbar:f,threads:p,commentRequest:m,foundLine:h,disableFileHeader:g,fileDiff:_,compactThreads:v,fullHeight:y,compactHeight:b,collapsible:x,threadMargin:S,decision:C,column:w,framed:T,commentLabel:E,range:D,onToggleReviewed:O}=e,k=g!==void 0&&g,A=v!==void 0&&v,j=y!==void 0&&y,M=b!==void 0&&b,N=x!==void 0&&x,P=S!==void 0&&S,F=C!==void 0&&C,I=w!==void 0&&w,L=T!==void 0&&T,{dark:R}=Gc(),z;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(z=new Set,t[0]=z):z=t[0];let[B,V]=(0,Z.useState)(z),{preferences:H}=ec(),U=Ec(i.connection),W=F?n:am(n,U),G=AZ(o.worktreeId,o.entry),K;t[1]!==i.connection.environmentId||t[2]!==o.entry||t[3]!==o.worktreeId||t[4]!==D?(K=JSON.stringify([i.connection.environmentId,o.worktreeId,o.entry,D]),t[1]=i.connection.environmentId,t[2]=o.entry,t[3]=o.worktreeId,t[4]=D,t[5]=K):K=t[5];let ee=LZ(K),te=RQ(),[q,ne]=(0,Z.useState)(null),re;t[6]===ee?re=t[7]:(re=()=>ee.selection(),t[6]=ee,t[7]=re);let[ie,ae]=(0,Z.useState)(re),oe=ie?W.find(e=>e.id===ie.lines.id):void 0,se=ie?.anchor&&oe?.comment?WQ(ie.anchor,oe.comment):!1,ce=se?null:ie?.lines??null,le=e=>{let t=e?W.find(t=>t.id===e.id):void 0,n=e?{lines:e,anchor:t?.comment?$t(t.comment,e.range):null}:null;ae(n),ee.rememberSelection(n)},ue;t[8]===ee?ue=t[9]:(ue=()=>ee.focused(),t[8]=ee,t[9]=ue);let[de,fe]=(0,Z.useState)(ue),pe;t[10]===ee?pe=t[11]:(pe=e=>{fe(e),ee.rememberFocus(e)},t[10]=ee,t[11]=pe);let J=pe,me;t[12]===de?me=t[13]:(me=e=>e.id===de,t[12]=de,t[13]=me);let ge=Math.max(W.findIndex(me),0),[_e,ve]=(0,Z.useState)(null),ye=new Set(W.filter(e=>q?.id!==e.id&&gZ(G.folds,e.id,W.length>1&&e.review?.reviewed===!0||(N||W.length>1)&&U&&im(e.path))).map(I$)),be;t[14]!==ne||t[15]!==J?(be=(e,t)=>{J(e.id),ne({id:e.id,anchor:t,focusRequested:!0})},t[14]=ne,t[15]=J,t[16]=be):be=t[16];let xe=be,Se;t[17]!==xe||t[18]!==le?(Se=e=>{e?.comment&&(xe(e,{...e.comment,kind:`file`}),le(null))},t[17]=xe,t[18]=le,t[19]=Se):Se=t[19];let Ce=Se,we;t[20]!==ne||t[21]!==le?(we=()=>{ne(null),le(null)},t[20]=ne,t[21]=le,t[22]=we):we=t[22];let Te=we,[Ee,De]=(0,Z.useState)();m!==void 0&&Ee!==m&&(De(m),Ce(W[0]));let[Oe,ke]=(0,Z.useState)(),[Ae,je]=(0,Z.useState)(),Me=o.reveal,Ne=Me&&W.find(e=>e.comment&&UQ(Me.anchor,e.comment,r.review!==void 0)),Pe=e=>{let t=W[e];t&&(J(t.id),ee.scrollTo({type:`item`,id:t.id,align:`start`}))},Fe=new Map(W.map(F$)),Ie=W.map(e=>{let t=e.comment,n=[],i=new Map,a=t?p.filter(n=>UQ(n.anchor,t,r.review!==void 0)&&(n.anchor.comparison||W.find(e=>e.comment&&UQ(n.anchor,e.comment,r.review!==void 0))?.id===e.id)).map(n=>({thread:n,stale:WQ(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`});q?.id===e.id&&n.push({kind:`composer`,anchor:q.anchor});let o=n.map(P$);return{id:e.id,collapsed:ye.has(e.id),version:ku(JSON.stringify([e.version,ye.has(e.id),n])),annotations:o,...EQ(e)}}),Le=W.filter(N$),Re=new Set(Le.map(M$)).size,ze=Le[0]?.id,Be=new Map;for(let e of W)e.review&&!Be.has(e.review.path)&&Be.set(e.review.path,e.id);let Ve=j||c?12:160,He=F||I||A||L?cl:pu,Ue=R?`dark`:`light`,We=H.lineOverflow,Ge=H.diffStyle,Ke=!k&&!j,qe=k||M,Je,Ye;t[23]===J?(Je=t[24],Ye=t[25]):(Je=(e,t)=>J(t.item.id),Ye=(e,t)=>J(t.item.id),t[23]=J,t[24]=Je,t[25]=Ye);let Xe=(e,t)=>{let n=Fe.get(t.item.id);if(!n?.comment)return;let r=$t(n.comment,e);if(!r){ve(`Select lines on one side of the comparison.`);return}ve(null),xe(n,r),le({id:n.id,range:e})},Ze;t[26]===_?Ze=t[27]:(Ze=SQ(_),t[26]=_,t[27]=Ze);let Qe=`${A?`[data-line-annotation]:has([data-file-thread-marker]) { margin-left: 0; }`:``}${Ze}${F||I||L?nl:``}${I?cc:``}${Fu}${al}${P?Ml:``}${k||M?`[data-code] { padding-top: 0 !important; }`:Os}${A?Nc:``}${M?`[data-diffs-header], pre { border: 0; border-radius: 0; }`:``}`,$e;t[28]===I?$e=t[29]:($e=I?{itemMetrics:{lineHeight:22,diffHeaderHeight:41}}:{},t[28]=I,t[29]=$e);let et;t[30]!==M||t[31]!==k?(et=k||M?{itemMetrics:{paddingTop:0}}:{},t[30]=M,t[31]=k,t[32]=et):et=t[32];let tt=k||M?0:12,nt=M?0:Ve,rt;t[33]!==tt||t[34]!==nt?(rt={paddingTop:tt,paddingBottom:nt,gap:12},t[33]=tt,t[34]=nt,t[35]=rt):rt=t[35];let it;t[36]!==H.diffStyle||t[37]!==H.lineOverflow||t[38]!==He||t[39]!==Ue||t[40]!==Ke||t[41]!==qe||t[42]!==Je||t[43]!==Ye||t[44]!==Xe||t[45]!==Qe||t[46]!==$e||t[47]!==et||t[48]!==rt?(it={theme:He,themeType:Ue,overflow:We,diffStyle:Ge,diffIndicators:`classic`,hunkSeparators:`line-info`,stickyHeaders:Ke,disableFileHeader:qe,enableLineSelection:!0,enableGutterUtility:!0,onLineClick:Je,onLineNumberClick:Ye,onGutterUtilityClick:Xe,lineHoverHighlight:`number`,unsafeCSS:Qe,...$e,...et,layout:rt},t[36]=H.diffStyle,t[37]=H.lineOverflow,t[38]=He,t[39]=Ue,t[40]=Ke,t[41]=qe,t[42]=Je,t[43]=Ye,t[44]=Xe,t[45]=Qe,t[46]=$e,t[47]=et,t[48]=rt,t[49]=it):it=t[49];let at=it,ot=W.length>0&&W.every(e=>ye.has(e.id)),st;t[50]!==W||t[51]!==G?(st=e=>G.setCollapsed(W.map(j$),e),t[50]=W,t[51]=G,t[52]=st):st=t[52];let ct=st,lt=e=>{J(e),G.setCollapsed([e],!ye.has(e))},ut;t[53]===ot?ut=t[54]:(ut=ot?(0,Q.jsx)(Ud,{"aria-hidden":`true`,"data-icon":`inline-start`}):(0,Q.jsx)(Vd,{"aria-hidden":`true`,"data-icon":`inline-start`}),t[53]=ot,t[54]=ut);let dt=ut,ft=ot?`Expand all files`:`Collapse all files`,pt;t[55]!==ot||t[56]!==ct?(pt=()=>ct(!ot),t[55]=ot,t[56]=ct,t[57]=pt):pt=t[57];let mt;t[58]!==dt||t[59]!==ft||t[60]!==pt?(mt=(0,Q.jsxs)(X,{size:`sm`,variant:`ghost`,onClick:pt,children:[dt,ft]}),t[58]=dt,t[59]=ft,t[60]=pt,t[61]=mt):mt=t[61];let ht=mt,gt=W.length>1?ht:null,_t;t[62]!==o.entry||t[63]!==o.toolbarTarget?(_t=o.toolbarTarget!==void 0&&/^(file|review-file|review-change|change|branch):/.test(o.entry),t[62]=o.entry,t[63]=o.toolbarTarget,t[64]=_t):_t=t[64];let vt=_t,yt=W[ge]??W[0],bt;t[65]!==d||t[66]!==yt||t[67]!==u||t[68]!==O||t[69]!==Ce||t[70]!==vt?(bt=vt&&(yt?(0,Q.jsxs)(Q.Fragment,{children:[yt.review&&(0,Q.jsx)(pQ,{label:`Reviewed`,variant:`outline`,icon:yt?.review?.reviewed?ci:Wp,shortcut:Ic.toggleReviewed,disabled:!yt?.review?.fingerprint,pressed:yt?.review?.reviewed,onClick:()=>{yt&&O(yt)}}),(0,Q.jsx)(pQ,{label:`Comment`,icon:fp,shortcut:Ic.commentOnFile,disabled:!yt?.comment,onClick:()=>Ce(yt)}),u]}):d??u),t[65]=d,t[66]=yt,t[67]=u,t[68]=O,t[69]=Ce,t[70]=vt,t[71]=bt):bt=t[71];let xt=bt,St;t[72]!==gt||t[73]!==W||t[74]!==Pe||t[75]!==ge||t[76]!==G||t[77]!==s?(St=s&&(()=>s({collapse:gt,current:W[ge]?.path,counts:DQ(W),open:e=>{let t=W.findIndex(t=>t.path===e),n=W[t];n&&G.setCollapsed([n.id],!1),Pe(t)}})),t[72]=gt,t[73]=W,t[74]=Pe,t[75]=ge,t[76]=G,t[77]=s,t[78]=St):St=t[78];let Ct=St,wt=q||se?null:ie?.anchor,Tt=(F||I||A||L)&&`decision-code`,Et=A&&`file-code`,Dt=L&&`commit-code`,Ot=M&&`overflow-hidden rounded-lg border`,kt;t[79]!==Tt||t[80]!==Et||t[81]!==Dt||t[82]!==Ot?(kt=Y(`@container/code relative flex min-h-0 flex-1 flex-col`,Tt,Et,Dt,Ot),t[79]=Tt,t[80]=Et,t[81]=Dt,t[82]=Ot,t[83]=kt):kt=t[83];let At;t[84]!==o.toolbarTarget||t[85]!==xt?(At=o.toolbarTarget&&xt&&(0,bd.createPortal)(xt,o.toolbarTarget),t[84]=o.toolbarTarget,t[85]=xt,t[86]=At):At=t[86];let jt;t[87]!==W||t[88]!==Pe||t[89]!==ge||t[90]!==o.active||t[91]!==O||t[92]!==Ce?(jt=o.active&&W.length>0&&(0,Q.jsx)(z$,{next:()=>Pe(Math.min(ge+1,W.length-1)),previous:()=>Pe(Math.max(ge-1,0)),comment:()=>Ce(W[ge]),review:()=>{let e=W[ge];e?.review&&O(e)}}),t[87]=W,t[88]=Pe,t[89]=ge,t[90]=o.active,t[91]=O,t[92]=Ce,t[93]=jt):jt=t[93];let Mt;t[94]!==i||t[95]!==_e||t[96]!==r||t[97]!==wt||t[98]!==se?(Mt=se||_e?(0,Q.jsx)(`p`,{role:`status`,className:`absolute bottom-3 left-3 z-10 rounded-lg border bg-popover p-2 text-xs`,children:se?`Code changed since these lines were selected. Select lines again.`:_e}):wt!=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)(fp,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(_r,{className:`pointer-events-auto`,text:`${qn(wt.filePath)} · ${Za(wt)}`}),wt.kind===`codeRange`&&wt.comparison?.kind===`worktree`&&wt.side!==`deletions`&&(wt.comparison.scope===`staged`||wt.comparison.scope===`unstaged`)&&(0,Q.jsx)(`span`,{className:`pointer-events-auto`,children:(0,Q.jsx)(YJ,{scope:r,context:i,path:wt.filePath,hunk:{scope:wt.comparison.scope,startLine:wt.startLine,endLine:wt.endLine},variant:`compact`})})]}),t[94]=i,t[95]=_e,t[96]=r,t[97]=wt,t[98]=se,t[99]=Mt):Mt=t[99];let Nt;t[100]!==gt||t[101]!==I||t[102]!==f?(Nt=f?f(gt):!I&&gt&&(0,Q.jsx)(`div`,{className:`flex shrink-0 justify-end px-3`,children:gt}),t[100]=gt,t[101]=I,t[102]=f,t[103]=Nt):Nt=t[103];let Pt;t[104]!==I||t[105]!==W.length||t[106]!==c||t[107]!==s||t[108]!==u||t[109]!==l||t[110]!==vt||t[111]!==Ct?(Pt=W.length===0&&(s||u||c)&&(0,Q.jsxs)(`div`,{className:Y(`min-h-0 flex-1 overflow-auto`,I&&L$),"data-testid":`empty-code-document`,children:[l&&(0,Q.jsx)(`div`,{className:`flex items-center gap-1 px-3.5 py-2`,children:l}),Ct?.(),c?.(),!vt&&u&&(0,Q.jsx)(`div`,{className:`flex justify-end px-3.5 py-2`,children:(0,Q.jsx)(nY,{children:u})})]}),t[104]=I,t[105]=W.length,t[106]=c,t[107]=s,t[108]=u,t[109]=l,t[110]=vt,t[111]=Ct,t[112]=Pt):Pt=t[112];let Ft;t[113]!==M||t[114]!==W[0]||t[115]!==Ce?(Ft=M&&W[0]&&(0,Q.jsxs)(`div`,{className:`flex min-h-10 shrink-0 items-center gap-2 border-b bg-muted px-2 py-1`,children:[(0,Q.jsx)(_r,{className:`min-w-0 flex-1 font-mono text-caption font-medium`,text:W[0].path}),(0,Q.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":`Comment on ${W[0].path} (file)`,onClick:()=>Ce(W[0]),children:[(0,Q.jsx)(mp,{}),(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:`Comment`})]})]}),t[113]=M,t[114]=W[0],t[115]=Ce,t[116]=Ft):Ft=t[116];let It=W.length>0&&(0,Q.jsx)(DA,{ref:e=>{if(!e)return;let t=ee.attach(e);if(Me&&Ne&&Ae!==Me.nonce&&ye.has(Ne.id))return G.setCollapsed([Ne.id],!1),t;let n=requestAnimationFrame(()=>{let t=ee.position();e.scrollTo({type:`position`,position:t+(at.stickyHeaders&&!at.disableFileHeader?at.itemMetrics?.diffHeaderHeight??ks.diffHeaderHeight:0),behavior:`instant`});let n=W[0];if(h&&n&&Oe!==h.nonce&&(le({id:n.id,range:{start:h.line,end:h.line}}),e.scrollTo({type:`line`,id:n.id,lineNumber:h.line,align:`center`}),ke(h.nonce)),Me&&Ne&&Ae!==Me.nonce){let t=Me.anchor,n=Ne.comment&&WQ(t,Ne.comment,r.review&&{revision:r.review.revision,commentRevision:p.find(e=>e.anchor===t)?.review?.revision,kind:Ne.kind});e.scrollTo(t.kind===`codeRange`&&!n?{type:`line`,id:Ne.id,lineNumber:t.startLine,...Ne.kind===`diff`?{side:t.side??`additions`}:{},align:`center`}:{type:`item`,id:Ne.id,align:`start`}),J(Ne.id),je(Me.nonce)}});return()=>{cancelAnimationFrame(n),t?.()}},items:Ie,onScroll:ee.rememberPosition,selectedLines:ce,onSelectedLinesChange:e=>{q||(le(e),e&&J(e.id))},renderAnnotation:(...e)=>{let[t,,n]=e,a=t.metadata;return a.kind===`agent`?(0,Q.jsx)(n$,{compact:F,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(A$)&&A&&n.type===`file`&&!B.has(`${n.id}:${a.lineNumber}`)?(0,Q.jsxs)(X,{type:`button`,"data-file-thread-marker":``,"aria-expanded":!1,variant:`ghost`,className:`ml-3 w-[calc(100%-var(--spacing)*5.5)] justify-start`,onClick:()=>V(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)(nm,{})}),a.threads.some(O$)&&(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)(Ld,{})})]}),fi(a.threads.length,`comment`),a.threads.some(E$)&&` · Agent replied`,(0,Q.jsx)(lr,{})]}):a.kind===`composer`?q?.id===n.id&&(0,Q.jsx)(e$,{scope:r,context:i,anchor:q.anchor,inputRef:e=>{e&&q.focusRequested&&(e.focus(),ne(e=>e===q?{...e,focusRequested:!1}:e))},onClose:Te},JSON.stringify(q.anchor)):(0,Q.jsxs)(`div`,{...P&&a.lineNumber>0?{ref:te.card}:{},className:Y(`m-3 flex flex-col gap-3 font-sans`,P&&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:[A&&n.type===`file`&&B.has(`${n.id}:${a.lineNumber}`)&&(0,Q.jsxs)(X,{type:`button`,"aria-expanded":!0,variant:`link`,size:`sm`,className:`self-start`,onClick:()=>V(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)(he,{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)(xi,{to:`/reviews/$reviewId/$revision`,params:{reviewId:t.review.reviewId,revision:String(t.review.revision)},search:T$,className:Y(Ki({variant:`outline`,size:`xs`})),children:[`Open r`,t.review.revision]})}),(0,Q.jsx)(b$,{scope:r,context:i,thread:t,...P&&a.lineNumber>0&&t.anchor.kind===`codeRange`?{location:(0,Q.jsx)(x$,{anchor:t.anchor,onReveal:e=>{let r=t.anchor;if(r.kind!==`codeRange`)return;let i=n.type===`diff`?{side:r.side??`additions`}:{};(0,bd.flushSync)(()=>{le({id:n.id,range:{start:r.startLine,end:r.endLine,...i}}),J(n.id)}),BQ(e)}})}:{}})]},t.id)})]})},renderHeaderMetadata:e=>{let t=Fe.get(e.id);if(k||!t)return null;let n=e.id===W[0]?.id,r=W.findIndex(t=>t.id===e.id),i=!vt&&n?u:null,o=F&&W.length>1?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(R$,{label:`Previous file`,keys:Ic.previousFile,disabled:r===0,onClick:()=>Pe(r-1),children:(0,Q.jsx)(zt,{})}),(0,Q.jsx)(R$,{label:`Next file`,keys:Ic.nextFile,disabled:r===W.length-1,onClick:()=>Pe(r+1),children:(0,Q.jsx)(a,{})})]}):null,s=e.id===W[0]?.id?l:null,c=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,d=E?`${E} about ${t.path}`:`Comment on ${t.path} (${t.kind===`diff`?t.note??`diff`:`file`})`,f=F?(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":d,onClick:()=>Ce(t),children:[(0,Q.jsx)(mp,{}),(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:E??`Comment`})]}):(0,Q.jsxs)(X,{variant:`ghost`,size:`xs`,"aria-label":d,onClick:()=>Ce(t),children:[(0,Q.jsx)(fp,{}),(0,Q.jsx)(`span`,{className:`max-narrow:sr-only`,children:E??`Comment`})]}),p=t.comment&&!vt&&!I?f:null;return I?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[c,t.comment&&f,(0,Q.jsx)(NQ,{counts:OQ(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)(B$,{label:`Previous file`,icon:zt,shortcut:Ic.previousFile,onClick:()=>Pe(Math.max(W.findIndex(e=>e.id===t.id)-1,0))}),(0,Q.jsx)(B$,{label:`Next file`,icon:a,shortcut:Ic.nextFile,onClick:()=>Pe(Math.min(W.findIndex(e=>e.id===t.id)+1,W.length-1))})]})]}):!c&&!s&&!i&&!p&&!o?null:(0,Q.jsxs)(`div`,{className:Y(`flex max-w-full items-center justify-end gap-1.5`,!F&&`flex-wrap`),children:[c,s,F?(0,Q.jsxs)(Q.Fragment,{children:[i&&(0,Q.jsx)(nY,{children:i}),p]}):(i||p)&&(0,Q.jsxs)(nY,{children:[i,p]}),o&&(0,Q.jsx)(`span`,{className:`flex items-center max-narrow:hidden`,children:o})]})},disableWorkerPool:F||I||A||L,options:at,...te.reserve>0?{style:{paddingBottom:te.reserve}}:{},className:Y(M&&`max-h-48 flex-none overflow-auto`,!M&&j&&`flex-none overflow-visible`,!M&&!j&&`min-h-0 flex-1 overflow-auto`,I&&L$),...Ct?{renderCodeViewHeader:Ct}:{},...c?{renderCodeViewFooter:c}:{},renderHeaderPrefix:e=>{let t=Fe.get(e.id);if(!t)return null;let n=ye.has(e.id),r=t.review,i=r&&!vt&&Be.get(r.path)===t.id?r.control:null;return(0,Q.jsxs)(`span`,{className:Y(`flex items-center`,I?`gap-2`:`gap-1`),children:[!F&&U&&e.id===ze&&W.length>Le.length&&(0,Q.jsxs)(`span`,{className:`mr-2 border-r pr-2 font-sans text-xs font-medium`,children:[`Specs · `,fi(Re,`file`)]}),(I||N||W.length>1)&&(0,Q.jsx)(B$,{label:`${n?`Expand`:`Collapse`} ${t.path}`,icon:n?lr:a,expanded:!n,onClick:()=>lt(e.id)}),i]})},renderHeaderFilenameSuffix:e=>{let t=Fe.get(e.id);return t&&t.note?(0,Q.jsx)(_r,{className:`ml-2 hidden max-w-48 font-sans text-xs text-muted-foreground @code-wide/code:block`,text:t.note}):null}}),Lt;return t[117]!==kt||t[118]!==At||t[119]!==jt||t[120]!==Mt||t[121]!==Nt||t[122]!==Pt||t[123]!==Ft||t[124]!==It?(Lt=(0,Q.jsxs)(`div`,{role:`region`,"aria-label":`Code content`,className:kt,children:[At,jt,Mt,Nt,Pt,Ft,It]}),t[117]=kt,t[118]=At,t[119]=jt,t[120]=Mt,t[121]=Nt,t[122]=Pt,t[123]=Ft,t[124]=It,t[125]=Lt):Lt=t[125],Lt}function T$(e){return{environment:e.environment,decision:void 0}}function E$(e){let{thread:t}=e;return t.messages.some(D$)}function D$(e){return e.author===`agent`}function O$(e){let{thread:t}=e;return t.messages.some(k$)}function k$(e){return e.author===`agent`}function A$(e){let{stale:t}=e;return!t}function j$(e){return e.id}function M$(e){return e.path}function N$(e){return im(e.path)}function P$(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 F$(e){return[e.id,e]}function I$(e){return e.id}var L$=`px-[max(--spacing(4),calc((100%-var(--container-reading))/2))] @2xl/pane:px-[max(--spacing(7),calc((100%-var(--container-reading))/2))]`;function R$(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)(X,{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)(Ts,{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=uc(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(eL,{children:l}),t[9]=l,t[10]=u);let d;t[11]!==n||t[12]!==u?(d=(0,Q.jsxs)(tt,{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)(ke,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function z$(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 Qs(Ic.nextFile,n,s),Qs(Ic.previousFile,r,s),Qs(Ic.commentOnFile,i,s),Qs(Ic.toggleReviewed,a,s),null}function B$(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)(X,{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)(Ts,{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)(eL,{children:uc(i)}),t[10]=i,t[11]=u);let d;t[12]!==n||t[13]!==u?(d=(0,Q.jsxs)(tt,{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)(ke,{children:[l,d]}),t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function V$(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,bd.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)(_r,{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=Y(`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)(_r,{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)(_r,{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 H$(e){let t=(0,$.c)(4),{more:n,pending:r,onReadMore:i}=e;if(n<=0)return null;let a=r?`Reading…`:`Read ${Math.min(n,25)} more of ${n}`,o;return t[0]!==i||t[1]!==r||t[2]!==a?(o=(0,Q.jsx)(`div`,{className:`border-t px-4 py-3 text-center`,children:(0,Q.jsx)(X,{variant:`outline`,size:`sm`,onClick:i,disabled:r,children:a})}),t[0]=i,t[1]=r,t[2]=a,t[3]=o):o=t[3],o}function U$(e,t,n){return{path:n.path,fingerprint:n.fingerprint??null,reviewed:n.reviewStatus===`reviewed`,stale:n.reviewStatus===`stale`,control:(0,Q.jsx)(W$,{scope:e,context:t,path:n.path,fingerprint:n.fingerprint,status:n.reviewStatus,compact:!0},`review:${n.path}`)}}function W$(e){let t=(0,$.c)(45),{scope:n,context:r,path:i,fingerprint:a,status:o,compact:s,range:c}=e,l=s!==void 0&&s,u=c===void 0?Ae:c,d=kQ(n,r,u),f=AQ(n,r,u),p=d.result.waiting||f.result.waiting,m,h;if(t[0]!==l||t[1]!==a||t[2]!==d||t[3]!==i||t[4]!==p||t[5]!==o||t[6]!==f){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e=fl(d.result,f.result);if(a==null){let e;t[9]===i?e=t[10]:(e=tr([i]),t[9]=i,t[10]=e);let n;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(mf,{className:`size-3`,"aria-hidden":`true`}),t[11]=n):n=t[11];let r=l?`Not reviewable`:`Not reviewable: too large or unreadable`,a;t[12]!==e||t[13]!==r?(a=(0,Q.jsxs)(`span`,{title:e,className:`inline-flex items-center gap-1 text-2xs text-muted-foreground`,children:[n,r]}),t[12]=e,t[13]=r,t[14]=a):a=t[14],h=a;break bb0}let n=o===`reviewed`,r;t[15]!==i||t[16]!==o?(r=Ke(i,o),t[15]=i,t[16]=o,t[17]=r):r=t[17];let s=r,c=l?`icon-xs`:`xs`,u=n?`ghost`:`outline`,g;t[18]!==a||t[19]!==d||t[20]!==i||t[21]!==n||t[22]!==f?(g=()=>{n?f.start(i):d.start({path:i,fingerprint:a})},t[18]=a,t[19]=d,t[20]=i,t[21]=n,t[22]=f,t[23]=g):g=t[23];let _;t[24]!==l||t[25]!==p||t[26]!==o?(_=(0,Q.jsx)(q$,{pending:p,status:o,compact:l}),t[24]=l,t[25]=p,t[26]=o,t[27]=_):_=t[27];let v;t[28]!==l||t[29]!==o?(v=!l&&J$(o),t[28]=l,t[29]=o,t[30]=v):v=t[30];let y;t[31]!==s||t[32]!==p||t[33]!==n||t[34]!==v||t[35]!==c||t[36]!==u||t[37]!==g||t[38]!==_?(y=(0,Q.jsx)(Ts,{render:(0,Q.jsxs)(X,{type:`button`,size:c,variant:u,"aria-pressed":n,disabled:p,"aria-label":s,onClick:g,children:[_,v]})}),t[31]=s,t[32]=p,t[33]=n,t[34]=v,t[35]=c,t[36]=u,t[37]=g,t[38]=_,t[39]=y):y=t[39];let b;t[40]===s?b=t[41]:(b=(0,Q.jsx)(tt,{role:`tooltip`,className:`break-all`,children:s}),t[40]=s,t[41]=b);let x;t[42]!==y||t[43]!==b?(x=(0,Q.jsxs)(ke,{children:[y,b]}),t[42]=y,t[43]=b,t[44]=x):x=t[44],m=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[x,e!==void 0&&(0,Q.jsx)(_r,{className:`max-w-52 text-2xs text-destructive`,render:(0,Q.jsx)(`span`,{role:`alert`}),text:ai(e)})]})}t[0]=l,t[1]=a,t[2]=d,t[3]=i,t[4]=p,t[5]=o,t[6]=f,t[7]=m,t[8]=h}else m=t[7],h=t[8];return h===Symbol.for(`react.early_return_sentinel`)?m:h}function G$(e){let t=(0,$.c)(23),{scope:n,context:r,path:i,fingerprint:a,status:o,latest:s,onStart:c}=e,l=kQ(n,r,Ae),u=AQ(n,r,Ae),d=l.result.waiting||u.result.waiting,f=fl(l.result,u.result),p=s?f:void 0,m=(0,Z.useId)(),h=o===`reviewed`,g=a!=null,_=o===`stale`?`Changed since reviewed`:`Toggle reviewed`,v;t[0]!==i||t[1]!==g||t[2]!==_?(v=g?_:tr([i]),t[0]=i,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v,b=`${i} reviewed`,x=p!==void 0,S=d||!g,C;t[4]!==d||t[5]!==a||t[6]!==l||t[7]!==c||t[8]!==i||t[9]!==h||t[10]!==u?(C=()=>{d||a==null||(c(),h?u.start(i):l.start({path:i,fingerprint:a}))},t[4]=d,t[5]=a,t[6]=l,t[7]=c,t[8]=i,t[9]=h,t[10]=u,t[11]=C):C=t[11];let w;t[12]!==d||t[13]!==m||t[14]!==h||t[15]!==b||t[16]!==x||t[17]!==S||t[18]!==C?(w=(0,Q.jsx)(Ts,{render:(0,Q.jsx)(yY,{checked:h,"aria-label":b,"aria-describedby":m,"aria-invalid":x,disabled:S,"aria-busy":d,onCheckedChange:C})}),t[12]=d,t[13]=m,t[14]=h,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w):w=t[19];let T;return t[20]!==y||t[21]!==m?(T=(0,Q.jsx)(`span`,{id:m,hidden:!0,children:y}),t[20]=y,t[21]=m,t[22]=T):T=t[22],(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(ke,{children:[w,(0,Q.jsx)(tt,{role:`tooltip`,className:`break-all`,children:p===void 0?y:ai(p)})]}),T,p!==void 0&&(0,Q.jsx)(`span`,{role:`alert`,className:`sr-only`,children:ai(p)})]})}function K$(e){let t=(0,$.c)(44),{scope:n,context:r,entries:i,compact:a,range:o}=e,s=a!==void 0&&a,c=jQ(n,r,o===void 0?Ae:o),l,u,d,f,p,m,h,g,_,v,y,b,x;if(t[0]!==c||t[1]!==s||t[2]!==i){f=zn(i);let e=c.result.waiting,n=f.blocked||e;m=`inline-flex min-w-0 flex-col items-end gap-1`,d=ke,u=Ts,l=X,h=`button`,g=s?`icon-xs`:`xs`,_=`outline`,v=n,y=f.label,b=()=>{n||(f.unmarking?c.start({kind:`unmark`,paths:f.reviewedPaths}):c.start({kind:`mark`,entries:f.entries}))},x=(0,Q.jsx)(Y$,{pending:e,unmarking:f.unmarking}),p=!s&&X$(e,f.unmarking,f.text),t[0]=c,t[1]=s,t[2]=i,t[3]=l,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=x}else l=t[3],u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15];let S;t[16]!==l||t[17]!==p||t[18]!==h||t[19]!==g||t[20]!==_||t[21]!==v||t[22]!==y||t[23]!==b||t[24]!==x?(S=(0,Q.jsxs)(l,{type:h,size:g,variant:_,disabled:v,"aria-label":y,onClick:b,children:[x,p]}),t[16]=l,t[17]=p,t[18]=h,t[19]=g,t[20]=_,t[21]=v,t[22]=y,t[23]=b,t[24]=x,t[25]=S):S=t[25];let C;t[26]!==u||t[27]!==S?(C=(0,Q.jsx)(u,{render:S}),t[26]=u,t[27]=S,t[28]=C):C=t[28];let w;t[29]===f.label?w=t[30]:(w=(0,Q.jsx)(tt,{role:`tooltip`,className:`break-all`,children:f.label}),t[29]=f.label,t[30]=w);let T;t[31]!==d||t[32]!==C||t[33]!==w?(T=(0,Q.jsxs)(d,{children:[C,w]}),t[31]=d,t[32]=C,t[33]=w,t[34]=T):T=t[34];let E;t[35]===c.report?E=t[36]:(E=c.report&&(0,Q.jsx)(Z$,{report:c.report}),t[35]=c.report,t[36]=E);let D;t[37]===c.result?D=t[38]:(D=q(c.result)&&(0,Q.jsx)(`span`,{role:`alert`,className:`max-w-64 text-right text-2xs text-destructive`,children:ai(Yt(c.result.cause))}),t[37]=c.result,t[38]=D);let O;return t[39]!==m||t[40]!==T||t[41]!==E||t[42]!==D?(O=(0,Q.jsxs)(`span`,{className:m,children:[T,E,D]}),t[39]=m,t[40]=T,t[41]=E,t[42]=D,t[43]=O):O=t[43],O}function q$(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)(Ge,{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)(ci,{}),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)(qc,{}),t[2]=e):e=t[2],e}let a=i&&`invisible`,o;t[3]===a?o=t[4]:(o=Y(a),t[3]=a,t[4]=o);let s;return t[5]===o?s=t[6]:(s=(0,Q.jsx)(ci,{className:o}),t[5]=o,t[6]=s),s}function J$(e){return e===`reviewed`?`Reviewed`:e===`stale`?`Review again`:`Mark reviewed`}function Y$(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)(Ge,{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)(qc,{}),t[1]=e):e=t[1],e}let i;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(ci,{}),t[2]=i):i=t[2],i}function X$(e,t,n){return e?t?`Unmarking…`:`Marking…`:n}function Z$(e){let t=(0,$.c)(11),{report:n}=e,r=n.failed.length,i=r>0?`alert`:`status`,a=r>0?`text-destructive`:`text-muted-foreground`,o;t[0]===a?o=t[1]:(o=Y(`max-w-64 text-right text-2xs leading-tight`,a),t[0]=a,t[1]=o);let s;t[2]===r?s=t[3]:(s=r>0&&(0,Q.jsx)(Gd,{className:`mr-1 inline size-3`}),t[2]=r,t[3]=s);let c;t[4]===n?c=t[5]:(c=An(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 Q$(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(e1,{...e,path:void 0}),t[0]=e,t[1]=n),n}function $$(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)(e1,{...r,path:n}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function e1(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)(t1,{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)(xQ,{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 t1(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=qt(a),t[0]=a,t[1]=c);let l=c,u=mQ(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=ur(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=Lq(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)(he,{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=hP(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)(n1,{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 n1(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=Vn(Dn(zP(n,u))),f=JSON.stringify([c.base,c.head.branch]),[p,m]=wr(PZ(JSON.stringify([u.environmentId,n.projectId,n.worktreeId,f]))),h=o.slice(0,p),g=nF(n,u,c.diffRange,h.map(Nq)),_=JSON.stringify([c.diffRange,h.map(i1)]),[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(Nq(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(Nq(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)(W$,{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=GP(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(r1)),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)(pQ,{label:`Timeline`,iconOnly:!0,icon:Ap,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)(V$,{target:i.toolbarTarget,barActions:null,title:qn(k.path),subtitle:`${k.path} · on the branch`,children:S(k,!1)}):(0,Q.jsxs)(V$,{target:i.toolbarTarget,barActions:null,title:`Branch`,subtitle:`${fi(o.length,`file`)} changed`,children:[e,(0,Q.jsx)(K$,{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)(a1,{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)(S$,{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)(H$,{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 r1(e){return e.path}function i1(e){return e.fingerprint}function a1(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`:Lq(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 `,Lq(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:fi(n.commits,`commit`)}),(0,Q.jsxs)(`span`,{children:[`from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:Iq(n.mergeBaseOid)}),` `,`to `,(0,Q.jsx)(`span`,{className:`font-mono`,children:Iq(n.head.oid)})]}),(0,Q.jsx)(Je,{variant:`secondary`,children:Lq(n.base)})]})]}),t[2]=n.base,t[3]=n.commits,t[4]=n.head.oid,t[5]=n.mergeBaseOid,t[6]=d,t[7]=r,t[8]=f):f=t[8];let p;t[9]===i?p=t[10]:(p=i>0&&(0,Q.jsx)(`p`,{className:`mt-1 text-2xs text-muted-foreground`,children:`Uncommitted changes are not part of the branch review. Review them under Uncommitted.`}),t[9]=i,t[10]=p);let m;t[11]!==s||t[12]!==c?(m=s&&(0,Q.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-xs text-muted-foreground`,children:[`Some patches could not be read.`,(0,Q.jsx)(X,{size:`xs`,variant:`outline`,onClick:c,children:`Try again`})]}),t[11]=s,t[12]=c,t[13]=m):m=t[13];let h;t[14]!==l||t[15]!==s||t[16]!==a||t[17]!==o?(h=a.length>0&&(0,Q.jsx)(`ul`,{className:`mt-3 space-y-1.5`,"aria-label":`Changes without code preview`,children:a.map(e=>(0,Q.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 rounded-lg border bg-muted/25 px-3 py-2 text-xs`,children:[l(e),(0,Q.jsx)(_r,{className:`font-mono font-medium`,text:e.path}),(0,Q.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.status,` ·`,` `,aN(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 o1=e=>Nq(e).join(`\0`);function s1(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=zY(s,n,a,m),_;t[3]!==s||t[4]!==n?(_=RY({connection:s,scope:n}),t[3]=s,t[4]=n,t[5]=_):_=t[5];let v=Vn(Dn(Yr(_))),y=v?.snapshot?.head.kind===`attached`&&v.commits.some(e=>e.oid===a)?Lq(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=iF(s,n,a,m,D.map(d1)),k;t[12]===O.patches?k=t[13]:(k=e=>O.patches.get(o1(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=GP(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=>(GP(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 ${Iq(a)}`,t[21]=g.commit.subject,t[22]=a,t[23]=I):I=t[23];let L=I,R=new Map(M.map(u1));for(let e of D)A(e)?.kind===`metadata-only`&&R.set(Pq(e),{added:0,removed:0});let z=F===0&&g.files.every(e=>{let t=A(e);return R.has(Pq(e))||t?.kind===`binary`})?[...R.values()].reduce(l1,{added:0,removed:0}):void 0,B;t[24]===a?B=t[25]:(B=(0,Q.jsx)(pQ,{label:`Copy hash`,icon:er,onClick:()=>At(a,`commit id`)}),t[24]=a,t[25]=B);let V;t[26]===o?V=t[27]:(V=(0,Q.jsx)(pQ,{label:`Open in graph`,icon:Hf,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,bd.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)(Wf,{className:`size-3.5 shrink-0`}),(0,Q.jsxs)(`span`,{children:[`Commit`,` `,(0,Q.jsx)(_r,{text:a,disclose:`always`,className:`font-mono text-caption text-foreground`,children:Iq(a)})]}),y&&(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[`on`,` `,(0,Q.jsx)(_r,{text:y,className:`font-mono text-caption font-normal`})]})]}),(0,Q.jsx)(_r,{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)(Pe,{value:String(m),onValueChange:e=>h(()=>p({nonce:c?.nonce,parent:Number(e)})),children:(0,Q.jsx)(Hn,{children:g.commit.parentOids.map(c1)})}),(0,Q.jsx)(pQ,{label:`Copy message`,icon:er,onClick:()=>At(Mq(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)(f1,{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)(S$,{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)(H$,{more:F,pending:O.pending,onReadMore:E}),t[48]=O.pending,t[49]=F,t[50]=E,t[51]=ee):ee=t[51];let te;return t[52]!==K||t[53]!==ee?(te=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[K,ee]}),t[52]=K,t[53]=ee,t[54]=te):te=t[54],te}function c1(e,t){return(0,Q.jsxs)(ar,{value:String(t+1),children:[OY(t+1),` parent ·`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:Iq(e)})]},e)}function l1(e,t){return{added:e.added+t.added,removed:e.removed+t.removed}}function u1(e){return[e.path,e.lineCounts]}function d1(e){return Nq(e)}function f1(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)(em,{className:`size-3`})}),t[0]=u):u=t[0];let d;t[1]===n.commit.author.name?d=t[2]:(d=(0,Q.jsx)(_r,{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=io(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:Iq(n.comparison.baseOid)}),n.commit.parentOids.length>1&&` (${OY(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),_=Rq(n.commit.refs).filter(e).map(p1),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=fi(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)(_1,{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)(_r,{text:Nq(e).join(` → `),className:`flex-1 font-mono font-medium`}),(0,Q.jsx)(_1,{count:c.get(Pq(e))}),i(e)?.kind===`binary`&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Binary`})]},o1(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)(m1,{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 p1(e){return(0,Q.jsx)(_r,{text:e.name,className:`font-mono`},`${e.kind}:${e.name}`)}function m1(e){let t=(0,$.c)(15),{changes:n,patchOf:r,failed:i,onRetry:a}=e,o;t[0]!==i||t[1]!==a?(o=i&&(0,Q.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-xs text-muted-foreground`,children:[`Some patches could not be read.`,(0,Q.jsx)(X,{size:`xs`,variant:`outline`,onClick:a,children:`Try again`})]}),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s;if(t[3]!==n||t[4]!==i||t[5]!==r){let e;t[7]!==i||t[8]!==r?(e=e=>{let t=Pq(e),n=r(e),a=eN(e),o=aN(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)(_r,{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(`
1398
+ `).filter(g1).map(h1).join(`
1399
+ `)})]},`${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 h1(e){return e.slice(1)}function g1(e){return/^[+-]Subproject commit /.test(e)}function _1(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 v1(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(y1),t[0]=a,t[1]=f);let p=f.length,m;t[2]===a.length?m=t[3]:(m=fi(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)(X,{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)(So,{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)(fo,{"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)(ka,{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)(G$,{scope:n,context:r,path:e.path,fingerprint:e.fingerprint,status:e.reviewStatus,latest:u===e.path,onStart:()=>d(e.path)}),(0,Q.jsxs)(b1,{current:o.current===e.path,onOpen:()=>o.open(e.path),children:[(0,Q.jsxs)(_r,{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)(NQ,{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 y1(e){return e.reviewStatus===`reviewed`}function b1(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 x1(e){return[...new Set([e.oldPath,e.newPath,e.path].filter(e=>e!==void 0))]}function S1(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:om(e.id)}]:[]));return i.find(e=>e.stepId===n)??i.find(e=>e.place===r)??i[0]}function C1(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(T1,0),t[12]=i?.hunks,t[13]=r),s=r;let a;t[14]===i?.hunks?a=t[15]:(a=i?.hunks.reduce(w1,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=_r,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 w1(e,t){return e+t.deletionLines}function T1(e,t){return e+t.additionLines}function E1(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=$o({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=Yr(s),l=Br(s),u;t[4]===c?u=t[5]:(u=Vn(Dn(c))?.revision,t[4]=c,t[5]=u);let d=u;if(!d){if(q(c)){let e;return t[6]===l?e=t[7]:(e=(0,Q.jsx)(g,{description:`The review file could not be read.`,onRetry:l}),t[6]=l,t[7]=e),e}if(De(c)){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(hn,{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)(he,{title:`Revision not found`,description:`This retained file's revision is no longer available.`}),t[9]=e):e=t[9],e}let f;return t[10]!==r||t[11]!==n||t[12]!==i||t[13]!==a||t[14]!==d?(f=(0,Q.jsx)(D1,{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]=f):f=t[15],f}function D1(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 d=l,f={connection:i.connection,reviewId:r.reviewId,revision:r.revision},p=u({...f,path:s}),m=Yr(p),h=Br(p),_=Vn(Dn(m)),v;t[7]===s?v=t[8]:(v=e=>e.path===s,t[7]=s,t[8]=v);let y=r.files.find(v),b=ra({...f,paths:y?[x1(y)]:[]}),x=Yr(b),S=Br(b),C;t[9]!==x||t[10]!==n.kind||t[11]!==m?(C=n.kind===`review-change`?q(x):q(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`?De(x):De(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?GP(r.headOid,{...y,oldPath:y.oldPath,newPath:y.newPath},Vn(Dn(x))?.diffs[0]?.content):void 0,k=O?.fileDiff,A=(()=>{if(n.kind===`review-change`)return O;if(_?.kind===`text`)return CQ(`review:${r.reviewId}:${r.revision}:${s}`,s,_.text)})(),j=Vn(Dn(Yr(N(f)))),M=Us(f),P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P={mode:`promiseExit`},t[17]=P):P=t[17];let[F,I]=wr(M.mark,P),L;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(L={mode:`promiseExit`},t[18]=L):L=t[18];let[R,z]=wr(M.unmark,L),B=y?.newOid??y?.oldOid,V=j?.files.some(e=>e.path===s&&e.fingerprint===B)??!1,H=NZ(`${r.reviewId}:${r.revision}`),U=r.content.layers,W=S1(U,s,qZ(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(`
1400
+ `)}),t[19]=K,t[20]=ee);let te=ee,ne;t[21]!==w||t[22]!==E||t[23]!==te||t[24]!==_?.kind||t[25]!==s||t[26]!==D?(ne=()=>w?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(g,{description:`${s} · Code unavailable at this revision`,onRetry:D}),te]}):E?(0,Q.jsx)(hn,{label:`Loading retained file`}):_?.kind===`too-large`?(0,Q.jsx)(he,{title:`Not shown`,description:`This file is too large to display.`}):_?.kind===`unsupported`?(0,Q.jsx)(he,{title:`Not shown`,description:`This file cannot be displayed as text.`}):(0,Q.jsx)(he,{title:`Not shown`,description:`${s} · Code unavailable at this revision`,children:te}),t[21]=w,t[22]=E,t[23]=te,t[24]=_?.kind,t[25]=s,t[26]=D,t[27]=ne):ne=t[27];let re=ne,ie=K?`Step ${K.title}`:`File ${s}`,ae;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(ip,{className:`size-3.5 shrink-0`}),t[28]=ae):ae=t[28];let oe=G&&K?`Part of the review · Decision ${U.indexOf(G)+1}, stop ${G.steps.indexOf(K)+1} · ${K.title}`:`Part of the review`,se;t[29]!==U||t[30]!==G||t[31]!==K?(se=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]=se):se=t[32];let ce;t[33]!==oe||t[34]!==se?(ce=(0,Q.jsxs)(_r,{className:`min-w-0 flex-1`,text:oe,children:[`Part of the review`,se]}),t[33]=oe,t[34]=se,t[35]=ce):ce=t[35];let le;t[36]===o?le=t[37]:(le=()=>o({kind:`handoff`}),t[36]=o,t[37]=le);let ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Q.jsx)(kd,{}),t[38]=ue):ue=t[38];let de;t[39]===le?de=t[40]:(de=(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:le,children:[ue,`Back to the walkthrough`]}),t[39]=le,t[40]=de);let fe;t[41]!==ce||t[42]!==de?(fe=(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:[ae,ce,de]}),t[41]=ce,t[42]=de,t[43]=fe):fe=t[43];let pe=y?.status,J;t[44]!==k||t[45]!==s||t[46]!==pe?(J=(0,Q.jsx)(C1,{path:s,note:pe,diff:k}),t[44]=k,t[45]=s,t[46]=pe,t[47]=J):J=t[47];let me;t[48]!==F||t[49]!==R?(me=(q(F)||q(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]=F,t[49]=R,t[50]=me):me=t[50];let ge;t[51]!==i||t[52]!==k||t[53]!==n.kind||t[54]!==A||t[55]!==B||t[56]!==a||t[57]!==I||t[58]!==F||t[59]!==o||t[60]!==s||t[61]!==V||t[62]!==r||t[63]!==d||t[64]!==re||t[65]!==z||t[66]!==R?(ge=A?(0,Q.jsx)(S$,{scope:d,context:i,interaction:a,disableFileHeader:!0,compactThreads:n.kind===`review-file`,fileDiff:n.kind===`review-file`?k:void 0,headerActions:(0,Q.jsx)(pQ,{label:`Timeline`,iconOnly:!0,icon:Ap,onClick:()=>o({kind:`timeline`,path:s})}),entries:[{...A,comment:HQ(r,s),...B?{review:{path:s,fingerprint:B,reviewed:V,control:null}}:{}}],onReview:()=>{!B||F.waiting||R.waiting||(V?z({kind:`file`,path:s,headBlobOid:B}):I({kind:`file`,revision:r.revision,path:s,headBlobOid:B}))}}):re(),t[51]=i,t[52]=k,t[53]=n.kind,t[54]=A,t[55]=B,t[56]=a,t[57]=I,t[58]=F,t[59]=o,t[60]=s,t[61]=V,t[62]=r,t[63]=d,t[64]=re,t[65]=z,t[66]=R,t[67]=ge):ge=t[67];let _e;return t[68]!==ie||t[69]!==fe||t[70]!==J||t[71]!==me||t[72]!==ge?(_e=(0,Q.jsxs)(`article`,{"aria-label":ie,className:`flex min-h-0 flex-1 flex-col`,children:[fe,J,me,ge]}),t[68]=ie,t[69]=fe,t[70]=J,t[71]=me,t[72]=ge,t[73]=_e):_e=t[73],_e}function O1(e,t,n){if(t===``)return[];let r=t.toLocaleLowerCase(),i=[],a=e.split(`
1401
+ `);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 k1(e,t){return Math.max(0,Math.min(e,t-1))}function A1(e,t,n){return t===0?0:(k1(e,t)+n+t)%t}function j1(e,t,n){if(t===0)return`No results`;let r=t===n?`+`:``;return`${k1(e,t)+1} of ${t}${r}`}function M1(e){let t=(0,$.c)(65),{text:n,focusRequest:r,onReveal:i,onClose:o}=e,[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(0),d;t[0]!==s||t[1]!==n?(d=O1(n,s,st),t[0]=s,t[1]=n,t[2]=d):d=t[2];let f=d,[p,m]=(0,Z.useState)(),h;t[3]!==f||t[4]!==i?(h=(e,t)=>{let n=t===void 0?f:t;u(e);let r=n[e];r&&i(r.line)},t[3]=f,t[4]=i,t[5]=h):h=t[5];let g=h,_;t[6]!==l||t[7]!==f.length||t[8]!==g?(_=e=>g(A1(l,f.length,e)),t[6]=l,t[7]=f.length,t[8]=g,t[9]=_):_=t[9];let v=_,y;t[10]===o?y=t[11]:(y=e=>{e.key===`Escape`&&(e.preventDefault(),o())},t[10]=o,t[11]=y);let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(oL,{children:(0,Q.jsx)(Mp,{})}),t[12]=b):b=t[12];let x;t[13]!==r||t[14]!==p?(x=e=>{e&&p!==r&&(e.focus(),e.select(),m(r))},t[13]=r,t[14]=p,t[15]=x):x=t[15];let S;t[16]!==g||t[17]!==n?(S=e=>{c(e.target.value),g(0,O1(n,e.target.value,st))},t[16]=g,t[17]=n,t[18]=S):S=t[18];let C;t[19]===v?C=t[20]:(C=e=>{e.key===`Enter`&&(e.preventDefault(),v(e.shiftKey?-1:1))},t[19]=v,t[20]=C);let w;t[21]!==s||t[22]!==x||t[23]!==S||t[24]!==C?(w=(0,Q.jsx)(uL,{ref:x,"aria-label":`Find in file`,placeholder:`Find in file`,value:s,onChange:S,onKeyDown:C}),t[21]=s,t[22]=x,t[23]=S,t[24]=C,t[25]=w):w=t[25];let T;t[26]!==l||t[27]!==f.length||t[28]!==s?(T=s!==``&&(0,Q.jsx)(lL,{role:`status`,children:j1(l,f.length,1e4)}),t[26]=l,t[27]=f.length,t[28]=s,t[29]=T):T=t[29];let E=f.length===0,D;t[30]===v?D=t[31]:(D=()=>v(-1),t[30]=v,t[31]=D);let O;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(zt,{}),t[32]=O):O=t[32];let k;t[33]!==E||t[34]!==D?(k=(0,Q.jsx)(Ts,{render:(0,Q.jsx)(cL,{size:`icon-xs`,"aria-label":`Previous match`,disabled:E,onClick:D,children:O})}),t[33]=E,t[34]=D,t[35]=k):k=t[35];let A;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(tt,{role:`tooltip`,className:`break-all`,children:`Previous match`}),t[36]=A):A=t[36];let j;t[37]===k?j=t[38]:(j=(0,Q.jsxs)(ke,{children:[k,A]}),t[37]=k,t[38]=j);let M=f.length===0,N;t[39]===v?N=t[40]:(N=()=>v(1),t[39]=v,t[40]=N);let P;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(a,{}),t[41]=P):P=t[41];let F;t[42]!==M||t[43]!==N?(F=(0,Q.jsx)(Ts,{render:(0,Q.jsx)(cL,{size:`icon-xs`,"aria-label":`Next match`,disabled:M,onClick:N,children:P})}),t[42]=M,t[43]=N,t[44]=F):F=t[44];let I;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(tt,{role:`tooltip`,className:`break-all`,children:`Next match`}),t[45]=I):I=t[45];let L;t[46]===F?L=t[47]:(L=(0,Q.jsxs)(ke,{children:[F,I]}),t[46]=F,t[47]=L);let R;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(kn,{}),t[48]=R):R=t[48];let z;t[49]===o?z=t[50]:(z=(0,Q.jsx)(Ts,{render:(0,Q.jsx)(cL,{size:`icon-xs`,"aria-label":`Close find`,onClick:o,children:R})}),t[49]=o,t[50]=z);let B;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(tt,{role:`tooltip`,className:`break-all`,children:`Close find`}),t[51]=B):B=t[51];let V;t[52]===z?V=t[53]:(V=(0,Q.jsxs)(ke,{children:[z,B]}),t[52]=z,t[53]=V);let H;t[54]!==T||t[55]!==j||t[56]!==L||t[57]!==V?(H=(0,Q.jsxs)(oL,{align:`inline-end`,children:[T,j,L,V]}),t[54]=T,t[55]=j,t[56]=L,t[57]=V,t[58]=H):H=t[58];let U;t[59]!==H||t[60]!==w?(U=(0,Q.jsxs)(iL,{className:`w-full max-w-sm`,children:[b,w,H]}),t[59]=H,t[60]=w,t[61]=U):U=t[61];let W;return t[62]!==U||t[63]!==y?(W=(0,Q.jsx)(`div`,{role:`search`,className:`flex shrink-0 justify-end border-b px-3 py-1.5`,onKeyDown:y,children:U}),t[62]=U,t[63]=y,t[64]=W):W=t[64],W}function N1(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=jw(e.path)?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-auto`,children:[(0,Q.jsx)(G1,{...e}),(0,Q.jsx)(B1,{path:e.path,copy:!1,children:(0,Q.jsxs)(nY,{className:`max-w-full flex-wrap justify-end`,children:[(0,Q.jsx)(V1,{path:e.path,onOpen:e.onOpen}),(0,Q.jsx)(H1,{path:e.path})]})}),(0,Q.jsx)(Mw,{scope:e.scope,path:e.path,connection:e.context.connection})]}):(0,Q.jsx)(P1,{...e}),t[0]=e,t[1]=n),n}function P1(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=IM(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)(F1,{...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)(F1,{...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)(I1,{...e}),t[14]=e,t[15]=u),u}function F1(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)(G1,{...r}),t[3]=r,t[4]=i);let a;t[5]===r.path?a=t[6]:(a=(0,Q.jsx)(B1,{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)(he,{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 I1(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}=Eu(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)(F1,{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)(L1,{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 L1(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}=ec(),{connection:m}=r,h=RP(n,m),g;t[0]===a?g=t[1]:(g=U1(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=gQ(n,r,h,v)[0],b=y?.comparisons??[],x=b.find(R1)??b[0],S=x?oN(x):void 0,C;t[4]!==a||t[5]!==y?(C=y?[{path:a,fingerprint:y.fingerprint}]:[],t[4]=a,t[5]=y,t[6]=C):C=t[6];let w=BP(n,m,y?.statusToken??``,C,S?[S]:[]),T=S?w.diffs.get(pP(S)):void 0,E=x&&x.scope!==`untracked`&&x.scope!==`unmerged`&&T?WP(x,T)?.fileDiff:void 0,D=x&&`kind`in x?`${x.scope} · ${x.kind}`:x?.scope,O;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),O=h.changes.some(e),t[7]=h.changes,t[8]=a,t[9]=O}else O=t[9];let k=O,A;t[12]!==_||t[13]!==p?(A=()=>W1(_,p),t[12]=_,t[13]=p,t[14]=A):A=t[14];let[j,M]=(0,Z.useState)(A),{reveal:N,active:P}=i,[F,I]=(0,Z.useState)();N&&F!==N.nonce&&N.anchor.comparison?.kind===`file`&&N.anchor.filePath===a&&(I(N.nonce),M(`source`));let[L,R]=(0,Z.useState)(),[z,B]=(0,Z.useState)(!1),[V,H]=(0,Z.useState)(),[U,W]=(0,Z.useState)(),G=(0,Z.useId)();hq(c,G,s);let K=_===`code`||j===`source`,ee;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>H(Date.now()),t[15]=ee):ee=t[15];let te=P&&K&&!z,q;t[16]===te?q=t[17]:(q={enabled:te,ignoreInputs:!1,conflictBehavior:`allow`},t[16]=te,t[17]=q),Qs(Ic.findInFile,ee,q);let ne=l.diskChanged.has(G)?`Changed on disk just now`:``,re;t[18]===ne?re=t[19]:(re=(0,Q.jsx)(`span`,{"aria-live":`polite`,className:`hidden text-xs text-muted-foreground xl:inline`,children:ne}),t[18]=ne,t[19]=re);let ie;t[20]!==_||t[21]!==j?(ie=_!==`code`&&(0,Q.jsx)(Pe,{value:j,onValueChange:e=>{(e===`rendered`||e===`source`)&&M(e)},children:(0,Q.jsxs)(Hn,{children:[(0,Q.jsx)(ar,{value:`rendered`,children:_===`markdown`?`Reader`:`Preview`}),(0,Q.jsx)(ar,{value:`source`,children:`Source`})]})}),t[20]=_,t[21]=j,t[22]=ie):ie=t[22];let ae;t[23]!==re||t[24]!==ie?(ae=(0,Q.jsxs)(Q.Fragment,{children:[re,ie]}),t[23]=re,t[24]=ie,t[25]=ae):ae=t[25];let oe=ae,se;t[26]!==s||t[27]!==l.owner||t[28]!==l.savedText||t[29]!==l.text||t[30]!==d||t[31]!==G?(se=s&&(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(X,{variant:`ghost`,size:`icon-sm`,disabled:l.owner!==null&&l.owner!==G,"aria-label":l.text===l.savedText?`Edit`:`Resume edit`,onClick:()=>{d(G)&&B(!0)}}),children:(0,Q.jsx)(bn,{})}),(0,Q.jsx)(tt,{role:`tooltip`,children:l.owner!==null&&l.owner!==G?`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]=G,t[32]=se):se=t[32];let ce;t[33]!==k||t[34]!==f||t[35]!==a?(ce=k&&(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Open diff`,onClick:()=>f({kind:`change`,path:a})}),children:(0,Q.jsx)(bf,{})}),(0,Q.jsx)(tt,{role:`tooltip`,children:`Open diff`})]}),t[33]=k,t[34]=f,t[35]=a,t[36]=ce):ce=t[36];let le;t[37]!==i.toolbarTarget||t[38]!==f||t[39]!==a?(le=i.toolbarTarget===void 0&&(0,Q.jsx)(V1,{path:a,onOpen:f}),t[37]=i.toolbarTarget,t[38]=f,t[39]=a,t[40]=le):le=t[40];let ue;t[41]===a?ue=t[42]:(ue=(0,Q.jsx)(H1,{path:a}),t[41]=a,t[42]=ue);let de;t[43]!==se||t[44]!==ce||t[45]!==le||t[46]!==ue?(de=(0,Q.jsxs)(Q.Fragment,{children:[se,ce,le,ue]}),t[43]=se,t[44]=ce,t[45]=le,t[46]=ue,t[47]=de):de=t[47];let fe=de;if(z){let e;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>B(!1),t[48]=e):e=t[48];let n;t[49]!==s||t[50]!==u||t[51]!==o?(n=()=>{u(o,s??``),B(!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)(B1,{path:a,children:e}),t[53]=a,t[54]=r);let i;return t[55]!==P||t[56]!==k||t[57]!==c||t[58]!==l||t[59]!==G||t[60]!==a||t[61]!==n||t[62]!==r?(i=(0,Q.jsx)(DM,{owner:G,path:a,draft:c,state:l,active:P,changed:k,onDone:e,onDiscard:n,renderToolbar:r}),t[55]=P,t[56]=k,t[57]=c,t[58]=l,t[59]=G,t[60]=a,t[61]=n,t[62]=r,t[63]=i):i=t[63],i}let pe;t[64]!==P||t[65]!==z||t[66]!==K?(pe=P&&!K&&!z&&(0,Q.jsx)(K1,{onComment:()=>{M(`source`),R(Date.now())}}),t[64]=P,t[65]=z,t[66]=K,t[67]=pe):pe=t[67];let J;t[68]!==i.toolbarTarget||t[69]!==f||t[70]!==a||t[71]!==K?(J=i.toolbarTarget&&!K&&(0,bd.createPortal)((0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pQ,{label:`Comment`,icon:fp,shortcut:Ic.commentOnFile,onClick:()=>{M(`source`),R(Date.now())}}),(0,Q.jsx)(V1,{path:a,onOpen:f})]}),i.toolbarTarget),t[68]=i.toolbarTarget,t[69]=f,t[70]=a,t[71]=K,t[72]=J):J=t[72];let me;t[73]!==fe||t[74]!==L||t[75]!==s||t[76]!==r||t[77]!==E||t[78]!==V||t[79]!==U||t[80]!==i||t[81]!==_||t[82]!==oe||t[83]!==j||t[84]!==D||t[85]!==f||t[86]!==a||t[87]!==n||t[88]!==o?(me=j===`rendered`&&_!==`code`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(B1,{path:a,copy:!1,children:[oe,(0,Q.jsx)(nY,{className:`max-w-full flex-wrap justify-end`,children:fe})]}),(0,Q.jsx)(z1,{scope:n,context:r,path:a,kind:_,text:o})]}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[V!==void 0&&(0,Q.jsx)(M1,{text:o,focusRequest:V,onReveal:e=>W({line:e,nonce:Date.now()}),onClose:()=>H(void 0)}),(0,Q.jsxs)(C1,{path:a,note:D,diff:E,children:[oe,fe]}),(0,Q.jsx)(S$,{disableFileHeader:!0,compactThreads:!0,fileDiff:E,scope:n,context:r,interaction:i,headerActions:i.toolbarTarget===void 0?void 0:(0,Q.jsx)(V1,{path:a,onOpen:f}),...L===void 0?{}:{commentRequest:L},...U===void 0?{}:{foundLine:U},entries:[{...CQ(`file:${a}`,a,o),...s?{comment:{filePath:a,comparison:{kind:`file`},contentFingerprint:s}}:{}}]})]}),t[73]=fe,t[74]=L,t[75]=s,t[76]=r,t[77]=E,t[78]=V,t[79]=U,t[80]=i,t[81]=_,t[82]=oe,t[83]=j,t[84]=D,t[85]=f,t[86]=a,t[87]=n,t[88]=o,t[89]=me):me=t[89];let he;return t[90]!==pe||t[91]!==J||t[92]!==me?(he=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-card`,children:[pe,J,me]}),t[90]=pe,t[91]=J,t[92]=me,t[93]=he):he=t[93],he}function R1(e){return e.scope===`unstaged`}function z1(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)(SM,{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)(FM,{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 B1(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)(H1,{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)(C1,{path:n,children:[r,o]}),t[3]=r,t[4]=n,t[5]=o,t[6]=s):s=t[6],s}function V1(e){let t=(0,$.c)(3),{path:n,onOpen:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Q.jsx)(pQ,{label:`Timeline`,iconOnly:!0,icon:Ap,onClick:()=>r({kind:`timeline`,path:n})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function H1(e){let t=(0,$.c)(8),{path:n}=e,r;t[0]===n?r=t[1]:(r=(0,Q.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Copy path`,onClick:()=>At(n,`path`)}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(er,{}),t[2]=i):i=t[2];let a;t[3]===r?a=t[4]:(a=(0,Q.jsx)(Ts,{render:r,children:i}),t[3]=r,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(tt,{role:`tooltip`,children:`Copy path`}),t[5]=o):o=t[5];let s;return t[6]===a?s=t[7]:(s=(0,Q.jsxs)(ke,{children:[a,o]}),t[6]=a,t[7]=s),s}function U1(e){let t=e.toLowerCase();return t.endsWith(`.md`)||t.endsWith(`.mdx`)?`markdown`:t.endsWith(`.html`)||t.endsWith(`.htm`)?`html`:`code`}function W1(e,t){return e===`markdown`||e===`html`?t.documentsDefault:`source`}function G1(e){let t=(0,$.c)(25),{scope:n,context:r,interaction:i,path:a,onOpen:o}=e,s=RP(n,r.connection),c;t[0]===a?c=t[1]:(c=[a],t[0]=a,t[1]=c);let l=gQ(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)(K1,{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)(pQ,{label:`Comment`,icon:fp,shortcut:Ic.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)(V1,{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,bd.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 K1(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],Qs(Ic.commentOnFile,n,r),null}function q1(e){return[...new Set(e)].join(`, `)}function J1(e){let t=(0,$.c)(37),{scope:n,context:r,interaction:i,paths:a,files:s,focus:c,header:l,headerActions:u,headerLeading:d,commentRequest:f,toolbar:p,agentNotes:m,footer:h,column:g}=e,_=s===void 0?[]:s,v=g!==void 0&&g,{connection:y}=r,[b,x]=(0,Z.useState)(0),[S]=(0,Z.useState)(a0);hQ(n,r);let C=RP(n,y),w=o(gQ(n,r,C,a),_),T=BP(n,y,w[0]?.statusToken??``,w.flatMap(r0),w.flatMap(t0)),E=TM(y,n,w.flatMap($1)),D;t[0]===T.diffs?D=t[1]:(D=e=>{let t=oN(e);return t?T.diffs.get(pP(t)):void 0},t[0]=T.diffs,t[1]=D);let O=D,k=T.pending||E.pending,A=T.failed||E.failed,j=new Map(_.map(Q1)),M;t[2]!==O||t[3]!==E?(M=e=>{let t=e.comparisons.flatMap(e=>{if(e.scope===`unmerged`)return[`Conflict`];if(e.scope===`untracked`)return E.contents.has(e.path)?[]:[`Not readable`];if(!e.supported)return[`Unsupported comparison`];let t=O(e);return t?t.kind===`binary`?[`Binary change`]:t.kind===`omitted`?[`Content omitted: ${rN(t.reason)}`]:WP(e,t)?[]:[`No single-file textual patch`]:[]});return t.length>0?[{item:e,reasons:t}]:[]},t[2]=O,t[3]=E,t[4]=M):M=t[4];let N=w.flatMap(M),P=w.flatMap(e=>e.comparisons.flatMap(t=>{let i=U$(n,r,e);if(t.scope===`untracked`){let n=E.contents.get(t.path);return n===void 0?[]:[{...CQ(mP(t),e.path,n,j.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=s0(O(t),c?.[e.path]),o=a?WP(t,a):null,s=j.get(e.path);return o?[{...o,...s?{note:s}:{},review:i,comment:{filePath:e.path,comparison:{kind:`worktree`,scope:t.scope},...e.fingerprint?{contentFingerprint:e.fingerprint}:{}}}]:[]}));for(let[e,t]of Object.entries(m??{})){let n=P.filter(t=>t.path===e),r=n.find(Z1)??n[0];if(r)for(let e of t){let t=r.kind===`file`?e.line<=r.contents.split(`
1402
+ `).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 F=new Set(P.map(X1)),I=i.toolbarTarget!==void 0&&/^(file|change|branch):/.test(i.entry)&&P.length===0&&w.length===1?N[0]?.item:void 0,L=l||k||A||N.length>0?e=>(0,Q.jsxs)(Q.Fragment,{children:[l?.({...e,open:t=>{let n=S.get(t);!F.has(t)&&n?(n.focus({preventScroll:!0}),n.scrollIntoView({block:`start`})):e.open(t)}}),(k||A)&&(0,Q.jsx)(c0,{failed:A,retry:()=>{T.retry(),E.retry()}}),N.length>0&&(0,Q.jsx)(l0,{changes:N,column:v,onTarget:(e,t)=>{t?S.set(e,t):S.delete(e)},renderedPaths:F,scope:n,context:r,paneFile:!!I,...P.length===0&&(f!==void 0||b>0)?{commentRequest:(f??0)+b}:{}})]}):void 0,R;t[5]!==r||t[6]!==u||t[7]!==i.active||t[8]!==I||t[9]!==n||t[10]!==x?(R=I?(0,Q.jsx)(d0,{scope:n,context:r,item:I,active:i.active,onComment:()=>x(Y1),children:u}):void 0,t[5]=r,t[6]=u,t[7]=i.active,t[8]=I,t[9]=n,t[10]=x,t[11]=R):R=t[11];let z;t[12]===f?z=t[13]:(z=f===void 0?{}:{commentRequest:f},t[12]=f,t[13]=z);let B;t[14]===h?B=t[15]:(B=h?{footer:h}:{},t[14]=h,t[15]=B);let V;t[16]===L?V=t[17]:(V=L?{header:L}:{},t[16]=L,t[17]=V);let H;t[18]===u?H=t[19]:(H=u?{headerActions:u}:{},t[18]=u,t[19]=H);let U;t[20]===d?U=t[21]:(U=d?{headerLeading:d}:{},t[20]=d,t[21]=U);let W;t[22]===p?W=t[23]:(W=p?{toolbar:p}:{},t[22]=p,t[23]=W);let G;return t[24]!==v||t[25]!==r||t[26]!==P||t[27]!==i||t[28]!==n||t[29]!==U||t[30]!==W||t[31]!==R||t[32]!==z||t[33]!==B||t[34]!==V||t[35]!==H?(G=(0,Q.jsx)(S$,{emptyActions:R,scope:n,context:r,interaction:i,...z,entries:P,column:v,...B,...V,...H,...U,...W}),t[24]=v,t[25]=r,t[26]=P,t[27]=i,t[28]=n,t[29]=U,t[30]=W,t[31]=R,t[32]=z,t[33]=B,t[34]=V,t[35]=H,t[36]=G):G=t[36],G}function Y1(e){return e+1}function X1(e){return e.path}function Z1(e){return e.comment?.comparison?.kind===`worktree`&&e.comment.comparison.scope===`unstaged`}function Q1(e){return[e.path,e.note]}function $1(e){return e.comparisons.flatMap(e0)}function e0(e){return e.scope===`untracked`?[e.path]:[]}function t0(e){return e.comparisons.flatMap(n0)}function n0(e){let t=oN(e);return t?[t]:[]}function r0(e){return e.comparisons.some(i0)?[{path:e.path,fingerprint:e.fingerprint}]:[]}function i0(e){return e.scope===`staged`||e.scope===`unstaged`}function a0(){return new Map}var o0=new WeakMap;function s0(e,t){if(!e||!t?.length||e.kind!==`text`)return e;let n=t.map(e=>`${e.startLine}-${e.endLine}`).join(`,`),r=o0.get(e),i=r?.get(n);if(i)return i;let a=dP(e.patch,t),o=a?{...e,patch:a}:e;return r??=new Map,r.set(n,o),o0.set(e,r),o}function c0(e){let t=(0,$.c)(3),{failed:n,retry:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(`section`,{className:`mx-4 mt-3 flex items-center gap-3 rounded-lg border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"aria-live":`polite`,children:n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:`The changes in this document could not be read.`}),(0,Q.jsx)(X,{size:`xs`,variant:`outline`,onClick:r,children:`Load the changes again`})]}):(0,Q.jsx)(`span`,{children:`Loading changes…`})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function l0(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=Y(`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}: ${q1(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)(_r,{className:`min-w-0 basis-full`,text:t.path}),jw(t.path)&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:`Current worktree image`}),(0,Q.jsx)(Mw,{scope:o,path:t.path,connection:s.connection})]}),(0,Q.jsx)(Je,{variant:`outline`,className:`h-auto max-w-full text-left whitespace-normal`,children:q1(n)}),!l&&!a.has(t.path)&&(0,Q.jsx)(W$,{scope:o,context:s,path:t.path,fingerprint:t.fingerprint,status:t.reviewStatus,compact:!!t.fingerprint}),!a.has(t.path)&&(0,Q.jsx)(u0,{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 u0(e){let t=(0,$.c)(16),{scope:n,context:r,path:i,commentRequest:a,paneFile:o}=e,{threads:s}=PQ(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)(X,{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)(b$,{scope:n,context:r,thread:e},e.id)),c&&(0,Q.jsx)(e$,{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 d0(e){let t=(0,$.c)(22),{scope:n,context:r,item:i,active:a,onComment:o,children:s}=e,c=MQ(n,r,f0),l;t[0]!==r||t[1]!==i||t[2]!==n?(l=U$(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),Qs(Ic.toggleReviewed,f,p);let m;t[9]===a?m=t[10]:(m={enabled:a,ignoreInputs:!0},t[9]=a,t[10]=m),Qs(Ic.commentOnFile,o,m);let h=u.reviewed?ci:Wp,g=!u.fingerprint,_;t[11]!==h||t[12]!==g||t[13]!==u.reviewed||t[14]!==f?(_=(0,Q.jsx)(pQ,{label:`Reviewed`,variant:`outline`,icon:h,shortcut:Ic.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)(pQ,{label:`Comment`,icon:fp,shortcut:Ic.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 f0(e){return Is.add(e)}var p0=Z.createContext(void 0);function m0(){let e=Z.useContext(p0);if(e===void 0)throw Error(s(13));return e}var h0={imageLoadingStatus:()=>null},g0=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=L(`span`,e,{state:c,ref:t,props:a,stateAttributesMapping:h0});return(0,Q.jsx)(p0.Provider,{value:l,children:u})});function _0(e,{referrerPolicy:t,crossOrigin:n,sizes:r,srcSet:i},a){let o=Z.useState(`idle`),s=o[1];return ii(()=>{if(!a)return Vi;if(!e&&!i)return s(`error`),Vi;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 v0={...h0,...nt},y0=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}=m0(),[f,p]=_0(l,e,!a),m=f===`loaded`,{mounted:h,transitionStatus:g,setMounted:_}=Uo(m),v=Z.useRef(null),y=Z.useRef(!0);ii(()=>{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=dr(e=>{i?.(e),d(e)});ii(()=>{f!==`idle`&&x(f)},[f,x]),ii(()=>()=>d(`idle`),[d]),fn({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=L(`img`,e,{state:S,ref:[t,v],props:[b,u,w],stateAttributesMapping:v0,enabled:C});return C?T:null}),b0=Z.forwardRef(function(e,t){let{className:n,render:r,delay:i=0,style:a,...o}=e,{imageLoadingStatus:s}=m0(),[c,l]=Z.useState(i===0),u=J();return Z.useEffect(()=>(i>0?u.start(i,()=>l(!0)):l(!0),u.clear),[u,i]),L(`span`,e,{state:{imageLoadingStatus:s},ref:t,props:o,stateAttributesMapping:h0,enabled:s!==`loaded`&&(i===0||c)})});function x0({className:e,size:t=`default`,...n}){return(0,Q.jsx)(g0,{"data-slot":`avatar`,"data-size":t,className:Y(`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 S0({className:e,...t}){return(0,Q.jsx)(y0,{"data-slot":`avatar-image`,className:Y(`aspect-square size-full rounded-full object-cover`,e),...t})}function C0({className:e,...t}){return(0,Q.jsx)(b0,{"data-slot":`avatar-fallback`,className:Y(`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 w0={open:Qf,draft:ep,merged:Jf,closed:Xf},T0={open:`text-add-fg`,draft:`text-muted-foreground`,merged:`text-brand`,closed:`text-del-fg`};function E0(e){return w0[da(e)]}function D0(e){return T0[da(e)]}function O0(e){let t=(0,$.c)(10),{pull:n}=e,r;t[0]===n?r=t[1]:(r=da(n),t[0]=n,t[1]=r);let i=r,a=w0[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=Bo(n),t[4]=n,t[5]=s);let c;return t[6]!==i||t[7]!==o||t[8]!==s?(c=(0,Q.jsxs)(Je,{variant:i,children:[o,s]}),t[6]=i,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function k0(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(Je,{variant:`outline`,children:[(0,Q.jsx)(nc,{"aria-hidden":`true`}),`GitHub unavailable`]}),e[0]=t):t=e[0],t}var A0={passed:(0,Q.jsx)(ci,{"aria-hidden":`true`,strokeWidth:2.5,className:`size-3 shrink-0 text-add-fg`}),running:(0,Q.jsx)(Ge,{"aria-hidden":`true`,className:`size-3 shrink-0`}),failed:(0,Q.jsx)(kn,{"aria-hidden":`true`,strokeWidth:2.5,className:`size-3 shrink-0 text-del-fg`})};function j0(e){let t=(0,$.c)(6),{tone:n,label:r,className:i}=e,a;t[0]===i?a=t[1]:(a=Y(`inline-flex items-center gap-1`,i),t[0]=i,t[1]=a);let o=n!==`none`&&A0[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 M0(){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 N0(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??wp,u=n===`empty`?`ghost`:`outline`,d;t[0]!==r||t[1]!==c||t[2]!==a||t[3]!==u?(d=(0,Q.jsx)(X,{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)(Ts,{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)(tt,{children:r}),t[11]=r,t[12]=m);let h;return t[13]!==p||t[14]!==m?(h=(0,Q.jsxs)(ke,{children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15],h}var P0={passed:`open`,failed:`closed`,none:`outline`};function F0(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=bt({connection:i.connection,reviewId:n}),t[0]=i.connection,t[1]=n,t[2]=c):c=t[2];let l=c,u=Yr(l),d=Br(l),f;t[3]===u?f=t[4]:(f=Vn(Dn(u)),t[3]=u,t[4]=f);let p=f;if(q(u)){let e;return t[5]!==o||t[6]!==d?(e=(0,Q.jsx)(g,{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(!p){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(hn,{label:`Loading pull request`}),t[8]=e):e=t[8],e}if(p.kind===`unavailable`){let e;return t[9]!==o||t[10]!==u.waiting||t[11]!==d||t[12]!==p.reason?(e=(0,Q.jsx)(K0,{reason:p.reason,retrying:u.waiting,onRetry:d,onBack:o}),t[9]=o,t[10]=u.waiting,t[11]=d,t[12]=p.reason,t[13]=e):e=t[13],e}if(p.kind===`not-linked`||p.pullRequest.number!==r){let e=p.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)(X,{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)(he,{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 m=p.pullRequest,h;t[19]!==i.connection||t[20]!==m.state||t[21]!==n?(h=m.state===`merged`||m.state===`closed`?(0,Q.jsx)(oK,{connection:i.connection,reviewId:n}):void 0,t[19]=i.connection,t[20]=m.state,t[21]=n,t[22]=h):h=t[22];let _;t[23]!==m.url||t[24]!==h||t[25]!==a?(_=(0,Q.jsx)(L0,{url:m.url,target:a,archive:h}),t[23]=m.url,t[24]=h,t[25]=a,t[26]=_):_=t[26];let v=`Pull request #${r}`,y;t[27]===m?y=t[28]:(y=(0,Q.jsx)(R0,{pull:m}),t[27]=m,t[28]=y);let b;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`h2`,{children:`Description`}),t[29]=b):b=t[29];let x;t[30]===m.author?x=t[31]:(x=m.author&&(0,Q.jsx)(_r,{text:`by ${m.author}`}),t[30]=m.author,t[31]=x);let S;t[32]!==m.author||t[33]!==m.createdAt?(S=m.author&&m.createdAt&&(0,Q.jsx)(M0,{}),t[32]=m.author,t[33]=m.createdAt,t[34]=S):S=t[34];let C;t[35]===m.createdAt?C=t[36]:(C=m.createdAt&&(0,Q.jsx)(`time`,{dateTime:m.createdAt,children:q0(m.createdAt)}),t[35]=m.createdAt,t[36]=C);let w;t[37]!==C||t[38]!==x||t[39]!==S?(w=(0,Q.jsxs)(`div`,{className:I0,children:[b,(0,Q.jsxs)(`div`,{className:`ml-auto flex min-w-0 items-center gap-1.5 font-normal`,children:[x,S,C]})]}),t[37]=C,t[38]=x,t[39]=S,t[40]=w):w=t[40];let T;t[41]===m.description?T=t[42]:(T=m.description.trim()?(0,Q.jsx)(SM,{text:m.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]=m.description,t[42]=T);let E;t[43]!==w||t[44]!==T?(E=(0,Q.jsxs)(`section`,{"aria-label":`Description`,children:[w,T]}),t[43]=w,t[44]=T,t[45]=E):E=t[45];let D;t[46]!==o||t[47]!==s||t[48]!==m?(D=(0,Q.jsx)(B0,{pull:m,onBack:o,onFile:s}),t[46]=o,t[47]=s,t[48]=m,t[49]=D):D=t[49];let O;t[50]!==E||t[51]!==D?(O=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[E,D]}),t[50]=E,t[51]=D,t[52]=O):O=t[52];let k;t[53]===m?k=t[54]:(k=(0,Q.jsx)(`aside`,{"aria-label":`Checks and details`,className:`min-w-0 shrink-0 @min-4xl/pr:w-68`,children:(0,Q.jsx)(W0,{pull:m})}),t[53]=m,t[54]=k);let A;t[55]!==O||t[56]!==k?(A=(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:[O,k]}),t[55]=O,t[56]=k,t[57]=A):A=t[57];let j;t[58]!==u.waiting||t[59]!==A||t[60]!==v||t[61]!==y?(j=(0,Q.jsxs)(`article`,{"aria-busy":u.waiting,"aria-label":v,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:[y,A]}),t[58]=u.waiting,t[59]=A,t[60]=v,t[61]=y,t[62]=j):j=t[62];let M;return t[63]!==j||t[64]!==_?(M=(0,Q.jsxs)(`div`,{className:`@container/pr flex min-h-0 min-w-0 flex-1 flex-col overflow-auto`,children:[_,j]}),t[63]=j,t[64]=_,t[65]=M):M=t[65],M}var I0=`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 L0(e){let t=(0,$.c)(21),{url:n,target:r,archive:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(X,{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=Y(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)(Io,{"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)(Ts,{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)(tt,{children:`Open on GitHub`}),t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,Q.jsxs)(ke,{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,bd.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 R0(e){let t=(0,$.c)(53),{pull:n}=e,r;t[0]===n.url?r=t[1]:(r=Co(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)(Qf,{"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)(M0,{}),(0,Q.jsx)(_r,{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)(O0,{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)(V0,{author:n.author,url:n.authorAvatarUrl}),(0,Q.jsx)(_r,{text:n.author,className:`font-medium text-foreground`}),(0,Q.jsx)(M0,{})]}),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)(_r,{text:n.baseBranch}),t[19]=n.baseBranch,t[20]=m);let h;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(kd,{"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)(_r,{text:n.headBranch}),t[22]=n.headBranch,t[23]=g);let _;t[24]!==m||t[25]!==g?(_=(0,Q.jsxs)(Ts,{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)(tt,{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)(ke,{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)(M0,{}),t[33]=b):b=t[33];let x;t[34]===n.updatedAt?x=t[35]:(x=q0(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)(ke,{children:[(0,Q.jsxs)(Ts,{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)(ci,{"aria-hidden":`true`,strokeWidth:2.25,className:`size-3.5 text-add-fg`}),Bi(n)]}),(0,Q.jsxs)(tt,{children:[`The pull request’s head, `,Iq(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)(nc,{"aria-hidden":`true`,className:`size-3.5`}),Bi(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(z0)}),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 z0(e,t){return(0,Q.jsx)(`li`,{className:`min-w-0 max-w-full`,children:(0,Q.jsx)(Je,{variant:`outline`,className:`max-w-full`,children:(0,Q.jsx)(_r,{text:e.name})})},`${e.name}:${t}`)}function B0(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)(fe,{"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)(Io,{"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:I0,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:po(n.timeline).map(e=>{let{item:t,comments:n}=e;return(0,Q.jsx)(H0,{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)(H0,{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)(X,{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 V0(e){let t=(0,$.c)(9),{author:n,url:r}=e,i;t[0]===r?i=t[1]:(i=r&&(0,Q.jsx)(S0,{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)(C0,{children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,Q.jsxs)(x0,{size:`sm`,"aria-hidden":`true`,children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function H0(e){let t=(0,$.c)(51),{item:n,onFile:r,children:i}=e,{dark:a}=Gc(),o;t[0]===n.reviewState?o=t[1]:(o=Jr(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)(V0,{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)(_r,{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)(Je,{variant:P0[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=q0(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)(X,{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)(Io,{"aria-hidden":`true`,className:`size-3`}),t[19]=x):x=t[19];let S;t[20]===b?S=t[21]:(S=(0,Q.jsx)(Ts,{render:b,children:x}),t[20]=b,t[21]=S);let C;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(tt,{children:`Open on GitHub`}),t[22]=C):C=t[22];let w;t[23]===S?w=t[24]:(w=(0,Q.jsxs)(ke,{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)(X,{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)(vf,{"aria-hidden":`true`}),(0,Q.jsx)(_r,{text:d})]}):(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-xs`,children:[(0,Q.jsx)(vf,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(_r,{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)(YA,{file:{name:u??`review.diff`,contents:n.diffHunk,lang:`diff`},options:{theme:pu,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)(SM,{text:n.body,className:Y(`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 U0={passed:{Icon:el,label:`Passed`,color:`text-add-fg`},failed:{Icon:tf,label:`Failed`,color:`text-del-fg`},running:{Icon:Ge,label:`Running`,color:`text-muted-foreground`}};function W0(e){let t=(0,$.c)(34),{pull:n}=e,r;t[0]!==n.checks||t[1]!==n.checksSummary||t[2]!==n.checksTruncated?(r=Aa(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=Cr(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:I0,children:[s,(0,Q.jsx)(j0,{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(G0)}),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=Iq(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)(_r,{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)(j0,{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 G0(e,t){let n=Mo(e),r=ri(e.durationMs),i=U0[n],a=i.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)(a,{role:`img`,"aria-label":i.label,className:Y(`size-3.5 shrink-0`,i.color)}),(0,Q.jsx)(_r,{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)(ke,{children:[(0,Q.jsxs)(Ts,{render:(0,Q.jsx)(`a`,{href:e.detailsUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Details for ${e.name} on GitHub`,className:Ki({variant:`ghost`,size:`sm`})}),children:[`Details`,(0,Q.jsx)(Io,{"aria-hidden":`true`,className:`size-2.75`})]}),(0,Q.jsxs)(tt,{children:[`Details for `,e.name,` on GitHub`]})]})]},`${e.name}:${t}`)}function K0(e){let t=(0,$.c)(28),{reason:n,retrying:i,onRetry:a,onBack:o}=e,s=hs(),c;t[0]===n?c=t[1]:(c=r(n),t[0]=n,t[1]=c);let{description:l,action:u}=c,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(k0,{}),t[2]=d):d=t[2];let f;t[3]!==u.kind||t[4]!==u.label||t[5]!==s?(f=u.kind===`settings`&&(0,Q.jsxs)(X,{variant:`outline`,onClick:()=>void s({to:`/settings/$section`,params:{section:`git`}}),children:[(0,Q.jsx)(Pp,{}),u.label]}),t[3]=u.kind,t[4]=u.label,t[5]=s,t[6]=f):f=t[6];let p;t[7]!==u.kind||t[8]!==u.label||t[9]!==u.url?(p=u.kind===`install`&&(0,Q.jsxs)(X,{variant:`outline`,nativeButton:!1,render:(0,Q.jsx)(`a`,{href:u.url,target:`_blank`,rel:`noreferrer`}),children:[(0,Q.jsx)(Io,{}),u.label]}),t[7]=u.kind,t[8]=u.label,t[9]=u.url,t[10]=p):p=t[10];let m;t[11]!==u.kind||t[12]!==u.label||t[13]!==u.text?(m=u.kind===`copy`&&(0,Q.jsxs)(X,{variant:`outline`,onClick:()=>At(u.text,`command`),children:[(0,Q.jsx)(er,{}),u.label]}),t[11]=u.kind,t[12]=u.label,t[13]=u.text,t[14]=m):m=t[14];let h;t[15]!==u.kind||t[16]!==a||t[17]!==i?(h=u.kind!==`install`&&(0,Q.jsx)(X,{variant:`outline`,disabled:i,onClick:a,children:`Try again`}),t[15]=u.kind,t[16]=a,t[17]=i,t[18]=h):h=t[18];let g;t[19]===o?g=t[20]:(g=(0,Q.jsx)(X,{variant:`ghost`,onClick:o,children:`Back to the review`}),t[19]=o,t[20]=g);let _;return t[21]!==l||t[22]!==f||t[23]!==p||t[24]!==m||t[25]!==h||t[26]!==g?(_=(0,Q.jsxs)(he,{title:`Pull request unavailable`,description:l,children:[d,f,p,m,h,g]}),t[21]=l,t[22]=f,t[23]=p,t[24]=m,t[25]=h,t[26]=g,t[27]=_):_=t[27],_}function q0(e){return Number.isFinite(Date.parse(e))?io(e):`unknown time`}var J0=ui(ao.check(Ro(te)));function Y0(e,t,n){return{to:`/reviews/$reviewId`,params:{reviewId:e.reviewId},search:{environment:e.environmentId===t?void 0:e.environmentId,entry:Jq(n),decision:void 0}}}function X0(e){return{entry:J0(e.entry)?e.entry:void 0,side:J0(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 Z0(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=Jq(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)(i2,{...v}),t[18]=v,t[19]=e),e}case`specs`:{let e;return t[20]===v?e=t[21]:(e=(0,Q.jsx)(i2,{...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)(u2,{...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)(E1,{...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)(N1,{...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)(s1,{...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)(Q$,{...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)($$,{...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)(t2,{...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)(e2,{...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)(Q0,{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 Q0(e){let t=(0,$.c)(23),{document:n,context:r,toolbarTarget:i,onOpen:a}=e,o=ns(),s=F(),c=hs(),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($0)].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)(he,{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(Y0(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)(F0,{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 $0(e){return e.connection}function e2(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)(dX,{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 t2(e){let t=(0,$.c)(17),{scope:n,context:r,path:i,onOpen:a,sideLabel:o}=e,s=`Timeline of ${i}`,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(Ap,{className:`size-4 shrink-0`}),t[0]=c):c=t[0];let l;t[1]===i?l=t[2]:(l=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[c,(0,Q.jsx)(_r,{text:i})]}),t[1]=i,t[2]=l);let u;t[3]!==s||t[4]!==l?(u=(0,Q.jsx)(V$,{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)(pX,{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 n2(e){let t=(0,$.c)(14),{scope:n,context:r,branch:i}=e,a=kF(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)(_r,{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 r2(e,t){return fi(t,e?`uncommitted spec change`:`uncommitted change`)}function i2(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;hQ(n,r);let p=Ec(r.connection),m=RP(n,f),h=gQ(n,r,m),g=nQ(n,r),_=!c&&g.review?.active?g.review:void 0,v;t[0]!==h||t[1]!==c?(v=c?h.filter(l2):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)(eL,{children:uc(Ic.surfaceFiles)}),t[7]=i):i=t[7];let o;t[8]===r?o=t[9]:(o=(0,Q.jsxs)(X,{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)(eL,{children:uc(Ic.surfaceHistory)}),t[12]=c):c=t[12];let l;t[13]===s?l=t[14]:(l=(0,Q.jsxs)(X,{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)(he,{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=_?cm(_,m.changes.map(c2),{specsApart:p}).flatMap(s2):[],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(o2)}:{},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)(n2,{scope:n,context:r,branch:m.branch?.name}),(0,Q.jsx)(v1,{scope:n,context:r,label:r2(c,y.length),items:y,controls:e,actionsOpen:u,onActionsOpenChange:d,actions:(0,Q.jsx)(K$,{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:bQ(..._.layers.map(a2),yQ(_.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)(J1,{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 a2(e,t){return vQ(e,t+1)}function o2(e){return e.path}function s2(e){return e.paths.map(t=>({path:t,note:pm(e)}))}function c2(e){return e.path}function l2(e){return im(e.path)}function u2(e){let t=(0,$.c)(14),{scope:n,context:r,interaction:i,onOpen:a,path:o}=e,{connection:s}=r;hQ(n,r);let c=RP(n,s),l;if(t[0]===o?l=t[1]:(l=[o],t[0]=o,t[1]=l),!gQ(n,r,c,l).find(e=>e.path===o)){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(he,{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)(J1,{...i.reveal?.compose?{commentRequest:i.reveal.nonce}:{},headerActions:(0,Q.jsx)(pQ,{label:`Timeline`,iconOnly:!0,icon:Ap,onClick:()=>a({kind:`timeline`,path:o})}),headerLeading:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(X,{variant:`ghost`,size:`xs`,"aria-label":`Open file`,onClick:()=>a({kind:`file`,path:o}),children:[(0,Q.jsx)(Of,{}),(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)(YJ,{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 d2=(e,t)=>fetch(e,{...t,credentials:`same-origin`,redirect:`error`,cache:`no-store`});function f2(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 p2(e,t,n){let r=(0,$.c)(17),i,a,o;r[0]!==t.connection||r[1]!==e||r[2]!==n?(o=No(n,t.connection.address,p()),i=Yr,a=Hu({connection:t.connection,scope:e,summary:n,delivery:{url:o,transport:d2}}),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=Vn(Dn(s));c=s,l=e,u=o,d=e!==void 0&&f2(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 m2(e){let t=(0,$.c)(10),{label:n,value:r,max:i,className:a}=e,o;t[0]===a?o=t[1]:(o=Y(`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 h2(e,t){let n=(0,$.c)(6),r;n[0]!==t.connection||n[1]!==e?(r=Us({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=wr(r.remove,i),o;return n[4]===a?o=n[5]:(o=gM(a),n[4]=a,n[5]=o),o}function g2(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=Us({connection:i.connection,reviewId:n}),t[0]=i.connection,t[1]=n,t[2]=c):c=t[2];let[l,u]=wr(c.close),d=h2(n,i),f=d.result,p=l.waiting||f.waiting,m;t[3]===f.waiting?m=t[4]:(m=e=>{f.waiting||s(e)},t[3]=f.waiting,t[4]=m);let h;t[5]!==u||t[6]!==p||t[7]!==r?(h=r===`open`&&(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,disabled:p,onClick:()=>u(),children:[(0,Q.jsx)(Td,{}),`Close review`]}),t[5]=u,t[6]=p,t[7]=r,t[8]=h):h=t[8];let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(X,{type:`button`,variant:`destructive`,size:`sm`}),_=(0,Q.jsx)(Jp,{}),t[9]=g,t[10]=_):(g=t[9],_=t[10]);let v;t[11]===p?v=t[12]:(v=(0,Q.jsxs)(UM,{disabled:p,render:g,children:[_,`Delete review…`]}),t[11]=p,t[12]=v);let y;t[13]!==h||t[14]!==v?(y=(0,Q.jsxs)(`div`,{className:`flex flex-col items-start`,children:[h,v]}),t[13]=h,t[14]=v,t[15]=y):y=t[15];let b;t[16]===l?b=t[17]:(b=q(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]=b);let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsxs)(qM,{children:[(0,Q.jsx)(YM,{children:`Delete review?`}),(0,Q.jsx)(XM,{children:`This permanently deletes every revision, proof asset, comment and mark owned by this review for everyone connected.`})]}),t[18]=x):x=t[18];let S;t[19]===f?S=t[20]:(S=q(f)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`The review could not be deleted. Try again.`}),t[19]=f,t[20]=S);let C;t[21]===f.waiting?C=t[22]:(C=(0,Q.jsx)(QM,{disabled:f.waiting,children:`Cancel`}),t[21]=f.waiting,t[22]=C);let w;t[23]!==d||t[24]!==a?(w=()=>{d.send(void 0,()=>{s(!1),a()})},t[23]=d,t[24]=a,t[25]=w):w=t[25];let T=f.waiting?`Deleting…`:`Delete`,E;t[26]!==f.waiting||t[27]!==w||t[28]!==T?(E=(0,Q.jsx)(X,{variant:`destructive`,disabled:f.waiting,onClick:w,children:T}),t[26]=f.waiting,t[27]=w,t[28]=T,t[29]=E):E=t[29];let D;t[30]!==C||t[31]!==E?(D=(0,Q.jsxs)(JM,{children:[C,E]}),t[30]=C,t[31]=E,t[32]=D):D=t[32];let O;t[33]!==S||t[34]!==D?(O=(0,Q.jsxs)(KM,{children:[x,S,D]}),t[33]=S,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==o||t[37]!==O||t[38]!==m||t[39]!==y||t[40]!==b?(k=(0,Q.jsxs)(HM,{open:o,onOpenChange:m,children:[y,b,O]}),t[36]=o,t[37]=O,t[38]=m,t[39]=y,t[40]=b,t[41]=k):k=t[41],k}function _2(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=Sm(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(v2);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)(y2,{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:Y(`size-1.5 shrink-0 rounded-full`,t&&`bg-brand`)}),(0,Q.jsxs)(`span`,{className:Y(`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:io(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)(y2,{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=Lq(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=io(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)(X,{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)(g2,{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 v2(e,t){return t.revision-e.revision}function y2(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 b2(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=Sm(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)(y2,{count:fi(r.removed.fileCount,`file`),children:`Removed`}),i=`flex flex-col divide-y border-y`,a=r.removed.groups.map(x2)}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)(w2,{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 x2(e,t){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2 wrap-anywhere`,children:[(0,Q.jsx)(w2,{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 S2(e){let t=(0,$.c)(2),{revision:n}=e,r;if(t[0]!==n){let e=Sm(n);r=(0,Q.jsxs)(`section`,{"aria-label":`Not proven`,className:`flex min-w-0 flex-col text-xs`,children:[(0,Q.jsx)(y2,{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(C2)})]}),t[0]=n,t[1]=r}else r=t[1];return r}function C2(e,t){return(0,Q.jsxs)(`li`,{className:`flex gap-1.5 py-2 wrap-anywhere`,children:[(0,Q.jsx)(qd,{"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 w2(e){let t=(0,$.c)(4),{paths:n}=e,r;t[0]===n?r=t[1]:(r=n.map(T2),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 T2(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 E2(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:Y(`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)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(X,{variant:`ghost`,size:`icon-sm`,className:`relative`,"aria-label":O2(e),"aria-current":e.key===r?`step`:void 0,onClick:()=>a(e.key)}),children:(0,Q.jsx)(`span`,{className:Y(`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)(D2,{stop:e,done:i(e)})})}),(0,Q.jsx)(tt,{side:`right`,children:O2(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)(TI,{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 D2(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)(ci,{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)(Fd,{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)(wf,{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)(Mf,{className:`size-3.5`}),t[5]=e):e=t[5],e}}}function O2(e){return e.kind===`briefing`?`Open the briefing`:`Go to ${pm(e)}`}function k2(e){let t=(0,$.c)(26),{revision:n}=e,r,i,a,o,s,c,l;if(t[0]!==n){let e=Sm(n),{recommendation:u}=e,d=u.value===`merge`,f=d?ci:vp;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(j2)})]}),r=`Recommendation`,i=`flex min-w-0 flex-col`;let m=!d&&`fill-current stroke-0`,h;t[9]===m?h=t[10]:(h=Y(`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(A2)}),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 A2(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 j2(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)(Yd,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:`min-w-0`,children:e.title}),(0,Q.jsx)(Io,{className:`size-3 shrink-0 text-muted-foreground`})]})},e.url)}var M2=Ha(e=>Zr(t=>{if(!e)return;let n=URL.createObjectURL(new Blob([Vr(e)],{type:e.mediaType}));return t.addFinalizer(()=>URL.revokeObjectURL(n)),n}));function N2(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=M2(e),t[0]=e,t[1]=n),Yr(n)}function P2(e,t,n){let r=(0,$.c)(4),i;return r[0]!==t.connection||r[1]!==n||r[2]!==e?(i=e.review?Yi({...e.review,connection:t.connection,proofId:n}):zc({scope:e,connection:t.connection,proofId:n}),r[0]=t.connection,r[1]=n,r[2]=e,r[3]=i):i=r[3],Yr(i)}function F2(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 I2(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=Y(`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:To(i.checks).map((e,t)=>(0,Q.jsx)(R2,{check:e,target:F2(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)(z2,{scope:n,context:r,asset:e,target:F2(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 L2(e){return e===`pass`?el:e===`fail`?tf:Zd}function R2(e){let t=(0,$.c)(36),{check:n,target:r}=e,i=n.result===`fail`,a;t[0]===n.result?a=t[1]:(a=L2(n.result),t[0]=n.result,t[1]=a);let o=a,s=n.name,c;t[2]===n.result?c=t[3]:(c=Tr(n.result),t[2]=n.result,t[3]=c);let l=`${s}: ${c}`,u=n.result,d=i&&`border-destructive/50 bg-destructive/5`,f;t[4]===d?f=t[5]:(f=Y(`rounded-lg border px-3 py-2`,d),t[4]=d,t[5]=f);let p=n.result===`pass`&&`text-graph-2`,m=i&&`text-destructive`,h;t[6]!==p||t[7]!==m?(h=Y(`size-4 shrink-0`,p,m),t[6]=p,t[7]=m,t[8]=h):h=t[8];let g;t[9]!==o||t[10]!==h?(g=(0,Q.jsx)(o,{"aria-hidden":!0,className:h}),t[9]=o,t[10]=h,t[11]=g):g=t[11];let _;t[12]===n.name?_=t[13]:(_=(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 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=Y(`shrink-0 text-xs`,v),t[14]=v,t[15]=y);let b;t[16]===n.result?b=t[17]:(b=Tr(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 z2(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)(ff,{"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)(_r,{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=Va(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)(B2,{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 B2(e){let t=(0,$.c)(10),{scope:n,context:r,id:i,title:a,video:o}=e,[s,c]=(0,Z.useState)(!1),l=P2(n,r,i),u;t[0]===l?u=t[1]:(u=Vn(Dn(l)),t[0]=l,t[1]=u);let d=N2(u);if(q(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 f;return t[5]!==s||t[6]!==a||t[7]!==d||t[8]!==o?(f=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)(AF,{onOpenChange:e=>!e&&c(!1),children:[(0,Q.jsx)(jF,{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)(FF,{className:`max-h-[92svh] overflow-auto sm:max-w-[min(92vw,90rem)]`,children:[(0,Q.jsxs)(IF,{children:[(0,Q.jsx)(RF,{children:a}),(0,Q.jsx)(zF,{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)(X,{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]=f):f=t[9],f}function V2(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 H2(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=Sm(n),l=u.proven.checks.length+u.proven.assets.length===0,d=u.proven.checks.filter(U2),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:[`${fi(p,`check`)} passed`,f>0&&`${f} failed`,m>0&&fi(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)(V2,{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=Xr(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)(he,{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)(I2,{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 U2(e){return e.result===`fail`}function W2(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=Mi({base:r.base,tip:r.headOid}),t[0]=r.base,t[1]=r.headOid,t[2]=d):d=t[2];let f=s??G2,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)(e$,{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 G2(){}function K2(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)($d,{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)(mp,{}),t[9]=v,t[10]=y):(v=t[9],y=t[10]);let b;t[11]===c?b=t[12]:(b=(0,Q.jsxs)(X,{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)(W2,{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 q2(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)($d,{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)(W2,{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 J2(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 Y2(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(e4),j=r.filter($2),M=dm(r.flatMap(Q2),i),N=e.filter(o).length,P=[...e,...j].find(e=>!o(e)),F=ym(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(Z2),t[31]=r,t[32]=R);let z=R,B=new Set(F.questions.flatMap(X2)),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=io(c.publishedAt),t[39]=c.publishedAt,t[40]=ee);let te;t[41]===ee?te=t[42]:(te=(0,Q.jsx)(`span`,{children:ee}),t[41]=ee,t[42]=te);let q;t[43]!==p||t[44]!==G||t[45]!==te?(q=(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,te,p]}),t[43]=p,t[44]=G,t[45]=te,t[46]=q):q=t[46];let ne;t[47]===u?ne=t[48]:(ne=(0,Q.jsx)(_r,{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)(k2,{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:[fi(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:[q,(0,Q.jsxs)(`h2`,{className:`text-briefing-title font-semibold wrap-anywhere`,children:[ne,(0,Q.jsxs)(`span`,{className:`block`,children:[sm(e.length),`.`]})]}),re,(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[P?(0,Q.jsxs)(X,{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 ${pm(P)}`}),(0,Q.jsx)(jd,{})]}):(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm font-medium text-graph-2`,children:[(0,Q.jsx)(ci,{className:`size-4`}),`Everything in this change is reviewed`]}),V&&(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,size:`lg`,onClick:()=>s(V.key),children:[(0,Q.jsx)(nc,{}),`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)(V2,{id:`briefing-questions`,aside:F.questions.length,children:`Needs your decision`}),F.questions.map(e=>(0,Q.jsx)(K2,{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)(a4,{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)(J2,{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)(b2,{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)(V2,{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)(i4,{title:`New`,parts:F.added,review:n,onGo:s}),(0,Q.jsx)(i4,{title:`Changed`,parts:F.changed,review:n,onGo:s}),(0,Q.jsx)(i4,{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)(J2,{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)(S2,{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)(H2,{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)(J2,{margin:J,children:ge}),t[89]=J,t[90]=ge,t[91]=y):y=t[91],g=J2,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 ${fi(e.length,`decision`)} · ${M.reviewed} of ${fi(M.total,`file`)} reviewed`;t[93]===_e?D=t[94]:(D=(0,Q.jsx)(V2,{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=dm(e.paths,i),r=_m(e.layer).join(` → `)||`No changed code`,c=B.has(e.number);return(0,Q.jsx)(t4,{stop:e,onGo:s,detail:r,current:e.key===P?.key,children:i=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(n4,{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)(nc,{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=dm(e.paths,i);return(0,Q.jsx)(t4,{stop:e,onGo:s,current:e.key===P?.key,children:()=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:Y(`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)(wf,{className:`size-3`}):(0,Q.jsx)(Mf,{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:fm(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 X2(e){return e.decision===void 0?[]:[e.decision]}function Z2(e){return e.kind===`unexplained`}function Q2(e){return e.paths}function $2(e){return e.kind===`unexplained`||e.kind===`specs`}function e4(e){return e.kind===`decision`}function t4(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?pm(n):`${pm(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??pm(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:Y(`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)(_r,{text:l,renderTrigger:u})}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function n4(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=Y(`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)(ci,{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 r4={New:`default`,Changed:`outline`,Removed:`destructive`};function i4(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)(Je,{variant:r4[n],children:n})}),(0,Q.jsxs)(_r,{className:`min-w-0 flex-1 leading-4.5`,text:e.detail?`${e.label} · ${e.detail}`:e.label,children:[(0,Q.jsx)(`span`,{className:Y(`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)(a4,{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 a4(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=Y(u),t[0]=u,t[1]=d);let f;t[2]!==c.id||t[3]!==i?(f=()=>i(om(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)(jd,{}),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)(X,{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 o4(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=bm(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=xm(i,n);let e=pa(i.proof,h.id),r;t[21]!==u||t[22]!==n.paths?(r=dm(n.paths,u),t[21]=u,t[22]=n.paths,t[23]=r):r=t[23],y=r,v=J2,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)(q2,{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)(u4,{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:To(e.checks).map(s4)}),(0,Q.jsxs)(X,{variant:`link`,size:`xs`,className:`self-start`,onClick:()=>m(`briefing`),children:[`All proof for this review`,(0,Q.jsx)(jd,{"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)(Je,{variant:`brand-soft`,children:[(0,Q.jsx)($d,{}),` 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)(Je,{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)(nc,{}),` 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)(Je,{variant:`outline`,children:[(0,Q.jsx)(ci,{}),` 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)(f4,{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)(m4,{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)(X,{variant:`outline`,size:`xs`,className:`max-w-full`,onClick:()=>m(e.stop),children:[(0,Q.jsx)(_r,{text:qn(e.path)}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.stop===`specs`?`· in Specs`:`· shown in decision ${i.layers.findIndex(t=>om(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 s4(e){return(0,Q.jsxs)(`li`,{className:Y(`flex items-start gap-1.5 wrap-anywhere`,e.result===`fail`&&`text-destructive`),children:[e.result===`fail`?(0,Q.jsx)(tf,{className:`mt-px size-3.5 shrink-0`}):(0,Q.jsx)(el,{className:`mt-px size-3.5 shrink-0 text-graph-2`}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[e.name,` · `,Tr(e.result)]})]},e.name)}function c4(e){return e===`new`?`New`:e===`changed`?`Changed`:`Removed`}var l4={new:`default`,changed:`outline`,removed:`destructive`};function u4(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(d4),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 d4(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)(Je,{variant:l4[e.change],children:c4(e.change)})]},e.part.id)}function f4(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)(SM,{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)(X,{variant:`link`,size:`xs`,onClick:()=>i(p4),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 p4(e){return!e}function m4(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=_m(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=fi(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(h4)}),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=fi(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)(g4,{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 h4(e,t){return(0,Q.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1.5`,children:[t>0&&(0,Q.jsx)(jd,{className:`size-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0`,children:e})]},`${e}:${t}`)}function g4(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:Y(`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:Y(`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)(_4,{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)(_r,{text:c,renderTrigger:l}),t[10]=l,t[11]=c,t[12]=u):u=t[12],u}function _4(e){let t=(0,$.c)(7),{step:n}=e,r;t[0]===n?r=t[1]:(r=gm(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=Y(`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 v4(e){let t=(0,$.c)(33),n;t[0]===e?n=t[1]:(n=Ll(e),t[0]=e,t[1]=n);let[r,i]=wr(n);if(r.kind===`loading`)return null;if(r.kind===`failure`){let e;t[2]===r.error?e=t[3]:(e=(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r.error}),t[2]=r.error,t[3]=e);let n;t[4]===i?n=t[5]:(n=(0,Q.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>i(`refresh`),children:`Read agent connection again`}),t[4]=i,t[5]=n);let a;return t[6]!==e||t[7]!==n?(a=(0,Q.jsxs)(`section`,{"aria-label":`Agent feedback`,className:`flex flex-col gap-2`,children:[e,n]}),t[6]=e,t[7]=n,t[8]=a):a=t[8],a}let a;t[9]!==e.writable||t[10]!==r.session?(a=r.session?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`text-xs break-all text-muted-foreground`,children:[`Connected session: `,r.session]}),e.writable?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Only saved feedback is sent. Sending keeps the review open.`}):null]}):null,t[9]=e.writable,t[10]=r.session,t[11]=a):a=t[11];let o;t[12]===r.status?o=t[13]:(o=r.status?(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:r.status}):null,t[12]=r.status,t[13]=o);let s;t[14]===r.reason?s=t[15]:(s=r.reason?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r.reason}):null,t[14]=r.reason,t[15]=s);let c;t[16]===r.deliveryError?c=t[17]:(c=r.deliveryError?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r.deliveryError}):null,t[16]=r.deliveryError,t[17]=c);let l;t[18]!==i||t[19]!==r.canDisconnect||t[20]!==r.canSend||t[21]!==r.sending||t[22]!==r.showActions?(l=r.showActions?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(X,{size:`sm`,disabled:!r.canSend,onClick:()=>i(`send`),children:r.sending?`Sending feedback…`:`Send feedback`}),(0,Q.jsx)(X,{size:`sm`,variant:`outline`,disabled:!r.canDisconnect,onClick:()=>i(`disconnect`),children:`Disconnect session`})]}):null,t[18]=i,t[19]=r.canDisconnect,t[20]=r.canSend,t[21]=r.sending,t[22]=r.showActions,t[23]=l):l=t[23];let u;t[24]===r.errors?u=t[25]:(u=r.errors.map(y4),t[24]=r.errors,t[25]=u);let d;return t[26]!==a||t[27]!==o||t[28]!==s||t[29]!==c||t[30]!==l||t[31]!==u?(d=(0,Q.jsxs)(`section`,{"aria-label":`Agent feedback`,className:`flex min-w-0 flex-col gap-2`,children:[a,o,s,c,l,u]}),t[26]=a,t[27]=o,t[28]=s,t[29]=c,t[30]=l,t[31]=u,t[32]=d):d=t[32],d}function y4(e,t){return(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:e},t)}function b4(e){let t=(0,$.c)(3),{current:n,onGo:r,code:i,...a}=e,{stops:o,items:s}=a,c=o.find(S4),l=o.find(x4),[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":pm(c),className:`flex min-w-0 scroll-mt-4 flex-col gap-5`,children:[(0,Q.jsx)(w4,{eyebrow:`After the decisions`,title:`Not explained`,lead:c.paths.length>0?`${c.paths.length} changed ${Ya(c.paths.length,`file has`,`files have`)} no decision pointing at ${Ya(c.paths.length,`it`,`them`)}. Read ${Ya(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:[fi(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:`grid min-h-7.5 min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-x-2.5 gap-y-1 py-1 pr-1.5 pl-0.5`,children:[(0,Q.jsx)(nc,{className:`size-3.5 shrink-0 text-warn`}),(0,Q.jsx)(_r,{text:e.path,className:`font-mono text-caption leading-4`,render:(0,Q.jsx)(`span`,{title:e.path})}),(0,Q.jsx)(`span`,{className:`col-start-2 min-w-0 text-xs leading-4 text-muted-foreground tabular-nums`,children:e.ranges.length>0?uP(e.ranges):`whole file`}),(0,Q.jsxs)(X,{type:`button`,variant:`link`,size:`sm`,className:`col-start-2 justify-self-start`,onClick:()=>r(e.stop),children:[`Read in `,C4(o,e.stop),(0,Q.jsx)(lr,{})]})]},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:[fi(c.paths.length,`file`),` no decision points at`]}),(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[dm(c.paths,s).reviewed,` of`,` `,c.paths.length,` reviewed`]})]}),i(c)]})]}),m=l&&(0,Q.jsxs)(`section`,{ref:f(l.key),"aria-label":pm(l),className:`flex min-w-0 scroll-mt-4 flex-col gap-5`,children:[(0,Q.jsx)(w4,{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)(J2,{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)(T4,{...a})}),children:h})}function x4(e){return e.kind===`specs`}function S4(e){return e.kind===`unexplained`}function C4(e,t){let n=e.find(e=>e.key===t);return n?n.kind===`decision`?`decision ${n.number}`:pm(n):t}function w4(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=Y(`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=Y(`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 T4(e){let t=(0,$.c)(111),{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=dm(n.flatMap(O4),a);let e=n.find(D4),i=n.find(E4),s;t[21]===o?s=t[22]:(s=cn(o),t[21]=o,t[22]=s),y=s.open;let c;t[23]===r?c=t[24]:(c=Sm(r),t[23]=r,t[24]=c);let u=c.notProven.length,d;t[25]===r.content.proof?d=t[26]:(d=Vo(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)(ci,{className:`size-2.75`,strokeWidth:3})}):(0,Q.jsx)(Kn,{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=fi(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=fi(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)(k4,{label:`Checks`,children:B}),t[49]=B,t[50]=V);let H;t[51]===u?H=t[52]:(H=(0,Q.jsx)(k4,{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=fi(e?.paths.length??0,`file`);t[57]===U?D=t[58]:(D=(0,Q.jsx)(k4,{label:`Not explained`,children:U}),t[57]=U,t[58]=D),_=k4,b=`Specs`,C=fi(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)(k4,{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)(k4,{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;t[75]!==d.connection||t[76]!==r.reviewId||t[77]!==r.revision?(L=(0,Q.jsx)(v4,{connection:d.connection,reviewId:r.reviewId,reviewRevision:r.revision,writable:!0}),t[75]=d.connection,t[76]=r.reviewId,t[77]=r.revision,t[78]=L):L=t[78];let R,z;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>p(!0),z=(0,Q.jsx)(mp,{}),t[79]=R,t[80]=z):(R=t[79],z=t[80]);let B;t[81]===f?B=t[82]:(B=(0,Q.jsxs)(X,{ref:h,type:`button`,variant:`default`,"aria-expanded":f,onClick:R,children:[z,`Ask the agent`]}),t[81]=f,t[82]=B);let V;t[83]!==m||t[84]!==f||t[85]!==d||t[86]!==r.base||t[87]!==r.headOid||t[88]!==u?(V=f&&(0,Q.jsx)(e$,{scope:u,context:d,anchor:Mi({base:r.base,tip:r.headOid}),onClose:()=>{p(!1),m?.focus()}}),t[83]=m,t[84]=f,t[85]=d,t[86]=r.base,t[87]=r.headOid,t[88]=u,t[89]=V):V=t[89];let H;t[90]===s?H=t[91]:(H=s?.state===`open`&&(0,Q.jsxs)(`a`,{href:s.url,target:`_blank`,rel:`noopener noreferrer`,className:Ki({variant:`outline`}),children:[`Merge on GitHub`,(0,Q.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[`#`,s.number]}),(0,Q.jsx)(ff,{})]}),t[90]=s,t[91]=H);let U;t[92]!==c||t[93]!==d.connection||t[94]!==s||t[95]!==i?(U=c&&i?(0,Q.jsx)(oK,{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)(Td,{className:`mt-px size-3.5 shrink-0`}),`Archive appears here once #`,s.number,` is merged.`]}),t[92]=c,t[93]=d.connection,t[94]=s,t[95]=i,t[96]=U):U=t[96];let W;t[97]!==L||t[98]!==B||t[99]!==V||t[100]!==H||t[101]!==U?(W=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t pt-3`,children:[L,B,V,H,U]}),t[97]=L,t[98]=B,t[99]=V,t[100]=H,t[101]=U,t[102]=W):W=t[102];let G;return t[103]!==x||t[104]!==S||t[105]!==I||t[106]!==W||t[107]!==O||t[108]!==k||t[109]!==A?(G=(0,Q.jsxs)(`section`,{"aria-label":O,className:k,children:[A,x,S,I,W]}),t[103]=x,t[104]=S,t[105]=I,t[106]=W,t[107]=O,t[108]=k,t[109]=A,t[110]=G):G=t[110],G}function E4(e){return e.kind===`specs`}function D4(e){return e.kind===`unexplained`}function O4(e){return e.paths}function k4(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 A4(e,t){let n=n=>{if(n.source!==e.contentWindow)return;let r=ho(n.data);r!==null&&t(r)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function j4(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=ja(r??``),i;t[15]!==l||t[16]!==c?(i=e=>{let t=l[e-1];t&&c(om(t.id))},t[15]=l,t[16]=c,t[17]=i):i=t[17],d=i,u=J2,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:Y(`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)(ci,{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)(Ld,{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=io(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)(Je,{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)(Ip,{}),`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)(hn,{label:`Loading the agent's page`})}):(0,Q.jsx)(`iframe`,{ref:e=>e?A4(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 M4(e){let t=(0,$.c)(42),{label:n,shortLabel:r,compactLabel:i,stops:o,current:s,onGo:c,onPrevious:l,onNext:u,children:d}=e,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(zd,{}),t[0]=f):f=t[0];let p;t[1]===l?p=t[2]:(p=(0,Q.jsx)(N4,{label:`Previous stop`,keys:Ic.previousStop,onClick:l,children:f}),t[1]=l,t[2]=p);let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(lr,{}),t[3]=m):m=t[3];let h;t[4]===u?h=t[5]:(h=(0,Q.jsx)(N4,{label:`Next stop`,keys:Ic.nextStop,onClick:u,children:m}),t[4]=u,t[5]=h);let g=`${n}, jump to a stop`,_;t[6]===g?_=t[7]:(_=(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`min-w-0 shrink-0 @md/review:shrink`,"aria-label":g}),t[6]=g,t[7]=_);let v=`${n}, jump to a stop`,y;t[8]===i?y=t[9]:(y=(0,Q.jsx)(`span`,{className:`@md/review:hidden`,children:i}),t[8]=i,t[9]=y);let b;t[10]===r?b=t[11]:(b=(0,Q.jsx)(`span`,{className:`hidden @md/review:inline @2xl/review:hidden`,children:r}),t[10]=r,t[11]=b);let x;t[12]===n?x=t[13]:(x=(0,Q.jsx)(`span`,{className:`hidden @2xl/review:inline`,children:n}),t[12]=n,t[13]=x);let S;t[14]!==x||t[15]!==v||t[16]!==y||t[17]!==b?(S=(0,Q.jsxs)(_r,{className:`min-w-0 tabular-nums`,text:v,children:[y,b,x]}),t[14]=x,t[15]=v,t[16]=y,t[17]=b,t[18]=S):S=t[18];let C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(a,{className:`hidden @md/review:block`,"data-icon":`inline-end`}),t[19]=C):C=t[19];let w;t[20]!==S||t[21]!==_?(w=(0,Q.jsxs)(Lr,{render:_,children:[S,C]}),t[20]=S,t[21]=_,t[22]=w):w=t[22];let T;if(t[23]!==s||t[24]!==c||t[25]!==o){let e;t[27]!==s||t[28]!==c?(e=e=>(0,Q.jsx)(br,{"aria-current":e.key===s?`step`:void 0,onClick:()=>c(e.key),children:e.kind===`briefing`?`Open the briefing`:pm(e)},e.key),t[27]=s,t[28]=c,t[29]=e):e=t[29],T=o.map(e),t[23]=s,t[24]=c,t[25]=o,t[26]=T}else T=t[26];let E;t[30]===T?E=t[31]:(E=(0,Q.jsx)(Li,{side:`top`,children:T}),t[30]=T,t[31]=E);let D;t[32]!==w||t[33]!==E?(D=(0,Q.jsxs)(ro,{children:[w,E]}),t[32]=w,t[33]=E,t[34]=D):D=t[34];let O;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(eL,{children:uc(Ic.previousStop)}),t[35]=O):O=t[35];let k;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsxs)(tL,{className:`mr-1.5 hidden @2xl/review:inline-flex`,children:[O,(0,Q.jsx)(eL,{children:uc(Ic.nextStop)})]}),t[36]=k):k=t[36];let A;return t[37]!==d||t[38]!==D||t[39]!==p||t[40]!==h?(A=(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:[p,h,D,k,d]})}),t[37]=d,t[38]=D,t[39]=p,t[40]=h,t[41]=A):A=t[41],A}function N4(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)(X,{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)(Ts,{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=uc(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(eL,{children:l}),t[9]=l,t[10]=u);let d;t[11]!==n||t[12]!==u?(d=(0,Q.jsxs)(tt,{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)(ke,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function P4(e,t){let n=(0,$.c)(6),r;n[0]===e?r=n[1]:(r=ut(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=fa(r,i),o;return n[3]!==a||n[4]!==t?(o=e=>{a(t).then(t=>{oe(t)&&e()})},n[3]=a,n[4]=t,n[5]=o):o=n[5],o}var F4=class extends Z.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,Q.jsx)(g,{description:ai(this.state.error),onRetry:()=>this.props.reset(()=>this.setState({error:null}))}):this.props.children}};function I4(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=P4(r,i),l;t[0]===s?l=t[1]:(l=(0,Q.jsx)(hn,{label:s}),t[0]=s,t[1]=l);let u;t[2]!==n||t[3]!==o||t[4]!==c?(u=(0,Q.jsx)(F4,{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 L4(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],Qs(Ic.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],Qs(Ic.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],Qs(Ic.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],Qs(Ic.openToSide,v,y);let b=kF(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=N({connection:r.connection,reviewId:n.reviewId}),t[28]=r.connection,t[29]=n.reviewId,t[30]=T):T=t[30];let E=Tm(n,Vn(Dn(Yr(T))),{specsApart:Ec(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)(nq,{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)(R4,{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:hJ(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 R4(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}=nL(),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?B4(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=Yq(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=Y(`@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=eQ(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)(oZ,{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)(cQ,{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:Y(`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)(I4,{documentKey:y??void 0,connection:a.connection,scope:i,children:(0,Q.jsx)(Z0,{scope:i,context:a,document:T,onOpen:s,onBrowse:z4,sideLabel:mJ(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 z4(){}function B4(e){return e===0?`left`:`right`}function V4(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)(H4,{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)(X,{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)(W4,{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 H4(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:f,explanations:p,commentLabel:m}=e,h;t[0]!==o.connection||t[1]!==i||t[2]!==r.reviewId||t[3]!==r.revision?(h=ra({connection:o.connection,reviewId:r.reviewId,revision:r.revision,paths:i.map(x1)}),t[0]=o.connection,t[1]=i,t[2]=r.reviewId,t[3]=r.revision,t[4]=h):h=t[4];let g=Yr(h),_=Vn(Dn(g)),v=bQ(...(p?r.content.layers:[]).map(U4),f?yQ(r.content.notExplained):{}),y;t[5]!==o.connection||t[6]!==r.reviewId?(y=Us({connection:o.connection,reviewId:r.reviewId}),t[5]=o.connection,t[6]=r.reviewId,t[7]=y):y=t[7];let b=y,[x,S]=wr(b.mark),[C,w]=wr(b.unmark),T=i.flatMap(e=>{let t=_?.diffs.find(t=>t.paths.includes(e.path)),n=GP(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:v[e.path]??[],comment:HQ(r,e.path),review:{path:e.path,fingerprint:i,reviewed:a,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(yY,{className:`cursor-pointer`,checked:a,"aria-label":Ke(e.path,a?`reviewed`:`unreviewed`),disabled:!i||x.waiting||C.waiting,onCheckedChange:()=>i&&(a?w({kind:`file`,path:e.path,headBlobOid:i}):S({kind:`file`,revision:r.revision,path:e.path,headBlobOid:i}))})}),(0,Q.jsx)(tt,{children:Ke(e.path,a?`reviewed`:`unreviewed`)})]}),o>=0&&(0,Q.jsx)(Je,{variant:`brand-soft`,title:`Stop ${o+1}`,className:`ml-1`,children:o+1})]})}}]}),E;t[8]===g?E=t[9]:(E=De(g)&&(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)(Pn,{className:`h-7 w-full`}),(0,Q.jsx)(Pn,{className:`h-44 w-full`})]}),t[8]=g,t[9]=E);let D;t[10]===g?D=t[11]:(D=q(g)&&(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]=g,t[11]=D);let O;t[12]!==x||t[13]!==C?(O=(q(x)||q(C))&&(0,Q.jsx)(`p`,{role:`alert`,className:`p-3 text-destructive`,children:`The file mark could not be updated. Try again.`}),t[12]=x,t[13]=C,t[14]=O):O=t[14];let k=T.length>0&&(0,Q.jsx)(S$,{scope:a,context:o,interaction:{active:l,worktreeId:r.reviewId,entry:n},entries:T,fullHeight:!0,threadMargin:u,decision:d,...m?{commentLabel:m}:{},onReview:e=>{let t=e.review;!t?.fingerprint||x.waiting||C.waiting||(t.reviewed?w({kind:`file`,path:t.path,headBlobOid:t.fingerprint}):S({kind:`file`,revision:r.revision,path:t.path,headBlobOid:t.fingerprint}))}}),A=(_||q(g))&&i.filter(e=>!T.some(t=>t.path===e.path)).map(e=>{let t=_?.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?aN(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)(n$,{compact:u,title:e.title,text:e.text}),e.published&&(0,Q.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap`,children:e.published.join(`
1403
+ `)})]},e.id))]},e.path)}),j;return t[15]!==E||t[16]!==D||t[17]!==O||t[18]!==k||t[19]!==A?(j=(0,Q.jsxs)(Q.Fragment,{children:[E,D,O,k,A]}),t[15]=E,t[16]=D,t[17]=O,t[18]=k,t[19]=A,t[20]=j):j=t[20],j}function U4(e,t){return vQ(e,t+1)}function W4(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,d;t[0]!==i.connection||t[1]!==a||t[2]!==n.reviewId||t[3]!==n.revision?(d=u({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]=d):d=t[4];let f=Yr(d),p;if(t[5]!==a||t[6]!==f||t[7]!==n){let e=Vn(Dn(f));p=e?.kind===`text`?{...CQ(`review:${n.reviewId}:${n.revision}:${a}`,a,e.text),comment:HQ(n,a)}:void 0,t[5]=a,t[6]=f,t[7]=n,t[8]=p}else p=t[8];let m=p,h=o?`Step ${o.title}`:`File ${a}`,g;t[9]!==l||t[10]!==o?(g=o&&(0,Q.jsx)(n$,{compact:l,title:o.title,text:o.text}),t[9]=l,t[10]=o,t[11]=g):g=t[11];let _;t[12]!==s||t[13]!==l||t[14]!==i||t[15]!==m||t[16]!==a||t[17]!==f||t[18]!==n.reviewId||t[19]!==n.revision||t[20]!==r||t[21]!==o?(_=m?(0,Q.jsx)(S$,{compactHeight:l,decision:l,scope:r,context:i,interaction:{active:s,worktreeId:n.reviewId,entry:`file:${n.revision}:${a}`},entries:[m],fullHeight:!0}):(0,Q.jsxs)(`div`,{className:`p-4 text-sm break-all`,children:[(0,Q.jsxs)(`p`,{children:[a,` ·`,` `,De(f)?`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(`
1404
+ `)})]}),t[12]=s,t[13]=l,t[14]=i,t[15]=m,t[16]=a,t[17]=f,t[18]=n.reviewId,t[19]=n.revision,t[20]=r,t[21]=o,t[22]=_):_=t[22];let v;return t[23]!==h||t[24]!==g||t[25]!==_?(v=(0,Q.jsxs)(`article`,{"aria-label":h,className:`flex min-h-0 shrink-0 flex-col border-t`,children:[g,_]}),t[23]=h,t[24]=g,t[25]=_,t[26]=v):v=t[26],v}function G4(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=e.url?(0,Q.jsx)(K4,{...e,url:e.url}):(0,Q.jsx)(J4,{...e}),t[0]=e,t[1]=n),n}function K4(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=bt({connection:r.connection,reviewId:n}),t[0]=r.connection,t[1]=n,t[2]=s):s=t[2];let c=Yr(s),l;t[3]===c?l=t[4]:(l=q(c)?void 0:Vn(Dn(c)),t[3]=c,t[4]=l);let u=l,d;t[5]===i?d=t[6]:(d=za(i),t[5]=i,t[6]=d);let f=d;if(u?.kind===`available`){let e;return t[7]!==a||t[8]!==u.pullRequest?(e=(0,Q.jsx)(q4,{pull:u.pullRequest,onOpen:a}),t[7]=a,t[8]=u.pullRequest,t[9]=e):e=t[9],e}let p;t[10]!==c||t[11]!==u?(p=!q(c)&&(u===void 0||u.kind===`not-linked`),t[10]=c,t[11]=u,t[12]=p):p=t[12];let m=p,h=m?`Reading pull request`:`GitHub unavailable. Open the Review panel to recover.`,g;t[13]===o?g=t[14]:(g=e=>o(e.currentTarget,!1),t[13]=o,t[14]=g);let _;t[15]===f?_=t[16]:(_=f&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{children:[`#`,f]}),(0,Q.jsx)(M0,{})]}),t[15]=f,t[16]=_);let v=m?`text-muted-foreground`:`inline-flex items-center gap-1 text-warn`,y;t[17]===m?y=t[18]:(y=!m&&(0,Q.jsx)(nc,{"aria-hidden":`true`,className:`size-3`}),t[17]=m,t[18]=y);let b=m?`Reading…`:`GitHub unavailable`,x;t[19]!==b||t[20]!==v||t[21]!==y?(x=(0,Q.jsxs)(`span`,{className:v,children:[y,b]}),t[19]=b,t[20]=v,t[21]=y,t[22]=x):x=t[22];let S;return t[23]!==x||t[24]!==h||t[25]!==g||t[26]!==_?(S=(0,Q.jsxs)(N0,{variant:`linked`,description:h,icon:Qf,onClick:g,children:[_,x]}),t[23]=x,t[24]=h,t[25]=g,t[26]=_,t[27]=S):S=t[27],S}function q4(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=Aa(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)(nc,{"aria-hidden":`true`,className:`size-3`}),Bi(n)]}):(0,Q.jsx)(j0,{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=Bo(n),t[8]=n,t[9]=d);let f;t[10]!==s||t[11]!==o||t[12]!==n?(f=o?Bi(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=E0(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)(M0,{}),t[21]=_):_=t[21];let v;t[22]===n?v=t[23]:(v=D0(n),t[22]=n,t[23]=v);let y;t[24]===n?y=t[25]:(y=Bo(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)(M0,{}),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)(N0,{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 J4(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=w({connection:n.connection,projectId:r}),t[0]=n.connection,t[1]=r,t[2]=s):s=t[2];let c=Yr(s),l,u,d,f,p,m;if(t[3]!==a||t[4]!==c||t[5]!==i){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e=q(c)?void 0:Vn(Dn(c));if(ji(void 0,e)){m=null;break bb0}u=e?.kind===`available`?It(e.pullRequests,a,i).find(Y4)?.pull:void 0,l=N0,d=u?`found`:`empty`,f=u?`Link pull request #${u.number} from the Review panel`:`Link pull request`,p=u?E0(u):void 0}t[3]=a,t[4]=c,t[5]=i,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[12]!==u||t[13]!==o?(h=e=>o(e.currentTarget,u===void 0),t[12]=u,t[13]=o,t[14]=h):h=t[14];let g;t[15]===u?g=t[16]:(g=u?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{children:[`#`,u.number,` found`]}),(0,Q.jsx)(M0,{}),(0,Q.jsx)(`span`,{className:`text-brand`,children:`Link`})]}):`Link pull request`,t[15]=u,t[16]=g);let _;return t[17]!==l||t[18]!==d||t[19]!==f||t[20]!==p||t[21]!==h||t[22]!==g?(_=(0,Q.jsx)(l,{variant:d,description:f,icon:p,onClick:h,children:g}),t[17]=l,t[18]=d,t[19]=f,t[20]=p,t[21]=h,t[22]=g,t[23]=_):_=t[23],_}function Y4(e){return e.heldBy===void 0}function X4(e,t,n,r){e&&n===t&&!e.matches(`:disabled`)&&(r(),document.activeElement===document.body&&e.focus())}function Z4(e){let t=(0,$.c)(60),{reviewId:n,context:i,onOpenPullRequest:a}=e,o=GZ(n),s={connection:i.connection,reviewId:n},c=$o(s),l=Yr(c),u=Br(c),d=bt(s),f=Yr(d),p=Br(d),[m,h]=wr(Us(s).setPullRequest),[g,_]=(0,Z.useState)(),v,y,b,x,S,C,w;if(t[0]!==i||t[1]!==g||t[2]!==o||t[3]!==m||t[4]!==l||t[5]!==f||t[6]!==n||t[7]!==h){w=Symbol.for(`react.early_return_sentinel`);bb0:{v=Vn(Dn(l));let e;t[15]===f?e=t[16]:(e=q(f)?{kind:`failed`}:Vn(Dn(f)),t[15]=f,t[16]=e),S=e,b=v?.review?.pullRequest;let a=Vn(Dn(m));y=g!==void 0&&!m.waiting&&(q(m)||a?.kind===`unavailable`)?b?`linked`:`unlinked`:g;let s;t[17]===m?s=t[18]:(s=q(m)&&(0,Q.jsx)(lo,{variant:`destructive`,className:`mt-2`,children:(0,Q.jsx)(rr,{children:ai(Yt(m.cause))})}),t[17]=m,t[18]=s);let c=a?.kind===`unavailable`&&(0,Q.jsx)(lo,{className:`mt-2`,children:(0,Q.jsxs)(rr,{children:[r(a.reason).description,` Try again after GitHub is available.`]})}),u;if(t[19]!==s||t[20]!==c?(u=(0,Q.jsxs)(Q.Fragment,{children:[s,c]}),t[19]=s,t[20]=c,t[21]=u):u=t[21],x=u,!q(l)&&v?.review&&!b){let e;t[22]!==y||t[23]!==o?(e=e=>{X4(e,`unlinked`,y,()=>_(void 0)),o.attach(e)},t[22]=y,t[23]=o,t[24]=e):e=t[24];let r;t[25]===h?r=t[26]:(r=e=>{_(`linked`),h({pullRequest:e})},t[25]=h,t[26]=r),w=(0,Q.jsx)(u3,{context:i,reviewId:n,projectId:v.review.projectId,branch:v.review.branch,pending:m.waiting,outcome:x,controlRef:e,onLink:r});break bb0}C=b?za(b):void 0}t[0]=i,t[1]=g,t[2]=o,t[3]=m,t[4]=l,t[5]=f,t[6]=n,t[7]=h,t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S,t[13]=C,t[14]=w}else v=t[8],y=t[9],b=t[10],x=t[11],S=t[12],C=t[13],w=t[14];if(w!==Symbol.for(`react.early_return_sentinel`))return w;let T=C,E=v?.review?.state===`closed`,D;t[27]!==E||t[28]!==y||t[29]!==b||t[30]!==m.waiting||t[31]!==T||t[32]!==h?(D=b&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(o3,{url:b,number:T}),(0,Q.jsxs)(ro,{children:[(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(Lr,{render:(0,Q.jsx)(X,{ref:e=>X4(e,`linked`,y,()=>_(void 0)),variant:`ghost`,size:`icon-sm`,"aria-label":`Pull request actions`,disabled:m.waiting}),children:(0,Q.jsx)(uf,{})})}),(0,Q.jsx)(tt,{children:`Pull request actions`})]}),(0,Q.jsxs)(Li,{align:`end`,className:`w-59`,children:[(0,Q.jsxs)(br,{render:(0,Q.jsx)(`a`,{href:b,target:`_blank`,rel:`noreferrer`}),children:[(0,Q.jsx)(Io,{}),`Open on GitHub`]}),(0,Q.jsxs)(br,{onClick:()=>At(b,`pull request link`),children:[(0,Q.jsx)(er,{}),`Copy link`]}),(0,Q.jsx)(bs,{}),(0,Q.jsxs)(br,{className:`items-start`,onClick:()=>{_(`unlinked`),h({pullRequest:void 0})},children:[(0,Q.jsx)(Qp,{className:`mt-0.5`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsxs)(`span`,{children:[`Unlink `,T?`#${T}`:`pull request`]}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:E?`The review stays closed and readable under Closed.`:`The review stays and follows its branch again.`})]})]})]})]})]}),t[27]=E,t[28]=y,t[29]=b,t[30]=m.waiting,t[31]=T,t[32]=h,t[33]=D):D=t[33];let O;t[34]!==l||t[35]!==u?(O=q(l)&&(0,Q.jsx)(lo,{variant:`destructive`,className:`mt-1`,children:(0,Q.jsxs)(rr,{children:[`Could not display this review.`,(0,Q.jsx)(X,{variant:`outline`,size:`xs`,onClick:u,children:`Try again`})]})}),t[34]=l,t[35]=u,t[36]=O):O=t[36];let k;t[37]!==v?.review||t[38]!==l?(k=!q(l)&&!v?.review&&(0,Q.jsx)(Pn,{className:`mt-1 h-8 w-full`}),t[37]=v?.review,t[38]=l,t[39]=k):k=t[39];let A;t[40]!==b||t[41]!==m.waiting?(A=m.waiting&&b&&(0,Q.jsx)(`p`,{role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Unlinking…`}),t[40]=b,t[41]=m.waiting,t[42]=A):A=t[42];let j;t[43]!==i||t[44]!==v||t[45]!==b||t[46]!==T||t[47]!==a||t[48]!==S||t[49]!==l||t[50]!==p||t[51]!==f?(j=!q(l)&&v?.review&&b&&(0,Q.jsx)(Q4,{url:b,projectId:v.review.projectId,context:i,number:T,pull:S,reviewHead:v.revision?.headOid,retrying:f.waiting,onRetry:p,onOpen:a}),t[43]=i,t[44]=v,t[45]=b,t[46]=T,t[47]=a,t[48]=S,t[49]=l,t[50]=p,t[51]=f,t[52]=j):j=t[52];let M;return t[53]!==x||t[54]!==D||t[55]!==O||t[56]!==k||t[57]!==A||t[58]!==j?(M=(0,Q.jsxs)(s3,{trailing:D,children:[O,k,A,j,x]}),t[53]=x,t[54]=D,t[55]=O,t[56]=k,t[57]=A,t[58]=j,t[59]=M):M=t[59],M}function Q4(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=Zt({connection:i.connection,projectId:r}),t[0]=i.connection,t[1]=r,t[2]=d):d=t[2];let f=Yr(d),p;if(t[3]!==f||t[4]!==n){let e=Vn(Dn(f))?.repository,r=Co(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)(e3,{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)($4,{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)(_r,{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)(i3,{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)(r3,{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 $4(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=Aa(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)(i3,{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)(O0,{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)(M0,{})]}),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)(j0,{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)(M0,{}),(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`outline-none`}),children:`Same head`}),(0,Q.jsxs)(tt,{children:[`The pull request’s head, `,Iq(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)(a3,{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)(nc,{"aria-hidden":`true`,className:`mt-0.5 size-3 shrink-0`}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[Bi(n),`.`,(0,Q.jsxs)(`span`,{className:`block font-mono font-normal wrap-anywhere text-muted-foreground`,children:[`PR at `,Iq(n.headSha),` · review read`,` `,r?Iq(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 e3(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)(t3,{}),`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)(X,{variant:`outline`,className:n3,onClick:()=>i(r),children:o}):(0,Q.jsx)(X,{variant:`outline`,className:n3,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 t3(){let e=(0,$.c)(1),t;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)){let n=E0({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 n3=`mt-2.5 w-full`;function r3(e){let t=(0,$.c)(27),{reason:n,retrying:i,onRetry:a}=e,o=hs(),s;t[0]===n?s=t[1]:(s=n?r(n):{description:`Porcelain could not read the pull request.`,action:{kind:`retry`,label:`Try again`}},t[0]=n,t[1]=s);let c=s,{action:l}=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(a3,{children:(0,Q.jsx)(k0,{})}),t[2]=u):u=t[2];let d;t[3]===c.description?d=t[4]:(d=(0,Q.jsx)(`p`,{className:`mt-2 text-xs leading-4.25 text-foreground-2`,children:c.description}),t[3]=c.description,t[4]=d);let f;t[5]!==l.kind||t[6]!==l.label||t[7]!==o?(f=l.kind===`settings`&&(0,Q.jsxs)(X,{variant:`outline`,className:Y(n3,`mt-2`),onClick:()=>void o({to:`/settings/$section`,params:{section:`git`}}),children:[(0,Q.jsx)(Pp,{"aria-hidden":`true`,strokeWidth:1.75,className:`size-3.5 text-muted-foreground`}),l.label]}),t[5]=l.kind,t[6]=l.label,t[7]=o,t[8]=f):f=t[8];let p;t[9]!==l.kind||t[10]!==l.label||t[11]!==l.url?(p=l.kind===`install`&&(0,Q.jsxs)(X,{variant:`outline`,className:Y(n3,`mt-2`),nativeButton:!1,render:(0,Q.jsx)(`a`,{href:l.url,target:`_blank`,rel:`noreferrer`}),children:[(0,Q.jsx)(Io,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),l.label]}),t[9]=l.kind,t[10]=l.label,t[11]=l.url,t[12]=p):p=t[12];let m;t[13]!==l.kind||t[14]!==l.label||t[15]!==l.text?(m=l.kind===`copy`&&(0,Q.jsxs)(X,{variant:`outline`,className:Y(n3,`mt-2`),onClick:()=>At(l.text,`command`),children:[(0,Q.jsx)(er,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),l.label]}),t[13]=l.kind,t[14]=l.label,t[15]=l.text,t[16]=m):m=t[16];let h;t[17]!==l.kind||t[18]!==a||t[19]!==i?(h=l.kind!==`install`&&(0,Q.jsxs)(X,{variant:l.kind===`retry`?`outline`:`ghost`,className:Y(n3,`mt-2`),disabled:i,onClick:a,children:[(0,Q.jsx)(Ep,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),`Try again`]}),t[17]=l.kind,t[18]=a,t[19]=i,t[20]=h):h=t[20];let g;return t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==m||t[25]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[u,d,f,p,m,h]}),t[21]=d,t[22]=f,t[23]=p,t[24]=m,t[25]=h,t[26]=g):g=t[26],g}function i3(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)(_r,{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 a3(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 o3(e){let t=(0,$.c)(10),{url:n,number:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(X,{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)(Io,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Q.jsxs)(Ts,{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)(tt,{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)(ke,{children:[o,c]}),t[7]=o,t[8]=c,t[9]=l):l=t[9],l}function s3(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 c3(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=zr(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)(i3,{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)(O0,{pull:n}),t[5]=n,t[6]=d);let f;t[7]!==l.label||t[8]!==l.tone?(f=(0,Q.jsx)(j0,{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)(M0,{}),(0,Q.jsx)(_r,{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)(a3,{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)(l3,{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)(X,{ref:s,className:`mt-2.5 w-full`,disabled:a,onClick:()=>o(n.url),children:[(0,Q.jsx)(so,{"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 l3(e){let t=(0,$.c)(9),{reviewId:n,number:r,context:i}=e,a;t[0]!==i.connection||t[1]!==n?(a=$o({connection:i.connection,reviewId:n}),t[0]=i.connection,t[1]=n,t[2]=a):a=t[2];let o=Vn(Dn(Yr(a))),s=o?.review?Nr(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 u3(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=Zt({connection:n.connection,projectId:i}),t[0]=n.connection,t[1]=i,t[2]=u):u=t[2];let d=Yr(u),f;t[3]===d?f=t[4]:(f=q(d)?void 0:Vn(Dn(d))?.repository,t[3]=d,t[4]=f);let p=f,[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),b;t[5]===l?b=t[6]:(b=e=>{y(!1),l(e)},t[5]=l,t[6]=b);let x=b,S;t[7]!==n.connection||t[8]!==i?(S=w({connection:n.connection,projectId:i}),t[7]=n.connection,t[8]=i,t[9]=S):S=t[9];let C=S,T=Yr(C),E=Br(C),D;t[10]!==c||t[11]!==o||t[12]!==T?(D=e=>{!o&&!T.waiting&&!De(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]!==p||t[19]!==T||t[20]!==r||t[21]!==x){N=Symbol.for(`react.early_return_sentinel`);bb0:{R=q(T)?void 0:Vn(Dn(T)),A=R?.kind===`available`?It(R.pullRequests,a,r):[],j=A.find(d3);let e=A[0]?.pull;if(ji(void 0,R)){N=null;break bb0}let i=()=>{if(e&&A.length===1)return(0,Q.jsx)(o3,{url:e.url,number:e.number});if(p&&A.length===0)return(0,Q.jsxs)(X,{variant:`ghost`,size:`sm`,nativeButton:!1,render:(0,Q.jsx)(`a`,{href:`https://github.com/${p}/compare/${encodeURIComponent(a)}?expand=1`,target:`_blank`,rel:`noreferrer`}),className:`ml-auto`,children:[`Create on GitHub`,(0,Q.jsx)(Io,{"aria-hidden":`true`})]})};k=s3,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=De(T)&&(0,Q.jsx)(Pn,{"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)(c3,{pull:t,heldBy:r,linkRef:j?.pull.number===t.number?O:void 0,context:n,pending:o,onLink:x},t.number)})}t[14]=O,t[15]=a,t[16]=n,t[17]=o,t[18]=p,t[19]=T,t[20]=r,t[21]=x,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=(q(T)||R?.kind===`unavailable`)&&(0,Q.jsx)(r3,{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]!==g||t[54]!==o||t[55]!==x||t[56]!==m||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=bi(m);_(t===void 0),t===void 0?y(!0):o||x(t)},children:[(0,Q.jsx)(ae,{ref:O,"aria-label":`Pull request link`,type:`url`,required:!0,placeholder:`https://github.com/…/pull/482`,value:m,onChange:e=>{h(e.target.value),_(!1)},disabled:o,"aria-invalid":g||void 0,className:`min-w-0 flex-1`}),(0,Q.jsxs)(X,{type:`submit`,variant:`outline`,"aria-label":`Link pull request`,className:`shrink-0`,disabled:o||m.trim()===``,children:[(0,Q.jsx)(so,{"aria-hidden":`true`,className:`size-3.5`}),o?`Linking…`:`Link`]})]}),t[51]=O,t[52]=j,t[53]=g,t[54]=o,t[55]=x,t[56]=m,t[57]=R,t[58]=W):W=t[58];let G;t[59]===g?G=t[60]:(G=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]=g,t[60]=G);let K=!v&&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 d3(e){return e.heldBy===void 0}var f3=`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 p3(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]:(_=qn(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`:At(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=jt({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":h3(o,s),title:i==null?n:`${n}\n${i}`,className:Y(f3,`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)(m3,{status:o,reviewStatus:s}),(0,Q.jsx)(Dw,{path:n,className:`size-3.5 shrink-0`}),(0,Q.jsx)(_r,{className:Y(`min-w-0 flex-1 `,s===`reviewed`&&`line-through decoration-muted-foreground/40`),text:qn(n)}),c>0&&(0,Q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 text-2xs`,children:[(0,Q.jsx)(mp,{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)(p$,{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 m3(e){let t=(0,$.c)(16),{status:n,reviewStatus:r}=e,i=r??`unreviewed`,a;t[0]!==r||t[1]!==n?(a=h3(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=Y(`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 h3(e,t){return`${e===void 0?`Change type unavailable`:Yu[e].label} · ${g3(t)}`}function g3(e){return e===`reviewed`?`Reviewed`:e===`stale`?`Changed since review`:`Not reviewed`}function _3(e){let t=(0,$.c)(10),{label:n,active:r,onOpen:i,className:a,children:o}=e,s=a===void 0?f3:a,c=`Actions for ${n}`,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=jt({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)(p$,{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 v3(e){let t=(0,$.c)(15),{name:n,count:r,expanded:i,onExpanded:o,onAll:s,action:c,children:l}=e,u=i?a:lr,d;t[0]!==u||t[1]!==r||t[2]!==i||t[3]!==n||t[4]!==o?(d=e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:f3,"aria-label":n,"aria-expanded":i,onClick:()=>o(!i),children:[(0,Q.jsx)(_r,{className:`min-w-0 flex-1`,text:`${n} · ${fi(r,`file`)}`}),(0,Q.jsx)(u,{className:`size-3.5 shrink-0`})]}),e]}),t[0]=u,t[1]=r,t[2]=i,t[3]=n,t[4]=o,t[5]=d):d=t[5];let f=d,p;t[6]!==c||t[7]!==n||t[8]!==s||t[9]!==f?(p=c?f(c):(0,Q.jsx)(p$,{label:`Actions for ${n}`,actions:jt({kind:`group`}),onAction:e=>s(e===`expand-all`),children:f}),t[6]=c,t[7]=n,t[8]=s,t[9]=f,t[10]=p):p=t[10];let m=i&&l,h;return t[11]!==n||t[12]!==p||t[13]!==m?(h=(0,Q.jsxs)(`section`,{"aria-label":n,className:`mt-3 border-t pt-2`,children:[p,m]}),t[11]=n,t[12]=p,t[13]=m,t[14]=h):h=t[14],h}function y3(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)(b3,{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 b3(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=$o({connection:s,reviewId:n}),t[0]=s,t[1]=n,t[2]=c):c=t[2];let l=Yr(c),u;t[3]!==s||t[4]!==n?(u=N({connection:s,reviewId:n}),t[3]=s,t[4]=n,t[5]=u):u=t[5];let d=Yr(u),f;t[6]===l?f=t[7]:(f=Vn(Dn(l)),t[6]=l,t[7]=f);let p=f,m;t[8]===d?m=t[9]:(m=Vn(Dn(d)),t[8]=d,t[9]=m);let h=m,g=NZ(`${n}:${r}`),_=zZ(n),v=qZ(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)(_3,{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(Wq),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)(S3,{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 x3=`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 S3(e){let t=(0,$.c)(21),{revision:n,marks:r,context:i,activeStop:o,onStop:s,onStep:c,allChanges:l}=e,u;t[0]!==i.connection||t[1]!==n.reviewId?(u=Us({connection:i.connection,reviewId:n.reviewId}),t[0]=i.connection,t[1]=n.reviewId,t[2]=u):u=t[2];let d=u,[f,p]=wr(d.completeDecision),[m,h]=wr(d.unmark),[g,_]=wr(d.mark),v=Ec(i.connection),y;if(t[3]!==o||t[4]!==l||t[5]!==p||t[6]!==f||t[7]!==_||t[8]!==g||t[9]!==r||t[10]!==c||t[11]!==s||t[12]!==n||t[13]!==v||t[14]!==h||t[15]!==m){let e=cm(n.content,n.files.map(O3),{specsApart:v}),i=Cm(n,r),u=wm(n,r),d=f.waiting||m.waiting||g.waiting,b=e.filter(D3),x=e.filter(E3),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]!==f||t[18]!==g||t[19]!==m?(C=(q(f)||q(m)||q(g))&&(0,Q.jsx)(`p`,{role:`alert`,className:`p-2 text-caption text-destructive`,children:`The review mark could not be updated.`}),t[17]=f,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=mm(e,i,u),l=o===e.key,f=dm(e.paths,i),m=i.filter(t=>e.paths.includes(t.path)),g=u.get(e.layer.id)?.stale===!0;return(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(p$,{label:`More actions for decision ${e.number}`,description:e.layer.title,actions:jt({kind:`decision`,reviewed:t,stale:g,settled:r!==void 0,pending:d,files:m}),onAction:r=>{r===`open`&&s(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:m.flatMap(T3)}))},children:n=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:Y(x3,`flex-1`,t&&!l&&`text-muted-foreground`,l&&`bg-muted inset-ring inset-ring-border`),"aria-label":`${t?`✓`:e.number} ${fm(e)}${g?` code moved`:``} ${f.reviewed}/${f.total}`,"aria-pressed":l,"aria-expanded":l,onClick:()=>s(e.key),children:[(0,Q.jsx)(A3,{number:e.number,reviewed:t,active:l}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[(0,Q.jsx)(_r,{className:Y(`min-w-0 text-left`,l&&`font-semibold`),text:fm(e)}),g&&(0,Q.jsx)(j3,{text:`code moved`,tone:`warn`})]}),l?(0,Q.jsx)(a,{"aria-hidden":!0,className:`size-3 shrink-0 text-muted-foreground`}):(0,Q.jsx)(lr,{"aria-hidden":!0,className:`size-3 shrink-0 text-muted-foreground`})]}),n]})}),l&&(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=gm(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)(M3,{path:e.pointer.path,checked:n.reviewStatus===`reviewed`,disabled:d||r===void 0,onToggle:()=>S(e.pointer.path)}):(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),(0,Q.jsx)(_r,{text:`${e.title} · ${e.pointer.path}`,renderTrigger:(n,r)=>(0,Q.jsxs)(`button`,{type:`button`,className:Y(x3,`flex-1`),onClick:()=>c(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)(j3,{text:a.text,tone:a.tone})]})})]},e.id)})})]},e.key)})}),C,(x.length>0||l)&&(0,Q.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-col gap-px border-t pt-1.5`,children:[x.filter(w3).map(e=>(0,Q.jsx)(N3,{label:fm(e),icon:wf,count:k3(e.paths,i),active:o===e.key,onOpen:()=>s(e.key)},e.key)),l&&(0,Q.jsx)(N3,{label:`All changes`,icon:Af,count:fi(n.files.length,`file`),active:l.active,onOpen:l.onOpen}),x.filter(C3).map(e=>(0,Q.jsx)(N3,{label:`Open all specs`,icon:Mf,count:k3(e.paths,i),active:o===e.key,onOpen:()=>s(e.key)},e.key))]})]}),t[3]=o,t[4]=l,t[5]=p,t[6]=f,t[7]=_,t[8]=g,t[9]=r,t[10]=c,t[11]=s,t[12]=n,t[13]=v,t[14]=h,t[15]=m,t[16]=y}else y=t[16];return y}function C3(e){return e.kind===`specs`}function w3(e){return e.kind===`unexplained`}function T3(e){return e.fingerprint?[{path:e.path,headBlobOid:e.fingerprint}]:[]}function E3(e){return e.kind===`unexplained`||e.kind===`specs`}function D3(e){return e.kind===`decision`}function O3(e){return e.path}function k3(e,t){let n=dm(e,t);return n.total>0?`${n.reviewed}/${n.total}`:void 0}function A3(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)(ci,{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=Y(`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 j3(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=Y(`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 M3(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)(yY,{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 N3(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=Y(`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)(_r,{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)(lr,{"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)(_3,{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 P3({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=F3(I3(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={...F3(a,o),ref:z3(a.ref,o.ref)};return Z.cloneElement(n,s)}function F3(...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`?z3(i,r):R3(n)&&typeof i==`function`&&typeof r==`function`?L3(r,i):r}}return t}function I3(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 L3(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function R3(e){return/^on[A-Z]/.test(e)}function z3(...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 B3=8,V3=64,H3=0,U3=.5,W3=180,G3=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),K3={start:!1,end:!1},q3={currentAnchorId:null,visibleMessageIds:[]};function J3({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return K3;let i=o6({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function Y3({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return q3;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of X3(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+U3&&(u=e)}return l.length===0&&u===null?q3:{currentAnchorId:u,visibleMessageIds:l}}function X3(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function Z3(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function Q3(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function $3(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 e6(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function t6({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of X3(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 n6({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=r6(t,i),o=t.getBoundingClientRect().height,s=l6(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 r6(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function i6(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function a6({content:e,scrollTop:t,spacer:n,viewport:r}){let i=o6({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function o6({content:e,spacer:t,viewport:n}){let r=X3(e,t),i=c6(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 s6(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function c6(e){let t=window.getComputedStyle(e);return{end:d6(t.paddingBlockEnd||t.paddingBottom),start:d6(t.paddingBlockStart||t.paddingTop)}}function l6(e){let t=e?.parentElement;return t?c6(t):{end:0,start:0}}function u6(e){if(!e)return 0;let t=window.getComputedStyle(e);return d6(t.rowGap===`normal`?t.gap:t.rowGap)}function d6(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function f6(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 p6(e,t){return f6(e,t)}function m6(){return f6(q3,g6)}function h6(e,t){return e.start===t.start&&e.end===t.end}function g6(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function _6({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=p6(t===`end`||t===`last-anchor`,(e,t)=>e===t)),O.current===null&&(O.current=p6(K3,h6)),N.current===null&&(N.current=m6()),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 v6(e){e.pendingDefaultScrollStore.setSnapshot(!1)}function y6(e){e.defaultScrollPositionAppliedRef.current=!0,v6(e)}function b6({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()},W3))},[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)<=U3){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(s6(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=n6({align:t,element:e,scrollMargin:o?a+h.current:a,spacer:v.current,viewport:l}),f=a6({content:s,scrollTop:u,spacer:v.current,viewport:l});return x(f),p.current={element:e,viewportTop:i6(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?(y6(e),T(r,n)?(f.current=null,!0):(f.current={messageId:t,options:n},!0)):l.current===0&&(f.current={messageId:t,options:n},y6(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,y6(e),!0)},[T]),reanchorToAnchoredMessage:E,scrollToElement:T,scrollToEnd:w,scrollToMessage:D,scrollToStart:C}}function x6(e,t){return Z.useCallback(n=>{e.current=n,n&&t()},[e,t])}function S6({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=B3,scrollPreviousItemPeek:r=V3,scrollMargin:i=H3}){let a=_6({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-U3;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=J3({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(Y3({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:te}=b6({refs:a,commitScrollState:B,scheduleStateCommit:V,scheduleVisibilitySync:H}),q=Z.useCallback(()=>{let e=y.current,t=j.current;if(!e||!t||!e.element.isConnected)return!1;let n=i6(e.element,t)-e.viewportTop;return Math.abs(n)<=U3?!1:(t.scrollTop+=n,e.viewportTop=i6(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=t6({content:e,spacer:O.current,viewport:t});y.current=n?{element:n,viewportTop:i6(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?e6(X3(t,O.current)):null;if(!t||!n||!r)e=K({behavior:`auto`});else{let i=r6(r,n);e=o6({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`}):te({behavior:`auto`});return e?(y6(a),!0):!1},[t,G,K,te]),ae=Z.useCallback(()=>{let e=u.current;if(!e)return;let t=X3(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){q();return}if(t.length>n){let e=Z3(t,n);if(e){if(s.current&&g.current===`following-bottom`&&$3(t,n)){K({behavior:`auto`});return}G(e,{align:`start`},{keepPreviousPeek:!0}),I.current.add(e);return}}if(t.length===n){let e=Q3(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,q,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(q3)},[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=x6(S,de),pe=x6(j,de),J=Z.useCallback(e=>{u.current=e},[]),me=Z.useCallback(e=>{O.current=e,E.current=u6(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:te,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,te,J,fe,me,pe,A,he,ce,ue,P]);return Z.useLayoutEffect(()=>{ie()||p.current===0&&v6(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 C6(e){let t=Z.useRef(e);return t.current=e,t}var w6=Z.createContext(null),T6=Z.createContext(null);function E6(){let e=Z.useContext(w6);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function D6(){let e=Z.useContext(T6);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function O6({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=S6({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,Q.jsx)(w6.Provider,{value:o,children:(0,Q.jsx)(T6.Provider,{value:s,children:t})})}function k6(){let{pendingDefaultScrollStore:e}=E6();return Z.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function A6({children:e,...t}){let{setRootElement:n}=E6(),r=k6();return(0,Q.jsx)(`div`,{ref:n,...t,...r?{"data-pending-scroll":``}:null,children:e})}function j6({"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}=E6(),_=k6();f.current=o;let v=Z.useCallback(e=>{p(e),z3(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){G3.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 M6({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=E6(),u=Z.useRef(null),d=Z.useCallback(e=>{u.current=e,c(e),z3(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 N6({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=D6(),a=Z.useRef(null),o=Z.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),z3(t)?.(n)},[e,t,i]);return(0,Q.jsx)(`div`,{ref:o,"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function P6({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}=E6(),d=C6(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 P3({defaultTagName:`button`,props:F3({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 F6={Provider:O6,Root:A6,Viewport:j6,Content:M6,Item:N6,Button:P6};function I6(e){return(0,Q.jsx)(F6.Provider,{...e})}function L6({className:e,...t}){return(0,Q.jsx)(F6.Root,{"data-slot":`message-scroller`,className:Y(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,e),...t})}function R6({className:e,...t}){return(0,Q.jsx)(F6.Viewport,{"data-slot":`message-scroller-viewport`,className:Y(`size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent data-pending-scroll:invisible`,e),...t})}function z6({className:e,...t}){return(0,Q.jsx)(F6.Content,{"data-slot":`message-scroller-content`,className:Y(`flex h-max min-h-full flex-col gap-6`,e),...t})}function B6({className:e,scrollAnchor:t=!1,...n}){return(0,Q.jsx)(F6.Item,{"data-slot":`message-scroller-item`,scrollAnchor:t,className:Y(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,e),...n})}function V6({direction:e=`end`,className:t,children:n,render:r,variant:i=`secondary`,size:a=`icon-sm`,...o}){return(0,Q.jsx)(F6.Button,{"data-slot":`message-scroller-button`,"data-direction":e,"data-variant":i,"data-size":a,direction:e,className:Y(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,t),render:r??(0,Q.jsx)(X,{variant:i,size:a}),...o,children:n??(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Dd,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:e===`end`?`Scroll to end`:`Scroll to start`})]})})}function H6(e){return fi(e,`resolved thread`)}function U6(e){let t=(0,$.c)(57),{scope:n,context:r,threads:i}=e,[a,o]=(0,Z.useState)(null),s=QQ(n,r),c;t[0]===i?c=t[1]:(c=T(i),t[0]=i,t[1]=c);let{confirmed:l,kept:u}=c,d,f,p,m,h,g,_,v,y;if(t[2]!==l||t[3]!==a||t[4]!==s||t[5]!==i){let e=Vn(Dn(s.result))?.skipped.length??0,n;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>o(null),t[15]=n):n=t[15],h=n;let r=l.length===0,c;t[16]!==l||t[17]!==s||t[18]!==i?(c=()=>{s.reset();let e=new Set(l.map(W6));o(i.filter(t=>e.has(t.id)))},t[16]=l,t[17]=s,t[18]=i,t[19]=c):c=t[19];let u;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(Jp,{"data-icon":`inline-start`}),t[20]=u):u=t[20],t[21]!==r||t[22]!==c?(y=(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,size:`xs`,className:`ml-auto`,disabled:r,onClick:c,children:[u,`Delete resolved`]}),t[21]=r,t[22]=c,t[23]=y):y=t[23],m=HM,_=a!==null&&!($e(s.result)&&e===0),t[24]===s.result?v=t[25]:(v=e=>{!e&&!s.result.waiting&&h()},t[24]=s.result,t[25]=v),p=KM,f=qM,d=YM,g=$e(s.result)?`Kept ${fi(e,`thread`)} that changed`:`Delete ${H6(a?.length??0)}?`,t[2]=l,t[3]=a,t[4]=s,t[5]=i,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14];let b;t[26]!==d||t[27]!==g?(b=(0,Q.jsx)(d,{children:g}),t[26]=d,t[27]=g,t[28]=b):b=t[28];let x;t[29]!==u||t[30]!==s.result?(x=$e(s.result)?`The agent answered or someone reopened them after you confirmed, so they stay for you to read first.`:`This deletes the resolved threads you started, with the agent's replies in them, for you and for the agent.${u>0?` ${H6(u)} the agent started ${Ya(u,`stays`,`stay`)}, since you cannot delete what the agent wrote on its own.`:``}`,t[29]=u,t[30]=s.result,t[31]=x):x=t[31];let S;t[32]===x?S=t[33]:(S=(0,Q.jsx)(XM,{children:x}),t[32]=x,t[33]=S);let C;t[34]!==f||t[35]!==b||t[36]!==S?(C=(0,Q.jsxs)(f,{children:[b,S]}),t[34]=f,t[35]=b,t[36]=S,t[37]=C):C=t[37];let w;t[38]===s.result?w=t[39]:(w=q(s.result)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:ai(Yt(s.result.cause))}),t[38]=s.result,t[39]=w);let E;t[40]!==h||t[41]!==a||t[42]!==s?(E=(0,Q.jsx)(JM,{children:$e(s.result)?(0,Q.jsx)(X,{onClick:h,children:`Close`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(QM,{disabled:s.result.waiting,children:`Cancel`}),(0,Q.jsx)(X,{variant:`destructive`,disabled:s.result.waiting,onClick:()=>s.send(a??[]),children:s.result.waiting?`Deleting…`:`Delete`})]})}),t[40]=h,t[41]=a,t[42]=s,t[43]=E):E=t[43];let D;t[44]!==p||t[45]!==w||t[46]!==E||t[47]!==C?(D=(0,Q.jsxs)(p,{children:[C,w,E]}),t[44]=p,t[45]=w,t[46]=E,t[47]=C,t[48]=D):D=t[48];let O;t[49]!==m||t[50]!==D||t[51]!==_||t[52]!==v?(O=(0,Q.jsx)(m,{open:_,onOpenChange:v,children:D}),t[49]=m,t[50]=D,t[51]=_,t[52]=v,t[53]=O):O=t[53];let k;return t[54]!==O||t[55]!==y?(k=(0,Q.jsxs)(Q.Fragment,{children:[y,O]}),t[54]=O,t[55]=y,t[56]=k):k=t[56],k}function W6(e){return e.threadId}function G6(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=Y(`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(K6),t[5]=i,t[6]=l);let u;t[7]!==n||t[8]!==l?(u=(0,Q.jsx)(Hn,{"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)(Pe,{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 K6(e){return(0,Q.jsx)(ar,{value:e.value,className:`min-w-0`,children:e.label},e.value)}function q6(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)(G6,{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 J6(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)(X,{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)(fp,{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)(Ts,{render:o,children:s}),t[4]=o,t[5]=c);let l;t[6]===a?l=t[7]:(l=(0,Q.jsx)(tt,{role:`tooltip`,children:a}),t[6]=a,t[7]=l);let u;t[8]!==c||t[9]!==l?(u=(0,Q.jsxs)(ke,{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,bd.createPortal)(u,n),t[11]=u,t[12]=n,t[13]=d):d=t[13],d}function Y6(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)(e$,{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)(fp,{"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)(X,{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 X6(e){let t=(0,$.c)(23),{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(Z6),u;t[0]===i?u=t[1]:(u=cn(i),t[0]=i,t[1]=u);let d=u,f=s===`open`?`No open comments yet.`:`Nothing resolved yet.`;KQ(n,r,n.review?void 0:s);let p;t[2]!==r||t[3]!==n.review?(p=n.review?(0,Q.jsx)(`div`,{className:`shrink-0 border-b p-3`,children:(0,Q.jsx)(v4,{connection:r.connection,reviewId:n.review.reviewId,reviewRevision:n.review.revision,writable:!0})}):null,t[2]=r,t[3]=n.review,t[4]=p):p=t[4];let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`open`,`resolved`],t[5]=m):m=t[5];let h;t[6]!==d||t[7]!==s?(h=m.map(e=>(0,Q.jsxs)(X,{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[6]=d,t[7]=s,t[8]=h):h=t[8];let g;t[9]!==r||t[10]!==d||t[11]!==s||t[12]!==n||t[13]!==i?(g=s===`resolved`&&d.resolved>0&&(0,Q.jsx)(U6,{scope:n,context:r,threads:i}),t[9]=r,t[10]=d,t[11]=s,t[12]=n,t[13]=i,t[14]=g):g=t[14];let _;t[15]!==h||t[16]!==g?(_=(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1 px-2 pt-2 pb-2`,children:[h,g]}),t[15]=h,t[16]=g,t[17]=_):_=t[17];let v=l.length===0?(0,Q.jsx)(`p`,{className:`px-4 py-6 text-center text-caption text-muted-foreground`,children:f}):(0,Q.jsx)(I6,{autoScroll:!0,defaultScrollPosition:`end`,children:(0,Q.jsxs)(L6,{className:`min-h-0 flex-1`,children:[(0,Q.jsx)(R6,{"aria-label":`Comments`,children:(0,Q.jsx)(z6,{children:l.map((e,t)=>(0,Q.jsx)(B6,{messageId:e.id,scrollAnchor:t===l.length-1,children:(0,Q.jsx)(`div`,{className:`mx-2`,children:(0,Q.jsx)(b$,{thread:e,scope:n,context:r,onReveal:()=>o(e.anchor)})})},e.id))})}),(0,Q.jsx)(V6,{})]})},s),y;return t[18]!==a||t[19]!==p||t[20]!==_||t[21]!==v?(y=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[p,a,_,v]}),t[18]=a,t[19]=p,t[20]=_,t[21]=v,t[22]=y):y=t[22],y}function Z6(e,t){return Q6(e).localeCompare(Q6(t))}function Q6(e){return e.messages.at(-1)?.createdAt??``}function $6(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=re({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(e8)?.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)(i8,{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 e8(e){return e.reviewStatus===`stale`}function t8(e){let t=(0,$.c)(9),{scope:n,context:r,base:i,review:a,threads:o,onSelect:s}=e,{connection:c}=r,l=eF(n,c,i),u;t[0]===l.result?u=t[1]:(u=Vn(Dn(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)(n8,{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 n8(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=qt(i),t[0]=i,t[1]=c);let l=mQ(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=ur(i.files,l),u=i8,f=re({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(r8)?.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 r8(e){return e.reviewStatus===`stale`}function i8(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)(a8,{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)(l8,{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 a8(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}=s8(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(o8),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)(p8,{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 ${fi(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)(m2,{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)(p8,{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 o8(e){return e.result===`pass`}function s8(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=$o({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=N({connection:i.connection,reviewId:r}),t[4]=i.connection,t[5]=r,t[6]=c):c=t[6];let l=c,u=Yr(s),d=Yr(l),f=Br(s),p;t[7]!==i.connection||t[8]!==r?(p=$o({connection:i.connection,reviewId:r}),t[7]=i.connection,t[8]=r,t[9]=p):p=t[9];let m=Br(p),h=Br(l),g=Ec(i.connection),_,v;if(t[10]!==d||t[11]!==a||t[12]!==u||t[13]!==g){let e=Vn(Dn(u))?.revision,n=a??Vn(Dn(d)),r;t[16]!==d||t[17]!==a||t[18]!==u?(r=q(u)||a===void 0&&q(d),t[16]=d,t[17]=a,t[18]=u,t[19]=r):r=t[19],_=r,v=!_&&e&&n?Tm(e,n,{specsApart:g}):void 0,t[10]=d,t[11]=a,t[12]=u,t[13]=g,t[14]=_,t[15]=v}else _=t[14],v=t[15];let y;t[20]!==f||t[21]!==m||t[22]!==h?(y=()=>{f(),m(),h()},t[20]=f,t[21]=m,t[22]=h,t[23]=y):y=t[23];let b;return t[24]!==_||t[25]!==v||t[26]!==y?(b={progress:v,failed:_,retry:y},t[24]=_,t[25]=v,t[26]=y,t[27]=b):b=t[27],b}var c8={files:`Files`,stale:`Code moved`,unexplained:`Explanation`,comments:`Comments`,replies:`Replies`,checks:`Checks`};function l8(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(d8),s=n.filter(u8),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)(f8,{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)(f8,{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)(f8,{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 u8(e){return e.key===`comments`||e.key===`replies`}function d8(e){return e.key===`checks`}function f8({items:e,onSelect:t}){return e.map(e=>(0,Q.jsx)(p8,{name:c8[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 p8(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:Y(`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)(m8,{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)(_r,{text:r,renderTrigger:l,children:u}),t[11]=r,t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function m8(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)(ci,{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)(tf,{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)(Gd,{strokeWidth:1.75,"aria-hidden":!0,className:`size-3.5 shrink-0 text-warn`}),t[2]=r):r=t[2],r}function h8(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}=UZ(n.reviewId),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1),C;t[0]!==o||t[1]!==n?(C=Cm(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(g8)),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)(Z4,{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)(J6,{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)($6,{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=cn(a),t[26]=a,t[27]=N);let P;t[28]!==v||t[29]!==N.open||t[30]!==_?(P=(0,Q.jsx)(q6,{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)(TI,{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)(S3,{revision:n,marks:o,context:i,activeStop:m,onStop:d,onStep:h}),(0,Q.jsx)(v3,{name:`Changed files`,count:w.length,expanded:y,onExpanded:b,onAll:b,action:(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Open all changes`,onClick:u}),children:(0,Q.jsx)(bf,{})}),(0,Q.jsx)(tt,{children:`Open all changes`})]}),children:w.map(e=>(0,Q.jsxs)(_3,{label:e.path,active:s===e.path,onOpen:()=>l(e.path),children:[(0,Q.jsx)(m3,{status:E.get(e.path),reviewStatus:e.reviewStatus}),(0,Q.jsx)(Dw,{path:e.path,className:`size-3.5 shrink-0`}),(0,Q.jsx)(_r,{className:Y(`min-w-0 flex-1`,e.reviewStatus===`reviewed`&&`line-through decoration-muted-foreground/40`),text:qn(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)(X6,{scope:r,context:i,threads:a,composer:(0,Q.jsx)(Y6,{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 g8(e){return[e.path,pl(e)]}function _8(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=tF(n,r,c),d=eF(n,r,i),f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;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=Vn(Dn(u.result)),n;t[22]===d.result?n=t[23]:(n=Vn(Dn(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`:Lq(r),t[24]=r,t[25]=o);let D=o,O=e?.defaultRef??null,k=i??O,A=[{heading:`Local`,entries:e?.bases.filter(b8)??[]},{heading:`Remote`,entries:e?.bases.filter(y8)??[]}].filter(v8),j=e=>{a(e===O?void 0:e),l(!1)};h=ka,g=c,_=l;let M=s?`max-w-24 @min-3xl/pane:max-w-40`:`w-full`,N;t[26]===M?N=t[27]:(N=Y(`justify-between`,M),t[26]=M,t[27]=N);let P=`Compare against ${D}`,F;t[28]!==N||t[29]!==P?(F=(0,Q.jsx)(X,{variant:`outline`,size:`sm`,className:N,"aria-label":P,title:`Choose the branch this one is compared against`}),t[28]=N,t[29]=P,t[30]=F):F=t[30];let I=s&&`hidden @min-3xl/pane:block`,L;t[31]===I?L=t[32]:(L=Y(`size-3.5 shrink-0 text-muted-foreground`,I),t[31]=I,t[32]=L);let R;t[33]===L?R=t[34]:(R=(0,Q.jsx)(Hf,{className:L}),t[33]=L,t[34]=R);let z=`Against ${D}`,B=s&&`hidden @min-3xl/pane:inline`,V;t[35]===B?V=t[36]:(V=Y(`text-muted-foreground`,B),t[35]=B,t[36]=V);let H;t[37]===V?H=t[38]:(H=(0,Q.jsxs)(`span`,{className:V,children:[`Against`,` `]}),t[37]=V,t[38]=H);let U;t[39]!==D||t[40]!==z||t[41]!==H?(U=(0,Q.jsxs)(_r,{text:z,children:[H,D]}),t[39]=D,t[40]=z,t[41]=H,t[42]=U):U=t[42];let W;t[43]!==R||t[44]!==U?(W=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[R,U]}),t[43]=R,t[44]=U,t[45]=W):W=t[45];let G;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(Ud,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[46]=G):G=t[46],t[47]!==F||t[48]!==W?(v=(0,Q.jsxs)(So,{render:F,children:[W,G]}),t[47]=F,t[48]=W,t[49]=v):v=t[49],m=fo,T=`start`,E=`w-72`,p=YV,t[50]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(ZV,{"aria-label":`Find a base branch`,placeholder:`Find a branch`}),t[50]=w):w=t[50],f=QV,y=`Base branches`,t[51]===u.result?b=t[52]:(b=De(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]=b),t[53]!==u.refresh||t[54]!==u.result?(x=q(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)(X,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:u.refresh,children:`Try again`})]}),t[53]=u.refresh,t[54]=u.result,t[55]=x):x=t[55],t[56]===u.result?S=t[57]:(S=$e(u.result)&&(0,Q.jsx)($V,{children:`No branch matches.`}),t[56]=u.result,t[57]=S),C=A.map(e=>(0,Q.jsx)(eH,{heading:e.heading,children:e.entries.map(e=>(0,Q.jsxs)(tH,{value:e.name,"data-checked":e.ref===k,onSelect:()=>j(e.ref),children:[(0,Q.jsx)(_r,{text:e.name}),e.ref===O&&(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]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E}else f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21];let D;t[58]!==f||t[59]!==y||t[60]!==b||t[61]!==x||t[62]!==S||t[63]!==C?(D=(0,Q.jsxs)(f,{"aria-label":y,children:[b,x,S,C]}),t[58]=f,t[59]=y,t[60]=b,t[61]=x,t[62]=S,t[63]=C,t[64]=D):D=t[64];let O;t[65]!==p||t[66]!==D||t[67]!==w?(O=(0,Q.jsxs)(p,{children:[w,D]}),t[65]=p,t[66]=D,t[67]=w,t[68]=O):O=t[68];let k;t[69]!==m||t[70]!==O||t[71]!==T||t[72]!==E?(k=(0,Q.jsx)(m,{align:T,className:E,children:O}),t[69]=m,t[70]=O,t[71]=T,t[72]=E,t[73]=k):k=t[73];let A;return t[74]!==h||t[75]!==g||t[76]!==_||t[77]!==v||t[78]!==k?(A=(0,Q.jsxs)(h,{open:g,onOpenChange:_,children:[v,k]}),t[74]=h,t[75]=g,t[76]=_,t[77]=v,t[78]=k,t[79]=A):A=t[79],A}function v8(e){return e.entries.length>0}function y8(e){return e.remote}function b8(e){return!e.remote}function x8(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)(_8,{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)(S8,{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 S8(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)(C8,{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)(xQ,{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 C8(e){let t=(0,$.c)(51),{scope:n,context:r,branch:i,activeEntry:a,threads:o,onOpen:s,sideLabel:c}=e,l=Ec(r.connection),u;t[0]===i?u=t[1]:(u=qt(i),t[0]=i,t[1]=u);let d=u,f=mQ(n,r,d),p=MQ(n,r,w8,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=ur(i.files,f),n;t[20]===i.head.branch?n=t[21]:(n=i.head.branch===null||i.head.branch===void 0?`this commit`:Lq(i.head.branch),t[20]=i.head.branch,t[21]=n);let r=n,u;t[22]===i.commits?u=t[23]:(u=fi(i.commits,`commit`),t[22]=i.commits,t[23]=u);let d=u;m=TI,b=`h-0 min-h-0 flex-1`,h=`p-2 pr-3`;let x;t[24]===i.base.ref?x=t[25]:(x=Lq(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=Jq(Kq),t[30]=S):S=t[30];let C;t[31]===s?C=t[32]:(C=()=>s(Kq),t[31]=s,t[32]=C);let w,T;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(Hf,{className:`size-3.5 shrink-0 text-muted-foreground`}),T=(0,Q.jsx)(_r,{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)(_3,{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 `,Lq(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)(p3,{path:e.path,document:{kind:`branch-file`,path:e.path},note:e.status,changeStatus:pl(e),scopes:[e.status],reviewStatus:e.reviewStatus,commentCount:o.filter(t=>t.anchor.comparison?.kind===`branch`&&Ca(t.anchor)===e.path&&!t.resolved).length,active:a===Jq({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=am(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 w8(e){return Is.add(e)}var T8=[{value:`uncommitted`,label:`Uncommitted`},{value:`branch`,label:`Branch`}];function E8(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);hQ(n,r),FQ(n,r);let _=RP(n,f),v=nQ(n,r).review??null,{setPlace:y}=NZ(`${v?.reviewId??n.worktreeId}:${v?.revision??``}`),b=zZ(v?.reviewId??``),{threads:x}=PQ(n,r),S=gQ(n,r,_),C;t[0]===x?C=t[1]:(C=cn(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?Kq:{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)(Z4,{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)(J6,{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)(G6,{label:`Changes to review`,className:`px-2.5 pt-3`,value:s,onValue:M,options:T8}),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)(t8,{scope:n,context:r,base:c,review:v,threads:x,onSelect:D}):(0,Q.jsx)($6,{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)(q6,{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)(x8,{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)(O8,{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)(X6,{threads:x,scope:n,context:r,composer:T?(0,Q.jsx)(P8,{scope:n,context:r,base:c,open:h,setOpen:g}):(0,Q.jsx)(Y6,{scope:n,context:r,anchor:Mi(void 0),open:h,setOpen:g}),onReveal:e=>{if(e.kind===`change`){a(e.comparison?.kind===`branch`?Kq:{kind:`handoff`},e);return}a(F8(e,new Set(_.changes.map(D8))),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 D8(e){return e.path}function O8(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=Ec(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(N8),g=d?h.filter(M8):h,_=d?h.filter(im):[],v=new Map(l.map(j8)),y=bl(s.changes),b=MQ(n,r,A8),[x,S]=(0,Z.useState)(null),C=e=>(0,Q.jsx)(p3,{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(k8))],reviewStatus:v.get(e)?.reviewStatus,commentCount:u.filter(t=>Ca(t.anchor)===e&&!t.resolved).length,active:i===Jq({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=TI,T;t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==c?(T=c?(0,Q.jsx)(y3,{context:r,review:c,activeEntry:i,onOpen:a}):(0,Q.jsx)(_3,{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)(v3,{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)(v3,{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)(_3,{label:`Open all specs`,active:i===`specs`,onOpen:()=>a(Gq),children:`Open all specs`}),_.map(C)]}),k;t[6]!==r||t[7]!==x||t[8]!==n?(k=x&&(0,Q.jsx)(YJ,{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 k8(e){return e.scope}function A8(e){return Is.add(e)}function j8(e){return[e.path,e]}function M8(e){return!im(e)}function N8(e){return e.path}function P8(e){let t=(0,$.c)(14),{scope:n,context:r,base:i,open:a,setOpen:o}=e,{connection:s}=r,c=eF(n,s,i),l,u,d,f;if(t[0]!==c.result||t[1]!==r||t[2]!==n){let e=Vn(Dn(c.result)),i=e?.base?.ref,a=e?.head.oid;l=Y6,u=n,d=r,f=i==null||a==null?void 0:Mi({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 F8(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 I8(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}=nQ(i.scope,i.context),o;t[4]===a?o=t[5]:(o=z8(a),t[4]=a,t[5]=o);let s=!!a,c;t[6]===i?c=t[7]:(c=e=>(0,Q.jsx)(V8,{...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)(L8,{layout:n,surfaces:R8,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 L8(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}=nL(),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=Y(`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)(_r,{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)(Pe,{value:o,onValueChange:e=>{Sq(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)(Hn,{className:`h-8 min-w-0 flex-1`,children:r.map(e=>(0,Q.jsx)(_r,{propagateEscape:!0,text:i[e],renderTrigger:t=>(0,Q.jsxs)(ar,{value:e,className:`min-w-0`,children:[(0,Q.jsx)(B8,{published:a,surface:e,className:`size-3.5 shrink-0`}),t]})},e))}),f]}),(0,Q.jsx)(Yn,{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 R8=[`files`,`changes`,`history`];function z8(e){return{...Qq,changes:Zq(e)??Qq.changes}}function B8(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)(Af,{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)(Ap,{className:i}),t[2]=i,t[3]=e),e}let a;return t[4]!==i||t[5]!==n?(a=n?(0,Q.jsx)(ip,{className:i}):(0,Q.jsx)(bf,{className:i}),t[4]=i,t[5]=n,t[6]=a):a=t[6],a}function V8(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=nQ(n,r);if(!s){let e;t[0]!==c||t[1]!==f.review||t[2]!==a?(e=f.review&&a===`changes`&&(0,Q.jsx)(X,{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)(he,{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)(E8,{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)(kK,{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)(sX,{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(Wq)}),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)(I4,{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)(TI,{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 H8={files:Ic.surfaceFiles,changes:Ic.surfaceReview,history:Ic.surfaceHistory};function U8(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)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":r[e],"aria-pressed":t,"aria-keyshortcuts":H8[e],onClick:()=>t?c():s(e)}),children:(0,Q.jsx)(B8,{published:i,surface:e})}),(0,Q.jsxs)(tt,{side:`left`,children:[r[e],` `,(0,Q.jsx)(eL,{children:uc(H8[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)(X,{ref:u,variant:`ghost`,size:`icon`,className:`mt-auto`,"aria-label":d,"aria-expanded":o,"aria-keyshortcuts":Ic.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)(gp,{}),t[20]=m):m=t[20];let h;t[21]===p?h=t[22]:(h=(0,Q.jsx)(Ts,{render:p,children:m}),t[21]=p,t[22]=h);let g;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(eL,{children:uc(Ic.toggleSidebar)}),t[23]=g):g=t[23];let _;t[24]===d?_=t[25]:(_=(0,Q.jsxs)(tt,{side:`left`,children:[d,` `,g]}),t[24]=d,t[25]=_);let v;t[26]!==h||t[27]!==_?(v=(0,Q.jsxs)(ke,{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 W8(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:f,onDeleted:p,liveScope:m,proofCurrent:h,onShowReviewPanel:g,active:_}=e,v=h===void 0||h,y=_===void 0||_,b;t[0]!==l.connection||t[1]!==n||t[2]!==s?(b=$o({connection:l.connection,reviewId:n,...s===void 0?{}:{revision:s}}),t[0]=l.connection,t[1]=n,t[2]=s,t[3]=b):b=t[3];let x=b,S=Yr(x),C=Br(x),w;t[4]===S?w=t[5]:(w=Vn(Dn(S)),t[4]=S,t[5]=w);let T=w,E;t[6]!==o||t[7]!==f||t[8]!==S||t[9]!==C?(E=K8(S,o,C,f),t[6]=o,t[7]=f,t[8]=S,t[9]=C,t[10]=E):E=t[10];let D=E;if(D)return D;if(!T?.review||!T.revision){let e;return t[11]!==l||t[12]!==o||t[13]!==f||t[14]!==u||t[15]!==n||t[16]!==s?(e=(0,Q.jsx)(G8,{navigation:o,reviewId:n,revision:s,context:l,onRevision:u,onBack:f}),t[11]=l,t[12]=o,t[13]=f,t[14]=u,t[15]=n,t[16]=s,t[17]=e):e=t[17],e}let O=`${n}:${T.revision.revision}`,k=T.revision,A;t[18]===S?A=t[19]:(A=q(S),t[18]=S,t[19]=A);let j;t[20]!==S.waiting||t[21]!==C||t[22]!==A?(j={run:C,failed:A,waiting:S.waiting},t[20]=S.waiting,t[21]=C,t[22]=A,t[23]=j):j=t[23];let M;return t[24]!==y||t[25]!==l||t[26]!==T||t[27]!==c||t[28]!==r||t[29]!==m||t[30]!==o||t[31]!==f||t[32]!==p||t[33]!==i||t[34]!==u||t[35]!==g||t[36]!==d||t[37]!==v||t[38]!==O||t[39]!==j||t[40]!==a?(M=(0,Q.jsx)(Y8,{toolbarTarget:a,documentNavigation:r,navigation:o,onOpen:i,data:T,revision:k,context:l,decision:c,onRevision:u,onStop:d,onBack:f,onDeleted:p,liveScope:m,proofCurrent:v,active:y,onShowReviewPanel:g,reread:j},O),t[24]=y,t[25]=l,t[26]=T,t[27]=c,t[28]=r,t[29]=m,t[30]=o,t[31]=f,t[32]=p,t[33]=i,t[34]=u,t[35]=g,t[36]=d,t[37]=v,t[38]=O,t[39]=j,t[40]=a,t[41]=M):M=t[41],M}function G8(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=$o({connection:a.connection,reviewId:r}),t[0]=a.connection,t[1]=r,t[2]=c):c=t[2];let l=c,u=Yr(l),d=Br(l),f;t[3]===u?f=t[4]:(f=Vn(Dn(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=K8(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)(X,{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)(X,{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)(he,{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)(wn,{navigation:n,title:`Review`,children:b}),t[20]=n,t[21]=b,t[22]=x):x=t[22],x}function K8(e,t,n,r){if(De(e))return(0,Q.jsx)(q8,{navigation:t});if(q(e)&&me(Dn(e)))return(0,Q.jsx)(J8,{navigation:t,retry:n,onBack:r})}function q8(e){let t=(0,$.c)(3),{navigation:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(hn,{label:`Loading review`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Q.jsx)(wn,{navigation:n,title:`Review`,children:r}),t[1]=n,t[2]=i),i}function J8(e){let t=(0,$.c)(6),{navigation:n,retry:r,onBack:i}=e,a;t[0]!==i||t[1]!==r?(a=(0,Q.jsx)(g,{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)(wn,{navigation:n,title:`Review`,children:a}),t[3]=n,t[4]=a,t[5]=o):o=t[5],o}function Y8(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:f,onDeleted:p,liveScope:m,proofCurrent:h,onShowReviewPanel:_,active:v,reread:y}=e,b=h===void 0||h,x=v===void 0||v,S=kF(c.connection),C;t[0]===s.projectId?C=t[1]:(C=e=>e.id===s.projectId,t[0]=s.projectId,t[1]=C);let w=S.projects.find(C)?.worktrees.find(e=>e.available&&e.id===s.content.worktreeId),T=m??(w?{projectId:s.projectId,worktreeId:w.id}:void 0),E;t[2]!==o.review?.latestRevision||t[3]!==o.revisions||t[4]!==s.headOid?(E=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]=E):E=t[5];let D=E,O=Vn(Dn(eF(T,c.connection,void 0).result)),k=s.content,A;t[6]!==s.reviewId||t[7]!==s.revision?(A={reviewId:s.reviewId,revision:s.revision},t[6]=s.reviewId,t[7]=s.revision,t[8]=A):A=t[8];let j;t[9]!==k.worktreeId||t[10]!==s.projectId||t[11]!==A?(j={projectId:s.projectId,worktreeId:k.worktreeId,review:A},t[9]=k.worktreeId,t[10]=s.projectId,t[11]=A,t[12]=j):j=t[12];let M=j,{result:P,page:F,url:I,available:L}=p2(M,c,k.summary),[R,z]=(0,Z.useState)(),B;t[13]!==y||t[14]!==k.summary.expires?(B=()=>{z(k.summary.expires),y.run()},t[13]=y,t[14]=k.summary.expires,t[15]=B):B=t[15];let H=B,U;t[16]!==c.connection||t[17]!==s.reviewId||t[18]!==s.revision?(U=os({connection:c.connection,reviewId:s.reviewId,revision:s.revision}),t[16]=c.connection,t[17]=s.reviewId,t[18]=s.revision,t[19]=U):U=t[19];let W=U,G=Yr(W),K=Br(W),ee;t[20]!==c.connection||t[21]!==s.reviewId?(ee=V({connection:c.connection,reviewId:s.reviewId}),t[20]=c.connection,t[21]=s.reviewId,t[22]=ee):ee=t[22],Ba(ee);let te;t[23]!==c.connection||t[24]!==s.reviewId?(te=N({connection:c.connection,reviewId:s.reviewId}),t[23]=c.connection,t[24]=s.reviewId,t[25]=te):te=t[25];let ne=te,re=Yr(ne),ie=Br(ne),ae=Vn(Dn(re)),oe=Ec(c.connection),{dark:se}=Gc(),ce=NZ(`${s.reviewId}:${s.revision}`),le=qZ(s.reviewId,s.revision),[ue,de]=(0,Z.useState)(),[fe,pe]=(0,Z.useState)(`walkthrough`),J=n!==void 0,me=`review:${s.reviewId}:${s.revision}`,{focused:ge,setFocused:_e}=kZ(me),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]!==me?(xe={worktreeId:me,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]=me,t[35]=xe):xe=t[35];let Se=JZ(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,Jq(e)):Se.open(ge,Jq(e))},t[36]=ge,t[37]=a,t[38]=J,t[39]=Se,t[40]=Ce):Ce=t[40];let we=Ce,Te=x&&(!J||Se.panes[ge]?.active===`handoff`),Ee=pZ(),{open:Oe,setOpen:Ae}=VZ(s.reviewId),je=GZ(s.reviewId),Me;t[41]!==we||t[42]!==s.reviewId?(Me=e=>we({kind:`pull-request`,reviewId:s.reviewId,number:e}),t[41]=we,t[42]=s.reviewId,t[43]=Me):Me=t[43];let Ne=Me,[Fe,Ie]=(0,Z.useState)(!1),Le=nL(),Re=nL(),[Be,Ve]=(0,Z.useState)(l);Be!==l&&(Ve(l),de(void 0),pe(`walkthrough`));let He=cm(k,s.files.map(e5),{specsApart:oe}),Ue;t[44]!==l||t[45]!==k.layers?(Ue=l!==void 0&&!k.layers.some(e=>e.id===l),t[44]=l,t[45]=k.layers,t[46]=Ue):Ue=t[46];let We=Ue,Ge=ce.place;l&&(Ge=om(l)),We&&(Ge=`briefing`);let Ke=lm(He,ue??Ge),qe=wm(s,ae),Je=Cm(s,ae),Ye=Je.filter($8).length,Xe=He.filter(e=>e.kind===`decision`&&mm(e,Je,qe)).length,Ze=e=>mm(e,Je,qe),Qe=k.layers.length,et=e=>{let t=um(He,Ke.key,e);return t?()=>nt(t.key):void 0},nt=e=>{Re.element?.scrollTo({top:0}),de(e),ce.setPlace(e),pe(`walkthrough`),J&&Se.selectPane(0),d?.(k.layers.find(t=>om(t.id)===e)?.id)},rt={active:Te&&fe===`walkthrough`,worktreeId:s.reviewId,entry:`review:${s.revision}`},it=e=>{le.choose(e.pointer.path,e.id),at(e.pointer.path)},at=e=>we({kind:`review-file`,reviewId:s.reviewId,revision:s.revision,path:e}),ot={review:k,scope:M,context:c,interaction:rt,onOpen:e=>{e.path&&at(e.path)}},st;t[47]!==H||t[48]!==k.summary?(st=e=>{(e===`walkthrough`||e===`summary`||e===`changes`)&&(e===`summary`&&Hi(k.summary,Date.now())&&H(),pe(e))},t[47]=H,t[48]=k.summary,t[49]=st):st=t[49];let ct;t[50]===P?ct=t[51]:(ct=De(P)||P.waiting,t[50]=P,t[51]=ct);let lt;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,Q.jsxs)(ke,{children:[(0,Q.jsxs)(Ts,{render:(0,Q.jsx)(ar,{value:`walkthrough`,"aria-label":`Walkthrough`}),children:[(0,Q.jsx)(ip,{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)(tt,{children:`Walkthrough`})]}),t[52]=lt):lt=t[52];let ut;t[53]===L?ut=t[54]:(ut=L&&(0,Q.jsxs)(ke,{children:[(0,Q.jsxs)(Ts,{render:(0,Q.jsx)(ar,{value:`summary`,"aria-label":`Agent summary`}),children:[(0,Q.jsx)(Ef,{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)(tt,{children:`Agent summary`})]}),t[53]=L,t[54]=ut);let dt;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,Q.jsxs)(ke,{children:[(0,Q.jsxs)(Ts,{render:(0,Q.jsx)(ar,{value:`changes`,"aria-label":`All changes`}),children:[(0,Q.jsx)(bf,{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)(tt,{children:`All changes in this revision`})]}),t[55]=dt):dt=t[55];let ft;t[56]!==ct||t[57]!==ut?(ft=(0,Q.jsxs)(Hn,{"aria-label":`Review presentation`,"aria-busy":ct,children:[lt,ut,dt]}),t[56]=ct,t[57]=ut,t[58]=ft):ft=t[58];let pt;t[59]!==st||t[60]!==ft||t[61]!==fe?(pt=(0,Q.jsx)(Pe,{className:`shrink-0`,value:fe,onValueChange:st,children:ft}),t[59]=st,t[60]=ft,t[61]=fe,t[62]=pt):pt=t[62];let mt=pt,ht=fi(Je.length,`file`),gt;t[63]===k.layers.length?gt=t[64]:(gt=fi(k.layers.length,`decision`),t[63]=k.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)(m2,{label:`Files reviewed`,value:Ye,max:Je.length}),(0,Q.jsxs)(`span`,{children:[Xe,` of `,gt]})]})]}),vt={connection:c.connection,reviewId:s.reviewId},yt=Vn(Dn(Yr($o(vt)))),xt=bt(vt),St=Yr(xt),Ct=q(St)?{kind:`failed`}:Vn(Dn(St))??{kind:`loading`},wt=o.review?.pullRequest?Ct:void 0,Tt=Nr(o.review??s,yt?.revision??s,wt?.kind===`available`?wt.pullRequest.title:void 0),Et=o.review,{threads:Dt}=PQ(m??M,c,T),Ot;t[65]!==Ee||t[66]!==Ae||t[67]!==Ie?(Ot=()=>{Ee?Ae(!0):Ie(!0)},t[65]=Ee,t[66]=Ae,t[67]=Ie,t[68]=Ot):Ot=t[68];let kt=Ot,At=o.review?.pullRequest,jt;t[69]!==je||t[70]!==_||t[71]!==kt?(jt=(e,t)=>{t&&je.request(),_?_(e):kt()},t[69]=je,t[70]=_,t[71]=kt,t[72]=jt):jt=t[72];let Mt;t[73]!==c||t[74]!==Ne||t[75]!==s.branch||t[76]!==s.projectId||t[77]!==s.reviewId||t[78]!==At||t[79]!==jt?(Mt=(0,Q.jsx)(G4,{reviewId:s.reviewId,projectId:s.projectId,branch:s.branch,url:At,context:c,onOpen:Ne,onShowPanel:jt}),t[73]=c,t[74]=Ne,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]!==Ee||t[82]!==Oe||t[83]!==Le||t[84]!==Ae||t[85]!==Ie?(Pt=()=>{if(!Ee){Ie(Q8);return}Oe&&Le.element?.focus(),Ae(Z8)},t[81]=Ee,t[82]=Oe,t[83]=Le,t[84]=Ae,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=z8(s.content),t[89]=s.content,t[90]=Rt);let zt=Rt,Bt=e=>(0,Q.jsx)(L8,{layout:e,surfaces:t5,names:zt,published:!0,surface:`changes`,onSurface:kt,children:e=>(0,Q.jsx)(I4,{connection:c.connection,scope:M,children:(0,Q.jsx)(h8,{actionsTarget:e,revision:s,scope:M,context:c,threads:Dt,marks:ae,activeStop:Ke.key,onStep:e=>Lt(()=>{pe(`walkthrough`),it(e)}),file:void 0,onFile:e=>Lt(()=>{pe(`walkthrough`),at(e)}),onChange:e=>Lt(()=>{pe(`walkthrough`),we({kind:`review-change`,reviewId:s.reviewId,revision:s.revision,path:e})}),onStop:e=>Lt(()=>nt(e)),onAllChanges:()=>Lt(()=>{pe(`changes`),J&&Se.activate(0,`handoff`)}),onProof:()=>Lt(()=>nt(`briefing`)),onOpenPullRequest:e=>Lt(()=>Ne(e))})})}),Vt;t[91]!==Ee||t[92]!==zt||t[93]!==Ie||t[94]!==Ft?(Vt=Ee?null:(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":zt.changes,onClick:()=>Ee?Ft():Ie(!0)}),children:(0,Q.jsx)(gp,{className:`size-3.5`})}),(0,Q.jsxs)(tt,{children:[zt.changes,(0,Q.jsx)(eL,{children:uc(Ic.toggleSidebar)})]})]}),t[91]=Ee,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,Kt;t[98]===s.headOid?Kt=t[99]:(Kt=s.headOid.slice(0,7),t[98]=s.headOid,t[99]=Kt);let qt;t[100]===s.files.length?qt=t[101]:(qt=fi(s.files.length,`file`),t[100]=s.files.length,t[101]=qt);let Jt;t[102]!==s.revision||t[103]!==Kt||t[104]!==qt?(Jt=(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Revision `,Gt,` · `,Kt,` ·`,` `,qt,`, including specs`]}),t[102]=s.revision,t[103]=Kt,t[104]=qt,t[105]=Jt):Jt=t[105];let Yt;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Yt=(0,Q.jsx)(X,{variant:`outline`,className:`self-start`,onClick:()=>pe(`walkthrough`),children:`Back to the walkthrough`}),t[106]=Yt):Yt=t[106];let Zt;t[107]===Jt?Zt=t[108]:(Zt=(0,Q.jsxs)(`header`,{className:`mb-5 flex flex-col gap-2`,children:[Wt,Jt,Yt]}),t[107]=Jt,t[108]=Zt);let Qt;t[109]===s.files?Qt=t[110]:(Qt=s.files.map(X8),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)(V4,{revision:s,place:`changes`,paths:Qt,scope:M,context:c,active:Te,marks:ae??{files:[],decisions:[]},gaps:!1,explanations:!1})]}),en;t[111]===Re?en=t[112]:(en=e=>Re.attach(e),t[111]=Re,t[112]=en);let tn=fe===`changes`,nn=fe===`changes`,rn=!J&&`border`,an=fe===`changes`&&`pointer-events-none invisible absolute inset-0`,on;t[113]!==rn||t[114]!==an?(on=Y(`@container-size/review flex min-h-0 min-w-0 flex-1 flex-col overflow-auto bg-card wrap-anywhere`,rn,an),t[113]=rn,t[114]=an,t[115]=on):on=t[115];let sn;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(sn={containerName:`pane review`},t[116]=sn):sn=t[116];let cn=r&&(0,bd.createPortal)(_t,r),ln=Te&&fe===`walkthrough`&&(0,Q.jsx)(s5,{stops:He,current:Ke.key,onGo:nt}),un;t[117]!==O||t[118]!==D?(un=O&&O.head.oid!==D&&(0,Q.jsx)(`div`,{className:`px-4 pt-3`,children:(0,Q.jsx)(he,{role:`status`,title:`The branch tip differs from this review.`,description:`Publish a revision to include it.`})}),t[117]=O,t[118]=D,t[119]=un):un=t[119];let dn;t[120]!==R||t[121]!==y.failed||t[122]!==y.run||t[123]!==y.waiting||t[124]!==k.summary.expires||t[125]!==fe?(dn=y.failed&&(fe!==`summary`||R!==k.summary.expires)&&(0,Q.jsx)(`div`,{className:`px-4 py-2`,children:(0,Q.jsxs)(lo,{variant:`destructive`,children:[(0,Q.jsx)(rr,{children:`This review could not be refreshed. Showing the last loaded revision.`}),(0,Q.jsx)(ze,{children:(0,Q.jsx)(X,{variant:`outline`,size:`sm`,disabled:y.waiting,onClick:y.run,children:`Try again`})})]})}),t[120]=R,t[121]=y.failed,t[122]=y.run,t[123]=y.waiting,t[124]=k.summary.expires,t[125]=fe,t[126]=dn):dn=t[126];let fn;t[127]!==K||t[128]!==G?(fn=q(G)&&(0,Q.jsx)(`div`,{className:`px-4 py-2`,children:(0,Q.jsxs)(lo,{variant:`destructive`,children:[(0,Q.jsx)(rr,{children:`This revision could not be recorded as seen.`}),(0,Q.jsx)(ze,{children:(0,Q.jsx)(X,{variant:`outline`,size:`sm`,disabled:G.waiting,onClick:K,children:`Try again`})})]})}),t[127]=K,t[128]=G,t[129]=fn):fn=t[129];let pn;t[130]===We?pn=t[131]:(pn=We&&(0,Q.jsx)(`div`,{className:`px-4 pt-3`,children:(0,Q.jsx)(he,{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]=pn);let mn;t[132]===Symbol.for(`react.memo_cache_sentinel`)?(mn=(0,Q.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading review content…`}),t[132]=mn):mn=t[132];let hn=(fe!==`summary`||L)&&(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start`,children:[(0,Q.jsx)(E2,{stops:He,current:fe===`summary`?void 0:Ke.key,done:Ze,onGo:nt,page:Re.element}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[q(re)&&(0,Q.jsxs)(`p`,{role:`alert`,className:`p-3 text-sm`,children:[`Reviewed marks could not be read.`,` `,(0,Q.jsx)(X,{variant:`outline`,size:`xs`,onClick:ie,children:`Try again`})]}),fe===`summary`&&R===k.summary.expires&&y.failed&&(0,Q.jsx)(g,{description:`A fresh link to the agent's page could not be read. Check the connection and try again.`,onRetry:y.run}),fe===`summary`&&!(R===k.summary.expires&&y.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)(j4,{revision:s,page:F,url:R===k.summary.expires?void 0:I,dark:se,stops:He,done:Ze,onGo:nt})}),fe!==`summary`&&Ke.kind===`briefing`&&(0,Q.jsx)(Y2,{...ot,revision:s,latestRevision:o.review?.latestRevision??s.revision,title:Tt,pullRequestChip:Nt,proofCurrent:b&&s.headOid===D,margin:(0,Q.jsx)(_2,{data:o,revision:s,context:c,onRevision:u,onDeleted:p??f,onBack:J?f:void 0}),stops:He,items:Je,decisions:qe,done:Ze,onGo:nt}),fe!==`summary`&&Ke.kind!==`briefing`&&(0,Q.jsxs)(`section`,{role:`region`,"aria-label":Ke.kind===`decision`?pm(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)(o4,{proofCurrent:b&&s.headOid===D,stop:Ke,total:Qe,pullRequestChip:Nt,review:k,revision:s,scope:M,context:c,decision:qe.get(Ke.layer.id),finished:Ze(Ke),items:Je,onGo:nt,onStep:it},Ke.key),(0,Q.jsx)(J2,{children:(0,Q.jsx)(V4,{revision:s,place:Ke.key,paths:Ke.paths,scope:M,context:c,active:Te&&fe===`walkthrough`,marks:ae??{files:[],decisions:[]},steps:Ke.layer.steps,decision:!0},Ke.key)})]}):(0,Q.jsx)(b4,{stops:He,current:Ke,revision:s,record:Et,items:Je,threads:Dt,pullRequest:wt?.kind===`available`?wt.pullRequest:void 0,archivable:Et?mr(Et,wt):!1,status:Et&&qo(Et,wt)?{...ms({revision:s,marks:ae,status:w?.status,pull:wt}),group:`Closed`}:ms({revision:s,marks:ae,status:w?.status,pull:wt}),scope:M,context:c,onGo:nt,code:e=>(0,Q.jsx)(V4,{revision:s,place:e.key,paths:e.paths,scope:M,context:c,active:Te&&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)(r5,{children:(0,Q.jsx)(M4,{label:Ke.kind===`decision`?`Decision ${Ke.number} of ${Qe}`:fm(Ke),shortLabel:Ke.kind===`decision`?`${Ke.number} of ${Qe}`:fm(Ke),compactLabel:Ke.kind===`decision`?`${Ke.number}/${Qe}`:`${He.findIndex(e=>e.key===Ke.key)+1}/${He.length}`,stops:He,current:Ke.key,onGo:nt,onPrevious:et(-1),onNext:et(1),children:Ke.kind===`decision`?(0,Q.jsx)(a5,{revision:s,layerId:Ke.layer.id,fingerprint:Ke.layer.fingerprint,reviewed:Ze(Ke),files:s.files.filter(e=>Ke.paths.includes(e.path)),settled:$e(re),context:c}):(0,Q.jsx)(o5,{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:$e(re),context:c})})})]},Ke.key)]})]}),gn;t[133]===hn?gn=t[134]:(gn=(0,Q.jsx)(Z.Suspense,{fallback:mn,children:hn}),t[133]=hn,t[134]=gn);let _n;t[135]!==en||t[136]!==tn||t[137]!==nn||t[138]!==on||t[139]!==cn||t[140]!==ln||t[141]!==un||t[142]!==dn||t[143]!==fn||t[144]!==pn||t[145]!==gn?(_n=(0,Q.jsxs)(`section`,{ref:en,"aria-label":`Review walkthrough`,"aria-hidden":tn,inert:nn,className:on,style:sn,children:[cn,ln,un,dn,fn,pn,gn]}),t[135]=en,t[136]=tn,t[137]=nn,t[138]=on,t[139]=cn,t[140]=ln,t[141]=un,t[142]=dn,t[143]=fn,t[144]=pn,t[145]=gn,t[146]=_n):_n=t[146];let vn=_n,yn=fe===`changes`&&$t,bn;t[147]!==yn||t[148]!==vn?(bn=(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[yn,vn]}),t[147]=yn,t[148]=vn,t[149]=bn):bn=t[149];let xn=bn;if(!J)return xn;let Sn;t[150]!==kt||t[151]!==Ft?(Sn=(0,Q.jsx)(n5,{onShow:kt,onToggle:Ft}),t[150]=kt,t[151]=Ft,t[152]=Sn):Sn=t[152];let Cn;t[153]!==Ee||t[154]!==zt||t[155]!==Oe||t[156]!==Le||t[157]!==Ae||t[158]!==kt||t[159]!==Ft?(Cn=Ee&&(0,Q.jsx)(U8,{surfaces:t5,names:zt,published:!0,surface:`changes`,open:Oe,onSelect:kt,onHide:()=>Ae(!1),onToggle:Ft,toggleRef:e=>Le.attach(e)}),t[153]=Ee,t[154]=zt,t[155]=Oe,t[156]=Le,t[157]=Ae,t[158]=kt,t[159]=Ft,t[160]=Cn):Cn=t[160];let wn=ps,Tn;t[161]===zt.changes?Tn=t[162]:(Tn=(0,Q.jsx)(Xt,{children:zt.changes}),t[161]=zt.changes,t[162]=Tn);let En;t[163]===Symbol.for(`react.memo_cache_sentinel`)?(En=(0,Q.jsx)(Mr,{children:`Readiness, changed files and comments of this review.`}),t[163]=En):En=t[163];let On;t[164]===Tn?On=t[165]:(On=(0,Q.jsxs)(as,{className:`sr-only`,children:[Tn,En]}),t[164]=Tn,t[165]=On);let kn=!Ee&&Bt(`sheet`),An;return t[166]!==wn||t[167]!==On||t[168]!==kn?(An=(0,Q.jsxs)(wn,{className:`w-[min(90vw,22rem)]!`,showCloseButton:!1,children:[On,kn]}),t[166]=wn,t[167]=On,t[168]=kn,t[169]=An):An=t[169],(0,Q.jsxs)(Ko,{open:Fe&&!Ee,onOpenChange:Ie,children:[Sn,(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:[(0,Q.jsx)(L4,{revision:s,context:c,navigation:i,layout:Se,focused:ge,onOpen:we,review:xn,reviewActions:_t,panelControl:Ht}),Ee&&Oe&&(0,Q.jsx)(`div`,{className:`ml-2 w-80 shrink-0`,children:Bt(`docked`)}),Cn]}),An]})}function X8(e){return e.path}function Z8(e){return!e}function Q8(e){return!e}function $8(e){return e.reviewStatus===`reviewed`}function e5(e){return e.path}var t5=[`changes`];function n5(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],Qs(Ic.surfaceReview,n,i);let a;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a={ignoreInputs:!0},t[1]=a):a=t[1],Qs(Ic.toggleSidebar,r,a),null}function r5(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)(J2,{children:n})}),t[0]=n,t[1]=r),r}function i5(e){return e.flatMap(e=>{let t=e.newOid??e.oldOid;return t?[{path:e.path,headBlobOid:t}]:[]})}function a5(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=Us({connection:s.connection,reviewId:n.reviewId}),t[0]=s.connection,t[1]=n.reviewId,t[2]=l):l=t[2];let u=l,[d,f]=wr(u.completeDecision),[p,m]=wr(u.unmark),h=a?`outline`:`default`,g=!o||d.waiting||p.waiting,_;t[3]!==c||t[4]!==i||t[5]!==r||t[6]!==f||t[7]!==a||t[8]!==n.revision||t[9]!==m?(_=()=>a?m({kind:`decision`,layerId:r,fingerprint:i}):f({revision:n.revision,layerId:r,fingerprint:i,files:i5(c)}),t[3]=c,t[4]=i,t[5]=r,t[6]=f,t[7]=a,t[8]=n.revision,t[9]=m,t[10]=_):_=t[10];let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(ci,{}),t[11]=v):v=t[11];let y=a?`Decision reviewed`:`Mark decision reviewed`,b;t[12]!==a||t[13]!==h||t[14]!==g||t[15]!==_||t[16]!==y?(b=(0,Q.jsxs)(X,{type:`button`,variant:h,"aria-pressed":a,disabled:g,onClick:_,children:[v,y]}),t[12]=a,t[13]=h,t[14]=g,t[15]=_,t[16]=y,t[17]=b):b=t[17];let x;t[18]!==p||t[19]!==d?(x=(q(d)||q(p))&&(0,Q.jsx)(`p`,{role:`alert`,className:`px-2 text-xs text-destructive`,children:`Not saved. Try again.`}),t[18]=p,t[19]=d,t[20]=x):x=t[20];let S;return t[21]!==b||t[22]!==x?(S=(0,Q.jsxs)(Q.Fragment,{children:[b,x]}),t[21]=b,t[22]=x,t[23]=S):S=t[23],S}function o5(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=Us({connection:a.connection,reviewId:n.reviewId}),t[0]=a.connection,t[1]=n.reviewId,t[2]=o):o=t[2];let[s,c]=wr(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:i5(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)(ci,{}),t[7]=d):d=t[7];let f;t[8]===r.length?f=t[9]:(f=r.length===0?`Every file reviewed`:`Mark ${fi(r.length,`file`)} reviewed`,t[8]=r.length,t[9]=f);let p;t[10]!==l||t[11]!==u||t[12]!==f?(p=(0,Q.jsxs)(X,{type:`button`,variant:`default`,disabled:l,onClick:u,children:[d,f]}),t[10]=l,t[11]=u,t[12]=f,t[13]=p):p=t[13];let m;t[14]===s?m=t[15]:(m=q(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]=m);let h;return t[16]!==p||t[17]!==m?(h=(0,Q.jsxs)(Q.Fragment,{children:[p,m]}),t[16]=p,t[17]=m,t[18]=h):h=t[18],h}function s5(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=um(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],Qs(Ic.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],Qs(Ic.previousStop,l,u),null}function c5(e){let t=(0,$.c)(25),{scope:n,context:r,active:i,toolbarTarget:a,onOpen:o,onBrowse:s}=e,c=nQ(n,r),[l,u]=(0,Z.useState)(),d=c.review?.reviewId,f=zZ(d??``);if(De(c.result)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(hn,{label:`Loading review`}),t[0]=e):e=t[0],e}if(q(c.result)){let e;return t[1]===c.refresh?e=t[2]:(e=(0,Q.jsx)(g,{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)(he,{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 p=c.review?.proof.current,m;t[4]===f?m=t[5]:(m=()=>f.choose(void 0),t[4]=f,t[5]=m);let h;t[6]!==c||t[7]!==d?(h=()=>{u(d),c.refresh()},t[6]=c,t[7]=d,t[8]=h):h=t[8];let _;t[9]===s?_=t[10]:(_=e=>s(`changes`,e),t[9]=s,t[10]=_);let v;return t[11]!==i||t[12]!==r||t[13]!==o||t[14]!==d||t[15]!==n||t[16]!==f.choose||t[17]!==f.request||t[18]!==f.revision||t[19]!==p||t[20]!==m||t[21]!==h||t[22]!==_||t[23]!==a?(v=(0,Q.jsx)(W8,{toolbarTarget:a,onOpen:o,proofCurrent:p,active:i,reviewId:d,revision:f.revision,context:r,onRevision:f.choose,onBack:m,onDeleted:h,onShowReviewPanel:_,liveScope:n},f.request),t[11]=i,t[12]=r,t[13]=o,t[14]=d,t[15]=n,t[16]=f.choose,t[17]=f.request,t[18]=f.revision,t[19]=p,t[20]=m,t[21]=h,t[22]=_,t[23]=a,t[24]=v):v=t[24],v}function l5(e){let t=(0,$.c)(8),n=nQ(e.scope,e.context);if(n.review?.reviewId){let n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(c5,{...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=Ye(Dn(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)(i2,{...e,intro:r}),t[5]=e,t[6]=r,t[7]=i):i=t[7],i}var u5=[{value:`uncommitted`,label:`Uncommitted`,Icon:bf},{value:`branch`,label:`Branch`,Icon:Hf}];function d5(e){let t=(0,$.c)(6),{value:n,onValueChange:r}=e,i;t[0]===r?i=t[1]:(i=e=>{Cq(e)&&r(e)},t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Hn,{"aria-label":`Compare`,children:u5.map(f5)}),t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==n?(o=(0,Q.jsx)(Pe,{className:`shrink-0`,value:n,onValueChange:i,children:a}),t[3]=i,t[4]=n,t[5]=o):o=t[5],o}function f5(e){let{value:t,label:n,Icon:r}=e;return(0,Q.jsxs)(ke,{children:[(0,Q.jsxs)(Ts,{render:(0,Q.jsx)(ar,{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)(tt,{children:n})]},t)}function p5(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)(m5,{...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)(I4,{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 m5(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=pZ(),[p,m]=(0,Z.useState)(f);p!==f&&(m(f),f&&u&&(l(!0),d(!1)));let h=nL(),g=nL(),_=nL(),{isMobile:v,open:y,openMobile:b}=pr(),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}=kZ(n.id),D=zP(C,o.connection),O=nQ(C,o),k;t[3]===D?k=t[4]:(k=me(Dn(D)),t[3]=D,t[4]=k);let A=k,j;t[5]===O.result?j=t[6]:(j=me(Dn(O.result)),t[5]=O.result,t[6]=j);let M=j,N;t[7]!==w||t[8]!==i.entry||t[9]!==i.side?(N=!w&&!Yq(i.entry)&&!Yq(i.side),t[7]=w,t[8]=i.entry,t[9]=i.side,t[10]=N):N=t[10];let P=N,F=!P||!A&&!M,I;t[11]!==D||t[12]!==O.review?(I=O.review||(Vn(Dn(D))?.changes.length??0)>0?Jq({kind:`handoff`}):null,t[11]=D,t[12]=O.review,t[13]=I):I=t[13];let L=I,R=u&&!f,z;t[14]!==L||t[15]!==T||t[16]!==_.element||t[17]!==a||t[18]!==F||t[19]!==i.entry||t[20]!==i.side||t[21]!==E||t[22]!==R||t[23]!==n.id?(z={worktreeId:n.id,entry:i.entry,side:i.side,onSearch:a,fallback:L,focused:T,setFocused:E,ready:F,focusBoundary:_.element,focusBoundaryOpen:R},t[14]=L,t[15]=T,t[16]=_.element,t[17]=a,t[18]=F,t[19]=i.entry,t[20]=i.side,t[21]=E,t[22]=R,t[23]=n.id,t[24]=z):z=t[24];let B=JZ(z),V;t[25]!==T||t[26]!==B.split?(V=mJ(y5(B.split,T)),t[25]=T,t[26]=B.split,t[27]=V):V=t[27];let H=V,U;t[28]!==c||t[29]!==h?(U=()=>{c&&h.element?.focus(),l(g5)},t[28]=c,t[29]=h,t[30]=U):U=t[30];let W=U,G;t[31]!==f||t[32]!==W?(G=()=>{f?W():d(h5)},t[31]=f,t[32]=W,t[33]=G):G=t[33];let K;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(K={ignoreInputs:!0},t[34]=K):K=t[34],Qs(Ic.toggleSidebar,G,K);let[ee,te]=(0,Z.useState)(),q;t[35]!==T||t[36]!==B||t[37]!==a?(q=(e,t,n)=>{let r=Jq(e),i=+(T===0),o=n?.toSide?i:B.open(T,r);te(t?{anchor:t,nonce:Date.now(),pane:o,key:r,...n?.compose?{compose:!0}:{}}:void 0);let s=t?pi(t):void 0;n?.toSide&&B.openToSide(T,r),s!==void 0&&a({base:s}),d(!1)},t[35]=T,t[36]=B,t[37]=a,t[38]=q):q=t[38];let ne=q,re;t[39]===a?re=t[40]:(re=e=>{a({surface:e})},t[39]=a,t[40]=re);let ie=re,ae;t[41]!==f||t[42]!==ie?(ae=e=>{ie(e),f?l(!0):d(!0)},t[41]=f,t[42]=ie,t[43]=ae):ae=t[43];let oe=ae,se;t[44]===oe?se=t[45]:(se=()=>oe(`changes`),t[44]=oe,t[45]=se);let ce;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ce={ignoreInputs:!0},t[46]=ce):ce=t[46],Qs(Ic.surfaceReview,se,ce);let le;t[47]===oe?le=t[48]:(le=()=>oe(`files`),t[47]=oe,t[48]=le);let ue;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ue={ignoreInputs:!0},t[49]=ue):ue=t[49],Qs(Ic.surfaceFiles,le,ue);let de;t[50]===oe?de=t[51]:(de=()=>oe(`history`),t[50]=oe,t[51]=de);let fe;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(fe={ignoreInputs:!0},t[52]=fe):fe=t[52],Qs(Ic.surfaceHistory,de,fe);let pe=nL(),J;t[53]!==pe||t[54]!==oe?(J=(e,t)=>{pe.attach(t),oe(e)},t[53]=pe,t[54]=oe,t[55]=J):J=t[55];let he=J,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,Te,Ee,De,Oe,Ae,je,Me;if(t[59]!==he||t[60]!==pe||t[61]!==o||t[62]!==f||t[63]!==T||t[64]!==B||t[65]!==u||t[66]!==_||t[67]!==g||t[68]!==s||t[69]!==v||t[70]!==y||t[71]!==b||t[72]!==P||t[73]!==a||t[74]!==ne||t[75]!==D||t[76]!==c||t[77]!==O||t[78]!==h||t[79]!==ee||t[80]!==C||t[81]!==i.base||t[82]!==ie||t[83]!==oe||t[84]!==H||t[85]!==x||t[86]!==ge||t[87]!==_e||t[88]!==ve||t[89]!==W||t[90]!==n.available||t[91]!==n.path){let e={scope:ge,onScope:_e,onBase:ve},r=B.panes[T]?.active??void 0,p=t=>(0,Q.jsx)(I8,{layout:t,scope:C,context:o,worktreePath:n.path,surface:x,activeEntry:r,available:n.available,onSurface:ie,onOpen:ne,sideLabel:H,changes:{...e,base:i.base,onBase:e=>a({base:e})}}),m;t[105]!==pe||t[106]!==o||t[107]!==f||t[108]!==B||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)(oZ,{scope:C,context:o}),(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Ts,{render:(0,Q.jsx)(X,{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":Ic.toggleSidebar,onClick:()=>{pe.attach(null),B.selectPane(e),d(!0)},children:(0,Q.jsx)(gp,{})})}),(0,Q.jsxs)(tt,{role:`tooltip`,className:`break-all`,children:[`Review `,(0,Q.jsx)(eL,{children:uc(Ic.toggleSidebar)})]})]})]}),t[105]=pe,t[106]=o,t[107]=f,t[108]=B,t[109]=u,t[110]=g,t[111]=C,t[112]=m):m=t[112];let S=m,w;t[113]===ne?w=t[114]:(w=e=>ne({kind:`file`,path:e}),t[113]=ne,t[114]=w),t[115]!==o.connection||t[116]!==B.bindQuickOpen||t[117]!==B.recentFiles||t[118]!==C||t[119]!==w?(je=(0,Q.jsx)(nq,{bindPopup:B.bindQuickOpen,openFiles:B.recentFiles,scope:C,connection:o.connection,onOpen:w}),t[115]=o.connection,t[116]=B.bindQuickOpen,t[117]=B.recentFiles,t[118]=C,t[119]=w,t[120]=je):je=t[120];let E=v?0:480,k;t[121]!==o||t[122]!==C?(k=(0,Q.jsx)(AJ,{scope:C,context:o}),t[121]=o,t[122]=C,t[123]=k):k=t[123];let A;t[124]!==o||t[125]!==ne||t[126]!==C?(A=(0,Q.jsx)(jJ,{scope:C,context:o,onOpen:ne}),t[124]=o,t[125]=ne,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:[k,A,(0,Q.jsx)(_5,{reveal:ee,scope:C,context:o,overview:D,published:O,needsDefault:P,layout:B,base:i.base,changes:e,focused:T,onOpen:ne,onBrowse:he,navigationTrigger:s,navigatorIsMobile:v,navigatorOpen:y,navigatorOpenMobile:b,tabControls:S})]}),M;t[128]!==E||t[129]!==j?(M=(0,Q.jsx)(tK,{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)(nK,{"aria-label":`Document panes and side panel`,className:`w-2 bg-transparent after:w-2`}),(0,Q.jsx)(tK,{id:`review-sidebar`,defaultSize:320,minSize:260,maxSize:520,children:p(`docked`)})]}),F;t[131]!==M||t[132]!==N?(F=(0,Q.jsxs)(eK,{orientation:`horizontal`,className:`min-h-0 flex-1`,children:[M,N]}),t[131]=M,t[132]=N,t[133]=F):F=t[133];let I;t[134]!==f||t[135]!==c||t[136]!==O.review||t[137]!==h||t[138]!==oe||t[139]!==x||t[140]!==W?(I=f&&(0,Q.jsx)(U8,{surfaces:R8,names:z8(O.review),published:!!O.review,surface:x,open:c,onSelect:oe,onHide:()=>l(!1),onToggle:W,toggleRef:e=>h.attach(e)}),t[134]=f,t[135]=c,t[136]=O.review,t[137]=h,t[138]=oe,t[139]=x,t[140]=W,t[141]=I):I=t[141],t[142]!==F||t[143]!==I?(Me=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[F,I]}),t[142]=F,t[143]=I,t[144]=Me):Me=t[144],be=Ko,De=u&&!f,Oe=d,t[145]===B?Ae=t[146]:(Ae=e=>{e||B.focusDestination()},t[145]=B,t[146]=Ae),ye=ps,t[147]!==B||t[148]!==_?(xe=e=>{_.attach(e),e===null&&B.focusDestination()},t[147]=B,t[148]=_,t[149]=xe):xe=t[149],t[150]!==pe.element||t[151]!==B||t[152]!==_.element||t[153]!==g.element?(Se=()=>{if(B.hasDestinationFocus())return!1;let e=document.activeElement;return e===document.body||_.element?.contains(e)?pe.element?.isConnected?pe.element:g.element:!1},t[150]=pe.element,t[151]=B,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`)?(Te=(0,Q.jsxs)(as,{className:`sr-only`,children:[(0,Q.jsx)(Xt,{children:`Worktree review`}),(0,Q.jsx)(Mr,{children:`Choose a review surface and open a document.`})]}),t[155]=Te):Te=t[155],Ee=!f&&p(`sheet`),t[59]=he,t[60]=pe,t[61]=o,t[62]=f,t[63]=T,t[64]=B,t[65]=u,t[66]=_,t[67]=g,t[68]=s,t[69]=v,t[70]=y,t[71]=b,t[72]=P,t[73]=a,t[74]=ne,t[75]=D,t[76]=c,t[77]=O,t[78]=h,t[79]=ee,t[80]=C,t[81]=i.base,t[82]=ie,t[83]=oe,t[84]=H,t[85]=x,t[86]=ge,t[87]=_e,t[88]=ve,t[89]=W,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]=Te,t[99]=Ee,t[100]=De,t[101]=Oe,t[102]=Ae,t[103]=je,t[104]=Me}else ye=t[92],be=t[93],xe=t[94],Se=t[95],Ce=t[96],we=t[97],Te=t[98],Ee=t[99],De=t[100],Oe=t[101],Ae=t[102],je=t[103],Me=t[104];let Ne;t[156]!==ye||t[157]!==xe||t[158]!==Se||t[159]!==Ce||t[160]!==we||t[161]!==Te||t[162]!==Ee?(Ne=(0,Q.jsxs)(ye,{ref:xe,finalFocus:Se,className:Ce,showCloseButton:we,children:[Te,Ee]}),t[156]=ye,t[157]=xe,t[158]=Se,t[159]=Ce,t[160]=we,t[161]=Te,t[162]=Ee,t[163]=Ne):Ne=t[163];let Pe;t[164]!==be||t[165]!==De||t[166]!==Oe||t[167]!==Ae||t[168]!==Ne?(Pe=(0,Q.jsx)(be,{open:De,onOpenChange:Oe,onOpenChangeComplete:Ae,children:Ne}),t[164]=be,t[165]=De,t[166]=Oe,t[167]=Ae,t[168]=Ne,t[169]=Pe):Pe=t[169];let Fe;return t[170]!==je||t[171]!==Me||t[172]!==Pe?(Fe=(0,Q.jsxs)(Q.Fragment,{children:[je,Me,Pe]}),t[170]=je,t[171]=Me,t[172]=Pe,t[173]=Fe):Fe=t[173],Fe}function h5(e){return!e}function g5(e){return!e}function _5(e){let t=(0,$.c)(3),n=me(Dn(e.overview)),r=me(Dn(e.published.result));if(e.needsDefault&&n&&q(e.overview))throw Yt(e.overview.cause);if(e.needsDefault&&r&&q(e.published.result))throw Yt(e.published.result.cause);if(e.needsDefault&&(n||r)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(hn,{label:`Loading review`}),t[0]=e):e=t[0],e}let i;return t[1]===e?i=t[2]:(i=(0,Q.jsx)(v5,{...e}),t[1]=e,t[2]=i),i}function v5(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],Qs(Ic.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],Qs(Ic.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],Qs(Ic.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],Qs(Ic.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:Zq(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)(b5,{...D(0)}),t[35]=D,t[36]=A);let j;t[37]!==k||t[38]!==A?(j=(0,Q.jsx)(tK,{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)(nK,{"aria-label":p?`Top and bottom document panes`:`Left and right document panes`,withHandle:!0}),(0,Q.jsx)(tK,{id:`pane-right`,minSize:p?200:320,children:(0,Q.jsx)(b5,{...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)(eK,{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 y5(e,t){return e?t===0?`left`:`right`:null}function b5(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}=nL(),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=Yq(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=aQ(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=Y(`@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)(ke,{children:[(0,Q.jsx)(Ts,{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":ul()===`mac`?`Meta+B`:`Control+B`,onClick:()=>{!g&&_&&requestAnimationFrame(()=>h.element?.focus())}})}),(0,Q.jsxs)(tt,{role:`tooltip`,className:`break-all`,children:[`Toggle Sidebar`,` `,(0,Q.jsx)(eL,{children:uc(Ic.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=y5(a,r),t[23]=r,t[24]=a,t[25]=z):z=t[25];let B;t[26]!==r||t[27]!==i?(B=eQ(i,r),t[26]=r,t[27]=i,t[28]=B):B=t[28];let V=E?.kind===`handoff`&&!u&&(0,Q.jsx)(d5,{value:f.scope,onValueChange:f.onScope}),H=(E?.kind===`branch`||E?.kind===`handoff`&&!u&&f.scope===`branch`)&&(0,Q.jsx)(_8,{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)(cQ,{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)(_8,{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=Yq(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:Y(`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)(I4,{documentKey:e,connection:c.connection,scope:s,children:(0,Q.jsx)(Z0,{handoff:l5,scope:s,context:c,document:l,sideLabel:mJ(y5(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{hF as A,TI as C,IF as D,zF as E,Ew as M,np as N,RF as O,Hf as P,LI as S,FF as T,HH as _,vJ as a,eL as b,kq as c,xq as d,_q as f,QU as g,rK as h,X0 as i,mF as j,kF as k,Tq as l,iK as m,G8 as n,Jq as o,cK as p,W8 as r,eJ as s,p5 as t,wq as u,MH as v,AF as w,tL as x,nL as y};