onepipeline-ui 0.90.1 → 0.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,107 @@
1
+ import{$ as e,A as t,B as n,C as r,Ct as i,D as a,E as o,Et as s,F as c,G as l,H as u,I as d,J as f,K as p,L as m,M as h,N as g,O as _,P as v,Q as y,R as b,S as x,St as S,T as C,Tt as w,U as T,V as E,W as D,X as O,Y as k,Z as A,_ as j,_t as M,a as N,at as P,b as F,bt as I,c as L,ct as R,d as ee,dt as te,et as ne,f as re,ft as ie,g as ae,gt as oe,ht as se,i as ce,it as le,j as ue,k as de,l as fe,lt as pe,m as me,mt as he,n as ge,nt as _e,o as ve,ot as ye,p as be,pt as xe,q as Se,r as Ce,rt as z,s as we,st as Te,t as Ee,tt as De,u as Oe,ut as ke,v as Ae,vt as je,w as Me,wt as Ne,x as Pe,xt as Fe,y as Ie,yt as Le,z as Re}from"./index-r1tmgIDs.js";var ze=z(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Be=z(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Ve=z(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),He=z(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ue=z(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),We=z(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Ge=z(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ke=z(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qe=z(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),Je=z(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Ye=z(`circle-minus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),Xe=z(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),Ze=z(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Qe=z(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),$e=z(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),et=z(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),tt=z(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),nt=z(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),rt=z(`hand`,[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]),it=z(`layers`,[[`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`}]]),at=z(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),ot=z(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),st=z(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),ct=z(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),lt=z(`message-square-off`,[[`path`,{d:`M19 19H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.7.7 0 0 1 2 21.286V5a2 2 0 0 1 1.184-1.826`,key:`1wyg69`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.656 3H20a2 2 0 0 1 2 2v11.344`,key:`mhl4k6`}]]),ut=z(`message-square-reply`,[[`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:`m10 8-3 3 3 3`,key:`fp6dz7`}],[`path`,{d:`M17 14v-1a2 2 0 0 0-2-2H7`,key:`1tkjnz`}]]),dt=z(`octagon-minus`,[[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),ft=z(`octagon-pause`,[[`path`,{d:`M10 15V9`,key:`1lckn7`}],[`path`,{d:`M14 15V9`,key:`1muqhk`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}]]),pt=z(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),mt=z(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),ht=z(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),gt=z(`repeat-2`,[[`path`,{d:`m2 9 3-3 3 3`,key:`1ltn5i`}],[`path`,{d:`M13 18H7a2 2 0 0 1-2-2V6`,key:`1r6tfw`}],[`path`,{d:`m22 15-3 3-3-3`,key:`4rnwn2`}],[`path`,{d:`M11 6h6a2 2 0 0 1 2 2v10`,key:`2f72bc`}]]),_t=z(`route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),vt=z(`satellite`,[[`path`,{d:`m13.5 6.5-3.148-3.148a1.205 1.205 0 0 0-1.704 0L6.352 5.648a1.205 1.205 0 0 0 0 1.704L9.5 10.5`,key:`dzhfyz`}],[`path`,{d:`M16.5 7.5 19 5`,key:`1ltcjm`}],[`path`,{d:`m17.5 10.5 3.148 3.148a1.205 1.205 0 0 1 0 1.704l-2.296 2.296a1.205 1.205 0 0 1-1.704 0L13.5 14.5`,key:`nfoymv`}],[`path`,{d:`M9 21a6 6 0 0 0-6-6`,key:`1iajcf`}],[`path`,{d:`M9.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l4.296-4.296a1.205 1.205 0 0 0 0-1.704l-2.296-2.296a1.205 1.205 0 0 0-1.704 0z`,key:`nv9zqy`}]]),yt=z(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),bt=z(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),xt=z(`square-terminal`,[[`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`}]]),St=z(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Ct=z(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),wt=z(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Tt=z(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),Et=z(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Dt=1e3,Ot=60*Dt,kt=60*Ot,At=24*kt,jt=[1,2,5,10,20,50,100,200,500,Dt,2*Dt,5*Dt,10*Dt,15*Dt,20*Dt,30*Dt,Ot,2*Ot,5*Ot,10*Ot,15*Ot,20*Ot,30*Ot,kt,2*kt,3*kt,6*kt,12*kt,At,2*At,7*At,14*At,30*At,60*At,90*At,180*At,365*At],Mt=5.6,Nt=8,Pt=160;function Ft(e,t=2){return String(e).padStart(t,`0`)}function It(e){let t=new Date(e);if(Number.isNaN(t.valueOf()))return String(e);let n=`${Ft(t.getHours())}:${Ft(t.getMinutes())}`,r=t.getMilliseconds();if(t.getSeconds()===0&&r===0)return n;let i=`${n}:${Ft(t.getSeconds())}`;if(r===0)return i;let a=r%100==0?1:r%10==0?2:3;return`${i}.${Ft(r,3).slice(0,a)}`}function Lt(e,t){let n=e<0?`-`:`+`,r=Math.round(Math.abs(e)/t)*t,i=Math.floor(r/kt),a=Math.floor(r%kt/Ot),o=Math.round(r%Ot),s=[];if(i>0&&s.push(`${i} h`),a>0&&s.push(`${a} min`),o>0){let e=t<Dt?Math.round(Math.log10(Dt/t)):0;s.push(`${Number((o/Dt).toFixed(e))} s`)}return s.length===0?`+0 ${t>=Ot?`min`:`s`}`:`${n}${s.join(` `)}`}function Rt(e){return e>=Ot?Ot:e>=Dt?Dt:10**Math.floor(Math.log10(e))}function zt(e){return[1,10,100,Dt].find(t=>t>=e)??Ot}function Bt(e,t,n){let r=zt(n),i=Math.round(e/r)*r;return{clock:It(i),offset:Lt(i-t,r)}}function Vt(e,t){return Math.max(e.length,t.length)*Mt}function Ht(e,t){let n=t>=kt?-new Date(e).getTimezoneOffset()*Ot:0;return Math.ceil((e+n)/t)*t-n}function Ut(e,t,n,r){let i=t.end-t.start,a=Rt(e),o=[],s=0,c=-1/0;for(let l=Ht(t.start,e);l<=t.end;l+=e){let e=It(l),u=Lt(l-n,a),d=Vt(e,u);s=Math.max(s,d);let f=(l-t.start)/i*r-d/2,p=`center`;f<0?(f=0,p=`start`):f+d>r&&(f=r-d,p=`end`),!(f<c+Nt)&&(c=f+d,o.push({alignment:p,clock:e,offset:u,value:l}))}return{regular:e/i*r>=s+Nt,ticks:o}}function Wt({minSpacingPx:e=0,origin:t,range:n,width:r}){let i=n.end-n.start;if(!(i>0)||!(r>0))return[];let a=Math.max(2,Math.floor(r/Pt)),o=null,s=null,c=[];for(let l of jt){if(l/i*r<Math.max(e,36))continue;let{regular:u,ticks:d}=Ut(l,n,t,r);c=d,u&&(o??=d,d.length>=a&&(s=d))}return s??o??c}var B=s(Fe(),1),V=A(),Gt=[`bg-spectrum-blue`,`bg-spectrum-green`,`bg-spectrum-orange`,`bg-spectrum-violet`,`bg-spectrum-red`,`bg-spectrum-indigo`,`bg-spectrum-yellow`],Kt=`__timeline_implicit_lane__`;function qt(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return Gt[(t>>>0)%Gt.length]??Gt[0]}function Jt(e){return e.laneId??Kt}function Yt(e){return typeof e.end==`number`&&Number.isFinite(e.end)?e.end:typeof e.duration==`number`&&Number.isFinite(e.duration)?e.start+e.duration:e.start}function Xt(e){return e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function Zt(e){let t=new Date(e);return Number.isNaN(t.valueOf())?String(e):t.toISOString()}function Qt(e,t){let n=Yt(e),r=[e.label,`Lane: ${Jt(e)}`,`Status: ${e.status??`unknown`}`,`Start: ${Zt(e.start)}`];return n>e.start?r.push(`End: ${Zt(n)}`,`Duration: ${Xt(n-e.start)}`):r.push(`Duration: not recorded`),e.status===`failed`&&t?.trim()&&r.push(`Failure: ${t.trim().slice(0,160)}`),r.join(` · `)}var $t=e=>`item:${e.id}`,en=e=>`marker:${e.id}`;function tn(e,t,n,r){let i=(0,B.useRef)(new Map),a=(0,B.useRef)(null),[o,s]=(0,B.useState)(null),c=(0,B.useCallback)((e,t)=>{t?i.current.set(e,t):i.current.delete(e)},[]),l=(e,t)=>{if(e===a.current)return;a.current=e,s(e);let n=e===null?void 0:i.current.get(e);r?.(t&&n?{element:n,entry:t}:null)};return{hoveredKey:o,leave:()=>l(null,null),register:c,resolve:(r,a,o)=>{let s=[...e.flatMap(e=>{let t=Yt(e);return t<n.start||e.start>n.end?[]:[{distance:r<e.start?e.start-r:r>t?r-t:0,entry:e,key:$t(e),marker:!1}]}),...t.flatMap(e=>e.at<n.start||e.at>n.end?[]:[{distance:Math.abs(e.at-r),entry:e,key:en(e),marker:!0}])],c=a instanceof Element?a.closest(`[data-timeline-entry]`):null,u=s.find(e=>i.current.get(e.key)===c),d=s.reduce((e,t)=>!e||t.distance<e.distance||t.distance===e.distance&&t.marker===o&&e.marker!==o?t:e,null),f=u??d;l(f?.key??null,f?.entry??null)}}}function nn(e,t){let n=t;for(let r=e.parentElement;r&&r!==t;r=r.parentElement)if(getComputedStyle(r).overflowX!==`visible`){n=r;break}let r=e.getBoundingClientRect(),i=n.getBoundingClientRect().left+n.clientLeft,a=i+n.clientWidth;r.left<i?n.scrollLeft+=r.left-i:r.right>a&&(n.scrollLeft+=r.right-a)}function rn(e,t,n){let[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null),s=(0,B.useRef)(null),c=(t&&t[1]>t[0]?{end:t[1],start:t[0]}:null)??r??e,l=Math.max(1,c.end-c.start),u=e=>{n?.([e.start,e.end]),t||i(e)},d=e=>{let t=s.current?.getBoundingClientRect(),n=t?.width||1e3;return c.start+Math.min(1,Math.max(0,(e-(t?.left??0))/n))*l};return{axis:s,brushStart:e=>o(d(e)),finishBrush:e=>{if(a===null)return;let t=d(e);Math.abs(t-a)>=l*.02&&u({end:Math.max(t,a),start:Math.min(t,a)}),o(null)},range:c,reset:()=>{n?.([e.start,e.end]),t||i(null)},viewChanged:c.start!==e.start||c.end!==e.end,zoom:(t,n)=>{let r=d(t),i=n<0?.75:1.25,a=Math.max(1,e.end-e.start),o=Math.min(a,Math.max(a/100,l*i)),s=r-o*((r-c.start)/l);s=Math.max(e.start,Math.min(s,e.end-o)),u({end:s+o,start:s})}}}function an({axis:e,cursor:t,crosshair:n=!0,ticks:r,expanded:i=!1,getFailureExcerpt:a,items:o,label:s=`Timeline`,lanes:c,markers:l=[],onExpandedChange:u,onHover:d,onRangeChange:f,onSelect:p,range:m,selectedId:h}){let g=(0,B.useId)(),[_,v]=(0,B.useState)(1e3),[y,b]=(0,B.useState)(null),[x,S]=(0,B.useState)(null),C=(0,B.useMemo)(()=>o.filter(e=>Number.isFinite(e.start)),[o]),w=(0,B.useMemo)(()=>l.filter(e=>Number.isFinite(e.at)),[l]),T=(0,B.useMemo)(()=>c?[...c]:[...new Set(C.map(Jt))].map(e=>({id:e,label:e===Kt?`Events`:e})),[c,C]),E=(0,B.useMemo)(()=>{let e=[...C.flatMap(e=>[e.start,Yt(e)]),...w.map(e=>e.at)];if(e.length===0)return{end:1,start:0};let t=Math.min(...e),n=Math.max(...e);return{end:n>t?n:t+1,start:t}},[C,w]),D=rn(E,m,f),{axis:O,range:A}=D,j=tn(C,w,A,d),M=(0,B.useRef)(null),N=C.length>0||w.length>0;(0,B.useEffect)(()=>{if(!N)return;let e=O.current;if(!e)return;let t=()=>v(e.getBoundingClientRect().width||1e3);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[O,N]),(0,B.useEffect)(()=>{let e=O.current,t=h?e?.querySelector(`[data-selected="true"]`):null;e&&t&&nn(t,e)},[O,h]);let P=Math.max(1,A.end-A.start),F=e=>(e-A.start)/P*100,I=i?T:[{id:`overlay`,label:`All events`}],L=e?.origin??E.start,R=r?.minSpacingPx,ee=R!==void 0&&Number.isFinite(R)&&R>0?R:0,te=(0,B.useMemo)(()=>Wt({minSpacingPx:ee,origin:L,range:{end:A.end,start:A.start},width:_}),[ee,L,_,A.end,A.start]),re=y===null?null:A.start+y*P,ie=re===null?null:Bt(re,L,P/_),ae=e=>{let t=Yt(e);if(t<A.start||e.start>A.end)return null;let n=Math.max(0,F(Math.max(e.start,A.start))),r=Math.max(.8,F(Math.min(t,A.end))-n),i=t<=e.start,o=`timeline-detail-${g}-${e.id.replace(/[^a-zA-Z0-9_-]/g,`-`)}`,s=qt(Jt(e));return(0,V.jsxs)(`div`,{className:`absolute inset-y-0`,style:{left:`${n}%`},children:[(0,V.jsx)(`button`,{"aria-describedby":o,"aria-label":`${e.label}, ${i?`point event`:`span`}`,"aria-pressed":h===e.id,"aria-current":h===e.id?`true`:void 0,"data-turn-id":e.turnId,"data-tool-call-id":e.toolCallId,"data-event-index":e.eventIndex,"data-timeline-entry":``,"data-timeline-hovered":j.hoveredKey===$t(e)?`true`:void 0,className:k(`absolute top-0 h-5 border-2 border-card shadow-sm hover:opacity-80 focus-visible:z-20`,i?`w-5 -translate-x-1/2 rounded-full`:`min-w-1 rounded-md`,h===e.id&&`ring-2 ring-foreground ring-offset-1`,s),"data-lane-color":s,"data-selected":h===e.id?`true`:`false`,"data-timeline-shape":i?`point`:`span`,onBlur:()=>S(null),onClick:t=>{t.stopPropagation(),S(e.id),p?.(e)},onFocus:()=>S(e.id),onMouseEnter:()=>S(e.id),onMouseLeave:()=>S(null),ref:t=>j.register($t(e),t),style:{width:i?void 0:`${r}cqw`},type:`button`,children:i?(0,V.jsx)(_e,{"aria-hidden":`true`,className:`m-auto size-2 fill-current text-white`}):null}),(0,V.jsx)(`span`,{className:k(`pointer-events-none absolute z-30 w-80 rounded-md bg-popover px-2.5 py-2 text-[10px] text-popover-foreground shadow-lg`,x===e.id?`block`:`sr-only`),id:o,role:x===e.id?`tooltip`:void 0,style:{top:`1.4rem`},children:Qt(e,a?.(e))})]},e.id)};return(0,V.jsxs)(`section`,{"aria-label":s,className:`timeline rounded-xl border bg-card p-4`,children:[(0,V.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,V.jsx)(`div`,{"aria-label":`Timeline legend`,className:`flex flex-wrap gap-3`,role:`list`,children:T.map(e=>(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] text-muted-foreground`,role:`listitem`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:k(`size-2 rounded-full`,qt(e.id))}),e.label]},e.id))}),(0,V.jsxs)(`div`,{className:`flex gap-1`,children:[(0,V.jsxs)(`button`,{"aria-label":i?`Collapse timeline`:`Expand timeline`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] text-muted-foreground hover:bg-muted`,onClick:()=>u?.(!i),type:`button`,children:[i?(0,V.jsx)(Ge,{"aria-hidden":`true`,className:`size-3`}):(0,V.jsx)(Ue,{"aria-hidden":`true`,className:`size-3`}),i?`Collapse`:`Expand`]}),(0,V.jsxs)(`button`,{"aria-label":`Reset timeline zoom`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] text-muted-foreground hover:bg-muted disabled:opacity-40`,disabled:!D.viewChanged,onClick:D.reset,type:`button`,children:[(0,V.jsx)(ne,{"aria-hidden":`true`,className:`size-3`}),` Reset zoom`]})]})]}),C.length===0&&w.length===0?(0,V.jsx)(`p`,{className:`m-0 text-xs text-muted-foreground`,children:`No timeline events recorded.`}):(0,V.jsxs)(`div`,{"aria-label":`Timeline plot. Scroll to zoom or drag to select a range.`,className:`relative touch-none select-none overflow-hidden rounded-lg border bg-muted/40 pb-3 pt-7`,onPointerMove:e=>{let t=e.currentTarget,n=t.getBoundingClientRect(),r=Math.min(1,Math.max(0,(e.clientX-n.left-t.clientLeft)/(t.clientWidth||n.width||1e3)));b(r);let i=M.current?.getBoundingClientRect().top??n.top;j.resolve(A.start+r*P,e.target,e.clientY<i)},onPointerLeave:()=>{b(null),j.leave()},onPointerDown:e=>D.brushStart(e.clientX),onPointerUp:e=>D.finishBrush(e.clientX),onWheel:e=>{e.preventDefault(),D.zoom(e.clientX,e.deltaY)},ref:O,children:[n&&ie!==null?(0,V.jsx)(`div`,{"aria-label":`Timeline crosshair`,className:`pointer-events-none absolute inset-y-0 z-30 w-0.5 -translate-x-1/2 bg-foreground shadow-[0_0_0_1px_var(--card)]`,style:{left:`${(y??0)*100}%`},children:(0,V.jsxs)(`span`,{className:`absolute top-0 flex flex-col items-center whitespace-nowrap rounded-sm border bg-popover px-1 text-[10px] leading-3 text-popover-foreground shadow-sm`,style:{transform:(y??0)>.5?`translateX(-100%)`:void 0},children:[(0,V.jsx)(`span`,{children:ie.clock}),(0,V.jsx)(`span`,{children:ie.offset})]})}):null,(0,V.jsxs)(`div`,{className:`relative grid gap-2`,ref:M,style:{containerType:`inline-size`},children:[I.map(e=>(0,V.jsxs)(`div`,{className:`relative h-6 border-b border-border/60`,"data-lane-id":e.id,"data-testid":`timeline-lane`,children:[i?(0,V.jsx)(`span`,{className:`sr-only`,children:e.label}):null,(i?C.filter(t=>Jt(t)===e.id):C).map(ae)]},e.id)),w.map(e=>e.at<A.start||e.at>A.end?null:(0,V.jsxs)(`div`,{className:`pointer-events-none absolute inset-y-0 z-20`,style:{left:`${F(e.at)}%`},children:[(0,V.jsx)(`span`,{className:`absolute inset-y-0 w-px bg-foreground/60`,"data-testid":`timeline-marker-line`}),(0,V.jsx)(`button`,{"aria-label":`${e.label}, marker`,"aria-pressed":h===e.id,className:k(`pointer-events-auto absolute bottom-full left-1/2 mb-1 flex size-5 -translate-x-1/2 items-center justify-center rounded-full bg-card text-foreground shadow`,h===e.id&&`ring-2 ring-foreground`),"data-selected":h===e.id?`true`:`false`,"data-timeline-entry":``,"data-timeline-hovered":j.hoveredKey===en(e)?`true`:void 0,onClick:t=>{t.stopPropagation(),p?.(e)},ref:t=>j.register(en(e),t),type:`button`,children:e.icon??(0,V.jsx)(st,{"aria-hidden":`true`,className:`size-3`})})]},e.id)),typeof t==`number`&&Number.isFinite(t)&&t>=A.start&&t<=A.end?(0,V.jsx)(`span`,{"aria-label":`Timeline cursor`,className:`pointer-events-none absolute inset-y-0 z-10 w-px bg-primary`,"data-testid":`timeline-cursor`,style:{left:`${F(t)}%`}}):null]}),(0,V.jsx)(`ol`,{"aria-label":`Timeline axis`,className:`relative m-0 mt-2 h-6 list-none p-0 font-mono text-[9px] leading-3 text-subtle`,"data-testid":`timeline-axis`,"data-timeline-axis":!0,children:te.map(e=>(0,V.jsxs)(`li`,{className:`absolute top-0 flex flex-col items-center whitespace-nowrap`,"data-tick-time":e.value,style:e.alignment===`start`?{left:0}:e.alignment===`end`?{right:0}:{left:`${F(e.value)}%`,transform:`translateX(-50%)`},children:[(0,V.jsx)(`span`,{children:e.clock}),(0,V.jsx)(`span`,{children:e.offset})]},e.value))})]})]})}var on=Object.defineProperty,sn=(e,t)=>on(e,`name`,{value:t,configurable:!0});function cn(e,t){let n=B.createContext(t);n.displayName=e+`Context`;let r=sn(e=>{let{children:t,...r}=e,i=B.useMemo(()=>r,Object.values(r));return(0,V.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=B.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return sn(i,`useContext`),[r,i]}sn(cn,`createContext`);function ln(e,t=[]){let n=[];function r(t,r){let i=B.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=sn(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=B.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=B.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return sn(s,`useContext`),[o,s]}sn(r,`createContext`);let i=sn(()=>{let t=n.map(e=>B.createContext(e));return sn(function(n){let r=n?.[e]||t;return B.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,un(i,...t)]}sn(ln,`createContextScope`);function un(...e){let t=e[0];if(e.length===1)return t;let n=sn(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return sn(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}sn(un,`composeContextScopes`);var dn=Object.defineProperty,fn=(e,t)=>dn(e,`name`,{value:t,configurable:!0});function pn(e){let t=e+`CollectionProvider`,[n,r]=ln(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=fn(e=>{let{scope:t,children:n}=e,r=B.useRef(null),a=B.useRef(new Map).current;return(0,V.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=p(s),l=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=f(t,a(s,n).collectionRef);return(0,V.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,m=p(u),h=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),s=f(t,o),c=a(u,n);return B.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,V.jsx)(m,{[d]:``,ref:s,children:r})});h.displayName=u;function g(t){let n=a(e+`CollectionConsumer`,t);return B.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return fn(g,`useCollection`),[{Provider:o,Slot:l,ItemSlot:h},g,r]}fn(pn,`createCollection`);var mn=new WeakMap,hn=class e extends Map{static{fn(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],mn.set(this,!0)}set(e,t){return mn.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=vn(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=gn(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=gn(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return gn(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function gn(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=_n(e,t);return n===-1?void 0:e[n]}fn(gn,`at`);function _n(e,t){let n=e.length,r=vn(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}fn(_n,`toSafeIndex`);function vn(e){return e!==e||e===0?0:Math.trunc(e)}fn(vn,`toSafeInteger`);function yn(e){let t=e+`CollectionProvider`,[n,r]=ln(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new hn,setItemMap:fn(()=>void 0,`setItemMap`)}),o=fn(({state:e,...t})=>e?(0,V.jsx)(c,{...t,state:e}):(0,V.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=fn(e=>{let t=_();return(0,V.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=fn(e=>{let{scope:t,children:n,state:r}=e,a=B.useRef(null),[o,s]=B.useState(null),c=f(a,s),[l,u]=r;return B.useEffect(()=>{if(!o)return;let e=Cn(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,V.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=p(l),d=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=f(t,a(l,n).collectionRef);return(0,V.jsx)(u,{ref:i,children:r})});d.displayName=l;let m=e+`CollectionItemSlot`,h=p(m),g=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),[s,c]=B.useState(null),l=f(t,o,c),{setItemMap:u}=a(m,n),d=B.useRef(i);bn(d.current,i)||(d.current=i);let p=d.current;return B.useEffect(()=>{let e=p;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(Sn):(t.set(s,{...e,element:s}),t.toSorted(Sn)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new hn(e)))}},[s,p,u]),(0,V.jsx)(h,{"data-radix-collection-item":``,ref:l,children:r})});g.displayName=m;function _(){return B.useState(new hn)}fn(_,`useInitCollection`);function v(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return fn(v,`useCollection`),[{Provider:o,Slot:d,ItemSlot:g},{createCollectionScope:r,useCollection:v,useInitCollection:_}]}fn(yn,`createCollection`);function bn(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}fn(bn,`shallowEqual`);function xn(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}fn(xn,`isElementPreceding`);function Sn(e,t){return!e[1].element||!t[1].element?0:xn(e[1].element,t[1].element)?-1:1}fn(Sn,`sortByDocumentPosition`);function Cn(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}fn(Cn,`getChildListObserver`);var wn=Object.defineProperty,Tn=(e,t)=>wn(e,`name`,{value:t,configurable:!0}),En=!!(typeof window<`u`&&window.document&&window.document.createElement);function Dn(e,t,{checkForDefaultPrevented:n=!0}={}){return Tn(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Tn(Dn,`composeEventHandlers`);function On(e){if(!En)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Tn(On,`getOwnerWindow`);function kn(e){if(!En)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Tn(kn,`getOwnerDocument`);function An(e,t=!1){let{activeElement:n}=kn(e);if(!n?.nodeName)return null;if(jn(n)&&n.contentDocument)return An(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=kn(n).getElementById(e);if(t)return t}}return n}Tn(An,`getActiveElement`);function jn(e){return e.tagName===`IFRAME`}Tn(jn,`isFrame`);var Mn=globalThis?.document?B.useLayoutEffect:()=>{},Nn=Object.defineProperty,Pn=(e,t)=>Nn(e,`name`,{value:t,configurable:!0}),Fn=B.useEffectEvent,In=B.useInsertionEffect;function Ln(e){if(typeof Fn==`function`)return Fn(e);let t=B.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof In==`function`?In(()=>{t.current=e}):Mn(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}Pn(Ln,`useEffectEvent`);var Rn=Object.defineProperty,zn=(e,t)=>Rn(e,`name`,{value:t,configurable:!0}),Bn=B.useInsertionEffect||Mn;function Vn({prop:e,defaultProp:t,onChange:n=zn(()=>{},`onChange`),caller:r}){let[i,a,o]=Hn({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,B.useCallback(t=>{if(s){let n=Un(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}zn(Vn,`useControllableState`);function Hn({defaultProp:e,onChange:t}){let[n,r]=B.useState(e),i=B.useRef(n),a=B.useRef(t);return Bn(()=>{a.current=t},[t]),B.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}zn(Hn,`useUncontrolledState`);function Un(e){return typeof e==`function`}zn(Un,`isFunction`);var Wn=Symbol(`RADIX:SYNC_STATE`);function Gn(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=Ln(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=B.useReducer((t,n)=>{if(n.type===Wn)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=B.useRef(p);B.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=B.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return B.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:Wn,state:i})},[i,d.state,c]),[h,f]}zn(Gn,`useControllableStateReducer`);var Kn=s(I(),1),qn=Object.defineProperty,Jn=(e,t)=>qn(e,`name`,{value:t,configurable:!0}),Yn=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=p(`Primitive.${t}`),r=B.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Xn(e,t){e&&Kn.flushSync(()=>e.dispatchEvent(t))}Jn(Xn,`dispatchDiscreteCustomEvent`);var Zn=Object.defineProperty,Qn=(e,t)=>Zn(e,`name`,{value:t,configurable:!0});function $n(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}Qn($n,`useStateMachine`);var er=Qn(e=>{let{present:t,children:n}=e,r=tr(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=rr(r.ref,ar(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null},`Presence`);function tr(e){let[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),a=B.useRef(`none`),o=B.useRef(void 0),[s,c]=$n(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return B.useEffect(()=>{s===`mounted`?(a.current=o.current??ir(r.current),o.current=void 0):a.current=`none`},[s]),Mn(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=ir(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Mn(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=Qn(a=>{let o=ir(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=Qn(e=>{e.target===t&&(a.current=ir(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:B.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=ir(t)}else r.current=null;n(e)},[])}}Qn(tr,`usePresence`);function nr(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Qn(nr,`setRef`);function rr(...e){let t=B.useRef(e);return t.current=e,B.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=nr(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():nr(n[e],null)}}},[])}Qn(rr,`useStableComposedRefs`);function ir(e){return e?.animationName||`none`}Qn(ir,`getAnimationName`);function ar(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Qn(ar,`getElementRef`);var or=Object.defineProperty,sr=(e,t)=>or(e,`name`,{value:t,configurable:!0}),cr=B.useId||(()=>void 0),lr=0;function ur(e){let[t,n]=B.useState(cr());return Mn(()=>{e||n(e=>e??String(lr++))},[e]),e||(t?`radix-${t}`:``)}sr(ur,`useId`);var dr=Object.defineProperty,fr=(e,t)=>dr(e,`name`,{value:t,configurable:!0}),pr=`Collapsible`,[mr,hr]=ln(pr),[gr,_r]=mr(pr),vr=B.forwardRef(fr(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=Vn({prop:r,defaultProp:i??!1,onChange:o,caller:pr});return(0,V.jsx)(gr,{scope:n,disabled:a,contentId:ur(),open:c,onOpenToggle:B.useCallback(()=>l(e=>!e),[l]),children:(0,V.jsx)(Yn.div,{"data-state":wr(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),yr=`CollapsibleTrigger`,br=B.forwardRef(fr(function(e,t){let{__scopeCollapsible:n,...r}=e,i=_r(yr,n);return(0,V.jsx)(Yn.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":wr(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:Dn(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),xr=`CollapsibleContent`,Sr=B.forwardRef(fr(function(e,t){let{forceMount:n,...r}=e,i=_r(xr,e.__scopeCollapsible);return(0,V.jsx)(er,{present:n||i.open,children:({present:e})=>(0,V.jsx)(Cr,{...r,ref:t,present:e})})},`CollapsibleContent`)),Cr=B.forwardRef(fr(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=_r(xr,n),[s,c]=B.useState(r),l=B.useRef(null),u=f(t,l),d=B.useRef(0),p=d.current,m=B.useRef(0),h=m.current,g=o.open||s,_=B.useRef(g),v=B.useRef(void 0);return B.useEffect(()=>{let e=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(e)},[]),Mn(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,m.current=t.width,_.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,V.jsx)(Yn.div,{"data-state":wr(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!g,...a,ref:u,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:g&&i})},`CollapsibleContentImpl`));function wr(e){return e?`open`:`closed`}fr(wr,`getState`);var Tr=vr,Er=br,Dr=Sr,Or=Object.defineProperty,kr=(e,t)=>Or(e,`name`,{value:t,configurable:!0}),Ar=B.createContext(void 0);function jr(e){let t=B.useContext(Ar);return e||t||`ltr`}kr(jr,`useDirection`);var Mr=Object.defineProperty,Nr=(e,t)=>Mr(e,`name`,{value:t,configurable:!0}),Pr=`Accordion`,Fr=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[Ir,Lr,Rr]=pn(Pr),[zr,Br]=ln(Pr,[Rr,hr]),Vr=hr(),Hr=B.forwardRef(Nr(function(e,t){let{type:n,...r}=e,i=r,a=r;return(0,V.jsx)(Ir.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,V.jsx)(Jr,{...a,ref:t}):(0,V.jsx)(qr,{...i,ref:t})})},`Accordion`)),[Ur,Wr]=zr(Pr),[Gr,Kr]=zr(Pr,{collapsible:!1}),qr=B.forwardRef(Nr(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Nr(()=>{},`onValueChange`),collapsible:a=!1,...o}=e,[s,c]=Vn({prop:n,defaultProp:r??``,onChange:i,caller:Pr});return(0,V.jsx)(Ur,{scope:e.__scopeAccordion,value:B.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:B.useCallback(()=>a&&c(``),[a,c]),children:(0,V.jsx)(Gr,{scope:e.__scopeAccordion,collapsible:a,children:(0,V.jsx)(Zr,{...o,ref:t})})})},`AccordionImplSingle`)),Jr=B.forwardRef(Nr(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Nr(()=>{},`onValueChange`),...a}=e,[o,s]=Vn({prop:n,defaultProp:r??[],onChange:i,caller:Pr}),c=B.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=B.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,V.jsx)(Ur,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,V.jsx)(Gr,{scope:e.__scopeAccordion,collapsible:!0,children:(0,V.jsx)(Zr,{...a,ref:t})})})},`AccordionImplMultiple`)),[Yr,Xr]=zr(Pr),Zr=B.forwardRef(Nr(function(e,t){let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=f(B.useRef(null),t),c=Lr(n),l=jr(i)===`ltr`,u=Dn(e.onKeyDown,e=>{if(!Fr.includes(e.key))return;let t=e.target,n=c().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),i=n.length;if(r===-1)return;e.preventDefault();let o=r,s=i-1,u=Nr(()=>{o=r+1,o>s&&(o=0)},`moveNext`),d=Nr(()=>{o=r-1,o<0&&(o=s)},`movePrev`);switch(e.key){case`Home`:o=0;break;case`End`:o=s;break;case`ArrowRight`:a===`horizontal`&&(l?u():d());break;case`ArrowDown`:a===`vertical`&&u();break;case`ArrowLeft`:a===`horizontal`&&(l?d():u());break;case`ArrowUp`:a===`vertical`&&d();break}n[o%i].ref.current?.focus()});return(0,V.jsx)(Yr,{scope:n,disabled:r,direction:i,orientation:a,children:(0,V.jsx)(Ir.Slot,{scope:n,children:(0,V.jsx)(Yn.div,{...o,"data-orientation":a,ref:s,onKeyDown:r?void 0:u})})})},`AccordionImpl`)),Qr=`AccordionItem`,[$r,ei]=zr(Qr),ti=B.forwardRef(Nr(function(e,t){let{__scopeAccordion:n,value:r,...i}=e,a=Xr(Qr,n),o=Wr(Qr,n),s=Vr(n),c=ur(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,V.jsx)($r,{scope:n,open:l,disabled:u,triggerId:c,children:(0,V.jsx)(Tr,{"data-orientation":a.orientation,"data-state":ci(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})},`AccordionItem`)),ni=`AccordionHeader`,ri=B.forwardRef(Nr(function(e,t){let{__scopeAccordion:n,...r}=e,i=Xr(Pr,n),a=ei(ni,n);return(0,V.jsx)(Yn.h3,{"data-orientation":i.orientation,"data-state":ci(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})},`AccordionHeader`)),ii=`AccordionTrigger`,ai=B.forwardRef(Nr(function(e,t){let{__scopeAccordion:n,...r}=e,i=Xr(Pr,n),a=ei(ii,n),o=Kr(ii,n),s=Vr(n);return(0,V.jsx)(Ir.ItemSlot,{scope:n,children:(0,V.jsx)(Er,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})},`AccordionTrigger`)),oi=`AccordionContent`,si=B.forwardRef(Nr(function(e,t){let{__scopeAccordion:n,...r}=e,i=Xr(Pr,n),a=ei(oi,n),o=Vr(n);return(0,V.jsx)(Dr,{role:`region`,"aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":`var(--radix-collapsible-content-height)`,"--radix-accordion-content-width":`var(--radix-collapsible-content-width)`,...e.style}})},`AccordionContent`));function ci(e){return e?`open`:`closed`}Nr(ci,`getState`);var li=Hr,ui=ti,di=ri,fi=ai,pi=si;function mi({...e}){return(0,V.jsx)(li,{"data-slot":`accordion`,...e})}function hi({className:e,...t}){return(0,V.jsx)(ui,{"data-slot":`accordion-item`,className:k(`border-b last:border-b-0`,e),...t})}function gi({className:e,children:t,...n}){return(0,V.jsx)(di,{className:`flex`,children:(0,V.jsxs)(fi,{"data-slot":`accordion-trigger`,className:k(`flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180`,e),...n,children:[t,(0,V.jsx)(Ue,{className:`pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200`})]})})}function _i({className:e,children:t,...n}){return(0,V.jsx)(pi,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,...n,children:(0,V.jsx)(`div`,{className:k(`pt-0 pb-4`,e),children:t})})}var vi=D(`relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`border-destructive bg-destructive-surface text-destructive *:data-[slot=alert-description]:text-destructive [&>svg]:text-current`}},defaultVariants:{variant:`default`}});function yi({className:e,variant:t,...n}){return(0,V.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:k(vi({variant:t}),e),...n})}function bi({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`alert-title`,className:k(`col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight`,e),...t})}function xi({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`alert-description`,className:k(`col-start-2 grid justify-items-start gap-1 text-sm text-muted-foreground [&_p]:leading-relaxed`,e),...t})}var Si=Object.defineProperty,Ci=(e,t)=>Si(e,`name`,{value:t,configurable:!0});function wi(e){let t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}Ci(wi,`useCallbackRef`);var Ti=Object.defineProperty,Ei=(e,t)=>Ti(e,`name`,{value:t,configurable:!0}),Di=`Avatar`,[Oi,ki]=ln(Di),Ai=[0,()=>void 0],[ji,Mi]=Oi(Di),Ni=B.forwardRef(Ei(function(e,t){let{__scopeAvatar:n,...r}=e,[i,a]=B.useState(`idle`),[o,s]=Ri();return(0,V.jsx)(ji,{scope:n,imageLoadingStatus:i,setImageLoadingStatus:a,imageCount:o,setImageCount:s,children:(0,V.jsx)(Yn.span,{...r,ref:t})})},`Avatar`)),Pi=`AvatarFallback`,Fi=B.forwardRef(Ei(function(e,t){let{__scopeAvatar:n,delayMs:r,...i}=e,a=Mi(Pi,n),[o,s]=B.useState(r===void 0);return B.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,V.jsx)(Yn.span,{...i,ref:t}):null},`AvatarFallback`));function Ii(e,{loadingStatus:t,setLoadingStatus:n,referrerPolicy:r,crossOrigin:i}){return Mn(()=>{if(!e){n(`error`);return}let t=new window.Image,a=Ei(e=>{let t=e.currentTarget;n(Li(t))},`handleLoad`),o=Ei(()=>n(`error`),`handleError`);return t.addEventListener(`load`,a),t.addEventListener(`error`,o),r&&(t.referrerPolicy=r),t.crossOrigin=i??null,t.src=e,n(Li(t)),()=>{t.removeEventListener(`load`,a),t.removeEventListener(`error`,o),n(`idle`)}},[e,i,r,n]),t}Ei(Ii,`useImageLoadingStatus`);function Li(e){return e.complete?e.naturalWidth>0?`loaded`:`error`:`loading`}Ei(Li,`getImageLoadingStatus`);function Ri(){return Ai}Ei(Ri,`useImageCount`);function zi(e){}Ei(zi,`useUpdateImageCount`);function Bi({className:e,size:t=`default`,...n}){return(0,V.jsx)(Ni,{"data-slot":`avatar`,"data-size":t,className:k(`group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6`,e),...n})}function Vi({className:e,...t}){return(0,V.jsx)(Fi,{"data-slot":`avatar-fallback`,className:k(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}function Hi({className:e,...t}){return(0,V.jsx)(`img`,{className:k(`aspect-square size-full object-cover`,e),"data-slot":`avatar-image`,...t})}var Ui=D(`inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`border border-destructive bg-destructive-surface text-destructive hover:bg-destructive-surface/80 focus-visible:ring-destructive/40`,outline:`border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,xs:`h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5`,lg:`h-10 rounded-md px-6 has-[>svg]:px-4`,icon:`size-9`,"icon-xs":`size-6 rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function Wi({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,V.jsx)(r?l:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:k(Ui({variant:t,size:n,className:e})),...i})}function Gi({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`card`,className:k(`flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm`,e),...t})}function Ki({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`card-content`,className:k(`px-6`,e),...t})}var qi=Object.defineProperty,Ji=(e,t)=>qi(e,`name`,{value:t,configurable:!0}),Yi=`dismissableLayer.update`,Xi=`dismissableLayer.pointerDownOutside`,Zi=`dismissableLayer.focusOutside`,Qi,$i=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ea=B.forwardRef(Ji(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=B.useContext($i),[d,p]=B.useState(null),m=d?.ownerDocument??globalThis?.document,[,h]=B.useState({}),g=f(t,p),_=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=v?_.indexOf(v):-1,b=d?_.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=B.useRef(!1),w=ra(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:B.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return S&&!t},[u.branches,S])}),T=ia(e=>{if(r&&C.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},m),E=d?b===_.length-1:!1,D=wi(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return B.useEffect(()=>{if(E)return m.addEventListener(`keydown`,D,{capture:!0}),()=>m.removeEventListener(`keydown`,D,{capture:!0})},[m,E,D]),B.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Qi=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),aa(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Qi))}},[d,m,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),aa())},[d,u]),B.useEffect(()=>{let e=Ji(()=>h({}),`handleUpdate`);return document.addEventListener(Yi,e),()=>document.removeEventListener(Yi,e)},[]),(0,V.jsx)(Yn.div,{...l,ref:g,style:{pointerEvents:x?S?`auto`:`none`:void 0,...e.style},onFocusCapture:Dn(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Dn(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Dn(e.onPointerDownCapture,w.onPointerDownCapture)})},`DismissableLayer`));function ta(){let e=B.useContext($i),[t,n]=B.useState(null);return B.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Ji(ta,`useDismissableLayerSurface`);var na=Ji(()=>!0,`IS_TRUE`);function ra(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=na}=t,s=wi(e),c=B.useRef(!1),l=B.useRef(!1),u=B.useRef(new Map),d=B.useRef(()=>{});return B.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}Ji(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}Ji(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}Ji(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}Ji(p,`handleInteractionBubble`);let m=Ji(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||oa(Xi,s,p,{discrete:!0})};if(Ji(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:Ji(()=>c.current=!0,`onPointerDownCapture`)}}Ji(ra,`usePointerDownOutside`);function ia(e,t=globalThis?.document){let n=wi(e),r=B.useRef(!1);return B.useEffect(()=>{let e=Ji(e=>{e.target&&!r.current&&oa(Zi,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:Ji(()=>r.current=!0,`onFocusCapture`),onBlurCapture:Ji(()=>r.current=!1,`onBlurCapture`)}}Ji(ia,`useFocusOutside`);function aa(){let e=new CustomEvent(Yi);document.dispatchEvent(e)}Ji(aa,`dispatchUpdate`);function oa(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Xn(i,a):i.dispatchEvent(a)}Ji(oa,`handleAndDispatchCustomEvent`);var sa=Object.defineProperty,ca=(e,t)=>sa(e,`name`,{value:t,configurable:!0}),la=`focusScope.autoFocusOnMount`,ua=`focusScope.autoFocusOnUnmount`,da={bubbles:!1,cancelable:!0},fa=B.forwardRef(ca(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=wi(i),u=wi(a),d=B.useRef(null),p=f(t,c),m=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(m.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:ya(d.current,{select:!0})},t=function(e){if(m.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||ya(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&ya(s)};ca(e,`handleFocusIn`),ca(t,`handleFocusOut`),ca(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,m.paused]),B.useEffect(()=>{if(s){ba.add(m);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(la,da);s.addEventListener(la,l),s.dispatchEvent(t),t.defaultPrevented||(pa(Ca(ha(s)),{select:!0}),document.activeElement===e&&ya(s))}return()=>{s.removeEventListener(la,l),setTimeout(()=>{let t=new CustomEvent(ua,da);s.addEventListener(ua,u),s.dispatchEvent(t),t.defaultPrevented||ya(e??document.body,{select:!0}),s.removeEventListener(ua,u),ba.remove(m)},0)}}},[s,l,u,m]);let h=B.useCallback(e=>{if(!n&&!r||m.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=ma(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&ya(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&ya(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,m.paused]);return(0,V.jsx)(Yn.div,{tabIndex:-1,...o,ref:p,onKeyDown:h})},`FocusScope`));function pa(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(ya(r,{select:t}),document.activeElement!==n)return}ca(pa,`focusFirst`);function ma(e){let t=ha(e);return[ga(t,e),ga(t.reverse(),e)]}ca(ma,`getTabbableEdges`);function ha(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:ca(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}ca(ha,`getTabbableCandidates`);function ga(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):_a(r,{upTo:t})))return r}ca(ga,`findVisible`);function _a(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}ca(_a,`isHidden`);function va(e){return e instanceof HTMLInputElement&&`select`in e}ca(va,`isSelectableInput`);function ya(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&va(e)&&t&&e.select()}}ca(ya,`focus`);var ba=xa();function xa(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Sa(e,t),e.unshift(t)},remove(t){e=Sa(e,t),e[0]?.resume()}}}ca(xa,`createFocusScopesStack`);function Sa(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}ca(Sa,`arrayRemove`);function Ca(e){return e.filter(e=>e.tagName!==`A`)}ca(Ca,`removeLinks`);var wa=Object.defineProperty,Ta=B.forwardRef(((e,t)=>wa(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=B.useState(!1);Mn(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Kn.createPortal((0,V.jsx)(Yn.div,{...r,ref:t}),o):null},`Portal`)),Ea=Object.defineProperty,Da=(e,t)=>Ea(e,`name`,{value:t,configurable:!0}),Oa=0,ka=null;function Aa(e){return ja(),e.children}Da(Aa,`FocusGuards`);function ja(){B.useEffect(()=>{ka||={start:Ma(),end:Ma()};let{start:e,end:t}=ka;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Oa++,()=>{Oa===1&&(ka?.start.remove(),ka?.end.remove(),ka=null),Oa=Math.max(0,Oa-1)}},[])}Da(ja,`useFocusGuards`);function Ma(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}Da(Ma,`createFocusGuard`);var Na=function(){return Na=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Na.apply(this,arguments)};function Pa(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Fa(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Ia=`right-scroll-bar-position`,La=`width-before-scroll-bar`,Ra=`with-scroll-bars-hidden`,za=`--removed-body-scroll-bar-size`;function Ba(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Va(e,t){var n=(0,B.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Ha=typeof window<`u`?B.useLayoutEffect:B.useEffect,Ua=new WeakMap;function Wa(e,t){var n=Va(t||null,function(t){return e.forEach(function(e){return Ba(e,t)})});return Ha(function(){var t=Ua.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Ba(e,null)}),i.forEach(function(e){r.has(e)||Ba(e,a)})}Ua.set(n,e)},[e]),n}function Ga(e){return e}function Ka(e,t){t===void 0&&(t=Ga);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function qa(e){e===void 0&&(e={});var t=Ka(null);return t.options=Na({async:!0,ssr:!1},e),t}var Ja=function(e){var t=e.sideCar,n=Pa(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return B.createElement(r,Na({},n))};Ja.isSideCarExport=!0;function Ya(e,t){return e.useMedium(t),Ja}var Xa=qa(),Za=function(){},Qa=B.forwardRef(function(e,t){var n=B.useRef(null),r=B.useState({onScrollCapture:Za,onWheelCapture:Za,onTouchMoveCapture:Za}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Pa(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Wa([n,t]),C=Na(Na({},b),i);return B.createElement(B.Fragment,null,u&&B.createElement(x,{sideCar:Xa,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?B.cloneElement(B.Children.only(s),Na(Na({},C),{ref:S})):B.createElement(v,Na({},C,{className:c,ref:S}),s))});Qa.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Qa.classNames={fullWidth:La,zeroRight:Ia};var $a,eo=function(){if($a)return $a;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function to(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=eo();return t&&e.setAttribute(`nonce`,t),e}function no(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ro(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var io=function(){var e=0,t=null;return{add:function(n){e==0&&(t=to())&&(no(t,n),ro(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ao=function(){var e=io();return function(t,n){B.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},oo=function(){var e=ao();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},so={left:0,top:0,right:0,gap:0},co=function(e){return parseInt(e||``,10)||0},lo=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[co(n),co(r),co(i)]},uo=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return so;var t=lo(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},fo=oo(),po=`data-scroll-locked`,mo=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
+ .${Ra} {
3
+ overflow: hidden ${r};
4
+ padding-right: ${s}px ${r};
5
+ }
6
+ body[${po}] {
7
+ overflow: hidden ${r};
8
+ overscroll-behavior: contain;
9
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
10
+ padding-left: ${i}px;
11
+ padding-top: ${a}px;
12
+ padding-right: ${o}px;
13
+ margin-left:0;
14
+ margin-top:0;
15
+ margin-right: ${s}px ${r};
16
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
+ }
18
+
19
+ .${Ia} {
20
+ right: ${s}px ${r};
21
+ }
22
+
23
+ .${La} {
24
+ margin-right: ${s}px ${r};
25
+ }
26
+
27
+ .${Ia} .${Ia} {
28
+ right: 0 ${r};
29
+ }
30
+
31
+ .${La} .${La} {
32
+ margin-right: 0 ${r};
33
+ }
34
+
35
+ body[${po}] {
36
+ ${za}: ${s}px;
37
+ }
38
+ `},ho=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},go=function(){B.useEffect(function(){return document.body.setAttribute(po,(ho()+1).toString()),function(){var e=ho()-1;e<=0?document.body.removeAttribute(po):document.body.setAttribute(po,e.toString())}},[])},_o=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;go();var a=B.useMemo(function(){return uo(i)},[i]);return B.createElement(fo,{styles:mo(a,!t,i,n?``:`!important`)})},vo=!1;if(typeof window<`u`)try{var yo=Object.defineProperty({},"passive",{get:function(){return vo=!0,!0}});window.addEventListener(`test`,yo,yo),window.removeEventListener(`test`,yo,yo)}catch{vo=!1}var bo=vo?{passive:!1}:!1,xo=function(e){return e.tagName===`TEXTAREA`},So=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!xo(e)&&n[t]===`visible`)},Co=function(e){return So(e,`overflowY`)},wo=function(e){return So(e,`overflowX`)},To=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Oo(e,r)){var i=ko(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Eo=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Do=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Oo=function(e,t){return e===`v`?Co(t):wo(t)},ko=function(e,t){return e===`v`?Eo(t):Do(t)},Ao=function(e,t){return e===`h`&&t===`rtl`?-1:1},jo=function(e,t,n,r,i){var a=Ao(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=ko(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Oo(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Mo=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},No=function(e){return[e.deltaX,e.deltaY]},Po=function(e){return e&&`current`in e?e.current:e},Fo=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Io=function(e){return`
39
+ .block-interactivity-${e} {pointer-events: none;}
40
+ .allow-interactivity-${e} {pointer-events: all;}
41
+ `},Lo=0,Ro=[];function zo(e){var t=B.useRef([]),n=B.useRef([0,0]),r=B.useRef(),i=B.useState(Lo++)[0],a=B.useState(oo)[0],o=B.useRef(e);B.useEffect(function(){o.current=e},[e]),B.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Fa([e.lockRef.current],(e.shards||[]).map(Po),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=B.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Mo(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=To(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=To(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return jo(h,t,e,h===`h`?s:c,!0)},[]),c=B.useCallback(function(e){var n=e;if(!(!Ro.length||Ro[Ro.length-1]!==a)){var r=`deltaY`in n?No(n):Mo(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Fo(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Po).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=B.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Bo(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=B.useCallback(function(e){n.current=Mo(e),r.current=void 0},[]),d=B.useCallback(function(t){l(t.type,No(t),t.target,s(t,e.lockRef.current))},[]),f=B.useCallback(function(t){l(t.type,Mo(t),t.target,s(t,e.lockRef.current))},[]);B.useEffect(function(){return Ro.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,bo),document.addEventListener(`touchmove`,c,bo),document.addEventListener(`touchstart`,u,bo),function(){Ro=Ro.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,bo),document.removeEventListener(`touchmove`,c,bo),document.removeEventListener(`touchstart`,u,bo)}},[]);var p=e.removeScrollBar,m=e.inert;return B.createElement(B.Fragment,null,m?B.createElement(a,{styles:Io(i)}):null,p?B.createElement(_o,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Bo(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Vo=Ya(Xa,zo),Ho=B.forwardRef(function(e,t){return B.createElement(Qa,Na({},e,{ref:t,sideCar:Vo}))});Ho.classNames=Qa.classNames;var Uo=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Wo=new WeakMap,Go=new WeakMap,Ko={},qo=0,Jo=function(e){return e&&(e.host||Jo(e.parentNode))},Yo=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Jo(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Xo=function(e,t,n,r){var i=Yo(t,Array.isArray(e)?e:[e]);Ko[n]||(Ko[n]=new WeakMap);var a=Ko[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Wo.get(e)||0)+1,l=(a.get(e)||0)+1;Wo.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Go.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),qo++,function(){o.forEach(function(e){var t=Wo.get(e)-1,i=a.get(e)-1;Wo.set(e,t),a.set(e,i),t||(Go.has(e)||e.removeAttribute(r),Go.delete(e)),i||e.removeAttribute(n)}),qo--,qo||(Wo=new WeakMap,Wo=new WeakMap,Go=new WeakMap,Ko={})}},Zo=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Uo(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Xo(r,i,n,`aria-hidden`)):function(){return null}},Qo=Object.defineProperty,$o=(e,t)=>Qo(e,`name`,{value:t,configurable:!0}),es=`Dialog`,[ts,ns]=ln(es),[rs,is]=ts(es),as=$o(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=B.useRef(null),c=B.useRef(null),[l,u]=Vn({prop:r,defaultProp:i??!1,onChange:a,caller:es}),[d,f]=B.useState(0),[p,m]=B.useState(0);return(0,V.jsx)(rs,{scope:t,triggerRef:s,contentRef:c,contentId:ur(),titleId:ur(),descriptionId:ur(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:B.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),os=`DialogPortal`,[ss,cs]=ts(os,{forceMount:void 0}),ls=$o(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=is(os,t);return(0,V.jsx)(ss,{scope:t,forceMount:n,children:B.Children.map(r,e=>(0,V.jsx)(er,{present:n||a.open,children:(0,V.jsx)(Ta,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),us=`DialogOverlay`,ds=B.forwardRef($o(function(e,t){let n=cs(us,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=is(us,e.__scopeDialog);return a.modal?(0,V.jsx)(er,{present:r||a.open,children:(0,V.jsx)(ps,{...i,ref:t})}):null},`DialogOverlay`)),fs=p(`DialogOverlay.RemoveScroll`),ps=B.forwardRef($o(function(e,t){let{__scopeDialog:n,...r}=e,i=is(us,n),a=f(t,ta());return(0,V.jsx)(Ho,{as:fs,allowPinchZoom:!0,shards:[i.contentRef],children:(0,V.jsx)(Yn.div,{"data-state":Ts(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),ms=`DialogContent`,hs=B.forwardRef($o(function(e,t){let n=cs(ms,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=is(ms,e.__scopeDialog);return(0,V.jsx)(er,{present:r||a.open,children:a.modal?(0,V.jsx)(gs,{...i,ref:t}):(0,V.jsx)(_s,{...i,ref:t})})},`DialogContent`)),gs=B.forwardRef($o(function(e,t){let n=is(ms,e.__scopeDialog),r=B.useRef(null),i=f(t,n.contentRef,r);return B.useEffect(()=>{let e=r.current;if(e)return Zo(e)},[]),(0,V.jsx)(vs,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Dn(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Dn(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Dn(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),_s=B.forwardRef($o(function(e,t){let n=is(ms,e.__scopeDialog),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(vs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),vs=B.forwardRef($o(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=is(ms,n);return ja(),(0,V.jsx)(V.Fragment,{children:(0,V.jsx)(fa,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(ea,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Ts(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),ys=`DialogTitle`,bs=B.forwardRef($o(function(e,t){let{__scopeDialog:n,...r}=e,i=is(ys,n),{setTitleCount:a}=i;return Mn(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,V.jsx)(Yn.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),xs=`DialogDescription`,Ss=B.forwardRef($o(function(e,t){let{__scopeDialog:n,...r}=e,i=is(xs,n),{setDescriptionCount:a}=i;return Mn(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,V.jsx)(Yn.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),Cs=`DialogClose`,ws=B.forwardRef($o(function(e,t){let{__scopeDialog:n,...r}=e,i=is(Cs,n);return(0,V.jsx)(Yn.button,{type:`button`,...r,ref:t,onClick:Dn(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Ts(e){return e?`open`:`closed`}$o(Ts,`getState`);function Es({...e}){return(0,V.jsx)(as,{"data-slot":`dialog`,...e})}function Ds({...e}){return(0,V.jsx)(ls,{"data-slot":`dialog-portal`,...e})}function Os({...e}){return(0,V.jsx)(ws,{"data-slot":`dialog-close`,...e})}function ks({className:e,...t}){return(0,V.jsx)(ds,{"data-slot":`dialog-overlay`,className:k(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function As({className:e,children:t,showCloseButton:n=!0,...r}){return(0,V.jsxs)(Ds,{"data-slot":`dialog-portal`,children:[(0,V.jsx)(ks,{}),(0,V.jsxs)(hs,{"data-slot":`dialog-content`,className:k(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,V.jsxs)(ws,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,V.jsx)(Et,{}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function js({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`dialog-header`,className:k(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Ms({className:e,showCloseButton:t=!1,children:n,...r}){return(0,V.jsxs)(`div`,{"data-slot":`dialog-footer`,className:k(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,V.jsx)(ws,{asChild:!0,children:(0,V.jsx)(Wi,{variant:`outline`,children:`Close`})})]})}function Ns({className:e,...t}){return(0,V.jsx)(bs,{"data-slot":`dialog-title`,className:k(`text-lg leading-none font-semibold`,e),...t})}function Ps({className:e,...t}){return(0,V.jsx)(Ss,{"data-slot":`dialog-description`,className:k(`text-sm text-muted-foreground`,e),...t})}function Fs({className:e,type:t,...n}){return(0,V.jsx)(`input`,{type:t,"data-slot":`input`,className:k(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,e),...n})}var Is=Object.defineProperty,Ls=B.forwardRef(((e,t)=>Is(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,V.jsx)(Yn.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`));function Rs({className:e,...t}){return(0,V.jsx)(Ls,{"data-slot":`label`,className:k(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var zs=[`top`,`right`,`bottom`,`left`],Bs=Math.min,Vs=Math.max,Hs=Math.round,Us=Math.floor,Ws=e=>({x:e,y:e}),Gs={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ks(e,t,n){return Vs(e,Bs(t,n))}function qs(e,t){return typeof e==`function`?e(t):e}function Js(e){return e.split(`-`)[0]}function Ys(e){return e.split(`-`)[1]}function Xs(e){return e===`x`?`y`:`x`}function Zs(e){return e===`y`?`height`:`width`}function Qs(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function $s(e){return Xs(Qs(e))}function ec(e,t,n){n===void 0&&(n=!1);let r=Ys(e),i=$s(e),a=Zs(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=lc(o)),[o,lc(o)]}function tc(e){let t=lc(e);return[nc(e),t,nc(t)]}function nc(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var rc=[`left`,`right`],ic=[`right`,`left`],ac=[`top`,`bottom`],oc=[`bottom`,`top`];function sc(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ic:rc:t?rc:ic;case`left`:case`right`:return t?ac:oc;default:return[]}}function cc(e,t,n,r){let i=Ys(e),a=sc(Js(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(nc)))),a}function lc(e){let t=Js(e);return Gs[t]+e.slice(t.length)}function uc(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function dc(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:uc(e)}function fc(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function pc(e,t,n){let{reference:r,floating:i}=e,a=Qs(t),o=$s(t),s=Zs(o),c=Js(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Ys(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function mc(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=qs(t,e),p=dc(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=fc(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=fc(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var hc=50,gc=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:mc},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=pc(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<hc&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=pc(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},_c=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=qs(e,t)||{};if(l==null)return{};let d=dc(u),f={x:n,y:r},p=$s(i),m=Zs(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Bs(d[_],T),D=Bs(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Ks(E,k,O),j=!c.arrow&&Ys(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),vc=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=qs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Js(r),_=Qs(o),v=Js(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[lc(o)]:tc(o)),x=p!==`none`;!d&&x&&b.push(...cc(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ec(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Qs(t))||T.every(e=>Qs(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Qs(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function yc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bc(e){return zs.some(t=>e[t]>=0)}var xc=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=qs(e,t);switch(i){case`referenceHidden`:{let e=yc(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:bc(e)}}}case`escaped`:{let e=yc(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:bc(e)}}}default:return{}}}}},Sc=new Set([`left`,`top`]);async function Cc(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Js(n),s=Ys(n),c=Qs(n)===`y`,l=Sc.has(o)?-1:1,u=a&&c?-1:1,d=qs(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var wc=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Cc(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Tc=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=qs(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Qs(i),p=Xs(f),m=u[p],h=u[f],g=(e,t)=>Ks(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Ec=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=qs(e,t),u={x:n,y:r},d=Qs(i),f=Xs(d),p=u[f],m=u[d],h=qs(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Sc.has(Js(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Dc=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=qs(e,t),c=await i.detectOverflow(t,s),l=Js(n),u=Ys(n),d=Qs(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Bs(p-c[m],g),y=Bs(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Vs(c.left,c.right):S=p-2*Vs(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Oc(){return typeof window<`u`}function kc(e){return Mc(e)?(e.nodeName||``).toLowerCase():`#document`}function Ac(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function jc(e){return((Mc(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Mc(e){return Oc()?e instanceof Node||e instanceof Ac(e).Node:!1}function Nc(e){return Oc()?e instanceof Element||e instanceof Ac(e).Element:!1}function Pc(e){return Oc()?e instanceof HTMLElement||e instanceof Ac(e).HTMLElement:!1}function Fc(e){return!Oc()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ac(e).ShadowRoot}function Ic(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=qc(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Lc(e){return/^(table|td|th)$/.test(kc(e))}function Rc(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var zc=/transform|translate|scale|rotate|perspective|filter/,Bc=/paint|layout|strict|content/,Vc=e=>!!e&&e!==`none`,Hc;function Uc(e){let t=Nc(e)?qc(e):e;return Vc(t.transform)||Vc(t.translate)||Vc(t.scale)||Vc(t.rotate)||Vc(t.perspective)||!Gc()&&(Vc(t.backdropFilter)||Vc(t.filter))||zc.test(t.willChange||``)||Bc.test(t.contain||``)}function Wc(e){let t=Yc(e);for(;Pc(t)&&!Kc(t);){if(Uc(t))return t;if(Rc(t))return null;t=Yc(t)}return null}function Gc(){return Hc??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Hc}function Kc(e){return/^(html|body|#document)$/.test(kc(e))}function qc(e){return Ac(e).getComputedStyle(e)}function Jc(e){return Nc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yc(e){if(kc(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Fc(e)&&e.host||jc(e);return Fc(t)?t.host:t}function Xc(e){let t=Yc(e);return Kc(t)?(e.ownerDocument||e).body:Pc(t)&&Ic(t)?t:Xc(t)}function Zc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Xc(e),i=r===e.ownerDocument?.body,a=Ac(r);if(i){let e=Qc(a);return t.concat(a,a.visualViewport||[],Ic(r)?r:[],e&&n?Zc(e):[])}else return t.concat(r,Zc(r,[],n))}function Qc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $c(e){let t=qc(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Pc(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Hs(n)!==a||Hs(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function el(e){return Nc(e)?e:e.contextElement}function tl(e){let t=el(e);if(!Pc(t))return Ws(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$c(t),o=(a?Hs(n.width):n.width)/r,s=(a?Hs(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var nl=Ws(0);function rl(e){let t=Ac(e);return!Gc()||!t.visualViewport?nl:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function il(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ac(e)}function al(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=el(e),o=Ws(1);t&&(r?Nc(r)&&(o=tl(r)):o=tl(e));let s=il(a,n,r)?rl(a):Ws(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Ac(a),t=Nc(r)?Ac(r):r,n=e,i=Qc(n);for(;i&&t!==n;){let e=tl(i),t=i.getBoundingClientRect(),r=qc(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ac(i),i=Qc(n)}}return fc({width:u,height:d,x:c,y:l})}function ol(e,t){let n=Jc(e).scrollLeft;return t?t.left+n:al(jc(e)).left+n}function sl(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ol(e,n),y:n.top+t.scrollTop}}function cl(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=jc(r),s=t?Rc(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ws(1),u=Ws(0),d=Pc(r);if((d||!a)&&((kc(r)!==`body`||Ic(o))&&(c=Jc(r)),d)){let e=al(r);l=tl(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?sl(o,c):Ws(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ll(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function ul(e){let t=Jc(e),n=e.ownerDocument.body,r=Vs(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Vs(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+ol(e),o=-t.scrollTop;return qc(n).direction===`rtl`&&(a+=Vs(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var dl=25;function fl(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Ac(e),a=jc(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Gc()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(ol(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=dl&&(s-=o)}return{width:s,height:c,x:l,y:u}}function pl(e,t){let n=al(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=tl(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ml(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=fl(e,n,t);else if(t===`document`)r=ul(jc(e));else if(Nc(t))r=pl(t,n);else{let n=rl(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return fc(r)}function hl(e,t){let n=t.get(e);if(n)return n;let r=Zc(e,[],!1).filter(e=>Nc(e)&&kc(e)!==`body`),i=null,a=qc(e).position===`fixed`,o=a?Yc(e):e;for(;Nc(o)&&!Kc(o);){let e=qc(o),t=Uc(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Yc(o)}return t.set(e,r),r}function gl(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Rc(t)?[]:hl(t,this._c):[].concat(n),r],o=ml(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=ml(t,a[e],i);s=Vs(n.top,s),c=Bs(n.right,c),l=Bs(n.bottom,l),u=Vs(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function _l(e){let{width:t,height:n}=$c(e);return{width:t,height:n}}function vl(e,t,n){let r=Pc(t),i=jc(t),a=n===`fixed`,o=al(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ws(0);if((r||!a)&&((kc(t)!==`body`||Ic(i))&&(s=Jc(t)),r)){let e=al(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=ol(i));let l=i&&!r&&!a?sl(i,s):Ws(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function yl(e){return qc(e).position===`static`}function bl(e,t){if(!Pc(e)||qc(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return jc(e)===n&&(n=n.ownerDocument.body),n}function xl(e,t){let n=Ac(e);if(Rc(e))return n;if(!Pc(e)){let t=Yc(e);for(;t&&!Kc(t);){if(Nc(t)&&!yl(t))return t;t=Yc(t)}return n}let r=bl(e,t);for(;r&&Lc(r)&&yl(r);)r=bl(r,t);return r&&Kc(r)&&yl(r)&&!Uc(r)?n:r||Wc(e)||n}var Sl=async function(e){let t=this.getOffsetParent||xl,n=this.getDimensions,r=await n(e.floating);return{reference:vl(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Cl(e){return qc(e).direction===`rtl`}var wl={convertOffsetParentRelativeRectToViewportRelativeRect:cl,getDocumentElement:jc,getClippingRect:gl,getOffsetParent:xl,getElementRects:Sl,getClientRects:ll,getDimensions:_l,getScale:tl,isElement:Nc,isRTL:Cl};function Tl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function El(e,t,n){let r=null,i,a=jc(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Us(d),h=Us(a.clientWidth-(u+f)),g=Us(a.clientHeight-(d+p)),_=Us(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Vs(0,Bs(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Tl(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Ac(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Dl(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=el(e),u=i||a?[...l?Zc(l):[],...t?Zc(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?El(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?al(e):null;c&&g();function g(){let t=al(e);h&&!Tl(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ol=wc,kl=Tc,Al=vc,jl=Dc,Ml=xc,Nl=_c,Pl=Ec,Fl=(e,t,n)=>{let r=new Map,i=n??{},a={...wl,...i.platform,_c:r};return gc(e,t,{...i,platform:a})},Il=typeof document<`u`?B.useLayoutEffect:function(){};function Ll(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ll(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ll(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Rl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zl(e,t){let n=Rl(e);return Math.round(t*n)/n}function Bl(e){let t=B.useRef(e);return Il(()=>{t.current=e}),t}function Vl(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=B.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=B.useState(r);Ll(f,r)||p(r);let[m,h]=B.useState(null),[g,_]=B.useState(null),v=B.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=B.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=B.useRef(null),C=B.useRef(null),w=B.useRef(u),T=c!=null,E=Bl(c),D=Bl(i),O=Bl(l),k=B.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Fl(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Ll(w.current,t)&&(w.current=t,Kn.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Il(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=B.useRef(!1);Il(()=>(A.current=!0,()=>{A.current=!1}),[]),Il(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=B.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=B.useMemo(()=>({reference:b,floating:x}),[b,x]),N=B.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=zl(M.floating,u.x),r=zl(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Rl(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return B.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Hl=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Nl({element:r.current,padding:i}).fn(n):r?Nl({element:r,padding:i}).fn(n):{}}}},Ul=(e,t)=>{let n=Ol(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wl=(e,t)=>{let n=kl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gl=(e,t)=>({fn:Pl(e).fn,options:[e,t]}),Kl=(e,t)=>{let n=Al(e);return{name:n.name,fn:n.fn,options:[e,t]}},ql=(e,t)=>{let n=jl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jl=(e,t)=>{let n=Ml(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yl=(e,t)=>{let n=Hl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xl=Object.defineProperty,Zl=B.forwardRef(((e,t)=>Xl(e,`name`,{value:t,configurable:!0}))(function(e,t){let{children:n,width:r=10,height:i=5,...a}=e;return(0,V.jsx)(Yn.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,V.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})},`Arrow`)),Ql=Object.defineProperty,$l=(e,t)=>Ql(e,`name`,{value:t,configurable:!0});function eu(e){let[t,n]=B.useState(void 0);return Mn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}$l(eu,`useSize`);var tu=Object.defineProperty,nu=(e,t)=>tu(e,`name`,{value:t,configurable:!0}),ru=`Popper`,[iu,au]=ln(ru),[ou,su]=iu(ru),cu=nu(e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,V.jsx)(ou,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),lu=`PopperAnchor`,uu=B.forwardRef(nu(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=su(lu,n),o=B.useRef(null),s=a.onAnchorChange,c=f(t,B.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=B.useRef(null);B.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&bu(a.placementState),d=u?.[0],p=u?.[1];return r?null:(0,V.jsx)(Yn.div,{"data-radix-popper-side":d,"data-radix-popper-align":p,...i,ref:c})},`PopperAnchor`)),du=`PopperContent`,[fu,pu]=iu(du),mu=B.forwardRef(nu(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:m=`optimized`,onPlaced:h,...g}=e,_=su(du,n),[v,y]=B.useState(null),b=f(t,y),[x,S]=B.useState(null),C=eu(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(vu),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Vl({strategy:`fixed`,placement:E,whileElementsMounted:nu((...e)=>Dl(...e,{animationFrame:m===`always`}),`whileElementsMounted`),elements:{reference:_.anchor},middleware:[Ul({mainAxis:i+T,alignmentAxis:o}),c&&Wl({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Gl():void 0,...A}),c&&Kl({...A}),ql({...A,apply:nu(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),x&&Yl({element:x,padding:s}),yu({arrowWidth:w,arrowHeight:T}),p&&Jl({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),I=_.setPlacementState;Mn(()=>(I(N),()=>{I(void 0)}),[N,I]);let[L,R]=bu(N),ee=wi(h);Mn(()=>{P&&ee?.()},[P,ee]);let te=F.arrow?.x,ne=F.arrow?.y,re=F.arrow?.centerOffset!==0,[ie,ae]=B.useState();return Mn(()=>{v&&ae(window.getComputedStyle(v).zIndex)},[v]),(0,V.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ie,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(fu,{scope:n,placedSide:L,placedAlign:R,onArrowChange:S,arrowX:te,arrowY:ne,shouldHideArrow:re,children:(0,V.jsx)(Yn.div,{"data-side":L,"data-align":R,...g,ref:b,style:{...g.style,animation:P?g.style?.animation:`none`}})})})},`PopperContent`)),hu=`PopperArrow`,gu={top:`bottom`,right:`left`,bottom:`top`,left:`right`},_u=B.forwardRef(nu(function(e,t){let{__scopePopper:n,...r}=e,i=pu(hu,n),a=gu[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(Zl,{...r,ref:t,style:{...r.style,display:`block`}})})},`PopperArrow`));function vu(e){return e!==null}nu(vu,`isNotNull`);var yu=nu(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=bu(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function bu(e){let[t,n=`center`]=e.split(`-`);return[t,n]}nu(bu,`getSideAndAlignFromPlacement`);var xu=cu,Su=uu,Cu=mu,wu=_u,Tu=Object.defineProperty,Eu=(e,t)=>Tu(e,`name`,{value:t,configurable:!0});function Du(e,[t,n]){return Math.min(n,Math.max(t,e))}Eu(Du,`clamp`);var Ou=Object.defineProperty,ku=(e,t)=>Ou(e,`name`,{value:t,configurable:!0});function Au(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}ku(Au,`useStateMachine`);var ju=`ScrollArea`,[Mu,Nu]=ln(ju),[Pu,Fu]=Mu(ju),Iu=B.forwardRef(ku(function(e,t){let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=B.useState(null),[l,u]=B.useState(null),[d,p]=B.useState(null),[m,h]=B.useState(null),[g,_]=B.useState(null),[v,y]=B.useState(0),[b,x]=B.useState(0),[S,C]=B.useState(!1),[w,T]=B.useState(!1),E=f(t,c),D=jr(i);return(0,V.jsx)(Pu,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:p,scrollbarX:m,onScrollbarXChange:h,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:g,onScrollbarYChange:_,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,V.jsx)(Yn.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":v+`px`,"--radix-scroll-area-corner-height":b+`px`,...e.style}})})},`ScrollArea`)),Lu=`ScrollAreaViewport`,Ru=B.forwardRef(ku(function(e,t){let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=Fu(Lu,n),s=f(t,B.useRef(null),o.onViewportChange);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(zu,{nonce:i}),(0,V.jsx)(Yn.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,V.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})},`ScrollAreaViewport`)),zu=B.memo(ku(function({nonce:e}){return(0,V.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e})},`ScrollAreaViewportStyle`),(e,t)=>e.nonce===t.nonce),Bu=`ScrollAreaScrollbar`,Vu=B.forwardRef(ku(function(e,t){let{forceMount:n,...r}=e,i=Fu(Bu,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return B.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,V.jsx)(Hu,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,V.jsx)(Uu,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,V.jsx)(Wu,{...r,ref:t,forceMount:n}):i.type===`always`?(0,V.jsx)(Gu,{...r,ref:t,"data-state":`visible`}):null},`ScrollAreaScrollbar`)),Hu=B.forwardRef(ku(function(e,t){let{forceMount:n,...r}=e,i=Fu(Bu,e.__scopeScrollArea),[a,o]=B.useState(!1);return B.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=ku(()=>{window.clearTimeout(t),o(!0)},`handlePointerEnter`),r=ku(()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)},`handlePointerLeave`);return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,V.jsx)(er,{present:n||a,children:(0,V.jsx)(Wu,{"data-state":a?`visible`:`hidden`,...r,ref:t})})},`ScrollAreaScrollbarHover`)),Uu=B.forwardRef(ku(function(e,t){let{forceMount:n,...r}=e,i=Fu(Bu,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=dd(()=>c(`SCROLL_END`),100),[s,c]=Au(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return B.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),B.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=ku(()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r},`handleScroll`);return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,V.jsx)(er,{present:n||s!==`hidden`,children:(0,V.jsx)(Gu,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:Dn(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:Dn(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})},`ScrollAreaScrollbarScroll`)),Wu=B.forwardRef(ku(function(e,t){let n=Fu(Bu,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=B.useState(!1),s=e.orientation===`horizontal`,c=dd(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return fd(n.viewport,c),fd(n.content,c),(0,V.jsx)(er,{present:r||a,children:(0,V.jsx)(Gu,{"data-state":a?`visible`:`hidden`,...i,ref:t})})},`ScrollAreaScrollbarAuto`)),Gu=B.forwardRef(ku(function(e,t){let{orientation:n=`vertical`,...r}=e,i=Fu(Bu,e.__scopeScrollArea),a=B.useRef(null),o=B.useRef(0),[s,c]=B.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=id(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:ku(e=>a.current=e,`onThumbChange`),onThumbPointerUp:ku(()=>o.current=0,`onThumbPointerUp`),onThumbPointerDown:ku(e=>o.current=e,`onThumbPointerDown`)};function d(e,t){return od(e,o.current,s,t)}return ku(d,`getScrollPosition`),n===`horizontal`?(0,V.jsx)(Ku,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=sd(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,V.jsx)(qu,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=sd(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null},`ScrollAreaScrollbarVisible`)),Ku=B.forwardRef(ku(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=Fu(Bu,e.__scopeScrollArea),[o,s]=B.useState(),c=B.useRef(null),l=f(t,c,a.onScrollbarXChange);return B.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,V.jsx)(Xu,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":ad(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),ld(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:rd(o.paddingLeft),paddingEnd:rd(o.paddingRight)}})}})},`ScrollAreaScrollbarX`)),qu=B.forwardRef(ku(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=Fu(Bu,e.__scopeScrollArea),[o,s]=B.useState(),c=B.useRef(null),l=f(t,c,a.onScrollbarYChange);return B.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,V.jsx)(Xu,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":ad(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),ld(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:rd(o.paddingTop),paddingEnd:rd(o.paddingBottom)}})}})},`ScrollAreaScrollbarY`)),[Ju,Yu]=Mu(Bu),Xu=B.forwardRef(ku(function(e,t){let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...p}=e,m=Fu(Bu,n),[h,g]=B.useState(null),_=f(t,g),v=B.useRef(null),y=B.useRef(``),b=m.viewport,x=r.content-r.viewport,S=wi(u),C=wi(c),w=dd(d,10);function T(e){if(v.current){let t=e.clientX-v.current.left,n=e.clientY-v.current.top;l({x:t,y:n})}}return ku(T,`handleDragScroll`),B.useEffect(()=>{let e=ku(e=>{let t=e.target;h?.contains(t)&&S(e,x)},`handleWheel`);return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[b,h,x,S]),B.useEffect(C,[r,C]),fd(h,w),fd(m.content,w),(0,V.jsx)(Ju,{scope:n,scrollbar:h,hasThumb:i,onThumbChange:wi(a),onThumbPointerUp:wi(o),onThumbPositionChange:C,onThumbPointerDown:wi(s),children:(0,V.jsx)(Yn.div,{...p,ref:_,style:{position:`absolute`,...p.style},onPointerDown:Dn(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),v.current=h.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,m.viewport&&(m.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:Dn(e.onPointerMove,T),onPointerUp:Dn(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=``),v.current=null})})})},`ScrollAreaScrollbarImpl`)),Zu=`ScrollAreaThumb`,Qu=B.forwardRef(ku(function(e,t){let{forceMount:n,...r}=e,i=Yu(Zu,e.__scopeScrollArea);return(0,V.jsx)(er,{present:n||i.hasThumb,children:(0,V.jsx)($u,{ref:t,...r})})},`ScrollAreaThumb`)),$u=B.forwardRef(ku(function(e,t){let{__scopeScrollArea:n,style:r,...i}=e,a=Fu(Zu,n),o=Yu(Zu,n),{onThumbPositionChange:s}=o,c=f(t,o.onThumbChange),l=B.useRef(void 0),u=dd(()=>{l.current&&=(l.current(),void 0)},100);return B.useEffect(()=>{let e=a.viewport;if(e){let t=ku(()=>{if(u(),!l.current){let t=ud(e,s);l.current=t,s()}},`handleScroll`);return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,V.jsx)(Yn.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:Dn(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:Dn(e.onPointerUp,o.onThumbPointerUp)})},`ScrollAreaThumbImpl`)),ed=`ScrollAreaCorner`,td=B.forwardRef(ku(function(e,t){let n=Fu(ed,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,V.jsx)(nd,{...e,ref:t}):null},`ScrollAreaCorner`)),nd=B.forwardRef(ku(function(e,t){let{__scopeScrollArea:n,...r}=e,i=Fu(ed,n),[a,o]=B.useState(0),[s,c]=B.useState(0),l=!!(a&&s),{onCornerWidthChange:u,onCornerHeightChange:d}=i;return fd(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),fd(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),B.useEffect(()=>()=>{u(0),d(0)},[u,d]),l?(0,V.jsx)(Yn.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null},`ScrollAreaCornerImpl`));function rd(e){return e?parseInt(e,10):0}ku(rd,`toInt`);function id(e,t){let n=e/t;return isNaN(n)?0:n}ku(id,`getThumbRatio`);function ad(e){let t=id(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}ku(ad,`getThumbSize`);function od(e,t,n,r=`ltr`){let i=ad(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return cd([c,l],d)(e)}ku(od,`getScrollPositionFromPointer`);function sd(e,t,n=`ltr`){let r=ad(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=Du(e,n===`ltr`?[0,o]:[o*-1,0]);return cd([0,o],[0,s])(c)}ku(sd,`getThumbOffsetFromScroll`);function cd(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}ku(cd,`linearScale`);function ld(e,t){return e>0&&e<t}ku(ld,`isScrollingWithinScrollbarBounds`);var ud=ku((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return ku((function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)}),`loop`)(),()=>window.cancelAnimationFrame(r)},`addUnlinkedScrollListener`);function dd(e,t){let n=wi(e),r=B.useRef(0);return B.useEffect(()=>()=>window.clearTimeout(r.current),[]),B.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}ku(dd,`useDebounceCallback`);function fd(e,t){let n=wi(t);Mn(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}ku(fd,`useResizeObserver`);var pd=Iu,md=Ru,hd=td;function gd({className:e,children:t,...n}){return(0,V.jsxs)(pd,{"data-slot":`scroll-area`,className:k(`relative`,e),...n,children:[(0,V.jsx)(md,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,V.jsx)(_d,{}),(0,V.jsx)(hd,{})]})}function _d({className:e,orientation:t=`vertical`,...n}){return(0,V.jsx)(Vu,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:k(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,V.jsx)(Qu,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}var vd=Object.defineProperty,yd=(e,t)=>vd(e,`name`,{value:t,configurable:!0}),bd=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),xd=B.forwardRef(yd(function(e,t){return(0,V.jsx)(Yn.span,{...e,ref:t,style:{...bd,...e.style}})},`VisuallyHidden`)),Sd=Object.defineProperty,Cd=(e,t)=>Sd(e,`name`,{value:t,configurable:!0}),wd=`horizontal`,Td=[`horizontal`,`vertical`],Ed=B.forwardRef(Cd(function(e,t){let{decorative:n,orientation:r=wd,...i}=e,a=Dd(r)?r:wd,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,V.jsx)(Yn.div,{"data-orientation":a,...o,...i,ref:t})},`Separator`));function Dd(e){return Td.includes(e)}Cd(Dd,`isValidOrientation`);var Od=Ed;function kd({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,V.jsx)(Od,{"data-slot":`separator`,decorative:n,orientation:t,className:k(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}function Ad({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`skeleton`,className:k(`animate-pulse rounded-md bg-accent`,e),...t})}var jd=Object.defineProperty,Md=(e,t)=>jd(e,`name`,{value:t,configurable:!0}),Nd=!1;function Pd(){let[e,t]=B.useState(Nd);return B.useEffect(()=>{Nd||(Nd=!0,t(!0))},[]),e}Md(Pd,`useIsHydrated`);var Fd=B.useSyncExternalStore;function Id(){return()=>{}}Md(Id,`subscribe`);function Ld(){return Fd(Id,()=>!0,()=>!1)}Md(Ld,`useIsHydratedModern`);var Rd=typeof Fd==`function`?Ld:Pd,zd=Object.defineProperty,Bd=(e,t)=>zd(e,`name`,{value:t,configurable:!0}),Vd=`rovingFocusGroup.onEntryFocus`,Hd={bubbles:!1,cancelable:!0},Ud=`RovingFocusGroup`,[Wd,Gd,Kd]=pn(Ud),[qd,Jd]=ln(Ud,[Kd]),[Yd,Xd]=qd(Ud),Zd=B.forwardRef(Bd(function(e,t){return(0,V.jsx)(Wd.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(Wd.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(Qd,{...e,ref:t})})})},`RovingFocusGroup`)),Qd=B.forwardRef(Bd(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,p=B.useRef(null),m=f(t,p),h=jr(a),[g,_]=Vn({prop:o,defaultProp:s??null,onChange:c,caller:Ud}),[v,y]=B.useState(!1),b=wi(l),x=Gd(n),S=B.useRef(!1),[C,w]=B.useState(0);return B.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(Vd,b),()=>e.removeEventListener(Vd,b)},[b]),(0,V.jsx)(Yd,{scope:n,orientation:r,dir:h,loop:i,currentTabStopId:g,onItemFocus:B.useCallback(e=>_(e),[_]),onItemShiftTab:B.useCallback(()=>y(!0),[]),onFocusableItemAdd:B.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:B.useCallback(()=>w(e=>e-1),[]),children:(0,V.jsx)(Yn.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:`none`,...e.style},onMouseDown:Dn(e.onMouseDown,()=>{S.current=!0}),onFocus:Dn(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(Vd,Hd);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);af([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:Dn(e.onBlur,()=>y(!1))})})},`RovingFocusGroupImpl`)),$d=`RovingFocusGroupItem`,ef=B.forwardRef(Bd(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=ur(),l=a||c,u=Xd($d,n),d=u.currentTabStopId===l,f=Gd(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=Rd();return Mn(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),B.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,V.jsx)(Wd.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(Yn.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Dn(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Dn(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Dn(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=rf(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?of(n,r+1):n.slice(r+1)}setTimeout(()=>af(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),tf={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function nf(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Bd(nf,`getDirectionAwareKey`);function rf(e,t,n){let r=nf(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return tf[r]}Bd(rf,`getFocusIntent`);function af(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Bd(af,`focusFirst`);function of(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Bd(of,`wrapArray`);var sf=Zd,cf=ef,lf=Object.defineProperty,uf=(e,t)=>lf(e,`name`,{value:t,configurable:!0}),df=`Tabs`,[ff,pf]=ln(df,[Jd]),mf=Jd(),[hf,gf]=ff(df),_f=B.forwardRef(uf(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=jr(s),[d,f]=Vn({prop:r,onChange:i,defaultProp:a??``,caller:df});return(0,V.jsx)(hf,{scope:n,baseId:ur(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,V.jsx)(Yn.div,{dir:u,"data-orientation":o,...l,ref:t})})},`Tabs`)),vf=`TabsList`,yf=B.forwardRef(uf(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=gf(vf,n),o=mf(n);return(0,V.jsx)(sf,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,V.jsx)(Yn.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),bf=`TabsTrigger`,xf=B.forwardRef(uf(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=gf(bf,n),s=mf(n),c=wf(o.baseId,r),l=Tf(o.baseId,r),u=r===o.value;return(0,V.jsx)(cf,{asChild:!0,...s,focusable:!i,active:u,children:(0,V.jsx)(Yn.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:Dn(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:Dn(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:Dn(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})},`TabsTrigger`)),Sf=`TabsContent`,Cf=B.forwardRef(uf(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=gf(Sf,n),c=wf(s.baseId,r),l=Tf(s.baseId,r),u=r===s.value,d=B.useRef(u);return B.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,V.jsx)(er,{present:i||u,children:({present:n})=>(0,V.jsx)(Yn.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})},`TabsContent`));function wf(e,t){return`${e}-trigger-${t}`}uf(wf,`makeTriggerId`);function Tf(e,t){return`${e}-content-${t}`}uf(Tf,`makeContentId`);var Ef=_f,Df=yf,Of=xf,kf=Cf;function Af({className:e,orientation:t=`horizontal`,...n}){return(0,V.jsx)(Ef,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:k(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var jf=D(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Mf({className:e,variant:t=`default`,...n}){return(0,V.jsx)(Df,{"data-slot":`tabs-list`,"data-variant":t,className:k(jf({variant:t}),e),...n})}function Nf({className:e,...t}){return(0,V.jsx)(Of,{"data-slot":`tabs-trigger`,className:k(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function Pf({className:e,...t}){return(0,V.jsx)(kf,{"data-slot":`tabs-content`,className:k(`flex-1 outline-none`,e),...t})}var Ff=Object.defineProperty,If=(e,t)=>Ff(e,`name`,{value:t,configurable:!0}),[Lf,Rf]=ln(`Tooltip`,[au]),zf=au(),Bf=`TooltipProvider`,Vf=700,Hf=`tooltip.open`,[Uf,Wf]=Lf(Bf),Gf=If(e=>{let{__scopeTooltip:t,delayDuration:n=Vf,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=B.useRef(!0),s=B.useRef(!1),c=B.useRef(0);return B.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,V.jsx)(Uf,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:B.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:B.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:B.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),Kf=`Tooltip`,[qf,Jf]=Lf(Kf),Yf=If(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Wf(Kf,e.__scopeTooltip),l=zf(t),[u,d]=B.useState(null),[f,p]=B.useState(void 0),m=ur(),h=B.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=B.useRef(!1),[y,b]=Vn({prop:r,defaultProp:i??!1,onChange:If(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Hf))):c.onClose(),a?.(e)},`onChange`),caller:Kf}),x=B.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=B.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=B.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=B.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);B.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let T=f??m;return(0,V.jsx)(xu,{...l,children:(0,V.jsx)(qf,{scope:t,contentId:T,setContentId:p,open:y,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:B.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:B.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})},`Tooltip`),Xf=`TooltipTrigger`,Zf=B.forwardRef(If(function(e,t){let{__scopeTooltip:n,...r}=e,i=Jf(Xf,n),a=Wf(Xf,n),o=zf(n),s=f(t,B.useRef(null),i.onTriggerChange),c=B.useRef(!1),l=B.useRef(!1),u=B.useCallback(()=>c.current=!1,[]);return B.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,V.jsx)(Su,{asChild:!0,...o,children:(0,V.jsx)(Yn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Dn(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Dn(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Dn(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Dn(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Dn(e.onBlur,i.onClose),onClick:Dn(e.onClick,i.onClose)})})},`TooltipTrigger`)),Qf=`TooltipPortal`,[$f,ep]=Lf(Qf,{forceMount:void 0}),tp=If(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Jf(Qf,t);return(0,V.jsx)($f,{scope:t,forceMount:n,children:(0,V.jsx)(er,{present:n||a.open,children:(0,V.jsx)(Ta,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),np=`TooltipContent`,rp=B.forwardRef(If(function(e,t){let n=ep(np,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Jf(np,e.__scopeTooltip);return(0,V.jsx)(er,{present:r||o.open,children:o.disableHoverableContent?(0,V.jsx)(op,{side:i,...a,ref:t}):(0,V.jsx)(ip,{side:i,...a,ref:t})})},`TooltipContent`)),ip=B.forwardRef(If(function(e,t){let n=Jf(np,e.__scopeTooltip),r=Wf(np,e.__scopeTooltip),i=B.useRef(null),a=f(t,i),[o,s]=B.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,p=B.useCallback(()=>{s(null),d(!1)},[d]),m=B.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=lp(r,cp(r,n.getBoundingClientRect())),a=up(t.getBoundingClientRect()),o=fp([...i,...a]);s(o),d(!0)},[d]);return B.useEffect(()=>()=>p(),[p]),B.useEffect(()=>{if(c&&u){let e=If(e=>m(e,u),`handleTriggerLeave`),t=If(e=>m(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,m,p]),B.useEffect(()=>{if(o){let e=If(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!dp(n,o);r?p():i&&(p(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,p]),(0,V.jsx)(op,{...e,ref:a})},`TooltipContentHoverable`)),ap=Se(`TooltipContent`),op=B.forwardRef(If(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=Jf(np,n),u=zf(n),{onClose:d}=l;B.useEffect(()=>(document.addEventListener(Hf,d),()=>document.removeEventListener(Hf,d)),[d]),B.useEffect(()=>{if(l.trigger){let e=If(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:f}=l;return Mn(()=>(f(a),()=>{f(void 0)}),[a,f]),(0,V.jsx)(ea,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,V.jsxs)(Cu,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,V.jsx)(ap,{children:r}),i?(0,V.jsx)(xd,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`)),sp=B.forwardRef(If(function(e,t){let{__scopeTooltip:n,...r}=e,i=zf(n);return(0,V.jsx)(wu,{...i,...r,ref:t})},`TooltipArrow`));function cp(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}If(cp,`getExitSideFromRect`);function lp(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}If(lp,`getPaddedExitPoints`);function up(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}If(up,`getPointsFromRect`);function dp(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}If(dp,`isPointInPolygon`);function fp(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),pp(t)}If(fp,`getHull`);function pp(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}If(pp,`getHullPresorted`);var mp=Gf,hp=Yf,gp=Zf,_p=tp,vp=rp,yp=sp;function bp({delayDuration:e=0,...t}){return(0,V.jsx)(mp,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function xp({...e}){return(0,V.jsx)(hp,{"data-slot":`tooltip`,...e})}function Sp({...e}){return(0,V.jsx)(gp,{"data-slot":`tooltip-trigger`,...e})}function Cp({className:e,sideOffset:t=0,children:n,...r}){return(0,V.jsx)(_p,{children:(0,V.jsxs)(vp,{"data-slot":`tooltip-content`,sideOffset:t,className:k(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,V.jsx)(yp,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}var wp={completed:`Completed`,failed:`Failed`,running:`Running`,stopped:`Stopped`};function Tp({state:e}){let t=Object.hasOwn(wp,e)?e:`unknown`;return(0,V.jsxs)(T,{className:k(`gap-1.5 uppercase tracking-[.03em]`,{"border-destructive bg-destructive-surface text-destructive":t===`failed`,"border-info bg-info-surface text-info":t===`running`,"border-success bg-success-surface text-success":t===`completed`,"border-warning bg-warning-surface text-warning":t===`stopped`}),variant:`outline`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:k(`size-1.5 rounded-full bg-current`,t===`running`&&`animate-pulse`)}),wp[e]??e]})}var Ep=`tool_result`;function Dp(...e){for(let t of e)if(t!=null)return t;return null}function Op(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n?.call&&!n.result)return n}}function kp({call:e,result:t}){let n=e??t,r=n?.kind??Ep;return{eventIndices:[e?.index,t?.index].filter(e=>e!==void 0),durationMs:Dp(e?.durationMs,t?.durationMs),finishedAt:Dp(e?.finishedAt,t?.finishedAt),id:`tool-${n?.index??0}`,input:e?.input??t?.input,kind:r,name:Dp(e?.name,t?.name)??r,output:Dp(t?.output,e?.output),startedAt:Dp(e?.startedAt,t?.startedAt),status:Dp(e?.status,t?.status),timingSource:Dp(e?.timingSource,t?.timingSource),toolCallId:Dp(e?.toolCallId,t?.toolCallId)}}function Ap(e){let t=[],n=new Map;for(let r of e){if(r.kind===Ep){let e=r.toolCallId?n.get(r.toolCallId):Op(t);if(e&&!e.result){e.result=r,e.call?.toolCallId&&n.delete(e.call.toolCallId);continue}t.push({call:null,result:r});continue}let e={call:r,result:null};t.push(e),r.toolCallId&&n.set(r.toolCallId,e)}return t.map(kp)}var jp=[{id:`turns`,label:`Turns`},{id:`phases`,label:`Phases`},{id:`tools`,label:`Tools`}];function Mp(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function Np(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0}function Pp(e){let t=[],n=[];for(let r of e.turns){let e=Mp(r.startedAt)??Mp(r.timestamp);if(e===null)continue;let i=Np(r.durationMs),a=Mp(r.finishedAt);t.push({...i===void 0?a===null?{}:{end:a}:{duration:i},turnId:r.id,id:r.id,kind:`turn`,label:`${r.harness} turn`,laneId:`turns`,payload:{turn:r,type:`turn`},start:e,status:r.status});let o=[[`model`,r.modelMs],[`tools`,r.toolMs]],s=e;for(let[e,n]of o){let i=Np(n);i!==void 0&&(t.push({duration:i,id:`${r.id}-phase-${e}`,kind:`${e} phase`,label:`${e===`model`?`Model`:`Tool`} time`,laneId:`phases`,parent:r.id,payload:{turn:r,type:`phase`},start:s,status:r.status}),s+=i)}let c=Np(r.timeToFirstTokenMs);c!==void 0&&n.push({at:e+c,id:`${r.id}-first-token`,label:`First token`,payload:{turn:r,type:`milestone`},status:r.status});for(let n of Ap(r.tools)){let i=Mp(n.startedAt)??e,a=Np(n.durationMs),o=Mp(n.finishedAt);t.push({...a===void 0?o===null?{}:{end:o}:{duration:a},turnId:r.id,...n.toolCallId===null?{}:{toolCallId:n.toolCallId},eventIndex:Number(n.id.slice(5)),id:`${r.id}-${n.id}`,kind:n.kind,label:n.name,laneId:`tools`,parent:r.id,payload:{turn:r,type:`tool`},start:i,status:n.status})}}let r=Mp(e.startedAt);return{items:t,lanes:jp.filter(e=>t.some(t=>t.laneId===e.id)),markers:n,...r===null?{}:{origin:r}}}function Fp({cursor:e,focus:t,expanded:n,onExpandedChange:r,onSelectTurn:i,selectedTurnId:a,turns:o}){let[s,c]=(0,B.useState)(!1),l=n??s,u=Pp({turns:o}),d=o.find(e=>e.id===t?.turnId),f=d&&t?Ap(d.tools).find(e=>t.toolCallId===void 0?t.eventIndex!==void 0&&e.eventIndices.includes(t.eventIndex):e.toolCallId===t.toolCallId):void 0,p=t?u.items.find(e=>e.turnId===t.turnId&&e.id===(f?`${t.turnId}-${f.id}`:t.turnId)):void 0;return(0,V.jsx)(an,{...e===void 0?{}:{cursor:e},expanded:t?!0:l,onExpandedChange:e=>{n===void 0&&c(e),r?.(e)},getFailureExcerpt:e=>e.payload.turn.failureKind,items:u.items,label:`Conversation timeline`,lanes:u.lanes,markers:u.markers,onSelect:e=>i(e.payload.turn.id),...p?{selectedId:p.id}:a?{selectedId:a}:{}})}function Ip(e){let t=(0,B.useRef)(null),n=(0,B.useRef)(new Map),[r,i]=(0,B.useState)(),a=(0,B.useRef)(new Map);a.current=new Map(e.map(e=>[e.id,e.time]));let o=(0,B.useCallback)(()=>{let r=t.current;if(!r)return;let a=r.getBoundingClientRect().top+Math.min(r.clientHeight*.25,160),o=e.map(e=>({element:n.current.get(e.id),...e})).filter(e=>!!e.element);if(o.length===0)return;let s=o[0];if(!s)return;let c=s;for(let e of o)if(e.element.getBoundingClientRect().top<=a)c=e;else break;i(c.time)},[e]),s=(0,B.useCallback)(e=>{t.current?.removeEventListener(`scroll`,o),t.current=e,e?.addEventListener(`scroll`,o,{passive:!0}),o()},[o]);return(0,B.useEffect)(()=>{o();let e=t.current;return()=>e?.removeEventListener(`scroll`,o)},[o]),{containerRef:s,cursor:r,register:(0,B.useCallback)((e,t)=>{t?n.current.set(e,t):n.current.delete(e)},[]),scrollTo:(0,B.useCallback)(e=>{n.current.get(e)?.scrollIntoView({behavior:`smooth`,block:`start`});let t=a.current.get(e);t!==void 0&&i(t)},[])}}function Lp({className:e,from:t,...n}){return(0,V.jsx)(`div`,{className:k(t===`user`?`flex justify-end`:`grid grid-cols-[2rem_minmax(0,1fr)] items-start gap-3.5`,e),"data-message-author":t,...n})}function Rp({className:e,...t}){return(0,V.jsx)(`div`,{className:k(`min-w-0`,e),...t})}function zp({children:e,src:t}){return(0,V.jsxs)(Bi,{"aria-hidden":`true`,className:`size-8 rounded-[9px]`,children:[t?(0,V.jsx)(Hi,{alt:``,src:t}):null,(0,V.jsx)(Vi,{className:`bg-primary text-[9px] font-extrabold text-primary-foreground`,children:e})]})}var Bp=/"(?:[^"\\]|\\.)*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null/g;function Vp(e){try{return JSON.parse(e)}catch{return}}function Hp(e,t=2){try{return JSON.stringify(e,null,t)??String(e)}catch{return String(e)}}function Up(e){return Hp(e,0)}function Wp(e,t){return e.startsWith(`"`)?t?`hljs-attr`:`hljs-string`:e===`true`||e===`false`||e===`null`?`hljs-literal`:`hljs-number`}function Gp(e){let t=[],n=0;for(let r of e.matchAll(Bp)){let i=r[0],a=r.index;a>n&&t.push(e.slice(n,a)),n=a+i.length;let o=/^\s*:/.test(e.slice(n));t.push((0,V.jsx)(`span`,{className:Wp(i,o),children:i},`${a}-${i.length}`))}return n<e.length&&t.push(e.slice(n)),t}function Kp({className:e,label:t,value:n}){return(0,V.jsx)(`pre`,{"aria-label":t,className:k(`message-json`,e),children:(0,V.jsx)(`code`,{children:Gp(Hp(n))})})}function qp(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Jp=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Yp=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xp={};function Zp(e,t){return((t||Xp).jsx?Yp:Jp).test(e)}var Qp=/[ \t\n\f\r]/g;function $p(e){return typeof e==`object`?e.type===`text`&&em(e.value):em(e)}function em(e){return e.replace(Qp,``)===``}var tm=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};tm.prototype.normal={},tm.prototype.property={},tm.prototype.space=void 0;function nm(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new tm(n,r,t)}function rm(e){return e.toLowerCase()}var im=class{constructor(e,t){this.attribute=t,this.property=e}};im.prototype.attribute=``,im.prototype.booleanish=!1,im.prototype.boolean=!1,im.prototype.commaOrSpaceSeparated=!1,im.prototype.commaSeparated=!1,im.prototype.defined=!1,im.prototype.mustUseProperty=!1,im.prototype.number=!1,im.prototype.overloadedBoolean=!1,im.prototype.property=``,im.prototype.spaceSeparated=!1,im.prototype.space=void 0;var am=w({boolean:()=>sm,booleanish:()=>cm,commaOrSpaceSeparated:()=>fm,commaSeparated:()=>dm,number:()=>H,overloadedBoolean:()=>lm,spaceSeparated:()=>um}),om=0,sm=pm(),cm=pm(),lm=pm(),H=pm(),um=pm(),dm=pm(),fm=pm();function pm(){return 2**++om}var mm=Object.keys(am),hm=class extends im{constructor(e,t,n,r){let i=-1;if(super(e,t),gm(this,`space`,r),typeof n==`number`)for(;++i<mm.length;){let e=mm[i];gm(this,mm[i],(n&am[e])===am[e])}}};hm.prototype.defined=!0;function gm(e,t,n){n&&(e[t]=n)}function _m(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new hm(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[rm(r)]=r,n[rm(a.attribute)]=r}return new tm(t,n,e.space)}var vm=_m({properties:{ariaActiveDescendant:null,ariaAtomic:cm,ariaAutoComplete:null,ariaBusy:cm,ariaChecked:cm,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:um,ariaCurrent:null,ariaDescribedBy:um,ariaDetails:null,ariaDisabled:cm,ariaDropEffect:um,ariaErrorMessage:null,ariaExpanded:cm,ariaFlowTo:um,ariaGrabbed:cm,ariaHasPopup:null,ariaHidden:cm,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:um,ariaLevel:H,ariaLive:null,ariaModal:cm,ariaMultiLine:cm,ariaMultiSelectable:cm,ariaOrientation:null,ariaOwns:um,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:cm,ariaReadOnly:cm,ariaRelevant:null,ariaRequired:cm,ariaRoleDescription:um,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:cm,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function ym(e,t){return t in e?e[t]:t}function bm(e,t){return ym(e,t.toLowerCase())}var xm=_m({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:dm,acceptCharset:um,accessKey:um,action:null,allow:null,allowFullScreen:sm,allowPaymentRequest:sm,allowUserMedia:sm,alpha:sm,alt:null,as:null,async:sm,autoCapitalize:null,autoComplete:um,autoFocus:sm,autoPlay:sm,blocking:um,capture:null,charSet:null,checked:sm,cite:null,className:um,closedBy:null,colorSpace:null,cols:H,colSpan:H,command:null,commandFor:null,content:null,contentEditable:cm,controls:sm,controlsList:um,coords:H|dm,crossOrigin:null,data:null,dateTime:null,decoding:null,default:sm,defer:sm,dir:null,dirName:null,disabled:sm,download:lm,draggable:cm,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:sm,formTarget:null,headers:um,height:H,hidden:lm,high:H,href:null,hrefLang:null,htmlFor:um,httpEquiv:um,id:null,imageSizes:null,imageSrcSet:null,inert:sm,inputMode:null,integrity:null,is:null,isMap:sm,itemId:null,itemProp:um,itemRef:um,itemScope:sm,itemType:um,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:sm,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:sm,muted:sm,name:null,nonce:null,noModule:sm,noValidate:sm,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:sm,optimum:H,pattern:null,ping:um,placeholder:null,playsInline:sm,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:sm,referrerPolicy:null,rel:um,required:sm,reversed:sm,rows:H,rowSpan:H,sandbox:um,scope:null,scoped:sm,seamless:sm,selected:sm,shadowRootClonable:sm,shadowRootCustomElementRegistry:sm,shadowRootDelegatesFocus:sm,shadowRootMode:null,shadowRootSerializable:sm,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:cm,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:sm,useMap:null,value:cm,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:um,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:sm,declare:sm,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:sm,noHref:sm,noShade:sm,noWrap:sm,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:cm,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:sm,disablePictureInPicture:sm,disableRemotePlayback:sm,exportParts:dm,part:um,prefix:null,property:null,results:H,security:null,unselectable:null},space:`html`,transform:bm}),Sm=_m({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:fm,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:um,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:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:sm,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,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:dm,g2:dm,glyphName:dm,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:fm,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,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:H,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:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:um,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fm,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fm,rev:fm,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fm,requiredFeatures:fm,requiredFonts:fm,requiredFormats:fm,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:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:fm,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:fm,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:fm,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:ym}),Cm=_m({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()}}),wm=_m({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:bm}),Tm=_m({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Em={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`},Dm=/[A-Z]/g,Om=/-[a-z]/g,km=/^data[-\w.:]+$/i;function Am(e,t){let n=rm(t),r=t,i=im;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&km.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Om,Mm);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Om.test(e)){let n=e.replace(Dm,jm);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=hm}return new i(r,t)}function jm(e){return`-`+e.toLowerCase()}function Mm(e){return e.charAt(1).toUpperCase()}var Nm=nm([vm,xm,Cm,wm,Tm],`html`),Pm=nm([vm,Sm,Cm,wm,Tm],`svg`);function Fm(e){return e.join(` `).trim()}var Im=Ne(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
42
+ `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(!(e.charAt(0)!=`/`||e.charAt(1)!=`*`)){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Lm=Ne((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Im());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Rm=Ne((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),zm=Ne(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Lm()),r=Rm();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Bm=Hm(`end`),Vm=Hm(`start`);function Hm(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 Um(e){let t=Vm(e),n=Bm(e);if(t&&n)return{start:t,end:n}}function Wm(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Km(e.position):`start`in e||`end`in e?Km(e):`line`in e||`column`in e?Gm(e):``}function Gm(e){return qm(e&&e.line)+`:`+qm(e&&e.column)}function Km(e){return Gm(e&&e.start)+`-`+Gm(e&&e.end)}function qm(e){return e&&typeof e==`number`?e:1}var Jm=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&&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=Wm(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}};Jm.prototype.file=``,Jm.prototype.name=``,Jm.prototype.reason=``,Jm.prototype.message=``,Jm.prototype.stack=``,Jm.prototype.column=void 0,Jm.prototype.line=void 0,Jm.prototype.ancestors=void 0,Jm.prototype.cause=void 0,Jm.prototype.fatal=void 0,Jm.prototype.place=void 0,Jm.prototype.ruleId=void 0,Jm.prototype.source=void 0;var Ym=s(zm(),1),Xm={}.hasOwnProperty,Zm=new Map,Qm=/[A-Z]/g,$m=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),eh=new Set([`td`,`th`]);function th(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=fh(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=dh(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`?Pm:Nm,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=nh(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function nh(e,t,n){if(t.type===`element`)return rh(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ih(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return oh(e,t,n);if(t.type===`mdxjsEsm`)return ah(e,t);if(t.type===`root`)return sh(e,t,n);if(t.type===`text`)return ch(e,t)}function rh(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Pm,e.schema=i),e.ancestors.push(t);let a=vh(e,t.tagName,!1),o=ph(e,t),s=hh(e,t);return $m.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!$p(e)})),lh(e,o,a,t),uh(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ih(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)}yh(e,t.position)}function ah(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);yh(e,t.position)}function oh(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Pm,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:vh(e,t.name,!0),o=mh(e,t),s=hh(e,t);return lh(e,o,a,t),uh(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function sh(e,t,n){let r={};return uh(r,hh(e,t)),e.create(t,e.Fragment,r,n)}function ch(e,t){return t.value}function lh(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function uh(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function dh(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 fh(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Vm(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 ph(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Xm.call(t.properties,i)){let a=gh(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&eh.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 mh(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 yh(e,t.position);else{let i=r.name,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 yh(e,t.position);else a=r.value===null||r.value;n[i]=a}return n}function hh(e,t){let n=[],r=-1,i=e.passKeys?new Map:Zm;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=nh(e,a,o);s!==void 0&&n.push(s)}return n}function gh(e,t,n){let r=Am(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?qp(n):Fm(n)),r.property===`style`){let t=typeof n==`object`?n:_h(e,String(n));return e.stylePropertyNameCase===`css`&&(t=bh(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Em[r.property]||r.property:r.attribute,n]}}function _h(e,t){try{return(0,Ym.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Jm("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=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function vh(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=Zp(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=Zp(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Xm.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);yh(e)}function yh(e,t){let n=new Jm("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=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function bh(e){let t={},n;for(n in e)Xm.call(e,n)&&(t[xh(n)]=e[n]);return t}function xh(e){let t=e.replace(Qm,Sh);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Sh(e){return`-`+e.toLowerCase()}var Ch={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`]},wh={};function Th(e,t){let n=t||wh;return Eh(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function Eh(e,t,n){if(Oh(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 Dh(e.children,t,n)}return Array.isArray(e)?Dh(e,t,n):``}function Dh(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Eh(e[i],t,n);return r.join(``)}function Oh(e){return!!(e&&typeof e==`object`)}var kh=document.createElement(`i`);function Ah(e){let t=`&`+e+`;`;kh.innerHTML=t;let n=kh.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function jh(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 Mh(e,t){return e.length>0?(jh(e,e.length,0,t),e):t}var Nh={}.hasOwnProperty;function Ph(e){let t={},n=-1;for(;++n<e.length;)Fh(t,e[n]);return t}function Fh(e,t){let n;for(n in t){let r=(Nh.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Nh.call(r,a)||(r[a]=[]);let e=i[a];Ih(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Ih(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);jh(e,0,0,r)}function Lh(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 Rh(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var zh=Xh(/[A-Za-z]/),Bh=Xh(/[\dA-Za-z]/),Vh=Xh(/[#-'*+\--9=?A-Z^-~]/);function Hh(e){return e!==null&&(e<32||e===127)}var Uh=Xh(/\d/),Wh=Xh(/[\dA-Fa-f]/),Gh=Xh(/[!-/:-@[-`{-~]/);function U(e){return e!==null&&e<-2}function Kh(e){return e!==null&&(e<0||e===32)}function qh(e){return e===-2||e===-1||e===32}var Jh=Xh(/\p{P}|\p{S}/u),Yh=Xh(/\s/);function Xh(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Zh(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Bh(e.charCodeAt(n+1))&&Bh(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 Qh(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return qh(r)?(e.enter(n),s(r)):t(r)}function s(r){return qh(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var $h={tokenize:eg};function eg(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Qh(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);return}return U(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var tg={tokenize:rg},ng={tokenize:ig};function rg(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++;return jh(t.events,a+1,0,t.events.slice(n)),t.events.length=s,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(ng,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(ng,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);return}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);return}return U(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++;jh(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}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 ig(e,t,n){return Qh(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function ag(e){if(e===null||Kh(e)||Yh(e))return 1;if(Jh(e))return 2}function og(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 sg={name:`attention`,resolveAll:cg,tokenize:lg};function cg(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};ug(d,-c),ug(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Mh(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Mh(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Mh(l,og(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Mh(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Mh(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,jh(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function lg(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ag(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=ag(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function ug(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var dg={name:`autolink`,tokenize:fg};function fg(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 zh(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Bh(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||Bh(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||Hh(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Vh(t)?(e.consume(t),l):n(t)}function u(e){return Bh(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||Bh(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var pg={partial:!0,tokenize:mg};function mg(e,t,n){return r;function r(t){return qh(t)?Qh(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||U(e)?t(e):n(e)}}var hg={continuation:{tokenize:_g},exit:vg,name:`blockQuote`,tokenize:gg};function gg(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 qh(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function _g(e,t,n){let r=this;return i;function i(t){return qh(t)?Qh(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(hg,t,n)(r)}}function vg(e){e.exit(`blockQuote`)}var yg={name:`characterEscape`,tokenize:bg};function bg(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 Gh(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var xg={name:`characterReference`,tokenize:Sg};function Sg(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=Bh,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=Wh,u):(e.enter(`characterReferenceValue`),a=7,o=Uh,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Bh&&!Ah(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 Cg={partial:!0,tokenize:Eg},wg={concrete:!0,name:`codeFenced`,tokenize:Tg};function Tg(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`),qh(t)?Qh(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||U(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Cg,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||U(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):qh(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Qh(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||U(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||U(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&&qh(t)?Qh(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||U(t)?e.check(Cg,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||U(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`),qh(t)?Qh(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`),qh(t)?Qh(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||U(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Eg(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 Dg={name:`codeIndented`,tokenize:kg},Og={partial:!0,tokenize:Ag};function kg(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Qh(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):U(t)?e.attempt(Og,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||U(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Ag(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Qh(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):U(e)?i(e):n(e)}}var jg={name:`codeText`,previous:Ng,resolve:Mg,tokenize:Pg};function Mg(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 Ng(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Pg(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)):U(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||U(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 Fg=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&&Ig(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),Ig(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Ig(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);Ig(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Ig(this.left,t.reverse())}}};function Ig(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 Lg(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Fg(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,Rg(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 jh(e,0,1/0,u.slice(0)),!l}function Rg(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 zg={resolve:Vg,tokenize:Hg},Bg={partial:!0,tokenize:Ug};function Vg(e){return Lg(e),e}function Hg(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):U(t)?e.check(Bg,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 Ug(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Qh(e,a,`linePrefix`)}function a(i){if(i===null||U(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 Wg(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||Hh(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||U(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||Kh(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||Hh(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 Gg(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):U(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||U(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!qh(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Kg(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):U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Qh(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||U(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 qg(e,t){let n;return r;function r(i){return U(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):qh(i)?Qh(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Jg={name:`definition`,tokenize:Xg},Yg={partial:!0,tokenize:Zg};function Xg(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Gg.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Rh(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 Kh(t)?qg(e,l)(t):l(t)}function l(t){return Wg(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Yg,d,d)(t)}function d(t){return qh(t)?Qh(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||U(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Zg(e,t,n){return r;function r(t){return Kh(t)?qg(e,i)(t):n(t)}function i(t){return Kg(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return qh(t)?Qh(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||U(e)?t(e):n(e)}}var Qg={name:`hardBreakEscape`,tokenize:$g};function $g(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return U(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var e_={name:`headingAtx`,resolve:t_,tokenize:n_};function t_(e,t){let n=e.length-2,r=3,i,a;return 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&&(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`},jh(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function n_(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||Kh(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||U(n)?(e.exit(`atxHeading`),t(n)):qh(n)?Qh(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||Kh(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var r_=`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(`.`),i_=[`pre`,`script`,`style`,`textarea`],a_={concrete:!0,name:`htmlFlow`,resolveTo:c_,tokenize:l_},o_={partial:!0,tokenize:d_},s_={partial:!0,tokenize:u_};function c_(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 l_(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:I):zh(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):zh(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):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 zh(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Kh(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&i_.includes(l)?(i=1,r.interrupt?t(s):O(s)):r_.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||Bh(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 qh(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||zh(t)?(e.consume(t),b):qh(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Bh(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):qh(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):qh(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||U(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||Kh(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||qh(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||U(t)?O(t):qh(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):U(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(o_,R,k)(t)):t===null||U(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(s_,A,R)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||U(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return i_.includes(n)?(e.consume(t),L):O(t)}return zh(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||U(t)?(e.exit(`htmlFlowData`),R(t)):(e.consume(t),L)}function R(n){return e.exit(`htmlFlow`),t(n)}}function u_(e,t,n){let r=this;return i;function i(t){return U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function d_(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(pg,t,n)}}var f_={name:`htmlText`,tokenize:p_};function p_(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):zh(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):zh(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):U(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(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):U(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):U(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):U(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return zh(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Bh(t)?(e.consume(t),S):C(t)}function C(t){return U(t)?(o=C,N(t)):qh(t)?(e.consume(t),C):M(t)}function w(t){return t===45||Bh(t)?(e.consume(t),w):t===47||t===62||Kh(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||zh(t)?(e.consume(t),E):U(t)?(o=T,N(t)):qh(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||Bh(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):U(t)?(o=D,N(t)):qh(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):U(t)?(o=O,N(t)):qh(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):U(t)?(o=k,N(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||Kh(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Kh(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return qh(t)?Qh(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var m_={name:`labelEnd`,resolveAll:v_,resolveTo:y_,tokenize:b_},h_={tokenize:x_},g_={tokenize:S_},__={tokenize:C_};function v_(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&&jh(e,0,e.length,n),e}function y_(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Mh(s,e.slice(a+1,a+r+3)),s=Mh(s,[[`enter`,u,t]]),s=Mh(s,og(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Mh(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Mh(s,e.slice(o+1)),s=Mh(s,[[`exit`,c,t]]),jh(e,a,e.length,s),e}function b_(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Rh(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(h_,u,o?u:d)(t):t===91?e.attempt(g_,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(__,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function x_(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 Kh(t)?qg(e,a)(t):a(t)}function a(t){return t===41?u(t):Wg(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Kh(t)?qg(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Kg(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Kh(t)?qg(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 S_(e,t,n){let r=this;return i;function i(t){return Gg.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Rh(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function C_(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 w_={name:`labelStartImage`,resolveAll:m_.resolveAll,tokenize:T_};function T_(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var E_={name:`labelStartLink`,resolveAll:m_.resolveAll,tokenize:D_};function D_(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var O_={name:`lineEnding`,tokenize:k_};function k_(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Qh(e,t,`linePrefix`)}}var A_={name:`thematicBreak`,tokenize:j_};function j_(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||U(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),qh(t)?Qh(e,s,`whitespace`)(t):s(t))}}var M_={continuation:{tokenize:I_},exit:R_,name:`list`,tokenize:F_},N_={partial:!0,tokenize:z_},P_={partial:!0,tokenize:L_};function F_(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:Uh(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(A_,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 Uh(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(pg,r.interrupt?n:u,e.attempt(N_,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return qh(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 I_(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(pg,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Qh(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!qh(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(P_,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Qh(e,e.attempt(M_,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function L_(e,t,n){let r=this;return Qh(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 R_(e){e.exit(this.containerState.type)}function z_(e,t,n){let r=this;return Qh(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!qh(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var B_={name:`setextUnderline`,resolveTo:V_,tokenize:H_};function V_(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function H_(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`),qh(t)?Qh(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||U(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var U_={tokenize:W_};function W_(e){let t=this,n=e.attempt(pg,r,e.attempt(this.parser.constructs.flowInitial,i,Qh(e,e.attempt(this.parser.constructs.flow,i,e.attempt(zg,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var G_={resolveAll:Y_()},K_=J_(`string`),q_=J_(`text`);function J_(e){return{resolveAll:Y_(e===`text`?X_: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);return}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 Y_(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 X_(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Z_=w({attentionMarkers:()=>av,contentInitial:()=>$_,disable:()=>ov,document:()=>Q_,flow:()=>tv,flowInitial:()=>ev,insideSpan:()=>iv,string:()=>nv,text:()=>rv}),Q_={42:M_,43:M_,45:M_,48:M_,49:M_,50:M_,51:M_,52:M_,53:M_,54:M_,55:M_,56:M_,57:M_,62:hg},$_={91:Jg},ev={[-2]:Dg,[-1]:Dg,32:Dg},tv={35:e_,42:A_,45:[B_,A_],60:a_,61:B_,95:A_,96:wg,126:wg},nv={38:xg,92:yg},rv={[-5]:O_,[-4]:O_,[-3]:O_,33:w_,38:xg,42:sg,60:[dg,f_],91:E_,92:[Qg,yg],93:m_,95:sg,96:jg},iv={null:[sg,G_]},av={null:[42,95]},ov={null:[]};function sv(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=Mh(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=og(a,l.events,l),l.events):[]}function f(e,t){return lv(p(e),t)}function p(e){return cv(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(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){U(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&&jh(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 cv(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 lv(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=`
43
+ `;break;case-3:o=`\r
44
+ `;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 uv(e){let t={constructs:Ph([Z_,...(e||{}).extensions||[]]),content:n($h),defined:[],document:n(tg),flow:n(U_),lazy:{},string:n(K_),text:n(q_)};return t;function n(e){return n;function n(n){return sv(t,e,n)}}}function dv(e){for(;!Lg(e););return e}var fv=/[\0\t\n\r]/g;function pv(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(fv.lastIndex=u,c=fv.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var mv=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function hv(e){return e.replace(mv,gv)}function gv(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Lh(n.slice(t?2:1),t?16:10)}return Ah(n)||e}var _v={}.hasOwnProperty;function vv(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),yv(n)(dv(uv(n).document().write(pv()(e,t,!0))))}function yv(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ge),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(fe),blockQuote:a(se),characterEscape:T,characterReference:T,codeFenced:a(ce),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ce,o),codeText:a(le,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ue),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(de),hardBreakEscape:a(pe),hardBreakTrailing:a(pe),htmlFlow:a(me,o),htmlFlowData:T,htmlText:a(me,o),htmlTextData:T,image:a(he),label:o,link:a(ge),listItem:a(ve),listItemValue:f,listOrdered:a(_e,d),listUnordered:a(_e),paragraph:a(ye),reference:ee,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(fe),strong:a(be),thematicBreak:a(Se)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:oe,autolinkProtocol:ae,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ne,characterReferenceMarkerNumeric:ne,characterReferenceValue:re,characterReference:ie,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:te,resourceDestinationString:I,resourceTitleString:L,resource:R,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};xv(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];_v.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Cv).call(a,void 0,e[0])}for(r.position={start:bv(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:bv(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;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 i=r;for(s=void 0;i--;){let t=e[i];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=i}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),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(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:bv(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Cv).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Wm({start:e.start,end:e.end})+`): it’s not open`);n.position.end=bv(e.end)}function u(){return Th(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(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 p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){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 _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Rh(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=xe(),n.position={start:bv(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=bv(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=bv(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){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=hv(t),n.identifier=Rh(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 I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function R(){this.data.inReference=void 0}function ee(){this.data.referenceType=`collapsed`}function te(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Rh(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ne(e){this.data.characterReferenceType=e.type}function re(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Lh(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Ah(t);let i=this.stack[this.stack.length-1];i.value+=r}function ie(e){let t=this.stack.pop();t.position.end=bv(e.end)}function ae(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function oe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function se(){return{type:`blockquote`,children:[]}}function ce(){return{type:`code`,lang:null,meta:null,value:``}}function le(){return{type:`inlineCode`,value:``}}function ue(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function de(){return{type:`emphasis`,children:[]}}function fe(){return{type:`heading`,depth:0,children:[]}}function pe(){return{type:`break`}}function me(){return{type:`html`,value:``}}function he(){return{type:`image`,title:null,url:``,alt:null}}function ge(){return{type:`link`,title:null,url:``,children:[]}}function _e(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function ve(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function ye(){return{type:`paragraph`,children:[]}}function be(){return{type:`strong`,children:[]}}function xe(){return{type:`text`,value:``}}function Se(){return{type:`thematicBreak`}}}function bv(e){return{line:e.line,column:e.column,offset:e.offset}}function xv(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?xv(e,r):Sv(e,r)}}function Sv(e,t){let n;for(n in t)if(_v.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`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Cv(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Wm({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wm({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Wm({start:t.start,end:t.end})+`) is still open`)}function wv(e){let t=this;t.parser=n;function n(n){return vv(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Tv(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 Ev(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
45
+ `}]}function Dv(e,t){let n=t.value?t.value+`
46
+ `:``,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 Ov(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kv(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Av(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Zh(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 jv(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 Mv(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Nv(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 Pv(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Nv(e,t);let i={src:Zh(r.url||``),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 Fv(e,t){let n={src:Zh(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 Iv(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 Lv(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Nv(e,t);let i={href:Zh(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 Rv(e,t){let n={href:Zh(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 zv(e,t,n){let r=e.all(t),i=n?Bv(n):Vv(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:`
47
+ `}),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:`
48
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Bv(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Vv(n[r])}return t}function Vv(e){return e.spread??e.children.length>1}function Hv(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 Uv(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Wv(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Gv(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Kv(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=Vm(t.children[1]),o=Bm(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 qv(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 Jv(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Yv=9,Xv=32;function Zv(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Qv(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Qv(t.slice(i),i>0,!1)),a.join(``)}function Qv(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Yv||t===Xv;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Yv||t===Xv;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function $v(e,t){let n={type:`text`,value:Zv(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function ey(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var ty={blockquote:Tv,break:Ev,code:Dv,delete:Ov,emphasis:kv,footnoteReference:Av,heading:jv,html:Mv,imageReference:Pv,image:Fv,inlineCode:Iv,linkReference:Lv,link:Rv,listItem:zv,list:Hv,paragraph:Uv,root:Wv,strong:Gv,table:Kv,tableCell:Jv,tableRow:qv,text:$v,thematicBreak:ey,toml:ny,yaml:ny,definition:ny,footnoteDefinition:ny};function ny(){}var ry=typeof self==`object`?self:globalThis,iy=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new ry[e](t)},ay=(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)e[r(t)]=r(n);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 ry[e]==`function`?iy(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)}}return n(iy(a,o),i)};return r},oy=e=>ay(new Map,e)(0),sy=``,{toString:cy}={},{keys:ly}=Object,uy=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=cy.call(e).slice(8,-1);switch(n){case`Array`:return[1,sy];case`Object`:return[2,sy];case`Date`:return[3,sy];case`RegExp`:return[4,sy];case`Map`:return[5,sy];case`Set`:return[6,sy];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},dy=([e,t])=>e===0&&(t===`function`||t===`symbol`),fy=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=uy(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of ly(r))(e||!dy(uy(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,isNaN(r.getTime())?sy:r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(dy(uy(n))||dy(uy(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!dy(uy(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},py=(e,{json:t,lossy:n}={})=>{let r=[];return fy(!(t||n),!!t,new Map,r)(e),r},my=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?oy(py(e,t)):structuredClone(e):(e,t)=>oy(py(e,t));function hy(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 gy(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function _y(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||hy,r=e.options.footnoteBackLabel||gy,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=Zh(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...my(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
49
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
50
+ `}]}}var vy=(function(e){if(e==null)return Cy;if(typeof e==`function`)return Sy(e);if(typeof e==`object`)return Array.isArray(e)?yy(e):by(e);if(typeof e==`string`)return xy(e);throw Error(`Expected function, string, or object as test`)});function yy(e){let t=[],n=-1;for(;++n<e.length;)t[n]=vy(e[n]);return Sy(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function by(e){let t=e;return Sy(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function xy(e){return Sy(t);function t(t){return t&&t.type===e}}function Sy(e){return t;function t(t,n,r){return!!(wy(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Cy(){return!0}function wy(e){return typeof e==`object`&&!!e&&`type`in e}function Ty(e){return e}var Ey=[];function Dy(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=vy(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+Ty(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Ey,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Oy(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Oy(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Ey:[e]}function ky(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),Dy(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var Ay={}.hasOwnProperty,jy={};function My(e,t){let n=t||jy,r=new Map,i=new Map,a={all:s,applyData:Py,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...ty,...n.handlers},one:o,options:n,patch:Ny,wrap:Iy};return ky(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(Ay.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,r=my(n);return r.children=a.all(e),r}return my(e)}return(a.options.unknownHandler||Fy)(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=Ly(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=Ly(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Ny(e,t){e.position&&(t.position=Um(e))}function Py(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,my(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Fy(e,t){let n=t.data||{},r=`value`in t&&!(Ay.call(n,`hProperties`)||Ay.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 Iy(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
51
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
52
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
53
+ `}),n}function Ly(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ry(e,t){let n=My(e,t),r=n.one(e,void 0),i=_y(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
54
+ `},i)),a}function zy(e,t){return e&&`run`in e?async function(n,r){let i=Ry(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Ry(n,{file:r,...e||t})}}function By(e){if(e)throw e}var Vy=Ne(((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 Hy(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 Uy(){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);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Wy(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 Wy(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 Gy={basename:Ky,dirname:qy,extname:Jy,join:Yy,sep:`/`};function Ky(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Qy(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 qy(e){if(Qy(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 Jy(e){Qy(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}continue}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 Yy(...e){let t=-1,n;for(;++t<e.length;)Qy(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Xy(n)}function Xy(e){Qy(e);let t=e.codePointAt(0)===47,n=Zy(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Zy(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 Qy(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var $y={cwd:eb};function eb(){return`/`}function tb(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function nb(e){if(typeof e==`string`)e=new URL(e);else if(!tb(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 rb(e)}function rb(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 ib=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],ab=class{constructor(e){let t;t=e?tb(e)?{path:e}:typeof e==`string`||lb(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:$y.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<ib.length;){let e=ib[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)ib.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Gy.basename(this.path):void 0}set basename(e){sb(e,`basename`),ob(e,`basename`),this.path=Gy.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Gy.dirname(this.path):void 0}set dirname(e){cb(this.basename,`dirname`),this.path=Gy.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Gy.extname(this.path):void 0}set extname(e){if(ob(e,`extname`),cb(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=Gy.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){tb(e)&&(e=nb(e)),sb(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Gy.basename(this.path,this.extname):void 0}set stem(e){sb(e,`stem`),ob(e,`stem`),this.path=Gy.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 Jm(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 ob(e,t){if(e&&e.includes(Gy.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Gy.sep+"`")}function sb(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function cb(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function lb(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var ub=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),db=s(Vy(),1),fb={}.hasOwnProperty,pb=new class e extends ub{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=Uy()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,db.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(gb(`data`,this.frozen),this.namespace[e]=t,this):fb.call(this.namespace,e)&&this.namespace[e]||void 0:e?(gb(`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=yb(e),n=this.parser||this.Parser;return mb(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),mb(`process`,this.parser||this.Parser),hb(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=yb(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);xb(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(),mb(`processSync`,this.parser||this.Parser),hb(`processSync`,this.compiler||this.Compiler),this.process(e,r),vb(`processSync`,`process`,t),n;function r(e,r){t=!0,By(e),n=r}}run(e,t,n){_b(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=yb(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),vb(`runSync`,`run`,n),r;function i(e,t){By(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=yb(t),r=this.compiler||this.Compiler;return hb(`stringify`,r),_b(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(gb(`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,db.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];Hy(o)&&Hy(r)&&(r=(0,db.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function mb(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function hb(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function gb(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 _b(e){if(!Hy(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function vb(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function yb(e){return bb(e)?e:new ab(e)}function bb(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function xb(e){return typeof e==`string`||Sb(e)}function Sb(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Cb=[],wb={allowDangerousHtml:!0},Tb=/^(https?|ircs?|mailto|xmpp)$/i,Eb=[{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 Db(e){let t=Ob(e),n=kb(e);return Ab(t.runSync(t.parse(n),n),e)}function Ob(e){let t=e.rehypePlugins||Cb,n=e.remarkPlugins||Cb,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...wb}:wb;return pb().use(wv).use(n).use(zy,r).use(t)}function kb(e){let t=e.children||``,n=new ab;return typeof t==`string`?n.value=t:``+t,n}function Ab(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||jb;for(let e of Eb)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return ky(e,l),th(e,{Fragment:V.Fragment,components:i,ignoreInvalidStyle:!0,jsx:V.jsx,jsxs:V.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 Ch)if(Object.hasOwn(Ch,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Ch[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 jb(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||Tb.test(e.slice(0,t))?e:``}var Mb=(function(e,t,n){let r=vy(n);if(!e||!e.type||!e.children)throw Error(`Expected parent node`);if(typeof t==`number`){if(t<0||t===1/0)throw Error(`Expected positive finite number as index`)}else if(t=e.children.indexOf(t),t<0)throw Error(`Expected child node or index`);for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),Nb=(function(e){if(e==null)return Lb;if(typeof e==`string`)return Fb(e);if(typeof e==`object`)return Pb(e);if(typeof e==`function`)return Ib(e);throw Error("Expected function, string, or array as `test`")});function Pb(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Nb(e[n]);return Ib(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Fb(e){return Ib(t);function t(t){return t.tagName===e}}function Ib(e){return t;function t(t,n,r){return!!(Rb(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Lb(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`element`&&`tagName`in e&&typeof e.tagName==`string`)}function Rb(e){return typeof e==`object`&&!!e&&`type`in e&&`tagName`in e}var zb=/\n/g,Bb=/[\t ]+/g,Vb=Nb(`br`),Hb=Nb(tx),Ub=Nb(`p`),Wb=Nb(`tr`),Gb=Nb([`datalist`,`head`,`noembed`,`noframes`,`noscript`,`rp`,`script`,`style`,`template`,`title`,ex,nx]),Kb=Nb(`address.article.aside.blockquote.body.caption.center.dd.dialog.dir.dl.dt.div.figure.figcaption.footer.form,.h1.h2.h3.h4.h5.h6.header.hgroup.hr.html.legend.li.listing.main.menu.nav.ol.p.plaintext.pre.section.ul.xmp`.split(`.`));function qb(e,t){let n=t||{},r=`children`in e?e.children:[],i=Kb(e),a=$b(e,{whitespace:n.whitespace||`normal`,breakBefore:!1,breakAfter:!1}),o=[];(e.type===`text`||e.type===`comment`)&&o.push(...Xb(e,{whitespace:a,breakBefore:!0,breakAfter:!0}));let s=-1;for(;++s<r.length;)o.push(...Jb(r[s],e,{whitespace:a,breakBefore:s?void 0:i,breakAfter:s<r.length-1?Vb(r[s+1]):i}));let c=[],l;for(s=-1;++s<o.length;){let e=o[s];typeof e==`number`?l!==void 0&&e>l&&(l=e):e&&(l!==void 0&&l>-1&&c.push(`
55
+ `.repeat(l)||` `),l=-1,c.push(e))}return c.join(``)}function Jb(e,t,n){return e.type===`element`?Yb(e,t,n):e.type===`text`?n.whitespace===`normal`?Xb(e,n):Zb(e):[]}function Yb(e,t,n){let r=$b(e,n),i=e.children||[],a=-1,o=[];if(Gb(e))return o;let s,c;for(Vb(e)||Wb(e)&&Mb(t,e,Wb)?c=`
56
+ `:Ub(e)?(s=2,c=2):Kb(e)&&(s=1,c=1);++a<i.length;)o=o.concat(Jb(i[a],e,{whitespace:r,breakBefore:a?void 0:s,breakAfter:a<i.length-1?Vb(i[a+1]):c}));return Hb(e)&&Mb(t,e,Hb)&&o.push(` `),s&&o.unshift(s),c&&o.push(c),o}function Xb(e,t){let n=String(e.value),r=[],i=[],a=0;for(;a<=n.length;){zb.lastIndex=a;let e=zb.exec(n),i=e&&`index`in e?e.index:n.length;r.push(Qb(n.slice(a,i).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,``),a!==0||t.breakBefore,i!==n.length||t.breakAfter)),a=i+1}let o=-1,s;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),s=void 0):r[o]?(typeof s==`number`&&i.push(s),i.push(r[o]),s=0):(o===0||o===r.length-1)&&i.push(0);return i}function Zb(e){return[String(e.value)]}function Qb(e,t,n){let r=[],i=0,a;for(;i<e.length;){Bb.lastIndex=i;let n=Bb.exec(e);a=n?n.index:e.length,!i&&!a&&n&&!t&&r.push(``),i!==a&&r.push(e.slice(i,a)),i=n?a+n[0].length:a}return i!==a&&!n&&r.push(``),r.join(` `)}function $b(e,t){if(e.type===`element`){let n=e.properties||{};switch(e.tagName){case`listing`:case`plaintext`:case`xmp`:return`pre`;case`nobr`:return`nowrap`;case`pre`:return n.wrap?`pre-wrap`:`pre`;case`td`:case`th`:return n.noWrap?`nowrap`:t.whitespace;case`textarea`:return`pre-wrap`;default:}}return t.whitespace}function ex(e){return!!(e.properties||{}).hidden}function tx(e){return e.tagName===`td`||e.tagName===`th`}function nx(e){return e.tagName===`dialog`&&!(e.properties||{}).open}function rx(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(?!struct)(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,begin:`\\b[a-z\\d_]*_t\\b`},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},s={className:`number`,variants:[{begin:`[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)`},{begin:`[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)`}],relevance:0},c={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},l={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},u=t.optional(r)+e.IDENT_RE+`\\s*\\(`,d=`alignas.alignof.and.and_eq.asm.atomic_cancel.atomic_commit.atomic_noexcept.auto.bitand.bitor.break.case.catch.class.co_await.co_return.co_yield.compl.concept.const_cast|10.consteval.constexpr.constinit.continue.decltype.default.delete.do.dynamic_cast|10.else.enum.explicit.export.extern.false.final.for.friend.goto.if.import.inline.module.mutable.namespace.new.noexcept.not.not_eq.nullptr.operator.or.or_eq.override.private.protected.public.reflexpr.register.reinterpret_cast|10.requires.return.sizeof.static_assert.static_cast|10.struct.switch.synchronized.template.this.thread_local.throw.transaction_safe.transaction_safe_dynamic.true.try.typedef.typeid.typename.union.using.virtual.volatile.while.xor.xor_eq`.split(`.`),f=[`bool`,`char`,`char16_t`,`char32_t`,`char8_t`,`double`,`float`,`int`,`long`,`short`,`void`,`wchar_t`,`unsigned`,`signed`,`const`,`static`],p=`any.auto_ptr.barrier.binary_semaphore.bitset.complex.condition_variable.condition_variable_any.counting_semaphore.deque.false_type.flat_map.flat_set.future.imaginary.initializer_list.istringstream.jthread.latch.lock_guard.multimap.multiset.mutex.optional.ostringstream.packaged_task.pair.promise.priority_queue.queue.recursive_mutex.recursive_timed_mutex.scoped_lock.set.shared_future.shared_lock.shared_mutex.shared_timed_mutex.shared_ptr.stack.string_view.stringstream.timed_mutex.thread.true_type.tuple.unique_lock.unique_ptr.unordered_map.unordered_multimap.unordered_multiset.unordered_set.variant.vector.weak_ptr.wstring.wstring_view`.split(`.`),m=`abort.abs.acos.apply.as_const.asin.atan.atan2.calloc.ceil.cerr.cin.clog.cos.cosh.cout.declval.endl.exchange.exit.exp.fabs.floor.fmod.forward.fprintf.fputs.free.frexp.fscanf.future.invoke.isalnum.isalpha.iscntrl.isdigit.isgraph.islower.isprint.ispunct.isspace.isupper.isxdigit.labs.launder.ldexp.log.log10.make_pair.make_shared.make_shared_for_overwrite.make_tuple.make_unique.malloc.memchr.memcmp.memcpy.memset.modf.move.pow.printf.putchar.puts.realloc.scanf.sin.sinh.snprintf.sprintf.sqrt.sscanf.std.stderr.stdin.stdout.strcat.strchr.strcmp.strcpy.strcspn.strlen.strncat.strncmp.strncpy.strpbrk.strrchr.strspn.strstr.swap.tan.tanh.terminate.to_underlying.tolower.toupper.vfprintf.visit.vprintf.vsprintf`.split(`.`),h={type:f,keyword:d,literal:[`NULL`,`false`,`nullopt`,`nullptr`,`true`],built_in:[`_Pragma`],_type_hints:p},g={className:`function.dispatch`,relevance:0,keywords:{_hint:m},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[g,c,a,n,e.C_BLOCK_COMMENT_MODE,s,o],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:h,contains:_.concat([{begin:/\(/,end:/\)/,keywords:h,contains:_.concat([`self`]),relevance:0}]),relevance:0},y={className:`function`,begin:`(`+i+`[\\*&\\s]+)+`+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:h,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:h,relevance:0},{begin:u,returnBegin:!0,contains:[l],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[o,s]},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:`C++`,aliases:[`cc`,`c++`,`h++`,`hpp`,`hh`,`hxx`,`cxx`],keywords:h,illegal:`</`,classNameAliases:{"function.dispatch":`built_in`},contains:[].concat(v,y,g,_,[c,{begin:`\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)`,end:`>`,keywords:h,contains:[`self`,a]},{begin:e.IDENT_RE+`::`,keywords:h},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:`keyword`,3:`title.class`}}])}}function ix(e){let t={type:[`boolean`,`byte`,`word`,`String`],built_in:`KeyboardController.MouseController.SoftwareSerial.EthernetServer.EthernetClient.LiquidCrystal.RobotControl.GSMVoiceCall.EthernetUDP.EsploraTFT.HttpClient.RobotMotor.WiFiClient.GSMScanner.FileSystem.Scheduler.GSMServer.YunClient.YunServer.IPAddress.GSMClient.GSMModem.Keyboard.Ethernet.Console.GSMBand.Esplora.Stepper.Process.WiFiUDP.GSM_SMS.Mailbox.USBHost.Firmata.PImage.Client.Server.GSMPIN.FileIO.Bridge.Serial.EEPROM.Stream.Mouse.Audio.Servo.File.Task.GPRS.WiFi.Wire.TFT.GSM.SPI.SD`.split(`.`),_hints:`setup.loop.runShellCommandAsynchronously.analogWriteResolution.retrieveCallingNumber.printFirmwareVersion.analogReadResolution.sendDigitalPortPair.noListenOnLocalhost.readJoystickButton.setFirmwareVersion.readJoystickSwitch.scrollDisplayRight.getVoiceCallStatus.scrollDisplayLeft.writeMicroseconds.delayMicroseconds.beginTransmission.getSignalStrength.runAsynchronously.getAsynchronously.listenOnLocalhost.getCurrentCarrier.readAccelerometer.messageAvailable.sendDigitalPorts.lineFollowConfig.countryNameWrite.runShellCommand.readStringUntil.rewindDirectory.readTemperature.setClockDivider.readLightSensor.endTransmission.analogReference.detachInterrupt.countryNameRead.attachInterrupt.encryptionType.readBytesUntil.robotNameWrite.readMicrophone.robotNameRead.cityNameWrite.userNameWrite.readJoystickY.readJoystickX.mouseReleased.openNextFile.scanNetworks.noInterrupts.digitalWrite.beginSpeaker.mousePressed.isActionDone.mouseDragged.displayLogos.noAutoscroll.addParameter.remoteNumber.getModifiers.keyboardRead.userNameRead.waitContinue.processInput.parseCommand.printVersion.readNetworks.writeMessage.blinkVersion.cityNameRead.readMessage.setDataMode.parsePacket.isListening.setBitOrder.beginPacket.isDirectory.motorsWrite.drawCompass.digitalRead.clearScreen.serialEvent.rightToLeft.setTextSize.leftToRight.requestFrom.keyReleased.compassRead.analogWrite.interrupts.WiFiServer.disconnect.playMelody.parseFloat.autoscroll.getPINUsed.setPINUsed.setTimeout.sendAnalog.readSlider.analogRead.beginWrite.createChar.motorsStop.keyPressed.tempoWrite.readButton.subnetMask.debugPrint.macAddress.writeGreen.randomSeed.attachGPRS.readString.sendString.remotePort.releaseAll.mouseMoved.background.getXChange.getYChange.answerCall.getResult.voiceCall.endPacket.constrain.getSocket.writeJSON.getButton.available.connected.findUntil.readBytes.exitValue.readGreen.writeBlue.startLoop.IPAddress.isPressed.sendSysex.pauseMode.gatewayIP.setCursor.getOemKey.tuneWrite.noDisplay.loadImage.switchPIN.onRequest.onReceive.changePIN.playFile.noBuffer.parseInt.overflow.checkPIN.knobRead.beginTFT.bitClear.updateIR.bitWrite.position.writeRGB.highByte.writeRed.setSpeed.readBlue.noStroke.remoteIP.transfer.shutdown.hangCall.beginSMS.endWrite.attached.maintain.noCursor.checkReg.checkPUK.shiftOut.isValid.shiftIn.pulseIn.connect.println.localIP.pinMode.getIMEI.display.noBlink.process.getBand.running.beginSD.drawBMP.lowByte.setBand.release.bitRead.prepare.pointTo.readRed.setMode.noFill.remove.listen.stroke.detach.attach.noTone.exists.buffer.height.bitSet.circle.config.cursor.random.IRread.setDNS.endSMS.getKey.micros.millis.begin.print.write.ready.flush.width.isPIN.blink.clear.press.mkdir.rmdir.close.point.yield.image.BSSID.click.delay.read.text.move.peek.beep.rect.line.open.seek.fill.size.turn.stop.home.find.step.tone.sqrt.RSSI.SSID.end.bit.tan.cos.sin.pow.map.abs.max.min.get.run.put`.split(`.`),literal:[`DIGITAL_MESSAGE`,`FIRMATA_STRING`,`ANALOG_MESSAGE`,`REPORT_DIGITAL`,`REPORT_ANALOG`,`INPUT_PULLUP`,`SET_PIN_MODE`,`INTERNAL2V56`,`SYSTEM_RESET`,`LED_BUILTIN`,`INTERNAL1V1`,`SYSEX_START`,`INTERNAL`,`EXTERNAL`,`DEFAULT`,`OUTPUT`,`INPUT`,`HIGH`,`LOW`]},n=rx(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name=`Arduino`,n.aliases=[`ino`],n.supersetOf=`cpp`,n}function ax(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:[`self`,{begin:/:-/,contains:[n]}]};Object.assign(n,{className:`variable`,variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,`(?![\\w\\d])(?![$])`)},r]});let i={className:`subst`,begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:`comment`}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:`string`})]}},s={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let c={match:/\\"/},l={className:`string`,begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:`number`},e.NUMBER_MODE,n]},f=e.SHEBANG({binary:`(${[`fish`,`bash`,`zsh`,`sh`,`csh`,`ksh`,`tcsh`,`dash`,`scsh`].join(`|`)})`,relevance:10}),p={className:`function`,begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=[`if`,`then`,`else`,`elif`,`fi`,`time`,`for`,`while`,`until`,`in`,`do`,`done`,`case`,`esac`,`coproc`,`function`,`select`],h=[`true`,`false`],g={match:/(\/[a-z._-]+)+/},_=[`break`,`cd`,`continue`,`eval`,`exec`,`exit`,`export`,`getopts`,`hash`,`pwd`,`readonly`,`return`,`shift`,`test`,`times`,`trap`,`umask`,`unset`],v=[`alias`,`bind`,`builtin`,`caller`,`command`,`declare`,`echo`,`enable`,`help`,`let`,`local`,`logout`,`mapfile`,`printf`,`read`,`readarray`,`source`,`sudo`,`type`,`typeset`,`ulimit`,`unalias`],y=`autoload.bg.bindkey.bye.cap.chdir.clone.comparguments.compcall.compctl.compdescribe.compfiles.compgroups.compquote.comptags.comptry.compvalues.dirs.disable.disown.echotc.echoti.emulate.fc.fg.float.functions.getcap.getln.history.integer.jobs.kill.limit.log.noglob.popd.print.pushd.pushln.rehash.sched.setcap.setopt.stat.suspend.ttyctl.unfunction.unhash.unlimit.unsetopt.vared.wait.whence.where.which.zcompile.zformat.zftp.zle.zmodload.zparseopts.zprof.zpty.zregexparse.zsocket.zstyle.ztcp`.split(`.`),b=`chcon.chgrp.chown.chmod.cp.dd.df.dir.dircolors.ln.ls.mkdir.mkfifo.mknod.mktemp.mv.realpath.rm.rmdir.shred.sync.touch.truncate.vdir.b2sum.base32.base64.cat.cksum.comm.csplit.cut.expand.fmt.fold.head.join.md5sum.nl.numfmt.od.paste.ptx.pr.sha1sum.sha224sum.sha256sum.sha384sum.sha512sum.shuf.sort.split.sum.tac.tail.tr.tsort.unexpand.uniq.wc.arch.basename.chroot.date.dirname.du.echo.env.expr.factor.groups.hostid.id.link.logname.nice.nohup.nproc.pathchk.pinky.printenv.printf.pwd.readlink.runcon.seq.sleep.stat.stdbuf.stty.tee.test.timeout.tty.uname.unlink.uptime.users.who.whoami.yes`.split(`.`);return{name:`Bash`,aliases:[`sh`,`zsh`],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:h,built_in:[..._,...v,`set`,`shopt`,...y,...b]},contains:[f,e.SHEBANG(),p,d,a,o,g,s,c,l,u,n]}}function ox(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,variants:[{begin:`\\b[a-z\\d_]*_t\\b`},{match:/\batomic_[a-z]{3,6}\b/}]},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},s={className:`number`,variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},c={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},l={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},u=t.optional(r)+e.IDENT_RE+`\\s*\\(`,d={keyword:`asm.auto.break.case.continue.default.do.else.enum.extern.for.fortran.goto.if.inline.register.restrict.return.sizeof.typeof.typeof_unqual.struct.switch.typedef.union.volatile.while._Alignas._Alignof._Atomic._Generic._Noreturn._Static_assert._Thread_local.alignas.alignof.noreturn.static_assert.thread_local._Pragma`.split(`.`),type:`float.double.signed.unsigned.int.short.long.char.void._Bool._BitInt._Complex._Imaginary._Decimal32._Decimal64._Decimal96._Decimal128._Decimal64x._Decimal128x._Float16._Float32._Float64._Float128._Float32x._Float64x._Float128x.const.static.constexpr.complex.bool.imaginary`.split(`.`),literal:`true false NULL`,built_in:`std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr`},f=[c,a,n,e.C_BLOCK_COMMENT_MODE,s,o],p={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:d,contains:f.concat([{begin:/\(/,end:/\)/,keywords:d,contains:f.concat([`self`]),relevance:0}]),relevance:0},m={begin:`(`+i+`[\\*&\\s]+)+`+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:d,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:d,relevance:0},{begin:u,returnBegin:!0,contains:[e.inherit(l,{className:`title.function`})],relevance:0},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:`C`,aliases:[`h`],keywords:d,disableAutodetect:!0,illegal:`</`,contains:[].concat(p,m,f,[c,{begin:e.IDENT_RE+`::`,keywords:d},{className:`class`,beginKeywords:`enum class struct union`,end:/[{;:<>=]/,contains:[{beginKeywords:`final class struct`},e.TITLE_MODE]}]),exports:{preprocessor:c,strings:o,keywords:d}}}function sx(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(?!struct)(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,begin:`\\b[a-z\\d_]*_t\\b`},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},s={className:`number`,variants:[{begin:`[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)`},{begin:`[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)`}],relevance:0},c={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),{className:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},l={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},u=t.optional(r)+e.IDENT_RE+`\\s*\\(`,d=`alignas.alignof.and.and_eq.asm.atomic_cancel.atomic_commit.atomic_noexcept.auto.bitand.bitor.break.case.catch.class.co_await.co_return.co_yield.compl.concept.const_cast|10.consteval.constexpr.constinit.continue.decltype.default.delete.do.dynamic_cast|10.else.enum.explicit.export.extern.false.final.for.friend.goto.if.import.inline.module.mutable.namespace.new.noexcept.not.not_eq.nullptr.operator.or.or_eq.override.private.protected.public.reflexpr.register.reinterpret_cast|10.requires.return.sizeof.static_assert.static_cast|10.struct.switch.synchronized.template.this.thread_local.throw.transaction_safe.transaction_safe_dynamic.true.try.typedef.typeid.typename.union.using.virtual.volatile.while.xor.xor_eq`.split(`.`),f=[`bool`,`char`,`char16_t`,`char32_t`,`char8_t`,`double`,`float`,`int`,`long`,`short`,`void`,`wchar_t`,`unsigned`,`signed`,`const`,`static`],p=`any.auto_ptr.barrier.binary_semaphore.bitset.complex.condition_variable.condition_variable_any.counting_semaphore.deque.false_type.flat_map.flat_set.future.imaginary.initializer_list.istringstream.jthread.latch.lock_guard.multimap.multiset.mutex.optional.ostringstream.packaged_task.pair.promise.priority_queue.queue.recursive_mutex.recursive_timed_mutex.scoped_lock.set.shared_future.shared_lock.shared_mutex.shared_timed_mutex.shared_ptr.stack.string_view.stringstream.timed_mutex.thread.true_type.tuple.unique_lock.unique_ptr.unordered_map.unordered_multimap.unordered_multiset.unordered_set.variant.vector.weak_ptr.wstring.wstring_view`.split(`.`),m=`abort.abs.acos.apply.as_const.asin.atan.atan2.calloc.ceil.cerr.cin.clog.cos.cosh.cout.declval.endl.exchange.exit.exp.fabs.floor.fmod.forward.fprintf.fputs.free.frexp.fscanf.future.invoke.isalnum.isalpha.iscntrl.isdigit.isgraph.islower.isprint.ispunct.isspace.isupper.isxdigit.labs.launder.ldexp.log.log10.make_pair.make_shared.make_shared_for_overwrite.make_tuple.make_unique.malloc.memchr.memcmp.memcpy.memset.modf.move.pow.printf.putchar.puts.realloc.scanf.sin.sinh.snprintf.sprintf.sqrt.sscanf.std.stderr.stdin.stdout.strcat.strchr.strcmp.strcpy.strcspn.strlen.strncat.strncmp.strncpy.strpbrk.strrchr.strspn.strstr.swap.tan.tanh.terminate.to_underlying.tolower.toupper.vfprintf.visit.vprintf.vsprintf`.split(`.`),h={type:f,keyword:d,literal:[`NULL`,`false`,`nullopt`,`nullptr`,`true`],built_in:[`_Pragma`],_type_hints:p},g={className:`function.dispatch`,relevance:0,keywords:{_hint:m},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[g,c,a,n,e.C_BLOCK_COMMENT_MODE,s,o],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:h,contains:_.concat([{begin:/\(/,end:/\)/,keywords:h,contains:_.concat([`self`]),relevance:0}]),relevance:0},y={className:`function`,begin:`(`+i+`[\\*&\\s]+)+`+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:h,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:h,relevance:0},{begin:u,returnBegin:!0,contains:[l],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[o,s]},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:`C++`,aliases:[`cc`,`c++`,`h++`,`hpp`,`hh`,`hxx`,`cxx`],keywords:h,illegal:`</`,classNameAliases:{"function.dispatch":`built_in`},contains:[].concat(v,y,g,_,[c,{begin:`\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)`,end:`>`,keywords:h,contains:[`self`,a]},{begin:e.IDENT_RE+`::`,keywords:h},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:`keyword`,3:`title.class`}}])}}function cx(e){let t=[`bool`,`byte`,`char`,`decimal`,`delegate`,`double`,`dynamic`,`enum`,`float`,`int`,`long`,`nint`,`nuint`,`object`,`sbyte`,`short`,`string`,`ulong`,`uint`,`ushort`],n=[`public`,`private`,`protected`,`static`,`internal`,`protected`,`abstract`,`async`,`extern`,`override`,`unsafe`,`virtual`,`new`,`sealed`,`partial`],r={keyword:`abstract.as.base.break.case.catch.class.const.continue.do.else.event.explicit.extern.finally.fixed.for.foreach.goto.if.implicit.in.interface.internal.is.lock.namespace.new.operator.out.override.params.private.protected.public.readonly.record.ref.return.scoped.sealed.sizeof.stackalloc.static.struct.switch.this.throw.try.typeof.unchecked.unsafe.using.virtual.void.volatile.while`.split(`.`).concat(`add.alias.and.ascending.args.async.await.by.descending.dynamic.equals.file.from.get.global.group.init.into.join.let.nameof.not.notnull.on.or.orderby.partial.record.remove.required.scoped.select.set.unmanaged.value|0.var.when.where.with.yield`.split(`.`)),built_in:t,literal:[`default`,`false`,`null`,`true`]},i=e.inherit(e.TITLE_MODE,{begin:`[a-zA-Z](\\.?\\w)*`}),a={className:`number`,variants:[{begin:`\\b(0b[01']+)`},{begin:`(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)`},{begin:`(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)`}],relevance:0},o={className:`string`,begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},s={className:`string`,begin:`@"`,end:`"`,contains:[{begin:`""`}]},c=e.inherit(s,{illegal:/\n/}),l={className:`subst`,begin:/\{/,end:/\}/,keywords:r},u=e.inherit(l,{illegal:/\n/}),d={className:`string`,begin:/\$"/,end:`"`,illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,u]},f={className:`string`,begin:/\$@"/,end:`"`,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:`""`},l]},p=e.inherit(f,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:`""`},u]});l.contains=[f,d,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE],u.contains=[p,d,c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let m={variants:[o,f,d,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h={begin:`<`,end:`>`,contains:[{beginKeywords:`in out`},i]},g=e.IDENT_RE+`(<`+e.IDENT_RE+`(\\s*,\\s*`+e.IDENT_RE+`)*>)?(\\[\\])?`,_={begin:`@`+e.IDENT_RE,relevance:0};return{name:`C#`,aliases:[`cs`,`c#`],keywords:r,illegal:/::/,contains:[e.COMMENT(`///`,`$`,{returnBegin:!0,contains:[{className:`doctag`,variants:[{begin:`///`,relevance:0},{begin:`<!--|-->`},{begin:`</?`,end:`>`}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`meta`,begin:`#`,end:`$`,keywords:{keyword:`if else elif endif define undef warning error line region endregion pragma checksum`}},m,a,{beginKeywords:`class interface`,relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:`where class`},i,h,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`namespace`,relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`record`,relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[i,h,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`meta`,begin:`^\\s*\\[(?=[\\w])`,excludeBegin:!0,end:`\\]`,excludeEnd:!0,contains:[{className:`string`,begin:/"/,end:/"/}]},{beginKeywords:`new return throw await else`,relevance:0},{className:`function`,begin:`(`+g+`\\s+)+`+e.IDENT_RE+`\\s*(<[^=]+>\\s*)?\\(`,returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:r,contains:[{beginKeywords:n.join(` `),relevance:0},{begin:e.IDENT_RE+`\\s*(<[^=]+>\\s*)?\\(`,returnBegin:!0,contains:[e.TITLE_MODE,h],relevance:0},{match:/\(\)/},{className:`params`,begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,relevance:0,contains:[m,a,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_]}}var lx=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),ux=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),dx=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),fx=[...ux,...dx],px=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),mx=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),hx=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),gx=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function _x(e){let t=e.regex,n=lx(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i=/@-?\w[\w]*(-\w+)*/,a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:`CSS`,case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:`from to`},classNameAliases:{keyframePosition:`selector-tag`},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:`selector-id`,begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:`selector-class`,begin:`\\.[a-zA-Z-][a-zA-Z0-9_-]*`,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,variants:[{begin:`:(`+mx.join(`|`)+`)`},{begin:`:(:)?(`+hx.join(`|`)+`)`}]},n.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+gx.join(`|`)+`)\\b`},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:`url data-uri`},contains:[...a,{className:`string`,begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:`[{;]`,relevance:0,illegal:/:/,contains:[{className:`keyword`,begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:px.join(` `)},contains:[{begin:/[a-z-]+(?=:)/,className:`attribute`},...a,n.CSS_NUMBER_MODE]}]},{className:`selector-tag`,begin:`\\b(`+fx.join(`|`)+`)\\b`}]}}function vx(e){let t=e.regex;return{name:`Diff`,aliases:[`patch`],contains:[{className:`meta`,relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:`comment`,variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:`addition`,begin:/^\+/,end:/$/},{className:`deletion`,begin:/^-/,end:/$/},{className:`addition`,begin:/^!/,end:/$/}]}}function yx(e){let t={keyword:[`break`,`case`,`chan`,`const`,`continue`,`default`,`defer`,`else`,`fallthrough`,`for`,`func`,`go`,`goto`,`if`,`import`,`interface`,`map`,`package`,`range`,`return`,`select`,`struct`,`switch`,`type`,`var`],type:[`bool`,`byte`,`complex64`,`complex128`,`error`,`float32`,`float64`,`int8`,`int16`,`int32`,`int64`,`string`,`uint8`,`uint16`,`uint32`,`uint64`,`int`,`uint`,`uintptr`,`rune`],literal:[`true`,`false`,`iota`,`nil`],built_in:[`append`,`cap`,`close`,`complex`,`copy`,`imag`,`len`,`make`,`new`,`panic`,`print`,`println`,`real`,`recover`,`delete`]};return{name:`Go`,aliases:[`golang`],keywords:t,illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`string`,variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:`number`,variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:`function`,beginKeywords:`func`,end:`\\s*(\\{|$)`,excludeEnd:!0,contains:[e.TITLE_MODE,{className:`params`,begin:/\(/,end:/\)/,endsParent:!0,keywords:t,illegal:/["']/}]}]}}function bx(e){let t=e.regex;return{name:`GraphQL`,aliases:[`gql`],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:[`query`,`mutation`,`subscription`,`type`,`input`,`schema`,`directive`,`interface`,`union`,`scalar`,`fragment`,`enum`,`on`],literal:[`true`,`false`,`null`]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:`punctuation`,match:/[.]{3}/,relevance:0},{scope:`punctuation`,begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:`variable`,begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:`meta`,match:/@\w+/,excludeEnd:!0},{scope:`symbol`,begin:t.concat(/[_A-Za-z][_0-9A-Za-z]*/,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function xx(e){let t=e.regex,n={className:`number`,relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let i={className:`variable`,variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},a={className:`literal`,begin:/\bon|off|true|false|yes|no\b/},o={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:`'''`,end:`'''`,relevance:10},{begin:`"""`,end:`"""`,relevance:10},{begin:`"`,end:`"`},{begin:`'`,end:`'`}]},s={begin:/\[/,end:/\]/,contains:[r,a,i,o,n,`self`],relevance:0},c=t.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{name:`TOML, also INI`,aliases:[`toml`],case_insensitive:!0,illegal:/\S/,contains:[r,{className:`section`,begin:/\[+/,end:/\]+/},{begin:t.concat(c,`(\\s*\\.\\s*`,c,`)*`,t.lookahead(/\s*=\s*[^#\s]/)),className:`attr`,starts:{end:/$/,contains:[r,s,a,i,o,n]}}]}}var Sx=`[0-9](_*[0-9])*`,Cx=`\\.(${Sx})`,wx=`[0-9a-fA-F](_*[0-9a-fA-F])*`,Tx={className:`number`,variants:[{begin:`(\\b(${Sx})((${Cx})|\\.)?|(${Cx}))[eE][+-]?(${Sx})[fFdD]?\\b`},{begin:`\\b(${Sx})((${Cx})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Cx})[fFdD]?\\b`},{begin:`\\b(${Sx})[fFdD]\\b`},{begin:`\\b0[xX]((${wx})\\.?|(${wx})?\\.(${wx}))[pP][+-]?(${Sx})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${wx})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function Ex(e,t,n){return n===-1?``:e.replace(t,r=>Ex(e,t,n-1))}function Dx(e){let t=e.regex,n=`[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*`,r=n+Ex(`(?:<[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*~~~(?:\\s*,\\s*[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*~~~)*>)?`,/~~~/g,2),i={keyword:`synchronized.abstract.private.var.static.if.const .for.while.strictfp.finally.protected.import.native.final.void.enum.else.break.transient.catch.instanceof.volatile.case.assert.package.default.public.try.switch.continue.throws.protected.public.private.module.requires.exports.do.sealed.yield.permits.goto.when`.split(`.`),literal:[`false`,`true`,`null`],type:[`char`,`boolean`,`long`,`float`,`int`,`byte`,`short`,`double`],built_in:[`super`,`this`]},a={className:`meta`,begin:`@[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*`,contains:[{begin:/\(/,end:/\)/,contains:[`self`]}]},o={className:`params`,begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:`Java`,aliases:[`jsp`],keywords:i,illegal:/<\/|#/,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:`doctag`,begin:`@[A-Za-z]+`}]}),{begin:/import java\.[a-z]+\./,keywords:`import`,relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:`string`,contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:`keyword`,3:`title.class`}},{match:/non-sealed/,scope:`keyword`},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:`type`,3:`variable`,5:`operator`}},{begin:[/record/,/\s+/,n],className:{1:`keyword`,3:`title.class`},contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`new throw return else`,relevance:0},{begin:[`(?:`+r+`\\s+)`,e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:`title.function`},keywords:i,contains:[{className:`params`,begin:/\(/,end:/\)/,keywords:i,relevance:0,contains:[a,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Tx,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Tx,a]}}var Ox=`[A-Za-z$_][0-9A-Za-z$_]*`,kx=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),Ax=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],jx=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),Mx=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],Nx=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],Px=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],Fx=[].concat(Nx,jx,Mx);function Ix(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=Ox,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:Ox,keyword:kx,literal:Ax,built_in:Fx,"variable.language":Px},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:`[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...jx,...Mx]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...Nx,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$[A-Za-z$_][0-9A-Za-z$_]*`,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function Lx(e){let t={className:`attr`,begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:`punctuation`,relevance:0},r=[`true`,`false`,`null`],i={scope:`literal`,beginKeywords:r.join(` `)};return{name:`JSON`,aliases:[`jsonc`],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:`\\S`}}var Rx=`[0-9](_*[0-9])*`,zx=`\\.(${Rx})`,Bx=`[0-9a-fA-F](_*[0-9a-fA-F])*`,Vx={className:`number`,variants:[{begin:`(\\b(${Rx})((${zx})|\\.)?|(${zx}))[eE][+-]?(${Rx})[fFdD]?\\b`},{begin:`\\b(${Rx})((${zx})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${zx})[fFdD]?\\b`},{begin:`\\b(${Rx})[fFdD]\\b`},{begin:`\\b0[xX]((${Bx})\\.?|(${Bx})?\\.(${Bx}))[pP][+-]?(${Rx})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${Bx})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function Hx(e){let t={keyword:`abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual`,built_in:`Byte Short Char Int Long Boolean Float Double Void Unit Nothing`,literal:`true false null`},n={className:`keyword`,begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:`symbol`,begin:/@\w+/}]}},r={className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`@`},i={className:`subst`,begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},a={className:`variable`,begin:`\\$`+e.UNDERSCORE_IDENT_RE},o={className:`string`,variants:[{begin:`"""`,end:`"""(?=[^"])`,contains:[a,i]},{begin:`'`,end:`'`,illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`,illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,a,i]}]};i.contains.push(o);let s={className:`meta`,begin:`@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*`+e.UNDERSCORE_IDENT_RE+`)?`},c={className:`meta`,begin:`@`+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(o,{className:`string`}),`self`]}]},l=Vx,u=e.COMMENT(`/\\*`,`\\*/`,{contains:[e.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:`type`,begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=d;return f.variants[1].contains=[d],d.variants[1].contains=[f],{name:`Kotlin`,aliases:[`kt`,`kts`],keywords:t,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`}]}),e.C_LINE_COMMENT_MODE,u,n,r,s,c,{className:`function`,beginKeywords:`fun`,end:`[(]|$`,returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+`\\s*\\(`,returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:`type`,begin:/</,end:/>/,keywords:`reified`,relevance:0},{className:`params`,begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,e.C_LINE_COMMENT_MODE,u],relevance:0},e.C_LINE_COMMENT_MODE,u,s,c,o,e.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:`title.class`},keywords:`class interface trait`,end:/[:\{(]|$/,excludeEnd:!0,illegal:`extends implements`,contains:[{beginKeywords:`public protected internal private constructor`},e.UNDERSCORE_TITLE_MODE,{className:`type`,begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},s,c]},o,{className:`meta`,begin:`^#!/usr/bin/env`,end:`$`,illegal:`
57
+ `},l]}}var Ux=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Wx=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),Gx=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),Kx=[...Wx,...Gx],qx=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),Jx=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),Yx=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),Xx=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse(),Zx=Jx.concat(Yx).sort().reverse();function Qx(e){let t=Ux(e),n=Zx,r=`([\\w-]+|@\\{[\\w-]+\\})`,i=[],a=[],o=function(e){return{className:`string`,begin:`~?`+e+`.*?`+e}},s=function(e,t,n){return{className:e,begin:t,relevance:n}},c={$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:qx.join(` `)},l={begin:`\\(`,end:`\\)`,contains:a,keywords:c,relevance:0};a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,o(`'`),o(`"`),t.CSS_NUMBER_MODE,{begin:`(url|data-uri)\\(`,starts:{className:`string`,end:`[\\)\\n]`,excludeEnd:!0}},t.HEXCOLOR,l,s(`variable`,`@@?[\\w-]+`,10),s(`variable`,`@\\{[\\w-]+\\}`),s(`built_in`,"~?`[^`]*?`"),{className:`attribute`,begin:`[\\w-]+\\s*:`,end:`:`,returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:`and not`},t.FUNCTION_DISPATCH);let u=a.concat({begin:/\{/,end:/\}/,contains:i}),d={beginKeywords:`when`,endsWithParent:!0,contains:[{beginKeywords:`and not`}].concat(a)},f={begin:`([\\w-]+|@\\{[\\w-]+\\})\\s*:`,returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+Xx.join(`|`)+`)\\b`,end:/(?=:)/,starts:{endsWithParent:!0,illegal:`[<=$]`,relevance:0,contains:a}}]},p={className:`keyword`,begin:`@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b`,starts:{end:`[;{}]`,keywords:c,returnEnd:!0,contains:a,relevance:0}},m={className:`variable`,variants:[{begin:`@[\\w-]+\\s*:`,relevance:15},{begin:`@[\\w-]+`}],starts:{end:`[;}]`,returnEnd:!0,contains:u}},h={variants:[{begin:`[\\.#:&\\[>]`,end:`[;{}]`},{begin:r,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,d,s(`keyword`,`all\\b`),s(`variable`,`@\\{[\\w-]+\\}`),{begin:`\\b(`+Kx.join(`|`)+`)\\b`,className:`selector-tag`},t.CSS_NUMBER_MODE,s(`selector-tag`,r,0),s(`selector-id`,`#([\\w-]+|@\\{[\\w-]+\\})`),s(`selector-class`,`\\.([\\w-]+|@\\{[\\w-]+\\})`,0),s(`selector-tag`,`&`,0),t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,begin:`:(`+Jx.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+Yx.join(`|`)+`)`},{begin:/\(/,end:/\)/,relevance:0,contains:u},{begin:`!important`},t.FUNCTION_DISPATCH]},g={begin:`[\\w-]+:(:)?(${n.join(`|`)})`,returnBegin:!0,contains:[h]};return i.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,m,g,f,h,d,t.FUNCTION_DISPATCH),{name:`Less`,case_insensitive:!0,illegal:`[=>'/<($"]`,contains:i}}function $x(e){let t=`\\[=*\\[`,n=`\\]=*\\]`,r={begin:t,end:n,contains:[`self`]},i=[e.COMMENT(`--(?!\\[=*\\[)`,`$`),e.COMMENT(`--\\[=*\\[`,n,{contains:[r],relevance:10})];return{name:`Lua`,aliases:[`pluto`],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:`true false nil`,keyword:`and break do else elseif end for goto if in local not or repeat return then until while`,built_in:`_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove`},contains:i.concat([{className:`function`,beginKeywords:`function`,end:`\\)`,contains:[e.inherit(e.TITLE_MODE,{begin:`([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*`}),{className:`params`,begin:`\\(`,endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:`string`,begin:t,end:n,contains:[r],relevance:5}])}}function eS(e){let t={className:`variable`,variants:[{begin:`\\$\\(`+e.UNDERSCORE_IDENT_RE+`\\)`,contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:`variable`,begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:`subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value`},contains:[t,n]},i={begin:`^`+e.UNDERSCORE_IDENT_RE+`\\s*(?=[:+?]?=)`},a={className:`meta`,begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:`.PHONY`}},o={className:`section`,begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:`Makefile`,aliases:[`mk`,`mak`,`make`],keywords:{$pattern:/[\w-]+/,keyword:`define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath`},contains:[e.HASH_COMMENT_MODE,t,n,r,i,a,o]}}function tS(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:`>`,subLanguage:`xml`,relevance:0},r={begin:`^[-\\*]{3,}`,end:`$`},i={className:`code`,variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:`(~{3,})[^~](.|\\n)*?\\1~*[ ]*`},{begin:"```",end:"```+[ ]*$"},{begin:`~~~`,end:`~~~+[ ]*$`},{begin:"`.+?`"},{begin:`(?=^( {4}|\\t))`,contains:[{begin:`^( {4}|\\t)`,end:`(\\n)$`}],relevance:0}]},a={className:`bullet`,begin:`^[ ]*([*+-]|(\\d+\\.))(?=\\s+)`,end:`\\s+`,excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:`symbol`,begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:`link`,begin:/:\s*/,end:/$/,excludeBegin:!0}]},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:`string`,relevance:0,begin:`\\[`,end:`\\]`,excludeBegin:!0,returnEnd:!0},{className:`link`,relevance:0,begin:`\\]\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0},{className:`symbol`,relevance:0,begin:`\\]\\[`,end:`\\]`,excludeBegin:!0,excludeEnd:!0}]},c={className:`strong`,contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},l={className:`emphasis`,contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=e.inherit(c,{contains:[]}),d=e.inherit(l,{contains:[]});c.contains.push(d),l.contains.push(u);let f=[n,s];return[c,l,u,d].forEach(e=>{e.contains=e.contains.concat(f)}),f=f.concat(c,l),{name:`Markdown`,aliases:[`md`,`mkdown`,`mkd`],contains:[{className:`section`,variants:[{begin:`^#{1,6}`,end:`$`,contains:f},{begin:`(?=^.+?\\n[=-]{2,}$)`,contains:[{begin:`^[=-]*$`},{begin:`^`,end:`\\n`,contains:f}]}]},n,a,c,l,{className:`quote`,begin:`^>\\s+`,contains:f,end:`$`},i,r,s,o,{scope:`literal`,match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function nS(e){let t={className:`built_in`,begin:`\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+`},n=/[a-zA-Z@][a-zA-Z0-9_]*/,r={"variable.language":[`this`,`super`],$pattern:n,keyword:`while.export.sizeof.typedef.const.struct.for.union.volatile.static.mutable.if.do.return.goto.enum.else.break.extern.asm.case.default.register.explicit.typename.switch.continue.inline.readonly.assign.readwrite.self.@synchronized.id.typeof.nonatomic.IBOutlet.IBAction.strong.weak.copy.in.out.inout.bycopy.byref.oneway.__strong.__weak.__block.__autoreleasing.@private.@protected.@public.@try.@property.@end.@throw.@catch.@finally.@autoreleasepool.@synthesize.@dynamic.@selector.@optional.@required.@encode.@package.@import.@defs.@compatibility_alias.__bridge.__bridge_transfer.__bridge_retained.__bridge_retain.__covariant.__contravariant.__kindof._Nonnull._Nullable._Null_unspecified.__FUNCTION__.__PRETTY_FUNCTION__.__attribute__.getter.setter.retain.unsafe_unretained.nonnull.nullable.null_unspecified.null_resettable.class.instancetype.NS_DESIGNATED_INITIALIZER.NS_UNAVAILABLE.NS_REQUIRES_SUPER.NS_RETURNS_INNER_POINTER.NS_INLINE.NS_AVAILABLE.NS_DEPRECATED.NS_ENUM.NS_OPTIONS.NS_SWIFT_UNAVAILABLE.NS_ASSUME_NONNULL_BEGIN.NS_ASSUME_NONNULL_END.NS_REFINED_FOR_SWIFT.NS_SWIFT_NAME.NS_SWIFT_NOTHROW.NS_DURING.NS_HANDLER.NS_ENDHANDLER.NS_VALUERETURN.NS_VOIDRETURN`.split(`.`),literal:[`false`,`true`,`FALSE`,`TRUE`,`nil`,`YES`,`NO`,`NULL`],built_in:[`dispatch_once_t`,`dispatch_queue_t`,`dispatch_sync`,`dispatch_async`,`dispatch_once`],type:[`int`,`float`,`char`,`unsigned`,`signed`,`short`,`long`,`double`,`wchar_t`,`unichar`,`void`,`bool`,`BOOL`,`id|0`,`_Bool`]},i={$pattern:n,keyword:[`@interface`,`@class`,`@protocol`,`@implementation`]};return{name:`Objective-C`,aliases:[`mm`,`objc`,`obj-c`,`obj-c++`,`objective-c++`],keywords:r,illegal:`</`,contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:`string`,variants:[{begin:`@"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]}]},{className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),{className:`string`,begin:/<.*?>/,end:/$/,illegal:`\\n`},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`class`,begin:`(`+i.keyword.join(`|`)+`)\\b`,end:/(\{|$)/,excludeEnd:!0,keywords:i,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:`\\.`+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function rS(e){let t=e.regex,n=`abs.accept.alarm.and.atan2.bind.binmode.bless.break.caller.chdir.chmod.chomp.chop.chown.chr.chroot.class.close.closedir.connect.continue.cos.crypt.dbmclose.dbmopen.defined.delete.die.do.dump.each.else.elsif.endgrent.endhostent.endnetent.endprotoent.endpwent.endservent.eof.eval.exec.exists.exit.exp.fcntl.field.fileno.flock.for.foreach.fork.format.formline.getc.getgrent.getgrgid.getgrnam.gethostbyaddr.gethostbyname.gethostent.getlogin.getnetbyaddr.getnetbyname.getnetent.getpeername.getpgrp.getpriority.getprotobyname.getprotobynumber.getprotoent.getpwent.getpwnam.getpwuid.getservbyname.getservbyport.getservent.getsockname.getsockopt.given.glob.gmtime.goto.grep.gt.hex.if.index.int.ioctl.join.keys.kill.last.lc.lcfirst.length.link.listen.local.localtime.log.lstat.lt.ma.map.method.mkdir.msgctl.msgget.msgrcv.msgsnd.my.ne.next.no.not.oct.open.opendir.or.ord.our.pack.package.pipe.pop.pos.print.printf.prototype.push.q|0.qq.quotemeta.qw.qx.rand.read.readdir.readline.readlink.readpipe.recv.redo.ref.rename.require.reset.return.reverse.rewinddir.rindex.rmdir.say.scalar.seek.seekdir.select.semctl.semget.semop.send.setgrent.sethostent.setnetent.setpgrp.setpriority.setprotoent.setpwent.setservent.setsockopt.shift.shmctl.shmget.shmread.shmwrite.shutdown.sin.sleep.socket.socketpair.sort.splice.split.sprintf.sqrt.srand.stat.state.study.sub.substr.symlink.syscall.sysopen.sysread.sysseek.system.syswrite.tell.telldir.tie.tied.time.times.tr.truncate.uc.ucfirst.umask.undef.unless.unlink.unpack.unshift.untie.until.use.utime.values.vec.wait.waitpid.wantarray.warn.when.while.write.x|0.xor.y|0`.split(`.`),r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(` `)},a={className:`subst`,begin:`[$@]\\{`,end:`\\}`,keywords:i},o={begin:/->\{/,end:/\}/},s={scope:`attr`,match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:`variable`,variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,`(?![A-Za-z])(?![@$%])`)},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[s]},l={className:`number`,variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[e.BACKSLASH_ESCAPE,a,c],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(e,n,i=`\\1`)=>{let a=i===`\\1`?i:t.concat(i,n);return t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,a,/(?:\\.|[^\\\/])*?/,i,r)},p=(e,n,i)=>t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,i,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:`string`,contains:u,variants:[{begin:`q[qwxr]?\\s*\\(`,end:`\\)`,relevance:5},{begin:`q[qwxr]?\\s*\\[`,end:`\\]`,relevance:5},{begin:`q[qwxr]?\\s*\\{`,end:`\\}`,relevance:5},{begin:`q[qwxr]?\\s*\\|`,end:`\\|`,relevance:5},{begin:`q[qwxr]?\\s*<`,end:`>`,relevance:5},{begin:`qw\\s+q`,end:`q`,relevance:5},{begin:`'`,end:`'`,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:`-?\\w+\\s*=>`,relevance:0}]},l,{begin:`(\\/\\/|`+e.RE_STARTERS_RE+`|\\b(split|return|print|reverse|grep)\\b)\\s*`,keywords:`split return print reverse grep`,relevance:0,contains:[e.HASH_COMMENT_MODE,{className:`regexp`,variants:[{begin:f(`s|tr|y`,t.either(...d,{capture:!0}))},{begin:f(`s|tr|y`,`\\(`,`\\)`)},{begin:f(`s|tr|y`,`\\[`,`\\]`)},{begin:f(`s|tr|y`,`\\{`,`\\}`)}],relevance:2},{className:`regexp`,variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p(`(?:m|qr)?`,/\//,/\//)},{begin:p(`m|qr`,t.either(...d,{capture:!0}),/\1/)},{begin:p(`m|qr`,/\(/,/\)/)},{begin:p(`m|qr`,/\[/,/\]/)},{begin:p(`m|qr`,/\{/,/\}/)}]}]},{className:`function`,beginKeywords:`sub method`,end:`(\\s*\\(.*?\\))?[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s]},{className:`class`,beginKeywords:`class`,end:`[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s,l]},{begin:`-\\w\\b`,relevance:0},{begin:`^__DATA__$`,end:`^__END__$`,subLanguage:`mojolicious`,contains:[{begin:`^@@.*`,end:`$`,className:`comment`}]}];return a.contains=m,o.contains=m,{name:`Perl`,aliases:[`pl`,`pm`],keywords:i,contains:m}}function iS(e){let t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),a=t.concat(/[A-Z]+/,n),o={scope:`variable`,match:`\\$+`+r},s={scope:`meta`,variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:`subst`,variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},l=e.inherit(e.APOS_STRING_MODE,{illegal:null}),u=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(e,t)=>{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},f=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
58
+ ]`,m={scope:`string`,variants:[u,l,d,f]},h={scope:`number`,variants:[{begin:`\\b0[bB][01]+(?:_[01]+)*\\b`},{begin:`\\b0[oO][0-7]+(?:_[0-7]+)*\\b`},{begin:`\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b`},{begin:`(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?`}],relevance:0},g=[`false`,`null`,`true`],_=`__CLASS__.__DIR__.__FILE__.__FUNCTION__.__COMPILER_HALT_OFFSET__.__LINE__.__METHOD__.__NAMESPACE__.__TRAIT__.die.echo.exit.include.include_once.print.require.require_once.array.abstract.and.as.binary.bool.boolean.break.callable.case.catch.class.clone.const.continue.declare.default.do.double.else.elseif.empty.enddeclare.endfor.endforeach.endif.endswitch.endwhile.enum.eval.extends.final.finally.float.for.foreach.from.global.goto.if.implements.instanceof.insteadof.int.integer.interface.isset.iterable.list.match|0.mixed.new.never.object.or.private.protected.public.readonly.real.return.string.switch.throw.trait.try.unset.use.var.void.while.xor.yield`.split(`.`),v=`Error|0.AppendIterator.ArgumentCountError.ArithmeticError.ArrayIterator.ArrayObject.AssertionError.BadFunctionCallException.BadMethodCallException.CachingIterator.CallbackFilterIterator.CompileError.Countable.DirectoryIterator.DivisionByZeroError.DomainException.EmptyIterator.ErrorException.Exception.FilesystemIterator.FilterIterator.GlobIterator.InfiniteIterator.InvalidArgumentException.IteratorIterator.LengthException.LimitIterator.LogicException.MultipleIterator.NoRewindIterator.OutOfBoundsException.OutOfRangeException.OuterIterator.OverflowException.ParentIterator.ParseError.RangeException.RecursiveArrayIterator.RecursiveCachingIterator.RecursiveCallbackFilterIterator.RecursiveDirectoryIterator.RecursiveFilterIterator.RecursiveIterator.RecursiveIteratorIterator.RecursiveRegexIterator.RecursiveTreeIterator.RegexIterator.RuntimeException.SeekableIterator.SplDoublyLinkedList.SplFileInfo.SplFileObject.SplFixedArray.SplHeap.SplMaxHeap.SplMinHeap.SplObjectStorage.SplObserver.SplPriorityQueue.SplQueue.SplStack.SplSubject.SplTempFileObject.TypeError.UnderflowException.UnexpectedValueException.UnhandledMatchError.ArrayAccess.BackedEnum.Closure.Fiber.Generator.Iterator.IteratorAggregate.Serializable.Stringable.Throwable.Traversable.UnitEnum.WeakReference.WeakMap.Directory.__PHP_Incomplete_Class.parent.php_user_filter.self.static.stdClass`.split(`.`),y={keyword:_,literal:(e=>{let t=[];return e.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t})(g),built_in:v},b=e=>e.map(e=>e.replace(/\|\d+$/,``)),x={variants:[{match:[/new/,t.concat(p,`+`),t.concat(`(?!`,b(v).join(`\\b|`),`\\b)`),i],scope:{1:`keyword`,4:`title.class`}}]},S=t.concat(r,`\\b(?!\\()`),C={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{2:`variable.constant`}},{match:[/::/,/class/],scope:{2:`variable.language`}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{1:`title.class`,3:`variable.constant`}},{match:[i,t.concat(`::`,t.lookahead(/(?!class\b)/))],scope:{1:`title.class`}},{match:[i,/::/,/class/],scope:{1:`title.class`,3:`variable.language`}}]},w={scope:`attr`,match:t.concat(r,t.lookahead(`:`),t.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:y,contains:[w,o,C,e.C_BLOCK_COMMENT_MODE,m,h,x]},E={relevance:0,match:[/\b/,t.concat(`(?!fn\\b|function\\b|`,b(_).join(`\\b|`),`|`,b(v).join(`\\b|`),`\\b)`),r,t.concat(p,`*`),t.lookahead(/(?=\()/)],scope:{3:`title.function.invoke`},contains:[T]};T.contains.push(E);let D=[w,C,e.C_BLOCK_COMMENT_MODE,m,h,x],O={begin:t.concat(/#\[\s*\\?/,t.either(i,a)),beginScope:`meta`,end:/]/,endScope:`meta`,keywords:{literal:g,keyword:[`new`,`array`]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:[`new`,`array`]},contains:[`self`,...D]},...D,{scope:`meta`,variants:[{match:i},{match:a}]}]};return{case_insensitive:!1,keywords:y,contains:[O,e.HASH_COMMENT_MODE,e.COMMENT(`//`,`$`),e.COMMENT(`/\\*`,`\\*/`,{contains:[{scope:`doctag`,match:`@[A-Za-z]+`}]}),{match:/__halt_compiler\(\);/,keywords:`__halt_compiler`,starts:{scope:`comment`,end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:`meta`,endsParent:!0}]}},s,{scope:`variable.language`,match:/\$this\b/},o,E,C,{match:[/const/,/\s/,r],scope:{1:`keyword`,3:`variable.constant`}},x,{scope:`function`,relevance:0,beginKeywords:`fn function`,end:/[;{]/,excludeEnd:!0,illegal:`[$%\\[]`,contains:[{beginKeywords:`use`},e.UNDERSCORE_TITLE_MODE,{begin:`=>`,endsParent:!0},{scope:`params`,begin:`\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0,keywords:y,contains:[`self`,O,o,C,e.C_BLOCK_COMMENT_MODE,m,h]}]},{scope:`class`,variants:[{beginKeywords:`enum`,illegal:/[($"]/},{beginKeywords:`class interface trait`,illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:`extends implements`},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:`namespace`,relevance:0,end:`;`,illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:`title.class`})]},{beginKeywords:`use`,relevance:0,end:`;`,contains:[{match:/\b(as|const|function)\b/,scope:`keyword`},e.UNDERSCORE_TITLE_MODE]},m,h]}}function aS(e){return{name:`PHP template`,subLanguage:`xml`,contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:`php`,contains:[{begin:`/\\*`,end:`\\*/`,skip:!0},{begin:`b"`,end:`"`,skip:!0},{begin:`b'`,end:`'`,skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function oS(e){return{name:`Plain text`,aliases:[`text`,`txt`],disableAutodetect:!0}}function sS(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}function cS(e){return{aliases:[`pycon`],contains:[{className:`meta.prompt`,starts:{end:/ |$/,starts:{end:`$`,subLanguage:`python`}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function lS(e){let t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,a=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:`R`,keywords:{$pattern:n,keyword:`function if in break next repeat else for while`,literal:`NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10`,built_in:`LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm`},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:`doctag`,match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:`doctag`,begin:`@param`,end:/$/,contains:[{scope:`variable`,variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:`doctag`,match:/@[a-zA-Z]+/},{scope:`keyword`,match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:`"`,end:`"`,relevance:0},{begin:`'`,end:`'`,relevance:0}]},{relevance:0,variants:[{scope:{1:`operator`,2:`number`},match:[i,r]},{scope:{1:`operator`,2:`number`},match:[/%[^%]*%/,r]},{scope:{1:`punctuation`,2:`number`},match:[a,r]},{scope:{2:`number`},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:`operator`},match:[n,/\s+/,/<-/,/\s+/]},{scope:`operator`,relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:`punctuation`,relevance:0,match:a},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function uS(e){let t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),a={"variable.constant":[`__FILE__`,`__LINE__`,`__ENCODING__`],"variable.language":[`self`,`super`],keyword:`alias.and.begin.BEGIN.break.case.class.defined.do.else.elsif.end.END.ensure.for.if.in.module.next.not.or.redo.require.rescue.retry.return.then.undef.unless.until.when.while.yield.include.extend.prepend.public.private.protected.raise.throw`.split(`.`),built_in:[`proc`,`lambda`,`attr_accessor`,`attr_reader`,`attr_writer`,`define_method`,`private_constant`,`module_function`],literal:[`true`,`false`,`nil`]},o={className:`doctag`,begin:`@[A-Za-z]+`},s={begin:`#<`,end:`>`},c=[e.COMMENT(`#`,`$`,{contains:[o]}),e.COMMENT(`^=begin`,`^=end`,{contains:[o],relevance:10}),e.COMMENT(`^__END__`,e.MATCH_NOTHING_RE)],l={className:`subst`,begin:/#\{/,end:/\}/,keywords:a},u={className:`string`,contains:[e.BACKSLASH_ESCAPE,l],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,l]})]}]},d=`[0-9](_?[0-9])*`,f={className:`number`,relevance:0,variants:[{begin:`\\b([1-9](_?[0-9])*|0)(\\.(${d}))?([eE][+-]?(${d})|r)?i?\\b`},{begin:`\\b0[dD][0-9](_?[0-9])*r?i?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*r?i?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*r?i?\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b`},{begin:`\\b0(_?[0-7])+r?i?\\b`}]},p={variants:[{match:/\(\)/},{className:`params`,begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},m=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:`title.class`,4:`title.class.inherited`},keywords:a},{match:[/(include|extend)\s+/,i],scope:{2:`title.class`},keywords:a},{relevance:0,match:[i,/\.new[. (]/],scope:{1:`title.class`}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`},{relevance:0,match:r,scope:`title.class`},{match:[/def/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[p]},{begin:e.IDENT_RE+`::`},{className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`(!|\\?)?:`,relevance:0},{className:`symbol`,begin:`:(?!\\s)`,contains:[u,{begin:n}],relevance:0},f,{className:`variable`,begin:`(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])`},{className:`params`,begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:`(`+e.RE_STARTERS_RE+`|unless)\\s*`,keywords:`unless`,contains:[{className:`regexp`,contains:[e.BACKSLASH_ESCAPE,l],illegal:/\n/,variants:[{begin:`/`,end:`/[a-z]*`},{begin:/%r\{/,end:/\}[a-z]*/},{begin:`%r\\(`,end:`\\)[a-z]*`},{begin:`%r!`,end:`![a-z]*`},{begin:`%r\\[`,end:`\\][a-z]*`}]}].concat(s,c),relevance:0}].concat(s,c);l.contains=m,p.contains=m;let h=[{begin:/^\s*=>/,starts:{end:`$`,contains:m}},{className:`meta.prompt`,begin:`^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])`,starts:{end:`$`,keywords:a,contains:m}}];return c.unshift(s),{name:`Ruby`,aliases:[`rb`,`gemspec`,`podspec`,`thor`,`irb`],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:`ruby`})].concat(h,c,m)}}function dS(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),a={className:`title.function.invoke`,relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o=`abstract.as.async.await.become.box.break.const.continue.crate.do.dyn.else.enum.extern.false.final.fn.for.if.impl.in.let.loop.macro.match.mod.move.mut.override.priv.pub.ref.return.self.Self.static.struct.super.trait.true.try.type.typeof.union.unsafe.unsized.use.virtual.where.while.yield`.split(`.`),s=[`true`,`false`,`Some`,`None`,`Ok`,`Err`],c=`drop .Copy.Send.Sized.Sync.Drop.Fn.FnMut.FnOnce.ToOwned.Clone.Debug.PartialEq.PartialOrd.Eq.Ord.AsRef.AsMut.Into.From.Default.Iterator.Extend.IntoIterator.DoubleEndedIterator.ExactSizeIterator.SliceConcatExt.ToString.assert!.assert_eq!.bitflags!.bytes!.cfg!.col!.concat!.concat_idents!.debug_assert!.debug_assert_eq!.env!.eprintln!.panic!.file!.format!.format_args!.include_bytes!.include_str!.line!.local_data_key!.module_path!.option_env!.print!.println!.select!.stringify!.try!.unimplemented!.unreachable!.vec!.write!.writeln!.macro_rules!.assert_ne!.debug_assert_ne!`.split(`.`),l=[`i8`,`i16`,`i32`,`i64`,`i128`,`isize`,`u8`,`u16`,`u32`,`u64`,`u128`,`usize`,`f32`,`f64`,`str`,`char`,`bool`,`Box`,`Option`,`Result`,`String`,`Vec`];return{name:`Rust`,aliases:[`rs`],keywords:{$pattern:e.IDENT_RE+`!?`,type:l,keyword:o,literal:s,built_in:c},illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:`symbol`,begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:`string`,variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:`char.escape`,match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:`number`,variants:[{begin:`\\b0b([01_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b0o([0-7_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b0x([A-Fa-f0-9_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)([ui](8|16|32|64|128|size)|f(32|64))?`}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:`keyword`,3:`title.function`}},{className:`meta`,begin:`#!?\\[`,end:`\\]`,contains:[{className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:`keyword`,3:`keyword`,4:`variable`}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:`keyword`,3:`variable`,5:`keyword`}},{begin:[/type/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:e.IDENT_RE+`::`,keywords:{keyword:`Self`,built_in:c,type:l}},{className:`punctuation`,begin:`->`},a]}}var fS=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),pS=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),mS=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),hS=[...pS,...mS],gS=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),_S=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),vS=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),yS=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function bS(e){let t=fS(e),n=vS,r=_S,i=`@[a-z-]+`,a={className:`variable`,begin:`(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b`,relevance:0};return{name:`SCSS`,case_insensitive:!0,illegal:`[=/|']`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:`selector-id`,begin:`#[A-Za-z0-9_-]+`,relevance:0},{className:`selector-class`,begin:`\\.[A-Za-z0-9_-]+`,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-tag`,begin:`\\b(`+hS.join(`|`)+`)\\b`,relevance:0},{className:`selector-pseudo`,begin:`:(`+r.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+n.join(`|`)+`)`},a,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+yS.join(`|`)+`)\\b`},{begin:`\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b`},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,a,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:`@(page|font-face)`,keywords:{$pattern:i,keyword:`@page @font-face`}},{begin:`@`,end:`[{;]`,returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:gS.join(` `)},contains:[{begin:i,className:`keyword`},{begin:/[a-z-]+(?=:)/,className:`attribute`},a,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function xS(e){return{name:`Shell Session`,aliases:[`console`,`shellsession`],contains:[{className:`meta.prompt`,begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:`bash`}}]}}function SS(e){let t=e.regex,n=e.COMMENT(`--`,`$`),r={scope:`string`,variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=[`true`,`false`,`unknown`],o=[`double precision`,`large object`,`with timezone`,`without timezone`],s=`bigint.binary.blob.boolean.char.character.clob.date.dec.decfloat.decimal.float.int.integer.interval.nchar.nclob.national.numeric.real.row.smallint.time.timestamp.varchar.varying.varbinary`.split(`.`),c=[`add`,`asc`,`collation`,`desc`,`final`,`first`,`last`,`view`],l=`abs.acos.all.allocate.alter.and.any.are.array.array_agg.array_max_cardinality.as.asensitive.asin.asymmetric.at.atan.atomic.authorization.avg.begin.begin_frame.begin_partition.between.bigint.binary.blob.boolean.both.by.call.called.cardinality.cascaded.case.cast.ceil.ceiling.char.char_length.character.character_length.check.classifier.clob.close.coalesce.collate.collect.column.commit.condition.connect.constraint.contains.convert.copy.corr.corresponding.cos.cosh.count.covar_pop.covar_samp.create.cross.cube.cume_dist.current.current_catalog.current_date.current_default_transform_group.current_path.current_role.current_row.current_schema.current_time.current_timestamp.current_path.current_role.current_transform_group_for_type.current_user.cursor.cycle.date.day.deallocate.dec.decimal.decfloat.declare.default.define.delete.dense_rank.deref.describe.deterministic.disconnect.distinct.double.drop.dynamic.each.element.else.empty.end.end_frame.end_partition.end-exec.equals.escape.every.except.exec.execute.exists.exp.external.extract.false.fetch.filter.first_value.float.floor.for.foreign.frame_row.free.from.full.function.fusion.get.global.grant.group.grouping.groups.having.hold.hour.identity.in.indicator.initial.inner.inout.insensitive.insert.int.integer.intersect.intersection.interval.into.is.join.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.language.large.last_value.lateral.lead.leading.left.like.like_regex.listagg.ln.local.localtime.localtimestamp.log.log10.lower.match.match_number.match_recognize.matches.max.member.merge.method.min.minute.mod.modifies.module.month.multiset.national.natural.nchar.nclob.new.no.none.normalize.not.nth_value.ntile.null.nullif.numeric.octet_length.occurrences_regex.of.offset.old.omit.on.one.only.open.or.order.out.outer.over.overlaps.overlay.parameter.partition.pattern.per.percent.percent_rank.percentile_cont.percentile_disc.period.portion.position.position_regex.power.precedes.precision.prepare.primary.procedure.ptf.range.rank.reads.real.recursive.ref.references.referencing.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.release.result.return.returns.revoke.right.rollback.rollup.row.row_number.rows.running.savepoint.scope.scroll.search.second.seek.select.sensitive.session_user.set.show.similar.sin.sinh.skip.smallint.some.specific.specifictype.sql.sqlexception.sqlstate.sqlwarning.sqrt.start.static.stddev_pop.stddev_samp.submultiset.subset.substring.substring_regex.succeeds.sum.symmetric.system.system_time.system_user.table.tablesample.tan.tanh.then.time.timestamp.timezone_hour.timezone_minute.to.trailing.translate.translate_regex.translation.treat.trigger.trim.trim_array.true.truncate.uescape.union.unique.unknown.unnest.update.upper.user.using.value.values.value_of.var_pop.var_samp.varbinary.varchar.varying.versioning.when.whenever.where.width_bucket.window.with.within.without.year`.split(`.`),u=`abs.acos.array_agg.asin.atan.avg.cast.ceil.ceiling.coalesce.corr.cos.cosh.count.covar_pop.covar_samp.cume_dist.dense_rank.deref.element.exp.extract.first_value.floor.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.last_value.lead.listagg.ln.log.log10.lower.max.min.mod.nth_value.ntile.nullif.percent_rank.percentile_cont.percentile_disc.position.position_regex.power.rank.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.row_number.sin.sinh.sqrt.stddev_pop.stddev_samp.substring.substring_regex.sum.tan.tanh.translate.translate_regex.treat.trim.trim_array.unnest.upper.value_of.var_pop.var_samp.width_bucket`.split(`.`),d=[`current_catalog`,`current_date`,`current_default_transform_group`,`current_path`,`current_role`,`current_schema`,`current_transform_group_for_type`,`current_user`,`session_user`,`system_time`,`system_user`,`current_time`,`localtime`,`current_timestamp`,`localtimestamp`],f=[`create table`,`insert into`,`primary key`,`foreign key`,`not null`,`alter table`,`add constraint`,`grouping sets`,`on overflow`,`character set`,`respect nulls`,`ignore nulls`,`nulls first`,`nulls last`,`depth first`,`breadth first`],p=u,m=[...l,...c].filter(e=>!u.includes(e)),h={scope:`variable`,match:/@[a-z0-9][a-z0-9_]*/},g={scope:`operator`,match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,`\\s+`))),/\b/)}let y={scope:`keyword`,match:v(f),relevance:0};function b(e,{exceptions:t,when:n}={}){let r=n;return t||=[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:r(e)?`${e}|0`:e)}return{name:`SQL`,case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(m,{when:e=>e.length<3}),literal:a,type:s,built_in:d},contains:[{scope:`type`,match:v(o)},y,_,h,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,g]}}function CS(e){return e?typeof e==`string`?e:e.source:null}function wS(e){return TS(`(?=`,e,`)`)}function TS(...e){return e.map(e=>CS(e)).join(``)}function ES(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function DS(...e){return`(`+(ES(e).capture?``:`?:`)+e.map(e=>CS(e)).join(`|`)+`)`}var OS=e=>TS(/\b/,e,/\w$/.test(e)?/\b/:/\B/),kS=[`Protocol`,`Type`].map(OS),AS=[`init`,`self`].map(OS),jS=[`Any`,`Self`],MS=[`actor`,`any`,`associatedtype`,`async`,`await`,/as\?/,/as!/,`as`,`borrowing`,`break`,`case`,`catch`,`class`,`consume`,`consuming`,`continue`,`convenience`,`copy`,`default`,`defer`,`deinit`,`didSet`,`distributed`,`do`,`dynamic`,`each`,`else`,`enum`,`extension`,`fallthrough`,/fileprivate\(set\)/,`fileprivate`,`final`,`for`,`func`,`get`,`guard`,`if`,`import`,`indirect`,`infix`,/init\?/,/init!/,`inout`,/internal\(set\)/,`internal`,`in`,`is`,`isolated`,`nonisolated`,`lazy`,`let`,`macro`,`mutating`,`nonmutating`,/open\(set\)/,`open`,`operator`,`optional`,`override`,`package`,`postfix`,`precedencegroup`,`prefix`,/private\(set\)/,`private`,`protocol`,/public\(set\)/,`public`,`repeat`,`required`,`rethrows`,`return`,`set`,`some`,`static`,`struct`,`subscript`,`super`,`switch`,`throws`,`throw`,/try\?/,/try!/,`try`,`typealias`,/unowned\(safe\)/,/unowned\(unsafe\)/,`unowned`,`var`,`weak`,`where`,`while`,`willSet`],NS=[`false`,`nil`,`true`],PS=[`assignment`,`associativity`,`higherThan`,`left`,`lowerThan`,`none`,`right`],FS=[`#colorLiteral`,`#column`,`#dsohandle`,`#else`,`#elseif`,`#endif`,`#error`,`#file`,`#fileID`,`#fileLiteral`,`#filePath`,`#function`,`#if`,`#imageLiteral`,`#keyPath`,`#line`,`#selector`,`#sourceLocation`,`#warning`],IS=`abs.all.any.assert.assertionFailure.debugPrint.dump.fatalError.getVaList.isKnownUniquelyReferenced.max.min.numericCast.pointwiseMax.pointwiseMin.precondition.preconditionFailure.print.readLine.repeatElement.sequence.stride.swap.swift_unboxFromSwiftValueWithType.transcode.type.unsafeBitCast.unsafeDowncast.withExtendedLifetime.withUnsafeMutablePointer.withUnsafePointer.withVaList.withoutActuallyEscaping.zip`.split(`.`),LS=DS(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),RS=DS(LS,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),zS=TS(LS,RS,`*`),BS=DS(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),VS=DS(BS,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),HS=TS(BS,VS,`*`),US=TS(/[A-Z]/,VS,`*`),WS=[`attached`,`autoclosure`,TS(/convention\(/,DS(`swift`,`block`,`c`),/\)/),`discardableResult`,`dynamicCallable`,`dynamicMemberLookup`,`escaping`,`freestanding`,`frozen`,`GKInspectable`,`IBAction`,`IBDesignable`,`IBInspectable`,`IBOutlet`,`IBSegueAction`,`inlinable`,`main`,`nonobjc`,`NSApplicationMain`,`NSCopying`,`NSManaged`,TS(/objc\(/,HS,/\)/),`objc`,`objcMembers`,`propertyWrapper`,`requires_stored_property_inits`,`resultBuilder`,`Sendable`,`testable`,`UIApplicationMain`,`unchecked`,`unknown`,`usableFromInline`,`warn_unqualified_access`],GS=[`iOS`,`iOSApplicationExtension`,`macOS`,`macOSApplicationExtension`,`macCatalyst`,`macCatalystApplicationExtension`,`watchOS`,`watchOSApplicationExtension`,`tvOS`,`tvOSApplicationExtension`,`swift`];function KS(e){let t={match:/\s+/,relevance:0},n=e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,DS(...kS,...AS)],className:{2:`keyword`}},a={match:TS(/\./,DS(...MS)),relevance:0},o=MS.filter(e=>typeof e==`string`).concat([`_|0`]),s={variants:[{className:`keyword`,match:DS(...MS.filter(e=>typeof e!=`string`).concat(jS).map(OS),...AS)}]},c={$pattern:DS(/\b\w+/,/#\w+/),keyword:o.concat(FS),literal:NS},l=[i,a,s],u=[{match:TS(/\./,DS(...IS)),relevance:0},{className:`built_in`,match:TS(/\b/,DS(...IS),/(?=\()/)}],d={match:/->/,relevance:0},f=[d,{className:`operator`,relevance:0,variants:[{match:zS},{match:`\\.(\\.|${RS})+`}]}],p=`([0-9]_*)+`,m=`([0-9a-fA-F]_*)+`,h={className:`number`,relevance:0,variants:[{match:`\\b(${p})(\\.(${p}))?([eE][+-]?(${p}))?\\b`},{match:`\\b0x(${m})(\\.(${m}))?([pP][+-]?(${p}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},g=(e=``)=>({className:`subst`,variants:[{match:TS(/\\/,e,/[0\\tnr"']/)},{match:TS(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(e=``)=>({className:`subst`,match:TS(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),v=(e=``)=>({className:`subst`,label:`interpol`,begin:TS(/\\/,e,/\(/),end:/\)/}),y=(e=``)=>({begin:TS(e,/"""/),end:TS(/"""/,e),contains:[g(e),_(e),v(e)]}),b=(e=``)=>({begin:TS(e,/"/),end:TS(/"/,e),contains:[g(e),v(e)]}),x={className:`string`,variants:[y(),y(`#`),y(`##`),y(`###`),b(),b(`#`),b(`##`),b(`###`)]},S=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],C={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:S},w=e=>{let t=TS(e,/\//),n=TS(/\//,e);return{begin:t,end:n,contains:[...S,{scope:`comment`,begin:`#(?!.*${n})`,end:/$/}]}},T={scope:`regexp`,variants:[w(`###`),w(`##`),w(`#`),C]},E={match:TS(/`/,HS,/`/)},D=[E,{className:`variable`,match:/\$\d+/},{className:`variable`,match:`\\$${VS}+`}],O=[{match:/(@|#(un)?)available/,scope:`keyword`,starts:{contains:[{begin:/\(/,end:/\)/,keywords:GS,contains:[...f,h,x]}]}},{scope:`keyword`,match:TS(/@/,DS(...WS),wS(DS(/\(/,/\s+/)))},{scope:`meta`,match:TS(/@/,HS)}],k={match:wS(/\b[A-Z]/),relevance:0,contains:[{className:`type`,match:TS(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,VS,`+`)},{className:`type`,match:US,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:TS(/\s+&\s+/,wS(US)),relevance:0}]},A={begin:/</,end:/>/,keywords:c,contains:[...r,...l,...O,d,k]};k.contains.push(A);let j={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:[`self`,{match:TS(HS,/\s*:/),keywords:`_|0`,relevance:0},...r,T,...l,...u,...f,h,x,...D,...O,k]},M={begin:/</,end:/>/,keywords:`repeat each`,contains:[...r,k]},N={begin:/\(/,end:/\)/,keywords:c,contains:[{begin:DS(wS(TS(HS,/\s*:/)),wS(TS(HS,/\s+/,HS,/\s*:/))),end:/:/,relevance:0,contains:[{className:`keyword`,match:/\b_\b/},{className:`params`,match:HS}]},...r,...l,...f,h,x,...O,k,j],endsParent:!0,illegal:/["']/},P={match:[/(func|macro)/,/\s+/,DS(E.match,HS,zS)],className:{1:`keyword`,3:`title.function`},contains:[M,N,t],illegal:[/\[/,/%/]},F={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:`keyword`},contains:[M,N,t],illegal:/\[|%/},I={match:[/operator/,/\s+/,zS],className:{1:`keyword`,3:`title`}},L={begin:[/precedencegroup/,/\s+/,US],className:{1:`keyword`,3:`title`},contains:[k],keywords:[...PS,...NS],end:/}/},R={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:`keyword`,3:`keyword`,5:`title.function`}},ee={match:[/class\b/,/\s+/,/var\b/],scope:{1:`keyword`,3:`keyword`}},te={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,HS,/\s*/],beginScope:{1:`keyword`,3:`title.class`},keywords:c,contains:[M,...l,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:`title.class.inherited`,match:US},...l],relevance:0}]};for(let e of x.variants){let t=e.contains.find(e=>e.label===`interpol`);t.keywords=c;let n=[...l,...u,...f,h,x,...D];t.contains=[...n,{begin:/\(/,end:/\)/,contains:[`self`,...n]}]}return{name:`Swift`,keywords:c,contains:[...r,P,F,R,ee,te,I,L,{beginKeywords:`import`,end:/$/,contains:[...r],relevance:0},T,...l,...u,...f,h,x,...D,...O,k,j]}}var qS=`[A-Za-z$_][0-9A-Za-z$_]*`,JS=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),YS=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],XS=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),ZS=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],QS=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],$S=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],eC=[].concat(QS,XS,ZS);function tC(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=qS,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:qS,keyword:JS,literal:YS,built_in:eC,"variable.language":$S},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:`[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...XS,...ZS]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...QS,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$[A-Za-z$_][0-9A-Za-z$_]*`,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function nC(e){let t=e.regex,n=tC(e),r=qS,i=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},o={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},c={$pattern:qS,keyword:JS.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:YS,built_in:eC.concat(i),"variable.language":$S},l={className:`meta`,begin:`@[A-Za-z$_][0-9A-Za-z$_]*`},u=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(l);let d=n.contains.find(e=>e.scope===`attr`),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([l,a,o,f]),u(n,`shebang`,e.SHEBANG()),u(n,`use_strict`,s);let p=n.contains.find(e=>e.label===`func.def`);return p.relevance=0,Object.assign(n,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),n}function rC(e){let t=e.regex,n={className:`string`,begin:/"(""|[^/n])"C\b/},r={className:`string`,begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,c={className:`literal`,variants:[{begin:t.concat(/# */,t.either(a,i),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(a,i),/ +/,t.either(o,s),/ *#/)}]},l={className:`number`,relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:`label`,begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:`doctag`,begin:/<\/?/,end:/>/}]}),f=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:`Visual Basic .NET`,aliases:[`vb`],case_insensitive:!0,classNameAliases:{label:`symbol`},keywords:{keyword:`addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield`,built_in:`addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort`,type:`boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort`,literal:`true false nothing`},illegal:`//|\\{|\\}|endif|gosub|variant|wend|^\\$ `,contains:[n,r,c,l,u,d,f,{className:`meta`,begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:`const disable else elseif enable end externalsource if region then`},contains:[f]}]}}function iC(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);return t.contains.push(`self`),{name:`WebAssembly`,keywords:{$pattern:/[\w.]+/,keyword:`anyfunc,block,br,br_if,br_table,call,call_indirect,data,drop,elem,else,end,export,func,global.get,global.set,local.get,local.set,local.tee,get_global,get_local,global,if,import,local,loop,memory,memory.grow,memory.size,module,mut,nop,offset,param,result,return,select,set_global,set_local,start,table,tee_local,then,type,unreachable`.split(`,`)},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:`keyword`,3:`operator`}},{className:`variable`,begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:`punctuation`,relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:`keyword`,3:`title.function`}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:`type`},{className:`keyword`,match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:`number`,relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}}function aC(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:`attr`,begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:`string`,endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,contains:[a,o,c,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/<style(?=\s|>)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:[`css`,`xml`]}},{className:`tag`,begin:/<script(?=\s|>)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:[`javascript`,`handlebars`,`xml`]}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function oC(e){let t=`true false yes no null`,n={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},a={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),s={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},c={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},l={begin:/\{/,end:/\}/,contains:[c],illegal:`\\n`,relevance:0},u={begin:`\\[`,end:`\\]`,contains:[c],illegal:`\\n`,relevance:0},d=[n,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`type`,begin:`!<[\\w#;/?:@&=+$,.~*'()[\\]]+>`},{className:`type`,begin:`![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`type`,begin:`!![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},s,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},l,u,i,a],f=[...d];return f.pop(),f.push(o),c.contains=f,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:d}}var sC={arduino:ix,bash:ax,c:ox,cpp:sx,csharp:cx,css:_x,diff:vx,go:yx,graphql:bx,ini:xx,java:Dx,javascript:Ix,json:Lx,kotlin:Hx,less:Qx,lua:$x,makefile:eS,markdown:tS,objectivec:nS,perl:rS,php:iS,"php-template":aS,plaintext:oS,python:sS,"python-repl":cS,r:lS,ruby:uS,rust:dS,scss:bS,shell:xS,sql:SS,swift:KS,typescript:nC,vbnet:rC,wasm:iC,xml:aC,yaml:oC},cC=s(Ne(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#x27;`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},F={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},I=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},L=I(`//`,`$`),R=I(`/\\*`,`\\*/`),ee=I(`#`,`$`),te=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:{scope:`number`,begin:k,relevance:0},BINARY_NUMBER_RE:k,COMMENT:I,C_BLOCK_COMMENT_MODE:R,C_LINE_COMMENT_MODE:L,C_NUMBER_MODE:{scope:`number`,begin:O,relevance:0},C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:ee,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:D,relevance:0},NUMBER_RE:D,PHRASAL_WORDS_MODE:F,QUOTE_STRING_MODE:P,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:{scope:`title`,begin:T,relevance:0},UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:E,relevance:0}});function ne(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function re(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function ie(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=ne,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function ae(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function oe(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function se(e,t){e.relevance===void 0&&(e.relevance=1)}var ce=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},le=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],ue=`keyword`;function de(e,t,n=ue){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,de(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,fe(n[0],n[1])]})}}function fe(e,t){return t?Number(t):+!pe(e)}function pe(e){return le.includes(e.toLowerCase())}var me={},he=e=>{console.error(e)},ge=(e,...t)=>{console.log(`WARN: ${e}`,...t)},_e=(e,t)=>{me[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),me[`${e}/${t}`]=!0)},ve=Error();function ye(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function be(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw he(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),ve;if(typeof e.beginScope!=`object`||e.beginScope===null)throw he(`beginScope must be object`),ve;ye(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function xe(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw he(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),ve;if(typeof e.endScope!=`object`||e.endScope===null)throw he(`endScope must be object`),ve;ye(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function Se(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Ce(e){Se(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),be(e),xe(e)}function z(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(C(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[re,oe,Ce,ce].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[ie,ae,se].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=de(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return Te(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function we(e){return e?e.endsWithParent||we(e.starts):!1}function Te(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:we(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Ee=`11.11.1`,De=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},Oe=i,ke=a,Ae=Symbol(`nomatch`),je=7,Me=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(ge(s.replace(`{}`,n[1])),ge(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(_e(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),_e(`10.7.0`,`Please use highlight(code, options) instead.
59
+ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};ee(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,ee(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=je&&(F+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(F+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(R=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return Ae;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(F+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}else if(r.type===`end`){let e=C(r);if(e!==Ae)return e}if(r.type===`illegal`&&a===``)return P+=`
60
+ `,1;if(L>1e5&&L>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return P+=a,a.length}let D=N(e);if(!D)throw he(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=z(D),k=``,A=a||O,j={},M=new l.__emitter(l);w();let P=``,F=0,I=0,L=0,R=!1;try{if(D.__emitTokens)D.__emitTokens(n,M);else{for(A.matcher.considerAll();;){L++,R?R=!1:A.matcher.considerAll(),A.matcher.lastIndex=I;let e=A.matcher.exec(n);if(!e)break;let t=E(n.substring(I,e.index),e);I=e.index+t}E(n.substring(I))}return M.finalize(),k=M.toHTML(),{language:e,value:k,relevance:F,illegal:!1,_emitter:M,_top:A}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:Oe(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:I,context:n.slice(I-100,I+100),mode:t.mode,resultSoFar:k},_emitter:M};if(o)return{language:e,value:Oe(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:Oe(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(N).filter(F).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1;if(N(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(ee(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),l.throwUnescapedHTML))throw new De(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),ee(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=ke(l,e)}let E=()=>{k(),_e(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),_e(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let O=!1;function k(){function e(){k()}if(document.readyState===`loading`){O||window.addEventListener(`DOMContentLoaded`,e,!1),O=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function A(n,r){let i=null;try{i=r(e)}catch(e){if(he(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)he(e);else throw e;i=c}i.name||=n,t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&P(i.aliases,{languageName:n})}function j(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function M(){return Object.keys(t)}function N(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function P(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function F(e){let t=N(e);return t&&!t.disableAutodetect}function I(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function L(e){I(e),a.push(e)}function R(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function ee(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function ne(e){return _e(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),_e(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:k,highlightElement:w,highlightBlock:ne,configure:T,initHighlighting:E,initHighlightingOnLoad:D,registerLanguage:A,unregisterLanguage:j,listLanguages:M,getLanguage:N,registerAliases:P,autoDetection:F,inherit:ke,addPlugin:L,removePlugin:R}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Ee,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in te)typeof te[e]==`object`&&n(te[e]);return Object.assign(e,te),e},Ne=Me({});Ne.newInstance=()=>Me({}),t.exports=Ne,Ne.HighlightJS=Ne,Ne.default=Ne}))()).default,lC={},uC=`hljs-`;function dC(e){let t=cC.newInstance();return e&&a(e),{highlight:n,highlightAuto:r,listLanguages:i,register:a,registerAlias:o,registered:s};function n(e,n,r){let i=r||lC,a=typeof i.prefix==`string`?i.prefix:uC;if(!t.getLanguage(e))throw Error("Unknown language: `"+e+"` is not registered");t.configure({__emitter:fC,classPrefix:a});let o=t.highlight(n,{ignoreIllegals:!0,language:e});if(o.errorRaised)throw Error("Could not highlight with `Highlight.js`",{cause:o.errorRaised});let s=o._emitter.root,c=s.data;return c.language=o.language,c.relevance=o.relevance,s}function r(e,r){let a=(r||lC).subset||i(),o=-1,s=0,c;for(;++o<a.length;){let i=a[o];if(!t.getLanguage(i))continue;let l=n(i,e,r);l.data&&l.data.relevance!==void 0&&l.data.relevance>s&&(s=l.data.relevance,c=l)}return c||{type:`root`,children:[],data:{language:void 0,relevance:s}}}function i(){return t.listLanguages()}function a(e,n){if(typeof e==`string`)t.registerLanguage(e,n);else{let n;for(n in e)Object.hasOwn(e,n)&&t.registerLanguage(n,e[n])}}function o(e,n){if(typeof e==`string`)t.registerAliases(typeof n==`string`?n:[...n],{languageName:e});else{let n;for(n in e)if(Object.hasOwn(e,n)){let r=e[n];t.registerAliases(typeof r==`string`?r:[...r],{languageName:n})}}}function s(e){return!!t.getLanguage(e)}}var fC=class{constructor(e){this.options=e,this.root={type:`root`,children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e===``)return;let t=this.stack[this.stack.length-1],n=t.children[t.children.length-1];n&&n.type===`text`?n.value+=e:t.children.push({type:`text`,value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){let n=this.stack[this.stack.length-1],r=e.root.children;t?n.children.push({type:`element`,tagName:`span`,properties:{className:[t]},children:r}):n.children.push(...r)}openNode(e){let t=this,n=e.split(`.`).map(function(e,n){return n?e+`_`.repeat(n):t.options.classPrefix+e}),r=this.stack[this.stack.length-1],i={type:`element`,tagName:`span`,properties:{className:n},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return``}},pC={};function mC(e){let t=e||pC,n=t.aliases,r=t.detect||!1,i=t.languages||sC,a=t.plainText,o=t.prefix,s=t.subset,c=`hljs`,l=dC(i);if(n&&l.registerAlias(n),o){let e=o.indexOf(`-`);c=e===-1?o:o.slice(0,e)}return function(e,t){ky(e,`element`,function(e,n,i){if(e.tagName!==`code`||!i||i.type!==`element`||i.tagName!==`pre`)return;let u=hC(e);if(u===!1||!u&&!r||u&&a&&a.includes(u))return;Array.isArray(e.properties.className)||(e.properties.className=[]),e.properties.className.includes(c)||e.properties.className.unshift(c);let d=qb(e,{whitespace:`pre`}),f;try{f=u?l.highlight(u,d,{prefix:o}):l.highlightAuto(d,{prefix:o,subset:s})}catch(n){let r=n;if(u&&/Unknown language/.test(r.message)){t.message("Cannot highlight as `"+u+"`, it’s not registered",{ancestors:[i,e],cause:r,place:e.position,ruleId:`missing-language`,source:`rehype-highlight`});return}throw r}!u&&f.data&&f.data.language&&e.properties.className.push(`language-`+f.data.language),f.children.length>0&&(e.children=f.children)})}}function hC(e){let t=e.properties.className,n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){let e=String(t[n]);if(e===`no-highlight`||e===`nohighlight`)return!1;!r&&e.slice(0,5)===`lang-`&&(r=e.slice(5)),!r&&e.slice(0,9)===`language-`&&(r=e.slice(9))}return r}var gC=`a.blockquote.br.code.del.em.h1.h2.h3.h4.h5.h6.hr.li.ol.p.pre.span.strong.table.tbody.td.th.thead.tr.ul`.split(`.`);function _C({children:e,label:t}){let n=Vp(e);return n===void 0?(0,V.jsx)(`div`,{className:`message-markdown`,children:(0,V.jsx)(Db,{allowedElements:[...gC],rehypePlugins:[mC],skipHtml:!0,children:e})}):(0,V.jsx)(Kp,{className:`whitespace-pre`,label:`${t} formatted JSON`,value:n})}var vC=typeof window>`u`?B.useEffect:B.useLayoutEffect,yC=new Set([`auto`,`overlay`,`scroll`]),bC=[`keydown`,`pointerdown`,`touchstart`,`wheel`];function xC(e){for(let t=e.parentElement;t&&!(t===document.body||t===document.documentElement);t=t.parentElement)if(yC.has(getComputedStyle(t).overflowY))return t;let t=document.scrollingElement;return t instanceof HTMLElement?t:document.documentElement}function SC(e,t){vC(()=>{let n=e.current;if(!t||!n)return;let r=n.getAttribute(`aria-current`)===`true`?n:n.querySelector(`[aria-current="true"]`);if(!r)return;let i=xC(n),a=i===document.scrollingElement,o=()=>{let e=Number.parseFloat(getComputedStyle(r).scrollMarginTop)||0,t=a?0:i.getBoundingClientRect().top+i.clientTop;return r.getBoundingClientRect().top-(t+e)},s=e=>i.scrollTo({behavior:`instant`,top:i.scrollTop+e});s(o());let c=!0,l=()=>{c=!1},u=typeof ResizeObserver>`u`?void 0:new ResizeObserver(()=>{if(!c)return;let e=o();Math.abs(e)>=.5&&s(e)});for(let e of new Set([r,n,...i.children]))u?.observe(e);for(let e of bC)i.addEventListener(e,l,{passive:!0});return()=>{u?.disconnect();for(let e of bC)i.removeEventListener(e,l)}},[t,e])}var CC=200,wC=`mt-0 max-h-72 whitespace-pre-wrap rounded-none border-0 text-[11px]`,TC=`conversation-focus-highlight`,EC={completed:`text-success`,failed:`text-destructive`,interrupted:`text-warning`,timeout:`text-warning`};function DC({label:e,value:t}){return(0,V.jsx)(Kp,{className:`mt-0 max-h-90 whitespace-pre-wrap rounded-none border-0 text-[11px]`,label:e,value:t})}function OC(e){return e===null||!Number.isFinite(e)?null:e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function kC(e){return e.input===void 0||e.input===null?e.output??``:typeof e.input==`string`?e.input:Up(e.input)}function AC(e){return kC(e).split(`
61
+ `,1)[0]?.trim().slice(0,CC)??``}function jC({status:e}){return e?(0,V.jsxs)(`span`,{className:k(`flex shrink-0 items-center gap-1 text-[9px] uppercase tracking-[.08em]`,EC[e]??`text-subtle`),children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-current`}),e]}):null}function MC({invocation:e}){let t=[[`Call ID`,e.toolCallId],[`Started`,e.startedAt],[`Finished`,e.finishedAt],[`Timing`,e.timingSource]].filter(([,e])=>e!==null);return t.length===0?null:(0,V.jsx)(`dl`,{"aria-label":`${e.name} tool timing`,className:`flex flex-wrap gap-2 px-3.5 py-2`,children:t.map(([e,t])=>(0,V.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,V.jsx)(`dt`,{className:`text-[9px] uppercase text-subtle`,children:e}),(0,V.jsx)(`dd`,{className:`m-0 font-mono text-[10px] text-muted-foreground`,children:t})]},e))})}function NC({children:e,title:t}){return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`m-0 px-3.5 pt-2 text-[9px] font-bold uppercase tracking-[.08em] text-subtle`,children:t}),e]})}function PC({invocation:e,current:t}){let n=OC(e.durationMs),r=AC(e),i=e.input!==void 0&&e.input!==null,a=e.output===null?void 0:Vp(e.output);return(0,V.jsxs)(hi,{"aria-current":t?`true`:void 0,"data-tool-call-id":e.toolCallId??void 0,"data-event-index":e.id.slice(5),className:k(`rounded-[10px] border px-3`,t?TC:`bg-card`),value:e.id,children:[(0,V.jsxs)(gi,{"aria-label":`${e.name} tool details`,className:`items-center gap-2 py-1.5 text-xs text-muted-foreground`,children:[(0,V.jsx)(St,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,V.jsx)(`span`,{className:`shrink-0 font-medium text-foreground`,children:e.name}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[10px] font-normal text-subtle`,children:r}),n?(0,V.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums text-subtle`,children:n}):null,(0,V.jsx)(jC,{status:e.status})]}),(0,V.jsxs)(_i,{className:`-mx-3 border-t p-0`,children:[(0,V.jsx)(MC,{invocation:e}),i?(0,V.jsx)(NC,{title:`Input`,children:(0,V.jsx)(Kp,{className:wC,label:`${e.name} tool input`,value:e.input})}):null,e.output===null?null:(0,V.jsx)(NC,{title:`Output`,children:a===void 0?(0,V.jsx)(`pre`,{"aria-label":`${e.name} tool output`,className:k(`message-json`,wC),children:e.output}):(0,V.jsx)(Kp,{className:wC,label:`${e.name} tool output`,value:a})}),!i&&e.output===null?(0,V.jsxs)(`p`,{className:`m-0 px-3.5 py-2 text-[11px] italic text-muted-foreground`,children:[`This `,e.kind,` event carried no input or output.`]}):null]})]})}var FC=[`inputTokens`,`outputTokens`,`cacheReadTokens`,`cacheWriteTokens`,`costUsd`],IC=e=>FC.some(t=>Object.hasOwn(e,t));function LC({usage:e}){let t=[[`Input`,`inputTokens`,e.inputTokens],[`Output`,`outputTokens`,e.outputTokens],[`Cache read`,`cacheReadTokens`,e.cacheReadTokens],[`Cache write`,`cacheWriteTokens`,e.cacheWriteTokens],[`Cost`,`costUsd`,e.costUsd]].filter(([,t])=>Object.hasOwn(e,t));return t.length===0?null:(0,V.jsx)(`dl`,{"aria-label":`Usage`,className:`mt-4.5 flex flex-wrap gap-2`,children:t.map(([e,t,n])=>(0,V.jsxs)(`div`,{className:`flex gap-1.5 rounded-md bg-muted px-2 py-1`,children:[(0,V.jsx)(`dt`,{className:`text-[9px] uppercase text-subtle`,children:e}),(0,V.jsx)(`dd`,{className:`m-0 text-[10px] text-muted-foreground`,children:n===null?`Not reported`:t===`costUsd`&&typeof n==`number`?`$${n.toFixed(4)}`:n??`Not reported`})]},t))})}function RC({current:e,eventIndex:t,onOpenChange:n,open:r,text:i,value:a}){return(0,V.jsx)(mi,{collapsible:!0,onValueChange:e=>n(e===a),type:`single`,value:r?a:``,children:(0,V.jsxs)(hi,{"aria-current":e?`true`:void 0,className:k(`rounded-[10px] border border-dashed px-3`,e?TC:`bg-card`),"data-event-index":t,value:a,children:[(0,V.jsx)(gi,{className:`py-1.5 text-xs text-muted-foreground`,children:`Reasoning`}),(0,V.jsx)(_i,{className:`whitespace-pre-wrap text-[13px] leading-relaxed text-muted-foreground`,children:i})]})})}var zC=e=>`agent-${e}`,BC=e=>`reasoning-${e}`;function VC(e,t,n,r){let i=(e,t)=>({key:e,kind:`item`,openKey:t});if(t.toolCallId!==void 0){let e=n.find(e=>e.toolCallId===t.toolCallId);return e?i(e.id,e.id):{kind:`turn`}}if(t.eventIndex!==void 0){let r=t.eventIndex,a=n.find(e=>e.eventIndices.includes(r));if(a)return i(a.id,a.id);let o=e.agentEvents?.find(e=>e.index===r);return o?i(zC(r),o.kind===`reasoning`?BC(r):void 0):{kind:`turn`}}return t.part===`end`&&!r?{kind:`turn`}:t.part?{kind:`part`,part:t.part}:{kind:`turn`}}function HC(e,t){let n=t?.kind===`item`?t.openKey:void 0;return n===void 0||e.includes(n)?[...e]:[...e,n]}function UC(e,t){let n=e?.kind===`part`&&e.part===t;return{current:n,props:{"aria-current":n?`true`:void 0}}}function WC(e,t){return[...e.map(e=>({at:e.index,event:e,type:`agent`})),...t.map(e=>({at:e.eventIndices[0]??1/0,invocation:e,type:`tool`}))].sort((e,t)=>e.at-t.at)}function GC({current:e,entries:t,onOpenItemsChange:n,openItems:r}){let i=(e,t)=>n(t?[...r,e]:r.filter(t=>t!==e));return(0,V.jsx)(`section`,{"aria-label":`Agent activity`,className:`my-3`,children:(0,V.jsx)(mi,{className:`space-y-2`,onValueChange:n,type:`multiple`,value:r,children:t.map(t=>t.type===`tool`?(0,V.jsx)(PC,{current:e===t.invocation.id,invocation:t.invocation},t.invocation.id):t.event.kind===`reasoning`?(0,V.jsx)(RC,{current:e===zC(t.event.index),eventIndex:t.event.index,onOpenChange:e=>i(BC(t.event.index),e),open:r.includes(BC(t.event.index)),text:t.event.text,value:BC(t.event.index)},BC(t.event.index)):(0,V.jsx)(`div`,{"aria-current":e===zC(t.event.index)?`true`:void 0,"aria-label":`Agent message`,className:k(`border-l-2 border-primary pl-3`,e===zC(t.event.index)&&TC),"data-event-index":t.event.index,role:`group`,children:(0,V.jsx)(_C,{label:`Agent message`,children:t.event.text})},`message-${t.event.index}`))})})}function KC({author:e,focus:t,turn:n}){let r=(0,B.useRef)(null),i=Ap(n.tools),a=!!n.failureKind||IC(n.usage),o=t?.turnId===n.id,s=o?VC(n,t,i,a):void 0,c=o?JSON.stringify(t):void 0,[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(()=>HC([],s)),[p,m]=(0,B.useState)(c);p!==c&&(m(c),s&&(u(!1),f(e=>HC(e,s)))),SC(r,c);let h=s?.kind===`item`?s.key:void 0,g=UC(s,`prompt`),_=UC(s,`answer`),v=UC(s,`end`),y=Object.keys(n.unknown).length>0,b=n.agentEvents?.length?WC(n.agentEvents,i):null,x=b?.some(e=>e.type===`agent`&&e.event.kind===`reasoning`),S=n.status===`running`;return(0,V.jsxs)(`article`,{ref:r,"data-turn-id":n.id,"aria-current":s?.kind===`turn`?`true`:void 0,"aria-label":`Turn ${n.id} from ${n.harness}`,className:k(`mx-auto mb-10.5 max-w-[850px]`,s?.kind===`turn`&&TC),children:[(0,V.jsxs)(`button`,{className:`mb-2 text-[10px] text-muted-foreground hover:text-foreground`,type:`button`,"aria-expanded":!l,onClick:()=>u(!l),children:[l?`Expand`:`Collapse`,` turn `,n.id]}),(0,V.jsxs)(`div`,{hidden:l,children:[(0,V.jsx)(Lp,{from:`user`,children:(0,V.jsxs)(Rp,{...g.props,className:k(`mb-8 ml-auto max-w-[min(680px,88%)] rounded-[22px_22px_5px_22px] border`,g.current?TC:`bg-popover`,`px-5 py-4.5`),"data-turn-part":`prompt`,children:[(0,V.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[.08em] text-subtle`,children:`You`}),S&&!n.user?(0,V.jsx)(`p`,{className:`text-[13px] italic text-muted-foreground`,children:`The prompt is recorded when this run finishes.`}):(0,V.jsx)(_C,{label:`User message`,children:n.user})]})}),(0,V.jsxs)(Lp,{from:`assistant`,children:[(0,V.jsx)(zp,{...e?.avatar?{src:e.avatar}:{},children:e?e.label.slice(0,2).toUpperCase():`OH`}),(0,V.jsxs)(Rp,{className:`pt-1`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[.08em] text-subtle`,children:[(0,V.jsx)(`span`,{children:e?.label??n.harness}),n.model?(0,V.jsx)(T,{variant:`secondary`,className:`font-medium normal-case tracking-normal`,children:n.model}):null]}),n.reasoning&&!x?(0,V.jsx)(mi,{className:`mt-2.5`,collapsible:!0,type:`single`,children:(0,V.jsxs)(hi,{className:`rounded-[10px] border border-dashed bg-card px-3`,value:`reasoning`,children:[(0,V.jsx)(gi,{className:`text-xs text-muted-foreground`,children:`Reasoning`}),(0,V.jsx)(_i,{className:`whitespace-pre-wrap text-[13px] leading-relaxed text-muted-foreground`,children:n.reasoning})]})}):null,b?(0,V.jsx)(GC,{current:h,entries:b,onOpenItemsChange:f,openItems:d}):i.length>0?(0,V.jsx)(`section`,{"aria-label":`Tool calls`,className:`my-3`,children:(0,V.jsx)(mi,{className:`space-y-1`,type:`multiple`,value:d,onValueChange:f,children:i.map(e=>(0,V.jsx)(PC,{current:h===e.id,invocation:e},e.id))})}):null,(0,V.jsx)(`div`,{..._.props,className:_.current?TC:void 0,"data-turn-part":`answer`,children:n.assistant?(0,V.jsx)(_C,{label:`Assistant message`,children:n.assistant}):S?(0,V.jsx)(`p`,{className:`text-[13px] italic text-muted-foreground`,role:`status`,children:`Still running. Its final answer appears when the run finishes.`}):(0,V.jsx)(`p`,{className:`text-[13px] italic text-muted-foreground`,children:`No assistant text was captured for this run.`})}),a?(0,V.jsxs)(`div`,{...v.props,className:v.current?TC:void 0,"data-turn-part":`end`,children:[n.failureKind?(0,V.jsxs)(`p`,{"aria-label":`Failure: ${n.failureKind}`,className:`border-l-2 border-destructive pl-2.5 text-xs text-destructive`,role:`note`,children:[`Failure: `,n.failureKind]}):null,(0,V.jsx)(LC,{usage:n.usage})]}):null,y?(0,V.jsx)(mi,{className:`mt-2.5`,collapsible:!0,type:`single`,children:(0,V.jsxs)(hi,{className:`rounded-[10px] border bg-card px-3`,value:`unknown`,children:[(0,V.jsx)(gi,{className:`text-xs text-muted-foreground`,children:`Additional upstream data`}),(0,V.jsx)(_i,{className:`-mx-3 border-t p-0`,children:(0,V.jsx)(DC,{label:`Additional upstream data detail`,value:n.unknown})})]})}):null]})]})]})]})}Object.freeze({status:`aborted`});function W(e,t,n){function r(n,r){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r);for(let e in o.prototype)e in n||Object.defineProperty(n,e,{value:o.prototype[e].bind(n)});n._zod.constr=o,n._zod.def=r}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var qC=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},JC=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},YC={};function XC(e){return e&&Object.assign(YC,e),YC}function ZC(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function QC(e,t){return typeof t==`bigint`?t.toString():t}function $C(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function ew(e){return e==null}function tw(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function nw(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var rw=Symbol(`evaluating`);function iw(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==rw)return r===void 0&&(r=rw,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function aw(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ow(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function sw(e){return JSON.stringify(e)}var cw=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function lw(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var uw=$C(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function dw(e){if(lw(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(lw(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function fw(e){return dw(e)?{...e}:Array.isArray(e)?[...e]:e}var pw=new Set([`string`,`number`,`symbol`]);function mw(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function hw(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function G(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function gw(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var _w={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function vw(e,t){let n=e._zod.def;return hw(e,ow(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return aw(this,`shape`,e),e},checks:[]}))}function yw(e,t){let n=e._zod.def;return hw(e,ow(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return aw(this,`shape`,r),r},checks:[]}))}function bw(e,t){if(!dw(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");return hw(e,ow(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return aw(this,`shape`,n),n},checks:[]}))}function xw(e,t){if(!dw(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return hw(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return aw(this,`shape`,n),n},checks:e._zod.def.checks})}function Sw(e,t){return hw(e,ow(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return aw(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Cw(e,t,n){return hw(t,ow(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return aw(this,`shape`,i),i},checks:[]}))}function ww(e,t,n){return hw(t,ow(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return aw(this,`shape`,i),i},checks:[]}))}function Tw(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ew(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Dw(e){return typeof e==`string`?e:e?.message}function Ow(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Dw(e.inst?._zod.def?.error?.(e))??Dw(t?.error?.(e))??Dw(n.customError?.(e))??Dw(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function kw(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Aw(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var jw=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,QC,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Mw=W(`$ZodError`,jw),Nw=W(`$ZodError`,jw,{Parent:Error});function Pw(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Fw(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var Iw=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new qC;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ow(e,a,XC())));throw cw(t,i?.callee),t}return o.value},Lw=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ow(e,a,XC())));throw cw(t,i?.callee),t}return o.value},Rw=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new qC;return a.issues.length?{success:!1,error:new(e??Mw)(a.issues.map(e=>Ow(e,i,XC())))}:{success:!0,data:a.value}},zw=Rw(Nw),Bw=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Ow(e,i,XC())))}:{success:!0,data:a.value}},Vw=Bw(Nw),Hw=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Iw(e)(t,n,i)},Uw=e=>(t,n,r)=>Iw(e)(t,n,r),Ww=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Lw(e)(t,n,i)},Gw=e=>async(t,n,r)=>Lw(e)(t,n,r),Kw=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Rw(e)(t,n,i)},qw=e=>(t,n,r)=>Rw(e)(t,n,r),Jw=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Bw(e)(t,n,i)},Yw=e=>async(t,n,r)=>Bw(e)(t,n,r),Xw=/^[cC][^\s-]{8,}$/,Zw=/^[0-9a-z]+$/,Qw=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$w=/^[0-9a-vA-V]{20}$/,eT=/^[A-Za-z0-9]{27}$/,tT=/^[a-zA-Z0-9_-]{21}$/,nT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,rT=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,iT=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,aT=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,oT=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function sT(){return new RegExp(oT,`u`)}var cT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,lT=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,uT=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,dT=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,pT=/^[A-Za-z0-9_-]*$/,mT=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,hT=/^\+(?:[0-9]){6,14}[0-9]$/,gT=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,_T=RegExp(`^${gT}$`);function vT(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function yT(e){return RegExp(`^${vT(e)}$`)}function bT(e){let t=vT({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${gT}T(?:${r})$`)}var xT=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ST=/^-?\d+$/,CT=/^-?\d+(?:\.\d+)?/,wT=/^(?:true|false)$/i,TT=/^null$/i,ET=/^[^A-Z]*$/,DT=/^[^a-z]*$/,OT=W(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),kT={number:`number`,bigint:`bigint`,object:`date`},AT=W(`$ZodCheckLessThan`,(e,t)=>{OT.init(e,t);let n=kT[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),jT=W(`$ZodCheckGreaterThan`,(e,t)=>{OT.init(e,t);let n=kT[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),MT=W(`$ZodCheckMultipleOf`,(e,t)=>{OT.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):nw(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),NT=W(`$ZodCheckNumberFormat`,(e,t)=>{OT.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=_w[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ST)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inst:e})}}),PT=W(`$ZodCheckMaxLength`,(e,t)=>{var n;OT.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ew(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=kw(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),FT=W(`$ZodCheckMinLength`,(e,t)=>{var n;OT.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ew(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=kw(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),IT=W(`$ZodCheckLengthEquals`,(e,t)=>{var n;OT.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ew(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=kw(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),LT=W(`$ZodCheckStringFormat`,(e,t)=>{var n,r;OT.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),RT=W(`$ZodCheckRegex`,(e,t)=>{LT.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),zT=W(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ET,LT.init(e,t)}),BT=W(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=DT,LT.init(e,t)}),VT=W(`$ZodCheckIncludes`,(e,t)=>{OT.init(e,t);let n=mw(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),HT=W(`$ZodCheckStartsWith`,(e,t)=>{OT.init(e,t);let n=RegExp(`^${mw(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),UT=W(`$ZodCheckEndsWith`,(e,t)=>{OT.init(e,t);let n=RegExp(`.*${mw(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),WT=W(`$ZodCheckOverwrite`,(e,t)=>{OT.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),GT=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
62
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
63
+ `))}},KT={major:4,minor:1,patch:12},qT=W(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=KT;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Tw(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new qC;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Tw(e,t))});else{if(e.issues.length===t)continue;r||=Tw(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Tw(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new qC;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new qC;return o.then(e=>t(e,r,a))}return t(o,r,a)}}e[`~standard`]={validate:t=>{try{let n=zw(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Vw(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}}),JT=W(`$ZodString`,(e,t)=>{qT.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??xT(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),YT=W(`$ZodStringFormat`,(e,t)=>{LT.init(e,t),JT.init(e,t)}),XT=W(`$ZodGUID`,(e,t)=>{t.pattern??=rT,YT.init(e,t)}),ZT=W(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=iT(e)}else t.pattern??=iT();YT.init(e,t)}),QT=W(`$ZodEmail`,(e,t)=>{t.pattern??=aT,YT.init(e,t)}),$T=W(`$ZodURL`,(e,t)=>{YT.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:mT.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),eE=W(`$ZodEmoji`,(e,t)=>{t.pattern??=sT(),YT.init(e,t)}),tE=W(`$ZodNanoID`,(e,t)=>{t.pattern??=tT,YT.init(e,t)}),nE=W(`$ZodCUID`,(e,t)=>{t.pattern??=Xw,YT.init(e,t)}),rE=W(`$ZodCUID2`,(e,t)=>{t.pattern??=Zw,YT.init(e,t)}),iE=W(`$ZodULID`,(e,t)=>{t.pattern??=Qw,YT.init(e,t)}),aE=W(`$ZodXID`,(e,t)=>{t.pattern??=$w,YT.init(e,t)}),oE=W(`$ZodKSUID`,(e,t)=>{t.pattern??=eT,YT.init(e,t)}),sE=W(`$ZodISODateTime`,(e,t)=>{t.pattern??=bT(t),YT.init(e,t)}),cE=W(`$ZodISODate`,(e,t)=>{t.pattern??=_T,YT.init(e,t)}),lE=W(`$ZodISOTime`,(e,t)=>{t.pattern??=yT(t),YT.init(e,t)}),uE=W(`$ZodISODuration`,(e,t)=>{t.pattern??=nT,YT.init(e,t)}),dE=W(`$ZodIPv4`,(e,t)=>{t.pattern??=cT,YT.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv4`})}),fE=W(`$ZodIPv6`,(e,t)=>{t.pattern??=lT,YT.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv6`}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),pE=W(`$ZodCIDRv4`,(e,t)=>{t.pattern??=uT,YT.init(e,t)}),mE=W(`$ZodCIDRv6`,(e,t)=>{t.pattern??=dT,YT.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function hE(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var gE=W(`$ZodBase64`,(e,t)=>{t.pattern??=fT,YT.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64`}),e._zod.check=n=>{hE(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function _E(e){if(!pT.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return hE(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var vE=W(`$ZodBase64URL`,(e,t)=>{t.pattern??=pT,YT.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64url`}),e._zod.check=n=>{_E(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),yE=W(`$ZodE164`,(e,t)=>{t.pattern??=hT,YT.init(e,t)});function bE(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var xE=W(`$ZodJWT`,(e,t)=>{YT.init(e,t),e._zod.check=n=>{bE(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),SE=W(`$ZodNumber`,(e,t)=>{qT.init(e,t),e._zod.pattern=e._zod.bag.pattern??CT,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),CE=W(`$ZodNumber`,(e,t)=>{NT.init(e,t),SE.init(e,t)}),wE=W(`$ZodBoolean`,(e,t)=>{qT.init(e,t),e._zod.pattern=wT,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),TE=W(`$ZodNull`,(e,t)=>{qT.init(e,t),e._zod.pattern=TT,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),EE=W(`$ZodUnknown`,(e,t)=>{qT.init(e,t),e._zod.parse=e=>e}),DE=W(`$ZodNever`,(e,t)=>{qT.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function OE(e,t,n){e.issues.length&&t.issues.push(...Ew(n,e.issues)),t.value[n]=e.value}var kE=W(`$ZodArray`,(e,t)=>{qT.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>OE(t,n,e))):OE(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function AE(e,t,n,r){e.issues.length&&t.issues.push(...Ew(n,e.issues)),e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function jE(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=gw(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ME(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type;for(let i of Object.keys(t)){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>AE(e,n,i,t))):AE(a,n,i,t)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var NE=W(`$ZodObject`,(e,t)=>{if(qT.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=$C(()=>jE(t));iw(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=lw,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e]._zod.run({value:s[e],issues:[]},o);n instanceof Promise?c.push(n.then(n=>AE(n,t,e,s))):AE(n,t,e,s)}return i?ME(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),PE=W(`$ZodObjectJIT`,(e,t)=>{NE.init(e,t);let n=e._zod.parse,r=$C(()=>jE(t)),i=e=>{let t=new GT([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=sw(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let e of n.keys){let n=a[e],r=sw(e);t.write(`const ${n} = ${i(e)};`),t.write(`
64
+ if (${n}.issues.length) {
65
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
66
+ ...iss,
67
+ path: iss.path ? [${r}, ...iss.path] : [${r}]
68
+ })));
69
+ }
70
+
71
+
72
+ if (${n}.value === undefined) {
73
+ if (${r} in input) {
74
+ newResult[${r}] = undefined;
75
+ }
76
+ } else {
77
+ newResult[${r}] = ${n}.value;
78
+ }
79
+
80
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=lw,s=!YC.jitless,c=s&&uw.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?ME([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function FE(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Tw(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ow(e,r,XC())))}),t)}var IE=W(`$ZodUnion`,(e,t)=>{qT.init(e,t),iw(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),iw(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),iw(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),iw(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>tw(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>FE(t,i,e,a)):FE(s,i,e,a)}}),LE=W(`$ZodDiscriminatedUnion`,(e,t)=>{IE.init(e,t);let n=e._zod.parse;iw(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=$C(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!lw(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),RE=W(`$ZodIntersection`,(e,t)=>{qT.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>BE(e,t,n)):BE(e,i,a)}});function zE(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(dw(e)&&dw(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=zE(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=zE(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function BE(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Tw(e))return e;let r=zE(t.value,n.value);if(!r.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}var VE=W(`$ZodRecord`,(e,t)=>{qT.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!dw(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...Ew(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...Ew(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Ow(e,r,XC())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Ew(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Ew(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),HE=W(`$ZodEnum`,(e,t)=>{qT.init(e,t);let n=ZC(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>pw.has(typeof e)).map(e=>typeof e==`string`?mw(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),UE=W(`$ZodLiteral`,(e,t)=>{if(qT.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?mw(e):e?mw(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),WE=W(`$ZodTransform`,(e,t)=>{qT.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new JC(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new qC;return n.value=i,n}});function GE(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var KE=W(`$ZodOptional`,(e,t)=>{qT.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,iw(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),iw(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${tw(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>GE(t,e.value)):GE(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),qE=W(`$ZodNullable`,(e,t)=>{qT.init(e,t),iw(e._zod,`optin`,()=>t.innerType._zod.optin),iw(e._zod,`optout`,()=>t.innerType._zod.optout),iw(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${tw(e.source)}|null)$`):void 0}),iw(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),JE=W(`$ZodDefault`,(e,t)=>{qT.init(e,t),e._zod.optin=`optional`,iw(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>YE(e,t)):YE(r,t)}});function YE(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var XE=W(`$ZodPrefault`,(e,t)=>{qT.init(e,t),e._zod.optin=`optional`,iw(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ZE=W(`$ZodNonOptional`,(e,t)=>{qT.init(e,t),iw(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>QE(t,e)):QE(i,e)}});function QE(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var $E=W(`$ZodCatch`,(e,t)=>{qT.init(e,t),iw(e._zod,`optin`,()=>t.innerType._zod.optin),iw(e._zod,`optout`,()=>t.innerType._zod.optout),iw(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ow(e,n,XC()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ow(e,n,XC()))},input:e.value}),e.issues=[]),e)}}),eD=W(`$ZodPipe`,(e,t)=>{qT.init(e,t),iw(e._zod,`values`,()=>t.in._zod.values),iw(e._zod,`optin`,()=>t.in._zod.optin),iw(e._zod,`optout`,()=>t.out._zod.optout),iw(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>tD(e,t.in,n)):tD(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>tD(e,t.out,n)):tD(r,t.out,n)}});function tD(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var nD=W(`$ZodReadonly`,(e,t)=>{qT.init(e,t),iw(e._zod,`propValues`,()=>t.innerType._zod.propValues),iw(e._zod,`values`,()=>t.innerType._zod.values),iw(e._zod,`optin`,()=>t.innerType._zod.optin),iw(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(rD):rD(r)}});function rD(e){return e.value=Object.freeze(e.value),e}var iD=W(`$ZodLazy`,(e,t)=>{qT.init(e,t),iw(e._zod,`innerType`,()=>t.getter()),iw(e._zod,`pattern`,()=>e._zod.innerType._zod.pattern),iw(e._zod,`propValues`,()=>e._zod.innerType._zod.propValues),iw(e._zod,`optin`,()=>e._zod.innerType._zod.optin??void 0),iw(e._zod,`optout`,()=>e._zod.innerType._zod.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),aD=W(`$ZodCustom`,(e,t)=>{OT.init(e,t),qT.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>oD(t,n,r,e));oD(i,n,r,e)}});function oD(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Aw(e))}}var sD=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function cD(){return new sD}var lD=cD();function uD(e,t){return new e({type:`string`,...G(t)})}function dD(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...G(t)})}function fD(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...G(t)})}function pD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...G(t)})}function mD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...G(t)})}function hD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...G(t)})}function gD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...G(t)})}function _D(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...G(t)})}function vD(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...G(t)})}function yD(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...G(t)})}function bD(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...G(t)})}function xD(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...G(t)})}function SD(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...G(t)})}function CD(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...G(t)})}function wD(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...G(t)})}function TD(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...G(t)})}function ED(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...G(t)})}function DD(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...G(t)})}function OD(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...G(t)})}function kD(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...G(t)})}function AD(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...G(t)})}function jD(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...G(t)})}function MD(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...G(t)})}function ND(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...G(t)})}function PD(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...G(t)})}function FD(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...G(t)})}function ID(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...G(t)})}function LD(e,t){return new e({type:`number`,checks:[],...G(t)})}function RD(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...G(t)})}function zD(e,t){return new e({type:`boolean`,...G(t)})}function BD(e,t){return new e({type:`null`,...G(t)})}function VD(e){return new e({type:`unknown`})}function HD(e,t){return new e({type:`never`,...G(t)})}function UD(e,t){return new AT({check:`less_than`,...G(t),value:e,inclusive:!1})}function WD(e,t){return new AT({check:`less_than`,...G(t),value:e,inclusive:!0})}function GD(e,t){return new jT({check:`greater_than`,...G(t),value:e,inclusive:!1})}function KD(e,t){return new jT({check:`greater_than`,...G(t),value:e,inclusive:!0})}function qD(e,t){return new MT({check:`multiple_of`,...G(t),value:e})}function JD(e,t){return new PT({check:`max_length`,...G(t),maximum:e})}function YD(e,t){return new FT({check:`min_length`,...G(t),minimum:e})}function XD(e,t){return new IT({check:`length_equals`,...G(t),length:e})}function ZD(e,t){return new RT({check:`string_format`,format:`regex`,...G(t),pattern:e})}function QD(e){return new zT({check:`string_format`,format:`lowercase`,...G(e)})}function $D(e){return new BT({check:`string_format`,format:`uppercase`,...G(e)})}function eO(e,t){return new VT({check:`string_format`,format:`includes`,...G(t),includes:e})}function tO(e,t){return new HT({check:`string_format`,format:`starts_with`,...G(t),prefix:e})}function nO(e,t){return new UT({check:`string_format`,format:`ends_with`,...G(t),suffix:e})}function rO(e){return new WT({check:`overwrite`,tx:e})}function iO(e){return rO(t=>t.normalize(e))}function aO(){return rO(e=>e.trim())}function oO(){return rO(e=>e.toLowerCase())}function sO(){return rO(e=>e.toUpperCase())}function cO(e,t,n){return new e({type:`array`,element:t,...G(n)})}function lO(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...G(n)})}function uO(e){let t=dO(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Aw(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Aw(r))}},e(n.value,n)));return t}function dO(e,t){let n=new OT({check:`custom`,...G(t)});return n._zod.check=e,n}var fO=W(`ZodISODateTime`,(e,t)=>{sE.init(e,t),LO.init(e,t)});function pO(e){return ND(fO,e)}var mO=W(`ZodISODate`,(e,t)=>{cE.init(e,t),LO.init(e,t)});function hO(e){return PD(mO,e)}var gO=W(`ZodISOTime`,(e,t)=>{lE.init(e,t),LO.init(e,t)});function _O(e){return FD(gO,e)}var vO=W(`ZodISODuration`,(e,t)=>{uE.init(e,t),LO.init(e,t)});function yO(e){return ID(vO,e)}var bO=(e,t)=>{Mw.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Fw(e,t)},flatten:{value:t=>Pw(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,QC,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,QC,2)}},isEmpty:{get(){return e.issues.length===0}}})};W(`ZodError`,bO);var xO=W(`ZodError`,bO,{Parent:Error}),SO=Iw(xO),CO=Lw(xO),wO=Rw(xO),TO=Bw(xO),EO=Hw(xO),DO=Uw(xO),OO=Ww(xO),kO=Gw(xO),AO=Kw(xO),jO=qw(xO),MO=Jw(xO),NO=Yw(xO),PO=W(`ZodType`,(e,t)=>(qT.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(ow(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]})),e.clone=(t,n)=>hw(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>SO(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>wO(e,t,n),e.parseAsync=async(t,n)=>CO(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>TO(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>EO(e,t,n),e.decode=(t,n)=>DO(e,t,n),e.encodeAsync=async(t,n)=>OO(e,t,n),e.decodeAsync=async(t,n)=>kO(e,t,n),e.safeEncode=(t,n)=>AO(e,t,n),e.safeDecode=(t,n)=>jO(e,t,n),e.safeEncodeAsync=async(t,n)=>MO(e,t,n),e.safeDecodeAsync=async(t,n)=>NO(e,t,n),e.refine=(t,n)=>e.check(Xk(t,n)),e.superRefine=t=>e.check(Zk(t)),e.overwrite=t=>e.check(rO(t)),e.optional=()=>Mk(e),e.nullable=()=>Pk(e),e.nullish=()=>Mk(Pk(e)),e.nonoptional=t=>Bk(e,t),e.array=()=>q(e),e.or=t=>bk([e,t]),e.and=t=>wk(e,t),e.transform=t=>Wk(e,Ak(t)),e.default=t=>Ik(e,t),e.prefault=t=>Rk(e,t),e.catch=t=>Hk(e,t),e.pipe=t=>Wk(e,t),e.readonly=()=>Kk(e),e.describe=t=>{let n=e.clone();return lD.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return lD.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return lD.get(e);let n=e.clone();return lD.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),FO=W(`_ZodString`,(e,t)=>{JT.init(e,t),PO.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(ZD(...t)),e.includes=(...t)=>e.check(eO(...t)),e.startsWith=(...t)=>e.check(tO(...t)),e.endsWith=(...t)=>e.check(nO(...t)),e.min=(...t)=>e.check(YD(...t)),e.max=(...t)=>e.check(JD(...t)),e.length=(...t)=>e.check(XD(...t)),e.nonempty=(...t)=>e.check(YD(1,...t)),e.lowercase=t=>e.check(QD(t)),e.uppercase=t=>e.check($D(t)),e.trim=()=>e.check(aO()),e.normalize=(...t)=>e.check(iO(...t)),e.toLowerCase=()=>e.check(oO()),e.toUpperCase=()=>e.check(sO())}),IO=W(`ZodString`,(e,t)=>{JT.init(e,t),FO.init(e,t),e.email=t=>e.check(dD(RO,t)),e.url=t=>e.check(_D(VO,t)),e.jwt=t=>e.check(MD(rk,t)),e.emoji=t=>e.check(vD(UO,t)),e.guid=t=>e.check(fD(zO,t)),e.uuid=t=>e.check(pD(BO,t)),e.uuidv4=t=>e.check(mD(BO,t)),e.uuidv6=t=>e.check(hD(BO,t)),e.uuidv7=t=>e.check(gD(BO,t)),e.nanoid=t=>e.check(yD(WO,t)),e.guid=t=>e.check(fD(zO,t)),e.cuid=t=>e.check(bD(GO,t)),e.cuid2=t=>e.check(xD(KO,t)),e.ulid=t=>e.check(SD(qO,t)),e.base64=t=>e.check(kD(ek,t)),e.base64url=t=>e.check(AD(tk,t)),e.xid=t=>e.check(CD(JO,t)),e.ksuid=t=>e.check(wD(YO,t)),e.ipv4=t=>e.check(TD(XO,t)),e.ipv6=t=>e.check(ED(ZO,t)),e.cidrv4=t=>e.check(DD(QO,t)),e.cidrv6=t=>e.check(OD($O,t)),e.e164=t=>e.check(jD(nk,t)),e.datetime=t=>e.check(pO(t)),e.date=t=>e.check(hO(t)),e.time=t=>e.check(_O(t)),e.duration=t=>e.check(yO(t))});function K(e){return uD(IO,e)}var LO=W(`ZodStringFormat`,(e,t)=>{YT.init(e,t),FO.init(e,t)}),RO=W(`ZodEmail`,(e,t)=>{QT.init(e,t),LO.init(e,t)}),zO=W(`ZodGUID`,(e,t)=>{XT.init(e,t),LO.init(e,t)}),BO=W(`ZodUUID`,(e,t)=>{ZT.init(e,t),LO.init(e,t)}),VO=W(`ZodURL`,(e,t)=>{$T.init(e,t),LO.init(e,t)});function HO(e){return _D(VO,e)}var UO=W(`ZodEmoji`,(e,t)=>{eE.init(e,t),LO.init(e,t)}),WO=W(`ZodNanoID`,(e,t)=>{tE.init(e,t),LO.init(e,t)}),GO=W(`ZodCUID`,(e,t)=>{nE.init(e,t),LO.init(e,t)}),KO=W(`ZodCUID2`,(e,t)=>{rE.init(e,t),LO.init(e,t)}),qO=W(`ZodULID`,(e,t)=>{iE.init(e,t),LO.init(e,t)}),JO=W(`ZodXID`,(e,t)=>{aE.init(e,t),LO.init(e,t)}),YO=W(`ZodKSUID`,(e,t)=>{oE.init(e,t),LO.init(e,t)}),XO=W(`ZodIPv4`,(e,t)=>{dE.init(e,t),LO.init(e,t)}),ZO=W(`ZodIPv6`,(e,t)=>{fE.init(e,t),LO.init(e,t)}),QO=W(`ZodCIDRv4`,(e,t)=>{pE.init(e,t),LO.init(e,t)}),$O=W(`ZodCIDRv6`,(e,t)=>{mE.init(e,t),LO.init(e,t)}),ek=W(`ZodBase64`,(e,t)=>{gE.init(e,t),LO.init(e,t)}),tk=W(`ZodBase64URL`,(e,t)=>{vE.init(e,t),LO.init(e,t)}),nk=W(`ZodE164`,(e,t)=>{yE.init(e,t),LO.init(e,t)}),rk=W(`ZodJWT`,(e,t)=>{xE.init(e,t),LO.init(e,t)}),ik=W(`ZodNumber`,(e,t)=>{SE.init(e,t),PO.init(e,t),e.gt=(t,n)=>e.check(GD(t,n)),e.gte=(t,n)=>e.check(KD(t,n)),e.min=(t,n)=>e.check(KD(t,n)),e.lt=(t,n)=>e.check(UD(t,n)),e.lte=(t,n)=>e.check(WD(t,n)),e.max=(t,n)=>e.check(WD(t,n)),e.int=t=>e.check(sk(t)),e.safe=t=>e.check(sk(t)),e.positive=t=>e.check(GD(0,t)),e.nonnegative=t=>e.check(KD(0,t)),e.negative=t=>e.check(UD(0,t)),e.nonpositive=t=>e.check(WD(0,t)),e.multipleOf=(t,n)=>e.check(qD(t,n)),e.step=(t,n)=>e.check(qD(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ak(e){return LD(ik,e)}var ok=W(`ZodNumberFormat`,(e,t)=>{CE.init(e,t),ik.init(e,t)});function sk(e){return RD(ok,e)}var ck=W(`ZodBoolean`,(e,t)=>{wE.init(e,t),PO.init(e,t)});function lk(e){return zD(ck,e)}var uk=W(`ZodNull`,(e,t)=>{TE.init(e,t),PO.init(e,t)});function dk(e){return BD(uk,e)}var fk=W(`ZodUnknown`,(e,t)=>{EE.init(e,t),PO.init(e,t)});function pk(){return VD(fk)}var mk=W(`ZodNever`,(e,t)=>{DE.init(e,t),PO.init(e,t)});function hk(e){return HD(mk,e)}var gk=W(`ZodArray`,(e,t)=>{kE.init(e,t),PO.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(YD(t,n)),e.nonempty=t=>e.check(YD(1,t)),e.max=(t,n)=>e.check(JD(t,n)),e.length=(t,n)=>e.check(XD(t,n)),e.unwrap=()=>e.element});function q(e,t){return cO(gk,e,t)}var _k=W(`ZodObject`,(e,t)=>{PE.init(e,t),PO.init(e,t),iw(e,`shape`,()=>t.shape),e.keyof=()=>Y(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:pk()}),e.loose=()=>e.clone({...e._zod.def,catchall:pk()}),e.strict=()=>e.clone({...e._zod.def,catchall:hk()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>bw(e,t),e.safeExtend=t=>xw(e,t),e.merge=t=>Sw(e,t),e.pick=t=>vw(e,t),e.omit=t=>yw(e,t),e.partial=(...t)=>Cw(jk,e,t[0]),e.required=(...t)=>ww(zk,e,t[0])});function vk(e,t){return new _k({type:`object`,shape:e??{},...G(t)})}function J(e,t){return new _k({type:`object`,shape:e,catchall:hk(),...G(t)})}var yk=W(`ZodUnion`,(e,t)=>{IE.init(e,t),PO.init(e,t),e.options=t.options});function bk(e,t){return new yk({type:`union`,options:e,...G(t)})}var xk=W(`ZodDiscriminatedUnion`,(e,t)=>{yk.init(e,t),LE.init(e,t)});function Sk(e,t,n){return new xk({type:`union`,options:t,discriminator:e,...G(n)})}var Ck=W(`ZodIntersection`,(e,t)=>{RE.init(e,t),PO.init(e,t)});function wk(e,t){return new Ck({type:`intersection`,left:e,right:t})}var Tk=W(`ZodRecord`,(e,t)=>{VE.init(e,t),PO.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Ek(e,t,n){return new Tk({type:`record`,keyType:e,valueType:t,...G(n)})}var Dk=W(`ZodEnum`,(e,t)=>{HE.init(e,t),PO.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Dk({...t,checks:[],...G(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Dk({...t,checks:[],...G(r),entries:i})}});function Y(e,t){return new Dk({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...G(t)})}var Ok=W(`ZodLiteral`,(e,t)=>{UE.init(e,t),PO.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function X(e,t){return new Ok({type:`literal`,values:Array.isArray(e)?e:[e],...G(t)})}var kk=W(`ZodTransform`,(e,t)=>{WE.init(e,t),PO.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new JC(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Aw(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Aw(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ak(e){return new kk({type:`transform`,transform:e})}var jk=W(`ZodOptional`,(e,t)=>{KE.init(e,t),PO.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Mk(e){return new jk({type:`optional`,innerType:e})}var Nk=W(`ZodNullable`,(e,t)=>{qE.init(e,t),PO.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Pk(e){return new Nk({type:`nullable`,innerType:e})}var Fk=W(`ZodDefault`,(e,t)=>{JE.init(e,t),PO.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ik(e,t){return new Fk({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():fw(t)}})}var Lk=W(`ZodPrefault`,(e,t)=>{XE.init(e,t),PO.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Rk(e,t){return new Lk({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():fw(t)}})}var zk=W(`ZodNonOptional`,(e,t)=>{ZE.init(e,t),PO.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Bk(e,t){return new zk({type:`nonoptional`,innerType:e,...G(t)})}var Vk=W(`ZodCatch`,(e,t)=>{$E.init(e,t),PO.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Hk(e,t){return new Vk({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Uk=W(`ZodPipe`,(e,t)=>{eD.init(e,t),PO.init(e,t),e.in=t.in,e.out=t.out});function Wk(e,t){return new Uk({type:`pipe`,in:e,out:t})}var Gk=W(`ZodReadonly`,(e,t)=>{nD.init(e,t),PO.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Kk(e){return new Gk({type:`readonly`,innerType:e})}var qk=W(`ZodLazy`,(e,t)=>{iD.init(e,t),PO.init(e,t),e.unwrap=()=>e._zod.def.getter()});function Jk(e){return new qk({type:`lazy`,getter:e})}var Yk=W(`ZodCustom`,(e,t)=>{aD.init(e,t),PO.init(e,t)});function Xk(e,t={}){return lO(Yk,e,t)}function Zk(e){return uO(e)}function Qk(e){let t=Jk(()=>bk([K(e),ak(),lk(),dk(),q(t),Ek(K(),t)]));return t}var $k=Le(),eA=[`urgent`,`high`,`medium`,`low`],tA={urgent:`Critical`,high:`High`,medium:`Medium`,low:`Low`},nA={list:`/api/human-items`,item:e=>`/api/human-items/${encodeURIComponent(e)}`,answers:`/api/human-items/answers`,answer:e=>`/api/human-items/${encodeURIComponent(e)}/answer`,complete:e=>`/api/human-items/${encodeURIComponent(e)}/complete`,dismiss:e=>`/api/human-items/${encodeURIComponent(e)}/dismiss`,reopen:e=>`/api/human-items/${encodeURIComponent(e)}/reopen`,note:e=>`/api/human-items/${encodeURIComponent(e)}/note`},rA=K().nullable(),iA=K().regex(/\S/u),aA=J({session:K(),run:rA,plan:rA}),oA=Sk(`scope`,[J({scope:X(`nothing`)}),J({scope:X(`work`),run:K(),node:K()}),J({scope:X(`plan`),plan:K()}),J({scope:X(`host`)})]),sA=Y([`manager`,`user`]),cA=Sk(`when`,[J({when:X(`time`),at:pO({offset:!0}).optional(),after_seconds:ak().int().min(1).optional(),reason:iA.optional()}),J({when:X(`run`),run:iA,on:Y([`settled`,`ended`]),reason:iA.optional()}),J({when:X(`node`),run:iA,node:iA,reason:iA.optional()}),J({when:X(`check`),command:q(K()).min(1),cwd:K().regex(/^(\/|\\|[A-Za-z]:[\\/])/u).optional(),timeout_seconds:ak().int().min(1).max(60).optional(),interval_seconds:ak().int().min(10).max(86400).optional(),reason:iA.optional()})]).superRefine((e,t)=>{let n=e.when===`time`&&e.at===void 0==(e.after_seconds===void 0)?`a time names exactly one of at and after_seconds`:e.when===`check`&&!/\S/u.test(e.command[0]??``)?`a check's program is not blank`:void 0;n!==void 0&&t.addIssue({code:`custom`,message:n})}),lA=J({actor:K(),on_behalf_of:rA,text:rA,choice:rA.optional(),reason:rA,provenance:sA.optional(),condition:cA.nullable().optional()}),uA=J({id:K().regex(/^[a-z0-9][a-z0-9-]{0,63}$/u),title:K().regex(/^[^\r\n]*\S[^\r\n]*$/u).refine(e=>[...e].length<=80),description:iA});function dA(e,t){let n=e=>JSON.stringify(Object.entries(e).sort(([e],[t])=>e<t?-1:1));return n(e)===n(t)}function fA(e){let t=e.expiry??[];if(t.some(e=>e.when===`time`&&e.after_seconds!==void 0||e.when===`check`&&e.cwd===void 0))return`a stored condition holds its time's at and its check's cwd`;let n=e.resolution,r=n?.condition??void 0;if(e.state!==`expired`)return r===void 0?void 0:`only an expired item's resolution names the condition that held`;if(n!==null)return n.actor===`engine`&&n.on_behalf_of===null&&n.text===null&&(n.choice??null)===null&&(n.provenance??`manager`)===`manager`&&n.reason!==null&&/\S/u.test(n.reason)&&r!==void 0&&t.some(e=>dA(e,r))?void 0:`an expiry is the engine's, with a reason and one of the item's conditions`}function pA(e){let t=fA(e);if(t!==void 0)return t;let{kind:n,state:r,resolution:i}=e,a=e.choices??[];if(n===`task`&&a.length>0)return`choices are only valid on questions`;if(new Set(a.map(({id:e})=>e)).size!==a.length)return`a choice id is repeated`;let o=i?.choice??void 0;if(o!==void 0&&(r!==`answered`||!a.some(({id:e})=>e===o)))return`a resolution's choice is one this answered question offers`;if(n===`question`&&e.approval!==null)return`approval is only valid on tasks`;if(r===`open`)return i===null?void 0:`an open item has no resolution`;if(i===null)return`a resolved item carries its resolution`;if(r===`answered`)return n===`question`&&(i.text===null?o!==void 0:/\S/u.test(i.text))&&i.reason===null?void 0:`an answer is a question's, with a choice or text and no reason`;if(r===`completed`)return n===`task`&&(i.text===null||/\S/u.test(i.text))&&i.reason===null?void 0:`a completion is a task's, with no reason and any comment not blank`;if(r!==`expired`)return i.text===null?void 0:`a dismissal carries no text`}var mA=J({schema_version:X(1),id:K().min(1),dedup_key:K(),kind:Y([`task`,`question`]),title:iA,body:iA,choices:q(uA).max(6).optional(),priority:Y(eA),owner:aA,block:oA,approval:J({board_copy:K(),key:K()}).nullable(),state:Y([`open`,`answered`,`completed`,`dismissed`,`expired`]),resolution:lA.nullable(),tracker:J({task:K(),url:HO()}).nullable(),expiry:q(cA).max(8).optional(),created_at:K(),updated_at:K()}).superRefine((e,t)=>{let n=pA(e);n!==void 0&&t.addIssue({code:`custom`,message:n})}),hA=J({run:K(),node:K(),title:K()}),gA=J({plan:K(),count:ak().int().nonnegative(),preview:q(hA).max(3)}),_A=J({total:ak().int().nonnegative(),plans:q(gA)});function vA(e,t){return!(e.state===`open`&&e.block.scope!==`nothing`)&&(t.total!==0||t.plans.length>0)?`a non-blocking item reports nothing blocked`:new Set(t.plans.map(({plan:e})=>e)).size===t.plans.length?t.plans.some(({count:e,preview:t})=>t.length!==Math.min(e,3))?`a preview is the first three affected steps of its plan`:t.plans.reduce((e,{count:t})=>e+t,0)===t.total?void 0:`the blocked total is the plans' counts`:`a blocked plan appears twice`}var yA=J({available:lk(),reason:rA});function bA({dedup_key:e,block:t,owner:n}){return t.scope===`work`&&e===`run:${t.run}#${t.node}`&&n.run===t.run}function xA(e,{available:t,reason:n}){return(t?n!==null:n===null||!/\S/u.test(n))?`a reopen states a reason exactly when it is unavailable`:e.state===`open`||e.state===`answered`||bA(e)||e.state!==`expired`&&e.resolution?.actor===`engine`?t?`this item's state cannot be reopened`:void 0:t||e.state===`completed`&&e.approval!==null?void 0:`nothing about this item's state refuses a reopen`}var SA=J({condition:ak().int().nonnegative(),last_run_at:iA,outcome:Y([`holds`,`not-yet`,`failed`]),detail:rA}).superRefine(({outcome:e,detail:t},n)=>{e===`failed`!=(t!==null)&&n.addIssue({code:`custom`,message:`a check carries a detail exactly when it failed`})});function CA(e,t){let n=e.expiry??[];return(t??[]).every(({condition:e})=>n[e]?.when===`check`)?void 0:`a check names one of the item's check conditions`}var wA=J({item:mA,blocked:_A,reopen:yA,checks:q(SA).optional()}).superRefine(({item:e,blocked:t,reopen:n,checks:r},i)=>{let a=vA(e,t)??xA(e,n)??CA(e,r);a!==void 0&&i.addIssue({code:`custom`,message:a})});function TA(e){let{blocked:t,nodes:n}=e;if(n.length!==t.total)return`the steps are the blocked total`;if(new Set(n.map(({run:e,node:t})=>`${e}\u0000${t}`)).size!==n.length)return`a blocked step appears twice`;let r=0;for(let{count:e,preview:i}of t.plans){let t=n.slice(r,r+e);if(i.some((e,n)=>t[n]?.run!==e.run||t[n]?.node!==e.node))return`a preview is the first steps of its plan's group`;r+=e}}var EA=J({action:Y([`human-item-raised`,`human-item-answered`,`human-item-completed`,`human-item-dismissed`,`human-item-auto-resolved`,`human-item-reopened`,`human-item-noted`,`human-item-expired`]),at:pO({offset:!0}),actor:iA,on_behalf_of:rA,provenance:sA}),DA=J({item:mA,blocked:_A,nodes:q(hA),reopen:yA,history:q(EA).optional(),checks:q(SA).optional()}).superRefine((e,t)=>{let n=vA(e.item,e.blocked)??xA(e.item,e.reopen)??CA(e.item,e.checks)??TA(e);n!==void 0&&t.addIssue({code:`custom`,message:n})}),OA=J({item:wA,event_id:K()}),kA=Sk(`kind`,[J({kind:X(`unavailable`)}),J({kind:X(`conflict`),reason:K()})]),AA=J({batch:rA.optional(),answered:q(OA),refused:q(J({id:K(),refusal:kA}))}),jA=J({items:q(wA)}),MA=J({kind:Y([`task`,`question`]).nullable().optional(),blocking:lk().nullable().optional(),priority:Y(eA).nullable().optional(),state:Y([`open`,`answered`,`completed`,`dismissed`,`expired`]).nullable().optional(),session:K().nullable().optional(),run:K().nullable().optional(),plan:K().nullable().optional(),host:lk().nullable().optional()}),NA=J({type:X(`human-items`),items:q(wA),detail:DA.nullable()}),PA=ak().finite().nonnegative(),Z=ak().int().nonnegative(),FA=pO({offset:!0}),IA=K().min(1).nullable(),Q=e=>vk(e).catchall(pk()),LA={runs:`/api/v2/runs`,run:e=>`/api/v2/runs/${encodeURIComponent(e)}`,timeline:e=>`/api/v2/runs/${encodeURIComponent(e)}/timeline`,conversation:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/conversations/${encodeURIComponent(t)}`,artifact:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,timelineEvents:e=>`/api/v2/runs/${encodeURIComponent(e)}/timeline/events`,timelineNodeStream:e=>`/api/v2/runs/${encodeURIComponent(e)}/timeline/node-stream`,events:`/api/v2/events`,projects:`/api/v2/projects`,project:e=>`/api/v2/projects/${encodeURIComponent(e)}`,stop:e=>`/api/v2/runs/${encodeURIComponent(e)}/stop`,shutdown:`/api/v2/shutdown`,unwatched:`/api/v2/unwatched`,host:`/api/v2/host`,status:e=>`/api/v2/runs/${encodeURIComponent(e)}/status`,results:e=>`/api/v2/runs/${encodeURIComponent(e)}/results`,goals:`/api/v2/goals`,runGoals:e=>`/api/v2/runs/${encodeURIComponent(e)}/goals`,transcript:e=>`/api/v2/runs/${encodeURIComponent(e)}/transcript`,telemetry:e=>`/api/v2/runs/${encodeURIComponent(e)}/telemetry`,agents:e=>`/api/v2/runs/${encodeURIComponent(e)}/agents`,nodeAgents:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/agents`,projectAgents:e=>`/api/v2/projects/${encodeURIComponent(e)}/agents`,subscriptions:`/api/v2/subscriptions`,subscription:e=>`/api/v2/subscriptions/${encodeURIComponent(e)}`},RA={includeSettled:`include_settled`,includeConversations:`include_conversations`,runId:`run_id`,after:`after`,cursor:`cursor`,limit:`limit`,span:`span`,from:`from`,to:`to`,select:`select`,node:`node`,scope:`scope`,filter:`filter`,until:`until`,timeout:`timeout`,subscription:`subscription`,tick:`tick`},zA={run:`run`,node:`node`},BA=Y([`complete`,`partial`,`legacy`]),VA=Y([`native`,`labelled`,`inferred`]),HA=Q({agent_model_ms:lk(),judge_model_ms:lk(),llmlint_model_ms:lk(),tool_ms:lk()}),UA=PA.nullable(),WA=Z.nullable(),GA=Q({agent_seconds:UA,judge_seconds:UA,llmlint_seconds:UA,gate_seconds:UA,publication_wait_seconds:UA,lock_wait_seconds:UA,setup_seconds:UA,scheduling_seconds:UA,wall_seconds:UA,agent_model_ms:WA,judge_model_ms:WA,llmlint_model_ms:WA,tool_ms:WA,idle_orchestration_ms:WA,unattributed_ms:WA,wall_ms:WA,fractions:Q({agent_model:UA,judge_model:UA,llmlint_model:UA,tool:UA,idle_orchestration:UA,lock_wait:UA,setup:UA,scheduling:UA})}),KA=K().regex(/^[A-Za-z0-9_-]+$/,`a member name: letters, digits, hyphens and underscores`),qA=Y([`agent`,`judge`,`llmlint`]),JA=PA.nullable(),YA=Q({input_tokens:JA,output_tokens:JA,cache_read_tokens:JA,cache_write_tokens:JA,cost_usd:JA}),XA=Q({agent:YA,judge:YA,llmlint:YA,total:YA}),ZA=Q({session_id:K().min(1),history_id:K().min(1).nullable().optional(),role:qA,agent_role:KA.optional(),turn_index:Z.nullable().optional(),started_at:FA.optional(),finished_at:FA.nullable().optional()}),QA=Ek(K(),pk()),$A=Y([`agent`,`gate`,`checks`,`publication`,`timeout`,`provider`,`configuration`,`unknown`]),ej=Y([`agent`,`judge`,`llmlint`]),tj=Y([`quota_at_launch`,`quota_mid_conversation`,`stale_session_resume`,`rate_limit`,`harness_exit`]),nj=Q({side:ej.optional(),harness:K().optional(),variant:K().optional(),identity:K().optional(),cause:tj.optional(),raw_tail:K().optional(),reset_time:K().optional(),missing_session_id:K().optional(),wait_seconds:ak().nonnegative().optional(),failure_kind:K().optional(),structured_error:QA.optional(),judge_unrecorded:lk().optional()}).extend({class:$A,detail:K().optional()}),rj=Q({node:K().min(1),status:K().min(1),outcome:K().min(1).optional(),branch:K().min(1).optional(),comparison_remote:K().min(1).optional(),comparison_base:K().min(1).optional(),checkpoint:K().min(1).optional(),commit:K().min(1).optional(),retry_lineage:QA.optional(),gate_attestation:QA.optional(),failure:nj.optional(),timing:GA.optional(),usage:XA.optional(),sessions:q(ZA),tool_commands:Ek(K(),Z).optional(),turns:Z,lint:Z,timing_quality:BA,linkage_quality:VA,timing_presence:HA}),ij=Q({run_id:K().min(1),state:K().min(1),phase:K().min(1),last_event:IA,last_progress_at:PA.optional(),timing:GA,nodes:q(rj),providers:q(QA).optional(),failure:nj.optional(),check_rollup:QA.optional(),usage:XA,timing_quality:BA,linkage_quality:VA,timing_presence:HA,sources:q(K()),node_work_ms:Q({agent_model_ms:WA,judge_model_ms:WA,llmlint_model_ms:WA,tool_ms:WA,wall_ms:WA}),turns:Z,lint:Z,agent_count:Z.optional()}),aj=Q({schema_version:bk([K(),ak()]).optional(),observed_at:K().optional(),identities:q(QA)}),oj=Q({started_at:FA.optional(),launch_id:K().min(1),launcher:Y([`claude-code`,`codex`,`unknown`]),session_key:K().min(1).optional(),launcher_session_id:K().min(1).optional()}),sj=K().min(1),cj=Q({labels:Ek(K(),K()).optional(),group:K().min(1).optional(),run_id:K().min(1),state:K().min(1),phase:K().min(1),last_event:IA,last_progress_at:PA.optional(),timing_quality:BA,linkage_quality:VA,timing:GA,node_counts:Ek(K(),Z),launch:oj.optional(),project:K().min(1).optional(),project_name:K().min(1).optional(),liveness:sj.optional(),unread_surfaces:Z.optional()}),lj=Q({path:K().min(1),reason:K().min(1)}),uj=Q({api_version:X(2),telemetry_schema_version:X(30),observed_at:FA,runs:q(cj),next_cursor:K().min(1).optional(),unreadable:q(lj).optional(),missing:q(K().min(1)).optional(),provider_health:aj.optional()}),dj=Y([`agent`,`human`,`command`]),fj=Q({id:K().min(1),kind:dj.optional(),persona:K().min(1).optional(),task:K().min(1),deps:q(K().min(1)).optional(),max_turns:Z.positive().optional(),expects_no_diff:lk().optional()}),pj=Q({branch:K().min(1),base_branch:K().min(1),pr_base:K().min(1),checkpoint:K().min(1),completed_steps:q(K()).optional(),pr:K().nullable().optional(),mode:Y([`pause`,`retry`,`continue`]).optional(),attempts:Z.optional()}),mj=Q({branch:K().min(1),repo:K().min(1).optional(),identity:K().min(1).optional(),base_branch:K().min(1).optional(),pr:K().min(1).optional(),pr_base:K().min(1).optional()}),hj=q(K()),gj=fj.extend({task:K().min(1).optional(),repo:K().min(1).optional(),steps:q(fj).min(1).optional(),session:K().min(1).optional(),project_dir:K().min(1).optional(),base_branch:K().min(1).optional(),branch:K().min(1).optional(),title:K().min(1).optional(),verify_cmd:K().min(1).optional(),skip_verify:lk().optional(),verify_via_ci:lk().optional(),merge_policy:Y([`auto`,`direct`,`none`]).optional(),workflow:Y([`local`,`remote`]).optional(),repo_type:Y([`single-owner`,`team`]).optional(),execution_checkout:K().min(1).optional(),stack_bases:q(mj).optional(),resume:pj.optional(),sets:hj.optional(),command:q(K()).min(1).optional(),timeout_seconds:Z.positive().optional()}),_j=gj.superRefine((e,t)=>{e.steps===void 0&&e.task===void 0&&t.addIssue({code:`custom`,path:[`task`],message:"a plan task without `steps` must carry its own `task` prose"})}),vj=Q({gate_log:K().optional(),worker_report:K().optional(),oneharness_session:K().optional()}),yj=Q({id:K().min(1),kind:K().min(1),persona:K().nullable(),status:K().min(1),telemetry:QA.optional(),artifacts:vj.optional()}),bj=Q({ref:K().min(1),task:K(),unblocks:q(K()),unblocks_publication:lk()}),xj=Q({branch:K().min(1),base_branch:K().min(1),pr_base:K(),checkpoint:K().min(1),completed_steps:q(K()),pr:K().nullable(),mode:K().optional()}),Sj=Q({identity:K().min(1),target:K().min(1),style:K().min(1).optional(),version:K().min(1)}),Cj=Q({producer:K().min(1),target:K().min(1)}),wj=Q({path:K().min(1),content:K().optional(),truncated:lk().optional()}),Tj=Q({kind:K().optional(),log:wj.optional(),status:K().optional(),task:K().optional(),unblocks:q(K()).optional(),blocked_by:q(K()).optional(),human_actions:q(bj).optional(),completed:lk().optional(),exit_code:ak().int().nullable().optional(),verdicts:q(pk()).optional(),usage:QA.optional(),telemetry:QA.optional(),repo:K().optional(),branch:K().optional(),commit:K().optional(),base_branch:K().optional(),pr_base:K().optional(),synthetic_stack_base:K().nullable().optional(),stack_bases:q(QA).optional(),repository_type:Y([`single-owner`,`team`]).nullable().optional(),repo_type:Y([`single-owner`,`team`]).nullable().optional(),publication_workflow:Y([`local`,`remote`]).nullable().optional(),workflow:Y([`local`,`remote`]).nullable().optional(),merge_policy:Y([`auto`,`direct`,`none`]).nullable().optional(),outcome:K().optional(),ok:lk().optional(),pr:K().nullable().optional(),release:Sj.nullable().optional(),awaiting:q(Cj).min(1).optional(),detail:K().optional(),follow_ups:K().nullable().optional(),steps:q(yj).optional(),waiting_steps:q(K()).optional(),resume:xj.nullable().optional(),error:K().nullable().optional(),retry_lineage:QA.optional(),deferred_cleanup:q(K()).optional(),artifacts:vj.optional()}),Ej=Q({ok:lk().optional(),state:K().optional(),started_order:q(K()).optional(),results:Ek(K(),Tj).optional(),schema_version:Z.optional()}),Dj=Y([`running`,`done`,`failed`,`waiting`,`parked`,`cancelled`,`complete-but-draft`,`complete-but-held`]),Oj=Y([`pending`,`ready`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`complete-but-draft`,`complete-but-held`,`unknown`]),kj=Q({addressable:lk(),member:K().min(1).optional(),reason:K().min(1).optional()}).superRefine((e,t)=>{e.addressable===(e.reason!==void 0)&&t.addIssue({code:`custom`,path:[`reason`],message:`a reason is carried exactly when there is no turn to address`})}),Aj=Q({id:K().min(1),kind:K(),unblocks:q(K().min(1))}),jj=Q({at:K().min(1),author:K().min(1),command:QA,reason:K(),envelope:Z.optional(),index:Z.optional(),refusal:QA.optional()}),Mj=Q({run_id:K().min(1),plan:Q({tasks:q(_j),schema_version:Z.optional(),concurrency:Z.positive().optional(),name:K().min(1).optional(),goal:Q({id:K().min(1),text:K().min(1)}).optional()}),node_states:Ek(K(),Dj),node_status:Ek(K(),Oj),node_gated_by:Ek(K(),q(K().min(1))),node_control:Ek(K(),kj),node_results:Ek(K(),Tj),decisions:q(Aj),attestations:q(K()),result:Ej.nullable(),last_seq:Z,run_node_sets:hj.optional(),rejected_edits:q(jj).min(1).optional()}),Nj=Mj.superRefine(Pj);function Pj(e,t){let n=new Set(e.plan.tasks.map(e=>e.id)),r=new Set(Object.keys(e.node_status));(n.size!==e.plan.tasks.length||n.size!==r.size||[...n].some(e=>!r.has(e)))&&t.addIssue({code:`custom`,path:[`node_status`],message:`must contain exactly one entry for every plan task`}),Object.entries(e.node_gated_by).find(([e,t])=>!n.has(e)||t.some(e=>!n.has(e)))&&t.addIssue({code:`custom`,path:[`node_gated_by`],message:`must name only nodes in this graph's plan`}),Object.keys(e.node_control).find(t=>e.node_status[t]!==`running`)!==void 0&&t.addIssue({code:`custom`,path:[`node_control`],message:`must name only nodes the run has in flight`})}var Fj=Q({cacheReadTokens:JA.optional(),cacheWriteTokens:JA.optional(),costUsd:JA.optional(),inputTokens:JA.optional(),outputTokens:JA.optional()}),Ij=Q({index:Z,input:pk().optional(),kind:K(),name:K().nullable().optional(),output:K().nullable().optional(),toolCallId:K().min(1).optional(),output_truncated:X(!0).optional(),input_truncated:X(!0).optional()}),Lj=Q({judge:K(),kind:K(),decision:K(),reason:K()}),Rj=Q({agentEvents:q(Q({index:ak().int().nonnegative(),kind:Y([`message`,`reasoning`]),text:K()})).optional(),assistant:K().nullable(),durationMs:JA.optional(),failureKind:K().nullable(),finishedAt:FA.nullable().optional(),harness:K(),id:K(),judges:q(Lj).optional(),model:K().nullable(),modelMs:JA.optional(),reasoning:K().nullable(),startedAt:FA.nullable().optional(),status:K(),timestamp:FA,toolMs:JA.optional(),tools:q(Ij),unknown:QA,usage:Fj,user:K()}),zj=Q({conversation:Q({canContinue:lk(),harnesses:q(K()),id:K().min(1),name:K(),project:K(),startedAt:FA,state:K(),turns:q(Rj)}),attribution:Q({runId:K().optional(),nodeId:K().optional(),stepId:K().optional(),launchId:K().optional(),launcher:Y([`claude-code`,`codex`,`unknown`]).optional(),transportRole:qA,agentRole:KA.optional(),parentConversationId:K().optional(),persona:K().optional(),finishedAt:FA.nullable().optional(),inferred:X(!0).optional(),timing:GA.optional()})}),Bj=Q({node:K().optional(),conversations:q(zj)}),Vj=bk([q(zj),q(Bj).transform(e=>e.flatMap(e=>e.conversations))]),Hj=Q({name:K(),state:K(),status:K().optional(),conclusion:K().optional(),started_at:FA.optional(),completed_at:FA.optional(),required:lk(),requirement:K().optional(),url:K().url().nullable().optional()}),Uj=Q({ok:lk(),output_tail:K(),artifact_id:K().min(1).optional()}),Wj=Q({verification:Q({pre_push_hook:lk().optional(),required_checks:q(K()).optional(),required_checks_status:K().optional(),expected_gate:q(K()).optional(),checks:q(Hj).optional(),records:q(Uj)}),publication:Q({pr_url:K().url().optional(),branch:K().optional(),branch_url:K().url().optional(),merged:lk(),base_branch:K().optional(),commit:K().optional(),commit_url:K().url().optional()}).optional()}),Gj=q(vk({event_id:K().min(1),node:K().min(1),step:K().min(1).optional(),at:ak().finite(),kind:K(),name:K(),detail:K(),description:K(),events:ak().int().nonnegative()})),Kj=Q({telemetry:Q({schema_version:Z,as_of:FA.optional()}).optional(),api_version:X(2),telemetry_schema_version:X(30),observed_at:FA,run:ij.extend({live_activity:Gj.optional()}),graph:Nj.nullable(),conversations:Vj,node_details:Ek(K(),Wj).optional().default({}),launch:oj.optional(),provider_health:aj.optional()}),qj=J({complete:lk(),loading:q(K()),failed:K().optional()}),Jj=J({loading:X(!0)}),Yj=rj.partial({sessions:!0,turns:!0,lint:!0,timing_quality:!0,linkage_quality:!0,timing_presence:!0}),Xj=GA.partial().extend({wall_seconds:UA}),Zj=ij.partial({usage:!0,timing_quality:!0,linkage_quality:!0,timing_presence:!0,sources:!0,node_work_ms:!0,lint:!0}).extend({timing:Xj,nodes:q(Yj),turns:bk([Z,Jj]),live_activity:Gj.optional()}),Qj=Mj.partial({node_states:!0,decisions:!0,attestations:!0}).extend({plan:Q({tasks:q(gj),schema_version:Z.optional(),concurrency:Z.positive().optional(),name:K().min(1).optional(),goal:Q({id:K().min(1),text:K().min(1)}).optional()})}).superRefine(Pj),$j=Kj.extend({run:Zj,graph:Qj.nullable(),conversations:Vj.optional(),progress:qj.optional()}),eM=Y([`conversation`,`gate_log`,`worker_report`,`oneharness_session`,`pr`,`refusal`]),tM=Y([`run`,`node`,`step`,`dispatch`,`verification`,`publication`,`pr-drafting`,`conflict-resolution`,`human-wait`,`rollup`,`queued`]),nM=Y([`starting`,`dispatching`,`deciding`,`surfacing`,`waiting`,`settled`,`finished`]),rM=Q({kind:eM,value:K().min(1)}),iM=Q({delivered:lk(),delivery:Y([`live`,`deferred`]).optional(),reached:Y([`queued`,`worker`,`supervisor`,`judged-with`,`carried`]).optional(),turn:Y([`interrupted`,`turn-end`]).optional(),member:K().min(1).optional(),input_bytes:Z.optional(),reason:K().min(1).optional(),node_id:K().min(1).optional()}).superRefine((e,t)=>{e.delivered&&e.reason!==void 0&&t.addIssue({code:`custom`,path:[`reason`],message:`a delivered redirection carries no reason it did not land`}),e.delivery!==void 0&&e.delivered!==(e.delivery===`live`)&&t.addIssue({code:`custom`,path:[`delivery`],message:"`delivery` is `live` exactly when the running turn took the note"})}),aM=Q({dep:K().min(1),identity:K().min(1).optional(),target:K().min(1).optional(),style:K().min(1).optional(),action:K().min(1).optional(),since:FA.optional(),waited_seconds:Z.optional(),last_answer:K().min(1).optional()}),oM=Q({kind:K().min(1).optional(),message:K().min(1).optional(),source:K().min(1).optional(),blocking:lk().optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a surface record carries at least one recorded fact`})}),sM=Q({id:Z,correlation:K().min(1).optional(),node:K().min(1).optional(),kind:K().min(1).optional(),message:K().min(1).optional(),source:K().min(1).optional(),blocking:lk().optional(),queued_at:FA.optional(),read_at:FA.optional(),replied_at:FA.optional(),reply:Q({author:K().min(1).optional(),message:K().min(1).optional(),completion:lk().optional(),reason:K().min(1).optional(),provenance:K().min(1).optional()}).optional()}),cM=Q({name:K().min(1).optional(),required:lk().optional(),requirement:K().optional(),url:K().nullable().optional(),state:K().min(1).optional(),kind:K().min(1).optional(),base:K().min(1).optional(),awaited:q(K().min(1)).optional(),grace_seconds:ak().nonnegative().optional(),warned:lk().optional(),head:K().min(1).optional(),verdict:K().min(1).optional(),skipped:q(K().min(1)).optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a review record carries at least one recorded fact`})}),lM=Q({identity:K().min(1).optional(),target:K().min(1).optional(),style:K().min(1).optional(),version:K().min(1).optional(),landing_commit:K().min(1).optional(),actor:K().min(1).optional(),superseded:lk().optional(),form:K().min(1).optional(),outcome:K().min(1).optional(),elapsed_ms:Z.optional(),dep:K().min(1).optional(),delivery:K().min(1).optional(),awaiting:q(aM).min(1).optional(),versions:q(Q({identity:K().min(1),target:K().min(1),version:K().min(1)})).min(1).optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a release record carries at least one recorded fact`})}),uM=Q({id:K().min(1),label:K().min(1),order:Z,started_at:FA}),dM=Q({conversation:K().min(1),turn:K().min(1),part:Y([`prompt`,`answer`,`end`]),gap:X(!0).optional()}),fM=Q({id:K().min(1),stream:K().min(1).optional(),seq:Z.optional(),journal_order:Z.optional(),record_id:K().min(1).optional(),persona:K().min(1).optional(),dispatch_id:K().min(1).optional(),dispatch_group:uM.optional(),fields:Ek(K().min(1),Qk()).optional(),kind:K().min(1),at:FA,node_id:K().min(1).optional(),step_id:K().min(1).optional(),status:K().min(1).optional(),author:K().min(1).optional(),redirection:iM.optional(),release:lM.optional(),surface:oM.optional(),surface_id:ak().int().nonnegative().optional(),correlation:K().min(1).optional(),surface_state:sM.optional(),review:cM.optional(),reference:rM.optional(),description:K().optional(),conversation_item:dM.optional(),tool:Q({index:Z,tool_call_id:K().min(1).optional(),turn:K().min(1).optional()}).optional()}),pM=Q({started_at:FA,ended_at:FA}),mM=Q({kind:K().min(1),blocking:q(K().min(1)).min(1).optional(),ahead:q(K().min(1)).min(1).optional(),limit:Z.optional(),reference:K().min(1).optional(),awaiting:q(K().min(1)).min(1).optional()}),hM=Q({id:K().min(1),kind:tM,label:K(),started_at:FA,ended_at:FA.nullable(),events:q(fM),events_total:Z.optional(),parent_id:K().min(1).optional(),node_id:K().min(1).optional(),step_id:K().min(1).optional(),status:K().min(1).optional(),count:Z.optional(),total_duration_ms:Z.optional(),intervals:q(pM).optional(),harness_scope:K().min(1).optional(),dispatch_attempt:K().min(1).optional(),agent_role:KA.optional(),transport_role:qA.optional(),dispatch_id:K().min(1).optional(),dispatch_group:uM.optional(),reference:rM.optional(),conversation_item:dM.optional(),detail:Q({ok:lk().optional(),output_tail:K().optional(),artifact_id:K().optional()}).optional(),phase:nM.optional(),reasons:q(mM).min(1).optional()}).superRefine((e,t)=>{e.reasons!==void 0&&e.kind!==`queued`&&t.addIssue({code:`custom`,path:[`reasons`],message:`only a queued span carries the reasons a node was held`})}),gM=Q({id:K().min(1),kind:eM,content:K(),truncated:lk(),turns:q(Rj).optional(),unavailable:K().optional()}),_M=Q({api_version:X(2),timeline_schema_version:X(18),observed_at:FA,run_id:K().min(1),spans:q(hM),progress:qj.optional()}),vM=fM.extend({span_id:K().min(1)}),yM=Q({rows:q(vM),next_cursor:K().min(1).nullable(),total:Z,span:Q({id:K().min(1)}).optional(),observed_at:FA}),bM=Sk(`kind`,[J({kind:X(`start`),total:Z,split:J({heads_s:ak().nonnegative(),fetch_s:ak().nonnegative(),build_s:ak().nonnegative()})}),J({kind:X(`rows`),rows:q(vM).max(1e3)}),J({kind:X(`end`)}),J({kind:X(`error`),message:K()})]),xM=Q({error:Q({code:K(),message:K()})});Q({schema_version:X(1),launch_id:K().min(1),launcher:Y([`claude-code`,`codex`]),launcher_session_id:K().min(1),started_at:FA,repository_identity:K().min(1)});var SM=Y([`snapshot`,`run.changed`,`conversation.changed`,`activity.changed`,`run.removed`]),CM=QA;function wM(e){let t=e.indexOf(`:`);if(t===-1)return!1;let n=e.slice(0,t),r=e.slice(t+1);return/^[a-z0-9][a-z0-9-]*$/u.test(n)&&r.length>0&&r.length<=128&&!r.startsWith(`.`)&&/^[A-Za-z0-9._-]+$/u.test(r)}var TM=Q({project:K().min(1).nullable(),name:K().min(1).nullable(),last_write_at:PA.nullable(),runs:q(cj),agent_count:Z.optional()}),EM=Q({api_version:X(2),telemetry_schema_version:X(30),observed_at:FA,projects:q(TM),unreadable:q(lj).optional()}),DM=TM.extend({api_version:X(2),telemetry_schema_version:X(30),observed_at:FA}),OM={api_version:X(2),telemetry_schema_version:X(30),observed_at:FA};Y([`manager`,`user`]);var kM=Q({...OM,run_id:K().min(1),stopped:lk(),owner:K().min(1),forced:lk(),teardown:K().min(1)}),AM=Y([`host`]);Y([`host`]);var jM=Y([`delivered`,`no-turn`,`failed`,`not-asked`]),MM=Y([`graceful`,`killed`,`still-running`]),NM=Y([`pushed`,`already-on-origin`,`no-remote`,`refused`]),PM=Q({...OM,scope:AM,root:K(),grace_seconds:Z,forced:lk(),complete:lk(),runs:q(Q({run_id:K().min(1),owner:K().min(1),forced_over_owner:lk(),dispatches:q(Q({node:K().min(1),pid:Z,interrupt:jM,detail:K(),ended:MM,waited_ms:Z})),teardown:K().min(1),branches:q(Q({identity:K(),branch:K(),result:NM,remote:K().nullable(),commit:K().nullable(),detail:K()}))})),not_pushed:q(Q({identity:K(),branch:K()})),not_pushed_unread:K().nullable(),rendered:K()}),FM=Q({...OM,session_key:K().min(1).optional(),reported:q(Q({run:K().min(1),standing:K().min(1),why_not_watched:K()})),unresolved:q(K())}),IM=Q({schema_version:X(1),host:K(),root:K(),root_error:K().nullable(),free_space:q(Q({roots:q(Q({role:K(),path:K().nullable(),measured_at:K().nullable()})),free_bytes:Z.nullable(),total_bytes:Z.nullable(),error:K().nullable()})),dispatches:q(Q({run:K(),node:K(),launcher:K(),age_ms:PA.nullable(),proof:Y([`held`,`unproven`]),unproven:K().nullable()})),gone:q(Q({run:K(),node:K(),reason:K()})),skipped:q(Q({path:K(),reason:K()}))}),LM=Q({...OM,reading:IM.optional(),rendered:K(),unreadable:q(lj).optional()});Q({...OM,run_id:K().min(1),rendered:K()});var RM=Q({...OM,run_id:K().min(1),liveness:sj,unread_surfaces:Q({count:Z,oldest_seconds:PA.nullable()}),node_status:Ek(K(),K().min(1)),summary:K(),rendered:K()});Q({...OM,run_id:K().min(1),node:K().min(1).nullable().optional(),rendered:K()}),Q({...OM,run_id:K().min(1),telemetry:Q({schema_version:Z})});var zM=Q({history_id:K().min(1),harness:K().min(1),variant:K().min(1).optional(),harness_id:K().min(1),started:FA}),BM=Q({history_session:K().min(1),name:K().min(1),history_dir:K().min(1),history_project:K().min(1),history_file:K().min(1),project:K().min(1),started:FA,labels:Ek(K(),K()),runs:q(zM),run_id:K().min(1).optional()}),VM={...OM,sessions:q(BM),skipped:Z},HM=Q({...VM,run_id:K().min(1),node:K().min(1).optional()}),UM=Q({...VM,project:K().min(1)}),WM=K().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u),GM=K().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}:(0|[1-9][0-9]*)$/u),KM=bk([J({type:X(`sidebar`)}),J({type:X(`detail`),run_id:K().min(1),filter:K().min(1).optional()}),J({type:X(`timeline`),run_id:K().min(1),scope:X(`run`),filter:K().min(1).optional()}),J({type:X(`timeline`),run_id:K().min(1),scope:X(`node`),node:K().min(1),filter:K().min(1).optional()}),J({type:X(`human-items`),filter:MA.optional(),item:K().min(1).optional()})]),qM=J({id:K().min(1),name:K(),group:J({project:K(),name:K()}).nullable(),kind:K().nullable(),state:K().min(1),nodes:J({total:Z,done:Z,failed:Z,running:Z}),updated_at:FA,started_at:FA.optional()});Object.keys(qM.shape);var JM=bk([J({type:X(`sidebar`)}),J({type:X(`detail`),run_id:K().min(1),detail:$j}),J({type:X(`timeline`),run_id:K().min(1),scope:X(`run`),detail:$j,timeline:_M}),J({type:X(`timeline`),run_id:K().min(1),scope:X(`node`),node:K().min(1),detail:$j,timeline:_M}),NA]),YM=J({id:GM,sidebar:q(qM).nullable(),visible:JM}),XM=q(bk([K(),Z])),ZM=bk([J({p:XM,v:pk()}),J({p:XM,a:q(pk())}),J({p:XM,d:X(!0)})]),QM={id:GM,base:GM,subscription:WM},$M=Y([`unknown-cursor`,`stale-cursor`,`server-restarted`]),eN=J({...QM,type:X(`reset`),reason:$M,snapshot:YM}),tN=bk([eN,J({...QM,type:X(`sidebar.snapshot`),rows:q(qM)}),J({...QM,type:X(`run.changed`),row:qM}),J({...QM,type:X(`run.removed`),run_id:K().min(1)}),J({...QM,type:X(`detail.patch`),run_id:K().min(1),ops:q(ZM)}),J({...QM,type:X(`timeline.patch`),run_id:K().min(1),scope:X(`run`),ops:q(ZM)}),J({...QM,type:X(`timeline.patch`),run_id:K().min(1),scope:X(`node`),node:K().min(1),ops:q(ZM)}),J({...QM,type:X(`human-items.patch`),ops:q(ZM)})]),nN=[`reset`,`sidebar.snapshot`,`run.changed`,`run.removed`,`detail.patch`,`timeline.patch`,`human-items.patch`],rN=J({subscription:WM,view:KM,initial:bk([J({type:X(`snapshot`),snapshot:YM}),eN])}),iN=`api_version,telemetry_schema_version,observed_at,progress,run.run_id,run.state,run.phase,run.last_event,run.timing.wall_seconds,run.nodes.*.node,run.nodes.*.status,run.nodes.*.outcome,run.nodes.*.failure,run.turns,graph.last_seq,graph.run_id,graph.plan.goal,graph.plan.tasks.*.id,graph.plan.tasks.*.kind,graph.plan.tasks.*.name,graph.plan.tasks.*.deps,graph.plan.tasks.*.repo,graph.plan.tasks.*.steps,graph.node_status,graph.node_gated_by,graph.node_control,graph.result,graph.node_results.*.blocked_by,graph.node_results.*.awaiting,graph.node_results.*.outcome,graph.node_results.*.error,graph.node_results.*.detail,node_details`.split(`,`);function aN(e){let t=new Map;for(let n of e){let e=t;for(let t of n.split(`.`)){let n=e.get(t);n===void 0&&(n=new Map,e.set(t,n)),e=n}}return t}aN(iN),J({code:X(`subscription-unavailable`),reason:Y([`expired`,`server-restarted`,`unknown`])});var oN=class extends Error{constructor(e){super(e),this.name=`PatchError`}};function sN(e,t){let n=e;for(let e of t)n=cN(n,e);return n}function cN(e,t){let n=t.p;if(`a`in t)return uN(e,n,e=>{if(!Array.isArray(e))throw new oN(`an append's path names an array`);return[...e,...t.a]});let r=n.at(-1);if(r===void 0)throw new oN(`the root is never replaced or deleted`);return uN(e,n.slice(0,-1),e=>{if(`v`in t){if(Array.isArray(e)&&typeof r==`number`){if(r>=e.length)throw new oN(`a set replaces an existing element`);let n=[...e];return n[r]=t.v,n}if(lN(e)&&typeof r==`string`)return{...e,[r]:t.v};throw new oN(`a set's path does not match its parent`)}if(lN(e)&&typeof r==`string`){if(!Object.hasOwn(e,r))throw new oN(`a deletion names an existing member`);let t={...e};return delete t[r],t}throw new oN(`a deletion names an object member`)})}function lN(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uN(e,t,n){let[r,...i]=t;if(r===void 0)return n(e);if(Array.isArray(e)&&typeof r==`number`){if(r>=e.length)throw new oN(`an index on the path does not exist`);let t=[...e];return t[r]=uN(e[r],i,n),t}if(lN(e)&&typeof r==`string`){if(!Object.hasOwn(e,r))throw new oN(`a parent on the path does not exist`);return{...e,[r]:uN(e[r],i,n)}}throw new oN(`a path step does not match its parent`)}var dN=(0,B.createContext)({taken:!0});function fN(e){if(e?.landed===void 0)return;let t=zj.safeParse(e.landed.body);return t.success?t.data:void 0}function pN(e,t,n,r){let i=t===void 0||n===void 0?void 0:JSON.stringify([t,n]),a=(0,B.useContext)(dN),[o]=(0,B.useState)(()=>a.taken||a.transcript===void 0?void 0:i===JSON.stringify([a.transcript.runId,a.transcript.conversationId])?a.transcript:void 0),[s,c]=(0,B.useState)(()=>{let e=fN(o);return e===void 0||i===void 0?void 0:{key:i,conversation:e}}),l=(0,B.useRef)({asked:0,shown:0}),u=(0,B.useRef)(s!==void 0);(0,B.useEffect)(()=>{if(i===void 0||t===void 0||n===void 0){l.current.key=void 0;return}let r=l.current,s=o!==void 0&&!a.taken&&i===JSON.stringify([o.runId,o.conversationId])?o:void 0;if(s!==void 0&&(a.taken=!0),s!==void 0&&u.current){u.current=!1,r.key=i;return}r.key!==i&&(r.shown=r.asked),r.key=i,r.asked+=1;let d=r.asked,f=()=>r.key===i&&d>r.shown,p=()=>e.getConversation(t,n);(s===void 0?p():s.read.then(e=>{let t=zj.safeParse(e);return t.success?t.data:p()},p)).then(e=>{f()&&(r.shown=d,c({key:i,conversation:e}))}).catch(e=>{if(!f())return;let t=e instanceof Error?e:Error(String(e));c(e=>e?.key===i&&e.conversation!==void 0?e:{key:i,error:t})})},[e,t,n,i,r,o,a]);let d=s?.key===i?s:void 0;return(0,B.useMemo)(()=>({conversation:d?.conversation,error:d?.error,loading:i!==void 0&&d===void 0}),[d,i])}var mN=1e3;function hN(e){let t=e.lastIndexOf(`:`);return{epoch:e.slice(0,t),seq:BigInt(e.slice(t+1))}}var gN=class{#e;#t;#n;#r;#i;#a;#o;#s;#c=!1;#l=!1;#u=0;#d;#f=()=>{this.#x(),this.#t.onDisconnected?.()};#p=()=>this.#y();#m=()=>this.close(!0);constructor(e,t){this.#e=e,this.#t=t,this.#n=t.view,this.#d=t.paused??!1,globalThis.addEventListener?.(`offline`,this.#f),globalThis.addEventListener?.(`online`,this.#p),globalThis.addEventListener?.(`pagehide`,this.#m);let n=t.initial;if(n===void 0)this.#h({});else{let e=++this.#u;queueMicrotask(()=>{e===this.#u&&!this.#c&&this.#g(n)})}}get view(){return this.#n}change(e){this.#c||EN(e,this.#n)||(this.#n=e,this.#l=!1,this.#x(),this.#h(this.#r===void 0?{}:{replaces:this.#r}))}pause(){this.#d||(this.#d=!0,this.#x())}resume(){this.#d&&(this.#d=!1,this.#y())}close(e=!1){this.#c||(this.#c=!0,this.#u+=1,globalThis.removeEventListener?.(`offline`,this.#f),globalThis.removeEventListener?.(`online`,this.#p),globalThis.removeEventListener?.(`pagehide`,this.#m),this.#x(),this.#r!==void 0&&this.#e.retire(this.#r,e).catch(()=>void 0))}async#h(e){let t=++this.#u,n;try{n=await this.#e.subscribe({view:this.#n,...e})}catch(e){if(t!==this.#u)return;this.#t.onError?.(ON(e));return}if(t!==this.#u||this.#c){this.#e.retire(n.subscription).catch(()=>void 0);return}this.#_(n)}#g(e){let t;try{t=this.#e.parseSubscribed(e)}catch(e){this.#t.onError?.(Error(`The first answer failed contract validation: ${DN(e)}`));return}this.#_(t)}#_(e){let t=TN(this.#n,e);if(t!==void 0){this.#w(Error(`The subscription answered ${t}`));return}this.#r=e.subscription;let n=e.initial;if(n.type===`snapshot`)this.#v(n.snapshot,{kind:`snapshot`});else if(n.subscription!==e.subscription||n.snapshot.id!==n.id){this.#w(Error(`A recreated subscription's reset is not its own snapshot`));return}else this.#v(n.snapshot,{kind:`reset`,reason:n.reason});this.#y()}#v(e,t){this.#i={sidebar:e.sidebar??this.#i?.sidebar,visible:e.visible,applied:e.id},this.#t.onState(this.#i,t)}#y(){if(this.#c||this.#l||this.#d||this.#a!==void 0||this.#r===void 0||this.#i===void 0)return;this.#o!==void 0&&clearTimeout(this.#o),this.#o=void 0;let e=this.#e.url(LA.events);e.searchParams.set(RA.subscription,this.#r),e.searchParams.set(RA.after,this.#i.applied);let t=this.#e.open(e);this.#a=t;let n=!1;this.#s=setTimeout(()=>{this.#a===t&&this.#w(new i(`Opening the live stream`))},S),t.onopen=()=>{this.#b(),n&&this.#t.onConnected?.(),n=!0};for(let e of nN)t.addEventListener(e,n=>{this.#a===t&&n instanceof MessageEvent&&typeof n.data==`string`&&(this.#b(),this.#C(n.data,e,n.lastEventId))});t.onerror=()=>{this.#a===t&&(this.#t.onDisconnected?.(),t.readyState===2&&(this.#a=void 0,this.#o=setTimeout(()=>{this.#o=void 0,!(this.#c||this.#l||this.#i===void 0)&&this.#h({resume:this.#i.applied})},mN)))}}#b(){this.#s!==void 0&&clearTimeout(this.#s),this.#s=void 0}#x(){this.#b(),this.#a?.close(),this.#a=void 0,this.#o!==void 0&&clearTimeout(this.#o),this.#o=void 0}#S(){this.#x(),this.#y()}#C(e,t,n){let r=this.#i;if(r===void 0||this.#l)return;let i;try{i=tN.parse(JSON.parse(e))}catch(e){this.#w(Error(`A frame failed contract validation: ${DN(e)}`));return}if(i.subscription!==this.#r)return;if(i.type!==t||i.id!==n){this.#w(Error(`A frame's SSE event or id is not the frame's own type and id`));return}let a=hN(r.applied),o=hN(i.id);if(o.epoch===a.epoch&&o.seq<=a.seq)return;if(i.type===`reset`){if(i.snapshot.id!==i.id){this.#w(Error(`A reset frame names a snapshot other than itself`));return}let e=wN(this.#n,i.snapshot);if(e!==void 0){this.#w(Error(`A reset frame re-sent ${e}`));return}this.#v(i.snapshot,{kind:`reset`,reason:i.reason});return}if(o.epoch!==a.epoch){this.#w(Error(`A frame names another server's epoch`));return}if(i.base!==r.applied){this.#S();return}let s;try{s={..._N(r,i,this.#n),applied:i.id}}catch(e){this.#w(Error(`A patch could not be applied: ${DN(e)}`));return}this.#i=s,this.#t.onState(s,{kind:`frame`,frame:i})}#w(e){this.#l=!0,this.#x(),this.#t.onError?.(e)}};function _N(e,t,n){switch(t.type){case`sidebar.snapshot`:return{sidebar:t.rows,visible:e.visible};case`run.changed`:{let n=e.sidebar??[],r=n.findIndex(e=>e.id===t.row.id);return{sidebar:r===-1?[...n,t.row]:n.map((e,n)=>n===r?t.row:e),visible:e.visible}}case`run.removed`:return{sidebar:e.sidebar?.filter(e=>e.id!==t.run_id),visible:e.visible};default:return{sidebar:e.sidebar,visible:yN(e.visible,t,n)}}}function vN(e,t,n,r){let i=e.safeParse(sN(t,n));if(!i.success)throw Error(`the patched ${r} failed contract validation`);return i.data}function yN(e,t,n){let r=e=>Error(`a ${t.type} for ${e} this tab does not show`);if(t.type===`human-items.patch`){if(e.type!==`human-items`)throw r(`human items`);let i=vN(NA,e,t.ops,`human items`);if(CN(n,i))throw Error(`a human-items.patch moved its detail to another item`);return i}if(e.type===`sidebar`||e.type===`human-items`||e.run_id!==t.run_id)throw r(`a run`);let i=n=>{if(n.run_id!==e.run_id)throw Error(`a ${t.type} moved its payload to another run`);return n};switch(t.type){case`detail.patch`:return{...e,detail:(()=>{let n=vN($j,e.detail,t.ops,`detail`);return i(n.run),n})()};case`timeline.patch`:if(e.type!==`timeline`||e.scope!==t.scope)throw r(`a timeline`);if(t.scope===`node`&&(e.scope!==`node`||e.node!==t.node))throw r(`a node's timeline`);return{...e,timeline:i(vN(_M,e.timeline,t.ops,`timeline`))}}}function bN(e){return[e.type,e.run_id,e.scope,e.node].join(`\0`)}function xN(e){return Array.isArray(e)?e.map(xN):typeof e==`object`&&e?Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,xN(t)])):e}function SN(e){if(e!==void 0){if(typeof e!=`string`)return JSON.stringify(xN(e));if(!e.startsWith(`{`))return e;try{return JSON.stringify(xN(JSON.parse(e)))}catch{return e}}}function CN(e,t){return t.detail===null?!1:!(`item`in e)||t.detail.item.id!==e.item}function wN(e,t){let n=t.visible;if(bN(n)!==bN(e))return`the state of another view`;if(n.type===`human-items`)return CN(e,n)?`the detail of another item`:void 0;if(n.type!==`sidebar`)return[n.detail.run.run_id,`timeline`in n?n.timeline.run_id:n.run_id].every(e=>e===n.run_id)?void 0:`a payload of another run`}function TN(e,t){if(bN(t.view)!==bN(e))return`another view`;let n=e=>`filter`in e?e.filter:void 0;if(SN(n(t.view))!==SN(n(e)))return`another filter`;let r=e=>`item`in e?e.item:void 0;return r(t.view)===r(e)?wN(e,t.initial.snapshot):`another item`}function EN(e,t){return JSON.stringify(e)===JSON.stringify(t)}function DN(e){return e instanceof Error?e.message:String(e)}function ON(e){return e instanceof Error?e:Error(String(e))}var kN=class extends Error{status;code;constructor(e,t,n,r){super(e,r),this.status=t,this.code=n,this.name=`TelemetryClientError`}},AN=50,jN=class{#e;#t;#n;constructor(e,t={}){this.#e=new URL(e),this.#t=t.fetch??globalThis.fetch,this.#n=t.eventSource}async listRuns(e=!1,t,n=AN){let r=this.#r(LA.runs);return r.searchParams.set(RA.includeSettled,String(e)),r.searchParams.set(RA.limit,String(n)),t!==void 0&&r.searchParams.set(RA.cursor,t),this.#a(r,uj.parse)}async selectRuns(e){if(e.length===0)throw new kN(`Invalid selection`);for(let t of e)if(PN(t,`run ID`),t.includes(`,`))throw new kN(`Invalid run ID`);let t=this.#r(LA.runs);return t.searchParams.set(RA.select,e.join(`,`)),this.#a(t,uj.parse)}async getRun(e,t={}){PN(e,`run ID`);let n=this.#r(LA.run(e));return t.includeConversations!==void 0&&n.searchParams.set(RA.includeConversations,String(t.includeConversations)),t.filter!==void 0&&n.searchParams.set(RA.filter,t.filter),this.#a(n,Kj.parse)}async getTimeline(e,t,n){PN(e,`run ID`);let r=this.#r(LA.timeline(e));return n!==void 0&&r.searchParams.set(RA.filter,n),t===void 0?r.searchParams.set(RA.scope,zA.run):(r.searchParams.set(RA.scope,zA.node),r.searchParams.set(RA.node,t)),this.#a(r,_M.parse)}async getConversation(e,t){return PN(e,`run ID`),PN(t,`conversation ID`),this.#a(this.#r(LA.conversation(e,t)),zj.parse)}async getArtifact(e,t){return PN(e,`run ID`),PN(t,`artifact ID`),this.#a(this.#r(LA.artifact(e,t)),gM.parse)}async getTimelineEvents(e,t){PN(e,`run ID`),t.node!==void 0&&PN(t.node,`node ID`);let n=this.#r(LA.timelineEvents(e));n.searchParams.set(RA.scope,t.scope===`node`&&t.node!==void 0?zA.node:zA.run);for(let[e,r]of[[RA.node,t.node],[RA.span,t.span],[RA.cursor,t.cursor],[RA.from,t.from],[RA.to,t.to],[RA.filter,t.filter],[RA.limit,t.limit===void 0?void 0:String(t.limit)]])r!==void 0&&n.searchParams.set(e,r);return this.#a(n,yM.parse,void 0,`This page of the run's history`)}subscribe(e){e.runId!==void 0&&PN(e.runId,`run ID`),e.after!==void 0&&PN(e.after,`cursor`);let t=this.#r(LA.events);e.runId!==void 0&&t.searchParams.set(RA.runId,e.runId),e.after!==void 0&&t.searchParams.set(RA.after,e.after),e.filter!==void 0&&t.searchParams.set(RA.filter,e.filter);let n=this.#i(t);for(let t of SM.options)n.addEventListener(t,n=>{try{let r=n,i=JSON.parse(r.data),a=t===`snapshot`?uj.parse(i):CM.parse(i);e.onEvent({id:r.lastEventId,event:t,data:a})}catch(t){e.onError?.(t)}});return n.onerror=t=>e.onError?.(t),{close:()=>n.close()}}live(e){return new gN({subscribe:e=>this.createSubscription(e),retire:(e,t)=>this.retireSubscription(e,t),open:e=>this.#i(e),url:e=>this.#r(e),parseSubscribed:e=>rN.parse(e)},e)}async*streamNodeTimeline(e,t,n){PN(e,`run ID`),PN(t,`node ID`);let r=this.#r(LA.timelineNodeStream(e));r.searchParams.set(RA.scope,zA.node),r.searchParams.set(RA.node,t);let i;try{i=await this.#t(r,n===void 0?{}:{signal:n})}catch(e){throw new kN(`Telemetry request failed`,void 0,void 0,{cause:e})}if(!i.ok||i.body===null){let e=await i.json().catch(()=>void 0),t=xM.safeParse(e);throw new kN(t.success?t.data.error.message:`Telemetry request failed with status ${i.status}`,i.status,t.success?t.data.error.code:void 0)}let a=i.body.pipeThrough(new TextDecoderStream).getReader(),o=e=>{try{return bM.parse(JSON.parse(e))}catch(e){throw new kN(`Telemetry response failed contract validation`,i.status,void 0,{cause:e})}},s=``;try{for(;;){let e;try{e=await a.read()}catch(e){throw new kN(`The node's timeline was cut off`,i.status,void 0,{cause:e})}if(e.done)break;s+=e.value;for(let e=s.indexOf(`
81
+ `);e>=0;e=s.indexOf(`
82
+ `)){let t=s.slice(0,e);if(s=s.slice(e+1),t===``)continue;let n=o(t);if(n.kind===`end`)return;if(n.kind===`error`)throw new kN(n.message,i.status,`node_stream_failed`);yield n}}}finally{await a.cancel().catch(()=>void 0)}throw new kN(`The node's timeline ended before its last line`,i.status,`node_stream_cut_off`)}async createSubscription(e){return this.#a(this.#r(LA.subscriptions),rN.parse,NN(`POST`,e),e.view.type===`sidebar`||e.view.type===`human-items`?`The read of this page`:`The read of this run's history`)}async retireSubscription(e,t=!1){PN(e,`subscription ID`);let n;try{n=await this.#t(this.#r(LA.subscription(e)),{method:`DELETE`,...t?{keepalive:t}:{}})}catch(e){throw new kN(`Telemetry request failed`,void 0,void 0,{cause:e})}if(!n.ok&&n.status!==204)throw new kN(`Retiring a subscription failed with status ${n.status}`,n.status)}async listProjects(){return this.#a(this.#r(LA.projects),EM.parse)}async getProject(e){return PN(e,`project ID`),this.#a(this.#r(LA.project(e)),DM.parse)}async stop(e,t=!1){return PN(e,`run ID`),this.#a(this.#r(LA.stop(e)),kM.parse,NN(`POST`,{force:t}))}async listHumanItems(e={}){let t=this.#r(nA.list);for(let[n,r]of Object.entries(e))r!=null&&t.searchParams.set(n,String(r));return this.#a(t,jA.parse)}async getHumanItem(e){return PN(e,`human-item ID`),this.#a(this.#r(nA.item(e)),DA.parse)}async answerHumanItem(e,t){return PN(e,`human-item ID`),this.#a(this.#r(nA.answer(e)),OA.parse,NN(`POST`,typeof t==`string`?{text:t}:t))}async answerHumanItems(e){return this.#a(this.#r(nA.answers),AA.parse,NN(`POST`,{answers:e}))}async completeHumanItem(e){return PN(e,`human-item ID`),this.#a(this.#r(nA.complete(e)),OA.parse,NN(`POST`,{}))}async dismissHumanItem(e,t){return PN(e,`human-item ID`),this.#a(this.#r(nA.dismiss(e)),OA.parse,NN(`POST`,t?.trim()?{reason:t}:{}))}async reopenHumanItem(e){return PN(e,`human-item ID`),this.#a(this.#r(nA.reopen(e)),OA.parse,NN(`POST`,{}))}async noteHumanItem(e,t){return PN(e,`human-item ID`),this.#a(this.#r(nA.note(e)),OA.parse,NN(`POST`,{text:t}))}async shutdown(e,t={}){return this.#a(this.#r(LA.shutdown),PM.parse,NN(`POST`,{scope:e,...MN(t)}))}async unwatched(){return this.#a(this.#r(LA.unwatched),FM.parse)}async host(){return this.#a(this.#r(LA.host),LM.parse)}async getStatus(e){return PN(e,`run ID`),this.#a(this.#r(LA.status(e)),RM.parse)}async getAgents(e){return PN(e,`run ID`),this.#a(this.#r(LA.agents(e)),HM.parse)}async getNodeAgents(e,t){return PN(e,`run ID`),PN(t,`node ID`),this.#a(this.#r(LA.nodeAgents(e,t)),HM.parse)}async getProjectAgents(e){return PN(e,`project ID`),this.#a(this.#r(LA.projectAgents(e)),UM.parse)}#r(e){return new URL(e,this.#e)}#i(e){return(this.#n??(e=>{if(typeof EventSource>`u`)throw new kN(`EventSource is unavailable; provide an eventSource factory`);return new EventSource(e)}))(e.toString())}async#a(e,t,n,r){let a=r===void 0?void 0:new AbortController,o=a===void 0?void 0:setTimeout(()=>a.abort(),S);try{return await this.#o(e,t,{...n,...a===void 0?{}:{signal:a.signal}})}catch(e){throw a?.signal.aborted===!0&&r!==void 0?new kN(new i(r).message,void 0,`deadline`,{cause:e}):e}finally{o!==void 0&&clearTimeout(o)}}async#o(e,t,n){let r;try{r=await this.#t(e,n)}catch(e){throw new kN(`Telemetry request failed`,void 0,void 0,{cause:e})}let i=await r.json().catch(e=>{throw r.ok?new kN(`Telemetry server returned invalid JSON`,r.status,void 0,{cause:e}):new kN(`Telemetry request failed with status ${r.status}`,r.status,void 0,{cause:e})});if(!r.ok){let e=xM.safeParse(i);throw new kN(e.success?e.data.error.message:`Telemetry request failed with status ${r.status}`,r.status,e.success?e.data.error.code:void 0)}try{return t(i)}catch(e){throw new kN(`Telemetry response failed contract validation`,r.status,void 0,{cause:e})}}};function MN(e){let{grace:t,force:n=!1}=e;if(t===void 0)return{force:n};if(!Number.isSafeInteger(t)||t<0)throw new kN(`Invalid grace: whole seconds, 0 or more`);return{grace:t,force:n}}function NN(e,t){return{method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)}}function PN(e,t){let n=[...e].some(e=>e.charCodeAt(0)<32);if(e.length===0||n||/[/?#]/u.test(e))throw new kN(`Invalid ${t}`)}function FN({outcome:t,label:n}){if(t===void 0)return null;if(t.kind===`refused`){let r=t.error,i=r instanceof kN?r.code:void 0,a=r instanceof kN?r.status:void 0;return(0,V.jsxs)(yi,{"aria-label":`${n} refused`,variant:`destructive`,children:[(0,V.jsx)(e,{}),(0,V.jsxs)(bi,{children:[t.title,a!==void 0&&` · ${a}`,i!==void 0&&` ${i}`]}),(0,V.jsx)(xi,{children:(0,V.jsx)(`pre`,{className:`verb-text`,children:r.message})})]})}return(0,V.jsxs)(yi,{"aria-label":`${n} receipt`,children:[(0,V.jsx)(Ke,{}),(0,V.jsx)(bi,{children:t.title}),(0,V.jsx)(xi,{children:(0,V.jsx)(`pre`,{className:`verb-text`,children:JSON.stringify(t.payload,null,2)})})]})}async function IN(e,t){try{return{kind:`answered`,title:e,payload:await t()}}catch(t){return{kind:`refused`,title:e,error:t instanceof Error?t:Error(String(t))}}}var LN={Complete:Ke,Failed:$e,Stopped:dt,Unfinished:Qe,"Waiting on you":rt,"Driver dead":Ct,Idle:Xe,Running:ot},RN=e=>e.toLowerCase().replaceAll(/[^a-z]+/gu,`-`);function zN({state:e,large:t=!1}){let n=e.known?LN[e.word]:qe,r=t?16:13;return(0,V.jsxs)(`span`,{className:`run-state-group`,"data-large":t,children:[(0,V.jsxs)(`span`,{"aria-label":`Run state`,className:`run-state`,"data-run-state":e.known?RN(e.word):`unknown`,role:`group`,title:e.word,children:[(0,V.jsx)(n,{"aria-label":e.word,role:`img`,size:r}),(0,V.jsx)(`span`,{"aria-hidden":`true`,children:e.word})]}),e.failed>0&&(0,V.jsxs)(`span`,{className:`run-failures`,title:`${e.failed} failed nodes`,children:[(0,V.jsx)($e,{"aria-hidden":`true`,size:r}),e.failed,` failed`]})]})}function BN(e,t,n){let[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)();return{run:(0,B.useCallback)(async(...r)=>{i(!0);let a=await IN(typeof e==`string`?e:e(...r),()=>t(...r));return o(a),i(!1),a.kind===`answered`&&n?.(),a},[e,t,n]),pending:r,outcome:a}}function VN(e){return/\[[^\]]+\]/.exec(e)?.[0]}function HN({runId:e,control:t,ended:n,state:r}){let{stop:i,stopOpen:a,setStopOpen:o,forceOpen:s,setForceOpen:c,refusal:l}=UN(t),u=l===void 0?void 0:VN(l.message),d=i.outcome,f=i.pending;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`run-actions`,children:[r!==void 0&&(0,V.jsx)(`span`,{className:`run-actions-badge`,children:(0,V.jsx)(zN,{state:r})}),!n&&(0,V.jsxs)(Wi,{"aria-label":`Stop`,disabled:f,onClick:()=>o(!0),size:`sm`,title:`Stop`,type:`button`,variant:`destructive`,children:[(0,V.jsx)(pt,{size:14}),(0,V.jsx)(`span`,{className:`run-action-label`,children:`Stop`})]})]}),(0,V.jsx)(Es,{onOpenChange:o,open:a,children:(0,V.jsxs)(As,{children:[(0,V.jsxs)(js,{children:[(0,V.jsxs)(Ns,{children:[`Stop `,e,`?`]}),(0,V.jsx)(Ps,{children:`The run is stopped as the acting session. A run another session owns is refused, naming its owner.`})]}),(0,V.jsxs)(Ms,{children:[(0,V.jsx)(Os,{asChild:!0,children:(0,V.jsx)(Wi,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,V.jsx)(Wi,{disabled:f,onClick:()=>void i.run(!1),type:`button`,variant:`destructive`,children:`Stop run`})]})]})}),(0,V.jsx)(Es,{onOpenChange:c,open:s,children:(0,V.jsxs)(As,{children:[(0,V.jsxs)(js,{children:[(0,V.jsxs)(Ns,{children:[`Force-stop `,e,u!==void 0&&`, overriding ${u}`,`?`]}),(0,V.jsxs)(Ps,{children:[l?.message,` — `,`a forced stop is journalled forced with the owner it overrode.`]})]}),(0,V.jsxs)(Ms,{children:[(0,V.jsx)(Os,{asChild:!0,children:(0,V.jsx)(Wi,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,V.jsxs)(Wi,{disabled:f,onClick:()=>void i.run(!0),type:`button`,variant:`destructive`,children:[`Force stop`,u!==void 0&&`, overriding ${u}`]})]})]})}),d!==void 0&&(0,V.jsxs)(`div`,{className:`run-outcomes`,children:[(0,V.jsx)(FN,{label:`Stop`,outcome:d}),l!==void 0&&(0,V.jsx)(`div`,{className:`composer-actions`,children:(0,V.jsx)(Wi,{onClick:()=>c(!0),size:`sm`,type:`button`,variant:`destructive`,children:`Force stop…`})})]})]})}function UN(e){let[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(!1),a=BN(e=>e?`Forced stop`:`Stop`,(0,B.useCallback)(async t=>{try{return await e.stop(t)}finally{n(!1),i(!1)}},[e.stop]));return{stop:a,stopOpen:t,setStopOpen:n,forceOpen:r,setForceOpen:i,refusal:a.outcome?.kind===`refused`&&a.outcome.error instanceof kN&&a.outcome.error.code===`not_owner`?a.outcome.error:void 0}}function WN(e,t,n){let[r,i]=(0,B.useState)({}),a=(0,B.useRef)({key:e});(0,B.useEffect)(()=>{a.current.key=e},[e]),(0,B.useEffect)(()=>{if(e===void 0)return;let n=a.current.out;if(n?.key===e){n.again=!0;return}let r=()=>{let n={key:e,again:!1};a.current.out=n;let o=t=>{a.current.out===n&&(a.current.out=void 0),a.current.key===e&&(t(),n.again&&r())};t().then(t=>o(()=>i({key:e,value:t}))).catch(t=>o(()=>i(n=>({...n.key===e?n:{},key:e,error:GN(t)}))))};r()},[e,n]);let o=r.key===e?r:void 0;return{value:o?.value,error:o?.error,loading:e!==void 0&&o?.value===void 0&&o?.error===void 0}}function GN(e){return e instanceof Error?e:Error(String(e))}function KN(e,t){let[n,r]=(0,B.useState)(0),i=(0,B.useCallback)(()=>r(e=>e+1),[]);return{status:WN(t,()=>e.getStatus(t??``),n),stop:(0,B.useCallback)(async n=>{try{return await e.stop(t??``,n)}finally{i()}},[e,t,i]),reread:i}}function qN(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=qN(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var JN={value:()=>{}};function YN(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new XN(n)}function XN(e){this._=e}function ZN(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}XN.prototype=YN.prototype={constructor:XN,on:function(e,t){var n=this._,r=ZN(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=QN(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=$N(n[i],e.name,t);else if(t==null)for(i in n)n[i]=$N(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new XN(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function QN(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function $N(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=JN,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var eP={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function tP(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),eP.hasOwnProperty(t)?{space:eP[t],local:e}:e}function nP(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function rP(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function iP(e){var t=tP(e);return(t.local?rP:nP)(t)}function aP(){}function oP(e){return e==null?aP:function(){return this.querySelector(e)}}function sP(e){typeof e!=`function`&&(e=oP(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new YF(r,this._parents)}function cP(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function lP(){return[]}function uP(e){return e==null?lP:function(){return this.querySelectorAll(e)}}function dP(e){return function(){return cP(e.apply(this,arguments))}}function fP(e){e=typeof e==`function`?dP(e):uP(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new YF(r,i)}function pP(e){return function(){return this.matches(e)}}function mP(e){return function(t){return t.matches(e)}}var hP=Array.prototype.find;function gP(e){return function(){return hP.call(this.children,e)}}function _P(){return this.firstElementChild}function vP(e){return this.select(e==null?_P:gP(typeof e==`function`?e:mP(e)))}var yP=Array.prototype.filter;function bP(){return Array.from(this.children)}function xP(e){return function(){return yP.call(this.children,e)}}function SP(e){return this.selectAll(e==null?bP:xP(typeof e==`function`?e:mP(e)))}function CP(e){typeof e!=`function`&&(e=pP(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new YF(r,this._parents)}function wP(e){return Array(e.length)}function TP(){return new YF(this._enter||this._groups.map(wP),this._parents)}function EP(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}EP.prototype={constructor:EP,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function DP(e){return function(){return e}}function OP(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new EP(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function kP(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new EP(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function AP(e){return e.__data__}function jP(e,t){if(!arguments.length)return Array.from(this,AP);var n=t?kP:OP,r=this._parents,i=this._groups;typeof e!=`function`&&(e=DP(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=MP(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new YF(o,r),o._enter=s,o._exit=c,o}function MP(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function NP(){return new YF(this._exit||this._groups.map(wP),this._parents)}function PP(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function FP(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new YF(s,this._parents)}function IP(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function LP(e){e||=RP;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new YF(i,this._parents).order()}function RP(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function zP(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function BP(){return Array.from(this)}function VP(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function HP(){let e=0;for(let t of this)++e;return e}function UP(){return!this.node()}function WP(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function GP(e){return function(){this.removeAttribute(e)}}function KP(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qP(e,t){return function(){this.setAttribute(e,t)}}function JP(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function YP(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function XP(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ZP(e,t){var n=tP(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?KP:GP:typeof t==`function`?n.local?XP:YP:n.local?JP:qP)(n,t))}function QP(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function $P(e){return function(){this.style.removeProperty(e)}}function eF(e,t,n){return function(){this.style.setProperty(e,t,n)}}function tF(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function nF(e,t,n){return arguments.length>1?this.each((t==null?$P:typeof t==`function`?tF:eF)(e,t,n??``)):rF(this.node(),e)}function rF(e,t){return e.style.getPropertyValue(t)||QP(e).getComputedStyle(e,null).getPropertyValue(t)}function iF(e){return function(){delete this[e]}}function aF(e,t){return function(){this[e]=t}}function oF(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function sF(e,t){return arguments.length>1?this.each((t==null?iF:typeof t==`function`?oF:aF)(e,t)):this.node()[e]}function cF(e){return e.trim().split(/^|\s+/)}function lF(e){return e.classList||new uF(e)}function uF(e){this._node=e,this._names=cF(e.getAttribute(`class`)||``)}uF.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function dF(e,t){for(var n=lF(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function fF(e,t){for(var n=lF(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function pF(e){return function(){dF(this,e)}}function mF(e){return function(){fF(this,e)}}function hF(e,t){return function(){(t.apply(this,arguments)?dF:fF)(this,e)}}function gF(e,t){var n=cF(e+``);if(arguments.length<2){for(var r=lF(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?hF:t?pF:mF)(n,t))}function _F(){this.textContent=``}function vF(e){return function(){this.textContent=e}}function yF(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function bF(e){return arguments.length?this.each(e==null?_F:(typeof e==`function`?yF:vF)(e)):this.node().textContent}function xF(){this.innerHTML=``}function SF(e){return function(){this.innerHTML=e}}function CF(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function wF(e){return arguments.length?this.each(e==null?xF:(typeof e==`function`?CF:SF)(e)):this.node().innerHTML}function TF(){this.nextSibling&&this.parentNode.appendChild(this)}function EF(){return this.each(TF)}function DF(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function OF(){return this.each(DF)}function kF(e){var t=typeof e==`function`?e:iP(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function AF(){return null}function jF(e,t){var n=typeof e==`function`?e:iP(e),r=t==null?AF:typeof t==`function`?t:oP(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function MF(){var e=this.parentNode;e&&e.removeChild(this)}function NF(){return this.each(MF)}function PF(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function FF(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function IF(e){return this.select(e?FF:PF)}function LF(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function RF(e){return function(t){e.call(this,t,this.__data__)}}function zF(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function BF(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function VF(e,t,n){return function(){var r=this.__on,i,a=RF(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function HF(e,t,n){var r=zF(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?VF:BF,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function UF(e,t,n){var r=QP(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function WF(e,t){return function(){return UF(this,e,t)}}function GF(e,t){return function(){return UF(this,e,t.apply(this,arguments))}}function KF(e,t){return this.each((typeof t==`function`?GF:WF)(e,t))}function*qF(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var JF=[null];function YF(e,t){this._groups=e,this._parents=t}function XF(){return new YF([[document.documentElement]],JF)}function ZF(){return this}YF.prototype=XF.prototype={constructor:YF,select:sP,selectAll:fP,selectChild:vP,selectChildren:SP,filter:CP,data:jP,enter:TP,exit:NP,join:PP,merge:FP,selection:ZF,order:IP,sort:LP,call:zP,nodes:BP,node:VP,size:HP,empty:UP,each:WP,attr:ZP,style:nF,property:sF,classed:gF,text:bF,html:wF,raise:EF,lower:OF,append:kF,insert:jF,remove:NF,clone:IF,datum:LF,on:HF,dispatch:KF,[Symbol.iterator]:qF};function QF(e){return typeof e==`string`?new YF([[document.querySelector(e)]],[document.documentElement]):new YF([[e]],JF)}function $F(e){let t;for(;t=e.sourceEvent;)e=t;return e}function eI(e,t){if(e=$F(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var tI={passive:!1},nI={capture:!0,passive:!1};function rI(e){e.stopImmediatePropagation()}function iI(e){e.preventDefault(),e.stopImmediatePropagation()}function aI(e){var t=e.document.documentElement,n=QF(e).on(`dragstart.drag`,iI,nI);`onselectstart`in t?n.on(`selectstart.drag`,iI,nI):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function oI(e,t){var n=e.document.documentElement,r=QF(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,iI,nI),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var sI=e=>()=>e;function cI(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}cI.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function lI(e){return!e.ctrlKey&&!e.button}function uI(){return this.parentNode}function dI(e,t){return t??{x:e.x,y:e.y}}function fI(){return navigator.maxTouchPoints||`ontouchstart`in this}function pI(){var e=lI,t=uI,n=dI,r=fI,i={},a=YN(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,tI).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(QF(n.view).on(`mousemove.drag`,m,nI).on(`mouseup.drag`,h,nI),aI(n.view),rI(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(iI(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){QF(e.view).on(`mousemove.drag mouseup.drag`,null),oI(e.view,l),iI(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(rI(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(iI(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(rI(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=eI(l||r,t),p,m,h;if((h=n.call(e,new cI(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=eI(l||a,t),_=o;break}u.call(r,e,new cI(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:sI(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:sI(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:sI(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:sI(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function mI(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function hI(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function gI(){}var _I=.7,vI=1/_I,yI=`\\s*([+-]?\\d+)\\s*`,bI=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,xI=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,SI=/^#([0-9a-f]{3,8})$/,CI=RegExp(`^rgb\\(${yI},${yI},${yI}\\)$`),wI=RegExp(`^rgb\\(${xI},${xI},${xI}\\)$`),TI=RegExp(`^rgba\\(${yI},${yI},${yI},${bI}\\)$`),EI=RegExp(`^rgba\\(${xI},${xI},${xI},${bI}\\)$`),DI=RegExp(`^hsl\\(${bI},${xI},${xI}\\)$`),OI=RegExp(`^hsla\\(${bI},${xI},${xI},${bI}\\)$`),kI={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};mI(gI,PI,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:AI,formatHex:AI,formatHex8:jI,formatHsl:MI,formatRgb:NI,toString:NI});function AI(){return this.rgb().formatHex()}function jI(){return this.rgb().formatHex8()}function MI(){return qI(this).formatHsl()}function NI(){return this.rgb().formatRgb()}function PI(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=SI.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?FI(t):n===3?new zI(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?II(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?II(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=CI.exec(e))?new zI(t[1],t[2],t[3],1):(t=wI.exec(e))?new zI(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=TI.exec(e))?II(t[1],t[2],t[3],t[4]):(t=EI.exec(e))?II(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=DI.exec(e))?KI(t[1],t[2]/100,t[3]/100,1):(t=OI.exec(e))?KI(t[1],t[2]/100,t[3]/100,t[4]):kI.hasOwnProperty(e)?FI(kI[e]):e===`transparent`?new zI(NaN,NaN,NaN,0):null}function FI(e){return new zI(e>>16&255,e>>8&255,e&255,1)}function II(e,t,n,r){return r<=0&&(e=t=n=NaN),new zI(e,t,n,r)}function LI(e){return e instanceof gI||(e=PI(e)),e?(e=e.rgb(),new zI(e.r,e.g,e.b,e.opacity)):new zI}function RI(e,t,n,r){return arguments.length===1?LI(e):new zI(e,t,n,r??1)}function zI(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}mI(zI,RI,hI(gI,{brighter(e){return e=e==null?vI:vI**+e,new zI(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?_I:_I**+e,new zI(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new zI(WI(this.r),WI(this.g),WI(this.b),UI(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:BI,formatHex:BI,formatHex8:VI,formatRgb:HI,toString:HI}));function BI(){return`#${GI(this.r)}${GI(this.g)}${GI(this.b)}`}function VI(){return`#${GI(this.r)}${GI(this.g)}${GI(this.b)}${GI((isNaN(this.opacity)?1:this.opacity)*255)}`}function HI(){let e=UI(this.opacity);return`${e===1?`rgb(`:`rgba(`}${WI(this.r)}, ${WI(this.g)}, ${WI(this.b)}${e===1?`)`:`, ${e})`}`}function UI(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function WI(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function GI(e){return e=WI(e),(e<16?`0`:``)+e.toString(16)}function KI(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new YI(e,t,n,r)}function qI(e){if(e instanceof YI)return new YI(e.h,e.s,e.l,e.opacity);if(e instanceof gI||(e=PI(e)),!e)return new YI;if(e instanceof YI)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new YI(o,s,c,e.opacity)}function JI(e,t,n,r){return arguments.length===1?qI(e):new YI(e,t,n,r??1)}function YI(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}mI(YI,JI,hI(gI,{brighter(e){return e=e==null?vI:vI**+e,new YI(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?_I:_I**+e,new YI(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new zI(QI(e>=240?e-240:e+120,i,r),QI(e,i,r),QI(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new YI(XI(this.h),ZI(this.s),ZI(this.l),UI(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=UI(this.opacity);return`${e===1?`hsl(`:`hsla(`}${XI(this.h)}, ${ZI(this.s)*100}%, ${ZI(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function XI(e){return e=(e||0)%360,e<0?e+360:e}function ZI(e){return Math.max(0,Math.min(1,e||0))}function QI(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var $I=e=>()=>e;function eL(e,t){return function(n){return e+n*t}}function tL(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function nL(e){return(e=+e)==1?rL:function(t,n){return n-t?tL(t,n,e):$I(isNaN(t)?n:t)}}function rL(e,t){var n=t-e;return n?eL(e,n):$I(isNaN(e)?t:e)}var iL=(function e(t){var n=nL(t);function r(e,t){var r=n((e=RI(e)).r,(t=RI(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=rL(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function aL(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function oL(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function sL(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=gL(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function cL(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function lL(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function uL(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=gL(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var dL=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fL=new RegExp(dL.source,`g`);function pL(e){return function(){return e}}function mL(e){return function(t){return e(t)+``}}function hL(e,t){var n=dL.lastIndex=fL.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=dL.exec(e))&&(i=fL.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:lL(r,i)})),n=fL.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?mL(c[0].x):pL(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function gL(e,t){var n=typeof t,r;return t==null||n===`boolean`?$I(t):(n===`number`?lL:n===`string`?(r=PI(t))?(t=r,iL):hL:t instanceof PI?iL:t instanceof Date?cL:oL(t)?aL:Array.isArray(t)?sL:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?uL:lL)(e,t)}var _L=180/Math.PI,vL={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function yL(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*_L,skewX:Math.atan(c)*_L,scaleX:o,scaleY:s}}var bL;function xL(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?vL:yL(t.a,t.b,t.c,t.d,t.e,t.f)}function SL(e){return e==null||(bL||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),bL.setAttribute(`transform`,e),!(e=bL.transform.baseVal.consolidate()))?vL:(e=e.matrix,yL(e.a,e.b,e.c,e.d,e.e,e.f))}function CL(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:lL(e,i)},{i:c-2,x:lL(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:lL(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:lL(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:lL(e,n)},{i:s-2,x:lL(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var wL=CL(xL,`px, `,`px)`,`deg)`),TL=CL(SL,`, `,`)`,`)`),EL=1e-12;function DL(e){return((e=Math.exp(e))+1/e)/2}function OL(e){return((e=Math.exp(e))-1/e)/2}function kL(e){return((e=Math.exp(2*e))-1)/(e+1)}var AL=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<EL)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=DL(y),c=s/(n*g)*(i*kL(t*r+y)-OL(y));return[a+c*d,o+c*f,s*i/DL(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),jL=0,ML=0,NL=0,PL=1e3,FL,IL,LL=0,RL=0,zL=0,BL=typeof performance==`object`&&performance.now?performance:Date,VL=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function HL(){return RL||=(VL(UL),BL.now()+zL)}function UL(){RL=0}function WL(){this._call=this._time=this._next=null}WL.prototype=GL.prototype={constructor:WL,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?HL():+n)+(t==null?0:+t),!this._next&&IL!==this&&(IL?IL._next=this:FL=this,IL=this),this._call=e,this._time=n,XL()},stop:function(){this._call&&(this._call=null,this._time=1/0,XL())}};function GL(e,t,n){var r=new WL;return r.restart(e,t,n),r}function KL(){HL(),++jL;for(var e=FL,t;e;)(t=RL-e._time)>=0&&e._call.call(void 0,t),e=e._next;--jL}function qL(){RL=(LL=BL.now())+zL,jL=ML=0;try{KL()}finally{jL=0,YL(),RL=0}}function JL(){var e=BL.now(),t=e-LL;t>PL&&(zL-=t,LL=e)}function YL(){for(var e,t=FL,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:FL=n);IL=e,XL(r)}function XL(e){jL||(ML&&=clearTimeout(ML),e-RL>24?(e<1/0&&(ML=setTimeout(qL,e-BL.now()-zL)),NL&&=clearInterval(NL)):(NL||=(LL=BL.now(),setInterval(JL,PL)),jL=1,VL(qL)))}function ZL(e,t,n){var r=new WL;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var QL=YN(`start`,`end`,`cancel`,`interrupt`),$L=[];function eR(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;iR(e,n,{name:t,index:r,group:i,on:QL,tween:$L,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function tR(e,t){var n=rR(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function nR(e,t){var n=rR(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function rR(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function iR(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=GL(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return ZL(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(ZL(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function aR(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function oR(e){return this.each(function(){aR(this,e)})}function sR(e,t){var n,r;return function(){var i=nR(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function cR(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=nR(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function lR(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=rR(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?sR:cR)(n,e,t))}function uR(e,t,n){var r=e._id;return e.each(function(){var e=nR(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return rR(e,r).value[t]}}function dR(e,t){var n;return(typeof t==`number`?lL:t instanceof PI?iL:(n=PI(t))?(t=n,iL):hL)(e,t)}function fR(e){return function(){this.removeAttribute(e)}}function pR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mR(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function hR(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function gR(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function _R(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function vR(e,t){var n=tP(e),r=n===`transform`?TL:dR;return this.attrTween(e,typeof t==`function`?(n.local?_R:gR)(n,r,uR(this,`attr.`+e,t)):t==null?(n.local?pR:fR)(n):(n.local?hR:mR)(n,r,t))}function yR(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function bR(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function xR(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&bR(e,i)),n}return i._value=t,i}function SR(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&yR(e,i)),n}return i._value=t,i}function CR(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=tP(e);return this.tween(n,(r.local?xR:SR)(r,t))}function wR(e,t){return function(){tR(this,e).delay=+t.apply(this,arguments)}}function TR(e,t){return t=+t,function(){tR(this,e).delay=t}}function ER(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?wR:TR)(t,e)):rR(this.node(),t).delay}function DR(e,t){return function(){nR(this,e).duration=+t.apply(this,arguments)}}function OR(e,t){return t=+t,function(){nR(this,e).duration=t}}function kR(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?DR:OR)(t,e)):rR(this.node(),t).duration}function AR(e,t){if(typeof t!=`function`)throw Error();return function(){nR(this,e).ease=t}}function jR(e){var t=this._id;return arguments.length?this.each(AR(t,e)):rR(this.node(),t).ease}function MR(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();nR(this,e).ease=n}}function NR(e){if(typeof e!=`function`)throw Error();return this.each(MR(this._id,e))}function PR(e){typeof e!=`function`&&(e=pP(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new lz(r,this._parents,this._name,this._id)}function FR(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new lz(o,this._parents,this._name,this._id)}function IR(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function LR(e,t,n){var r,i,a=IR(t)?tR:nR;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function RR(e,t){var n=this._id;return arguments.length<2?rR(this.node(),n).on.on(e):this.each(LR(n,e,t))}function zR(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function BR(){return this.on(`end.remove`,zR(this._id))}function VR(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=oP(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,eR(l[f],t,n,f,l,rR(u,n)));return new lz(a,this._parents,t,n)}function HR(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=uP(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=rR(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&eR(p,t,n,h,f,m);a.push(f),o.push(u)}return new lz(a,o,t,n)}var UR=XF.prototype.constructor;function WR(){return new UR(this._groups,this._parents)}function GR(e,t){var n,r,i;return function(){var a=rF(this,e),o=(this.style.removeProperty(e),rF(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function KR(e){return function(){this.style.removeProperty(e)}}function qR(e,t,n){var r,i=n+``,a;return function(){var o=rF(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function JR(e,t,n){var r,i,a;return function(){var o=rF(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),rF(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function YR(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=nR(this,e),l=c.on,u=c.value[a]==null?s||=KR(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function XR(e,t,n){var r=(e+=``)==`transform`?wL:dR;return t==null?this.styleTween(e,GR(e,r)).on(`end.style.`+e,KR(e)):typeof t==`function`?this.styleTween(e,JR(e,r,uR(this,`style.`+e,t))).each(YR(this._id,e)):this.styleTween(e,qR(e,r,t),n).on(`end.style.`+e,null)}function ZR(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function QR(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&ZR(e,a,n)),r}return a._value=t,a}function $R(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,QR(e,t,n??``))}function ez(e){return function(){this.textContent=e}}function tz(e){return function(){var t=e(this);this.textContent=t??``}}function nz(e){return this.tween(`text`,typeof e==`function`?tz(uR(this,`text`,e)):ez(e==null?``:e+``))}function rz(e){return function(t){this.textContent=e.call(this,t)}}function iz(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&rz(r)),t}return r._value=e,r}function az(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,iz(e))}function oz(){for(var e=this._name,t=this._id,n=dz(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=rR(c,t);eR(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new lz(r,this._parents,e,n)}function sz(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=nR(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var cz=0;function lz(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function uz(e){return XF().transition(e)}function dz(){return++cz}var fz=XF.prototype;lz.prototype=uz.prototype={constructor:lz,select:VR,selectAll:HR,selectChild:fz.selectChild,selectChildren:fz.selectChildren,filter:PR,merge:FR,selection:WR,transition:oz,call:fz.call,nodes:fz.nodes,node:fz.node,size:fz.size,empty:fz.empty,each:fz.each,on:RR,attr:vR,attrTween:CR,style:XR,styleTween:$R,text:nz,textTween:az,remove:BR,tween:lR,delay:ER,duration:kR,ease:jR,easeVarying:NR,end:sz,[Symbol.iterator]:fz[Symbol.iterator]};function pz(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var mz={time:null,delay:0,duration:250,ease:pz};function hz(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function gz(e){var t,n;e instanceof lz?(t=e._id,e=e._name):(t=dz(),(n=mz).time=HL(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&eR(c,e,t,l,o,n||hz(c,t));return new lz(r,this._parents,e,t)}XF.prototype.interrupt=oR,XF.prototype.transition=gz;var _z=e=>()=>e;function vz(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function yz(e,t,n){this.k=e,this.x=t,this.y=n}yz.prototype={constructor:yz,scale:function(e){return e===1?this:new yz(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new yz(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var bz=new yz(1,0,0);xz.prototype=yz.prototype;function xz(e){for(;!e.__zoom;)if(!(e=e.parentNode))return bz;return e.__zoom}function Sz(e){e.stopImmediatePropagation()}function Cz(e){e.preventDefault(),e.stopImmediatePropagation()}function wz(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Tz(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ez(){return this.__zoom||bz}function Dz(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Oz(){return navigator.maxTouchPoints||`ontouchstart`in this}function kz(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Az(){var e=wz,t=Tz,n=kz,r=Dz,i=Oz,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=AL,l=YN(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Ez).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Ez),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(bz.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new yz(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new yz(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new yz(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=QF(this.that).datum();l.call(e,this.that,new vz(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=eI(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],aR(this),s.start();Cz(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=QF(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=eI(t,i),l=t.clientX,u=t.clientY;aI(t.view),Sz(t),a.mouse=[c,this.__zoom.invert(c)],aR(this),a.start();function d(e){if(Cz(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=eI(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),oI(e.view,a.moved),Cz(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=eI(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Cz(r),s>0?QF(this).transition().duration(s).call(x,d,c,r):QF(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(Sz(t),s=0;s<i;++s)c=r[s],l=eI(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),aR(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(Cz(e),s=0;s<a;++s)c=i[s],l=eI(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Sz(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=eI(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=QF(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:_z(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:_z(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:_z(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:_z([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var jz={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Mz=[[-1/0,-1/0],[1/0,1/0]],Nz=[`Enter`,` `,`Escape`],Pz={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},Fz;(function(e){e.Strict=`strict`,e.Loose=`loose`})(Fz||={});var Iz;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Iz||={});var Lz;(function(e){e.Partial=`partial`,e.Full=`full`})(Lz||={});var Rz={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},zz;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(zz||={});var Bz;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Bz||={});var $;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})($||={});var Vz={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top};function Hz(e){return e===null?null:e?`valid`:`invalid`}var Uz=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,Wz=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),Gz=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Kz=(e,t=[0,0])=>{let{width:n,height:r}=EB(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},qz=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:cB(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):Gz(n)?n:t.nodeLookup.get(n.id)),oB(e,i?uB(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Jz=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=oB(n,uB(e)),r=!0)}),r?cB(n):{x:0,y:0,width:0,height:0}},Yz=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=fB(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},Xz=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Zz(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=EB(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function Qz({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=CB(Jz(Zz(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function $z({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,jz.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&TB(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=TB(d)?nB(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,jz.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function eB({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=Xz(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var tB=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),nB=(e={x:0,y:0},t,n)=>({x:tB(e.x,t[0][0],t[1][0]-(n?.width??0)),y:tB(e.y,t[0][1],t[1][1]-(n?.height??0))});function rB(e,t,n){let{width:r,height:i}=EB(n),{x:a,y:o}=n.internals.positionAbsolute;return nB(e,[[a,o],[a+r,o+i]],t)}var iB=(e,t,n)=>e<t?tB(Math.abs(e-t),1,t)/t:e>n?-tB(Math.abs(e-n),1,t)/t:0,aB=(e,t,n=15,r=40)=>[iB(e.x,r,t.width-r)*n,iB(e.y,r,t.height-r)*n],oB=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),sB=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),cB=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),lB=(e,t=[0,0])=>{let{x:n,y:r}=Gz(e)?e.internals.positionAbsolute:Kz(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},uB=(e,t=[0,0])=>{let{x:n,y:r}=Gz(e)?e.internals.positionAbsolute:Kz(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},dB=(e,t)=>cB(oB(sB(e),sB(t))),fB=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},pB=(e,t)=>fB(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),mB=e=>hB(e.width)&&hB(e.height)&&hB(e.x)&&hB(e.y),hB=e=>!isNaN(e)&&isFinite(e),gB=(e,t)=>(e,t)=>{},_B=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),vB=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?_B(s,o):s},yB=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function bB(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function xB(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=bB(e,n),i=bB(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=bB(e.top??e.y??0,n),i=bB(e.bottom??e.y??0,n),a=bB(e.left??e.x??0,t),o=bB(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function SB(e,t,n,r,i,a){let{x:o,y:s}=yB(e,[t,n,r]),{x:c,y:l}=yB({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var CB=(e,t,n,r,i,a)=>{let o=xB(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=tB(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=SB(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},wB=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function TB(e){return e!=null&&e!==`parent`}function EB(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function DB(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function OB(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function kB(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function AB(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function jB(e){return{...Pz,...e||{}}}function MB(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=RB(e),s=vB({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?_B(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var NB=e=>({width:e.offsetWidth,height:e.offsetHeight}),PB=e=>e?.getRootNode?.()||window?.document,FB=[`INPUT`,`SELECT`,`TEXTAREA`];function IB(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?FB.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var LB=e=>`clientX`in e,RB=(e,t)=>{let n=LB(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},zB=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...NB(t)}})};function BB({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function VB(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function HB({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case $.Left:return[t-VB(t-r,a),n];case $.Right:return[t+VB(r-t,a),n];case $.Top:return[t,n-VB(n-i,a)];case $.Bottom:return[t,n+VB(i-n,a)]}}function UB({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,curvature:o=.25}){let[s,c]=HB({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=HB({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=BB({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function WB({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function GB({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function KB({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=oB(uB(e),uB(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),pB({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},cB(a))>0}var qB=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,JB=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),YB=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,jz.error006()),t;let r=n.getEdgeId||qB,i;return i=Uz(e)?{...e}:{...e,id:r(e)},JB(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function XB({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=WB({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var ZB={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},QB=({source:e,sourcePosition:t=$.Bottom,target:n})=>t===$.Left||t===$.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},$B=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function eV({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:r=$.Top,center:i,offset:a,stepPosition:o}){let s=ZB[t],c=ZB[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=QB({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=WB({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function tV(e,t,n,r){let i=Math.min($B(e,t)/2,$B(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function nV({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=eV({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=tV(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function rV(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function iV(e){let{sourceNode:t,targetNode:n}=e;if(!rV(t)||!rV(n))return null;let r=t.internals.handleBounds||aV(t.handles),i=n.internals.handleBounds||aV(n.handles),a=sV(r?.source??[],e.sourceHandle),o=sV(e.connectionMode===Fz.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,jz.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||$.Bottom,c=o?.position||$.Top,l=oV(t,a,s),u=oV(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function aV(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function oV(e,t,n=$.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??EB(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case $.Top:return{x:i+o/2,y:a};case $.Right:return{x:i+o,y:a+s/2};case $.Bottom:return{x:i+o/2,y:a+s};case $.Left:return{x:i,y:a+s/2}}}function sV(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function cV(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function lV(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=cV(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var uV=1e3,dV=10,fV={nodeOrigin:[0,0],nodeExtent:Mz,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},pV={...fV,checkEquality:!0};function mV(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function hV(e,t,n){let r=mV(fV,n);for(let n of e.values())if(n.parentId)bV(n,e,t,r);else{let e=nB(Kz(n,r.nodeOrigin),TB(n.extent)?n.extent:r.nodeExtent,EB(n));n.internals.positionAbsolute=e}}function gV(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function _V(e){return e===`manual`}function vV(e,t,n,r={}){let i=mV(pV,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!_V(i.zIndexMode)?uV:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=nB(Kz(u,i.nodeOrigin),TB(u.extent)?u.extent:i.nodeExtent,EB(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:gV(u,e),z:xV(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&bV(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function yV(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function bV(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=mV(fV,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}yV(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*dV),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=SV(e,u,o,s,a&&!_V(c)?uV:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function xV(e,t,n){let r=hB(e.zIndex)?e.zIndex:0;return _V(n)?r:r+(e.selected?t:0)}function SV(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=EB(e),l=Kz(e,n),u=TB(e.extent)?nB(l,e.extent,c):l,d=nB({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=rB(d,c,t));let f=xV(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function CV(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=dB(a.get(n.parentId)?.expandedRect??lB(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=EB(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function wV(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=NB(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=TB(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=rB(h,s,n))}else m&&(h=nB(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:zB(`source`,r.nodeElement,p,d,e.id),target:zB(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&bV(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:lB(g,i)}))}}if(f.length>0){let e=CV(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function TV({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function EV(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function DV(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;EV(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),EV(`target`,s,c,e,i,o),t.set(r.id,r)}}function OV(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:OV(n,t):!1}function kV(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function AV(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!OV(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function jV({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function MV({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=_B(a,t);return{x:o.x-a.x,y:o.y-a.y}}function NV({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=QF(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?sB(Jz(s)):null,x=v&&l?MV({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:_B(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=$z({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=jV({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=aB(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=MB(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=AV(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=jV({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=pI().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=MB(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=RB(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=MB(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=RB(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=RB(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=jV({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!kV(t,`.${g}`,v))&&(!_||kV(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function PV(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())pB(i,lB(e))>0&&r.push(e);return r}var FV=250;function IV(e,t,n,r){let i=[],a=1/0,o=PV(e,n,t+FV);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=oV(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function LV(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...oV(o,c,c.position,!0)}:c}function RV(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function zV(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var BV=()=>!0;function VV(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=BV,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=PB(e.target),E=0,D,{x:O,y:k}=RB(e),A=RV(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=LV(i,A,r,c,t);if(!N)return;let P=RB(e,j),F=!1,I=null,L=!1,R=null;function ee(){if(!u||!j)return;let[e,t]=aB(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(ee)}let te={...N,nodeId:i,type:A,position:N.position},ne=c.get(i),re={inProgress:!0,isValid:null,from:oV(ne,te,$.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:ne,to:P,toHandle:null,toPosition:Vz[te.position],toNode:null,pointer:P};function ie(){M=!0,y(re),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&ie();function ae(e){if(!M){let{x:t,y:n}=RB(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;ie()}if(!x()||!te){oe(e);return}let a=b();P=RB(e,j),D=IV(vB(P,a,!1,[1,1]),n,c,te),F||=(ee(),!0);let s=HV(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=zV(!!D,s.isValid);let u=c.get(i),f=u?oV(u,te,$.Left,!0):re.from,p={...re,from:f,isValid:L,to:s.toHandle&&L?yB({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:Vz[te.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),re=p}function oe(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=re,r={...n,toPosition:re.toHandle?re.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,ae),T.removeEventListener(`mouseup`,oe),T.removeEventListener(`touchmove`,ae),T.removeEventListener(`touchend`,oe)}}T.addEventListener(`mousemove`,ae),T.addEventListener(`mouseup`,oe),T.addEventListener(`touchmove`,ae),T.addEventListener(`touchend`,oe)}function HV(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=BV,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=RB(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=RV(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===Fz.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=LV(t,e,a,u,n,!0)}return _}var UV={onPointerDown:VV,isValid:HV};function WV({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=QF(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&wB()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=Az().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:eI}}var GV=e=>({x:e.x,y:e.y,zoom:e.k}),KV=({x:e,y:t,zoom:n})=>bz.translate(e,t).scale(n),qV=(e,t)=>e.target.closest(`.${t}`),JV=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),YV=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,XV=(e,t=0,n=YV,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},ZV=e=>{let t=e.ctrlKey&&wB()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function QV({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(qV(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=eI(u),t=d*2**ZV(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===Iz.Vertical?0:u.deltaX*f,m=i===Iz.Horizontal?0:u.deltaY*f;!wB()&&u.shiftKey&&i!==Iz.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=GV(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function $V({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=qV(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function eH({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=GV(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function tH({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&JV(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,GV(a.transform))}}function nH({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&JV(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=GV(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function rH({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(qV(d,`${l}-flow__node`)||qV(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||qV(d,s)&&m||qV(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function iH({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=Az().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=QF(e).call(f);y({x:i.x,y:i.y,zoom:tB(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(ZV);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?gL:AL).transform(XV(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&v();let O=i&&!S&&!r;f.clickDistance(D?1/0:!hB(E)||E<0?0:E);let k=O?QV({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):$V({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,k,{passive:!1});let A=eH({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,A);let j=tH({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,j);let M=nH({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,M);let N=rH({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});f.filter(N),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=KV(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=KV(e);return await g(n,t),n}function x(e){if(p){let t=KV(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?xz(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?gL:AL).scaleTo(XV(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?gL:AL).scaleBy(XV(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!hB(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var aH;(function(e){e.Line=`line`,e.Handle=`handle`})(aH||={});function oH({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function sH(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function cH(e,t){return Math.max(0,t-e)}function lH(e,t){return Math.max(0,e-t)}function uH(e,t,n){return Math.max(0,t-e,e-n)}function dH(e,t){return e?!t:t}function fH(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=uH(E,h,g),j=uH(D,_,v);if(o){let e=0,t=0;c&&w<0?e=cH(y+w+O,o[0][0]):!c&&w>0&&(e=lH(y+E+O,o[1][0])),l&&T<0?t=cH(b+T+k,o[0][1]):!l&&T>0&&(t=lH(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=lH(y+w,s[0][0]):!c&&w<0&&(e=cH(y+E,s[1][0])),l&&T>0?t=lH(b+T,s[0][1]):!l&&T<0&&(t=cH(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=uH(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?lH(b+k+E/C,o[1][1])*C:cH(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?cH(b+E/C,s[1][1])*C:lH(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=uH(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?lH(y+D*C+O,o[1][0])/C:cH(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?cH(y+D*C,s[1][0])/C:lH(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(dH(c,l)?-w:w)/C:w=(dH(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var pH={width:0,height:0,x:0,y:0},mH={...pH,pointerX:0,pointerY:0,aspectRatio:1};function hH(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function gH({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=QF(e),o={controlDirection:sH(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...pH},h={...mH};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:sH(e)};let g,_=null,v=[],y,b,x,S=!1,C=pI().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=MB(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=TB(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=hH(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=MB(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=fH(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let F=oH({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var _H=Ne((e=>{var t=Fe();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),vH=Ne(((e,t)=>{t.exports=_H()})),yH=Ne((e=>{var t=Fe(),n=vH();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),bH=s(Ne(((e,t)=>{t.exports=yH()}))(),1),xH=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},SH=e=>e?xH(e):xH,{useDebugValue:CH}=B.default,{useSyncExternalStoreWithSelector:wH}=bH.default,TH=e=>e;function EH(e,t=TH,n){let r=wH(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return CH(r),r}var DH=(e,t)=>{let n=SH(e),r=(e,r=t)=>EH(n,e,r);return Object.assign(r,n),r},OH=(e,t)=>e?DH(e,t):DH;function kH(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var AH=(0,B.createContext)(null),jH=AH.Provider,MH=jz.error001(`react`);function NH(e,t){let n=(0,B.useContext)(AH);if(n===null)throw Error(MH);return EH(n,e,t)}function PH(){let e=(0,B.useContext)(AH);if(e===null)throw Error(MH);return(0,B.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var FH={display:`none`},IH={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},LH=`react-flow__node-desc`,RH=`react-flow__edge-desc`,zH=`react-flow__aria-live`,BH=e=>e.ariaLiveMessage,VH=e=>e.ariaLabelConfig;function HH({rfId:e}){let t=NH(BH);return(0,V.jsx)(`div`,{id:`${zH}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:IH,children:t})}function UH({rfId:e,disableKeyboardA11y:t}){let n=NH(VH);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{id:`${LH}-${e}`,style:FH,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,V.jsx)(`div`,{id:`${RH}-${e}`,style:FH,children:n[`edge.a11yDescription.default`]}),!t&&(0,V.jsx)(HH,{rfId:e})]})}var WH=(0,B.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,V.jsx)(`div`,{className:qN([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));WH.displayName=`Panel`;var GH=`https://reactflow.dev?utm_source=attribution`;function KH({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,V.jsx)(WH,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${GH}`,children:(0,V.jsx)(`a`,{href:GH,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var qH=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},JH=e=>e.id;function YH(e,t){return kH(e.selectedNodes.map(JH),t.selectedNodes.map(JH))&&kH(e.selectedEdges.map(JH),t.selectedEdges.map(JH))}function XH({onSelectionChange:e}){let t=PH(),{selectedNodes:n,selectedEdges:r}=NH(qH,YH);return(0,B.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var ZH=e=>!!e.onSelectionChangeHandlers;function QH({onSelectionChange:e}){let t=NH(ZH);return e||t?(0,V.jsx)(XH,{onSelectionChange:e}):null}var $H=[0,0],eU={x:0,y:0,zoom:1},tU=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],nU=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),rU={translateExtent:Mz,nodeOrigin:$H,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function iU(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=NH(nU,kH),l=PH();(0,B.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=rU,s()}),[]);let u=(0,B.useRef)(rU);return(0,B.useEffect)(()=>{for(let s of tU){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:jB(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},tU.map(t=>e[t])),null}function aU(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function oU(e){let[t,n]=(0,B.useState)(e===`system`?null:e);return(0,B.useEffect)(()=>{if(e!==`system`){n(e);return}let t=aU(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?aU()?.matches?`dark`:`light`:t}var sU=typeof document<`u`?document:null;function cU(e=null,t={target:sU,actInsideInputWithModifier:!0}){let[n,r]=(0,B.useState)(!1),i=(0,B.useRef)(!1),a=(0,B.useRef)(new Set([])),[o,s]=(0,B.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
83
+ `).replace(`
84
+
85
+ `,`
86
+ +`).split(`
87
+ `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,B.useEffect)(()=>{let n=t?.target??sU,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&IB(e))return!1;let n=uU(e.code,s);if(a.current.add(e[n]),lU(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=uU(e.code,s);lU(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function lU(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function uU(e,t){return t.includes(e)?`code`:`key`}var dU=()=>{let e=PH();return(0,B.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=CB(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return vB(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=yB(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function fU(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)pU(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function pU(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing);break}}function mU(e,t){return fU(e,t)}function hU(e,t){return fU(e,t)}function gU(e,t){return{id:e,type:`select`,selected:t}}function _U(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(gU(a.id,e)))}return r}function vU({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function yU(e){return{id:e.id,type:`remove`}}var bU=gB(`React Flow`,`https://reactflow.dev/`);function xU(e,t,n={}){return YB(e,t,{...n,onError:n.onError??bU})}var SU=e=>Wz(e),CU=e=>Uz(e);function wU(e){return(0,B.forwardRef)(e)}var TU=typeof window<`u`?B.useLayoutEffect:B.useEffect;function EU(e){let[t,n]=(0,B.useState)(BigInt(0)),[r]=(0,B.useState)(()=>DU(()=>n(e=>e+BigInt(1))));return TU(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function DU(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var OU=(0,B.createContext)(null);function kU({children:e}){let t=PH(),n=EU((0,B.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=vU({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=EU((0,B.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(vU({items:s,lookup:o}))},[])),i=(0,B.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,V.jsx)(OU.Provider,{value:i,children:e})}function AU(){let e=(0,B.useContext)(OU);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var jU=e=>!!e.panZoom;function MU(){let e=dU(),t=PH(),n=AU(),r=NH(jU),i=(0,B.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=SU(e)?e:n.get(e.id),a=i.parentId?OB(i.position,i.measured,i.parentId,n,r):i.position;return lB({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&SU(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&CU(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await eB({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(yU);o?.(f),c(e)}if(m){let e=d.map(yU);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=mB(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=lB(s?r:a),l=pB(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=mB(e)?e:a(e);if(!r)return!1;let i=pB(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return qz(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??AB();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,B.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var NU=e=>e.selected,PU=typeof window<`u`?window:void 0;function FU({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=PH(),{deleteElements:r}=MU(),i=cU(e,{actInsideInputWithModifier:!1}),a=cU(t,{target:PU});(0,B.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(NU),edges:e.filter(NU)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,B.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function IU(e){let t=PH();(0,B.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=NB(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,jz.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var LU={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},RU=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function zU({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=Iz.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=PH(),S=(0,B.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=NH(RU,kH),E=cU(f),D=(0,B.useRef)();IU(S);let O=(0,B.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,B.useEffect)(()=>{if(S.current){D.current=iH({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,B.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,V.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:LU,children:m})}var BU=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function VU(){let{userSelectionActive:e,userSelectionRect:t}=NH(BU,kH);return e&&t?(0,V.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var HU=(e,t)=>n=>{n.target===t.current&&e?.(n)},UU=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function WU({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Lz.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,B.useRef)(0),_=PH(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=NH(UU,kH),C=y&&(e||v),w=(0,B.useRef)(null),T=(0,B.useRef)(),E=(0,B.useRef)(new Set),D=(0,B.useRef)(new Set),O=(0,B.useRef)(!1),k=(0,B.useRef)(!1),A=(0,B.useRef)({x:0,y:0}),j=(0,B.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,F=e=>{k.current&&=(e.stopPropagation(),!1)},I=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=RB(n.nativeEvent,T.current),l=vB({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function L(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=yB(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set(Yz(a,m,i,n===Lz.Partial,!0).map(e=>e.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}kB(h,E.current)||c(_U(a,E.current,!0)),kB(g,D.current)||l(_U(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function R(){if(!i||!T.current)return;let[e,t]=aB(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(R);return}let{x:t,y:n}=A.current;L(t,n),g.current=requestAnimationFrame(R)})}let ee=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};return(0,B.useEffect)(()=>()=>ee(),[]),(0,V.jsxs)(`div`,{className:qN([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:b,selection:e}]),onClick:C?void 0:HU(M,w),onContextMenu:HU(N,w),onWheel:HU(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=RB(e.nativeEvent,T.current);A.current={x:o,y:c};let l=yB({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(R(),!0),L(o,c)}:p,onPointerUp:e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),ee())},onPointerCancel:C?e=>{e.target?.releasePointerCapture?.(e.pointerId),ee()}:void 0,onPointerDownCapture:C?I:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:LU,children:[h,(0,V.jsx)(VU,{})]})}function GU({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,jz.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function KU({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=PH(),[c,l]=(0,B.useState)(!1),u=(0,B.useRef)();return(0,B.useEffect)(()=>{if(!t)return u.current=NV({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{GU({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,B.useEffect)(()=>{t||!e.current||!u.current||u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var qU=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function JU(){let e=PH();return(0,B.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=qU(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=_B(t,i));let{position:a,positionAbsolute:s}=$z({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var YU=(0,B.createContext)(null),XU=YU.Provider;YU.Consumer;var ZU=()=>(0,B.useContext)(YU),QU=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),$U=(0,B.createContext)(null);function eW({children:e}){let t=NH(QU,kH);return(0,V.jsx)($U.Provider,{value:t,children:e})}function tW(){let e=(0,B.useContext)($U);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var nW={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},rW=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return nW;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===Fz.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function iW({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=PH(),_=ZU(),{connectOnClick:v,noPanClassName:y,rfId:b}=tW(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=NH(rW(_,m,e),kH);_||g.getState().onError?.(`010`,jz.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(xU(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=LB(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();UV.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,V.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:qN([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=PB(t.target),h=n||c,{connection:v,isValid:y}=UV.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var aW=(0,B.memo)(wU(iW));function oW({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return(0,V.jsxs)(V.Fragment,{children:[e?.label,(0,V.jsx)(aW,{type:`source`,position:n,isConnectable:t})]})}function sW({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(aW,{type:`target`,position:n,isConnectable:t}),e?.label,(0,V.jsx)(aW,{type:`source`,position:r,isConnectable:t})]})}function cW(){return null}function lW({data:e,isConnectable:t,targetPosition:n=$.Top}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(aW,{type:`target`,position:n,isConnectable:t}),e?.label]})}var uW={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},dW={input:oW,default:sW,output:lW,group:cW};function fW(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var pW=e=>{let{width:t,height:n,x:r,y:i}=Jz(e.nodeLookup,{filter:e=>!!e.selected});return{width:hB(t)?t:null,height:hB(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function mW({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=PH(),{width:i,height:a,transformString:o,userSelectionActive:s}=NH(pW,kH),c=JU(),l=(0,B.useRef)(null);(0,B.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(KU({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,V.jsx)(`div`,{className:qN([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,V.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(uW,e.key)&&(e.preventDefault(),c({direction:uW[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var hW=typeof window<`u`?window:void 0,gW=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function _W({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:F,isControlledViewport:I}){let{nodesSelectionActive:L,userSelectionActive:R}=NH(gW,kH),ee=cU(l,{target:hW}),te=cU(h,{target:hW}),ne=te||w,re=te||b,ie=u&&ne!==!0,ae=ee||R||ie;return FU({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,V.jsx)(zU,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:re,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!ee&&ne,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:ie,children:(0,V.jsxs)(WU,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ne,autoPanOnSelection:T,isSelecting:!!ae,selectionMode:d,selectionKeyPressed:ee,paneClickDistance:s,selectionOnDrag:ie,children:[e,L&&(0,V.jsx)(mW,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}_W.displayName=`FlowRenderer`;var vW=(0,B.memo)(_W),yW=e=>t=>e?Yz(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function bW(e){return NH((0,B.useCallback)(yW(e),[e]),kH)}var xW=e=>e.updateNodeInternals;function SW(){let e=NH(xW),[t]=(0,B.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,B.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function CW({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=PH(),a=(0,B.useRef)(null),o=(0,B.useRef)(null),s=(0,B.useRef)(e.sourcePosition),c=(0,B.useRef)(e.targetPosition),l=(0,B.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,B.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,B.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,B.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function wW({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=NH(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},kH),S=y.type||`default`,C=g?.[S]||dW[S];C===void 0&&(v?.(`003`,jz.error003(S)),S=`default`,C=g?.default||dW.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=PH(),k=DB(y),A=CW({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=KU({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=JU();if(y.hidden)return null;let N=EB(y),P=fW(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,L=r?e=>r(e,{...b.userNode}):void 0,R=i?e=>i(e,{...b.userNode}):void 0,ee=a?e=>a(e,{...b.userNode}):void 0,te=o?e=>o(e,{...b.userNode}):void 0,ne=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&GU({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},re=t=>{if(!(IB(t.nativeEvent)||m)){if(Nz.includes(t.key)&&T){let n=t.key===`Escape`;GU({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(uW,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:uW[t.key],factor:t.shiftKey?4:1})}}},ie=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(Yz(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,V.jsx)(`div`,{className:qN([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:L,onMouseLeave:R,onContextMenu:ee,onClick:ne,onDoubleClick:te,onKeyDown:D?re:void 0,tabIndex:D?0:void 0,onFocus:D?ie:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${LH}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,V.jsx)(XU,{value:e,children:(0,V.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var TW=(0,B.memo)(wW),EW=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function DW(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=NH(EW,kH),a=bW(e.onlyRenderVisibleElements),o=SW();return(0,V.jsx)(`div`,{className:`react-flow__nodes`,style:LU,children:a.map(a=>(0,V.jsx)(TW,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}DW.displayName=`NodeRenderer`;var OW=(0,B.memo)(DW);function kW(e){return NH((0,B.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&KB({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),kH)}var AW=({color:e=`none`,strokeWidth:t=1})=>(0,V.jsx)(`polyline`,{className:`arrow`,style:{strokeWidth:t,...e&&{stroke:e}},strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`}),jW=({color:e=`none`,strokeWidth:t=1})=>(0,V.jsx)(`polyline`,{className:`arrowclosed`,style:{strokeWidth:t,...e&&{stroke:e,fill:e}},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),MW={[Bz.Arrow]:AW,[Bz.ArrowClosed]:jW};function NW(e){let t=PH();return(0,B.useMemo)(()=>Object.prototype.hasOwnProperty.call(MW,e)?MW[e]:(t.getState().onError?.(`009`,jz.error009(e)),null),[e])}var PW=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=NW(t);return c?(0,V.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,V.jsx)(c,{color:n,strokeWidth:o})}):null},FW=({defaultColor:e,rfId:t})=>{let n=NH(e=>e.edges),r=NH(e=>e.defaultEdgeOptions),i=(0,B.useMemo)(()=>lV(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,V.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,V.jsx)(`defs`,{children:i.map(e=>(0,V.jsx)(PW,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};FW.displayName=`MarkerDefinitions`;var IW=(0,B.memo)(FW);function LW({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,B.useState)({x:1,y:0,width:0,height:0}),p=qN([`react-flow__edge-textwrapper`,l]),m=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,V.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,V.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,V.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}LW.displayName=`EdgeText`;var RW=(0,B.memo)(LW);function zW({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`path`,{...u,d:e,fill:`none`,className:qN([`react-flow__edge-path`,u.className])}),l?(0,V.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&hB(t)&&hB(n)?(0,V.jsx)(RW,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function BW({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function VW({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=BW({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=BW({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=BB({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function HW(e){return(0,B.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=VW({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,V.jsx)(zW,{id:e.isInternal?void 0:t,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var UW=HW({isInternal:!1}),WW=HW({isInternal:!0});UW.displayName=`SimpleBezierEdge`,WW.displayName=`SimpleBezierEdgeInternal`;function GW(e){return(0,B.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=nV({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,V.jsx)(zW,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var KW=GW({isInternal:!1}),qW=GW({isInternal:!0});KW.displayName=`SmoothStepEdge`,qW.displayName=`SmoothStepEdgeInternal`;function JW(e){return(0,B.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,V.jsx)(KW,{...n,id:r,pathOptions:(0,B.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var YW=JW({isInternal:!1}),XW=JW({isInternal:!0});YW.displayName=`StepEdge`,XW.displayName=`StepEdgeInternal`;function ZW(e){return(0,B.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=XB({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,V.jsx)(zW,{id:e.isInternal?void 0:t,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var QW=ZW({isInternal:!1}),$W=ZW({isInternal:!0});QW.displayName=`StraightEdge`,$W.displayName=`StraightEdgeInternal`;function eG(e){return(0,B.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=UB({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,V.jsx)(zW,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var tG=eG({isInternal:!1}),nG=eG({isInternal:!0});tG.displayName=`BezierEdge`,nG.displayName=`BezierEdgeInternal`;var rG={default:nG,straight:$W,step:XW,smoothstep:qW,simplebezier:WW},iG={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},aG=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,oG=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,sG=`react-flow__edgeupdater`;function cG({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,V.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:qN([sG,`${sG}-${s}`]),cx:aG(t,r,e),cy:oG(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function lG({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=PH(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;UV.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,V.jsxs)(V.Fragment,{children:[(e===!0||e===`source`)&&(0,V.jsx)(cG,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,V.jsx)(cG,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function uG({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=NH(t=>t.edgeLookup.get(e)),b=NH(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||rG[x];S===void 0&&(_?.(`011`,jz.error011(x)),x=`default`,S=h?.default||rG.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,B.useRef)(null),[D,O]=(0,B.useState)(!1),[k,A]=(0,B.useState)(!1),j=PH(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R}=NH((0,B.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return iG;let i=iV({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=GB({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||iG,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),kH),ee=(0,B.useMemo)(()=>y.markerStart?`url('#${cV(y.markerStart,m)}')`:void 0,[y.markerStart,m]),te=(0,B.useMemo)(()=>y.markerEnd?`url('#${cV(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===null)return null;let ne=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},re=a?e=>{a(e,{...y})}:void 0,ie=o?e=>{o(e,{...y})}:void 0,ae=s?e=>{s(e,{...y})}:void 0,oe=c?e=>{c(e,{...y})}:void 0,se=l?e=>{l(e,{...y})}:void 0;return(0,V.jsx)(`svg`,{style:{zIndex:M},children:(0,V.jsxs)(`g`,{className:qN([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:ne,onDoubleClick:re,onContextMenu:ie,onMouseEnter:ae,onMouseMove:oe,onMouseLeave:se,onKeyDown:C?t=>{if(!v&&Nz.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${RH}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,V.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:ee,markerEnd:te,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,V.jsx)(lG,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,setUpdateHover:O,setReconnecting:A})]})})}var dG=(0,B.memo)(uG),fG=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function pG({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=NH(fG,kH),b=kW(t);return(0,V.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,V.jsx)(IW,{defaultColor:e,rfId:n}),b.map(e=>(0,V.jsx)(dG,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}pG.displayName=`EdgeRenderer`;var mG=(0,B.memo)(pG),hG=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function gG({children:e}){let t=PH(),n=(0,B.useRef)(null),[r]=(0,B.useState)(()=>t.getState().transform);return TU(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=hG(r)))};return r(),t.subscribe(r)},[t]),(0,V.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:hG(r)},children:e})}function _G(e){let t=MU(),n=(0,B.useRef)(!1);(0,B.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var vG=e=>e.panZoom?.syncViewport;function yG(e){let t=NH(vG),n=PH();return(0,B.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function bG(e){return e.connection.inProgress?{...e.connection,to:vB(e.connection.to,e.transform)}:{...e.connection}}function xG(e){return e?t=>e(bG(t)):bG}function SG(e){return NH(xG(e),kH)}var CG=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function wG({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=NH(CG,kH);return a&&i&&c?(0,V.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,V.jsx)(`g`,{className:qN([`react-flow__connection`,Hz(s)]),children:(0,V.jsx)(TG,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var TG=({style:e,type:t=zz.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=SG();if(!i)return;if(n)return(0,V.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Hz(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case zz.Bezier:[m]=UB(h);break;case zz.SimpleBezier:[m]=VW(h);break;case zz.Step:[m]=nV({...h,borderRadius:0});break;case zz.SmoothStep:[m]=nV(h);break;default:[m]=XB(h)}return(0,V.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};TG.displayName=`ConnectionLine`;var EG={};function DG(e=EG){(0,B.useRef)(e),PH(),(0,B.useEffect)(()=>{},[e])}function OG(){PH(),(0,B.useRef)(!1),(0,B.useEffect)(()=>{},[])}function kG({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:R,panOnDrag:ee,autoPanOnSelection:te,onPaneClick:ne,onPaneMouseEnter:re,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneScroll:oe,onPaneContextMenu:se,paneClickDistance:ce,nodeClickDistance:le,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,viewport:z,onViewportChange:we,nodesDraggable:Te}){return DG(e),DG(t),OG(),_G(n),yG(z),(0,V.jsx)(vW,{onPaneClick:ne,onPaneMouseEnter:re,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneContextMenu:se,onPaneScroll:oe,paneClickDistance:ce,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:R,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:ee,autoPanOnSelection:te,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,onViewportChange:we,isControlledViewport:!!z,children:(0,V.jsxs)(gG,{children:[(0,V.jsx)(mG,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,onlyRenderVisibleElements:T,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,defaultMarkerColor:M,noPanClassName:be,disableKeyboardA11y:xe,rfId:Ce}),(0,V.jsx)(wG,{style:h,type:m,component:g,containerStyle:_}),(0,V.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,V.jsx)(OW,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:le,onlyRenderVisibleElements:T,noPanClassName:be,noDragClassName:ve,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,nodesDraggable:Te}),(0,V.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}kG.displayName=`GraphView`;var AG=(0,B.memo)(kG),jG=gB(`React Flow`,`https://reactflow.dev/`),MG=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??Mz;DV(h,g,_);let{nodesInitialized:x}=vV(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=CB(Jz(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:Mz,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Fz.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Rz},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:jG,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:Pz,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},NG=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>OH((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await Qz({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...MG({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=vV(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();DV(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=wV(e,n,r,i,a,o,l);d&&(hV(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=oV(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=CV(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(mU(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(hU(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>gU(e,!0)));return}i(_U(r,new Set([...e]),!0)),a(_U(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>gU(e,!0)));return}a(_U(n,new Set([...e]))),i(_U(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(gU(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(gU(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,gU(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,gU(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(vV(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return TV({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...Rz}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...MG()})}},Object.is);function PG({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,B.useState)(()=>NG({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,V.jsx)(jH,{value:m,children:(0,V.jsx)(kU,{children:(0,V.jsx)(eW,{children:p})})})}function FG({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,B.useContext)(AH)?(0,V.jsx)(V.Fragment,{children:e}):(0,V.jsx)(PG,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var IG={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function LG({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:I,connectionMode:L,connectionLineType:R=zz.Bezier,connectionLineStyle:ee,connectionLineComponent:te,connectionLineContainerStyle:ne,deleteKeyCode:re=`Backspace`,selectionKeyCode:ie=`Shift`,selectionOnDrag:ae=!1,selectionMode:oe=Lz.Full,panActivationKeyCode:se=`Space`,multiSelectionKeyCode:ce=wB()?`Meta`:`Control`,zoomActivationKeyCode:le=wB()?`Meta`:`Control`,snapToGrid:ue,snapGrid:de,onlyRenderVisibleElements:fe=!1,selectNodesOnDrag:pe,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,nodeOrigin:ve=$H,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe=!0,defaultViewport:Se=eU,minZoom:Ce=.5,maxZoom:z=2,translateExtent:we=Mz,preventScrolling:Te=!0,nodeExtent:Ee,defaultMarkerColor:De=`#b1b1b7`,zoomOnScroll:Oe=!0,zoomOnPinch:ke=!0,panOnScroll:Ae=!1,panOnScrollSpeed:je=.5,panOnScrollMode:Me=Iz.Free,zoomOnDoubleClick:Ne=!0,panOnDrag:Pe=!0,onPaneClick:Fe,onPaneMouseEnter:Ie,onPaneMouseMove:Le,onPaneMouseLeave:Re,onPaneScroll:ze,onPaneContextMenu:Be,paneClickDistance:Ve=1,nodeClickDistance:He=0,children:Ue,onReconnect:We,onReconnectStart:Ge,onReconnectEnd:Ke,onEdgeContextMenu:qe,onEdgeDoubleClick:Je,onEdgeMouseEnter:Ye,onEdgeMouseMove:Xe,onEdgeMouseLeave:Ze,reconnectRadius:Qe=10,onNodesChange:$e,onEdgesChange:et,noDragClassName:tt=`nodrag`,noWheelClassName:nt=`nowheel`,noPanClassName:rt=`nopan`,fitView:it,fitViewOptions:at,connectOnClick:ot,attributionPosition:st,proOptions:ct,defaultEdgeOptions:lt,elevateNodesOnSelect:ut=!0,elevateEdgesOnSelect:dt=!1,disableKeyboardA11y:ft=!1,autoPanOnConnect:pt,autoPanOnNodeDrag:mt,autoPanOnSelection:ht=!0,autoPanSpeed:gt,connectionRadius:_t,isValidConnection:vt,onError:yt,style:bt,id:xt,nodeDragThreshold:St,connectionDragThreshold:Ct,viewport:wt,onViewportChange:Tt,width:Et,height:Dt,colorMode:Ot=`light`,debug:kt,onScroll:At,ariaLabelConfig:jt,zIndexMode:Mt=`basic`,...Nt},Pt){let Ft=xt||`1`,It=oU(Ot),Lt=(0,B.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),At?.(e)},[At]);return(0,V.jsx)(`div`,{"data-testid":`rf__wrapper`,...Nt,onScroll:Lt,style:{...bt,...IG},ref:Pt,className:qN([`react-flow`,i,It]),id:xt,role:`application`,children:(0,V.jsxs)(FG,{nodes:e,edges:t,width:Et,height:Dt,fitView:it,fitViewOptions:at,minZoom:Ce,maxZoom:z,nodeOrigin:ve,nodeExtent:Ee,zIndexMode:Mt,children:[(0,V.jsx)(iU,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe,elevateNodesOnSelect:ut,elevateEdgesOnSelect:dt,minZoom:Ce,maxZoom:z,nodeExtent:Ee,onNodesChange:$e,onEdgesChange:et,snapToGrid:ue,snapGrid:de,connectionMode:L,translateExtent:we,connectOnClick:ot,defaultEdgeOptions:lt,fitView:it,fitViewOptions:at,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:rt,nodeOrigin:ve,rfId:Ft,autoPanOnConnect:pt,autoPanOnNodeDrag:mt,autoPanSpeed:gt,onError:yt,connectionRadius:_t,isValidConnection:vt,selectNodesOnDrag:pe,nodeDragThreshold:St,connectionDragThreshold:Ct,onBeforeDelete:I,debug:kt,ariaLabelConfig:jt,zIndexMode:Mt}),(0,V.jsx)(AG,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:R,connectionLineStyle:ee,connectionLineComponent:te,connectionLineContainerStyle:ne,selectionKeyCode:ie,selectionOnDrag:ae,selectionMode:oe,deleteKeyCode:re,multiSelectionKeyCode:ce,panActivationKeyCode:se,zoomActivationKeyCode:le,onlyRenderVisibleElements:fe,defaultViewport:Se,translateExtent:we,minZoom:Ce,maxZoom:z,preventScrolling:Te,zoomOnScroll:Oe,zoomOnPinch:ke,zoomOnDoubleClick:Ne,panOnScroll:Ae,panOnScrollSpeed:je,panOnScrollMode:Me,panOnDrag:Pe,autoPanOnSelection:ht,onPaneClick:Fe,onPaneMouseEnter:Ie,onPaneMouseMove:Le,onPaneMouseLeave:Re,onPaneScroll:ze,onPaneContextMenu:Be,paneClickDistance:Ve,nodeClickDistance:He,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:We,onReconnectStart:Ge,onReconnectEnd:Ke,onEdgeContextMenu:qe,onEdgeDoubleClick:Je,onEdgeMouseEnter:Ye,onEdgeMouseMove:Xe,onEdgeMouseLeave:Ze,reconnectRadius:Qe,defaultMarkerColor:De,noDragClassName:tt,noWheelClassName:nt,noPanClassName:rt,rfId:Ft,disableKeyboardA11y:ft,nodeExtent:Ee,viewport:wt,onViewportChange:Tt,nodesDraggable:me}),(0,V.jsx)(QH,{onSelectionChange:k}),Ue,(0,V.jsx)(KH,{proOptions:ct,position:st}),(0,V.jsx)(UH,{rfId:Ft,disableKeyboardA11y:ft})]})})}var RG=wU(LG);jz.error014();function zG({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,V.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:qN([`react-flow__background-pattern`,n,r])})}function BG({radius:e,className:t}){return(0,V.jsx)(`circle`,{cx:e,cy:e,r:e,className:qN([`react-flow__background-pattern`,`dots`,t])})}var VG;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(VG||={});var HG={[VG.Dots]:1,[VG.Lines]:1,[VG.Cross]:6},UG=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function WG({id:e,variant:t=VG.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,B.useRef)(null),{transform:f,patternId:p}=NH(UG,kH),m=r||HG[t],h=t===VG.Dots,g=t===VG.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,V.jsxs)(`svg`,{className:qN([`react-flow__background`,l]),style:{...c,...LU,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,V.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,V.jsx)(BG,{radius:y/2,className:u}):(0,V.jsx)(zG,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,V.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}WG.displayName=`Background`;var GG=(0,B.memo)(WG);function KG(){return(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,V.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function qG(){return(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,V.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function JG(){return(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,V.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function YG(){return(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,V.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function XG(){return(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,V.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function ZG({children:e,className:t,...n}){return(0,V.jsx)(`button`,{type:`button`,className:qN([`react-flow__controls-button`,t]),...n,children:e})}var QG=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function $G({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=PH(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=NH(QG,kH),{zoomIn:y,zoomOut:b,fitView:x}=MU();return(0,V.jsxs)(WH,{className:qN([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(ZG,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,V.jsx)(KG,{})}),(0,V.jsx)(ZG,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,V.jsx)(qG,{})})]}),n&&(0,V.jsx)(ZG,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,V.jsx)(JG,{})}),r&&(0,V.jsx)(ZG,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,V.jsx)(XG,{}):(0,V.jsx)(YG,{})}),u]})}$G.displayName=`Controls`;var eK=(0,B.memo)($G);function tK({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,V.jsx)(`rect`,{className:qN([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var nK=(0,B.memo)(tK),rK=e=>e.nodes.map(e=>e.id),iK=e=>e instanceof Function?e:()=>e;function aK({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=nK,onClick:o}){let s=NH(rK,kH),c=iK(t),l=iK(e),u=iK(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,V.jsx)(V.Fragment,{children:s.map(e=>(0,V.jsx)(sK,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function oK({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=NH(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=EB(r);return{node:r,x:i,y:a,width:o,height:s}},kH);return!l||l.hidden||!DB(l)?null:(0,V.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var sK=(0,B.memo)(oK),cK=(0,B.memo)(aK),lK=200,uK=150,dK=e=>!e.hidden,fK=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?dB(Jz(e.nodeLookup,{filter:dK}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},pK=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,mK=(e,t)=>pK(e.viewBB,t.viewBB)&&pK(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,hK=`react-flow__minimap-desc`;function gK({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=PH(),S=(0,B.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=NH(fK,mK),j=e?.width??lK,M=e?.height??uK,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,R=b*F,ee=C.x-(I-C.width)/2-R,te=C.y-(L-C.height)/2-R,ne=I+R*2,re=L+R*2,ie=`${hK}-${T}`,ae=(0,B.useRef)(0),oe=(0,B.useRef)();ae.current=F,(0,B.useEffect)(()=>{if(S.current&&E)return oe.current=WV({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>ae.current}),()=>{oe.current?.destroy()}},[E]),(0,B.useEffect)(()=>{oe.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let se=p?e=>{let[t,n]=oe.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ce=m?(0,B.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,le=_??A[`minimap.ariaLabel`];return(0,V.jsx)(WH,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:qN([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,V.jsxs)(`svg`,{width:j,height:M,viewBox:`${ee} ${te} ${ne} ${re}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":ie,ref:S,onClick:se,children:[le&&(0,V.jsx)(`title`,{id:ie,children:le}),(0,V.jsx)(cK,{onClick:ce,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,V.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${ee-R},${te-R}h${ne+R*2}v${re+R*2}h${-ne-R*2}z
88
+ M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}gK.displayName=`MiniMap`,(0,B.memo)(gK);var _K=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,vK={[aH.Line]:`right`,[aH.Handle]:`bottom-right`};function yK({nodeId:e,position:t,variant:n=aH.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=ZU(),y=typeof e==`string`?e:v,b=PH(),x=(0,B.useRef)(null),S=n===aH.Handle,C=NH((0,B.useCallback)(_K(S&&p),[S,p]),kH),w=(0,B.useRef)(null),T=t??vK[n];return(0,B.useEffect)(()=>{if(!(!x.current||!y))return w.current||=gH({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=CV([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...OB({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,V.jsx)(`div`,{className:qN([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,B.memo)(yK);var bK={agent:Ve,human:wt,command:xt,change:De};function xK({data:e}){let t=bK[e.kind]??yt,n=e.style===`success`?He:e.style===`danger`||e.style===`muted`?Et:e.style===`active`?qe:et;return(0,V.jsxs)(`article`,{"aria-label":`${e.label}: ${e.state}`,className:k(`dag-node`,`state-${e.state}`,`token-${e.style}`),"data-selected":e.selected,children:[(0,V.jsx)(aW,{type:`target`,position:$.Left}),(0,V.jsxs)(`div`,{className:`node-heading`,children:[(0,V.jsxs)(T,{className:`node-kind px-1.5 py-0 text-[9px] tracking-[.1em] uppercase`,variant:`outline`,children:[(0,V.jsx)(t,{"aria-label":e.kind,role:`img`,size:10}),e.kind]}),(0,V.jsx)(n,{className:k(e.style===`active`&&`spin`),size:17})]}),(0,V.jsx)(`strong`,{children:e.label}),(0,V.jsx)(`span`,{className:`node-status`,children:e.state}),e.reason!==void 0&&(0,V.jsx)(`span`,{className:`node-reason`,title:e.reason,children:e.reason}),e.awaits!==void 0&&(0,V.jsx)(`span`,{className:`node-awaits`,title:e.awaits,children:e.awaits}),(0,V.jsx)(aW,{type:`source`,position:$.Right})]})}function SK({data:e,id:t,markerEnd:n,style:r}){return(0,V.jsx)(zW,{id:t,path:CK(e?.points??[]),markerEnd:n,style:r})}function CK(e){let[t,...n]=e;return t?`M ${t.x} ${t.y} ${n.map(e=>`L ${e.x} ${e.y}`).join(` `)}`:``}var wK={dagNode:xK},TK={routed:SK};function EK({nodes:e,selectedNodeId:t,onSelectNode:n,journalSeq:r}){let i=(0,B.useMemo)(()=>{let t=new Map;for(let n of e)ve(n.status)&&t.set(n.id,Oe(n));return t},[e]),a=(0,B.useMemo)(()=>new Map(e.map(e=>[e.id,Ee(e)])),[e]),{nodes:o,edges:s}=(0,B.useMemo)(()=>{let n=new Set(e.map(e=>e.id)),r=se({nodes:e.map(e=>({id:e.id,label:e.label,kind:e.kind,state:e.status,...Ce(i.get(e.id),a.get(e.id))})),edges:e.flatMap(e=>(e.task?.deps??[]).filter(e=>n.has(e)).map(t=>({id:`${t}->${e.id}`,source:t,target:e.id})))});return{nodes:r.nodes.map(e=>({id:e.id,type:`dagNode`,position:{x:e.x,y:e.y},data:{label:e.label,kind:e.kind,state:e.state,style:e.style,selected:e.id===t,...i.get(e.id)===void 0?{}:{reason:i.get(e.id)},...a.get(e.id)===void 0?{}:{awaits:a.get(e.id)}},width:e.width,height:e.height,measured:{width:e.width,height:e.height},handles:[{type:`target`,position:$.Left,x:0,y:e.height/2,width:0,height:0},{type:`source`,position:$.Right,x:e.width,y:e.height/2,width:0,height:0}]})),edges:r.edges.map(t=>({id:t.id,source:t.source,target:t.target,type:`routed`,data:{points:t.points},animated:e.find(({id:e})=>e===t.target)?.status===`running`}))}},[e,i,a,t]);return(0,V.jsxs)(`div`,{className:`graph-wrap`,"data-journal-seq":r,children:[(0,V.jsxs)(RG,{nodes:o,edges:s,colorMode:`dark`,nodeTypes:wK,edgeTypes:TK,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,fitView:!0,minZoom:.05,onInit:e=>void e.fitView(),onNodeClick:(e,t)=>n(t.id),"aria-label":`DAG execution graph`,children:[(0,V.jsx)(GG,{color:`var(--border)`,gap:22}),(0,V.jsx)(eK,{showInteractive:!1})]}),(0,V.jsx)(`ol`,{className:`accessible-node-list`,"aria-label":`DAG nodes`,children:e.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),children:[e.label,`: `,e.status,i.get(e.id)===void 0?``:` — ${i.get(e.id)}`,a.get(e.id)===void 0?``:` — ${a.get(e.id)}`]})},e.id))})]})}function DK({value:e,label:t=`Record`}){return e==null?(0,V.jsx)(`span`,{children:`Not recorded`}):typeof e==`boolean`?(0,V.jsx)(`span`,{children:e?`Yes`:`No`}):typeof e==`string`||typeof e==`number`?(0,V.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:String(e)}):Array.isArray(e)?e.length===0?(0,V.jsx)(`span`,{children:`None`}):(0,V.jsx)(`ol`,{"aria-label":t,children:e.map((e,n)=>(0,V.jsx)(`li`,{"aria-label":`${t}.${n}`,children:(0,V.jsx)(DK,{label:`${t}.${n}`,value:e})},n))}):typeof e==`object`?(0,V.jsx)(`div`,{className:`structured-fields`,children:Object.entries(e).map(([e,n])=>(0,V.jsxs)(`fieldset`,{"aria-label":`${t}.${e}`,children:[(0,V.jsx)(`legend`,{children:e.replaceAll(`_`,` `)}),(0,V.jsx)(DK,{label:`${t}.${e}`,value:n})]},e))}):(0,V.jsx)(`span`,{children:`Not recorded`})}function OK(e,t){let[n,r]=(0,B.useState)(0);return{host:WN(`host`,()=>e.host(),n),unwatched:WN(`unwatched`,()=>e.unwatched(),n),refresh:(0,B.useCallback)(()=>{r(e=>e+1),t?.()},[t])}}var kK=[`Run`,`Node`,`Provider`,`Age (ms)`,`Proof`];function AK(e,t){let n=e?.runs??[];if(t===void 0)return n;let r=new Map(t.map(e=>[e.id,e])),i=new Set(n.map(e=>e.run_id));return[...n.flatMap(e=>{let t=r.get(e.run_id);if(t===void 0)return[];let{done:n,failed:i,running:a}=t.nodes;return[{run_id:e.run_id,state:t.state,node_counts:{...e.node_counts,done:n,failed:i,running:a}}]}),...(e===void 0?[]:t).filter(e=>!i.has(e.id)).map(({id:e,state:t,nodes:{done:n,failed:r,running:i}})=>({run_id:e,state:t,node_counts:{done:n,failed:r,running:i}}))]}function jK({client:e,onRefresh:t,list:n,rows:r,listError:i,children:a}){let{host:o,unwatched:s,refresh:c}=OK(e,t),l=o.value?.reading;return(0,V.jsx)(gd,{className:`min-h-0 flex-1`,children:(0,V.jsxs)(`section`,{"aria-label":`Host`,className:`channel-view host-page`,children:[(0,V.jsxs)(`h2`,{children:[`This host`,l&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsx)(`output`,{"aria-label":`Host name`,className:`host-name`,children:l.host})]})]}),(0,V.jsx)(Wi,{onClick:c,children:`Refresh host`}),(o.error||s.error)&&(0,V.jsx)(`p`,{role:`alert`,children:o.error?.message??s.error?.message}),o.loading&&(0,V.jsx)(`p`,{role:`status`,children:`Reading host…`}),l&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`dl`,{children:[(0,V.jsx)(`dt`,{children:`Runs root`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`output`,{"aria-label":`Runs root path`,children:l.root})})]}),l.root_error&&(0,V.jsx)(`p`,{role:`alert`,children:l.root_error}),(0,V.jsxs)(`section`,{"aria-label":`Free space`,children:[(0,V.jsx)(`h3`,{children:`Free space`}),l.free_space.map((e,t)=>(0,V.jsxs)(`dl`,{children:[(0,V.jsx)(`dt`,{children:`Filesystem`}),(0,V.jsx)(`dd`,{children:e.roots.map((e,t)=>(0,V.jsxs)(`span`,{children:[t>0&&` · `,e.role,`:`,` `,(0,V.jsx)(`output`,{"aria-label":`Filesystem root path`,children:e.path??`unresolved`}),e.measured_at&&(0,V.jsxs)(V.Fragment,{children:[` `,`(measured at`,` `,(0,V.jsx)(`output`,{"aria-label":`Measured root ancestor`,children:e.measured_at}),`)`]})]},e.role))}),(0,V.jsx)(`dt`,{children:`Free bytes`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`output`,{"aria-label":`Free capacity bytes`,children:e.free_bytes??`Unknown`})}),(0,V.jsx)(`dt`,{children:`Total bytes`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`output`,{"aria-label":`Total capacity bytes`,children:e.total_bytes??`Unknown`})}),e.error&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Error`}),(0,V.jsx)(`dd`,{children:e.error})]})]},e.roots[0]?.path??t))]}),(0,V.jsxs)(`section`,{"aria-label":`Providers and dispatches`,children:[(0,V.jsx)(`h3`,{children:`Providers and dispatches`}),l.dispatches.length===0?(0,V.jsx)(`p`,{children:`No live dispatches`}):(0,V.jsx)(`section`,{"aria-label":`Providers and dispatches table`,className:`host-table`,children:(0,V.jsxs)(`table`,{children:[(0,V.jsx)(`thead`,{children:(0,V.jsx)(`tr`,{children:kK.map(e=>(0,V.jsx)(`th`,{children:e},e))})}),(0,V.jsx)(`tbody`,{children:l.dispatches.map(e=>(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`td`,{"data-label":`Run`,children:e.run}),(0,V.jsx)(`td`,{"data-label":`Node`,children:e.node}),(0,V.jsx)(`td`,{"data-label":`Provider`,children:e.launcher}),(0,V.jsx)(`td`,{"data-label":`Age (ms)`,children:(0,V.jsx)(`output`,{"aria-label":`Dispatch age milliseconds`,className:`host-age`,children:e.age_ms??`Unknown`})}),(0,V.jsxs)(`td`,{"data-label":`Proof`,children:[e.proof,e.unproven&&`: ${e.unproven}`]})]},`${e.run}/${e.node}`))})]})})]}),(0,V.jsxs)(`section`,{"aria-label":`Gone dispatches`,children:[(0,V.jsx)(`h3`,{children:`Gone dispatches`}),l.gone.map(e=>(0,V.jsxs)(`p`,{children:[e.run,` · `,e.node,` · `,e.reason]},`${e.run}/${e.node}`))]}),l.skipped.map(e=>(0,V.jsxs)(`p`,{children:[e.path,`: `,e.reason]},e.path))]}),(0,V.jsxs)(`section`,{"aria-label":`Unwatched runs`,children:[(0,V.jsxs)(`h3`,{children:[`Unwatched runs: `,s.value?.reported.length??`…`]}),s.value?.reported.map(e=>(0,V.jsxs)(`dl`,{children:[(0,V.jsx)(`dt`,{children:e.run}),(0,V.jsxs)(`dd`,{children:[e.standing,` · `,e.why_not_watched]})]},e.run)),s.value?.unresolved.map(e=>(0,V.jsx)(`p`,{children:e},e))]}),(0,V.jsxs)(`section`,{"aria-label":`Runs on the host`,children:[(0,V.jsx)(`h3`,{children:`Runs on the host`}),i&&(0,V.jsxs)(`p`,{role:`alert`,children:[`Listing unavailable: `,i.message]}),AK(n,r).map(e=>(0,V.jsx)(`p`,{children:[e.run_id,e.state,L(e.node_counts)].filter(Boolean).join(` · `)},e.run_id))]}),(0,V.jsxs)(`details`,{"aria-label":`Provider health`,children:[(0,V.jsx)(`summary`,{children:`Provider health`}),(0,V.jsx)(DK,{value:n?.provider_health})]}),a]})})}function MK(e,t,n){let{value:r,error:i}=WN(t?`host-listing`:void 0,async()=>{let[t,n]=await Promise.all([e.listRuns(!0),e.listProjects()]);return{...t,runs:n.projects.flatMap(e=>e.runs),next_cursor:void 0}},n);return t?{list:r,error:i}:{}}function NK(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 PK(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function FK(e){return e}var IK=[],LK=`skip`;function RK(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=vy(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 (`+FK(e.type+(t?`<`+t+`>`:``))+`)`})}return o;function o(){let r=!a||l(e,t,n[n.length-1]||void 0),o=IK;if(s&&r&&(o=zK(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=zK(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 zK(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?IK:[e]}function BK(e,t,n){let r=vy((n||{}).ignore||[]),i=VK(t),a=-1;for(;++a<i.length;)RK(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 LK}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)o.lastIndex=n+1;else{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(!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 VK(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([HK(e[0]),UK(e[1])])}return t}function HK(e){return typeof e==`string`?new RegExp(PK(e),`g`):e}function UK(e){return typeof e==`function`?e:function(){return e}}var WK=`phrasing`,GK=[`autolink`,`link`,`image`,`label`];function KK(){return{transforms:[eq],enter:{literalAutolink:JK,literalAutolinkEmail:YK,literalAutolinkHttp:YK,literalAutolinkWww:YK},exit:{literalAutolink:$K,literalAutolinkEmail:QK,literalAutolinkHttp:XK,literalAutolinkWww:ZK}}}function qK(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:WK,notInConstruct:GK},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:WK,notInConstruct:GK},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:WK,notInConstruct:GK}]}}function JK(e){this.enter({type:`link`,title:null,url:``,children:[],position:void 0},e)}function YK(e){this.config.enter.autolinkProtocol.call(this,e)}function XK(e){this.config.exit.autolinkProtocol.call(this,e)}function ZK(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 QK(e){this.config.exit.autolinkEmail.call(this,e)}function $K(e){this.exit(e)}function eq(e){BK(e,[[/(?<![\da-z])(https?:\/\/|www(?=\.))([\w-]*\.[\w\-.]*)([^\t\n\r ]*)/gi,tq],[/(?<![\w+\-.@])xmpp:([\w+\-.]+)@([\w-]+(?:\.[\w-]+)+)(\/(?:[\w\-/]|\.(?=[\dA-Za-z]))*)?/g,iq],[/(?<![\w+\-.@])mailto:([\w+\-.]+)@([\w-]+(?:\.[\w-]+)+)/g,rq],[/(?<![\w+\-.]|(?:^|[^\d@A-Za-z])(?:mailto|xmpp):)([\w+\-.]+)@([\w-]+(?:\.[\w-]+)+)/g,nq]],{ignore:[`link`,`linkReference`]})}function tq(e,t,n,r,i){if(!sq(i))return!1;let a=``;if(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),Jh(n.charCodeAt(0))||!aq(n))return!1;let o=oq(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 nq(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 rq(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 iq(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 aq(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 oq(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=NK(e,`(`),a=NK(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 sq(e){let t=e.input.charCodeAt(e.index-1);return e.index===0||Yh(t)||Jh(t)}_q.peek=gq;function cq(){this.buffer()}function lq(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function uq(){this.buffer()}function dq(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function fq(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Rh(this.sliceSerialize(e)).toLowerCase(),n.label=t}function pq(e){this.exit(e)}function mq(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Rh(this.sliceSerialize(e)).toLowerCase(),n.label=t}function hq(e){this.exit(e)}function gq(){return`[`}function _q(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 vq(){return{enter:{gfmFootnoteCallString:cq,gfmFootnoteCall:lq,gfmFootnoteDefinitionLabelString:uq,gfmFootnoteDefinition:dq},exit:{gfmFootnoteCallString:fq,gfmFootnoteCall:pq,gfmFootnoteDefinitionLabelString:mq,gfmFootnoteDefinition:hq}}}function yq(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:_q},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?`
89
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?xq:bq))),s(),o}}function bq(e,t,n){return t===0?e:xq(e,t,n)}function xq(e,t,n){return(n?``:` `)+e}var Sq=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Dq.attention=Oq,Dq.peek=kq;function Cq(){return{canContainEols:[`delete`],enter:{strikethrough:Tq},exit:{strikethrough:Eq}}}function wq(){return{handlers:{delete:Dq},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Sq}]}}function Tq(e){this.enter({type:`delete`,children:[],position:void 0},e)}function Eq(e){this.exit(e)}function Dq(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 Oq(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function kq(){return`~`}function Aq(e){return e.length}function jq(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Aq,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=Mq(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]=Nq(r[d]);else{let e=Nq(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(`
90
+ `)}function Mq(e){return e==null?``:String(e)}function Nq(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}function Pq(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()),Fq);return i(),o}function Fq(e,t,n){return`>`+(n?``:` `)+e}function Iq(e,t){return Lq(e,t.inConstruct,!0)&&!Lq(e,t.notInConstruct,!1)}function Lq(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 Rq(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
91
+ `&&Iq(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
92
+ `}function zq(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 Bq(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Vq(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Hq(e,t,n,r){let i=Vq(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(Bq(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,Uq);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(zq(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
93
+ `,encode:["`"],...s.current()})),t()}return u+=s.move(`
94
+ `),a&&(u+=s.move(a+`
95
+ `)),u+=s.move(c),l(),u}function Uq(e,t,n){return(n?``:` `)+e}function Wq(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Gq(e,t,n,r){let i=Wq(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?` `:`
96
+ `,...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 Kq(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function qq(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function Jq(e,t,n){let r=ag(e),i=ag(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}}Yq.peek=Xq;function Yq(e,t,n,r){let i=Kq(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Jq(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=qq(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Jq(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+qq(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Xq(e,t,n){return n.options.emphasis||`*`}function Zq(e,t){let n=!1;return ky(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)&&Th(e)&&(t.options.setext||n))}function Qq(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(Zq(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
97
+ `,after:`
98
+ `});return r(),t(),o+`
99
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
100
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
101
+ `,...a.current()});return/^[\t ]/.test(l)&&(l=qq(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}$q.peek=eJ;function $q(e){return e.value||``}function eJ(){return`<`}tJ.peek=nJ;function tJ(e,t,n,r){let i=Wq(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 nJ(){return`!`}rJ.peek=iJ;function rJ(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=[],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 iJ(){return`!`}aJ.peek=oJ;function aJ(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)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 oJ(){return"`"}function sJ(e,t){let n=Th(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))}cJ.peek=lJ;function cJ(e,t,n,r){let i=Wq(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(sJ(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(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:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function lJ(e,t,n){return sJ(e,n)?`<`:`[`}uJ.peek=dJ;function uJ(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=[],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 dJ(){return`[`}function fJ(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 pJ(e){let t=fJ(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 mJ(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function hJ(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 gJ(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?mJ(n):fJ(n),s=e.ordered?o===`.`?`)`:`.`:pJ(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),hJ(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 _J(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 vJ(e,t,n,r){let i=_J(n),a=n.bulletCurrent||fJ(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 yJ(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var bJ=vy([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function xJ(e,t,n,r){return(e.children.some(function(e){return bJ(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function SJ(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}CJ.peek=wJ;function CJ(e,t,n,r){let i=SJ(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Jq(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=qq(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Jq(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+qq(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function wJ(e,t,n){return n.options.strong||`*`}function TJ(e,t,n,r){return n.safe(e.value,r)}function EJ(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 DJ(e,t,n){let r=(hJ(n)+(n.options.ruleSpaces?` `:``)).repeat(EJ(n));return n.options.ruleSpaces?r.slice(0,-1):r}var OJ={blockquote:Pq,break:Rq,code:Hq,definition:Gq,emphasis:Yq,hardBreak:Rq,heading:Qq,html:$q,image:tJ,imageReference:rJ,inlineCode:aJ,link:cJ,linkReference:uJ,list:gJ,listItem:vJ,paragraph:yJ,root:xJ,strong:CJ,text:TJ,thematicBreak:DJ};function kJ(){return{enter:{table:AJ,tableData:PJ,tableHeader:PJ,tableRow:MJ},exit:{codeText:FJ,table:jJ,tableData:NJ,tableHeader:NJ,tableRow:NJ}}}function AJ(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 jJ(e){this.exit(e),this.data.inTable=void 0}function MJ(e){this.enter({type:`tableRow`,children:[],position:void 0},e)}function NJ(e){this.exit(e)}function PJ(e){this.enter({type:`tableCell`,children:[],position:void 0},e)}function FJ(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,IJ));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function IJ(e,t){return t===`|`?t:e}function LJ(e){let{tableCellPadding:t,tablePipeAlign:n,stringLength:r}=e||{},i=t?` `:`|`;return{handlers:{inlineCode:d,table:a,tableCell:s,tableRow:o},join:[RJ],unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
102
+ `,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(`
103
+ `))}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 jq(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=OJ.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 RJ(e,t,n,r){if(e.type===`table`&&n.type===`listItem`&&n.spread===!1&&(t.type===`definition`||t.type===`heading`&&zJ(t,r)||t.type===`paragraph`||t.type===`table`))return 1}function zJ(e,t){let n=!1;return ky(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)&&Th(e)&&(t.options.setext||n))}function BJ(){return{exit:{taskListCheckValueChecked:HJ,taskListCheckValueUnchecked:HJ,paragraph:UJ}}}function VJ(){return{handlers:{paragraph:WJ},join:[GJ]}}function HJ(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function UJ(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 WJ(e,t,n,r){if(!t||t.type!==`listItem`||KJ(t)!==e)return OJ.paragraph(e,t,n,r);let i=`[`+(t.checked?`x`:` `)+`] `,a=n.createTracker(r);return a.move(i),i+OJ.paragraph(e.children.length>0?e:{type:`paragraph`,children:[{type:`text`,value:` `}]},t,n,{...r,...a.current()})}function GJ(e,t,n){if(!(e.type===`definition`&&n.type===`listItem`))return;let r=KJ(n);if(r&&n.children.indexOf(e)<n.children.indexOf(r))return 0}function KJ(e){if(typeof e.checked==`boolean`)for(let t of e.children){if(t.type===`paragraph`)return t;if(t.type!==`definition`)return}}function qJ(){return[KK(),vq(),Cq(),kJ(),BJ()]}function JJ(e){return{extensions:[qK(),yq(e),wq(),LJ(e),VJ()]}}var YJ={tokenize:lY,partial:!0},XJ={tokenize:uY,partial:!0},ZJ={tokenize:dY,partial:!0},QJ={tokenize:fY,partial:!0},$J={tokenize:pY,partial:!0},eY={name:`wwwAutolink`,tokenize:sY,previous:mY},tY={name:`protocolAutolink`,tokenize:cY,previous:hY},nY={name:`emailAutolink`,tokenize:oY,previous:gY},rY={};function iY(){return{text:rY}}for(var aY=48;aY<123;)rY[aY]=nY,aY++,aY===58?aY=65:aY===91&&(aY=97);rY[43]=nY,rY[45]=nY,rY[46]=nY,rY[95]=nY,rY[72]=[nY,tY],rY[104]=[nY,tY],rY[87]=[nY,eY],rY[119]=[nY,eY];function oY(e,t,n){let r=this,i,a;return o;function o(t){return!_Y(t)||!gY.call(r,r.previous)||vY(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return _Y(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check($J,u,l)(t):t===45||t===95||Bh(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&&zh(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function sY(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!mY.call(r,r.previous)||vY(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(YJ,e.attempt(XJ,e.attempt(ZJ,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function cY(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&hY.call(r,r.previous)&&!vY(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(zh(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||Hh(t)||Kh(t)||Yh(t)||Jh(t)?n(t):e.attempt(XJ,e.attempt(ZJ,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function lY(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 uY(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(QJ,c,s)(t):t===null||Kh(t)||Yh(t)||t!==45&&Jh(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 dY(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(QJ,t,a)(o):o===null||Kh(o)||Yh(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function fY(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||Kh(o)||Yh(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Kh(e)||Yh(e)?t(e):r(e)}function a(e){return zh(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):zh(t)?(e.consume(t),o):n(t)}}function pY(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Bh(e)?n(e):t(e)}}function mY(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Kh(e)}function hY(e){return!zh(e)}function gY(e){return!(e===47||_Y(e))}function _Y(e){return e===43||e===45||e===46||e===95||Bh(e)}function vY(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 yY={tokenize:DY,partial:!0};function bY(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:wY,continuation:{tokenize:TY},exit:EY}},text:{91:{name:`gfmFootnoteCall`,tokenize:CY},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:xY,resolveTo:SY}}}}function xY(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=Rh(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 SY(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 CY(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||Kh(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Rh(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Kh(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 wY(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||Kh(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Rh(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Kh(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),Qh(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function TY(e,t,n){return e.check(pg,t,e.attempt(yY,t,n))}function EY(e){e.exit(`gfmFootnoteDefinition`)}function DY(e,t,n){let r=this;return Qh(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 OY(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&&jh(o,o.length,0,og(s,e.slice(r+1,n),t)),jh(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),jh(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=ag(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=ag(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var kY=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){AY(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 AY(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 jY(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 MY(){return{flow:{null:{name:`table`,tokenize:NY,resolveAll:PY}}}}function NY(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?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):U(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):qh(t)?Qh(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||Kh(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,qh(t)?Qh(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 qh(t)?Qh(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||U(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 qh(t)?Qh(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||U(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||U(n)?(e.exit(`tableRow`),t(n)):qh(n)?Qh(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Kh(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 PY(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 kY;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(IY(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=FY(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=FY(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=FY(f,t,o,i,n,d)):(o[0]=o[1],d=FY(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&IY(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=jY(t.events,n))}return e}function FY(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},LY(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=LY(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=LY(t.events,n[2]),a=LY(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({},LY(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function IY(e,t,n,r,i){let a=[],o=LY(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 LY(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var RY={name:`tasklistCheck`,tokenize:BY};function zY(){return{text:{91:RY}}}function BY(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 Kh(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 U(r)?t(r):qh(r)?e.check({tokenize:VY},t,n)(r):n(r)}}function VY(e,t,n){return Qh(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function HY(e){return Ph([iY(),bY(),OY(e),MY(),zY()])}var UY={};function WY(e){let t=this,n=e||UY,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(HY(n)),a.push(qJ()),o.push(JJ(n))}var GY=new Set([`http:`,`https:`,`mailto:`]);function KY(e){try{return new URL(e)}catch{return}}function qY(e){let t=e===void 0?void 0:KY(e)?.protocol;return t!==void 0&&GY.has(t)?e:void 0}var JY={target:`_blank`,rel:`noopener noreferrer`},YY=typeof window>`u`?B.useEffect:B.useLayoutEffect;function XY(e,t){let n=(0,B.useRef)(null);return YY(()=>{let t=n.current;if(!t||e===void 0)return;let r=()=>{t.removeAttribute(`data-otg-table-cut`);let e=t.querySelector(`table`);if(!e||t.scrollHeight<=t.clientHeight)return;let n=e.getBoundingClientRect().top-t.getBoundingClientRect().top;t.toggleAttribute(`data-otg-table-cut`,n<t.clientHeight)};r();let i=t.clientWidth,a=new ResizeObserver(()=>{t.clientWidth!==i&&(i=t.clientWidth,r())});a.observe(t);let o=!0;return document.fonts?.ready.then(()=>{o&&r()}),()=>{o=!1,a.disconnect()}},[e,t]),n}function ZY(e){return e.tagName===`img`?{type:`text`,value:String(e.properties?.alt||`image`)}:(e.children&&=e.children.map(ZY),e)}function QY(){let e=t=>{t.tagName===`a`?ZY(t):t.children?.forEach(e)};return e}function $Y({href:e,children:t}){let n=qY(e);return(0,V.jsx)(`a`,{href:n,...n===void 0?{}:JY,children:t})}var eX={a:({href:e,children:t})=>(0,V.jsx)($Y,{href:e,children:t}),img:({src:e,alt:t})=>(0,V.jsx)($Y,{href:typeof e==`string`?e:void 0,children:t||`image`})},tX=[WY],nX=[QY];function rX({source:e,clamp:t}){let n=t!==void 0&&Number.isInteger(t)&&t>0?t:void 0,r=XY(n,e),i=n===void 0?void 0:{WebkitLineClamp:n,maxHeight:`calc(${n} * 1lh)`};return(0,V.jsx)(`div`,{className:n===void 0?`otg-markdown`:`otg-markdown otg-markdown--clamped`,ref:r,style:i,children:(0,V.jsx)(Db,{components:eX,rehypePlugins:nX,remarkPlugins:tX,children:e})})}function iX({title:e,body:t,badges:n,meta:r,links:i,actions:a,clamp:o,children:s,className:c,...l}){let u=(0,B.useId)();return(0,V.jsx)(`article`,{...l,"aria-labelledby":u,className:c?`otg-card ${c}`:`otg-card`,children:(0,V.jsxs)(`div`,{className:`otg-card__surface`,children:[(0,V.jsxs)(`div`,{className:`otg-card__header`,children:[n!=null&&(0,V.jsx)(`div`,{className:`otg-card__badges`,children:n}),(0,V.jsx)(`h3`,{className:`otg-card__title`,id:u,children:e}),a!=null&&(0,V.jsx)(`div`,{className:`otg-card__actions`,children:a})]}),r!=null&&(0,V.jsx)(`div`,{className:`otg-card__meta`,children:r}),i!=null&&(0,V.jsx)(`div`,{className:`otg-card__links`,children:i}),t?(0,V.jsx)(rX,{source:t,...o===void 0?{}:{clamp:o}}):null,s]})})}var aX=new Map([[`github.com`,`GitHub`],[`linear.app`,`Linear`]]);function oX(e){return aX.get(KY(e)?.hostname??``)??`tracker`}function sX({url:e,label:t,...n}){let r=qY(e);return(0,V.jsx)(`a`,{"aria-label":`Open ${oX(e)} issue ${t}`,...n,href:r,...JY,className:[`otg-source-link`,n.className].filter(Boolean).join(` `),children:t})}function cX({label:e,item:t,busyLabel:n=`${e}…`,reopen:r,sending:i,disabled:a=!1,onPress:o,className:s,control:c={}}){let[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(!1),p=(0,B.useId)(),m=t===void 0?e:`${e}: ${t}`,h=`Why ${e} is unavailable${t===void 0?``:`: ${t}`}`;return r?.available===!1?(0,V.jsxs)(`fieldset`,{"aria-label":`${m} (unavailable)`,className:`${s} human-items-unavailable`,onPointerEnter:()=>f(!0),onPointerLeave:()=>f(!1),children:[(0,V.jsx)(`button`,{"aria-describedby":p,disabled:!0,type:`button`,children:e}),(0,V.jsx)(`sup`,{className:`human-items-why-anchor`,children:(0,V.jsx)(`button`,{...c,"aria-controls":p,"aria-expanded":l,"aria-label":h,className:`human-items-why`,onClick:e=>{e.stopPropagation(),u(e=>!e)},type:`button`,children:`?`})}),(0,V.jsx)(`span`,{className:`human-items-why-tip`,hidden:!(l||d),id:p,role:`tooltip`,children:r.reason})]}):(0,V.jsx)(`button`,{...c,"aria-busy":i,"aria-label":i?void 0:m,className:s,disabled:a,onClick:()=>{i||o()},type:`button`,children:i?n:e})}var lX=15e3;function uX(e,t,n){let[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(``),[d,f]=(0,B.useState)(!1),p=(0,B.useRef)(null),{key:m,phase:h,followUp:g}=e,_=h===`sending`||g?.phase===`failed`||g?.phase===`sending`;return(0,B.useLayoutEffect)(()=>{if(f(!1),_)return;let e=setTimeout(()=>f(!0),lX);return()=>clearTimeout(e)},[`${m}:${h}:${g?.kind??``}:${g?.phase??``}`,_]),(0,B.useEffect)(()=>{c(!1),u(``)},[m]),(0,B.useEffect)(()=>{g?.kind===`note`&&g.phase===`done`&&(c(!1),u(``))},[g]),(0,B.useEffect)(()=>{if(!d||r||s)return;let e=p.current?.contains(document.activeElement)??!1;a&&e||t()},[d,r,a,s,t]),(0,B.useEffect)(()=>{if(!r)return;let e=e=>{let t=p.current;t!==null&&e.target instanceof Node&&!t.contains(e.target)&&i(!1)};return document.addEventListener(`pointerover`,e,!0),()=>document.removeEventListener(`pointerover`,e,!0)},[r]),(0,B.useEffect)(()=>{let e=p.current;if(e===null)return;let t=()=>n(e.getBoundingClientRect().height);t();let r=new ResizeObserver(t);return r.observe(e),()=>{r.disconnect(),n(0)}},[n]),{holds:{ref:p,onFocus:()=>o(!0),onBlur:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||o(!1)},onPointerEnter:()=>i(!0),onPointerLeave:()=>i(!1)},writing:s,setWriting:c,text:l,setText:u}}var dX={complete:`Completed`,dismiss:`Dismissed`,reopen:`Reopened`},fX={complete:`Completing`,dismiss:`Dismissing`,reopen:`Reopening`},pX={complete:`Reopened`,dismiss:`Restored`,reopen:`Reopened`};function mX(e){let{action:t,title:n,phase:r,error:i,followUp:a}=e;if(r===`failed`)return`Not ${dX[t].toLowerCase()}: ${n}. ${i??``}`.trim();let o=pX[t],s=t===`dismiss`?`Reason`:`Comment`;return a?.phase===`failed`?a.kind===`undo`?`Not ${o.toLowerCase()}: ${n}. ${a.error??``}`.trim():`${s} not saved: ${n}. ${a.error??``}`.trim():a?.phase===`done`?a.kind===`undo`?`${o}: ${n}`:`${s} saved: ${n}`:r===`sending`?`${fX[t]}: ${n}…`:`${dX[t]}: ${n}`}function hX({toast:e,onUndo:t,onNote:n,onClose:r,onRoom:i}){let{holds:a,writing:o,setWriting:s,text:c,setText:l}=uX(e,r,i),u=(0,B.useId)(),{action:d,phase:f,followUp:p}=e,m=f===`failed`||p?.phase===`failed`,h=f!==`failed`&&d!==`reopen`,g=p?.kind===`undo`&&p.phase===`done`,_=d===`dismiss`?`Add reason`:`Add comment`,v=d===`dismiss`?`Reason`:`Comment`,y=p?.kind===`note`&&p.phase===`sending`,b=p?.kind===`undo`&&p.phase===`sending`;return(0,V.jsxs)(`section`,{"aria-label":`Action result`,className:`human-items-toast`,"data-phase":p?.phase??f,"data-tone":m?`failure`:`success`,...a,children:[(0,V.jsx)(`p`,{className:`human-items-toast-message`,role:m?`alert`:`status`,children:mX(e)}),p?.kind===`note`&&p.saved!==void 0&&(0,V.jsx)(`blockquote`,{"aria-label":`Saved ${v.toLowerCase()}`,className:`human-items-toast-saved`,children:p.saved}),h&&!g&&(0,V.jsxs)(`div`,{className:`human-items-toast-actions`,children:[(0,V.jsx)(cX,{className:`human-items-toast-action`,disabled:b,label:d===`dismiss`?`Restore`:`Reopen`,onPress:t,reopen:e.reopen,sending:b}),!o&&(0,V.jsx)(`button`,{className:`human-items-toast-action`,onClick:()=>s(!0),type:`button`,children:_})]}),h&&!g&&o&&(0,V.jsxs)(`form`,{className:`human-items-toast-note`,onSubmit:e=>{e.preventDefault(),c.trim()!==``&&n(c)},children:[(0,V.jsx)(`label`,{className:`sr-only`,htmlFor:u,children:v}),(0,V.jsx)(`input`,{autoFocus:!0,id:u,onChange:e=>l(e.target.value),placeholder:`${v}, then Enter`,readOnly:y,value:c}),(0,V.jsx)(`button`,{"aria-busy":y,className:`human-items-toast-action`,disabled:y,type:`submit`,children:y?`Sending…`:p?.kind===`note`&&p.phase===`failed`?`Send again`:`Send`})]}),(0,V.jsx)(`button`,{"aria-label":`Close`,className:`human-items-toast-close`,onClick:r,type:`button`,children:(0,V.jsx)(Et,{"aria-hidden":`true`,size:14})})]})}var gX=eA.map(e=>({wire:e,label:tA[e]}));function _X(e){return tA[e.priority]}function vX(e){return e.kind===`task`?`Task`:`Question`}var yX={open:`Open`,answered:`Answered`,completed:`Completed`,dismissed:`Dismissed`,expired:`Expired`},bX=[`open`,`answered`,`completed`,`dismissed`,`expired`],xX=bX.map(e=>({state:e,label:yX[e]}));function SX(e){return yX[e.state]}function CX(e){return e.state===`open`&&e.block.scope!==`nothing`}function wX(e){return e===1?`1 step`:`${e} steps`}function TX(e){let{item:t,blocked:n}=e;if(!CX(t))return[];switch(t.block.scope){case`host`:return[`blocks all work on this host`];case`plan`:return[`blocks all of ${t.block.plan}`];case`work`:return n.plans.map(({plan:e,count:t})=>`blocks ${wX(t)} in ${e}`);default:return[]}}function EX(e){let t=TX(e);return e.item.block.scope===`work`?e.blocked.plans.map(({count:e,preview:n},r)=>{let i=e-n.length,a=n.map(({node:e})=>e).join(`, `);return`${t[r]}: ${a}${i>0?` +${i} more`:``}`}).join(`; `):t.join(`; `)}function DX(e){if(e.block.scope===`host`)return`host`;let{plan:t,run:n,session:r}=e.owner;return t!==null&&n!==null?`plan ${t} / run ${n}`:t===null?n===null?`session ${r}`:`run ${n}`:`plan ${t}`}function OX(e){let t=TX(e);if(e.item.block.scope!==`work`)return t.map(t=>({phrase:t,nodes:e.nodes}));let n=0;return e.blocked.plans.map(({count:r},i)=>{let a=e.nodes.slice(n,n+r);return n+=r,{phrase:t[i]??``,nodes:a}})}function kX(e){return e===`user`?`you`:`the manager`}function AX(e){return e.resolution?.provenance??`manager`}var jX={"human-item-raised":`Raised`,"human-item-answered":`Answered`,"human-item-completed":`Completed`,"human-item-dismissed":`Dismissed`,"human-item-auto-resolved":`Resolved`,"human-item-reopened":`Reopened`,"human-item-noted":`Note`,"human-item-expired":`Expired`};function MX(e){let t=e.action===`human-item-expired`&&e.actor===`engine`?`the engine`:kX(e.provenance);return`${jX[e.action]} by ${t}`}var NX=60;function PX(e,t){return e===1?`${t}`:`${e} ${t}s`}function FX(e){return e%3600==0?PX(e/3600,`hour`):e%60==0?PX(e/60,`minute`):PX(e,`second`)}function IX(e){return e.join(` `)}function LX(e){switch(e.when){case`time`:return e.at===void 0?`${FX(e.after_seconds??0)} after it was raised`:`at ${pe(e.at)}`;case`run`:return e.on===`settled`?`when run ${e.run} settles`:`when run ${e.run} ends`;case`node`:return`when step ${e.node} of run ${e.run} settles`;case`check`:return`when its check ${IX(e.command)} says so, checked every ${FX(e.interval_seconds??NX)}`}}function RX(e){let t=e.expiry??[];if(!(e.state!==`open`||t.length===0))return`Expires ${t.map(LX).join(`, or `)}`}function zX(e){switch(e.when){case`time`:return e.at===void 0?`${FX(e.after_seconds??0)} after it was raised`:`at ${pe(e.at)}`;case`run`:return`run ${e.run} ${e.on===`settled`?`settled`:`ended`}`;case`node`:return`step ${e.node} of run ${e.run} settled`;case`check`:return`its check ${IX(e.command)}`}}function BX(e){return e.charAt(0).toUpperCase()+e.slice(1)}function VX(e){let{resolution:t}=e;if(e.state!==`expired`||t===null)return;let n=t.condition??void 0;return{reason:BX(t.reason??``),held:n===void 0?``:BX(zX(n))}}function HX(e){switch(e.outcome){case`holds`:return`expired`;case`not-yet`:return`not yet`;case`failed`:return`failed: ${e.detail??``}`}}function UX(e){return e.item.state===`open`?(e.checks??[]).filter(({outcome:e})=>e===`failed`):[]}function WX(e){return(e.item.expiry??[]).map((t,n)=>({key:`${n}`,words:BX(LX(t)),last:e.checks?.find(e=>e.condition===n)}))}function GX(e){let{resolution:t}=e;if(t!==null){if(e.state===`dismissed`&&t.reason!==null)return{label:`Reason`,text:t.reason};if(e.state===`completed`&&t.text!==null)return{label:`Comment`,text:t.text}}}function KX(e){let{item:t}=e,{plan:n,run:r}=t.owner,i=TX(e).join(`; `),a={answered:`Answered`,completed:`Completed`,dismissed:`Dismissed`}[t.state],o=GX(t),s=VX(t);return[{label:`Priority`,value:_X(t)},{label:`Kind`,value:vX(t)},{label:`State`,value:SX(t)},{label:`Source`,value:DX(t)},...n===null?[]:[{label:`Plan`,value:n}],...r===null?[]:[{label:`Run`,value:r}],{label:`Blocks`,value:i===``?`Nothing`:i},{label:`Raised`,at:t.created_at},...a===void 0?[]:[{label:a,at:t.updated_at,party:kX(AX(t))}],...o===void 0?[]:[{label:o.label,value:o.text}],...s===void 0?[]:[{label:`Expired`,at:t.updated_at,party:`the engine`},{label:`Reason`,value:s.reason},{label:`Condition that held`,value:s.held}]]}function qX(e,t){return e.find(e=>e===t)}var JX=[``,`task`,`question`],YX=[``,`yes`,`no`],XX=[``,...eA],ZX=bX,QX=[``,`session`,`run`,`plan`,`host`],$X={kind:``,blocking:``,priority:``,state:`open`,source:``,sourceId:``};function eZ(e){let t=e.sourceId.trim();return{...e.kind===``?{}:{kind:e.kind},...e.blocking===``?{}:{blocking:e.blocking===`yes`},...e.priority===``?{}:{priority:e.priority},...e.state===`open`?{}:{state:e.state},...e.source===`host`?{host:!0}:{},...e.source!==``&&e.source!==`host`&&t!==``?{[e.source]:t}:{}}}function tZ(e){return Number(e.kind!==$X.kind)+Number(e.blocking!==$X.blocking)+Number(e.priority!==$X.priority)+Number(e.state!==$X.state)+Number(e.source!==$X.source)}var nZ=[`priority`,`kind`,`source`,`blocking`,`none`],rZ=`priority`,iZ=[{value:`priority`,label:`Priority`},{value:`kind`,label:`Kind`},{value:`source`,label:`Source`},{value:`blocking`,label:`Blocking`},{value:`none`,label:`None`}],aZ=[`default`,`newest`,`oldest`],oZ=`default`,sZ=[{value:`default`,label:`Default`},{value:`newest`,label:`Newest first`},{value:`oldest`,label:`Oldest first`}];function cZ(e,t){if(t==="default")return e;let n=t===`newest`?-1:1;return e.map(e=>({view:e,at:Date.parse(e.item.created_at)})).sort((e,t)=>n*(e.at-t.at)).map(({view:e})=>e)}function lZ(e){if(typeof e!=`object`||!e)return;let t=t=>{let n=Reflect.get(e,t);return typeof n==`string`?n:``},n=qX(ZX,t(`state`));if(n!==void 0)return{kind:qX(JX,t(`kind`))??``,blocking:qX(YX,t(`blocking`))??``,priority:qX(XX,t(`priority`))??``,state:n,source:qX(QX,t(`source`))??``,sourceId:t(`sourceId`)}}function uZ(e,t){let{item:n}=e;switch(t){case`priority`:return{key:n.priority,label:_X(n),rank:eA.indexOf(n.priority)};case`kind`:return{key:n.kind,label:vX(n),rank:n.kind===`task`?0:1};case`blocking`:return CX(n)?{key:`blocking`,label:`Blocking`,rank:0}:{key:`not-blocking`,label:`Not blocking`,rank:1};case`source`:{let e=DX(n);return{key:e,label:`Source: ${e}`,rank:0}}}}function dZ(e,t,n=oZ){if(t===`none`)return[{key:`all`,items:cZ(e,n)}];let r=new Map;return e.forEach((e,n)=>{let{key:i,label:a,rank:o}=uZ(e,t),s=r.get(i);s?s.items.push(e):r.set(i,{label:a,rank:o,first:n,items:[e]})}),[...r.entries()].sort(([,e],[,t])=>e.rank-t.rank||e.first-t.first).map(([e,{label:t,items:r}])=>({key:e,label:t,items:cZ(r,n)}))}function fZ({answers:e,onRoom:t}){let n=(0,B.useRef)(null),{count:r,remaining:i,sending:a,sendError:o,notices:s}=e,c=r>0||o!==void 0||s.length>0;return(0,B.useEffect)(()=>{let e=n.current;if(e===null)return;let r=()=>t(e.getBoundingClientRect().height);r();let i=new ResizeObserver(r);return i.observe(e),()=>{i.disconnect(),t(0)}},[t,c]),c?(0,V.jsxs)(`section`,{"aria-label":`Drafted answers`,className:`human-items-send`,ref:n,children:[r>0&&(0,V.jsxs)(`div`,{className:`human-items-send-bar`,children:[(0,V.jsx)(`button`,{"aria-busy":a,className:`human-items-send-action`,"data-primary":`true`,disabled:a,onClick:()=>void e.send(),type:`button`,children:a?`Sending…`:`Send ${r} ${r===1?`answer`:`answers`}`}),(0,V.jsx)(`button`,{className:`human-items-send-action`,disabled:a,onClick:e.discard,type:`button`,children:`Discard`}),i>0&&(0,V.jsxs)(`span`,{className:`human-items-send-more`,children:[i,` more after this`]})]}),o!==void 0&&(0,V.jsxs)(`p`,{className:`human-item-status`,"data-failed":`true`,role:`alert`,children:[`Not sent, and your drafts are kept: `,o]}),s.length>0&&(0,V.jsx)(`ul`,{"aria-label":`Not sent`,className:`human-items-not-sent`,children:s.map(t=>(0,V.jsxs)(`li`,{children:[(0,V.jsxs)(`p`,{children:[(0,V.jsxs)(`strong`,{children:[`Not sent: `,t.title]}),` (`,t.reason,`)`]}),t.choiceTitle!==void 0&&(0,V.jsxs)(`p`,{children:[`Choice: `,t.choiceTitle]}),t.text!==void 0&&(0,V.jsx)(rX,{source:t.text}),(0,V.jsx)(`button`,{className:`human-items-send-action`,onClick:()=>e.clearNotice(t.key),type:`button`,children:`Clear`})]},t.key))})]}):null}var pZ=`answered or dismissed elsewhere`,mZ=`onepipeline-ui.human-items.draft.`,hZ=/^[^\s/?#]+$/u,gZ=J({title:K(),choice:K().optional(),choiceTitle:K().optional(),text:K().optional()});function _Z(){try{let e={};for(let t=0;t<window.localStorage.length;t+=1){let n=window.localStorage.key(t);if(n===null||!n.startsWith(mZ))continue;let r=n.slice(33),i=vZ(window.localStorage.getItem(n));i!==void 0&&hZ.test(r)&&(e[r]=i)}return e}catch{return}}function vZ(e){if(e!==null)try{let t=gZ.safeParse(JSON.parse(e));return t.success?t.data:void 0}catch{return}}function yZ(e,t){try{t===void 0?window.localStorage.removeItem(`${mZ}${e}`):window.localStorage.setItem(`${mZ}${e}`,JSON.stringify(t))}catch{}}function bZ(e){return e!==void 0&&e.trim()!==``}function xZ(e){return e.choice!==void 0||bZ(e.text)}function SZ(e,t){return{id:e,...t.choice===void 0?{}:{choice:t.choice},...bZ(t.text)?{text:t.text}:{}}}function CZ(e){return e.kind===`conflict`?e.reason:`human items are unavailable on this host`}async function wZ(e,t){try{return(await e.getHumanItem(t)).item.state!==`open`}catch(e){return e instanceof kN&&e.status===404||void 0}}function TZ(e,t){return e[t]===void 0?e:Object.fromEntries(Object.entries(e).filter(([e])=>e!==t))}function EZ(e,t,n,r,i,a){let[o,s]=(0,B.useState)(()=>_Z()??{}),[c,l]=(0,B.useState)({}),[u,d]=(0,B.useState)([]),[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(),g=(0,B.useRef)(!1),_=(0,B.useRef)(0),v=(0,B.useRef)(o);v.current=o;let y=(0,B.useRef)(new Set),b=(0,B.useRef)(new Set),x=(0,B.useRef)(0),S=(0,B.useCallback)((e,t)=>{yZ(e,t),s(n=>t===void 0?TZ(n,e):{...n,[e]:t}),l(t=>TZ(t,e)),h(void 0)},[]),C=(0,B.useCallback)((e,t)=>{let n=v.current[e];if(n===void 0)return;yZ(e,void 0),s(t=>TZ(t,e)),l(t=>TZ(t,e)),_.current+=1;let r=_.current;d(e=>[...e,{...n,key:r,reason:t}])},[]),w=(0,B.useCallback)((e,t)=>{let{id:n,title:r}=e.item,{text:i}=v.current[n]??{},a={title:r,...v.current[n]?.choice===t.id?{}:{choice:t.id,choiceTitle:t.title},...i===void 0?{}:{text:i}};S(n,xZ(a)?a:void 0)},[S]),T=(0,B.useCallback)((e,t)=>{let{id:n,title:r}=e.item,{choice:i,choiceTitle:a}=v.current[n]??{},o={title:r,...i===void 0?{}:{choice:i},...a===void 0?{}:{choiceTitle:a},...t===``?{}:{text:t}};S(n,o.choice===void 0&&t===``?void 0:o)},[S]),E=Object.entries(o).filter(([,e])=>xZ(e)),D=E.slice(0,50),O=(0,B.useCallback)(async(t,n)=>{await wZ(e,t)===!0?C(t,n):l(e=>({...e,[t]:n}))},[e,C]),k=(0,B.useCallback)(async()=>{if(g.current)return;let t=_Z(),n=D.filter(([e])=>t!==void 0&&t[e]===void 0);for(let[e]of n)s(t=>TZ(t,e));let r=D.flatMap(([e,t])=>n.some(([t])=>t===e)?[]:[SZ(e,t)]);if(r.length!==0){g.current=!0,p(!0),h(void 0),a(r.map(({id:e})=>e));try{let t=await e.answerHumanItems(r);for(let{item:e}of t.answered)yZ(e.item.id,void 0),s(t=>TZ(t,e.item.id)),l(t=>TZ(t,e.item.id));i(t.answered),await Promise.all(t.refused.map(({id:e,refusal:t})=>O(e,CZ(t))))}catch(e){h(e instanceof Error?e.message:String(e))}finally{g.current=!1,p(!1),a([])}}},[D,e,i,a,O]),A=(0,B.useCallback)(()=>{for(let e of Object.keys(v.current))yZ(e,void 0);s({}),l({}),h(void 0)},[]),j=(0,B.useCallback)(e=>{d(t=>t.filter(t=>t.key!==e))},[]);return(0,B.useEffect)(()=>{y.current.clear(),x.current+=1},[n]),(0,B.useEffect)(()=>{if(t===void 0||f)return;for(let e of Object.keys(o)){if(r(e))continue;let i=t.find(({item:t})=>t.id===e);if(i!==void 0){y.current.delete(e),i.item.state!==`open`&&C(e,pZ);continue}y.current.has(e)||b.current.has(e)||n(e)}function n(t){let r=x.current;b.current.add(t),wZ(e,t).then(e=>{if(e===!1&&r!==x.current&&!g.current){n(t);return}b.current.delete(t),!g.current&&(e===!0?C(t,pZ):e===!1&&y.current.add(t))})}},[e,o,t,C,f,r]),{drafts:o,refusals:c,notices:u,sending:f,sendError:m,count:D.length,remaining:E.length-D.length,pressChoice:w,setText:T,retire:C,send:k,discard:A,clearNotice:j}}function DZ(e,t,n,r=String){let[i,a]=(0,B.useState)(()=>{try{let r=window.localStorage.getItem(e);return(r===null?void 0:t(r))??n}catch{return n}});return[i,(0,B.useCallback)(t=>{a(t);try{window.localStorage.setItem(e,r(t))}catch{}},[e,r])]}var OZ=`onepipeline-ui.human-items.filters`;function kZ(e){try{return lZ(JSON.parse(e))}catch{return}}function AZ(e){let[t,n]=DZ(OZ,kZ,$X,JSON.stringify),[r,i]=(0,B.useState)(),a=(0,B.useMemo)(()=>{if(!e)return;let n=eZ(t);return{type:`human-items`,...Object.keys(n).length===0?{}:{filter:n},...r===void 0?{}:{item:r}}},[e,JSON.stringify(eZ(t)),r]);return(0,B.useEffect)(()=>{e||i(void 0)},[e]),{choice:t,setChoice:n,selectedId:r,setSelectedId:i,view:a}}function jZ(e,t,n,r,i=``){let[a,o]=(0,B.useState)({}),[s,c]=(0,B.useState)(),[l,u]=(0,B.useState)([]),[d,f]=(0,B.useState)({}),[p,m]=(0,B.useState)({}),[h,g]=(0,B.useState)(),_=(0,B.useRef)(new Set),v=(0,B.useRef)(new Map),y=(0,B.useRef)(0),b=(0,B.useRef)(void 0);b.current=s;let x=t.items,S=(0,B.useRef)(i);S.current=i,(0,B.useEffect)(()=>{m(e=>Object.keys(e).length===0?e:{})},[i]);let C=(0,B.useMemo)(()=>{if(x===void 0)return;let e=x.flatMap(e=>{let t=d[e.item.id];if(t!==void 0)return[t.view];let n=p[e.item.id]?.view;return n===void 0||!NZ(n,e)?[e]:n.item.state===r?[n]:[]}),t=t=>e.some(({item:e})=>e.id===t);for(let{view:n,at:a,filter:o}of Object.values(p))o===i&&n.item.state===r&&!t(n.item.id)&&e.splice(Math.min(a,e.length),0,n);for(let{view:n,at:r}of[...l,...Object.values(d)])t(n.item.id)||e.splice(Math.min(r,e.length),0,n);return e},[x,l,p,d,r,i]);(0,B.useEffect)(()=>{x!==void 0&&m(e=>{let t=Object.entries(e).filter(([e,{view:t}])=>{let n=x.find(({item:t})=>t.id===e);return n===void 0?t.item.state===r:NZ(t,n)});return t.length===Object.keys(e).length?e:Object.fromEntries(t)})},[x,r]);let w=t.error===void 0&&t.item===n?t.detail:void 0,T=n===void 0?void 0:p[n]?.view,E=w&&T!==void 0&&NZ(T,{item:w.item})?{...w,item:T.item,reopen:T.reopen}:w,D=(0,B.useRef)(x);D.current=x;let O=EZ(e,x,i,(0,B.useCallback)(e=>_.current.has(e),[]),(0,B.useCallback)(e=>{let t=S.current;m(n=>{let r={...n};for(let{item:n}of e){let e=Math.max(0,D.current?.findIndex(({item:e})=>e.id===n.item.id)??0);r[n.item.id]={view:n,at:e,filter:t}}return r});let n=new Set(e.map(({item:e})=>e.item.id));u(e=>e.filter(({view:e})=>!n.has(e.item.id)))},[]),(0,B.useCallback)(e=>{let t=D.current??[];u(e.flatMap(e=>{let n=t.findIndex(({item:t})=>t.id===e),r=t[n];return r===void 0?[]:[{view:r,at:n}]}))},[])),{retire:k}=O,A=(0,B.useCallback)((e,t)=>c(n=>n?.key===e?t(n):n),[]),j=(0,B.useCallback)((t,n,r)=>{let{id:i,title:a}=t.item;if(_.current.has(i))return;_.current.add(i);let s=++y.current,l=S.current,u=Math.max(0,D.current?.findIndex(({item:e})=>e.id===i)??0);o(e=>({...e,[i]:{pending:n.action}})),f(e=>({...e,[i]:{view:t,at:u}})),c({key:s,id:i,title:a,action:n.action,phase:`sending`});let d=n.action===`complete`?e.completeHumanItem(i):n.action===`dismiss`?e.dismissHumanItem(i,n.reason):e.reopenHumanItem(i);v.current.set(s,d),d.then(e=>{m(t=>({...t,[i]:{view:e.item,at:u,filter:l}})),o(e=>({...e,[i]:{}})),n.action!==`reopen`&&k(i,`dismissed here`),r?.(),A(s,t=>({...t,phase:`done`,reopen:e.item.reopen}))},e=>{let t=FZ(e);o(e=>({...e,[i]:{error:t}})),A(s,e=>({...e,phase:`failed`,error:t})),g({id:i})}).finally(()=>{_.current.delete(i),f(MZ(i))})},[e,A,k]),M=(0,B.useCallback)((e,t)=>{let n=b.current;if(n===void 0)return;let r=v.current.get(n.key);if(r===void 0||n.followUp?.phase===`sending`)return;let{key:i,id:a}=n,o=S.current;A(i,t=>({...t,followUp:{kind:e,phase:`sending`}})),r.then(n=>{if(e===`undo`&&!n.item.reopen.available){A(i,e=>({...e,followUp:void 0}));return}t(a).then(t=>{m(e=>({...e,[a]:{view:t.item,at:e[a]?.at??0,filter:o}}));let n=e===`note`?PZ(t.item.item):void 0;A(i,r=>({...r,reopen:t.item.reopen,followUp:{kind:e,phase:`done`,...n===void 0?{}:{saved:n}}}))},t=>A(i,n=>({...n,followUp:{kind:e,phase:`failed`,error:FZ(t)}})))},()=>A(i,e=>({...e,followUp:void 0})))},[A]),N=(0,B.useCallback)(()=>M(`undo`,t=>e.reopenHumanItem(t)),[e,M]),P=(0,B.useCallback)(t=>M(`note`,n=>e.noteHumanItem(n,t)),[e,M]),F=(0,B.useCallback)(()=>c(void 0),[]);return{items:C,listError:n===void 0||C===void 0?t.error:void 0,detail:E===null?void 0:E,gone:n!==void 0&&E===null,detailError:n===void 0?void 0:t.error,writes:a,answers:O,write:j,toast:s,undo:N,note:P,closeToast:F,returned:h}}function MZ(e){return t=>t[e]===void 0?t:Object.fromEntries(Object.entries(t).filter(([t])=>t!==e))}function NZ(e,t){return Date.parse(e.item.updated_at)>Date.parse(t.item.updated_at)}function PZ(e){let{resolution:t}=e;if(t!==null)return(e.state===`dismissed`?t.reason:t.text)??void 0}function FZ(e){return e instanceof Error?e.message:String(e)}var IZ=`onepipeline-ui.human-items.group-by`,LZ=`onepipeline-ui.human-items.sort`,RZ=e=>qX(nZ,e),zZ=e=>qX(aZ,e);function BZ(){let[e,t]=DZ(IZ,RZ,rZ),[n,r]=DZ(LZ,zZ,oZ);return{groupBy:e,setGroupBy:t,sort:n,setSort:r}}var VZ=`data-card-action`,HZ=4;function UZ({client:e,live:t,choice:n,setChoice:r,selectedId:i,setSelectedId:a}){let o=jZ(e,t,i,n.state,JSON.stringify(n)),{groupBy:s,setGroupBy:c,sort:l,setSort:u}=BZ(),[d,f]=(0,B.useState)(0),[p,m]=(0,B.useState)(0),h=(0,B.useRef)(null),g=o.items?.find(({item:e})=>e.id===i)??o.detail,_=(0,B.useRef)(void 0);g===void 0?_.current?.item.id!==i&&(_.current=void 0):_.current=g;let v=(0,B.useRef)(i);v.current=i;let y=(e,t)=>{o.write(e,t,()=>{v.current===e.item.id&&a(void 0)})},b=o.returned;(0,B.useEffect)(()=>{b!==void 0&&h.current?.querySelector(`[data-item-id="${CSS.escape(b.id)}"]`)?.scrollIntoView({block:`nearest`})},[b]);let x=dZ(o.items??[],s,l);return(0,V.jsxs)(`section`,{"aria-label":`Action items`,className:`human-items-page`,"data-detail-open":i!==void 0,style:WZ(d,p),children:[(0,V.jsx)(qZ,{choice:n,groupBy:s,onChange:r,onGroupBy:c,onSort:u,sort:l}),(0,V.jsxs)(`div`,{className:`human-items-body`,children:[(0,V.jsxs)(`section`,{"aria-label":`Action item list`,className:`human-items-list`,children:[o.listError&&(0,V.jsx)(`p`,{role:`alert`,children:o.listError}),o.items===void 0&&!o.listError&&(0,V.jsx)(`p`,{role:`status`,children:`Reading action items…`}),o.items?.length===0&&(0,V.jsx)(`p`,{role:`status`,children:`No action items match these filters.`}),(0,V.jsx)(`div`,{className:`human-items-groups`,onKeyDown:e=>KZ(e,h.current),ref:h,children:x.map(e=>(0,V.jsx)(GZ,{answering:o.answers,group:e,groupBy:s,onSelect:a,onWrite:y,selectedId:i,writes:o.writes},e.key))}),(o.items?.length??0)>0&&(0,V.jsx)(`button`,{className:`card-actions-entry`,onFocus:()=>h.current?.querySelector(`[${VZ}]`)?.focus(),type:`button`,children:`Card actions: use the arrow keys`})]}),i!==void 0&&(0,V.jsx)(fQ,{answering:o.answers,error:o.detailError,detail:o.detail,gone:o.gone,lastShown:_.current,onClose:()=>a(void 0),onWrite:y,state:o.writes[i],view:g})]}),(0,V.jsx)(fZ,{answers:o.answers,onRoom:m}),o.toast&&(0,V.jsx)(hX,{onClose:o.closeToast,onNote:o.note,onRoom:f,onUndo:o.undo,toast:o.toast})]})}function WZ(e,t){return{"--toast-room":`${e}px`,"--send-room":`${t}px`}}function GZ({group:e,groupBy:t,selectedId:n,writes:r,answering:i,onSelect:a,onWrite:o}){let s=(0,B.useId)(),c=e.items.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsx)(ZZ,{answering:i,groupBy:t,onSelect:()=>a(e.item.id),onWrite:o,selected:e.item.id===n,state:r[e.item.id],view:e})},e.item.id));return e.label===void 0?(0,V.jsx)(`ul`,{"aria-label":`Action items`,children:c}):(0,V.jsxs)(`section`,{"aria-labelledby":s,className:`human-items-group`,children:[(0,V.jsxs)(`h2`,{className:`human-items-group-heading`,id:s,children:[e.label,` `,(0,V.jsxs)(`span`,{className:`human-items-group-count`,children:[`(`,e.items.length,`)`]})]}),(0,V.jsx)(`ul`,{"aria-labelledby":s,children:c})]})}function KZ(e,t){let n=e.target;if(t===null||!(n instanceof HTMLElement)||!n.hasAttribute(VZ))return;let r=[...t.querySelectorAll(`[${VZ}]`)],i=r.indexOf(n),a=e.key===`ArrowRight`||e.key===`ArrowDown`?r[Math.min(i+1,r.length-1)]:e.key===`ArrowLeft`||e.key===`ArrowUp`?r[Math.max(i-1,0)]:e.key===`Home`?r[0]:e.key===`End`?r.at(-1):void 0;a!==void 0&&(e.preventDefault(),a.focus())}function qZ({choice:e,groupBy:t,sort:n,onChange:r,onGroupBy:i,onSort:a}){let o=(0,B.useId)(),[s,c]=(0,B.useState)(!1),l=(t,n)=>r({...e,[t]:n}),u=e.source!==``&&e.source!==`host`,d=tZ(e)+Number(t!==rZ);return(0,V.jsxs)(`div`,{className:`human-items-controls`,"data-open":s,children:[(0,V.jsxs)(`button`,{"aria-controls":`${o}-filters`,"aria-expanded":s,"aria-label":d>0?`Filters, ${d} changed`:`Filters`,className:`human-items-filters-toggle`,onClick:()=>c(e=>!e),type:`button`,children:[(0,V.jsx)(bt,{"aria-hidden":`true`,size:14}),`Filters`,d>0&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`human-items-filters-count`,children:d})]}),(0,V.jsx)(`select`,{"aria-label":`Sort`,className:`human-items-sort-toggle`,onChange:e=>a(JZ(e.target.value)),value:n,children:sZ.map(({value:e,label:t})=>(0,V.jsxs)(`option`,{value:e,children:[`Sort: `,t]},e))}),(0,V.jsxs)(`fieldset`,{className:`human-items-filters`,id:`${o}-filters`,children:[(0,V.jsx)(`legend`,{className:`sr-only`,children:`Filter action items`}),(0,V.jsx)(`label`,{htmlFor:`${o}-group`,children:`Group by`}),(0,V.jsx)(`select`,{id:`${o}-group`,onChange:e=>i(qX(nZ,e.target.value)??`priority`),value:t,children:iZ.map(({value:e,label:t})=>(0,V.jsx)(`option`,{value:e,children:t},e))}),(0,V.jsx)(`label`,{className:`human-items-sort-label`,htmlFor:`${o}-sort`,children:`Sort`}),(0,V.jsx)(`select`,{className:`human-items-sort-select`,id:`${o}-sort`,onChange:e=>a(JZ(e.target.value)),value:n,children:sZ.map(({value:e,label:t})=>(0,V.jsx)(`option`,{value:e,children:t},e))}),(0,V.jsx)(`label`,{htmlFor:`${o}-kind`,children:`Kind`}),(0,V.jsxs)(`select`,{id:`${o}-kind`,onChange:e=>l(`kind`,qX(JX,e.target.value)??``),value:e.kind,children:[(0,V.jsx)(`option`,{value:``,children:`Any kind`}),(0,V.jsx)(`option`,{value:`task`,children:`Task`}),(0,V.jsx)(`option`,{value:`question`,children:`Question`})]}),(0,V.jsx)(`label`,{htmlFor:`${o}-blocking`,children:`Blocking`}),(0,V.jsxs)(`select`,{id:`${o}-blocking`,onChange:e=>l(`blocking`,qX(YX,e.target.value)??``),value:e.blocking,children:[(0,V.jsx)(`option`,{value:``,children:`Any`}),(0,V.jsx)(`option`,{value:`yes`,children:`Yes`}),(0,V.jsx)(`option`,{value:`no`,children:`No`})]}),(0,V.jsx)(`label`,{htmlFor:`${o}-priority`,children:`Priority`}),(0,V.jsxs)(`select`,{id:`${o}-priority`,onChange:e=>l(`priority`,qX(XX,e.target.value)??``),value:e.priority,children:[(0,V.jsx)(`option`,{value:``,children:`Any priority`}),gX.map(({wire:e,label:t})=>(0,V.jsx)(`option`,{value:e,children:t},e))]}),(0,V.jsx)(`label`,{htmlFor:`${o}-state`,children:`State`}),(0,V.jsx)(`select`,{id:`${o}-state`,onChange:e=>l(`state`,qX(ZX,e.target.value)??`open`),value:e.state,children:xX.map(({state:e,label:t})=>(0,V.jsx)(`option`,{value:e,children:t},e))}),(0,V.jsx)(`label`,{htmlFor:`${o}-source`,children:`Source`}),(0,V.jsxs)(`select`,{id:`${o}-source`,onChange:e=>l(`source`,qX(QX,e.target.value)??``),value:e.source,children:[(0,V.jsx)(`option`,{value:``,children:`Any source`}),(0,V.jsx)(`option`,{value:`session`,children:`Session`}),(0,V.jsx)(`option`,{value:`run`,children:`Run`}),(0,V.jsx)(`option`,{value:`plan`,children:`Plan`}),(0,V.jsx)(`option`,{value:`host`,children:`Host`})]}),u&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`label`,{htmlFor:`${o}-source-id`,children:`Source identifier`}),(0,V.jsx)(`input`,{id:`${o}-source-id`,onChange:e=>l(`sourceId`,e.target.value),placeholder:`${e.source} id`,type:`search`,value:e.sourceId})]})]})]})}function JZ(e){return qX(aZ,e)??`default`}function YZ(e){return e.target instanceof Element&&e.target.closest(`a, button, textarea, input, select, [data-long-pressed="true"]`)===null}function XZ({view:e,groupBy:t}){let{item:n}=e;return(0,V.jsxs)(V.Fragment,{children:[n.state===`expired`&&(0,V.jsx)(`span`,{className:`human-item-expired-badge`,children:SX(n)}),t!==`priority`&&(0,V.jsx)(`span`,{className:`human-item-priority`,"data-priority":n.priority,children:_X(n)}),t!==`kind`&&(0,V.jsx)(`span`,{className:`human-item-kind`,children:vX(n)}),t!==`blocking`&&CX(n)&&(0,V.jsx)(`span`,{className:`human-item-blocking`,children:`Blocking`})]})}function ZZ({view:e,groupBy:t,selected:n,state:r,answering:i,onSelect:a,onWrite:o}){let{item:s}=e,c=s.state===`open`,l=s.state===`expired`,u=EX(e),d=[{key:`raised`,part:(0,V.jsx)(nQ,{at:s.created_at})},...c||l?[]:[{key:`state`,part:SX(s)}],...u?[{key:`blocked`,part:u}]:[],...t===`source`?[]:[{key:`source`,part:`Source: ${DX(s)}`}]],f=(s.choices?.length??0)>0,p=GX(s);return(0,V.jsxs)(iX,{actions:(0,V.jsx)(QZ,{item:e,onSelect:a,onWrite:o,state:r}),badges:(0,V.jsx)(XZ,{groupBy:t,view:e}),body:s.body,className:`human-item-card`,clamp:HZ,"data-blocking":CX(s),"data-expired":l,"data-item-id":s.id,"data-selected":n,meta:d.map(({key:e,part:t},n)=>(0,V.jsxs)(B.Fragment,{children:[n>0&&` · `,(0,V.jsx)(`span`,{children:t})]},e)),onClick:e=>{YZ(e)&&a()},title:s.title,children:[s.kind===`question`&&c&&f&&(0,V.jsxs)(`fieldset`,{className:`human-item-choices`,children:[(0,V.jsxs)(`legend`,{className:`sr-only`,children:[`Choices: `,s.title]}),s.choices?.map(t=>(0,V.jsx)(aQ,{answering:i,choice:t,view:e},t.id))]}),s.kind===`question`&&c&&(0,V.jsx)(oQ,{answering:i,label:`Answer: ${s.title}`,view:e}),(0,V.jsx)(lQ,{view:e}),p&&(0,V.jsx)(iQ,{label:p.label,text:p.text}),(0,V.jsx)(sQ,{view:e}),(0,V.jsx)(uQ,{reason:i.refusals[s.id]}),(0,V.jsx)(dQ,{state:r})]})}function QZ({item:e,state:t,onSelect:n,onWrite:r}){let{item:i}=e,a=i.state===`open`,o=t?.pending;return(0,V.jsxs)(V.Fragment,{children:[i.tracker&&(0,V.jsx)(sX,{className:`human-item-tracker`,"data-card-action":``,label:i.tracker.task,title:i.tracker.task,onClick:e=>e.stopPropagation(),tabIndex:-1,url:i.tracker.url}),(0,V.jsx)(`button`,{className:`human-item-action`,"data-card-action":``,tabIndex:-1,onClick:n,type:`button`,"aria-label":`Details: ${i.title}`,children:`Details`}),a&&i.kind===`task`&&(0,V.jsx)(tQ,{action:`complete`,control:$Z,className:`human-item-action`,name:`Complete: ${i.title}`,onPress:()=>r(e,{action:`complete`}),pending:o}),a&&(0,V.jsx)(tQ,{action:`dismiss`,control:$Z,className:`human-item-action`,name:`Dismiss: ${i.title}`,onPress:()=>r(e,{action:`dismiss`}),pending:o}),!a&&(0,V.jsx)(cX,{busyLabel:`Reopening…`,className:`human-item-action`,control:$Z,disabled:o!==void 0,label:`Reopen`,item:i.title,onPress:()=>r(e,{action:`reopen`}),reopen:e.reopen,sending:o===`reopen`})]})}var $Z={[VZ]:``,tabIndex:-1},eQ={complete:{label:`Complete`,busy:`Completing…`},dismiss:{label:`Dismiss`,busy:`Dismissing…`}};function tQ({action:e,name:t,pending:n,onPress:r,className:i,control:a={},children:o}){let s=n===e,c=eQ[e],l={...a,"aria-busy":s,"aria-label":s?void 0:t,className:i,disabled:n!==void 0,onClick:r,type:`button`,children:s?c.busy:c.label};return o?o(l):(0,V.jsx)(`button`,{...l})}function nQ({at:e}){let[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(!1),a=(0,B.useRef)(void 0),o=(0,B.useId)(),s=ke(e),c=()=>clearTimeout(a.current);return(0,V.jsxs)(`span`,{"aria-describedby":t?o:void 0,className:`human-item-raised`,"data-long-pressed":r,tabIndex:-1,onPointerCancel:c,onPointerEnter:e=>{e.pointerType===`mouse`&&n(!0)},onPointerDown:e=>{i(!1),e.pointerType!==`mouse`&&(c(),a.current=setTimeout(()=>{n(!0),i(!0)},rQ))},onPointerLeave:()=>{c(),n(!1)},onPointerUp:c,children:[`Raised `,(0,V.jsx)(u,{at:e,relative:!0}),t&&s!==void 0&&(0,V.jsx)(`span`,{className:`human-item-raised-tip`,id:o,role:`tooltip`,children:R(s)})]})}var rQ=500;function iQ({label:e,text:t}){return(0,V.jsxs)(`p`,{className:`human-item-note`,children:[(0,V.jsxs)(`span`,{className:`human-item-note-label`,children:[e,`:`]}),` `,t]})}function aQ({view:e,choice:t,answering:n}){return(0,V.jsx)(`button`,{"aria-pressed":n.drafts[e.item.id]?.choice===t.id,className:`human-item-choice`,disabled:n.sending,onClick:()=>n.pressChoice(e,t),type:`button`,children:t.title})}function oQ({view:e,label:t,answering:n}){return(0,V.jsx)(`textarea`,{"aria-busy":n.sending,"aria-label":t,className:`human-item-answer`,onChange:t=>n.setText(e,t.target.value),onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||e.preventDefault()},placeholder:(e.item.choices?.length??0)>0?`Or write your own answer`:`Write an answer`,readOnly:n.sending,rows:1,value:n.drafts[e.item.id]?.text??``})}function sQ({view:e}){let t=VX(e.item);if(t!==void 0)return(0,V.jsxs)(`p`,{className:`human-item-expiry-reason`,children:[t.reason,t.held!==``&&(0,V.jsxs)(`span`,{className:`human-item-expiry-held`,children:[` · `,t.held]})]});let n=RX(e.item);return(0,V.jsxs)(V.Fragment,{children:[n!==void 0&&(0,V.jsx)(`p`,{className:`human-item-expiry`,children:n}),UX(e).map(e=>(0,V.jsxs)(`p`,{className:`human-item-status human-item-check-failed`,"data-failed":`true`,title:e.detail??void 0,children:[`Check `,HX(e)]},e.condition))]})}function cQ({view:e}){if(e.item.state!==`open`)return null;let t=WX(e);return t.length===0?null:(0,V.jsxs)(`section`,{"aria-label":`Expiry`,className:`human-item-detail-expiry`,children:[(0,V.jsx)(`h3`,{children:`Expiry`}),(0,V.jsx)(`ul`,{children:t.map(({key:e,words:t,last:n})=>(0,V.jsxs)(`li`,{children:[t,n!==void 0&&(0,V.jsxs)(`p`,{className:`human-item-check-detail`,"data-failed":n.outcome===`failed`,children:[`Last check `,HX(n),` · `,(0,V.jsx)(u,{at:n.last_run_at,relative:!0})]})]},e))})]})}function lQ({view:e}){let{item:t}=e;if(t.state!==`answered`||t.resolution===null)return null;let{choice:n,text:r}=t.resolution,i=t.choices?.find(({id:e})=>e===n);return(0,V.jsxs)(`section`,{"aria-label":`Answer`,className:`human-item-answered`,children:[i&&(0,V.jsx)(`p`,{className:`human-item-answered-choice`,children:i.title}),r!==null&&(0,V.jsx)(rX,{source:r})]})}function uQ({reason:e}){return e===void 0?null:(0,V.jsxs)(`p`,{className:`human-item-status`,"data-failed":`true`,role:`alert`,children:[`Not sent: `,e]})}function dQ({state:e}){return e?.error?(0,V.jsx)(`p`,{className:`human-item-status`,"data-failed":`true`,role:`alert`,children:e.error}):null}function fQ({view:e,detail:t,gone:n,lastShown:r,error:i,state:a,answering:o,onWrite:s,onClose:c}){if(n&&e===void 0)return(0,V.jsxs)(`aside`,{"aria-label":`Action item detail`,className:`human-item-detail`,children:[(0,V.jsxs)(`header`,{className:`human-item-detail-head`,children:[r&&(0,V.jsx)(`h2`,{children:r.item.title}),(0,V.jsx)(Wi,{"aria-label":`Close detail`,onClick:c,size:`sm`,type:`button`,variant:`ghost`,children:(0,V.jsx)(Et,{size:14})})]}),(0,V.jsx)(`p`,{role:`status`,children:`Resolved: this item needs nothing more from you.`})]});let l=t??e;if(l===void 0)return(0,V.jsxs)(`aside`,{"aria-label":`Action item detail`,className:`human-item-detail`,children:[(0,V.jsx)(Wi,{"aria-label":`Close detail`,onClick:c,size:`sm`,type:`button`,variant:`ghost`,children:(0,V.jsx)(Et,{size:14})}),i?(0,V.jsx)(`p`,{role:`alert`,children:i}):(0,V.jsx)(`p`,{role:`status`,children:`Reading…`})]});let{item:d}=l,f=d.state===`open`,p=d.choices??[],m=d.kind===`question`&&f;return(0,V.jsxs)(`aside`,{"aria-label":`Action item detail`,className:`human-item-detail`,tabIndex:0,children:[(0,V.jsxs)(`header`,{className:`human-item-detail-head`,children:[(0,V.jsx)(`h2`,{children:d.title}),(0,V.jsx)(Wi,{"aria-label":`Close detail`,onClick:c,size:`sm`,type:`button`,variant:`ghost`,children:(0,V.jsx)(Et,{size:14})})]}),i&&(0,V.jsx)(`p`,{role:`alert`,children:i}),(0,V.jsx)(`section`,{"aria-label":`Full body`,className:`human-item-detail-body`,children:(0,V.jsx)(rX,{source:d.body})}),m&&p.length>0&&(0,V.jsxs)(`fieldset`,{className:`human-item-choice-list`,children:[(0,V.jsx)(`legend`,{children:`Choices`}),p.map(e=>(0,V.jsxs)(`div`,{className:`human-item-choice-entry`,children:[(0,V.jsx)(aQ,{answering:o,choice:e,view:l}),(0,V.jsx)(`div`,{className:`human-item-choice-description`,children:(0,V.jsx)(rX,{source:e.description})})]},e.id))]}),m&&(0,V.jsx)(oQ,{answering:o,label:`Answer in detail: ${d.title}`,view:l}),(0,V.jsx)(lQ,{view:l}),(0,V.jsx)(cQ,{view:l}),(0,V.jsx)(uQ,{reason:o.refusals[d.id]}),(0,V.jsxs)(`div`,{className:`human-item-detail-actions`,children:[f&&d.kind===`task`&&(0,V.jsx)(tQ,{action:`complete`,onPress:()=>s(l,{action:`complete`}),pending:a?.pending,children:e=>(0,V.jsx)(Wi,{...e,size:`sm`})}),f&&(0,V.jsx)(tQ,{action:`dismiss`,onPress:()=>s(l,{action:`dismiss`}),pending:a?.pending,children:e=>(0,V.jsx)(Wi,{...e,size:`sm`,variant:`outline`})}),!f&&(0,V.jsx)(cX,{busyLabel:`Reopening…`,className:`human-item-detail-reopen`,disabled:a?.pending!==void 0,label:`Reopen`,onPress:()=>s(l,{action:`reopen`}),reopen:l.reopen,sending:a?.pending===`reopen`}),(0,V.jsx)(dQ,{state:a})]}),t?.history!==void 0&&t.history.length>0&&(0,V.jsx)(pQ,{history:t.history}),(0,V.jsxs)(`dl`,{className:`human-item-metadata`,children:[KX(l).map(e=>(0,V.jsxs)(B.Fragment,{children:[(0,V.jsx)(`dt`,{children:e.label}),(0,V.jsx)(`dd`,{children:`value`in e?e.value:(0,V.jsxs)(V.Fragment,{children:[e.party!==void 0&&`By ${e.party} · `,(0,V.jsx)(u,{at:e.at,relative:!0})]})})]},e.label)),t&&t.nodes.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Blocked steps`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`section`,{"aria-label":`Blocked steps`,className:`human-item-steps`,children:OX(t).map(({phrase:e,nodes:t})=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{children:e}),(0,V.jsx)(`ul`,{children:t.map(e=>(0,V.jsxs)(`li`,{children:[e.run,` / `,e.node,`: `,e.title]},`${e.run}/${e.node}`))})]},e))})})]}),d.tracker&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Tracker`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(sX,{className:`human-item-tracker-full`,label:d.tracker.task,url:d.tracker.url})})]})]})]})}function pQ({history:e}){return(0,V.jsxs)(`section`,{"aria-label":`History`,className:`human-item-history`,children:[(0,V.jsx)(`h3`,{children:`History`}),(0,V.jsx)(`ol`,{children:e.map((e,t)=>(0,V.jsxs)(`li`,{children:[MX(e),` · `,(0,V.jsx)(u,{at:e.at,relative:!0})]},t))})]})}function mQ({className:e,state:t}){let n=hQ(t);return(0,V.jsxs)(T,{className:k(`gap-1.5 tracking-[.03em] uppercase`,n&&_Q[n],e),variant:`outline`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:k(`size-1.5 rounded-full bg-current`,t===`running`&&`animate-pulse`)}),t]})}function hQ(e){return CQ[e]}var gQ=e=>{let t=hQ(e);return k(`size-2 shrink-0 rounded-full bg-current`,t===void 0?`text-muted-foreground`:vQ[t])},_Q={success:`border-success bg-success-surface text-success`,destructive:`border-destructive bg-destructive-surface text-destructive`,warning:`border-warning bg-warning-surface text-warning`,info:`border-info bg-info-surface text-info`},vQ={success:`text-success`,destructive:`text-destructive`,warning:`text-warning`,info:`text-info`},yQ=`success`,bQ=`destructive`,xQ=`warning`,SQ={blocked:xQ,cancelled:bQ,"complete-but-draft":xQ,"complete-but-held":xQ,done:yQ,failed:bQ,"not-completed":bQ,parked:void 0,pending:void 0,ready:void 0,running:`info`,skipped:xQ,unknown:void 0,waiting:void 0},CQ={...SQ,complete:SQ.done,settled:SQ.done,active:SQ.running},wQ=`/human-items`;function TQ(e){return e===`/human-items`||e===`/human-items/`}function EQ(e){return TQ(e)?`/`:e}function DQ(e){return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}var OQ=()=>window.location.pathname;function kQ(){let e=(0,B.useSyncExternalStore)(DQ,OQ,OQ),t=(0,B.useCallback)(()=>{let e=new URLSearchParams;for(let t of new URLSearchParams(window.location.search).getAll(`hide-kind`))e.append(`hide-kind`,t);let t=e.size>0?`?${e}`:``;window.history.pushState(null,``,`${wQ}${t}`),window.dispatchEvent(new PopStateEvent(`popstate`))},[]);return{active:TQ(e),open:t}}var AQ={graph:`graph`,overall:`overall`};function jQ(e){return e!==null&&Object.hasOwn(AQ,e)}var MQ={projects:`projects`,runs:`runs`};function NQ(e){return e!==null&&Object.hasOwn(MQ,e)}var PQ={timeline:`Timeline`,task:`Task`,criteria:`Acceptance criteria`,dependencies:`Dependencies`,remote:`Remote`};function FQ(e){return e!==null&&Object.hasOwn(PQ,e)}function IQ(e,t){let n=e.get(t);return n!==null&&oe(n)?n:void 0}function LQ(){let e=(0,B.useSyncExternalStore)(RQ,zQ,zQ),t=new URLSearchParams(e),n=t.get(`list`),r=NQ(n)?n:`projects`,i=t.get(`project`),a=i!==null&&(i===`none`||wM(i))?i:void 0,o=IQ(t,`run`),s=IQ(t,`node`),c=IQ(t,`event`),l=t.get(`view`),u=t.get(`tab`),d=u===`pr`||u===`checks`?`remote`:FQ(u)?u:`timeline`,f=jQ(l)?l:s===void 0?`overall`:`graph`,p=(0,B.useCallback)((e,t=!1)=>{let n=new URLSearchParams(window.location.search);e(n);let r=t?window.location.pathname:EQ(window.location.pathname);window.history.pushState(null,``,`${r}?${n}`),window.dispatchEvent(new PopStateEvent(`popstate`))},[]);return{list:r,host:t.get(`page`)===`host`,hiddenKinds:t.getAll(`hide-kind`),hiddenEventTypes:[...new Set(t.getAll(`hide-event`))].filter(he),selectEventTypes:e=>p(t=>{t.delete(`hide-event`);for(let n of e)t.append(`hide-event`,n)},!0),selectHost:()=>p(e=>{e.set(`page`,`host`)}),selectKinds:e=>p(t=>{t.delete(`hide-kind`);for(let n of e)t.append(`hide-kind`,n)},!0),projectKey:a,runId:o,nodeId:s,itemId:c,view:f,nodeTab:d,selectList:e=>p(t=>{e===`projects`?t.delete(`list`):t.set(`list`,e),t.delete(`project`)}),selectProject:e=>p(t=>{e===void 0?t.delete(`project`):t.set(`project`,e),t.delete(`list`),t.delete(`run`),t.delete(`node`),t.delete(`event`),t.delete(`tab`)}),selectRun:e=>p(t=>{t.set(`run`,e),t.delete(`page`),t.delete(`node`),t.delete(`event`),t.delete(`tab`)}),selectNode:e=>p(t=>{e?t.set(`node`,e):t.delete(`node`),t.delete(`event`),t.delete(`tab`),t.set(`view`,`graph`)}),selectItem:e=>p(t=>{e?t.set(`event`,e):t.delete(`event`)}),showOverall:()=>p(e=>{e.set(`view`,`overall`),e.delete(`node`),e.delete(`event`),e.delete(`tab`)}),selectNodeTab:e=>p(t=>{e===`timeline`?t.delete(`tab`):t.set(`tab`,e),e!==`timeline`&&t.delete(`event`)})}}function RQ(e){return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}function zQ(){return window.location.search}function BQ(e){return[...e].sort((e,t)=>{let n=e.started_at,r=t.started_at;return n!==void 0&&r===void 0?-1:n===void 0&&r!==void 0?1:(r===void 0?0:Date.parse(r))-(n===void 0?0:Date.parse(n))||Date.parse(t.updated_at)-Date.parse(e.updated_at)||e.id.localeCompare(t.id)})}function VQ(e){let t=new Map;for(let n of e){let e=n.group?.project??`none`,r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t].map(([e,t])=>{let n=BQ(t),r=t[0]?.group?.project??null,i=t.map(e=>e.updated_at).reduce((e,t)=>Date.parse(t)>Date.parse(e)?t:e);return{key:e,project:r,label:r===null?`Other runs`:n.find(e=>e.group?.name)?.group?.name??r,rows:n,updatedAt:i}}).sort((e,t)=>Number(e.project===null)-Number(t.project===null)||Date.parse(t.updatedAt)-Date.parse(e.updatedAt)||e.key.localeCompare(t.key))}function HQ(e){let{done:t,failed:n,running:r}=e.nodes;return L({done:t,failed:n,running:r})}function UQ(e,t){let n=new Map(e.map(e=>[e.id,JSON.stringify(e)])),r=t.filter(e=>n.get(e.id)!==JSON.stringify(e)).length,i=new Set(t.map(e=>e.id));return r+e.filter(e=>!i.has(e.id)).length}function WQ(e,t,n,r){let[i,a]=(0,B.useState)(new Set),o=(0,B.useCallback)(e=>{a(t=>t.has(e)?t:new Set(t).add(e))},[]),s=(0,B.useCallback)(e=>{a(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),c=(0,B.useMemo)(()=>VQ(e??[]),[e]),l=c.find(e=>e.rows.some(e=>e.id===n))?.key,[u,d]=(0,B.useState)();return l!==u&&(d(l),l!==void 0&&o(l)),(0,B.useMemo)(()=>({kinds:[...new Set(e?.flatMap(e=>e.kind?[e.kind]:[])??[])].sort(),groups:c.map(e=>{let n=e.rows.filter(e=>!e.kind||!t.includes(e.kind)),a=n[0];return{key:e.key,label:e.label,runs:n,expanded:i.has(e.key),toggle:()=>s(e.key),open:()=>{o(e.key),a&&r(a.id)}}})}),[e,c,t,i,o,s,r])}var GQ=240,KQ=`data-row-key`;function qQ(e,t){let n=(0,B.useRef)(new Map);(0,B.useLayoutEffect)(()=>{let t=e.current;if(t===null)return;let r=t.getBoundingClientRect().top,i=[...t.querySelectorAll(`[${KQ}]`)],a=new Map(i.map(e=>[e.getAttribute(`data-row-key`)??``,e.getBoundingClientRect().top-r])),o=[...n.current.keys()].filter(e=>a.has(e)),s=[...a.keys()].filter(e=>n.current.has(e));if(o.join(`
104
+ `)!==s.join(`
105
+ `)&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)for(let e of i){let t=n.current.get(e.getAttribute(`data-row-key`)??``),r=a.get(e.getAttribute(`data-row-key`)??``);t===void 0||r===void 0||t===r||e.animate([{transform:`translateY(${t-r}px)`},{transform:`translateY(0)`}],{duration:GQ,easing:`ease-out`})}n.current=a},[e,t])}function JQ({rows:e,failed:t=!1,selectedRunId:n,onSelect:r,onOpenProject:i,onHost:a,hostCurrent:o=!1,onActionItems:s,actionItemsCurrent:c=!1,hiddenKinds:l,onKindsChange:u,updates:d,drawerOpen:f=!1,drawerRef:p}){let{kinds:m,groups:h}=WQ(e,l,n,i??r),g=(0,B.useRef)(null);return qQ(g,h),(0,V.jsx)(`nav`,{"aria-label":`Projects`,className:`run-nav`,"data-open":f,id:`run-navigation`,ref:p,children:(0,V.jsx)(gd,{className:`h-full`,children:(0,V.jsxs)(`div`,{className:`px-[18px] py-6 max-sm:px-2`,children:[(0,V.jsxs)(`div`,{className:`brand`,children:[(0,V.jsx)(`div`,{"aria-hidden":`true`,className:`brand-mark`,children:(0,V.jsx)(ze,{size:20})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`eyebrow`,children:`Local orchestration`}),(0,V.jsx)(`h1`,{children:`DAG Observatory`})]})]}),(0,V.jsx)(kd,{className:`my-[22px]`}),(0,V.jsxs)(`div`,{className:`nav-pages`,children:[(0,V.jsx)(Wi,{"aria-current":o?`page`:void 0,onClick:a,variant:`ghost`,children:`Host`}),s&&(0,V.jsx)(Wi,{"aria-current":c?`page`:void 0,onClick:s,variant:`ghost`,children:`Action items`})]}),m.length>0&&(0,V.jsxs)(`details`,{className:`kind-filter`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsxs)(`span`,{children:[`Run kinds:`,` `,m.filter(e=>!l.includes(e)).length,` of`,` `,m.length]}),(0,V.jsx)(Ue,{"aria-hidden":`true`,size:14})]}),(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{className:`sr-only`,children:`Run kinds`}),m.map(e=>(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:!l.includes(e),onChange:t=>u(t.target.checked?l.filter(t=>t!==e):[...l,e])}),e]},e))]})]}),d,e===void 0?(0,V.jsx)(`p`,{role:`status`,children:t?`Projects did not load`:`Loading projects…`}):(0,V.jsx)(`div`,{className:`nav-rows`,ref:g,children:h.map(e=>(0,V.jsxs)(`fieldset`,{"aria-label":`Project ${e.label}`,className:`project-group`,children:[(0,V.jsxs)(`div`,{className:`project-row`,[KQ]:`project:${e.key}`,children:[(0,V.jsx)(`button`,{"aria-expanded":e.expanded,"aria-label":`${e.expanded?`Collapse`:`Expand`} ${e.label}`,className:`project-toggle`,onClick:e.toggle,type:`button`,children:(0,V.jsx)(We,{"aria-hidden":`true`,"data-open":e.expanded,size:12})}),(0,V.jsxs)(`button`,{className:`project-open`,onClick:e.open,type:`button`,children:[(0,V.jsx)(`span`,{className:`project-name`,children:e.label}),(0,V.jsxs)(`span`,{className:`project-count`,children:[e.runs.length,(0,V.jsx)(`span`,{className:`sr-only`,children:` shown runs`})]})]})]}),e.expanded&&e.runs.length===0&&(0,V.jsx)(`p`,{className:`run-list-status`,role:`status`,children:`No runs of the shown kinds.`}),e.expanded&&e.runs.length>0&&(0,V.jsx)(`ul`,{"aria-label":`Runs of ${e.label}`,className:`run-list`,children:e.runs.map(e=>{let t=n===e.id,i=[e.state,HQ(e)].filter(Boolean).join(` · `);return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{"aria-current":t?`page`:void 0,className:`run-link`,"data-active":t,onClick:()=>r(e.id),title:i,type:`button`,"data-row-key":`run:${e.id}`,children:[(0,V.jsxs)(xp,{children:[(0,V.jsx)(Sp,{asChild:!0,children:(0,V.jsx)(`span`,{role:`img`,"aria-label":e.state,className:k(`run-dot`,gQ(e.state))})}),(0,V.jsx)(Cp,{children:e.state})]}),(0,V.jsx)(`span`,{className:`run-link-name`,children:e.name}),e.kind&&(0,V.jsx)(`span`,{"aria-label":e.kind,className:`run-link-tag`,role:`note`,children:e.kind}),t&&(0,V.jsx)(`span`,{className:`run-link-counts`,children:i})]})},e.id)})})]},e.key))})]})})})}function YQ(){let[e,t]=(0,B.useState)(!1),n=(0,B.useRef)(null),r=(0,B.useRef)(null),i=(0,B.useRef)(!1),a=(0,B.useCallback)(()=>t(!1),[]),o=(0,B.useCallback)(()=>t(e=>!e),[]);return(0,B.useEffect)(()=>{if(!e)return;let r=e=>{e.key===`Escape`&&t(!1)},i=()=>{n.current?.offsetParent===null&&t(!1)};return document.addEventListener(`keydown`,r),window.addEventListener(`resize`,i),()=>{document.removeEventListener(`keydown`,r),window.removeEventListener(`resize`,i)}},[e]),(0,B.useEffect)(()=>{e?r.current?.querySelector(`button`)?.focus():i.current&&n.current?.focus(),i.current=e},[e]),{open:e,close:a,toggle:o,menuButton:n,drawer:r}}function XQ(e,t){let[n,r]=(0,B.useState)(0),i=(0,B.useRef)(void 0),a=(0,B.useRef)(t);a.current=t;let o=e===`live`,s=(0,B.useRef)(o);s.current=o;let c=(0,B.useCallback)(e=>{i.current=void 0,r(0),a.current(e)},[]),l=(0,B.useCallback)(()=>{i.current!==void 0&&c(i.current.value)},[c]),u=(0,B.useCallback)((e,t=1)=>{s.current?c(e):(i.current={value:e},r(e=>e+t))},[c]),d=(0,B.useCallback)(()=>{i.current=void 0,r(0)},[]);return(0,B.useEffect)(()=>{o&&l()},[o,l]),(0,B.useEffect)(()=>{if(typeof e!=`number`)return;let t=setInterval(l,e*1e3);return()=>clearInterval(t)},[e,l]),{waiting:n,show:c,take:l,offer:u,drop:d}}function ZQ(e,t){let[n,r]=(0,B.useState)(),[i,a]=(0,B.useState)(),[o,s]=(0,B.useState)({}),c=(0,B.useRef)([]),[l,u]=(0,B.useState)(),[d,f]=(0,B.useState)(),[p,m]=(0,B.useState)(),[h,g]=(0,B.useState)(),[_,v]=(0,B.useState)(),[y,b]=(0,B.useState)(),[x,S]=(0,B.useState)(0),C=t.runId,w=l===void 0||C!==void 0&&l.some(e=>e.id===C)?C:C!==void 0||t.selectFirst?BQ(l)[0]?.id:void 0,T=(0,B.useMemo)(()=>t.humanItems??je(t.host?void 0:w,t.view,t.nodeId),[t.humanItems,t.host,w,t.view,t.nodeId]),E=(0,B.useRef)(void 0),D=(0,B.useRef)(T);D.current=T;let O=(0,B.useRef)(t.first),k=XQ(t.navigationUpdates,f),A=XQ(t.mainUpdates,(0,B.useCallback)(e=>{r(e.state),a(e.view);let{visible:t}=e.state;if(t.type===`human-items`){let{items:n,detail:r}=t;s({items:n,detail:r,...e.view.type===`human-items`&&e.view.item!==void 0?{item:e.view.item}:{}})}m(new Date().toISOString()),e.reset!==void 0&&b(`The live view was re-sent whole: ${e.reset}.`)},[])),j=t.navigationUpdates!==`off`||t.mainUpdates!==`off`,M=(0,B.useRef)(j);M.current=j,(0,B.useEffect)(()=>{g(void 0);let t=!0,n=O.current;if(O.current=void 0,n?.error!==void 0){g(n.error);return}let r=e.live({view:D.current,paused:!M.current,...n?.answer!==void 0&&JSON.stringify(n.address.view)===JSON.stringify(D.current)?{initial:n.answer}:{},onState:(e,n)=>{let i=c.current;e.sidebar!==void 0&&(c.current=e.sidebar,u(e.sidebar)),g(void 0),v(void 0);let a={state:e,view:r.view,...n.kind===`reset`?{reset:n.reason}:{}};if(n.kind===`snapshot`){if(A.show(a),e.sidebar!==void 0){if(t)k.show(e.sidebar);else if(i!==e.sidebar){let t=UQ(i,e.sidebar);t>0&&k.offer(e.sidebar,t)}}t=!1;return}if(n.kind===`reset`){e.sidebar!==void 0&&k.offer(e.sidebar),A.offer(a);return}if(n.frame.type===`sidebar.snapshot`){k.show(n.frame.rows);return}let o=n.frame.type===`run.changed`||n.frame.type===`run.removed`;o&&e.sidebar!==void 0&&k.offer(e.sidebar),(!o||e.visible.type===`sidebar`)&&A.offer(a)},onError:e=>{if(r.view.type===`human-items`){s(t=>({...t.items===void 0?{}:{items:t.items},error:e.message})),r.change({type:`sidebar`});return}if(e instanceof kN&&(e.code===`run_not_found`||e.code===`node_not_found`)){r.change({type:`sidebar`});return}g(e)},onDisconnected:()=>v(Error(`Live telemetry stream disconnected`)),onConnected:()=>v(void 0)});return E.current=r,()=>{r.close(),E.current===r&&(E.current=void 0)}},[e,x,A.show,A.offer,k.show,k.offer]),(0,B.useEffect)(()=>{JSON.stringify(E.current?.view)!==JSON.stringify(T)&&A.drop(),E.current?.change(T),T.type!==`human-items`&&s(e=>Object.keys(e).length===0?e:{})},[T,A.drop]),(0,B.useEffect)(()=>{j?E.current?.resume():E.current?.pause()},[j]);let N=(0,B.useCallback)(()=>{k.take(),A.take()},[k.take,A.take]),P=(0,B.useCallback)(()=>{b(void 0),N(),S(e=>e+1)},[N]),F=n?.visible,I=F!==void 0&&F.type!==`sidebar`&&F.type!==`human-items`&&F.run_id===w&&QQ(F,T)&&JSON.stringify(i)===JSON.stringify(T)?F:void 0,L=(0,B.useRef)(void 0),R=I?.detail??(L.current?.run.run_id===w?L.current:void 0);L.current=R;let ee=(0,B.useMemo)(()=>$Q(R),[R]),te=h!==void 0&&T.type===`timeline`&&R!==void 0;return{rows:l,navigationRows:d,navigationWaiting:k.waiting,hostRows:n?.sidebar,mainWaiting:A.waiting,runId:w,detail:R,timeline:I&&`timeline`in I?I.timeline:void 0,humanItems:o,timelineError:te?h:void 0,loading:n===void 0&&h===void 0,lastUpdated:p,activity:ee,error:te?_:h??_,notice:y,refresh:P}}function QQ(e,t){return t.type===e.type?t.type===`timeline`&&e.type===`timeline`?t.scope===e.scope&&(t.scope===`run`||e.scope===`node`&&e.node===t.node):!0:!1}function $Q(e){let t=e?.run.live_activity;if(t===void 0)return[];let n=Gj.safeParse(t);return n.success?n.data:[]}var e$={minutes:60,seconds:1},t$=e=>Object.hasOwn(e$,e),n$=600%e$.minutes==0?{amount:String(600/e$.minutes),unit:`minutes`}:{amount:`600`,unit:`seconds`};function r$(e){let t=e.amount.trim();if(!/^\d+$/u.test(t))return;let n=Number(t)*e$[e.unit];return Number.isSafeInteger(n)?n:void 0}function i$(e){if(e===0)return`no grace`;let t=Math.floor(e/60),n=e%60,r=(e,t)=>`${e} ${t}${e===1?``:`s`}`;return t===0?r(n,`second`):n===0?r(t,`minute`):`${r(t,`minute`)} ${r(n,`second`)}`}function a$(e){return e.map(e=>({runId:e.run_id,owner:we(e.launch)}))}function o$(e,t){return t instanceof kN&&t.status!==void 0&&t.code!==void 0?{phase:`refused`,sent:e,error:t}:{phase:`lost`,sent:e,error:t instanceof Error?t:Error(String(t))}}var s$={dispatchStopped:`dispatch-stopped`,hostShutdown:`host-shutdown`};function c$(e,t,n){let r=new Set(e.runs.map(({runId:e})=>e)),i=Object.values(s$);return n.flatMap(e=>{if(!r.has(e.run_id))return[];let n=e.last_event;if(n===null||!i.includes(n))return[];let a=t.get(e.run_id);return a!==void 0&&a.last_event===n&&a.last_progress_at===e.last_progress_at?[]:[{runId:e.run_id,recorded:n===s$.hostShutdown?s$.hostShutdown:s$.dispatchStopped}]})}function l$(e){return new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).format(e)}function u$(e){return(0,B.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.owner,(t.get(n.owner)??0)+1);return[...t].map(([e,t])=>({owner:e,count:t}))},[e])}var d$=`Each live dispatch is asked to stop and commit, and given the grace to end itself; whatever is still standing then is torn down, and every branch the run's records name is pushed to its origin. Nothing is sent until you confirm.`;function f$({open:e,onOpenChange:t,runs:n,blocked:r,unreadable:i=0,onConfirm:a}){let o=(0,B.useId)(),[s,c]=(0,B.useState)(n$),[l,u]=(0,B.useState)(!1),d=r$(s),f=n!==void 0&&r===void 0,p=()=>{c(n$),u(!1),t(!1)};return(0,V.jsx)(Es,{onOpenChange:e=>e?t(!0):p(),open:e,children:(0,V.jsxs)(As,{className:`shutdown-dialog`,children:[(0,V.jsxs)(js,{children:[(0,V.jsx)(Ns,{children:`Shut down the entire host?`}),(0,V.jsx)(Ps,{children:d$})]}),(0,V.jsxs)(`div`,{className:`shutdown-dialog-body`,children:[r===void 0?n===void 0?(0,V.jsx)(`p`,{className:`shutdown-blocked`,role:`status`,children:`Reading which runs this acts on…`}):(0,V.jsx)(m$,{caption:`It acts on all ${p$(n.length)} on this host, over their owners — each is interrupted, torn down and pushed:`,label:`Runs on this host`,runs:n,warning:!0}):(0,V.jsx)(`p`,{className:`shutdown-blocked`,role:`status`,children:r}),i>0&&(0,V.jsxs)(`p`,{className:`shutdown-scope-note`,children:[i===1?`1 run root on this host could not be read`:`${i} run roots on this host could not be read`,`: the engine cannot read them either, so this shutdown signals nothing in them and pushes none of their branches.`]}),(0,V.jsxs)(`fieldset`,{className:`shutdown-grace`,children:[(0,V.jsx)(`legend`,{children:`Grace`}),(0,V.jsxs)(`div`,{className:`shutdown-grace-row`,children:[(0,V.jsx)(Rs,{className:`sr-only`,htmlFor:`${o}-grace`,children:`Grace`}),(0,V.jsx)(Fs,{"aria-describedby":`${o}-grace-help`,"aria-invalid":d===void 0,id:`${o}-grace`,inputMode:`numeric`,min:0,onChange:e=>c({...s,amount:e.target.value}),step:1,type:`number`,value:s.amount}),(0,V.jsx)(Rs,{className:`sr-only`,htmlFor:`${o}-unit`,children:`Grace unit`}),(0,V.jsx)(`select`,{className:`composer-select`,id:`${o}-unit`,onChange:e=>{let t=e.target.value;t$(t)&&c({...s,unit:t})},value:s.unit,children:Object.keys(e$).map(e=>(0,V.jsx)(`option`,{value:e,children:e},e))})]}),(0,V.jsx)(`p`,{className:`channel-age`,id:`${o}-grace-help`,children:d===void 0?`The grace is a whole number of minutes or seconds, 0 or more.`:`How long each live dispatch has to end itself once asked: ${i$(d)}. The engine's default is ${i$(r$(n$)??0)}.`})]}),(0,V.jsxs)(`div`,{className:`composer-check shutdown-force`,children:[(0,V.jsx)(`input`,{checked:l,id:`${o}-force`,onChange:e=>u(e.target.checked),type:`checkbox`}),(0,V.jsx)(Rs,{htmlFor:`${o}-force`,children:`Force: skip the interrupt and the wait and go straight to the teardown — whatever a worker had not committed is lost.`})]})]}),(0,V.jsxs)(Ms,{children:[(0,V.jsx)(Os,{asChild:!0,children:(0,V.jsx)(Wi,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,V.jsx)(Wi,{disabled:!f||d===void 0,onClick:()=>{d!==void 0&&(a(d,l),p())},type:`button`,variant:`destructive`,children:`Shut down the host`})]})]})})}var p$=e=>e===1?`1 run`:`${e} runs`;function m$({caption:e,label:t,runs:n,warning:r=!1}){let i=u$(n);return(0,V.jsxs)(`div`,{className:`shutdown-runs`,"data-warning":r,children:[(0,V.jsx)(`p`,{className:`shutdown-scope-note`,children:e}),(0,V.jsx)(`ul`,{"aria-label":t,children:i.map(({owner:e,count:t})=>(0,V.jsxs)(`li`,{children:[e,` — `,p$(t)]},e))})]})}function h$(e,t,n){let[r,i]=(0,B.useState)(),a=g$(r!==void 0,e,t,n);return{open:r,setOpen:i,opener:e=>()=>i(e),runs:a.rows===void 0||r===void 0?void 0:a$(a.rows),blocked:a.blocked,unreadable:e?.unreadable?.length??0}}function g$(e,t,n,r){let i=(0,B.useRef)(new Set),a=t?.next_cursor;return(0,B.useEffect)(()=>{if(!e){i.current.clear();return}a===void 0||r||i.current.has(a)||(i.current.add(a),n())},[e,a,r,n]),t===void 0?{blocked:`Reading the runs listing this view holds…`}:a===void 0?{rows:t.runs}:!r&&i.current.has(a)?{blocked:`The rest of the runs listing could not be read (${t.runs.length} runs read), so the runs this acts on cannot all be named. Close this and try again.`}:{blocked:`Reading the rest of the runs listing so every run this acts on can be named (${t.runs.length} read so far)…`}}function _$(e,t){let[n,r]=(0,B.useState)({phase:`idle`}),i=(0,B.useRef)(!1);return{state:n,confirm:(0,B.useCallback)((n,a,o)=>{if(i.current)return;i.current=!0;let s={scope:e,runs:n,grace:a,force:o,sentAt:Date.now()};r({phase:`sending`,sent:s}),t({grace:a,force:o}).then(e=>r({phase:`answered`,sent:s,report:e}),e=>r(o$(s,e))).finally(()=>{i.current=!1})},[e,t]),dismiss:(0,B.useCallback)(()=>{i.current||r({phase:`idle`})},[])}}var v$=[`host`];function y$(e){return{host:_$(`host`,(0,B.useCallback)(t=>e.shutdown(`host`,t),[e]))}}function b$({list:e,loadMore:t,loadingMore:n,shutdowns:r}){let{open:i,setOpen:a,opener:o,runs:s,blocked:c,unreadable:l}=h$(e,t,n),u=r.host.state.phase===`sending`;return(0,V.jsxs)(`fieldset`,{"aria-label":`Shut down runs on this host`,className:`host-shutdown`,children:[(0,V.jsx)(`p`,{className:`eyebrow`,children:`This host`}),(0,V.jsx)(`div`,{className:`host-shutdown-actions`,children:(0,V.jsxs)(Wi,{disabled:u,onClick:o(`host`),size:`sm`,type:`button`,variant:`destructive`,children:[(0,V.jsx)(mt,{size:14}),` Shut down the entire host`]})}),v$.map(e=>(0,V.jsx)(f$,{blocked:c,onConfirm:(e,t)=>s!==void 0&&r.host.confirm(s,e,t),onOpenChange:t=>a(t?e:void 0),open:i===e,runs:i===e?s:void 0,unreadable:l},e))]})}var x$=1e3;function S$(e,t){let[n,r]=(0,B.useState)(()=>Date.now());(0,B.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),x$);return()=>clearInterval(e)},[]);let i=c$(e,(0,B.useRef)(new Map(t.filter(t=>e.runs.some(({runId:e})=>e===t.run_id)).map(e=>[e.run_id,e]))).current,t);return{now:n,progress:i,done:i.filter(({recorded:e})=>e===s$.hostShutdown).length,deadline:e.sentAt+e.grace*1e3,asks:!e.force&&e.grace>0}}function C$({label:t,state:n,rows:r,onDismiss:i}){return n.phase===`idle`?null:(0,V.jsxs)(`section`,{"aria-label":t,className:`shutdown-status`,children:[n.phase===`sending`?(0,V.jsx)(T$,{rows:r,sent:n.sent}):n.phase===`lost`?(0,V.jsxs)(yi,{"aria-label":`${t} lost`,variant:`destructive`,children:[(0,V.jsx)(Ct,{}),(0,V.jsx)(bi,{children:`Shutdown lost: no answer came back`}),(0,V.jsxs)(xi,{children:[(0,V.jsxs)(`p`,{children:[`The request sent at `,l$(n.sent.sentAt),` ended without an answer (`,n.error.message,`). The engine may still be carrying out the shutdown — check the runs before sending another.`]}),(0,V.jsx)(w$,{sent:n.sent})]})]}):n.phase===`refused`?(0,V.jsxs)(yi,{"aria-label":`${t} refused`,variant:`destructive`,children:[(0,V.jsx)(e,{}),(0,V.jsxs)(bi,{children:[`Shutdown refused · `,n.error.status,` `,n.error.code]}),(0,V.jsxs)(xi,{children:[(0,V.jsx)(`pre`,{className:`verb-text`,children:n.error.message}),(0,V.jsx)(`p`,{children:`Nothing was signalled and nothing was pushed.`})]})]}):(0,V.jsx)(D$,{label:t,report:n.report}),n.phase!==`sending`&&(0,V.jsx)(`div`,{className:`composer-actions`,children:(0,V.jsx)(Wi,{onClick:i,size:`sm`,type:`button`,variant:`outline`,children:`Dismiss`})})]})}function w$({sent:e}){return(0,V.jsxs)(`p`,{className:`channel-age`,children:[`Sent `,l$(e.sentAt),` · scope `,e.scope,` · grace`,` `,i$(e.grace),e.force?` · forced`:``,` · `,e.runs.length,` `,e.runs.length===1?`run`:`runs`,` in scope`]})}function T$({sent:e,rows:t}){let{now:n,progress:r,done:i,deadline:a,asks:o}=S$(e,t);return(0,V.jsxs)(`div`,{"aria-live":`polite`,className:`shutdown-inflight`,role:`status`,children:[(0,V.jsxs)(`p`,{className:`shutdown-inflight-head`,children:[(0,V.jsx)(ot,{"aria-hidden":`true`,className:`animate-spin`,size:14}),(0,V.jsx)(`strong`,{children:`Shutdown in progress`}),` — still waiting for the engine's answer, `,ye(Math.max(0,n-e.sentAt)),` after it was sent.`]}),(0,V.jsx)(w$,{sent:e}),(0,V.jsx)(`p`,{children:o?n<a?`Waiting out the ${i$(e.grace)} grace until ${l$(a)} (${ye(a-n)} left) for each live dispatch to end itself; runs are worked through one after another, each with its own grace.`:`The first grace ran out at ${l$(a)}; the engine is tearing down what is still standing and pushing branches, run by run.`:`Forced: nothing is asked or waited for; the engine is tearing the runs down and pushing their branches.`}),(0,V.jsxs)(`p`,{children:[i,` of `,e.runs.length,` `,e.runs.length===1?`run has`:`runs have`,` recorded their shutdown.`]}),r.length>0&&(0,V.jsx)(`ul`,{"aria-label":`Recorded so far`,children:r.map(({runId:e,recorded:t})=>(0,V.jsxs)(`li`,{children:[e,`:`,` `,t===s$.hostShutdown?`put down — host-shutdown recorded after its teardown and pushes`:`its dispatches are stopping — dispatch-stopped recorded`]},e))})]})}function E$(e){let t=e.remote===null?``:` to ${e.remote}`,n=e.commit===null?``:` at ${e.commit}`;switch(e.result){case`pushed`:return`pushed${t}${n}`;case`already-on-origin`:return`already on its origin${t}${n}; nothing was pushed`;case`no-remote`:return`not pushed: this identity has no origin${n}`;case`refused`:return`could not be preserved${n}`}}function D$({label:t,report:n}){return(0,V.jsxs)(yi,{"aria-label":`${t} report`,variant:n.complete?`default`:`destructive`,children:[n.complete?(0,V.jsx)(Ke,{}):(0,V.jsx)(e,{}),(0,V.jsx)(bi,{children:n.complete?`Shutdown complete`:`Shutdown incomplete`}),(0,V.jsxs)(xi,{className:`shutdown-report`,children:[!n.complete&&(0,V.jsx)(`p`,{children:`Not everything went as asked: a dispatch was killed at the deadline or is still running, a teardown was not clean, or a branch could not be preserved. Read the runs below.`}),(0,V.jsxs)(`p`,{className:`channel-age`,children:[`Scope `,n.scope,` · grace `,i$(n.grace_seconds),n.forced?` · forced`:``,` · runs root `,n.root]}),n.runs.length===0?(0,V.jsx)(`p`,{children:`No run was selected: nothing was signalled.`}):n.runs.map(e=>(0,V.jsxs)(`section`,{"aria-label":`Shutdown of ${e.run_id}`,className:`shutdown-report-run`,children:[(0,V.jsxs)(`h4`,{children:[e.run_id,` · owner `,e.owner,e.forced_over_owner&&` — another session's run, acted on over its owner`]}),e.dispatches.length===0?(0,V.jsx)(`p`,{children:`No live dispatch to interrupt.`}):(0,V.jsx)(`ul`,{"aria-label":`Dispatches of ${e.run_id}`,children:e.dispatches.map(e=>(0,V.jsxs)(`li`,{children:[e.node,` (pid `,e.pid,`): interrupt`,` `,e.interrupt,`; ended `,e.ended,` after`,` `,ye(e.waited_ms),(0,V.jsxs)(`span`,{className:`channel-age`,children:[` — `,e.detail]})]},`${e.node}-${e.pid}`))}),(0,V.jsxs)(`p`,{children:[`Teardown: `,e.teardown]}),e.branches.length===0?(0,V.jsx)(`p`,{children:`No branch this run's records name.`}):(0,V.jsx)(`ul`,{"aria-label":`Branches of ${e.run_id}`,children:e.branches.map(e=>(0,V.jsxs)(`li`,{children:[e.identity,`@`,e.branch,`: `,E$(e),(0,V.jsxs)(`span`,{className:`channel-age`,children:[` — `,e.detail]})]},`${e.identity}@${e.branch}`))})]},e.run_id)),n.not_pushed_unread===null?n.not_pushed.length===0?(0,V.jsx)(`p`,{children:`Other unpublished branches on this host: none.`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{children:[`Other unpublished branches on this host, which this shutdown did not push (`,n.not_pushed.length,`):`]}),(0,V.jsx)(`ul`,{"aria-label":`Branches not pushed`,children:n.not_pushed.map(({identity:e,branch:t})=>(0,V.jsxs)(`li`,{children:[e,`@`,t]},`${e}@${t}`))})]}):(0,V.jsxs)(`p`,{children:[`Other unpublished branches on this host: not read —`,` `,n.not_pushed_unread,`. This is not a count of zero: there may be work on this host nothing outside it carries.`]}),(0,V.jsxs)(`details`,{children:[(0,V.jsx)(`summary`,{children:`The engine's own report`}),(0,V.jsx)(`pre`,{className:`verb-text`,children:n.rendered})]})]})]})}function O$(e){if(e===void 0||e===``)return;let t;try{t=new URL(e).pathname}catch{return k$}let n=/\/[^/]+\/([^/]+)\/pull\/(\d+)\/?$/u.exec(t);return n===null?k$:`${n[1]}#${n[2]}`}var k$=`Change request`,A$={crosshair:!0,ticks:{minSpacingPx:80}},j$=2e3;function M$(e){let[t,n]=e;if(n-t>=2e3)return e;let r=(t+n)/2;return[r-j$/2,r+j$/2]}var N$=1e3;function P$({completedAt:e,startedAt:t}){let n=t===void 0?void 0:ke(t),r=e===void 0?void 0:ke(e),i=F$(n!==void 0&&r===void 0);return n===void 0?null:r===void 0?(0,V.jsxs)(V.Fragment,{children:[ye(i-n.getTime()),` · running`]}):(0,V.jsx)(V.Fragment,{children:ye(r.getTime()-n.getTime())})}function F$(e){let[t,n]=(0,B.useState)(()=>Date.now());return(0,B.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),N$);return()=>clearInterval(t)},[e]),t}var I$={passed:Ke,failed:$e,skipped:Ye,neutral:Je,queued:qe,running:ot,"not recorded":Ze};function L$(e){if(e.conclusion===void 0){if(e.status===void 0)return`not recorded`;if(e.status===`in_progress`)return`running`;if(e.status!==`completed`)return`queued`}switch(e.conclusion){case`success`:return`passed`;case`skipped`:return`skipped`;case`neutral`:return`neutral`;default:return`failed`}}function R$({check:e}){let t=L$(e),n=I$[t];return(0,V.jsxs)(`span`,{className:`check-status`,"data-check":t.replace(` `,`-`),title:[e.status??`not recorded`,e.conclusion].filter(Boolean).join(`: `),children:[(0,V.jsx)(n,{"aria-label":t,role:`img`,size:14}),(0,V.jsx)(`span`,{"aria-hidden":`true`,children:t})]})}function z$({control:e}){if(e===void 0)return null;let t=e.addressable?`Turn reachable`:`No turn to reach`,n=e.addressable?`a planner's note can be delivered into the ${e.member??`member`} turn in flight`:e.reason,r=e.addressable?ut:lt;return(0,V.jsxs)(T,{"aria-label":`${t}: ${n}`,className:k(`node-view-control gap-1.5`,e.addressable?`border-info bg-info-surface text-info`:`border-warning bg-warning-surface text-warning`),title:n,variant:`outline`,children:[(0,V.jsx)(r,{"aria-hidden":`true`,size:12}),t]})}function B$({counts:e,hidden:t,onHiddenChange:n}){let r=te.filter(n=>(e.get(n)??0)>0||t.has(n)),i=r.filter(e=>!t.has(e)).length,a=(0,B.useId)();return(0,V.jsxs)(`header`,{className:`event-list-head`,children:[(0,V.jsx)(`h3`,{children:`Events`}),r.length>0&&(0,V.jsxs)(`details`,{className:`kind-filter event-type-filter`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsxs)(`span`,{children:[`Event types:`,` `,i===r.length?`all ${r.length}`:`${i} of ${r.length}`]}),(0,V.jsx)(Ue,{"aria-hidden":`true`,size:14})]}),(0,V.jsxs)(`fieldset`,{children:[(0,V.jsx)(`legend`,{className:`sr-only`,children:`Event types`}),r.map(r=>(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`input`,{"aria-describedby":`${a}-${r}`,"aria-label":xe(r),checked:!t.has(r),onChange:e=>n(e.target.checked?[...t].filter(e=>e!==r):[...t,r]),type:`checkbox`}),(0,V.jsx)(`span`,{children:xe(r)}),(0,V.jsx)(`span`,{className:`event-type-count`,id:`${a}-${r}`,children:e.get(r)??0})]},r)),(0,V.jsxs)(`p`,{className:`event-type-filter-foot`,children:[(0,V.jsx)(`button`,{onClick:()=>n([]),type:`button`,children:`Select all`}),(0,V.jsx)(`button`,{onClick:()=>n([...te]),type:`button`,children:`Clear`})]})]})]})]})}function V$({onClear:e}){return(0,V.jsxs)(`div`,{className:`event-list-empty`,role:`status`,children:[(0,V.jsx)(`p`,{children:`The event-type filter hides every event in this list.`}),(0,V.jsx)(`button`,{className:`load-earlier`,onClick:e,type:`button`,children:`Show every event type`})]})}function H$({entry:e,onToggle:t,children:n}){let{group:r}=e,i=x(r);return(0,V.jsxs)(`section`,{"aria-label":`${i}: ${r.displayLabel}`,className:`transcript-cycle`,"data-cycle-count":r.count,children:[(0,V.jsxs)(`header`,{className:`transcript-cycle-head`,children:[(0,V.jsx)(gt,{"aria-hidden":`true`,size:14}),(0,V.jsxs)(`strong`,{className:`transcript-cycle-count`,children:[`×`,r.count]}),(0,V.jsxs)(`span`,{className:`transcript-cycle-span`,children:[i,` · `,(0,V.jsx)(u,{at:r.startedAt}),`–`,(0,V.jsx)(u,{at:r.endedAt??r.startedAt}),r.durationMs!==null&&` · ${ye(r.durationMs)}`]}),(0,V.jsx)(`button`,{"aria-expanded":e.expanded,onClick:t,type:`button`,children:e.expanded?`Show one pass`:`Show all ${r.children.length}`})]}),n]})}function U$({failure:e,what:t=`Earlier rows`}){return(0,V.jsxs)(`p`,{className:`page-failed`,role:`alert`,children:[(0,V.jsxs)(`span`,{children:[t,` did not load: `,e.message]}),(0,V.jsx)(`button`,{onClick:e.retry,type:`button`,children:`Try again`})]})}var W$=`Partial — loading`;function G$({load:e}){let t=e.total===void 0?`${e.loaded.toLocaleString()} records loaded`:`${e.loaded.toLocaleString()} of ${e.total.toLocaleString()} records loaded`;return(0,V.jsxs)(`p`,{className:`partial-mark`,role:`status`,children:[(0,V.jsx)(`span`,{className:`partial-mark-label`,children:W$}),(0,V.jsx)(`span`,{className:`partial-mark-count`,children:t})]})}function K$(e,t){let[n,r]=(0,B.useState)(null);return(0,B.useLayoutEffect)(()=>{n!==null&&!n.isConnected&&r(null)}),(0,B.useLayoutEffect)(()=>{let i=e.current;if(!t||n!==null||i===null)return;let a=()=>{let e=i.querySelector(`[aria-label^="Timeline plot"]`);return e===null?!1:(getComputedStyle(e).position===`static`&&(e.style.position=`relative`),r(e),!0)};if(a())return;let o=new MutationObserver(()=>{a()&&o.disconnect()});return o.observe(i,{childList:!0,subtree:!0}),()=>o.disconnect()}),n}function q$({container:e,partial:t=!1,range:n,stretches:r}){let i=K$(e,r.length>0);if(i===null)return null;let a=Math.max(n[1]-n[0],1),o=e=>(Math.min(Math.max(e,n[0]),n[1])-n[0])/a*100;return(0,Kn.createPortal)(r.map(([e,n])=>(0,V.jsx)(`span`,{className:`history-hatch`,"data-from":e,"data-to":n,style:{left:`${o(e)}%`,width:`${o(n)-o(e)}%`},children:(0,V.jsx)(`span`,{className:`history-hatch-label`,children:t?W$:j})},`${e}-${n}`)),i)}function J$(e){return e===`human-step`?`human step`:e}function Y$(e){return e.style===`human-step`}function X$(e){switch(e){case`not-released`:return`not released yet`;case`awaiting-human-step`:return`waiting for the human step`;case`not-answered`:return`the registry did not answer`;case`not-landed`:return`released, but not carrying this work yet`;default:return e}}function Z$(e){if(e!==void 0)return e?`yes — a later acknowledgement replaced this one`:`no`}function Q$(e){if(e!==void 0)return e===`live`?`Live — into the turn that was already running`:e===`next`?`Deferred — onto the node's next dispatch`:e}function $$(e){return[e.identity,e.target].filter(Boolean).join(` · `)||e.dep}function e1({release:e}){let t=[[`Dependency`,e.dep],[`Identity`,e.identity],[`Release target`,e.target],[`Style`,e.style===void 0?void 0:J$(e.style)],[`Version`,e.version],[`Probe outcome`,e.outcome],[`Probed through`,e.form],[`Probe took`,e.elapsed_ms===void 0?void 0:`${e.elapsed_ms} ms`],[`Acknowledged by`,e.actor],[`Superseded`,Z$(e.superseded)],[`Landed as`,e.landing_commit],[`Adopted`,Q$(e.delivery)]].filter(([,e])=>e!==void 0);return(0,V.jsxs)(V.Fragment,{children:[t.length>0&&(0,V.jsx)(`dl`,{className:`facts`,children:t.map(([e,t])=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:e}),(0,V.jsx)(`dd`,{children:t})]},e))}),e.awaiting!==void 0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Held on`}),(0,V.jsx)(`ul`,{className:`release-awaiting`,children:e.awaiting.map(e=>(0,V.jsxs)(`li`,{children:[Y$(e)?(0,V.jsxs)(yi,{children:[(0,V.jsx)(y,{}),(0,V.jsxs)(bi,{children:[`Waiting on a person · `,$$(e)]}),(0,V.jsx)(xi,{children:e.action??`The release is a human step and the run recorded no action for it.`})]}):(0,V.jsxs)(`p`,{className:`detail-note`,children:[`Waiting on an automated release · `,$$(e)]}),(0,V.jsx)(`p`,{className:`detail-note`,children:[e.last_answer===void 0?void 0:X$(e.last_answer),e.waited_seconds===void 0?void 0:`waited ${e.waited_seconds}s`].filter(e=>e!==void 0).join(` · `)})]},`${e.dep}·${e.identity??``}·${e.target??``}`))})]}),e.versions!==void 0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Versions adopted`}),(0,V.jsx)(`ul`,{className:`release-awaiting`,children:e.versions.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`p`,{className:`detail-note`,children:[e.identity,` · `,e.target,` · `,e.version]})},`${e.identity}·${e.target}`))})]})]})}function t1({node:e}){let t=e.result?.release??void 0;if(t===void 0)return(0,V.jsx)(V.Fragment,{children:`Not recorded`});let n=t.identity!==e.task?.repo;return(0,V.jsx)(V.Fragment,{children:[t.target,t.style===void 0?void 0:J$(t.style),t.version,n?t.identity:void 0].filter(e=>e!==void 0).join(` · `)})}function n1({artifactId:t,client:n,focusFirstPrompt:r=!1,runId:i}){let a=WN(`${i}/${t}`,()=>n.getArtifact(i,t),0),o=a.value?.turns??[],s=o[0],c=r&&s!==void 0?{turnId:s.id,part:`prompt`}:void 0;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Oneharness conversation`}),a.loading?(0,V.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:`Loading conversation…`}):a.value===void 0?(0,V.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:`The history store holds no readable copy of that conversation.`}):a.value.unavailable===void 0?(0,V.jsx)(Gi,{className:r?`harness-conversation-focused gap-0 py-3`:`gap-0 py-3`,children:(0,V.jsx)(Ki,{className:`px-3`,children:o.map(e=>(0,V.jsx)(KC,{...c?.turnId===e.id?{focus:c}:{},turn:e},e.id))})}):(0,V.jsxs)(yi,{variant:`destructive`,children:[(0,V.jsx)(e,{}),(0,V.jsx)(bi,{children:`Transcript unavailable`}),(0,V.jsx)(xi,{children:a.value.unavailable})]})]})}function r1({artifactId:e,client:t,heading:n,missing:r,noun:i,runId:a,unreadable:o}){let s=i1(e),c=WN(s===void 0?void 0:`${a}/${s}`,()=>t.getArtifact(a,s??``),0),l=c.value?.content;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:n}),s===void 0?(0,V.jsx)(`p`,{className:`detail-note`,children:r}):c.loading?(0,V.jsxs)(`p`,{"aria-live":`polite`,className:`detail-note`,children:[`Loading `,i,`…`]}):l===void 0?(0,V.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:o}):(0,V.jsxs)(V.Fragment,{children:[c.value?.truncated===!0&&(0,V.jsxs)(`p`,{className:`detail-note`,children:[`The server keeps the end of a `,i,` this long; its beginning is not shown.`]}),(0,V.jsx)(`section`,{"aria-label":n,children:(0,V.jsx)(`pre`,{children:l})})]})]})}function i1(e){if(!(e===void 0||/[/?#]/u.test(e)))return e}var a1=6,o1=8,s1=`[aria-describedby^="timeline-detail-"]`,c1=`[data-timeline-entry]`,l1=e=>{if(!(e instanceof Element))return;let t=E(e);if(t!==void 0)return t;let n=e.closest(s1);if(n instanceof HTMLElement){let e=document.getElementById(n.getAttribute(`aria-describedby`)??``)?.textContent?.trim();return e?{element:n,detail:e}:void 0}let r=e.closest(c1),i=r?.getAttribute(`aria-label`)?.replace(/, marker$/u,``);return r instanceof HTMLElement&&i?{element:r,detail:i}:void 0},u1=(e,t)=>t!==void 0&&e?.element===t.element&&e.detail===t.detail?e:t,d1=(0,B.createContext)(()=>void 0);function f1(){let e=(0,B.useContext)(d1),t=(0,B.useRef)(!1);return(0,B.useEffect)(()=>()=>{t.current&&e(null)},[e]),(0,B.useCallback)(n=>{t.current=n!==null,e(n?.element??null)},[e])}function p1({children:e}){let t=(0,B.useContext)(d1);return(0,V.jsx)(`div`,{onPointerLeave:()=>t(null),onPointerOver:e=>{let n=e.target;t(n instanceof Element?l1(n)?.element??null:null)},children:e})}function m1({children:e}){let t=(0,B.useRef)(null),[n,r]=(0,B.useState)(),[i,a]=(0,B.useState)(),o=n??i,s=(0,B.useCallback)(()=>{r(void 0),a(void 0)},[]),c=(0,B.useCallback)(e=>r(t=>u1(t,e===null?void 0:l1(e))),[]);(0,B.useEffect)(()=>{let e=e=>a(t=>u1(t,l1(e.target))),t=e=>a(t=>u1(t,l1(e.relatedTarget))),n=()=>r(void 0);return document.addEventListener(`pointerleave`,n),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t),()=>{document.removeEventListener(`pointerleave`,n),document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t)}},[]);let l=(0,B.useCallback)(()=>{let e=t.current;if(e===null||o===void 0)return;if(!o.element.isConnected)return s();let n=o.element.getBoundingClientRect(),r=e.getBoundingClientRect(),i=window.innerWidth-r.width-o1,a=Math.min(Math.max(n.left,o1),Math.max(o1,i)),c=n.bottom+a1,l=n.top-r.height-a1,u=Math.max(o1,window.innerHeight-r.height-o1),d=c+r.height<=window.innerHeight-o1?c:l,f=Math.min(Math.max(d,o1),u);e.style.left=`${Math.round(a)}px`,e.style.top=`${Math.round(f)}px`,e.style.visibility=`visible`},[o,s]);return(0,B.useLayoutEffect)(l,[l]),(0,B.useEffect)(()=>{if(o!==void 0)return window.addEventListener(`scroll`,l,!0),window.addEventListener(`resize`,l),()=>{window.removeEventListener(`scroll`,l,!0),window.removeEventListener(`resize`,l)}},[o,l]),(0,V.jsxs)(d1.Provider,{value:c,children:[e,o!==void 0&&(0,Kn.createPortal)((0,V.jsx)(`div`,{"aria-hidden":`true`,className:`timeline-popover`,"data-testid":`timeline-popover`,ref:t,style:{visibility:`hidden`},children:o.detail},o.detail),document.body)]})}function h1(e){let t=(0,B.useRef)(void 0);return(0,B.useCallback)(n=>{t.current?.disconnect(),t.current=void 0;let r=n?.parentElement;if(n===null||r==null)return;let i=()=>r.style.setProperty(e,`${n.getBoundingClientRect().height}px`);i(),t.current=new ResizeObserver(i),t.current.observe(n)},[e])}var g1=[`keydown`,`pointerdown`,`touchstart`,`wheel`];function _1(e){for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t}return null}function v1(e,t){(0,B.useLayoutEffect)(()=>{let n=e.current;if(n===null||t===``)return;let r=_1(n);if(r===null)return;let i=()=>{let e=Number.parseFloat(getComputedStyle(n).scrollMarginTop)||0,t=r.getBoundingClientRect().top+r.clientTop;return n.getBoundingClientRect().top-(t+e)},a=()=>{let e=i();Math.abs(e)>=.5&&r.scrollTo({behavior:`instant`,top:r.scrollTop+e})};a();let o=!0,s=()=>{o=!1},c=new ResizeObserver(()=>{o&&a()});for(let e of new Set([n,...r.children]))c.observe(e);for(let e of g1)r.addEventListener(e,s,{passive:!0});return()=>{c.disconnect();for(let e of g1)r.removeEventListener(e,s)}},[e,t])}var y1=32;function b1(e){return e===null?null:e.closest(`[data-slot="scroll-area-viewport"]`)??e.parentElement}function x1(e,t){let n=(0,B.useRef)(null),r=(0,B.useRef)(!0),i=(0,B.useRef)({key:e,count:t}),a=(0,B.useCallback)(()=>{let e=n.current;e!==null&&(r.current=e.scrollHeight-e.scrollTop-e.clientHeight<=y1)},[]),o=(0,B.useCallback)(e=>{n.current?.removeEventListener(`scroll`,a),n.current=b1(e),n.current?.addEventListener(`scroll`,a,{passive:!0}),a()},[a]);return(0,B.useLayoutEffect)(()=>{let a=i.current;i.current={key:e,count:t};let o=a.key===e&&a.count>0&&t>a.count,s=n.current;!o||s===null||!r.current||(s.scrollTop=s.scrollHeight)},[e,t]),o}var S1=25,C1=2e3;function w1({client:e,runId:t,node:r,row:i}){let a=i===void 0?void 0:t0(i),o=a?.kind===`conversation`?a.value:void 0,[s,c]=(0,B.useState)(0),l=pN(e,t,o,i===void 0?void 0:`${Y1(i)}|${s}`),u=i!==void 0&&A1(i,l,r)===`not-yet`;(0,B.useEffect)(()=>{if(!u)return;let e=setInterval(()=>c(e=>e+1),C1);return()=>clearInterval(e)},[u]);let d=x1(o,X1(i,l)),f=a?.kind===`oneharness_session`?i1(a.value):void 0;return(0,V.jsx)(`section`,{"aria-label":`Timeline item detail`,className:`timeline-detail`,children:(0,V.jsx)(gd,{className:`h-full`,children:(0,V.jsx)(`div`,{className:`p-[22px] max-sm:p-3`,ref:d,children:i===void 0?(0,V.jsxs)(`div`,{className:`detail-placeholder`,children:[(0,V.jsx)(at,{size:30}),(0,V.jsx)(`p`,{children:`Select an item in the timeline to read what it recorded.`})]}):e0(a)?(0,V.jsx)(F1,{conversationId:a?.value??``,...r===void 0?{}:{node:r},row:i,transcript:l}):f===void 0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(n,{row:i}),(0,V.jsx)(kd,{className:`my-4`}),(0,V.jsx)(T1,{client:e,runId:t,node:r,reference:a,row:i}),i.rowKind===`event`&&(0,V.jsx)(o0,{client:e,event:i.event,...i.event.kind===`edit-rejected`?{shown:W1}:{}})]}):(0,V.jsx)(n1,{artifactId:f,client:e,focusFirstPrompt:!0,runId:t})})})})}function T1({client:e,runId:t,row:n,node:r,reference:i}){if(n.rowKind===`event`&&n.event.kind===`edit-rejected`)return(0,V.jsx)(U1,{client:e,event:n.event,reference:i,runId:t});let a=Z1(n);if(a!==void 0)return(0,V.jsx)(V1,{redirection:a,row:n});let o=Q1(n);if(o!==void 0)return(0,V.jsx)(e1,{release:o});let s=$1(n);return s===void 0?r0(n)?(0,V.jsx)(R1,{client:e,runId:t,reference:i,row:n}):i?.kind===`worker_report`&&i1(i.value)!==void 0?(0,V.jsx)(z1,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):i0(n,i)&&r!==void 0?(0,V.jsx)(B1,{node:r,reference:i}):(0,V.jsx)(q1,{reference:i,row:n}):(0,V.jsx)(K1,{row:n,surface:s})}function E1({turn:e}){return e.judges===void 0||e.judges.length===0?null:(0,V.jsx)(`ul`,{"aria-label":`Judges on turn ${e.id}`,className:`judge-decisions`,children:e.judges.map(e=>(0,V.jsxs)(`li`,{children:[(0,V.jsxs)(`span`,{className:`judge-decision-who`,children:[e.judge,` (`,e.kind,`)`]}),` `,e.decision,` — `,e.reason]},e.judge))})}function D1(e){if(e.rowKind===`event`)return e.event.conversation_item;if(e.rowKind===`span`)return e.span.conversation_item}function O1(e){return e.conversation_item?.turn??e.tool?.turn??e.id}function k1(e,t){if(e.rowKind===`event`&&e.event.tool!==void 0){let n=O1(e.event),r=t.find(({id:e})=>e===n),{index:i,tool_call_id:a}=e.event.tool;return r===void 0?{turnId:n,eventIndex:i}:a!==void 0&&r.tools.some(e=>e.toolCallId===a)?{turnId:r.id,toolCallId:a}:!(r.tools.some(e=>e.index===i)||(r.agentEvents??[]).some(e=>e.index===i))&&e.event.fields?.kind===`message`?{turnId:r.id,part:`answer`}:{turnId:r.id,eventIndex:i}}let n=D1(e);return n===void 0?void 0:{turnId:n.turn,part:n.part}}function A1(e,t,n){let r=t.conversation?.conversation;if(r===void 0)return;let i=D1(e),a=e.rowKind===`event`?O1(e.event):i?.turn;if(a===void 0||i?.gap!==!0&&r.turns.some(({id:e})=>e===a))return;if(i?.gap===!0)return`not-yet`;let o=Number(a.slice(a.lastIndexOf(`.`)+1));return Number.isInteger(o)&&o>=r.turns.length&&M1(r.state,n)?`not-yet`:`no-longer`}var j1={pending:!0,ready:!0,running:!0,waiting:!0,blocked:!0,parked:!0,unknown:!0,done:!1,failed:!1,cancelled:!1,skipped:!1,"not-completed":!1,"complete-but-draft":!1,"complete-but-held":!1};function M1(e,t){return e===`member-settled`?!1:t===void 0||j1[t.status]}function N1({turnId:e,absence:t}){let n=(0,B.useRef)(null);return v1(n,`${e}|${t}`),(0,V.jsx)(`div`,{className:`conversation-turn-absent`,"data-turn-id":e,children:(0,V.jsx)(`p`,{"aria-current":`true`,className:`detail-note conversation-focus-highlight`,ref:n,role:`note`,children:t===`not-yet`?`This turn is not in the recorded transcript yet.`:`This turn is no longer part of the recorded transcript.`})})}function P1({turn:t}){let n=[t.unknown.instruction_truncated===!0?`its prompt`:void 0,t.unknown.truncated===!0?`its reply`:void 0,t.tools.some(e=>e.output_truncated===!0)?`a tool's output`:void 0,t.tools.some(e=>e.input_truncated===!0)?`a tool's input`:void 0].filter(e=>e!==void 0);return n.length===0?null:(0,V.jsxs)(yi,{className:`mb-3`,role:`note`,children:[(0,V.jsx)(e,{}),(0,V.jsx)(bi,{children:`Cut by the recorder`}),(0,V.jsxs)(xi,{children:[`The run's recorder cut `,n.join(`, `),` to its bound, and no whole copy exists: neither the member's report nor a history file this run names holds it.`]})]})}function F1({conversationId:t,node:n,row:i,transcript:a}){let[o,s]=(0,B.useState)(S1),c=a.conversation,l=c?.conversation.turns??[],u=i.rowKind===`event`?O1(i.event):void 0,d=A1(i,a,n),f=u===void 0?l:d===void 0?l.filter(({id:e})=>e===u):[],p=f.length===0?l:f,m=Ip(p.map(e=>({id:e.id,time:Date.parse(e.timestamp)}))),h=h1(`--conversation-focus-offset`),g=k1(i,p),_=d===void 0?void 0:u??g?.turnId,v=c===void 0?r(i.role,i.transport):a0(c.attribution.agentRole,c.attribution.transportRole),y=c?.attribution.persona;return(0,V.jsx)(Gi,{className:`gap-0 py-3`,children:(0,V.jsxs)(Ki,{className:`px-3`,children:[(0,V.jsxs)(`header`,{className:`transcript-header`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`p`,{className:`eyebrow`,children:[i.dispatch===void 0?``:`${i.dispatch.label} · `,v,y?` · ${y}`:``]}),(0,V.jsx)(`h4`,{children:c?.conversation.name??t})]}),c===void 0?(0,V.jsx)(Ad,{className:`transcript-state-placeholder`}):(0,V.jsx)(Tp,{state:c.conversation.state})]}),(0,V.jsx)(kd,{className:`my-2.5`}),a.loading?(0,V.jsxs)(`div`,{className:`conversation-loading`,children:[(0,V.jsx)(`div`,{className:`conversation-timeline-sticky conversation-timeline-placeholder`,children:(0,V.jsx)(Ad,{className:`h-full w-full`})}),(0,V.jsxs)(`div`,{"aria-live":`polite`,className:`loading-inline`,children:[(0,V.jsx)(Ad,{className:`h-2 w-40`}),(0,V.jsx)(Ad,{className:`h-2 w-24`}),`Loading transcript…`]})]}):c===void 0?(0,V.jsxs)(yi,{variant:`destructive`,children:[(0,V.jsx)(e,{}),(0,V.jsx)(bi,{children:`Transcript unavailable`}),(0,V.jsxs)(xi,{children:[(0,V.jsx)(`p`,{children:a.error?.message??`The server recorded no transcript.`}),i.rowKind===`event`&&Object.keys(i.event.fields??{}).length>0&&(0,V.jsx)(c0,{value:i.event.fields??{}})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`conversation-timeline-sticky`,ref:h,children:(0,V.jsx)(p1,{children:(0,V.jsx)(Fp,{cursor:m.cursor,...g===void 0?{}:d===void 0?{focus:g}:{expanded:!0},onSelectTurn:m.scrollTo,turns:[...p]})})}),(0,V.jsxs)(`div`,{className:`conversation-turns`,ref:m.containerRef,children:[d!==void 0&&_!==void 0&&(0,V.jsx)(N1,{absence:d,turnId:_}),f.slice(0,o).map(e=>(0,V.jsx)(`div`,{ref:t=>m.register(e.id,t),children:(0,V.jsx)(L1,{author:v,...g?.turnId===e.id?{focus:g}:{},turn:e})},e.id)),u!==void 0&&(0,V.jsx)(`div`,{"aria-hidden":`true`,className:`conversation-focus-room`})]}),f.length>o&&(0,V.jsxs)(Wi,{onClick:()=>s(o+S1),size:`sm`,type:`button`,variant:`outline`,children:[`Show more of `,f.length,` turns`]})]})]})})}function I1(e,t){return e===t||e!==void 0&&t!==void 0&&e.turnId===t.turnId&&e.part===t.part&&e.eventIndex===t.eventIndex&&e.toolCallId===t.toolCallId}var L1=(0,B.memo)(function({author:e,focus:t,turn:n}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(P1,{turn:n}),(0,V.jsx)(KC,{author:{label:e},...t===void 0?{}:{focus:t},turn:n}),(0,V.jsx)(E1,{turn:n})]})},(e,t)=>e.turn===t.turn&&e.author===t.author&&I1(e.focus,t.focus));function R1({row:e,client:t,runId:n,reference:r}){let i=e.rowKind===`span`?e.span.detail:void 0,a=i?.artifact_id??(r?.kind===`gate_log`?r.value:void 0);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Verification record`}),(0,V.jsx)(`dl`,{className:`facts`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Result`}),(0,V.jsx)(`dd`,{children:i?.ok===void 0?e.status??`in progress`:i.ok?`passed`:`failed`})]})}),i?.output_tail&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Output`}),(0,V.jsx)(`pre`,{children:i.output_tail})]}),(0,V.jsx)(r1,{artifactId:a,client:t,heading:`Full log`,missing:`No readable log was recorded.`,noun:`log`,runId:n,unreadable:`No readable log was recorded.`}),(0,V.jsxs)(`p`,{className:`detail-note`,children:[`Verification `,e.status??`in progress`,`.`]})]})}function z1({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(r1,{artifactId:e,client:t,heading:`Worker report`,missing:`This settlement recorded no report.`,noun:`report`,runId:i,unreadable:`This run kept no readable copy of that report.`}),(0,V.jsx)(q1,{reference:n,row:r})]})}function B1({node:e,reference:t}){let n=e.detail?.verification.checks??[],r=e.detail?.publication;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Publication`}),r?.pr_url&&(0,V.jsx)(J1,{fallback:``,reference:{kind:`pr`,value:r.pr_url}}),r?.merged&&r.commit_url?(0,V.jsx)(`p`,{className:`detail-link`,children:(0,V.jsxs)(`a`,{href:r.commit_url,rel:`noreferrer`,target:`_blank`,children:[`Merged commit `,r.commit?.slice(0,8),` `,(0,V.jsx)(nt,{size:13})]})}):r?.branch_url?(0,V.jsx)(`p`,{className:`detail-link`,children:(0,V.jsxs)(`a`,{href:r.branch_url,rel:`noreferrer`,target:`_blank`,children:[`Branch `,r.branch,` `,(0,V.jsx)(nt,{size:13})]})}):!r?.pr_url&&(0,V.jsx)(J1,{fallback:`No publication was recorded.`,reference:t}),(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Observed checks`}),n.length===0?(0,V.jsx)(`p`,{className:`detail-note`,children:`No checks were observed on this node.`}):(0,V.jsx)(`dl`,{className:`facts`,children:n.map(e=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:e.name}),(0,V.jsx)(`dd`,{children:e.url?(0,V.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.state}):e.state})]},e.name))})]})}function V1({redirection:e,row:t}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`dl`,{className:`facts`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Delivery`}),(0,V.jsx)(`dd`,{children:e.delivered?`Live — into the turn that was already running`:`Deferred — onto the node's next dispatch`})]}),e.turn!==void 0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Turn`}),(0,V.jsx)(`dd`,{children:e.turn===`turn-end`?`Left to end — the note reached it as it ended`:`Interrupted — its replacement opened on the note`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Redirected at`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(u,{at:t.startedAt,relative:!0})})]}),e.member!==void 0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Member`}),(0,V.jsx)(`dd`,{children:e.member})]}),e.input_bytes!==void 0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Note`}),(0,V.jsxs)(`dd`,{children:[e.input_bytes,` bytes offered`]})]}),(0,V.jsx)(H1,{row:t})]}),e.reason!==void 0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Why it was not delivered`}),(0,V.jsx)(`p`,{className:`detail-note`,children:e.reason})]})]})}function H1({row:e}){let t=e.rowKind===`event`?Me(e.event):void 0;return t===void 0?null:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Author`}),(0,V.jsx)(`dd`,{children:t})]})}function U1({client:e,event:t,reference:n,runId:r}){let i=t.fields??{},a=e=>typeof i[e]==`string`?i[e]:void 0,o=Me(t),s=a(`summary`),c=a(`node`),l=a(`reason`),d=[[`Author`,o],[`Summary`,s],[`Node`,c]],f=a(`full_reason`)!==void 0&&n?.kind===`refusal`?i1(n.value):void 0;return(0,V.jsxs)(`section`,{"aria-label":`Refused edit`,className:`refusal`,children:[(0,V.jsxs)(`dl`,{className:`facts`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Recorded at`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(u,{at:t.at,relative:!0})})]}),d.filter(([,e])=>e!==void 0).map(([e,t])=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:e}),(0,V.jsx)(`dd`,{children:t})]},e)),i.command!==void 0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Command as sent`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(l0,{value:i.command})})]})]}),f===void 0?l===void 0?(0,V.jsx)(`p`,{className:`detail-note`,children:`The record holds no reason.`}):(0,V.jsxs)(`figure`,{className:`refusal-figure`,children:[(0,V.jsx)(`figcaption`,{className:`detail-heading`,children:`Refusal`}),(0,V.jsx)(`pre`,{className:`refusal-text`,children:l})]}):(0,V.jsx)(G1,{artifactId:f,client:e,cut:i.full_reason_truncated===!0,runId:r})]})}var W1=new Set([`author`,`summary`,`node`,`command`,`reason`,`full_reason`,`full_reason_truncated`]);function G1({artifactId:e,client:t,cut:n,runId:r}){let i=WN(`${r}/${e}`,()=>t.getArtifact(r,e),0),a=i.value?.content;return(0,V.jsxs)(V.Fragment,{children:[n&&(0,V.jsx)(`p`,{className:`detail-note`,role:`note`,children:`The hook wrote more than the engine reads, so its output was cut at the engine's read bound.`}),i.loading?(0,V.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:`Loading the complete refusal…`}):a===void 0?(0,V.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:`This run holds no readable copy of the complete refusal.`}):(0,V.jsxs)(`figure`,{className:`refusal-figure`,children:[(0,V.jsx)(`figcaption`,{className:`detail-heading`,children:`Complete refusal`}),(0,V.jsx)(`pre`,{className:`refusal-text`,children:a})]})]})}function K1({surface:e,row:t}){let n=[[`Kind`,e.kind],[`Raised by`,e.source],[`Blocking`,e.blocking===void 0?void 0:e.blocking?`yes — dependents wait on the answer`:`no — nothing waits on it`]].filter(([,e])=>e!==void 0);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`dl`,{className:`facts`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Recorded at`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(u,{at:t.startedAt,relative:!0})})]}),n.map(([e,t])=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:e}),(0,V.jsx)(`dd`,{children:t})]},e))]}),e.message!==void 0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Message`}),(0,V.jsx)(`p`,{className:`detail-note`,children:e.message})]})]})}function q1({row:e,reference:t}){if(e.rowKind===`event`)return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dl`,{className:`facts`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Recorded at`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(u,{at:e.startedAt,relative:!0})})]})}),t!==void 0&&(0,V.jsx)(J1,{reference:t,fallback:`No recorded artifact.`})]});let n=e.rowKind===`group`?void 0:e,r=e.rowKind===`span`&&e.span.count!==void 0?`${e.span.count} records`:void 0,i=(e.rowKind===`span`?e.span.reasons:void 0)??[];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`dl`,{className:`facts`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Recorded at`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(u,{at:e.startedAt,relative:!0})})]}),e.rowKind===`span`&&(e.endedAt!==null||e.status===`running`)&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Ended`}),(0,V.jsx)(`dd`,{children:e.endedAt===null?`Still running`:(0,V.jsx)(u,{at:e.endedAt,relative:!0})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Status`}),(0,V.jsx)(`dd`,{children:e.status??`Not recorded`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Duration`}),(0,V.jsx)(`dd`,{children:e.durationMs===null?`Not recorded`:ye(e.durationMs)})]}),r!==void 0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Aggregated`}),(0,V.jsx)(`dd`,{children:r})]}),i.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Waiting on`}),(0,V.jsx)(`dd`,{children:i.map(_).join(` and `)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Step`}),(0,V.jsx)(`dd`,{children:n0(n)??`None`})]}),(0,V.jsx)(H1,{row:e})]}),(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Reference`}),(0,V.jsx)(J1,{fallback:e.rowKind===`span`&&e.span.kind===`dispatch`?`No transcript was recorded for this dispatch.`:`This item points at no recorded artifact.`,reference:t})]})}function J1({reference:e,fallback:t}){return e===void 0?(0,V.jsx)(`p`,{className:`detail-note`,children:t}):e.value.startsWith(`http`)?(0,V.jsx)(`p`,{className:`detail-link`,children:(0,V.jsxs)(`a`,{href:e.value,rel:`noreferrer`,target:`_blank`,children:[e.kind===`pr`?O$(e.value):e.value,` `,(0,V.jsx)(nt,{size:13})]})}):(0,V.jsxs)(`p`,{className:`detail-note`,children:[(0,V.jsx)(`span`,{className:`detail-reference-kind`,children:e.kind}),(0,V.jsx)(`code`,{children:e.value})]})}function Y1(e){if(e.rowKind!==`span`)return e.id;let t=e.span.events.at(-1);return[e.span.id,e.span.status??``,e.span.ended_at??``,e.span.events.length,t?.id??``,t?.at??``,t?.status??``].join(`|`)}function X1(e,t){return t.conversation===void 0?0:e?.rowKind===`event`?1:t.conversation.conversation.turns.length}function Z1(e){return e.rowKind===`event`?e.event.redirection:void 0}function Q1(e){return e.rowKind===`event`?e.event.release:void 0}function $1(e){return e.rowKind===`event`?e.event.surface:void 0}function e0(e){return e?.kind===`conversation`}function t0(e){if(e.rowKind===`span`)return e.span.reference;if(e.rowKind===`event`)return e.event.reference}function n0(e){if(e?.rowKind===`span`)return e.span.step_id;if(e?.rowKind===`event`)return e.event.step_id}function r0(e){return e.kind===`verification`||e.kind.startsWith(`verification-`)}function i0(e,t){return t?.kind===`pr`||e.kind===`publication`||e.kind.startsWith(`pr-`)||e.kind.startsWith(`publication-`)}function a0(e,t){return r(e,t)}function o0({client:e,event:t,shown:n}){let r=n===void 0?t.fields??{}:Object.fromEntries(Object.entries(t.fields??{}).filter(([e])=>!n.has(e)));if(n!==void 0&&Object.keys(r).length===0)return null;let i=t.kind===`command-started`?le(r.command):void 0;return(0,V.jsxs)(`section`,{"aria-label":`Recorded fields`,className:`record-content`,children:[t.surface_state!==void 0&&(0,V.jsx)(f0,{state:t.surface_state}),t.kind===`human-attested`&&(0,V.jsx)(p0,{client:e,item:r.item}),(t.kind===`node-held`||t.kind===`node-unheld`)&&(0,V.jsx)(m0,{event:t}),(t.kind===`edit-committed`||t.kind===`command-accepted`)&&(0,V.jsx)(h0,{operations:r.operations}),i!==void 0&&(0,V.jsx)(`dl`,{className:`facts`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Command`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`code`,{className:`command-line`,children:P(i)})})]})}),Object.keys(r).length===0?(0,V.jsx)(`p`,{className:`detail-note`,children:`This record holds no fields.`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Recorded fields`}),(0,V.jsx)(c0,{value:i===void 0?r:Object.fromEntries(Object.entries(r).filter(([e])=>e!==`command`))})]})]})}function s0(e){let t=e.replaceAll(/[_-]+/gu,` `).trim();return t.length===0?e:`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function c0({value:e}){return(0,V.jsx)(`dl`,{className:`facts record-fields`,children:Object.entries(e).map(([e,t])=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:s0(e)}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(l0,{value:t})})]},e))})}function l0({value:e}){if(e==null)return(0,V.jsx)(`span`,{className:`record-none`,children:`None`});if(typeof e==`string`)return(0,V.jsx)(`span`,{className:`record-text`,children:e});if(typeof e==`number`||typeof e==`boolean`)return(0,V.jsx)(V.Fragment,{children:String(e)});if(Array.isArray(e))return e.length===0?(0,V.jsx)(`span`,{className:`record-none`,children:`None`}):(0,V.jsx)(`ol`,{className:`record-list`,children:e.map((e,t)=>(0,V.jsx)(`li`,{children:(0,V.jsx)(l0,{value:e})},t))});let t=u0(e);return t===void 0?(0,V.jsx)(V.Fragment,{children:String(e)}):(0,V.jsx)(c0,{value:t})}function u0(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function d0(e,t){let n=e?.[t];return typeof n==`string`&&n.trim()!==``?n:void 0}function f0({state:e}){let{status:t}=d(e),n=e.reply,r=[[`Queued`,e.queued_at],[`Read`,e.read_at],[`Answered`,e.replied_at]];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`h3`,{className:`detail-heading`,children:[`Surface `,e.id]}),(0,V.jsxs)(`dl`,{className:`facts`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Status`}),(0,V.jsx)(`dd`,{children:t})]}),r.map(([e,t])=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:e}),(0,V.jsx)(`dd`,{children:t===void 0?`Not yet`:(0,V.jsx)(u,{at:t})})]},e)),e.correlation!==void 0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Correlation`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`code`,{children:e.correlation})})]})]}),n!==void 0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Reply`}),(0,V.jsx)(c0,{value:n})]})]})}function p0({client:e,item:t}){let n=u0(t),r=d0(n,`id`),i=u0(n?.resolution),a=d0(i,`choice`),o=WN(a===void 0?void 0:r,()=>e.getHumanItem(r??``),0);if(n===void 0)return(0,V.jsx)(`p`,{className:`detail-note`,children:`Attested with no human item resolved: the planner attested it itself.`});let s=o.value?.item.choices?.find(e=>e.id===a)?.title,c=[[`Item`,r],[`Action`,d0(n,`action`)],[`By`,d0(i,`actor`)],[`On behalf of`,d0(i,`on_behalf_of`)],[`Provenance`,d0(i,`provenance`)??`manager`],[`Choice`,a===void 0?void 0:s===void 0?a:`${s} (${a})`],[`Reason`,d0(i,`reason`)]],l=d0(i,`text`);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Human item`}),(0,V.jsx)(`dl`,{className:`facts`,children:c.filter(([,e])=>e!==void 0).map(([e,t])=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:e}),(0,V.jsx)(`dd`,{children:t})]},e))}),l!==void 0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Words`}),(0,V.jsx)(`p`,{className:`detail-note record-text`,children:l})]})]})}function m0({event:e}){let t=de(e);return t.length===0?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:e.kind===`node-held`?`Held because`:`Released from`}),(0,V.jsx)(`ul`,{className:`hold-reasons`,children:t.map((e,t)=>(0,V.jsx)(`li`,{children:_(e)},t))})]})}function h0({operations:e}){return!Array.isArray(e)||e.length===0?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h3`,{className:`detail-heading`,children:`Operations`}),(0,V.jsx)(`ol`,{className:`record-operations`,children:e.map((e,t)=>{let n=u0(e);return(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`strong`,{children:d0(n,`kind`)??`Operation ${t+1}`}),n===void 0?(0,V.jsx)(l0,{value:e}):(0,V.jsx)(c0,{value:n})]},t)})})]})}var g0=`span:`,_0=500,v0=ie,y0=e=>500*2**(e-1),b0=e=>e.record_id??e.id,x0=hM.omit({events:!0});function S0(e,t){if(t===void 0)return e;let n=new Set(e.events.map(b0)),r=t.filter(e=>!n.has(b0(e)));if(r.length===0)return e;let i=[...e.events,...r].map(e=>[Date.parse(e.at),e.journal_order??0,e]);return i.sort((e,t)=>e[0]-t[0]||e[1]-t[1]),{...e,events:i.map(([,,e])=>e)}}function C0(e){let t=e.flatMap(e=>{let t=e.events_total;if(t===void 0||t<=e.events.length)return[];let n=e.events[0],r=Date.parse(e.started_at),i=n===void 0?Date.parse(e.ended_at??e.started_at):Date.parse(n.at);return i>r?[[r,i]]:[]}).sort((e,t)=>e[0]-t[0]),n=[];for(let[e,r]of t){let t=n.at(-1);t!==void 0&&e<=t[1]?t[1]=Math.max(t[1],r):n.push([e,r])}return n}function w0({client:e,runId:t,scope:n,nodeId:r,timeline:i}){let a=(0,B.useRef)(new Map),o=(0,B.useRef)(new Map),s=(0,B.useRef)(new Set),[c,l]=(0,B.useState)(0),[u,d]=(0,B.useState)(()=>new Map),f=(0,B.useCallback)(()=>l(e=>e+1),[]),p=(0,B.useCallback)(e=>{for(let t of e.rows)a.current.set(b0(t),t)},[]),m=(0,B.useCallback)(e=>{d(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),h=(0,B.useCallback)((e,t,n)=>{s.current.delete(e),d(r=>new Map(r).set(e,{message:t instanceof Error?t.message:String(t),retry:n})),f()},[f]),g=(0,B.useMemo)(()=>{if(i===void 0)return i;if(n===`node`)for(let e of i.spans)for(let t of e.events)a.current.has(b0(t))||a.current.set(b0(t),{...t,span_id:e.id});let e=new Map;for(let t of a.current.values()){let n=e.get(t.span_id);n===void 0?e.set(t.span_id,[t]):n.push(t)}return e.size===0&&o.current.size===0?i:{...i,spans:i.spans.map(t=>{let n=S0(t,e.get(t.id)),r=o.current.get(t.id);return r===void 0?n:{...r,...n,events:n.events}})}},[i,c,n]),_=T0({client:e,runId:t,nodeId:n===`node`?r:void 0,opened:i!==void 0,take:p,bump:f}),v=_?.state===`loading`,y=(0,B.useMemo)(()=>n!==`node`||!v?[]:C0(g?.spans??[]),[g,n,v]),b=_?.failure??[...u].find(([e])=>!e.startsWith(g0))?.[1],x=(0,B.useCallback)(e=>u.get(`${g0}${e}`),[u]),S=(0,B.useCallback)(e=>m(`${g0}${e}`),[m]),C=(0,B.useCallback)(async(r,i,a)=>{m(r);try{let r;for(;;){let a=await e.getTimelineEvents(t,{scope:n,limit:_0,...i,...r===void 0?{}:{cursor:r}});p(a);let{span:s}=a;if(i.span!==void 0&&s!==void 0&&o.current.set(i.span,x0.parse(s)),f(),a.next_cursor===null)return;r=a.next_cursor}}catch(e){h(r,e,a)}},[f,m,e,h,t,n,p]),w=(0,B.useCallback)(e=>{let t=`${g0}${e}`;s.current.has(t)||(s.current.add(t),C(t,{span:e,...r===void 0?{}:{node:r}},()=>w(e)))},[r,C]),T=(0,B.useCallback)(e=>{let t=`row:${e??``}`;s.current.has(t)||(s.current.add(t),C(t,e===void 0?{}:{node:e},()=>T(e)))},[C]),E=(0,B.useCallback)((e,t,n)=>{let r=`stretch:${n??``}:${e}:${t}`;s.current.has(r)||(s.current.add(r),C(r,{...n===void 0?{}:{node:n},from:new Date(e).toISOString(),to:new Date(t).toISOString()},()=>E(e,t,n)))},[C]);return{...g===void 0?{}:{timeline:g},unheld:y,loadSpan:w,loadRow:T,loadStretch:E,spanFailure:x,forgetSpan:S,...b===void 0?{}:{failure:b},..._===void 0?{}:{nodeLoad:E0(_)}}}function T0({client:e,runId:t,nodeId:n,opened:r,take:i,bump:a}){let[o,s]=(0,B.useState)(),[c,l]=(0,B.useState)(0);if((0,B.useEffect)(()=>{if(n===void 0||!r)return;let o=new AbortController,c=new Set,u,d=()=>u!==void 0&&c.size>=u,f=!1,p,m=(e,t)=>s({node:n,state:e,loaded:c.size,...u===void 0?{}:{total:u},partial:e===`loading`&&f,...t===void 0?{}:{failure:t}}),h=setTimeout(()=>{f=!0,s(e=>e?.node===n&&e.state===`loading`?{...e,partial:!0}:e)},v0),g=async r=>{try{for await(let r of e.streamNodeTimeline(t,n,o.signal)){if(r.kind===`start`)u=r.total;else{i(r);for(let e of r.rows)c.add(b0(e));a()}d()&&clearTimeout(h),m(d()?`held`:`loading`)}clearTimeout(h),m(`held`),a()}catch(e){if(o.signal.aborted||d())return;if(r<3){p=setTimeout(()=>void g(r+1),y0(r));return}clearTimeout(h),m(`failed`,{message:e instanceof Error?e.message:String(e),retry:()=>l(e=>e+1)})}};return m(`loading`),g(1),()=>{o.abort(),clearTimeout(h),p!==void 0&&clearTimeout(p)}},[e,t,n,r,i,a,c]),!(n===void 0||o?.node!==n))return o}function E0(e){return{state:e.state,loaded:e.loaded,...e.total===void 0?{}:{total:e.total},partial:e.partial}}var D0=`This node is not on the run's graph, so the plan holds no task for it.`;function O0({client:n,runId:r,node:i,nodes:a,timeline:o,timelineError:s,hiddenTypes:c=[],onHiddenTypesChange:l=()=>{},runLoaded:u=!0,onRetry:d,selectedItemId:f,onSelectItem:p,onBack:m,selectedTab:h,onSelectTab:g}){let _=(0,B.useMemo)(()=>t(o,i.id),[o,i.id]);(0,B.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(f===void 0?m():p())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m,p,f]);let v=i.detail?.publication===void 0?i.result?.pr??void 0:i.detail.publication.pr_url;return(0,V.jsx)(`section`,{"aria-label":`Timeline for ${i.label}`,className:`node-view`,children:(0,V.jsxs)(Af,{className:`node-tabs`,onValueChange:e=>{FQ(e)&&g(e)},value:h,children:[(0,V.jsxs)(`section`,{"aria-label":`Node header`,className:`node-view-head`,children:[(0,V.jsx)(`nav`,{"aria-label":`Breadcrumb`,children:(0,V.jsxs)(`ol`,{className:`breadcrumb`,children:[(0,V.jsx)(`li`,{children:(0,V.jsxs)(Wi,{onClick:m,size:`sm`,type:`button`,variant:`ghost`,children:[(0,V.jsx)(Be,{size:14}),` Graph`]})}),(0,V.jsx)(`li`,{"aria-current":`page`,children:(0,V.jsx)(`span`,{className:`breadcrumb-node`,children:i.label})})]})}),(0,V.jsxs)(`div`,{className:`node-view-facts`,children:[(0,V.jsx)(mQ,{className:`node-view-state`,state:i.status}),(0,V.jsx)(z$,{control:i.control}),(0,V.jsxs)(`span`,{className:`node-view-meta`,children:[fe(i),` node ·`,` `,u?`${i.telemetry?.turns??0} turns · ${i.telemetry?.lint??0} lint turns`:`turns ${ae}`]}),v!==void 0&&(0,V.jsxs)(`a`,{className:`node-view-pr`,href:v,rel:`noreferrer`,target:`_blank`,children:[O$(v),` `,(0,V.jsx)(nt,{size:12})]})]}),(0,V.jsx)(Mf,{"aria-label":`Node details`,variant:`line`,children:Object.entries(PQ).map(([e,t])=>(0,V.jsx)(Nf,{value:e,children:t},e))})]}),(0,V.jsx)(B0,{node:i,nodes:a}),(0,V.jsx)(R0,{node:i}),(0,V.jsx)(z0,{node:i}),(0,V.jsxs)(Pf,{className:`node-tab-panel`,value:`task`,children:[i.task===void 0?(0,V.jsx)(`p`,{children:D0}):u?(0,V.jsx)(rX,{source:F0(i.task)}):(0,V.jsx)(`p`,{className:`loading-value`,children:ae}),(0,V.jsxs)(`dl`,{className:`facts`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Settled as`}),(0,V.jsx)(`dd`,{children:V0(i.result?.outcome)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Outcome`}),(0,V.jsx)(`dd`,{children:V0(i.result?.detail)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Graph overrides`}),(0,V.jsx)(`dd`,{children:u?(i.task?.sets??[]).length===0?`None`:(0,V.jsx)(`ol`,{"aria-label":`Graph overrides`,className:`sets-served`,children:i.task?.sets?.map((e,t)=>(0,V.jsx)(`li`,{children:(0,V.jsx)(`code`,{children:e})},t))}):ae})]})]})]}),(0,V.jsx)(Pf,{className:`node-tab-panel`,value:`criteria`,children:i.task===void 0?(0,V.jsx)(`p`,{children:D0}):u?(0,V.jsx)(rX,{source:I0(i.task)}):(0,V.jsx)(`p`,{className:`loading-value`,children:ae})}),(0,V.jsx)(Pf,{className:`node-tab-panel`,value:`dependencies`,children:(0,V.jsxs)(`dl`,{className:`facts`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Dependencies`}),(0,V.jsx)(`dd`,{children:(i.task?.deps??[]).map(e=>{let t=a.find(t=>t.id===e)?.status;return t===void 0?e:`${e} (${t})`}).join(`, `)||`None`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Unblocks`}),(0,V.jsx)(`dd`,{children:i.dependents.join(`, `)||`None`})]})]})}),(0,V.jsxs)(Pf,{className:`node-tab-panel`,value:`remote`,children:[!u&&(0,V.jsx)(`p`,{className:`loading-value`,children:`Loading…`}),(0,V.jsxs)(`dl`,{className:`facts`,hidden:!u,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Publication`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(L0,{node:i})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Branch`}),(0,V.jsx)(`dd`,{children:i.detail?.publication?.branch??`Not recorded`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Merge`}),(0,V.jsx)(`dd`,{children:i.detail?.publication?i.detail.publication.merged?`Merged`:`Not merged`:`Not recorded`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Release`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(t1,{node:i})})]}),(0,V.jsxs)(`div`,{className:`remote-check-facts`,children:[(0,V.jsx)(`dt`,{children:`Verification coverage`}),(0,V.jsxs)(`dd`,{children:[`Hook:`,` `,i.detail?.verification.pre_push_hook?`present`:`not recorded`,` · `,`Required checks:`,` `,i.detail?.verification.required_checks?.join(`, `)||`none configured`]})]}),(0,V.jsxs)(`div`,{className:`remote-check-facts`,children:[(0,V.jsx)(`dt`,{children:`Observed checks`}),(0,V.jsx)(`dd`,{children:(i.detail?.verification.checks??[]).length===0?`No checks observed`:(0,V.jsxs)(`table`,{"aria-label":`Remote checks`,className:`remote-checks`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{children:`Name`}),(0,V.jsx)(`th`,{children:`Status`}),(0,V.jsx)(`th`,{children:`Runtime`}),(0,V.jsx)(`th`,{children:`Required`})]})}),(0,V.jsx)(`tbody`,{children:i.detail?.verification.checks?.map(e=>(0,V.jsxs)(`tr`,{className:e.status===`completed`&&![`success`,`neutral`,`skipped`].includes(e.conclusion??``)?`check-failing`:void 0,children:[(0,V.jsx)(`th`,{scope:`row`,children:e.url?(0,V.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.name}):e.name}),(0,V.jsx)(`td`,{children:(0,V.jsx)(R$,{check:e})}),(0,V.jsx)(`td`,{children:(0,V.jsx)(P$,{...e.started_at===void 0?{}:{startedAt:e.started_at},...e.completed_at===void 0?{}:{completedAt:e.completed_at}})}),(0,V.jsxs)(`td`,{title:e.requirement,className:e.required?`check-required`:`check-optional`,children:[(0,V.jsx)(`svg`,{role:`img`,"aria-label":e.required?`required`:`not required`,width:`12`,height:`12`,viewBox:`0 0 12 12`,children:e.required?(0,V.jsx)(`path`,{d:`M6 0.5 L11 2.5 V6 C11 9 8.5 11 6 11.5 C3.5 11 1 9 1 6 V2.5 Z`,fill:`currentColor`}):(0,V.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`2 1.5`})}),e.required?`Required`:`Optional`]})]},e.name))})]})})]})]})]}),(0,V.jsx)(Pf,{className:`node-timeline-panel`,value:`timeline`,children:s===void 0?o===void 0?(0,V.jsx)(`div`,{"aria-live":`polite`,className:`loading-state`,children:`Loading the recorded timeline…`}):_.rows.length===0?(0,V.jsxs)(Gi,{className:`m-5 items-center gap-2 p-8 text-muted-foreground`,children:[(0,V.jsx)(`p`,{className:`m-0`,children:`This node has no recorded timeline yet.`}),(0,V.jsx)(`p`,{className:`m-0 text-[11px]`,children:`Spans and events appear here as the run records them.`})]}):(0,V.jsx)(k0,{client:n,hiddenTypes:c,node:i,onHiddenTypesChange:l,onSelectItem:p,runId:r,selectedItemId:f,timeline:o}):(0,V.jsxs)(yi,{className:`m-5 w-auto`,variant:`destructive`,children:[(0,V.jsx)(e,{}),(0,V.jsx)(bi,{children:`Timeline unavailable`}),(0,V.jsxs)(xi,{children:[s.message,` `,d!==void 0&&(0,V.jsx)(Wi,{onClick:d,size:`sm`,variant:`outline`,children:`Try again`})]})]})})]})})}function k0({client:e,hiddenTypes:t,node:n,onHiddenTypesChange:r,onSelectItem:i,runId:s,selectedItemId:c,timeline:l}){let u=w0({client:e,runId:s,scope:`node`,nodeId:n.id,timeline:l}),d=u.timeline??l,f=(0,B.useMemo)(()=>ue(d,n.id),[d,n.id]),p=(0,B.useMemo)(()=>new Set(t),[t]),_=(0,B.useMemo)(()=>o(f.tree,p),[f.tree,p]),v=(0,B.useMemo)(()=>Re(f.tree),[f.tree]),[y,x]=(0,B.useState)(()=>new Set),S=(0,B.useMemo)(()=>c===void 0?[]:h(_,c).filter(e=>e.rowKind===`group`).map(({id:e})=>e),[_,c]),C=(0,B.useMemo)(()=>S.length===0?y:new Set([...y,...S]),[y,S]),w=(0,B.useMemo)(()=>m(_,C),[_,C]),T=(0,B.useMemo)(()=>g(w).map(e=>({id:e.id,time:Date.parse(e.startedAt)})),[w]);j0(f,w);let E=u.nodeLoad?.state===`loading`,D=(0,B.useRef)(T);E||(D.current=T);let O=Ip(E?D.current:T),[k,A]=(0,B.useState)(!1),[j,M]=(0,B.useState)(),N=(0,B.useMemo)(()=>F(f.items,f.lanes),[f.items,f.lanes]),P=(0,B.useMemo)(()=>Pe(f.markers,f.items,c),[f.items,f.markers,c]),I=(0,B.useMemo)(()=>A0([...f.items,...f.markers.map(({at:e})=>({start:e}))]),[f.items,f.markers]),L=(0,B.useMemo)(()=>A0([...k?f.items:N,...P.map(({at:e})=>({start:e}))]),[k,f.items,N,P]),R=O.cursor===void 0?void 0:Math.min(Math.max(O.cursor,I[0]),I[1]),ee=c===void 0?void 0:a(_,c)??a(f.rows,c),te=(0,B.useRef)(0),ne=e=>{te.current=Date.now()+500,i(e),O.scrollTo(e)},re=(0,B.useRef)(ne);re.current=ne;let ie=(0,B.useCallback)(e=>re.current(e),[]),ae=(0,B.useRef)(null),{containerRef:oe}=O,se=(0,B.useCallback)(e=>{ae.current=e,oe(e)},[oe]),ce=(0,B.useRef)(null),le=f1(),{loadSpan:de,forgetSpan:fe}=u,pe=ee?.rowKind===`span`?ee.span.id:void 0;(0,B.useEffect)(()=>{if(pe!==void 0)return de(pe),()=>fe(pe)},[pe,de,fe]);let me=pe===void 0?void 0:u.spanFailure(pe),{scrollTo:he}=O;return(0,B.useEffect)(()=>{c!==void 0&&(te.current=Date.now()+500,he(c))},[c,he]),(0,V.jsxs)(`div`,{className:`node-execution`,"data-expanded":k,children:[(0,V.jsxs)(`section`,{"aria-busy":E,"aria-label":`Node timeline`,className:`node-timeline-sticky`,"data-testid":`node-timeline`,ref:ce,children:[(0,V.jsx)(q$,{container:ce,partial:u.nodeLoad?.partial===!0,range:j??L,stretches:u.unheld}),u.nodeLoad?.partial===!0&&(0,V.jsx)(G$,{load:u.nodeLoad}),(0,V.jsx)(an,{...A$,axis:{origin:I[0]},cursor:R,expanded:k,getFailureExcerpt:e=>e.payload.rowKind===`span`?e.payload.span.detail?.output_tail:void 0,items:k?f.items:N,lanes:f.lanes,markers:P,onExpandedChange:A,onHover:le,onRangeChange:e=>M(e[0]<=L[0]&&e[1]>=L[1]?void 0:M$(e)),onSelect:e=>ne(e.id),range:j??L,selectedId:c})]}),(0,V.jsxs)(`section`,{"aria-busy":E,"aria-label":`Node transcript`,className:`node-transcript`,ref:se,children:[u.failure!==void 0&&(0,V.jsx)(U$,{failure:u.failure,what:`This node's timeline`}),(0,V.jsx)(B$,{counts:v,hidden:p,onHiddenChange:r}),_.length===0&&f.tree.length>0&&(0,V.jsx)(V$,{onClear:()=>r([])}),b(w).map(e=>{let t=(0,V.jsx)(M0,{entries:e.entries,onOpen:ie,onToggle:e=>x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),register:O.register,selectedItemId:c},e.id);return e.dispatch===void 0?(0,V.jsx)(B.Fragment,{children:t},e.id):(0,V.jsxs)(`section`,{"aria-label":e.dispatch.label,className:`transcript-dispatch`,children:[(0,V.jsx)(`h3`,{children:e.dispatch.label}),t]},e.id)})]}),ee!==void 0&&(0,V.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,V.jsx)(Wi,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>i(),size:`icon`,variant:`ghost`,children:(0,V.jsx)(Et,{})}),(0,V.jsx)(w1,{client:e,node:n,row:ee,runId:s}),me!==void 0&&(0,V.jsx)(U$,{failure:me})]})]})}function A0(e){let t=e.map(({start:e})=>e),n=e.map(e=>e.end??e.start);if(t.length===0)return[0,1];let r=Math.min(...t),i=Math.max(...n);return[r,i>r?i:r+1]}function j0(e,t){(0,B.useLayoutEffect)(()=>{let n=window.__nodeLoadProbe;if(n===void 0)return;let r=[],i=e=>{r.push(e.id);for(let t of e.children)i(t)};for(let e of t)if(e.entryKind===`row`)r.push(e.row.id);else for(let t of e.group.children)i(t);n({chart:[...e.items.map(e=>e.id),...e.markers.map(e=>e.id)],list:r})},[e,t])}function M0({entries:e,onOpen:t,onToggle:n,register:r,selectedItemId:i}){return e.map(e=>e.entryKind===`row`?(0,V.jsx)(P0,{onOpen:t,register:r,row:e.row,selected:e.row.id===i||i!==void 0&&e.row.aliases?.includes(i)===!0},e.row.id):(0,V.jsx)(H$,{entry:e,onToggle:()=>n(e.group.id),children:(0,V.jsx)(M0,{entries:e.entries,onOpen:t,onToggle:n,register:r,...i===void 0?{}:{selectedItemId:i}})},e.group.id))}function N0(e,t){let[n,r]=[e.row,t.row];return e.selected===t.selected&&e.register===t.register&&e.onOpen===t.onOpen&&n.id===r.id&&n.rowKind===r.rowKind&&n.displayLabel===r.displayLabel&&n.displayKind===r.displayKind&&n.startedAt===r.startedAt&&n.durationMs===r.durationMs&&n.status===r.status&&n.statusAt===r.statusAt&&n.sessionName===r.sessionName&&n.dispatch?.label===r.dispatch?.label&&(n.rowKind===`event`&&r.rowKind===`event`?n.category===r.category&&n.event.seq===r.event.seq:n.rowKind!==`event`&&r.rowKind!==`event`)}var P0=(0,B.memo)(function({row:e,selected:t,register:n,onOpen:r}){let{id:i}=e,a=(0,B.useCallback)(e=>n(i,e),[n,i]);return(0,V.jsx)(`article`,{"aria-current":t?`true`:void 0,"aria-label":e.displayLabel,className:`transcript-item`,"data-dispatch-group":e.dispatch?.label,"data-journal-seq":e.rowKind===`event`?e.event.seq:void 0,"data-row-id":e.id,"data-selected":t,ref:a,children:(0,V.jsxs)(`button`,{"aria-label":`Open ${e.displayLabel}`,onClick:()=>r(e.id),type:`button`,children:[(0,V.jsxs)(`span`,{className:`eyebrow`,children:[e.rowKind===`event`&&(0,V.jsx)(O,{category:e.category}),e.displayKind]}),(0,V.jsx)(`strong`,{className:`transcript-label`,title:e.displayLabel,children:e.displayLabel}),(0,V.jsxs)(`span`,{className:`transcript-facts`,children:[(0,V.jsx)(u,{at:e.startedAt}),e.durationMs!==null&&` · ${ye(e.durationMs)}`,` · ${e.status??`recorded`}`,e.statusAt!==void 0&&(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(u,{at:e.statusAt})]}),e.sessionName!==void 0&&` · ${e.sessionName}`]})]})})},N0);function F0(e){if(e.task!==void 0)return e.task;let t=e.steps??[];return t.length===0?`No task prose recorded.`:t.map(e=>`## ${e.id}\n\n${e.task}`).join(`
106
+
107
+ `)}function I0(e){let t=F0(e),n=/(?:^|\n)##[ \t]*acceptance[ \t]+criteria[ \t]*\r?\n([\s\S]*?)(?=\r?\n##[ \t]|$)/i.exec(t)?.[1]?.trim();return n===void 0||n.length===0?`No acceptance criteria recorded in this node's task.`:n}function L0({node:e}){let t=e.detail?.publication;if(t===void 0)return typeof e.result?.pr==`string`&&e.result.pr?(0,V.jsxs)(`a`,{className:`node-view-pr`,href:e.result.pr,rel:`noreferrer`,target:`_blank`,children:[O$(e.result.pr),` `,(0,V.jsx)(nt,{size:12})]}):(0,V.jsx)(V.Fragment,{children:`Not recorded`});let n=(t.merged?[[t.pr_url,O$(t.pr_url)],[t.commit_url,`Commit ${t.commit?.slice(0,8)??``}`]]:[[t.pr_url,O$(t.pr_url)],[t.branch_url,t.branch??`Branch`]]).filter(([e])=>e);return n.length===0?(0,V.jsx)(V.Fragment,{children:`Not recorded`}):(0,V.jsx)(V.Fragment,{children:n.map(([e,t],n)=>(0,V.jsxs)(`span`,{children:[n>0&&` · `,(0,V.jsxs)(`a`,{className:`node-view-pr`,href:e,rel:`noreferrer`,target:`_blank`,children:[t,` `,(0,V.jsx)(nt,{size:12})]})]},e))})}function R0({node:e}){let t=ge(e);if(t.length===0)return null;let n=e.result?.detail?.trim()||void 0;return(0,V.jsxs)(`section`,{"aria-label":`Awaited releases`,className:`node-awaiting m-5 rounded-lg border border-warning bg-warning-surface px-4 py-3 text-warning`,children:[(0,V.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[(0,V.jsx)(ft,{size:16}),e.status===`complete-but-held`?`Complete, and held unlanded until its releases arrive`:`Complete, and held as a draft until its releases arrive`]}),(0,V.jsxs)(`dl`,{className:`facts facts-stacked`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:t.length===1?`Awaits`:`Awaits ${t.length}`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`ul`,{className:`awaited-releases`,children:t.map(e=>(0,V.jsxs)(`li`,{children:[`the `,(0,V.jsx)(`strong`,{children:e.target}),` release of`,` `,(0,V.jsx)(`code`,{children:e.producer})]},`${e.producer} ${e.target}`))})})]}),n!==void 0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Detail`}),(0,V.jsx)(`dd`,{children:n})]})]})]})}function z0({node:e}){if(e.kind!==`command`)return null;let t=e.task?.command,n=e.task?.timeout_seconds,r=e.result?.outcome,i=e.result?.log;return(0,V.jsxs)(`section`,{"aria-label":`Command`,className:`node-command m-5`,children:[(0,V.jsxs)(`dl`,{className:`facts`,children:[t!==void 0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Command`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`code`,{className:`command-line`,children:P(t)})})]}),n!==void 0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Timeout`}),(0,V.jsxs)(`dd`,{children:[n,` seconds`]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Outcome`}),(0,V.jsx)(`dd`,{children:r??e.status})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Log`}),(0,V.jsx)(`dd`,{children:i===void 0?`The command has not started.`:i.path})]})]}),i?.content===void 0?i!==void 0&&(0,V.jsx)(`p`,{className:`node-command-log-missing`,children:`The log is not readable from this run.`}):(0,V.jsxs)(`figure`,{className:`node-command-log-figure`,children:[(0,V.jsx)(`figcaption`,{children:`Command log`}),(0,V.jsx)(`pre`,{className:`node-command-log`,children:i.truncated===!0?`…${i.content}`:i.content})]})]})}function B0({node:t,nodes:n}){if(!ve(t.status))return null;let r=t.status===`blocked`||t.status===`skipped`,i=be(t),a=t.result?.error||void 0,o=t.result?.exit_code;return(0,V.jsxs)(yi,{className:k(`m-5 w-auto`,r&&`border-warning bg-warning-surface text-warning`),variant:r?`default`:`destructive`,children:[r?(0,V.jsx)(ft,{}):(0,V.jsx)(e,{}),(0,V.jsx)(bi,{children:r?`This node is ${t.status}`:`This node ${t.status===`cancelled`?`was cancelled`:t.status===`not-completed`?`did not complete`:`failed`}${t.failure?`: ${t.failure.class}`:``}`}),(0,V.jsx)(xi,{children:(0,V.jsxs)(`dl`,{className:`facts`,children:[r&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:t.status===`skipped`?`Unmet`:`Blocked by`}),(0,V.jsx)(`dd`,{children:t.blockers.length>0?t.blockers.map(e=>{let t=n.find(t=>t.id===e)?.status;return t===void 0?e:`${e} (${t})`}).join(`, `):`Nothing recorded; the run has not written what holds it.`})]}),t.status===`skipped`&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Attempts`}),(0,V.jsx)(`dd`,{children:`Never attempted`})]}),!r&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Detail`}),(0,V.jsx)(`dd`,{children:i??`No reason was recorded for this outcome.`})]}),a!==void 0&&a!==i&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Error`}),(0,V.jsx)(`dd`,{children:a})]}),typeof o==`number`&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Exit code`}),(0,V.jsx)(`dd`,{children:o})]})]})})]})}function V0(e){return e==null||e===``?`Not recorded`:typeof e==`string`?e:JSON.stringify(e,null,2)}function H0({client:t,detail:n,nodes:r,timeline:i,timelineError:s,hiddenTypes:l=[],onHiddenTypesChange:u=()=>{},onRetry:d,journalSeq:f,onSelectNode:p,selectedItemId:m,onSelectItem:h,state:g,status:_}){let y=n.run.run_id,b=w0({client:t,runId:y,scope:`run`,...i===void 0?{}:{timeline:i}}),x=b.timeline,S=Ae(n.progress),w=(0,B.useMemo)(()=>Ie(x,r),[x,r]),T=(x?.spans??[]).filter(e=>e.node_id===void 0),E=(0,B.useMemo)(()=>new Set(l),[l]),D=(0,B.useMemo)(()=>v(x),[x]),O=(0,B.useMemo)(()=>o(D,E),[D,E]),k=T.find(e=>e.id===m),A=T.flatMap(e=>e.events).find(e=>(e.record_id??e.id)===m)??T.flatMap(e=>e.events).find(e=>e.id===m),j=m===void 0?void 0:a(O,m),M=k===void 0?j??(A===void 0?void 0:C(A)):c(k),{loadSpan:N,forgetSpan:P,loadRow:F}=b;(0,B.useEffect)(()=>{m!==void 0&&M===void 0&&x!==void 0&&F(void 0)},[m,M,x,F]);let I=k?.id;(0,B.useEffect)(()=>{if(I!==void 0)return N(I),()=>P(I)},[I,N,P]);let L=I===void 0?void 0:b.spanFailure(I);return(0,B.useEffect)(()=>{let e=e=>{e.key===`Escape`&&m!==void 0&&h()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h,m]),(0,V.jsxs)(`div`,{className:`overall-view`,"data-journal-seq":f,children:[(0,V.jsx)(gd,{className:`h-full`,children:(0,V.jsxs)(`div`,{className:`p-[34px] max-sm:p-3`,children:[(0,V.jsxs)(`section`,{"aria-label":`Whole DAG`,className:`overall-hero`,children:[(0,V.jsx)(`p`,{className:`eyebrow`,children:`Whole DAG`}),(0,V.jsx)(`h2`,{children:y}),n.graph?.plan.goal?.text&&(0,V.jsx)(`p`,{className:`run-goal`,children:n.graph.plan.goal.text}),(0,V.jsxs)(`p`,{className:`overall-state`,children:[g!==void 0&&(0,V.jsx)(zN,{large:!0,state:g}),(0,V.jsx)(`span`,{children:n.run.last_event?`last event ${n.run.last_event}`:`no events recorded yet`})]})]}),(0,V.jsxs)(`section`,{"aria-label":`Run metrics`,className:`metric-grid`,children:[(0,V.jsx)(J0,{icon:(0,V.jsx)(it,{}),label:`Nodes`,value:ce(r)}),(0,V.jsx)(J0,{icon:(0,V.jsx)(et,{}),label:`Wall time`,value:n.run.timing.wall_seconds===null?`not measured`:Te(n.run.timing.wall_seconds)}),(0,V.jsx)(J0,{icon:(0,V.jsx)(tt,{}),label:`Turns`,value:typeof n.run.turns==`number`?String(n.run.turns):ae}),(0,V.jsx)(q0,{detail:n,runLoaded:S,status:_})]}),(0,V.jsx)(Gi,{className:`gap-0 py-[15px]`,children:(0,V.jsxs)(Ki,{className:`px-[15px]`,children:[(0,V.jsxs)(`div`,{className:`section-heading`,children:[(0,V.jsx)(ze,{size:16}),(0,V.jsx)(`h3`,{children:`Graph timeline`})]}),s===void 0?x===void 0?(0,V.jsx)(`p`,{"aria-live":`polite`,className:`m-0 text-[11px] text-muted-foreground`,children:`Loading the run's timeline…`}):x.spans.length===0?(0,V.jsx)(`p`,{className:`m-0 text-[11px] text-muted-foreground`,children:`This run has recorded no timeline yet.`}):(0,V.jsx)(U0,{graph:w,history:b,runRecordsToLoad:T.some(e=>e.harness_scope===void 0&&(e.events_total===void 0||e.events_total>e.events.length)),onOpenNode:p,onOpenItem:h,selectedItemId:m}):(0,V.jsxs)(yi,{className:`live-issue`,variant:`destructive`,children:[(0,V.jsx)(e,{}),(0,V.jsx)(bi,{children:`Timeline unavailable`}),(0,V.jsxs)(xi,{children:[s.message,` `,d!==void 0&&(0,V.jsx)(Wi,{onClick:d,size:`sm`,variant:`outline`,children:`Try again`})]})]})]})}),x!==void 0&&x.spans.length>0&&(0,V.jsx)(G0,{counts:Re(D),hidden:E,listed:O,onHiddenChange:u,onOpen:h,recorded:D.length,...m===void 0?{}:{selectedItemId:m}})]})}),M!==void 0&&(0,V.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,V.jsx)(Wi,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>h(),size:`icon`,variant:`ghost`,children:(0,V.jsx)(Et,{})}),(0,V.jsx)(w1,{client:t,row:M,runId:y}),L!==void 0&&(0,V.jsx)(U$,{failure:L})]})]})}function U0({graph:e,history:t,runRecordsToLoad:n,onOpenNode:r,onOpenItem:i,selectedItemId:a}){let[o,s]=(0,B.useState)(),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(new Set),f=o??e.range,[p,m]=(0,B.useState)(!1),{loadRow:h,loadStretch:g}=t;(0,B.useEffect)(()=>{if(o===void 0)return;let e=setTimeout(()=>g(o[0],o[1],void 0),250);return()=>clearTimeout(e)},[o,g]);let _=e=>{e.kind===`record`&&e.nodeId===void 0||e.nodeId===void 0?i(e.id):r(e.nodeId)},v=f1(),y=e.line.lanes.filter(({id:t})=>e.line.items.some(e=>e.laneId===t));return(0,V.jsxs)(`div`,{className:`graph-timeline`,"data-rows-open":c,children:[(0,V.jsx)(an,{...A$,axis:{origin:e.range[0]},expanded:!1,items:e.line.items,label:`Graph timeline`,lanes:y,markers:e.line.markers,onExpandedChange:l,onHover:v,onRangeChange:e=>s(M$(e)),onSelect:e=>_(e.payload),range:f,selectedId:a}),t.failure!==void 0&&(0,V.jsx)(U$,{failure:t.failure}),n&&!p&&(0,V.jsx)(`button`,{className:`load-earlier`,onClick:()=>{m(!0),h(void 0)},type:`button`,children:`Load the run's own records`}),c&&(0,V.jsx)(`ol`,{className:`graph-rows`,children:e.rows.map(t=>(0,V.jsx)(K0,{onOpen:_,onOpenNode:r,onExpandedChange:e=>{e&&h(t.nodeId),d(n=>{let r=new Set(n);return e?r.add(t.id):r.delete(t.id),r})},expanded:u.has(t.id),origin:e.range[0],range:f,onRangeChange:e=>s(M$(e)),row:t,selectedItemId:a},t.id))})]})}var W0=()=>{};function G0({counts:e,hidden:t,listed:n,onHiddenChange:r,onOpen:i,recorded:a,selectedItemId:o}){let[s,c]=(0,B.useState)(new Set),l=(0,B.useMemo)(()=>{if(o===void 0)return s;let e=h(n,o).filter(e=>e.rowKind===`group`).map(({id:e})=>e);return e.length===0?s:new Set([...s,...e])},[n,s,o]),u=(0,B.useMemo)(()=>m(n,l),[n,l]),d=(0,B.useCallback)(e=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[]);return(0,V.jsx)(Gi,{className:`mt-4 gap-0 py-[15px]`,children:(0,V.jsx)(Ki,{className:`px-[15px]`,children:(0,V.jsxs)(`section`,{"aria-label":`Run events`,className:`run-events`,children:[(0,V.jsx)(B$,{counts:e,hidden:t,onHiddenChange:r}),a===0?(0,V.jsx)(`p`,{className:`m-0 text-[11px] text-muted-foreground`,children:`No record of the run's own is held yet.`}):n.length===0?(0,V.jsx)(V$,{onClear:()=>r([])}):(0,V.jsx)(M0,{entries:u,onOpen:i,onToggle:d,register:W0,...o===void 0?{}:{selectedItemId:o}})]})})})}function K0({row:e,range:t,origin:n,expanded:r,onExpandedChange:i,onRangeChange:a,onOpen:o,onOpenNode:s,selectedItemId:c}){let l=e.nodeId,u=f1();return(0,V.jsxs)(`li`,{className:`graph-row`,"data-row-kind":e.kind,children:[(0,V.jsxs)(`header`,{className:`graph-row-head`,children:[l===void 0?(0,V.jsx)(`span`,{className:`graph-row-name`,children:e.label}):(0,V.jsx)(`button`,{className:`graph-row-name`,onClick:()=>s(l),type:`button`,children:e.label}),(0,V.jsxs)(`span`,{className:`graph-row-facts`,children:[ye(e.workedMs),` recorded · `,ye(e.idleMs),` `,`idle`]})]}),(0,V.jsx)(an,{...A$,axis:{origin:n},expanded:r,items:r?e.items:e.line,label:`${e.label} timeline`,lanes:e.lanes,markers:e.markers,onExpandedChange:i,onHover:u,onRangeChange:a,onSelect:e=>o(e.payload),range:t,selectedId:c})]})}function q0({detail:e,status:t,runLoaded:n}){let r=t.value?.unread_surfaces,i=e.run.last_progress_at;return(0,V.jsxs)(Gi,{"aria-label":`Run details`,className:`metric run-details gap-2 p-4`,role:`group`,children:[(0,V.jsx)(`p`,{children:`Run details`}),(0,V.jsxs)(`dl`,{children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Launching session`}),(0,V.jsx)(`dd`,{children:n?we(e.launch):ae})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Unread surfaces`}),(0,V.jsxs)(`dd`,{children:[r===void 0?t.error===void 0?ae:`Unavailable`:r.oldest_seconds===null?String(r.count):`${r.count} · oldest ${Te(r.oldest_seconds)}`,t.error!==void 0&&(0,V.jsxs)(`span`,{className:`run-details-error`,role:`alert`,children:[` `,`Status unavailable: `,t.error.message]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Last progress`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`output`,{"aria-label":`Last progress`,children:n?i===void 0||i<=0?`—`:(0,V.jsx)(u,{at:new Date(i*1e3).toISOString(),relative:!0}):ae})})]})]})]})}function J0({icon:e,label:t,value:n}){return(0,V.jsxs)(Gi,{"aria-label":t,className:`metric flex-row items-center gap-3 p-4`,role:`group`,children:[e,(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{children:t}),(0,V.jsx)(`strong`,{children:n})]})]})}var Y0=[{setting:`live`,label:`Live`},{setting:10,label:`Every 10 seconds`},{setting:30,label:`Every 30 seconds`},{setting:60,label:`Every minute`},{setting:300,label:`Every 5 minutes`},{setting:`off`,label:`Off`}],X0=`live`,Z0={navigation:`dag-ui.updates.navigation`,main:`dag-ui.updates.main`};function Q0(e){return Y0.find(({setting:t})=>String(t)===e)?.setting}function $0(e){try{return window.localStorage.getItem(e)}catch{return null}}function e2(e,t){try{window.localStorage.setItem(e,String(t))}catch{}}function t2(e,t){let[n,r]=(0,B.useState)(()=>Q0($0(e))??t);return[n,(0,B.useCallback)(t=>{r(t),e2(e,t)},[e])]}function n2(){let[e,t]=t2(Z0.navigation,30),[n,r]=t2(Z0.main,X0);return{navigation:e,setNavigation:t,main:n,setMain:r}}function r2({name:e,caption:t,setting:n,waiting:r,onChange:i}){return(0,V.jsxs)(`div`,{className:`update-setting`,children:[(0,V.jsxs)(`label`,{children:[(0,V.jsx)(`span`,{children:t}),(0,V.jsx)(`select`,{"aria-label":e,onChange:e=>{let t=Q0(e.target.value);t!==void 0&&i(t)},value:String(n),children:Y0.map(({setting:e,label:t})=>(0,V.jsx)(`option`,{value:String(e),children:t},e))})]}),r>0&&(0,V.jsxs)(`output`,{"aria-label":`${e} waiting`,className:`update-waiting`,children:[r,` waiting`]})]})}var i2=new jN(window.location.origin,{fetch:window.fetch.bind(window)});function a2(e){let t=(0,B.useRef)({value:e,count:0});return t.current.value!==e&&(t.current={value:e,count:t.current.count+1}),t.current.count}var o2=()=>Promise.resolve();function s2({client:t=i2,first:n,onDrawn:r}){let i=LQ(),a=kQ(),o=i.host||a.active,s=AZ(a.active),c=n2(),l=YQ(),d=ZQ(t,{runId:i.runId,view:M(i.view,i.nodeId),nodeId:i.nodeId,selectFirst:!o,host:o,humanItems:s.view,navigationUpdates:c.navigation,mainUpdates:c.main,...n===void 0?{}:{first:n}}),f=d.rows,p=d.runId,m=d.activity.at(-1),h=d.detail,g=(0,B.useMemo)(()=>h?ee(h):[],[h]),_=KN(t,p),v=_.status.value?.liveness,y=(0,B.useMemo)(()=>h===void 0?void 0:me({state:h.run.state,...v===void 0?{}:{liveness:v},statuses:h.graph?.node_status??{}}),[h,v]),b=y$(t),[x,S]=(0,B.useState)(0),C=b.host.state.phase===`sending`,w=a2(f),{list:T,error:E}=MK(t,i.host||C,x+(C?w:0)),D=h===void 0?void 0:N(h),O=Ae(h?.progress),k=h?.progress?.failed??d.timeline?.progress?.failed,A=!o&&(h?.progress?.complete===!1||d.timeline?.progress?.complete===!1),j=!o&&h===void 0&&d.error!==void 0,P=(0,B.useRef)(!1);(0,B.useLayoutEffect)(()=>{P.current||(h!==void 0||d.error!==void 0)&&(P.current=!0,r?.())},[h,d.error,r]);let F=re(h,g,i.nodeId);(0,B.useEffect)(()=>{if(o||!f)return;let e=VQ(f),t=e.find(e=>e.rows.some(e=>e.id===i.runId)),n=t?.rows.find(e=>e.id===i.runId),r=(t?.rows??e.flatMap(e=>e.rows)).filter(e=>!e.kind||!i.hiddenKinds.includes(e.kind));(!i.runId||n?.kind&&i.hiddenKinds.includes(n.kind))&&r[0]&&i.selectRun(r[0].id)},[f,i,o]),(0,B.useEffect)(()=>{if(p&&i.runId&&i.runId!==p){let e=new URLSearchParams(window.location.search);e.set(`run`,p),e.delete(`node`),e.delete(`event`),e.set(`view`,i.view),window.history.replaceState(null,``,`${window.location.pathname}?${e}`),window.dispatchEvent(new PopStateEvent(`popstate`))}},[i.runId,p,i.view]);let I=a.active?`Action items`:i.host?`Host`:p??`No DAG selected`,L=e=>(0,V.jsxs)(`section`,{"aria-label":p&&!o?`Run header`:`Workspace header`,className:`topbar${p&&!o?` run-topbar`:``}`,children:[(0,V.jsx)(`button`,{"aria-controls":`run-navigation`,"aria-expanded":l.open,"aria-label":`Open navigation`,className:`nav-menu`,onClick:l.toggle,ref:l.menuButton,type:`button`,children:(0,V.jsx)(ct,{"aria-hidden":`true`,size:18})}),(0,V.jsx)(`div`,{className:`topbar-title`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`eyebrow`,children:`Execution telemetry`}),(0,V.jsx)(`h2`,{title:I,children:I})]})}),(0,V.jsxs)(`div`,{className:`topbar-actions`,children:[!o&&p!==void 0&&(0,V.jsx)(HN,{control:_,runId:p,ended:h!==void 0&&(h.run.state===`settled`||h.run.state.startsWith(`ended-`)),...y===void 0?{}:{state:y}}),(0,V.jsxs)(`span`,{className:`connection`,children:[(0,V.jsx)(vt,{size:15}),d.lastUpdated===void 0?`Waiting for first update`:(0,V.jsxs)(V.Fragment,{children:[`Last updated `,(0,V.jsx)(u,{at:d.lastUpdated,relative:!0})]})]}),!o&&m!==void 0&&(0,V.jsxs)(`button`,{className:`last-activity connection`,type:`button`,title:`${m.node}: ${c2(m)}`,onClick:()=>{i.selectNode(m.node),i.selectItem(m.event_id)},children:[m.node,`: `,c2(m)]})]}),e,(0,V.jsxs)(`div`,{className:`main-updates`,children:[(0,V.jsx)(r2,{caption:`Updates`,name:`Main area updates`,onChange:c.setMain,setting:c.main,waiting:d.mainWaiting}),(0,V.jsxs)(Wi,{onClick:()=>{S(e=>e+1),d.refresh(),o||_.reread()},size:`sm`,type:`button`,variant:`outline`,children:[(0,V.jsx)(ht,{size:14}),` Refresh`]})]})]}),R=(0,V.jsxs)(V.Fragment,{children:[d.error&&!j&&(0,V.jsxs)(yi,{className:`live-issue rounded-none border-x-0 border-t-0`,variant:`destructive`,children:[(0,V.jsx)(e,{}),(0,V.jsx)(bi,{children:`Live telemetry issue`}),(0,V.jsxs)(xi,{children:[d.error.message,` `,(0,V.jsx)(Wi,{onClick:d.refresh,size:`sm`,type:`button`,variant:`outline`,children:`Try again`})]})]}),k!==void 0&&(0,V.jsxs)(yi,{className:`live-issue rounded-none border-x-0 border-t-0`,variant:`destructive`,children:[(0,V.jsx)(e,{}),(0,V.jsx)(bi,{children:`The rest of this run's history did not load`}),(0,V.jsxs)(xi,{children:[k,` `,(0,V.jsx)(Wi,{onClick:d.refresh,size:`sm`,type:`button`,variant:`outline`,children:`Try again`})]})]}),d.notice&&(0,V.jsx)(`p`,{className:`live-notice`,role:`status`,children:d.notice}),(0,V.jsx)(C$,{label:`Shutdown of the entire host`,onDismiss:b.host.dismiss,rows:T?.runs??[],state:b.host.state})]});return(0,V.jsx)(bp,{children:(0,V.jsx)(m1,{children:(0,V.jsxs)(`div`,{className:`app-shell`,children:[(0,V.jsx)(JQ,{rows:d.navigationRows,failed:d.rows===void 0&&d.error!==void 0,selectedRunId:p,onSelect:e=>{i.selectRun(e),l.close()},onOpenProject:i.selectRun,onHost:()=>{i.selectHost(),l.close()},hostCurrent:i.host&&!a.active,onActionItems:()=>{a.open(),l.close()},actionItemsCurrent:a.active,hiddenKinds:i.hiddenKinds,onKindsChange:i.selectKinds,drawerOpen:l.open,drawerRef:l.drawer,updates:(0,V.jsx)(r2,{caption:`Navigation`,name:`Navigation updates`,onChange:c.setNavigation,setting:c.navigation,waiting:d.navigationWaiting})}),l.open&&(0,V.jsx)(`button`,{"aria-label":`Close navigation`,className:`nav-scrim`,onClick:l.close,type:`button`}),(0,V.jsx)(`main`,{className:`workspace`,inert:l.open,children:o?(0,V.jsxs)(V.Fragment,{children:[L(void 0),R,a.active?(0,V.jsx)(UZ,{client:t,live:d.humanItems,choice:s.choice,setChoice:s.setChoice,selectedId:s.selectedId,setSelectedId:s.setSelectedId}):(0,V.jsx)(jK,{client:t,listError:E,onRefresh:()=>S(e=>e+1),list:T,rows:d.hostRows,children:(0,V.jsx)(b$,{list:T,loadMore:o2,loadingMore:!1,shutdowns:b})})]}):(0,V.jsxs)(Af,{className:`min-h-0 flex-1 gap-0`,onValueChange:e=>e===`overall`?i.showOverall():i.selectNode(void 0),value:i.view,children:[L((0,V.jsx)(`div`,{className:`view-tabs`,children:(0,V.jsxs)(Mf,{"aria-label":`DAG views`,variant:`line`,children:[(0,V.jsxs)(Nf,{value:`graph`,children:[(0,V.jsx)(Tt,{size:15}),` Graph`]}),(0,V.jsxs)(Nf,{value:`overall`,children:[(0,V.jsx)(_t,{size:15}),` Overall`]})]})})),R,(0,V.jsx)(Pf,{className:`min-h-0`,value:i.view,children:j&&d.error?(0,V.jsx)(`div`,{className:`loading-state`,children:(0,V.jsxs)(`div`,{className:`read-failed`,role:`alert`,children:[(0,V.jsx)(`strong`,{children:`This run's history did not load`}),(0,V.jsx)(`p`,{children:d.error.message}),(0,V.jsx)(`button`,{onClick:d.refresh,type:`button`,children:`Try again`})]})}):!h&&(d.loading||p!==void 0)?(0,V.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,V.jsx)(Ad,{className:`h-2 w-48`}),(0,V.jsx)(Ad,{className:`h-2 w-32`}),`Loading execution history…`]}):h&&p?i.view===`overall`?(0,V.jsx)(H0,{client:t,detail:h,hiddenTypes:i.hiddenEventTypes,onHiddenTypesChange:i.selectEventTypes,journalSeq:D?.last_seq,nodes:g,onRetry:d.refresh,state:y,status:_.status,timeline:d.timeline,timelineError:d.timelineError,onSelectNode:i.selectNode,onSelectItem:i.selectItem,selectedItemId:i.itemId},p):F?(0,V.jsx)(O0,{client:t,hiddenTypes:i.hiddenEventTypes,onHiddenTypesChange:i.selectEventTypes,runLoaded:O,onRetry:d.refresh,node:F,nodes:g,onBack:()=>i.selectNode(void 0),onSelectItem:i.selectItem,runId:p,selectedItemId:i.itemId,selectedTab:i.nodeTab,onSelectTab:i.selectNodeTab,timeline:d.timeline,timelineError:d.timelineError},`${p}:${F.id}`):(0,V.jsx)(EK,{journalSeq:D?.last_seq,nodes:g,selectedNodeId:i.nodeId,onSelectNode:i.selectNode}):(0,V.jsxs)(`div`,{className:`empty-state`,children:[(0,V.jsx)(Tt,{size:34}),(0,V.jsx)(`h2`,{children:`No DAG runs found`}),(0,V.jsx)(`p`,{children:`Start an orchestrated run to see it appear here.`})]})})]})}),A&&k===void 0&&(0,V.jsx)(`p`,{className:`history-loading`,role:`status`,children:`The rest of this run's history is still loading`})]})})})}function c2(e){return e.description||e.kind}var l2=class extends B.Component{state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`DAG UI render failed`,e,t.componentStack)}render(){return this.state.error?(0,V.jsxs)(`main`,{className:`fatal-error`,role:`alert`,children:[(0,V.jsx)(`p`,{className:`eyebrow`,children:`Rendering error`}),(0,V.jsx)(`h1`,{children:`The DAG view could not be displayed.`}),(0,V.jsx)(`p`,{children:this.state.error.message}),(0,V.jsx)(Wi,{onClick:()=>(this.props.onReload??(()=>window.location.reload()))(),type:`button`,variant:`secondary`,children:`Reload`})]}):this.props.children}};function u2(e,t,n){let r=n===void 0?e:document.createElement(`div`);r!==e&&(r.setAttribute(`data-app-behind-first-screen`,``),r.style.cssText=`position:fixed;inset:0;visibility:hidden;`,document.body.appendChild(r));let i=()=>{r!==e&&(n?.unmount(),e.replaceWith(r),r.id=`root`,r.removeAttribute(`data-app-behind-first-screen`),r.style.cssText=``)},a={...t?.transcript===void 0?{}:{transcript:t.transcript},taken:t?.transcript===void 0};(0,$k.createRoot)(r).render((0,V.jsx)(B.StrictMode,{children:(0,V.jsx)(l2,{children:(0,V.jsx)(dN.Provider,{value:a,children:(0,V.jsx)(s2,{first:t,onDrawn:i})})})}))}export{u2 as mountApp};