@eliya-oss/agent-diff 0.1.0-alpha.217 → 0.1.0-alpha.219

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 (58) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/main.js +1 -1
  3. package/dist/web/nitro.json +1 -1
  4. package/dist/web/public/assets/index-Bh4VvgUA.css +2 -0
  5. package/dist/web/public/assets/index-Drcgn18b.js +12 -0
  6. package/dist/web/public/assets/{rolldown-runtime-XKyaHtl9.js → jsx-runtime-EIAPxkjE.js} +1 -1
  7. package/dist/web/public/assets/review-n355efiY.js +44 -0
  8. package/dist/web/public/assets/routes-CS6_XKJl.js +1 -0
  9. package/dist/web/server/_libs/@base-ui/react+[...].mjs +2686 -4472
  10. package/dist/web/server/_libs/@tanstack/react-router+[...].mjs +1 -107
  11. package/dist/web/server/_libs/lucide-react.mjs +93 -268
  12. package/dist/web/server/_libs/react-markdown+[...].mjs +1 -1
  13. package/dist/web/server/_libs/valibot.mjs +1 -59
  14. package/dist/web/server/_ssr/highlight.server-Ch_kPZFd.mjs +199 -0
  15. package/dist/web/server/_ssr/{listener.functions-DygHonX4.mjs → listener.functions-D_FW10zU.mjs} +7 -7
  16. package/dist/web/server/_ssr/{listener.server-BUJSjrgf.mjs → listener.server-CNBuLJaL.mjs} +3 -2
  17. package/dist/web/server/_ssr/{review-block-BpqPNXDo.mjs → review-C9HjDh4D.mjs} +5200 -5492
  18. package/dist/web/server/_ssr/review-folder.server-uYIw59BJ.mjs +361 -0
  19. package/dist/web/server/_ssr/{adhoc.functions-CDadmCcu.mjs → review-link.functions-CWIHejdy.mjs} +12 -11
  20. package/dist/web/server/_ssr/review-link.server-Ch6ScuIv.mjs +196 -0
  21. package/dist/web/server/_ssr/{review-parts.server-j_3LS0HZ.mjs → review-parts.server-ZuyuH_iS.mjs} +2 -2
  22. package/dist/web/server/_ssr/review-read.functions-nFrtWtAD.mjs +37 -0
  23. package/dist/web/server/_ssr/{live-schema-BYm_IvNp.mjs → review-schema-C0qXng9-.mjs} +5 -64
  24. package/dist/web/server/_ssr/review-target.server-DpaZaVu9.mjs +18 -0
  25. package/dist/web/server/_ssr/{review.functions-Cvig5BYP.mjs → review.functions-ByriVZbF.mjs} +19 -17
  26. package/dist/web/server/_ssr/review.server-BVLvmBWu.mjs +856 -0
  27. package/dist/web/server/_ssr/{router-CD3AbIAr.mjs → router-D1afwNBo.mjs} +119 -257
  28. package/dist/web/server/_ssr/routes-6k-4pwuW.mjs +20 -0
  29. package/dist/web/server/_ssr/ssr.mjs +36 -72
  30. package/dist/web/server/_ssr/{thread-code-BWhoBW-5.mjs → thread-code-CYNB3wg5.mjs} +2 -3
  31. package/dist/web/server/_ssr/{type-hover-DSq-tkS_.mjs → type-hover-BWVNL2Vt.mjs} +2 -3
  32. package/dist/web/server/_ssr/{type-hover.functions-B_9iC3Xs.mjs → type-hover.functions-YBMXC9UU.mjs} +6 -5
  33. package/dist/web/server/_tanstack-start-manifest_v-B_8y6kG9.mjs +30 -0
  34. package/dist/web/server/index.mjs +25 -88
  35. package/package.json +1 -1
  36. package/dist/web/public/assets/_deck-CklUZ5Lb.js +0 -1
  37. package/dist/web/public/assets/_point-CXnTY-uf.js +0 -1
  38. package/dist/web/public/assets/adhoc.functions-C2dHzbMd.js +0 -1
  39. package/dist/web/public/assets/decks.functions-tXNTG2sC.js +0 -2
  40. package/dist/web/public/assets/index-B1ZY8zdK.css +0 -2
  41. package/dist/web/public/assets/index-DwC305SP.js +0 -11
  42. package/dist/web/public/assets/preload-helper-D5PXivxI.js +0 -1
  43. package/dist/web/public/assets/review-DAeFpudT.js +0 -1
  44. package/dist/web/public/assets/review-block-ILzR6Z95.js +0 -47
  45. package/dist/web/public/assets/routes-CVPv3eOL.js +0 -1
  46. package/dist/web/public/assets/shortcuts-BsNWbUaT.js +0 -1
  47. package/dist/web/public/assets/use-window-event-BDUVK1pJ.js +0 -1
  48. package/dist/web/public/assets/viewed-store-CbsF-9u7.js +0 -1
  49. package/dist/web/server/_deck-yL0m-bqz.mjs +0 -387
  50. package/dist/web/server/_libs/yaml.mjs +0 -6585
  51. package/dist/web/server/_point-C3P2_j2t.mjs +0 -1528
  52. package/dist/web/server/_ssr/decks.functions-BHxu668D.mjs +0 -1073
  53. package/dist/web/server/_ssr/review-CsjxwbVP.mjs +0 -58
  54. package/dist/web/server/_ssr/review-target.server-DA41RDao.mjs +0 -1779
  55. package/dist/web/server/_ssr/routes-CvszJ1sA.mjs +0 -27
  56. package/dist/web/server/_ssr/shortcuts-B7llaLLc.mjs +0 -228
  57. package/dist/web/server/_ssr/viewed-store-DGoAmvYO.mjs +0 -198
  58. package/dist/web/server/_tanstack-start-manifest_v-D8b_yVnx.mjs +0 -56
@@ -0,0 +1,44 @@
1
+ import{$ as e,$n as t,$t as n,A as r,An as i,Ar as a,At as o,B as s,Bn as c,Bt as l,C as u,Cn as d,Cr as f,Ct as p,D as m,Dr as h,Dt as g,E as _,Er as v,Et as y,F as b,Fn as x,Ft as S,G as C,Gn as w,Gt as T,H as E,Hn as D,Ht as O,I as k,In as A,It as ee,J as j,Jn as M,Jt as N,K as P,Kn as F,Kt as te,L as I,Ln as ne,Lt as L,M as re,Mn as ie,Mt as ae,N as oe,Nn as se,O as R,Or as z,Ot as ce,P as le,Pn as ue,Pt as de,Q as B,Qn as V,Qt as fe,R as pe,Rn as H,Rt as me,S as he,Sn as ge,Sr as _e,St as ve,T as ye,Tn as be,Tr as xe,Tt as Se,U as Ce,Un as we,Ut as Te,V as Ee,Vn as De,Vt as Oe,W as ke,Wn as Ae,Wt as je,X as Me,Xn as Ne,Xt as Pe,Y as Fe,Yn as Ie,Yt as Le,Z as Re,Zn as ze,Zt as Be,_ as Ve,_r as He,_t as Ue,a as We,an as Ge,ar as Ke,at as qe,b as Je,bn as Ye,br as Xe,bt as Ze,c as Qe,cn as $e,cr as et,ct as tt,d as nt,dn as rt,dr as it,dt as at,en as ot,er as st,et as ct,f as lt,fn as ut,fr as dt,ft,g as pt,gn as mt,gr as U,gt as ht,h as gt,hr as W,ht as _t,i as vt,in as yt,ir as bt,it as xt,j as St,jt as Ct,k as wt,kr as Tt,kt as Et,l as Dt,lr as Ot,lt as kt,m as At,mn as jt,mr as Mt,mt as Nt,n as Pt,nn as Ft,nr as It,nt as Lt,o as Rt,on as zt,or as Bt,ot as Vt,p as Ht,pn as Ut,pr as Wt,pt as Gt,q as Kt,qn as qt,qt as Jt,r as Yt,rn as Xt,rr as Zt,rt as Qt,s as $t,sn as en,sr as tn,st as nn,t as rn,tn as an,tr as G,tt as on,u as sn,un as cn,ur as ln,ut as un,v as dn,vn as fn,vr as pn,vt as mn,w as hn,wn as gn,wr as _n,wt as vn,x as yn,xn as bn,xr as xn,xt as Sn,y as Cn,yn as wn,yr as Tn,yt as En,z as Dn,zn as On,zt as kn}from"./index-Drcgn18b.js";import{i as An,n as jn,r as Mn,t as Nn}from"./jsx-runtime-EIAPxkjE.js";var Pn={name:`arrow-down-to-line`,size:24,node:[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]};Pn.node;var Fn=v(Pn),In={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};In.node;var Ln=v(In),Rn={name:`arrow-up-to-line`,size:24,node:[[`path`,{d:`M5 3h14`,key:`7usisc`}],[`path`,{d:`m18 13-6-6-6 6`,key:`1kf1n9`}],[`path`,{d:`M12 7v14`,key:`1akyts`}]]};Rn.node;var zn=v(Rn),Bn={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Bn.node;var Vn=v(Bn),Hn={name:`check-check`,size:24,node:[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]};Hn.node;var Un=v(Hn),Wn={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Wn.node;var Gn=v(Wn),Kn={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};Kn.node;var qn=v(Kn),Jn={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Jn.node;var Yn=v(Jn),Xn={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Xn.node;var Zn=v(Xn),Qn={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Qn.node;var $n=v(Qn),er={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`}]]};er.node;var tr=v(er),nr={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`}]]};nr.node;var rr=v(nr),ir={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};ir.node;var ar=v(ir),or={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};or.node;var sr=v(or),cr={name:`clipboard-copy`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`,key:`4jdomd`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`,key:`3hqy98`}],[`path`,{d:`M21 14H11`,key:`1bme5i`}],[`path`,{d:`m15 10-4 4 4 4`,key:`5dvupr`}]]};cr.node;var lr=v(cr),ur={name:`copy`,size:24,node:[[`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`}]]};ur.node;var dr=v(ur),fr={name:`corner-down-left`,size:24,node:[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]};fr.node;var pr=v(fr),mr={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`]};mr.node;var hr=v(mr),gr={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`}]]};gr.node;var _r=v(gr),vr={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`}]]};vr.node;var yr=v(vr),br={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 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.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};br.node;var xr=v(br),Sr={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`}]]};Sr.node;var Cr=v(Sr),wr={name:`git-compare`,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`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]};wr.node;var Tr=v(wr),Er={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`}]]};Er.node;var Dr=v(Er),Or={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`}]]};Or.node;var kr=v(Or),Ar={name:`layers-2`,size:24,node:[[`path`,{d:`M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z`,key:`15q6uc`}],[`path`,{d:`m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845`,key:`byia6g`}]]};Ar.node;var jr=v(Ar),Mr={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};Mr.node;var Nr=v(Mr),Pr={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};Pr.node;var Fr=v(Pr),Ir={name:`list-ordered`,size:24,node:[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]};Ir.node;var Lr=v(Ir),Rr={name:`locate-fixed`,size:24,node:[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Rr.node;var zr=v(Rr),Br={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`}]]};Br.node;var Vr=v(Br),Hr={name:`messages-square`,size:24,node:[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]};Hr.node;var Ur=v(Hr),Wr={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};Wr.node;var Gr=v(Wr),Kr={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`}]]};Kr.node;var qr=v(Kr),Jr={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};Jr.node;var Yr=v(Jr),Xr={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Xr.node;var Zr=v(Xr),Qr={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Qr.node;var $r=v(Qr),ei={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};ei.node;var ti=v(ei),ni={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};ni.node;var ri=v(ni),ii={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`}]]};ii.node;var ai=v(ii),oi={name:`sparkle`,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`}]]};oi.node;var si=v(oi),ci={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`]};ci.node;var li=v(ci),ui={name:`square-arrow-out-up-right`,size:24,node:[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]],aliases:[`arrow-up-right-from-square`]};ui.node;var di=v(ui),fi={name:`square-dashed-text`,size:24,node:[[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 14v1`,key:`169vum`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M9 3h1`,key:`1yesri`}]],aliases:[`text-selection`,`text-select`]};fi.node;var pi=v(fi),mi={name:`square-terminal`,size:24,node:[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]],aliases:[`terminal-square`]};mi.node;var hi=v(mi),gi={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};gi.node;var _i=v(gi),vi={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};vi.node;var yi=v(vi),bi={name:`text-wrap`,size:24,node:[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]],aliases:[`wrap-text`]};bi.node;var xi=v(bi),Si={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`]};Si.node;var Ci=v(Si),wi={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`]};wi.node;var Ti=v(wi),Ei={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Ei.node;var Di=v(Ei),Oi=0;function ki(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(Oi);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),tn;let o=requestAnimationFrame(a);return Oi=o,()=>{Oi===o&&(cancelAnimationFrame(o),Oi=0)}}var Ai={inert:new WeakMap,"aria-hidden":new WeakMap},ji=`data-base-ui-inert`,Mi={inert:new WeakSet,"aria-hidden":new WeakSet},Ni=new WeakMap,Pi=0;function Fi(e){return Mi[e]}function Ii(e){return e?xe(e)?e.host:Ii(e.parentNode):null}var Li=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Ii(t);return e.contains(n)?n:null}).filter(e=>e!=null),Ri=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},zi=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{pn(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function Bi(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=Li(t,e),l=i?zi(t,Ri(c),new Set(c)):[],u=[],d=[];if(a){let e=Ai[a],n=Fi(a);s=n,o=e;let r=Li(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);zi(t,Ri(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(Ni.get(e)||0)+1;Ni.set(e,t),d.push(e),t===1&&e.setAttribute(ji,``)}),Pi+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(Ni.get(e)||0)-1;Ni.set(e,t),t||e.removeAttribute(ji)}),--Pi,Pi||(Ai.inert=new WeakMap,Ai[`aria-hidden`]=new WeakMap,Mi.inert=new WeakSet,Mi[`aria-hidden`]=new WeakSet,Ni=new WeakMap)}}function Vi(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=it(e[0]).body;return Bi(e,a,n,r,{mark:i})}var K=An(a(),1),q=Nn();function Hi(e,t){let n=Xe(On(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var Ui=20,Wi=[];function Gi(){Wi=Wi.filter(e=>e.deref()?.isConnected)}function Ki(e){Gi(),e&&pn(e)!==`body`&&(Wi.push(new WeakRef(e)),Wi.length>Ui&&(Wi=Wi.slice(-20)))}function qi(){return Gi(),Wi[Wi.length-1]?.deref()}function Ji(e){return e?te(e)?e:Jt(e)[0]||e:null}function Yi(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=l(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return te(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Xi(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=U(()=>b.current.floatingContext?.nodeId),S=i===!1,C=bn(_)&&S,E=Xt(i),k=Xt(a),A=Xt(l),ee=Xt(g),j=Et(p),M=ae(),N=K.useRef(!1),P=K.useRef(!1),F=K.useRef(!1),I=K.useRef(null),re=K.useRef(``),ie=K.useRef(``),oe=K.useRef(null),se=K.useRef(null),R=et(oe,f,M?.beforeInsideRef),z=et(se,M?.afterInsideRef),ce=Ie(),le=Ie(),ue=Ft(),de=M!=null,B=Ye(v),V=U((e=B)=>e?Jt(e):[]),fe=U(()=>m?.().filter(e=>e!=null)??[]);K.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&H(B,ne(it(B)))&&V().length===0&&!C&&we(e)}let t=it(B);return Ge(t,`keydown`,e)},[r,B,s,C,V]),K.useEffect(()=>{if(r||!g)return;let e=it(B);function t(){F.current=!1}function n(e){let t=On(e),n=fe(),r=H(v,t)||H(_,t)||H(M?.portalNode,t)||n.some(e=>e===t||H(e,t));F.current=!r,ie.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(P.current=!0,le.start(0,()=>{P.current=!1}))}function i(){ie.current=`keyboard`}return yt(Ge(e,`pointerdown`,n,!0),Ge(e,`pointerup`,t,!0),Ge(e,`pointercancel`,t,!0),Ge(e,`keydown`,i,!0),t)},[r,v,_,B,g,M,le,fe]),K.useEffect(()=>{if(r||!c)return;let e=it(B);function t(){P.current=!0,le.start(0,()=>{P.current=!1})}function n(e){let t=On(e);te(t)&&(I.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=On(t);s&&n==null&&i!=null&&H(v,i)&&Ki(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=fe(),f=n?.hasAttribute(L(`focus-guard`))&&[oe.current,se.current,M?.beforeInsideRef.current,M?.afterInsideRef.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,vn(d),vn(u)].includes(n),p=!(H(_,n)||H(v,n)||H(n,v)||H(M?.portalNode,n)||l.some(e=>e===n||H(e,n))||c.hasMatchingElement(e=>H(e,n))||f||j&&(kn(j.nodesRef.current,a).find(e=>H(e.context?.elements.floating,n)||H(e.context?.elements.domReference,n))||me(j.nodesRef.current,a).find(e=>[e.context?.elements.floating,Ye(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&B&&Yi(B),o&&r!==_&&!Be(i)&&ne(e)===e.body){if(_e(B)&&(B.focus(),o===`popup`)){ue.request(()=>{B.focus()});return}let e=V(),t=I.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||B;_e(n)&&n.focus()}b.current.insideReactTree?b.current.insideReactTree=!1:(C||!s)&&n&&p&&!P.current&&(C||n!==qi())&&(N.current=!0,h.setOpen(!1,zt(cn,t)))})}function a(){F.current||(b.current.insideReactTree=!0,ce.start(0,()=>{b.current.insideReactTree=!1}))}let l=_e(_)?_:null;if(v||l)return yt(l&&Ge(l,`focusout`,i),l&&Ge(l,`pointerdown`,t),v&&Ge(v,`focusin`,n),v&&Ge(v,`focusout`,i),v&&M&&Ge(v,`focusout`,a,!0))},[r,_,v,B,s,j,M,h,c,o,V,C,x,b,ce,le,ue,u,d,fe]),K.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(M?.portalNode?.querySelectorAll(`[${L(`portal`)}]`)||[]),t=(j?me(j.nodesRef.current,x()):[]).find(e=>bn(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Vi([v,...e,oe.current,se.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,...fe(),t,vn(d),vn(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=Vi([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,M,C,j,x,u,d,fe]),W(()=>{if(!g||r||!_e(B))return;re.current=``,ie.current=``;let e=it(B),t=ne(e);queueMicrotask(()=>{let n=E.current,r=typeof n==`function`?n(A.current||``):n;if(r===void 0||r===!1||H(B,t))return;let i=null,a=()=>(i??=V(B),i[0]||B),o;o=r===!0||r===null?a():vn(r),o||=a();let s=H(B,ne(e));ki(o,{preventScroll:o===B,shouldFocus(){if(!ee.current)return!1;if(s)return!0;let t=ne(e);return!(t!==o&&H(B,t))}})})},[r,g,B,V,E,A,ee]),W(()=>{if(r||!B)return;let e=it(B),t=ne(e),n=A.current==null;Ki(t);function i(e){if(e.open||(re.current=Hi(e.nativeEvent,ie.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(N.current=!0),e.reason===`outside-press`){if(e.nested)N.current=!1;else if(De(e.nativeEvent)||D(e.nativeEvent))N.current=!1;else{let e=!1;it(B).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?N.current=!1:N.current=!0}}}y.on(`openchange`,i);function a(e){let r=k.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&pn(t)!==`body`?t:null,s=n?o||a:a||o;return s||=qi()||null,typeof i==`boolean`?s:vn(i)||s||null}return()=>{y.off(`openchange`,i);let t=ne(e),n=fe(),r=H(v,t)||n.some(e=>e===t||H(e,t))||j&&kn(j.nodesRef.current,x(),!1).some(e=>H(e.context?.elements.floating,t)),o=k.current,s=re.current,c=a(s);queueMicrotask(()=>{let n=Ji(c),i=typeof o!=`boolean`;if(o&&!N.current&&_e(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}N.current=!1})}},[r,v,B,k,A,y,j,_,x,fe]),W(()=>{if(!w||g||!v)return;let e=ne(it(v));_e(e)&&ge(e)&&H(v,e)&&e.blur()},[g,v]),W(()=>{if(!r&&M)return M.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{M.setFocusManagerState(null)}},[r,M,s,g,h,c,_]),W(()=>{if(!r&&B)return Yi(B),()=>{queueMicrotask(Gi)}},[r,B]);let pe=!r&&(!s||!C)&&(de||s);return(0,q.jsxs)(K.Fragment,{children:[pe&&(0,q.jsx)(ot,{"data-type":`inside`,ref:R,onFocus:e=>{if(s){let e=V();ki(e[e.length-1])}else M?.portalNode&&(N.current=!1,T(e,M.portalNode)?Oe(_)?.focus():vn(d??M.beforeOutsideRef)?.focus())}}),n,pe&&(0,q.jsx)(ot,{"data-type":`inside`,ref:z,onFocus:e=>{s?ki(V()[0]):M?.portalNode&&(c&&(N.current=!0),T(e,M.portalNode)?O(_)?.focus():vn(u??M.afterOutsideRef)?.focus())}})]})}function Zi(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:l=wn}=t,u=`rootStore`in e?e.rootStore:e,d=u.context.dataRef,f=K.useRef(void 0),p=Ft(),m=Ie(),h=K.useMemo(()=>{function e(e,t,n,r){let i=zt(l,t,n);e&&r===`touch`&&s>0?m.start(s,()=>{u.setOpen(!0,i)}):u.setOpen(e,i)}function t(e,t,n){let r=d.current.openEvent,a=u.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){f.current=c(e.pointerType,!0)&&D(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=f.current,o=n.nativeEvent,s=u.select(`open`);if(n.button!==0||r===`click`||c(i,!0)&&a)return;let l=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),d=On(o);if(ge(d)){e(l,o,d,i);return}let m=n.currentTarget;p.request(()=>{e(l,o,m,i)})},onClick(n){if(r===`mousedown-only`)return;let i=f.current;r===`mousedown`&&i?f.current=void 0:c(i,!0)&&a||e(t(u.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){f.current=void 0}}},[d,r,a,l,u,o,i,p,m,s]);return K.useMemo(()=>n?{reference:h}:Bt,[n,h])}function Qi(e,t,n,r){return{left:e,top:t,right:n,bottom:r,x:e,y:t,width:n-e,height:r-t}}function $i(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function ea(e){let t=[],n,r=1/0,i=1/0,a=-1/0,o=-1/0;for(let s of Array.from(e).sort((e,t)=>e.top-t.top)){if(r=Math.min(r,s.left),i=Math.min(i,s.top),a=Math.max(a,s.right),o=Math.max(o,s.bottom),!n||s.top-n.top>n.height/2)t.push($i(s));else{let e=t[t.length-1];e.left=Math.min(e.left,s.left),e.right=Math.max(e.right,s.right),e.bottom=Math.max(e.bottom,s.bottom),e.width=e.right-e.left,e.height=e.bottom-e.top}n=s}return{lines:t,fallback:Qi(r,i,a,o)}}function ta(e,t,n){return e.findIndex(e=>t>e.left-2&&t<e.right+2&&n>e.top-2&&n<e.bottom+2)}function na(e){return Qi(e.left,e.top,e.right,e.bottom)}function ra(e,t,n){let{lines:r}=ea(e.getClientRects());if(r.length<2)return;let i=ta(r,t,n);return{x:t,y:n,lineIndex:i===-1?void 0:i,element:e}}function ia(e,t,n){let{lines:r,fallback:i}=ea(e.getClientRects());if(r.length<2)return null;let a=n?.x,o=n?.y,s=t[0];if(n?.lineIndex!=null&&r[n.lineIndex])return na(r[n.lineIndex]);if(a!=null&&o!=null){let e=ta(r,a,o);if(e!==-1)return na(r[e])}if(r.length===2&&r[0].left>r[1].right&&a!=null&&o!=null)return i;if(s===`t`||s===`b`){let e=r[0],t=r[r.length-1],n=s===`t`?e:t;return Qi(n.left,e.top,n.right,t.bottom)}let c=s===`l`,l=r[0].left,u=r[0].right,d=c?1/0:-1/0,f=r[0],p=r[0];for(let e of r){l=Math.min(l,e.left),u=Math.max(u,e.right);let t=c?e.left:e.right;c&&t<d||!c&&t>d?(d=t,f=e,p=e):t===d&&(p=e)}return Qi(l,f.top,u,p.bottom)}function aa(e){return`contextElement`in e&&e.contextElement?e.contextElement:xn(e)?e:void 0}function oa(e,t,n,r){let i=ra(t,n,r);return e.current=i,i}function sa(e){return{name:`inline`,async fn(t){let n=t.elements.reference;if(typeof n?.getClientRects!=`function`)return{};let r=aa(n),i=e.current,a=i?.element===n||i?.element===r?i:void 0,o=ia(n,t.placement,a);if(!o||typeof t.platform.getElementRects!=`function`)return{};let s=await t.platform.getElementRects({reference:{contextElement:r,getBoundingClientRect(){return o}},floating:t.elements.floating,strategy:t.strategy});return t.rects.reference.x===s.reference.x&&t.rects.reference.y===s.reference.y&&t.rects.reference.width===s.reference.width&&t.rects.reference.height===s.reference.height?{}:{reset:{rects:s}}}}}var ca=`Escape`;function la(e){return w&&e.movementX===0&&e.movementY===0}function ua(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function da(e,t){return ua(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function fa(e,t,n){return ua(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function pa(e,t,n){return ua(t,n?e===ue:e===x,e===se)}function ma(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===ca:ua(t,n?e===x:e===ue,e===A)}function ha(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:x}=t,S=x!=null,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),O=C.context.dataRef,k=Ye(T),A=bn(E),ee=Xt(k),j=ce(),M=Et(b),P=K.useRef(f),F=K.useRef(o??-1),te=K.useRef(null),I=K.useRef(!0),L=U(e=>{i(F.current===-1?null:F.current,e)}),re=K.useRef(!!T),ie=K.useRef(w),ae=K.useRef(!1),oe=K.useRef(!1),se=K.useRef(null),R=Xt(h),z=Xt(w),le=Xt(o),ue=Xt(y),de=Ft(),B=Ft(),V=U(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):se.current=ki(e,{sync:ae.current,preventScroll:!0})}let t=n.current[F.current],r=oe.current;t&&e(t),(ae.current?e=>e():e=>de.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),ye&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});W(()=>{O.current.orientation=g},[O,g]),W(()=>{a&&(w&&T?(F.current=o??-1,P.current&&o!=null&&(oe.current=!0,L())):re.current&&(F.current=-1,L()))},[a,w,T,o,L]),W(()=>{if(a){if(!w)ae.current=!1;else if(T){if(r==null){if(ae.current=!1,le.current!=null)return;if(re.current&&(F.current=-1,V()),(!ie.current||!re.current)&&P.current&&(te.current!=null||P.current===!0&&te.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>B.request(e):queueMicrotask)(t),e+=1):(F.current=te.current==null||fa(te.current,g,u)||l?Pe(n):Le(n),te.current=null,L())};t()}}else fe(n.current,r)||(F.current=r,V(),oe.current=!1)}}},[a,w,T,r,le,l,n,g,u,L,V,B]),W(()=>{if(!a||T||!M||d||!re.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=ne(it(E??t??null)),r=e.some(e=>e.context&&H(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,E,M,j,d]),W(()=>{ie.current=w,re.current=!!T}),W(()=>{w||(te.current=null,P.current=f)},[w,f]);let pe=r!=null,me=U(e=>{if(!z.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,L(e))}),he=U(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),ge=U(()=>Pe(n,R.current)),ve=U(e=>{if(I.current=!1,ae.current=!0,e.which===229||!z.current&&e.currentTarget===ee.current)return;if(l&&ma(e.key,g,u,S)){da(e.key,he())||we(e),C.setOpen(!1,zt(Ut,e.nativeEvent)),_e(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=F.current,r=Pe(n,h),i=Le(n,h);if(A||(e.key===`Home`&&(we(e),F.current=r,L(e)),e.key===`End`&&(we(e),F.current=i,L(e))),x!=null){let t=x(e,F.current,n,g,c,u,h,r,i);if(t!=null&&(F.current=t,L(e)),g===`both`)return}if(da(e.key,g)){if(we(e),w&&!d&&ne(e.currentTarget.ownerDocument)===e.currentTarget){F.current=fa(e.key,g,u)?r:i,L(e);return}fa(e.key,g,u)?c?t>=i?s&&t!==n.current.length?F.current=-1:(ae.current=!1,F.current=r):F.current=N(n.current,{startingIndex:t,disabledIndices:h}):F.current=Math.min(i,N(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?F.current=n.current.length:(ae.current=!1,F.current=i):F.current=N(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):F.current=Math.max(r,N(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),fe(n.current,F.current)&&(F.current=-1),L(e)}}),ye=K.useMemo(()=>({onFocus(e){ae.current=!0,me(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){la(e)||(ae.current=!0,oe.current=!1,p&&me(e))},onPointerLeave(e){if(!z.current||!I.current||e.pointerType===`touch`)return;ae.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&ue.current&&(se.current?.(),se.current=null,F.current=-1,L(e),!d)){let e=ee.current,t=ne(it(e));e&&H(e,t)&&e.focus({preventScroll:!0})}}}),[me,z,ee,p,n,L,ue,d]),be=K.useMemo(()=>d&&w&&pe&&{"aria-activedescendant":`${v}-${r}`},[d,w,pe,v,r]),xe=K.useMemo(()=>({...A?{}:be,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=On(e.nativeEvent);if(t&&!H(ee.current,t))return;we(e),C.setOpen(!1,zt(cn,e.nativeEvent)),_e(E)&&E.focus()}else ve(e)},onPointerMove(e){la(e)||(I.current=!0)}}),[be,ve,ee,A,C,w,d,E]),Se=K.useMemo(()=>{function e(e){C.setOpen(!0,zt(Ut,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&De(e.nativeEvent)&&(P.current=!d)}function n(e){P.current=f,f===`auto`&&D(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=pa(t.key,he(),u),a=da(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return ve(t);if(n||m||!r){if(o){let e=da(t.key,he());te.current=l&&e?null:t.key}l?i&&(we(t),n?(F.current=ge(),L(t)):e(t)):a&&(le.current!=null&&(F.current=le.current),we(t),!n&&m?e(t):ve(t),n&&L(t))}},onFocus(e){C.select(`open`)&&!d&&(F.current=-1,L(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[ve,f,ge,l,L,C,m,g,he,u,le,d]),Ce=K.useMemo(()=>({...be,...Se}),[be,Se]);return K.useMemo(()=>a?{reference:Ce,floating:xe,item:ye,trigger:Se}:{},[a,Ce,xe,Se,ye])}function ga(e,t){let{listRef:r,elementsRef:i,activeIndex:a,onMatch:o,disabledIndices:s,onTyping:c,enabled:l=!0,resetMs:u=750,selectedIndex:d=null}=t,f=`rootStore`in e?e.rootStore:e,p=f.useState(`open`),m=Ie(),h=K.useRef(``),g=K.useRef(d??a??-1),_=K.useRef(null),v=U(e=>{function t(e){return i?.current[e]}function l(e){let r=t(e);return r&&!Be(r)||r?.matches(`:disabled`)?!1:s==null||!n(Ke,e,s)}function f(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(e[n]?.toLowerCase().startsWith(i)&&l(n))return n}return-1}let v=r.current;if(h.current.length>0&&e.key===` `&&(we(e),c?.(!0)),h.current.length>0&&h.current[0]!==` `&&f(v,h.current)===-1&&e.key!==` `&&c?.(!1),v==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;p&&e.key!==` `&&(we(e),c?.(!0));let y=h.current===``;y&&(g.current=d??a??-1),v.every((e,t)=>e&&l(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,m.start(u,()=>{h.current=``,g.current=_.current,c?.(!1)});let b=((y?d??a??-1:g.current)??0)+1,x=f(v,h.current,b);x===-1?e.key!==` `&&(h.current=``,c?.(!1)):(o?.(x),_.current=x)}),y=U(e=>{let t=e.relatedTarget,n=f.select(`domReferenceElement`),r=f.select(`floatingElement`);H(n,t)||H(r,t)||(m.clear(),h.current=``,g.current=_.current,c?.(!1))});W(()=>{(p||d===null)&&(m.clear(),_.current=null,h.current!==``&&(h.current=``))},[p,d,m]);let b=K.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return K.useMemo(()=>l?{reference:b,floating:b}:{},[l,b])}var _a=e=>{let t={running:null,next:null},n=async()=>{let n=e();t.running=n;try{return await n}finally{t.running===n&&(t.running=null)}},r=async e=>{try{await e}catch{}return t.next=null,n()};return Object.assign(()=>t.running===null?n():(t.next??=r(t.running),t.next),{current:()=>t.running??n()})},va=h({method:`POST`}).handler(z(`d8312664c6aa9aecf245095d01a37077f92332e35727648e70895cf2ce8820df`)),ya=h({method:`POST`}).handler(z(`0f042f20f6465d3f1aef6d39f8a9bbc6d7a67f0c0095129fb5a12320572da6c5`)),ba=h({method:`GET`}).handler(z(`6eecb07d4b182f665117c88dc895f7eb8dc3a4bb4bc7444c3c7f5e39e45f1395`)),xa=h({method:`POST`}).handler(z(`6d9ad149a44e29ec90458d6687ea2c92d98859cbcc44d7521127c2c4cfaedc67`)),Sa=h({method:`GET`}).handler(z(`f3609bca9dbfd37554e557b01b4f2cde39e84e8d358a830730bfb93998f3f6dd`)),Ca=h({method:`GET`}).handler(z(`ec830af09bbd81cf8ccba41a6cf5c80ef59098d9272dcd133d7509d54d033a76`)),wa=h({method:`POST`}).handler(z(`1c122a1878638fa6877d8737799f71372951cf995210ada6f735b17d8dcdc6ec`)),Ta=h({method:`GET`}).handler(z(`ca81996f5cde62306b310948df2499c55b0d5c8df1bbf5c0da11478771b4afb0`)),Ea=h({method:`POST`}).handler(z(`acd41dcd63b04d512e76bc5182c86ad4235a95b99e5beba1de74832877815035`)),Da=h({method:`POST`}).handler(z(`95b2066779521c5ee2eb1562972665eef00a38622ad0864ef7d8b4672d82fd39`)),Oa=h({method:`POST`}).handler(z(`c7a57e967e7faf79ff4adba8db39dd62f1c9c7a9efdc2fd1c0ff9a8a75e89dc6`)),ka=h({method:`POST`}).handler(z(`e7a2c93fea99cc38405ad8aec216e26f886d619a7f8376f105cb1cfa7cceea95`)),Aa={pull:null,remarks:[],drafts:[]},ja=({place:e,branch:t})=>{let[n,r]=(0,K.useState)(Aa),i=(0,K.useMemo)(()=>_a(async()=>{r(await Sa({data:{place:e,branch:t,isFresh:!0}}))}),[e,t]);return(0,K.useEffect)(()=>{let n={isCurrent:!0};return(async()=>{let i=await Sa({data:{place:e,branch:t,isFresh:!1}});n.isCurrent&&r(i)})(),()=>{n.isCurrent=!1}},[e,t]),{extras:n,refresh:i}},Ma=`reconnected`,Na=15e3,Pa=(e,t)=>{let n=(0,K.useRef)(t);(0,K.useEffect)(()=>{n.current=t}),(0,K.useEffect)(()=>{let t={events:null,opens:0,hiddenAt:0},r=()=>{t.events?.close();let r=new EventSource(e);for(let e of Object.keys(n.current).filter(e=>e!==Ma))r.addEventListener(e,t=>{n.current[e]?.(t instanceof MessageEvent?String(t.data):``)});r.addEventListener(`open`,()=>{t.opens+=1,t.opens>1&&n.current[Ma]?.(``)}),t.events=r},i=e=>{if(document.visibilityState===`hidden`){t.hiddenAt=Date.now();return}let n=e instanceof PageTransitionEvent&&e.persisted,i=t.hiddenAt>0&&Date.now()-t.hiddenAt>Na;(n||i||t.events?.readyState===EventSource.CLOSED)&&r(),t.hiddenAt=0};return r(),document.addEventListener(`visibilitychange`,i),globalThis.addEventListener(`pageshow`,i),()=>{document.removeEventListener(`visibilitychange`,i),globalThis.removeEventListener(`pageshow`,i),t.events?.close()}},[e])},Fa=1500,Ia=e=>{let t=(0,K.useRef)([]),n=(0,K.useRef)(null),r=(0,K.useCallback)(async e=>{let r=t.current;t.current=[];let i=(async()=>{await e})();n.current=i,await i,n.current===i&&(n.current=null),r.forEach(e=>{e()})},[]);return{settle:r,awaitNext:(0,K.useCallback)(()=>{if(n.current!==null)return n.current;let{promise:i,resolve:a}=Promise.withResolvers();t.current.push(()=>{a(void 0)});let o=t.current.at(-1);return setTimeout(()=>{o!==void 0&&t.current.includes(o)&&r(e())},Fa),i},[r,e])}},La=St([`filed`,`waiting`,`answered`,`asked`,`settled`,`gone`]),Ra=wt({path:k(),added:R(),removed:R(),read:Je(),open:R(),stand:La}),za=wt({title:k(),note:r(k(),``),files:Cn(k()),spans:r(Cn(wt({path:k(),start:R(),end:R()})),[]),prose:r(Cn(wt({path:k(),line:R(),markdown:k(),after:Je()})),[]),read:r(Cn(k()),[]),vanished:r(Cn(k()),[]),added:R(),removed:R(),done:Je(),unclaimed:Je(),open:R(),stand:La,parts:Cn(Ra),address:r(k()),ticket:r(R()),sublayer:r(R())}),Ba=wt({number:R(),address:k(),title:k(),note:r(k(),``),layers:Cn(R()),sublayers:R(),sublayersDone:r(R(),0),files:Cn(k()),added:R(),removed:R(),done:r(Je(),!1),open:r(R(),0),stand:r(La,`gone`)}),Va=wt({stale:r(Je(),!1),summary:r(k(),``),layers:Cn(za),tickets:r(Cn(Ba),[]),topLevel:r(R())});wt({layers:Va});var Ha=wt({voice:St([`reviewer`,`agent`]),body:k(),at:k(),choices:r(Cn(k()))}),Ua=wt({id:k(),file:k(),side:St([`old`,`new`]),start:R(),end:R(),snippet:r(k(),``),body:k(),at:r(k(),``),state:k(),outdated:r(Je(),!1),settled:r(Je(),!1),unread:r(R(),0),taken:r(Je(),!1),doing:r(wt({body:k(),at:k()})),turns:Cn(Ha),stand:La,section:St([`asked`,`filed`,`with`,`answered`,`movedOn`,`settled`,`removed`]),movedPast:Je(),reworded:Je(),about:St([`branch`,`line`]),settleable:Je(),layers:Cn(R())}),Wa=wt({path:k(),open:R(),settled:R(),stand:La}),Ga=wt({path:k(),side:St([`old`,`new`]),line:R(),open:R(),settled:R(),stand:La}),Ka=wt({asked:R(),unread:R()});wt({comments:Cn(Ua),counts:r(Ka),files:Cn(Wa),lines:Cn(Ga)}),wt({layers:r(Va)});var qa=(e,t)=>e.map(e=>{let[n]=e.layers,r=n===void 0?null:t[n-1]?.address??String(n);return r===e.layerAddress?e:{...e,layerAddress:r}}),Ja=new Map,Ya=(e,t)=>{Ja.get(e)?.forEach(e=>{e(t)})},Xa=(e,t)=>{let n=Ja.get(e)??new Set;return n.add(t),Ja.set(e,n),()=>{n.delete(t)}},Za=()=>({started:0,shown:0}),Qa=async(e,t)=>{e.started+=1;let n=e.started,r=await t();return n<e.shown?null:(e.shown=n,r)},$a=h({method:`POST`}).handler(z(`bc42f104a022623469410d19573fe9714a7aed7a344f808479517ee6742bfaae`)),eo=h({method:`GET`}).handler(z(`9efdcbe2ace17d0836d7df7bc9aff104b4868682ca79516ddb6927a8ed223691`)),to=h({method:`GET`}).handler(z(`1e0b1bc8f9718ae1ef49c47aa55a9e44518eaa93e3b317cf1b521d87b3f6e983`)),no=h({method:`GET`}).handler(z(`e21610e432516c6914db00010e8bedfa8f3b53f243b609befdc905f0d0717d60`)),ro=new Map,io=({place:e,branch:t})=>`${e}|${t}`,ao=[`comments`,`state`,`layers`],oo=e=>{try{let t=JSON.parse(e);return typeof t==`object`&&t&&`what`in t&&Array.isArray(t.what)?t.what.map(String):[]}catch{return[]}},so=e=>ao.filter(t=>e.includes(t)),co=()=>{let e={isWhole:!1,parts:new Set,run:async e=>{}},t=_a(async()=>{let t={isWhole:e.isWhole,parts:[...e.parts]};e.isWhole=!1,e.parts.clear(),await e.run(t)});return{set:t=>{e.run=t},ask:async({isWhole:n,parts:r})=>{e.isWhole||=n,r.forEach(t=>{e.parts.add(t)}),await t()}}},lo=({place:e,branch:t},{show:n,merge:r})=>{let i=(0,K.useRef)(Za()),a=(0,K.useCallback)(n=>Qa(i.current,()=>eo({data:{place:e,branch:t,...n}})),[e,t]),o=(0,K.useRef)(null);return{read:a,reread:(0,K.useCallback)(async i=>{o.current??=co(),o.current.set(async({isWhole:i,parts:o})=>{if(i){let e=await a({isFresh:!0,isWhole:!0});e!==null&&n(e)}else o.length>0&&r(await ba({data:{place:e,branch:t,parts:[...o]}}))}),await o.current.ask(i)},[a,n,r,e,t])}},uo=(e,{read:t,show:n})=>{let{place:r,branch:i}=e;(0,K.useEffect)(()=>{let e={isCurrent:!0},a=async r=>{let i=await t({isFresh:r,isWhole:!0});e.isCurrent&&i!==null&&n(i)};return(async()=>{ro.get(io({place:r,branch:i}))===void 0&&await a(!1),await a(!0)})(),()=>{e.isCurrent=!1}},[r,i,t,n])},fo=(e,t)=>{let[n,r]=(0,K.useState)(()=>ro.get(e)??t);return{outline:n,show:(0,K.useCallback)(t=>{ro.set(e,t),r(t)},[e]),merge:(0,K.useCallback)(t=>{r(n=>{let r=n===null?n:{...n,...t};return r!==null&&ro.set(e,r),r})},[e])}},po={isWhole:!0,parts:[]},mo=({key:e,reread:t,settle:n,onChanged:r})=>({changed:e=>{let i=oo(e),a=so(i);a.length===0?r(i):n(Promise.all([t({isWhole:!1,parts:a}),r(i)]))},moved:()=>{n(t(po))},reconnected:()=>{n(Promise.all([t(po),r([`other`])]))},listener:t=>{Ya(e,t)}}),ho=(e,t)=>{let{place:n,branch:r}=e,i=io(e),{outline:a,show:o,merge:s}=fo(i,e.kept),{read:c,reread:l}=lo({place:n,branch:r},{show:o,merge:s}),{settle:u,awaitNext:d}=Ia(()=>Promise.all([l({isWhole:!1,parts:ao}),t([`other`])]));return uo({place:n,branch:r},{read:c,show:o}),Pa(`/review/events?${new URLSearchParams({place:n,branch:r})}`,mo({key:i,reread:l,settle:u,onChanged:t})),{outline:a,refresh:(0,K.useCallback)((e=!1)=>e?l(po):d(),[l,d])}},go=e=>{let[t,n]=(0,K.useState)(null),r=t?.on===e?t.told:e;return{layers:r.layers,tickets:r.tickets,threads:qa(e.threads,r.layers),handleLayers:t=>{t!==null&&n({on:e,told:t})}}},_o=e=>`${e.path}|${e.fingerprint}`,vo=(e,t)=>[...e].findLast(([e])=>e.startsWith(`${t}|`))?.[1],yo=200,bo=e=>{if(`requestIdleCallback`in globalThis){let t=requestIdleCallback(e);return()=>{cancelIdleCallback(t)}}let t=setTimeout(e,yo);return()=>{clearTimeout(t)}},xo=({place:e,branch:t,files:n,selected:r,order:i})=>{let[a,o]=(0,K.useState)(new Map),s=(0,K.useRef)(new Set),c=new Map(n.map(e=>[e.path,e])),l=(0,K.useCallback)(async n=>{if(n===void 0||n.rows.length>0||s.current.has(_o(n)))return;s.current.add(_o(n));let r=await to({data:{place:e,branch:t,path:n.path,fingerprint:n.fingerprint}}).catch(()=>null);o(e=>r===null?e:new Map([...e,[_o(n),r]])),r===null&&s.current.delete(_o(n))},[e,t]),u=c.get(r),d=i.indexOf(r),f=[i[d+1],i[d-1]].map(e=>c.get(e??``));return(0,K.useEffect)(()=>(l(u),bo(()=>{f.forEach(e=>{l(e)})}))),{fileFor:e=>{if(e.rows.length>0)return e;let t=a.get(_o(e))??vo(a,e.path);if(t!==void 0)return{...t,oldSha:e.oldSha,newSha:e.newSha}}}},So=(e,t)=>t===null||e.layers.includes(t+1),Co=(e,t)=>`${e.path}|${e.reviewed}|${t}`,wo=async e=>{try{return await no({data:e})}catch{return}},To=(e,t)=>e!==void 0&&e.kept&&!e.deleted&&So(e,t),Eo=({place:e,branch:t,since:n,selected:r,layer:i,current:a})=>{let[o,s]=(0,K.useState)(new Set),[c,l]=(0,K.useState)(new Map),u=(0,K.useRef)(new Set),d=n.find(e=>e.path===r),f=To(d,i)&&a!==void 0&&!o.has(r);(0,K.useEffect)(()=>{if(!f||u.current.has(Co(d,a.blob)))return;let n=Co(d,a.blob);u.current.add(n);let r={place:e,branch:t,path:d.path,reviewed:d.reviewed};(async()=>{let e=await wo({...r,blob:a.blob});e===void 0?u.current.delete(n):l(t=>new Map([...t,[n,e]]))})()});let p=e=>{let t=n.find(t=>t.path===e.path);return To(t,i)?c.has(Co(t,e.blob))?c.get(Co(t,e.blob)):vo(c,e.path):null},m=e=>!To(n.find(t=>t.path===e),i)||a?.path===e&&a.blob!==``&&p(a)===null?null:o.has(e)?`full`:`since`;return{modeOf:m,setMode:(e,t)=>{s(n=>new Set(t===`full`?[...n,e]:[...n].filter(t=>t!==e)))},swap:e=>e.path===r&&m(e.path)===`since`?p(e)??e:e,isWaiting:e=>e===r&&m(e)===`since`&&a!==void 0&&p(a)===void 0}},Do=({place:e,branch:t},{outline:n,selected:r,layer:i})=>{let a=xo({place:e,branch:t,files:n.files,selected:r,order:n.order}),o=n.files.find(e=>e.path===r),s=Eo({place:e,branch:t,since:n.since,selected:r,layer:i,current:o===void 0?void 0:a.fileFor(o)});return{files:n.files.map(e=>s.swap(a.fileFor(e)??e)),isFileLoaded:e=>{let t=n.files.find(t=>t.path===e);return t!==void 0&&a.fileFor(t)!==void 0&&!s.isWaiting(e)},sinceView:{modeOf:s.modeOf,setMode:s.setMode}}},Oo=2,ko=e=>e.split(`/`).at(-1)??e,Ao=e=>e.split(`/`).slice(0,-1).join(`/`),jo=e=>{let t={name:``,full:``,dirs:[],files:[]},n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t!==void 0)return t;let i={name:ko(e),full:e,dirs:[],files:[]};return n.set(e,i),r(Ao(e)).dirs.push(i),i};return e.forEach(e=>{r(Ao(e)).files.push(e)}),t},Mo=(e,t=e.name)=>{let[n]=e.dirs;return e.files.length===0&&e.dirs.length===1&&n!==void 0?Mo(n,t===``?n.name:`${t}/${n.name}`):{...e,name:t,dirs:e.dirs.map(e=>Mo(e))}},No=e=>{let t=e.split(`/`);return t.length>Oo?`…/${t.slice(-2).join(`/`)}`:e},Po=(e,t,{collapsed:n,rows:r})=>{e.dirs.forEach(e=>{r.push({kind:`dir`,key:`dir:${e.full}`,label:t===0?No(e.name):e.name,full:e.full,depth:t}),n.has(e.full)||Po(e,t+1,{collapsed:n,rows:r})}),e.files.forEach(e=>{r.push({kind:`file`,key:`file:${e}`,path:e,label:ko(e),depth:t})})},Fo=(e,t)=>{let n=[];return Po(e,0,{collapsed:t,rows:n}),n},Io=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),Lo=new Set,Ro={paths:[],root:null,order:[]},zo=e=>{let t=jo(e);return{...t,dirs:t.dirs.map(e=>Mo(e))}},Bo=e=>Fo(e,Lo).flatMap(e=>e.kind===`file`?[e.path]:[]),Vo=e=>{if(Ro.root!==null&&Io(Ro.paths,e))return{root:Ro.root,order:Ro.order};let t=zo(e);return Ro.paths=e,Ro.root=t,Ro.order=Bo(t),{root:t,order:Ro.order}},Ho=(e,t)=>Fo(Vo(e).root,t),Uo=e=>Vo(e).order,Wo=e=>`layer:${String(e)}`,Go=e=>`ticket:${String(e)}`,Ko=(e,t)=>`${Wo(e)}:${t}`,qo=/^layer:(?<index>\d+)/u,Jo=/^ticket:(?<number>\d+)$/u,Yo=e=>{let t=qo.exec(e);return t?.groups?.index===void 0?null:Number(t.groups.index)},Xo=e=>{let t=Jo.exec(e);return t?.groups?.number===void 0?null:Number(t.groups.number)},Zo=e=>e.map(e=>`${e.title}:${String(e.files.length)}`).join(`|`),Qo=`layer:read`,$o=e=>Ao(e),es=3,ts=e=>{let t=e.split(`/`);return t.length<es?`${e}/`:`${t[0]??``}/…/${t.at(-1)??``}/`},ns=K.createContext(void 0);function rs(e){let t=K.useContext(ns);if(!e&&t===void 0)throw Error(Wt(27));return t}var is=K.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=rs(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d={open:c,transitionStatus:s.useState(`transitionStatus`)};return Zt(`div`,e,{state:d,ref:[s.context.backdropRef,t],stateAttributesMapping:gn,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),as=K.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=rs(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=Ot({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,zt($e,e.nativeEvent))}return Zt(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),os=K.createContext(void 0);function ss(){let e=K.useContext(os);if(e===void 0)throw Error(Wt(26));return e}var cs=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),ls=`--nested-dialogs`,us=`data-nested-dialog-open`,ds={...d,...i,nestedDialogOpen(e){return e?{[us]:``}:null}},fs=K.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=rs(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);ss(),mn({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?un(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=Zt(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...Vt,hidden:!m,onKeyDown(e){cs.has(e.key)&&e.stopPropagation()},style:{[ls]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:ds});return(0,q.jsx)(Xi,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),ps=K.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),ms=K.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=rs(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,q.jsx)(os.Provider,{value:n,children:(0,q.jsxs)(Ct,{ref:t,...r,children:[a&&o===!0&&(0,q.jsx)(ps,{ref:i.context.internalBackdropRef,inert:C(!s)}),e.children]})}):null}),hs={},gs={},_s=``;function vs(e,t){return _n(e)?e:t}function ys(e,t,n){return/hidden|clip/.test(e.getComputedStyle(vs(t,n)).overflowY)}function bs(e){if(typeof document>`u`)return!1;let t=it(e);return Xe(t).innerWidth-t.documentElement.clientWidth>0}function xs(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=it(e),n=t.documentElement,r=t.body,i=vs(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Ss(e){let t=it(e),n=t.documentElement,r=t.body,i=vs(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Cs(e){let t=it(e),n=t.documentElement,r=t.body,i=Xe(n),a=0,o=0,s=!1,c=an.create();if(w&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,hs={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},_s=n.style.scrollBehavior,gs={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=vs(n,r);s=xs(e),s?(n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`):(Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`)}function u(){Object.assign(n.style,hs),Object.assign(r.style,gs),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=_s)}function d(){u(),c.request(l)}l();let f=Ge(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var ws=new class{lockCount=0;restore=null;timeoutLock=M.create();timeoutUnlock=M.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=it(e),n=t.documentElement,r=t.body,i=Xe(n);if(ys(i,n,r)){let t=new i.MutationObserver(()=>{ys(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=F||!bs(e);this.restore=a?Ss(e):Cs(e)}};function Ts(e=!0,t=null){W(()=>{if(e)return ws.acquire(t)},[e,t])}function Es({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=K.useState(0),[u,d]=K.useState(0),f=c===0,m=p(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=On(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||H(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return Ts(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),W(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),Nt(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var Ds={...xt,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Os=class extends ve{constructor(e,t,n){let r=new qe,i=ks(e,r,t,n);super(i,As(r),Ds)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled||(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(at(this.state,e,t.trigger)))}};function ks(e,t,n,r=!1){return{...Qt(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function As(e){return{popupRef:K.createRef(),backdropRef:K.createRef(),internalBackdropRef:K.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function js(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=rs(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=_t((e,t)=>new Os({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);ht(b,x),ft(b);let{forceUnmount:w}=Gt(x,b);K.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,zt(rt))}),[w,b]);let T=x||S;return(0,q.jsxs)(ns.Provider,{value:b,children:[u&&(0,q.jsx)(nn,{handle:u,store:b}),T&&(0,q.jsx)(Es,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var Ms=Ne(function(e){return js(`dialog`,e)}),Ns=K.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=rs(),c=Re(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Zt(`h2`,e,{ref:t,props:[{id:c},o]})});function Ps(e){let t=K.useRef(``),n=K.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:K.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function Fs(e,t){let n=K.useRef(e),r=U(t);W(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Is(e,t){let{onClick:n,onPointerDown:r}=Ps(U((n,r)=>{(typeof e==`function`?e():e)||t(r||(F?`touch`:``))}));return K.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Ls(e){let[t,n]=K.useState(null),r=Is(e,n);return Fs(e,t=>{t&&!e&&n(null)}),K.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var Rs=.25,zs=.11,Bs=6,Vs=2,Hs=`(max-width: 767px)`,Us=`translate 320ms var(--e-drawer)`,Ws=`translate 220ms var(--e-drawer)`,Gs=220,Ks=e=>e>=0?e:-Math.sqrt(-e)*Vs,qs=(e,t)=>{if(!(t instanceof Element)||!globalThis.matchMedia(Hs).matches)return!1;if(t.closest(`[data-slot="dialog-header"]`)!==null)return!0;let n=t.closest(`[data-slot="dialog-body"]`);return n===null?e.contains(t):n.scrollTop<=0},Js=e=>{if(!(e instanceof Element)||e.closest(`[data-slot="dialog-header"]`)!==null)return!0;let t=e.closest(`[data-slot="dialog-body"]`);return t===null||t.scrollHeight<=t.clientHeight},Ys=e=>{e.style.transition=Ws,e.style.translate=`0 calc(100% + 2rem)`,globalThis.setTimeout(()=>{e.querySelector(`[data-slot="dialog-header"] [aria-label="Close"]`)?.click()},Gs)},Xs=(e,t,n)=>{let r=n-t.startY,i=r/Math.max(1,Date.now()-t.startedAt);r>e.offsetHeight*Rs||i>zs?Ys(e):(e.style.transition=Us,e.style.translate=``)},Zs=e=>{let t={startY:0,startedAt:0,isDragging:!1,canDrag:!1,canStretch:!1};return{handleStart:n=>{let[r]=n.touches;t.canDrag=n.touches.length===1&&qs(e,n.target),t.canStretch=t.canDrag&&Js(n.target),t.isDragging=!1,t.startY=r?.clientY??0,t.startedAt=Date.now()},handleMove:n=>{let[r]=n.touches,i=(r?.clientY??t.startY)-t.startY,a=i>Bs||t.canStretch&&i<-6;t.canDrag&&(t.isDragging||a)&&(t.isDragging=!0,n.preventDefault(),e.style.transition=`none`,e.style.translate=`0 ${String(Ks(i))}px`)},handleEnd:n=>{let[r]=n.changedTouches;t.isDragging&&Xs(e,t,r?.clientY??t.startY),t.isDragging=!1}}},Qs=e=>{let{handleStart:t,handleMove:n,handleEnd:r}=Zs(e);return e.addEventListener(`touchstart`,t,{passive:!0}),e.addEventListener(`touchmove`,n,{passive:!1}),e.addEventListener(`touchend`,r),e.addEventListener(`touchcancel`,r),()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchmove`,n),e.removeEventListener(`touchend`,r),e.removeEventListener(`touchcancel`,r)}};function $s({...e}){return(0,q.jsx)(Ms,{"data-slot":`dialog`,...e})}function ec({...e}){return(0,q.jsx)(as,{"data-slot":`dialog-close`,...e})}function tc({className:e,...t}){return(0,q.jsx)(Ns,{className:G(`sr-only`,e),"data-slot":`dialog-title`,...t})}var nc={fill:`fixed inset-0 transition-[opacity,scale] duration-200 ease-out data-ending-style:scale-[0.98] data-ending-style:opacity-0 data-starting-style:scale-[0.98] data-starting-style:opacity-0 motion-reduce:data-ending-style:scale-100 motion-reduce:data-starting-style:scale-100`,sheet:`dialog-sheet flex flex-col overflow-hidden text-sm text-popover-foreground md:rounded-xl md:border md:border-border md:bg-popover md:shadow-sheet`},rc=(e,t)=>n=>(typeof e==`function`?e(n):e!=null&&(e.current=n),t&&n!==null?Qs(n):void 0);function ic({className:e,variant:t=`fill`,ref:n,...r}){return(0,q.jsxs)(ms,{children:[(0,q.jsx)(is,{className:`fixed inset-0 z-30 bg-overlay transition-opacity duration-200 ease-out data-ending-style:opacity-0 data-starting-style:opacity-0`,"data-slot":`dialog-overlay`,forceRender:t===`sheet`}),(0,q.jsx)(fs,{className:G(`z-30 outline-none`,nc[t],e),"data-slot":`dialog-content`,"data-variant":t,ref:rc(n,t===`sheet`),...r})]})}function ac({title:e}){return(0,q.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between gap-3 border-b border-border ps-4 pe-3 max-md:relative max-md:h-14 max-md:border-0 max-md:ps-6 max-md:pt-2`,"data-slot":`dialog-header`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-s-1/2 top-2 h-1.25 w-9 -translate-x-1/2 rounded-full bg-foreground/28 md:hidden`}),(0,q.jsx)(Ns,{className:`m-0 text-sm font-medium text-foreground max-md:text-lg max-md:font-semibold`,children:e}),(0,q.jsxs)(as,{"aria-label":`Close`,className:`flex press items-center gap-1.5 rounded-md px-1.5 py-1 text-xs text-subtle outline-none hover:bg-secondary hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring max-md:size-11 max-md:justify-center max-md:p-0`,children:[(0,q.jsx)(`span`,{className:`max-md:hidden`,children:(0,q.jsx)(V,{children:`Esc`})}),(0,q.jsx)(`span`,{className:`hidden size-8 place-items-center rounded-full bg-foreground/10 text-foreground max-md:grid`,children:(0,q.jsx)(Di,{"aria-hidden":!0,className:`size-4`,strokeWidth:2.25})})]})]})}function oc({children:e}){return(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto overscroll-contain`,"data-slot":`dialog-body`,children:e})}function sc({children:e}){return(0,q.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-t border-border bg-wash px-4 py-2.5 text-xs text-muted-foreground`,"data-slot":`dialog-footer`,children:e})}var cc=(e,t)=>{let[n,r]=(0,K.useState)(null),i=(0,K.useRef)(e);return(0,K.useEffect)(()=>{i.current=e}),(0,K.useEffect)(()=>{let e={isCurrent:!0};return(async()=>{let n=await i.current();e.isCurrent&&r({key:t,value:n})})(),()=>{e.isCurrent=!1}},[t]),n?.key===t?n.value:null},lc={vscode:`VS Code`,cursor:`Cursor`,windsurf:`Windsurf`,zed:`Zed`,idea:`JetBrains`},uc=e=>e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`),dc={vscode:(e,t)=>`vscode://file${uc(e)}:${String(t)}:1`,cursor:(e,t)=>`cursor://file${uc(e)}:${String(t)}:1`,windsurf:(e,t)=>`windsurf://file${uc(e)}:${String(t)}:1`,zed:(e,t)=>`zed://file${uc(e)}:${String(t)}`,idea:(e,t)=>`idea://open?file=${encodeURIComponent(e)}&line=${String(t)}`},fc={vscode:e=>`vscode://file${uc(e)}`,cursor:e=>`cursor://file${uc(e)}`,windsurf:e=>`windsurf://file${uc(e)}`},pc=400,mc=e=>{let t=Array.from({length:e.length},()=>null),n=null;for(let r=e.length-1;r>=0;--r)n=e[r]?.new??n,t[r]=n;let r=null;return e.map((e,n)=>(r=e.new??r,e.op===`gap`?null:t[n]??r))},hc=(e,t)=>e.worktree===null||e.isDeleted||t===null?null:dc[e.editor](`${e.worktree}/${e.path}`,t),gc=(e,t)=>e===null?null:fc[t]?.(e)??null,_c=e=>{let t=document.createElement(`a`);t.href=e,t.rel=`noopener`,t.dataset.editorLink=``,document.body.append(t),t.click(),t.remove()},vc=(e,t)=>{t===null?_c(e):(_c(t),globalThis.setTimeout(()=>{_c(e)},pc))},yc=e=>e.closest(`[data-editor-folder]`)?.dataset.editorFolder??null,bc=({worktree:e,file:t,editor:n})=>{if(t===void 0)return[];let r={worktree:e,path:t.path,isDeleted:t.status===`deleted`,editor:n};return mc(t.rows).map(e=>hc(r,e))},xc=({worktree:e,file:t,row:n})=>{let{editor:r}=nt(),i=bc({worktree:e,file:t,editor:r})[n]??null;i!==null&&vc(i,gc(e,r))},Sc=[{title:`Move`,rows:[[[`j`,`k`],`move`],[[`]`,`[`],`next and previous file`],[[`}`,`{`],`next and previous change`],[[`g`,`G`],`first and last line`],[[`n`,`N`],`next and previous comment`],[[`Tab`],`between the files and the diff`]]},{title:`Comment`,rows:[[[`v`,`V`],`select, select the change`],[[`c`],`comment`],[[`ctrl`,`s`],`send`],[[`C`],`send the notes you hold`],[[`a`],`review panel`],[[`T`],`every thread that needs you, or the diff`],[[`D`],`settle what is read`]]},{title:`Files`,rows:[[[`m`],`reviewed`],[[`M`],`reviewed, and the next file`],[[`f`],`hide read files`],[[`s`],`layers or file tree`],[[`h`,`l`],`close and open a layer`],[[`L`],`ask for a new order`]]},{title:`View`,rows:[[[`w`],`wrap`],[[`+`,`-`],`more or less context`],[[`F`],`whole file`],[[`r`],`since review or full diff`],[[`l`],`open the fold`],[[`h`],`fold another layer's lines back`],[[`S`],`scope above the diff`],[[`I`],`layer notes over the code`],[[`O`],`other layers' lines in place`],[[`e`],`open the line in your editor`]]},{title:`Branch`,rows:[[[`b`],`base to compare against`],[[`p`],`pull request`],[[`/`],`search this branch`],[[`?`],`keys`],[[`Esc`],`back`]]}],Cc=({keys:e,label:n,isScoped:r})=>(0,q.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,q.jsx)(`dt`,{className:`flex w-16 shrink-0 justify-end`,children:(0,q.jsx)(t,{children:e.map(e=>(0,q.jsx)(V,{children:e},e))})}),(0,q.jsxs)(`dd`,{className:`m-0 min-w-0 text-muted-foreground`,children:[n,e[0]===`S`?(0,q.jsx)(`span`,{className:`ms-1.5 text-xs text-subtle`,children:r?`on`:`off`}):null]})]}),wc=()=>{let{isScoped:e}=Qe();return(0,q.jsx)(`div`,{className:`grid gap-x-8 gap-y-4 px-4 py-3 sm:grid-cols-2`,children:Sc.map(t=>(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h3`,{className:`m-0 mb-1 ps-19 text-xs font-medium text-subtle`,children:t.title}),(0,q.jsx)(`dl`,{className:`m-0`,children:t.rows.map(([t,n])=>(0,q.jsx)(Cc,{isScoped:e,keys:t,label:n},t.join(` `)))})]},t.title))})},Tc=()=>{let{editor:e}=Qe();return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`me-1`,children:`Open lines in`}),sn.map(t=>(0,q.jsx)(st,{"aria-pressed":e===t,"data-editor-choice":t,onClick:()=>{Ht({editor:t})},size:`xs`,variant:`ghost`,children:lc[t]},t))]})},Ec=()=>{let e=We();return(0,q.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,q.jsx)(`span`,{className:`me-2`,children:`Theme`}),(0,q.jsxs)(`fieldset`,{className:`relative m-0 grid grid-cols-3 rounded-md border-0 bg-muted p-0.5`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-y-0.5 inset-s-0.5 segment-pill rounded-sm bg-secondary`,ref:t=>{t?.style.setProperty(`--at`,String(Pt.indexOf(e)))}}),Pt.map(t=>(0,q.jsx)(`button`,{"aria-pressed":e===t,className:`relative h-5 press px-2 text-xs text-muted-foreground hover:text-foreground aria-pressed:text-foreground`,"data-theme-choice":t,onClick:()=>{vt(t)},type:`button`,children:Yt[t]},t))]})]})},Dc=e=>`'${e.replaceAll(`'`,`'\\''`)}'`,Oc=e=>[`1. Run \`adiff comment take --worktree ${Dc(e)}\` once. It hands you every comment still owed an answer.`,`2. Run \`adiff comment take --worktree ${Dc(e)} --wait 6900\` in the background (in Claude Code: Bash with run_in_background and timeout 7200000). It returns when there is a comment you have not been handed. Never poll it on a timer, and keep only one running.`,`3. For each comment you are handed, do what it asks in ${e}, then answer it by id with \`adiff comment answer --worktree ${e} --id <id> --body "…"\`, saying what you changed. If the comment is unclear or asks for something you cannot do there, answer with your question instead.`,`4. When the background wait returns, start it again before you handle what it returned, and go back to step 3. An empty answer means only that the wait ran out: start it again and say nothing.`],kc=(e,t)=>[`I am reviewing ${t} in the adiff review page, and my comments reach you through adiff. The branch is checked out in ${e}.`,`Use the adiff skill if you have one. Listen to the review in a loop:`,...Oc(e),`Keep listening until I say the review is done. Do not push or open pull requests unless I ask.`].join(`
2
+ `),Ac=(e,t)=>[`I stopped your headless run and took this session over in my terminal. Carry on answering the review of ${t} in ${e}, as before:`,...Oc(e),`Keep listening until I say the review is done. Do not push or open pull requests unless I ask.`].join(`
3
+ `),jc=({resume:e,interactive:t,worktree:n,branch:r})=>e===null?Mc(t,n,r):`cd ${Dc(n)} && ${e} ${Dc(Ac(n,r))}`,Mc=(e,t,n)=>`cd ${Dc(t)} && ${e} ${Dc(kc(t,n))}`,Nc=K.createContext(void 0);function Pc(e){let t=K.useContext(Nc);if(t===void 0&&!e)throw Error(Wt(33));return t}var Fc=K.createContext(void 0);function Ic(e){let t=K.useContext(Fc);if(t===void 0&&!e)throw Error(Wt(36));return t}var Lc=K.createContext(void 0);function Rc(e=!0){let t=K.useContext(Lc);if(t===void 0&&!e)throw Error(Wt(25));return t}function zc({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=K.useRef(e!==void 0),[a,o]=K.useState(t);return[i&&e!==void 0?e:a,K.useCallback(e=>{i||o(e)},[])]}function Bc(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=Rc(!0),f=d!==void 0;return K.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:ut})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!qt&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&ln(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var Vc={type:`regular-item`};function Hc(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=K.useRef(null),{getButtonProps:d,buttonRef:f}=Ot({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Bc({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=K.useCallback(e=>Mt(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=et(u,f);return K.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var Uc=K.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Wc(){return K.useContext(Uc)}function Gc(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Wc(),u=K.useRef(-1),[d,f]=K.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=K.useRef(null),h=K.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return W(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var Kc=K.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Gc({guess:!0,label:a}),f=Pc(!0),p=Re(i),{store:m}=Ic(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=Hc({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:Vc});return Zt(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),qc=K.createContext(void 0);function Jc(e){let t=K.useContext(qc);if(t===void 0&&!e)throw Error(Wt(69));return t}var Yc=K.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=Ic(),{side:c,align:l}=Pc(),u=Jc(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;mn({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),K.useEffect(()=>{function e(e){s.setOpen(!1,zt(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),ct(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O={transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},k=Zt(`div`,e,{state:O,ref:[t,s.context.popupRef,D],stateAttributesMapping:gn,props:[p,{onKeyDown(e){u&&cs.has(e.key)&&e.stopPropagation()}},Kt(f),o,{"data-rootownerid":y}]}),A=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(A=!0),(0,q.jsx)(Xi,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?A:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:k})}),Xc=K.createContext(void 0);function Zc(){let e=K.useContext(Xc);if(e===void 0)throw Error(Wt(32));return e}var Qc=K.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=Ic();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,q.jsx)(Xc.Provider,{value:n,children:(0,q.jsx)(Ct,{ref:t,...r,portalOwnerRole:o})})});function $c(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=U(i),[,o]=K.useState(!1),s=He(tl).current,c=He(el).current,l=K.useRef(0),u=K.useRef(!0),d=K.useRef(null),f=K.useRef(null),p=U(()=>{u.current||(u.current=!0,o(e=>!e))}),m=U((e,t)=>{c.set(e,t),p()}),h=U(e=>{c.delete(e),p()}),g=U(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!il(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&al(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=rl(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=U(()=>{let[e,t]=nl(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});W(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),W(()=>{u.current&&v()}),W(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=U(e=>(s.add(e),()=>{s.delete(e)})),b=K.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,q.jsx)(Uc.Provider,{value:b,children:t})}function el(){return new Map}function tl(){return new Set}function nl(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>al(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function rl(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function il(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function al(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var ol=20;function sl(e,t,n,r){let[i,a]=K.useState(!1);W(()=>{if(!e||!t||n==null){a(!1);return}let r=it(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-ol)},[e,t,n]),Ts(e&&(!t||i),r)}var cl=K.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=de,style:g,..._}=e,{store:v}=Ic(),y=Zc(),b=Rc(!0),x=v.useState(`parent`),w=v.useState(`floatingRootContext`),T=v.useState(`floatingTreeRoot`),E=v.useState(`mounted`),D=v.useState(`open`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`activeTriggerElement`),ee=v.useState(`transitionStatus`),M=v.useState(`positionerElement`),N=v.useState(`instantType`),F=v.useState(`adaptiveOrigin`),te=v.useState(`lastOpenChangeReason`),I=v.useState(`floatingNodeId`),ne=v.useState(`floatingParentNodeId`),L=w.useState(`domReferenceElement`),re=K.useRef(null),ie=En(M),ae=n,oe=c,se=l,R=s,z=h;x.type===`context-menu`&&(ae=n??x.context?.anchor,R??=`start`,!o&&R!==`center`&&(se=e.alignOffset??2,oe=e.sideOffset??-5));let ce=o,le=R;x.type===`menu`?(ce??=`inline-end`,le??=`start`,z=e.collisionAvoidance??S):x.type===`menubar`&&(ce??=x.context.orientation===`vertical`?`inline-end`:`bottom`,le??=`start`);let ue=x.type===`context-menu`,B=j({anchor:ae,floatingRootContext:w,positionMethod:b?`fixed`:r,mounted:E,side:ce,sideOffset:oe,align:le,alignOffset:se,arrowPadding:ue?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:I,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:z,shift:ue?{crossAxis:!(`side`in z&&z.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:F});K.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&v.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,zt(mt)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[v,T.events,I]),K.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,zt(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,v]);let V=Ie();K.useEffect(()=>{D||V.clear()},[D,V]),K.useEffect(()=>{function e(e){if(D&&e.nodeId===v.select(`floatingParentNodeId`)){if(e.target&&A&&A!==e.target){let e=v.select(`closeDelay`);e>0?V.isStarted()||V.start(e,()=>{v.setOpen(!1,zt(mt))}):v.setOpen(!1,zt(mt))}else V.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,v,V]),K.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:ne,reason:v.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,v,I,ne]),W(()=>{let e=L,t=re.current;if(e&&(re.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return ie(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,ie,v]);let fe={open:D,side:B.side,align:B.align,anchorHidden:B.anchorHidden,nested:x.type===`menu`,instant:N},pe=x.type===`menubar`&&x.context.modal;sl(D&&(pe||O&&te!==`trigger-hover`),k===`touch`,M,A);let H=P(e,fe,{styles:B.positionerStyles,transitionStatus:ee,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),me=E&&x.type!==`menu`&&(x.type!==`menubar`&&O&&te!==`trigger-hover`||x.type===`menubar`&&x.context.modal),he=null;return x.type===`menubar`?he=x.context.contentElement:x.type===void 0&&(he=A),(0,q.jsxs)(Nc.Provider,{value:B,children:[me&&(0,q.jsx)(ps,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:C(!D),cutout:he}),(0,q.jsx)(Se,{id:I,children:(0,q.jsx)($c,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:H})})]})}),ll=K.createContext(null);function ul(e){let t=K.useContext(ll);if(t===null&&!e)throw Error(Wt(5));return t}var dl={...xt,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},fl=class extends ve{constructor(e,t,n=!1){let r=new qe,i=ml(r,t,n,e);super(i,pl(r),dl),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef}else e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function pl(e){return{positionerRef:K.createRef(),popupRef:K.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:K.createRef(),beforeContentFocusGuardRef:K.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function ml(e,t,n=!1,r){return{...Qt(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new o,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Bt,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var hl=K.createContext(void 0);function gl(){return K.useContext(hl)}var _l=Ne(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:_=!0}=e,v=Rc(!0),b=Ic(!0),x=ul(!0),S=gl(),C=K.useMemo(()=>S&&b?{type:`menu`,store:b.store}:x?{type:`menubar`,context:x}:v&&!b?{type:`context-menu`,context:v}:{type:void 0},[v,b,x,S]),w=ee(),T=ee(),E=ce(),D=C.type===`menu`?C.store:void 0,O=(n??a)&&D?.state.transitionStatus===`starting`,k=He(()=>O?D?.state.instantType:void 0).current,A=vl({open:a,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:C,disabled:o,highlightItemOnHover:_,modal:C.type===void 0?s:void 0,rootId:w,instantType:k},T,E!=null);A.useControlledProp(`openProp`,n),A.useControlledProp(`triggerIdProp`,m),A.useContextCallback(`onOpenChangeComplete`,i);let j=A.useState(`floatingTreeRoot`),M=g(j),N=A.useState(`open`),P=A.useState(`activeTriggerElement`),F=A.useState(`positionerElement`),te=A.useState(`hoverEnabled`),I=A.useState(`disabled`),ne=A.useState(`lastOpenChangeReason`),L=A.useState(`parent`),re=A.useState(`activeIndex`),ie=A.useState(`payload`),ae=A.useState(`floatingParentNodeId`),oe=K.useRef(null),se=K.useRef(L.type!==`context-menu`),R=Ie(),z=K.useRef(!0),le=Ie(),ue=ae!=null,{openMethod:de,triggerProps:B}=Ls(N);A.useSyncedValues({disabled:o,highlightItemOnHover:_,modal:L.type===void 0?s:void 0,openMethod:de,rootId:w}),ft(A);let{forceUnmount:V,transitionStatus:fe}=Gt(N,A,()=>{A.set(`allowMouseEnter`,!1)},O),pe=En(A.context.popupRef);K.useEffect(()=>{if(k===void 0)return;let e=()=>{A.state.instantType===k&&A.set(`instantType`,void 0)};if(!N){e();return}if(fe!==void 0)return;if(A.context.popupRef.current==null){e();return}let t=new AbortController;return pe(e,t.signal),()=>{t.abort()}},[k,N,fe,pe,A]),W(()=>{v&&!b?A.update({parent:{type:`context-menu`,context:v},floatingNodeId:M,floatingParentNodeId:E}):b&&A.update({floatingNodeId:M,floatingParentNodeId:E})},[v,b,M,E,A]),K.useEffect(()=>{N||(oe.current=null),L.type===`context-menu`&&(N?R.start(500,()=>{se.current=!0}):(R.clear(),se.current=!1))},[R,N,L.type]),W(()=>{!N&&!te&&A.set(`hoverEnabled`,!0)},[N,te,A]);let H=U((e,t)=>{let n=t.reason;if(!e&&!A.select(`open`)||N===e&&t.trigger===P&&ne===n)return;let i=kt(t);if(!e&&t.trigger==null&&(t.trigger=P??void 0),r?.(e,t),t.isCanceled)return;A.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!z.current)return;e&&n===`trigger-focus`?(z.current=!1,le.start(300,()=>{z.current=!0})):(z.current=!0,le.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null);oe.current=t.event;let c=at(A.state,e,t.trigger,i());c.openChangeReason=n,c.instantType=L.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:o||s?o?`click`:`dismiss`:void 0,A.update(c)}),me=Sn({popupStore:A,floatingRootContext:A.state.floatingRootContext,floatingId:T,nested:E!=null,onOpenChange:H}),he=me.context.events;W(()=>{let e=({open:e,eventDetails:t})=>H(e,t);return he.on(`setOpen`,e),()=>{he?.off(`setOpen`,e)}},[he,H]);let ge=K.useCallback(()=>{A.setOpen(!1,zt(rt))},[A]);K.useImperativeHandle(u,()=>({unmount:V,close:ge}),[V,ge]);let _e;L.type===`context-menu`&&(_e=L.context),K.useImperativeHandle(_e?.positionerRef,()=>F,[F]),K.useImperativeHandle(_e?.actionsRef,()=>({setOpen:H}),[H]);let ve=p(me,{enabled:!I,bubbles:{escapeKey:d&&L.type===`menu`},outsidePress(){return L.type!==`context-menu`||oe.current?.type===`contextmenu`||se.current},externalTree:ue?j:void 0}),ye=Fe(),be=K.useCallback(e=>{A.select(`activeIndex`)!==e&&A.set(`activeIndex`,e)},[A]),xe=ha(me,{enabled:!I,listRef:A.context.itemDomElements,activeIndex:re,nested:L.type!==void 0,loopFocus:c,orientation:l,parentOrientation:L.type===`menubar`?L.context.orientation:void 0,rtl:ye===`rtl`,disabledIndices:Ke,onNavigate:be,openOnArrowKeyDown:L.type!==`context-menu`,externalTree:ue?j:void 0,focusItemOnHover:_}),Se=K.useCallback(e=>{A.context.typingRef.current=e},[A]),Ce=ga(me,{enabled:!I,listRef:A.context.itemLabels,elementsRef:A.context.itemDomElements,activeIndex:re,resetMs:500,onMatch:e=>{N&&e!==re&&A.set(`activeIndex`,e)},onTyping:Se}),we=K.useMemo(()=>{let e=Mt(Ce.reference,xe.reference,ve.reference,{onMouseMove(){A.set(`allowMouseEnter`,!0)}},B);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=N,e},[A,Ce.reference,xe.reference,ve.reference,B,N]),Te=K.useMemo(()=>{let e=Mt(xe.trigger,ve.trigger,B);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[xe.trigger,ve.trigger,B]);He(()=>(A.update({inactiveTriggerProps:Te}),null));let Ee=K.useMemo(()=>Mt(Vt,{id:T,role:`menu`,"aria-orientation":l===`horizontal`?`horizontal`:void 0,"aria-labelledby":P?.id,onMouseMove(){A.set(`allowMouseEnter`,!0),L.type===`menu`&&A.set(`hoverEnabled`,!1)},onClick(){A.select(`hoverEnabled`)&&A.set(`hoverEnabled`,!1)},onKeyDown(e){let t=A.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Ce.floating,xe.floating,ve.floating),[P,T,l,L.type,A,Ce.floating,xe.floating,ve.floating]),De=xe.item??Bt;Nt(A,{floatingRootContext:me,activeTriggerProps:we,inactiveTriggerProps:Te,popupProps:Ee,itemProps:De});let Oe=K.useMemo(()=>({store:A,parent:C}),[A,C]),ke=(0,q.jsxs)(Fc.Provider,{value:Oe,children:[f&&(0,q.jsx)(nn,{handle:f,store:A}),typeof t==`function`?t({payload:ie}):t]});return L.type===void 0||L.type===`context-menu`?(0,q.jsx)(y,{externalTree:j,children:ke}):ke});function vl(e,t,n){return He(()=>new fl(e,t,n)).current}var yl=5;function bl(e,t){let n=xl(t);return e.clientX>=n.left-yl&&e.clientX<=n.right+yl&&e.clientY>=n.top-yl&&e.clientY<=n.bottom+yl}function xl(e){let t=e.getBoundingClientRect(),n=Xe(e);if(Ae)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function Sl(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=dt(),{ref:i,index:a}=Gc(e),o=n===a,s=K.useRef(null),c=et(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function Cl(e){let{render:t,className:n,style:r,state:i=Bt,props:a=Ke,refs:o=Ke,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=Sl({metadata:s});return Zt(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function wl(e){if(_e(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!f(e))return wl(Tn(e))}var Tl=An(Tt(),1);function El(e,t){let n=K.useRef(null);function r(t){Tl.flushSync(()=>{e.setOpen(!1,zt(cn,t.nativeEvent,t.currentTarget))}),je(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&T(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{Tl.flushSync(()=>{e.setOpen(!1,zt(cn,n.nativeEvent,n.currentTarget))});let i=Te(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&H(r,i);){let e=i;if(i=Oe(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Dl(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=K.useRef(!1);return K.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,it(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Bt,[t,n,r])}var Ol=ze(function(t,n){let{render:r,className:i,style:a,disabled:s=!1,nativeButton:c=!0,id:l,openOnHover:u,delay:d=100,closeDelay:f=0,handle:p,payload:m,...h}=t,_=Ic(!0),v=Lt(p)??_?.store;if(!v)throw Error(Wt(85));let y=Re(l),b=v.useState(`isTriggerActive`,y),x=v.useState(`floatingRootContext`),S=v.useState(`isOpenedByTrigger`,y),C=v.useState(`triggerPopupId`,y),w=K.useRef(null),T=Al(),E=dt(!0),D=Et(),O=K.useMemo(()=>D??new o,[D]),k=g(O),A=ce(),{registerTrigger:ee,isMountedByThisTrigger:j}=Ue(y,w,v,{payload:m,closeDelay:f,parent:T,floatingTreeRoot:O,floatingNodeId:k,floatingParentNodeId:A,keyboardEventRelay:E?.relayKeyboardEvent}),M=T.type===`menubar`,N=v.useState(`disabled`),P=s||N||M&&T.context.disabled,{getButtonProps:F,buttonRef:te}=Ot({disabled:P,native:c});K.useEffect(()=>{!S&&T.type===void 0&&(v.context.allowMouseUpTriggerRef.current=!1)},[v,S,T.type]);let I=K.useRef(null),ne=Ie(),L=U(e=>{if(!I.current)return;ne.clear(),v.context.allowMouseUpTriggerRef.current=!1;let t=e.target;H(I.current,t)||H(v.select(`positionerElement`),t)||t===I.current||t!=null&&wl(t)===v.select(`rootId`)||bl(e,I.current)||O.events.emit(`close`,{domEvent:e,reason:en})});K.useEffect(()=>{S&&v.select(`lastOpenChangeReason`)===`trigger-hover`&&it(I.current).addEventListener(`mouseup`,L,{once:!0})},[S,L,v]);let re=M&&T.context.hasSubmenuOpen,ie=e(x,{enabled:(u??re)&&!P&&(!M||re&&!j),handleClose:B({blockPointerEvents:!M}),mouseOnly:!0,move:!1,restMs:T.type===void 0?d:void 0,delay:{close:f},triggerElementRef:w,externalTree:O,isActiveTrigger:b,isClosing:()=>v.select(`transitionStatus`)===`ending`}),ae=kl(S,v.select(`lastOpenChangeReason`)),oe=Zi(x,{enabled:!P,event:S&&M?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:T.type===void 0&&ae}),se=on(x,{enabled:!P&&re}),R=Dl({open:S,enabled:M,mouseDownAction:`open`}),z=K.useMemo(()=>Mt(se.reference,oe.reference),[se.reference,oe.reference]),le=v.useState(`triggerProps`,j),{preFocusGuardRef:ue,handlePreFocusGuardFocus:de,handleFocusTargetFocus:V}=El(v,w),fe={disabled:P,open:S},pe=[I,n,te,ee,w],me=[z,ie??Bt,le,{"aria-haspopup":`menu`,"aria-controls":C,id:y,onMouseDown:e=>{v.select(`open`)||(ne.start(200,()=>{v.context.allowMouseUpTriggerRef.current=!0}),it(e.currentTarget).addEventListener(`mouseup`,L,{once:!0}))}},M?{role:`menuitem`}:{},R,h,F],he=Zt(`button`,t,{enabled:!M,stateAttributesMapping:be,state:fe,ref:pe,props:me});return M?(0,q.jsx)(Cl,{tag:`button`,render:r,className:i,style:a,state:fe,refs:pe,props:me,stateAttributesMapping:be}):S?(0,q.jsxs)(K.Fragment,{children:[(0,q.jsx)(ot,{ref:ue,onFocus:de},`${y}-pre-focus-guard`),(0,q.jsx)(K.Fragment,{children:he},y),(0,q.jsx)(ot,{ref:v.context.triggerFocusTargetRef,onFocus:V},`${y}-post-focus-guard`)]}):(0,q.jsx)(K.Fragment,{children:he},y)});function kl(e,t){let n=Ie(),[r,i]=K.useState(!1);return W(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Al(){let e=ul(!0);return K.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var jl=K.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return Zt(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function Ml({...e}){return(0,q.jsx)(_l,{"data-slot":`dropdown-menu`,...e})}function Nl({...e}){return(0,q.jsx)(Ol,{"data-slot":`dropdown-menu-trigger`,...e})}function Pl({className:e,align:t=`end`,sideOffset:n=6,...r}){return(0,q.jsx)(Qc,{children:(0,q.jsx)(cl,{align:t,className:`isolate z-50`,sideOffset:n,children:(0,q.jsx)(Yc,{className:G(`min-w-48 pop-menu rounded-lg border border-border bg-popover p-1 text-sm text-popover-foreground shadow-md outline-none`,e),"data-slot":`dropdown-menu-content`,...r})})})}function Fl({className:e,...t}){return(0,q.jsx)(Kc,{className:G(`flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-150 ease-out outline-none select-none data-highlighted:bg-secondary data-highlighted:text-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground`,e),"data-slot":`dropdown-menu-item`,...t})}function Il({className:e,...t}){return(0,q.jsx)(jl,{className:G(`-mx-1 my-1 h-px bg-border`,e),"data-slot":`dropdown-menu-separator`,...t})}var Ll=()=>{let e=Ve();return async(t,n)=>{await navigator.clipboard.writeText(t),e.add({title:n})}},Rl=async({model:e,copy:t})=>{let{listener:n,branch:r}=e,i=n?.run??null,a=n?.worktree??null,o=n?.agents.find(e=>e.label===i?.agent)??null;a!==null&&i!==null&&o!==null&&(await t(jc({resume:i.resume,interactive:o.interactive,worktree:a,branch:r}),`Resume command copied · paste it in a terminal`),await e.handleStop())},zl=({model:e,copy:t})=>e.listener?.run?.state===`running`&&e.listener.worktree!==null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(Fl,{disabled:e.isBusy,onClick:()=>{Rl({model:e,copy:t})},children:[(0,q.jsx)(hi,{}),`Take over in your terminal`]}),(0,q.jsx)(Il,{})]}):null,Bl=e=>e.agents.find(t=>t.id===e.chosen)??null,Vl=({model:e,isHeard:t,onSettings:n})=>{let r=Ll(),{listener:i,isBusy:a,branch:o}=e;if(i===null)return null;let s=Bl(i),c=i.agents.filter(e=>e.isInstalled&&e.id!==s?.id),{worktree:l}=i;return(0,q.jsxs)(Ml,{children:[(0,q.jsx)(Nl,{render:(0,q.jsx)(st,{"aria-label":`Agent options`,size:`icon-xs`,variant:`ghost`,children:(0,q.jsx)(qn,{})})}),(0,q.jsxs)(Pl,{children:[(0,q.jsx)(zl,{copy:r,model:e}),t?null:c.map(t=>(0,q.jsxs)(Fl,{disabled:a||l===null,onClick:()=>void e.handleStart(t.id),children:[(0,q.jsx)(Yr,{}),`Start a headless ${t.label}`]},t.id)),t||c.length===0?null:(0,q.jsx)(Il,{}),(0,q.jsxs)(Fl,{disabled:l===null,onClick:()=>{l!==null&&r(kc(l,o),`Prompt copied: paste it to your agent`)},children:[(0,q.jsx)(lr,{}),`Copy a prompt for your agent`]}),s===null?null:(0,q.jsxs)(Fl,{disabled:l===null,onClick:()=>{l!==null&&r(Mc(s.interactive,l,o),`Command copied: paste it in a terminal to open ${s.label}`)},children:[(0,q.jsx)(hi,{}),`Copy a terminal command for ${s.label}`]}),(0,q.jsx)(Il,{}),(0,q.jsxs)(Fl,{onClick:n,children:[(0,q.jsx)(ai,{}),`Agent settings…`]})]})]})},Hl=e=>{let t=Ll(),n=e.listener,{listener:r}=n,i=r?.worktree??null;if(r===null||i===null)return[];let a=Bl(r),o=r.run?.state===`running`;return[{id:`start`,icon:li,label:`Start ${a?.label??`an agent`}`,note:`It reads your comments and answers them in the background`,isShown:!o&&!r.isListening&&a!==null,onPress:()=>{a!==null&&n.handleStart(a.id)}},{id:`take-over`,icon:hi,label:`Take over in your terminal`,note:`Copies a command that resumes its session, and stops it here`,isShown:o,onPress:()=>{Rl({model:n,copy:t})}},{id:`stop`,icon:_i,label:`Stop ${r.run?.agent??`the agent`}`,isShown:o,onPress:()=>{n.handleStop()}},{id:`terminal`,icon:hi,label:`Copy a terminal command`,note:`Opens ${a?.label??`the agent`} in this worktree, already listening`,isShown:!o&&a!==null,onPress:()=>{a!==null&&t(Mc(a.interactive,i,n.branch),`Command copied · paste it in a terminal`)}}]},Ul=`[data-review-diff]`,Wl=`[data-review-row]`,Gl=100,Kl=()=>{let e=document.querySelector(Ul);if(e===null)return null;let{top:t}=e.getBoundingClientRect(),n=[...e.querySelectorAll(Wl)].find(e=>e.getBoundingClientRect().bottom>t);return n===void 0?null:{diff:e,row:n,at:n.getBoundingClientRect().top}},ql=e=>{let t=Kl();$t(e),t!==null&&(t.diff.scrollTop+=t.row.getBoundingClientRect().top-t.at),Ht({codeSize:e})},Jl=()=>{let{codeSize:e}=Qe();return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`label`,{className:`flex min-h-14 items-center gap-3 px-3.5`,children:[(0,q.jsx)(`span`,{className:`sr-only`,children:`Code size`}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`w-4 text-center text-xs text-muted-foreground`,children:`A`}),(0,q.jsx)(`input`,{"aria-valuetext":`${String(e)} pixels`,className:`code-size-range min-w-0 flex-1`,max:Dt.max,min:Dt.min,ref:t=>{let n=(e-Dt.min)/(Dt.max-Dt.min);t?.style.setProperty(`--fill`,`${String(n*Gl)}%`)},onChange:e=>{ql(Number(e.currentTarget.value))},step:1,type:`range`,value:e}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`w-4 text-center text-lg text-muted-foreground`,children:`A`})]})})},Yl=({isOn:e})=>(0,q.jsx)(`span`,{"aria-hidden":!0,className:`relative h-7 w-16 shrink-0 rounded-full bg-foreground/16 transition-colors duration-200 data-on:bg-sign-add`,"data-on":e?``:void 0,children:(0,q.jsx)(`span`,{className:`absolute inset-s-0.5 top-0.5 h-6 w-9.5 switch-thumb rounded-full bg-white shadow-sm`})}),Xl=({action:e})=>{let t=e.icon,n=e.isOn!==void 0;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{"aria-checked":n?e.isOn:void 0,className:`flex min-h-13 w-full items-center gap-3 px-3.5 py-1.5 text-start text-base/5 text-foreground transition-colors duration-150 active:bg-foreground/8`,onClick:()=>{e.onPress()},role:n?`switch`:void 0,type:`button`,children:[(0,q.jsx)(`span`,{className:`grid size-7.5 shrink-0 place-items-center rounded-lg bg-foreground/9`,children:(0,q.jsx)(t,{className:`size-4.5`})}),(0,q.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,q.jsx)(`span`,{children:e.label}),e.note===void 0?null:(0,q.jsx)(`span`,{className:`text-ui text-muted-foreground`,children:e.note})]}),e.value===void 0?null:(0,q.jsx)(`span`,{className:`max-w-32 truncate font-mono text-ui text-muted-foreground`,children:e.value}),n?(0,q.jsx)(Yl,{isOn:e.isOn===!0}):(0,q.jsx)(Zn,{"aria-hidden":!0,className:`size-4 shrink-0 text-subtle`})]})})},Zl=({title:e,actions:t,extra:n=null})=>{let r=t.filter(e=>e.isShown!==!1);return r.length===0?null:(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h3`,{className:`m-0 px-4 pt-3.5 pb-1.5 text-ui font-normal text-muted-foreground`,children:e}),(0,q.jsxs)(`ul`,{className:`m-0 list-none more-group p-0`,children:[r.map(e=>(0,q.jsx)(Xl,{action:e},e.id)),n]})]})},Ql=(e,{present:t,isShown:n})=>{let r=new Set(t);return e.map((e,t)=>{let i=e.files.filter(e=>r.has(e));return{kind:`layer`,key:Wo(t),index:t,address:e.address,ticket:e.ticket,title:e.title,all:i,files:i.filter(e=>n(t,e))}})},$l=(e,t)=>{let n=[];return e.forEach(e=>{let{ticket:r}=e,i=n.find(e=>e.kind===`ticket`&&e.number===r),a=t.find(e=>e.number===r);r===null||a===void 0?n.push(e):i?.kind===`ticket`?i.groups.push(e):n.push({kind:`ticket`,key:Go(r),number:r,title:a.title,groups:[e]})}),n},eu=e=>e.kind===`ticket`?e.groups:[e],tu=(e,{depth:t,isOpen:n})=>[{kind:`dir`,key:e.key,label:e.title,full:e.key,depth:t},...n(e)?e.files.map(n=>({kind:`file`,key:Ko(e.index,n),path:n,label:ko(n),depth:t+1})):[]],nu=(e,t)=>e.flatMap(e=>e.kind===`layer`?tu(e,{depth:0,isOpen:t}):[{kind:`dir`,key:e.key,label:e.title,full:e.key,depth:0},...t(e)?e.groups.flatMap(e=>tu(e,{depth:1,isOpen:t})):[]]),ru=e=>e.flatMap(e=>eu(e).flatMap(e=>e.files.map(t=>Ko(e.index,t)))),iu=(e,{isDone:t,isOpen:n,isReadOpen:r})=>{let i=e.filter(e=>t(e)),a=e.filter(e=>!t(e));if(i.length===0)return{rows:nu(e,n),order:ru(e),done:i,rest:a};let o={kind:`dir`,key:Qo,label:`${String(i.length)} ${i.length===1?`layer`:`layers`} read`,full:Qo,depth:0},s=r?[...i,...a]:a;return{rows:[o,...nu(s,n)],order:ru(s),done:i,rest:a}},au={gone:``,settled:`✓`,filed:`○`,waiting:`◎`,answered:`●`,asked:`◉`},ou={gone:`Removed`,settled:`Settled`,filed:`Not picked up`,waiting:`Picked up, no answer`,answered:`Answered, not settled`,asked:`Waiting on you`},su={gone:`removed`,settled:`settled`,filed:`not picked up`,waiting:`picked up`,answered:`answered`,asked:`waiting on you`},cu={open:0,stand:`gone`},lu=(e,t)=>e.find(e=>e.path===t)??cu,uu=(e,t)=>e?.parts.find(e=>e.path===t)??cu,du=({open:e,stand:t,settled:n=0})=>e===0&&t===`settled`?`${String(n)} settled`:`${String(e)} ${e===1?`comment`:`comments`} · ${e===1?``:`the loudest `}${su[t]}`,fu=(e,t,n)=>e.findIndex(e=>(t===`new`?e.new:e.old)===n),pu=(e,{threads:t,layer:n})=>n===null||t.some(t=>t.file===e.path&&t.side===e.side&&t.end===e.line&&!t.isMovedPast&&t.layers.includes(n+1)),mu=({lineMarks:e,threads:t,drafts:n,path:r,rows:i,layer:a})=>{let o=new Map;return e.filter(e=>e.path===r&&pu(e,{threads:t,layer:a})).forEach(e=>{let t=fu(i,e.side,e.line);t!==-1&&o.set(t,{stand:e.stand,settled:e.settled})}),n.filter(e=>e.file===r).forEach(e=>{let t=fu(i,`new`,e.end),n=o.get(t);t!==-1&&o.set(t,{stand:n===void 0||n.stand===`settled`?`filed`:n.stand,settled:n?.settled??0})}),o},hu=/(?<=\.)\s+(?=[A-Z`?@(])/u,gu=/^[-•·*]\s+/u,_u=/\*\*(?<words>[^*]+)\*\*/gu,vu=/^Read\b/u,yu=e=>e.replaceAll(_u,`$<words>`),bu=e=>(e.includes(`
4
+ `)?e.split(`
5
+ `):e.split(hu)).map(e=>yu(e.trim().replace(gu,``))).filter(e=>e!==``),xu=(e,t)=>{let[n,...r]=bu(e);return n===void 0?null:{lead:n,points:r.filter(e=>!vu.test(e)),howTo:r.filter(e=>vu.test(e)),path:t}},Su=e=>{let[t]=e.prose;return t===void 0?null:xu(t.markdown,t.path)},Cu=(e,t)=>e.prose.slice(1).filter(e=>e.path===t).toSorted((e,t)=>e.line-t.line||Number(e.after)-Number(t.after)),wu=/(?<code>`[^`]+`|\?\w+=|@[A-Z]\w+|\b(?:GET|POST|PUT|PATCH|DELETE)\b|\b[a-z]+[A-Z]\w*|\b[A-Z][a-z\d]+[A-Z]\w*|(?:[\w.:-]*\/)+[\w.:-]+|\b[\w-]+\.(?:ts|tsx|js|json|md|ya?ml)\b)/u,Tu=2,Eu=/(?<=[./])/u,Du=/[./]$/u,Ou=/^[a-z_$]/iu,ku=({text:e,next:t})=>e.split(Eu).map((e,n,r)=>(0,q.jsxs)(K.Fragment,{children:[e,Du.test(e)&&Ou.test(r[n+1]??t)?(0,q.jsx)(`wbr`,{}):null]},`${String(n)}:${e}`)),Au=({text:e,isChipped:t=!1})=>{let n=e.split(wu).map((e,t)=>t%Tu===1?{isCode:!0,text:e.replaceAll("`",``)}:{isCode:!1,text:e});return(0,q.jsx)(`span`,{className:`wrap-anywhere`,children:n.map((e,r)=>{let i=n.slice(r+1).find(e=>e.text!==``)?.text??``;return e.isCode?(0,q.jsx)(`code`,{className:t?`note-code`:`font-mono text-foreground`,children:(0,q.jsx)(ku,{next:i,text:e.text})},`${String(r)}:${e.text}`):(0,q.jsx)(ku,{next:i,text:e.text},`${String(r)}:${e.text}`)})})},ju=({className:e})=>(0,q.jsx)(`svg`,{"aria-hidden":!0,className:e,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:1.3,viewBox:`0 0 14 14`,children:(0,q.jsx)(`path`,{d:`M3 4h8M3 7h8M3 10h5`})}),Mu=({intro:e,isPart:t=!1,isIntroShown:n,onOpenIntro:r})=>e===null?null:(0,q.jsxs)(`button`,{className:G(`mt-0.5 mb-1 grid w-full gap-0.5 rounded-md py-1.5 pe-2 text-start text-ui text-muted-foreground hover:bg-row-hover hover:text-foreground max-md:text-sm`,t?`ps-10.5`:`ps-8`),onClick:r,type:`button`,children:[(0,q.jsx)(`span`,{children:(0,q.jsx)(Au,{text:e.lead})}),(0,q.jsx)(`span`,{className:`text-xs text-subtle`,children:n?`Intro is open`:`Read the intro`})]}),Nu=1e3,Pu=e=>e>=Nu?`${(e/Nu).toFixed(1).replace(/\.0$/u,``)}k`:String(e),Fu=({added:e,removed:t,className:n})=>e===0&&t===0?null:(0,q.jsxs)(`span`,{className:G(`shrink-0 tabular-nums`,n),children:[e===0?null:(0,q.jsx)(`span`,{className:`text-sign-add`,children:`+${Pu(e)}`}),e===0||t===0?null:` `,t===0?null:(0,q.jsx)(`span`,{className:`text-sign-del`,children:`−${Pu(t)}`})]}),Iu=3e4,Lu=0,Ru=e=>{Lu=Date.now();let t=setInterval(()=>{Lu=Date.now(),e()},Iu);return()=>{clearInterval(t)}},zu=()=>Lu,Bu=()=>0,Vu=()=>(0,K.useSyncExternalStore)(Ru,zu,Bu),Hu=6e4,Uu=36e5,Wu=864e5,Gu=6048e5,Ku=new Intl.DateTimeFormat(void 0,{day:`numeric`,month:`short`}),qu=(e,t)=>{let n=t-Date.parse(e);return n<Hu?`now`:n<Uu?`${String(Math.floor(n/Hu))}m`:n<Wu?`${String(Math.floor(n/Uu))}h`:n<Gu?`${String(Math.floor(n/Wu))}d`:Ku.format(new Date(e))},Ju=e=>`${String(e)} ${e===1?`line`:`lines`}`,Yu=e=>`${String(e)} ${e===1?`place`:`places`}`,Xu=(e,t)=>{let n=e.at===``?``:`, ${qu(e.at,t)} ago`;return e.deleted?`Deleted since you reviewed it${n}`:e.kept?`${Ju(e.added+e.removed)} in ${Yu(e.places)} since you reviewed it${n}`:`Changed since you reviewed it${n}`},Zu=()=>(0,q.jsxs)(`svg`,{"aria-hidden":!0,className:`size-3`,fill:`none`,viewBox:`0 0 12 12`,children:[(0,q.jsx)(`path`,{d:`M10.4 4.2A4.9 4.9 0 1 0 10.9 7.6`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.3`}),(0,q.jsx)(`path`,{d:`M10.9 1.6 10.6 4.5 7.8 4.1`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.3`}),(0,q.jsx)(`path`,{d:`M3.9 6.2 5.4 7.7 8 4.9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.4`})]}),Qu=({since:e})=>{let t=Vu();return(0,q.jsxs)(E,{children:[(0,q.jsxs)(ke,{render:(0,q.jsx)(`span`,{className:`inline-flex text-muted-foreground`}),children:[(0,q.jsx)(Zu,{}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Changed since review`})]}),(0,q.jsx)(Ce,{children:(0,q.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:`Changed since review`}),(0,q.jsx)(`span`,{children:Xu(e,t)})]})})]})},$u={added:{Icon:Zr,label:()=>`New file`,tone:`text-sign-add`},deleted:{Icon:Gr,label:()=>`Deleted file`,tone:`text-sign-del`},renamed:{Icon:Ln,label:e=>`Renamed from ${e}`,tone:`text-subtle`},copied:{Icon:dr,label:e=>`Copied from ${e}`,tone:`text-subtle`}},ed=({file:e})=>{if(e.status===`modified`)return null;let{Icon:t,label:n,tone:r}=$u[e.status],i=n(e.previousPath);return(0,q.jsxs)(E,{children:[(0,q.jsxs)(ke,{render:(0,q.jsx)(`span`,{className:G(`inline-flex shrink-0`,r)}),children:[(0,q.jsx)(t,{"aria-hidden":!0,className:`size-3`}),(0,q.jsx)(`span`,{className:`sr-only`,children:i})]}),(0,q.jsx)(Ce,{children:i})]})},td=[{short:`bin`,label:`Binary file`,isOn:e=>e.isBinary},{short:`gen`,label:`Generated file`,isOn:e=>e.isGenerated}],nd=({file:e})=>td.filter(t=>t.isOn(e)).map(e=>(0,q.jsxs)(E,{children:[(0,q.jsx)(ke,{render:(0,q.jsx)(`span`,{className:`shrink-0 text-subtle`}),children:e.short}),(0,q.jsx)(Ce,{children:e.label})]},e.short)),rd={gone:``,settled:`text-stand-settled`,filed:`text-stand-filed`,waiting:`text-stand-waiting`,answered:`text-stand-answered`,asked:`text-stand-asked`},id=(0,q.jsx)(`circle`,{cx:`6`,cy:`6`,fill:`none`,r:`4.25`,stroke:`currentColor`,strokeWidth:`1.5`}),ad={gone:null,filed:id,waiting:(0,q.jsxs)(q.Fragment,{children:[id,(0,q.jsx)(`circle`,{cx:`6`,cy:`6`,fill:`currentColor`,r:`1.75`})]}),answered:(0,q.jsx)(`circle`,{cx:`6`,cy:`6`,fill:`currentColor`,r:`5`}),asked:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`circle`,{cx:`6`,cy:`6`,fill:`none`,r:`5`,stroke:`currentColor`,strokeWidth:`1`}),(0,q.jsx)(`circle`,{cx:`6`,cy:`6`,fill:`currentColor`,r:`3`})]}),settled:(0,q.jsx)(`path`,{d:`M2.25 6.25 4.75 8.75 9.75 3.25`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.75`})},od=({stand:e})=>(0,q.jsx)(`svg`,{"aria-hidden":!0,className:`size-2.5`,shapeRendering:`geometricPrecision`,viewBox:`0 0 12 12`,children:ad[e]}),sd=({stand:e,said:t=null})=>{if(e===`gone`)return(0,q.jsx)(`span`,{"aria-hidden":!0,className:`stand-slot`});let n=t??ou[e];return(0,q.jsxs)(E,{children:[(0,q.jsxs)(ke,{render:(0,q.jsx)(`span`,{className:G(`stand-slot`,rd[e]),"data-glyph":au[e],"data-stand":e}),children:[(0,q.jsx)(od,{stand:e}),(0,q.jsx)(`span`,{className:`sr-only`,children:n})]}),(0,q.jsx)(Ce,{children:n})]})},cd=({threads:e})=>e.open>0?(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,q.jsx)(sd,{said:du(e),stand:e.stand}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:G(`font-mono text-xs tabular-nums`,rd[e.stand]),children:e.open})]}):null,ld=12,ud=(e,t,n)=>({count:e.all.length,read:e.all.filter(t=>n(e.index,t)).length,added:t?.added??0,removed:t?.removed??0,isDone:t?.isDone??!1}),dd=({size:e})=>(0,q.jsxs)(`span`,{className:`text-xs/4 text-subtle tabular-nums`,children:[`${String(e.count)} ${e.count===1?`file`:`files`}`,e.count===0?null:(0,q.jsxs)(q.Fragment,{children:[` · `,(0,q.jsx)(`span`,{className:`text-sign-add`,children:`+${Pu(e.added)}`}),e.removed===0?null:(0,q.jsx)(`span`,{className:`text-sign-del`,children:` −${Pu(e.removed)}`})]})]}),fd=()=>(0,q.jsx)(Gn,{"aria-label":`read`,className:`size-3 text-success in-aria-expanded:max-md:text-accent-foreground`,strokeWidth:3}),pd=({layer:e,size:t})=>t.isDone?(0,q.jsx)(fd,{}):e.isRemainder?`·`:e.address,md=e=>{let{layer:t,size:n,isOpen:r,isCursor:i}=e,a=t.ticket!==null,{isDone:o}=n;return(0,q.jsxs)(`button`,{"aria-expanded":r,"data-pinned":r?``:void 0,className:G(`flex min-w-0 items-start gap-2 rounded-lg py-1.5 text-start hover:bg-row-hover`,`w-full px-2`,r&&`sticky top-12 z-2 bg-secondary hover:bg-secondary data-stuck:rounded-none data-stuck:shadow-pinned`,r&&(a?`data-stuck:bleed-part`:`data-stuck:bleed`),i&&`bg-secondary transition-none hover:bg-secondary`,i&&!a&&`tree-cursor`),"data-open-row":r?``:void 0,onClick:e.onPick,ref:e.register(e.group.key),title:t.title,type:`button`,children:[(0,q.jsx)(`span`,{className:G(`grid h-5 shrink-0 items-center font-mono text-xs text-subtle tabular-nums`,a?`w-6.5 justify-items-start`:`w-4.5 justify-items-center`,r&&`max-md:rounded-full max-md:bg-accent max-md:text-accent-foreground`,r&&(a?`max-md:h-5.5 max-md:justify-items-center max-md:text-2xs`:`max-md:size-6`)),children:pd(e)}),(0,q.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-px`,children:[(0,q.jsx)(`span`,{className:G(`text-ui wrap-anywhere`,r&&`max-md:text-base max-md:font-semibold`,r||!o&&i?`font-medium text-foreground`:`text-muted-foreground`,o&&!r&&`text-subtle`),children:t.title}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{className:`flex-1`,children:(0,q.jsx)(dd,{size:n})}),(0,q.jsx)(cd,{threads:t}),(0,q.jsx)(`span`,{className:`font-mono text-xs text-subtle tabular-nums`,children:n.count===0?`—`:`${String(n.read)}/${String(n.count)}`}),(0,q.jsx)(Zn,{"aria-hidden":!0,className:`size-3 turn text-subtle`})]})]})]})},hd=({name:e})=>e.length<=ld?(0,q.jsx)(`span`,{className:`name-fit`,children:e}):(0,q.jsxs)(`span`,{className:`name-fit`,children:[(0,q.jsx)(`span`,{className:`name-head`,children:e.slice(0,-12)}),(0,q.jsx)(`span`,{className:`shrink-0`,children:e.slice(-12)})]}),gd=({file:e,part:t})=>e!==void 0&&(t?.added??0)===0&&(t?.removed??0)===0?(0,q.jsx)(ed,{file:e}):(0,q.jsx)(`span`,{className:`shrink-0 text-sign-add tabular-nums`,children:`+${Pu(t?.added??0)}`}),_d=({path:e,props:t})=>{let n=Ko(t.group.index,e),r=t.isReadIn(t.group.index,e),i=t.block.layers[t.group.index],a=uu(i,e),o=t.files.get(e),s=r?void 0:t.block.since.find(t=>t.path===e),c=i!==void 0&&Cu(i,e).length>0,l=t.cursor===n;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{"aria-current":l?`true`:void 0,"aria-label":r?`${ko(e)}, read`:void 0,className:G(`relative flex h-6 w-full min-w-0 items-center gap-1.5 rounded-md ps-7 pe-2 text-start font-mono text-xs hover:bg-row-hover max-md:h-11 max-md:text-sm`,r?`text-muted-foreground`:`text-foreground`,l&&`bg-secondary transition-none hover:bg-secondary`,l&&(i?.ticket??null)===null&&`tree-cursor`),onClick:()=>{t.onPickFile(n,e)},ref:t.register(n),title:e,type:`button`,children:[a.open>0?(0,q.jsx)(`span`,{className:`absolute inset-s-2.5 top-1/2 -translate-y-1/2`,children:(0,q.jsx)(sd,{said:du(a),stand:a.stand})}):null,(0,q.jsx)(hd,{name:ko(e)}),c?(0,q.jsx)(ju,{className:`size-3.5 shrink-0 text-subtle`}):null,r?(0,q.jsx)(Gn,{"aria-hidden":!0,className:`size-3 shrink-0 text-success`,strokeWidth:3}):null,s===void 0?null:(0,q.jsx)(Qu,{since:s}),r||s!==void 0?null:(0,q.jsx)(gd,{file:o,part:i?.parts.find(t=>t.path===e)})]})})},vd=e=>{let t=(e.block.layers[e.group.index]?.ticket??null)!==null,n=e.group.files.map((t,n)=>({path:t,folder:$o(t),isNewFolder:n===0||$o(e.group.files[n-1]??``)!==$o(t)}));return(0,q.jsx)(`ul`,{className:G(`m-0 list-none pt-1 pb-1.5 max-md:mt-2 max-md:mb-3 max-md:more-group max-md:py-1 max-md:ps-0`,t?`ps-3.5 max-md:ms-3 max-md:me-1`:`ps-1.5 max-md:mx-1`),children:n.map(({path:t,folder:n,isNewFolder:r})=>(0,q.jsxs)(`div`,{className:`contents`,children:[r&&n!==``?(0,q.jsxs)(`li`,{className:`flex items-center gap-1.5 ps-4 pt-2 pb-0.5 font-mono text-2xs text-subtle`,title:`${n}/`,children:[(0,q.jsx)(Cr,{"aria-hidden":!0,className:`size-3 shrink-0`}),(0,q.jsx)(`span`,{className:`truncate`,children:ts(n)})]}):null,(0,q.jsx)(_d,{path:t,props:e})]},t))})},yd=e=>({count:e.files.length,added:e.added,removed:e.removed}),bd=({rowKey:e,ticket:t,isOpen:n,isCursor:r,onPick:i,register:a})=>(0,q.jsxs)(`button`,{"aria-expanded":n,className:G(`flex w-full min-w-0 items-start gap-2 rounded-lg px-2 py-1.5 text-start hover:bg-row-hover`,r&&`bg-secondary transition-none hover:bg-secondary`),onClick:i,ref:a(e),title:t.title,type:`button`,children:[(0,q.jsx)(`span`,{className:`grid h-5 w-4.5 shrink-0 place-items-center font-mono text-xs text-subtle tabular-nums`,children:t.isDone?(0,q.jsx)(Gn,{"aria-label":`read`,className:`size-3 text-success`,strokeWidth:3}):t.address}),(0,q.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-px`,children:[(0,q.jsx)(`span`,{className:G(`text-ui wrap-anywhere`,n||r?`text-foreground`:`text-muted-foreground`,r&&`font-medium`,t.isDone&&!n&&!r&&`text-subtle`),children:t.title}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{className:`flex-1`,children:(0,q.jsx)(dd,{size:yd(t)})}),n?null:(0,q.jsx)(cd,{threads:t}),(0,q.jsxs)(`span`,{className:`font-mono text-xs text-subtle tabular-nums`,children:[`${String(t.sublayersDone)}/${String(t.sublayers)}`,(0,q.jsx)(`span`,{className:`font-sans`,children:` parts`})]}),(0,q.jsx)(Zn,{"aria-hidden":!0,className:`size-3 turn text-subtle`})]})]})]}),xd=({row:e,onPick:t})=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{className:G(`flex min-h-14 w-full items-center gap-2.5 py-1.5 pe-3.5 text-start transition-colors duration-150 active:bg-foreground/8`,e.isPart?`ps-10`:`ps-3.5`),onClick:()=>{t(e.key)},type:`button`,children:[(0,q.jsx)(`span`,{className:G(`grid h-6 shrink-0 place-items-center rounded-full font-mono`,e.isPart?`w-7.5 text-xs`:`w-6 text-sm`,e.isHere?`bg-accent text-accent-foreground`:`text-subtle`),children:e.isRead&&!e.isHere?(0,q.jsx)(Gn,{"aria-label":`read`,className:`size-3.5 text-success`,strokeWidth:3}):e.number}),(0,q.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,q.jsx)(`span`,{className:`text-base/5 wrap-anywhere`,children:e.title}),(0,q.jsx)(dd,{size:e.size})]}),e.threads.open>0?(0,q.jsx)(sd,{said:du(e.threads),stand:e.threads.stand}):null,(0,q.jsx)(`span`,{className:`shrink-0 font-mono text-sm text-subtle tabular-nums`,children:e.count})]})}),Sd=({props:e})=>{let{model:t,block:n}=e,r=Xo(e.state.cursor),i=Yo(e.state.cursor)??t.groups.find(t=>t.all.includes(e.state.selected))?.index,a=e=>{let a=ud(e,n.layers[e.index],t.marks.isReadIn),o=n.layers[e.index];return{key:e.key,number:o?.isRemainder===!0?`·`:e.address,title:e.title,size:a,threads:o??cu,count:a.count===0?`—`:`${String(a.read)}/${String(a.count)}`,isRead:a.isDone,isHere:r===null&&e.index===i,isPart:e.ticket!==null}},o=[];return t.entries.forEach(e=>{let t=e.kind===`ticket`?n.tickets.find(t=>t.number===e.number):void 0;t!==void 0&&o.push({key:Go(t.number),number:t.address,title:t.title,size:yd(t),threads:cu,count:`${String(t.sublayersDone)}/${String(t.sublayers)}`,isRead:t.isDone,isHere:r===t.number,isPart:!1}),eu(e).forEach(e=>{o.push(a(e))})}),(0,q.jsx)(`ul`,{className:`m-0 mx-2 mb-10 list-none more-group p-0`,children:o.map(t=>(0,q.jsx)(xd,{onPick:e.onPickLayer,row:t},t.key))})},Cd=e=>e.state.focus===`diff`&&e.file!==void 0,wd=7,Td=e=>e===void 0?`automatic`:/^[\da-f]{40}$/u.test(e)?e.slice(0,wd):e,Ed=({key:e,props:t})=>[e(`b`,{icon:Tr,label:`Compare against`,value:Td(t.block.base.label)}),e(`/`,{icon:ti,label:`Search the branch`}),e(`p`,{icon:Dr,label:`Open the pull request`,isShown:t.hasPull}),e(`L`,{icon:Lr,label:`New reading order`,note:`Ask the agent to regroup the files into layers`})],Dd=({key:e,props:t})=>[e(`a`,{icon:Ur,label:`Review panel`}),e(`D`,{icon:Un,label:`Settle what is read`,note:`Close answered threads on files you reviewed`}),e(`C`,{icon:ri,label:`Send ${String(t.draftCount)} held notes`,note:`Post them to the pull request as one review`,isShown:t.draftCount>0})],Od=({key:e,props:t})=>[e(`m`,{icon:ar,label:`Reviewed`,isOn:t.isReviewed,isShown:t.file!==void 0}),e(`s`,{icon:Nr,label:`Group by layer`,note:`Read the files in the order the agent suggests`,isOn:t.state.isLayered||t.state.wantsLayers}),e(`f`,{icon:_r,label:`Hide read files`,isOn:t.state.isHidingReviewed})],kd=({key:e,props:t})=>[e(`}`,{icon:Fn,label:`Next change`,isShown:Cd(t)}),e(`{`,{icon:zn,label:`Previous change`,isShown:Cd(t)}),e(`n`,{icon:qn,label:`Next comment`,isShown:Cd(t)}),e(`N`,{icon:$n,label:`Previous comment`,isShown:Cd(t)}),e(`V`,{icon:pi,label:`Select the change`,note:`Pick every line of the change under the cursor`,isShown:Cd(t)})],Ad=({key:e,props:t,isNoted:n,isOthersShown:r})=>t.state.isLayered?[e(`I`,{icon:yi,label:`Layer notes`,note:`The layer's intro and each file's note over its code`,isOn:n}),e(`O`,{icon:jr,label:`Other layers`,note:`Other layers' lines in place, quiet, rather than folded`,isOn:r})]:[],jd=e=>{let{key:t,props:n,isScoped:r}=e;return[t(`w`,{icon:xi,label:`Wrap long lines`,isOn:n.state.isWrapped}),t(`+`,{icon:rr,label:`More context`,note:`Show more unchanged lines around each change`}),t(`-`,{icon:tr,label:`Less context`}),t(`F`,{icon:yr,label:`Whole file`,isOn:n.state.context===`whole`}),t(`S`,{icon:qr,label:`Pin the scope`,note:`Keep the function you are in above the code`,isOn:r}),...Ad(e)]},Md=({key:e})=>[e(`?`,{icon:kr,label:`Theme, editor and keys`,note:`Warm, black or light; where lines open`})],Nd=({props:e,onPress:t,footer:n})=>{let{isScoped:r,isNoted:i,isOthersShown:a}=Qe(),o=Hl(e),s={props:e,isScoped:r,isNoted:i,isOthersShown:a,key:(e,n)=>({id:e,...n,onPress:()=>{t(e)}})};return(0,q.jsxs)(`div`,{className:`grid gap-1 px-2 pb-10`,children:[(0,q.jsx)(Zl,{actions:Ed(s),title:`Branch`}),(0,q.jsx)(Zl,{actions:o,title:`Agent`}),(0,q.jsx)(Zl,{actions:Dd(s),title:`Comments`}),(0,q.jsx)(Zl,{actions:Od(s),title:`Files`}),(0,q.jsx)(Zl,{actions:kd(s),title:`Move`}),(0,q.jsx)(Zl,{actions:jd(s),extra:(0,q.jsx)(Jl,{}),title:`Diff`}),(0,q.jsx)(Zl,{actions:Md(s),title:`Settings`}),n]})},Pd=e=>{let t=e.clipboardData.getData(`text/plain`);if(t===``||(e.preventDefault(),document.execCommand(`insertText`,!1,t)))return;let n=e.currentTarget,r=n.value.length;n.setRangeText(t,n.selectionStart??r,n.selectionEnd??r,`end`),n.dispatchEvent(new Event(`input`,{bubbles:!0}))},Fd=`flex w-full min-w-0 items-start gap-2 rounded-md px-2 py-1.5 text-start transition-colors duration-150 ease-out outline-none hover:bg-secondary focus-visible:bg-secondary`,Id=({text:e})=>(0,q.jsx)(`p`,{className:`m-0 px-4 py-6 text-center text-sm text-subtle`,children:e}),Ld=(e,t)=>e.trim()===``?`Type to search the files this branch changes`:t===null?`Searching…`:t.length===0?`No matches`:null,Rd=e=>{let t={place:e.place,branch:e.block.branch},[n,r]=(0,K.useState)(``),[i,a]=(0,K.useState)([]),o=(0,K.useRef)(0);return{term:n,matches:i,find:async e=>{o.current+=1;let n=o.current;if(r(e),a(e.trim()===``?[]:null),e.trim()===``)return;let i=await Ta({data:{...t,term:e}});n===o.current&&a(i)}}},zd=({term:e,onTerm:t,onEnter:n})=>(0,q.jsx)(`div`,{className:`shrink-0 border-b border-border p-2`,children:(0,q.jsxs)(`label`,{className:`flex h-9 cursor-text items-center gap-2 rounded-lg border border-border bg-composer px-2.5 text-sm transition-colors duration-150 ease-out focus-within:border-muted-foreground hover:border-subtle`,children:[(0,q.jsx)(ti,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-subtle`}),(0,q.jsx)(`input`,{"aria-label":`Search this branch`,className:`min-w-0 flex-1 bg-transparent text-foreground outline-none placeholder:text-subtle [&::-webkit-search-cancel-button]:hidden`,onChange:e=>{t(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),n())},"data-autofocus":!0,onPaste:Pd,placeholder:`Search this branch`,type:`search`,value:e})]})}),Bd=({props:e,onOpen:t})=>{let{term:n,matches:r,find:i}=Rd(e),a=Ld(n,r);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(zd,{onEnter:()=>{let[e]=r??[];e!==void 0&&t(e.path)},onTerm:e=>void i(e),term:n}),(0,q.jsxs)(oc,{children:[a===null?null:(0,q.jsx)(Id,{text:a}),(0,q.jsx)(`ul`,{className:`m-0 grid list-none gap-0.5 p-2`,children:(r??[]).map(e=>(0,q.jsx)(`li`,{children:(0,q.jsx)(`button`,{"aria-label":`${e.path} line ${String(e.line)}: ${e.text.trim()}`,className:Fd,onClick:()=>{t(e.path)},type:`button`,children:(0,q.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,q.jsx)(`span`,{className:`truncate rtl-ellipsis font-mono text-xs/5 text-muted-foreground`,children:(0,q.jsx)(`bdi`,{children:`${e.path}:${String(e.line)}`})}),(0,q.jsx)(`span`,{className:G(`truncate font-mono text-xs/5 whitespace-pre`,e.changed?`text-foreground`:`text-subtle`),children:e.text.trim()})]})})},`${e.path}:${String(e.line)}`))})]}),(0,q.jsxs)(sc,{children:[(0,q.jsx)(V,{children:`↵`}),(0,q.jsx)(`span`,{children:`opens the first match`})]})]})},Vd=40,Hd=8,Ud=e=>e.length===Vd?e.slice(0,Hd):e,Wd=({title:e,said:t,isCurrent:n,isFirst:r=!1,onPick:i})=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{"aria-current":n?`true`:void 0,className:Fd,"data-autofocus":r?!0:void 0,onClick:i,type:`button`,children:[(0,q.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center text-success`,children:n?(0,q.jsx)(Gn,{"aria-hidden":!0,className:`size-3.5`}):null}),(0,q.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,q.jsx)(`span`,{className:`truncate font-mono text-xs/5 text-foreground`,children:e}),t===``?null:(0,q.jsx)(`span`,{className:`text-xs text-subtle`,children:t})]})]})}),Gd=e=>/^[\da-f]{7,40}$/u.test(e),Kd=({text:e})=>(0,q.jsx)(`li`,{"aria-hidden":!0,className:`px-2 pt-2.5 pb-1 text-2xs font-medium text-subtle`,children:e}),qd=({props:e,onDone:t})=>{let n={place:e.place,branch:e.block.branch},r=e.block.base.label,i=cc(()=>Ca({data:n}),`${n.place}|${n.branch}`),a=async r=>{t(),await wa({data:{...n,ref:r}}),await e.refresh(!0)};return(0,q.jsxs)(`ul`,{className:`m-0 grid list-none gap-0.5 p-2`,children:[(0,q.jsx)(Wd,{isCurrent:!1,isFirst:!0,onPick:()=>void a(null),said:`The branch it is stacked on`,title:`automatic`}),i===null?(0,q.jsx)(Id,{text:`Reading the refs…`}):null,[{title:`Commits`,refs:(i??[]).filter(e=>Gd(e.ref))},{title:`Branches`,refs:(i??[]).filter(e=>!Gd(e.ref))}].map(e=>e.refs.length===0?null:(0,q.jsxs)(K.Fragment,{children:[(0,q.jsx)(Kd,{text:e.title}),e.refs.map(e=>(0,q.jsx)(Wd,{isCurrent:e.ref===r,onPick:()=>void a(e.ref),said:e.said,title:Ud(e.ref)},e.ref))]},e.title))]})},Jd={base:`Compare against`,search:`Search this branch`,keys:`Keys`,more:`Actions`,layers:`Layers`},Yd=({props:e,phone:t,onOpen:n})=>{let{state:r,setState:i}=e,[a,o]=(0,K.useState)(r.dialog),s=(0,K.useRef)(null);r.dialog!==null&&r.dialog!==a&&o(r.dialog);let c=()=>{i({...r,dialog:null})};return(0,q.jsx)($s,{onOpenChange:e=>{e||c()},open:r.dialog!==null,children:(0,q.jsxs)(ic,{"data-review-dialog":a??``,initialFocus:()=>s.current?.querySelector(`[data-autofocus]`)??s.current,finalFocus:()=>document.querySelector(`[data-owns-keys]`),ref:s,variant:`sheet`,children:[(0,q.jsx)(ac,{title:a===null?``:Jd[a]}),a===`keys`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(oc,{children:(0,q.jsx)(wc,{})}),(0,q.jsxs)(sc,{children:[(0,q.jsx)(Tc,{}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`mx-2 h-4 w-px bg-border`}),(0,q.jsx)(Ec,{})]})]}):null,a===`more`?(0,q.jsx)(oc,{children:(0,q.jsx)(Nd,{onPress:t.handlePress,props:t})}):null,a===`layers`?(0,q.jsx)(oc,{children:(0,q.jsx)(Sd,{props:t})}):null,a===`base`?(0,q.jsx)(oc,{children:(0,q.jsx)(qd,{onDone:c,props:e})}):null,a===`search`?(0,q.jsx)(Bd,{onOpen:e=>{c(),n(e)},props:e}):null]})})};function Xd(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=zc({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=Ze(a,!0,!0),u=Re(),[d,f]=K.useState(),p=d===null?void 0:d??u,m=U(e=>{let t=!a,n=zt(wn,e.nativeEvent);r(t,n),n.isCanceled||o(t)});return K.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var Zd=K.createContext(void 0);function Qd(){let e=K.useContext(Zd);if(e===void 0)throw Error(Wt(15));return e}var $d=`data-open`,ef=`data-closed`,tf=ie,nf=`data-panel-open`,rf={[$d]:``},af={[ef]:``},of={open(e){return e?{[nf]:``}:null}},sf={open(e){return e?rf:af},...i},cf=K.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=U(o),d=Xd({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=K.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=K.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=Zt(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:sf});return(0,q.jsx)(Zd.Provider,{value:p,children:m})}),lf={...of,...i},uf=K.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=Qd(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=Ot({disabled:c,focusableWhenDisabled:!0,native:u});return Zt(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:lf})}),df={height:void 0,width:void 0};function ff(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=K.useRef(null),f=K.useRef(null),[p,m]=K.useState(df),h=K.useRef(df),g=K.useRef(!1),_=K.useRef(s),v=K.useRef(!1),[y,b]=K.useState(!1),x=K.useRef(null),S=et(t,d),C=Xt(s),w=En(d),T=!s&&!a,E=y?`idle`:u,D=s&&(_.current||v.current),O=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,k=n&&T&&f.current!==`css-animation`,A=U((e,t=!0)=>{t&&(h.current=e),m(e)}),ee=U(()=>{x.current?.(),x.current=null}),j=U(e=>{ee(),x.current=()=>{x.current=null,e()}}),M=U(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});W(()=>{y&&u!==`starting`&&b(!1)},[y,u]),K.useEffect(()=>()=>{M(),ee()},[M,ee]),W(()=>{let e=d.current;if(!e)return;!s&&x.current&&ee();let t=mf(e,D);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=pf(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){A(pf(e)),b(!0);return}if(t===`css-transition`){let t=_f(e);if(A(pf(e)),!n)return t;let r=gf(e,`transition-duration`,`0s`);return j(r),b(!0),t}A(pf(e));let r=gf(e,`animation-name`,`none`);if(!n){r();return}let i=gf(e,`animation-duration`,`0s`);r(),j(i),b(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(_.current=!1,v.current=!1,t===`none`){A(df,!1),c(!1);return}A(pf(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=pf(e);n.height>0||n.width>0?(A(n),t===`css-animation`&&gf(e,`animation-name`,`none`)()):c(!1)},[a,s,ee,A,c,j,D,u]),mn({enabled:s&&a&&E===`idle`,open:!0,ref:d,onComplete(){s&&A(df,!1)}}),K.useEffect(()=>{if(s||!a||E!==`ending`||!d.current)return;let e=new AbortController,t=-1;function n(){C.current||(c(!1),A(df,!1))}return t=an.request(()=>{w(n,e.signal)}),()=>{an.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),W(()=>{let e=d.current;e&&n&&T&&e.setAttribute(`hidden`,`until-found`)},[T,n]),K.useEffect(function(){let e=d.current;if(!e)return;function t(e){let t=zt(jt,e);o(!0,t),t.isCanceled||(g.current=!0,l(!0))}return Ge(e,`beforematch`,t)},[o,l]);let N=i||n||a||s;return{height:O.height,props:{...k?{[tf]:``}:void 0,hidden:T,id:r},ref:S,shouldPreventOpenAnimation:D,shouldRender:N,transitionStatus:E,width:O.width}}function pf(e){return{height:e.scrollHeight,width:e.scrollWidth}}function mf(e,t){let n=Xe(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&hf(n.animationDuration),i=hf(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function hf(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function gf(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{r===``?e.style.removeProperty(t):e.style.setProperty(t,r,i)}}function _f(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})}let r=an.request(n);return()=>{an.cancel(r),n()}}var vf=`--collapsible-panel-height`,yf=`--collapsible-panel-width`,bf=K.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{defaultPanelId:l,mounted:u,onOpenChange:d,open:f,setMounted:p,setPanelIdState:m,setOpen:h,state:g,transitionStatus:_}=Qd(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;W(()=>(m(e=>b??(e===null?void 0:e)),()=>{m(e=>e===b?null:e)}),[b,m]);let{height:S,props:C,ref:w,shouldPreventOpenAnimation:T,shouldRender:E,transitionStatus:D,width:O}=ff({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=bt(s,k),ee=Zt(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[vf]:S===void 0?`auto`:`${S}px`,[yf]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:sf});return E?ee:null}),xf=It(`group/trigger flex w-full items-center gap-1.5 text-start transition-colors duration-150 ease-out outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,{variants:{size:{default:`h-11 rounded-md px-1 text-sm font-medium text-foreground hover:bg-secondary`,sm:`gap-1 text-xs hover-text`,row:`h-9 border-t border-border px-3 text-xs text-muted-foreground hover:bg-row-hover hover:text-foreground focus-visible:text-foreground`}},defaultVariants:{size:`default`}});function Sf({...e}){return(0,q.jsx)(cf,{"data-slot":`collapsible`,...e})}function Cf({className:e,size:t,...n}){return(0,q.jsx)(uf,{className:G(xf({size:t,className:e})),"data-slot":`collapsible-trigger`,...n})}var wf=It(``,{variants:{variant:{default:`h-(--collapsible-panel-height) overflow-clip transition-[height,opacity] duration-200 ease-out data-ending-style:h-0 data-ending-style:opacity-0 data-starting-style:h-0 data-starting-style:opacity-0 motion-reduce:transition-opacity`,room:`room-panel`}},defaultVariants:{variant:`default`}});function Tf({className:e,variant:t,...n}){return(0,q.jsx)(bf,{className:G(wf({variant:t,className:e})),"data-slot":`collapsible-content`,...n})}var Ef=({agent:e,isPicked:t,onPick:n})=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{"aria-current":t?`true`:void 0,className:G(Fd,!e.isInstalled&&`opacity-60`),"data-autofocus":t?!0:void 0,onClick:n,type:`button`,children:[(0,q.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center text-success`,children:t?(0,q.jsx)(Gn,{"aria-hidden":!0,className:`size-3.5`}):null}),(0,q.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,q.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),(0,q.jsx)(`span`,{className:`truncate font-mono text-xs text-subtle`,children:e.isInstalled?e.path??e.bin:`not found in your shell`})]})]})}),Df=({label:e,hint:t,value:n,fallback:r,onChange:i})=>(0,q.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,q.jsxs)(`span`,{className:`flex items-baseline justify-between gap-3 text-xs text-muted-foreground`,children:[(0,q.jsx)(`span`,{children:e}),n===r?null:(0,q.jsx)(`button`,{className:`text-subtle hover:text-foreground`,onClick:e=>{e.preventDefault(),i(r)},type:`button`,children:`Reset`})]}),(0,q.jsx)(`textarea`,{className:`min-h-14 resize-y rounded-lg border border-border bg-composer px-2.5 py-2 font-mono text-xs/5 text-foreground outline-none focus:border-muted-foreground`,onChange:e=>{i(e.target.value)},onPaste:Pd,spellCheck:!1,value:n}),(0,q.jsx)(`span`,{className:`text-xs text-subtle`,children:t})]}),Of=({model:e,onDone:t})=>{let{listener:n}=e,[r,i]=(0,K.useState)(n?.chosen??`claude`),[a,o]=(0,K.useState)({});if(n===null)return null;let s=n.agents.find(e=>e.id===r),c=a[r]??{headless:s?.headless??``,interactive:s?.interactive??``},l=(e,t)=>{o({...a,[r]:{...c,[e]:t}})},u=async()=>{await e.handleSave({agent:r,...c}),t()};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(oc,{children:[(0,q.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-2 gap-0.5 p-2`,children:n.agents.map(e=>(0,q.jsx)(Ef,{agent:e,isPicked:e.id===r,onPick:()=>{i(e.id)}},e.id))}),s===void 0?null:(0,q.jsxs)(`div`,{className:`grid gap-4 border-t border-border p-4`,children:[(0,q.jsx)(Df,{fallback:s.defaultHeadless,hint:`Runs in the review’s worktree, in your shell, so aliases work. The prompt is added last.`,label:`Headless command`,onChange:e=>{l(`headless`,e)},value:c.headless}),(0,q.jsx)(Df,{fallback:s.defaultInteractive,hint:`What “Copy a terminal command” starts. The prompt is added last.`,label:`Terminal command`,onChange:e=>{l(`interactive`,e)},value:c.interactive})]})]}),(0,q.jsxs)(sc,{children:[(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:n.configPath}),(0,q.jsx)(st,{disabled:e.isBusy,onClick:()=>void u(),size:`sm`,children:`Save`})]})]})},kf=({model:e,isOpen:t,onOpenChange:n})=>(0,q.jsx)($s,{onOpenChange:n,open:t,children:(0,q.jsxs)(ic,{variant:`sheet`,children:[(0,q.jsx)(ac,{title:`Agent`}),t?(0,q.jsx)(Of,{model:e,onDone:()=>{n(!1)}}):null]})}),Af=({listener:e},t)=>{let n=new Set(e?.takenLately);return t.filter(e=>n.has(e.id)&&e.stand===`waiting`).length},jf=e=>`An agent is working on ${String(e)} ${e===1?`comment`:`comments`}`,Mf=({listener:e},t)=>{let n=e?.run;return n?.state===`running`?e?.isListening===!0?`A headless ${n.agent} is listening`:`A headless ${n.agent} is working`:e?.isListening===!0?`An agent is listening`:t>0?jf(t):`No agent is watching this review`},Nf=(e,t)=>({working:Af(e,t),waiting:t.filter(e=>e.stand===`filed`).length}),Pf=100,Ff=({done:e,total:t,className:n})=>(0,q.jsx)(`span`,{"aria-hidden":!0,className:G(`h-0.75 overflow-hidden rounded-full bg-secondary`,n),children:(0,q.jsx)(`span`,{className:`progress-fill`,ref:n=>{n?.style.setProperty(`--fill`,`${String(t===0?0:e*Pf/t)}%`)}})}),If={files:`rail`,diff:`diff`,panel:`panel`},Lf=(e,t)=>e.querySelector(`:scope > [data-review-${If[t]}]`),Rf=e=>e!==null&&Object.hasOwn(If,e),zf=()=>{let e=document.querySelector(`[data-phone-view]`),t=e?.dataset.phoneView??null;if(e===null||!Rf(t))return;let n=Lf(e,t),r=globalThis.matchMedia(`(prefers-reduced-motion: reduce)`).matches;for(let e of n===null?[]:[n,...n.querySelectorAll(`*`)])e.scrollTop>0&&e.scrollTo({top:0,behavior:r?`auto`:`smooth`})},Bf={lead:`diff`,pile:null,threadAt:null,isBackToThreads:!1},Vf=e=>e.isPanelOpen?`panel`:e.focus===`diff`?`diff`:`files`,Hf=e=>e.isPanelOpen?{...e,isPanelOpen:!1}:{...e,focus:`tree`,anchor:null},Uf=e=>({...e,isPanelOpen:!1,focus:`diff`}),Wf=e=>Yo(e.cursor),Gf=(e,t)=>e.layerOpen[t]??(t!==`layer:read`&&e.cursor.startsWith(`${t}:`)),Kf=(e,{key:t,groups:n})=>{let r=n.find(e=>e.key===t)?.ticket??null,i=r===null?null:Go(r),a=Object.fromEntries(Object.entries({...e.layerOpen,[t]:!0}).filter(([e])=>e!==i));return{...e,dialog:null,cursor:t,layerOpen:a}},qf=(e,t)=>{if(t.kind===`layer`)return Gf(e,t.key);let n=Yo(e.cursor);return e.layerOpen[t.key]??t.groups.some(e=>e.index===n)},Jf=(e,t,n)=>({...e,layerOpen:{...e.layerOpen,[t]:n}}),Yf=e=>e.split(`/`).slice(0,-1).map((e,t,n)=>n.slice(0,t+1).join(`/`)),Xf=e=>{let[t=``]=e.order;return{selected:t,cursor:`file:${t}`,collapsed:new Set,isHidingReviewed:!1,isLayered:!1,wantsLayers:!1,layerOpen:{},isPanelOpen:!1,dialog:null,focus:`tree`,row:0,anchor:null,context:3,opened:{},runs:{},isWrapped:!1,settledAt:null,...Bf}},Zf=(e,t)=>e.has(t)?new Set([...e].filter(e=>e!==t)):new Set([...e,t]),Qf=(e,t,n)=>{let r=n.find(e=>e.key===t),i=r===void 0?Gf(e,t):qf(e,r);return Jf({...e,cursor:t},t,!i)},$f=(e,t,n=[])=>t.kind===`file`?{...e,selected:t.path,cursor:t.key,row:0,anchor:null}:e.isLayered?Qf(e,t.key,n):{...e,collapsed:Zf(e.collapsed,t.full),cursor:t.key},ep=(e,{rows:t,offset:n})=>{let r=t.findIndex(t=>t.key===e.cursor),i=t[Math.min(t.length-1,Math.max(0,r+n))];return i===void 0?e:i.kind===`file`?{...e,selected:i.path,cursor:i.key,row:0,anchor:null}:{...e,cursor:i.key}},tp=(e,t)=>e.find(e=>e.kind===`file`&&e.path===t)?.key??`file:${t}`,np=(e,{order:t,offset:n,rows:r})=>{let i=t[t.indexOf(e.selected)+n];return i===void 0?e:{...e,selected:i,cursor:tp(r,i),row:0,anchor:null}},rp=(e,{order:t,offset:n})=>{let r=t.indexOf(e.cursor),i=t[(r===-1?t.findIndex(t=>t.endsWith(`:${e.selected}`)):r)+n];if(i===void 0)return e;let a=Yo(i)??0;return{...e,cursor:i,selected:i.slice(`layer:${String(a)}:`.length),row:0,anchor:null}},ip=(e,t)=>e.isLayered?rp(e,t):np(e,t),ap=(e,{rowsFor:t,layerOf:n})=>{let r={...e,isLayered:!e.isLayered,collapsed:new Set,layerOpen:{}};return r.isLayered?{...r,cursor:`layer:${String(n(e.selected))}:${e.selected}`}:{...r,cursor:tp(t(r),e.selected)}},op=(e,t)=>t.hasLayers?ap(e,t):{...e,wantsLayers:!e.wantsLayers},sp=(e,t)=>{if(e.cursor===`layer:read`||Xo(e.cursor)!==null)return Jf(e,e.cursor,t);let n=Wf(e);if(n===null)return e;let r=`layer:${String(n)}`,i=Jf(e,r,t);return t?i:{...i,cursor:r}},cp=7,lp=e=>e===void 0?`its stacked parent`:/^[\da-f]{40}$/u.test(e)?e.slice(0,cp):e,up=()=>(0,q.jsx)(`span`,{"aria-hidden":!0,className:`h-4 w-px shrink-0 bg-border`}),dp=({count:e,total:t})=>(0,q.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-2 whitespace-nowrap tabular-nums`,children:[(0,q.jsx)(Ff,{className:`w-14`,done:e,total:t}),`${String(e)} of ${String(t)} reviewed`]}),fp=({children:e,block:t,pull:n,onBase:r,onKeys:i,total:a,reviewedCount:o,lead:s})=>(0,q.jsxs)(`div`,{className:`flex h-11 min-w-0 items-center gap-3 bg-wash ps-4 pe-2.5 text-xs text-muted-foreground max-md:hidden`,children:[(0,q.jsx)(`span`,{className:`truncate font-mono text-ui font-medium text-foreground`,children:t.branch}),(0,q.jsxs)(`button`,{className:`inline-flex shrink-0 press items-center gap-1 font-mono whitespace-nowrap text-subtle hover:text-foreground`,onClick:r,title:`Change what this branch is compared against (b)`,type:`button`,children:[`vs ${lp(t.base.label)}`,(0,q.jsx)(qn,{"aria-hidden":!0,className:`size-3`})]}),n===null?null:(0,q.jsx)(`a`,{className:`shrink-0 press font-mono whitespace-nowrap text-subtle hover:text-foreground`,href:n.url,rel:`noopener noreferrer`,target:`_blank`,title:`Open the pull request (p)`,children:`#${String(n.number)}`}),s,(0,q.jsx)(`span`,{className:`ms-auto`}),(0,q.jsx)(dp,{count:o,total:a}),e===void 0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(up,{}),e]}),(0,q.jsx)(up,{}),(0,q.jsx)(Ee,{keys:[`?`],label:`Every key`,side:`left`,children:(0,q.jsx)(`button`,{className:`inline-flex shrink-0 press items-center gap-1.5 whitespace-nowrap text-subtle hover:text-foreground`,onClick:i,type:`button`,children:`Keys`})})]}),pp=e=>e.slice(e.lastIndexOf(`/`)+1),mp=2,hp=e=>{let t=e.split(`/`);return t.length>mp?`…/${t.slice(-2).join(`/`)}`:e},gp=e=>e.slice(0,Math.max(0,e.lastIndexOf(`/`))),_p=`grid size-11 shrink-0 place-items-center rounded-full text-foreground glass press aria-pressed:bg-accent/28`,vp=({onMore:e})=>(0,q.jsx)(`button`,{"aria-label":`More actions`,className:_p,onClick:e,type:`button`,children:(0,q.jsx)(hr,{className:`size-5.5`})}),yp=({className:e,children:t})=>(0,q.jsx)(`button`,{className:`min-w-0 flex-1 text-start ${e}`,onClick:zf,type:`button`,children:t}),bp=({label:e,onBack:t})=>(0,q.jsx)(`button`,{"aria-label":e,className:_p,onClick:t,type:`button`,children:(0,q.jsx)(Yn,{className:`size-5.5`})}),xp=e=>{let t=e.state.isLayered?e.model.groups.find(t=>e.file!==void 0&&t.all.includes(e.file.path)):void 0;return t===void 0||e.file===void 0?`${String(e.position)} of ${String(e.total)}`:`${String(t.all.indexOf(e.file.path)+1)} of ${String(t.all.length)} in layer ${t.address}`},Sp=e=>(0,q.jsxs)(`div`,{className:`grid grid-cols-1 gap-2.5 bg-background px-4 py-3 md:hidden`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(yp,{className:`truncate font-mono text-lg/6 font-semibold`,children:e.block.branch}),(0,q.jsx)(`button`,{"aria-label":e.state.isHidingReviewed?`Show read files`:`Hide read files`,"aria-pressed":e.state.isHidingReviewed,className:_p,onClick:()=>{e.handlePress(`f`)},type:`button`,children:(0,q.jsx)(Fr,{className:`size-5`})}),(0,q.jsx)(vp,{onMore:e.onMore})]}),e.state.isLayered?null:(0,q.jsx)(Ff,{className:`h-1 w-full`,done:e.reviewedCount,total:e.reviewTotal}),(0,q.jsxs)(`div`,{className:`flex min-h-6 items-center justify-between gap-2`,children:[(0,q.jsx)(`span`,{className:`text-ui text-muted-foreground tabular-nums`,children:`${String(e.reviewedCount)} of ${String(e.reviewTotal)} reviewed`}),e.nextUnreviewed===null?null:(0,q.jsxs)(`button`,{className:`-my-2.5 -me-1 inline-flex min-h-11 press items-center gap-0.5 px-1 text-ui font-medium text-claude`,onClick:()=>{e.nextUnreviewed!==null&&e.onOpen(e.nextUnreviewed)},type:`button`,children:[`Next unreviewed`,(0,q.jsx)(Zn,{"aria-hidden":!0,className:`size-4`,strokeWidth:2.25})]})]}),(0,q.jsx)(`span`,{className:e.state.isLayered?`hidden`:void 0,children:(0,q.jsxs)(`button`,{className:`inline-flex h-8 press items-center gap-1.5 rounded-full bg-secondary px-3 font-mono text-xs text-muted-foreground`,onClick:()=>{e.handlePress(`b`)},type:`button`,children:[`vs ${lp(e.block.base.label)}`,(0,q.jsx)(qn,{"aria-hidden":!0,className:`size-3.5`})]})})]}),Cp=e=>{let t=Vf(e.state);if(t===`files`)return(0,q.jsx)(Sp,{...e});let n=e.file===void 0?``:gp(e.file.path);return(0,q.jsxs)(`div`,{className:`flex items-center gap-2.5 bg-background px-3 pt-3 pb-2.5 md:hidden`,children:[(0,q.jsx)(bp,{label:t===`panel`?`Close the review panel`:`Back to the files`,onBack:e.onBack}),t===`diff`&&e.file!==void 0?(0,q.jsxs)(yp,{className:`grid gap-0.5`,children:[(0,q.jsx)(`span`,{className:`truncate font-mono text-base/5 font-semibold`,children:pp(e.file.path)}),(0,q.jsx)(`span`,{className:`truncate font-mono text-xs text-muted-foreground tabular-nums`,children:[n===``?``:hp(n),xp(e)].filter(Boolean).join(` · `)})]}):(0,q.jsx)(yp,{className:`truncate text-lg font-semibold`,children:`Review`}),(0,q.jsx)(vp,{onMore:e.onMore})]})},wp=({listener:e})=>{let t=e?.run;return t==null||t.state===`running`?t?.lines.at(-1)??``:t.state===`stopped`?`Stopped`:`Ended: ${t.lines.at(-1)??``}`},Tp=({lines:e})=>(0,q.jsx)(Tf,{children:(0,q.jsxs)(`ol`,{className:`m-0 grid max-h-48 list-none gap-0.5 overflow-auto border-b border-border bg-wash px-3 py-2 font-mono text-xs/5 text-muted-foreground`,children:[e.length===0?(0,q.jsx)(`li`,{className:`text-subtle`,children:`Nothing yet`}):null,e.map((e,t)=>(0,q.jsx)(`li`,{className:`wrap-break-word`,children:e},`${String(t)}-${e}`))]})}),Ep=({note:e,isFailure:t})=>e===``?null:(0,q.jsx)(Dn,{label:e,children:(0,q.jsx)(`span`,{className:G(`max-w-64 truncate`,t?`text-destructive`:`text-subtle`),children:e})}),Dp=({model:e,threads:t})=>{let{listener:n,isBusy:r,failure:i}=e,[a,o]=(0,K.useState)(!1),s=n?.run??null,c=s?.state===`running`,{working:l,waiting:u}=Nf(e,t),d=n?.isListening===!0||c||l>0;if(n===null)return null;let f=Bl(n);return(0,q.jsxs)(`span`,{className:`flex h-6 min-w-0 items-center gap-2`,children:[d||f===null?null:(0,q.jsxs)(st,{disabled:r||n.worktree===null,onClick:()=>void e.handleStart(f.id),size:`xs`,title:`${Mf(e,l)}${u>0?` · ${String(u)} waiting`:``}. Start a headless ${f.label} to answer it.`,variant:`outline`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`me-0.5 size-1.5 rounded-full bg-subtle`}),`Start agent`]}),d?(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 whitespace-nowrap`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full bg-success`}),(0,q.jsx)(`span`,{className:`truncate text-foreground`,children:Mf(e,l)})]}):null,d||s!==null||i!==null?(0,q.jsx)(Ep,{isFailure:i!==null,note:i??wp(e)}):null,s===null?null:(0,q.jsx)(`span`,{className:`shrink-0`,children:(0,q.jsx)(Cf,{size:`sm`,children:`Log`})}),c?(0,q.jsx)(st,{disabled:r,onClick:()=>void e.handleStop(),size:`xs`,variant:`ghost`,children:`Stop`}):null,(0,q.jsx)(Vl,{isHeard:d,model:e,onSettings:()=>{o(!0)}}),(0,q.jsx)(kf,{isOpen:a,model:e,onOpenChange:o})]})},Op=({model:e,phone:t,...n})=>(0,q.jsxs)(Sf,{children:[(0,q.jsx)(Cp,{...t}),(0,q.jsx)(fp,{...n,children:(0,q.jsx)(Dp,{model:e,threads:n.block.threads})}),(0,q.jsx)(Tp,{lines:e.listener?.run?.lines??[]})]}),kp=e=>e.key??e.id,Ap=(e,t)=>t.end===null?-1:e.findIndex(e=>(t.side===`new`?e.new:e.old)===t.end),jp=(e,t)=>t.seenAt!==void 0||e.seen.includes(t.id),Mp=(e,{comments:t,path:n})=>{let r=t.filter(e=>e.parent===null&&e.path===n),i=new Map,a=[];return r.forEach(n=>{let r=t.filter(e=>e.parent===n.id),o=Ap(e,n);o===-1?a.push({root:n,replies:r,isOutdated:!0}):i.set(o,[...i.get(o)??[],{root:n,replies:r,isOutdated:n.isOutdated===!0}])}),{byRow:i,loose:a}},Np=e=>{let t=new Map,n=new Map;return e.forEach((e,r)=>{let i=e.filter(e=>e.root.resolved!==!0),a=e.filter(e=>e.root.resolved===!0);i.length>0&&t.set(r,i),a.length>0&&n.set(r,a)}),{open:t,settled:n}},Pp=e=>e.new===null?e.old===null?null:{side:`old`,line:e.old}:{side:`new`,line:e.new},Fp=(e,t)=>{let n=Pp(e);return n!==null&&n.side===t.side&&n.line===t.line},Ip=e=>`${e.side}:${String(e.line)}`,Lp=(e,[t,n],r=!1)=>{let i=e.slice(Math.min(t,n),Math.max(t,n)+1).filter(e=>e.op!==`gap`&&(!r||e.new!==null)),a=i.map(e=>Pp(e)).find(e=>e!==null),o=i.map(e=>Pp(e)).findLast(e=>e!==null);return a===void 0||o===void 0?null:{from:a,to:o,code:i.map(e=>e.code).join(`
6
+ `)}},Rp=({from:e,to:t})=>({side:t.side,start:e.side===t.side?e.line:t.line,end:t.line}),zp=e=>{let t=(0,K.useRef)(e);return(0,K.useLayoutEffect)(()=>{t.current=e}),t},Bp=(e,{wanted:t,first:n,step:r})=>{let[i,a]=(0,K.useState)(n),o=Math.min(e,Math.max(i,t));return(0,K.useEffect)(()=>{if(o>=e)return;let t=setTimeout(()=>{(0,K.startTransition)(()=>{a(o+r)})},0);return()=>{clearTimeout(t)}},[o,e,r]),o},Vp=20,Hp=(0,K.createContext)(null),Up=e=>`${String(e)} ${e===1?`line`:`lines`}`,Wp=({label:e,range:t,index:n,fold:r,children:i})=>{let a=(0,K.useContext)(Hp);return(0,q.jsx)(Dn,{label:e,children:(0,q.jsx)(`button`,{"aria-label":e,className:`inline-flex h-5 items-center gap-1 rounded-sm px-1 text-subtle hover:bg-muted hover:text-foreground focus-visible:text-foreground`,onClick:()=>{a?.({range:t,index:n,isWhole:t[1]-t[0]+1>=r.count})},type:`button`,children:i})})},Gp=({fold:e,index:t})=>{let n={index:t,fold:e},r=[e.first,Math.min(e.last,e.first+Vp-1)],i=[Math.max(e.first,e.last-Vp+1),e.last];return e.count<=Vp?(0,q.jsx)(Wp,{...n,label:`Show lines ${String(e.first)}–${String(e.last)}`,range:[e.first,e.last],children:`⋯ Show ${Up(e.count)}`}):(0,q.jsxs)(q.Fragment,{children:[e.isTop?null:(0,q.jsx)(Wp,{...n,label:`Show lines ${String(r[0])}–${String(r[1])}`,range:r,children:(0,q.jsx)(qn,{className:`size-3.5`})}),e.isBottom?null:(0,q.jsx)(Wp,{...n,label:`Show lines ${String(i[0])}–${String(i[1])}`,range:i,children:(0,q.jsx)($n,{className:`size-3.5`})}),(0,q.jsx)(Wp,{...n,label:`Show lines ${String(e.first)}–${String(e.last)}`,range:[e.first,e.last],children:`⋯ Show all ${Up(e.count)}`})]})},Kp=({fold:e,index:t,isCursor:n})=>{let r=(0,K.useContext)(Hp);return(0,q.jsx)(`div`,{className:G(`flex items-center gap-1 px-3 py-0.5 text-subtle`,n&&`review-cursor`),"data-fold-row":t,children:r===null?`⋯ ${Up(e.count)} hidden`:(0,q.jsx)(Gp,{fold:e,index:t})})},qp=(0,K.createContext)(null),Jp=([e,t])=>e===t?String(e):`${String(e)}–${String(t)}`,Yp=({row:e,index:t,isCursor:n})=>{let r=(0,K.useContext)(qp),{range:i,count:a,isOpen:o}=e.others,s=o?`Hide lines`:`Show lines`,c=o?qn:Zn;return(0,q.jsxs)(`button`,{"aria-expanded":o,"aria-label":`${s}: ${e.code}`,className:G(`group/run diff-row w-full items-center py-1 text-start text-subtle diff-fold-row hover:bg-row-hover`,n&&`review-cursor`),"data-run-row":t,disabled:r===null,onClick:()=>{r?.({range:i,index:t,count:a,isOpen:o})},type:`button`,children:[(0,q.jsx)(`span`,{className:`col-span-2 col-start-2 justify-self-end diff-fold-range text-end whitespace-nowrap tabular-nums`,children:Jp(i)}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`col-start-4 grid size-4.5 place-items-center place-self-center rounded-sm group-hover/run:bg-secondary group-hover/run:text-foreground`,children:(0,q.jsx)(c,{className:G(`size-3`,!o&&`opacity-0 group-hover/run:opacity-100`)})}),(0,q.jsxs)(`span`,{className:`col-start-5 flex items-center gap-3 pe-4 font-sans text-xs`,children:[e.code,(0,q.jsx)(`span`,{"aria-hidden":!0,className:`h-px min-w-8 flex-1 bg-border`}),(0,q.jsxs)(`span`,{className:`sticky inset-e-4 key-hint items-center gap-1.5 text-muted-foreground`,children:[s,(0,q.jsx)(V,{children:o?`h`:`l`})]})]})]})},Xp=K.createContext(void 0);function Zp(e){let t=K.useContext(Xp);if(t===void 0&&!e)throw Error(Wt(47));return t}var Qp={...xt,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},$p=class extends ve{constructor(e,t,n){let r=new qe;super(em(e,r,t,n),tm(r),Qp)}setOpen=(e,t)=>{let n=t.reason===fn,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=kt(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=at(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Tl.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function em(e,t,n,r=!1){let i={...Qt(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function tm(e){return{popupRef:K.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:K.createRef(),beforeContentFocusGuardRef:K.createRef(),stickIfOpenTimeout:new M,triggerElements:e}}var nm=Ne(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=im(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),ht(u,d),ft(u);let{forceUnmount:m}=Gt(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),K.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),K.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,zt(rt))}),[m,u]);let h=d||f;return(0,q.jsxs)(Xp.Provider,{value:u,children:[s&&(0,q.jsx)(nn,{handle:s,store:u}),h&&(0,q.jsx)(am,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function rm(e){return Zp(!0)?(0,q.jsx)(nm,{props:e}):(0,q.jsx)(y,{children:(0,q.jsx)(nm,{props:e})})}function im(e,t){let n=_t((e,n)=>new $p(t,e,n));return K.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function am({store:e,modal:t}){let n=e.useState(`floatingRootContext`),r=p(n,{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),i=r.reference,a=r.floating;return Nt(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:a}),null}var om=K.createContext(void 0);function sm(){let e=K.useContext(om);if(e===void 0)throw Error(Wt(45));return e}var cm=K.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Zp().useState(`mounted`)||n?(0,q.jsx)(om.Provider,{value:n,children:(0,q.jsx)(Ct,{ref:t,...r})}):null}),lm=K.createContext(void 0);function um(){let e=K.useContext(lm);if(!e)throw Error(Wt(46));return e}var dm=K.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:_=S,...v}=e,y=Zp(),b=sm(),x=g(),w=y.useState(`floatingRootContext`),T=y.useState(`mounted`),E=y.useState(`open`),D=y.useState(`openChangeReason`),O=y.useState(`activeTriggerElement`),k=y.useState(`modal`),A=y.useState(`openMethod`),ee=y.useState(`positionerElement`),M=y.useState(`instantType`),N=y.useState(`transitionStatus`),F=y.useState(`adaptiveOrigin`),te=K.useRef(null),I=En(ee),ne=j({anchor:a,floatingRootContext:w,positionMethod:o,mounted:T,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:b,nodeId:x,collisionAvoidance:_,adaptiveOrigin:F}),L=w.useState(`domReferenceElement`);W(()=>{let e=L,t=te.current;if(e&&(te.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return I(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,I,y]);let re=k===!0&&D!==`trigger-hover`;sl(E&&re,A===`touch`,ee,O);let ie=y.useStateSetter(`positionerElement`),ae={open:E,side:ne.side,align:ne.align,anchorHidden:ne.anchorHidden,instant:M},oe=P(e,ae,{styles:ne.positionerStyles,transitionStatus:N,props:v,refs:[t,ie],hidden:!T,inert:!E});return(0,q.jsxs)(lm.Provider,{value:ne,children:[T&&re&&(0,q.jsx)(ps,{inert:C(!E),cutout:O}),(0,q.jsx)(Se,{id:x,children:oe})]})}),fm=K.createContext(void 0);function pm(){let[e,t]=K.useState(0),n=U(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:K.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var mm=K.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=Zp(),l=um(),u=Jc(!0)!=null,{context:d,hasClosePart:f}=pm(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);mn({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),ct(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?un(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let ee=c.useStateSetter(`popupElement`),j={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},M=Zt(`div`,e,{state:j,ref:[t,c.context.popupRef,ee],props:[_,{id:T,role:`dialog`,...Vt,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&cs.has(e.key)&&e.stopPropagation()}},Kt(g),s],stateAttributesMapping:gn});return(0,q.jsx)(Xi,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:_e(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,q.jsx)(fm.Provider,{value:d,children:M})})}),hm=K.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Zp(),s=Re(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),Zt(`h2`,e,{ref:t,props:[{id:s},a]})});function gm({...e}){return(0,q.jsx)(rm,{"data-slot":`popover`,...e})}function _m({className:e,...t}){return(0,q.jsx)(hm,{className:G(`m-0 truncate text-sm font-medium`,e),"data-slot":`popover-title`,...t})}function vm({className:e,side:t=`bottom`,sideOffset:n=4,align:r=`start`,anchor:i,children:a,...o}){return(0,q.jsx)(cm,{children:(0,q.jsx)(dm,{align:r,anchor:i,className:`isolate z-50 data-anchor-hidden:invisible`,side:t,sideOffset:n,children:(0,q.jsx)(mm,{className:G(`pop-menu rounded-lg border border-border bg-popover text-sm text-popover-foreground shadow-md outline-none`,e),"data-slot":`popover-content`,...o,children:a})})})}var ym=`(max-width: 767px)`,bm=()=>`matchMedia`in globalThis&&globalThis.matchMedia(ym).matches,xm=e=>{let t=globalThis.matchMedia(ym);return t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}},Sm=()=>(0,K.useSyncExternalStore)(xm,bm,()=>!1),Cm=({isOpen:e,children:t})=>(0,q.jsx)(Sf,{open:e,children:(0,q.jsx)(Tf,{variant:`room`,children:(0,q.jsx)(`div`,{className:`room-content`,children:t})})}),wm=({isNew:e,onEntered:t,children:n})=>(0,q.jsx)(`div`,{className:`room-enter`,"data-new":e,onAnimationEnd:e=>{e.target===e.currentTarget.firstElementChild?.firstElementChild&&t()},children:(0,q.jsx)(`div`,{children:(0,q.jsx)(`div`,{children:n})})}),Tm={previous:{key:`ArrowLeft`,keys:[`←`]},next:{key:`ArrowRight`,keys:[`→`]},nextOpen:{key:`n`,keys:[`N`]},copyLink:{key:`l`,keys:[`L`]},submit:{key:`Enter`,isMod:!0,keys:[`⌘`,`↵`]},send:{key:`Enter`,keys:[`↵`]},close:{key:`Escape`,keys:[`Esc`]},search:{key:`/`,keys:[`/`]}},Em=new Set([`INPUT`,`TEXTAREA`,`SELECT`]),Dm=e=>e instanceof HTMLElement&&(e.isContentEditable||Em.has(e.tagName)),Om=()=>document.querySelector(`[data-gallery], [role="menu"]`)!==null,km=`review-draft|`,Am=new Map,jm=e=>{let t=Am.get(e);if(t!==void 0)return t;try{return sessionStorage.getItem(km+e)??``}catch{return``}},Mm=(e,t)=>{Am.set(e,t);try{t===``?sessionStorage.removeItem(km+e):sessionStorage.setItem(km+e,t)}catch{}},Nm=(e,t)=>{let[n,r]=(0,K.useState)(()=>t===void 0?``:jm(t)),i=e=>{r(e),t!==void 0&&Mm(t,e)},[a,o]=(0,K.useState)(!1),s=n.trim(),c=s!==``&&!a;return{text:n,setText:i,canSend:c,submit:async()=>{c&&(o(!0),await e(s),o(!1),i(``))},paste:Pd}},Pm=176,Fm=e=>{e.style.height=`auto`,e.style.height=`${String(Math.min(e.scrollHeight,Pm))}px`},Im=e=>{e.focus(),e.setSelectionRange(e.value.length,e.value.length)},Lm={card:{form:`grid cursor-text gap-2 rounded-xl border border-border bg-composer px-3 pt-2.5 pb-2 transition-colors duration-150 ease-out focus-within:border-muted-foreground hover:border-subtle`,text:`max-h-44 min-h-6 resize-none overflow-y-auto bg-transparent text-sm/6 text-foreground outline-none placeholder:text-subtle`},phone:{form:`flex cursor-text flex-wrap items-end gap-1`,text:`max-h-44 min-h-6 min-w-0 flex-1 resize-none overflow-y-auto bg-transparent pb-2.5 text-base text-foreground outline-none placeholder:text-subtle`}},Rm=({isDisabled:e,label:t})=>(0,q.jsx)(`button`,{"aria-label":t,className:`grid size-11 shrink-0 press place-items-center disabled:opacity-40`,disabled:e,type:`submit`,children:(0,q.jsx)(`span`,{className:`grid size-8.5 place-items-center rounded-full bg-accent text-accent-foreground`,children:(0,q.jsx)(Vn,{"aria-hidden":!0,className:`size-4.5`,strokeWidth:2.5})})}),zm=new WeakSet,Bm=(e,t)=>n=>{e.current=n,n!==null&&(Fm(n),t&&!zm.has(n)&&(zm.add(n),Im(n)))},Vm=e=>(e.ctrlKey||e.metaKey)&&e.key===`s`||e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing,Hm=({submit:e,cancel:t})=>n=>{Vm(n)&&(n.preventDefault(),e()),n.key===`Escape`&&t?.()},Um=({placeholder:e,submitLabel:t,isFocused:n=!1,onSubmit:r,onCancel:i,draftKey:a,look:o=`card`})=>{let{text:c,setText:l,canSend:u,submit:d,paste:f}=Nm(r,a),p=o===`phone`,m=(0,K.useRef)(null),h=(0,K.useRef)(null);return(0,q.jsxs)(`form`,{className:Lm[o].form,onPointerDown:e=>{(e.target===e.currentTarget||e.target===h.current)&&m.current!==null&&(e.preventDefault(),Im(m.current))},onSubmit:e=>{e.preventDefault(),d()},children:[(0,q.jsx)(`textarea`,{"aria-label":e,className:Lm[o].text,onChange:e=>{l(e.target.value),Fm(e.target)},onKeyDown:Hm({submit:d,cancel:i}),onPaste:f,placeholder:e,ref:Bm(m,n),rows:1,value:c}),p?(0,q.jsx)(Rm,{isDisabled:!u,label:t}):null,(0,q.jsxs)(`div`,{className:p?`hidden`:`flex items-center justify-end gap-2`,ref:h,children:[i===void 0?null:(0,q.jsx)(s,{label:`Cancel`,onClick:i,shortcut:Tm.close,size:`icon-sm`,type:`button`,children:(0,q.jsx)(Di,{})}),(0,q.jsx)(s,{disabled:!u,label:t,shortcut:Tm.send,size:`icon-sm`,type:`submit`,children:(0,q.jsx)(pr,{})})]})]})},Wm={gone:`Removed`,settled:`Settled`,filed:`Not picked up`,waiting:`Picked up`,answered:`Answered`,asked:`Waiting on you`},Gm={gone:`text-subtle`,settled:`font-normal text-subtle`,filed:`text-muted-foreground`,waiting:`text-muted-foreground`,answered:`text-stand-answered`,asked:`text-stand-asked`},Km=(e,t)=>e.stand===void 0?e.resolved===!0?`settled`:t.some(e=>e.author===`claude`)?`answered`:e.seenAt===void 0?`filed`:`waiting`:e.stand,qm=({stand:e})=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(sd,{stand:e}),(0,q.jsx)(`span`,{className:G(`font-medium`,Gm[e]),children:Wm[e]})]}),Jm=({stand:e,isOutdated:t,children:n})=>(0,q.jsxs)(`div`,{className:`flex h-8 items-center gap-1.5 border-b border-border px-3 text-xs`,children:[(0,q.jsx)(qm,{stand:e}),t?(0,q.jsx)(`span`,{className:`rounded-sm bg-secondary px-1.5 text-2xs text-muted-foreground`,children:`Code changed`}):null,(0,q.jsx)(`span`,{className:`flex-1`}),n]}),Ym=()=>(0,q.jsx)(`span`,{className:G(`inline-grid shrink-0`,rd.settled),children:(0,q.jsx)(od,{stand:`settled`})}),Xm=({here:e})=>e==null?null:(0,q.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-subtle tabular-nums hover:text-foreground`,onClick:e.handleOpen,type:`button`,children:[(0,q.jsx)(Ym,{}),`${String(e.count)} settled here`]}),Zm=/\s*\(recommended\)\s*$/iu,Qm=40,$m=4,eh=4,th=({root:e,replies:t})=>{let n=t.at(-1);return Km(e,t)===`asked`&&n?.author===`claude`?n.choices??[]:[]},nh=e=>e.map(e=>({label:e.replace(Zm,``),isRecommended:Zm.test(e)})),rh=e=>e.length<=eh&&e.every(t=>!t.isRecommended&&t.label.length<=Math.floor(Qm/e.length)-$m),ih=(e,t)=>!e.defaultPrevented&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!Dm(e.target)&&!Om()&&document.querySelector(`[role="dialog"]`)===null&&(document.activeElement?.closest(`[data-owns-keys]`)??null)!==null&&/^[1-9]$/u.test(e.key)?t[Number(e.key)-1]:void 0,ah=({answer:e,index:t,isLarge:n,isSegment:r,onPick:i})=>(0,q.jsxs)(`button`,{className:G(`group flex min-w-0 items-start gap-2 text-start outline-none hover:bg-secondary/50 focus-visible:bg-secondary/50`,n?`min-h-11 px-3 py-2.5 text-base`:`px-2 py-1.5 text-sm`,r?`flex-1 border-s border-border first:border-s-0`:`border-t border-border first:border-t-0`),onClick:()=>{i(e.label)},type:`button`,children:[n?null:(0,q.jsx)(V,{children:t+1}),(0,q.jsxs)(`span`,{className:`grid min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`wrap-anywhere`,children:e.label}),e.isRecommended?(0,q.jsx)(`span`,{className:G(`text-success`,n?`text-sm`:`text-xs`),children:`Recommended`}):null]}),n||r?null:(0,q.jsx)(pr,{"aria-hidden":!0,className:`mt-0.75 size-3.5 shrink-0 text-transparent transition-colors duration-150 group-hover:text-muted-foreground group-focus-visible:text-muted-foreground`})]}),oh=({choices:e,isKeyed:t,isLarge:n,onPick:r})=>{let i=nh(e),a=!n&&rh(i);return dn(`keydown`,e=>{let n=t?ih(e,i):void 0;n!==void 0&&(e.preventDefault(),r(n.label))}),(0,q.jsx)(`fieldset`,{"aria-label":`Answers`,className:G(`min-w-0 overflow-hidden border border-border bg-background`,n?`rounded-xl`:`ms-5.5 rounded-md`,a?`flex`:`grid`),children:i.map((e,t)=>(0,q.jsx)(ah,{answer:e,index:t,isLarge:n,isSegment:a,onPick:r},e.label))})},sh=({props:e,isLarge:t=!1})=>{let n=th(e.thread);return n.length===0?null:(0,q.jsx)(oh,{choices:n,isKeyed:!t&&e.isCurrent===!0,isLarge:t,onPick:t=>{e.actions.handleReply(e.thread.root,t)}})},ch={placeholder:`Reply`,submitLabel:`Reply`},lh=({props:e})=>{let t=e.thread.root.resolved===!0;return(0,q.jsxs)(`button`,{className:G(`inline-flex h-8 shrink-0 press items-center gap-1.5 rounded-lg border px-2.5 text-sm font-medium`,e.isCurrent===!0&&!t?`border-accent bg-accent text-accent-foreground`:`border-border hover:bg-row-hover`),onClick:()=>{e.actions.handleResolve(e.thread.root,!t)},type:`button`,children:[t?(0,q.jsx)($r,{className:`size-3.5`}):(0,q.jsx)(Gn,{className:`size-3.5`}),t?`Reopen`:`Settle`]})},uh=(e,t)=>t?`Or write your own…`:e?`Reply…`:`Add to this…`,dh=({props:e,canSettle:t})=>{let[n,r]=(0,K.useState)(!1),i=th(e.thread).length>0,{root:a}=e.thread;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(sh,{props:e}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Cm,{isOpen:n,children:(0,q.jsx)(Um,{draftKey:`reply:${a.id}`,isFocused:!0,onCancel:()=>{r(!1)},onSubmit:async t=>{await e.actions.handleReply(a,t),r(!1)},...ch})}),(0,q.jsx)(Cm,{isOpen:!n,children:(0,q.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,q.jsx)(`button`,{className:`h-8 flex-1 rounded-lg border hover-border border-border bg-background px-2.5 text-start text-sm hover-text text-subtle`,"data-reply-open":!0,onClick:()=>{r(!0)},type:`button`,children:uh(t,i)}),t?(0,q.jsx)(lh,{props:e}):null]})})]})]})};function fh(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var ph=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mh=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hh={};function gh(e,t){return((t||hh).jsx?mh:ph).test(e)}var _h=/[ \t\n\f\r]/g;function vh(e){return typeof e==`object`?e.type===`text`&&yh(e.value):yh(e)}function yh(e){return e.replace(_h,``)===``}var bh=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};bh.prototype.normal={},bh.prototype.property={},bh.prototype.space=void 0;function xh(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new bh(n,r,t)}function Sh(e){return e.toLowerCase()}var Ch=class{constructor(e,t){this.attribute=t,this.property=e}};Ch.prototype.attribute=``,Ch.prototype.booleanish=!1,Ch.prototype.boolean=!1,Ch.prototype.commaOrSpaceSeparated=!1,Ch.prototype.commaSeparated=!1,Ch.prototype.defined=!1,Ch.prototype.mustUseProperty=!1,Ch.prototype.number=!1,Ch.prototype.overloadedBoolean=!1,Ch.prototype.property=``,Ch.prototype.spaceSeparated=!1,Ch.prototype.space=void 0;var wh=Mn({boolean:()=>J,booleanish:()=>Eh,commaOrSpaceSeparated:()=>kh,commaSeparated:()=>Oh,number:()=>Y,overloadedBoolean:()=>Dh,spaceSeparated:()=>X}),Th=0,J=Ah(),Eh=Ah(),Dh=Ah(),Y=Ah(),X=Ah(),Oh=Ah(),kh=Ah();function Ah(){return 2**++Th}var jh=Object.keys(wh),Mh=class extends Ch{constructor(e,t,n,r){let i=-1;if(super(e,t),Nh(this,`space`,r),typeof n==`number`)for(;++i<jh.length;){let e=jh[i];Nh(this,jh[i],(n&wh[e])===wh[e])}}};Mh.prototype.defined=!0;function Nh(e,t,n){n&&(e[t]=n)}function Ph(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Mh(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Sh(r)]=r,n[Sh(a.attribute)]=r}return new bh(t,n,e.space)}var Fh=Ph({properties:{ariaActiveDescendant:null,ariaAtomic:Eh,ariaAutoComplete:null,ariaBusy:Eh,ariaChecked:Eh,ariaColCount:Y,ariaColIndex:Y,ariaColSpan:Y,ariaControls:X,ariaCurrent:null,ariaDescribedBy:X,ariaDetails:null,ariaDisabled:Eh,ariaDropEffect:X,ariaErrorMessage:null,ariaExpanded:Eh,ariaFlowTo:X,ariaGrabbed:Eh,ariaHasPopup:null,ariaHidden:Eh,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:X,ariaLevel:Y,ariaLive:null,ariaModal:Eh,ariaMultiLine:Eh,ariaMultiSelectable:Eh,ariaOrientation:null,ariaOwns:X,ariaPlaceholder:null,ariaPosInSet:Y,ariaPressed:Eh,ariaReadOnly:Eh,ariaRelevant:null,ariaRequired:Eh,ariaRoleDescription:X,ariaRowCount:Y,ariaRowIndex:Y,ariaRowSpan:Y,ariaSelected:Eh,ariaSetSize:Y,ariaSort:null,ariaValueMax:Y,ariaValueMin:Y,ariaValueNow:Y,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Ih(e,t){return t in e?e[t]:t}function Lh(e,t){return Ih(e,t.toLowerCase())}var Rh=Ph({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Oh,acceptCharset:X,accessKey:X,action:null,allow:null,allowFullScreen:J,allowPaymentRequest:J,allowUserMedia:J,alpha:J,alt:null,as:null,async:J,autoCapitalize:null,autoComplete:X,autoFocus:J,autoPlay:J,blocking:X,capture:null,charSet:null,checked:J,cite:null,className:X,closedBy:null,colorSpace:null,cols:Y,colSpan:Y,command:null,commandFor:null,content:null,contentEditable:Eh,controls:J,controlsList:X,coords:Y|Oh,crossOrigin:null,data:null,dateTime:null,decoding:null,default:J,defer:J,dir:null,dirName:null,disabled:J,download:Dh,draggable:Eh,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:J,formTarget:null,headers:X,height:Y,hidden:Dh,high:Y,href:null,hrefLang:null,htmlFor:X,httpEquiv:X,id:null,imageSizes:null,imageSrcSet:null,inert:J,inputMode:null,integrity:null,is:null,isMap:J,itemId:null,itemProp:X,itemRef:X,itemScope:J,itemType:X,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:J,low:Y,manifest:null,max:null,maxLength:Y,media:null,method:null,min:null,minLength:Y,multiple:J,muted:J,name:null,nonce:null,noModule:J,noValidate:J,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:J,optimum:Y,pattern:null,ping:X,placeholder:null,playsInline:J,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:J,referrerPolicy:null,rel:X,required:J,reversed:J,rows:Y,rowSpan:Y,sandbox:X,scope:null,scoped:J,seamless:J,selected:J,shadowRootClonable:J,shadowRootCustomElementRegistry:J,shadowRootDelegatesFocus:J,shadowRootMode:null,shadowRootSerializable:J,shape:null,size:Y,sizes:null,slot:null,span:Y,spellCheck:Eh,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Y,step:null,style:null,tabIndex:Y,target:null,title:null,translate:null,type:null,typeMustMatch:J,useMap:null,value:Eh,width:Y,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:X,axis:null,background:null,bgColor:null,border:Y,borderColor:null,bottomMargin:Y,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:J,declare:J,event:null,face:null,frame:null,frameBorder:null,hSpace:Y,leftMargin:Y,link:null,longDesc:null,lowSrc:null,marginHeight:Y,marginWidth:Y,noResize:J,noHref:J,noShade:J,noWrap:J,object:null,profile:null,prompt:null,rev:null,rightMargin:Y,rules:null,scheme:null,scrolling:Eh,standby:null,summary:null,text:null,topMargin:Y,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Y,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:J,disablePictureInPicture:J,disableRemotePlayback:J,exportParts:Oh,part:X,prefix:null,property:null,results:Y,security:null,unselectable:null},space:`html`,transform:Lh}),zh=Ph({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:kh,accentHeight:Y,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Y,amplitude:Y,arabicForm:null,ascent:Y,attributeName:null,attributeType:null,azimuth:Y,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Y,by:null,calcMode:null,capHeight:Y,className:X,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Y,diffuseConstant:Y,direction:null,display:null,dur:null,divisor:Y,dominantBaseline:null,download:J,dx:null,dy:null,edgeMode:null,editable:null,elevation:Y,enableBackground:null,end:null,event:null,exponent:Y,externalResourcesRequired:null,fill:null,fillOpacity:Y,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Oh,g2:Oh,glyphName:Oh,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Y,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Y,horizOriginX:Y,horizOriginY:Y,id:null,ideographic:Y,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Y,k:Y,k1:Y,k2:Y,k3:Y,k4:Y,kernelMatrix:kh,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Y,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Y,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Y,overlineThickness:Y,paintOrder:null,panose1:null,path:null,pathLength:Y,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:X,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Y,pointsAtY:Y,pointsAtZ:Y,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kh,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kh,rev:kh,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kh,requiredFeatures:kh,requiredFonts:kh,requiredFormats:kh,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Y,specularExponent:Y,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Y,strikethroughThickness:Y,string:null,stroke:null,strokeDashArray:kh,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Y,strokeOpacity:Y,strokeWidth:null,style:null,surfaceScale:Y,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kh,tabIndex:Y,tableValues:null,target:null,targetX:Y,targetY:Y,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kh,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Y,underlineThickness:Y,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Y,values:null,vAlphabetic:Y,vMathematical:Y,vectorEffect:null,vHanging:Y,vIdeographic:Y,version:null,vertAdvY:Y,vertOriginX:Y,vertOriginY:Y,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Y,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Ih}),Bh=Ph({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Vh=Ph({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Lh}),Hh=Ph({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Uh={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Wh=/[A-Z]/g,Gh=/-[a-z]/g,Kh=/^data[-\w.:]+$/i;function qh(e,t){let n=Sh(t),r=t,i=Ch;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Kh.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Gh,Yh);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Gh.test(e)){let n=e.replace(Wh,Jh);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Mh}return new i(r,t)}function Jh(e){return`-`+e.toLowerCase()}function Yh(e){return e.charAt(1).toUpperCase()}var Xh=xh([Fh,Rh,Bh,Vh,Hh],`html`),Zh=xh([Fh,zh,Bh,Vh,Hh],`svg`);function Qh(e){return e.join(` `).trim()}var $h=/\/\*(?:[^*]|\*(?!\/))*\*\//g,eg=/\n/g,tg=/^\s*/,ng=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,rg=/^:\s*/,ig=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,ag=/^[;\s]*/,og=`
7
+ `,sg=`/`,cg=`*`,lg=``,ug=`comment`,dg=`declaration`;function fg(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var n=1,r=1;function i(e){var t=e.match(eg);t&&(n+=t.length);var i=e.lastIndexOf(og);r=~i?e.length-i:r+e.length}function a(){var e={line:n,column:r};return function(t){return t.position=new o(e),l(),t}}function o(e){this.start=e,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(i){var a=Error(t.source+`:`+n+`:`+r+`: `+i);if(a.reason=i,a.filename=t.source,a.line=n,a.column=r,a.source=e,!t.silent)throw a}function c(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function l(){c(tg)}function u(e){for(var t;t=d();)e.push(t);return e}function d(){var t=a();if(sg==e.charAt(0)&&cg==e.charAt(1)){for(var n=2;lg!=e.charAt(n)&&(cg!=e.charAt(n)||sg!=e.charAt(n+1));)++n;if(n+=2,lg===e.charAt(n-1))return s(`End of comment missing`);var o=e.slice(2,n-2);return r+=2,i(o),e=e.slice(n),r+=2,t({type:ug,comment:o})}}function f(){var e=a(),t=c(ng);if(t){if(d(),!c(rg))return s(`property missing ':'`);var n=c(ig),r=e({type:dg,property:t[0].replace($h,lg).trim(),value:n?n[0].replace($h,lg).trim():lg});return c(ag),r}}function p(){var e=[];u(e);for(var t;t=f();)e.push(t),u(e);return e}return l(),p()}function pg(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=fg(e),i=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:a}=e;i?t(r,a,e):a&&(n??={},n[r]=a)}),n}var mg=gg(`end`),hg=gg(`start`);function gg(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function _g(e){let t=hg(e),n=mg(e);if(t&&n)return{start:t,end:n}}function vg(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?bg(e.position):`start`in e||`end`in e?bg(e):`line`in e||`column`in e?yg(e):``}function yg(e){return xg(e&&e.line)+`:`+xg(e&&e.column)}function bg(e){return yg(e&&e.start)+`-`+yg(e&&e.end)}function xg(e){return e&&typeof e==`number`?e:1}var Sg=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=vg(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Object.defineProperties(Sg.prototype,{file:{configurable:!0,enumerable:!0,value:``,writable:!0},name:{configurable:!0,enumerable:!0,value:``,writable:!0},reason:{configurable:!0,enumerable:!0,value:``,writable:!0},message:{configurable:!0,enumerable:!0,value:``,writable:!0},stack:{configurable:!0,enumerable:!0,value:``,writable:!0},column:{configurable:!0,enumerable:!0,writable:!0},line:{configurable:!0,enumerable:!0,writable:!0},ancestors:{configurable:!0,enumerable:!0,writable:!0},cause:{configurable:!0,enumerable:!0,writable:!0},fatal:{configurable:!0,enumerable:!0,writable:!0},place:{configurable:!0,enumerable:!0,writable:!0},ruleId:{configurable:!0,enumerable:!0,writable:!0},source:{configurable:!0,enumerable:!0,writable:!0}});var Cg={}.hasOwnProperty,wg=new Map,Tg=/[A-Z]/g,Eg=/-([a-z])/g,Dg=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Og=new Set([`td`,`th`]),kg=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Ag(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Vg(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Bg(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Zh:Xh,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=jg(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function jg(e,t,n){if(t.type===`element`)return Mg(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Ng(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Fg(e,t,n);if(t.type===`mdxjsEsm`)return Pg(e,t);if(t.type===`root`)return Ig(e,t,n);if(t.type===`text`)return Lg(e,t)}function Mg(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Zh,e.schema=i),e.ancestors.push(t);let a=qg(e,t.tagName,!1),o=Hg(e,t),s=Wg(e,t);return Dg.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!vh(e)})),Rg(e,o,a,t),zg(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ng(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Jg(e,t.position)}function Pg(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Jg(e,t.position)}function Fg(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Zh,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:qg(e,t.name,!0),o=Ug(e,t),s=Wg(e,t);return Rg(e,o,a,t),zg(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ig(e,t,n){let r={};return zg(r,Wg(e,t)),e.create(t,e.Fragment,r,n)}function Lg(e,t){return t.value}function Rg(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function zg(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Bg(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Vg(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=hg(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Hg(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Cg.call(t.properties,i)){let a=Gg(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Og.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Ug(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Jg(e,t.position)}else{let{name:i}=r,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Jg(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Wg(e,t){let n=[],r=-1,i=e.passKeys?new Map:wg;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=jg(e,a,o);s!==void 0&&n.push(s)}return n}function Gg(e,t,n){if(n==null||typeof n==`number`&&Number.isNaN(n))return;let r=qh(e.schema,t);return Array.isArray(n)&&(n=r.commaSeparated?fh(n):Qh(n)),r.property===`style`?[`style`,typeof n==`object`?e.stylePropertyNameCase===`dom`?n:Yg(n):Kg(e,String(n))]:[e.elementAttributeNameCase===`react`&&r.space?Uh[r.property]||r.property:r.attribute,n]}function Kg(e,t){let n={};try{pg(t,function(t,r){if(t&&r){let i=t;i.slice(0,2)!==`--`&&(i=i.toLowerCase(),e.stylePropertyNameCase===`dom`&&(i.slice(0,4)===`-ms-`&&(i=i.slice(1)),i=i.replace(Eg,Qg))),n[i]=r}})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Sg("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=kg+`#cannot-parse-style-attribute`,r}return n}function qg(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=gh(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=gh(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Cg.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Jg(e)}function Jg(e,t){let n=new Sg("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=kg+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Yg(e){let t={},n;for(n in e)Cg.call(e,n)&&(t[Xg(n)]=e[n]);return t}function Xg(e){if(e.slice(0,2)===`--`)return e;let t=e.replace(Tg,Zg);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Zg(e){return`-`+e.toLowerCase()}function Qg(e,t){return t.toUpperCase()}var $g={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},e_={};function t_(e,t){let n=t||e_;return n_(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function n_(e,t,n){if(i_(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return r_(e.children,t,n)}return Array.isArray(e)?r_(e,t,n):``}function r_(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=n_(e[i],t,n);return r.join(``)}function i_(e){return!!(e&&typeof e==`object`)}var a_=document.createElement(`i`);function o_(e){let t=`&`+e+`;`;a_.innerHTML=t;let n=a_.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function s_(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function c_(e,t){return e.length>0?(s_(e,e.length,0,t),e):t}var l_={}.hasOwnProperty;function u_(e){let t={},n=-1;for(;++n<e.length;)d_(t,e[n]);return t}function d_(e,t){let n;for(n in t){let r=(l_.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){l_.call(r,a)||(r[a]=[]);let e=i[a];f_(r[a],Array.isArray(e)?e:e?[e]:[])}}}function f_(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);s_(e,0,0,r)}function p_(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function m_(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var h_=T_(/[A-Za-z]/),g_=T_(/[\dA-Za-z]/),__=T_(/[#-'*+\--9=?A-Z^-~]/);function v_(e){return e!==null&&(e<32||e===127)}var y_=T_(/\d/),b_=T_(/[\dA-Fa-f]/),x_=T_(/[!-/:-@[-`{-~]/);function Z(e){return e!==null&&e<-2}function S_(e){return e!==null&&(e<0||e===32)}function Q(e){return e===-2||e===-1||e===32}var C_=T_(/\p{P}|\p{S}/u),w_=T_(/\s/);function T_(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function E_(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&g_(e.charCodeAt(n+1))&&g_(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function $(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Q(r)?(e.enter(n),s(r)):t(r)}function s(r){return Q(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function D_(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&Q(t)?(e.enter(r),c(t)):l(t)}function c(t){return Q(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var O_={tokenize:k_};function k_(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null)e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);else return Z(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var A_=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){j_(this,e,t,n,!1)}addBefore(e,t,n){j_(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function j_(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var M_={tokenize:P_},N_={tokenize:F_};function P_(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;let c=new A_;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(N_,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(N_,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null)i&&v(),_(0),e.consume(n);else return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null)g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);else return Z(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;let l=new A_;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function F_(e,t,n){return $(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function I_(e){if(e===null||S_(e)||w_(e))return 1;if(C_(e))return 2}function L_(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var R_={name:`attention`,resolveAll:z_,tokenize:B_};function z_(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};V_(o,-a),V_(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=c_(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=c_(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=c_(r,L_(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=c_(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=c_(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),s_(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function B_(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=I_(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=I_(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function V_(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var H_={name:`autolink`,tokenize:U_};function U_(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return h_(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||g_(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||g_(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||v_(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):__(t)?(e.consume(t),l):n(t)}function u(e){return g_(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||g_(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var W_={partial:!0,tokenize:G_};function G_(e,t,n){return r;function r(t){return Q(t)?$(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Z(e)?t(e):n(e)}}var K_={continuation:{tokenize:J_},exit:Y_,name:`blockQuote`,tokenize:q_};function q_(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Q(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function J_(e,t,n){let r=this;return i;function i(t){return Q(t)?$(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(K_,t,n)(r)}}function Y_(e){e.exit(`blockQuote`)}var X_={name:`characterEscape`,tokenize:Z_};function Z_(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return x_(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Q_={name:`characterReference`,tokenize:$_};function $_(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=g_,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=b_,u):(e.enter(`characterReferenceValue`),a=7,o=y_,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===g_&&!o_(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var ev={partial:!0,tokenize:tv};function tv(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var nv={concrete:!0,name:`codeFenced`,tokenize:rv};function rv(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Q(t)?$(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Z(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(ev,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),$(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Z(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Q(t)?$(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Z(t)?e.check(ev,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Z(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Q(t)?$(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Q(t)?$(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Z(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var iv={name:`codeIndented`,tokenize:ov},av={partial:!0,tokenize:sv};function ov(e,t,n){return r;function r(t){return e.enter(`codeIndented`),D_(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):Z(t)?e.attempt(av,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||Z(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function sv(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Z(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):D_(e,t,a,`linePrefix`,4,4)(o)}function a(e){return Z(e)?i(e):n(e)}}var cv={name:`codeText`,previous:uv,resolve:lv,tokenize:dv};function lv(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function uv(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function dv(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Z(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var fv=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&pv(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),pv(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),pv(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);pv(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);pv(this.left,t.reverse())}}}};function pv(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function mv(e){let t={},n=-1,r,i,a,o,s,c,l,u=new fv(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,hv(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return s_(e,0,1/0,u.slice(0)),!l}function hv(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var gv={resolve:vv,tokenize:yv},_v={partial:!0,tokenize:bv};function vv(e){return mv(e),e}function yv(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Z(t)?e.check(_v,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function bv(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$(e,a,`linePrefix`)}function a(i){if(i===null||Z(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function xv(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||v_(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Z(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||S_(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||v_(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Sv(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Z(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Z(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Q(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Cv(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Z(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function wv(e,t){let n;return r;function r(i){return Z(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Q(i)?$(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Tv={name:`definition`,tokenize:Dv},Ev={partial:!0,tokenize:Ov};function Dv(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Sv.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=m_(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return S_(t)?wv(e,l)(t):l(t)}function l(t){return xv(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Ev,d,d)(t)}function d(t){return Q(t)?$(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Z(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Ov(e,t,n){return r;function r(t){return S_(t)?wv(e,i)(t):n(t)}function i(t){return Cv(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Q(t)?$(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Z(e)?t(e):n(e)}}var kv={name:`hardBreakEscape`,tokenize:Av};function Av(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Z(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var jv={name:`headingAtx`,resolve:Mv,tokenize:Nv};function Mv(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};s_(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function Nv(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||S_(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Z(n)?(e.exit(`atxHeading`),t(n)):Q(n)?$(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||S_(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Pv=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Fv=[`pre`,`script`,`style`,`textarea`],Iv={concrete:!0,name:`htmlFlow`,resolveTo:Rv,tokenize:zv},Lv={partial:!0,tokenize:Bv};function Rv(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function zv(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:F):h_(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):h_(a)?(e.consume(a),i=4,r.interrupt?t:F):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:F):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return h_(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||S_(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Fv.includes(l)?(i=1,r.interrupt?t(s):O(s)):Pv.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||g_(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Q(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||h_(t)?(e.consume(t),b):Q(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||g_(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Q(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Q(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Z(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||S_(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Q(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Z(t)?O(t):Q(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),j):t===60&&i===1?(e.consume(t),M):t===62&&i===4?(e.consume(t),te):t===63&&i===3?(e.consume(t),F):t===93&&i===5?(e.consume(t),P):Z(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Lv,I,k)(t)):t===null||Z(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(ev,A,I)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return t===null||Z(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function j(t){return t===45?(e.consume(t),F):O(t)}function M(t){return t===47?(e.consume(t),o=``,N):O(t)}function N(t){if(t===62){let n=o.toLowerCase();return Fv.includes(n)?(e.consume(t),te):O(t)}return h_(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),N):O(t)}function P(t){return t===93?(e.consume(t),F):O(t)}function F(t){return t===62?(e.consume(t),te):t===45&&i===2?(e.consume(t),F):O(t)}function te(t){return t===null||Z(t)?(e.exit(`htmlFlowData`),I(t)):(e.consume(t),te)}function I(n){return e.exit(`htmlFlow`),t(n)}}function Bv(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(W_,t,n)}}var Vv={name:`htmlText`,tokenize:Hv};function Hv(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):h_(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):h_(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Z(t)?(o=d,M(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?j(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Z(t)?(o=h,M(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?j(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?j(t):Z(t)?(o=v,M(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Z(t)?(o=y,M(t)):(e.consume(t),y)}function b(e){return e===62?j(e):y(e)}function x(t){return h_(t)?(e.consume(t),S):n(t)}function S(t){return t===45||g_(t)?(e.consume(t),S):C(t)}function C(t){return Z(t)?(o=C,M(t)):Q(t)?(e.consume(t),C):j(t)}function w(t){return t===45||g_(t)?(e.consume(t),w):t===47||t===62||S_(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),j):t===58||t===95||h_(t)?(e.consume(t),E):Z(t)?(o=T,M(t)):Q(t)?(e.consume(t),T):j(t)}function E(t){return t===45||t===46||t===58||t===95||g_(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Z(t)?(o=D,M(t)):Q(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Z(t)?(o=O,M(t)):Q(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,ee):t===null?n(t):Z(t)?(o=k,M(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||S_(t)?T(t):(e.consume(t),A)}function ee(e){return e===47||e===62||S_(e)?T(e):n(e)}function j(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function M(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),N}function N(t){return Q(t)?$(e,P,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):P(t)}function P(t){return e.enter(`htmlTextData`),o(t)}}var Uv={name:`labelEnd`,resolveAll:qv,resolveTo:Jv,tokenize:Yv},Wv={tokenize:Xv},Gv={tokenize:Zv},Kv={tokenize:Qv};function qv(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&s_(e,0,e.length,n),e}function Jv(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=c_(o,e.slice(i+1,i+r+3)),o=c_(o,[[`enter`,l,t]]),o=c_(o,L_(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=c_(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=c_(o,e.slice(a+1)),o=c_(o,[[`exit`,s,t]]),s_(e,i,e.length,o),e}function Yv(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(m_(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Wv,u,o?u:d)(t):t===91?e.attempt(Gv,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Kv,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function Xv(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return S_(t)?wv(e,a)(t):a(t)}function a(t){return t===41?u(t):xv(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return S_(t)?wv(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Cv(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return S_(t)?wv(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Zv(e,t,n){let r=this;return i;function i(t){return Sv.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(m_(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Qv(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var $v={name:`labelStartImage`,resolveAll:Uv.resolveAll,tokenize:ey};function ey(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var ty={name:`labelStartLink`,resolveAll:Uv.resolveAll,tokenize:ny};function ny(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var ry={name:`lineEnding`,tokenize:iy};function iy(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$(e,t,`linePrefix`)}}var ay={name:`thematicBreak`,tokenize:oy};function oy(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Z(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Q(t)?$(e,s,`whitespace`)(t):s(t))}}var sy={continuation:{tokenize:dy},exit:py,name:`list`,tokenize:uy},cy={partial:!0,tokenize:my},ly={partial:!0,tokenize:fy};function uy(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:y_(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(ay,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return y_(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(W_,r.interrupt?n:u,e.attempt(cy,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Q(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function dy(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(W_,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Q(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ly,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,$(e,e.attempt(sy,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function fy(e,t,n){let r=this;return $(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function py(e){e.exit(this.containerState.type)}function my(e,t,n){let r=this;return $(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Q(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var hy={name:`setextUnderline`,resolveTo:gy,tokenize:_y};function gy(e,t){let n=new A_,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function _y(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Q(t)?$(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Z(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var vy={tokenize:yy};function yy(e){let t=this,n=e.attempt(W_,r,e.attempt(this.parser.constructs.flowInitial,i,$(e,e.attempt(this.parser.constructs.flow,i,e.attempt(gv,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var by={resolveAll:wy()},xy=Cy(`string`),Sy=Cy(`text`);function Cy(e){return{resolveAll:wy(e===`text`?Ty:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null)t.consume(e);else return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function wy(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):t[r]&&t[r][1].type===`data`||(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Ty(e,t){let n=new A_,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var Ey=Mn({attentionMarkers:()=>Py,contentInitial:()=>Oy,disable:()=>Fy,document:()=>Dy,flow:()=>Ay,flowInitial:()=>ky,insideSpan:()=>Ny,string:()=>jy,text:()=>My}),Dy={42:sy,43:sy,45:sy,48:sy,49:sy,50:sy,51:sy,52:sy,53:sy,54:sy,55:sy,56:sy,57:sy,62:K_},Oy={91:Tv},ky={[-2]:iv,[-1]:iv,32:iv},Ay={35:jv,42:ay,45:[hy,ay],60:Iv,61:hy,95:ay,96:nv,126:nv},jy={38:Q_,92:X_},My={[-5]:ry,[-4]:ry,[-3]:ry,33:$v,38:Q_,42:R_,60:[H_,Vv],91:ty,92:[kv,X_],93:Uv,95:R_,96:cv},Ny={null:[R_,by]},Py={null:[42,95]},Fy={null:[]};function Iy(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=c_(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=L_(a,l.events,l),l.events):[]}function f(e,t){return Ry(p(e),t)}function p(e){return Ly(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){Z(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&s_(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ly(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Ry(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
8
+ `;break;case-3:o=`\r
9
+ `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function zy(e){let t={constructs:u_([Ey,...(e||{}).extensions||[]]),content:n(O_),defined:[],document:n(M_),flow:n(vy),lazy:{},string:n(xy),text:n(Sy)};return t;function n(e){return n;function n(n){return Iy(t,e,n)}}}function By(e){for(;!mv(e););return e}var Vy=/[\0\t\n\r]/g;function Hy(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){Vy.lastIndex=c;let n=Vy.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Uy=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Wy(e){return e.replace(Uy,Gy)}function Gy(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return p_(n.slice(t?2:1),t?16:10)}return o_(n)||e}var Ky={}.hasOwnProperty;function qy(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Jy(n)(By(zy(n).document().write(Hy()(e,t,!0))))}function Jy(e){let t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:o(H),autolinkProtocol:E,autolinkEmail:E,atxHeading:o(B),blockQuote:o(z),characterEscape:E,characterReference:E,codeFenced:o(ce),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(ce,s),codeText:o(le,s),codeTextData:E,data:E,codeFlowValue:E,definition:o(ue),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(de),hardBreakEscape:o(V),hardBreakTrailing:o(V),htmlFlow:o(fe,s),htmlFlowData:E,htmlText:o(fe,s),htmlTextData:E,image:o(pe),label:s,link:o(H),listItem:o(he),listItemValue:p,listOrdered:o(me,f),listUnordered:o(me),paragraph:o(ge),reference:L,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(B),strong:o(_e),thematicBreak:o(ye)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:R,autolinkProtocol:se,blockQuote:l(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:ae,characterReference:oe,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:D,codeIndented:l(v),codeText:l(j),codeTextData:D,data:D,definition:l(),definitionDestinationString:x,definitionLabelString:y,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(k),hardBreakTrailing:l(k),htmlFlow:l(A),htmlFlowData:D,htmlText:l(ee),htmlTextData:D,image:l(N),label:F,labelText:P,lineEnding:O,link:l(M),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:re,resourceDestinationString:te,resourceTitleString:I,resource:ne,setextHeading:l(T),setextHeadingLineSequence:w,setextHeadingText:C,strong:l(),thematicBreak:l()}};Xy(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[],position:void 0},o={stack:[r],tokenStack:[],config:t,enter:c,exit:u,buffer:s,resume:d,data:n},l=[],f=[],p=-1;for(;++p<e.length;)f.push(e[p]),(e[p][1].type===`listOrdered`||e[p][1].type===`listUnordered`)&&(e[p][0]===`enter`?l.push(f.length-1):a(f,l.pop()));for(e=f,p=-1;++p<e.length;){let n=t[e[p][0]];e[p][0]===`enter`&&t.beforeEnter.length>0&&i(t.beforeEnter,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),Ky.call(n,e[p][1].type)&&n[e[p][1].type].call({...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),e[p][0]===`exit`&&t.afterExit.length>0&&i(t.afterExit,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||Qy).call(o,void 0,e[0])}for(r.position={start:Yy(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Yy(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},p=-1;++p<t.transforms.length;)r=t.transforms[p](r)||r;return r}function i(e,t,n){let r=-1;for(;++r<e.length;)e[r].call(t,n)}function a(e,t){let n=e.length-1,r=t-1,i=-1,a=!1,o,s,c,l,u=[];for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let n=r;for(s=void 0;n--;){let t=e[n];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=n}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),u.push({at:s||r,event:[`exit`,o,t[2]]})}if(t[1].type===`listItemPrefix`){let e={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=e,u.push({at:r,event:[`enter`,e,t[2]]}),c=void 0,l=!0}}}let d=e.splice(t),f=0;for(r=-1;++r<d.length;){for(;f<u.length&&u[f].at===t+r;)e.push(u[f++].event);e.push(d[r])}e[t][1]._spread=a}function o(e,t){return n;function n(n){c.call(this,e(n),n),t&&t.call(this,n)}}function s(){this.stack.push({type:`fragment`,children:[]})}function c(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Yy(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),u.call(this,t)}}function u(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw Error("Cannot close `"+e.type+"` ("+vg({start:e.start,end:e.end})+`): it’s not open`);r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Qy).call(this,e,r[0])),n.position.end=Yy(e.end)}function d(){return t_(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function h(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function v(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function y(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=m_(this.sliceSerialize(e)).toLowerCase()}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function x(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function S(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function C(){this.data.setextHeadingSlurpLineEnding=!0}function w(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function E(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&n.type===`text`||(n=ve(),n.position={start:Yy(e.start),end:void 0},t.push(n)),this.stack.push(n)}function D(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Yy(e.end)}function O(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Yy(e.end),this.data.atHardBreak=void 0}else!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(E.call(this,e),D.call(this,e))}function k(){this.data.atHardBreak=!0}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Wy(t),n.identifier=m_(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ne(){this.data.inReference=void 0}function L(){this.data.referenceType=`collapsed`}function re(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=m_(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ie(e){this.data.characterReferenceType=e.type}function ae(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=p_(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=o_(t);let i=this.stack[this.stack.length-1];i.value+=r}function oe(e){let t=this.stack.pop();t.position.end=Yy(e.end)}function se(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function R(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function z(){return{type:`blockquote`,children:[],position:void 0}}function ce(){return{type:`code`,lang:null,meta:null,value:``,position:void 0}}function le(){return{type:`inlineCode`,value:``,position:void 0}}function ue(){return{type:`definition`,identifier:``,label:null,title:null,url:``,position:void 0}}function de(){return{type:`emphasis`,children:[],position:void 0}}function B(){return{type:`heading`,depth:0,children:[],position:void 0}}function V(){return{type:`break`,position:void 0}}function fe(){return{type:`html`,value:``,position:void 0}}function pe(){return{type:`image`,title:null,url:``,alt:null,position:void 0}}function H(){return{type:`link`,title:null,url:``,children:[],position:void 0}}function me(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[],position:void 0}}function he(e){return{type:`listItem`,spread:e._spread,checked:null,children:[],position:void 0}}function ge(){return{type:`paragraph`,children:[],position:void 0}}function _e(){return{type:`strong`,children:[],position:void 0}}function ve(){return{type:`text`,value:``,position:void 0}}function ye(){return{type:`thematicBreak`,position:void 0}}}function Yy(e){return{line:e.line,column:e.column,offset:e.offset}}function Xy(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Xy(e,r):Zy(e,r)}}function Zy(e,t){let n;for(n in t)if(Ky.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`afterExit`:case`beforeEnter`:{let r=t[n];r&&e[n].push(r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Qy(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+vg({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vg({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+vg({start:t.start,end:t.end})+`) is still open`)}function $y(e){let t=this;t.parser=n;function n(n){return qy(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function eb(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function tb(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
10
+ `}]}function nb(e,t){let n=t.value?t.value+`
11
+ `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function rb(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ib(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ab(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=E_(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function ob(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sb(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function cb(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function lb(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return cb(e,t);let i={src:E_(r.url||``)};t.alt!==null&&t.alt!==void 0&&(i.alt=t.alt),r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function ub(e,t){let n={src:E_(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function db(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function fb(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return cb(e,t);let i={href:E_(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function pb(e,t){let n={href:E_(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function mb(e,t,n){let r=e.all(t),i=n?hb(n):gb(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
12
+ `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
13
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function hb(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let{children:n}=e,r=-1;for(;!t&&++r<n.length;)t=gb(n[r])}return t}function gb(e){let{spread:t}=e;return t??e.children.length>1}function _b(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function vb(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yb(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function bb(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xb(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=hg(t.children[1]),o=mg(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Sb(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function Cb(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var wb=9,Tb=32;function Eb(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Db(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Db(t.slice(i),i>0,!1)),a.join(``)}function Db(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===wb||t===Tb;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===wb||t===Tb;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Ob(e,t){let n={type:`text`,value:Eb(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function kb(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Ab={blockquote:eb,break:tb,code:nb,delete:rb,emphasis:ib,footnoteReference:ab,heading:ob,html:sb,imageReference:lb,image:ub,inlineCode:db,linkReference:fb,link:pb,listItem:mb,list:_b,paragraph:vb,root:yb,strong:bb,table:xb,tableCell:Cb,tableRow:Sb,text:Ob,thematicBreak:kb,toml:jb,yaml:jb,definition:jb,footnoteDefinition:jb};function jb(){}var{defineProperty:Mb}=Object,Nb=typeof self==`object`?self:globalThis,Pb=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new Nb[e](t)},Fb=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?Mb(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof Nb[e]==`function`?Pb(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(Pb(a,o),i)};return r},Ib=e=>Fb(new Map,e)(0),Lb=``,{toString:Rb}={},{keys:zb,is:Bb}=Object,Vb=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Rb.call(e).slice(8,-1);switch(n){case`Array`:return[1,Lb];case`Object`:return[2,Lb];case`Date`:return[3,Lb];case`RegExp`:return[4,Lb];case`Map`:return[5,Lb];case`Set`:return[6,Lb];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},Hb=([e,t])=>e===0&&(t===`function`||t===`symbol`),Ub=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=Vb(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&Bb(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of zb(o))(e||!Hb(Vb(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?Lb:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(Hb(Vb(n))||Hb(Vb(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!Hb(Vb(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},Wb=(e,{json:t,lossy:n}={})=>{let r=[];return Ub(!(t||n),!!t,new Map,r)(e),r},Gb=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Ib(Wb(e,t)):structuredClone(e):(e,t)=>Ib(Wb(e,t));function Kb(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function qb(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Jb(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Kb,r=e.options.footnoteBackLabel||qb,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=[],l=-1;for(;++l<e.footnoteOrder.length;){let t=e.footnoteById.get(e.footnoteOrder[l]);t&&(s[l]=e.all(t))}for(l=-1;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let a=s[l],o=String(i.identifier).toUpperCase(),u=E_(o.toLowerCase()),d=0,f=[],p=e.footnoteCounts.get(o);for(;p!==void 0&&++d<=p;){f.length>0&&f.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(l,d);typeof e==`string`&&(e={type:`text`,value:e}),f.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+u+(d>1?`-`+d:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(l,d),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let m=a[a.length-1];if(m&&m.type===`element`&&m.tagName===`p`){let e=m.children[m.children.length-1];e&&e.type===`text`?e.value+=` `:m.children.push({type:`text`,value:` `}),m.children.push(...f)}else a.push(...f);let h={type:`element`,tagName:`li`,properties:{id:t+`fn-`+u},children:e.wrap(a,!0)};e.patch(i,h),c.push(h)}if(c.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...Gb(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
14
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(c,!0)},{type:`text`,value:`
15
+ `}]}}var Yb=(function(e){if(e==null)return ex;if(typeof e==`function`)return $b(e);if(typeof e==`object`)return Array.isArray(e)?Xb(e):Zb(e);if(typeof e==`string`)return Qb(e);throw Error(`Expected function, string, or object as test`)});function Xb(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Yb(e[n]);return $b(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Zb(e){let t=e;return $b(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Qb(e){return $b(t);function t(t){return t&&t.type===e}}function $b(e){return t;function t(t,n,r){return!!(tx(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function ex(){return!0}function tx(e){return typeof e==`object`&&!!e&&`type`in e}function nx(e){return e}var rx=[],ix=`skip`;function ax(e,t,n,r){if(!e||typeof e!=`object`)throw Error("Unexpected value `"+e+"` for `tree`, expected node");let i=!0,a,o,s,c;if(typeof n==`function`||n&&typeof n==`object`?(a=t,o=n,r&&(i=!1)):(o=t,n&&(i=!1)),typeof o==`function`)s=o;else if(o&&typeof o==`object`){if(o.enter!==null&&o.enter!==void 0){if(typeof o.enter==`function`)s=o.enter;else throw Error("Unexpected value `"+o.enter+"` for `visitors.enter`, expected optional visitor")}if(typeof o.exit==`function`)c=o.exit;else throw Error("Unexpected value `"+o.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw Error("Unexpected value `"+o+"` for `enter` or `visitors`, expected visitor or object with visitors");let l=Yb(a),u=i?1:-1;d(e,void 0,[])();function d(e,t,n){let r=e&&typeof e==`object`?e:{};if(typeof r.type==`string`){let t=typeof r.tagName==`string`?r.tagName:typeof r.name==`string`?r.name:void 0;Object.defineProperty(o,"name",{value:`node (`+nx(e.type+(t?`<`+t+`>`:``))+`)`})}return o;function o(){let r=!a||l(e,t,n[n.length-1]||void 0),o=rx;if(s&&r&&(o=ox(s(e,n,t)),o[0]===!1))return o;if(`children`in e&&e.children){let t=e;if(t.children&&o[0]!==`skip`){let e=(i?-1:t.children.length)+u,r=[...n,t];for(;e>-1&&e<t.children.length;){let n=t.children[e],i=d(n,e,r)();if(i[0]===!1)return i;e=typeof i[1]==`number`?i[1]:e+u}}}if(c&&r){let r=ox(c(e,n,t));if(r[0]===`skip`)throw Error("Unexpected value `"+r[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(r[0]===!1||typeof r[1]==`number`)return r}return o}}}function ox(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?rx:[e]}function sx(e,t,n,r){let i,a,o;typeof n==`function`||n&&typeof n==`object`?(i=t,a=n,o=r):(a=t,o=n),typeof a==`function`?ax(e,i,lx(a),o):ax(e,i,cx(a),o)}function cx(e){return!e||typeof e!=`object`?e:{enter:typeof e.enter==`function`?lx(e.enter):e.enter,exit:typeof e.exit==`function`?lx(e.exit):e.exit}}function lx(e){return t;function t(t,n,r){return e(t,r,n[n.length-1])}}var ux={}.hasOwnProperty,dx={};function fx(e,t){let n=t||dx,r=new Map,i=new Map,a={all:s,applyData:mx,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Ab,...n.handlers},one:o,options:n,patch:px,wrap:gx};return sx(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=String(e.identifier).toUpperCase();e.type===`definition`?r.has(t)||r.set(t,e):i.has(t)||i.set(t,e)}}),a;function o(e,t){let{type:n}=e,r=a.handlers[n];if(ux.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e;return{...Gb(n),children:a.all(e)}}return Gb(e)}return(a.options.unknownHandler||hx)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=_x(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=_x(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function px(e,t){e.position&&(t.position=_g(e))}function mx(e,t){let n=t;if(e&&e.data){let{hChildren:t,hName:r,hProperties:i}=e.data;typeof r==`string`&&(n.type===`element`?n.tagName=r:n={type:`element`,tagName:r,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,Gb(i)),`children`in n&&n.children&&t!=null&&(n.children=t)}return n}function hx(e,t){let n=t.data||{},r=`value`in t&&!(ux.call(n,`hProperties`)||ux.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function gx(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
16
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
17
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
18
+ `}),n}function _x(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function vx(e,t){let n=fx(e,t),r=n.one(e,void 0),i=Jb(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
19
+ `},i)),a}function yx(e,t){return e&&`run`in e?async function(n,r){let i=vx(n,{file:r,...t});await e.run(i,r)}:function(n,r){return vx(n,{file:r,...e||t})}}function bx(e){if(e)throw e}var xx=jn(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Sx(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Cx(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a)r(a);else{for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?wx(s,i)(...o):r(null,...o)}}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function wx(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var Tx={basename:Ex,dirname:Dx,extname:Ox,join:kx,sep:`/`};function Ex(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Mx(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Dx(e){if(Mx(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Ox(e){Mx(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function kx(...e){let t=-1,n;for(;++t<e.length;)Mx(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Ax(n)}function Ax(e){Mx(e);let t=e.codePointAt(0)===47,n=jx(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function jx(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Mx(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Nx={cwd:Px};function Px(){return`/`}function Fx(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Ix(e){if(typeof e==`string`)e=new URL(e);else if(!Fx(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Lx(e)}function Lx(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Rx=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],zx=class{constructor(e){let t;t=e?Fx(e)?{path:e}:typeof e==`string`||Ux(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Nx.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Rx.length;){let e=Rx[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Rx.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Tx.basename(this.path):void 0}set basename(e){Vx(e,`basename`),Bx(e,`basename`),this.path=Tx.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Tx.dirname(this.path):void 0}set dirname(e){Hx(this.basename,`dirname`),this.path=Tx.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Tx.extname(this.path):void 0}set extname(e){if(Bx(e,`extname`),Hx(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=Tx.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Fx(e)&&(e=Ix(e)),Vx(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Tx.basename(this.path,this.extname):void 0}set stem(e){Vx(e,`stem`),Bx(e,`stem`),this.path=Tx.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Sg(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Bx(e,t){if(e&&e.includes(Tx.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Tx.sep+"`")}function Vx(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Hx(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Ux(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Wx=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Gx=An(xx(),1),Kx={}.hasOwnProperty,qx=new class e extends Wx{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Cx()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Gx.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Xx(`data`,this.frozen),this.namespace[e]=t,this):Kx.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Xx(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=$x(e),n=this.parser||this.Parser;return Jx(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Jx(`process`,this.parser||this.Parser),Yx(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=$x(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);tS(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Jx(`processSync`,this.parser||this.Parser),Yx(`processSync`,this.compiler||this.Compiler),this.process(e,r),Qx(`processSync`,`process`,t),n;function r(e,r){t=!0,bx(e),n=r}}run(e,t,n){Zx(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=$x(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Qx(`runSync`,`run`,n),r;function i(e,t){bx(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=$x(t),r=this.compiler||this.Compiler;return Yx(`stringify`,r),Zx(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Xx(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,Gx.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Sx(o)&&Sx(r)&&(r=(0,Gx.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Jx(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Yx(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Xx(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Zx(e){if(!Sx(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Qx(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function $x(e){return eS(e)?e:new zx(e)}function eS(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function tS(e){return typeof e==`string`||nS(e)}function nS(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var rS=[],iS={allowDangerousHtml:!0},aS=/^(https?|ircs?|mailto|xmpp)$/i,oS=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function sS(e){let t=cS(e),n=lS(e);return uS(t.runSync(t.parse(n),n),e)}function cS(e){let t=e.rehypePlugins||rS,n=e.remarkPlugins||rS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...iS}:iS;return qx().use($y).use(n).use(yx,r).use(t)}function lS(e){let t=e.children||``,n=new zx;return typeof t==`string`?n.value=t:``+t,n}function uS(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||dS;for(let e of oS)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return sx(e,l),Ag(e,{Fragment:q.Fragment,components:i,ignoreInvalidStyle:!0,jsx:q.jsx,jsxs:q.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in $g)if(Object.hasOwn($g,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=$g[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function dS(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||aS.test(e.slice(0,t))?e:``}function fS(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function pS(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function mS(e,t,n){let r=Yb((n||{}).ignore||[]),i=hS(t),a=-1;for(;++a<i.length;)ax(e,o);function o(e,t,n){if(e.type===`text`&&typeof n==`number`)return s(e,t,n);if(r(e,n,t[t.length-1]))return ix}function s(e,t,n){let r=t[t.length-1],o=i[a][0],s=i[a][1],c=0,l=!1,u=[];o.lastIndex=0;let d=o.exec(e.value);for(;d;){let n=d.index,r={index:d.index,input:d.input,stack:[...t,e]},i=s(...d,r);if(typeof i==`string`&&(i=i.length>0?{type:`text`,value:i}:void 0),i!==!1){if(c!==n&&f({type:`text`,value:e.value.slice(c,n)}),Array.isArray(i))for(let e of i)f(e);else i&&f(i);c=n+d[0].length,l=!0}if(i===!1||d[0].length===0){let t=e.value.codePointAt(n)||0;o.lastIndex=n+(/[uv]/.test(o.flags)&&t>65535?2:1)}if(!o.global)break;d=o.exec(e.value)}return l?(c<e.value.length&&f({type:`text`,value:e.value.slice(c)}),r.children.splice(n,1,...u)):u=[e],n+u.length;function f(e){let t=u[u.length-1];t&&t.type===`text`&&e.type===`text`?t.value+=e.value:u.push(e)}}}function hS(e){if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let t=[],n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([gS(e[0]),_S(e[1])])}return t}function gS(e){return typeof e==`string`?new RegExp(pS(e),`g`):e}function _S(e){return typeof e==`function`?e:function(){return e}}var vS=`phrasing`,yS=[`autolink`,`link`,`image`,`label`];function bS(){return{transforms:[OS],enter:{literalAutolink:SS,literalAutolinkEmail:CS,literalAutolinkHttp:CS,literalAutolinkWww:CS},exit:{literalAutolink:DS,literalAutolinkEmail:ES,literalAutolinkHttp:wS,literalAutolinkWww:TS}}}function xS(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:vS,notInConstruct:yS},{character:`.`,before:`[Ww]{3}`,inConstruct:vS,notInConstruct:yS},{character:`:`,before:`[PSps]`,after:`\\/`,inConstruct:vS,notInConstruct:yS}]}}function SS(e){this.enter({type:`link`,title:null,url:``,children:[],position:void 0},e)}function CS(e){this.config.enter.autolinkProtocol.call(this,e)}function wS(e){this.config.exit.autolinkProtocol.call(this,e)}function TS(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function ES(e){this.config.exit.autolinkEmail.call(this,e)}function DS(e){this.exit(e)}function OS(e){mS(e,[[/(?<![\da-z])(https?:\/\/|www(?=\.))([\w-]*\.[\w\-.]*)([^\t\n\r ]*)/gi,kS],[/(?<![\w+\-.@])xmpp:([\w+\-.]+)@([\w-]+(?:\.[\w-]+)+)(\/(?:[\w\-/]|\.(?=[\dA-Za-z]))*)?/g,MS],[/(?<![\w+\-.@])mailto:([\w+\-.]+)@([\w-]+(?:\.[\w-]+)+)/g,jS],[/(?<![\w+\-.]|(?:^|[^\d@A-Za-z])(?:mailto|xmpp):)([\w+\-.]+)@([\w-]+(?:\.[\w-]+)+)/g,AS]],{ignore:[`link`,`linkReference`]})}function kS(e,t,n,r,i){if(!FS(i))return!1;let a=``;if(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),C_(n.charCodeAt(0))||!NS(n))return!1;let o=PS(n+r),s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0],position:void 0}],position:void 0};return o[1]?[s,{type:`text`,value:o[1],position:void 0}]:s}function AS(e,t,n){return!/[\d\-_]$/.test(n)&&{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n,position:void 0}],position:void 0}}function jS(e,t,n){if(/[\d\-_]$/.test(n))return!1;let r=`mailto:`+t+`@`+n;return{type:`link`,title:null,url:r,children:[{type:`text`,value:r,position:void 0}],position:void 0}}function MS(e,t,n,r,i){if(/[\d\-_]$/.test(n)||r&&(!/[A-Za-z]$/.test(r)||i.input.charAt(i.index+e.length)===`@`))return!1;let a=`xmpp:`+t+`@`+n+(r||``);return{type:`link`,title:null,url:a,children:[{type:`text`,value:a,position:void 0}],position:void 0}}function NS(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[\dA-Za-z]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[\dA-Za-z]/.test(t[t.length-2])))}function PS(e){let t=e.length;for(;t>0;){let n=e.charCodeAt(t-1);if(n===33||n===34||n===38||n===39||n===41||n===44||n===46||n===58||n===59||n===60||n===62||n===63||n===93||n===125)t--;else break}if(t===e.length)return[e,void 0];let n=e.slice(t);e=e.slice(0,t);let r=n.indexOf(`)`),i=fS(e,`(`),a=fS(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function FS(e){let t=e.input.charCodeAt(e.index-1);return e.index===0||w_(t)||C_(t)}GS.peek=WS;function IS(){this.buffer()}function LS(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function RS(){this.buffer()}function zS(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function BS(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=m_(this.sliceSerialize(e)).toLowerCase(),n.label=t}function VS(e){this.exit(e)}function HS(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=m_(this.sliceSerialize(e)).toLowerCase(),n.label=t}function US(e){this.exit(e)}function WS(){return`[`}function GS(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function KS(){return{enter:{gfmFootnoteCallString:IS,gfmFootnoteCall:LS,gfmFootnoteDefinitionLabelString:RS,gfmFootnoteDefinition:zS},exit:{gfmFootnoteCallString:BS,gfmFootnoteCall:VS,gfmFootnoteDefinitionLabelString:HS,gfmFootnoteDefinition:US}}}function qS(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:GS},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
20
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?YS:JS))),s(),o}}function JS(e,t,n){return t===0?e:YS(e,t,n)}function YS(e,t,n){return(n?``:` `)+e}var XS=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];tC.attention=nC,tC.peek=rC;function ZS(){return{canContainEols:[`delete`],enter:{strikethrough:$S},exit:{strikethrough:eC}}}function QS(){return{handlers:{delete:tC},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:XS}]}}function $S(e){this.enter({type:`delete`,children:[],position:void 0},e)}function eC(e){this.exit(e)}function tC(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function nC(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function rC(){return`~`}function iC(e){return e.length}function aC(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||iC,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=oC(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=sC(r[d]);else{let e=sC(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u],r=n.fillRows===!1?Math.max(1,o[u===1?0:u].length):l;d=-1;let i=[];for(;++d<r;){let o=e[d]||``,s=``,l=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];if(n===114)s=` `.repeat(e);else if(n===99){let t=e/2;e%2?(s=` `.repeat(t+.5),l=` `.repeat(t-.5)):(s=` `.repeat(t),l=s)}else l=` `.repeat(e)}n.delimiterStart!==!1&&!d&&i.push(`|`),n.padding===!1||n.alignDelimiters===!1&&o===``||n.delimiterStart===!1&&!d||i.push(` `),n.alignDelimiters!==!1&&i.push(s),i.push(o),n.alignDelimiters!==!1&&i.push(l),n.padding!==!1&&i.push(` `),(n.delimiterEnd!==!1||d!==r-1)&&i.push(`|`)}m.push(n.delimiterEnd===!1?i.join(``).replace(/ +$/,``):i.join(``))}return m.join(`
21
+ `)}function oC(e){return e==null?``:String(e)}function sC(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}var cC=Yb([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function lC(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),uC);return i(),o}function uC(e,t,n){return`>`+(n?``:` `)+e}function dC(e,t){return fC(e,t.inConstruct,!0)&&!fC(e,t.notInConstruct,!1)}function fC(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function pC(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){let e=n.unsafe[i];if(e.character===`
22
+ `&&!e.before&&!e.after&&dC(n.stack,e))return/[\t ]/.test(r.before)?``:` `}return`\\
23
+ `}function mC(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function hC(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^\n\r ]/.test(e.value)||/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function gC(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function _C(e,t,n,r){let i=gC(n),a=e.value||``;if(hC(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,vC);return e(),t}let o=n.createTracker(r),s=i.repeat(Math.max(mC(a,i)+1,3)),c=n.enter(`codeFenced`),l=i==="`"?`GraveAccent`:`Tilde`,u=o.move(s);if(e.lang){let t=n.enter(`codeFencedLang${l}`);u+=o.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...o.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${l}`);u+=o.move(` `),u+=o.move(n.safe(e.meta,{before:u,after:`
24
+ `,encode:["`"],...o.current()})),t()}return u+=o.move(`
25
+ `),a&&(u+=o.move(a+`
26
+ `)),u+=o.move(s),c(),u}function vC(e,t,n){return(n?``:` `)+e}function yC(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function bC(e,t,n,r){let i=yC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/^<|[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
27
+ `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function xC(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function SC(e){let t=e.codePointAt(0);return t===void 0?``:String.fromCodePoint(t)}function CC(e){let t=e.codePointAt(e.length-2);return t!==void 0&&t>65535?e.slice(-2):e.slice(-1)}function wC(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function TC(e,t,n){let r=I_(e),i=I_(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function EC(e){if(e.charCodeAt(0)!==60)return;let t=e.charCodeAt(1);if(t===33){let t=e.charCodeAt(2);return t===45?2:t===91?5:h_(t)?4:void 0}if(t===63)return 3;let n=t===47,r=n?2:1,i=r,a=e.charCodeAt(i);if(!h_(a))return;for(;a===45||g_(a);)a=e.charCodeAt(++i);let o=e.slice(r,i).toLowerCase();return!n&&a!==47&&Fv.includes(o)?1:Pv.includes(o)?6:7}var DC=new Map([[`*`,!1],[`_`,!0]]);function OC(e,t,n){let r=new Set;for(let i of e){let e=n.get(i);if(e&&i.attention&&t.some(e=>e.attention===i.attention))for(let t of e.tokens)r.add(t.attention)}let i=[];for(let t of e)t.attention&&r.delete(t.attention)&&i.push(t.attention);return i.reverse(),i}function kC(e,t,n){let r=[],i=new Map,a=new Map,o=0;for(;o<e.length;){if(!e[o].attention){o++;continue}let s=e[o].value.charAt(0),c=DC.get(s),l=o+1;for(;l<e.length&&e[l].attention&&e[l].value.charAt(0)===s;)l++;let u=o?e[o-1].value:t,d=I_(u.charCodeAt(u.length-1)),f=I_((l<e.length?e[l].value:n).charCodeAt(0)),p=!f||f===2&&!!d,m=!d||d===2&&!!f,h={tokens:e.slice(o,l),markers:[],start:0,end:0,open:c?p&&(!!d||!m):p,close:c?m&&(!!f||!p):m,split:c!==void 0};for(let e of h.tokens){i.set(e,[...h.tokens]),a.set(e,h);let t=e.value.length;for(;t--;)h.markers.push(e)}h.end=h.markers.length,r.push(h),o=l}for(MC(r,i),o=-1;++o<e.length;){let t=i.get(e[o]);if(t)return{attention:OC(e,t,a),index:o}}}function AC(e,t){let n=e[t?0:e.length-1];if(!n||n.attention)return;let r=t?SC(n.value):CC(n.value),i=wC(r.codePointAt(0));if(t)n.value=i+n.value.slice(r.length);else{let e=n.value.slice(0,n.value.length-r.length),t=0;for(;e.charCodeAt(e.length-1-t)===92;)t++;t%2&&(e+=`\\`),n.value=e+i}}function jC(e,t,n,r,i){for(let a of n.attention){let o=t.get(a)||a.sequences[0];for(let s of a.sequences){if(s===o)continue;let c=new Map(t);c.set(a,s);let l=RC(e,c,r,i),u=kC(l,r,i);if(!u||u.index>n.index)return{chosen:c,mistake:u,tokens:l}}}}function MC(e,t){let n=new Map;for(let r of e){let e=r.tokens[0].value.charAt(0),i=n.get(e);i||(i=[],n.set(e,i));let a=r.close?i.length:0;for(;a--&&r.start<r.end;){let e=i[a],n=e.end-e.start,o=r.end-r.start;if(r.split?(e.close||r.open)&&o%3&&!((n+o)%3):n!==e.markers.length||n!==o)continue;let s=r.split?n>1&&o>1?2:1:o,c=e.markers.slice(e.end-s,e.end),l=r.markers.slice(r.start,r.start+s),u=c[0],d=l[0];if(u===c[s-1]&&u.value.length===s&&d===l[s-1]&&d.value.length===s&&u.attention===d.attention)t.delete(u),t.delete(d);else{let e=[...new Set([...c,...l])];for(let n of e){let r=t.get(n);r&&r.push(...e)}}e.end-=s,r.start+=s,e.start===e.end&&i.splice(a,1),a=i.length}r.open&&r.start<r.end&&i.push(r)}}function NC(e,t,n){if(t.length===0)throw Error("Cannot serialize `"+e+"` as attention without markers, expected one or more markers");if(n.length===0)throw Error("Cannot serialize `"+e+"` as attention without sizes, expected one or more sizes");for(let t of n)if(!Number.isSafeInteger(t)||t<1)throw Error("Cannot serialize `"+e+"` as attention with `"+t+"` as size, expected positive integer");let r=[];for(let i of t){if(i.length!==1)throw Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected a single ascii character");if(!x_(i.charCodeAt(0)))throw Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected ascii punctuation");for(let e of n)r.push(i.repeat(e))}return r}function PC(e,t,n){let r=t.indexStack,i=e.children||[],a=[],o=-1,s=n.before;r.push(-1);let c=t.createTracker(n);for(;++o<i.length;){let l=i[o],u;if(r[r.length-1]=o,o+1<i.length){let n=t.handle.handlers[i[o+1].type];n&&n.peek&&(n=n.peek),u=n?SC(n(i[o+1],e,t,{before:``,after:``,...c.current()})):``}else u=n.after;let d=a[a.length-1];typeof d==`string`&&(s===`\r`||s===`
28
+ `)&&l.type===`html`&&EC(l.value)!==7&&(a[a.length-1]=d.replace(/(\r?\n|\r)$/,` `),s=` `,c=t.createTracker(n),c.move(zC(a,n.before,n.after)));let f=t.handle.handlers[l.type];if(f&&f.attention){let e=FC(l,f.attention,t,c);if(!e)continue;a.push(e),s=CC(e.sequences[0])}else{let n=t.handle(l,e,t,{...c.current(),after:u,before:s});if(!n)continue;c.move(n),a.push(n),s=CC(n)}}return r.pop(),a}function FC(e,t,n,r){let{construct:i,markers:a,sizes:o}=t(e,n),s=NC(e.type,a,o),c=s[0],l=n.enter(i),u=n.createTracker(r.current());u.move(c);let d=PC(e,n,{...u.current(),before:c,after:c});if(l(),d.length!==0)return r.move(c),r.move(zC(d,c,c)),r.move(c),{children:d,sequences:s}}function IC(e,t,n,r){let i=RC(e,t,n,r),a=kC(i,n,r);for(;a;){let o=jC(e,t,a,n,r);if(!o)return;t=o.chosen,i=o.tokens,a=o.mistake}return i}function LC(e,t,n,r){let i=n,a=-1;for(;++a<e.length;){let o=e[a];if(typeof o==`string`){i=``;continue}let s=a===e.length-1?r:``,c=o.sequences.find(function(t){let r=t.charAt(0);return r!==i.charAt(0)&&r!==s.charAt(0)||e.length===1&&DC.has(r)&&t.length>n.length})||o.sequences[0];c!==o.sequences[0]&&t.set(o,c),LC(o.children,t,c,c),i=c}}function RC(e,t,n,r){let i=[],a,o=CC(n),s=-1;for(;++s<e.length;){let n=e[s];if(typeof n==`string`){let e={value:n,attention:void 0};a&&a===SC(n)&&AC([e],!0),a=void 0,i.push(e),e.value&&(o=CC(e.value));continue}let c=t.get(n)||n.sequences[0],l=c.charAt(0),u=e[s+1],d=o,f=SC(u===void 0?r:typeof u==`string`?u:t.get(u)||u.sequences[0]),p=RC(n.children,t,c,c),m=p[0].value,h=TC(d.charCodeAt(d.length-1),m.charCodeAt(0),l);h.inside&&AC(p,!0);let g=CC(p[p.length-1].value),_=TC(f.charCodeAt(0),g.charCodeAt(g.length-1),l);_.inside&&AC(p,!1),h.outside&&d!==`
29
+ `&&d!==`\r`&&AC(i,!1),_.outside&&(a=f),i.push({value:c,attention:n},...p,{value:c,attention:n}),o=c.charAt(c.length-1)}return i}function zC(e,t,n){let r=new Map;LC(e,r,t,n);let i=(r.size>0?IC(e,r,t,n):void 0)||IC(e,new Map,t,n)||RC(e,new Map,t,n),a=``;for(let e of i)a+=e.value;return a}BC.attention=VC,BC.peek=HC;function BC(e,t,n,r){let i=n.enter(`phrasing`),a=FC(e,VC,n,n.createTracker(r)),o=a?zC([a],r.before,r.after):``;return i(),o}function VC(e,t){return{construct:`emphasis`,markers:xC(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[1]}}function HC(e,t,n){return n.options.emphasis||`*`}function UC(e,t){let n=!1;return sx(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&t_(e)&&(t.options.setext||n))}function WC(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(UC(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
30
+ `,after:`
31
+ `});return r(),t(),o+`
32
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
33
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
34
+ `,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=wC(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}GC.peek=KC;function GC(e){return e.value||``}function KC(){return`<`}qC.peek=JC;function qC(e,t,n,r){let i=yC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/^<|[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function JC(){return`!`}YC.peek=XC;function YC(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function XC(){return`!`}ZC.peek=QC;function ZC(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e);if(!e.atBreak)continue;let i;for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function QC(){return"`"}function $C(e,t){let n=t_(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][+\-.a-z]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}ew.peek=tw;function ew(e,t,n,r){let i=yC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if($C(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`),u=n.containerPhrasing(e,{before:l,after:`](`,...o.current()});l+=o.move(u),c(),l+=o.move(`](`);let d=/^<|[\0- \u007F]/.test(e.url),f=r.before.charAt(r.before.length-1),p=e.title||void 0;if(!p&&!d&&(f===`
35
+ `||f===`\r`)){let e=0;for(;e<u.length&&u.charCodeAt(e)!==93;)e+=u.charCodeAt(e)===92?2:1;u.charCodeAt(e+1)===58&&(p=``)}return!e.url&&typeof p==`string`||d?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:typeof p==`string`?` `:`)`,...o.current()}))),c(),typeof p==`string`&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(p,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function tw(e,t,n){return $C(e,n)?`<`:`[`}nw.peek=rw;function nw(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function rw(){return`[`}function iw(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function aw(e){let t=iw(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function ow(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function sw(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function cw(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?ow(n):iw(n),s=e.ordered?o===`.`?`)`:`.`:aw(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if(o!==`*`&&o!==`-`||!t||t.children&&t.children[0]||n.stack[n.stack.length-1]!==`list`||n.stack[n.stack.length-2]!==`listItem`||n.stack[n.stack.length-3]!==`list`||n.stack[n.stack.length-4]!==`listItem`||n.indexStack[n.indexStack.length-1]!==0||n.indexStack[n.indexStack.length-2]!==0||n.indexStack[n.indexStack.length-3]!==0||(c=!0),sw(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function lw(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function uw(e,t,n,r){let i=lw(n),a=n.bulletCurrent||iw(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function dw(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function fw(e,t,n,r){if(!e.children.some(function(e){return cC(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function pw(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}mw.attention=hw,mw.peek=gw;function mw(e,t,n,r){let i=n.enter(`phrasing`),a=FC(e,hw,n,n.createTracker(r)),o=a?zC([a],r.before,r.after):``;return i(),o}function hw(e,t){return{construct:`strong`,markers:pw(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function gw(e,t,n){return n.options.strong||`*`}function _w(e,t,n,r){let i=t?t.children:[],a=n.indexStack[n.indexStack.length-1];return n.safe(e.value,{...r,afterNode:i[a+1],beforeNode:i[a-1]})}function vw(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function yw(e,t,n){let r=(sw(n)+(n.options.ruleSpaces?` `:``)).repeat(vw(n));return n.options.ruleSpaces?r.slice(0,-1):r}var bw={blockquote:lC,break:pC,code:_C,definition:bC,emphasis:BC,hardBreak:pC,heading:WC,html:GC,image:qC,imageReference:YC,inlineCode:ZC,link:ew,linkReference:nw,list:cw,listItem:uw,paragraph:dw,root:fw,strong:mw,text:_w,thematicBreak:yw};function xw(){return{enter:{table:Sw,tableData:Ew,tableHeader:Ew,tableRow:ww},exit:{codeText:Dw,table:Cw,tableData:Tw,tableHeader:Tw,tableRow:Tw}}}function Sw(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[],position:void 0},e),this.data.inTable=!0}function Cw(e){this.exit(e),this.data.inTable=void 0}function ww(e){this.enter({type:`tableRow`,children:[],position:void 0},e)}function Tw(e){this.exit(e)}function Ew(e){this.enter({type:`tableCell`,children:[],position:void 0},e)}function Dw(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Ow));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Ow(e,t){return t===`|`?t:e}function kw(e){let{tableCellPadding:t,tablePipeAlign:n,stringLength:r}=e||{},i=t?` `:`|`;return{handlers:{inlineCode:d,table:a,tableCell:s,tableRow:o},join:[Aw],unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
36
+ `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}]};function a(e,t,n,r){let i=l(e,n,r),a=i[0];if(a){let t=e.align?e.align.length:0,n=-1;if(!t)for(;++n<i.length;)i[n].length>t&&(t=i[n].length);for(;a.length<t;)a.push(``)}return c(i,e.align)}function o(e,t,n,r){let i=c([u(e,n,r)]);return i.slice(0,i.indexOf(`
37
+ `))}function s(e,t,n,r){let a=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:i,after:i});return o(),a(),s}function c(e,i){return aC(e,{align:i,alignDelimiters:n,fillRows:!1,padding:t,stringLength:r})}function l(e,t,n){let{children:r}=e,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=u(r[i],t,n);return o(),a}function u(e,t,n){let{children:r}=e,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=s(r[i],e,t,n);return o(),a}function d(e,t,n){let r=bw.inlineCode(e,t,n);if(!n.stack.includes(`tableCell`))return r;let i=[],a=0,o=r.indexOf(`|`);for(;o!==-1;){let e=o;for(;e>a&&r.charCodeAt(e-1)===92;)e--;i.push(r.slice(a,o)),(o-e)%2==0&&i.push(`\\`),a=o,o=r.indexOf(`|`,o+1)}return i.push(r.slice(a)),i.join(``)}}function Aw(e,t,n,r){if(e.type===`table`&&n.type===`listItem`&&n.spread===!1&&(t.type===`definition`||t.type===`heading`&&jw(t,r)||t.type===`paragraph`||t.type===`table`))return 1}function jw(e,t){let n=!1;return sx(e,function(e){if(e.type===`break`||`value`in e&&/\r?\n|\r/.test(e.value))return n=!0,!1}),!!((!e.depth||e.depth<3)&&t_(e)&&(t.options.setext||n))}function Mw(){return{exit:{taskListCheckValueChecked:Pw,taskListCheckValueUnchecked:Pw,paragraph:Fw}}}function Nw(){return{handlers:{paragraph:Iw},join:[Lw]}}function Pw(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Fw(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start={...n.position.start}))}}this.exit(e)}function Iw(e,t,n,r){if(!t||t.type!==`listItem`||Rw(t)!==e)return bw.paragraph(e,t,n,r);let i=`[`+(t.checked?`x`:` `)+`] `,a=n.createTracker(r);return a.move(i),i+bw.paragraph(e.children.length>0?e:{type:`paragraph`,children:[{type:`text`,value:` `}]},t,n,{...r,...a.current()})}function Lw(e,t,n){if(e.type!==`definition`||n.type!==`listItem`)return;let r=Rw(n);if(r&&n.children.indexOf(e)<n.children.indexOf(r))return 0}function Rw(e){if(typeof e.checked==`boolean`)for(let t of e.children){if(t.type===`paragraph`)return t;if(t.type!==`definition`)return}}function zw(){return[bS(),KS(),ZS(),xw(),Mw()]}function Bw(e){return{extensions:[xS(),qS(e),QS(),kw(e),Nw()]}}var Vw={tokenize:tT,partial:!0},Hw={tokenize:nT,partial:!0},Uw={tokenize:rT,partial:!0},Ww={tokenize:iT,partial:!0},Gw={tokenize:aT,partial:!0},Kw={name:`wwwAutolink`,tokenize:$w,previous:oT},qw={name:`protocolAutolink`,tokenize:eT,previous:sT},Jw={name:`emailAutolink`,tokenize:Qw,previous:cT},Yw={};function Xw(){return{text:Yw}}for(var Zw=48;Zw<123;)Yw[Zw]=Jw,Zw++,Zw===58?Zw=65:Zw===91&&(Zw=97);Yw[43]=Jw,Yw[45]=Jw,Yw[46]=Jw,Yw[95]=Jw,Yw[72]=[Jw,qw],Yw[104]=[Jw,qw],Yw[87]=[Jw,Kw],Yw[119]=[Jw,Kw];function Qw(e,t,n){let r=this,i,a;return o;function o(t){return!lT(t)||!cT.call(r,r.previous)||uT(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return lT(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Gw,u,l)(t):t===45||t===95||g_(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&h_(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function $w(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!oT.call(r,r.previous)||uT(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Vw,e.attempt(Hw,e.attempt(Uw,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function eT(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&sT.call(r,r.previous)&&!uT(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(h_(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||v_(t)||S_(t)||w_(t)||C_(t)?n(t):e.attempt(Hw,e.attempt(Uw,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function tT(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function nT(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Ww,c,s)(t):t===null||S_(t)||w_(t)||t!==45&&C_(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function rT(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Ww,t,a)(o):o===null||S_(o)||w_(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function iT(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||S_(o)||w_(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||S_(e)||w_(e)?t(e):r(e)}function a(e){return h_(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):h_(t)?(e.consume(t),o):n(t)}}function aT(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return g_(e)?n(e):t(e)}}function oT(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||S_(e)}function sT(e){return!h_(e)}function cT(e){return!(e===47||lT(e))}function lT(e){return e===43||e===45||e===46||e===95||g_(e)}function uT(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var dT={tokenize:yT,partial:!0};function fT(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:gT,continuation:{tokenize:_T},exit:vT}},text:{91:{name:`gfmFootnoteCall`,tokenize:hT},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:pT,resolveTo:mT}}}}function pT(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=m_(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function mT(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function hT(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||S_(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(m_(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return S_(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function gT(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||S_(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=m_(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return S_(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),$(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function _T(e,t,n){return e.check(W_,t,e.attempt(dT,t,n))}function vT(e){e.exit(`gfmFootnoteDefinition`)}function yT(e,t,n){let r=this;return $(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function bT(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&s_(o,o.length,0,L_(s,e.slice(r+1,n),t)),s_(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),s_(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=I_(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=I_(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var xT=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){ST(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function ST(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function CT(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function wT(){return{flow:{null:{name:`table`,tokenize:TT,resolveAll:ET}}}}function TT(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124||(o=!0,a+=1),u(e)}function u(t){return t===null?n(t):Z(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Q(t)?$(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||S_(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Q(t)?$(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Q(t)?$(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Z(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Q(t)?$(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Z(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Z(n)?(e.exit(`tableRow`),t(n)):Q(n)?$(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||S_(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function ET(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new xT;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(OT(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=DT(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=DT(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=DT(f,t,o,i,n,d)):(o[0]=o[1],d=DT(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&OT(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=CT(t.events,n))}return e}function DT(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},kT(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=kT(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=kT(t.events,n[2]),a=kT(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},kT(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function OT(e,t,n,r,i){let a=[],o=kT(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function kT(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var AT={name:`tasklistCheck`,tokenize:MT};function jT(){return{text:{91:AT}}}function MT(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return S_(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Z(r)?t(r):Q(r)?e.check({tokenize:NT},t,n)(r):n(r)}}function NT(e,t,n){return $(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function PT(e){return u_([Xw(),fT(),bT(e),wT(),jT()])}var FT={};function IT(e){let t=this,n=e||FT,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(PT(n)),a.push(zw()),o.push(Bw(n))}var LT=(0,K.createContext)(()=>void 0),RT=()=>(0,K.use)(LT),zT=new Set([``,`#`,`no.`,`step`]),BT=`Term|Means`,VT=e=>e.type===`text`?e.value:e.type===`element`?e.children.map(e=>VT(e)).join(``):``,HT=e=>((e?.children.find(e=>e.type===`element`&&e.tagName===`thead`))?.children.find(e=>e.type===`element`&&e.tagName===`tr`)?.children??[]).filter(e=>e.type===`element`&&e.tagName===`th`),UT=e=>{let[t]=HT(e);return t!==void 0&&zT.has(VT(t).trim().toLowerCase())},WT=e=>HT(e).map(e=>VT(e).trim()).join(`|`)===BT,GT=({node:e,children:t})=>(0,q.jsx)(`div`,{className:`w-full markdown-table-scroll overflow-x-auto`,children:(0,q.jsx)(`table`,{className:`markdown-table`,"data-index":UT(e),children:t})}),KT=({node:e,children:t})=>WT(e)?(0,q.jsx)(`div`,{className:`my-2 w-full markdown-table-scroll`,children:(0,q.jsxs)(Sf,{children:[(0,q.jsxs)(Cf,{size:`sm`,children:[(0,q.jsx)(Zn,{className:`size-3 shrink-0 transition-transform duration-150 ease-out group-data-panel-open/trigger:rotate-90 motion-reduce:transition-none`}),`Terms`]}),(0,q.jsx)(Tf,{children:(0,q.jsx)(GT,{node:e,children:t})})]})}):(0,q.jsx)(GT,{node:e,children:t}),qT=e=>{let t=e?.properties.align;return typeof t==`string`?t:void 0},JT=({node:e,children:t})=>(0,q.jsx)(`th`,{"data-align":qT(e),children:t}),YT=({node:e,children:t})=>(0,q.jsx)(`td`,{"data-align":qT(e),children:t}),XT=/^[A-Za-z\d](?:[A-Za-z\d-]{0,38})$/u,ZT=/^[\w.-]{1,100}$/u,QT=/^[1-9]\d{0,9}$/u,$T=50,eE=/^https:\/\/github\.com\/(?<owner>[^/?#]+)\/(?<repo>[^/?#]+)\/pull\/(?<number>\d+)(?:\/(?:files|commits|checks|changes)(?:\/[^?#]*)?)?\/?(?:[?#].*)?$/u,tE=wt({owner:re(k(),le(XT)),repo:re(k(),le(ZT),yn(e=>e!==`.`&&e!==`..`)),number:re(k(),le(QT))});wt({pulls:re(Cn(tE),ye(1),hn($T))}),wt({state:St([`OPEN`,`CLOSED`,`MERGED`]),isDraft:Je(),reviewDecision:r(k(),``),title:k(),number:R()});var nE=e=>{let t=eE.exec(e)?.groups,n=b(tE,t);return n.success?n.output:null},rE=({owner:e,repo:t,number:n})=>`${e.toLowerCase()}/${t.toLowerCase()}#${n}`,iE=e=>e.state===`MERGED`?`merged`:e.state===`CLOSED`?`closed`:e.isDraft?`draft`:`open`,aE={merged:`Merged`,open:`Open`,draft:`Draft`,closed:`Closed`},oE={APPROVED:`approved`,CHANGES_REQUESTED:`changes requested`,REVIEW_REQUIRED:`review required`},sE={APPROVED:`approved`,CHANGES_REQUESTED:`changes`},cE=e=>iE(e)===`open`?sE[e.reviewDecision]??null:null,lE=e=>{let t=iE(e),n=oE[e.reviewDecision];return(t===`open`||t===`draft`)&&n!==void 0?`${aE[t]} · ${n}`:aE[t]},uE=h({method:`POST`}).handler(z(`706f3fc4ef5a13d24ef9f91b9bbd2f83df0422ecf22fdde6152d7f137e07eabf`)),dE=6e4,fE={status:`loading`},pE=new Map,mE=new Set,hE=new Map,gE={isScheduled:!1},_E=()=>{mE.forEach(e=>{e()})},vE=(e,t)=>{let n=Date.now();e.forEach(e=>{pE.set(e,{status:`done`,at:n,pull:t[e]??null})}),_E()},yE=async()=>{gE.isScheduled=!1;let e=[...hE.entries()];hE.clear();let t=e.map(([e])=>e);try{vE(t,await uE({data:{pulls:e.map(([,e])=>e)}}))}catch{vE(t,{})}},bE=e=>e!==void 0&&(e.status===`loading`||Date.now()-e.at<dE),xE=e=>{let t=rE(e);bE(pE.get(t))||(pE.set(t,pE.get(t)??fE),hE.set(t,e),gE.isScheduled||(gE.isScheduled=!0,setTimeout(()=>{yE()},0)))},SE=e=>(mE.add(e),()=>{mE.delete(e)}),CE=e=>pE.get(e),wE=()=>void 0,TE=e=>{let t=nE(e),n=t===null?``:rE(t),r=(0,K.useSyncExternalStore)(SE,()=>n===``?void 0:CE(n),wE);return(0,K.useEffect)(()=>{let t=nE(e);t!==null&&xE(t)},[e]),r},EE={merged:`M5.45 5.154A4.25 4.25 0 0 0 9.25 7.5h1.378a2.251 2.251 0 1 1 0 1.5H9.25A5.734 5.734 0 0 1 5 7.123v3.505a2.25 2.25 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.95-.218ZM4.25 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm8.5-4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM5 3.25a.75.75 0 1 0 0 .005V3.25Z`,open:`M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z`,draft:`M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 14a2.25 2.25 0 1 1 0-4.5 2.25 2.25 0 0 1 0 4.5ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM14 7.5a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm0-4.25a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z`,closed:`M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 5.5a.75.75 0 0 1 .75.75v3.378a2.251 2.251 0 1 1-1.5 0V7.25a.75.75 0 0 1 .75-.75Zm-2.03-5.273a.75.75 0 0 1 1.06 0l.97.97.97-.97a.748.748 0 0 1 1.265.332.75.75 0 0 1-.205.729l-.97.97.97.97a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-.97-.97-.97.97a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l.97-.97-.97-.97a.75.75 0 0 1 0-1.06ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z`},DE={merged:`text-pr-merged`,open:`text-pr-open`,draft:`text-pr-draft`,closed:`text-pr-closed`},OE={approved:`M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z`,changes:`M1 1.75C1 .784 1.784 0 2.75 0h7.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16H2.75A1.75 1.75 0 0 1 1 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25V4.664a.25.25 0 0 0-.073-.177l-2.914-2.914a.25.25 0 0 0-.177-.073ZM8 3.25a.75.75 0 0 1 .75.75v1.5h1.5a.75.75 0 0 1 0 1.5h-1.5v1.5a.75.75 0 0 1-1.5 0V7h-1.5a.75.75 0 0 1 0-1.5h1.5V4A.75.75 0 0 1 8 3.25Zm-3 8a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Z`},kE={approved:`text-pr-open`,changes:`text-pr-closed`},AE=({review:e})=>e===null?null:(0,q.jsx)(`svg`,{"aria-hidden":!0,className:`me-1 inline-block size-3.5 fill-current align-text-bottom ${kE[e]}`,"data-review":e,viewBox:`0 0 16 16`,children:(0,q.jsx)(`path`,{d:OE[e]})}),jE=e=>e.type===`text`?e.value:e.type===`element`?e.children.map(e=>jE(e)).join(``):``,ME=(e,t,n)=>e===t||e.replace(/^#/u,``)===String(n),NE=(e,t)=>RegExp(`(?:^|\\D)${t}(?:\\D|$)`,`u`).test(e),PE=({kind:e,label:t})=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`svg`,{"aria-hidden":!0,className:`me-1 inline-block size-4 fill-current align-text-bottom ${DE[e]}`,viewBox:`0 0 16 16`,children:(0,q.jsx)(`path`,{d:EE[e]})}),(0,q.jsxs)(`span`,{className:`sr-only`,children:[t,`: `]})]}),FE=({pull:e,text:t,href:n,children:r})=>{let i=(0,q.jsxs)(`span`,{className:`text-subtle`,children:[`#`,e.number]});return ME(t,n,e.number)?(0,q.jsxs)(q.Fragment,{children:[e.title,` `,i]}):NE(t,e.number)?r:(0,q.jsxs)(q.Fragment,{children:[r,` `,i]})},IE=({node:e,href:t,children:n,...r})=>{let i=TE(t),a=i?.status===`done`?i.pull:null;if(a===null)return(0,q.jsxs)(`a`,{href:t,...r,children:[i?.status===`loading`?(0,q.jsx)(`span`,{"aria-hidden":!0,className:`me-1 inline-block size-4 align-text-bottom`}):null,n]});let o=lE(a);return(0,q.jsx)(Dn,{label:o,children:(0,q.jsxs)(`a`,{href:t,...r,children:[(0,q.jsx)(PE,{kind:iE(a),label:o}),(0,q.jsx)(AE,{review:cE(a)}),(0,q.jsx)(FE,{href:t,pull:a,text:e===void 0?``:jE(e),children:n})]})})},LE=({node:e,href:t,children:n,...r})=>typeof t==`string`&&nE(t)!==null?(0,q.jsx)(IE,{href:t,node:e,...r,children:n}):(0,q.jsx)(`a`,{href:t,...r,children:n}),RE=`[data-gallery-scope]`,zE={a:LE,img:({src:e,alt:t})=>{let n=RT(),r=typeof e==`string`?e:``;return(0,q.jsx)(`button`,{className:`my-1 block cursor-zoom-in rounded-sm hover-outline`,onClick:e=>{let t=[...(e.currentTarget.closest(RE)??document.body).querySelectorAll(`button img`)].filter(e=>e instanceof HTMLImageElement),i=t.map(e=>[{src:e.src,label:e.alt}]);n(i,Math.max(0,t.findIndex(e=>e.getAttribute(`src`)===r)))},type:`button`,children:(0,q.jsx)(`img`,{alt:t??`Pasted screenshot`,className:`m-0 max-h-50 rounded-sm`,src:r})})},table:KT,th:JT,td:YT},BE=({text:e,className:t})=>(0,q.jsx)(`div`,{className:G(`prose max-w-none prose-code-chips prose-links text-foreground prose-tokens prose-p:my-2 prose-code:before:content-none prose-code:after:content-none prose-pre:contain-inline-size prose-ul:my-2`,t),children:(0,q.jsx)(sS,{components:zE,remarkPlugins:[IT],children:e})}),VE=e=>new Date(e).toLocaleString([],{day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}),HE=(e,t)=>{if(e===void 0)return`The agent picked up your comment`;let n=qu(e,t);return n===`now`?`Seen just now`:/\d$/u.test(n)?`Seen ${n}`:`Seen ${n} ago`},UE=({comment:e,live:t})=>{let n=Vu();return jp(t,e)?(0,q.jsx)(Dn,{label:HE(e.seenAt,n),children:(0,q.jsxs)(`span`,{className:`flex animate-fade-in items-center gap-1 text-xs text-subtle`,children:[(0,q.jsx)(Un,{"aria-hidden":!0,className:`size-3`}),`Seen`]})}):(0,q.jsxs)(`span`,{className:`flex animate-fade-in items-center gap-1 text-xs text-subtle`,children:[(0,q.jsx)(Gn,{"aria-hidden":!0,className:`size-3`}),`Sent`]})},WE=({isMine:e})=>(0,q.jsx)(`span`,{"aria-hidden":!0,className:G(`grid size-4 shrink-0 place-items-center rounded-full`,e?`bg-secondary text-muted-foreground`:`bg-claude/20 text-claude`),children:e?(0,q.jsx)(Ti,{className:`size-2.5`,strokeWidth:2.5}):(0,q.jsx)(si,{className:`size-2.5`,strokeWidth:2.5})}),GE=({at:e})=>{let t=Vu();return e===``?null:(0,q.jsx)(Dn,{label:VE(e),children:(0,q.jsx)(`time`,{className:`text-subtle`,dateTime:e,children:qu(e,t)})})},KE=({comment:e,live:t,isLatest:n,isLarge:r=!1})=>{let i=e.author===`you`;return(0,q.jsxs)(`div`,{className:`grid animate-enter gap-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,q.jsx)(WE,{isMine:i}),(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:i?`You`:`Agent`}),(0,q.jsx)(GE,{at:e.at})]}),(0,q.jsx)(BE,{className:G(`ps-5.5 wrap-anywhere`,r?`text-base/6`:`text-sm/6`),text:e.body}),i&&n?(0,q.jsx)(`div`,{className:`ps-5.5`,children:(0,q.jsx)(UE,{comment:e,live:t})}):null]})},qE=({doing:e})=>e===void 0?null:(0,q.jsxs)(`div`,{className:`flex animate-enter items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,q.jsx)(WE,{isMine:!1}),(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.body}),(0,q.jsx)(GE,{at:e.at})]}),JE=3,YE=e=>e.length<=JE?{first:e,middle:[],last:[]}:{first:e.slice(0,1),middle:e.slice(1,-2),last:e.slice(-2)},XE=({count:e,children:t})=>{let[n,r]=(0,K.useState)(!1);return e===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{"aria-expanded":n,className:`flex w-full items-center gap-2.5 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{r(!n)},type:`button`,children:[(0,q.jsx)(`span`,{className:`h-px flex-1 bg-border`}),n?`Fewer messages`:`${String(e)} more ${e===1?`message`:`messages`}`,(0,q.jsx)(`span`,{className:`h-px flex-1 bg-border`})]}),(0,q.jsx)(`div`,{className:`fold`,"data-open":n?``:void 0,inert:!n,children:(0,q.jsx)(`div`,{className:`grid gap-3`,children:t})})]})},ZE=3,QE=({comment:e,props:t,isLatest:n})=>(0,q.jsx)(wm,{isNew:t.actions.isNew(e)&&!t.actions.isNew(t.thread.root),onEntered:()=>{t.actions.markKnown([e])},children:(0,q.jsx)(KE,{comment:e,isLatest:n,live:t.live})}),$E=e=>{let t=[e.thread.root,...e.thread.replies],{first:n,middle:r,last:i}=YE(t),a=t.at(-1),o=t=>(0,q.jsx)(QE,{comment:t,isLatest:t===a,props:e},kp(t));return(0,q.jsxs)(q.Fragment,{children:[n.map(e=>o(e)),(0,q.jsx)(XE,{count:r.length,children:r.map(e=>o(e))}),i.map(e=>o(e))]})},eD=({code:e})=>(0,q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,q.jsx)(`span`,{className:`text-xs text-subtle`,children:`Before the change`}),(0,q.jsx)(`pre`,{className:`m-0 overflow-hidden rounded-md bg-background px-2.5 py-1.5 font-mono text-xs text-ellipsis whitespace-pre text-muted-foreground`,children:e.split(`
38
+ `).slice(0,ZE).join(`
39
+ `)})]}),tD=e=>{let{root:t,replies:n,isOutdated:r}=e.thread,i=Km(t,n);return(0,q.jsxs)(`div`,{className:`grid gap-3 px-3 pt-2.5 pb-3`,children:[r&&t.code!==``?(0,q.jsx)(eD,{code:t.code}):null,(0,q.jsx)($E,{...e}),i===`waiting`?(0,q.jsx)(qE,{doing:t.doing}):null,(0,q.jsx)(dh,{canSettle:i!==`waiting`&&i!==`filed`,props:e})]})},nD=({isAsked:e,children:t})=>(0,q.jsx)(`div`,{className:G(`sticky inset-s-3 my-2 grid thread-width grid-cols-1 overflow-hidden rounded-lg border bg-wash font-sans text-sm whitespace-normal`,e?`border-stand-asked/45`:`border-border`),children:t}),rD=e=>{let{root:t,replies:n}=e.thread,r=n.length+1;return(0,q.jsx)(nD,{isAsked:!1,children:(0,q.jsxs)(Sf,{children:[(0,q.jsx)(`div`,{className:`flex h-8 items-center px-3`,children:(0,q.jsxs)(Cf,{size:`sm`,children:[(0,q.jsx)(qm,{stand:`settled`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:t.body.split(`
40
+ `)[0]}),(0,q.jsx)(`span`,{className:`shrink-0 text-subtle tabular-nums`,children:`${String(r)} ${r===1?`message`:`messages`}`}),(0,q.jsx)(Zn,{className:`size-3 shrink-0 transition-transform group-data-panel-open/trigger:rotate-90`})]})}),(0,q.jsx)(Tf,{children:(0,q.jsx)(`div`,{className:`border-t border-border`,children:(0,q.jsx)(tD,{...e})})})]})})},iD=e=>{let t=Km(e.thread.root,e.thread.replies);return(0,q.jsxs)(nD,{isAsked:t===`asked`,children:[(0,q.jsxs)(Jm,{isOutdated:e.thread.isOutdated,stand:t,children:[(0,q.jsx)(Xm,{here:e.settledHere}),e.headAction]}),(0,q.jsx)(tD,{...e})]})},aD=(0,K.createContext)(null),oD=e=>{let t=(0,K.use)(aD);return n=>{let r=e.get(n)?.settled??0;return r===0||t===null?null:{count:r,handleOpen:()=>{t(n)}}}},sD=e=>`${String(e)} ${e===1?`message`:`messages`}`,cD=e=>e.replies.length+1,lD=({children:e,count:t})=>(0,q.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-1.5 border-b border-border px-3 max-md:h-12 max-md:ps-5`,children:[e,(0,q.jsx)(`span`,{className:`flex-1`}),(0,q.jsx)(`span`,{className:`shrink-0 text-xs text-subtle tabular-nums`,children:sD(t)})]}),uD=({threads:e,line:t,onPick:n,title:r})=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(lD,{count:e.reduce((e,t)=>e+cD(t),0),children:[(0,q.jsx)(Ym,{}),r(`${String(e.length)} settled on line ${String(t??``)}`)]}),(0,q.jsx)(`div`,{className:`grid grid-cols-1 p-1`,children:e.map(e=>(0,q.jsxs)(`button`,{className:`flex h-8 min-w-0 items-center gap-2 rounded-md px-2 text-start hover:bg-row-hover focus-visible:bg-row-hover max-md:h-14 max-md:px-4 max-md:text-base`,onClick:()=>{n(e)},type:`button`,children:[(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.root.body.split(`
41
+ `)[0]}),(0,q.jsx)(`span`,{className:`shrink-0 text-xs text-subtle tabular-nums`,children:cD(e)}),(0,q.jsx)(Zn,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-subtle`})]},kp(e.root)))})]}),dD=({thread:e,onBack:t,title:n,...r})=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(lD,{count:cD(e),children:[(0,q.jsx)(`button`,{"aria-label":`Back to the settled list`,className:`-ms-1.5 grid size-6 place-items-center rounded-md text-subtle hover:bg-row-hover hover:text-foreground max-md:size-11`,onClick:t,type:`button`,children:(0,q.jsx)(Yn,{"aria-hidden":!0,className:`size-3.5 max-md:size-5`})}),(0,q.jsx)(Ym,{}),n(`Settled`)]}),(0,q.jsx)(tD,{...r,thread:e})]}),fD=({props:e,title:t})=>{let[n,r]=(0,K.useState)(null),i=e.threads.find(e=>e.root.id===n),{live:a,actions:o}=e,s=i??(e.threads.length===1?e.threads[0]:void 0);return s===void 0?(0,q.jsx)(uD,{line:e.line?.new??e.line?.old??null,onPick:e=>{r(e.root.id)},threads:e.threads,title:t}):(0,q.jsx)(dD,{actions:o,live:a,onBack:()=>{e.threads.length===1&&e.onClose(),r(null)},thread:s,title:t})},pD=e=>(0,q.jsx)(_m,{children:e}),mD=e=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`truncate text-base font-medium`,children:e}),(0,q.jsx)(tc,{children:e})]}),hD=e=>{let t=Sm(),n=e.row!==null&&e.threads.length>0,r=String(e.row),i=t=>{t||e.onClose()};return t?(0,q.jsx)($s,{onOpenChange:i,open:n,children:(0,q.jsx)(ic,{variant:`sheet`,children:(0,q.jsx)(oc,{children:(0,q.jsx)(fD,{props:e,title:mD},r)})})}):(0,q.jsx)(gm,{onOpenChange:i,open:n,children:(0,q.jsx)(vm,{anchor:()=>document.querySelector(`[data-review-diff] [data-review-row="${r}"] [data-row-lead]`),children:(0,q.jsx)(`div`,{className:`grid settled-pop overflow-y-auto`,children:(0,q.jsx)(fD,{props:e,title:pD},r)})})})},gD=({settled:e,rows:t,threads:n,children:r,...i})=>{let a=e?.openRow??null;return(0,q.jsxs)(aD,{value:e?.onOpen??null,children:[r,e===null?null:(0,q.jsx)(hD,{...i,line:a===null?null:t[a]??null,onClose:()=>{e.onOpen(null)},row:a,threads:a===null?[]:n.get(a)??[]})]})},_D={ctx:``,add:`+`,del:`−`,gap:``},vD=e=>t=>{t.preventDefault(),(t.metaKey||t.ctrlKey)&&vc(e,yc(t.currentTarget))},yD=e=>t=>{t.preventDefault(),vc(e,yc(t.currentTarget))},bD=({line:e,href:t})=>t===null||e===null?e??``:(0,q.jsx)(`a`,{className:`cursor-text`,"data-line-link":!0,draggable:!1,href:t,onClick:vD(t),tabIndex:-1,title:`⌘-click to open in your editor`,children:e}),xD=({href:e})=>e===null?null:(0,q.jsx)(`a`,{"aria-label":`Open this line in your editor (e)`,className:`absolute inset-0 grid place-items-center text-subtle opacity-0 transition duration-150 ease-out row-bg group-hover/row:opacity-100 hover:text-foreground focus-visible:opacity-100 max-md:hidden`,"data-editor-link":!0,href:e,onClick:yD(e),title:`Open in editor (e)`,children:(0,q.jsx)(di,{className:`size-3.5`})}),SD=e=>`${String(e)} settled ${e===1?`thread`:`threads`} on this line`,CD=({settled:e,onOpen:t})=>{let n=SD(e);return t===null?(0,q.jsx)(sd,{said:n,stand:`settled`}):(0,q.jsxs)(E,{children:[(0,q.jsxs)(ke,{render:(0,q.jsx)(`button`,{"aria-label":`Open the ${n}`,className:G(`relative stand-slot press`,rd.settled),"data-settled-mark":!0,onClick:t,type:`button`}),children:[(0,q.jsx)(od,{stand:`settled`}),e>1?(0,q.jsx)(`span`,{className:`absolute -inset-e-1.5 -top-1 text-2xs font-medium tabular-nums`,children:e}):null]}),(0,q.jsx)(Ce,{children:n})]})},wD=({quiet:e})=>{if(e.place===`mid`||e.place===`end`)return(0,q.jsx)(`span`,{"aria-hidden":!0,className:`diff-quiet-slot`,children:(0,q.jsx)(`span`,{className:G(`w-px flex-1 bg-input`,e.place===`end`&&`mb-1.5`)})});let t=e.layer===null?e.title:`Layer ${e.layer} explains these lines: ${e.title}`;return(0,q.jsxs)(`span`,{className:G(`diff-quiet-slot`,e.place===`one`&&`justify-center`),children:[(0,q.jsx)(Dn,{label:t,children:(0,q.jsx)(`span`,{"aria-label":t,className:G(`text-2xs text-subtle tabular-nums`,e.place===`top`&&`pt-0.5`),"data-quiet-layer":!0,children:e.layer===null?`·`:`L${e.layer}`})}),e.place===`top`?(0,q.jsx)(`span`,{"aria-hidden":!0,className:`mt-1 w-px flex-1 bg-input`}):null]})},TD=({mark:e,onOpen:t})=>e===void 0?null:e.stand===`settled`?(0,q.jsx)(CD,{onOpen:t,settled:e.settled}):(0,q.jsx)(sd,{stand:e.stand}),ED=({settled:e,onOpen:t})=>t===null?null:(0,q.jsx)(`button`,{"aria-label":`Open the ${SD(e)}`,className:`absolute inset-0 md:hidden`,onClick:t,type:`button`}),DD=({row:e,index:t,editorHref:n,mark:r})=>{let i=(0,K.use)(aD),a=i===null||r?.stand!==`settled`||r.settled===0?null:()=>{i(t)},o=r?.settled??0;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:G(`diff-sticky diff-at-lead grid justify-items-center select-none`,o>1?`z-2`:`z-1`),"data-row-lead":!0,children:(0,q.jsx)(TD,{mark:r,onOpen:a})}),(0,q.jsxs)(`span`,{className:`diff-sticky diff-at-old pe-2 text-end text-subtle tabular-nums select-none`,children:[(0,q.jsx)(bD,{href:n,line:e.old}),(0,q.jsx)(ED,{onOpen:a,settled:o})]}),(0,q.jsxs)(`span`,{className:`diff-sticky diff-at-new pe-2 text-end text-subtle tabular-nums select-none`,children:[(0,q.jsx)(bD,{href:n,line:e.new}),(0,q.jsx)(ED,{onOpen:a,settled:o}),e.quiet===void 0?null:(0,q.jsx)(wD,{quiet:e.quiet})]}),(0,q.jsxs)(`span`,{className:G(`diff-sticky diff-at-sign text-center select-none`,e.op===`del`&&`text-sign-del`,e.op===`add`&&`text-sign-add`),children:[_D[e.op],(0,q.jsx)(xD,{href:n})]})]})},OD=e=>{(0,K.useEffect)(()=>{let t=globalThis.visualViewport;if(!e||t===null)return()=>{};let n=document.documentElement,r=()=>{let e=Math.max(0,window.innerHeight-t.height-t.offsetTop);n.style.setProperty(`--kb`,`${String(e)}px`)};return r(),t.addEventListener(`resize`,r),t.addEventListener(`scroll`,r),()=>{t.removeEventListener(`resize`,r),t.removeEventListener(`scroll`,r),n.style.removeProperty(`--kb`)}},[e])},kD=e=>{if(e==null)return null;let t=Rp(e);return t.start===t.end?`Line ${String(t.start)}`:`Lines ${String(t.start)}–${String(t.end)}`},AD=({selection:e})=>(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[kD(e.lines)===null?null:(0,q.jsx)(`span`,{className:`inline-flex h-5.5 items-center rounded-full bg-accent/24 px-2 font-mono text-xs text-claude`,children:kD(e.lines)}),(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.path?.split(`/`).at(-1)}),(0,q.jsx)(`button`,{"aria-label":`Cancel comment`,className:`ms-auto grid size-11 shrink-0 press place-items-center`,onClick:e.handleCancel,type:`button`,children:(0,q.jsx)(`span`,{className:`grid size-7.5 place-items-center rounded-full bg-foreground/8 text-muted-foreground`,children:(0,q.jsx)(Di,{"aria-hidden":!0,className:`size-3.5`,strokeWidth:2.25})})})]}),jD=({selection:e})=>{let t=Sm();OD(t);let n={draftKey:`new:${e.path??``}`,isFocused:!0,onCancel:e.handleCancel,onSubmit:e.handlePost,placeholder:`Comment on these lines`,submitLabel:`Comment`};return t?(0,Tl.createPortal)((0,q.jsxs)(`div`,{className:`phone-composer grid gap-0.5 py-1.5 ps-4 pe-1.5 glass`,children:[(0,q.jsx)(AD,{selection:e}),(0,q.jsx)(Um,{...n,look:`phone`})]}),document.body):(0,q.jsx)(`div`,{className:`py-2`,children:(0,q.jsx)(`div`,{className:`sticky inset-s-3 thread-width rounded-lg border border-border bg-wash p-3`,children:(0,q.jsx)(Um,{...n})})})},MD=({start:e,end:t})=>e===null||t===null?``:e===t?`Line ${String(e)}`:`Lines ${String(e)}–${String(t)}`,ND=({props:e,onNext:t,isNextFilled:n})=>{let{root:r,replies:i}=e.thread,a=Km(r,i);return(0,q.jsxs)(`div`,{className:`relative flex shrink-0 items-start gap-2 ps-5 pe-2 pt-4`,"data-slot":`dialog-header`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-s-1/2 top-2 h-1.25 w-9 -translate-x-1/2 rounded-full bg-foreground/28`}),(0,q.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-0.5 py-1.5`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-base`,children:[(0,q.jsx)(qm,{stand:a}),(0,q.jsx)(`span`,{className:`font-mono text-sm text-muted-foreground`,children:MD(r)})]}),(0,q.jsx)(`span`,{className:`truncate font-mono text-sm text-muted-foreground`,children:r.path?.split(`/`).at(-1)??``})]}),(0,q.jsx)(tc,{children:`${Wm[a]}, ${MD(r)}`}),t===void 0?null:(0,q.jsx)(`button`,{className:G(`my-1.5 h-8 shrink-0 press rounded-full px-3.5 text-sm font-medium`,n?`bg-accent text-accent-foreground`:`bg-foreground/10 text-foreground`),onClick:t,type:`button`,children:`Next ›`}),(0,q.jsx)(ec,{render:(0,q.jsx)(`button`,{"aria-label":`Close`,className:`grid size-11 press place-items-center`,type:`button`}),children:(0,q.jsx)(`span`,{className:`grid size-8 place-items-center rounded-full bg-foreground/10 text-foreground`,children:(0,q.jsx)(Di,{"aria-hidden":!0,className:`size-4`,strokeWidth:2.25})})})]})},PD=({props:e,isReplying:t,onReply:n,onNext:r,canSettle:i})=>{let{root:a,replies:o}=e.thread,s=Km(a,o);return(0,q.jsxs)(`div`,{className:`flex shrink-0 items-end gap-1.5 px-2.5 pt-1.5 pb-2.5`,children:[(i??(s===`answered`||s===`asked`))&&!t?(0,q.jsxs)(`button`,{className:`flex h-12 shrink-0 press items-center gap-1.5 rounded-full border border-foreground/12 bg-foreground/6 px-4 text-base font-medium`,onClick:()=>{e.actions.handleResolve(a,!0),r?.()},type:`button`,children:[(0,q.jsx)(Gn,{"aria-hidden":!0,className:`size-4`,strokeWidth:2.5}),`Settle`]}):null,(0,q.jsx)(`div`,{className:`min-w-0 flex-1 rounded-3xl border border-foreground/9 bg-background ps-4 pe-1`,children:t?(0,q.jsx)(Um,{draftKey:`reply:${a.id}`,isFocused:!0,look:`phone`,onCancel:()=>{n(!1)},onSubmit:async t=>{await e.actions.handleReply(a,t),n(!1)},placeholder:`Reply`,submitLabel:`Reply`}):(0,q.jsx)(`button`,{className:`flex h-11 w-full items-center text-start text-base text-subtle`,onClick:()=>{n(!0)},type:`button`,children:`Reply…`})})]})},FD=({props:e,isOpen:t,isReplying:n,onClose:r,onReply:i,onNext:a,canSettle:o})=>{let{root:s,replies:c}=e.thread,l=[s,...c],u=Km(s,c);return OD(t),(0,q.jsx)($s,{onOpenChange:e=>{e||r()},open:t,children:(0,q.jsxs)(ic,{variant:`sheet`,children:[(0,q.jsx)(ND,{isNextFilled:o===!1,onNext:a,props:e}),(0,q.jsx)(oc,{children:(0,q.jsxs)(`div`,{className:`grid gap-4 px-5 pt-1 pb-3`,children:[l.map(t=>(0,q.jsx)(KE,{comment:t,isLarge:!0,isLatest:t===l.at(-1),live:e.live},t.id)),u===`waiting`?(0,q.jsx)(qE,{doing:s.doing}):null,(0,q.jsx)(sh,{isLarge:!0,props:e})]})}),(0,q.jsx)(PD,{canSettle:o,isReplying:n,onNext:a,onReply:i,props:e})]})})},ID=e=>{let[t,n]=(0,K.useState)(!1),[r,i]=(0,K.useState)(!1),a=(0,K.useRef)(null),{root:o,replies:s}=e.thread,c=Km(o,s),l=s.at(-1)??o,u=s.length+1,d=e=>{e&&a.current?.focus(),i(e),n(!0)};return(0,q.jsxs)(`div`,{className:G(`sticky inset-s-3 my-2 thread-width overflow-hidden rounded-2xl border bg-wash font-sans whitespace-normal`,c===`asked`?`border-stand-asked/45`:`border-border`),children:[(0,q.jsxs)(`button`,{className:`grid w-full gap-1 px-3.5 pt-2.5 text-start`,onClick:()=>{d(!1)},type:`button`,children:[(0,q.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5 text-sm`,children:[(0,q.jsx)(qm,{stand:c}),(0,q.jsx)(`span`,{className:`flex-1`}),(0,q.jsx)(`span`,{className:`text-subtle tabular-nums`,children:`${String(u)} ${u===1?`message`:`messages`}`})]}),(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm text-muted-foreground`,children:[(0,q.jsx)(WE,{isMine:l.author===`you`}),l.author===`you`?`You`:`Agent`]}),(0,q.jsx)(`span`,{className:`line-clamp-3 ps-5.5 text-base/6 wrap-anywhere text-foreground`,children:l.body})]}),e.settledHere===null||e.settledHere===void 0?null:(0,q.jsx)(`div`,{className:`flex px-3.5 pt-2 text-sm`,children:(0,q.jsx)(Xm,{here:e.settledHere})}),(0,q.jsx)(`div`,{className:`p-2.5`,children:(0,q.jsx)(`button`,{className:`flex h-11 w-full press items-center rounded-full border border-border bg-background px-4 text-base text-subtle`,onClick:()=>{d(!0)},type:`button`,children:`Reply…`})}),(0,q.jsx)(`input`,{"aria-hidden":!0,className:`sr-only`,ref:a,tabIndex:-1}),(0,q.jsx)(FD,{isOpen:t,isReplying:r,onClose:()=>{n(!1),i(!1)},onReply:i,props:e})]})},LD=(e,t)=>e.thread.root.resolved===!0?(0,q.jsx)(rD,{...e}):t?(0,q.jsx)(ID,{...e}):(0,q.jsx)(iD,{...e}),RD=e=>{let t=Sm();return(0,q.jsx)(wm,{isNew:e.actions.isNew(e.thread.root),onEntered:()=>{e.actions.markKnown([e.thread.root,...e.thread.replies])},children:LD(e,t)})},zD=(e,t)=>e!==null&&t>=Math.min(...e)&&t<=Math.max(...e),BD=({row:e,index:t,selection:n,children:r,isCursor:i=!1,isWrapped:a=!1,isLeadTaken:o=!1})=>{let s=zD(n.selected,t);return(0,q.jsxs)(`div`,{className:G(`group/row diff-row`,i&&`review-cursor`),"data-op":e.op,"data-quiet":e.quiet!==void 0||void 0,"data-review-row":t,"data-selected":s,onMouseEnter:()=>{n.handleMove(t)},children:[(0,q.jsx)(`button`,{"aria-label":`Comment on this line. Drag to select a range.`,className:G(`sticky z-2 col-start-1 row-start-1 -me-5 size-5 self-center rounded-sm bg-accent text-sm/5 font-semibold text-accent-foreground opacity-0 transition duration-150 ease-out group-hover/row:opacity-100 hover:scale-110 focus-visible:opacity-100 max-md:hidden`,o?`inset-s-6`:`inset-s-0.5`,s&&`opacity-100`),onMouseDown:e=>{e.preventDefault(),n.handleStart(t)},type:`button`,children:`+`}),r,(0,q.jsx)(`span`,{className:G(`pe-4 pre-tab`,a?`whitespace-pre-wrap`:`whitespace-pre`),dangerouslySetInnerHTML:{__html:e.html},"data-code":!0})]})},VD=({row:e,index:t,selection:n,isCursor:r,isWrapped:i,editorHref:a,mark:o})=>e.op===`gap`&&e.fold!==void 0?(0,q.jsx)(Kp,{fold:e.fold,index:t,isCursor:r}):e.others===void 0?e.op===`gap`?(0,q.jsx)(`div`,{"aria-hidden":!0,className:`border-y border-border bg-wash px-3 py-0.5 text-subtle`,children:`⋯`}):(0,q.jsx)(BD,{index:t,isCursor:r,isLeadTaken:o?.stand===`settled`,isWrapped:i,row:e,selection:n,children:(0,q.jsx)(DD,{editorHref:a,index:t,mark:o,row:e})}):(0,q.jsx)(Yp,{index:t,isCursor:r,row:{...e,others:e.others}}),HD=(e,t)=>typeof e==`number`&&t.root.start!==null&&t.root.end!==null&&e>=t.root.start&&e<=t.root.end,UD=({threads:e,cursorLine:t,...n})=>e.map(e=>(0,q.jsx)(RD,{isCurrent:HD(t,e),thread:e,...n},kp(e.root))),WD=({index:e,selection:t,threads:n,hasRoom:r=!0,...i})=>(0,q.jsxs)(q.Fragment,{children:[r?(0,q.jsx)(Cm,{isOpen:t.composerAt===e,children:t.composerAt===e?(0,q.jsx)(jD,{selection:t}):null}):null,(0,q.jsx)(UD,{threads:n,...i})]}),GD=({threads:e,...t})=>e.length>0?(0,q.jsxs)(`div`,{className:`py-1`,children:[(0,q.jsx)(`p`,{className:`mx-3 mt-2 text-xs text-subtle`,children:`Comments on lines this version no longer shows`}),(0,q.jsx)(UD,{threads:e,...t})]}):null,KD=64,qD=4,JD=8,YD=e=>e==null?0:Math.floor(e/KD)+1,XD=e=>Math.max(0,...e.map(e=>e.code.length+(e.code.match(/\t/gu)?.length??0)*1)),ZD=e=>t=>{Object.entries(e).forEach(([e,n])=>{t?.style.setProperty(e,String(n))})},QD=(0,K.memo)(({rows:e,start:t,live:n,actions:r,...i})=>{let a=oD(i.lineMarks);return(0,q.jsx)(`div`,{className:`diff-chunk`,ref:ZD({"--rows":e.length,"--chars":XD(e)}),children:e.map((o,s)=>{let c=t+s;return(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(VD,{editorHref:i.editorLinks[c]??null,index:c,isCursor:i.cursorRow===c,isWrapped:i.isWrapped,row:o,mark:i.lineMarks.get(c),selection:i.selection}),(0,q.jsx)(WD,{actions:r,cursorLine:i.cursorRow===null?null:e[i.cursorRow-t]?.new,hasRoom:i.rooms.has(c),index:c,live:n,selection:i.selection,settledHere:a(c),threads:i.byRow.get(c)??[]})]},`${String(c)}-${String(o.old)}-${String(o.new)}`)})})},(e,t)=>e.rows===t.rows&&e.sig===t.sig&&(!t.isBusy||e.live===t.live&&e.actions===t.actions&&e.selection===t.selection)),$D=(e,{from:t,to:n})=>e!==null&&e>=t&&e<n?e:null,eO=(e,{from:t,to:n})=>{if(e===null)return``;let r=Math.max(t,Math.min(...e)),i=Math.min(n-1,Math.max(...e));return r<=i?`${String(r)}-${String(i)}`:``},tO=(e,t)=>{let n=e.lineMarks.get(t);return[e.editorLinks[t]??``,n===void 0?``:JSON.stringify(n),String(e.byRow.get(t)?.length??0),e.rooms.has(t)?`room`:``].join(`|`)},nO=(e,t)=>{let n=[];for(let r=t.from;r<t.to;r+=1)n.push(tO(e,r));return[String(e.isWrapped),String($D(e.cursorRow,t)),eO(e.selection.selected,t),String($D(e.selection.composerAt,t)),n.join(`,`)].join(`;`)},rO=(e,t)=>{for(let n=t.from;n<t.to;n+=1)if(e.byRow.has(n)||e.rooms.has(n))return!0;return $D(e.selection.composerAt,t)!==null},iO=e=>{let t=zp(e),n=(0,K.useCallback)(e=>{t.current.handleStart(e)},[t]),r=(0,K.useCallback)(e=>{t.current.handleMove(e)},[t]);return{...e,handleStart:n,handleMove:r}},aO=(e,t)=>{let[n,r]=(0,K.useState)({rows:t,at:new Set}),i=n.rows===t?n.at:new Set;if(e===null||i.has(e))return i;let a=new Set([...i,e]);return r({rows:t,at:a}),a},oO=e=>(0,K.useMemo)(()=>{let t=[];for(let n=0;n<e.length;n+=KD)t.push({start:n,rows:e.slice(n,n+KD)});return t},[e]),sO=e=>Math.max(YD(e.cursorRow),YD(e.selection.selected===null?null:Math.max(...e.selection.selected)),YD(e.selection.composerAt),...[...e.byRow.keys()].map(e=>YD(e))),cO=({rows:e,live:t,actions:n,...r})=>{let i=iO(r.selection),a=aO(r.selection.composerAt,e),o=oO(e),s={...r,rooms:a},c=Bp(o.length,{wanted:sO(s),first:qD,step:JD}),l=o.slice(c).reduce((e,t)=>e+t.rows.length,0);return(0,q.jsxs)(q.Fragment,{children:[o.slice(0,c).map(e=>{let a={from:e.start,to:e.start+e.rows.length},o=rO(s,a);return(0,K.createElement)(QD,{...s,actions:n,isBusy:o,key:`chunk-${String(e.start)}`,live:t,rows:e.rows,selection:o?r.selection:i,sig:nO(s,a),start:e.start})}),l===0?null:(0,q.jsx)(`div`,{"aria-hidden":!0,className:`diff-rows-later`,ref:ZD({"--rows":l})})]})},lO=e=>e.proposed?[e.oldSha??e.newSha,`proposed`].filter(Boolean).join(` → `):[e.oldSha,e.newSha].filter(Boolean).join(` → `),uO=e=>{let t=e.lastIndexOf(`/`)+1;return{dir:e.slice(0,t),base:e.slice(t)}},dO=({rows:e,counts:t})=>(0,q.jsx)(Fu,{added:t?.added??e.filter(e=>e.op===`add`).length,removed:t?.removed??e.filter(e=>e.op===`del`).length}),fO=({file:e})=>e.status===`renamed`||e.status===`copied`?(0,q.jsx)(`span`,{className:`text-subtle`,children:` ← ${e.previousPath??``}`}):null,pO=({settled:e})=>e===0?null:(0,q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 whitespace-nowrap text-subtle tabular-nums`,children:[(0,q.jsx)(`span`,{className:G(`inline-grid`,rd.settled),children:(0,q.jsx)(od,{stand:`settled`})}),`${String(e)} settled`]}),mO=({file:e,actions:t,counts:n=null,settled:r=0})=>{let{dir:i,base:a}=uO(e.path);return(0,q.jsxs)(`div`,{className:G(`flex items-center gap-2 border-b border-border bg-background font-mono text-xs`,t===null?`px-3 py-2`:`h-11 ps-5 pe-3 max-md:hidden`),children:[(0,q.jsx)(Dn,{label:e.path,children:(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate rtl-ellipsis`,children:(0,q.jsxs)(`bdi`,{children:[(0,q.jsx)(`span`,{className:`text-subtle`,children:i}),(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:a}),e.isNew?(0,q.jsx)(`span`,{className:`text-subtle`,children:` (new file)`}):null,(0,q.jsx)(fO,{file:e})]})})}),(0,q.jsx)(pO,{settled:r}),(0,q.jsx)(dO,{counts:n,rows:e.rows}),t??(0,q.jsx)(`span`,{className:`whitespace-nowrap text-subtle`,children:lO(e)})]})},hO=[],gO=new Map,_O=new Map,vO=(e,t)=>t?Np(e):{open:e,settled:_O},yO=e=>e.length>0&&e.every(e=>e.op===`del`||e.op===`gap`),bO=e=>e.some(e=>e.quiet!==void 0)?`diff-quiet-runs`:void 0,xO=({file:e,live:t,selection:n,actions:r,headActions:i=null,lead:a=null,counts:o=null,cursorRow:s=null,isWrapped:c=!1,scope:l=null,onCodeScroll:u,rowsRef:d,editorLinks:f=hO,onOpenFold:p,onToggleRun:m,lineMarks:h=gO,settled:g=null})=>{let _=Mp(e.rows,{comments:t.comments,path:e.path}),v=vO(_.byRow,g!==null),y={live:t,actions:r};return(0,q.jsxs)(`div`,{className:bO(e.rows),children:[(0,q.jsxs)(`div`,{className:`diff-file-head`,"data-review-head":!0,children:[(0,q.jsx)(mO,{actions:i,counts:o,file:e,settled:g?.count??0}),l]}),a,(0,q.jsx)(`div`,{className:`min-w-0 overflow-x-auto py-2 font-mono code-size`,"data-code-scroll":!0,onScroll:e=>{u?.(e.currentTarget.scrollLeft)},children:(0,q.jsx)(`div`,{className:`grid w-max min-w-full`,"data-gone-file":yO(e.rows)?``:void 0,"data-new-file":e.isNew?``:void 0,"data-review-rows":!0,ref:d,children:(0,q.jsx)(qp,{value:m??null,children:(0,q.jsx)(Hp,{value:p??null,children:(0,q.jsx)(gD,{...y,rows:e.rows,settled:g,threads:v.settled,children:(0,q.jsx)(cO,{...y,byRow:v.open,cursorRow:s,editorLinks:f,isWrapped:c,lineMarks:h,rows:e.rows,selection:n})})})})})}),(0,q.jsx)(GD,{threads:_.loose,...y})]})},SO=[{mode:`since`,label:`Since review`},{mode:`full`,label:`Full diff`}],CO=({mode:e,onMode:t})=>(0,q.jsx)(Ee,{keys:[`r`],label:`Since review or full diff`,children:(0,q.jsx)(`fieldset`,{className:`m-0 inline-flex shrink-0 gap-0.5 rounded-md border-0 bg-secondary p-0.5 max-md:w-full`,children:SO.map(n=>(0,q.jsx)(`button`,{"aria-pressed":e===n.mode,className:G(`h-6 press rounded-sm px-2.5 text-xs text-muted-foreground max-md:h-9 max-md:flex-1 max-md:text-sm`,e===n.mode&&`bg-background font-medium text-foreground shadow-sm`),onClick:()=>{t(n.mode)},type:`button`,children:n.label},n.mode))})}),wO=({since:e,mode:t,onMode:n})=>{let r=Vu();return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border px-3 py-1.5 text-xs text-muted-foreground max-md:flex-wrap max-md:px-4 max-md:py-2`,children:[(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 items-center gap-1.5 max-md:flex-wrap max-md:gap-y-0.5`,children:[(0,q.jsx)(Zu,{}),(0,q.jsx)(`span`,{className:`font-medium whitespace-nowrap text-foreground`,children:`Changed since review`}),(0,q.jsx)(`span`,{className:`truncate max-md:basis-full max-md:ps-4.5 max-md:whitespace-normal`,children:Xu(e,r)})]}),t===null?null:(0,q.jsx)(CO,{mode:t,onMode:n})]})},TO=/^\d+\.\s*/u,EO=(e,t)=>`${e.branch}|${t.title}`,DO=(e,t)=>`${e.branch}|ticket|${t.title}`,OO=(e,t)=>e.tickets.find(e=>e.number===t.ticket),kO=(e,t)=>{let n=Su(t)?.path;return e.files.some(e=>e.path===n)?n:t.files.find(t=>e.files.some(e=>e.path===t))},AO=(e,t)=>{let[n]=t.layers,r=n===void 0?void 0:e.layers[n-1];return n===void 0||r===void 0?null:{index:n-1,layer:r}},jO=(e,t)=>e.files.filter(e=>t.files.includes(e.path)),MO=(e,t)=>{let n=jO(e,t),r=n.filter(e=>Cu(t,e.path).length>0).length;return{count:n.length,added:t.added,detail:`${String(r)} of ${String(n.length)} files have a note`}},NO=({sublayers:e,sublayersDone:t})=>t===0?`${String(e)} parts, none read yet`:t===e?`Every part read`:`${String(t)} of ${String(e)} parts read`,PO=(e,t)=>{let n=OO(e,t);return n===void 0||t.sublayer===null?`Layer ${t.address} of ${String(e.topLevel)}`:`Layer ${t.address} · part ${String(t.sublayer)} of ${String(n.sublayers)} in ${n.title}`},FO=(e,t,n)=>{let r=OO(e,t);return r!==void 0&&AO(e,r)?.layer===t&&xu(r.note,``)!==null&&!n.includes(DO(e,r))},IO=(e,t)=>{let n=OO(e,t);n!==void 0&&AO(e,n)?.layer===t&&lt(DO(e,n),!0),lt(EO(e,t),!1)},LO=({points:e})=>e.length===0?null:(0,q.jsx)(`ul`,{className:`m-0 grid list-none gap-1.25 p-0`,children:e.map(e=>(0,q.jsxs)(`li`,{className:`flex gap-2.5 text-sm text-pretty text-muted-foreground max-md:text-base`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`mt-2.25 size-1 shrink-0 rounded-full bg-subtle`}),(0,q.jsx)(`span`,{children:(0,q.jsx)(Au,{isChipped:!0,text:e})})]},e))}),RO=({block:e,ticket:t})=>(0,q.jsx)(`ul`,{className:`m-0 mt-0.5 grid list-none gap-0.5 p-0`,children:t.layers.map(t=>{let n=e.layers[t-1];return n===void 0?null:(0,q.jsxs)(`li`,{className:`flex items-baseline gap-2 text-sm/5.5 text-muted-foreground max-md:text-base`,children:[(0,q.jsx)(`span`,{className:`w-7.5 shrink-0 font-mono text-xs/5.5 text-subtle`,children:n.address}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere`,children:n.title}),(0,q.jsxs)(`span`,{className:`shrink-0 text-xs whitespace-nowrap text-subtle tabular-nums`,children:[`${String(jO(e,n).length)} files · `,(0,q.jsx)(`span`,{className:`text-sign-add`,children:`+${Pu(n.added)}`})]})]},n.address)})}),zO=({intro:e,facts:t,onFold:n})=>(0,q.jsxs)(`div`,{className:`flex flex-col gap-3.5 border-s border-border ps-5 max-md:border-s-0 max-md:border-t max-md:ps-0 max-md:pt-4`,children:[e.howTo.length===0?null:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`m-0 mb-1 text-xs text-subtle`,children:`How to read it`}),e.howTo.map(e=>(0,q.jsx)(`p`,{className:`m-0 text-sm text-foreground max-md:text-base`,children:(0,q.jsx)(Au,{isChipped:!0,text:e})},e))]}),(0,q.jsxs)(`p`,{className:`m-0 grid gap-0.75 text-xs text-muted-foreground tabular-nums`,children:[(0,q.jsxs)(`span`,{children:[`${String(t.count)} files · `,(0,q.jsx)(`span`,{className:`text-sign-add`,children:`+${Pu(t.added)}`})]}),(0,q.jsx)(`span`,{children:t.detail})]}),(0,q.jsx)(`button`,{className:`inline-flex h-7.5 press items-center self-start rounded-md bg-foreground/9 px-3 text-ui font-medium hover:bg-foreground/14 max-md:h-12 max-md:justify-center max-md:self-stretch max-md:text-base`,onClick:n,type:`button`,children:`Got it`})]}),BO=e=>(0,q.jsxs)(`section`,{"aria-label":`Layer ${e.address} intro`,className:`mx-5 mt-4 layer-intro animate-enter rounded-xl border border-border bg-wash px-5 pt-4.5 pb-4 max-md:mx-3 max-md:mt-3 max-md:p-4`,children:[(0,q.jsxs)(`div`,{className:`grid max-w-155 content-start gap-2`,children:[(0,q.jsx)(`p`,{className:`m-0 text-xs wrap-anywhere text-subtle tabular-nums`,children:e.eyebrow}),(0,q.jsx)(`h2`,{className:`m-0 text-lg font-semibold tracking-tight text-balance wrap-anywhere`,children:e.title.replace(TO,``)}),(0,q.jsx)(`p`,{className:`m-0 mb-0.5 text-base text-foreground max-md:text-base`,children:(0,q.jsx)(Au,{isChipped:!0,text:e.intro.lead})}),e.children]}),(0,q.jsx)(zO,{facts:e.facts,intro:e.intro,onFold:e.onFold})]}),VO=({address:e,title:t,lead:n,onOpen:r})=>(0,q.jsx)(`div`,{className:`px-5 pt-3 max-md:px-3`,children:(0,q.jsxs)(`button`,{className:`flex h-9 w-full items-center gap-2.5 rounded-lg border border-border bg-wash px-3 text-start text-ui text-muted-foreground hover:bg-row-hover hover:text-foreground max-md:h-11`,onClick:r,type:`button`,children:[(0,q.jsx)(`span`,{className:`font-mono text-xs text-subtle`,children:e}),(0,q.jsx)(`b`,{className:`max-w-1/2 truncate font-medium text-foreground`,children:t.replace(TO,``).split(`:`)[0]}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),(0,q.jsx)(`span`,{className:`text-xs whitespace-nowrap text-subtle`,children:`Show intro`})]})}),HO=e=>`${e.after?`After`:`Before`} line ${String(e.line)}`,UO=({notes:e})=>(0,q.jsx)(`aside`,{"aria-label":`Note on this file`,className:`mx-5 mt-3 grid file-note animate-enter gap-2 rounded-lg bg-foreground/4.5 px-4 pt-3 pb-3.25 max-md:mx-3`,children:e.map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`p`,{className:`m-0 mb-1 flex items-center gap-1.5 font-mono text-2xs text-subtle`,children:[(0,q.jsx)(ju,{className:`size-3 shrink-0`}),HO(e)]}),(0,q.jsx)(`p`,{className:`m-0 max-w-160 text-sm text-pretty max-md:text-base`,children:(0,q.jsx)(Au,{isChipped:!0,text:yu(e.markdown.trim())})})]},`${String(e.line)}:${String(e.after)}:${e.markdown}`))}),WO=(e,t)=>{let n=t.isLayered?Yo(t.cursor):null,r=n===null?void 0:e.layers[n];return r===void 0||r.isRemainder||n===null?null:{index:n,layer:r}},GO=({block:e,layer:t})=>{let{introsFolded:n}=Qe(),r=Su(t),i=EO(e,t);return r===null?null:FO(e,t,n)||n.includes(i)?(0,q.jsx)(VO,{address:t.address,lead:r.lead,onOpen:()=>{IO(e,t)},title:t.title}):(0,q.jsx)(BO,{address:t.address,eyebrow:PO(e,t),facts:MO(e,t),intro:r,onFold:()=>{lt(i,!0)},title:t.title,children:(0,q.jsx)(LO,{points:r.points})})},KO=({block:e,ticket:t,path:n})=>{let{introsFolded:r}=Qe(),i=xu(t.note,n),a=DO(e,t);return i===null?null:r.includes(a)?(0,q.jsx)(VO,{address:t.address,lead:i.lead,onOpen:()=>{lt(a,!1)},title:t.title}):(0,q.jsxs)(BO,{address:t.address,eyebrow:`Layer ${t.address} of ${String(e.topLevel)} · ${String(t.sublayers)} parts`,facts:{count:t.files.length,added:t.added,detail:NO(t)},intro:i,onFold:()=>{lt(a,!0)},title:t.title,children:[(0,q.jsx)(LO,{points:i.points}),(0,q.jsx)(RO,{block:e,ticket:t})]})},qO=({block:e,layer:t,path:n})=>{let r=OO(e,t),i=r!==void 0&&AO(e,r)?.layer===t;return(0,q.jsxs)(q.Fragment,{children:[i?(0,q.jsx)(KO,{block:e,path:n,ticket:r}):null,(0,q.jsx)(GO,{block:e,layer:t})]})},JO=({block:e,state:t,path:n})=>{let{isNoted:r}=Qe(),i=WO(e,t),a=i===null?[]:Cu(i.layer,n);return!r||i===null?null:(0,q.jsxs)(q.Fragment,{children:[kO(e,i.layer)===n?(0,q.jsx)(qO,{block:e,layer:i.layer,path:n}):null,a.length===0?null:(0,q.jsx)(UO,{notes:a})]})},YO=({block:e,index:t,selected:n,onPickFile:r})=>{let{isNoted:i,introsFolded:a}=Qe(),o=e.layers[t],s=o===void 0?void 0:kO(e,o),c=o!==void 0&&i&&!a.includes(EO(e,o))&&!FO(e,o,a)&&n===s;return(0,q.jsx)(Mu,{intro:o===void 0?null:Su(o),isIntroShown:c,isPart:(o?.ticket??null)!==null,onOpenIntro:()=>{o!==void 0&&s!==void 0&&(IO(e,o),Ht({isNoted:!0}),r(Ko(t,s),s))}})},XO=({block:e,ticket:t,selected:n,onPickFile:r})=>{let{isNoted:i,introsFolded:a}=Qe(),o=AO(e,t),s=o===null?void 0:kO(e,o.layer),c=DO(e,t);return(0,q.jsx)(Mu,{intro:xu(t.note,s??``),isIntroShown:i&&!a.includes(c)&&n===s,onOpenIntro:()=>{o!==null&&s!==void 0&&(lt(c,!1),Ht({isNoted:!0}),r(Ko(o.index,s),s))}})},ZO=[{side:`old`,label:`Before`},{side:`new`,label:`After`}],QO=(e,t)=>`/review/image?${new URLSearchParams({place:e.place,branch:e.block.branch,side:t,file:t===`old`?e.file.previousPath:e.file.path,sha:t===`old`?e.block.base.sha:e.block.head.sha}).toString()}`,$O=e=>{let{image:t}=e.file;if(t===null)return null;let n=ZO.filter(({side:e})=>t[e]);return(0,q.jsx)(`div`,{className:`mb-3 grid gap-3 rounded-md border border-border p-3 sm:grid-cols-2`,children:n.map(({side:t,label:n})=>(0,q.jsxs)(`figure`,{className:`m-0 grid content-start gap-1.5`,children:[(0,q.jsx)(`figcaption`,{className:`text-xs text-subtle`,children:n}),(0,q.jsx)(`img`,{alt:`${e.file.path}, ${n.toLowerCase()}`,className:`max-h-80 max-w-full justify-self-start rounded-sm bg-shot object-contain`,src:QO(e,t)})]},t))})},ek=({path:e,view:t,getSince:n,cursor:r})=>{let i=r===null?null:Yo(r),a=n(e),o=a!==void 0&&So(a,i)?a:void 0;return o===void 0?null:(0,q.jsx)(wO,{mode:t.modeOf(e),onMode:n=>{t.setMode(e,n)},since:o})},tk=K.createContext(void 0);function nk(e){let t=K.useContext(tk);if(t===void 0&&!e)throw Error(Wt(50));return t}var rk={...xt,instantType:e=>e.instantType,adaptiveOrigin:e=>e.adaptiveOrigin,closeDelay:e=>e.closeDelay},ik=class extends ve{constructor(e,t,n){let r=new qe;super(ak(e,r,t,n),ok(r),rk)}setOpen=(e,t)=>{let{inlineRectCoordsRef:n}=this.context;tt(this,e,t,{onBeforeDispatch(){let r=t.event;e&&t.reason===`trigger-hover`&&t.trigger&&`clientX`in r&&`clientY`in r&&n.current?.element!==t.trigger&&oa(n,t.trigger,r.clientX,r.clientY)}})}};function ak(e,t,n,r=!1){return{...Qt(t,n,r),instantType:void 0,adaptiveOrigin:void 0,closeDelay:300,...e}}function ok(e){return{popupRef:K.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e,inlineRectCoordsRef:{current:void 0}}}function sk(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:i,actionsRef:a,handle:o,triggerId:s,defaultTriggerId:c=null,children:l}=e,u=_t((e,r)=>new ik({open:n,openProp:t,activeTriggerId:c,triggerIdProp:s},e,r));u.useControlledProp(`openProp`,t),u.useControlledProp(`triggerIdProp`,s),u.useContextCallback(`onOpenChange`,r),u.useContextCallback(`onOpenChangeComplete`,i);let d=u.useState(`open`),f=u.useState(`activeTriggerId`),p=u.useState(`mounted`),m=u.useState(`payload`);ft(u,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:h}=Gt(d,u,()=>{u.context.inlineRectCoordsRef.current=void 0});W(()=>{d&&(f??u.set(`payload`,void 0))},[u,f,d]),K.useImperativeHandle(a,()=>({unmount:h,close:()=>u.setOpen(!1,zt(rt))}),[h,u]);let g=d||p;return(0,q.jsxs)(tk.Provider,{value:u,children:[o&&(0,q.jsx)(nn,{handle:o,store:u}),g&&(0,q.jsx)(ck,{store:u}),typeof l==`function`?l({payload:m}):l]})}function ck({store:e}){let t=e.useState(`floatingRootContext`),n=p(t);return Nt(e,{activeTriggerProps:n.reference,inactiveTriggerProps:n.trigger,popupProps:n.floating}),null}var lk=Ne(function(e){return nk(!0)?(0,q.jsx)(sk,{...e}):(0,q.jsx)(y,{children:(0,q.jsx)(sk,{...e})})}),uk=K.createContext(void 0);function dk(){let e=K.useContext(uk);if(e===void 0)throw Error(Wt(48));return e}var fk=K.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return nk().useState(`mounted`)||n?(0,q.jsx)(uk.Provider,{value:n,children:(0,q.jsx)(Me,{ref:t,...r})}):null}),pk=K.createContext(void 0);function mk(){let e=K.useContext(pk);if(e===void 0)throw Error(Wt(49));return e}var hk=K.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=S,style:_,...v}=e,y=nk(),b=dk(),x=g(),C=y.useState(`open`),w=y.useState(`mounted`),T=y.useState(`floatingRootContext`),E=y.useState(`instantType`),D=y.useState(`transitionStatus`),O=y.useState(`adaptiveOrigin`),k=y.context.inlineRectCoordsRef,A=j({anchor:i,floatingRootContext:T,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:b,nodeId:x,collisionAvoidance:h,adaptiveOrigin:O,inline:sa(k)}),ee=A.update;W(()=>{C&&w&&ee()},[C,w,ee]);let M={open:C,side:A.side,align:A.align,anchorHidden:A.anchorHidden,instant:E},N=P(e,M,{styles:A.positionerStyles,transitionStatus:D,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!w,inert:!C});return(0,q.jsx)(pk.Provider,{value:A,children:(0,q.jsx)(Se,{id:x,children:N})})}),gk=K.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=nk(),{side:s,align:c}=mk(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`closeDelay`);return mn({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),ct(p,{closeDelay:m}),Zt(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[Vt,f,Kt(d),a],stateAttributesMapping:gn})});function _k({...e}){return(0,q.jsx)(lk,{"data-slot":`preview-card`,...e})}function vk({className:e,side:t=`right`,sideOffset:n=12,align:r=`start`,anchor:i,size:a=`default`,children:o,...s}){return(0,q.jsx)(fk,{children:(0,q.jsx)(hk,{align:r,anchor:i,className:`isolate z-50 data-anchor-hidden:invisible`,side:t,sideOffset:n,children:(0,q.jsx)(gk,{className:G(`origin-(--transform-origin) rounded-lg border border-border bg-popover text-popover-foreground shadow-md transition-[opacity,scale,translate] ease-out data-ending-style:scale-97 data-ending-style:opacity-0 data-starting-style:scale-97 data-starting-style:opacity-0 motion-reduce:data-ending-style:scale-100 motion-reduce:data-starting-style:scale-100`,a===`code`?`type-hover duration-150`:`w-80 p-3 duration-200 data-ending-style:-translate-x-2 data-starting-style:-translate-x-2 motion-reduce:data-ending-style:translate-x-0 motion-reduce:data-starting-style:translate-x-0`,e),"data-slot":`preview-card-content`,...s,children:o})})})}var yk=/`(?<code>[^`]+)`|\[(?<label>[^\]]+)\]\((?<url>https?:\/\/[^)\s]+)\)|\*(?<em>[^*\s][^*]*)\*/gu,bk=(e,t)=>{let{code:n,label:r,url:i,em:a}=e;return n===void 0?i===void 0?(0,q.jsx)(`em`,{children:a},t):(0,q.jsx)(`a`,{className:`text-claude hover:underline`,href:i,rel:`noreferrer`,target:`_blank`,children:r},t):(0,q.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono`,children:n},t)},xk=({text:e})=>{let t=[...e.matchAll(yk)];return t.length===0?e:t.flatMap((n,r)=>{let i=t[r-1],a=i===void 0?0:i.index+i[0].length,o=n.index+n[0].length,s=[e.slice(a,n.index),bk(n.groups??{},o)];return r===t.length-1&&s.push(e.slice(o)),s})},Sk=e=>e.split(/\n\s*\n/u).map(e=>e.replaceAll(/\s*\n\s*/gu,` `).trim()).filter(e=>e!==``),Ck=({text:e})=>Sk(e).map(e=>(0,q.jsx)(`p`,{className:`m-0`,children:(0,q.jsx)(xk,{text:e})},e)),wk=({tag:e})=>{if(e.name===`example`)return(0,q.jsx)(`pre`,{className:`m-0 font-mono text-xs/5 whitespace-pre-wrap text-foreground`,children:e.text});let[t=``,...n]=e.text.split(/\s+/u),r=e.name===`param`&&t!==``;return(0,q.jsxs)(`span`,{children:[r?(0,q.jsx)(`code`,{className:`me-1.5 font-mono text-foreground`,children:t}):null,(0,q.jsx)(xk,{text:(r?n.join(` `):e.text).replaceAll(/\s*\n\s*/gu,` `)})]})},Tk=({hover:e})=>{let t=e.tags.filter(e=>e.text!==``),n=e.tags.filter(e=>e.text===``);return e.documentation===``&&e.tags.length===0?null:(0,q.jsxs)(`div`,{className:`grid gap-2 border-t border-border px-3 py-2.5 text-xs/5 text-muted-foreground`,children:[e.documentation===``?null:(0,q.jsx)(Ck,{text:e.documentation}),t.length===0?null:(0,q.jsx)(`dl`,{className:`m-0 grid tag-rows gap-x-3 gap-y-1`,children:t.map((e,t)=>(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`font-mono text-subtle`,children:e.name}),(0,q.jsx)(`dd`,{className:`m-0 min-w-0 wrap-break-word`,children:(0,q.jsx)(wk,{tag:e})})]},`${e.name}-${String(t)}`))}),n.length===0?null:(0,q.jsx)(`p`,{className:`m-0 flex flex-wrap gap-1`,children:n.map(e=>(0,q.jsx)(`span`,{className:`rounded-sm bg-muted px-1.5 font-mono text-2xs text-subtle`,children:e.name},e.name))})]})},Ek=2,Dk=e=>{let t=e.lastIndexOf(`node_modules/`);if(t===-1)return e;let n=e.slice(t+13).split(`/`),r=n[0]?.startsWith(`@`)===!0?Ek:1;return`${n.slice(0,r).join(`/`)} · ${n.slice(r).join(`/`)}`},Ok=({definition:e,canJump:t,onJump:n})=>{let r=`${Dk(e.path)}:${String(e.line)}`;return(0,q.jsx)(`p`,{className:`m-0 truncate border-t border-border px-3 py-1.5 font-mono text-xs/5 text-subtle`,title:`${e.path}:${String(e.line)}`,children:t(e.path)?(0,q.jsx)(`button`,{className:`text-start break-all hover-text`,onClick:()=>{n(e.path,e.line)},type:`button`,children:r}):r})},kk=({hover:e,canJump:t,onJump:n})=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`pre`,{className:`m-0 px-3 py-2 font-mono text-xs/5 wrap-break-word whitespace-pre-wrap`,dangerouslySetInnerHTML:{__html:e.html}}),(0,q.jsx)(Tk,{hover:e}),e.definition===null?null:(0,q.jsx)(Ok,{canJump:t,definition:e.definition,onJump:n})]}),Ak=({shown:e,isOpen:t,canJump:n,onJump:r,onEnter:i,onLeave:a,onClose:o})=>(0,q.jsx)(_k,{onOpenChange:e=>{e||o()},open:t,children:e===null?null:(0,q.jsx)(vk,{align:`start`,anchor:e.anchor,onMouseEnter:i,onMouseLeave:a,side:`bottom`,sideOffset:4,size:`code`,children:(0,q.jsx)(kk,{canJump:n,hover:e.hover,onJump:r})})}),jk=250,Mk=120,Nk=4500,Pk=6,Fk=e=>{clearTimeout(e.asking?.timer),e.asking?.controller.abort(),e.asking=null},Ik=async(e,{point:t,signal:n,left:r=Pk})=>{let i=performance.now(),a=await e(t,n);return a===null&&performance.now()-i>=Nk&&r>1&&!n.aborted?Ik(e,{point:t,signal:n,left:r-1}):a},Lk=()=>{let e=(0,K.useRef)({asking:null,closing:void 0});return(0,K.useEffect)(()=>{let{current:t}=e;return()=>{clearTimeout(t.closing),Fk(t)}},[]),{askingKey:()=>e.current.asking?.key,stopAsking:()=>{Fk(e.current)},startAsking:t=>{Fk(e.current),e.current.asking=t},keepOpen:()=>{clearTimeout(e.current.closing)},closeAfter:t=>{clearTimeout(e.current.closing),e.current.closing=setTimeout(t,Mk)}}},Rk=e=>{let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(!1),a=Lk(),o=()=>{a.closeAfter(()=>{i(!1)})},s=async(t,r)=>{try{let o=await Ik(e,{point:t,signal:r.signal});!r.signal.aborted&&o!==null&&(a.keepOpen(),n({key:t.key,hover:o,anchor:t.anchor}),i(!0))}catch{i(!1)}},c=e=>{let t=new AbortController,n=setTimeout(()=>{s(e,t)},jk);a.startAsking({key:e.key,timer:n,controller:t})},l=e=>r&&e.key===t?.key;return{shown:t,isOpen:r,handleEnter:a.keepOpen,point:e=>{(e===null||e.key!==a.askingKey())&&(e!==null&&l(e)?a.keepOpen():(a.stopAsking(),o(),e!==null&&c(e)))},handleLeave:()=>{a.stopAsking(),o()},handleClose:()=>{a.stopAsking(),a.keepOpen(),i(!1)}}},zk=/\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/u,Bk=/[\p{ID_Start}$_][\p{ID_Continue}$‌‍]*/gu;wt({place:k(),branch:k(),path:re(k(),ye(1)),line:re(R(),he(),_(1)),column:re(R(),he(),_(0))});var Vk=e=>zk.test(e),Hk=(e,t)=>{let n=[...e.matchAll(Bk)].map(e=>({start:e.index,end:e.index+e[0].length}));return n.find(e=>e.start<=t&&t<e.end)??n.find(e=>e.end===t)??null},Uk=`.token.comment, .token.string, .token.number`,Wk=({clientX:e,clientY:t})=>{let n=document.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}},Gk=e=>{let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e!==null;e=t.nextNode())e instanceof Text&&n.push(e);return n},Kk=(e,t)=>{let n=t.node instanceof Text?e.indexOf(t.node):-1;return n===-1?null:e.slice(0,n).reduce((e,t)=>e+t.length,0)+t.offset},qk=(e,t)=>{let n=t;for(let t of e){if(n<=t.length)return{node:t,at:n};n-=t.length}return null},Jk=(e,{start:t,end:n})=>{let r=qk(e,t),i=qk(e,n);if(r===null||i===null)return null;let a=document.createRange();return a.setStart(r.node,r.at),a.setEnd(i.node,i.at),a},Yk=(e,{clientX:t,clientY:n})=>[...e.getClientRects()].some(e=>t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom),Xk=(e,t)=>{let n=Wk(t);if(n===null||n.node.parentElement?.closest(Uk)!==null)return null;let r=Gk(e),i=Kk(r,n),a=i===null?null:Hk(e.textContent,i),o=a===null?null:Jk(r,a);return a===null||o===null||!Yk(o,t)?null:{word:a,range:o}},Zk=(e,{line:t,pointer:n})=>{let r=Xk(e,n);return r===null?null:{key:`${String(t)}:${String(r.word.start)}`,line:t,column:r.word.start,anchor:{getBoundingClientRect:()=>r.range.getBoundingClientRect(),contextElement:e}}},Qk=h({method:`GET`}).handler(z(`81aea6d919e4c199dc875a22e9a9e4ad10e816bce0e36d084895c08d36390b40`)),$k=(e,t)=>{let n=e.target instanceof Element?e.target.closest(`[data-code]`):null,r=n?.closest(`[data-review-row]`)?.dataset.reviewRow,i=r===void 0?void 0:t.rows[Number(r)];return n===null||i===void 0||i.op===`del`||i.new===null?null:{code:n,line:i.new}},eA=({place:e,branch:t,file:n})=>{let r=Rk((r,i)=>Qk({data:{place:e,branch:t,path:n?.path??``,line:r.line,column:r.column},signal:i})),i=n!==void 0&&n.newSha!==null&&Vk(n.path);return{hover:r,handleMove:e=>{if(!(e.target instanceof Node)||!e.currentTarget.contains(e.target))return;let t=i&&e.buttons===0?$k(e,n):null;r.point(t===null?null:Zk(t.code,{line:t.line,pointer:e}))}}},tA=[],nA={op:`gap`,old:null,new:null,code:``,html:``},rA=e=>e.op===`add`||e.op===`del`,iA=e=>e?.new??e?.old??0,aA=(e,t)=>{let n=iA(t);return t.op!==`gap`&&n>=e[0]&&n<=e[1]},oA=(e,t)=>{let[n]=t.layers??[],r=n===void 0?void 0:e[n-1];return r===void 0||r.isRemainder||n===void 0?null:{layer:r.address,title:r.title}},sA=(e,{index:t,rows:n,runs:r=tA,isAllShown:i=!1})=>{let a=e=>e.layers?.includes(t+1)===!0;return!n.some(e=>a(e))||n.every(e=>!rA(e)||a(e))?void 0:{key:`${String(t)}|${i?`all`:r.flat().join(`,`)}`,isMine:a,isQuiet:e=>rA(e)&&!a(e)&&(i||e.quietIn?.includes(t+1)===!0),runOf:e=>r.find(t=>aA(t,e)),said:t=>{let n=oA(e,t);return n===null?`that no layer claims`:`from layer ${n.layer}`},quietOf:t=>{let n=oA(e,t);return{layer:n?.layer??null,title:n?.title??`No layer claims these lines`,place:`one`}}}},cA=(e,t)=>e!==void 0&&rA(t)&&!e.isMine(t)&&!e.isQuiet(t)&&e.runOf(t)===void 0,lA=(e,t,n)=>{let[r]=e,i=e.length===1?`line`:`lines`,a=[iA(r),iA(e.at(-1))];return{...nA,code:`${String(e.length)} ${i} ${r===void 0?``:t.said(r)}`,others:{range:a,count:e.length,isOpen:n}}},uA=(e,t)=>t===void 0||!rA(e)||t.isMine(e)||!t.isQuiet(e)&&t.runOf(e)===void 0?e:{...e,quiet:t.quietOf(e)},dA=(e,{row:t,rows:n,claim:r})=>{let i=r.runOf(t),a=e.at(-1);if(i===void 0||a!==void 0&&r.runOf(a)===i)return;let o=n.filter(e=>rA(e)&&aA(i,e)&&!r.isMine(e));e.push({...lA(o,r,!0),others:{range:i,count:o.length,isOpen:!0}})},fA=(e,t)=>{let n=e.at(-1),{quiet:r}=t;if(r===void 0||n?.others?.isOpen!==!0&&n?.quiet?.layer!==r.layer)e.push(t);else{if(n.quiet!==void 0){let t=n.quiet.place===`one`?`top`:`mid`;e[e.length-1]={...n,quiet:{...n.quiet,place:t}}}e.push({...t,quiet:{...r,place:`end`}})}},pA=(e,{row:t,rows:n,claim:r})=>{r!==void 0&&dA(e,{row:t,rows:n,claim:r}),fA(e,uA(t,r))},mA=(e,t)=>e.some(([e,n])=>e===t[0]&&n===t[1])?e.filter(([e,n])=>e!==t[0]||n!==t[1]):[...e,t],hA=(e,{rows:t,line:n})=>{let r=t.find(e=>e.new===n);return r===void 0||!rA(r)||e.some(e=>aA(e,r))?e:[...e,[n,n]]},gA=[3,10,25,60],_A=[],vA=(e,t)=>t.op===`ctx`&&t.new!==null&&e.some(([e,n])=>t.new!==null&&t.new>=e&&t.new<=n),yA=(e,{context:t,isShown:n})=>{let r=e.map(()=>!1),i=-1/0;e.forEach((e,a)=>{i=n(e)?a:i,r[a]=a-i<=t});let a=1/0;for(let i=e.length-1;i>=0;--i)a=n(e[i]??nA)?i:a,r[i]=r[i]===!0||a-i<=t;return r},bA=(e,t)=>{let n=e[0]?.new,r=e.at(-1)?.new;return n==null||r==null?nA:{...nA,fold:{first:n,last:r,count:e.length,...t}}},xA=(e,{claim:t,isTop:n,isBottom:r})=>{let i=e.filter(e=>rA(e)),[a]=i;return a===void 0?bA(e,{isTop:n,isBottom:r}):t===void 0?nA:lA(i,t,!1)},SA=(e,{context:t,claim:n,opened:r})=>{let i=yA(e,{context:t,isShown:e=>rA(e)&&!cA(n,e)}),a=[],o=[],s=e=>{a.push(xA(o,{claim:n,isTop:a.length===0,isBottom:e})),o=[]};return e.forEach((t,c)=>{i[c]!==!0&&!vA(r,t)||cA(n,t)?o.push(t):(o.length>0&&s(!1),pA(a,{row:t,rows:e,claim:n}))}),o.length>0&&s(!0),a},CA=new WeakMap,wA=(e,t,{claim:n,opened:r=_A}={})=>{if(t===`whole`&&n===void 0)return e;let i=t===`whole`?1/0:t,a=CA.get(e)??new Map,o=`${String(t)}|${n?.key??``}|${r.flat().join(`,`)}`,s=a.get(o)??SA(e,{context:i,claim:n,opened:r});return a.set(o,s),CA.set(e,a),s},TA=(e,{context:t,layers:n,cursor:r,opened:i,runs:a=tA,isAllShown:o=!1})=>{let s=r===null?null:Yo(r),c=s===null?void 0:sA(n,{index:s,rows:e.rows,runs:a,isAllShown:o});return wA(e.rows,t,{claim:c,opened:i})},EA=10,DA=e=>{let t=e?.fold;return t===void 0?null:t.count<=EA?[t.first,t.last]:t.isTop?[t.last-EA+1,t.last]:[t.first,t.first+EA-1]},OA=(e,{path:t,range:n})=>({...e,[t]:[...e[t]??_A,n]}),kA=(e,t)=>{let n=[...gA,`whole`],r=Math.max(0,n.indexOf(e));return n[Math.min(n.length-1,Math.max(0,r+t))]??e},AA=({state:e,setState:t})=>(0,K.useCallback)(({range:n,index:r,isWhole:i})=>{let a=n[1]-n[0]+1,o=i?a-1:a;t({...e,opened:OA(e.opened,{path:e.selected,range:n}),row:e.row>r?e.row+o:e.row})},[e,t]),jA=(e,{range:t,index:n,count:r,isOpen:i})=>{let a=mA(e.runs[e.selected]??[],t),o=e.row>n+(i?r:0),s=i&&e.row>n?n:e.row;return{...e,runs:{...e.runs,[e.selected]:a},row:o?e.row+(i?-r:r):s}},MA=({state:e,setState:t})=>(0,K.useCallback)(n=>{t(jA(e,n))},[e,t]),NA=e=>({openFold:AA(e),toggleRun:MA(e)}),PA=(e,{path:t,line:n,rows:r})=>({...e,context:`whole`,runs:{...e.runs,[t]:hA(e.runs[t]??tA,{rows:r,line:n})}}),FA=new WeakMap,IA=e=>{if(e.file===void 0)return[];let t=FA.get(e.file.rows)??new Map,n=`${e.worktree??``}|${e.file.path}|${e.file.status}|${e.editor}`,r=t.get(n)??bc(e);return t.set(n,r),FA.set(e.file.rows,t),r},LA=(e,t)=>{let n=e.state.isLayered?Yo(e.state.cursor):null,r=(n===null?[]:e.block.layers[n]?.parts??[]).find(e=>e.path===t.path),i=r===void 0||t.isSince===!0?t:r;return{added:i.added,removed:i.removed}},RA=(e,t)=>{let[n,r]=e?.split(`#`)??[];return n===t&&r!==void 0?Number(r):null},zA=(e,t,n)=>{let r=zp(e),i=t?.path??``,a=(0,K.useCallback)(e=>{let{state:t,setState:n}=r.current;n(e===null?{...t,settledAt:null}:{...t,settledAt:`${i}#${String(e)}`,focus:`diff`,row:e,anchor:null})},[r,i]);return{count:n,openRow:RA(e.state.settledAt,i),onOpen:a}},BA=(e,t)=>{let{editor:n}=Qe(),r=zA(e,t,e.block.fileMarks.find(e=>e.path===t?.path)?.settled??0);return{counts:t===void 0?{added:0,removed:0}:LA(e,t),editorLinks:IA({worktree:e.block.worktree,file:t,editor:n}),editorFolder:gc(e.block.worktree,n),settled:r,lineMarks:mu({lineMarks:e.block.lineMarks,threads:e.block.threads,drafts:e.extras.drafts,path:t?.path??``,rows:t?.rows??[],layer:e.state.isLayered?Yo(e.state.cursor):null})}},VA=(e,t)=>{let n=(0,K.useRef)(t);(0,K.useEffect)(()=>{n.current=t}),(0,K.useEffect)(()=>{e!==``&&n.current()},[e])},HA=({lines:e,htmlOf:t,opOf:n,oldOf:r,onPick:i,panRef:a})=>e.length===0?null:(0,q.jsx)(`nav`,{"aria-label":`Scope`,className:`scope-stack font-mono code-size`,"data-review-scope":!0,ref:a,children:(0,q.jsx)(`div`,{className:`flex w-max min-w-full flex-col-reverse`,children:e.toReversed().map((e,a)=>(0,q.jsxs)(`button`,{className:`scope-line diff-row text-start`,"data-scope-depth":e.depth,"data-scope-last":a===0||void 0,"data-scope-line":e.line,"data-scope-op":n(e.line),onClick:()=>{i(e.line)},title:`Go to line ${String(e.line)}`,type:`button`,children:[(0,q.jsx)(`span`,{className:`diff-sticky diff-at-lead`}),(0,q.jsx)(`span`,{className:`diff-sticky diff-at-old pe-2 text-end text-subtle tabular-nums`,children:r(e.line)}),(0,q.jsx)(`span`,{className:`diff-sticky diff-at-new pe-2 text-end text-subtle tabular-nums`,children:e.line}),(0,q.jsx)(`span`,{className:`diff-sticky diff-at-sign`}),(0,q.jsxs)(`span`,{className:`pe-4 whitespace-pre pre-tab`,children:[(0,q.jsx)(`span`,{dangerouslySetInnerHTML:{__html:t(e.line)}}),e.isElided?(0,q.jsx)(`span`,{className:`text-subtle`,children:` ⋯`}):null]})]},e.line))})}),UA=2,WA=(e,t)=>{let n=e.slice(t).find(e=>e.new!==null);return n===void 0?e.slice(0,t).findLast(e=>e.new!==null)?.new??null:n.new},GA=(e,t)=>{let n=[];if(t<=1||t>e.length)return n;for(let r=e[t-1]??0;r>0;r=e[r-1]??0)n.unshift(r);return n},KA=(e,t)=>{let n=e.map((e,t)=>({line:e,depth:t,isElided:!1}));if(n.length<=t||t<UA)return n.slice(0,t);let[r]=n;return r===void 0?[]:[{...r,isElided:!0},...n.slice(n.length-(t-1))]},qA=(e,t,n)=>{if(t===n)return!0;for(let r=e[t-1]??0;r>0;r=e[r-1]??0)if(r===n)return!0;return!1},JA=e=>new Set(e.filter(e=>e>0)),YA=(e,t,n)=>t.has(n)?[...GA(e,n),n]:GA(e,n),XA=`[data-review-row]`,ZA=`[data-review-head]`,QA=`[data-scope-line]`,$A=1,ej=2,tj=32,nj=50,rj={lines:[],push:0,height:0},ij=e=>[...e.querySelectorAll(XA)],aj=e=>Number(e.dataset.reviewRow??``),oj=e=>{let t=e.querySelector(ZA),n=(t??e).getBoundingClientRect();return t===null?n.top:n.bottom},sj=(e,t)=>{let n=e.querySelector(QA);if(n!==null)return n.getBoundingClientRect().height;let r=t.slice(0,nj).map(e=>e.getBoundingClientRect().height);return r.length===0?0:Math.min(...r)},cj=(e,t,n)=>{let r=JA(e.enclosedBy),i=new Map;return t.forEach((t,a)=>{let o=e.rows[aj(t)]?.new??null;o!==null&&YA(e.enclosedBy,r,o).forEach(e=>{i.has(e)||i.set(e,n[a]??0)})}),i},lj=({container:e,grid:t},n)=>{let r=ij(t),i=t.getBoundingClientRect().top,a=JA(n.enclosedBy),o=r.map(e=>e.getBoundingClientRect()),s=o.map(e=>e.top-i);return{tops:s,bottoms:o.map(e=>e.bottom-i),lines:r.map(e=>WA(n.rows,aj(e))),openers:r.map(e=>{let t=n.rows[aj(e)]?.new??null;return t!==null&&a.has(t)}),firstTops:cj(n,r,s),lineHeight:sj(e,r)}},uj=(e,t,n)=>{let r=0,i=e;for(;r<i;){let e=Math.floor((r+i)/ej),a=t(e)>n;r=a?r:e+1,i=a?e:i}return r},dj=(e,t,{row:n,top:r})=>{let i=e.lines[n]??null;if(i===null)return[];let a=GA(t.enclosedBy,i);return(e.openers[n]??!1)&&(e.tops[n]??0)<r-$A?[...a,i]:a},fj=(e,t)=>t.every((t,n)=>e[n]===t),pj=e=>Math.min(e,3),mj=(e,t,{top:n,depth:r})=>{let i=n+pj(r)*e.lineHeight,a=uj(e.bottoms.length,t=>e.bottoms[t]??0,i);return{row:a,slotTop:i,chain:dj(e,t,{row:a,top:i})}},hj=(e,t,n)=>(e.firstTops.get(t)??1/0)<n-$A,gj=(e,t,n)=>{let r=[],i=0;for(let a=0;a<tj;a+=1){let{row:o,slotTop:s,chain:c}=mj(e,t,{top:n,depth:a}),l=c[a];if(l===void 0||!fj(c,r)||!hj(e,l,s))break;r.push(l),i=o}return{pinned:r,probe:i}},_j=(e,t,{scope:n,from:r,bottom:i})=>{for(let a=r;a<e.tops.length&&(e.tops[a]??0)<i;a+=1){let r=e.lines[a]??null;if(r!==null&&!qA(t.enclosedBy,r,n))return Math.min(0,(e.tops[a]??0)-i)}return 0},vj=(e,t,n)=>{if(t.enclosedBy.length===0||e.lineHeight===0)return rj;let{pinned:r,probe:i}=gj(e,t,n),a=r.at(-1);if(a===void 0)return rj;let o=KA(r,4),s=o.length*e.lineHeight;return{lines:o,push:_j(e,t,{scope:a,from:i,bottom:n+s}),height:s}},yj=(e,t)=>oj(e)-t.getBoundingClientRect().top,bj=e=>Math.max(oj(e),...[...e.querySelectorAll(QA)].map(e=>e.getBoundingClientRect().bottom)),xj=e=>{let t=ij(e);return t[uj(t.length,e=>t[e]?.getBoundingClientRect().bottom??0,bj(e)+$A)]??null},Sj=e=>e.map(e=>`${String(e.line)}${e.isElided?`+`:``}`).join(`,`),Cj=(e,t)=>Sj(e)===Sj(t),wj=(e,t,n)=>{let r=JA(t.enclosedBy);return new Set(e.flatMap(e=>{let i=aj(e)<n?t.rows[aj(e)]?.new??null:null;return i===null?[]:YA(t.enclosedBy,r,i)}))},Tj=(e,t,n)=>{let r=WA(t.rows,n);if(!nt().isScoped||t.enclosedBy.length===0||r===null)return 0;let i=ij(e),a=wj(i,t,n);return KA(GA(t.enclosedBy,r).filter(e=>a.has(e)),4).length*sj(e,i)},Ej=(e,t,n)=>{let r=e.querySelector(`[data-review-row="${String(n)}"]`);r!==null&&(e.scrollTop+=Math.floor(r.getBoundingClientRect().top-oj(e)-Tj(e,t,n)))},Dj=e=>e.querySelector(ZA)?.getBoundingClientRect().height??0,Oj=()=>{},kj=(e,t)=>{let n=(0,K.useRef)(t),r=(0,K.useRef)(null),i=(0,K.useRef)(()=>{r.current??=requestAnimationFrame(()=>{r.current=null,n.current()})});return(0,K.useEffect)(()=>{n.current=t,i.current()}),(0,K.useEffect)(()=>{if(e===null)return Oj;let t=i.current;e.addEventListener(`scroll`,t,{passive:!0});let n=new ResizeObserver(t);return n.observe(e),()=>{e.removeEventListener(`scroll`,t),n.disconnect(),r.current!==null&&(cancelAnimationFrame(r.current),r.current=null)}},[e]),()=>{i.current()}},Aj=()=>{},jj=(e,t)=>{let n=(0,K.useRef)(t);(0,K.useEffect)(()=>{n.current=t}),(0,K.useEffect)(()=>{if(e===null)return Aj;let t=new ResizeObserver(()=>{n.current()});return t.observe(e),()=>{t.disconnect()}},[e])},Mj=`[data-scope-line]`,Nj=`[data-scope-last]`,Pj=(e,t)=>{let n=[...e.querySelectorAll(Mj)],r=e.querySelector(Nj);n.forEach(e=>{let n=e===r&&t<0?`translateY(${String(t)}px)`:``;e.style.transform!==n&&(e.style.transform=n)})},Fj=(e,t)=>{let n=`${String(Math.round(Dj(e)+t))}px`;e.style.scrollPaddingTop!==n&&(e.style.scrollPaddingTop=n)},Ij=(e,t)=>{let n=(0,K.useRef)(null),r=(0,K.useRef)(!0);return{markDirty:()=>{r.current=!0},read:()=>{if(e===null||!t)return rj;let i={rows:e.file.rows,enclosedBy:e.file.enclosedBy};return(r.current||n.current?.key!==e.file.fingerprint)&&(n.current={key:e.file.fingerprint,value:lj({container:e.container,grid:e.grid},i)},r.current=!1),vj(n.current.value,i,yj(e.container,e.grid))}}},Lj=(e,{grid:t,file:n})=>{let{isScoped:r}=Qe(),[i,a]=(0,K.useState)([]),o=(0,K.useRef)([]),s=Ij(e===null||t===null||n===void 0?null:{container:e,grid:t,file:n},r),c=kj(e,()=>{if(e===null)return;let t=s.read();Cj(t.lines,o.current)||(o.current=t.lines,(0,Tl.flushSync)(()=>{a(t.lines)})),Pj(e,t.push),Fj(e,t.height)});return jj(t,()=>{s.markDirty(),c()}),i},Rj=({props:e,file:t,whole:n,container:r})=>{let{state:i,setState:a}=e,[o,s]=(0,K.useState)(null),c=t?.rows??[],l=o===null?-1:c.findIndex(e=>e.new===o),u=`${t?.fingerprint??``}|${String(i.context)}|${String(i.isWrapped)}`;return VA(l===-1?``:`${String(o)}|${u}`,()=>{r!==null&&t!==void 0&&Ej(r,t,l),s(null)}),e=>{s(e),c.some(t=>t.new===e)||a(PA(i,{path:i.selected,line:e,rows:n?.rows??[]}))}},zj=()=>{let e=(0,K.useRef)({node:null,left:0});return{panRef:(0,K.useCallback)(t=>{e.current.node=t,t!==null&&(t.scrollLeft=e.current.left)},[]),handleCodeScroll:t=>{e.current.left=t,e.current.node!==null&&(e.current.node.scrollLeft=t)}}},Bj=e=>{let t=new WeakMap;return n=>{let r=n?.rows??[],i=t.get(r);if(i!==void 0)return i;let a=new Map(r.flatMap(t=>t.new===null?[]:[[t.new,e(t)]]));return t.set(r,a),a}},Vj=Bj(e=>e.html),Hj=Bj(e=>e.op),Uj=Bj(e=>e.old),Wj=({props:e,file:t,whole:n})=>{let[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(null),s=Lj(r,{grid:a,file:t}),c=Rj({props:e,file:t,whole:n,container:r}),{panRef:l,handleCodeScroll:u}=zj(),d=Vj(n),f=Hj(t),p=Uj(n);return{setContainer:i,setGrid:o,handleCodeScroll:u,stack:(0,q.jsx)(HA,{htmlOf:e=>d.get(e)??``,lines:s,oldOf:e=>p.get(e)??null,onPick:c,opOf:e=>f.get(e)??`ctx`,panRef:l})}},Gj=({failure:e,onDismiss:t})=>e===null?null:(0,q.jsxs)(`p`,{className:`m-0 flex items-start justify-between gap-3 border-b border-border px-3 py-2 text-sm text-destructive`,role:`alert`,children:[(0,q.jsx)(`span`,{children:e}),(0,q.jsx)(`button`,{className:`shrink-0 text-subtle hover:text-foreground`,onClick:t,type:`button`,children:`Dismiss`})]}),Kj=({from:e})=>e.map((e,t)=>e.failure===null?null:(0,q.jsx)(Gj,{failure:e.failure,onDismiss:e.handleDismissFailure},`${String(t)}:${e.failure}`)),qj={added:`New file`,modified:`Changed`,deleted:`Deleted file`,renamed:`Renamed`,copied:`Copied`},Jj=({file:e,counts:t})=>(0,q.jsxs)(`p`,{className:`m-0 flex gap-2 px-4 pt-1 pb-2.5 text-ui text-muted-foreground tabular-nums md:hidden`,children:[(0,q.jsx)(`span`,{className:`font-mono text-sign-add`,children:`+${String(t.added)}`}),t.removed>0?(0,q.jsx)(`span`,{className:`font-mono text-sign-del`,children:`−${String(t.removed)}`}):null,(0,q.jsx)(`span`,{children:qj[e.status]})]}),Yj=({file:e})=>(e.status===`renamed`||e.status===`copied`)&&e.added===0&&e.removed===0?(0,q.jsxs)(`p`,{className:`m-0 px-5 py-4 text-sm text-muted-foreground max-md:px-4`,children:[`${e.status===`renamed`?`Moved`:`Copied`} from `,(0,q.jsx)(`code`,{className:`font-mono text-foreground`,children:e.previousPath}),` with no changes: git paired the two files because their content is the same.`]}):null,Xj=({block:e,file:t,state:n})=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(JO,{block:e,path:t.path,state:n}),(0,q.jsx)(Yj,{file:t})]}),Zj=({props:e,file:t,marks:n})=>(0,q.jsx)(ek,{cursor:e.state.isLayered?e.state.cursor:null,getSince:n.getSince,path:t.path,view:e.sinceView}),Qj=({props:e,file:t,whole:n,comments:r,marks:i,acts:a,selection:o,jump:s,headActions:c})=>{let{block:l,place:u,state:d}=e,f=eA({place:u,branch:l.branch,file:t}),p=Wj({props:e,file:t,whole:n}),{editorFolder:m,counts:h,...g}=BA(e,t),{openFold:_,toggleRun:v}=NA(e),y=t!==void 0&&o!==null&&e.isFileLoaded(t.path);return(0,q.jsx)(`div`,{className:`min-h-0 min-w-0 review-diff`,"data-editor-folder":m??void 0,"data-review-diff":!0,ref:n=>{p.setContainer(n),n!==null&&y&&e.onDiffShown(n,t)},children:y?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Kj,{from:[r,i,a]}),(0,q.jsx)(Zj,{file:t,marks:i,props:e}),(0,q.jsx)(Jj,{counts:h,file:t}),(0,q.jsx)($O,{block:l,file:t,place:u}),(0,q.jsx)(`div`,{onMouseLeave:f.hover.handleLeave,onMouseMove:f.handleMove,children:(0,q.jsx)(xO,{...g,headActions:c,lead:(0,q.jsx)(Xj,{block:l,file:t,state:d}),counts:h,onOpenFold:_,onToggleRun:v,actions:r.actions,file:t,onCodeScroll:p.handleCodeScroll,rowsRef:p.setGrid,scope:p.stack,live:r.live,cursorRow:d.focus===`diff`?d.row:null,isWrapped:d.isWrapped,selection:o})}),(0,q.jsx)(Ak,{canJump:s.canJump,isOpen:f.hover.isOpen,onClose:f.hover.handleClose,onEnter:f.hover.handleEnter,onJump:(e,t)=>{f.hover.handleClose(),s.handleJump(e,t)},onLeave:f.hover.handleLeave,shown:f.hover.shown})]}):(0,q.jsx)(`p`,{className:`m-0 p-3 text-sm text-subtle`,children:l.error??(t===void 0?`No file selected`:`Reading ${t.path}…`)})},d.selected)},$j={key:`e`,keys:[`e`]},eM=({isOn:e,label:t,said:n,shortcutKey:r,onToggle:i})=>(0,q.jsx)(Ee,{keys:[r],label:n,side:`bottom`,children:(0,q.jsxs)(`button`,{"aria-pressed":e,className:`group inline-flex h-6 items-center gap-1.75 rounded-md px-2 text-xs text-muted-foreground hover:bg-secondary hover:text-foreground`,"data-on":e?``:void 0,onClick:i,type:`button`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`relative h-4 w-6.5 rounded-full bg-secondary transition-colors duration-200 group-data-on:bg-sign-add`,children:(0,q.jsx)(`span`,{className:`absolute inset-s-0.5 top-0.5 size-3 rounded-full bg-muted-foreground transition-transform duration-200 ease-out group-data-on:translate-x-2.5 group-data-on:bg-white`})}),t]})}),tM=()=>{let{isNoted:e,isOthersShown:t}=Qe();return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(eM,{isOn:e,label:`Notes`,onToggle:At,said:`Layer notes over the code`,shortcutKey:`I`}),(0,q.jsx)(eM,{isOn:t,label:`Other layers`,onToggle:gt,said:`Other layers' lines in place, quiet, rather than folded`,shortcutKey:`O`})]})},nM=({isReviewed:e,isLayered:t,canOpen:n,onPress:r})=>(0,q.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 font-sans`,children:[t?(0,q.jsx)(tM,{}):null,(0,q.jsx)(Ee,{keys:[`m`],side:`bottom`,children:(0,q.jsxs)(`button`,{"aria-pressed":e,className:`inline-flex h-6 press items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground hover:bg-secondary hover:text-foreground aria-pressed:text-success`,onClick:()=>{r(`m`)},type:`button`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:G(`grid size-3.25 place-items-center rounded-sm border transition-colors duration-150`,e?`border-success bg-success text-background`:`border-input`),children:(0,q.jsx)(Gn,{className:`size-2.5 icon-swap`,"data-off":e?void 0:``,strokeWidth:3})}),e?`Reviewed`:`Mark reviewed`]})}),n?(0,q.jsx)(s,{label:`Open in editor`,onClick:()=>{r(`e`)},shortcut:$j,size:`icon-xs`,children:(0,q.jsx)(di,{})}):null]}),rM={remarks:`Remarks`,dismissed:`Dismissed`,held:`Waiting to be sent`,asked:`Waiting on you`,filed:`Not picked up`,with:`Picked up, no answer`,answered:`Answered, not settled`,movedOn:`The branch moved past these`,settled:`Settled`,removed:`Removed`},iM=[`remarks`,`held`,`asked`,`filed`,`with`,`answered`,`movedOn`,`settled`,`removed`,`dismissed`],aM=({threads:e,remarks:t,drafts:n,isTheirs:r,pile:i})=>{let a=new Map(iM.map(e=>[e,[]]));return t.filter(e=>e.state!==`accepted`).forEach(e=>{a.get(e.state===`dismissed`?`dismissed`:`remarks`)?.push({kind:`remark`,remark:e})}),n.forEach(e=>{a.get(`held`)?.push({kind:`draft`,draft:e})}),e.forEach(e=>{a.get(i?.get(e.id)??e.section)?.push({kind:`thread`,thread:e})}),iM.flatMap(e=>{let t=a.get(e)??[],n=e===`held`&&r?`Held for the author`:rM[e];return t.length===0?[]:[{key:e,title:n,entries:t}]})},oM=e=>e.kind===`thread`?e.thread:e.kind===`remark`?e.remark:e.draft,sM=e=>{if(e.kind===`thread`&&e.thread.isAboutBranch)return{file:``,label:`Reading order`,line:0};let t=oM(e),n=t.file.split(`/`).at(-1)??t.file,r=t.start===t.end?String(t.end):`${String(t.start)}-${String(t.end)}`;return{file:t.file,label:`${n}:${r}`,line:t.start}},cM=e=>oM(e).body.split(`
42
+ `)[0]??``,lM=new Set([`remarks`,`asked`,`with`,`answered`]),uM=new Set([`settled`,`removed`,`dismissed`]),dM=e=>{if(e.kind!==`thread`)return cM(e);let{thread:t}=e;return(t.doing?.body??t.turns.at(-1)?.body??t.body).split(`
43
+ `)[0]??``},fM=e=>{if(e.kind!==`thread`)return null;let{thread:t}=e;return t.doing?.at??t.turns.at(-1)?.at??t.at},pM=e=>e.kind===`thread`?e.thread.unread>0||e.thread.stand===`asked`:e.kind===`remark`&&e.remark.state!==`dismissed`,mM=new Set([`j`,`k`,`ArrowDown`,`ArrowUp`,`Enter`,`Escape`,`d`,`X`]),hM=e=>e.kind===`thread`&&(e.thread.isMovedPast||e.thread.isAboutBranch),gM=e=>oM(e).id,_M=new Set([`asked`,`answered`,`movedOn`]),vM=e=>_M.has(e),yM=e=>e===void 0||e.isSettled||e.state===`removed`||e.turns.at(-1)?.voice===`reviewer`||e.stand!==`asked`&&e.stand!==`answered`,bM=e=>aM({threads:e,remarks:[],drafts:[],isTheirs:!1}).flatMap(({key:e,entries:t})=>vM(e)?t.flatMap(t=>t.kind===`thread`&&!yM(t.thread)?[{id:t.thread.id,section:e}]:[]):[]),xM=e=>new Map(e.map(e=>[e.id,e])),SM=(e,t)=>{let n=xM(t);return e.filter(e=>!yM(n.get(e.id))).length},CM=e=>e!==void 0&&!e.isSettled&&e.state!==`removed`,wM=(e,t)=>{let n=xM(t);return e.filter(e=>CM(n.get(e.id)))},TM=(e,t)=>{let n=xM(t);return e.find(e=>!yM(n.get(e.id)))?.id??null},EM=(e,{threads:t,at:n,offset:r})=>{let i=wM(e,t);if(n===null)return(r>0?i[0]:i.at(-1))?.id??null;let a=e.map(e=>e.id),o=a.indexOf(n),s=i.filter(e=>a.indexOf(e.id)>o),c=i.filter(e=>a.indexOf(e.id)<o);return(r>0?s[r-1]:c.at(r))?.id??null},DM=(e,{threads:t,at:n,offset:r})=>{let i=wM(e,t),a=[...new Set(i.map(e=>e.section))],o=e.find(e=>e.id===n)?.section??a[0],s=o===void 0?-1:a.indexOf(o),c=e=>i.find(t=>t.section===e)?.id??null;if(r>0)return c(a[s+1])??n;let l=c(o);return l!==n&&l!==null?l:c(a[s-1])??n},OM=e=>e===null?void 0:new Map(e.map(e=>[e.id,e.section])),kM=e=>{let t=e.lastIndexOf(`/`)+1;return{dir:e.slice(0,t),base:e.slice(t)}},AM=e=>e.start===e.end?String(e.start):`${String(e.start)}–${String(e.end)}`,jM=({thread:e})=>{if(e.isAboutBranch)return(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:`Reading order`});let{dir:t,base:n}=kM(e.file);return(0,q.jsxs)(`span`,{className:`min-w-0 truncate font-mono`,title:e.file,children:[(0,q.jsx)(`span`,{className:`text-subtle`,children:t}),(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:n}),(0,q.jsx)(`span`,{className:`text-subtle`,children:`:${AM(e)}`})]})},MM=({children:e})=>(0,q.jsx)(`span`,{className:`shrink-0 rounded-sm bg-secondary px-1.5 text-2xs whitespace-nowrap text-muted-foreground`,children:e}),NM=e=>{let t=kM(e.file).base;return e.isMovedPast?`Open in ${e.layerAddress===null?t:`layer ${e.layerAddress}`}, near line ${String(e.start)}`:`Open in the diff, at line ${String(e.start)}`},PM=e=>e.start===e.end?`line ${String(e.start)} is gone`:`lines ${AM(e)} are gone`,FM={changed:`Changed since you commented`,before:`Before the change`,now:null},IM={add:`+`,del:`−`,ctx:``,gap:``},LM=({code:e,stand:t})=>{let n=FM[e.said];return(0,q.jsxs)(`div`,{className:`border-b border-border bg-background py-1.5`,children:[n===null?null:(0,q.jsx)(`div`,{className:`px-3 pt-0.5 pb-1.5 text-xs text-subtle`,children:n}),(0,q.jsx)(`div`,{className:`grid font-mono text-xs/5`,children:e.rows.map((n,r)=>(0,q.jsxs)(`div`,{className:G(`thread-code-row`,n.op===`add`&&`bg-line-add`,n.op===`del`&&`bg-line-del`),children:[(0,q.jsx)(`span`,{className:G(`grid place-items-center`,rd[t]),children:e.marked[r]===!0?(0,q.jsx)(od,{stand:t}):null}),(0,q.jsx)(`span`,{className:`pe-1.5 text-end text-subtle tabular-nums`,children:n.old??``}),(0,q.jsx)(`span`,{className:`pe-1.5 text-end text-subtle tabular-nums`,children:n.new??``}),(0,q.jsx)(`span`,{className:G(`text-center`,n.op===`add`&&`text-sign-add`,n.op===`del`&&`text-sign-del`),children:IM[n.op]}),(0,q.jsx)(`span`,{className:`overflow-hidden pe-3 text-ellipsis whitespace-pre`,dangerouslySetInnerHTML:{__html:n.html}})]},`${n.op}:${String(n.old)}:${String(n.new)}`))})]})},RM=({thread:e,lead:t,...n})=>{let r=t.placed(e),i=Km(r.root,r.replies),a=t.code[e.id],o=t.current?.id===e.id,c=r.replies.length+1,l=r.replies.at(-1)?.at??r.root.at;return(0,q.jsxs)(`article`,{className:G(`grid scroll-mt-14 overflow-hidden rounded-lg border bg-wash font-sans text-sm`,o&&`border-foreground/22`,!o&&i===`asked`&&`border-stand-asked/45`,!o&&i!==`asked`&&`border-border`),"data-thread-card":e.id,"data-thread-current":o?``:void 0,onFocusCapture:()=>{t.pick(e.id)},children:[(0,q.jsxs)(`div`,{className:`flex h-8 min-w-0 items-center gap-1.5 border-b border-border px-3 text-xs`,children:[(0,q.jsx)(qm,{stand:i}),(0,q.jsx)(`button`,{className:`flex min-w-0 items-center text-start`,onClick:()=>{t.pick(e.id)},type:`button`,children:(0,q.jsx)(jM,{thread:e})}),e.isMovedPast?(0,q.jsx)(MM,{children:PM(e)}):null,e.isOutdated&&!e.isMovedPast?(0,q.jsx)(MM,{children:`Code changed`}):null,(0,q.jsx)(`span`,{className:`flex-1`}),(0,q.jsx)(`span`,{className:`shrink-0 whitespace-nowrap text-subtle tabular-nums`,children:`${String(c)} ${c===1?`message`:`messages`} ·`}),(0,q.jsx)(`span`,{className:`shrink-0`,children:(0,q.jsx)(GE,{at:l})}),e.isAboutBranch?null:(0,q.jsx)(`span`,{className:`-me-1.5 shrink-0`,children:(0,q.jsx)(s,{label:NM(e),onClick:()=>{t.showInDiff(e)},size:`icon-xs`,variant:`ghost`,children:(0,q.jsx)(zr,{})})})]}),a===void 0?null:(0,q.jsx)(LM,{code:a,stand:i}),(0,q.jsx)(tD,{...n,isCurrent:o,thread:{...r,isOutdated:a===void 0&&r.isOutdated}})]})},zM={asked:`Waiting on you`,answered:`Answered, not settled`,movedOn:`The branch moved past these`},BM=e=>zM[e],VM={asked:`text-stand-asked`,answered:`text-stand-answered`,movedOn:`text-foreground`},HM=({thread:e,lead:t})=>{let n=e.turns.length+1;return(0,q.jsxs)(`button`,{className:`flex h-8 min-w-0 items-center gap-2 rounded-lg border border-border bg-wash px-3 text-start text-xs text-subtle`,onClick:()=>{t.showInDiff(e)},type:`button`,children:[(0,q.jsx)(`span`,{className:G(`inline-grid shrink-0`,rd.settled),children:(0,q.jsx)(od,{stand:`settled`})}),(0,q.jsx)(`span`,{className:`shrink-0`,children:`Settled`}),(0,q.jsx)(`span`,{className:`shrink-0 font-mono`,children:e.isAboutBranch?`Reading order`:`${kM(e.file).base}:${AM(e)}`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:e.body.split(`
44
+ `)[0]}),(0,q.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:`${String(n)} messages`})]})},UM=e=>{let t=e.pile.map(e=>e.id),n=e.current===void 0?t.length:t.indexOf(e.current.id);return t.slice(0,n).filter(t=>!yM(e.found.get(t)))},WM=(e,t)=>e.left===0?`Every thread is handled`:t.length>0?null:`${String(e.left)} left`,GM=({lead:e,onTurn:t})=>{let n=UM(e),r=WM(e,n);return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-1 pt-4 text-xs text-subtle`,children:[r===null?(0,q.jsx)(`button`,{className:`text-muted-foreground hover:text-foreground`,onClick:()=>{e.pick(n[0]??null)},type:`button`,children:`${String(n.length)} skipped above`}):(0,q.jsx)(`span`,{children:r}),(0,q.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,q.jsxs)(`button`,{className:`inline-flex items-center gap-1.5 hover:text-foreground`,onClick:t,type:`button`,children:[(0,q.jsx)(V,{children:`T`}),`goes back to the diff`]})]})},KM=e=>e.reduce((e,t)=>{let n=e.at(-1);return n?.section===t.section?n.ids.push(t.id):e.push({section:t.section,ids:[t.id]}),e},[]),qM=({onTurn:e,...t})=>{let{lead:n}=t,r=KM(n.pile),i=n.current?.id??``;VA(i,()=>{requestAnimationFrame(()=>{document.querySelector(`[data-thread-card="${CSS.escape(i)}"]`)?.scrollIntoView({block:`start`,behavior:`smooth`})})});let a=n.pile.find(e=>e.id===n.current?.id)?.section??r[0]?.section;return(0,q.jsxs)(`div`,{className:`min-h-0 min-w-0 review-diff`,"data-review-threads":!0,children:[(0,q.jsxs)(`div`,{className:`sticky top-0 z-4 flex h-11 items-center gap-2.5 border-b border-border bg-background ps-5 pe-3 text-xs`,children:[a===void 0?(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:`Nothing needs you`}):(0,q.jsx)(`span`,{className:G(`font-medium`,VM[a]),children:BM(a)}),(0,q.jsx)(`span`,{className:`text-subtle tabular-nums`,children:`${String(n.left)} left`}),(0,q.jsx)(`span`,{className:`flex-1`}),(0,q.jsx)(Ee,{keys:[`↵`],children:(0,q.jsx)(`button`,{className:`inline-flex h-6 items-center gap-1.5 rounded-md px-2 text-muted-foreground hover:bg-secondary hover:text-foreground disabled:opacity-50`,disabled:n.current===void 0||n.current.isAboutBranch,onClick:()=>{n.showInDiff()},type:`button`,children:`Show in the diff`})})]}),(0,q.jsxs)(`div`,{className:`grid gap-2.5 px-4 pt-3 pb-24`,children:[r.map((e,r)=>(0,q.jsxs)(`section`,{className:`grid gap-2.5`,children:[r===0?null:(0,q.jsx)(`h3`,{className:`m-0 -mx-4 mt-3 border-t border-border px-5 pt-3 pb-0.5 text-xs font-medium`,children:(0,q.jsx)(`span`,{className:VM[e.section],children:BM(e.section)})}),e.ids.map(e=>{let r=n.found.get(e);return r===void 0?null:r.isSettled?(0,q.jsx)(HM,{lead:n,thread:r},e):(0,q.jsx)(RM,{...t,thread:r},e)})]},`${e.section}:${String(r)}`)),(0,q.jsx)(GM,{lead:n,onTurn:e})]})]})},JM=`inline-flex h-6 items-center gap-1.5 rounded-md px-2.5 font-medium text-muted-foreground hover:text-foreground aria-pressed:bg-secondary aria-pressed:text-foreground`,YM=({isThreads:e,left:t,onTurn:n})=>(0,q.jsx)(Ee,{keys:[`T`],label:`The diff, or every thread that needs you, in the middle`,children:(0,q.jsxs)(`fieldset`,{className:`m-0 inline-flex min-w-0 shrink-0 items-center gap-0.5 rounded-lg border border-border bg-background p-0.5`,children:[(0,q.jsx)(`legend`,{className:`sr-only`,children:`What fills the middle`}),(0,q.jsx)(`button`,{"aria-pressed":!e,className:JM,onClick:e?n:void 0,type:`button`,children:`Diff`}),(0,q.jsxs)(`button`,{"aria-pressed":e,className:JM,onClick:e?void 0:n,type:`button`,children:[`Threads`,(0,q.jsx)(`span`,{className:`font-normal text-subtle tabular-nums`,children:`${String(t)} left`})]})]})}),XM=({props:e,pane:t,lead:n,onPress:r})=>{let{state:i}=e,a=n.turn;return n.isOn?(0,q.jsx)(qM,{actions:t.comments.actions,lead:n,live:t.comments.live,onTurn:a}):(0,q.jsx)(Qj,{acts:t.acts,comments:t.comments,file:t.file,headActions:(0,q.jsx)(nM,{canOpen:e.block.worktree!==null&&t.file?.status!==`deleted`,isLayered:i.isLayered,isReviewed:t.file!==void 0&&t.model.isReadHere(t.file.path),onPress:r}),jump:t.jump,marks:t.model.marks,props:e,selection:t.selection,whole:t.model.files.get(i.selected)})},ZM=(e,t,n)=>`${String(e)} ${e===1?t:n}`,QM=e=>e.state!==`accepted`&&e.state!==`dismissed`,$M={title:`Nothing needs you`,rest:``},eN=(e,t)=>e+t===0?$M:{title:ZM(e,`remark`,`remarks`),rest:t===0?``:`· ${ZM(t,`note`,`notes`)} held for the author`},tN=({asked:e,unread:t})=>{let n=`${ZM(t,`answer`,`answers`)} to read`;return e>0?{title:ZM(e,`question`,`questions`),rest:t>0?`· ${n}`:``}:t>0?{title:n,rest:``}:$M},nN=({counts:e,remarks:t,drafts:n,isTheirs:r})=>r?eN(t.filter(e=>QM(e)).length,n.length):e===null?null:tN(e),rN=({counts:e,remarks:t,isTheirs:n})=>n?t.filter(e=>QM(e)).length:e?.asked??0,iN=({label:e,hint:t,isFilled:n=!1,onClick:r})=>{let i=(0,q.jsx)(`button`,{className:G(`inline-flex h-7 shrink-0 press items-center gap-1.5 rounded-md border px-2.5 text-xs font-medium max-md:h-11 max-md:rounded-full max-md:px-4 max-md:text-sm`,n?`border-accent bg-accent text-accent-foreground`:`border-border bg-background hover:bg-row-hover`),onClick:r,type:`button`,children:e});return t===void 0?i:(0,q.jsx)(Ee,{keys:[t],children:i})},aN=({entry:e})=>{let t=sM(e),n=fM(e);return(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-xs/4.5 text-subtle max-md:text-sm/5`,children:[(0,q.jsxs)(`span`,{className:G(`truncate`,t.file===``?``:`font-mono`),title:t.file,children:[e.kind===`remark`?`${e.remark.by} · `:``,t.label]}),n===null?null:(0,q.jsx)(`span`,{className:`ms-auto shrink-0 tabular-nums`,children:(0,q.jsx)(GE,{at:n})})]})},oN=({entry:e})=>e.kind===`thread`?(0,q.jsx)(`span`,{className:G(`grid h-4.5 w-4 shrink-0 place-items-center`,rd[e.thread.stand]),children:(0,q.jsx)(od,{stand:e.thread.stand})}):null,sN=({entry:e,sectionKey:t,isOn:n,onPick:r,tools:i})=>{let a=lM.has(t);return(0,q.jsxs)(`div`,{className:`group/row relative px-1.5`,children:[(0,q.jsxs)(`button`,{className:G(`flex w-full animate-enter gap-2 rounded-lg px-2 pt-2 pb-2.5 text-start transition-colors duration-150 max-md:px-3`,n?`bg-line-selected`:`group-hover/row:bg-row-hover`,a?`max-md:min-h-20`:`max-md:min-h-14`),"data-panel-entry":gM(e),onClick:r,type:`button`,children:[t===`movedOn`?(0,q.jsx)(oN,{entry:e}):null,(0,q.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,q.jsx)(aN,{entry:e}),(0,q.jsx)(`span`,{className:G(`text-ui wrap-anywhere transition-colors duration-300 max-md:text-base/6`,a?`line-clamp-2`:`line-clamp-1`,pM(e)?`text-foreground`:`text-subtle`),children:dM(e)})]})]}),i===void 0?null:(0,q.jsx)(`div`,{className:G(`pointer-events-none absolute inset-e-3 top-1 flex items-center gap-0.5 rounded-md opacity-0 transition-opacity duration-150 group-focus-within/row:pointer-events-auto group-focus-within/row:opacity-100 group-hover/row:pointer-events-auto group-hover/row:opacity-100 max-md:hidden`,n?`bg-line-selected`:`bg-row-hover`),children:i})]})},cN={asked:`text-stand-asked`,answered:`text-stand-answered`,filed:`text-stand-filed`,with:`text-stand-waiting`},lN=({section:e,count:t=e.entries.length,children:n})=>(0,q.jsxs)(`h3`,{className:`m-0 px-3.5 pt-5 pb-1.5 text-xs/4.5 font-medium text-muted-foreground max-md:px-5 max-md:text-sm`,children:[(0,q.jsx)(`span`,{className:cN[e.key],children:e.title}),(0,q.jsx)(`span`,{className:`ms-1.5 font-normal text-subtle tabular-nums`,children:t}),n]}),uN=(e,t)=>e.kind!==`thread`||t?.has(e.thread.id)!==!0||!yM(e.thread)?null:Wm[e.thread.isSettled?`settled`:e.thread.stand],dN=({entry:e,isOn:t,said:n,onPick:r})=>(0,q.jsx)(`div`,{className:`px-1.5`,children:(0,q.jsxs)(`button`,{className:G(`flex h-7.5 w-full items-center gap-2 rounded-lg px-2 text-start text-xs text-subtle`,t?`bg-line-selected`:`hover:bg-row-hover`),"data-panel-entry":gM(e),onClick:r,type:`button`,children:[(0,q.jsx)(oN,{entry:e}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:sM(e).label}),(0,q.jsx)(`span`,{className:`shrink-0`,children:n})]})}),fN=({said:e})=>e===null?null:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 px-3.5 pt-3.5 pb-1 max-md:px-5 max-md:pt-4`,children:[(0,q.jsx)(`b`,{className:`text-sm/5 font-semibold max-md:text-3xl/9 max-md:font-bold`,children:e.title}),e.rest===``?null:(0,q.jsx)(`span`,{className:`text-xs text-subtle max-md:text-base`,children:e.rest})]}),pN=[[`j k`,`move`],[`↵`,`open`],[`d`,`settle`],[`D`,`settle what is read`],[`X`,`remove`],[`esc`,`back to the diff`]],mN=()=>(0,q.jsx)(`div`,{className:`absolute inset-x-2 top-1 z-10 key-hint flex-wrap gap-x-3 gap-y-1 rounded-md border border-border bg-popover px-3 py-2 text-xs text-muted-foreground shadow-md max-md:hidden`,children:pN.map(([e,t])=>(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,q.jsx)(`kbd`,{className:`font-mono`,children:e}),t]},t))}),hN=()=>(0,q.jsxs)(`div`,{className:`grid gap-1 px-4 py-7 text-ui text-muted-foreground`,children:[(0,q.jsx)(`b`,{className:`text-sm font-semibold text-foreground`,children:`No comments yet`}),`Select lines in the diff and press c to write one. Each comment you send lands here, under where it stands.`]}),gN=({remark:e,acts:t,onWrite:n})=>e.state===`dismissed`?(0,q.jsx)(iN,{label:`Restore`,onClick:()=>{t.remark(e,`restore`)}}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(iN,{isFilled:!0,label:`Accept`,onClick:()=>{t.remark(e,`accept`)}}),(0,q.jsx)(iN,{label:`Dismiss`,onClick:()=>{t.remark(e,`dismiss`)}}),(0,q.jsx)(iN,{label:`Reply`,onClick:n})]}),_N=({draft:e,acts:t,onWrite:n})=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(iN,{label:`Reword`,onClick:n}),(0,q.jsx)(iN,{label:`Drop`,onClick:()=>{t.draft(e,null)}})]}),vN=({entry:e,acts:t})=>{let[n,r]=(0,K.useState)(!1);if(e.kind===`thread`)return null;let i=()=>{r(!0)};return(0,q.jsxs)(`div`,{className:`mb-2 px-3.5`,children:[(0,q.jsx)(Cm,{isOpen:n,children:(0,q.jsx)(Um,{draftKey:`panel:${gM(e)}`,isFocused:!0,onCancel:()=>{r(!1)},onSubmit:async n=>{r(!1),await(e.kind===`remark`?t.remark(e.remark,`reply`,n):t.draft(e.draft,n))},placeholder:e.kind===`draft`?`Reword the note`:`Write back to the remark`,submitLabel:e.kind===`draft`?`Save`:`Reply`})}),(0,q.jsx)(Cm,{isOpen:!n,children:(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.kind===`remark`?(0,q.jsx)(gN,{acts:t,onWrite:i,remark:e.remark}):(0,q.jsx)(_N,{acts:t,draft:e.draft,onWrite:i})})})]})},yN=({label:e,onClick:t,children:n})=>(0,q.jsxs)(E,{children:[(0,q.jsx)(ke,{render:(0,q.jsx)(`button`,{"aria-label":e,className:`grid size-6 press place-items-center rounded-md text-muted-foreground hover:bg-secondary hover:text-foreground`,onClick:t,type:`button`}),children:n}),(0,q.jsx)(Ce,{children:e})]}),bN=e=>{let{thread:t}=e;if(!hM(e))return`Go to line ${String(t.start)}`;let n=t.file.split(`/`).at(-1)??t.file;return`Open in ${t.layerAddress===null?n:`layer ${t.layerAddress}`}, near line ${String(t.start)}`},xN=new Set([`answered`,`asked`]),SN=({entry:e,acts:t,tools:n})=>{let{thread:r}=e;return(0,q.jsxs)(q.Fragment,{children:[r.file===``?null:(0,q.jsx)(yN,{label:bN(e),onClick:()=>{n.go(r)},children:(0,q.jsx)(zr,{"aria-hidden":!0,className:`size-3.5`})}),xN.has(r.stand)&&!r.isSettled?(0,q.jsx)(yN,{label:`Settle`,onClick:()=>{n.settle(r)},children:(0,q.jsx)(Gn,{"aria-hidden":!0,className:`size-3.5`})}):null,(0,q.jsx)(yN,{label:`Remove`,onClick:()=>{t.remove(r)},children:(0,q.jsx)(Ci,{"aria-hidden":!0,className:`size-3.5`})})]})},CN=({entry:e,acts:t,tools:n})=>e.kind===`thread`?e.thread.state===`removed`?null:(0,q.jsx)(SN,{acts:t,entry:e,tools:n}):e.kind===`draft`?(0,q.jsx)(yN,{label:`Drop`,onClick:()=>{t.draft(e.draft,null)},children:(0,q.jsx)(Ci,{"aria-hidden":!0,className:`size-3.5`})}):e.remark.state===`dismissed`?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(yN,{label:`Accept`,onClick:()=>{t.remark(e.remark,`accept`)},children:(0,q.jsx)(Gn,{"aria-hidden":!0,className:`size-3.5`})}),(0,q.jsx)(yN,{label:`Dismiss`,onClick:()=>{t.remark(e.remark,`dismiss`)},children:(0,q.jsx)(Di,{"aria-hidden":!0,className:`size-3.5`})})]}),wN=e=>e.at||(e.turns[0]?.at??``),TN=(e,t)=>e.turns.find(e=>e.voice===`agent`&&e.at>=t)?.at,EN=(e,t)=>{let{seenAt:n,...r}=e;return t===void 0?r:{...r,seenAt:t}},DN=e=>{let t=wN(e);return EN({id:e.id,path:e.file,side:e.side,start:e.start,end:e.end,code:e.snippet,body:e.body,author:`you`,parent:null,at:t,resolved:e.isSettled,stand:e.stand,doing:e.doing,isOutdated:e.isOutdated?!0:void 0},TN(e,t))},ON=e=>e.state!==`removed`&&!e.isMovedPast&&!e.isAboutBranch,kN=e=>{let t=DN(e);return{root:t,replies:e.turns.map((n,r)=>EN({...t,id:`${e.id}~${String(r)}`,body:n.body,author:n.voice===`agent`?`claude`:`you`,parent:e.id,at:n.at,choices:n.choices},n.voice===`agent`?void 0:TN(e,n.at)))}},AN=e=>e.flatMap(e=>{if(!ON(e))return[];let{root:t,replies:n}=kN(e);return[t,...n]}),jN=e=>({seen:e.threads.filter(e=>e.isTaken).map(e=>e.id),comments:AN(e.threads)}),MN=(e,t)=>{let{root:n,replies:r}=kN(e),i=new Set(r.map(e=>e.body)),a=t.comments.filter(t=>t.parent===e.id&&!i.has(t.body));return{root:n,replies:[...r,...a],isOutdated:!1}},NN=(e,t)=>{let n=e.findIndex(e=>gM(e)===t.list.cursor);return r=>{let i=e[Math.min(e.length-1,Math.max(0,n===-1?0:n+r))];i!==void 0&&t.go(i,t.list.open!==null&&hM(i))}},PN=({flat:e,state:t})=>e.find(e=>gM(e)===t.list.cursor),FN=e=>{let t=PN(e);return t?.kind===`thread`?t.thread:null},IN=e=>{let t=PN(e);t!==void 0&&(e.state.go(t,!0),!hM(t)&&t.kind===`thread`&&e.props.onLeave())},LN=e=>{let t=NN(e.flat,e.state),n=FN(e),{state:r,props:i}=e;return new Map([[`j`,()=>{t(1)}],[`ArrowDown`,()=>{t(1)}],[`k`,()=>{t(-1)}],[`ArrowUp`,()=>{t(-1)}],[`Enter`,()=>{IN(e)}],[`Escape`,()=>{r.list.open===null?i.onLeave():r.setList({...r.list,open:null})}],[`d`,()=>{n!==null&&e.settle(n)}],[`X`,()=>{n!==null&&i.acts.remove(n)}]])},RN=e=>e.metaKey||e.ctrlKey||e.altKey,zN=e=>e instanceof Element&&e.closest(`textarea, input, [contenteditable]`)!==null,BN=(e,t)=>{dn(`keydown`,n=>{let r=e.current,i=LN(t).get(n.key);i===void 0||t.props.threads!==void 0||r?.contains(document.activeElement)!==!0||RN(n)||zN(n.target)||(n.preventDefault(),i())}),VA(`panel`,()=>{bm()||e.current?.focus({preventScroll:!0})}),VA(t.state.list.open??``,()=>{requestAnimationFrame(()=>{e.current?.querySelector(`[data-open-card]`)?.scrollIntoView({block:`nearest`,behavior:`smooth`})})})},VN=(e,t)=>MN(e,{comments:t.comments.live.comments}),HN=e=>e.filter(e=>!uM.has(e.key)).flatMap(e=>e.entries),UN=e=>{let[t,n]=(0,K.useState)({cursor:null,open:null,folds:{}}),[r,i]=(0,K.useState)(null),a=t=>{t.unread>0&&e.acts.read(t)},o=(e,r)=>{n({...t,cursor:r}),i({id:e.id,isReplying:!1}),a(e)},s=(r,{key:i,isInPanel:s,isWalking:c})=>{bm()?o(r,i):s?(e.onCardOpen(),n({...t,cursor:i,open:c||t.open!==r.id?r.id:null}),a(r)):(n({...t,cursor:i,open:null}),e.onJump(r))};return{list:t,setList:n,sheet:r,setSheet:i,go:(r,i)=>{let a=gM(r);r.kind===`thread`&&e.threads?.pile.has(r.thread.id)===!0?(n({...t,cursor:a,open:null}),e.threads.onPick(r.thread)):r.kind===`thread`?s(r.thread,{key:a,isInPanel:hM(r),isWalking:i}):n({...t,cursor:a,open:null})},read:a}},WN=(e,t)=>{let n=aM({...e.shown,isTheirs:e.isTheirs,pile:e.threads?.pile}),r=HN(n),{actions:i}=e.comments,a=UN(e),o=e.threads===void 0?a:{...a,list:{...a.list,cursor:e.threads.at,open:null}};return BN(t,{flat:r,state:o,props:e,settle:t=>{i.handleResolve(VN(t,e).root,!t.isSettled)}}),{sections:n,flat:r,actions:i,state:o}},GN=({thread:e,props:t,actions:n})=>{let r=e.file.split(`/`).at(-1)??e.file,i=`Open in ${e.layerAddress===null?r:`layer ${e.layerAddress}`}, near line ${String(e.start)}`,a=VN(e,t);return(0,q.jsx)(`div`,{className:`mx-1.5 mb-2 grid gap-1.5 font-sans`,"data-open-card":!0,children:(0,q.jsx)(iD,{actions:n,isCurrent:!0,live:t.comments.live,headAction:e.file===``?null:(0,q.jsxs)(E,{children:[(0,q.jsx)(ke,{render:(0,q.jsx)(`button`,{"aria-label":i,className:`-me-1.5 grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-row-hover hover:text-foreground`,onClick:()=>{t.onShowLayer(e)},type:`button`}),children:(0,q.jsx)(zr,{"aria-hidden":!0,className:`size-3.5`})}),(0,q.jsx)(Ce,{children:i})]}),thread:{...a,isOutdated:a.root.code!==``}})})},KN=e=>e.kind===`thread`&&e.thread.unread===0,qN=({title:e,count:t,isOpen:n,className:r,onToggle:i})=>(0,q.jsx)(`div`,{className:G(`px-1.5`,r),children:(0,q.jsxs)(`button`,{className:`flex h-8.5 w-full items-center gap-2 rounded-lg px-2 text-xs font-medium text-muted-foreground hover:bg-row-hover max-md:h-12 max-md:px-3 max-md:text-base`,onClick:i,type:`button`,children:[(0,q.jsx)(Zn,{"aria-hidden":!0,className:G(`size-3 text-subtle transition-transform duration-180 ease-(--e-out) max-md:size-4`,n&&`rotate-90`)}),e,(0,q.jsx)(`span`,{className:`font-normal text-subtle tabular-nums`,children:t})]})}),JN=(e,t)=>{e.setList({...e.list,folds:{...e.list.folds,[t]:e.list.folds[t]!==!0}})},YN=({entry:e,sectionKey:t,...n})=>{let{props:r,state:i,actions:a}=n,o=gM(e),s=i.list.cursor===o,c=e.kind===`thread`&&i.list.open===e.thread.id,l=uN(e,r.threads?.pile);return l===null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(sN,{entry:e,isOn:s,onPick:()=>{i.go(e,!1)},sectionKey:t,tools:(0,q.jsx)(CN,{acts:r.acts,entry:e,tools:{go:t=>{e.kind===`thread`&&!hM(e)?i.go(e,!1):r.onShowLayer(t)},settle:e=>{a.handleResolve(VN(e,r).root,!0)}}})}),e.kind===`thread`?(0,q.jsx)(Cm,{isOpen:c,children:c?(0,q.jsx)(GN,{actions:a,props:r,thread:e.thread}):null}):null,s?(0,q.jsx)(vN,{acts:r.acts,entry:e}):null]}):(0,q.jsx)(dN,{entry:e,isOn:s,onPick:()=>{i.go(e,!1)},said:l})},XN=({section:e,...t})=>{let n=e.entries.filter(e=>!KN(e)).length,r=e.key===`movedOn`,i=r?e.entries.filter(KN):[],a=t.state.list.folds.read===!0,o=e.entries.filter(e=>uN(e,t.props.threads?.pile)===null).length;return(0,q.jsxs)(`section`,{children:[(0,q.jsx)(lN,{count:o,section:e,children:r&&n>0&&t.props.threads===void 0?(0,q.jsx)(`span`,{className:`font-normal text-subtle`,children:` · ${String(n)} new`}):null}),e.entries.map(n=>(0,q.jsx)(`div`,{className:G(r&&KN(n)&&!a&&`max-md:hidden`),children:(0,q.jsx)(YN,{entry:n,sectionKey:e.key,...t})},gM(n))),i.length>0?(0,q.jsx)(qN,{className:`md:hidden`,count:i.length,isOpen:a,onToggle:()=>{JN(t.state,`read`)},title:`Read`}):null]})},ZN=({section:e,props:t,state:n})=>{let r=n.list.folds[e.key]===!0,i=e=>{e.kind===`thread`?e.thread.state===`removed`?t.acts.remove(e.thread):t.acts.settle(e.thread):e.kind===`remark`&&t.acts.remark(e.remark,`restore`)};return(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`div`,{className:`mx-3.5 mt-3 mb-1 h-px bg-border max-md:mx-5`}),(0,q.jsx)(qN,{count:e.entries.length,isOpen:r,onToggle:()=>{JN(n,e.key)},title:e.title}),(0,q.jsx)(Cm,{isOpen:r,children:e.entries.map(t=>(0,q.jsx)(`div`,{className:`px-1.5`,children:(0,q.jsxs)(`button`,{className:`grid w-full animate-enter gap-0.5 rounded-lg px-2 py-1.5 text-start hover:bg-row-hover`,onClick:()=>{i(t)},type:`button`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-subtle`,children:[(0,q.jsx)(`span`,{className:`truncate font-mono`,children:sM(t).label}),(0,q.jsx)(`span`,{className:`ms-auto shrink-0`,children:e.key===`settled`?`Reopen`:`Restore`})]}),(0,q.jsx)(`span`,{className:`line-clamp-1 text-ui wrap-anywhere text-subtle`,children:dM(t)})]})},gM(t)))})]})},QN=({props:e})=>{let t=e.threads===void 0?e.shown.threads.filter(e=>e.isSettleable).length:0,n=e.shown.drafts.length;return t===0&&n===0?null:(0,q.jsxs)(`div`,{className:`flex animate-enter flex-wrap gap-2 border-t border-border px-2.5 py-2 max-md:px-4`,children:[n>0?(0,q.jsx)(iN,{hint:`C`,isFilled:!0,label:`Send ${String(n)}${e.isTheirs?` to the pull request`:``}`,onClick:()=>{e.acts.sendDrafts()}}):null,t>0?(0,q.jsx)(iN,{hint:`D`,label:`Settle ${String(t)} read`,onClick:()=>{e.acts.settleRead()}}):null]})},$N=({props:e,panel:t})=>{let{state:n,flat:r,actions:i}=t,a=r.flatMap(e=>e.kind===`thread`?[e.thread]:[]),o=a.find(e=>e.id===n.sheet?.id);return o===void 0?null:(0,q.jsx)(FD,{canSettle:o.stand===`answered`||o.stand===`asked`,isOpen:!0,isReplying:n.sheet?.isReplying===!0,onClose:()=>{n.setSheet(null)},onNext:()=>{let e=a[a.indexOf(o)+1];n.setSheet(e===void 0?null:{id:e.id,isReplying:!1}),e!==void 0&&n.read(e)},onReply:e=>{n.setSheet({id:o.id,isReplying:e})},props:{thread:VN(o,e),live:e.comments.live,actions:i}})},eP=e=>{let t=(0,K.useRef)(null),n=WN(e,t),r=nN({counts:e.block.threadCounts,remarks:e.shown.remarks,drafts:e.shown.drafts,isTheirs:e.isTheirs}),i=e.threads===void 0?r:{title:`${String(e.threads.left)} left`,rest:``};return(0,q.jsxs)(`aside`,{"aria-label":`Review`,className:`flex min-h-0 flex-col outline-none`,"data-review-panel":!0,ref:t,tabIndex:-1,children:[(0,q.jsx)(fN,{said:i}),(0,q.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,q.jsx)(mN,{}),(0,q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto pb-3`,children:[n.sections.length===0?(0,q.jsx)(hN,{}):null,n.sections.map(t=>uM.has(t.key)?(0,q.jsx)(ZN,{props:e,section:t,state:n.state},t.key):(0,q.jsx)(XN,{actions:n.actions,props:e,section:t,state:n.state},t.key))]})]}),(0,q.jsx)(QN,{props:e}),(0,q.jsx)($N,{panel:n,props:e})]})},tP=({props:e,pane:t,paneRef:n,lead:r})=>{let{state:i,setState:a}=e;return(0,q.jsx)(eP,{acts:t.acts,block:e.block,comments:t.comments,isLayered:i.isLayered,isTheirs:e.extras.pull?.theirs===!0,onJump:r.isOn?r.showInDiff:t.threadJump.handleJump,onCardOpen:()=>{a({...i,focus:`tree`})},onLeave:()=>{a(i.isBackToThreads?{...i,lead:`threads`,isBackToThreads:!1}:{...i,focus:`diff`}),n.current?.focus({preventScroll:!0})},onShowLayer:t.threadJump.handleShowLayer,railLayer:i.isLayered?Yo(i.cursor):null,shown:t.shown,threads:r.panel})},nP=()=>{let e=(0,K.useRef)(0);return(0,K.useEffect)(()=>{let t=()=>{e.current=Date.now()};return document.addEventListener(`touchmove`,t,{passive:!0}),document.addEventListener(`wheel`,t,{passive:!0}),()=>{document.removeEventListener(`touchmove`,t),document.removeEventListener(`wheel`,t)}},[]),e},rP=6,iP=24,aP=800,oP=e=>{let[t,n]=(0,K.useState)(!1),[r,i]=(0,K.useState)(e),a=(0,K.useRef)(new WeakMap),o=nP();return e!==r&&(i(e),n(!1)),{isHidden:t,handleScroll:e=>{if(!(e instanceof HTMLElement))return;let t=e.scrollTop,r=t-(a.current.get(e)??t);a.current.set(e,t),Date.now()-o.current>aP||(t<iP||r<-6?n(!1):r>rP&&n(!0))}}},sP=(e,t,n)=>{let r=e.indexOf(t);return[...e.slice(r+1),...e.slice(0,Math.max(0,r))].find(e=>!n(e))??null},cP=e=>e=>{let t=e?.querySelector(`[aria-current="page"]`);e!==null&&t!=null&&(e.style.setProperty(`--pill-x`,`${String(t.offsetLeft)}px`),e.style.setProperty(`--pill-w`,`${String(t.offsetWidth)}px`))},lP=()=>{if(typeof navigator.vibrate==`function`){navigator.vibrate(1);return}let e=document.createElement(`label`);e.innerHTML=`<input type="checkbox" switch>`,e.style.display=`none`,document.body.append(e),e.click(),e.remove()},uP=24,dP=8,fP=.35,pP=.35,mP=28,hP=.6,gP=100,_P=260,vP=`translate ${String(_P)}ms var(--e-drawer), opacity ${String(_P)}ms var(--e-drawer)`,yP=420,bP=()=>globalThis.matchMedia(`(display-mode: standalone)`).matches||`standalone`in navigator&&navigator.standalone===!0,xP=()=>globalThis.matchMedia(`(max-width: 767px)`).matches,SP=(e,t)=>{let{shown:n,under:r}=e;if(n===null||r===null)return;let i=Math.min(1,Math.max(0,t/n.offsetWidth));n.style.translate=`${String(i*gP)}% 0`,r.style.translate=`${String((i-1)*mP)}% 0`,r.style.opacity=String(hP+.4*i)},CP=e=>{for(let t of[e.shown,e.under])t?.style.removeProperty(`translate`),t?.style.removeProperty(`opacity`),t?.style.removeProperty(`transition`);e.shown!==null&&delete e.shown.dataset.backTop,delete e.box.dataset.backDrag},wP=e=>{e.box.dataset.swiped=``,e.back.onBack(),globalThis.requestAnimationFrame(()=>{CP(e)}),globalThis.setTimeout(()=>{delete e.box.dataset.swiped},yP)},TP=(e,t)=>{let n=e.shown?.offsetWidth??0,r=t/Math.max(1,Date.now()-e.at),i=t>n*fP||r>pP;for(let t of[e.shown,e.under])t?.style.setProperty(`transition`,vP);SP(e,i?n:0),i&&lP(),globalThis.setTimeout(()=>{i?wP(e):CP(e)},_P)},EP=e=>{let t=e.back.getViews();e.shown=t===null?null:Lf(e.box,t.shown),e.under=t===null?null:Lf(e.box,t.back),t===null||e.shown===null||e.under===null?e.phase=`idle`:(e.box.dataset.backDrag=t.back,e.shown.dataset.backTop=``,e.phase=`drag`)},DP=(e,t)=>{let[n]=e.touches;return e.touches.length===1&&n!==void 0&&n.clientX<=uP&&xP()&&bP()&&t.getViews()!==null},OP=(e,t)=>{let n={box:e,back:t,phase:`idle`,left:0,top:0,at:0,shown:null,under:null};return{handleStart:e=>{let[r]=e.touches;n.phase=DP(e,t)?`maybe`:`idle`,n.left=r?.clientX??0,n.top=r?.clientY??0,n.at=Date.now()},handleMove:e=>{let[t]=e.touches,r=(t?.clientX??n.left)-n.left,i=Math.abs((t?.clientY??n.top)-n.top);n.phase===`maybe`&&Math.max(r,i)>dP&&(r>i?EP(n):n.phase=`idle`),n.phase===`drag`&&(e.preventDefault(),SP(n,r))},handleEnd:e=>{let[t]=e.changedTouches;n.phase===`drag`&&TP(n,(t?.clientX??n.left)-n.left),n.phase=`idle`}}},kP=(e,t)=>{let{handleStart:n,handleMove:r,handleEnd:i}=OP(e,t);return e.addEventListener(`touchstart`,n,{passive:!0}),e.addEventListener(`touchmove`,r,{passive:!1}),e.addEventListener(`touchend`,i),e.addEventListener(`touchcancel`,i),()=>{e.removeEventListener(`touchstart`,n),e.removeEventListener(`touchmove`,r),e.removeEventListener(`touchend`,i),e.removeEventListener(`touchcancel`,i)}},AP=(e,t)=>{let n=zp({views:e,onBack:t});return(0,K.useCallback)(e=>e===null?void 0:kP(e,{getViews:()=>n.current.views,onBack:()=>{n.current.onBack()}}),[n])},jP=h({method:`GET`}).handler(z(`0606210e0df9e9467c6143a764ada1aaa034b2a0ed02cb9b03d64eed35e9c04a`)),MP=h({method:`POST`}).handler(z(`f401f5330e10ad3b2c602ae49981f226d7e57c8b2b638d0840a197a7d6125be6`)),NP=h({method:`POST`}).handler(z(`0883f654ee97f193b16da01fd0bc3688daa5e3a37bb245da03045b353099be05`)),PP=h({method:`POST`}).handler(z(`8d0f02766ecedce1b5d9b39c4524dd1912bd1780e2056ab3f564a5062bf0517c`)),FP=e=>typeof e==`object`&&!!e&&`agents`in e&&`takenLately`in e,IP=(e,t)=>JSON.stringify(e)===JSON.stringify(t),LP=e=>{let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(!1),{place:s,branch:c}=e,l=(0,K.useCallback)(async()=>{try{let e=await jP({data:{place:s,branch:c}});n(t=>IP(t,e)?t:e)}catch{n(null)}},[s,c]);(0,K.useEffect)(()=>{let e={isCurrent:!0};(async()=>{let t=await jP({data:{place:s,branch:c}});e.isCurrent&&n(e=>e??t)})();let t=Xa(`${s}|${c}`,e=>{let t=JSON.parse(e);FP(t)&&n(e=>IP(e,t)?e:t)});return()=>{e.isCurrent=!1,t()}},[s,c]);let u=async e=>{o(!0),i(null);try{let t=await e();i(t.ok?null:t.error??`It did not start`)}catch(e){i(e instanceof Error?e.message:String(e))}finally{await l(),o(!1)}};return{branch:c,listener:t,failure:r,isBusy:a,handleStart:e=>u(()=>MP({data:{place:s,branch:c,agent:e}})),handleStop:()=>u(()=>NP({data:{place:s,branch:c}})),handleSave:e=>u(()=>PP({data:e}))}},RP=80,zP=600,BP=2,VP=24,HP=e=>e instanceof Element?e.closest(`[data-code-scroll]`):null,UP=e=>{let{0:t}=e.touches;if(e.touches.length!==1||t===void 0||t.clientX<VP||t.clientX>window.innerWidth-VP)return null;let n=HP(e.target),r=n?.scrollLeft??0,i=n===null?0:n.scrollWidth-n.clientWidth;return{left:t.clientX,top:t.clientY,at:e.timeStamp,isAtStart:r<=1,isAtEnd:r>=i-1}},WP=(e,t)=>{let{0:n}=t.changedTouches;if(n===void 0||t.timeStamp-e.at>zP)return null;let r=n.clientX-e.left,i=n.clientY-e.top;return Math.abs(r)<RP||Math.abs(r)<BP*Math.abs(i)?null:r<0?e.isAtEnd?1:null:e.isAtStart?-1:null},GP=e=>{let t=(0,K.useRef)(null);return{handleTouchStart:e=>{t.current=UP(e)},handleTouchEnd:n=>{let r=t.current;t.current=null;let i=r===null?null:WP(r,n);i!==null&&e(i)}}},KP=(e,t)=>{let{block:n,state:r,setState:i}=e,a=Vf(r),o=LP({place:e.place,branch:n.branch}),s=oP(a),c=GP(e=>{a===`diff`&&(lP(),t.press(e===1?`]`:`[`))}),l=()=>{t.selection?.handleCancel(),i(Hf(r))},u=AP(a===`files`?null:{shown:a,back:Vf(Hf(r))},l);return{phone:{block:n,state:r,file:t.file,position:t.model.position,total:t.model.total,reviewTotal:t.model.reviewTotal,reviewedCount:t.model.marks.count,isReviewed:t.model.marks.isReviewed(r.selected),hasLayers:t.model.hasLayers,hasPull:e.extras.pull!==null,draftCount:t.shown.drafts.length,unreadCount:rN({counts:n.threadCounts,remarks:t.shown.remarks,isTheirs:e.extras.pull?.theirs===!0}),nextUnreviewed:sP(n.order,r.selected,t.model.marks.isReviewed),isBarHidden:s.isHidden||(t.selection?.composerAt??null)!==null,listener:o,model:t.model,onPickLayer:e=>{i(Kf(r,{key:e,groups:t.model.groups}))},handlePress:e=>{e===`m`&&lP(),t.press(e)},onOpen:t.handleOpen,onBack:l,onMore:()=>{i({...r,dialog:`more`})}},view:a,swipe:c,backRef:u,handleBarScroll:s.handleScroll}},qP=`grid size-12 shrink-0 place-items-center rounded-full text-foreground glass press disabled:opacity-40`,JP=({label:e,isDisabled:t=!1,onClick:n,children:r})=>(0,q.jsx)(`button`,{"aria-label":e,className:qP,disabled:t,onClick:n,type:`button`,children:r}),YP=({icon:e,label:t,isCurrent:n,badge:r=0,onClick:i})=>(0,q.jsxs)(`button`,{"aria-current":n?`page`:void 0,className:`phone-tab press`,onClick:i,type:`button`,children:[(0,q.jsx)(e,{className:`size-5 shrink-0`}),t,r>0?(0,q.jsx)(`span`,{"aria-label":`${String(r)} unread`,className:`grid h-4.5 min-w-4.5 place-items-center rounded-full bg-accent px-1.25 text-2xs font-semibold text-accent-foreground tabular-nums`,children:r}):null]}),XP=({props:e})=>{let t=Ve(),n=e.state.anchor!==null;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(JP,{isDisabled:e.position<=1,label:`Previous file`,onClick:()=>{e.handlePress(`[`)},children:(0,q.jsx)(Yn,{className:`size-5.5`})}),(0,q.jsxs)(`div`,{className:`flex h-12 min-w-0 flex-1 items-center justify-center gap-0.5 rounded-full px-1 glass`,children:[(0,q.jsxs)(`button`,{"aria-pressed":e.isReviewed,className:`phone-tab press aria-pressed:text-foreground`,onClick:()=>{e.handlePress(`m`)},type:`button`,children:[(0,q.jsxs)(`span`,{className:`relative grid size-5 shrink-0 place-items-center`,children:[(0,q.jsx)(sr,{className:`absolute size-5 icon-swap`,"data-off":e.isReviewed?``:void 0}),(0,q.jsx)(ar,{className:`absolute size-5 icon-swap text-success`,"data-off":e.isReviewed?void 0:``})]}),`Reviewed`]}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`h-5 w-px shrink-0 bg-foreground/12`}),(0,q.jsxs)(`button`,{className:`phone-tab press text-foreground`,onClick:()=>{n?e.handlePress(`c`):t.add({title:`Tap a line number to pick the lines to comment on`})},type:`button`,children:[(0,q.jsx)(Vr,{className:`size-5 shrink-0`}),`Comment`]})]}),(0,q.jsx)(JP,{isDisabled:e.position>=e.total,label:`Next file`,onClick:()=>{e.handlePress(`]`)},children:(0,q.jsx)(Zn,{className:`size-5.5`})})]})},ZP=({props:e})=>{let t=e.state.isPanelOpen;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`nav`,{"aria-label":`Sections`,className:`tab-pill flex h-12 items-center gap-0.5 rounded-full px-1 glass`,ref:cP(t),children:[(0,q.jsx)(YP,{icon:xr,isCurrent:!t,label:`Files`,onClick:()=>{t&&e.handlePress(`a`)}}),(0,q.jsx)(YP,{badge:e.unreadCount,icon:Ur,isCurrent:t,label:`Review`,onClick:()=>{t||e.handlePress(`a`)}})]}),(0,q.jsx)(`span`,{className:`flex-1`}),(0,q.jsx)(JP,{label:`Search the branch`,onClick:()=>{e.handlePress(`/`)},children:(0,q.jsx)(ti,{className:`size-5`})})]})},QP=e=>(0,q.jsx)(`div`,{className:`phone-bar md:hidden`,"data-hidden":e.isBarHidden||e.state.dialog!==null?``:void 0,children:Vf(e.state)===`diff`?(0,q.jsx)(XP,{props:e}):(0,q.jsx)(ZP,{props:e})}),$P=({title:e,said:t,isAsked:n,onReorder:r,action:i=`Reorder`,whileAsked:a=`Asked the agent for a new order; it shows here when written`})=>(0,q.jsxs)(`div`,{className:`mb-2 flex animate-enter items-start gap-2.5 rounded-lg bg-foreground/6 p-2.5`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`grid h-5 w-3.5 shrink-0 place-items-center`,children:(0,q.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground`})}),(0,q.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,q.jsx)(`span`,{className:`text-ui font-medium`,children:e}),(0,q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n?a:t})]}),n?(0,q.jsxs)(`span`,{className:`inline-flex h-6 shrink-0 items-center gap-1.5 px-2 text-xs font-medium text-success`,children:[(0,q.jsx)(Gn,{"aria-hidden":!0,className:`size-3`,strokeWidth:3}),`Asked`]}):(0,q.jsx)(Ee,{keys:[`L`],children:(0,q.jsx)(`button`,{className:`inline-flex h-6 shrink-0 press items-center gap-1.5 rounded-md bg-foreground/9 px-2 text-xs font-medium`,onClick:r,type:`button`,children:i})})]}),eF=e=>{let t=e.block.threads.find(e=>e.stand===`asked`),[n]=t?.layers??[],r=e.groups.find(e=>n!==void 0&&e.index===n-1);return t===void 0||r===void 0||t.layers.some(t=>e.isHere(t))?null:(0,q.jsxs)(`button`,{className:`mb-2 flex w-full animate-enter items-start gap-2.5 rounded-lg border border-stand-asked/40 p-2.5 text-start transition-colors duration-150 hover:bg-row-hover`,onClick:()=>{e.onPickFile(Ko(r.index,t.file),t.file)},type:`button`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`grid h-5 w-3.5 shrink-0 place-items-center text-stand-asked`,children:`◉`}),(0,q.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,q.jsx)(`span`,{className:`text-ui font-medium`,children:`Up next: a question for you`}),(0,q.jsx)(`span`,{className:`text-xs wrap-anywhere text-muted-foreground`,children:`in ${r.address} · ${r.title}, before the plan’s next layer`})]}),(0,q.jsx)(Ln,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`})]})},tF=({block:e,isAsked:t,onReorder:n})=>{if(e.isLayersStale)return(0,q.jsx)($P,{isAsked:t,onReorder:n,said:`The branch moved on after it was written`,title:`Order is out of date`});let r=e.unclaimedLines;return r===0?null:(0,q.jsx)($P,{isAsked:t,onReorder:n,said:`No layer claims them yet; a new order places them`,title:`${String(r)} changed ${r===1?`line is`:`lines are`} in no layer`})},nF=({files:e,isAsked:t,onAsk:n})=>(0,q.jsx)($P,{action:`Write them`,isAsked:t,onReorder:n,said:`The agent can split these ${String(e)} files into layers to read in order, each with a note on how to read it`,title:t?`An agent is writing layers`:`No layers yet`,whileAsked:`They show here when written; keep reading meanwhile`}),rF=({said:e,name:t,size:n,isPart:r=!1,onPick:i})=>(0,q.jsx)(`div`,{className:G(r&&`ps-6.5`),children:(0,q.jsx)(Ee,{keys:[`]`],children:(0,q.jsxs)(`button`,{"data-keep-visible":!0,className:`my-1.5 ms-6 next-layer animate-enter items-center gap-x-2 rounded-lg border border-border bg-background px-2.5 py-2 text-start hover:bg-row-hover`,onClick:i,type:`button`,children:[(0,q.jsx)(`span`,{className:`text-xs text-subtle`,children:e}),(0,q.jsx)(Ln,{"aria-hidden":!0,className:`row-span-3 size-3.5 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`text-ui font-medium`,children:t}),(0,q.jsx)(dd,{size:n})]})})}),iF=(e,t)=>[...e.querySelectorAll(`[data-pinned]`)].filter(e=>e!==t).reduce((e,t)=>e+t.offsetHeight,0),aF=(e,t)=>{let n=e.getBoundingClientRect().top-e.scrollTop,r=t.getBoundingClientRect(),i=e.querySelector(`[data-keep-visible]`),a=i===null?0:i.getBoundingClientRect().bottom-n;return{top:r.top-n,bottom:Math.max(r.bottom-n,a)}},oF=(e,t)=>{let{top:n,bottom:r}=aF(e,t),i=iF(e,t);n-i<e.scrollTop?e.scrollTop=n-i:r>e.scrollTop+e.clientHeight&&(e.scrollTop=r-e.clientHeight)},sF=e=>{let t=(0,K.useRef)(null),n=(0,K.useRef)(new Map);return(0,K.useEffect)(()=>{let r=t.current,i=n.current.get(e);r&&i&&oF(r,i)},[e]),{containerRef:t,register:(0,K.useCallback)(e=>t=>{t===null?n.current.delete(e):n.current.set(e,t)},[])}},cF=e=>{let t=[];return e.forEach(e=>{let n=t.at(-1);n?.[1]===e-1?n[1]=e:t.push([e,e])}),t.map(([e,t])=>e===t?String(e):`${String(e)}–${String(t)}`).join(`, `)},lF=(e,t)=>{let n=e.files.at(-1);return n!==void 0&&t===Ko(e.index,n)},uF=({paths:e})=>e.length===0?null:(0,q.jsxs)(`ul`,{className:`m-0 list-none ps-8.5 pe-2 pb-1.5`,children:[(0,q.jsx)(`li`,{className:`pt-1 text-xs/5 text-subtle`,children:`gone since the order was written`}),e.map(e=>(0,q.jsx)(`li`,{className:`truncate font-mono text-xs/5 text-subtle line-through`,title:e,children:e.slice(e.lastIndexOf(`/`)+1)},e))]}),dF=({group:e,props:t,register:n})=>{let r=t.block.layers[e.index]?.vanished??[];return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(YO,{block:t.block,index:e.index,onPickFile:t.onPickFile,selected:t.state.selected}),e.all.length===0?(0,q.jsx)(`p`,{className:`m-0 ps-8.5 pe-2 pb-2 text-xs text-subtle`,children:`Nothing left in this diff: its files changed after the order was written.`}):null,e.files.length>0?(0,q.jsx)(vd,{block:t.block,cursor:t.state.cursor,files:t.files,group:e,isReadIn:t.isReadIn,onPickFile:t.onPickFile,register:n}):null,(0,q.jsx)(uF,{paths:r})]})},fF=({group:e,props:t,register:n})=>{let r=t.block.layers[e.index],i=Gf(t.state,e.key);return r===void 0?null:(0,q.jsxs)(`div`,{className:G(`mb-0.5`,e.ticket!==null&&`ps-6.5`),children:[(0,q.jsx)(md,{group:e,isCursor:t.state.cursor===e.key,isOpen:i,layer:r,onPick:()=>{t.onPickLayer(e.key)},register:n,size:ud(e,t.block.layers[e.index],t.isReadIn)}),(0,q.jsx)(`div`,{className:`fold`,"data-open":i?``:void 0,inert:!i,children:(0,q.jsx)(`div`,{children:(0,q.jsx)(dF,{group:e,props:t,register:n})})})]})},pF=(e,t)=>{let n=e.flatMap(e=>eu(e)),r=n.find(e=>lF(e,t));if(r===void 0)return null;let i=n[n.indexOf(r)+1];if(i!==void 0&&r.ticket!==null&&i.ticket===r.ticket)return{key:i.key,said:`End of part ${r.address} · up next`,isPart:!0};let a=e[e.findIndex(e=>eu(e).includes(r))+1];return a===void 0?null:{key:a.key,said:r.ticket===null?`End of this layer · up next`:`End of layer ${String(r.ticket)} · up next`,isPart:!1}},mF=(e,t)=>e?.key===t,hF=({group:e,...t})=>mF(t.upNext,e.key)?(0,q.jsx)(rF,{isPart:t.upNext.isPart,name:`${e.address} · ${e.title}`,onPick:()=>{t.props.onPickLayer(e.key)},said:t.upNext.said,size:ud(e,t.props.block.layers[e.index],t.props.isReadIn)}):(0,q.jsx)(fF,{group:e,props:t.props,register:t.register}),gF=({entry:e,ticket:t,...n})=>{let{props:r}=n,i=qf(r.state,e),a=e.groups.some(e=>Gf(r.state,e.key));return(0,q.jsxs)(`div`,{className:`mb-0.5`,children:[(0,q.jsx)(bd,{isCursor:r.state.cursor===e.key,isOpen:i,onPick:()=>{r.onPickLayer(e.key)},register:n.register,rowKey:e.key,ticket:t}),(0,q.jsx)(`div`,{className:`fold`,"data-open":i?``:void 0,inert:!i,children:(0,q.jsxs)(`div`,{children:[a?null:(0,q.jsx)(XO,{block:r.block,onPickFile:r.onPickFile,selected:r.state.selected,ticket:t}),e.groups.map(e=>(0,q.jsx)(hF,{group:e,...n},e.key))]})})]})},_F=({entry:e,...t})=>{if(e.kind===`layer`)return(0,q.jsx)(hF,{group:e,...t});let n=t.props.block.tickets.find(t=>t.number===e.number);return n===void 0?null:mF(t.upNext,e.key)?(0,q.jsx)(rF,{name:`${n.address} · ${n.title}`,onPick:()=>{t.props.onPickLayer(e.key)},said:t.upNext.said,size:yd(n)}):(0,q.jsx)(gF,{entry:e,ticket:n,...t})},vF=100,yF=({state:e,groups:t,block:n})=>{let r=Xo(e.cursor);if(r!==null)return{index:null,ticket:r};let i=Yo(e.cursor)??t.find(t=>t.all.includes(e.selected))?.index??0;return{index:i,ticket:n.layers[i]?.ticket??null}},bF=(e,t)=>e.index===null?t.ticket===e.ticket:t.index===e.index,xF=(e,t)=>e.tickets.find(e=>e.number===t),SF=(e,t)=>{let n=t.index===null?void 0:e.layers[t.index],r=t.ticket===null?void 0:xF(e,t.ticket),i=`of ${String(e.topLevel)}`;if(n?.isRemainder===!0)return`Not in any layer`;if(r===void 0)return`Layer ${n?.address??`1`} ${i}`;let a=n?.sublayer??null;return a===null?`Layer ${r.address} ${i}`:`Layer ${r.address} ${i} · part ${String(a)} of ${String(r.sublayers)}`},CF=(e,t)=>{e?.style.setProperty(`--size`,String(Math.max(t.count,1))),e?.style.setProperty(`--fill`,`${String(t.count===0?0:t.read*vF/t.count)}%`)},wF=({group:e,size:t,here:n})=>(0,q.jsx)(`span`,{className:`layer-seg`,"data-here":bF(n,e)?``:void 0,ref:e=>{CF(e,t)}}),TF=({entries:e,here:t,sizeOf:n})=>(0,q.jsx)(`div`,{"aria-hidden":!0,className:`flex gap-0.5`,children:e.map(e=>e.kind===`layer`?(0,q.jsx)(wF,{group:e,here:t,size:n(e)},e.key):(0,q.jsx)(`span`,{className:`layer-tk`,ref:t=>{let r=e.groups.reduce((e,t)=>e+n(t).count,0);t?.style.setProperty(`--size`,String(Math.max(r,1)))},children:e.groups.map(e=>(0,q.jsx)(wF,{group:e,here:t,size:n(e)},e.key))},e.key))}),EF=e=>{let t=t=>ud(t,e.block.layers[t.index],e.isReadIn),n=e.groups.map(e=>t(e));return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`sticky -top-2 z-3 -mx-2 -mt-2 grid h-14 content-center gap-2 border-b border-border bg-wash px-4`,"data-pinned":!0,children:[(0,q.jsx)(TF,{entries:e.entries,here:e.here,sizeOf:t}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-subtle tabular-nums`,children:[(0,q.jsx)(`span`,{children:SF(e.block,e.here)}),(0,q.jsx)(`span`,{className:`max-md:hidden`,children:`${String(n.reduce((e,t)=>e+t.read,0))} of ${String(n.reduce((e,t)=>e+t.count,0))} files`}),(0,q.jsxs)(`button`,{className:`-my-3 inline-flex min-h-11 press items-center gap-0.5 text-sm font-medium text-claude md:hidden`,onClick:e.onAllLayers,type:`button`,children:[`All layers`,(0,q.jsx)(Zn,{"aria-hidden":!0,className:`size-4`})]})]})]}),e.block.summary===``?null:(0,q.jsx)(`p`,{className:`mx-2 mt-2.5 mb-2 line-clamp-2 text-xs text-muted-foreground`,title:e.block.summary,children:e.block.summary})]})},DF=[],OF=[],kF=(e,t)=>t.kind===`ticket`?e.tickets.find(e=>e.number===t.number)?.isDone===!0:e.layers[t.index]?.isDone===!0,AF=(e,t)=>e.key===t||eu(e).some(e=>e.index===Yo(t)),jF=(e,t)=>Gf(e,`layer:read`)||t.some(t=>AF(t,e.cursor)),MF=(e,{state:t,present:n,shown:r,isShownIn:i})=>{if(!t.isLayered||e.layers.length===0)return{rows:Ho(r,t.collapsed),order:Uo(r),groups:DF,entries:OF,done:OF};let a=Ql(e.layers,{present:n,isShown:i}),o=$l(a,e.tickets),s=t=>kF(e,t),c=iu(o,{isDone:s,isOpen:e=>qf(t,e),isReadOpen:jF(t,o.filter(e=>s(e)))});return{rows:c.rows,order:c.order,groups:a,entries:o,done:c.done}},NF=e=>e.isLayered?Yo(e.cursor):null,PF=e=>({...e,isHidingReviewed:!1,layerOpen:{...e.layerOpen,[Qo]:!0}}),FF=e=>{let t=e.querySelector(`[data-open-row]`);if(t!==null){let n=t.getBoundingClientRect().top-e.getBoundingClientRect().top;t.toggleAttribute(`data-stuck`,n<=57)}},IF=(e,t)=>t.kind===`ticket`?e.tickets.find(e=>e.number===t.number)?.files.length??0:t.all.length,LF=({props:e,register:t})=>{let n=jF(e.state,e.done),r=e.done.reduce((t,n)=>t+IF(e.block,n),0),i=e.state.cursor===Qo,a=e.done.map(e=>e.kind===`ticket`?e.number:Number(e.address));return(0,q.jsxs)(`button`,{"aria-expanded":n,className:`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-start text-ui text-subtle hover:bg-row-hover ${i?`tree-cursor bg-secondary`:``}`,onClick:()=>{e.onPickLayer(Qo)},ref:t(Qo),type:`button`,children:[(0,q.jsx)(`span`,{className:`grid w-4.5 shrink-0 place-items-center`,children:(0,q.jsx)(Gn,{"aria-hidden":!0,className:`size-3 text-success`,strokeWidth:3})}),(0,q.jsx)(`span`,{className:`flex-1`,children:`${e.done.length===1?`Layer`:`Layers`} ${cF(a)} read`}),(0,q.jsx)(`span`,{className:`text-xs tabular-nums`,children:`${String(r)} files`}),(0,q.jsx)(Zn,{"aria-hidden":!0,className:`size-3 turn`})]})},RF=e=>{let{containerRef:t,register:n}=sF(e.state.cursor),r=yF(e),i=new Set(e.done.map(e=>e.key)),a=e.entries.filter(e=>!i.has(e.key)),o=jF(e.state,e.done),s=pF(o?[...e.done,...a]:a,e.state.cursor),c=t=>(0,q.jsx)(_F,{entry:t,props:e,register:n,upNext:s},t.key);return(0,q.jsxs)(`nav`,{"aria-label":`Layers`,className:`min-h-0 overflow-auto p-2`,"data-review-rail":!0,onScroll:e=>{FF(e.currentTarget)},ref:t,children:[(0,q.jsx)(EF,{...e,here:r}),(0,q.jsx)(tF,{block:e.block,isAsked:e.isReorderAsked,onReorder:e.onReorder}),(0,q.jsx)(eF,{block:e.block,groups:e.groups,isHere:t=>{let n=e.groups[t-1];return n!==void 0&&bF(r,n)},onPickFile:e.onPickFile}),e.done.length>0?(0,q.jsx)(LF,{props:e,register:n}):null,e.done.length>0?(0,q.jsx)(`div`,{className:`fold`,"data-open":o?``:void 0,inert:!o,children:(0,q.jsx)(`div`,{children:e.done.map(e=>c(e))})}):null,a.map(e=>c(e))]})},zF=30,BF=80,VF=e=>e*Number(getComputedStyle(document.documentElement).fontSize.replace(`px`,``)),HF=(e,t)=>t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop,UF=(e,{top:t,height:n,inset:r,covered:i})=>{t<e.scrollTop+i?e.scrollTop=t-r:t+n>e.scrollTop+e.clientHeight&&(e.scrollTop=t+n-e.clientHeight)},WF=({total:e,rowRem:t,activeKey:n,activeIndex:r,activeInset:i=0,getCovered:a})=>{let o=(0,K.useRef)(null),[s,c]=(0,K.useState)(null),l=(0,K.useRef)(null),u=(0,K.useCallback)(()=>{let e=o.current;if(e===null)return;let n=VF(t),r=Math.floor(e.scrollTop/n),i=Math.ceil(e.clientHeight/n)+1;c(e=>e?.first===r&&e.count===i?e:{first:r,count:i})},[t]);(0,K.useLayoutEffect)(()=>{let e=o.current;if(e===null)return;let t=new ResizeObserver(u);return t.observe(e),u(),()=>{t.disconnect()}},[u]),(0,K.useLayoutEffect)(()=>{let e=o.current,s=e?.querySelector(`:scope > ul`);if(!e||!s||r<0||l.current===n)return;let c=VF(t);l.current=n,UF(e,{top:HF(e,s)+r*c,height:c,inset:i/t*c,covered:a?.(e)??0}),u()},[n,r,i,a,t,u]);let d=s===null?0:Math.max(0,s.first-zF),f=s===null?Math.min(e,BF):Math.min(e,s.first+s.count+zF);return{containerRef:o,start:Math.min(d,f),end:f,before:`${String(Math.min(d,f)*t)}rem`,after:`${String((e-f)*t)}rem`,onScroll:u}},GF=1.5,KF=2.5,qF=()=>Sm()?KF:GF,JF=e=>{let t=[],n=[],r=[];e.forEach((e,i)=>{for(let t=r.at(-1);t!==void 0&&t.depth>=e.depth;t=r.at(-1))n[t.index]=i-1,r.pop();t[i]=r.at(-1)?.index??-1,n[i]=i,r.push({index:i,depth:e.depth})});for(let{index:t}of r)n[t]=e.length-1;return{parent:t,end:n}},YF=({parent:e,end:t},n)=>{let r=[],i=(t[n]??n)>n?n:e[n]??-1;for(let t=i;t>=0;t=e[t]??-1)r.unshift(t);return r},XF={rows:[],push:0},ZF=e=>e*Number(getComputedStyle(document.documentElement).fontSize.replace(`px`,``)),QF=e=>e.querySelector(`ul`)?.offsetTop??0,$F=(e,t,n)=>{let r=[];for(let i=0;i<5;i+=1){let a=Math.floor((t+i*n)/n),o=a<0||a>=e.parent.length?[]:YF(e,a),s=o[i];if(s===void 0||i>0&&o[i-1]!==r[i-1])return r;r.push(s)}return r},eI=(e,t,n)=>{let r=ZF(n),i=e.scrollTop-QF(e),a=$F(t,i,r),o=a.at(-1);if(o===void 0)return XF;let s=((t.end[o]??o)+1)*r-i;return{rows:a,push:Math.max(0,a.length*r-s)}},tI=e=>{let{top:t}=e.getBoundingClientRect();return Math.max(0,...[...e.querySelectorAll(`[data-tree-pin]`)].map(e=>e.getBoundingClientRect().bottom-t))},nI=(e,t)=>e.push===t.push&&e.rows.length===t.rows.length&&e.rows.every((e,n)=>e===t.rows[n]),rI=({container:e,rows:t,rowRem:n})=>{let r=(0,K.useMemo)(()=>JF(t),[t]),[i,a]=(0,K.useState)(XF);return kj(e,()=>{let t=e===null?XF:eI(e,r,n);a(e=>nI(e,t)?e:t)}),i.rows.length===0||e===null?null:(0,q.jsx)(`div`,{className:`sticky -top-1 z-3 h-0`,children:i.rows.map((r,a)=>{let o=t[r];if(o===void 0)return null;let s=a===i.rows.length-1;return(0,q.jsxs)(`button`,{className:`absolute inset-x-2 flex h-6 w-full min-w-0 items-center gap-1.5 review-indent py-0.5 pe-2 text-start font-mono text-xs/5 text-subtle tree-pin hover:text-foreground max-md:h-10 max-md:text-sm`,"data-tree-pin":!0,"data-tree-pin-last":s?``:void 0,onClick:()=>{e.scrollTop=QF(e)+(r-a)*ZF(n)},ref:e=>{e?.style.setProperty(`--depth`,String(o.depth)),e?.style.setProperty(`top`,`${String(a*n)}rem`),e?.style.setProperty(`z-index`,String(5-a)),e?.style.setProperty(`transform`,s&&i.push>0?`translateY(${String(-i.push)}px)`:``)},tabIndex:-1,title:`Scroll to ${o.label}`,type:`button`,children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`inline-flex w-3.5 shrink-0 justify-center`,children:(0,q.jsx)(Zn,{className:`size-3 rotate-90`})}),(0,q.jsx)(`span`,{className:G(`min-w-0 flex-1 truncate`,o.key.startsWith(`layer:`)&&`font-sans font-medium text-muted-foreground`),children:o.label})]},o.key)})})},iI=({row:e,isCollapsed:t,isReviewed:n,since:r})=>(0,q.jsxs)(`span`,{"aria-hidden":!0,className:`inline-flex w-3.5 shrink-0 justify-center text-subtle`,children:[e.kind===`dir`?(0,q.jsx)(Zn,{className:G(`size-3 transition-transform duration-150`,!t&&`rotate-90`)}):null,e.kind===`file`&&n?(0,q.jsx)(Gn,{className:`size-3 text-success`}):null,e.kind===`file`&&r!==void 0?(0,q.jsx)(Qu,{since:r}):null]}),aI=({row:e,isCursor:t,isSelected:n,isCollapsed:r,isReviewed:i,since:a,file:o,threads:s,onPick:c})=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{"aria-current":n?`true`:void 0,"aria-label":e.kind===`file`&&i?`${e.label}, reviewed`:void 0,className:G(`flex h-6 w-full min-w-0 items-center gap-1.5 rounded-md py-0.5 pe-2 text-start font-mono text-xs/5 text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:bg-secondary focus-visible:text-foreground max-md:h-10 max-md:text-sm`,i&&!n&&`text-subtle`,n&&`bg-secondary text-foreground`,t&&`tree-cursor transition-none`,`review-indent`),onClick:c,ref:t=>{t?.style.setProperty(`--depth`,String(e.depth))},type:`button`,children:[(0,q.jsx)(iI,{isCollapsed:r,isReviewed:i,row:e,since:a}),(0,q.jsx)(`span`,{className:G(`min-w-0 flex-1 truncate`,e.kind===`dir`&&`text-subtle`,e.key.startsWith(`layer:`)&&`font-sans font-medium text-muted-foreground`),children:e.label}),o?(0,q.jsx)(nd,{file:o}):null,o?(0,q.jsx)(ed,{file:o}):null,(0,q.jsx)(sd,{said:du(s),stand:s.stand})]})}),oI=({rows:e,cursor:t,selected:n,collapsed:r,files:i,isReviewed:a,getSince:o,getThreads:s,onPick:c})=>{let l=qF(),u=e.findIndex(e=>e.key===t),[d,f]=(0,K.useState)(null),{containerRef:p,start:m,end:h,before:g,after:_,onScroll:v}=WF({total:e.length,rowRem:l,activeKey:t,activeIndex:u,activeInset:Math.min(e[u]?.depth??0,5)*l,getCovered:tI}),y=(0,K.useCallback)(e=>{p.current=e,f(e)},[p]);return(0,q.jsxs)(`nav`,{"aria-label":`Changed files`,className:`relative min-h-0 overflow-auto px-2 py-1`,"data-review-rail":!0,onScroll:v,ref:y,children:[(0,q.jsx)(rI,{container:d,rowRem:l,rows:e}),(0,q.jsx)(`ul`,{className:`m-0 list-none p-0 pt-(--before) pb-(--after)`,ref:e=>{e?.style.setProperty(`--before`,g),e?.style.setProperty(`--after`,_)},children:e.slice(m,h).map(e=>(0,q.jsx)(aI,{threads:e.kind===`file`?s(e.path):cu,file:e.kind===`file`?i.get(e.path):void 0,isCollapsed:e.kind===`dir`&&r.has(e.full),isCursor:e.key===t,isReviewed:e.kind===`file`&&a(e.path),since:e.kind===`file`?o(e.path):void 0,isSelected:e.kind===`file`&&e.path===n,onPick:()=>{c(e)},row:e},e.key))})]})},sI=(e,t)=>e.wantsLayers?{...e,wantsLayers:!1,isLayered:!0,collapsed:new Set,layerOpen:{},cursor:Ko(t(e.selected),e.selected)}:e,cI=e=>`${String(e)} ${e===1?`layer`:`layers`}`,lI=({count:e,isAsked:t,state:n,setState:r,layerOf:i})=>{let a=Ve();VA(e>0?`layers`:``,()=>{n.wantsLayers?(r(sI(n,i)),a.add({title:`Layers are written`,description:`${cI(e)}, in reading order`})):t&&a.add({title:`Layers are written`,description:`${cI(e)} · s shows them`})})},uI=(e,t)=>e.find(e=>e.key===t),dI=({block:e,state:t,setState:n,model:r,acts:i})=>{if(lI({count:e.layers.length,isAsked:i.layersAsked===``,state:t,setState:n,layerOf:r.layerOf}),t.isLayered&&r.hasLayers)return(0,q.jsx)(RF,{block:e,done:r.done,entries:r.entries,files:r.files,groups:r.groups,isReadIn:r.marks.isReadIn,onAllLayers:()=>{n({...t,dialog:`layers`})},isReorderAsked:i.failure===null&&i.layersAsked===Zo(e.layers),onReorder:()=>{i.askLayers(e.layers)},onPickFile:(e,r)=>{let i={...t,cursor:e,selected:r};n(bm()?Uf(i):i)},onPickLayer:e=>{let t=uI(r.rows,e);t!==void 0&&r.handlePick(t)},state:t});let a=(0,q.jsx)(oI,{collapsed:t.collapsed,cursor:t.cursor,files:r.files,getSince:r.marks.getSince,getThreads:r.getThreads,isReviewed:r.marks.isReviewed,onPick:r.handlePick,rows:r.rows,selected:t.selected});return t.wantsLayers&&!r.hasLayers?(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-col`,"data-review-rail-box":!0,children:[(0,q.jsx)(`div`,{className:`px-2 pt-2`,children:(0,q.jsx)(nF,{files:e.files.length,isAsked:i.failure===null&&i.layersAsked===Zo(e.layers),onAsk:()=>{i.askLayers(e.layers)}})}),a]}):a},fI=(e,t,{threads:n,rows:r})=>{let i=n.find(e=>e.id===t);return i===void 0||i.file===``?{...e,threadAt:t}:{...e,threadAt:t,selected:i.file,cursor:e.isLayered?e.cursor:tp(r,i.file),row:0,anchor:null}},pI=(e,t)=>{if(e.lead===`threads`)return{...e,lead:`diff`,isBackToThreads:!1};let n=e.pile!==null&&SM(e.pile,t.threads)>0,r=n&&e.pile!==null?e.pile:bM(t.threads),i=t.threads.find(t=>t.id===e.threadAt),a=n&&!yM(i)?e.threadAt:TM(r,t.threads);return fI({...e,lead:`threads`,pile:r,isPanelOpen:!0,isBackToThreads:!1},a,t)},mI=e=>e instanceof Error?e.message:String(e),hI=(e,t)=>n=>({...n,threads:n.threads.map(n=>n.id===e?t(n):n)}),gI=(e,t)=>n=>({...n,remarks:n.remarks.flatMap(n=>{if(n.id!==e)return[n];let r=t(n);return r===null?[]:[r]})}),_I=(e,t)=>n=>({...n,drafts:n.drafts.flatMap(n=>n.id===e?t===null?[]:[{...n,body:t}]:[n])}),vI=e=>({...e,isSettled:!0,isSettleable:!1,stand:`settled`,section:`settled`}),yI=e=>({...e,state:`removed`,isSettleable:!1,stand:`gone`,section:`removed`}),bI=e=>{let t=e.turns.at(-1)?.voice===`agent`?`answered`:`filed`;return{...e,isSettled:!1,stand:t,section:e.isMovedPast?`movedOn`:t}},xI=e=>t=>({...t,unread:0,isSettleable:!1,turns:[...t.turns,{voice:`reviewer`,body:e,at:new Date().toISOString()}]}),SI=e=>({...e,threads:e.threads.map(e=>e.isSettleable?vI(e):e)}),CI=e=>(t,n=``)=>()=>ya({data:{...e,act:t,id:n}}),wI=()=>{let[e,t]=(0,K.useState)(null);return{asked:e,mark:e=>{t(Zo(e))}}},TI=e=>{let t=async(t,n)=>{let r=Date.now()+Math.random();e(e=>[...e,{key:r,change:t}]);try{await n()}finally{e(e=>e.filter(e=>e.key!==r))}};return{echoResolve:(e,n,r)=>t(hI(e,n?vI:bI),r),echoReply:(e,n,r)=>t(hI(e,xI(n)),r)}},EI=(e,t)=>{let[n,r]=(0,K.useState)([]),[i,a]=(0,K.useState)(null),o=wI(),s=async(e,n,i)=>{let o=Date.now()+Math.random();a(null),r(t=>[...t,{key:o,change:e}]);try{await n(),await t()}catch(e){a(`${i}: ${mI(e)}`)}finally{r(e=>e.filter(e=>e.key!==o))}},c=CI(e);return{failure:i,handleDismissFailure:()=>{a(null)},shown:e=>n.reduce((e,t)=>t.change(e),e),...TI(r),settle:t=>s(hI(t.id,e=>e.isSettled?bI(e):vI(e)),()=>ka({data:{...e,id:t.id,settled:!t.isSettled}}),t.isSettled?`The thread was not taken back`:`The thread was not settled`),remove:e=>{let t=e.state===`removed`;return s(hI(e.id,e=>t?{...e,state:`sent`}:yI(e)),c(t?`restore`:`remove`,e.id),t?`The comment was not restored`:`The comment was not removed`)},read:e=>s(hI(e.id,e=>({...e,unread:0})),c(`read`,e.id),`The answer was not marked read`),settleRead:()=>s(SI,c(`settleRead`),`Nothing was settled`),layersAsked:o.asked,askLayers:async e=>{o.mark(e),await s(e=>e,c(`askLayers`),`The agent was not asked`)},sendDrafts:()=>s(e=>({...e,drafts:[]}),c(`sendDrafts`),`The notes were not sent`),remark:(t,n,r)=>s(gI(t.id,e=>n===`accept`?null:n===`reply`?e:{...e,state:n===`dismiss`?`dismissed`:`waiting`}),()=>Ea({data:{...e,id:t.id,act:n,body:r??``}}),`The remark was not ${n===`reply`?`answered`:`${n}ed`}`),draft:(t,n)=>s(_I(t.id,n),()=>Da({data:{...e,id:t.id,body:n}}),n===null?`The note was not dropped`:`The note was not reworded`)}},DI=e=>{let[t,n]=(0,K.useState)(()=>new Set(e.map(e=>kp(e))));return{isNew:e=>!t.has(kp(e)),markKnown:e=>{n(t=>new Set([...t,...e.map(e=>kp(e))]))}}},OI=(e,t)=>{let{lines:n}=t;if(n===null)return[t.from,t.to];let r=e.findIndex(e=>Fp(e,n.from)),i=e.findIndex(e=>Fp(e,n.to));return r===-1||i===-1?[t.from,t.to]:[r,i]},kI=()=>{let[e,t]=(0,K.useState)(null);return dn(`mouseup`,()=>{e?.isDragging===!0&&t({...e,isDragging:!1})}),{forFile:(n,r=[],i=!1)=>{let a=e?.key===n?e:null,o=a===null?null:OI(r,a),s=(e,a,o)=>{i&&r[e]?.new===null||t({key:n,from:e,to:a,lines:Lp(r,[e,a],i),...o})};return{selected:o,lines:a?.lines??null,composerAt:a&&o&&!a.isDragging&&a.isComposing?Math.max(...o):null,handleStart:e=>{s(e,e,{isDragging:!0,isComposing:!0})},handleMove:e=>{a?.isDragging===!0&&o!==null&&s(o[0],e,{isDragging:!0,isComposing:!0})},handleCancel:()=>{t(null)},handleMark:(e,t)=>{s(e,t,{isDragging:!1,isComposing:!1})},handleCompose:(e,t)=>{s(e,t,{isDragging:!1,isComposing:!0})}}},clear:()=>{t(null)}}},AI=16,jI=2,MI=()=>typeof crypto.randomUUID==`function`?crypto.randomUUID():Array.from(crypto.getRandomValues(new Uint8Array(AI)),e=>e.toString(AI).padStart(jI,`0`)).join(``),NI=(e,t)=>e.author===t.author&&e.parent===t.parent&&e.path===t.path&&e.side===t.side&&e.start===t.start&&e.end===t.end&&e.body.trim()===t.body.trim(),PI=(e,t,n)=>e.find(e=>t.id!==null&&e.id===t.id)??e.find(e=>!n.has(e.id)&&!t.earlier.includes(e.id)&&NI(e,t.comment)),FI=(e,t)=>{let n=new Map;for(let r of t){let t=PI(e,r,n);t!==void 0&&n.set(t.id,r.key)}return n},II=(e,{id:t,resolved:n})=>e.map(e=>e.id===t?{...e,resolved:n}:e),LI=(e,t,n)=>{let r=FI(e,t),i=new Set(r.values()),a=e.map(e=>{let t=r.get(e.id);return t===void 0?e:{...e,key:t}}),o=t.filter(e=>!e.isSettled&&!i.has(e.key)).map(e=>e.comment);return n.reduce((e,t)=>II(e,t),[...a,...o])},RI=()=>`pending:${MI()}`,zI=(e,t)=>{let n=RI(),r={...e,id:n,key:n,author:`you`,at:new Date().toISOString()};return{key:n,comment:r,earlier:t.filter(e=>NI(e,r)).map(e=>e.id),id:null,isSettled:!1}},BI=e=>e instanceof Error?e.message:String(e),VI=e=>{let[t,n]=(0,K.useState)([]),[r,i]=(0,K.useState)([]),[a,o]=(0,K.useState)(null),s=(e,t)=>{n(n=>n.map(n=>n.key===e?{...n,...t}:n))};return{failure:a,write:async(t,r,i)=>{o(null),n(e=>[...e,t]);try{s(t.key,{id:await r()}),await e(),s(t.key,{isSettled:!0})}catch(e){n(e=>e.filter(e=>e.key!==t.key)),o(`${i}: ${BI(e)}`)}},settle:async({id:t,resolved:n},r,a)=>{let s={key:RI(),id:t,resolved:n};o(null),i(e=>[...e,s]);try{await r(),await e()}catch(e){o(`${a}: ${BI(e)}`)}finally{i(e=>e.filter(e=>e.key!==s.key))}},shown:e=>LI(e,t,r),dismiss:()=>{o(null)}}},HI=e=>({...Rp(e),code:``,parent:null,resolved:!1}),UI=e=>{let t=kI(),n=VI(e.refresh),r=jN(e.block),i={...r,comments:n.shown(r.comments)},a=DI(i.comments),o={place:e.place,branch:e.block.branch},s=(e,t)=>{let{seenAt:i,key:a,...s}=e;return n.write(zI({...s,body:t,parent:e.id,resolved:!1},r.comments),async()=>(await Oa({data:{...o,id:e.id,body:t}}),null),`Your reply did not reach adiff ("${t}")`)};return{live:i,actions:{...a,handleReply:(e,t)=>(s(e,t),Promise.resolve()),handleResolve:async(e,t)=>{await n.settle({id:e.id,resolved:t},()=>ka({data:{...o,id:e.id,settled:t}}),t?`The thread was not resolved`:`The thread was not reopened`)}},sendReply:s,forFile:(e,i)=>{let{path:a,rows:s,isNewOnly:c}=i,l=t.forFile(e,s,c);return{...l,path:a,handlePost:e=>{let i=l.selected?Lp(s,l.selected,c):null;if(i===null)return Promise.resolve();let u={from:Ip(i.from),to:Ip(i.to)},d=zI({...HI(i),path:a,body:e},r.comments);return t.clear(),n.write(d,async()=>(await va({data:{...o,path:a,...u,body:e}})).id,`Your comment did not reach adiff ("${e}")`),Promise.resolve()}}},failure:n.failure,handleDismissFailure:n.dismiss}},WI=e=>e!==void 0&&(e.op!==`gap`||e.others!==void 0),GI=e=>e?.op===`add`||e?.op===`del`,KI=(e,t)=>Math.min(Math.max(0,t),Math.max(0,e.length-1)),qI=(e,t,n)=>{let r=KI(e,t+n);for(;!WI(e[r])&&r>0&&r<e.length-1;)r+=Math.sign(n);return KI(e,r)},JI=(e,t)=>GI(e[t])&&!GI(e[t-1]),YI=(e,t,n)=>{for(let r=t+n;r>=0&&r<e.length;r+=n)if(JI(e,r))return r;return t},XI=(e,t,n)=>(n===1?e.filter(e=>e>t):e.filter(e=>e<t).toReversed())[0]??t,ZI=(e,t)=>{if(!GI(e[t]))return[t,t];let n=t,r=t;for(;GI(e[n-1]);)--n;for(;GI(e[r+1]);)r+=1;return[n,r]},QI=(e,t)=>[Math.min(e,t),Math.max(e,t)],$I=(e,t,n)=>{let[r,i]=QI(t,n);return e.selection?.handleMark?.(r,i),{...e.state,anchor:t,row:n}},eL=(e,t)=>e.state.anchor===null?{...e.state,row:t}:$I(e,e.state.anchor,t),tL=(e,t)=>$I(e,e.state.anchor??e.state.row,qI(e.rows,e.state.row,t)),nL=e=>{let[t,n]=QI(e.state.anchor??e.state.row,e.state.row);return e.selection?.handleCompose?.(t,n),{...e.state,anchor:null}},rL=e=>e.state.anchor===null?$I(e,e.state.row,e.state.row):(e.selection?.handleCancel(),{...e.state,anchor:null}),iL=e=>{let[t,n]=ZI(e.rows,e.state.row);return $I(e,t,n)},aL=e=>e.state.anchor!==null||e.selection?.selected!==null?(e.selection?.handleCancel(),{...e.state,anchor:null}):{...e.state,focus:`tree`},oL=({rows:e,settledRows:t,state:n})=>{let r=e[n.row]?.others;if(r!==void 0&&!r.isOpen)return jA(n,{...r,index:n.row});let i=DA(e[n.row]);return i===null?t.includes(n.row)?{...n,settledAt:`${n.selected}#${String(n.row)}`}:n:{...n,opened:OA(n.opened,{path:n.selected,range:i})}},sL=(e,t)=>{let n=e.findLastIndex((e,n)=>n<=t&&e.others?.isOpen===!0),r=e[n]?.others;return r===void 0||t>n+r.count?void 0:{...r,index:n}},cL=(e,t)=>({...e,context:t,opened:{...e.opened,[e.selected]:[]}}),lL=(e,t)=>{let{rows:n,threadRows:r,state:i}=t,a=sL(n,i.row);return e===`h`&&a!==void 0?()=>jA(i,a):new Map([[`j`,()=>eL(t,qI(n,i.row,1))],[`ArrowDown`,()=>eL(t,qI(n,i.row,1))],[`k`,()=>eL(t,qI(n,i.row,-1))],[`ArrowUp`,()=>eL(t,qI(n,i.row,-1))],[`g`,()=>eL(t,0)],[`G`,()=>eL(t,Math.max(0,n.length-1))],[`}`,()=>eL(t,YI(n,i.row,1))],[`{`,()=>eL(t,YI(n,i.row,-1))],[`n`,()=>eL(t,XI(r,i.row,1))],[`N`,()=>eL(t,XI(r,i.row,-1))],[`v`,()=>rL(t)],[`V`,()=>iL(t)],[`c`,()=>nL(t)],[`Enter`,()=>nL(t)],[`Escape`,()=>aL(t)],[`l`,()=>oL(t)]]).get(e)},uL=(e,t)=>{if(!(!e.shiftKey||e.key!==`ArrowDown`&&e.key!==`ArrowUp`))return()=>tL(t,e.key===`ArrowDown`?1:-1)},dL=(e,t)=>new Map([[`w`,()=>({...t,isWrapped:!t.isWrapped})],[`+`,()=>({...t,context:kA(t.context,1)})],[`=`,()=>({...t,context:kA(t.context,1)})],[`-`,()=>cL(t,kA(t.context,-1))],[`_`,()=>cL(t,kA(t.context,-1))],[`F`,()=>t.context===`whole`?cL(t,3):{...t,context:`whole`}],[`Tab`,()=>({...t,focus:t.focus===`tree`?`diff`:`tree`})]]).get(e),fL=(e,{rows:t,order:n,state:r,hasLayers:i,rowsFor:a,layerOf:o,onTurn:s})=>new Map([[`T`,s],[`j`,()=>ep(r,{rows:t,offset:1})],[`ArrowDown`,()=>ep(r,{rows:t,offset:1})],[`k`,()=>ep(r,{rows:t,offset:-1})],[`ArrowUp`,()=>ep(r,{rows:t,offset:-1})],[`]`,()=>ip(r,{order:n,offset:1,rows:t})],[`M`,()=>ip(r,{order:n,offset:1,rows:t})],[`[`,()=>ip(r,{order:n,offset:-1,rows:t})],[`f`,()=>({...r,isHidingReviewed:!r.isHidingReviewed})],[`a`,()=>({...r,isPanelOpen:!r.isPanelOpen})],[`b`,()=>({...r,dialog:`base`})],[`/`,()=>({...r,dialog:`search`})],[`?`,()=>({...r,dialog:`keys`})],[`s`,()=>op(r,{rowsFor:a,layerOf:o,hasLayers:i})],...r.isLayered?[[`h`,()=>sp(r,!1)],[`l`,()=>sp(r,!0)]]:[]]).get(e),pL=(e,t)=>new Map([[`m`,()=>{t.onToggleReviewed(t.state.isLayered?Wf(t.state):null)}],[`M`,()=>{t.onToggleReviewed(t.state.isLayered?Wf(t.state):null)}],[`p`,t.onOpenPull],[`L`,t.onAskLayers],[`D`,t.onSettleRead],[`C`,t.onSendDrafts],[`r`,t.onToggleSince],[`S`,pt],[`I`,At],[`O`,gt],[`e`,()=>{xc({...t.shown,row:t.state.row})}],[`s`,()=>{t.paneRef.current?.focus({preventScroll:!0})}]]).get(e),mL=e=>mM.has(e.key)&&(document.activeElement?.closest(`[data-review-panel]`)??null)!==null,hL=new Set([`j`,`k`,`ArrowDown`,`ArrowUp`,`[`,`]`,`d`,`Enter`,`R`]),gL=(e,{state:t})=>t.dialog===null&&!mL(e)&&!(t.lead===`threads`&&hL.has(e.key))&&!Dm(e.target)&&!e.metaKey&&!e.ctrlKey&&!e.altKey,_L=(e,t)=>{t.focus===`diff`&&requestAnimationFrame(()=>{e.current?.querySelector(`[data-review-row="${String(t.row)}"]`)?.scrollIntoView({block:`nearest`})})},vL=new Set([`j`,`k`,`ArrowDown`,`ArrowUp`]),yL=(e,{state:t,diff:n})=>e.key===`Escape`&&t.lead===`diff`&&t.isBackToThreads&&t.anchor===null&&(n.selection?.composerAt??null)===null?()=>({...t,lead:`threads`,isBackToThreads:!1}):void 0,bL=(e,t)=>{let n={...t.diff,state:t.state};if(t.state.focus===`diff`){let t=uL(e,n)??lL(e.key,n);if(t!==void 0)return t}let r=dL(e.key,t.state);return r===void 0?t.state.focus===`diff`&&vL.has(e.key)?void 0:fL(e.key,t):r},xL=(e,t)=>yL(e,t)??bL(e,t),SL=(e,t)=>{let n=xL(e,t),r=pL(e.key,t);if(n!==void 0||r!==void 0){if(e.preventDefault(),n!==void 0){let e=n();t.setState(e),_L(t.paneRef,e)}r?.()}},CL=(e,t)=>{let{target:n}=e;if(!bm()||!(n instanceof Element)||t.current?.contains(n)!==!0||n.closest(`[data-code], a:not([data-line-link]), button`)!==null)return null;let r=n.closest(`[data-review-diff] [data-review-row]`)?.dataset.reviewRow;return r===void 0?null:Number(r)},wL=(e,{state:t,setState:n,diff:r})=>{let{selection:i}=r;if(i?.composerAt!==null)return;let a=t.anchor??e;t.anchor===e&&t.row===e?(i.handleCancel(),n({...t,anchor:null,row:e})):(i.handleMark?.(Math.min(a,e),Math.max(a,e)),n({...t,focus:`diff`,anchor:a,row:e}))},TL=e=>(dn(`keydown`,t=>{gL(t,e)&&SL(t,e)}),dn(`click`,t=>{let n=CL(t,e.paneRef);n!==null&&wL(n,e)}),t=>{let n={key:t,shiftKey:!1,preventDefault:()=>{}},r={...e,state:{...e.state,dialog:null}};e.state.dialog!==null&&xL(n,r)===void 0&&e.setState(r.state),SL(n,r)}),EL=(e,t)=>t.tickets.length===0||e.isRemainder?e.title:`${e.address} ${e.title}`,DL=(e,{after:t,index:n})=>{let r=t?.layers[n];if(t===null||r?.isDone!==!0||e.layers[n]?.isDone===!0)return null;let i=t.tickets.find(e=>e.number===r.ticket),a=e.tickets.find(e=>e.number===r.ticket)?.isDone===!0,o=i!==void 0&&i.isDone&&!a?i:void 0,s=o===void 0?n:Math.max(n,...o.layers.map(e=>e-1)),c=t.layers.find((e,t)=>t>s&&e.files.length>0);return{title:`Layer ${o?.address??r.address} read`,description:c===void 0?`Every layer is read`:`Next: ${EL(c,t)}`}},OL=`*`,kL=(e,t)=>`${e===null?OL:String(e)}:${t}`,AL=e=>e instanceof Error?e.message:String(e),jL=(e,t)=>e.layers.filter(e=>e.files.includes(t)).length,ML=(e,t)=>new Set([...e.reviewed,...e.order].filter(e=>t(e))).size,NL=({place:e,block:t,refresh:n,onLayers:r})=>{let[i,a]=(0,K.useState)(new Map),[o,s]=(0,K.useState)(null),c=e=>i.get(kL(null,e))??t.reviewed.includes(e),l=e=>c(e)?void 0:t.since.find(t=>t.path===e),u=(e,n)=>{let r=i.get(kL(null,n));return r===void 0?i.get(kL(e,n))??(c(n)||t.layers[e]?.read.includes(n)===!0):r},d=(e,n)=>i.get(kL(e,n))??i.get(kL(null,n))??t.layers[e]?.parts.find(e=>e.path===n)?.isRead===!0,f=async(e,t,i)=>{s(null),a(n=>new Map([...n,[e,t]]));try{let{told:e}=await i();return r(e),await n(),e}catch(e){return s(`The file was not marked: ${AL(e)}`),null}finally{a(t=>new Map([...t].filter(([t])=>t!==e)))}};return{isReviewed:c,getSince:l,isReadIn:u,isPartRead:d,toggle:(n,r)=>{let i=r!==null&&jL(t,n)>1,a=t.files.find(e=>e.path===n)?.blob??``,o={place:e,branch:t.branch,path:n,blob:a};return i?f(kL(r,n),!u(r,n),()=>$a({data:{...o,layer:t.layers[r]?.address??String(r+1)}})):f(kL(null,n),!c(n),()=>$a({data:{...o,layer:null}}))},count:ML(t,c),failure:o,handleDismissFailure:()=>{s(null)}}},PL=e=>{let{place:t,block:n,state:r,setState:i,refresh:a,onLayers:o}=e,s=NL({place:t,block:n,refresh:a,onLayers:o}),c=Ve(),l=e=>e.isHidingReviewed?n.order.filter(t=>!s.isReviewed(t)||t===e.selected):n.order,u=e=>MF(n,{state:e,present:n.order,shown:l(e),isShownIn:(t,n)=>!e.isHidingReviewed||n===e.selected||!s.isPartRead(t,n)}),{rows:d,order:f,groups:p,entries:m,done:h}=u(r),g=e=>Math.max(0,n.layers.findIndex(t=>t.files.includes(e))),_=u(PF(r)).order,v=_.indexOf(r.isLayered?r.cursor:r.selected);return{marks:s,rows:d,order:f,groups:p,entries:m,done:h,hasLayers:n.layers.length>0,rowsFor:e=>u(e).rows,layerOf:g,isReadHere:e=>{let t=NF(r);return t===null?s.isReviewed(e):s.isReadIn(t,e)},toggleReviewed:async(e,t)=>{let r=DL({layers:n.layers,tickets:n.tickets},{after:await s.toggle(e,t),index:t??g(e)});r!==null&&c.add(r)},position:v===-1?0:v+1,total:_.length,reviewTotal:n.total,files:new Map(n.files.map(e=>[e.path,e])),getThreads:e=>lu(n.fileMarks,e),handleOpen:e=>{let t={...r,selected:e,cursor:`file:${e}`,row:0,anchor:null};i(bm()?Uf(t):t)},handlePick:e=>{let t=$f(r,e,m);i(e.kind===`file`&&bm()?Uf(t):t)}}},FL=(e,t)=>{let n=Yo(e.cursor);if(n!==null&&t.layers.includes(n+1))return n;let[r]=t.layers;return r===void 0?null:r-1},IL=`near:`,LL=e=>{if(!e.startsWith(IL))return null;let t=e.slice(5),n=t.lastIndexOf(`:`);return{path:t.slice(0,n),line:Number(t.slice(n+1))}},RL=(e,t)=>n=>{let r=LL(n);if(r===null)return t.get(n);if(r.path!==e.path)return;let i=e.rows.findIndex(e=>e.new!==null&&e.new>=r.line);return i===-1?e.rows.findLastIndex(e=>e.new!==null):i},zL=({props:e,rowOf:t,paneRef:n})=>{let{state:r,setState:i}=e,[a,o]=(0,K.useState)(null),s=a===null?void 0:t(a);return VA(s===void 0?``:`${a??``}@${String(s)}`,()=>{s!==void 0&&(o(null),i({...r,row:s,anchor:null,focus:`diff`}),requestAnimationFrame(()=>{n.current?.querySelector(`[data-review-diff] [data-review-row="${String(s)}"]`)?.scrollIntoView({block:`center`,behavior:`smooth`})}))}),{handleJump:(e,t={})=>{let n=r.isLayered?FL(r,e):null;o(e.id),i({...r,...t,selected:e.file,cursor:n===null?`file:${e.file}`:Ko(n,e.file),anchor:null})},handleShowLayer:(e,t={})=>{if(e.file===``)return;let[n]=e.layers;o(`${IL}${e.file}:${String(e.start)}`),i({...r,...t,isLayered:n!==void 0,selected:e.file,cursor:n===void 0?`file:${e.file}`:Ko(n-1,e.file),row:0,anchor:null})}}},BL=({threads:e,shown:t,acts:n})=>{let r=e.filter(e=>t.includes(e.id)&&e.unread>0&&e.state!==`removed`);VA(r.map(e=>e.id).join(`|`),()=>{r.forEach(e=>{n.read(e)})})},VL=({props:e,model:t,comments:n,isAllShown:r})=>{let i=t.files.get(e.state.selected);if(i===void 0||!e.isFileLoaded(i.path))return{file:i,selection:null,threadRows:[],settledRows:[],shownThreads:[],rowOf:()=>void 0};let{state:a,block:o}=e,s=TA(i,{context:a.context,opened:a.opened[i.path]??[],runs:a.runs[i.path]??[],isAllShown:r,layers:o.layers,cursor:a.isLayered?a.cursor:null}),c={...i,rows:s},l=Np(Mp(c.rows,{comments:n.live.comments,path:c.path}).byRow);return{file:c,selection:n.forFile(c.path,{path:c.path,rows:c.rows,isNewOnly:c.isSince===!0}),threadRows:[...l.open.keys()],settledRows:[...l.settled.keys()],shownThreads:[...l.open.values()].flat().map(e=>e.root.id),rowOf:RL(c,new Map([...l.open.entries()].flatMap(([e,t])=>t.map(t=>[t.root.id,e]))))}},HL=e=>{let{isOthersShown:t}=Qe();return VL({...e,isAllShown:t})},UL=(e,t)=>e?.rows.findIndex(e=>e.new===t)??-1,WL=(e,t)=>{let n=`${e.path}:${String(e.line)}`;if(e.row!==null)return`scroll:${n}:${String(e.row)}`;if(!e.isWidened)return`open:${n}`;let r=UL(t,e.line);return r===-1?``:`found:${n}:${String(r)}`},GL=(e,t)=>e===null||t.shown?.path!==e.path?``:t.props.isFileLoaded(e.path)?WL(e,t.shown):``,KL=({props:e,shown:t,whole:n},r)=>{let i=UL(t,r.line);if(i===-1&&!r.isWidened&&UL(n,r.line)!==-1&&n!==void 0)return e.setState(PA(e.state,{path:r.path,line:r.line,rows:n.rows})),{...r,isWidened:!0};let a=Math.max(0,i);return e.setState({...e.state,focus:`diff`,row:a,anchor:null}),{...r,row:a}},qL=(e,t)=>{e.current?.querySelector(`[data-review-row="${String(t)}"]`)?.scrollIntoView({block:`center`}),e.current?.focus({preventScroll:!0})},JL=e=>{let[t,n]=(0,K.useState)(null),{props:r,paneRef:i}=e,a=new Set(r.block.files.map(e=>e.path));return VA(GL(t,e),()=>{t?.row===null?n(KL(e,t)):t!==null&&(qL(i,t.row),n(null))}),{canJump:e=>a.has(e),handleJump:(t,r)=>{e.onOpen(t),n({path:t,line:r,row:null,isWidened:!1})}}},YL=(e,t)=>{let n=Ve(),r=(n,r)=>t.echoResolve(n.id,r,()=>e.actions.handleResolve(n,r));return{...e,actions:{...e.actions,handleResolve:async(e,t)=>{t&&n.add({title:`Settled`,actionProps:{children:`Undo`,onClick:()=>{r(e,!1)}}}),await r(e,t)},handleReply:(n,r)=>(t.echoReply(n.id,r,()=>e.sendReply(n,r)),Promise.resolve())}}},XL=(e,t)=>e.shown({threads:t,remarks:[],drafts:[]}).threads,ZL=(e,t)=>{let{place:n,block:r,state:i,setState:a}=e,o=UI({place:n,block:r,refresh:e.refresh}),s=PL({...e,live:o.live}),c=EI({place:n,branch:r.branch},e.refresh),l=HL({props:e,model:s,comments:o}),{file:u,selection:d,threadRows:f,settledRows:p,shownThreads:m}=l,h=JL({props:e,shown:u,whole:s.files.get(i.selected),paneRef:t,onOpen:s.handleOpen});BL({threads:r.threads,shown:m,acts:c});let g=TL({paneRef:t,rows:s.rows,order:s.order,hasLayers:s.hasLayers,rowsFor:s.rowsFor,layerOf:s.layerOf,state:i,setState:a,onToggleReviewed:e=>{s.toggleReviewed(i.selected,e)},onOpenPull:()=>{let t=e.extras.pull?.url;t!==void 0&&window.open(t,`_blank`,`noopener`)},onAskLayers:()=>{c.askLayers(r.layers)},onSettleRead:()=>{c.settleRead()},onSendDrafts:()=>{c.sendDrafts()},onTurn:()=>pI(i,{threads:XL(c,r.threads),rows:s.rows}),onToggleSince:()=>{let t=e.sinceView.modeOf(i.selected);t!==null&&e.sinceView.setMode(i.selected,t===`since`?`full`:`since`)},shown:{worktree:r.worktree,file:u},diff:{rows:u?.rows??[],threadRows:f,settledRows:p,selection:d}});return{comments:YL(o,c),model:s,acts:c,shown:c.shown({threads:r.threads,remarks:e.extras.remarks,drafts:e.extras.drafts}),handleOpen:s.handleOpen,threadJump:zL({props:e,rowOf:l.rowOf,paneRef:t}),press:g,jump:h,file:u,selection:d}},QL=wt({id:k(),file:k(),start:R(),end:R(),at:k(),snippet:k(),isMovedPast:Je(),isOutdated:Je()});wt({place:k(),branch:k(),threads:Cn(QL)});var $L=e=>({id:e.id,file:e.file,start:e.start,end:e.end,at:e.at,snippet:e.snippet,isMovedPast:e.isMovedPast,isOutdated:e.isOutdated}),eR={key:``,found:{}},tR=(e,{threads:t,isOn:n})=>{let[r,i]=(0,K.useState)(eR),a=new Map(e.block.files.map(e=>[e.path,e.fingerprint])),o=n&&t.length>0?[e.block.head.sha,...t.map(e=>`${e.id}@${a.get(e.file)??``}`)].join(`|`):``,s=zp(o);return VA(o,()=>{let{place:n,block:r}=e,a=t.map(e=>$L(e));(async()=>{try{let e=await xa({data:{place:n,branch:r.branch,threads:a}});s.current===o&&i({key:o,found:e})}catch{}})()}),r.found},nR=e=>e.metaKey||e.ctrlKey||e.altKey,rR=(e,t)=>t.isOn&&hL.has(e.key)&&!t.isDialogOpen&&!nR(e)&&!Dm(e.target),iR=e=>{dn(`keydown`,t=>{let n=e.keys.get(t.key);n!==void 0&&rR(t,e)&&(t.preventDefault(),n(t))})},aR=300,oR=({props:e,pane:t},n)=>{let{state:r}=e,i=r.pile??[],a=t.shown.threads,o=new Map(a.map(e=>[e.id,e]));return{isOn:r.lead===`threads`&&!n,pile:i,found:o,all:a,current:r.threadAt===null?void 0:o.get(r.threadAt),threads:i.flatMap(e=>{let t=o.get(e.id);return t===void 0?[]:[t]})}},sR=({props:e,pane:t},n)=>(r,i=null)=>{let{state:a,setState:o}=e,{threads:s}=t.shown,c=s.find(e=>e.id===r);r!==null&&r!==a.threadAt&&(i!==null&&n.mark(i),o(fI(a,r,{threads:s,rows:t.model.rows})),c!==void 0&&c.unread>0&&t.acts.read(c))},cR=({pane:e},t)=>(n=t.current)=>{if(n===void 0||n.isAboutBranch)return;let r={lead:`diff`,isBackToThreads:!0,threadAt:n.id};n.isMovedPast?e.threadJump.handleShowLayer(n,r):e.threadJump.handleJump(n,r)},lR=(e,{view:t,moved:n})=>{let{props:r,pane:i,paneRef:a}=e,{threads:o}=i.shown,s=r.state.threadAt,c=sR(e,n),l=e=>MN(e,{comments:i.comments.live.comments});return{pick:c,placed:l,showInDiff:cR(e,t),step:(e,n)=>{c(EM(t.pile,{threads:o,at:s,offset:e}),n)},section:(e,n)=>{c(DM(t.pile,{threads:o,at:s,offset:e}),n)},settle:e=>{t.current===void 0||e-n.at<aR||(i.comments.actions.handleResolve(l(t.current).root,!0),c(EM(t.pile,{threads:o,at:t.current.id,offset:1}),e))},reply:()=>{a.current?.querySelector(`[data-thread-current] [data-reply-open]`)?.click()},turn:()=>{r.setState(pI(r.state,{threads:o,rows:i.model.rows}))}}},uR=e=>new Map([[`j`,t=>{e.step(1,t.timeStamp)}],[`ArrowDown`,t=>{e.step(1,t.timeStamp)}],[`k`,t=>{e.step(-1,t.timeStamp)}],[`ArrowUp`,t=>{e.step(-1,t.timeStamp)}],[`]`,t=>{e.section(1,t.timeStamp)}],[`[`,t=>{e.section(-1,t.timeStamp)}],[`d`,t=>{e.settle(t.timeStamp)}],[`Enter`,()=>{e.showInDiff()}],[`R`,e.reply]]),dR=(e,{view:t,acts:n})=>{let r=OM(e.state.pile);return t.isOn&&r!==void 0?{pile:r,at:t.current?.id??null,left:SM(t.pile,t.all),onPick:e=>{n.pick(e.id)}}:void 0},fR=e=>{let{props:t,paneRef:n}=e,[r,i]=(0,K.useState)(0),a=oR(e,Sm()),o=tR(t,{threads:a.threads,isOn:a.isOn}),s=lR(e,{view:a,moved:{at:r,mark:e=>{i(e)}}});return iR({isOn:a.isOn,isDialogOpen:t.state.dialog!==null,paneRef:n,keys:uR(s)}),{...a,...s,code:o,left:SM(a.pile,a.all),waiting:bM(a.all).length,panel:dR(t,{view:a,acts:s})}},pR=e=>{let{block:t,state:n,setState:r}=e,i=(0,K.useRef)(null),a=ZL(e,i),o=fR({props:e,pane:a,paneRef:i}),s=o.turn,{phone:c,view:l,swipe:u,backRef:d,handleBarScroll:f}=KP(e,a);return(0,q.jsxs)(`section`,{"aria-label":`Review of ${t.branch}`,className:`flex size-full min-h-0 flex-col overflow-clip bg-wash outline-none`,"data-owns-keys":!0,onScrollCapture:t=>{e.onScroll(t.currentTarget,a.selection===null?null:a.file??null),f(t.target)},ref:i,tabIndex:-1,children:[(0,q.jsx)(Op,{block:t,lead:(0,q.jsx)(YM,{isThreads:o.isOn,left:o.isOn?o.left:o.waiting,onTurn:s}),onBase:()=>{r({...n,dialog:`base`})},onKeys:()=>{r({...n,dialog:`keys`})},phone:c,pull:e.extras.pull,reviewedCount:a.model.marks.count,model:c.listener,total:a.model.reviewTotal}),(0,q.jsxs)(`div`,{className:`relative min-h-0 flex-1 ${n.isPanelOpen?`review-columns-panel`:`review-columns`}`,"data-phone-view":l,onTouchEnd:u.handleTouchEnd,onTouchStart:u.handleTouchStart,ref:d,children:[(0,q.jsx)(dI,{block:t,model:a.model,acts:a.acts,setState:r,state:n}),(0,q.jsx)(XM,{lead:o,onPress:c.handlePress,pane:a,props:e}),n.isPanelOpen?(0,q.jsx)(tP,{lead:o,pane:a,paneRef:i,props:e}):null]}),(0,q.jsx)(QP,{...c}),(0,q.jsx)(Yd,{onOpen:a.handleOpen,phone:c,props:e})]})},mR=(e,t)=>{let n=(0,K.useRef)({onMount:e,onUnmount:t});(0,K.useEffect)(()=>{n.current={onMount:e,onUnmount:t}}),(0,K.useLayoutEffect)(()=>(n.current.onMount(),()=>{n.current.onUnmount()}),[])},hR=e=>{let t=(0,K.useRef)(e);(0,K.useEffect)(()=>{t.current=e}),(0,K.useEffect)(()=>{let e=()=>{t.current()},n=()=>{document.visibilityState===`hidden`&&t.current()};return globalThis.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,n),()=>{globalThis.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,n)}},[])},gR=`adiff-review`,_R=wt({old:m(R()),new:m(R())}),vR=wt({path:k(),fingerprint:k(),top:R(),line:m(_R)}),yR=wt({version:u(1),head:k(),selected:k(),cursor:k(),collapsed:Cn(k()),isHidingReviewed:Je(),isLayered:Je(),layerOpen:oe(k(),Je()),isPanelOpen:Je(),focus:St([`tree`,`diff`]),row:R(),context:pe([R(),u(`whole`)]),opened:r(oe(k(),Cn(I([R(),R()]))),{}),isWrapped:Je(),lead:r(St([`diff`,`threads`]),`diff`),pile:r(m(Cn(wt({id:k(),section:St([`asked`,`answered`,`movedOn`])}))),null),threadAt:r(m(k()),null),scroll:m(vR),rail:R()}),bR=({place:e,branch:t})=>[gR,e,t].join(`|`),xR=e=>{try{let t=b(yR,JSON.parse(sessionStorage.getItem(e)??`null`));return t.success?t.output:null}catch{return null}},SR=(e,t)=>{try{return sessionStorage.setItem(e,JSON.stringify(t)),!0}catch{return!1}},CR=(e,t)=>e.includes(t)?t:e.find(e=>e>t)??e.at(-1)??``,wR=(e,t)=>Math.max(0,e.layers.findIndex(e=>e.files.includes(t))),TR=(e,{selected:t,isLayered:n})=>n?`layer:${String(wR(e,t))}:${t}`:`file:${t}`,ER=(e,t)=>{let n=Xf(t),r=CR(t.order,e.selected);if(r===``)return{state:n,scroll:null,rail:0};let i=r===e.selected&&e.head===t.head.sha,a=e.isLayered&&t.layers.length>0,o=new Set(Yf(r));return{state:{...n,selected:r,cursor:i?e.cursor:TR(t,{selected:r,isLayered:a}),collapsed:new Set(e.collapsed.filter(e=>!o.has(e))),isHidingReviewed:e.isHidingReviewed,isLayered:a,layerOpen:i?e.layerOpen:{},isPanelOpen:e.isPanelOpen,focus:e.focus,row:i?e.row:0,context:e.context,opened:e.head===t.head.sha?e.opened:{},isWrapped:e.isWrapped,lead:e.lead,pile:e.pile,threadAt:e.threadAt},scroll:e.scroll?.path===r?e.scroll:null,rail:e.rail}},DR=(e,{head:t,scroll:n,rail:r})=>({version:1,head:t,selected:e.selected,cursor:e.cursor,collapsed:[...e.collapsed],isHidingReviewed:e.isHidingReviewed,isLayered:e.isLayered,layerOpen:{...e.layerOpen},isPanelOpen:e.isPanelOpen,focus:e.focus,row:e.row,context:e.context,opened:Object.fromEntries(Object.entries(e.opened).map(([e,t])=>[e,t.map(([e,t])=>[e,t])])),isWrapped:e.isWrapped,lead:e.lead,pile:e.pile===null?null:e.pile.map(e=>({...e})),threadAt:e.threadAt,scroll:n,rail:r}),OR=(e,t)=>{let{reviewRow:n=``}=xj(e)?.dataset??{},r=n===``?void 0:t.rows[Number(n)];return{path:t.path,fingerprint:t.fingerprint,top:e.scrollTop,line:r===void 0?null:{old:r.old,new:r.new}}},kR=(e,t)=>t.new!==null&&e.new!==null?Math.abs(e.new-t.new):t.old!==null&&e.old!==null?Math.abs(e.old-t.old):1/0,AR=(e,t)=>e.reduce((e,n,r)=>{let i=kR(n,t);return i<e.distance?{index:r,distance:i}:e},{index:-1,distance:1/0}).index,jR=(e,t,n)=>{let r=n===null?-1:AR(t.rows,n);r===-1?e.scrollTop=0:Ej(e,t,r)},MR=(e,{scroll:t,file:n})=>{t.fingerprint===n.fingerprint?e.scrollTop=t.top:jR(e,n,t.line)},NR=3e3,PR=[`touchstart`,`wheel`,`keydown`,`pointerdown`],FR=(e,{scroll:t,file:n})=>{let r={isFirst:!0},i=new ResizeObserver(()=>{r.isFirst?r.isFirst=!1:t.line===null?e.scrollTop=t.top:jR(e,n,t.line)});return i.observe(e.querySelector(`[data-review-rows]`)??e),i},IR=(e,t)=>{for(let t of e.getAnimations())t.finish();MR(e,t);let n=FR(e,t),r=()=>{n.disconnect();for(let e of PR)globalThis.removeEventListener(e,r,!0)};for(let e of PR)globalThis.addEventListener(e,r,{capture:!0,passive:!0});globalThis.setTimeout(r,NR)},LR=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t)),RR=(e,t)=>{let n=Yo(e.cursor);return n!==null&&e.cursor===Ko(n,e.selected)?n:Math.max(0,t.findIndex(t=>t.files.includes(e.selected)))},zR=(e,t,n)=>{if(t.selected===e.selected&&t.isLayered===e.isLayered)return t;if(!t.isLayered){let e=new Set(Yf(t.selected));return{...t,collapsed:new Set([...t.collapsed].filter(t=>!e.has(t)))}}let r=RR(t,n),i=n[r]?.ticket??null,a=LR(t.layerOpen,Wo(r));return{...t,cursor:Ko(r,t.selected),layerOpen:i===null?a:LR(a,Go(i))}},BR=250,VR=`[data-review-diff]`,HR=`[data-review-rail]`,UR=(e,t)=>{let n=e.closest(`section`)?.querySelector(HR);n!=null&&(n.scrollTop=t)},WR=(e,t,n)=>{let r=(0,K.useRef)(null),i=()=>{let{state:r,...i}=n.current;SR(e,DR(r,{...i,head:t}))};return{save:i,flush:()=>{r.current!==null&&(clearTimeout(r.current.id),r.current.measure(),r.current=null),i()},later:e=>{r.current===null?r.current={measure:e,id:setTimeout(()=>{r.current?.measure(),r.current=null,i()},BR)}:r.current.measure=e}}},GR=(e,t)=>{bm()&&(e.current.state={...e.current.state,isWrapped:!0},t(e.current.state))},KR=(e,t)=>{let[n,r]=(0,K.useState)(()=>Xf(t)),i=(0,K.useRef)({state:n,scroll:null,rail:0}),a=(0,K.useRef)(null),o=WR(bR(e),t.head.sha,i);return mR(()=>{let n=xR(bR(e));if(n===null){GR(i,r),Rt();return}let o=ER(n,t);a.current={path:o.state.selected,scroll:o.scroll,rail:o.rail},i.current=o,r(o.state)},()=>{o.flush()}),hR(o.flush),{state:n,setState:e=>{let n=zR(i.current.state,e,t.layers);a.current=null,Rt(),i.current.state=n,r(n),o.save()},handleScroll:(e,t)=>{o.later(()=>{let n=e.querySelector(VR);i.current.rail=e.querySelector(HR)?.scrollTop??0,i.current.scroll=n===null||t===null?i.current.scroll:OR(n,t)})},handleDiffShown:(e,t)=>{let n=a.current;n?.path===t.path&&(a.current=null,n.scroll!==null&&IR(e,{scroll:n.scroll,file:t}),UR(e,n.rail),Rt())}}},qR=({branch:e})=>(0,q.jsxs)(`div`,{className:`grid size-full place-items-center rounded-md border border-border text-sm text-subtle`,children:[`Reading `,e,`…`]}),JR=({outline:e,refresh:t,extras:n,...r})=>{let i=KR({place:r.place,branch:r.branch},e),{state:a,setState:o}=i,s=go(e),c=Do({place:r.place,branch:r.branch},{outline:e,selected:a.selected,layer:a.isLayered?Yo(a.cursor):null}),l={...e,files:c.files,layers:s.layers,tickets:s.tickets,threads:s.threads},u={...r,block:l,state:a,setState:o,refresh:t,onLayers:s.handleLayers,extras:n.extras,isFileLoaded:c.isFileLoaded,sinceView:c.sinceView,onScroll:i.handleScroll,onDiffShown:i.handleDiffShown};return(0,q.jsx)(pR,{...u})},YR=e=>{let t=ja({place:e.place,branch:e.branch}),{outline:n,refresh:r}=ho({place:e.place,branch:e.branch,kept:e.kept},e=>e.includes(`other`)?t.refresh():Promise.resolve());return(0,q.jsx)(`div`,{className:`grid h-full grid-cols-1 grid-rows-1 gap-3`,children:n===null?(0,q.jsx)(qR,{branch:e.branch}):(0,q.jsx)(JR,{...e,extras:t,outline:n,refresh:r})})};function XR(){let e=rn.useLoaderData();return e.ok?(0,q.jsx)(`main`,{className:`h-dvh safe-page`,children:(0,q.jsx)(YR,{branch:e.branch,kept:e.outline,place:e.place},`${e.place}|${e.branch}`)}):(0,q.jsxs)(`main`,{className:`mx-auto flex max-w-2xl flex-col gap-2 px-4 py-12`,children:[(0,q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`This review cannot open`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.error})]})}export{XR as component};