@prefecthq/graphs 2.2.15 → 2.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/graphs.mjs +29 -29
- package/dist/graphs.mjs.map +1 -1
- package/dist/graphs.umd.js +2 -2
- package/dist/graphs.umd.js.map +1 -1
- package/dist/types/demo/App.vue.d.ts +1 -1
- package/dist/types/demo/components/AppComponentNavigationItems.vue.d.ts +1 -1
- package/dist/types/demo/components/AppNavigationBar.vue.d.ts +1 -1
- package/dist/types/demo/sections/WelcomePage.vue.d.ts +1 -1
- package/dist/types/demo/sections/components/RunGraphDemo.vue.d.ts +1 -1
- package/dist/types/src/components/RunGraph.vue.d.ts +1 -1
- package/dist/types/src/components/RunGraphSettings.vue.d.ts +1 -1
- package/dist/types/tailwind.config.d.ts +1 -0
- package/package.json +4 -3
package/dist/graphs.umd.js
CHANGED
|
@@ -1172,6 +1172,6 @@ void main(void)\r
|
|
|
1172
1172
|
* Subject to the terms at https://gsap.com/standard-license or for
|
|
1173
1173
|
* Club GSAP members, the agreement issued with that membership.
|
|
1174
1174
|
* @author: Jack Doyle, jack@greensock.com
|
|
1175
|
-
*/var Z0,Ur,yn,Ju,ws,V0,$u,mC=function(){return typeof window<"u"},hr={},Ts=180/Math.PI,bn=Math.PI/180,xn=Math.atan2,H0=1e8,Qu=/([A-Z])/g,gC=/(left|right|width|margin|padding|x)/i,yC=/[\s,\(]\S/,ki={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},qu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},bC=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},xC=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},_C=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},K0=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Y0=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},vC=function(t,e,i){return t.style[e]=i},wC=function(t,e,i){return t.style.setProperty(e,i)},TC=function(t,e,i){return t._gsap[e]=i},SC=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},EC=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},CC=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Ht="transform",Pe=Ht+"Origin",IC=function r(t,e){var i=this,s=this.target,n=s.style,o=s._gsap;if(t in hr&&n){if(this.tfm=this.tfm||{},t!=="transform")t=ki[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return i.tfm[a]=lr(s,a)}):this.tfm[t]=o.x?o[t]:lr(s,t),t===Pe&&(this.tfm.zOrigin=o.zOrigin);else return ki.transform.split(",").forEach(function(a){return r.call(i,a,e)});if(this.props.indexOf(Ht)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Pe,e,"")),t=Ht}(n||e)&&this.props.push(t,e,n[t])},z0=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},AC=function(){var t=this.props,e=this.target,i=e.style,s=e._gsap,n,o;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?i[t[n]]=t[n+2]:i.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(Qu,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)s[o]=this.tfm[o];s.svg&&(s.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=$u(),(!n||!n.isStart)&&!i[Ht]&&(z0(i),s.zOrigin&&i[Pe]&&(i[Pe]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},j0=function(t,e){var i={target:t,props:[],revert:AC,save:IC};return t._gsap||Re.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},J0,td=function(t,e){var i=Ur.createElementNS?Ur.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Ur.createElement(t);return i&&i.style?i:Ur.createElement(t)},Di=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Qu,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,_n(e)||e,1)||""},$0="O,Moz,ms,Ms,Webkit".split(","),_n=function(t,e,i){var s=e||ws,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!($0[o]+t in n););return o<0?null:(o===3?"ms":o>=0?$0[o]:"")+t},ed=function(){mC()&&window.document&&(Z0=window,Ur=Z0.document,yn=Ur.documentElement,ws=td("div")||{style:{}},td("div"),Ht=_n(Ht),Pe=Ht+"Origin",ws.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",J0=!!_n("perspective"),$u=Re.core.reverting,Ju=1)},id=function r(t){var e=td("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,s=this.nextSibling,n=this.style.cssText,o;if(yn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(s?i.insertBefore(this,s):i.appendChild(this)),yn.removeChild(e),this.style.cssText=n,o},Q0=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},q0=function(t){var e;try{e=t.getBBox()}catch{e=id.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===id||(e=id.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+Q0(t,["x","cx","x1"])||0,y:+Q0(t,["y","cy","y1"])||0,width:0,height:0}:e},ty=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&q0(t))},Ss=function(t,e){if(e){var i=t.style,s;e in hr&&e!==Pe&&(e=Ht),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(Qu,"-$1").toLowerCase())):i.removeAttribute(e)}},Xr=function(t,e,i,s,n,o){var a=new Me(t._pt,e,i,0,1,o?Y0:K0);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},ey={deg:1,rad:1,turn:1},MC={grid:1,flex:1},Wr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=ws.style,h=gC.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(h?"Width":"Height"),u=100,d=s==="px",f=s==="%",p,m,g,y;if(s===o||!n||ey[s]||ey[o])return n;if(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&ty(t),(f||o==="%")&&(hr[e]||~e.indexOf("adius")))return p=y?t.getBBox()[h?"width":"height"]:t[c],jt(f?n/p*u:n/100*p);if(a[h?"width":"height"]=u+(d?o:s),m=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Ur||!m.appendChild)&&(m=Ur.body),g=m._gsap,g&&f&&g.width&&h&&g.time===We.time&&!g.uncache)return jt(n/g.width*u);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=u+s,p=t[c],x?t.style[e]=x:Ss(t,e)}else(f||o==="%")&&!MC[Di(m,"display")]&&(a.position=Di(t,"position")),m===t&&(a.position="static"),m.appendChild(ws),p=ws[c],m.removeChild(ws),a.position="absolute";return h&&f&&(g=gs(m),g.time=We.time,g.width=m[c]),jt(d?p*n/u:p&&n?u/p*n:0)},lr=function(t,e,i,s){var n;return Ju||ed(),e in ki&&e!=="transform"&&(e=ki[e],~e.indexOf(",")&&(e=e.split(",")[0])),hr[e]&&e!=="transform"?(n=So(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:Ch(Di(t,Pe))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=Eh[e]&&Eh[e](t,e,i)||Di(t,e)||n0(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?Wr(t,e,n,i)+i:n},RC=function(t,e,i,s){if(!i||i==="none"){var n=_n(e,t,1),o=n&&Di(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=Di(t,"borderTopColor"))}var a=new Me(this._pt,t.style,e,0,1,B0),h=0,l=0,c,u,d,f,p,m,g,y,x,b,v,w;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(m=t.style[e],t.style[e]=s,s=Di(t,e)||s,m?t.style[e]=m:Ss(t,e)),c=[i,s],M0(c),i=c[0],s=c[1],d=i.match(un)||[],w=s.match(un)||[],w.length){for(;u=un.exec(s);)g=u[0],x=s.substring(h,u.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),g!==(m=d[l++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),g.charAt(1)==="="&&(g=dn(f,g)+v),y=parseFloat(g),b=g.substr((y+"").length),h=un.lastIndex-b.length,b||(b=b||Oe.units[e]||v,h===s.length&&(s+=b,a.e+=b)),v!==b&&(f=Wr(t,e,m,b)||0),a._pt={_next:a._pt,p:x||l===1?x:",",s:f,c:y-f,m:p&&p<4||e==="zIndex"?Math.round:0});a.c=h<s.length?s.substring(h,s.length):""}else a.r=e==="display"&&s==="none"?Y0:K0;return Qg.test(s)&&(a.e=0),this._pt=a,a},iy={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},PC=function(t){var e=t.split(" "),i=e[0],s=e[1]||"50%";return(i==="top"||i==="bottom"||s==="left"||s==="right")&&(t=i,i=s,s=t),e[0]=iy[i]||i,e[1]=iy[s]||s,e.join(" ")},LC=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,s=i.style,n=e.u,o=i._gsap,a,h,l;if(n==="all"||n===!0)s.cssText="",h=1;else for(n=n.split(","),l=n.length;--l>-1;)a=n[l],hr[a]&&(h=1,a=a==="transformOrigin"?Pe:Ht),Ss(i,a);h&&(Ss(i,Ht),o&&(o.svg&&i.removeAttribute("transform"),So(i,1),o.uncache=1,z0(s)))}},Eh={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new Me(t._pt,e,i,0,0,LC);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},To=[1,0,0,1,0,0],ry={},sy=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},ny=function(t){var e=Di(t,Ht);return sy(e)?To:e.substr(7).match($g).map(jt)},rd=function(t,e){var i=t._gsap||gs(t),s=t.style,n=ny(t),o,a,h,l;return i.svg&&t.getAttribute("transform")?(h=t.transform.baseVal.consolidate().matrix,n=[h.a,h.b,h.c,h.d,h.e,h.f],n.join(",")==="1,0,0,1,0,0"?To:n):(n===To&&!t.offsetParent&&t!==yn&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,yn.appendChild(t)),n=ny(t),h?s.display=h:Ss(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):yn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},sd=function(t,e,i,s,n,o){var a=t._gsap,h=n||rd(t,!0),l=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,d=a.yOffset||0,f=h[0],p=h[1],m=h[2],g=h[3],y=h[4],x=h[5],b=e.split(" "),v=parseFloat(b[0])||0,w=parseFloat(b[1])||0,S,C,I,M;i?h!==To&&(C=f*g-p*m)&&(I=v*(g/C)+w*(-m/C)+(m*x-g*y)/C,M=v*(-p/C)+w*(f/C)-(f*x-p*y)/C,v=I,w=M):(S=q0(t),v=S.x+(~b[0].indexOf("%")?v/100*S.width:v),w=S.y+(~(b[1]||b[0]).indexOf("%")?w/100*S.height:w)),s||s!==!1&&a.smooth?(y=v-l,x=w-c,a.xOffset=u+(y*f+x*m)-y,a.yOffset=d+(y*p+x*g)-x):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=w,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Pe]="0px 0px",o&&(Xr(o,a,"xOrigin",l,v),Xr(o,a,"yOrigin",c,w),Xr(o,a,"xOffset",u,a.xOffset),Xr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+w)},So=function(t,e){var i=t._gsap||new G0(t);if("x"in i&&!e&&!i.uncache)return i;var s=t.style,n=i.scaleX<0,o="px",a="deg",h=getComputedStyle(t),l=Di(t,Pe)||"0",c,u,d,f,p,m,g,y,x,b,v,w,S,C,I,M,L,G,N,A,D,Z,K,H,j,B,k,F,V,et,ft,at;return c=u=d=m=g=y=x=b=v=0,f=p=1,i.svg=!!(t.getCTM&&ty(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Ht]=(h.translate!=="none"?"translate3d("+(h.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(h.rotate!=="none"?"rotate("+h.rotate+") ":"")+(h.scale!=="none"?"scale("+h.scale.split(" ").join(",")+") ":"")+(h[Ht]!=="none"?h[Ht]:"")),s.scale=s.rotate=s.translate="none"),C=rd(t,i.svg),i.svg&&(i.uncache?(j=t.getBBox(),l=i.xOrigin-j.x+"px "+(i.yOrigin-j.y)+"px",H=""):H=!e&&t.getAttribute("data-svg-origin"),sd(t,H||l,!!H||i.originIsAbsolute,i.smooth!==!1,C)),w=i.xOrigin||0,S=i.yOrigin||0,C!==To&&(G=C[0],N=C[1],A=C[2],D=C[3],c=Z=C[4],u=K=C[5],C.length===6?(f=Math.sqrt(G*G+N*N),p=Math.sqrt(D*D+A*A),m=G||N?xn(N,G)*Ts:0,x=A||D?xn(A,D)*Ts+m:0,x&&(p*=Math.abs(Math.cos(x*bn))),i.svg&&(c-=w-(w*G+S*A),u-=S-(w*N+S*D))):(at=C[6],et=C[7],k=C[8],F=C[9],V=C[10],ft=C[11],c=C[12],u=C[13],d=C[14],I=xn(at,V),g=I*Ts,I&&(M=Math.cos(-I),L=Math.sin(-I),H=Z*M+k*L,j=K*M+F*L,B=at*M+V*L,k=Z*-L+k*M,F=K*-L+F*M,V=at*-L+V*M,ft=et*-L+ft*M,Z=H,K=j,at=B),I=xn(-A,V),y=I*Ts,I&&(M=Math.cos(-I),L=Math.sin(-I),H=G*M-k*L,j=N*M-F*L,B=A*M-V*L,ft=D*L+ft*M,G=H,N=j,A=B),I=xn(N,G),m=I*Ts,I&&(M=Math.cos(I),L=Math.sin(I),H=G*M+N*L,j=Z*M+K*L,N=N*M-G*L,K=K*M-Z*L,G=H,Z=j),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,y=180-y),f=jt(Math.sqrt(G*G+N*N+A*A)),p=jt(Math.sqrt(K*K+at*at)),I=xn(Z,K),x=Math.abs(I)>2e-4?I*Ts:0,v=ft?1/(ft<0?-ft:ft):0),i.svg&&(H=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!sy(Di(t,Ht)),H&&t.setAttribute("transform",H))),Math.abs(x)>90&&Math.abs(x)<270&&(n?(f*=-1,x+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,x+=x<=0?180:-180)),e=e||i.uncache,i.x=c-((i.xPercent=c&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-c)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+o,i.y=u-((i.yPercent=u&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-u)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=jt(f),i.scaleY=jt(p),i.rotation=jt(m)+a,i.rotationX=jt(g)+a,i.rotationY=jt(y)+a,i.skewX=x+a,i.skewY=b+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[Pe]=Ch(l)),i.xOffset=i.yOffset=0,i.force3D=Oe.force3D,i.renderTransform=i.svg?FC:J0?oy:GC,i.uncache=0,i},Ch=function(t){return(t=t.split(" "))[0]+" "+t[1]},nd=function(t,e,i){var s=be(e);return jt(parseFloat(e)+parseFloat(Wr(t,"x",i+"px",s)))+s},GC=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,oy(t,e)},Es="0deg",Eo="0px",Cs=") ",oy=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.z,l=i.rotation,c=i.rotationY,u=i.rotationX,d=i.skewX,f=i.skewY,p=i.scaleX,m=i.scaleY,g=i.transformPerspective,y=i.force3D,x=i.target,b=i.zOrigin,v="",w=y==="auto"&&t&&t!==1||y===!0;if(b&&(u!==Es||c!==Es)){var S=parseFloat(c)*bn,C=Math.sin(S),I=Math.cos(S),M;S=parseFloat(u)*bn,M=Math.cos(S),o=nd(x,o,C*M*-b),a=nd(x,a,-Math.sin(S)*-b),h=nd(x,h,I*M*-b+b)}g!==Eo&&(v+="perspective("+g+Cs),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(w||o!==Eo||a!==Eo||h!==Eo)&&(v+=h!==Eo||w?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+Cs),l!==Es&&(v+="rotate("+l+Cs),c!==Es&&(v+="rotateY("+c+Cs),u!==Es&&(v+="rotateX("+u+Cs),(d!==Es||f!==Es)&&(v+="skew("+d+", "+f+Cs),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Cs),x.style[Ht]=v||"translate(0, 0)"},FC=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.rotation,l=i.skewX,c=i.skewY,u=i.scaleX,d=i.scaleY,f=i.target,p=i.xOrigin,m=i.yOrigin,g=i.xOffset,y=i.yOffset,x=i.forceCSS,b=parseFloat(o),v=parseFloat(a),w,S,C,I,M;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=bn,l*=bn,w=Math.cos(h)*u,S=Math.sin(h)*u,C=Math.sin(h-l)*-d,I=Math.cos(h-l)*d,l&&(c*=bn,M=Math.tan(l-c),M=Math.sqrt(1+M*M),C*=M,I*=M,c&&(M=Math.tan(c),M=Math.sqrt(1+M*M),w*=M,S*=M)),w=jt(w),S=jt(S),C=jt(C),I=jt(I)):(w=u,I=d,S=C=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=Wr(f,"x",o,"px"),v=Wr(f,"y",a,"px")),(p||m||g||y)&&(b=jt(b+p-(p*w+m*C)+g),v=jt(v+m-(p*S+m*I)+y)),(s||n)&&(M=f.getBBox(),b=jt(b+s/100*M.width),v=jt(v+n/100*M.height)),M="matrix("+w+","+S+","+C+","+I+","+b+","+v+")",f.setAttribute("transform",M),x&&(f.style[Ht]=M)},NC=function(t,e,i,s,n){var o=360,a=le(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?Ts:1),l=h-s,c=s+l+"deg",u,d;return a&&(u=n.split("_")[1],u==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),u==="cw"&&l<0?l=(l+o*H0)%o-~~(l/o)*o:u==="ccw"&&l>0&&(l=(l-o*H0)%o-~~(l/o)*o)),t._pt=d=new Me(t._pt,e,i,s,l,bC),d.e=c,d.u="deg",t._props.push(i),d},ay=function(t,e){for(var i in e)t[i]=e[i];return t},kC=function(t,e,i){var s=ay({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,c,u,d,f,p;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Ht]=e,a=So(i,1),Ss(i,Ht),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Ht],o[Ht]=e,a=So(i,1),o[Ht]=l);for(h in hr)l=s[h],c=a[h],l!==c&&n.indexOf(h)<0&&(f=be(l),p=be(c),u=f!==p?Wr(i,h,l,p):parseFloat(l),d=parseFloat(c),t._pt=new Me(t._pt,a,h,u,d-u,qu),t._pt.u=p||0,t._props.push(h));ay(a,s)};Ae("padding,margin,Width,Radius",function(r,t){var e="Top",i="Right",s="Bottom",n="Left",o=(t<3?[e,i,s,n]:[e+n,e+i,s+i,s+n]).map(function(a){return t<2?r+a:"border"+a+r});Eh[t>1?"border"+r:r]=function(a,h,l,c,u){var d,f;if(arguments.length<4)return d=o.map(function(p){return lr(a,p,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(c+"").split(" "),f={},o.forEach(function(p,m){return f[p]=d[m]=d[m]||d[(m-1)/2|0]}),a.init(h,f,u)}});var hy={name:"css",register:ed,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,s,n){var o=this._props,a=t.style,h=i.vars.startAt,l,c,u,d,f,p,m,g,y,x,b,v,w,S,C,I;Ju||ed(),this.styles=this.styles||j0(t),I=this.styles.props,this.tween=i;for(m in e)if(m!=="autoRound"&&(c=e[m],!(Ue[m]&&F0(m,e,i,s,t,n)))){if(f=typeof c,p=Eh[m],f==="function"&&(c=c.call(i,s,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=yo(c)),p)p(this,t,m,c,i)&&(C=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),c+="",Or.lastIndex=0,Or.test(l)||(g=be(l),y=be(c)),y?g!==y&&(l=Wr(t,m,l,y)+y):g&&(c+=g),this.add(a,"setProperty",l,c,s,n,0,0,m),o.push(m),I.push(m,0,a[m]);else if(f!=="undefined"){if(h&&m in h?(l=typeof h[m]=="function"?h[m].call(i,s,t,n):h[m],le(l)&&~l.indexOf("random(")&&(l=yo(l)),be(l+"")||l==="auto"||(l+=Oe.units[m]||be(lr(t,m))||""),(l+"").charAt(1)==="="&&(l=lr(t,m))):l=lr(t,m),d=parseFloat(l),x=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),x&&(c=c.substr(2)),u=parseFloat(c),m in ki&&(m==="autoAlpha"&&(d===1&&lr(t,"visibility")==="hidden"&&u&&(d=0),I.push("visibility",0,a.visibility),Xr(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),m!=="scale"&&m!=="transform"&&(m=ki[m],~m.indexOf(",")&&(m=m.split(",")[0]))),b=m in hr,b){if(this.styles.save(m),v||(w=t._gsap,w.renderTransform&&!e.parseTransform||So(t,e.parseTransform),S=e.smoothOrigin!==!1&&w.smooth,v=this._pt=new Me(this._pt,a,Ht,0,1,w.renderTransform,w,0,-1),v.dep=1),m==="scale")this._pt=new Me(this._pt,w,"scaleY",w.scaleY,(x?dn(w.scaleY,x+u):u)-w.scaleY||0,qu),this._pt.u=0,o.push("scaleY",m),m+="X";else if(m==="transformOrigin"){I.push(Pe,0,a[Pe]),c=PC(c),w.svg?sd(t,c,0,S,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==w.zOrigin&&Xr(this,w,"zOrigin",w.zOrigin,y),Xr(this,a,m,Ch(l),Ch(c)));continue}else if(m==="svgOrigin"){sd(t,c,1,S,0,this);continue}else if(m in ry){NC(this,w,m,d,x?dn(d,x+c):c);continue}else if(m==="smoothOrigin"){Xr(this,w,"smooth",w.smooth,c);continue}else if(m==="force3D"){w[m]=c;continue}else if(m==="transform"){kC(this,c,t);continue}}else m in a||(m=_n(m)||m);if(b||(u||u===0)&&(d||d===0)&&!yC.test(c)&&m in a)g=(l+"").substr((d+"").length),u||(u=0),y=be(c)||(m in Oe.units?Oe.units[m]:g),g!==y&&(d=Wr(t,m,l,y)),this._pt=new Me(this._pt,b?w:a,m,d,(x?dn(d,x+u):u)-d,!b&&(y==="px"||m==="zIndex")&&e.autoRound!==!1?_C:qu),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=xC);else if(m in a)RC.call(this,t,m,l,x?x+c:c);else if(m in t)this.add(t,m,l||t[m],x?x+c:c,s,n);else if(m!=="parseTransform"){Iu(m,c);continue}b||(m in a?I.push(m,0,a[m]):I.push(m,1,l||t[m])),o.push(m)}}C&&U0(this)},render:function(t,e){if(e.tween._time||!$u())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:lr,aliases:ki,getSetter:function(t,e,i){var s=ki[e];return s&&s.indexOf(",")<0&&(e=s),e in hr&&e!==Pe&&(t._gsap.x||lr(t,"x"))?i&&V0===i?e==="scale"?SC:TC:(V0=i||{})&&(e==="scale"?EC:CC):t.style&&!vu(t.style[e])?vC:~e.indexOf("-")?wC:Hu(t,e)},core:{_removeProperty:Ss,_getMatrix:rd}};Re.utils.checkPrefix=_n,Re.core.getStyleSaver=j0,function(r,t,e,i){var s=Ae(r+","+t+","+e,function(n){hr[n]=1});Ae(t,function(n){Oe.units[n]="deg",ry[n]=1}),ki[s[13]]=r+","+t,Ae(i,function(n){var o=n.split(":");ki[o[1]]=s[o[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Ae("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Oe.units[r]="px"}),Re.registerPlugin(hy);var ly=Re.registerPlugin(hy)||Re;ly.core.Tween;const Is=new gt;class DC{constructor(t={}){this._recursive=typeof t.recursive=="boolean"?t.recursive:!0,this._toggle=t.toggle||"visible",this._targetList=new Set}add(t){return this._targetList.add(t),this}addAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.add(t[e]);return this}remove(t){return this._targetList.delete(t),this}removeAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.delete(t[e]);return this}clear(){return this._targetList.clear(),this}cull(t,e=!1){return e||this.uncull(),this._targetList.forEach(i=>{e||i.getBounds(!1,Is),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=Is.right>t.left&&Is.left<t.right&&Is.bottom>t.top&&Is.top<t.bottom)}),this}uncull(){return this._targetList.forEach(t=>{this._recursive?this.uncullRecursive(t):t[this._toggle]=!1}),this}cullRecursive(t,e,i){const s=i?e._bounds.getRectangle(Is):e.getBounds(!0,Is);if(e[this._toggle]=s.right>t.left&&s.left<t.right&&s.bottom>t.top&&s.top<t.bottom,!(s.left>=t.left&&s.top>=t.top&&s.right<=t.right&&s.bottom<=t.bottom)&&e[this._toggle]&&e.children&&e.children.length){const o=e.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(t,o[a])}}uncullRecursive(t){if(t[this._toggle]=!0,t.children&&t.children.length){const e=t.children;for(let i=0,s=e.length;i<s;i++)this.uncullRecursive(e[i])}}}var Ih={exports:{}};Ih.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=1,n=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",p="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Null]",x="[object Object]",b="[object Promise]",v="[object Proxy]",w="[object RegExp]",S="[object Set]",C="[object String]",I="[object Symbol]",M="[object Undefined]",L="[object WeakMap]",G="[object ArrayBuffer]",N="[object DataView]",A="[object Float32Array]",D="[object Float64Array]",Z="[object Int8Array]",K="[object Int16Array]",H="[object Int32Array]",j="[object Uint8Array]",B="[object Uint8ClampedArray]",k="[object Uint16Array]",F="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,et=/^\[object .+?Constructor\]$/,ft=/^(?:0|[1-9]\d*)$/,at={};at[A]=at[D]=at[Z]=at[K]=at[H]=at[j]=at[B]=at[k]=at[F]=!0,at[a]=at[h]=at[G]=at[c]=at[N]=at[u]=at[d]=at[f]=at[m]=at[g]=at[x]=at[w]=at[S]=at[C]=at[L]=!1;var Tt=typeof ve=="object"&&ve&&ve.Object===Object&&ve,It=typeof self=="object"&&self&&self.Object===Object&&self,Q=Tt||It||Function("return this")(),W=t&&!t.nodeType&&t,J=W&&!0&&r&&!r.nodeType&&r,$=J&&J.exports===W,O=$&&Tt.process,pt=function(){try{return O&&O.binding&&O.binding("util")}catch{}}(),yt=pt&&pt.isTypedArray;function Rt(T,R){for(var _=-1,E=T==null?0:T.length,P=0,X=[];++_<E;){var ut=T[_];R(ut,_,T)&&(X[P++]=ut)}return X}function Ot(T,R){for(var _=-1,E=R.length,P=T.length;++_<E;)T[P+_]=R[_];return T}function Fe(T,R){for(var _=-1,E=T==null?0:T.length;++_<E;)if(R(T[_],_,T))return!0;return!1}function Ze(T,R){for(var _=-1,E=Array(T);++_<T;)E[_]=R(_);return E}function Wo(T){return function(R){return T(R)}}function Kr(T,R){return T.has(R)}function Pn(T,R){return T==null?void 0:T[R]}function Ln(T){var R=-1,_=Array(T.size);return T.forEach(function(E,P){_[++R]=[P,E]}),_}function gi(T,R){return function(_){return T(R(_))}}function tl(T){var R=-1,_=Array(T.size);return T.forEach(function(E){_[++R]=E}),_}var el=Array.prototype,Xd=Function.prototype,Gn=Object.prototype,Yr=Q["__core-js_shared__"],Zo=Xd.toString,Ve=Gn.hasOwnProperty,Vo=function(){var T=/[^.]+$/.exec(Yr&&Yr.keys&&Yr.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Ho=Gn.toString,il=RegExp("^"+Zo.call(Ve).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rl=$?Q.Buffer:void 0,Fn=Q.Symbol,Zi=Q.Uint8Array,Fs=Gn.propertyIsEnumerable,Wd=el.splice,Vi=Fn?Fn.toStringTag:void 0,sl=Object.getOwnPropertySymbols,nl=rl?rl.isBuffer:void 0,Ns=gi(Object.keys,Object),Ko=xr(Q,"DataView"),He=xr(Q,"Map"),Yo=xr(Q,"Promise"),zo=xr(Q,"Set"),jo=xr(Q,"WeakMap"),ks=xr(Object,"create"),Zd=bi(Ko),yi=bi(He),Vd=bi(Yo),Hd=bi(zo),Kd=bi(jo),ol=Fn?Fn.prototype:void 0,Jo=ol?ol.valueOf:void 0;function Ne(T){var R=-1,_=T==null?0:T.length;for(this.clear();++R<_;){var E=T[R];this.set(E[0],E[1])}}function Yd(){this.__data__=ks?ks(null):{},this.size=0}function zd(T){var R=this.has(T)&&delete this.__data__[T];return this.size-=R?1:0,R}function jd(T){var R=this.__data__;if(ks){var _=R[T];return _===i?void 0:_}return Ve.call(R,T)?R[T]:void 0}function Jd(T){var R=this.__data__;return ks?R[T]!==void 0:Ve.call(R,T)}function $d(T,R){var _=this.__data__;return this.size+=this.has(T)?0:1,_[T]=ks&&R===void 0?i:R,this}Ne.prototype.clear=Yd,Ne.prototype.delete=zd,Ne.prototype.get=jd,Ne.prototype.has=Jd,Ne.prototype.set=$d;function xe(T){var R=-1,_=T==null?0:T.length;for(this.clear();++R<_;){var E=T[R];this.set(E[0],E[1])}}function Qd(){this.__data__=[],this.size=0}function qd(T){var R=this.__data__,_=kn(R,T);if(_<0)return!1;var E=R.length-1;return _==E?R.pop():Wd.call(R,_,1),--this.size,!0}function tf(T){var R=this.__data__,_=kn(R,T);return _<0?void 0:R[_][1]}function ef(T){return kn(this.__data__,T)>-1}function rf(T,R){var _=this.__data__,E=kn(_,T);return E<0?(++this.size,_.push([T,R])):_[E][1]=R,this}xe.prototype.clear=Qd,xe.prototype.delete=qd,xe.prototype.get=tf,xe.prototype.has=ef,xe.prototype.set=rf;function yr(T){var R=-1,_=T==null?0:T.length;for(this.clear();++R<_;){var E=T[R];this.set(E[0],E[1])}}function $o(){this.size=0,this.__data__={hash:new Ne,map:new(He||xe),string:new Ne}}function sf(T){var R=On(this,T).delete(T);return this.size-=R?1:0,R}function Nn(T){return On(this,T).get(T)}function Qo(T){return On(this,T).has(T)}function nf(T,R){var _=On(this,T),E=_.size;return _.set(T,R),this.size+=_.size==E?0:1,this}yr.prototype.clear=$o,yr.prototype.delete=sf,yr.prototype.get=Nn,yr.prototype.has=Qo,yr.prototype.set=nf;function br(T){var R=-1,_=T==null?0:T.length;for(this.__data__=new yr;++R<_;)this.add(T[R])}function al(T){return this.__data__.set(T,i),this}function of(T){return this.__data__.has(T)}br.prototype.add=br.prototype.push=al,br.prototype.has=of;function Hi(T){var R=this.__data__=new xe(T);this.size=R.size}function af(){this.__data__=new xe,this.size=0}function hl(T){var R=this.__data__,_=R.delete(T);return this.size=R.size,_}function hf(T){return this.__data__.get(T)}function lf(T){return this.__data__.has(T)}function cf(T,R){var _=this.__data__;if(_ instanceof xe){var E=_.__data__;if(!He||E.length<e-1)return E.push([T,R]),this.size=++_.size,this;_=this.__data__=new yr(E)}return _.set(T,R),this.size=_.size,this}Hi.prototype.clear=af,Hi.prototype.delete=hl,Hi.prototype.get=hf,Hi.prototype.has=lf,Hi.prototype.set=cf;function uf(T,R){var _=Xn(T),E=!_&&ea(T),P=!_&&!E&&Os(T),X=!_&&!E&&!P&&yl(T),ut=_||E||P||X,bt=ut?Ze(T.length,String):[],_t=bt.length;for(var lt in T)(R||Ve.call(T,lt))&&!(ut&&(lt=="length"||P&&(lt=="offset"||lt=="parent")||X&&(lt=="buffer"||lt=="byteLength"||lt=="byteOffset")||ta(lt,_t)))&&bt.push(lt);return bt}function kn(T,R){for(var _=T.length;_--;)if(Un(T[_][0],R))return _;return-1}function df(T,R,_){var E=R(T);return Xn(T)?E:Ot(E,_(T))}function Ds(T){return T==null?T===void 0?M:y:Vi&&Vi in Object(T)?gf(T):Bn(T)}function ll(T){return jr(T)&&Ds(T)==a}function cl(T,R,_,E,P){return T===R?!0:T==null||R==null||!jr(T)&&!jr(R)?T!==T&&R!==R:ff(T,R,_,E,cl,P)}function ff(T,R,_,E,P,X){var ut=Xn(T),bt=Xn(R),_t=ut?h:Ki(T),lt=bt?h:Ki(R);_t=_t==a?x:_t,lt=lt==a?x:lt;var vt=_t==x,Ut=lt==x,Pt=_t==lt;if(Pt&&Os(T)){if(!Os(R))return!1;ut=!0,vt=!1}if(Pt&&!vt)return X||(X=new Hi),ut||yl(T)?ul(T,R,_,E,P,X):dl(T,R,_t,_,E,P,X);if(!(_&s)){var de=vt&&Ve.call(T,"__wrapped__"),_e=Ut&&Ve.call(R,"__wrapped__");if(de||_e){var si=de?T.value():T,ni=_e?R.value():R;return X||(X=new Hi),P(si,ni,_,E,X)}}return Pt?(X||(X=new Hi),mf(T,R,_,E,P,X)):!1}function Dn(T){if(!gl(T)||xf(T))return!1;var R=Yi(T)?il:et;return R.test(bi(T))}function qo(T){return jr(T)&&zr(T.length)&&!!at[Ds(T)]}function pf(T){if(!_f(T))return Ns(T);var R=[];for(var _ in Object(T))Ve.call(T,_)&&_!="constructor"&&R.push(_);return R}function ul(T,R,_,E,P,X){var ut=_&s,bt=T.length,_t=R.length;if(bt!=_t&&!(ut&&_t>bt))return!1;var lt=X.get(T);if(lt&&X.get(R))return lt==R;var vt=-1,Ut=!0,Pt=_&n?new br:void 0;for(X.set(T,R),X.set(R,T);++vt<bt;){var de=T[vt],_e=R[vt];if(E)var si=ut?E(_e,de,vt,R,T,X):E(de,_e,vt,T,R,X);if(si!==void 0){if(si)continue;Ut=!1;break}if(Pt){if(!Fe(R,function(ni,Bs){if(!Kr(Pt,Bs)&&(de===ni||P(de,ni,_,E,X)))return Pt.push(Bs)})){Ut=!1;break}}else if(!(de===_e||P(de,_e,_,E,X))){Ut=!1;break}}return X.delete(T),X.delete(R),Ut}function dl(T,R,_,E,P,X,ut){switch(_){case N:if(T.byteLength!=R.byteLength||T.byteOffset!=R.byteOffset)return!1;T=T.buffer,R=R.buffer;case G:return!(T.byteLength!=R.byteLength||!X(new Zi(T),new Zi(R)));case c:case u:case g:return Un(+T,+R);case d:return T.name==R.name&&T.message==R.message;case w:case C:return T==R+"";case m:var bt=Ln;case S:var _t=E&s;if(bt||(bt=tl),T.size!=R.size&&!_t)return!1;var lt=ut.get(T);if(lt)return lt==R;E|=n,ut.set(T,R);var vt=ul(bt(T),bt(R),E,P,X,ut);return ut.delete(T),vt;case I:if(Jo)return Jo.call(T)==Jo.call(R)}return!1}function mf(T,R,_,E,P,X){var ut=_&s,bt=fl(T),_t=bt.length,lt=fl(R),vt=lt.length;if(_t!=vt&&!ut)return!1;for(var Ut=_t;Ut--;){var Pt=bt[Ut];if(!(ut?Pt in R:Ve.call(R,Pt)))return!1}var de=X.get(T);if(de&&X.get(R))return de==R;var _e=!0;X.set(T,R),X.set(R,T);for(var si=ut;++Ut<_t;){Pt=bt[Ut];var ni=T[Pt],Bs=R[Pt];if(E)var $b=ut?E(Bs,ni,Pt,R,T,X):E(ni,Bs,Pt,T,R,X);if(!($b===void 0?ni===Bs||P(ni,Bs,_,E,X):$b)){_e=!1;break}si||(si=Pt=="constructor")}if(_e&&!si){var xl=T.constructor,_l=R.constructor;xl!=_l&&"constructor"in T&&"constructor"in R&&!(typeof xl=="function"&&xl instanceof xl&&typeof _l=="function"&&_l instanceof _l)&&(_e=!1)}return X.delete(T),X.delete(R),_e}function fl(T){return df(T,bl,yf)}function On(T,R){var _=T.__data__;return bf(R)?_[typeof R=="string"?"string":"hash"]:_.map}function xr(T,R){var _=Pn(T,R);return Dn(_)?_:void 0}function gf(T){var R=Ve.call(T,Vi),_=T[Vi];try{T[Vi]=void 0;var E=!0}catch{}var P=Ho.call(T);return E&&(R?T[Vi]=_:delete T[Vi]),P}var yf=sl?function(T){return T==null?[]:(T=Object(T),Rt(sl(T),function(R){return Fs.call(T,R)}))}:vf,Ki=Ds;(Ko&&Ki(new Ko(new ArrayBuffer(1)))!=N||He&&Ki(new He)!=m||Yo&&Ki(Yo.resolve())!=b||zo&&Ki(new zo)!=S||jo&&Ki(new jo)!=L)&&(Ki=function(T){var R=Ds(T),_=R==x?T.constructor:void 0,E=_?bi(_):"";if(E)switch(E){case Zd:return N;case yi:return m;case Vd:return b;case Hd:return S;case Kd:return L}return R});function ta(T,R){return R=R??o,!!R&&(typeof T=="number"||ft.test(T))&&T>-1&&T%1==0&&T<R}function bf(T){var R=typeof T;return R=="string"||R=="number"||R=="symbol"||R=="boolean"?T!=="__proto__":T===null}function xf(T){return!!Vo&&Vo in T}function _f(T){var R=T&&T.constructor,_=typeof R=="function"&&R.prototype||Gn;return T===_}function Bn(T){return Ho.call(T)}function bi(T){if(T!=null){try{return Zo.call(T)}catch{}try{return T+""}catch{}}return""}function Un(T,R){return T===R||T!==T&&R!==R}var ea=ll(function(){return arguments}())?ll:function(T){return jr(T)&&Ve.call(T,"callee")&&!Fs.call(T,"callee")},Xn=Array.isArray;function pl(T){return T!=null&&zr(T.length)&&!Yi(T)}var Os=nl||wf;function ml(T,R){return cl(T,R)}function Yi(T){if(!gl(T))return!1;var R=Ds(T);return R==f||R==p||R==l||R==v}function zr(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function gl(T){var R=typeof T;return T!=null&&(R=="object"||R=="function")}function jr(T){return T!=null&&typeof T=="object"}var yl=yt?Wo(yt):qo;function bl(T){return pl(T)?uf(T):pf(T)}function vf(){return[]}function wf(){return!1}r.exports=ml}(Ih,Ih.exports);var OC=Ih.exports;const cy=Ws(OC);var BC=Object.defineProperty,UC=(r,t,e)=>t in r?BC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,U=(r,t,e)=>(UC(r,typeof t!="symbol"?t+"":t,e),e);class ti{constructor(t){U(this,"parent"),U(this,"paused"),this.parent=t,this.paused=!1}destroy(){}down(t){return!1}move(t){return!1}up(t){return!1}wheel(t){return!1}update(t){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var XC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},uy={exports:{}};(function(r,t){(function(){var e,i;i=function(s){return r.exports=s},e={linear:function(s,n,o,a){return o*s/a+n},easeInQuad:function(s,n,o,a){return o*(s/=a)*s+n},easeOutQuad:function(s,n,o,a){return-o*(s/=a)*(s-2)+n},easeInOutQuad:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s+n:-o/2*(--s*(s-2)-1)+n},easeInCubic:function(s,n,o,a){return o*(s/=a)*s*s+n},easeOutCubic:function(s,n,o,a){return o*((s=s/a-1)*s*s+1)+n},easeInOutCubic:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s+n:o/2*((s-=2)*s*s+2)+n},easeInQuart:function(s,n,o,a){return o*(s/=a)*s*s*s+n},easeOutQuart:function(s,n,o,a){return-o*((s=s/a-1)*s*s*s-1)+n},easeInOutQuart:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s+n:-o/2*((s-=2)*s*s*s-2)+n},easeInQuint:function(s,n,o,a){return o*(s/=a)*s*s*s*s+n},easeOutQuint:function(s,n,o,a){return o*((s=s/a-1)*s*s*s*s+1)+n},easeInOutQuint:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s*s+n:o/2*((s-=2)*s*s*s*s+2)+n},easeInSine:function(s,n,o,a){return-o*Math.cos(s/a*(Math.PI/2))+o+n},easeOutSine:function(s,n,o,a){return o*Math.sin(s/a*(Math.PI/2))+n},easeInOutSine:function(s,n,o,a){return-o/2*(Math.cos(Math.PI*s/a)-1)+n},easeInExpo:function(s,n,o,a){return s===0?n:o*Math.pow(2,10*(s/a-1))+n},easeOutExpo:function(s,n,o,a){return s===a?n+o:o*(-Math.pow(2,-10*s/a)+1)+n},easeInOutExpo:function(s,n,o,a){return(s/=a/2)<1?o/2*Math.pow(2,10*(s-1))+n:o/2*(-Math.pow(2,-10*--s)+2)+n},easeInCirc:function(s,n,o,a){return-o*(Math.sqrt(1-(s/=a)*s)-1)+n},easeOutCirc:function(s,n,o,a){return o*Math.sqrt(1-(s=s/a-1)*s)+n},easeInOutCirc:function(s,n,o,a){return(s/=a/2)<1?-o/2*(Math.sqrt(1-s*s)-1)+n:o/2*(Math.sqrt(1-(s-=2)*s)+1)+n},easeInElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n},easeOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*s)*Math.sin((s*a-c)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),s<1?-.5*(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l)*.5+o+n},easeInBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*(s/=a)*s*((h+1)*s-h)+n},easeOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*((s=s/a-1)*s*((h+1)*s+h)+1)+n},easeInOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),(s/=a/2)<1?o/2*(s*s*(((h*=1.525)+1)*s-h))+n:o/2*((s-=2)*s*(((h*=1.525)+1)*s+h)+2)+n},easeInBounce:function(s,n,o,a){var h;return h=e.easeOutBounce(a-s,0,o,a),o-h+n},easeOutBounce:function(s,n,o,a){return(s/=a)<1/2.75?o*(7.5625*s*s)+n:s<2/2.75?o*(7.5625*(s-=1.5/2.75)*s+.75)+n:s<2.5/2.75?o*(7.5625*(s-=2.25/2.75)*s+.9375)+n:o*(7.5625*(s-=2.625/2.75)*s+.984375)+n},easeInOutBounce:function(s,n,o,a){var h;return s<a/2?(h=e.easeInBounce(s*2,0,o,a),h*.5+n):(h=e.easeOutBounce(s*2-a,0,o,a),h*.5+o*.5+n)}},i(e)}).call(XC)})(uy);const dy=uy.exports;function Ah(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return dy[r]}else return dy[t]}const WC={removeOnInterrupt:!1,ease:"linear",time:1e3};class ZC extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"startX"),U(this,"startY"),U(this,"deltaX"),U(this,"deltaY"),U(this,"keepCenter"),U(this,"startWidth",null),U(this,"startHeight",null),U(this,"deltaWidth",null),U(this,"deltaHeight",null),U(this,"width",null),U(this,"height",null),U(this,"time",0),this.options=Object.assign({},WC,e),this.options.ease=Ah(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(t){if(this.paused)return;this.time+=t;const e=new dt(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,s=this.parent.height;this.complete(),(i!==this.parent.width||s!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const s=this.startWidth,n=this.deltaWidth;this.parent.fitWidth(s+n*i,this.keepCenter,this.height===null)}if(this.height!==null){const s=this.startHeight,n=this.deltaHeight;this.parent.fitHeight(s+n*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const s=this.startX,n=this.startY,o=this.deltaX,a=this.deltaY,h=new dt(this.parent.x,this.parent.y);this.parent.moveCenter(s+o*i,n+a*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}}}const VC={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class HC extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"left"),U(this,"top"),U(this,"right"),U(this,"bottom"),U(this,"underflowX"),U(this,"underflowY"),U(this,"ease"),U(this,"toX"),U(this,"toY"),this.options=Object.assign({},VC,e),this.ease=Ah(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(t){if(!this.paused){if(this.bounce(),this.toX){const e=this.toX;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),e.time>=this.options.time?(this.parent.x=e.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(e.time,e.start,e.delta,this.options.time)}if(this.toY){const e=this.toY;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),e.time>=this.options.time?(this.parent.y=e.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(e.time,e.start,e.delta,this.options.time)}}}calcUnderflowX(){let t;switch(this.underflowX){case-1:t=0;break;case 1:t=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:t=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return t}calcUnderflowY(){let t;switch(this.underflowY){case-1:t=0;break;case 1:t=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:t=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return t}oob(){const t=this.options.bounceBox;if(t){const e=typeof t.x>"u"?0:t.x,i=typeof t.y>"u"?0:t.y,s=typeof t.width>"u"?this.parent.worldWidth:t.width,n=typeof t.height>"u"?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>s,top:this.parent.top<i,bottom:this.parent.bottom>n,topLeft:new dt(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new dt(s*this.parent.scale.x-this.parent.screenWidth,n*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new dt(0,0),bottomRight:new dt(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){var t,e;if(this.paused)return;let i,s=this.parent.plugins.get("decelerate",!0);s&&(s.x||s.y)&&(s.x&&s.percentChangeX===((t=s.options)==null?void 0:t.friction)||s.y&&s.percentChangeY===((e=s.options)==null?void 0:e.friction))&&(i=this.oob(),(i.left&&this.left||i.right&&this.right)&&(s.percentChangeX=this.options.friction),(i.top&&this.top||i.bottom&&this.bottom)&&(s.percentChangeY=this.options.friction));const n=this.parent.plugins.get("drag",!0)||{},o=this.parent.plugins.get("pinch",!0)||{};if(s=s||{},!(n!=null&&n.active)&&!(o!=null&&o.active)&&(!this.toX||!this.toY)&&(!s.x||!s.y)){i=i||this.oob();const a=i.topLeft,h=i.bottomRight;if(!this.toX&&!s.x){let l=null;i.left&&this.left?l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x:i.right&&this.right&&(l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-h.x),l!==null&&this.parent.x!==l&&(this.toX={time:0,start:this.parent.x,delta:l-this.parent.x,end:l},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!s.y){let l=null;i.top&&this.top?l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y:i.bottom&&this.bottom&&(l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-h.y),l!==null&&this.parent.y!==l&&(this.toY={time:0,start:this.parent.y,delta:l-this.parent.y,end:l},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const KC={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class YC extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"last"),U(this,"noUnderflow"),U(this,"underflowX"),U(this,"underflowY"),this.options=Object.assign({},KC,e),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="none"?this.noUnderflow=!0:t==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=t.indexOf("left")!==-1?-1:t.indexOf("right")!==-1?1:0,this.underflowY=t.indexOf("top")!==-1?-1:t.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const t=new dt(this.parent.x,this.parent.y),e=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,e.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,e.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,e.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,e.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const zC={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class jC extends ti{constructor(t,e={}){super(t),U(this,"options"),this.options=Object.assign({},zC,e),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&t<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&t>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&e<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&e>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const t={x:null,y:null},e={x:null,y:null};if(typeof this.options.minScale=="number")t.x=this.options.minScale,t.y=this.options.minScale;else if(this.options.minScale!==null){const n=this.options.minScale;t.x=typeof n.x>"u"?null:n.x,t.y=typeof n.y>"u"?null:n.y}if(typeof this.options.maxScale=="number")e.x=this.options.maxScale,e.y=this.options.maxScale;else if(this.options.maxScale!==null){const n=this.options.maxScale;e.x=typeof n.x>"u"?null:n.x,e.y=typeof n.y>"u"?null:n.y}let i=this.parent.scale.x,s=this.parent.scale.y;t.x!==null&&i<t.x&&(i=t.x),e.x!==null&&i>e.x&&(i=e.x),t.y!==null&&s<t.y&&(s=t.y),e.y!==null&&s>e.y&&(s=e.y),(i!==this.parent.scale.x||s!==this.parent.scale.y)&&(this.parent.scale.set(i,s),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const JC={friction:.98,bounce:.8,minSpeed:.01},Zr=16;class $C extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"x"),U(this,"y"),U(this,"percentChangeX"),U(this,"percentChangeY"),U(this,"saved"),U(this,"timeSinceRelease"),this.options=Object.assign({},JC,e),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.handleMoved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const t=this.parent.input.count();return(t===1||t>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}handleMoved(t){if(this.saved.length){const e=this.saved[this.saved.length-1];t.type==="clamp-x"&&t.original?e.x===t.original.x&&(e.x=this.parent.x):t.type==="clamp-y"&&t.original&&e.y===t.original.y&&(e.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const t=performance.now();for(const e of this.saved)if(e.time>=t-100){const i=t-e.time;this.x=(this.parent.x-e.x)/i,this.y=(this.parent.y-e.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(t){t=t||{},typeof t.x<"u"&&(this.x=t.x,this.percentChangeX=this.options.friction),typeof t.y<"u"&&(this.y=t.y,this.percentChangeY=this.options.friction)}update(t){if(this.paused)return;const e=this.x||this.y,i=this.timeSinceRelease,s=this.timeSinceRelease+t;if(this.x){const n=this.percentChangeX,o=Math.log(n);this.parent.x+=this.x*Zr/o*(Math.pow(n,s/Zr)-Math.pow(n,i/Zr)),this.x*=Math.pow(this.percentChangeX,t/Zr)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Zr/o*(Math.pow(n,s/Zr)-Math.pow(n,i/Zr)),this.y*=Math.pow(this.percentChangeY,t/Zr)}this.timeSinceRelease+=t,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),e&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const QC={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class qC extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"moved"),U(this,"reverse"),U(this,"xDirection"),U(this,"yDirection"),U(this,"keyIsPressed"),U(this,"mouse"),U(this,"underflowX"),U(this,"underflowY"),U(this,"last"),U(this,"current"),U(this,"windowEventHandlers",[]),this.options=Object.assign({},QC,e),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){const e=s=>{t.includes(s.code)&&(this.keyIsPressed=!0)},i=s=>{t.includes(s.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",e)}addWindowEventHandler(t,e){window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e})}destroy(){this.windowEventHandlers.forEach(({event:t,handler:e})=>{window.removeEventListener(t,e)})}mouseButtons(t){!t||t==="all"?this.mouse=[!0,!0,!0]:this.mouse=[t.indexOf("left")!==-1,t.indexOf("middle")!==-1,t.indexOf("right")!==-1]}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="center"?(this.underflowX=0,this.underflowY=0):(t.includes("left")?this.underflowX=-1:t.includes("right")?this.underflowX=1:this.underflowX=0,t.includes("top")?this.underflowY=-1:t.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(t){const e=t.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!e||this.mouse[t.button]))}checkKeyPress(t){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&t.data.pointerType==="touch"}down(t){return this.paused||!this.options.pressDrag?!1:this.checkButtons(t)&&this.checkKeyPress(t)?(this.last={x:t.global.x,y:t.global.y},this.current=t.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(t){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===t.data.pointerId){const e=t.global.x,i=t.global.y,s=this.parent.input.count();if(s===1||s>1&&!this.parent.plugins.get("pinch",!0)){const n=e-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(n)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:e,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:t,screen:new dt(this.last.x,this.last.y),world:this.parent.toWorld(new dt(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(t){if(this.paused)return!1;const e=this.parent.input.touches;if(e.length===1){const i=e[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new dt(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(t){if(this.paused)return!1;if(this.options.wheel){const e=this.parent.plugins.get("wheel",!0);if(!e||!e.options.wheelZoom&&!t.ctrlKey){const i=t.deltaMode?this.options.lineHeight:1,s=[t.deltaX,t.deltaY],[n,o]=this.options.wheelSwapAxes?s.reverse():s;return this.xDirection&&(this.parent.x+=n*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||t.preventDefault(),this.parent.options.stopPropagation&&t.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const t=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,t.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,t.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,t.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,t.y=0)}}const tI={speed:0,acceleration:null,radius:null};class eI extends ti{constructor(t,e,i={}){super(t),U(this,"options"),U(this,"target"),U(this,"velocity"),this.target=e,this.options=Object.assign({},tI,i),this.velocity={x:0,y:0}}update(t){if(this.paused)return;const e=this.parent.center;let i=this.target.x,s=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-e.y,2)+Math.pow(this.target.x-e.x,2))>this.options.radius){const a=Math.atan2(this.target.y-e.y,this.target.x-e.x);i=this.target.x-Math.cos(a)*this.options.radius,s=this.target.y-Math.sin(a)*this.options.radius}else return;const n=i-e.x,o=s-e.y;if(n||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(s-e.y,i-e.x),h=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));if(h){const l=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>l?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*t,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*t,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const c=Math.cos(a)*this.velocity.x,u=Math.sin(a)*this.velocity.y,d=Math.abs(c)>Math.abs(n)?i:e.x+c,f=Math.abs(u)>Math.abs(o)?s:e.y+u;this.parent.moveCenter(d,f),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(s-e.y,i-e.x),h=Math.cos(a)*this.options.speed,l=Math.sin(a)*this.options.speed,c=Math.abs(h)>Math.abs(n)?i:e.x+h,u=Math.abs(l)>Math.abs(o)?s:e.y+l;this.parent.moveCenter(c,u),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,s),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const iI={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class rI extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"reverse"),U(this,"radiusSquared"),U(this,"left"),U(this,"top"),U(this,"right"),U(this,"bottom"),U(this,"horizontal"),U(this,"vertical"),this.options=Object.assign({},iI,e),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const t=this.options.distance;t!==null?(this.left=t,this.top=t,this.right=this.parent.screenWidth-t,this.bottom=this.parent.screenHeight-t):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(t){if(this.paused||t.pointerType!=="mouse"&&t.pointerId!==1||!this.options.allowButtons&&t.buttons!==0)return!1;const e=t.global.x,i=t.global.y;if(this.radiusSquared){const s=this.parent.toScreen(this.parent.center);if(Math.pow(s.x-e,2)+Math.pow(s.y-i,2)>=this.radiusSquared){const n=Math.atan2(s.y-i,s.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(n))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(n))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(n)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(n)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&e<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&e>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const t=this.parent.plugins.get("decelerate",!0);this.horizontal&&t&&!this.options.noDecelerate&&t.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const t=this.parent.plugins.get("decelerate",!0);this.vertical&&t&&!this.options.noDecelerate&&t.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const t=this.parent.center;this.horizontal&&(t.x+=this.horizontal*this.options.speed),this.vertical&&(t.y+=this.vertical*this.options.speed),this.parent.moveCenter(t),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const sI={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class nI extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"active",!1),U(this,"pinching",!1),U(this,"moved",!1),U(this,"lastCenter"),this.options=Object.assign({},sI,e)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(t){if(this.paused||!this.active)return!1;const e=t.global.x,i=t.global.y,s=this.parent.input.touches;if(s.length>=2){const n=s[0],o=s[1],a=n.last&&o.last?Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)):null;if(n.id===t.pointerId?n.last={x:e,y:i,data:t}:o.id===t.pointerId&&(o.last={x:e,y:i,data:t}),a){let h;const l=new dt(n.last.x+(o.last.x-n.last.x)/2,n.last.y+(o.last.y-n.last.y)/2);this.options.center||(h=this.parent.toLocal(l));let c=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));c=c===0?c=1e-10:c;const u=(1-a/c)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=u),this.isAxisY()&&(this.parent.scale.y+=u),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:l});const d=this.parent.plugins.get("clamp-zoom",!0);if(d&&d.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const f=this.parent.toGlobal(h);this.parent.x+=(l.x-f.x)*this.options.factor,this.parent.y+=(l.y-f.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(l.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(l.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=l,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const oI={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class aI extends ti{constructor(t,e,i,s={}){super(t),U(this,"options"),U(this,"ease"),U(this,"x"),U(this,"y"),U(this,"percent"),U(this,"snapping"),U(this,"deltaX"),U(this,"deltaY"),U(this,"startX"),U(this,"startY"),this.options=Object.assign({},oI,s),this.ease=Ah(s.ease,"easeInOutSine"),this.x=e,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const t=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-t.x,this.deltaY=this.y-t.y,this.startX=t.x,this.startY=t.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.percentChangeX=t.percentChangeY=this.options.friction)}return!1}update(t){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const e=this.snapping;e.time+=t;let i,s,n;const o=this.startX,a=this.startY,h=this.deltaX,l=this.deltaY;if(e.time>this.options.time)i=!0,s=o+h,n=a+l;else{const c=this.ease(e.time,0,1,this.options.time);s=o+h*c,n=a+l*c}this.options.topLeft?this.parent.moveCorner(s,n):this.parent.moveCenter(s,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const e=this.options.topLeft?this.parent.corner:this.parent.center;(e.x!==this.x||e.y!==this.y)&&this.snapStart()}}}const hI={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class lI extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"ease"),U(this,"xScale"),U(this,"yScale"),U(this,"xIndependent"),U(this,"yIndependent"),U(this,"snapping"),this.options=Object.assign({},hI,e),this.ease=Ah(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=t.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=t.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(t.container.scale.x=this.xScale,t.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):e.forceStart&&this.createSnapping()}createSnapping(){const t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,s=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:t,startY:e,deltaX:i-t,deltaY:s-e},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(t){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let e;if(!this.options.center&&!this.options.noMove&&(e=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=t,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const n=this.snapping,o=this.ease(n.time,n.startX,n.deltaX,this.options.time),a=this.ease(n.time,n.startY,n.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const s=this.parent.plugins.get("clamp-zoom",!0);s&&s.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))}}resume(){this.snapping=null,super.resume()}}const cI={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class uI extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"smoothing"),U(this,"smoothingCenter"),U(this,"smoothingCount"),U(this,"keyIsPressed"),this.options=Object.assign({},cI,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){window.addEventListener("keydown",e=>{t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const t=this.smoothingCenter,e=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x+=e.x),this.isAxisY()&&(this.parent.scale.y+=e.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const s=this.parent.plugins.get("clamp-zoom",!0);if(s&&s.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const n=this.parent.toGlobal(i);this.parent.x+=t.x-n.x,this.parent.y+=t.y-n.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(t){if(this.paused)return;const e=this.parent.input.getPointerPosition(t),i=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,s=Math.pow(2,(1+this.options.percent)*i);let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}wheel(t){if(this.paused||!this.checkKeyPress())return!1;if(t.ctrlKey&&this.options.trackpadPinch)this.pinch(t);else if(this.options.wheelZoom){const e=this.parent.input.getPointerPosition(t),i=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){const n={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+n.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+n.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}return!this.parent.options.passiveWheel}}class dI{constructor(t){U(this,"viewport"),U(this,"clickedAvailable"),U(this,"isMouseDown"),U(this,"last"),U(this,"wheelFunction"),U(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new gt(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.options.allowPreserveDragOutside?this.viewport.on("globalpointermove",this.move,this):this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.options.allowPreserveDragOutside||this.viewport.on("pointerleave",this.up,this),this.wheelFunction=t=>this.handleWheel(t),this.viewport.options.events.domElement.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.events.domElement.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.worldVisible)){if(t.pointerType==="mouse"?this.isMouseDown=!0:this.get(t.pointerId)||this.touches.push({id:t.pointerId,last:null}),this.count()===1){this.last=t.global.clone();const e=this.viewport.plugins.get("decelerate",!0),i=this.viewport.plugins.get("bounce",!0);(!e||!e.isActive())&&(!i||!i.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(t)&&this.viewport.options.stopPropagation&&t.stopPropagation()}}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(t){return Math.abs(t)>=this.viewport.threshold}move(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.plugins.move(t);if(this.clickedAvailable&&this.last){const i=t.global.x-this.last.x,s=t.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(s))&&(this.clickedAvailable=!1)}e&&this.viewport.options.stopPropagation&&t.stopPropagation()}up(t){if(this.viewport.pause||!this.viewport.worldVisible)return;t.pointerType==="mouse"&&(this.isMouseDown=!1),t.pointerType!=="mouse"&&this.remove(t.pointerId);const e=this.viewport.plugins.up(t);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:t,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this.viewport}),this.clickedAvailable=!1),e&&this.viewport.options.stopPropagation&&t.stopPropagation()}getPointerPosition(t){const e=new dt;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.toLocal(this.getPointerPosition(t));this.viewport.left<=e.x&&e.x<=this.viewport.right&&this.viewport.top<=e.y&&e.y<=this.viewport.bottom&&this.viewport.plugins.wheel(t)&&!this.viewport.options.passiveWheel&&t.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(t){for(const e of this.touches)if(e.id===t)return e;return null}remove(t){for(let e=0;e<this.touches.length;e++)if(this.touches[e].id===t){this.touches.splice(e,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}const Co=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class fI{constructor(t){U(this,"plugins"),U(this,"list"),U(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=Co.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=Co.indexOf(t);n!==-1&&Co.splice(n,1),Co.splice(i,0,t),this.sort()}get(t,e){var i;return e&&(i=this.plugins[t])!=null&&i.paused?null:this.plugins[t]}update(t){for(const e of this.list)e.update(t)}resize(){for(const t of this.list)t.resize()}reset(){for(const t of this.list)t.reset()}removeAll(){this.list.forEach(t=>{t.destroy()}),this.plugins={},this.sort()}remove(t){var e;this.plugins[t]&&((e=this.plugins[t])==null||e.destroy(),delete this.plugins[t],this.viewport.emit("plugin-remove",t),this.sort())}pause(t){var e;(e=this.plugins[t])==null||e.pause()}resume(t){var e;(e=this.plugins[t])==null||e.resume()}sort(){this.list=[];for(const t of Co)this.plugins[t]&&this.list.push(this.plugins[t])}down(t){let e=!1;for(const i of this.list)i.down(t)&&(e=!0);return e}move(t){let e=!1;for(const i of this.viewport.plugins.list)i.move(t)&&(e=!0);return e}up(t){let e=!1;for(const i of this.list)i.up(t)&&(e=!0);return e}wheel(t){let e=!1;for(const i of this.list)i.wheel(t)&&(e=!0);return e}}const pI={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:Te.shared,allowPreserveDragOutside:!1};class mI extends Ct{constructor(t){super(),U(this,"moving"),U(this,"screenWidth"),U(this,"screenHeight"),U(this,"threshold"),U(this,"input"),U(this,"plugins"),U(this,"zooming"),U(this,"lastViewport"),U(this,"options"),U(this,"_dirty"),U(this,"_forceHitArea"),U(this,"_hitAreaDefault"),U(this,"_pause"),U(this,"tickerFunction"),U(this,"_worldWidth"),U(this,"_worldHeight"),U(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...pI,...t},this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.disableOnContextMenu&&this.options.events.domElement.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new dI(this),this.plugins=new fI(this)}destroy(t){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.events.domElement.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(t)}update(t){this.pause||(this.plugins.update(t),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new gt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(t=window.innerWidth,e=window.innerHeight,i,s){this.screenWidth=t,this.screenHeight=e,typeof i<"u"&&(this._worldWidth=i),typeof s<"u"&&(this._worldHeight=s),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(t){this._worldWidth=t,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(t){this._worldHeight=t,this.plugins.resize()}getVisibleBounds(){return new gt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new dt(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new dt(t,e)):this.toGlobal(t)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new dt(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(t){this.moveCenter(t)}moveCenter(...t){let e,i;typeof t[0]=="number"?(e=t[0],i=t[1]):(e=t[0].x,i=t[0].y);const s=(this.worldScreenWidth/2-e)*this.scale.x,n=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==s||this.y!==n)&&(this.position.set(s,n),this.plugins.reset(),this.dirty=!0),this}get corner(){return new dt(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(...t){let e,i;return t.length===1?(e=-t[0].x*this.scale.x,i=-t[0].y*this.scale.y):(e=-t[0]*this.scale.x,i=-t[1]*this.scale.y),(e!==this.x||i!==this.y)&&(this.position.set(e,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(t){return this.screenWidth/t}findFitHeight(t){return this.screenHeight/t}findFit(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.min(i,s)}findCover(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.max(i,s)}fitWidth(t=this.worldWidth,e,i=!0,s){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitHeight(t=this.worldHeight,e,i=!0,s){let n;e&&(n=this.center),this.scale.y=this.screenHeight/t,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitWorld(t){let e;t&&(e=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),t&&e&&this.moveCenter(e),this}fit(t,e=this.worldWidth,i=this.worldHeight){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&s&&this.moveCenter(s),this}setZoom(t,e){let i;e&&(i=this.center),this.scale.set(t);const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&i&&this.moveCenter(i),this}zoomPercent(t,e){return this.setZoom(this.scale.x+this.scale.x*t,e)}zoom(t,e){return this.fitWidth(t+this.worldScreenWidth,e),this}get scaled(){return this.scale.x}set scaled(t){this.setZoom(t,!0)}snapZoom(t){return this.plugins.add("snap-zoom",new lI(this,t)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new dt(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(t){this.x=-t*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(t){this.x=-t*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(t){this.y=-t*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(t){this.y=-t*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(t){this._dirty=t}get forceHitArea(){return this._forceHitArea}set forceHitArea(t){t?(this._forceHitArea=t,this.hitArea=t):(this._forceHitArea=null,this.hitArea=new gt(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new qC(this,t)),this}clamp(t){return this.plugins.add("clamp",new YC(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new $C(this,t)),this}bounce(t){return this.plugins.add("bounce",new HC(this,t)),this}pinch(t){return this.plugins.add("pinch",new nI(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new aI(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new eI(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new uI(this,t)),this}animate(t){return this.plugins.add("animate",new ZC(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new jC(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new rI(this,t)),this}get pause(){return!!this._pause}set pause(t){this._pause=t,this.lastViewport=null,this.moving=!1,this.zooming=!1,t&&this.input.pause()}ensureVisible(t,e,i,s,n){n&&(i>this.worldScreenWidth||s>this.worldScreenHeight)&&(this.fit(!0,i,s),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;t<this.left?(this.left=t,o=!0):t+i>this.right&&(this.right=t+i,o=!0),e<this.top?(this.top=e,o=!0):e+s>this.bottom&&(this.bottom=e+s,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}function Mh(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function gI(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function od(r){let t,e,i;r.length!==2?(t=Mh,e=(a,h)=>Mh(r(a),h),i=(a,h)=>r(a)-h):(t=r===Mh||r===gI?r:yI,e=r,i=r);function s(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<0?l=u+1:c=u}while(l<c)}return l}function n(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<=0?l=u+1:c=u}while(l<c)}return l}function o(a,h,l=0,c=a.length){const u=s(a,h,l,c-1);return u>l&&i(a[u-1],h)>-i(a[u],h)?u-1:u}return{left:s,center:o,right:n}}function yI(){return 0}function bI(r){return r===null?NaN:+r}const xI=od(Mh).right;od(bI).center;const _I=Math.sqrt(50),vI=Math.sqrt(10),wI=Math.sqrt(2);function Rh(r,t,e){const i=(t-r)/Math.max(0,e),s=Math.floor(Math.log10(i)),n=i/Math.pow(10,s),o=n>=_I?10:n>=vI?5:n>=wI?2:1;let a,h,l;return s<0?(l=Math.pow(10,-s)/o,a=Math.round(r*l),h=Math.round(t*l),a/l<r&&++a,h/l>t&&--h,l=-l):(l=Math.pow(10,s)*o,a=Math.round(r/l),h=Math.round(t/l),a*l<r&&++a,h*l>t&&--h),h<a&&.5<=e&&e<2?Rh(r,t,e*2):[a,h,l]}function TI(r,t,e){if(t=+t,r=+r,e=+e,!(e>0))return[];if(r===t)return[r];const i=t<r,[s,n,o]=i?Rh(t,r,e):Rh(r,t,e);if(!(n>=s))return[];const a=n-s+1,h=new Array(a);if(i)if(o<0)for(let l=0;l<a;++l)h[l]=(n-l)/-o;else for(let l=0;l<a;++l)h[l]=(n-l)*o;else if(o<0)for(let l=0;l<a;++l)h[l]=(s+l)/-o;else for(let l=0;l<a;++l)h[l]=(s+l)*o;return h}function ad(r,t,e){return t=+t,r=+r,e=+e,Rh(r,t,e)[2]}function hd(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?ad(t,r,e):ad(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function ld(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function fy(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function Io(){}var Ao=.7,Ph=1/Ao,vn="\\s*([+-]?\\d+)\\s*",Mo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Oi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",SI=/^#([0-9a-f]{3,8})$/,EI=new RegExp(`^rgb\\(${vn},${vn},${vn}\\)$`),CI=new RegExp(`^rgb\\(${Oi},${Oi},${Oi}\\)$`),II=new RegExp(`^rgba\\(${vn},${vn},${vn},${Mo}\\)$`),AI=new RegExp(`^rgba\\(${Oi},${Oi},${Oi},${Mo}\\)$`),MI=new RegExp(`^hsl\\(${Mo},${Oi},${Oi}\\)$`),RI=new RegExp(`^hsla\\(${Mo},${Oi},${Oi},${Mo}\\)$`),py={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};ld(Io,Ro,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:my,formatHex:my,formatHex8:PI,formatHsl:LI,formatRgb:gy,toString:gy});function my(){return this.rgb().formatHex()}function PI(){return this.rgb().formatHex8()}function LI(){return vy(this).formatHsl()}function gy(){return this.rgb().formatRgb()}function Ro(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=SI.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?yy(t):e===3?new Le(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Lh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Lh(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=EI.exec(r))?new Le(t[1],t[2],t[3],1):(t=CI.exec(r))?new Le(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=II.exec(r))?Lh(t[1],t[2],t[3],t[4]):(t=AI.exec(r))?Lh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=MI.exec(r))?_y(t[1],t[2]/100,t[3]/100,1):(t=RI.exec(r))?_y(t[1],t[2]/100,t[3]/100,t[4]):py.hasOwnProperty(r)?yy(py[r]):r==="transparent"?new Le(NaN,NaN,NaN,0):null}function yy(r){return new Le(r>>16&255,r>>8&255,r&255,1)}function Lh(r,t,e,i){return i<=0&&(r=t=e=NaN),new Le(r,t,e,i)}function GI(r){return r instanceof Io||(r=Ro(r)),r?(r=r.rgb(),new Le(r.r,r.g,r.b,r.opacity)):new Le}function cd(r,t,e,i){return arguments.length===1?GI(r):new Le(r,t,e,i??1)}function Le(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}ld(Le,cd,fy(Io,{brighter(r){return r=r==null?Ph:Math.pow(Ph,r),new Le(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Ao:Math.pow(Ao,r),new Le(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Le(As(this.r),As(this.g),As(this.b),Gh(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:by,formatHex:by,formatHex8:FI,formatRgb:xy,toString:xy}));function by(){return`#${Ms(this.r)}${Ms(this.g)}${Ms(this.b)}`}function FI(){return`#${Ms(this.r)}${Ms(this.g)}${Ms(this.b)}${Ms((isNaN(this.opacity)?1:this.opacity)*255)}`}function xy(){const r=Gh(this.opacity);return`${r===1?"rgb(":"rgba("}${As(this.r)}, ${As(this.g)}, ${As(this.b)}${r===1?")":`, ${r})`}`}function Gh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function As(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Ms(r){return r=As(r),(r<16?"0":"")+r.toString(16)}function _y(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new pi(r,t,e,i)}function vy(r){if(r instanceof pi)return new pi(r.h,r.s,r.l,r.opacity);if(r instanceof Io||(r=Ro(r)),!r)return new pi;if(r instanceof pi)return r;r=r.rgb();var t=r.r/255,e=r.g/255,i=r.b/255,s=Math.min(t,e,i),n=Math.max(t,e,i),o=NaN,a=n-s,h=(n+s)/2;return a?(t===n?o=(e-i)/a+(e<i)*6:e===n?o=(i-t)/a+2:o=(t-e)/a+4,a/=h<.5?n+s:2-n-s,o*=60):a=h>0&&h<1?0:o,new pi(o,a,h,r.opacity)}function NI(r,t,e,i){return arguments.length===1?vy(r):new pi(r,t,e,i??1)}function pi(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}ld(pi,NI,fy(Io,{brighter(r){return r=r==null?Ph:Math.pow(Ph,r),new pi(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Ao:Math.pow(Ao,r),new pi(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<.5?e:1-e)*t,s=2*e-i;return new Le(ud(r>=240?r-240:r+120,s,i),ud(r,s,i),ud(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new pi(wy(this.h),Fh(this.s),Fh(this.l),Gh(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(){const r=Gh(this.opacity);return`${r===1?"hsl(":"hsla("}${wy(this.h)}, ${Fh(this.s)*100}%, ${Fh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function wy(r){return r=(r||0)%360,r<0?r+360:r}function Fh(r){return Math.max(0,Math.min(1,r||0))}function ud(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}const dd=r=>()=>r;function kI(r,t){return function(e){return r+e*t}}function DI(r,t,e){return r=Math.pow(r,e),t=Math.pow(t,e)-r,e=1/e,function(i){return Math.pow(r+i*t,e)}}function OI(r){return(r=+r)==1?Ty:function(t,e){return e-t?DI(t,e,r):dd(isNaN(t)?e:t)}}function Ty(r,t){var e=t-r;return e?kI(r,e):dd(isNaN(r)?t:r)}const Sy=function r(t){var e=OI(t);function i(s,n){var o=e((s=cd(s)).r,(n=cd(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=Ty(s.opacity,n.opacity);return function(c){return s.r=o(c),s.g=a(c),s.b=h(c),s.opacity=l(c),s+""}}return i.gamma=r,i}(1);function BI(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,i=t.slice(),s;return function(n){for(s=0;s<e;++s)i[s]=r[s]*(1-n)+t[s]*n;return i}}function UI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function XI(r,t){var e=t?t.length:0,i=r?Math.min(e,r.length):0,s=new Array(i),n=new Array(e),o;for(o=0;o<i;++o)s[o]=md(r[o],t[o]);for(;o<e;++o)n[o]=t[o];return function(a){for(o=0;o<i;++o)n[o]=s[o](a);return n}}function WI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function Nh(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function ZI(r,t){var e={},i={},s;(r===null||typeof r!="object")&&(r={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in r?e[s]=md(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var fd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pd=new RegExp(fd.source,"g");function VI(r){return function(){return r}}function HI(r){return function(t){return r(t)+""}}function KI(r,t){var e=fd.lastIndex=pd.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=fd.exec(r))&&(s=pd.exec(t));)(n=s.index)>e&&(n=t.slice(e,n),a[o]?a[o]+=n:a[++o]=n),(i=i[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,h.push({i:o,x:Nh(i,s)})),e=pd.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?HI(h[0].x):VI(t):(t=h.length,function(l){for(var c=0,u;c<t;++c)a[(u=h[c]).i]=u.x(l);return a.join("")})}function md(r,t){var e=typeof t,i;return t==null||e==="boolean"?dd(t):(e==="number"?Nh:e==="string"?(i=Ro(t))?(t=i,Sy):KI:t instanceof Ro?Sy:t instanceof Date?WI:UI(t)?BI:Array.isArray(t)?XI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ZI:Nh)(r,t)}function YI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function zI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function kh(r,t){if((e=(r=t?r.toExponential(t-1):r.toExponential()).indexOf("e"))<0)return null;var e,i=r.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+r.slice(e+1)]}function wn(r){return r=kh(Math.abs(r)),r?r[1]:NaN}function jI(r,t){return function(e,i){for(var s=e.length,n=[],o=0,a=r[0],h=0;s>0&&a>0&&(h+a+1>i&&(a=Math.max(1,i-h)),n.push(e.substring(s-=a,s+a)),!((h+=a+1)>i));)a=r[o=(o+1)%r.length];return n.reverse().join(t)}}function JI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var $I=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Dh(r){if(!(t=$I.exec(r)))throw new Error("invalid format: "+r);var t;return new gd({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Dh.prototype=gd.prototype;function gd(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}gd.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function QI(r){t:for(var t=r.length,e=1,i=-1,s;e<t;++e)switch(r[e]){case".":i=s=e;break;case"0":i===0&&(i=e),s=e;break;default:if(!+r[e])break t;i>0&&(i=0);break}return i>0?r.slice(0,i)+r.slice(s+1):r}var Ey;function qI(r,t){var e=kh(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(Ey=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=i.length;return n===o?i:n>o?i+new Array(n-o+1).join("0"):n>0?i.slice(0,n)+"."+i.slice(n):"0."+new Array(1-n).join("0")+kh(r,Math.max(0,t+n-1))[0]}function Cy(r,t){var e=kh(r,t);if(!e)return r+"";var i=e[0],s=e[1];return s<0?"0."+new Array(-s).join("0")+i:i.length>s+1?i.slice(0,s+1)+"."+i.slice(s+1):i+new Array(s-i.length+2).join("0")}const Iy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:zI,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:r=>Math.round(r).toString(8),p:(r,t)=>Cy(r*100,t),r:Cy,s:qI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function Ay(r){return r}var My=Array.prototype.map,Ry=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function t2(r){var t=r.grouping===void 0||r.thousands===void 0?Ay:jI(My.call(r.grouping,Number),r.thousands+""),e=r.currency===void 0?"":r.currency[0]+"",i=r.currency===void 0?"":r.currency[1]+"",s=r.decimal===void 0?".":r.decimal+"",n=r.numerals===void 0?Ay:JI(My.call(r.numerals,String)),o=r.percent===void 0?"%":r.percent+"",a=r.minus===void 0?"−":r.minus+"",h=r.nan===void 0?"NaN":r.nan+"";function l(u){u=Dh(u);var d=u.fill,f=u.align,p=u.sign,m=u.symbol,g=u.zero,y=u.width,x=u.comma,b=u.precision,v=u.trim,w=u.type;w==="n"?(x=!0,w="g"):Iy[w]||(b===void 0&&(b=12),v=!0,w="g"),(g||d==="0"&&f==="=")&&(g=!0,d="0",f="=");var S=m==="$"?e:m==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",C=m==="$"?i:/[%p]/.test(w)?o:"",I=Iy[w],M=/[defgprs%]/.test(w);b=b===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function L(G){var N=S,A=C,D,Z,K;if(w==="c")A=I(G)+A,G="";else{G=+G;var H=G<0||1/G<0;if(G=isNaN(G)?h:I(Math.abs(G),b),v&&(G=QI(G)),H&&+G==0&&p!=="+"&&(H=!1),N=(H?p==="("?p:a:p==="-"||p==="("?"":p)+N,A=(w==="s"?Ry[8+Ey/3]:"")+A+(H&&p==="("?")":""),M){for(D=-1,Z=G.length;++D<Z;)if(K=G.charCodeAt(D),48>K||K>57){A=(K===46?s+G.slice(D+1):G.slice(D))+A,G=G.slice(0,D);break}}}x&&!g&&(G=t(G,1/0));var j=N.length+G.length+A.length,B=j<y?new Array(y-j+1).join(d):"";switch(x&&g&&(G=t(B+G,B.length?y-A.length:1/0),B=""),f){case"<":G=N+G+A+B;break;case"=":G=N+B+G+A;break;case"^":G=B.slice(0,j=B.length>>1)+N+G+A+B.slice(j);break;default:G=B+N+G+A;break}return n(G)}return L.toString=function(){return u+""},L}function c(u,d){var f=l((u=Dh(u),u.type="f",u)),p=Math.max(-8,Math.min(8,Math.floor(wn(d)/3)))*3,m=Math.pow(10,-p),g=Ry[8+p/3];return function(y){return f(m*y)+g}}return{format:l,formatPrefix:c}}var Oh,Py,Ly;e2({thousands:",",grouping:[3],currency:["$",""]});function e2(r){return Oh=t2(r),Py=Oh.format,Ly=Oh.formatPrefix,Oh}function i2(r){return Math.max(0,-wn(Math.abs(r)))}function r2(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(wn(t)/3)))*3-wn(Math.abs(r)))}function s2(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,wn(t)-wn(r))+1}function Gy(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function n2(r){return function(){return r}}function o2(r){return+r}var Fy=[0,1];function Tn(r){return r}function yd(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:n2(isNaN(t)?NaN:.5)}function a2(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function h2(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=yd(s,i),n=e(o,n)):(i=yd(i,s),n=e(n,o)),function(a){return n(i(a))}}function l2(r,t,e){var i=Math.min(r.length,t.length)-1,s=new Array(i),n=new Array(i),o=-1;for(r[i]<r[0]&&(r=r.slice().reverse(),t=t.slice().reverse());++o<i;)s[o]=yd(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=xI(r,a,1,i)-1;return n[h](s[h](a))}}function Ny(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function c2(){var r=Fy,t=Fy,e=md,i,s,n,o=Tn,a,h,l;function c(){var d=Math.min(r.length,t.length);return o!==Tn&&(o=a2(r[0],r[d-1])),a=d>2?l2:h2,h=l=null,u}function u(d){return d==null||isNaN(d=+d)?n:(h||(h=a(r.map(i),t,e)))(i(o(d)))}return u.invert=function(d){return o(s((l||(l=a(t,r.map(i),Nh)))(d)))},u.domain=function(d){return arguments.length?(r=Array.from(d,o2),c()):r.slice()},u.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},u.rangeRound=function(d){return t=Array.from(d),e=YI,c()},u.clamp=function(d){return arguments.length?(o=d?!0:Tn,c()):o!==Tn},u.interpolate=function(d){return arguments.length?(e=d,c()):e},u.unknown=function(d){return arguments.length?(n=d,u):n},function(d,f){return i=d,s=f,c()}}function ky(){return c2()(Tn,Tn)}function u2(r,t,e,i){var s=hd(r,t,e),n;switch(i=Dh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=r2(s,o))&&(i.precision=n),Ly(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=s2(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=i2(s))&&(i.precision=n-(i.type==="%")*2);break}}return Py(i)}function d2(r){var t=r.domain;return r.ticks=function(e){var i=t();return TI(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return u2(s[0],s[s.length-1],e??10,i)},r.nice=function(e){e==null&&(e=10);var i=t(),s=0,n=i.length-1,o=i[s],a=i[n],h,l,c=10;for(a<o&&(l=o,o=a,a=l,l=s,s=n,n=l);c-- >0;){if(l=ad(o,a,e),l===h)return i[s]=o,i[n]=a,t(i);if(l>0)o=Math.floor(o/l)*l,a=Math.ceil(a/l)*l;else if(l<0)o=Math.ceil(o*l)/l,a=Math.floor(a*l)/l;else break;h=l}return r},r}function Dy(){var r=ky();return r.copy=function(){return Ny(r,Dy())},Gy.apply(r,arguments),d2(r)}function f2(r,t){r=r.slice();var e=0,i=r.length-1,s=r[e],n=r[i],o;return n<s&&(o=e,e=i,i=o,o=s,s=n,n=o),r[e]=t.floor(s),r[i]=t.ceil(n),r}const bd=new Date,xd=new Date;function se(r,t,e,i){function s(n){return r(n=arguments.length===0?new Date:new Date(+n)),n}return s.floor=n=>(r(n=new Date(+n)),n),s.ceil=n=>(r(n=new Date(n-1)),t(n,1),r(n),n),s.round=n=>{const o=s(n),a=s.ceil(n);return n-o<a-n?o:a},s.offset=(n,o)=>(t(n=new Date(+n),o==null?1:Math.floor(o)),n),s.range=(n,o,a)=>{const h=[];if(n=s.ceil(n),a=a==null?1:Math.floor(a),!(n<o)||!(a>0))return h;let l;do h.push(l=new Date(+n)),t(n,a),r(n);while(l<n&&n<o);return h},s.filter=n=>se(o=>{if(o>=o)for(;r(o),!n(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;t(o,-1),!n(o););else for(;--a>=0;)for(;t(o,1),!n(o););}),e&&(s.count=(n,o)=>(bd.setTime(+n),xd.setTime(+o),r(bd),r(xd),Math.floor(e(bd,xd))),s.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?s.filter(i?o=>i(o)%n===0:o=>s.count(0,o)%n===0):s)),s}const Bh=se(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Bh.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?se(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Bh),Bh.range;const cr=1e3,ei=cr*60,ur=ei*60,dr=ur*24,_d=dr*7,Oy=dr*30,vd=dr*365,Sn=se(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*cr)},(r,t)=>(t-r)/cr,r=>r.getUTCSeconds());Sn.range;const wd=se(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*cr)},(r,t)=>{r.setTime(+r+t*ei)},(r,t)=>(t-r)/ei,r=>r.getMinutes());wd.range,se(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*ei)},(r,t)=>(t-r)/ei,r=>r.getUTCMinutes()).range;const Td=se(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*cr-r.getMinutes()*ei)},(r,t)=>{r.setTime(+r+t*ur)},(r,t)=>(t-r)/ur,r=>r.getHours());Td.range,se(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*ur)},(r,t)=>(t-r)/ur,r=>r.getUTCHours()).range;const Po=se(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*ei)/dr,r=>r.getDate()-1);Po.range;const Sd=se(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/dr,r=>r.getUTCDate()-1);Sd.range,se(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/dr,r=>Math.floor(r/dr)).range;function Rs(r){return se(t=>{t.setDate(t.getDate()-(t.getDay()+7-r)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ei)/_d)}const Uh=Rs(0),Xh=Rs(1),p2=Rs(2),m2=Rs(3),En=Rs(4),g2=Rs(5),y2=Rs(6);Uh.range,Xh.range,p2.range,m2.range,En.range,g2.range,y2.range;function Ps(r){return se(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-r)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/_d)}const By=Ps(0),Wh=Ps(1),b2=Ps(2),x2=Ps(3),Cn=Ps(4),_2=Ps(5),v2=Ps(6);By.range,Wh.range,b2.range,x2.range,Cn.range,_2.range,v2.range;const Ed=se(r=>{r.setDate(1),r.setHours(0,0,0,0)},(r,t)=>{r.setMonth(r.getMonth()+t)},(r,t)=>t.getMonth()-r.getMonth()+(t.getFullYear()-r.getFullYear())*12,r=>r.getMonth());Ed.range,se(r=>{r.setUTCDate(1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCMonth(r.getUTCMonth()+t)},(r,t)=>t.getUTCMonth()-r.getUTCMonth()+(t.getUTCFullYear()-r.getUTCFullYear())*12,r=>r.getUTCMonth()).range;const fr=se(r=>{r.setMonth(0,1),r.setHours(0,0,0,0)},(r,t)=>{r.setFullYear(r.getFullYear()+t)},(r,t)=>t.getFullYear()-r.getFullYear(),r=>r.getFullYear());fr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:se(t=>{t.setFullYear(Math.floor(t.getFullYear()/r)*r),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*r)}),fr.range;const Ls=se(r=>{r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCFullYear(r.getUTCFullYear()+t)},(r,t)=>t.getUTCFullYear()-r.getUTCFullYear(),r=>r.getUTCFullYear());Ls.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:se(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/r)*r),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*r)}),Ls.range;function w2(r,t,e,i,s,n){const o=[[Sn,1,cr],[Sn,5,5*cr],[Sn,15,15*cr],[Sn,30,30*cr],[n,1,ei],[n,5,5*ei],[n,15,15*ei],[n,30,30*ei],[s,1,ur],[s,3,3*ur],[s,6,6*ur],[s,12,12*ur],[i,1,dr],[i,2,2*dr],[e,1,_d],[t,1,Oy],[t,3,3*Oy],[r,1,vd]];function a(l,c,u){const d=c<l;d&&([l,c]=[c,l]);const f=u&&typeof u.range=="function"?u:h(l,c,u),p=f?f.range(l,+c+1):[];return d?p.reverse():p}function h(l,c,u){const d=Math.abs(c-l)/u,f=od(([,,g])=>g).right(o,d);if(f===o.length)return r.every(hd(l/vd,c/vd,u));if(f===0)return Bh.every(Math.max(hd(l,c,u),1));const[p,m]=o[d/o[f-1][2]<o[f][2]/d?f-1:f];return p.every(m)}return[a,h]}const[T2,S2]=w2(fr,Ed,Uh,Po,Td,wd);function Cd(r){if(0<=r.y&&r.y<100){var t=new Date(-1,r.m,r.d,r.H,r.M,r.S,r.L);return t.setFullYear(r.y),t}return new Date(r.y,r.m,r.d,r.H,r.M,r.S,r.L)}function Id(r){if(0<=r.y&&r.y<100){var t=new Date(Date.UTC(-1,r.m,r.d,r.H,r.M,r.S,r.L));return t.setUTCFullYear(r.y),t}return new Date(Date.UTC(r.y,r.m,r.d,r.H,r.M,r.S,r.L))}function Lo(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function E2(r){var t=r.dateTime,e=r.date,i=r.time,s=r.periods,n=r.days,o=r.shortDays,a=r.months,h=r.shortMonths,l=Go(s),c=Fo(s),u=Go(n),d=Fo(n),f=Go(o),p=Fo(o),m=Go(a),g=Fo(a),y=Go(h),x=Fo(h),b={a:H,A:j,b:B,B:k,c:null,d:Hy,e:Hy,f:z2,g:sA,G:oA,H:H2,I:K2,j:Y2,L:Ky,m:j2,M:J2,p:F,q:V,Q:Qy,s:qy,S:$2,u:Q2,U:q2,V:tA,w:eA,W:iA,x:null,X:null,y:rA,Y:nA,Z:aA,"%":$y},v={a:et,A:ft,b:at,B:Tt,c:null,d:zy,e:zy,f:uA,g:vA,G:TA,H:hA,I:lA,j:cA,L:jy,m:dA,M:fA,p:It,q:Q,Q:Qy,s:qy,S:pA,u:mA,U:gA,V:yA,w:bA,W:xA,x:null,X:null,y:_A,Y:wA,Z:SA,"%":$y},w={a:L,A:G,b:N,B:A,c:D,d:Zy,e:Zy,f:X2,g:Wy,G:Xy,H:Vy,I:Vy,j:D2,L:U2,m:k2,M:O2,p:M,q:N2,Q:Z2,s:V2,S:B2,u:R2,U:P2,V:L2,w:M2,W:G2,x:Z,X:K,y:Wy,Y:Xy,Z:F2,"%":W2};b.x=S(e,b),b.X=S(i,b),b.c=S(t,b),v.x=S(e,v),v.X=S(i,v),v.c=S(t,v);function S(W,J){return function($){var O=[],pt=-1,yt=0,Rt=W.length,Ot,Fe,Ze;for($ instanceof Date||($=new Date(+$));++pt<Rt;)W.charCodeAt(pt)===37&&(O.push(W.slice(yt,pt)),(Fe=Uy[Ot=W.charAt(++pt)])!=null?Ot=W.charAt(++pt):Fe=Ot==="e"?" ":"0",(Ze=J[Ot])&&(Ot=Ze($,Fe)),O.push(Ot),yt=pt+1);return O.push(W.slice(yt,pt)),O.join("")}}function C(W,J){return function($){var O=Lo(1900,void 0,1),pt=I(O,W,$+="",0),yt,Rt;if(pt!=$.length)return null;if("Q"in O)return new Date(O.Q);if("s"in O)return new Date(O.s*1e3+("L"in O?O.L:0));if(J&&!("Z"in O)&&(O.Z=0),"p"in O&&(O.H=O.H%12+O.p*12),O.m===void 0&&(O.m="q"in O?O.q:0),"V"in O){if(O.V<1||O.V>53)return null;"w"in O||(O.w=1),"Z"in O?(yt=Id(Lo(O.y,0,1)),Rt=yt.getUTCDay(),yt=Rt>4||Rt===0?Wh.ceil(yt):Wh(yt),yt=Sd.offset(yt,(O.V-1)*7),O.y=yt.getUTCFullYear(),O.m=yt.getUTCMonth(),O.d=yt.getUTCDate()+(O.w+6)%7):(yt=Cd(Lo(O.y,0,1)),Rt=yt.getDay(),yt=Rt>4||Rt===0?Xh.ceil(yt):Xh(yt),yt=Po.offset(yt,(O.V-1)*7),O.y=yt.getFullYear(),O.m=yt.getMonth(),O.d=yt.getDate()+(O.w+6)%7)}else("W"in O||"U"in O)&&("w"in O||(O.w="u"in O?O.u%7:"W"in O?1:0),Rt="Z"in O?Id(Lo(O.y,0,1)).getUTCDay():Cd(Lo(O.y,0,1)).getDay(),O.m=0,O.d="W"in O?(O.w+6)%7+O.W*7-(Rt+5)%7:O.w+O.U*7-(Rt+6)%7);return"Z"in O?(O.H+=O.Z/100|0,O.M+=O.Z%100,Id(O)):Cd(O)}}function I(W,J,$,O){for(var pt=0,yt=J.length,Rt=$.length,Ot,Fe;pt<yt;){if(O>=Rt)return-1;if(Ot=J.charCodeAt(pt++),Ot===37){if(Ot=J.charAt(pt++),Fe=w[Ot in Uy?J.charAt(pt++):Ot],!Fe||(O=Fe(W,$,O))<0)return-1}else if(Ot!=$.charCodeAt(O++))return-1}return O}function M(W,J,$){var O=l.exec(J.slice($));return O?(W.p=c.get(O[0].toLowerCase()),$+O[0].length):-1}function L(W,J,$){var O=f.exec(J.slice($));return O?(W.w=p.get(O[0].toLowerCase()),$+O[0].length):-1}function G(W,J,$){var O=u.exec(J.slice($));return O?(W.w=d.get(O[0].toLowerCase()),$+O[0].length):-1}function N(W,J,$){var O=y.exec(J.slice($));return O?(W.m=x.get(O[0].toLowerCase()),$+O[0].length):-1}function A(W,J,$){var O=m.exec(J.slice($));return O?(W.m=g.get(O[0].toLowerCase()),$+O[0].length):-1}function D(W,J,$){return I(W,t,J,$)}function Z(W,J,$){return I(W,e,J,$)}function K(W,J,$){return I(W,i,J,$)}function H(W){return o[W.getDay()]}function j(W){return n[W.getDay()]}function B(W){return h[W.getMonth()]}function k(W){return a[W.getMonth()]}function F(W){return s[+(W.getHours()>=12)]}function V(W){return 1+~~(W.getMonth()/3)}function et(W){return o[W.getUTCDay()]}function ft(W){return n[W.getUTCDay()]}function at(W){return h[W.getUTCMonth()]}function Tt(W){return a[W.getUTCMonth()]}function It(W){return s[+(W.getUTCHours()>=12)]}function Q(W){return 1+~~(W.getUTCMonth()/3)}return{format:function(W){var J=S(W+="",b);return J.toString=function(){return W},J},parse:function(W){var J=C(W+="",!1);return J.toString=function(){return W},J},utcFormat:function(W){var J=S(W+="",v);return J.toString=function(){return W},J},utcParse:function(W){var J=C(W+="",!0);return J.toString=function(){return W},J}}}var Uy={"-":"",_:" ",0:"0"},ue=/^\s*\d+/,C2=/^%/,I2=/[\\^$*+?|[\]().{}]/g;function Mt(r,t,e){var i=r<0?"-":"",s=(i?-r:r)+"",n=s.length;return i+(n<e?new Array(e-n+1).join(t)+s:s)}function A2(r){return r.replace(I2,"\\$&")}function Go(r){return new RegExp("^(?:"+r.map(A2).join("|")+")","i")}function Fo(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function M2(r,t,e){var i=ue.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function R2(r,t,e){var i=ue.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function P2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function L2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function G2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Xy(r,t,e){var i=ue.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Wy(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function F2(r,t,e){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return i?(r.Z=i[1]?0:-(i[2]+(i[3]||"00")),e+i[0].length):-1}function N2(r,t,e){var i=ue.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function k2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function Zy(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function D2(r,t,e){var i=ue.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Vy(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function O2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function B2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function U2(r,t,e){var i=ue.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function X2(r,t,e){var i=ue.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function W2(r,t,e){var i=C2.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function Z2(r,t,e){var i=ue.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function V2(r,t,e){var i=ue.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function Hy(r,t){return Mt(r.getDate(),t,2)}function H2(r,t){return Mt(r.getHours(),t,2)}function K2(r,t){return Mt(r.getHours()%12||12,t,2)}function Y2(r,t){return Mt(1+Po.count(fr(r),r),t,3)}function Ky(r,t){return Mt(r.getMilliseconds(),t,3)}function z2(r,t){return Ky(r,t)+"000"}function j2(r,t){return Mt(r.getMonth()+1,t,2)}function J2(r,t){return Mt(r.getMinutes(),t,2)}function $2(r,t){return Mt(r.getSeconds(),t,2)}function Q2(r){var t=r.getDay();return t===0?7:t}function q2(r,t){return Mt(Uh.count(fr(r)-1,r),t,2)}function Yy(r){var t=r.getDay();return t>=4||t===0?En(r):En.ceil(r)}function tA(r,t){return r=Yy(r),Mt(En.count(fr(r),r)+(fr(r).getDay()===4),t,2)}function eA(r){return r.getDay()}function iA(r,t){return Mt(Xh.count(fr(r)-1,r),t,2)}function rA(r,t){return Mt(r.getFullYear()%100,t,2)}function sA(r,t){return r=Yy(r),Mt(r.getFullYear()%100,t,2)}function nA(r,t){return Mt(r.getFullYear()%1e4,t,4)}function oA(r,t){var e=r.getDay();return r=e>=4||e===0?En(r):En.ceil(r),Mt(r.getFullYear()%1e4,t,4)}function aA(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Mt(t/60|0,"0",2)+Mt(t%60,"0",2)}function zy(r,t){return Mt(r.getUTCDate(),t,2)}function hA(r,t){return Mt(r.getUTCHours(),t,2)}function lA(r,t){return Mt(r.getUTCHours()%12||12,t,2)}function cA(r,t){return Mt(1+Sd.count(Ls(r),r),t,3)}function jy(r,t){return Mt(r.getUTCMilliseconds(),t,3)}function uA(r,t){return jy(r,t)+"000"}function dA(r,t){return Mt(r.getUTCMonth()+1,t,2)}function fA(r,t){return Mt(r.getUTCMinutes(),t,2)}function pA(r,t){return Mt(r.getUTCSeconds(),t,2)}function mA(r){var t=r.getUTCDay();return t===0?7:t}function gA(r,t){return Mt(By.count(Ls(r)-1,r),t,2)}function Jy(r){var t=r.getUTCDay();return t>=4||t===0?Cn(r):Cn.ceil(r)}function yA(r,t){return r=Jy(r),Mt(Cn.count(Ls(r),r)+(Ls(r).getUTCDay()===4),t,2)}function bA(r){return r.getUTCDay()}function xA(r,t){return Mt(Wh.count(Ls(r)-1,r),t,2)}function _A(r,t){return Mt(r.getUTCFullYear()%100,t,2)}function vA(r,t){return r=Jy(r),Mt(r.getUTCFullYear()%100,t,2)}function wA(r,t){return Mt(r.getUTCFullYear()%1e4,t,4)}function TA(r,t){var e=r.getUTCDay();return r=e>=4||e===0?Cn(r):Cn.ceil(r),Mt(r.getUTCFullYear()%1e4,t,4)}function SA(){return"+0000"}function $y(){return"%"}function Qy(r){return+r}function qy(r){return Math.floor(+r/1e3)}var In,tb;EA({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function EA(r){return In=E2(r),tb=In.format,In.parse,In.utcFormat,In.utcParse,In}function CA(r){return new Date(r)}function IA(r){return r instanceof Date?+r:+new Date(+r)}function eb(r,t,e,i,s,n,o,a,h,l){var c=ky(),u=c.invert,d=c.domain,f=l(".%L"),p=l(":%S"),m=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),x=l("%b %d"),b=l("%B"),v=l("%Y");function w(S){return(h(S)<S?f:a(S)<S?p:o(S)<S?m:n(S)<S?g:i(S)<S?s(S)<S?y:x:e(S)<S?b:v)(S)}return c.invert=function(S){return new Date(u(S))},c.domain=function(S){return arguments.length?d(Array.from(S,IA)):d().map(CA)},c.ticks=function(S){var C=d();return r(C[0],C[C.length-1],S??10)},c.tickFormat=function(S,C){return C==null?w:l(C)},c.nice=function(S){var C=d();return(!S||typeof S.range!="function")&&(S=t(C[0],C[C.length-1],S??10)),S?d(f2(C,S)):c},c.copy=function(){return Ny(c,eb(r,t,e,i,s,n,o,a,h,l))},c}function AA(){return Gy.apply(eb(T2,S2,fr,Ed,Uh,Po,Td,wd,Sn,tb).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function No(r,t,e){this.k=r,this.x=t,this.y=e}No.prototype={constructor:No,scale:function(r){return r===1?this:new No(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new No(this.k,this.x+this.k*r,this.y+this.k*t)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},No.prototype;function ib(r){return r.mode==="temporal"||r.mode==="left-aligned"?MA(r):RA(r)}function MA({domain:r,range:t}){return AA().domain(r).range(t)}function RA({domain:r,range:t}){return Dy().domain(r).range(t)}function Ad(r){return{mode:it.horizontal,range:wR(),domain:TR(r)}}function PA(){return{mode:it.vertical}}let An=null;async function LA(){const r=await Wi();rb(r.start_time),tt.on("layoutSettingsUpdated",()=>rb(r.start_time))}function GA(){An=null}async function ii(){return An||await Ce("scaleCreated")}async function rb(r){await ee();const t=An?"scaleUpdated":"scaleCreated",e=Ad(r);An=ib(e),tt.emit(t,An)}let Ge=null,Md=null;async function FA(){const r=await Qt(),t=await bu();Ge=new mI({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Ge.zIndex=1,Ge.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),Ge.on("moved",()=>{tt.emit("viewportMoved",null)}).on("moved-end",()=>{tt.emit("viewportMoved",null)}),r.stage.addChild(Ge),tt.emit("viewportCreated",Ge),tt.on("applicationResized",XA),tt.on("scaleUpdated",()=>ko()),BA()}function NA(){Ge=null,Md=null}async function Rd({animate:r}={}){const e=(await te()).getChildByName(Pf);if(!e)throw new Error("Nodes container not found");VA();const{x:i,y:s,width:n,height:o}=e.getLocalBounds();if(!n||!o){DA({animate:r});return}kA({x:i,y:s,width:n,height:o,animate:r})}async function kA({x:r,y:t,width:e,height:i,animate:s}){const n=await Lt(),o=await te(),{guideTextSize:a,guideTextTopPadding:h,columnGap:l,rowGap:c,eventTargetSize:u}=n.styles,d=a+h,f=e+l*2,p=i+c*4+d+u,m=o.findFit(f,p);o.animate({position:{x:r+e/2,y:t+i/2+d},scale:Math.min(m,1),time:s?n.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{Vh(),ko()}})}async function DA({animate:r}){const t=await Wi(),e=await Lt(),i=await te(),s=await ii();let n=s(t.start_time)-e.styles.columnGap,o=s(t.end_time??new Date)+e.styles.columnGap;if(n>o){const c=n;n=o,o=c}const a=o-n,h=n+a/2,l=i.findFit(a,0);i.animate({position:{x:h,y:0},scale:l,time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{Vh(),ko()}})}async function te(){return Ge||await Ce("viewportCreated")}function sb(r){cy(Md,r)||(Md=r,tt.emit("viewportDateRangeUpdated",r))}function OA({xOffset:r,yOffset:t}){if(!Ge)return;const{x:e,y:i}=Ge.transform.position;Ge.setTransform(e+r,i+t,Ge.transform.scale.x,Ge.transform.scale.y)}async function BA(){const r=await te();ko(),r.on("moved",()=>ko())}async function ko(){const r=await nb();r&&sb(r)}async function nb(){const r=await te(),t=await ii(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function UA(r){const t=await nb(),e=await ee();if(r===void 0||e.isDependency()||cy(r,t))return;const i=await te(),s=await ii(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;sb(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function XA(){const r=await Qt(),t=await te(),e=await bu(),i=t.screenWidth,s=t.screenHeight,n=e.clientWidth,o=e.clientHeight,a=(n-i)/2,h=(o-s)/2;t.resize(r.screen.width,r.screen.height),OA({xOffset:a,yOffset:h})}class Zh{constructor(){Tf(this,"status","visible");Tf(this,"labels",new Set)}get visible(){return this.status==="visible"}get hidden(){return this.status==="hidden"}show(){if(this.status!=="visible"){for(const t of this.labels)t.visible=!0;this.status="visible"}}hide(){if(this.status!=="hidden"){for(const t of this.labels)t.visible=!1;this.status="hidden"}}toggle(t){t?this.show():this.hide()}add(t){this.labels.add(t),t.visible=this.visible}clear(){this.labels.clear()}}let Bi=null,ri=null,Ui=null,pr=null,mi=null;async function WA(){const r=await te(),t=await Qt();Bi=new DC({toggle:"renderable"}),ri=new Zh,Ui=new Zh,mi=new Zh,pr=new Zh,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.1,i=r.scale.x>.2,s=r.scale.x>.2,n=r.scale.x>.2;mi==null||mi.toggle(e),ri==null||ri.toggle(i),Ui==null||Ui.toggle(s),pr==null||pr.toggle(n),Bi==null||Bi.cull(t.renderer.screen),r.dirty=!1}}),tt.emit("cullCreated",Bi),tt.emit("labelCullCreated",ri),tt.emit("iconCullCreated",ri),tt.emit("edgeCullCreated",mi),tt.emit("toggleCullCreated",pr)}function ZA(){Bi=null,ri==null||ri.clear(),ri=null,Ui==null||Ui.clear(),Ui=null,mi==null||mi.clear(),mi=null,pr==null||pr.clear(),pr=null}async function Vh(){const r=await te();r.dirty=!0}function VA(){Bi&&Bi.uncull()}async function ob(){return Bi||await Ce("cullCreated")}async function HA(){return mi||await Ce("edgeCullCreated")}async function ab(){return ri||await Ce("labelCullCreated")}async function KA(){return Ui||await Ce("iconCullCreated")}async function hb(){const r=await ee(),t=await Lt();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return ly.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{Vh()}})}return{animate:e}}let Hh=new Map;function YA(){Hh=new Map}async function Do(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(Hh.has(e))return Hh.get(e);const i=await r(...t);return Hh.set(e,i),i}async function zA({size:r,stroke:t=1,radius:e=0}){const i=await Qt(),s=new ln;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new gt(0,0,r,r),resolution:10})}async function Oo(r){return await Do(zA,[r])}var Kh=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Kh||{});function lb(){const r=new $t;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await Oo(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function jA(){const r=await Qt(),t=new ln;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t,{wrapMode:vi.REPEAT})}async function Pd(){return await Do(jA,[])}function Ld(r,t){return Array.from({length:r},(e,i)=>t(i))}const JA=8,$A=2;async function QA(){const r=await Lt(),t=await ob(),e=await HA(),{animate:i}=await hb(),s=new Ct,{element:n,render:o}=await lb(),a=await Pd(),h=Ld(20,()=>new dt),l=new RS(a,h);let c=!1;s.name=rx,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function u(){return await o({size:10,rotate:Kh.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(p,m){const g=f(m);c||await u();for(const[y,x]of h.entries()){const{x:b,y:v}=g[y];i(x,{x:b,y:v},!c)}i(s,{x:p.x,y:p.y},!c),i(n,{x:m.x-JA,y:m.y},!c),c=!0}function f({x:p,y:m}){const g=[],y={x:0,y:0},x={x:p-$A,y:m},b={x:cb(y.x,{source:y,target:x}),y:y.y},v={x:cb(x.x,{source:y,target:x},!0),y:x.y};for(const[w]of h.entries()){if(w===h.length-1){g[w]=x;continue}const S=qA(w,{source:y,target:x,sourceBezier:b,targetBezier:v});g[w]=S}return g}return{element:s,render:u,setPosition:d}}function cb(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function qA(r,t){const e=r/20,{source:i,target:s,sourceBezier:n,targetBezier:o}=t,a=i.x+(n.x-i.x)*e,h=i.y+(n.y-i.y)*e,l=n.x+(o.x-n.x)*e,c=n.y+(o.y-n.y)*e,u=o.x+(s.x-o.x)*e,d=o.y+(s.y-o.y)*e,f=a+(l-a)*e,p=h+(c-h)*e,m=l+(u-l)*e,g=c+(d-c)*e,y=f+(m-f)*e,x=p+(g-p)*e;return{x:y,y:x}}async function tM({height:r,radius:t}){const e=await Qt(),i=new ln;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new gt(0,0,t,r),resolution:10})}async function eM(r){return await Do(tM,[r])}function iM(){const r=new $t,t=new $t;async function e(i){const s=await eM(i);return r.texture=s,t.texture=s,t.anchor.x=1,t.scale.x=-1,{left:r,right:t}}return{left:r,right:t,render:e}}async function mr(){const r=await Pd();return new $t(r)}async function Gd(){const r=new Ct,t=await mr(),{left:e,right:i,render:s}=await iM();r.addChild(t),r.addChild(e),r.addChild(i);async function n(h){const{width:l,x:c,visible:u}=a(h);return await s({height:h.height,radius:h.radius}),t.visible=u,t.width=l,t.height=h.height,t.x=c,e.visible=o(h.capLeft,h.radius),i.visible=o(h.capRight,h.radius),i.x=h.radius+l,t.tint=h.background,e.tint=h.background,i.tint=h.background,r}function o(h,l){return l===0?!1:h??!0}function a(h){const l=o(h.capLeft,h.radius),c=o(h.capRight,h.radius);let u=0;l&&(u+=h.radius),c&&(u+=h.radius);const d=Math.max(h.width-u,0),f=d>0,p=l?h.radius:0;return{width:d,visible:f,x:p}}return{element:r,render:n}}function Fd(){const r=new Ct,t=new $t,e=new $t,i=new $t,s=new $t,n=new $t,o=new $t,a=new $t,h=new $t;t.name="border-corner-top-left",e.name="border-corner-top-right",i.name="border-corner-bottom-left",s.name="border-corner-bottom-right",n.name="border-corner-left",o.name="border-corner-right",a.name="border-corner-top",h.name="border-corner-bottom",e.anchor.x=1,e.scale.x=-1,i.anchor.y=1,i.scale.y=-1,s.anchor.x=1,s.scale.x=-1,s.anchor.y=1,s.scale.y=-1,r.addChild(t),r.addChild(e),r.addChild(i),r.addChild(s),r.addChild(n),r.addChild(o),r.addChild(a),r.addChild(h);async function l(p){const{radius:m=0,color:g="#fff",stroke:y,width:x,height:b}=p,v=typeof m=="number",w={topLeft:c(v?m:m[0],x,b),topRight:c(v?m:m[1],x,b),bottomLeft:c(v?m:m[2],x,b),bottomRight:c(v?m:m[3],x,b)};return await u({width:x,height:b,stroke:y,cornerSizes:w}),await d({width:x,height:b,stroke:y,cornerSizes:w}),f(g),r}function c(p,m,g){const y=Math.min(m,g);return{size:p*2>y?y/2:p,radius:p}}async function u({width:p,height:m,stroke:g,cornerSizes:y}){const{topLeft:x,topRight:b,bottomLeft:v,bottomRight:w}=y,[S,C,I,M]=await Promise.all([Oo({...x,stroke:g}),Oo({...b,stroke:g}),Oo({...v,stroke:g}),Oo({...w,stroke:g})]);t.texture=S,e.texture=C,i.texture=M,s.texture=I,t.position.set(0,0),e.position.set(p-b.size,0),i.position.set(0,m-v.size),s.position.set(p-w.size,m-w.size)}async function d({width:p,height:m,stroke:g,cornerSizes:y}){const x=await Pd(),{topLeft:b,topRight:v,bottomLeft:w,bottomRight:S}=y;a.texture=x,n.texture=x,o.texture=x,h.texture=x,n.position.set(0,b.size),n.height=Math.max(m-b.size-w.size,0),n.width=g,o.position.set(p-g,v.size),o.height=Math.max(m-v.size-S.size,0),o.width=g,a.position.set(b.size,0),a.width=Math.max(p-b.size-v.size,0),a.height=g,h.position.set(w.size,m-g),h.width=Math.max(p-w.size-S.size,0),h.height=g}function f(p){t.tint=p,e.tint=p,i.tint=p,s.tint=p,a.tint=p,n.tint=p,o.tint=p,h.tint=p}return{element:r,render:l}}async function Yh(){const r=await Lt(),t=new Ct,{element:e,render:i}=await Fd();async function s({selected:n,width:o,height:a}){if(!n)return t.removeChild(e),t;const{selectedBorderColor:h,selectedBorderWidth:l,selectedBorderOffset:c,selectedBorderRadius:u}=r.styles;return e.position.set(-c,-c),t.addChild(e),await i({stroke:l,radius:u,width:o+c*2,height:a+c*2,color:h}),t}return{element:t,render:s}}async function rM(){const r=await Lt(),t=new Ct,{element:e,render:i}=await Gd(),{element:s,render:n}=await Yh();t.addChild(e),t.addChild(s);async function o({selected:a,width:h,height:l}){const{artifactBgColor:c,artifactBorderRadius:u}=r.styles,d={width:h,height:l,background:c,radius:u,capLeft:!0,capRight:!0};return await Promise.all([i(d),n({selected:a,width:h,height:l})]),t}return{element:t,render:o}}const sM=Object.freeze(Object.defineProperty({__proto__:null,Artifact:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15.7984%207.99134L12.7215%2012.9913C12.5599%2013.2539%2012.2797%2013.4202%2011.9718%2013.4362C11.664%2013.4523%2011.3679%2013.3159%2011.18%2013.0716L9.25692%2010.5716L10.7431%209.4284L11.8372%2010.8508L14.2016%207.00866L15.7984%207.99134Z'%20fill='white'/%3e%3c/svg%3e",ArtifactMarkdown:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15%207.1875H10V5.3125H15V7.1875ZM15%2010.9375H10V9.0625H15V10.9375ZM10%2014.6875H12.5V12.8125H10V14.6875Z'%20fill='white'/%3e%3c/svg%3e",ArtifactResult:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM9.52483%206.61458C9.7035%205.94774%2010.3889%205.55202%2011.0558%205.73069C11.7226%205.90937%2012.1183%206.59479%2011.9396%207.26162C11.761%207.92846%2011.0755%208.32418%2010.4087%208.14551C9.74188%207.96683%209.34615%207.28141%209.52483%206.61458ZM13.0604%2012.7383C13.239%2012.0715%2013.9245%2011.6757%2014.5913%2011.8544C15.2581%2012.0331%2015.6539%2012.7185%2015.4752%2013.3854C15.2965%2014.0522%2014.6111%2014.4479%2013.9442%2014.2692C13.2774%2014.0906%2012.8817%2013.4051%2013.0604%2012.7383ZM10.78%2014.27L15.78%206.77002L14.2199%205.72996L9.21995%2013.23L10.78%2014.27Z'%20fill='white'/%3e%3c/svg%3e",ArtifactTable:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM10%207.1875H11.875V5.3125H10V7.1875ZM10%2010.9375H11.875V9.0625H10V10.9375ZM11.875%2014.6875H10V12.8125H11.875V14.6875ZM13.125%207.1875H15V5.3125H13.125V7.1875ZM15%2010.9375H13.125V9.0625H15V10.9375ZM13.125%2014.6875H15V12.8125H13.125V14.6875Z'%20fill='white'/%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"}));function nM(r){const t={resolution:4};return ot.from(sM[r],t)}async function oM(r){return await Do(nM,[r])}async function aM({cullAtZoomThreshold:r=!0}={}){const t=await KA(),e=new $t;r&&t.add(e);async function i(s){const n=await oM(s);return e.texture=n,e}return{element:e,render:i}}var ub={exports:{}};(function(r){(function(){function t(m,g){document.addEventListener?m.addEventListener("scroll",g,!1):m.attachEvent("scroll",g)}function e(m){document.body?m():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),m()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),m())})}function i(m){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(m)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function s(m,g){m.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+g+";"}function n(m){var g=m.g.offsetWidth,y=g+100;return m.j.style.width=y+"px",m.i.scrollLeft=y,m.h.scrollLeft=m.h.scrollWidth+100,m.l!==g?(m.l=g,!0):!1}function o(m,g){function y(){var b=x;n(b)&&b.g.parentNode!==null&&g(b.l)}var x=m;t(m.h,y),t(m.i,y),n(m)}function a(m,g,y){g=g||{},y=y||window,this.family=m,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var h=null,l=null,c=null,u=null;function d(m){return l===null&&(f(m)&&/Apple/.test(window.navigator.vendor)?(m=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!m&&603>parseInt(m[1],10)):l=!1),l}function f(m){return u===null&&(u=!!m.document.fonts),u}function p(m,g){var y=m.style,x=m.weight;if(c===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}c=b.style.font!==""}return[y,x,c?m.stretch:"","100px",g].join(" ")}a.prototype.load=function(m,g){var y=this,x=m||"BESbswy",b=0,v=g||3e3,w=new Date().getTime();return new Promise(function(S,C){if(f(y.context)&&!d(y.context)){var I=new Promise(function(L,G){function N(){new Date().getTime()-w>=v?G(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(p(y,'"'+y.family+'"'),x).then(function(A){1<=A.length?L():setTimeout(N,25)},G)}N()}),M=new Promise(function(L,G){b=setTimeout(function(){G(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([M,I]).then(function(){clearTimeout(b),S(y)},C)}else e(function(){function L(){var V;(V=Z!=-1&&K!=-1||Z!=-1&&H!=-1||K!=-1&&H!=-1)&&((V=Z!=K&&Z!=H&&K!=H)||(h===null&&(V=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!V&&(536>parseInt(V[1],10)||parseInt(V[1],10)===536&&11>=parseInt(V[2],10))),V=h&&(Z==j&&K==j&&H==j||Z==B&&K==B&&H==B||Z==k&&K==k&&H==k)),V=!V),V&&(F.parentNode!==null&&F.parentNode.removeChild(F),clearTimeout(b),S(y))}function G(){if(new Date().getTime()-w>=v)F.parentNode!==null&&F.parentNode.removeChild(F),C(Error(""+v+"ms timeout exceeded"));else{var V=y.context.document.hidden;(V===!0||V===void 0)&&(Z=N.g.offsetWidth,K=A.g.offsetWidth,H=D.g.offsetWidth,L()),b=setTimeout(G,50)}}var N=new i(x),A=new i(x),D=new i(x),Z=-1,K=-1,H=-1,j=-1,B=-1,k=-1,F=document.createElement("div");F.dir="ltr",s(N,p(y,"sans-serif")),s(A,p(y,"serif")),s(D,p(y,"monospace")),F.appendChild(N.g),F.appendChild(A.g),F.appendChild(D.g),y.context.document.body.appendChild(F),j=N.g.offsetWidth,B=A.g.offsetWidth,k=D.g.offsetWidth,G(),o(N,function(V){Z=V,L()}),s(N,p(y,'"'+y.family+'",sans-serif')),o(A,function(V){K=V,L()}),s(A,p(y,'"'+y.family+'",serif')),o(D,function(V){H=V,L()}),s(D,p(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(ub);var hM=ub.exports;const lM=Ws(hM),db={inter:{fontFamily:"InterVariable",fontSize:16,lineHeight:20,fill:16777215}},fb={resolution:4,chars:fi.ASCII},pb="sans-serif",mb={inter:fM(db.inter)};let Nd=!1;async function cM(){const r=Object.values(db);await Promise.all(r.map(t=>uM(t))),Nd=!0,tt.emit("fontsLoaded",mb)}async function uM(r){const{fontFamily:t,...e}=r,i=new lM(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${pb}`),fi.from(t,{fontFamily:pb,...e},fb);return}fi.from(t,r,fb)}function dM(){Nd=!1}async function gb(){return Nd?mb:await Ce("fontsLoaded")}function fM(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new sE(s,i)}async function zh({cullAtZoomThreshold:r=!0}={}){const{inter:t}=await gb(),e=await ab(),i=t("");r&&e.add(i);async function s(n){return i.text=n,await i}return{element:i,render:s}}const pM=["result","markdown","table","unknown"],yb={markdown:"ArtifactMarkdown",table:"ArtifactTable",result:"ArtifactResult",unknown:"Artifact"},kd=["flow-run","task-run"];function mM(r){return kd.includes(r)}function jh(r){return kd.includes(r.kind)}function bb(r){return r.kind==="artifact"}function xb(r){return r.kind==="artifacts"}function _b(r){return r.kind==="state"}function vb(r){return r.kind==="event"}function wb(r){return r.kind==="events"}const gM=["COMPLETED","RUNNING","SCHEDULED","PENDING","FAILED","CANCELLED","CANCELLING","CRASHED","PAUSED"];async function Tb({cullAtZoomThreshold:r}){const t=await Lt(),e=new Ct,i=new Ct,{element:s,render:n}=await aM({cullAtZoomThreshold:r}),{element:o,render:a}=await zh({cullAtZoomThreshold:r}),{element:h,render:l}=await rM();let c=!1,u=null,d=null;i.addChild(s),i.addChild(o),e.addChild(h),e.addChild(i);async function f(y){if(y){const{selected:x,name:b,type:v}=y;c=x??c,u=b??u,d=v??d}return await Promise.all([p(),m()]),await g(),e}async function p(){if(!d)return s;const y=yb[d],{artifactIconSize:x,artifactIconColor:b,artifactPaddingLeft:v,artifactPaddingY:w}=t.styles,S=await n(y);return S.position={x:v,y:w},S.width=x,S.height=x,S.tint=b,S}async function m(){if(!u)return o.visible=!1,o;await a(u);const{artifactPaddingLeft:y,artifactPaddingY:x,artifactTextColor:b,artifactIconSize:v,artifactContentGap:w}=t.styles,S=y+v+w,C=x;return o.tint=b,o.scale.set(.75),o.position={x:S,y:C},o.visible=!0,o}async function g(){const{artifactPaddingLeft:y,artifactPaddingRight:x,artifactPaddingY:b}=t.styles,v={selected:c,width:i.width+y+x,height:i.height+b*2};return await l(v)}return{element:e,render:f}}let Kt=null,Jh=!1;async function yM(){const r=await te();r.on("click",()=>Xi(null)),r.on("drag-start",()=>{Jh=!0}),r.on("drag-end",()=>{setTimeout(()=>{Jh=!1})})}function bM(){Kt=null,Jh=!1}function Xi(r){if(!Jh&&!(!r&&!Kt||r&&gr(r))){if(Kt=r,r===null){tt.emit("itemSelected",null);return}tt.emit("itemSelected",r)}}function gr(r){if(Kt===null)return!1;const{kind:t}=r;switch(t){case"task-run":return jh(Kt)&&Kt.id===r.id;case"flow-run":return jh(Kt)&&Kt.id===r.id;case"artifact":return bb(Kt)&&Kt.id===r.id;case"artifacts":return xb(Kt)&&Kt.ids.length===r.ids.length&&Kt.ids.every(i=>r.ids.includes(i));case"state":return _b(Kt)&&Kt.id===r.id;case"event":return vb(Kt)&&Kt.id===r.id;case"events":return wb(Kt)&&Kt.ids.length===r.ids.length&&Kt.ids.every(i=>r.ids.includes(i));default:const e=t;throw new Error(`switch does not have case for value: ${e}`)}}function xM(){return Kt&&jh(Kt)?Kt:null}async function Dd(r,{cullAtZoomThreshold:t=!0,enableLocalClickHandling:e=!1}={}){const{element:i,render:s}=await Tb({cullAtZoomThreshold:t});let n=!1;i.eventMode="static",i.cursor="pointer",e&&i.on("click",c=>{c.stopPropagation(),Xi({kind:"artifact",id:r.id})}),tt.on("itemSelected",()=>{const c=gr({kind:"artifact",id:r.id});c!==n&&(n=c,o())});async function o(){await s({selected:n,name:r.key,type:r.type})}function a(){return n}function h(){return r.created}function l(){return r.id}return{element:i,render:o,getSelected:a,getDate:h,getId:l}}async function Sb(r,t){const e=await Wi(),i=await Lt();let s,n=null;async function o(){try{n=await i.fetchEvents(z.toValue(r)),t(n)}catch(h){console.error(h)}e.end_time||(s=setTimeout(()=>o(),i.fetchEventsInterval))}function a(){clearTimeout(s)}return{start:o,stop:a}}async function _M(){const r=await Lt(),t=await ab(),e=new Ct,{element:i,render:s}=await lb(),{element:n,render:o}=await Gd(),{element:a,render:h}=await Fd();t.add(e);let l=!1;e.eventMode="static",e.cursor="pointer",e.addChild(n),e.addChild(i),e.addChild(a),e.on("mouseover",u),e.on("mouseout",d);async function c({inside:f,isOpen:p}){l=f;const m={size:10,stroke:2,rotate:p?Kh.Up:Kh.Down},g=await s(m),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:r.styles.nodeToggleBgColor,radius:r.styles.nodeToggleBorderRadius},x=await o(y);x.alpha=f?0:.5;const b=await h({width:y.width,height:y.height,radius:y.radius,stroke:1,color:r.styles.nodeToggleBorderColor});b.alpha=f?0:1;const v={y:x.height/2,x:x.width/2},w=m.size/4;return g.x=v.x,g.y=p?v.y+w:v.y-w,e}function u(){n.alpha=l?.5:1}function d(){n.alpha=l?0:.5}return{element:e,render:c}}async function Eb(){const r=await Lt(),t=await ee(),e=new Ct,{element:i,render:s}=await Gd(),{element:n,render:o}=await Yh();e.addChild(i),e.addChild(n);async function a(l){const{background:c="#fff"}=r.styles.node(l),{nodeHeight:u,nodeRadius:d}=r.styles,f=gr({kind:l.kind,id:l.id}),p=h(l,d),m=l.state_type!=="RUNNING"||t.isDependency();return await Promise.all([s({width:p,height:u,radius:d,background:c,capRight:m}),o({selected:f,width:p,height:u})]),i}function h(l,c){const u=Bd();if(it.isTemporal()||it.isLeftAligned()){const d=l.start_time,f=l.end_time??new Date,m=Lf(f,d)/aa*u;return Math.max(m,c*2)}return u}return{element:e,render:a}}var Cb="Expected a function",Ib=NaN,vM="[object Symbol]",wM=/^\s+|\s+$/g,TM=/^[-+]0x[0-9a-f]+$/i,SM=/^0b[01]+$/i,EM=/^0o[0-7]+$/i,CM=parseInt,IM=typeof ve=="object"&&ve&&ve.Object===Object&&ve,AM=typeof self=="object"&&self&&self.Object===Object&&self,MM=IM||AM||Function("return this")(),RM=Object.prototype,PM=RM.toString,LM=Math.max,GM=Math.min,Od=function(){return MM.Date.now()};function FM(r,t,e){var i,s,n,o,a,h,l=0,c=!1,u=!1,d=!0;if(typeof r!="function")throw new TypeError(Cb);t=Ab(t)||0,$h(e)&&(c=!!e.leading,u="maxWait"in e,n=u?LM(Ab(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function f(S){var C=i,I=s;return i=s=void 0,l=S,o=r.apply(I,C),o}function p(S){return l=S,a=setTimeout(y,t),c?f(S):o}function m(S){var C=S-h,I=S-l,M=t-C;return u?GM(M,n-I):M}function g(S){var C=S-h,I=S-l;return h===void 0||C>=t||C<0||u&&I>=n}function y(){var S=Od();if(g(S))return x(S);a=setTimeout(y,m(S))}function x(S){return a=void 0,d&&i?f(S):(i=s=void 0,o)}function b(){a!==void 0&&clearTimeout(a),l=0,i=h=s=a=void 0}function v(){return a===void 0?o:x(Od())}function w(){var S=Od(),C=g(S);if(i=arguments,s=this,h=S,C){if(a===void 0)return p(h);if(u)return a=setTimeout(y,t),f(h)}return a===void 0&&(a=setTimeout(y,t)),o}return w.cancel=b,w.flush=v,w}function NM(r,t,e){var i=!0,s=!0;if(typeof r!="function")throw new TypeError(Cb);return $h(e)&&(i="leading"in e?!!e.leading:i,s="trailing"in e?!!e.trailing:s),FM(r,t,{leading:i,maxWait:t,trailing:s})}function $h(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function kM(r){return!!r&&typeof r=="object"}function DM(r){return typeof r=="symbol"||kM(r)&&PM.call(r)==vM}function Ab(r){if(typeof r=="number")return r;if(DM(r))return Ib;if($h(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=$h(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(wM,"");var e=SM.test(r);return e||EM.test(r)?CM(r.slice(2),e?2:8):TM.test(r)?Ib:+r}var OM=NM;const Mb=Ws(OM);async function Rb(){const{element:r,render:t}=await Tb({cullAtZoomThreshold:!1});let e=null,i=[],s=!1;r.eventMode="static",r.cursor="pointer",tt.on("itemSelected",()=>{const l=gr({kind:"artifacts",ids:i});l!==s&&e&&(s=l,n({ids:i,date:e}))});async function n(l){if(!l){e=null,i=[],r.visible=!1;return}const{ids:c,date:u}=l;e=u,i=c,await t({selected:s,type:"unknown",name:c.length.toString()}),r.visible=!0}function o(){return s}function a(){return e}function h(){return i}return{element:r,render:n,getSelected:o,getDate:a,getIds:h,isCluster:!0}}async function BM(){const r=await Qt(),t=await Wi(),e=await ee(),{element:i,render:s,update:n}=await Vb({isRoot:!0});i.zIndex=4;function o(a){if(it.isTemporal()&&!e.disableArtifacts){r.stage.addChild(i),s(a==null?void 0:a.artifacts);return}r.stage.removeChild(i)}t.artifacts&&o(t),tt.on("viewportMoved",()=>n()),tt.on("runDataCreated",a=>o(a)),tt.on("runDataUpdated",a=>o(a)),tt.on("configUpdated",()=>o()),tt.on("layoutSettingsUpdated",()=>o())}function _P(){}async function UM({radius:r}){const t=await Qt(),e=new ln;return e.beginFill("#fff"),e.drawCircle(0,0,r),e.endFill(),t.renderer.generateTexture(e,{resolution:10})}async function XM(r){return await Do(UM,[r])}async function Pb(r){const t=await XM(r);return new $t(t)}async function Lb(r){const t=new Ct,e=await Lt(),i=await mr(),s=await Pb({radius:e.styles.eventRadiusDefault}),{element:n,render:o}=await Yh();let a=!1;t.addChild(i),t.addChild(s),t.addChild(n),t.eventMode="static",t.cursor="pointer",t.on("mouseenter",()=>{a||s.scale.set(1.5)}),t.on("mouseleave",()=>{a||s.scale.set(1)}),tt.on("itemSelected",()=>{const u=gr({kind:"event",id:r.id,occurred:r.occurred});u!==a&&(a=u,s.scale.set(u?1.5:1),h())});function h(){const{eventColor:u,eventTargetSize:d,eventSelectedBorderInset:f}=e.styles;i.alpha=0,i.width=d,i.height=d,s.tint=u,s.anchor.set(.5),s.position.set(d/2,d/2),n.position.set(f,f),o({selected:a,width:d-f*2,height:d-f*2})}function l(){return r.id}function c(){return r.occurred}return{element:t,render:h,getId:l,getDate:c}}async function Gb(){const r=new Ct,t=await Lt(),e=await mr(),i=await Pb({radius:t.styles.eventClusterRadiusDefault}),{element:s,render:n}=await Yh(),{element:o,render:a}=await zh({cullAtZoomThreshold:!1});let h=null,l=[],c=!1;r.addChild(e),r.addChild(i),r.addChild(o),r.addChild(s),r.eventMode="static",r.cursor="pointer",r.on("mouseenter",()=>{c||i.scale.set(1.5)}),r.on("mouseleave",()=>{c||i.scale.set(1)}),tt.on("itemSelected",()=>{const x=gr({kind:"events",occurred:h,ids:l});x!==c&&(c=x,i.scale.set(x?1.5:1),h&&u({ids:l,date:h}))});async function u(x){if(!x){h=null,l=[],r.visible=!1;return}const{ids:b,date:v}=x;h=v,l=b,d(),f(),m(),await p(b.length.toString()),r.visible=!0}function d(){const{eventTargetSize:x}=t.styles;e.alpha=0,e.width=x,e.height=x}function f(){const{eventClusterColor:x,eventTargetSize:b}=t.styles;i.tint=x,i.anchor.set(.5),i.position.set(b/2,b/2)}async function p(x){if(l.length<2)return;const{eventTargetSize:b}=t.styles,v=-1;o.scale.set(.6),o.anchor.set(.5),o.position.set(b/2,b/2+v),await a(x)}function m(){const{eventSelectedBorderInset:x,eventTargetSize:b}=t.styles;s.position.set(x,x),n({selected:c,width:b-x*2,height:b-x*2})}function g(){return l}function y(){return h}return{element:r,render:u,getIds:g,getDate:y}}function Vr(r){return"getIds"in r}async function Fb({items:r,createCluster:t}){const e=[...r.values()].sort((o,a)=>o.element.x-a.element.x);async function i(o){let a,h=null,l=null;for(let c=o??0;c<e.length;c++){const u=e[c],d=u.element.x;if(u.element.visible=!0,h!==null&&a&&d<a){l=c;break}h=c,a=d+u.element.width}if(l!==null&&h!==null){const c=e[h],u=e[l];c.element.visible=!1,u.element.visible=!1;const d=await s(c,u);d&&(e.splice(h,1,d),e.splice(l,1)),i(h)}}async function s(o,a){const h=o.getDate(),l=a.getDate(),c=Vr(o)?o.getIds():[o.getId()],u=Vr(a)?a.getIds():[a.getId()];if(!h||!l)return console.error("flowRunArtifacts: visible item is missing date"),null;let d;Vr(o)?d=o:Vr(a)?d=a:d=await t();const f=[...c,...u],p=n(f);return await d.render({ids:f,date:p}),d}function n(o){const a=o.reduce((c,u)=>{const d=r.get(u),f=d==null?void 0:d.getDate();return f&&c.push(f.getTime()),c},[]),h=Math.min(...a),l=Math.max(...a);return new Date((h+l)/2)}await i()}async function Nb(r){const t=await Qt(),e=await te(),i=await Lt(),s=await ee();let n=await ii();const o=await h();o.element.on("click",c=>{c.stopPropagation();const{element:u}=o,d={x:u.position.x,y:u.position.y,width:u.width,height:u.height},f=Vr(o)?{kind:"events",ids:o.getIds(),occurred:o.getDate(),position:d}:{kind:"event",id:o.getId(),occurred:o.getDate(),position:d};Xi(f)}),tt.on("scaleUpdated",c=>{n=c,l()}),tt.on("viewportMoved",()=>l());async function a(c){await o.render(c),l()}async function h(){return r.type==="event"?await Lb(r.event):await Gb()}function l(){const c=o.getDate();if(!c||s.disableEvents||!it.isTemporal())return;const{element:u}=o,f=n(c)*e.scale._x+e.worldTransform.tx-u.width/2,p=t.screen.height-u.height-i.styles.eventBottomMargin;u.position.set(f,p)}return{...o,render:a}}async function kb(r){const t=await te(),e=await ee();let i=await ii();const s=await o();s.element.on("click",h=>{h.stopPropagation();const{element:l}=s,c=l.getGlobalPosition(),u={x:c.x,y:c.y,width:l.width*t.scale.x,height:l.height*t.scale.y},d=Vr(s)?{kind:"events",ids:s.getIds(),occurred:s.getDate(),position:u}:{kind:"event",id:s.getId(),occurred:s.getDate(),position:u};Xi(d)}),tt.on("scaleUpdated",h=>{i=h,a()});async function n(h){await s.render(h),a()}async function o(){return r.type==="event"?await Lb(r.event):await Gb()}function a(){const h=s.getDate(),{parentStartDate:l}=r;if(!h||e.disableEvents||!it.isTemporal()||!l)return;const{element:c}=s,d=i(h)-i(l)-c.width/2,f=-c.height;c.position.set(d,f)}return{...s,render:n}}async function Db({isRoot:r,parentStartDate:t}={}){const e=await ee(),i=new Map,s=new Map,n=[];let o=[];const a=new Ct;let h=null;tt.on("scaleUpdated",()=>u());async function l(p){if(p&&(h=p),!h)return;const m=[];for(const g of h)m.push(c(g));await Promise.all(m),u()}async function c(p){if(i.has(p.id))return i.get(p.id).render();if(s.has(p.id))return await s.get(p.id);const m=(async()=>{const g=r?await Nb({type:"event",event:p}):await kb({type:"event",event:p,parentStartDate:t});i.set(p.id,g),a.addChild(g.element)})();return s.set(p.id,m),await m,s.delete(p.id),i.get(p.id).render()}function u(){e.disableEvents||!it.isTemporal()||d()}const d=Mb(async()=>{o=[...n],await Fb({items:i,createCluster:f});for(const p of o)p.render()},250);async function f(){if(o.length>0)return o.pop();const p=r?await Nb({type:"cluster"}):await kb({type:"cluster",parentStartDate:t});return a.addChild(p.element),n.push(p),p}return{element:a,render:l,update:u}}let Bo=null,Mn=null;async function WM(){const r=await Qt(),t=await Lt(),e=await ee(),i=await Wi(),{element:s,render:n,update:o}=await Db({isRoot:!0});s.zIndex=2;async function a(l){if(!it.isTemporal()||e.disableEvents){r.stage.removeChild(s);return}r.stage.addChild(s),await n(l)}const h=await Sb(()=>({nodeId:t.runId,since:i.start_time,until:i.end_time??new Date}),l=>{const c=Mn?"eventDataUpdated":"eventDataCreated";Mn=l,tt.emit(c,Mn),a(l)});tt.on("configUpdated",()=>a()),tt.on("viewportMoved",()=>o()),tt.on("layoutSettingsUpdated",()=>a()),Bo=h.stop,h.start()}function ZM(){Bo==null||Bo(),Bo=null,Mn=null}async function VM(){return Mn||await Ce("eventDataCreated")}async function HM(r){const t=await Qt(),e=await te(),i=await Lt(),s=await Wi();let n=await ii();const o=new Ct,a=await mr(),h=await mr();let l=null,c=!1,u=!1;t.stage.addChild(h),o.addChild(a),a.eventMode="static",a.cursor="pointer",a.on("mouseover",()=>{c=!0,d()}),a.on("mouseleave",()=>{c=!1,d()}),a.on("click",()=>{const b={x:a.position.x,y:a.position.y,width:a.width,height:a.height};Xi({...r,kind:"state",position:b})}),tt.on("viewportMoved",()=>d()),tt.on("scaleUpdated",b=>{n=b,d()}),tt.on("itemSelected",()=>{const b=gr({kind:"state",...r});b!==u&&(u=b,c=!1,d())}),r.type==="RUNNING"&&!s.end_time&&g();function d(b){const{end:v}=b??{};if(v&&(l=v),s.end_time&&y(),!it.isTemporal()){h.visible=!1,o.visible=!1;return}const w=f();p(w),m(w),h.visible=!0,o.visible=!0}function f(){const{background:b="#fff"}=i.styles.state(r),v=Math.max(n(r.timestamp)*e.scale._x+e.worldTransform.tx,0);let w=0;return r.type==="RUNNING"&&!s.end_time?w=n(new Date)*e.scale._x+e.worldTransform.tx-v:l?w=n(l)*e.scale._x+e.worldTransform.tx-v:w=t.screen.width-v,{x:v,width:Math.max(w,0),background:b}}function p({x:b,width:v,background:w}){const{flowStateBarHeight:S,flowStateSelectedBarHeight:C}=i.styles,I=c||u?C:S;a.x=b,a.y=t.screen.height-I,a.width=v,a.height=I,a.tint=w}function m({x:b,width:v,background:w}){if(r.type==="RUNNING"){h.visible=!1;return}const{flowStateBarHeight:S,flowStateAreaAlpha:C}=i.styles;h.x=b,h.y=0,h.width=v,h.height=t.screen.height-S,h.tint=w,h.alpha=C}function g(){t.ticker.add(x)}function y(){t.ticker.remove(x)}function x(){d()}return{element:o,render:d}}function KM(r){return"isNodesFlowRunStateFactory"in r}async function YM(r){const t=await Qt(),e=await te(),i=await Lt(),s=await Wi();let n=await ii();const o=new Ct,a=await mr(),h=await mr();let l=null,c=null,u=0,d=0,f=!1,p=!1;o.visible=!1,o.addChild(h),o.addChild(a),a.eventMode="static",a.cursor="pointer",a.on("mouseover",()=>{f=!0,m()}),a.on("mouseleave",()=>{f=!1,m()}),a.on("click",S=>{S.stopPropagation();const C=a.getGlobalPosition(),I={x:C.x,y:C.y,width:a.width*e.scale.x,height:a.height*e.scale.y};Xi({...r,kind:"state",position:I})}),h.eventMode="none",h.cursor="default",tt.on("scaleUpdated",S=>{n=S,m()}),tt.on("itemSelected",()=>{const S=gr({kind:"state",...r});S!==p&&(p=S,f=!1,m())}),r.type==="RUNNING"&&!s.end_time&&b();function m(S){const{end:C,parentStartDate:I,width:M,height:L}=S??{};if(C&&(l=C),I&&(c=I),M&&(u=M),L&&(d=L),s.end_time&&v(),!it.isTemporal()){o.visible=!1;return}if(!c||u<=0){o.visible=!1;return}const G=g();if(G.width<=0){o.visible=!1;return}y(G),x(G),o.visible=!0}function g(){const{background:S="#fff"}=i.styles.state(r);if(!c)return{x:0,width:0,background:S};const C=n(c);let I=n(r.timestamp)-C;if(I>=u)return{x:u,width:0,background:S};I<0&&(I=0);let M=n(l??new Date)-C;M>u&&(M=u);const L=Math.max(M-I,0);return{x:I,width:L,background:S}}function y({x:S,width:C,background:I}){const{flowStateBarHeight:M,flowStateSelectedBarHeight:L}=i.styles,G=f||p?L:M;a.x=S,a.y=d-G,a.width=C,a.height=G,a.tint=I}function x({x:S,width:C,background:I}){const{flowStateBarHeight:M,flowStateAreaAlpha:L,nodeHeight:G}=i.styles,N=G/2;h.x=S,h.y=N,h.width=C,h.height=d-M-N,h.tint=I,h.alpha=L}function b(){t.ticker.add(w)}function v(){t.ticker.remove(w)}function w(){m()}return{element:o,render:m,isNodesFlowRunStateFactory:!0}}function Ob({isRoot:r}={}){const t=new Ct,e=new Map,i=new Map;let s=null;async function n(a,h){if(a&&(s=a),!s)return;const l=[];for(let c=0;c<s.length;c++)l.push(o(s[c],c,h));await Promise.all(l)}async function o(a,h,l){const c=s&&s.length>=h+1&&s[h+1],u=c?c.timestamp:void 0;let d;if(i.has(a.id)&&await i.get(a.id),e.has(a.id))d=e.get(a.id);else{const f=(async()=>{const p=r?await HM(a):await YM(a);e.set(a.id,p),t.addChild(p.element)})();i.set(a.id,f),await f,i.delete(a.id),d=e.get(a.id)}KM(d)?await d.render({end:u,...l}):await d.render(u?{end:u}:void 0)}return{element:t,render:n}}async function zM(){const r=await Qt(),t=await Wi(),{element:e,render:i}=await Ob({isRoot:!0});e.zIndex=3,r.stage.addChild(e);function s(n){i(n==null?void 0:n.states)}t.states&&s(t),tt.on("runDataUpdated",n=>s(n)),tt.on("configUpdated",()=>s()),tt.on("layoutSettingsUpdated",()=>s())}function vP(){}async function jM(){const r=await Qt(),t=await te(),e=await ee(),i=await Lt(),{inter:s}=await gb(),n=new Ct,o=await mr();n.addChild(o);const a=s("");n.addChild(a);let h=await ii(),l,c;tt.on("scaleUpdated",m=>{h=m,p()}),tt.on("viewportMoved",()=>{e.disableGuides||(p(),n.height!==r.screen.height&&d())});function u(m,g){l=m,c=g,d(),f(m)}function d(){o.width=i.styles.guideLineWidth,o.height=r.screen.height,o.tint=i.styles.guideLineColor}function f(m){a.text=c(m),a.fontSize=i.styles.guideTextSize,a.tint=i.styles.guideTextColor,a.position.set(i.styles.guideTextLeftPadding,i.styles.guideTextTopPadding)}function p(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:u}}class Bb extends Error{constructor(){super("Layout is not temporal")}}function JM(r){return r.toLocaleTimeString()}function Ub(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function $M(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function QM(r){return r.getHours()===0&&r.getMinutes()===0?`${Qh.date(r)}
|
|
1176
|
-
${Ub(r)}`:Ub(r)}const Qh={timeBySeconds:JM,timeByMinutesWithDates:QM,date:$M},ne={seconds:"seconds",minutes:"minutes",date:"date"},Uo={day:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.getTime()},week:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.setDate(r.getDate()-r.getDay()+1),t.getTime()}},At={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},Xb=[{ceiling:At.second*4,increment:At.second,labelFormat:ne.seconds},{ceiling:At.second*8,increment:At.second*5,labelFormat:ne.seconds},{ceiling:At.second*13,increment:At.second*10,labelFormat:ne.seconds},{ceiling:At.second*20,increment:At.second*15,labelFormat:ne.seconds},{ceiling:At.second*45,increment:At.second*30,labelFormat:ne.seconds},{ceiling:At.minute*4,increment:At.minute,labelFormat:ne.minutes},{ceiling:At.minute*8,increment:At.minute*5,labelFormat:ne.minutes},{ceiling:At.minute*13,increment:At.minute*10,labelFormat:ne.minutes},{ceiling:At.minute*28,increment:At.minute*15,labelFormat:ne.minutes},{ceiling:At.hour*1.24,increment:At.minute*30,labelFormat:ne.minutes},{ceiling:At.hour*3,increment:At.hour,labelFormat:ne.minutes},{ceiling:At.hour*8,increment:At.hour*2,getAnchor:Uo.day,labelFormat:ne.minutes},{ceiling:At.hour*13,increment:At.hour*6,getAnchor:Uo.day,labelFormat:ne.minutes},{ceiling:At.hour*22,increment:At.hour*12,getAnchor:Uo.day,labelFormat:ne.minutes},{ceiling:At.day*4,increment:At.day,getAnchor:Uo.day,labelFormat:ne.date},{ceiling:At.week*2,increment:At.week,getAnchor:Uo.week,labelFormat:ne.date},{ceiling:1/0,increment:At.week*4,labelFormat:ne.date}],qM=300;async function tR(){const r=await te(),t=await ee(),e=new Ct,i=new Map;let s=await ii();tt.on("scaleUpdated",d=>s=d),await o();function n(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:f,labelFormat:p}=a(),m=u(d,f);c(m,p)}catch(d){if(d instanceof Bb)return;console.error(d)}}async function o(){const d=[];Ld(30,async f=>{const p=jM();d.push(p);const m=await p;e.addChild(m.element),i.set(f,m)}),await Promise.all(d)}function a(){const d=r.left-qM,f=s.invert(d),p=s.invert(d+260/r.scale.x);if(!(f instanceof Date)||!(p instanceof Date))throw new Bb;const m=p.getTime()-f.getTime(),{increment:g,getAnchor:y,labelFormat:x}=h(m);return{anchor:y(f),increment:g,labelFormat:l(x)}}function h(d){const f=Xb.find(p=>p.ceiling>d)??Xb[0];return f.getAnchor||(f.getAnchor=p=>Math.floor(p.getTime()/f.increment)*f.increment),f}function l(d){switch(d){case ne.minutes:return Qh.timeByMinutesWithDates;case ne.date:return Qh.date;default:return Qh.timeBySeconds}}function c(d,f){const p=new Map(i.entries()),m=Array.from(p.keys()).filter(g=>!d.includes(g));i.clear();for(const g of d){if(p.has(g)){const x=p.get(g);i.set(g,x),x.render(new Date(g),f);continue}const y=p.get(m.pop()??-1);if(y===void 0){console.warn("Guides: No unused guides available to render.");continue}y.render(new Date(g),f),i.set(g,y)}}function u(d,f){return Ld(30,p=>d+f*p)}return{element:e,render:n}}async function eR(){const r=await Qt(),{element:t,render:e}=await tR();r.stage.addChild(t),e(),tt.on("viewportDateRangeUpdated",()=>e()),tt.on("layoutSettingsUpdated",()=>e()),tt.on("configUpdated",()=>e())}function wP(){}const iR=80;async function rR(){const r=await Qt(),t=await te(),e=await ee(),i=await Lt(),s=await mr();let n=await ii();tt.on("scaleUpdated",h=>n=h);function o(){if(!e.isTemporal()){s.visible=!1;return}s.width=i.styles.playheadWidth,s.height=r.stage.height,s.tint=i.styles.playheadColor,s.position.x=n(new Date)*t.scale.x+t.worldTransform.tx,a()}function a(){if(t.moving||!(s.position.x>0&&s.position.x<r.screen.width)||!(s.position.x>r.screen.width-iR))return;const c=t.left;t.zoomPercent(-.1,!0),t.left=c}return{element:s,render:o}}async function sR(){const r=await Qt(),t=await Wi(),{element:e,render:i}=await rR();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),tt.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function TP(){}function nR({stage:r,props:t}){cE(),FA(),LA(),eR(),pR(),BM(),WM(),zM(),sR(),gE(),cM(),hE(r),_E(t),WA(),_R(),yM()}function oR(){tt.clear();try{uE(),NA(),GA(),lE(),mR(),ZM(),vE(),yE(),dM(),ZA(),vR(),bM(),YA()}catch(r){console.error(r)}}async function Wb(r){const t=await Qt(),e=await te(),i=await Lt(),s=await ee(),n=await VM();let o=await ii(),a=n&&n.length>0;const h=await c();h.element.on("click",d=>{d.stopPropagation();const{element:f}=h,p=f.getGlobalPosition(),m={x:p.x,y:p.y,width:f.width,height:f.height},g=Vr(h)?{kind:"artifacts",ids:h.getIds(),position:m}:{kind:"artifact",id:h.getId()};Xi(g)}),tt.on("scaleUpdated",d=>{o=d,u()}),tt.on("viewportMoved",()=>u()),tt.on("eventDataCreated",d=>{a=d.length>0,u()}),tt.on("eventDataUpdated",d=>{a=d.length>0,u()});async function l(d){await h.render(d),u()}async function c(){return r.type==="artifact"?await Dd(r.artifact,{cullAtZoomThreshold:!1}):await Rb()}function u(){const d=h.getDate();if(!d||!it.isTemporal()||s.disableArtifacts)return;const f=h.getSelected(),{element:p}=h,{eventTargetSize:m,flowStateSelectedBarHeight:g}=i.styles;let y=0;if(f){const{selectedBorderOffset:S,selectedBorderWidth:C}=i.styles;y=S+C*2}const b=o(d)*e.scale._x+e.worldTransform.tx-(p.width-y)/2,v=a&&!s.disableEvents?m:g,w=t.screen.height-(p.height-y)-v;p.position.set(b,w)}return{...h,render:l}}async function Zb(r){const t=await te(),e=await Lt(),i=await ee();let s=await ii();const n=await a();n.element.on("click",l=>{console.log("artifact click"),l.stopPropagation();const{element:c}=n,u=c.getGlobalPosition(),d={x:u.x,y:u.y,width:c.width*t.scale.x,height:c.height*t.scale.y},f=Vr(n)?{kind:"artifacts",ids:n.getIds(),position:d}:{kind:"artifact",id:n.getId()};Xi(f)}),tt.on("scaleUpdated",l=>{s=l,h()});async function o(l){await n.render(l),h()}async function a(){return r.type==="artifact"?await Dd(r.artifact):await Rb()}function h(){const l=n.getDate(),{parentStartDate:c}=r;if(!l||!it.isTemporal()||i.disableArtifacts||!c)return;const u=n.getSelected(),{element:d}=n;let f=0;if(u){const{selectedBorderOffset:y,selectedBorderWidth:x}=e.styles;f=y+x*2}const m=s(l)-s(c)-(d.width-f)/2,g=-(d.height-f);d.position.set(m,g)}return{...n,render:o}}async function Vb({isRoot:r,parentStartDate:t}={}){const e=await ee(),i=new Map,s=new Map,n=[];let o=[];const a=new Ct;let h=null;async function l(p){if(p&&(h=p),!h)return;const m=[];for(const g of h)m.push(c(g));await Promise.all(m),u()}async function c(p){if(i.has(p.id))return i.get(p.id).render();s.has(p.id)&&await s.get(p.id);const m=(async()=>{const g=r?await Wb({type:"artifact",artifact:p}):await Zb({type:"artifact",artifact:p,parentStartDate:t});i.set(p.id,g),a.addChild(g.element)})();return s.set(p.id,m),await m,s.delete(p.id),i.get(p.id).render()}function u(){if(!(e.disableArtifacts||!it.isTemporal())){if(!it.isTemporal()){a.visible=!1;return}a.visible=!0,a.position.x=0,d()}}const d=Mb(async()=>{o=[...n],await Fb({items:i,createCluster:f});for(const p of o)p.render()},250);async function f(){if(o.length>0)return o.pop();const p=r?await Wb({type:"cluster"}):await Zb({type:"cluster",parentStartDate:t});return a.addChild(p.element),n.push(p),p}return{element:a,render:l,update:u}}class Hb extends Ct{updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t)this.children[t].updateTransform()}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(const t of this.children)if(t.calculateBounds(),t._mask){const e=t._mask.isMaskData?t._mask.maskObject:t._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(t._bounds,e._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds);this._bounds.updateID=this._boundsID}}async function aR(r){const t=new Hb,e=await Lt(),i=await ee(),{element:s,render:n}=await Eb(),{element:o,render:a}=await zh(),{element:h,render:l}=await _M(),{element:c,render:u}=await Fd(),{element:d,render:f,getSize:p,stopWorker:m}=await jb(),{element:g,render:y}=await Ob(),{element:x,render:b,update:v}=await Db({parentStartDate:r.start_time}),{element:w,render:S,update:C}=await Vb({parentStartDate:r.start_time});let I=!1,M=!1,L=r,G=!1;t.sortableChildren=!0,c.zIndex=0,s.zIndex=4,o.zIndex=5,h.zIndex=5,d.zIndex=2,x.zIndex=1,g.zIndex=2,w.zIndex=3,c.eventMode="none",c.cursor="default";const{start:N,stop:A}=await Yg(L.id,Q=>{M=!!Q.artifacts&&Q.artifacts.length>0,f(Q),B(Q.states),F(Q.artifacts),j()}),{start:D,stop:Z}=await Sb(()=>({nodeId:L.id,since:L.start_time,until:L.end_time??new Date}),Q=>{I=Q.length>0,k(Q)});t.addChild(s),t.addChild(o),t.addChild(h),h.on("click",Q=>{Q.stopPropagation(),H()}),d.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},d.on("rendered",()=>{Vh(),Tt()});async function K(Q){return L=Q,await n(Q),await ft(),await at(),G&&(await B(),await k(),await F(),await j()),t}async function H(){G?await et():await V()}async function j(){const{background:Q="#fff"}=e.styles.node(L),{width:W,height:J}=p(),{height:$}=It(),{nodeBorderRadius:O}=e.styles,pt=2;c.position={x:-pt,y:-pt};const yt=it.isTemporal()?$+pt*2:J+pt*2;await u({width:W+pt*2,height:yt,stroke:pt,radius:[O,O,0,0],color:Q})}async function B(Q){const{height:W}=It(),{width:J}=s;await y(Q??void 0,{parentStartDate:L.start_time,width:J,height:W})}async function k(Q){if(!G||!it.isTemporal()||i.disableEvents){t.removeChild(x);return}t.addChild(x);const{height:W}=It();if(x.position={x:0,y:W-e.styles.eventBottomMargin},Q){await b(Q);return}await v()}async function F(Q){if(!G||!it.isTemporal()||i.disableArtifacts){t.removeChild(w);return}t.addChild(w);const{eventTargetSize:W,flowStateSelectedBarHeight:J}=e.styles,{height:$}=It(),O=$-(I&&!i.disableEvents?W:J);if(w.position={x:0,y:O},Q){await S(Q);return}await C()}async function V(){G=!0,t.addChild(g),t.addChild(d),t.addChild(c),await Promise.all([N(),D(),K(L)]),Tt()}async function et(){G=!1,t.removeChild(g),t.removeChild(d),t.removeChild(c),t.removeChild(x),t.removeChild(w),m(),await Promise.all([A(),Z(),K(L)]),Tt()}async function ft(){const Q=e.styles.nodeToggleSize,W=e.styles.nodeHeight-Q,J=s.width>Q,$=await l({inside:J,isOpen:G});return $.x=J?W/2:s.width+e.styles.nodePadding,$.y=W/2,$}async function at(){const Q=await a(L.label),W=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,J=e.styles.nodePadding,$=h.x+h.width+J,O=s.width+J,pt=s.width>$+Q.width+J,yt=e.styles.nodeHeight/2-Q.height/2,Rt=pt?$:Math.max(O,$);return Q.position={x:Rt,y:yt},Q.tint=pt?W:e.styles.textDefault,Q}function Tt(){G&&(B(),k(),F(),j());const Q=It();t.emit("resized",Q)}function It(){const Q=p(),{nodeHeight:W,nodesPadding:J,eventTargetSize:$,eventBottomMargin:O,artifactPaddingY:pt,artifactIconSize:yt}=e.styles,Ot=M&&it.isTemporal()&&!i.disableArtifacts?yt+pt*2:0,Ze=I&&it.isTemporal()&&!i.disableEvents?$+O:0,Wo=G?Q.height+Ot+Ze+J*2:0,Kr=G?Q.width:0;return{height:W+Wo,width:Math.max(Kr,t.width)}}return{kind:"flow-run",element:t,bar:s,render:K}}async function hR(){const r=await Lt(),t=new Hb,{element:e,render:i}=await zh(),{element:s,render:n}=await Eb();t.addChild(s),t.addChild(e);async function o(h){return await Promise.all([n(h),i(h.label)]),a(),t}function a(){const h=r.styles.colorMode==="dark"?r.styles.textDefault:r.styles.textInverse,l=r.styles.nodePadding,c=s.width>l+e.width+l,u=c?l:s.width+l,d=r.styles.nodeHeight/2-e.height/2;e.position={x:u,y:d},e.tint=c?h:r.styles.textDefault}return{kind:"task-run",element:t,render:o,bar:s}}async function lR(r){const t=await Lt(),e=await Qt(),i=await ob(),s=await ee();let n=null;const o=new Map,{animate:a}=await hb(),{element:h,render:l,bar:c}=await C(r);let u=r,d=null,f=!1,p=!1;i.add(h),h.eventMode="static",h.cursor="pointer",h.name=ix,h.on("click",L=>{L.stopPropagation(),Xi({kind:u.kind,id:u.id})}),u.end_time||v(),tt.on("itemSelected",()=>{const L=gr({kind:u.kind,id:u.id});L!==f&&(f=L,l(u))});async function m(L){u=L;const G=I(L);return G===d||(d=G,await Promise.all([l(L),g(L.artifacts)]),L.end_time&&w()),h}async function g(L){if(!L||(x(),s.disableArtifacts||!it.isTemporal()))return;const G=[];for(const N of L)G.push(y(N));await Promise.all(G),b()}async function y(L){if(o.has(L.id))return o.get(L.id).render();const G=await Dd(L,{enableLocalClickHandling:!0});return o.set(L.id,G),n.addChild(G.element),G.render()}function x(){if(it.isTemporal()&&!s.disableArtifacts){n||(n=new Ct),h.addChild(n);return}n&&h.removeChild(n)}function b(){if(!n)return;const{artifactsGap:L,artifactsNodeOverlap:G}=t.styles;let N=0;for(const A of o.values())A.element.position.x=N,N+=A.element.width+L;n.position.y=-n.height+G,n.width<c.width&&(n.position.x=c.width-n.width)}function v(){e.ticker.add(S)}function w(){e.ticker.remove(S)}function S(){m(u)}async function C(L){const{kind:G}=L;switch(G){case"task-run":return await hR();case"flow-run":return await aR(L);default:const N=G;throw new Error(`switch does not have case for value: ${N}`)}}function I(L){var D;const G=L.end_time??new Date,N=((D=L.artifacts)==null?void 0:D.length)??0;return[L.state_type,G.getTime(),N,it.horizontal,it.horizontalScaleMultiplier,t.styles.colorMode,N>0&&s.disableArtifacts].join("-")}function M({x:L,y:G}){a(h,{x:L,y:G},!p),p=!0}return{element:h,render:m,bar:c,setPosition:M}}function Kb({gap:r=0,minimum:t=0}={}){const e=new Map;function i(c){const u=e.get(c)??[];return Math.max(...u.values(),z.toValue(t))+z.toValue(r)}function s(c){let u=0;for(let d=0;d<c;d++)u+=i(d);return u}function n(c){return s(c+1)-z.toValue(r)}function o({axis:c,nodeId:u,offset:d}){const f=e.get(c)??new Map;f.set(u,d),e.set(c,f)}function a({axis:c,nodeId:u}){let d,f;for(const[p,m]of e.entries())if(m.has(u)){d=p,f=m.get(u);break}d===c||d===void 0||f===void 0||(h({axis:d,nodeId:u}),o({axis:c,nodeId:u,offset:f}))}function h({axis:c,nodeId:u}){var d;(d=e.get(c))==null||d.delete(u)}function l(){e.clear()}return{getOffset:i,getTotalOffset:s,getTotalValue:n,setOffset:o,updateNodeAxis:a,removeOffset:h,clear:l}}function cR(r){throw new Error(`switch does not have case for value: ${r}`)}const Yb="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGlvbiBDbihuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjpuPGU/LTE6bj5lPzE6bj49ZT8wOk5hTn1mdW5jdGlvbiBudChuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjplPG4/LTE6ZT5uPzE6ZT49bj8wOk5hTn1mdW5jdGlvbiBSbihuKXtsZXQgZSx0LHI7bi5sZW5ndGghPT0yPyhlPUNuLHQ9KHUsbCk9PkNuKG4odSksbCkscj0odSxsKT0+bih1KS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b2x1bW4pLG8uc2V0KHUsey4uLmYseTpnLHJvdzpnfSl9RG8oe3R5cGU6ImxheW91dCIsbGF5b3V0OnttYXhSb3c6aSxtYXhDb2x1bW46YSxwb3NpdGlvbnM6b319KX19KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1ydW5HcmFwaC53b3JrZXItQzRjMjBKZ3UuanMubWFwCg==",uR=r=>Uint8Array.from(atob(r),t=>t.charCodeAt(0)),zb=typeof window<"u"&&window.Blob&&new Blob([uR(Yb)],{type:"text/javascript;charset=utf-8"});function dR(r){let t;try{if(t=zb&&(window.URL||window.webkitURL).createObjectURL(zb),!t)throw"";const e=new Worker(t,{name:r==null?void 0:r.name});return e.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+Yb,{name:r==null?void 0:r.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}function fR(r){const t=new dR;return t.onmessage=r,t}async function jb(){const r=new Map,t=new Map,e=new Ct,i=new Ct,s=await Lt();let n=null;const o=Kb({gap:()=>s.styles.rowGap,minimum:()=>s.styles.nodeHeight}),a=Kb({gap:()=>s.styles.columnGap,minimum:()=>Bd()});let h=null,l=null;e.name=Pf,tt.on("layoutUpdated",()=>{o.clear(),a.clear()}),tt.on("layoutSettingsUpdated",()=>{l&&e.parent&&c(l),A()}),tt.on("itemSelected",()=>{A()});async function c(B){u(),l=B,h=null,await Promise.all([f(B),m(B)]),y(B)}function u(){n||(n=fR(G))}function d(){n&&(n.terminate(),n=null)}async function f(B){const k=[];for(const F of B.nodes.values())k.push(p(F));await Promise.all(k)}async function p(B){const{render:k}=await v(B);return await k(B)}async function m(B){if((await ee()).disableEdges){e.removeChild(i);return}e.addChildAt(i,0);const F=[];for(const[V,{children:et}]of B.nodes)for(const{id:ft}of et)F.push(g(V,ft));await Promise.all(F)}async function g(B,k){const F=`${B}_${k}`;if(t.has(F))return;const V=await QA();t.has(F)||(t.set(F,V),i.addChild(V.element))}function y(B){if(!n)throw new Error("Layout worker not initialized");const k=new Map;for(const[F,{element:V}]of r)k.set(F,V.width);n.postMessage({type:"layout",data:B,widths:k,horizontalSettings:Ad(B.start_time),verticalSettings:PA()})}function x(){if(h)for(const[B,k]of t){const[F,V]=B.split("_"),et=h.positions.get(F),ft=h.positions.get(V),at=r.get(F);if(!et||!ft){console.warn(`Could not find edge in layout: Skipping ${B}`);continue}if(!at){console.warn(`Could not find parent node in nodes: Skipping ${F}`);continue}const Tt=at.bar.width,It=S(et),Q={x:It.x+Tt,y:It.y+s.styles.nodeHeight/2},W=S(ft),J={x:W.x-Q.x,y:W.y-Q.y+s.styles.nodeHeight/2};k.setPosition(Q,J)}}function b(){if(h){for(const[B,k]of r){const F=h.positions.get(B);if(!F){console.warn(`Could not find node in layout: Skipping ${B}`);continue}const V=S(F);k.setPosition(V),o.updateNodeAxis({nodeId:B,axis:F.y}),a.updateNodeAxis({nodeId:B,axis:F.column})}x(),e.emit("rendered"),e.emit("resized",L())}}async function v(B){const k=r.get(B.id);if(k)return k;const F=await lR(B);return F.element.on("resized",V=>w(B.id,V)),r.set(B.id,F),e.addChild(F.element),F}function w(B,k){if(!h)return;const F=r.get(B),V=h.positions.get(B);!F||!V||(o.setOffset({nodeId:B,axis:V.y,offset:k.height}),a.setOffset({nodeId:B,axis:V.column,offset:k.width}),b())}function S(B){const k=o.getTotalOffset(B.y);return{x:C(B),y:k}}function C(B){return it.isDependency()?a.getTotalOffset(B.column):B.x}function I(){return h?o.getTotalValue(h.maxRow):0}function M(){if(!h||!l)return 0;if(it.isDependency())return a.getTotalValue(h.maxColumn);const B=Ad(l.start_time),k=ib(B),F=k(l.end_time??new Date),V=k(l.start_time);return F-V}function L(){return{width:M(),height:I()}}function G({data:B}){const{type:k}=B;switch(k){case"layout":N(B);return;default:cR(k)}}function N(B){h=B.layout,b()}async function A(){const B=await ee(),k=xM();if(B.disableEdges||!k||!(l!=null&&l.nodes.has(k.id))){D([]);return}const F=H(k.id);D(F)}function D(B){Z(B),K(B)}function Z(B){for(const[k,{element:F}]of r){if(B.length===0||B.includes(k)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function K(B){for(const[k,{element:F}]of t){const[V,et]=k.split("_");if(B.length===0||B.includes(V)&&B.includes(et)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function H(B){const k=j(B,"parents"),F=j(B,"children");return[B,...k,...F]}function j(B,k){const F=l==null?void 0:l.nodes.get(B);if(!F)return[];const V=[];for(const{id:et}of F[k])V.push(et),V.push(...j(et,k));return V}return{element:e,stopWorker:d,getSize:L,render:c}}let Xo=null,Hr=null,Gs=null;async function pR(){const r=await te(),t=await Lt(),{element:e,render:i}=await jb();r.addChild(e),e.alpha=0;const s=await Yg(t.runId,async n=>{const o=Hr?"runDataUpdated":"runDataCreated";Hr=n,tt.emit(o,Hr),await ee(),i(n)});tt.on("configUpdated",()=>{Hr&&i(Hr)}),Gs=e,Xo=s.stop,Gs.once("rendered",()=>gR()),tt.on("layoutUpdated",()=>yR()),s.start()}function mR(){Xo==null||Xo(),Xo=null,Gs=null,Hr=null}async function Wi(){return Hr||await Ce("runDataCreated")}function gR(){Rd(),Te.shared.addOnce(()=>{Gs&&(Gs.alpha=1)})}async function yR(){if(!Gs)return;const r=await Lt();Gs.once("rendered",()=>{setTimeout(()=>{Rd({animate:!0})},r.animationDuration)})}function bR(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function xR({start_time:r,end_time:t,nodes:e},i,s){const n=Math.max(hx(t??new Date,r),1),o=i.styles.nodeHeight+i.styles.rowGap;return(e.size>0?e.size*o*.5:o*4)*s/(n*20)}async function _R(){const r=await Wi(),t=await Lt(),e=await Qt(),i=e.view.width/e.view.height,s=xR(r,t,i);qh(s,!0),r.nodes.size>t.disableAnimationsThreshold&&(it.disableAnimations=!0),bR(r.nodes)>t.disableEdgesThreshold&&(it.disableEdges=!0)}function vR(){it.horizontal="temporal",it.vertical="nearest-parent",it.horizontalScaleMultiplierDefault=0,it.horizontalScaleMultiplier=0,it.disableAnimations=!1,it.disableGuides=!1,it.disableEdges=!1,it.disableArtifacts=!1,it.disableEvents=!1}const it=z.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableGuides:!1,disableEdges:!1,disableArtifacts:!1,disableEvents:!1,isTemporal(){return this.horizontal==="temporal"},isDependency(){return this.horizontal==="dependency"},isWaterfall(){return this.vertical==="waterfall"},isNearestParent(){return this.vertical==="nearest-parent"},isLeftAligned(){return this.horizontal==="left-aligned"}});async function ee(){return Ud()?it:await Ce("layoutSettingsCreated")}function Bd(){return it.isDependency()?200:20*it.horizontalScaleMultiplier}function wR(){return[0,Bd()]}function TR(r){if(it.isDependency())return[0,1];const t=r,e=ox(t,1);return[t,e]}function qh(r,t=!1){if(it.horizontalScaleMultiplier===r)return;const e=Rn();it.horizontalScaleMultiplier=r,t&&(it.horizontalScaleMultiplierDefault=r),e()}function SR(){qh(it.horizontalScaleMultiplierDefault)}function ER(r){if(it.horizontal===r)return;const t=Rn();it.horizontal=r,it.disableGuides=it.isDependency()||it.isLeftAligned(),t()}function CR(r){if(it.vertical===r)return;const t=Rn();it.vertical=r,t()}function IR(r){if(it.disableEdges===r)return;const t=Rn();it.disableEdges=r,t()}function AR(r){if(it.disableArtifacts===r)return;const t=Rn();it.disableArtifacts=r,t()}function MR(r){if(it.disableEvents===r)return;const t=Rn();it.disableEvents=r,t()}function Rn(){const r=Ud()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=it;return()=>{Ud()&&tt.emit(r,it),(t!==it.horizontal||e!==it.vertical)&&tt.emit("layoutUpdated")}}function Ud(){return it.horizontalScaleMultiplier!==0}function Jb(r){if(!(r instanceof HTMLElement))return!1;const t=r.tagName.toLowerCase();return["input","textarea"].includes(t)}const RR={class:"flex items-center gap-2"},PR=z.defineComponent({__name:"RunGraphSettings",setup(r){const t=[ji.positions.topRight,ji.positions.bottomRight,ji.positions.topLeft,ji.positions.bottomLeft],e=[{label:"Temporal dependency",value:"temporal_nearest-parent"},{label:"Temporal sequence",value:"temporal_waterfall"},{label:"Dependency grid",value:"dependency_nearest-parent"},{label:"Sequential grid",value:"dependency_waterfall"},{label:"Comparative duration",value:"left-aligned_duration-sorted"}],i=z.computed({get(){return`${it.horizontal}_${it.vertical}`},set(u){const[d,f]=u.split("_");ER(d),CR(f)}}),s=z.computed({get(){return it.disableEdges},set(u){IR(u)}}),n=z.computed({get(){return it.disableArtifacts},set(u){AR(u)}}),o=z.computed({get(){return it.disableEvents},set(u){MR(u)}});function a(){const d=it.horizontalScaleMultiplier*1.25;qh(d)}function h(){const u=Math.abs(-.75),d=it.horizontalScaleMultiplier*u;qh(d)}_r.useKeyDown(["-","="],l);function l(u){if(!(Jb(u.target)||u.metaKey||u.ctrlKey))switch(u.key){case"-":h();break;case"=":a();break}}function c(){SR()}return(u,d)=>{const f=z.resolveComponent("p-radio-group"),p=z.resolveComponent("p-label"),m=z.resolveComponent("p-divider"),g=z.resolveComponent("p-checkbox"),y=z.resolveComponent("p-overflow-menu");return z.openBlock(),z.createBlock(z.unref(ji.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:z.withCtx(({toggle:x})=>[z.createVNode(z.unref(ji.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:x},null,8,["onClick"])]),default:z.withCtx(()=>[z.createVNode(y,{class:"run-graph-settings__menu"},{default:z.withCtx(()=>[z.createVNode(p,{label:"Layout"},{default:z.withCtx(()=>[z.createVNode(f,{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=x=>i.value=x),options:e},{label:z.withCtx(({option:x})=>[z.createTextVNode(z.toDisplayString(x.label),1)]),_:1},8,["modelValue"])]),_:1}),z.unref(it).isTemporal()||z.unref(it).isLeftAligned()?(z.openBlock(),z.createElementBlock(z.Fragment,{key:0},[z.createVNode(m),z.createVNode(p,{label:"Scaling"},{default:z.withCtx(()=>[z.createElementVNode("div",RR,[z.createVNode(z.unref(ji.PButton),{title:"Decrease scale (-)",small:"",icon:"MinusIcon",onClick:h}),z.createVNode(z.unref(ji.PButton),{title:"Increase scale (+)",small:"",icon:"PlusIcon",onClick:a}),z.createVNode(z.unref(ji.PButton),{small:"",onClick:c},{default:z.withCtx(()=>[z.createTextVNode(" Reset ")]),_:1})])]),_:1})],64)):z.createCommentVNode("",!0),z.createVNode(m),z.createVNode(g,{modelValue:s.value,"onUpdate:modelValue":d[1]||(d[1]=x=>s.value=x),label:"Hide dependency arrows"},null,8,["modelValue"]),z.createVNode(g,{modelValue:n.value,"onUpdate:modelValue":d[2]||(d[2]=x=>n.value=x),label:"Hide artifacts"},null,8,["modelValue"]),z.createVNode(g,{modelValue:o.value,"onUpdate:modelValue":d[3]||(d[3]=x=>o.value=x),label:"Hide events"},null,8,["modelValue"])]),_:1})]),_:1})}}}),LR={class:"run-graph__actions"},GR=z.defineComponent({__name:"RunGraph",props:{config:{},viewport:{},fullscreen:{type:[Boolean,null],default:null},selected:{default:null}},emits:["update:viewport","update:fullscreen","update:selected"],setup(r,{emit:t}){const e=r,i=z.ref(),s=z.ref(!1),n=z.computed({get(){return e.fullscreen??s.value},set(c){s.value=c,t("update:fullscreen",c)}});z.watch(()=>e.selected,c=>Xi(c)),tt.on("itemSelected",c=>t("update:selected",c)),z.watch(()=>e.viewport,c=>UA(c));const o=z.computed(()=>({root:{"run-graph--fullscreen":n.value}}));tt.on("viewportDateRangeUpdated",c=>t("update:viewport",c));function a(){Rd({animate:!0})}function h(){n.value=!n.value}z.onMounted(()=>{if(!i.value)throw new Error("Stage does not exist");nR({stage:i.value,props:e})}),z.onBeforeUnmount(()=>{oR()}),_r.useKeyDown(["c","f","Escape"],l);function l(c){if(!(Jb(c.target)||c.metaKey||c.ctrlKey))switch(c.key){case"c":a();break;case"f":h();break;case"Escape":n.value&&h();break}}return(c,u)=>{const d=z.resolveComponent("p-button");return z.openBlock(),z.createElementBlock("div",{class:z.normalizeClass(["run-graph",o.value.root])},[z.createElementVNode("div",{ref_key:"stage",ref:i,class:"run-graph__stage"},null,512),z.createElementVNode("div",LR,[z.createVNode(d,{title:"Recenter graph (c)",icon:"Target",flat:"",onClick:a}),z.createVNode(d,{title:"Toggle fullscreen (f)",icon:"ArrowsPointingOutIcon",flat:"",onClick:h}),z.createVNode(PR)])],2)}}});Ft.RunGraph=GR,Ft.artifactTypeIconMap=yb,Ft.artifactTypes=pM,Ft.isArtifactSelection=bb,Ft.isArtifactsSelection=xb,Ft.isEventSelection=vb,Ft.isEventsSelection=wb,Ft.isNodeSelection=jh,Ft.isRunGraphNodeType=mM,Ft.isStateSelection=_b,Ft.runGraphNodeKinds=kd,Ft.stateType=gM,Object.defineProperty(Ft,Symbol.toStringTag,{value:"Module"})});
|
|
1175
|
+
*/var Z0,Ur,yn,Ju,ws,V0,$u,mC=function(){return typeof window<"u"},hr={},Ts=180/Math.PI,bn=Math.PI/180,xn=Math.atan2,H0=1e8,Qu=/([A-Z])/g,gC=/(left|right|width|margin|padding|x)/i,yC=/[\s,\(]\S/,ki={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},qu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},bC=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},xC=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},_C=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},K0=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Y0=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},vC=function(t,e,i){return t.style[e]=i},wC=function(t,e,i){return t.style.setProperty(e,i)},TC=function(t,e,i){return t._gsap[e]=i},SC=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},EC=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},CC=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Ht="transform",Pe=Ht+"Origin",IC=function r(t,e){var i=this,s=this.target,n=s.style,o=s._gsap;if(t in hr&&n){if(this.tfm=this.tfm||{},t!=="transform")t=ki[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return i.tfm[a]=lr(s,a)}):this.tfm[t]=o.x?o[t]:lr(s,t),t===Pe&&(this.tfm.zOrigin=o.zOrigin);else return ki.transform.split(",").forEach(function(a){return r.call(i,a,e)});if(this.props.indexOf(Ht)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Pe,e,"")),t=Ht}(n||e)&&this.props.push(t,e,n[t])},z0=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},AC=function(){var t=this.props,e=this.target,i=e.style,s=e._gsap,n,o;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?i[t[n]]=t[n+2]:i.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(Qu,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)s[o]=this.tfm[o];s.svg&&(s.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=$u(),(!n||!n.isStart)&&!i[Ht]&&(z0(i),s.zOrigin&&i[Pe]&&(i[Pe]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},j0=function(t,e){var i={target:t,props:[],revert:AC,save:IC};return t._gsap||Re.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},J0,td=function(t,e){var i=Ur.createElementNS?Ur.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Ur.createElement(t);return i&&i.style?i:Ur.createElement(t)},Di=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Qu,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,_n(e)||e,1)||""},$0="O,Moz,ms,Ms,Webkit".split(","),_n=function(t,e,i){var s=e||ws,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!($0[o]+t in n););return o<0?null:(o===3?"ms":o>=0?$0[o]:"")+t},ed=function(){mC()&&window.document&&(Z0=window,Ur=Z0.document,yn=Ur.documentElement,ws=td("div")||{style:{}},td("div"),Ht=_n(Ht),Pe=Ht+"Origin",ws.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",J0=!!_n("perspective"),$u=Re.core.reverting,Ju=1)},id=function r(t){var e=td("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,s=this.nextSibling,n=this.style.cssText,o;if(yn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(s?i.insertBefore(this,s):i.appendChild(this)),yn.removeChild(e),this.style.cssText=n,o},Q0=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},q0=function(t){var e;try{e=t.getBBox()}catch{e=id.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===id||(e=id.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+Q0(t,["x","cx","x1"])||0,y:+Q0(t,["y","cy","y1"])||0,width:0,height:0}:e},ty=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&q0(t))},Ss=function(t,e){if(e){var i=t.style,s;e in hr&&e!==Pe&&(e=Ht),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(Qu,"-$1").toLowerCase())):i.removeAttribute(e)}},Xr=function(t,e,i,s,n,o){var a=new Me(t._pt,e,i,0,1,o?Y0:K0);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},ey={deg:1,rad:1,turn:1},MC={grid:1,flex:1},Wr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=ws.style,h=gC.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(h?"Width":"Height"),u=100,d=s==="px",f=s==="%",p,m,g,y;if(s===o||!n||ey[s]||ey[o])return n;if(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&ty(t),(f||o==="%")&&(hr[e]||~e.indexOf("adius")))return p=y?t.getBBox()[h?"width":"height"]:t[c],jt(f?n/p*u:n/100*p);if(a[h?"width":"height"]=u+(d?o:s),m=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Ur||!m.appendChild)&&(m=Ur.body),g=m._gsap,g&&f&&g.width&&h&&g.time===We.time&&!g.uncache)return jt(n/g.width*u);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=u+s,p=t[c],x?t.style[e]=x:Ss(t,e)}else(f||o==="%")&&!MC[Di(m,"display")]&&(a.position=Di(t,"position")),m===t&&(a.position="static"),m.appendChild(ws),p=ws[c],m.removeChild(ws),a.position="absolute";return h&&f&&(g=gs(m),g.time=We.time,g.width=m[c]),jt(d?p*n/u:p&&n?u/p*n:0)},lr=function(t,e,i,s){var n;return Ju||ed(),e in ki&&e!=="transform"&&(e=ki[e],~e.indexOf(",")&&(e=e.split(",")[0])),hr[e]&&e!=="transform"?(n=So(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:Ch(Di(t,Pe))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=Eh[e]&&Eh[e](t,e,i)||Di(t,e)||n0(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?Wr(t,e,n,i)+i:n},RC=function(t,e,i,s){if(!i||i==="none"){var n=_n(e,t,1),o=n&&Di(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=Di(t,"borderTopColor"))}var a=new Me(this._pt,t.style,e,0,1,B0),h=0,l=0,c,u,d,f,p,m,g,y,x,b,v,w;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(m=t.style[e],t.style[e]=s,s=Di(t,e)||s,m?t.style[e]=m:Ss(t,e)),c=[i,s],M0(c),i=c[0],s=c[1],d=i.match(un)||[],w=s.match(un)||[],w.length){for(;u=un.exec(s);)g=u[0],x=s.substring(h,u.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),g!==(m=d[l++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),g.charAt(1)==="="&&(g=dn(f,g)+v),y=parseFloat(g),b=g.substr((y+"").length),h=un.lastIndex-b.length,b||(b=b||Oe.units[e]||v,h===s.length&&(s+=b,a.e+=b)),v!==b&&(f=Wr(t,e,m,b)||0),a._pt={_next:a._pt,p:x||l===1?x:",",s:f,c:y-f,m:p&&p<4||e==="zIndex"?Math.round:0});a.c=h<s.length?s.substring(h,s.length):""}else a.r=e==="display"&&s==="none"?Y0:K0;return Qg.test(s)&&(a.e=0),this._pt=a,a},iy={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},PC=function(t){var e=t.split(" "),i=e[0],s=e[1]||"50%";return(i==="top"||i==="bottom"||s==="left"||s==="right")&&(t=i,i=s,s=t),e[0]=iy[i]||i,e[1]=iy[s]||s,e.join(" ")},LC=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,s=i.style,n=e.u,o=i._gsap,a,h,l;if(n==="all"||n===!0)s.cssText="",h=1;else for(n=n.split(","),l=n.length;--l>-1;)a=n[l],hr[a]&&(h=1,a=a==="transformOrigin"?Pe:Ht),Ss(i,a);h&&(Ss(i,Ht),o&&(o.svg&&i.removeAttribute("transform"),So(i,1),o.uncache=1,z0(s)))}},Eh={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new Me(t._pt,e,i,0,0,LC);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},To=[1,0,0,1,0,0],ry={},sy=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},ny=function(t){var e=Di(t,Ht);return sy(e)?To:e.substr(7).match($g).map(jt)},rd=function(t,e){var i=t._gsap||gs(t),s=t.style,n=ny(t),o,a,h,l;return i.svg&&t.getAttribute("transform")?(h=t.transform.baseVal.consolidate().matrix,n=[h.a,h.b,h.c,h.d,h.e,h.f],n.join(",")==="1,0,0,1,0,0"?To:n):(n===To&&!t.offsetParent&&t!==yn&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,yn.appendChild(t)),n=ny(t),h?s.display=h:Ss(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):yn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},sd=function(t,e,i,s,n,o){var a=t._gsap,h=n||rd(t,!0),l=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,d=a.yOffset||0,f=h[0],p=h[1],m=h[2],g=h[3],y=h[4],x=h[5],b=e.split(" "),v=parseFloat(b[0])||0,w=parseFloat(b[1])||0,S,C,I,M;i?h!==To&&(C=f*g-p*m)&&(I=v*(g/C)+w*(-m/C)+(m*x-g*y)/C,M=v*(-p/C)+w*(f/C)-(f*x-p*y)/C,v=I,w=M):(S=q0(t),v=S.x+(~b[0].indexOf("%")?v/100*S.width:v),w=S.y+(~(b[1]||b[0]).indexOf("%")?w/100*S.height:w)),s||s!==!1&&a.smooth?(y=v-l,x=w-c,a.xOffset=u+(y*f+x*m)-y,a.yOffset=d+(y*p+x*g)-x):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=w,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Pe]="0px 0px",o&&(Xr(o,a,"xOrigin",l,v),Xr(o,a,"yOrigin",c,w),Xr(o,a,"xOffset",u,a.xOffset),Xr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+w)},So=function(t,e){var i=t._gsap||new G0(t);if("x"in i&&!e&&!i.uncache)return i;var s=t.style,n=i.scaleX<0,o="px",a="deg",h=getComputedStyle(t),l=Di(t,Pe)||"0",c,u,d,f,p,m,g,y,x,b,v,w,S,C,I,M,L,G,N,A,D,Z,K,H,j,B,k,F,V,et,ft,at;return c=u=d=m=g=y=x=b=v=0,f=p=1,i.svg=!!(t.getCTM&&ty(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Ht]=(h.translate!=="none"?"translate3d("+(h.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(h.rotate!=="none"?"rotate("+h.rotate+") ":"")+(h.scale!=="none"?"scale("+h.scale.split(" ").join(",")+") ":"")+(h[Ht]!=="none"?h[Ht]:"")),s.scale=s.rotate=s.translate="none"),C=rd(t,i.svg),i.svg&&(i.uncache?(j=t.getBBox(),l=i.xOrigin-j.x+"px "+(i.yOrigin-j.y)+"px",H=""):H=!e&&t.getAttribute("data-svg-origin"),sd(t,H||l,!!H||i.originIsAbsolute,i.smooth!==!1,C)),w=i.xOrigin||0,S=i.yOrigin||0,C!==To&&(G=C[0],N=C[1],A=C[2],D=C[3],c=Z=C[4],u=K=C[5],C.length===6?(f=Math.sqrt(G*G+N*N),p=Math.sqrt(D*D+A*A),m=G||N?xn(N,G)*Ts:0,x=A||D?xn(A,D)*Ts+m:0,x&&(p*=Math.abs(Math.cos(x*bn))),i.svg&&(c-=w-(w*G+S*A),u-=S-(w*N+S*D))):(at=C[6],et=C[7],k=C[8],F=C[9],V=C[10],ft=C[11],c=C[12],u=C[13],d=C[14],I=xn(at,V),g=I*Ts,I&&(M=Math.cos(-I),L=Math.sin(-I),H=Z*M+k*L,j=K*M+F*L,B=at*M+V*L,k=Z*-L+k*M,F=K*-L+F*M,V=at*-L+V*M,ft=et*-L+ft*M,Z=H,K=j,at=B),I=xn(-A,V),y=I*Ts,I&&(M=Math.cos(-I),L=Math.sin(-I),H=G*M-k*L,j=N*M-F*L,B=A*M-V*L,ft=D*L+ft*M,G=H,N=j,A=B),I=xn(N,G),m=I*Ts,I&&(M=Math.cos(I),L=Math.sin(I),H=G*M+N*L,j=Z*M+K*L,N=N*M-G*L,K=K*M-Z*L,G=H,Z=j),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,y=180-y),f=jt(Math.sqrt(G*G+N*N+A*A)),p=jt(Math.sqrt(K*K+at*at)),I=xn(Z,K),x=Math.abs(I)>2e-4?I*Ts:0,v=ft?1/(ft<0?-ft:ft):0),i.svg&&(H=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!sy(Di(t,Ht)),H&&t.setAttribute("transform",H))),Math.abs(x)>90&&Math.abs(x)<270&&(n?(f*=-1,x+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,x+=x<=0?180:-180)),e=e||i.uncache,i.x=c-((i.xPercent=c&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-c)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+o,i.y=u-((i.yPercent=u&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-u)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=jt(f),i.scaleY=jt(p),i.rotation=jt(m)+a,i.rotationX=jt(g)+a,i.rotationY=jt(y)+a,i.skewX=x+a,i.skewY=b+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[Pe]=Ch(l)),i.xOffset=i.yOffset=0,i.force3D=Oe.force3D,i.renderTransform=i.svg?FC:J0?oy:GC,i.uncache=0,i},Ch=function(t){return(t=t.split(" "))[0]+" "+t[1]},nd=function(t,e,i){var s=be(e);return jt(parseFloat(e)+parseFloat(Wr(t,"x",i+"px",s)))+s},GC=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,oy(t,e)},Es="0deg",Eo="0px",Cs=") ",oy=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.z,l=i.rotation,c=i.rotationY,u=i.rotationX,d=i.skewX,f=i.skewY,p=i.scaleX,m=i.scaleY,g=i.transformPerspective,y=i.force3D,x=i.target,b=i.zOrigin,v="",w=y==="auto"&&t&&t!==1||y===!0;if(b&&(u!==Es||c!==Es)){var S=parseFloat(c)*bn,C=Math.sin(S),I=Math.cos(S),M;S=parseFloat(u)*bn,M=Math.cos(S),o=nd(x,o,C*M*-b),a=nd(x,a,-Math.sin(S)*-b),h=nd(x,h,I*M*-b+b)}g!==Eo&&(v+="perspective("+g+Cs),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(w||o!==Eo||a!==Eo||h!==Eo)&&(v+=h!==Eo||w?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+Cs),l!==Es&&(v+="rotate("+l+Cs),c!==Es&&(v+="rotateY("+c+Cs),u!==Es&&(v+="rotateX("+u+Cs),(d!==Es||f!==Es)&&(v+="skew("+d+", "+f+Cs),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Cs),x.style[Ht]=v||"translate(0, 0)"},FC=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.rotation,l=i.skewX,c=i.skewY,u=i.scaleX,d=i.scaleY,f=i.target,p=i.xOrigin,m=i.yOrigin,g=i.xOffset,y=i.yOffset,x=i.forceCSS,b=parseFloat(o),v=parseFloat(a),w,S,C,I,M;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=bn,l*=bn,w=Math.cos(h)*u,S=Math.sin(h)*u,C=Math.sin(h-l)*-d,I=Math.cos(h-l)*d,l&&(c*=bn,M=Math.tan(l-c),M=Math.sqrt(1+M*M),C*=M,I*=M,c&&(M=Math.tan(c),M=Math.sqrt(1+M*M),w*=M,S*=M)),w=jt(w),S=jt(S),C=jt(C),I=jt(I)):(w=u,I=d,S=C=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=Wr(f,"x",o,"px"),v=Wr(f,"y",a,"px")),(p||m||g||y)&&(b=jt(b+p-(p*w+m*C)+g),v=jt(v+m-(p*S+m*I)+y)),(s||n)&&(M=f.getBBox(),b=jt(b+s/100*M.width),v=jt(v+n/100*M.height)),M="matrix("+w+","+S+","+C+","+I+","+b+","+v+")",f.setAttribute("transform",M),x&&(f.style[Ht]=M)},NC=function(t,e,i,s,n){var o=360,a=le(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?Ts:1),l=h-s,c=s+l+"deg",u,d;return a&&(u=n.split("_")[1],u==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),u==="cw"&&l<0?l=(l+o*H0)%o-~~(l/o)*o:u==="ccw"&&l>0&&(l=(l-o*H0)%o-~~(l/o)*o)),t._pt=d=new Me(t._pt,e,i,s,l,bC),d.e=c,d.u="deg",t._props.push(i),d},ay=function(t,e){for(var i in e)t[i]=e[i];return t},kC=function(t,e,i){var s=ay({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,c,u,d,f,p;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Ht]=e,a=So(i,1),Ss(i,Ht),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Ht],o[Ht]=e,a=So(i,1),o[Ht]=l);for(h in hr)l=s[h],c=a[h],l!==c&&n.indexOf(h)<0&&(f=be(l),p=be(c),u=f!==p?Wr(i,h,l,p):parseFloat(l),d=parseFloat(c),t._pt=new Me(t._pt,a,h,u,d-u,qu),t._pt.u=p||0,t._props.push(h));ay(a,s)};Ae("padding,margin,Width,Radius",function(r,t){var e="Top",i="Right",s="Bottom",n="Left",o=(t<3?[e,i,s,n]:[e+n,e+i,s+i,s+n]).map(function(a){return t<2?r+a:"border"+a+r});Eh[t>1?"border"+r:r]=function(a,h,l,c,u){var d,f;if(arguments.length<4)return d=o.map(function(p){return lr(a,p,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(c+"").split(" "),f={},o.forEach(function(p,m){return f[p]=d[m]=d[m]||d[(m-1)/2|0]}),a.init(h,f,u)}});var hy={name:"css",register:ed,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,s,n){var o=this._props,a=t.style,h=i.vars.startAt,l,c,u,d,f,p,m,g,y,x,b,v,w,S,C,I;Ju||ed(),this.styles=this.styles||j0(t),I=this.styles.props,this.tween=i;for(m in e)if(m!=="autoRound"&&(c=e[m],!(Ue[m]&&F0(m,e,i,s,t,n)))){if(f=typeof c,p=Eh[m],f==="function"&&(c=c.call(i,s,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=yo(c)),p)p(this,t,m,c,i)&&(C=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),c+="",Or.lastIndex=0,Or.test(l)||(g=be(l),y=be(c)),y?g!==y&&(l=Wr(t,m,l,y)+y):g&&(c+=g),this.add(a,"setProperty",l,c,s,n,0,0,m),o.push(m),I.push(m,0,a[m]);else if(f!=="undefined"){if(h&&m in h?(l=typeof h[m]=="function"?h[m].call(i,s,t,n):h[m],le(l)&&~l.indexOf("random(")&&(l=yo(l)),be(l+"")||l==="auto"||(l+=Oe.units[m]||be(lr(t,m))||""),(l+"").charAt(1)==="="&&(l=lr(t,m))):l=lr(t,m),d=parseFloat(l),x=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),x&&(c=c.substr(2)),u=parseFloat(c),m in ki&&(m==="autoAlpha"&&(d===1&&lr(t,"visibility")==="hidden"&&u&&(d=0),I.push("visibility",0,a.visibility),Xr(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),m!=="scale"&&m!=="transform"&&(m=ki[m],~m.indexOf(",")&&(m=m.split(",")[0]))),b=m in hr,b){if(this.styles.save(m),v||(w=t._gsap,w.renderTransform&&!e.parseTransform||So(t,e.parseTransform),S=e.smoothOrigin!==!1&&w.smooth,v=this._pt=new Me(this._pt,a,Ht,0,1,w.renderTransform,w,0,-1),v.dep=1),m==="scale")this._pt=new Me(this._pt,w,"scaleY",w.scaleY,(x?dn(w.scaleY,x+u):u)-w.scaleY||0,qu),this._pt.u=0,o.push("scaleY",m),m+="X";else if(m==="transformOrigin"){I.push(Pe,0,a[Pe]),c=PC(c),w.svg?sd(t,c,0,S,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==w.zOrigin&&Xr(this,w,"zOrigin",w.zOrigin,y),Xr(this,a,m,Ch(l),Ch(c)));continue}else if(m==="svgOrigin"){sd(t,c,1,S,0,this);continue}else if(m in ry){NC(this,w,m,d,x?dn(d,x+c):c);continue}else if(m==="smoothOrigin"){Xr(this,w,"smooth",w.smooth,c);continue}else if(m==="force3D"){w[m]=c;continue}else if(m==="transform"){kC(this,c,t);continue}}else m in a||(m=_n(m)||m);if(b||(u||u===0)&&(d||d===0)&&!yC.test(c)&&m in a)g=(l+"").substr((d+"").length),u||(u=0),y=be(c)||(m in Oe.units?Oe.units[m]:g),g!==y&&(d=Wr(t,m,l,y)),this._pt=new Me(this._pt,b?w:a,m,d,(x?dn(d,x+u):u)-d,!b&&(y==="px"||m==="zIndex")&&e.autoRound!==!1?_C:qu),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=xC);else if(m in a)RC.call(this,t,m,l,x?x+c:c);else if(m in t)this.add(t,m,l||t[m],x?x+c:c,s,n);else if(m!=="parseTransform"){Iu(m,c);continue}b||(m in a?I.push(m,0,a[m]):I.push(m,1,l||t[m])),o.push(m)}}C&&U0(this)},render:function(t,e){if(e.tween._time||!$u())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:lr,aliases:ki,getSetter:function(t,e,i){var s=ki[e];return s&&s.indexOf(",")<0&&(e=s),e in hr&&e!==Pe&&(t._gsap.x||lr(t,"x"))?i&&V0===i?e==="scale"?SC:TC:(V0=i||{})&&(e==="scale"?EC:CC):t.style&&!vu(t.style[e])?vC:~e.indexOf("-")?wC:Hu(t,e)},core:{_removeProperty:Ss,_getMatrix:rd}};Re.utils.checkPrefix=_n,Re.core.getStyleSaver=j0,function(r,t,e,i){var s=Ae(r+","+t+","+e,function(n){hr[n]=1});Ae(t,function(n){Oe.units[n]="deg",ry[n]=1}),ki[s[13]]=r+","+t,Ae(i,function(n){var o=n.split(":");ki[o[1]]=s[o[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Ae("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Oe.units[r]="px"}),Re.registerPlugin(hy);var ly=Re.registerPlugin(hy)||Re;ly.core.Tween;const Is=new gt;class DC{constructor(t={}){this._recursive=typeof t.recursive=="boolean"?t.recursive:!0,this._toggle=t.toggle||"visible",this._targetList=new Set}add(t){return this._targetList.add(t),this}addAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.add(t[e]);return this}remove(t){return this._targetList.delete(t),this}removeAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.delete(t[e]);return this}clear(){return this._targetList.clear(),this}cull(t,e=!1){return e||this.uncull(),this._targetList.forEach(i=>{e||i.getBounds(!1,Is),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=Is.right>t.left&&Is.left<t.right&&Is.bottom>t.top&&Is.top<t.bottom)}),this}uncull(){return this._targetList.forEach(t=>{this._recursive?this.uncullRecursive(t):t[this._toggle]=!1}),this}cullRecursive(t,e,i){const s=i?e._bounds.getRectangle(Is):e.getBounds(!0,Is);if(e[this._toggle]=s.right>t.left&&s.left<t.right&&s.bottom>t.top&&s.top<t.bottom,!(s.left>=t.left&&s.top>=t.top&&s.right<=t.right&&s.bottom<=t.bottom)&&e[this._toggle]&&e.children&&e.children.length){const o=e.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(t,o[a])}}uncullRecursive(t){if(t[this._toggle]=!0,t.children&&t.children.length){const e=t.children;for(let i=0,s=e.length;i<s;i++)this.uncullRecursive(e[i])}}}var Ih={exports:{}};Ih.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=1,n=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",p="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Null]",x="[object Object]",b="[object Promise]",v="[object Proxy]",w="[object RegExp]",S="[object Set]",C="[object String]",I="[object Symbol]",M="[object Undefined]",L="[object WeakMap]",G="[object ArrayBuffer]",N="[object DataView]",A="[object Float32Array]",D="[object Float64Array]",Z="[object Int8Array]",K="[object Int16Array]",H="[object Int32Array]",j="[object Uint8Array]",B="[object Uint8ClampedArray]",k="[object Uint16Array]",F="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,et=/^\[object .+?Constructor\]$/,ft=/^(?:0|[1-9]\d*)$/,at={};at[A]=at[D]=at[Z]=at[K]=at[H]=at[j]=at[B]=at[k]=at[F]=!0,at[a]=at[h]=at[G]=at[c]=at[N]=at[u]=at[d]=at[f]=at[m]=at[g]=at[x]=at[w]=at[S]=at[C]=at[L]=!1;var Tt=typeof ve=="object"&&ve&&ve.Object===Object&&ve,It=typeof self=="object"&&self&&self.Object===Object&&self,Q=Tt||It||Function("return this")(),W=t&&!t.nodeType&&t,J=W&&!0&&r&&!r.nodeType&&r,$=J&&J.exports===W,O=$&&Tt.process,pt=function(){try{return O&&O.binding&&O.binding("util")}catch{}}(),yt=pt&&pt.isTypedArray;function Rt(T,R){for(var _=-1,E=T==null?0:T.length,P=0,X=[];++_<E;){var ut=T[_];R(ut,_,T)&&(X[P++]=ut)}return X}function Ot(T,R){for(var _=-1,E=R.length,P=T.length;++_<E;)T[P+_]=R[_];return T}function Fe(T,R){for(var _=-1,E=T==null?0:T.length;++_<E;)if(R(T[_],_,T))return!0;return!1}function Ze(T,R){for(var _=-1,E=Array(T);++_<T;)E[_]=R(_);return E}function Wo(T){return function(R){return T(R)}}function Kr(T,R){return T.has(R)}function Pn(T,R){return T==null?void 0:T[R]}function Ln(T){var R=-1,_=Array(T.size);return T.forEach(function(E,P){_[++R]=[P,E]}),_}function gi(T,R){return function(_){return T(R(_))}}function tl(T){var R=-1,_=Array(T.size);return T.forEach(function(E){_[++R]=E}),_}var el=Array.prototype,Xd=Function.prototype,Gn=Object.prototype,Yr=Q["__core-js_shared__"],Zo=Xd.toString,Ve=Gn.hasOwnProperty,Vo=function(){var T=/[^.]+$/.exec(Yr&&Yr.keys&&Yr.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Ho=Gn.toString,il=RegExp("^"+Zo.call(Ve).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rl=$?Q.Buffer:void 0,Fn=Q.Symbol,Zi=Q.Uint8Array,Fs=Gn.propertyIsEnumerable,Wd=el.splice,Vi=Fn?Fn.toStringTag:void 0,sl=Object.getOwnPropertySymbols,nl=rl?rl.isBuffer:void 0,Ns=gi(Object.keys,Object),Ko=xr(Q,"DataView"),He=xr(Q,"Map"),Yo=xr(Q,"Promise"),zo=xr(Q,"Set"),jo=xr(Q,"WeakMap"),ks=xr(Object,"create"),Zd=bi(Ko),yi=bi(He),Vd=bi(Yo),Hd=bi(zo),Kd=bi(jo),ol=Fn?Fn.prototype:void 0,Jo=ol?ol.valueOf:void 0;function Ne(T){var R=-1,_=T==null?0:T.length;for(this.clear();++R<_;){var E=T[R];this.set(E[0],E[1])}}function Yd(){this.__data__=ks?ks(null):{},this.size=0}function zd(T){var R=this.has(T)&&delete this.__data__[T];return this.size-=R?1:0,R}function jd(T){var R=this.__data__;if(ks){var _=R[T];return _===i?void 0:_}return Ve.call(R,T)?R[T]:void 0}function Jd(T){var R=this.__data__;return ks?R[T]!==void 0:Ve.call(R,T)}function $d(T,R){var _=this.__data__;return this.size+=this.has(T)?0:1,_[T]=ks&&R===void 0?i:R,this}Ne.prototype.clear=Yd,Ne.prototype.delete=zd,Ne.prototype.get=jd,Ne.prototype.has=Jd,Ne.prototype.set=$d;function xe(T){var R=-1,_=T==null?0:T.length;for(this.clear();++R<_;){var E=T[R];this.set(E[0],E[1])}}function Qd(){this.__data__=[],this.size=0}function qd(T){var R=this.__data__,_=kn(R,T);if(_<0)return!1;var E=R.length-1;return _==E?R.pop():Wd.call(R,_,1),--this.size,!0}function tf(T){var R=this.__data__,_=kn(R,T);return _<0?void 0:R[_][1]}function ef(T){return kn(this.__data__,T)>-1}function rf(T,R){var _=this.__data__,E=kn(_,T);return E<0?(++this.size,_.push([T,R])):_[E][1]=R,this}xe.prototype.clear=Qd,xe.prototype.delete=qd,xe.prototype.get=tf,xe.prototype.has=ef,xe.prototype.set=rf;function yr(T){var R=-1,_=T==null?0:T.length;for(this.clear();++R<_;){var E=T[R];this.set(E[0],E[1])}}function $o(){this.size=0,this.__data__={hash:new Ne,map:new(He||xe),string:new Ne}}function sf(T){var R=On(this,T).delete(T);return this.size-=R?1:0,R}function Nn(T){return On(this,T).get(T)}function Qo(T){return On(this,T).has(T)}function nf(T,R){var _=On(this,T),E=_.size;return _.set(T,R),this.size+=_.size==E?0:1,this}yr.prototype.clear=$o,yr.prototype.delete=sf,yr.prototype.get=Nn,yr.prototype.has=Qo,yr.prototype.set=nf;function br(T){var R=-1,_=T==null?0:T.length;for(this.__data__=new yr;++R<_;)this.add(T[R])}function al(T){return this.__data__.set(T,i),this}function of(T){return this.__data__.has(T)}br.prototype.add=br.prototype.push=al,br.prototype.has=of;function Hi(T){var R=this.__data__=new xe(T);this.size=R.size}function af(){this.__data__=new xe,this.size=0}function hl(T){var R=this.__data__,_=R.delete(T);return this.size=R.size,_}function hf(T){return this.__data__.get(T)}function lf(T){return this.__data__.has(T)}function cf(T,R){var _=this.__data__;if(_ instanceof xe){var E=_.__data__;if(!He||E.length<e-1)return E.push([T,R]),this.size=++_.size,this;_=this.__data__=new yr(E)}return _.set(T,R),this.size=_.size,this}Hi.prototype.clear=af,Hi.prototype.delete=hl,Hi.prototype.get=hf,Hi.prototype.has=lf,Hi.prototype.set=cf;function uf(T,R){var _=Xn(T),E=!_&&ea(T),P=!_&&!E&&Os(T),X=!_&&!E&&!P&&yl(T),ut=_||E||P||X,bt=ut?Ze(T.length,String):[],_t=bt.length;for(var lt in T)(R||Ve.call(T,lt))&&!(ut&&(lt=="length"||P&&(lt=="offset"||lt=="parent")||X&&(lt=="buffer"||lt=="byteLength"||lt=="byteOffset")||ta(lt,_t)))&&bt.push(lt);return bt}function kn(T,R){for(var _=T.length;_--;)if(Un(T[_][0],R))return _;return-1}function df(T,R,_){var E=R(T);return Xn(T)?E:Ot(E,_(T))}function Ds(T){return T==null?T===void 0?M:y:Vi&&Vi in Object(T)?gf(T):Bn(T)}function ll(T){return jr(T)&&Ds(T)==a}function cl(T,R,_,E,P){return T===R?!0:T==null||R==null||!jr(T)&&!jr(R)?T!==T&&R!==R:ff(T,R,_,E,cl,P)}function ff(T,R,_,E,P,X){var ut=Xn(T),bt=Xn(R),_t=ut?h:Ki(T),lt=bt?h:Ki(R);_t=_t==a?x:_t,lt=lt==a?x:lt;var vt=_t==x,Ut=lt==x,Pt=_t==lt;if(Pt&&Os(T)){if(!Os(R))return!1;ut=!0,vt=!1}if(Pt&&!vt)return X||(X=new Hi),ut||yl(T)?ul(T,R,_,E,P,X):dl(T,R,_t,_,E,P,X);if(!(_&s)){var de=vt&&Ve.call(T,"__wrapped__"),_e=Ut&&Ve.call(R,"__wrapped__");if(de||_e){var si=de?T.value():T,ni=_e?R.value():R;return X||(X=new Hi),P(si,ni,_,E,X)}}return Pt?(X||(X=new Hi),mf(T,R,_,E,P,X)):!1}function Dn(T){if(!gl(T)||xf(T))return!1;var R=Yi(T)?il:et;return R.test(bi(T))}function qo(T){return jr(T)&&zr(T.length)&&!!at[Ds(T)]}function pf(T){if(!_f(T))return Ns(T);var R=[];for(var _ in Object(T))Ve.call(T,_)&&_!="constructor"&&R.push(_);return R}function ul(T,R,_,E,P,X){var ut=_&s,bt=T.length,_t=R.length;if(bt!=_t&&!(ut&&_t>bt))return!1;var lt=X.get(T);if(lt&&X.get(R))return lt==R;var vt=-1,Ut=!0,Pt=_&n?new br:void 0;for(X.set(T,R),X.set(R,T);++vt<bt;){var de=T[vt],_e=R[vt];if(E)var si=ut?E(_e,de,vt,R,T,X):E(de,_e,vt,T,R,X);if(si!==void 0){if(si)continue;Ut=!1;break}if(Pt){if(!Fe(R,function(ni,Bs){if(!Kr(Pt,Bs)&&(de===ni||P(de,ni,_,E,X)))return Pt.push(Bs)})){Ut=!1;break}}else if(!(de===_e||P(de,_e,_,E,X))){Ut=!1;break}}return X.delete(T),X.delete(R),Ut}function dl(T,R,_,E,P,X,ut){switch(_){case N:if(T.byteLength!=R.byteLength||T.byteOffset!=R.byteOffset)return!1;T=T.buffer,R=R.buffer;case G:return!(T.byteLength!=R.byteLength||!X(new Zi(T),new Zi(R)));case c:case u:case g:return Un(+T,+R);case d:return T.name==R.name&&T.message==R.message;case w:case C:return T==R+"";case m:var bt=Ln;case S:var _t=E&s;if(bt||(bt=tl),T.size!=R.size&&!_t)return!1;var lt=ut.get(T);if(lt)return lt==R;E|=n,ut.set(T,R);var vt=ul(bt(T),bt(R),E,P,X,ut);return ut.delete(T),vt;case I:if(Jo)return Jo.call(T)==Jo.call(R)}return!1}function mf(T,R,_,E,P,X){var ut=_&s,bt=fl(T),_t=bt.length,lt=fl(R),vt=lt.length;if(_t!=vt&&!ut)return!1;for(var Ut=_t;Ut--;){var Pt=bt[Ut];if(!(ut?Pt in R:Ve.call(R,Pt)))return!1}var de=X.get(T);if(de&&X.get(R))return de==R;var _e=!0;X.set(T,R),X.set(R,T);for(var si=ut;++Ut<_t;){Pt=bt[Ut];var ni=T[Pt],Bs=R[Pt];if(E)var $b=ut?E(Bs,ni,Pt,R,T,X):E(ni,Bs,Pt,T,R,X);if(!($b===void 0?ni===Bs||P(ni,Bs,_,E,X):$b)){_e=!1;break}si||(si=Pt=="constructor")}if(_e&&!si){var xl=T.constructor,_l=R.constructor;xl!=_l&&"constructor"in T&&"constructor"in R&&!(typeof xl=="function"&&xl instanceof xl&&typeof _l=="function"&&_l instanceof _l)&&(_e=!1)}return X.delete(T),X.delete(R),_e}function fl(T){return df(T,bl,yf)}function On(T,R){var _=T.__data__;return bf(R)?_[typeof R=="string"?"string":"hash"]:_.map}function xr(T,R){var _=Pn(T,R);return Dn(_)?_:void 0}function gf(T){var R=Ve.call(T,Vi),_=T[Vi];try{T[Vi]=void 0;var E=!0}catch{}var P=Ho.call(T);return E&&(R?T[Vi]=_:delete T[Vi]),P}var yf=sl?function(T){return T==null?[]:(T=Object(T),Rt(sl(T),function(R){return Fs.call(T,R)}))}:vf,Ki=Ds;(Ko&&Ki(new Ko(new ArrayBuffer(1)))!=N||He&&Ki(new He)!=m||Yo&&Ki(Yo.resolve())!=b||zo&&Ki(new zo)!=S||jo&&Ki(new jo)!=L)&&(Ki=function(T){var R=Ds(T),_=R==x?T.constructor:void 0,E=_?bi(_):"";if(E)switch(E){case Zd:return N;case yi:return m;case Vd:return b;case Hd:return S;case Kd:return L}return R});function ta(T,R){return R=R??o,!!R&&(typeof T=="number"||ft.test(T))&&T>-1&&T%1==0&&T<R}function bf(T){var R=typeof T;return R=="string"||R=="number"||R=="symbol"||R=="boolean"?T!=="__proto__":T===null}function xf(T){return!!Vo&&Vo in T}function _f(T){var R=T&&T.constructor,_=typeof R=="function"&&R.prototype||Gn;return T===_}function Bn(T){return Ho.call(T)}function bi(T){if(T!=null){try{return Zo.call(T)}catch{}try{return T+""}catch{}}return""}function Un(T,R){return T===R||T!==T&&R!==R}var ea=ll(function(){return arguments}())?ll:function(T){return jr(T)&&Ve.call(T,"callee")&&!Fs.call(T,"callee")},Xn=Array.isArray;function pl(T){return T!=null&&zr(T.length)&&!Yi(T)}var Os=nl||wf;function ml(T,R){return cl(T,R)}function Yi(T){if(!gl(T))return!1;var R=Ds(T);return R==f||R==p||R==l||R==v}function zr(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function gl(T){var R=typeof T;return T!=null&&(R=="object"||R=="function")}function jr(T){return T!=null&&typeof T=="object"}var yl=yt?Wo(yt):qo;function bl(T){return pl(T)?uf(T):pf(T)}function vf(){return[]}function wf(){return!1}r.exports=ml}(Ih,Ih.exports);var OC=Ih.exports;const cy=Ws(OC);var BC=Object.defineProperty,UC=(r,t,e)=>t in r?BC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,U=(r,t,e)=>(UC(r,typeof t!="symbol"?t+"":t,e),e);class ti{constructor(t){U(this,"parent"),U(this,"paused"),this.parent=t,this.paused=!1}destroy(){}down(t){return!1}move(t){return!1}up(t){return!1}wheel(t){return!1}update(t){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var XC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},uy={exports:{}};(function(r,t){(function(){var e,i;i=function(s){return r.exports=s},e={linear:function(s,n,o,a){return o*s/a+n},easeInQuad:function(s,n,o,a){return o*(s/=a)*s+n},easeOutQuad:function(s,n,o,a){return-o*(s/=a)*(s-2)+n},easeInOutQuad:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s+n:-o/2*(--s*(s-2)-1)+n},easeInCubic:function(s,n,o,a){return o*(s/=a)*s*s+n},easeOutCubic:function(s,n,o,a){return o*((s=s/a-1)*s*s+1)+n},easeInOutCubic:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s+n:o/2*((s-=2)*s*s+2)+n},easeInQuart:function(s,n,o,a){return o*(s/=a)*s*s*s+n},easeOutQuart:function(s,n,o,a){return-o*((s=s/a-1)*s*s*s-1)+n},easeInOutQuart:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s+n:-o/2*((s-=2)*s*s*s-2)+n},easeInQuint:function(s,n,o,a){return o*(s/=a)*s*s*s*s+n},easeOutQuint:function(s,n,o,a){return o*((s=s/a-1)*s*s*s*s+1)+n},easeInOutQuint:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s*s+n:o/2*((s-=2)*s*s*s*s+2)+n},easeInSine:function(s,n,o,a){return-o*Math.cos(s/a*(Math.PI/2))+o+n},easeOutSine:function(s,n,o,a){return o*Math.sin(s/a*(Math.PI/2))+n},easeInOutSine:function(s,n,o,a){return-o/2*(Math.cos(Math.PI*s/a)-1)+n},easeInExpo:function(s,n,o,a){return s===0?n:o*Math.pow(2,10*(s/a-1))+n},easeOutExpo:function(s,n,o,a){return s===a?n+o:o*(-Math.pow(2,-10*s/a)+1)+n},easeInOutExpo:function(s,n,o,a){return(s/=a/2)<1?o/2*Math.pow(2,10*(s-1))+n:o/2*(-Math.pow(2,-10*--s)+2)+n},easeInCirc:function(s,n,o,a){return-o*(Math.sqrt(1-(s/=a)*s)-1)+n},easeOutCirc:function(s,n,o,a){return o*Math.sqrt(1-(s=s/a-1)*s)+n},easeInOutCirc:function(s,n,o,a){return(s/=a/2)<1?-o/2*(Math.sqrt(1-s*s)-1)+n:o/2*(Math.sqrt(1-(s-=2)*s)+1)+n},easeInElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n},easeOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*s)*Math.sin((s*a-c)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),s<1?-.5*(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l)*.5+o+n},easeInBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*(s/=a)*s*((h+1)*s-h)+n},easeOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*((s=s/a-1)*s*((h+1)*s+h)+1)+n},easeInOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),(s/=a/2)<1?o/2*(s*s*(((h*=1.525)+1)*s-h))+n:o/2*((s-=2)*s*(((h*=1.525)+1)*s+h)+2)+n},easeInBounce:function(s,n,o,a){var h;return h=e.easeOutBounce(a-s,0,o,a),o-h+n},easeOutBounce:function(s,n,o,a){return(s/=a)<1/2.75?o*(7.5625*s*s)+n:s<2/2.75?o*(7.5625*(s-=1.5/2.75)*s+.75)+n:s<2.5/2.75?o*(7.5625*(s-=2.25/2.75)*s+.9375)+n:o*(7.5625*(s-=2.625/2.75)*s+.984375)+n},easeInOutBounce:function(s,n,o,a){var h;return s<a/2?(h=e.easeInBounce(s*2,0,o,a),h*.5+n):(h=e.easeOutBounce(s*2-a,0,o,a),h*.5+o*.5+n)}},i(e)}).call(XC)})(uy);const dy=uy.exports;function Ah(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return dy[r]}else return dy[t]}const WC={removeOnInterrupt:!1,ease:"linear",time:1e3};class ZC extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"startX"),U(this,"startY"),U(this,"deltaX"),U(this,"deltaY"),U(this,"keepCenter"),U(this,"startWidth",null),U(this,"startHeight",null),U(this,"deltaWidth",null),U(this,"deltaHeight",null),U(this,"width",null),U(this,"height",null),U(this,"time",0),this.options=Object.assign({},WC,e),this.options.ease=Ah(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(t){if(this.paused)return;this.time+=t;const e=new dt(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,s=this.parent.height;this.complete(),(i!==this.parent.width||s!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const s=this.startWidth,n=this.deltaWidth;this.parent.fitWidth(s+n*i,this.keepCenter,this.height===null)}if(this.height!==null){const s=this.startHeight,n=this.deltaHeight;this.parent.fitHeight(s+n*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const s=this.startX,n=this.startY,o=this.deltaX,a=this.deltaY,h=new dt(this.parent.x,this.parent.y);this.parent.moveCenter(s+o*i,n+a*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}}}const VC={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class HC extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"left"),U(this,"top"),U(this,"right"),U(this,"bottom"),U(this,"underflowX"),U(this,"underflowY"),U(this,"ease"),U(this,"toX"),U(this,"toY"),this.options=Object.assign({},VC,e),this.ease=Ah(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(t){if(!this.paused){if(this.bounce(),this.toX){const e=this.toX;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),e.time>=this.options.time?(this.parent.x=e.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(e.time,e.start,e.delta,this.options.time)}if(this.toY){const e=this.toY;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),e.time>=this.options.time?(this.parent.y=e.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(e.time,e.start,e.delta,this.options.time)}}}calcUnderflowX(){let t;switch(this.underflowX){case-1:t=0;break;case 1:t=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:t=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return t}calcUnderflowY(){let t;switch(this.underflowY){case-1:t=0;break;case 1:t=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:t=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return t}oob(){const t=this.options.bounceBox;if(t){const e=typeof t.x>"u"?0:t.x,i=typeof t.y>"u"?0:t.y,s=typeof t.width>"u"?this.parent.worldWidth:t.width,n=typeof t.height>"u"?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>s,top:this.parent.top<i,bottom:this.parent.bottom>n,topLeft:new dt(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new dt(s*this.parent.scale.x-this.parent.screenWidth,n*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new dt(0,0),bottomRight:new dt(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){var t,e;if(this.paused)return;let i,s=this.parent.plugins.get("decelerate",!0);s&&(s.x||s.y)&&(s.x&&s.percentChangeX===((t=s.options)==null?void 0:t.friction)||s.y&&s.percentChangeY===((e=s.options)==null?void 0:e.friction))&&(i=this.oob(),(i.left&&this.left||i.right&&this.right)&&(s.percentChangeX=this.options.friction),(i.top&&this.top||i.bottom&&this.bottom)&&(s.percentChangeY=this.options.friction));const n=this.parent.plugins.get("drag",!0)||{},o=this.parent.plugins.get("pinch",!0)||{};if(s=s||{},!(n!=null&&n.active)&&!(o!=null&&o.active)&&(!this.toX||!this.toY)&&(!s.x||!s.y)){i=i||this.oob();const a=i.topLeft,h=i.bottomRight;if(!this.toX&&!s.x){let l=null;i.left&&this.left?l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x:i.right&&this.right&&(l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-h.x),l!==null&&this.parent.x!==l&&(this.toX={time:0,start:this.parent.x,delta:l-this.parent.x,end:l},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!s.y){let l=null;i.top&&this.top?l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y:i.bottom&&this.bottom&&(l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-h.y),l!==null&&this.parent.y!==l&&(this.toY={time:0,start:this.parent.y,delta:l-this.parent.y,end:l},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const KC={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class YC extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"last"),U(this,"noUnderflow"),U(this,"underflowX"),U(this,"underflowY"),this.options=Object.assign({},KC,e),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="none"?this.noUnderflow=!0:t==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=t.indexOf("left")!==-1?-1:t.indexOf("right")!==-1?1:0,this.underflowY=t.indexOf("top")!==-1?-1:t.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const t=new dt(this.parent.x,this.parent.y),e=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,e.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,e.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,e.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,e.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const zC={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class jC extends ti{constructor(t,e={}){super(t),U(this,"options"),this.options=Object.assign({},zC,e),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&t<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&t>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&e<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&e>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const t={x:null,y:null},e={x:null,y:null};if(typeof this.options.minScale=="number")t.x=this.options.minScale,t.y=this.options.minScale;else if(this.options.minScale!==null){const n=this.options.minScale;t.x=typeof n.x>"u"?null:n.x,t.y=typeof n.y>"u"?null:n.y}if(typeof this.options.maxScale=="number")e.x=this.options.maxScale,e.y=this.options.maxScale;else if(this.options.maxScale!==null){const n=this.options.maxScale;e.x=typeof n.x>"u"?null:n.x,e.y=typeof n.y>"u"?null:n.y}let i=this.parent.scale.x,s=this.parent.scale.y;t.x!==null&&i<t.x&&(i=t.x),e.x!==null&&i>e.x&&(i=e.x),t.y!==null&&s<t.y&&(s=t.y),e.y!==null&&s>e.y&&(s=e.y),(i!==this.parent.scale.x||s!==this.parent.scale.y)&&(this.parent.scale.set(i,s),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const JC={friction:.98,bounce:.8,minSpeed:.01},Zr=16;class $C extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"x"),U(this,"y"),U(this,"percentChangeX"),U(this,"percentChangeY"),U(this,"saved"),U(this,"timeSinceRelease"),this.options=Object.assign({},JC,e),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.handleMoved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const t=this.parent.input.count();return(t===1||t>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}handleMoved(t){if(this.saved.length){const e=this.saved[this.saved.length-1];t.type==="clamp-x"&&t.original?e.x===t.original.x&&(e.x=this.parent.x):t.type==="clamp-y"&&t.original&&e.y===t.original.y&&(e.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const t=performance.now();for(const e of this.saved)if(e.time>=t-100){const i=t-e.time;this.x=(this.parent.x-e.x)/i,this.y=(this.parent.y-e.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(t){t=t||{},typeof t.x<"u"&&(this.x=t.x,this.percentChangeX=this.options.friction),typeof t.y<"u"&&(this.y=t.y,this.percentChangeY=this.options.friction)}update(t){if(this.paused)return;const e=this.x||this.y,i=this.timeSinceRelease,s=this.timeSinceRelease+t;if(this.x){const n=this.percentChangeX,o=Math.log(n);this.parent.x+=this.x*Zr/o*(Math.pow(n,s/Zr)-Math.pow(n,i/Zr)),this.x*=Math.pow(this.percentChangeX,t/Zr)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Zr/o*(Math.pow(n,s/Zr)-Math.pow(n,i/Zr)),this.y*=Math.pow(this.percentChangeY,t/Zr)}this.timeSinceRelease+=t,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),e&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const QC={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class qC extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"moved"),U(this,"reverse"),U(this,"xDirection"),U(this,"yDirection"),U(this,"keyIsPressed"),U(this,"mouse"),U(this,"underflowX"),U(this,"underflowY"),U(this,"last"),U(this,"current"),U(this,"windowEventHandlers",[]),this.options=Object.assign({},QC,e),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){const e=s=>{t.includes(s.code)&&(this.keyIsPressed=!0)},i=s=>{t.includes(s.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",e)}addWindowEventHandler(t,e){window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e})}destroy(){this.windowEventHandlers.forEach(({event:t,handler:e})=>{window.removeEventListener(t,e)})}mouseButtons(t){!t||t==="all"?this.mouse=[!0,!0,!0]:this.mouse=[t.indexOf("left")!==-1,t.indexOf("middle")!==-1,t.indexOf("right")!==-1]}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="center"?(this.underflowX=0,this.underflowY=0):(t.includes("left")?this.underflowX=-1:t.includes("right")?this.underflowX=1:this.underflowX=0,t.includes("top")?this.underflowY=-1:t.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(t){const e=t.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!e||this.mouse[t.button]))}checkKeyPress(t){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&t.data.pointerType==="touch"}down(t){return this.paused||!this.options.pressDrag?!1:this.checkButtons(t)&&this.checkKeyPress(t)?(this.last={x:t.global.x,y:t.global.y},this.current=t.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(t){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===t.data.pointerId){const e=t.global.x,i=t.global.y,s=this.parent.input.count();if(s===1||s>1&&!this.parent.plugins.get("pinch",!0)){const n=e-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(n)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:e,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:t,screen:new dt(this.last.x,this.last.y),world:this.parent.toWorld(new dt(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(t){if(this.paused)return!1;const e=this.parent.input.touches;if(e.length===1){const i=e[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new dt(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(t){if(this.paused)return!1;if(this.options.wheel){const e=this.parent.plugins.get("wheel",!0);if(!e||!e.options.wheelZoom&&!t.ctrlKey){const i=t.deltaMode?this.options.lineHeight:1,s=[t.deltaX,t.deltaY],[n,o]=this.options.wheelSwapAxes?s.reverse():s;return this.xDirection&&(this.parent.x+=n*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||t.preventDefault(),this.parent.options.stopPropagation&&t.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const t=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,t.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,t.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,t.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,t.y=0)}}const tI={speed:0,acceleration:null,radius:null};class eI extends ti{constructor(t,e,i={}){super(t),U(this,"options"),U(this,"target"),U(this,"velocity"),this.target=e,this.options=Object.assign({},tI,i),this.velocity={x:0,y:0}}update(t){if(this.paused)return;const e=this.parent.center;let i=this.target.x,s=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-e.y,2)+Math.pow(this.target.x-e.x,2))>this.options.radius){const a=Math.atan2(this.target.y-e.y,this.target.x-e.x);i=this.target.x-Math.cos(a)*this.options.radius,s=this.target.y-Math.sin(a)*this.options.radius}else return;const n=i-e.x,o=s-e.y;if(n||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(s-e.y,i-e.x),h=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));if(h){const l=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>l?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*t,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*t,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const c=Math.cos(a)*this.velocity.x,u=Math.sin(a)*this.velocity.y,d=Math.abs(c)>Math.abs(n)?i:e.x+c,f=Math.abs(u)>Math.abs(o)?s:e.y+u;this.parent.moveCenter(d,f),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(s-e.y,i-e.x),h=Math.cos(a)*this.options.speed,l=Math.sin(a)*this.options.speed,c=Math.abs(h)>Math.abs(n)?i:e.x+h,u=Math.abs(l)>Math.abs(o)?s:e.y+l;this.parent.moveCenter(c,u),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,s),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const iI={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class rI extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"reverse"),U(this,"radiusSquared"),U(this,"left"),U(this,"top"),U(this,"right"),U(this,"bottom"),U(this,"horizontal"),U(this,"vertical"),this.options=Object.assign({},iI,e),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const t=this.options.distance;t!==null?(this.left=t,this.top=t,this.right=this.parent.screenWidth-t,this.bottom=this.parent.screenHeight-t):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(t){if(this.paused||t.pointerType!=="mouse"&&t.pointerId!==1||!this.options.allowButtons&&t.buttons!==0)return!1;const e=t.global.x,i=t.global.y;if(this.radiusSquared){const s=this.parent.toScreen(this.parent.center);if(Math.pow(s.x-e,2)+Math.pow(s.y-i,2)>=this.radiusSquared){const n=Math.atan2(s.y-i,s.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(n))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(n))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(n)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(n)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&e<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&e>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const t=this.parent.plugins.get("decelerate",!0);this.horizontal&&t&&!this.options.noDecelerate&&t.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const t=this.parent.plugins.get("decelerate",!0);this.vertical&&t&&!this.options.noDecelerate&&t.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const t=this.parent.center;this.horizontal&&(t.x+=this.horizontal*this.options.speed),this.vertical&&(t.y+=this.vertical*this.options.speed),this.parent.moveCenter(t),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const sI={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class nI extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"active",!1),U(this,"pinching",!1),U(this,"moved",!1),U(this,"lastCenter"),this.options=Object.assign({},sI,e)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(t){if(this.paused||!this.active)return!1;const e=t.global.x,i=t.global.y,s=this.parent.input.touches;if(s.length>=2){const n=s[0],o=s[1],a=n.last&&o.last?Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)):null;if(n.id===t.pointerId?n.last={x:e,y:i,data:t}:o.id===t.pointerId&&(o.last={x:e,y:i,data:t}),a){let h;const l=new dt(n.last.x+(o.last.x-n.last.x)/2,n.last.y+(o.last.y-n.last.y)/2);this.options.center||(h=this.parent.toLocal(l));let c=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));c=c===0?c=1e-10:c;const u=(1-a/c)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=u),this.isAxisY()&&(this.parent.scale.y+=u),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:l});const d=this.parent.plugins.get("clamp-zoom",!0);if(d&&d.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const f=this.parent.toGlobal(h);this.parent.x+=(l.x-f.x)*this.options.factor,this.parent.y+=(l.y-f.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(l.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(l.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=l,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const oI={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class aI extends ti{constructor(t,e,i,s={}){super(t),U(this,"options"),U(this,"ease"),U(this,"x"),U(this,"y"),U(this,"percent"),U(this,"snapping"),U(this,"deltaX"),U(this,"deltaY"),U(this,"startX"),U(this,"startY"),this.options=Object.assign({},oI,s),this.ease=Ah(s.ease,"easeInOutSine"),this.x=e,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const t=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-t.x,this.deltaY=this.y-t.y,this.startX=t.x,this.startY=t.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.percentChangeX=t.percentChangeY=this.options.friction)}return!1}update(t){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const e=this.snapping;e.time+=t;let i,s,n;const o=this.startX,a=this.startY,h=this.deltaX,l=this.deltaY;if(e.time>this.options.time)i=!0,s=o+h,n=a+l;else{const c=this.ease(e.time,0,1,this.options.time);s=o+h*c,n=a+l*c}this.options.topLeft?this.parent.moveCorner(s,n):this.parent.moveCenter(s,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const e=this.options.topLeft?this.parent.corner:this.parent.center;(e.x!==this.x||e.y!==this.y)&&this.snapStart()}}}const hI={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class lI extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"ease"),U(this,"xScale"),U(this,"yScale"),U(this,"xIndependent"),U(this,"yIndependent"),U(this,"snapping"),this.options=Object.assign({},hI,e),this.ease=Ah(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=t.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=t.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(t.container.scale.x=this.xScale,t.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):e.forceStart&&this.createSnapping()}createSnapping(){const t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,s=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:t,startY:e,deltaX:i-t,deltaY:s-e},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(t){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let e;if(!this.options.center&&!this.options.noMove&&(e=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=t,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const n=this.snapping,o=this.ease(n.time,n.startX,n.deltaX,this.options.time),a=this.ease(n.time,n.startY,n.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const s=this.parent.plugins.get("clamp-zoom",!0);s&&s.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))}}resume(){this.snapping=null,super.resume()}}const cI={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class uI extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"smoothing"),U(this,"smoothingCenter"),U(this,"smoothingCount"),U(this,"keyIsPressed"),this.options=Object.assign({},cI,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){window.addEventListener("keydown",e=>{t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const t=this.smoothingCenter,e=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x+=e.x),this.isAxisY()&&(this.parent.scale.y+=e.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const s=this.parent.plugins.get("clamp-zoom",!0);if(s&&s.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const n=this.parent.toGlobal(i);this.parent.x+=t.x-n.x,this.parent.y+=t.y-n.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(t){if(this.paused)return;const e=this.parent.input.getPointerPosition(t),i=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,s=Math.pow(2,(1+this.options.percent)*i);let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}wheel(t){if(this.paused||!this.checkKeyPress())return!1;if(t.ctrlKey&&this.options.trackpadPinch)this.pinch(t);else if(this.options.wheelZoom){const e=this.parent.input.getPointerPosition(t),i=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){const n={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+n.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+n.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}return!this.parent.options.passiveWheel}}class dI{constructor(t){U(this,"viewport"),U(this,"clickedAvailable"),U(this,"isMouseDown"),U(this,"last"),U(this,"wheelFunction"),U(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new gt(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.options.allowPreserveDragOutside?this.viewport.on("globalpointermove",this.move,this):this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.options.allowPreserveDragOutside||this.viewport.on("pointerleave",this.up,this),this.wheelFunction=t=>this.handleWheel(t),this.viewport.options.events.domElement.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.events.domElement.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.worldVisible)){if(t.pointerType==="mouse"?this.isMouseDown=!0:this.get(t.pointerId)||this.touches.push({id:t.pointerId,last:null}),this.count()===1){this.last=t.global.clone();const e=this.viewport.plugins.get("decelerate",!0),i=this.viewport.plugins.get("bounce",!0);(!e||!e.isActive())&&(!i||!i.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(t)&&this.viewport.options.stopPropagation&&t.stopPropagation()}}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(t){return Math.abs(t)>=this.viewport.threshold}move(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.plugins.move(t);if(this.clickedAvailable&&this.last){const i=t.global.x-this.last.x,s=t.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(s))&&(this.clickedAvailable=!1)}e&&this.viewport.options.stopPropagation&&t.stopPropagation()}up(t){if(this.viewport.pause||!this.viewport.worldVisible)return;t.pointerType==="mouse"&&(this.isMouseDown=!1),t.pointerType!=="mouse"&&this.remove(t.pointerId);const e=this.viewport.plugins.up(t);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:t,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this.viewport}),this.clickedAvailable=!1),e&&this.viewport.options.stopPropagation&&t.stopPropagation()}getPointerPosition(t){const e=new dt;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.toLocal(this.getPointerPosition(t));this.viewport.left<=e.x&&e.x<=this.viewport.right&&this.viewport.top<=e.y&&e.y<=this.viewport.bottom&&this.viewport.plugins.wheel(t)&&!this.viewport.options.passiveWheel&&t.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(t){for(const e of this.touches)if(e.id===t)return e;return null}remove(t){for(let e=0;e<this.touches.length;e++)if(this.touches[e].id===t){this.touches.splice(e,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}const Co=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class fI{constructor(t){U(this,"plugins"),U(this,"list"),U(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=Co.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=Co.indexOf(t);n!==-1&&Co.splice(n,1),Co.splice(i,0,t),this.sort()}get(t,e){var i;return e&&(i=this.plugins[t])!=null&&i.paused?null:this.plugins[t]}update(t){for(const e of this.list)e.update(t)}resize(){for(const t of this.list)t.resize()}reset(){for(const t of this.list)t.reset()}removeAll(){this.list.forEach(t=>{t.destroy()}),this.plugins={},this.sort()}remove(t){var e;this.plugins[t]&&((e=this.plugins[t])==null||e.destroy(),delete this.plugins[t],this.viewport.emit("plugin-remove",t),this.sort())}pause(t){var e;(e=this.plugins[t])==null||e.pause()}resume(t){var e;(e=this.plugins[t])==null||e.resume()}sort(){this.list=[];for(const t of Co)this.plugins[t]&&this.list.push(this.plugins[t])}down(t){let e=!1;for(const i of this.list)i.down(t)&&(e=!0);return e}move(t){let e=!1;for(const i of this.viewport.plugins.list)i.move(t)&&(e=!0);return e}up(t){let e=!1;for(const i of this.list)i.up(t)&&(e=!0);return e}wheel(t){let e=!1;for(const i of this.list)i.wheel(t)&&(e=!0);return e}}const pI={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:Te.shared,allowPreserveDragOutside:!1};class mI extends Ct{constructor(t){super(),U(this,"moving"),U(this,"screenWidth"),U(this,"screenHeight"),U(this,"threshold"),U(this,"input"),U(this,"plugins"),U(this,"zooming"),U(this,"lastViewport"),U(this,"options"),U(this,"_dirty"),U(this,"_forceHitArea"),U(this,"_hitAreaDefault"),U(this,"_pause"),U(this,"tickerFunction"),U(this,"_worldWidth"),U(this,"_worldHeight"),U(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...pI,...t},this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.disableOnContextMenu&&this.options.events.domElement.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new dI(this),this.plugins=new fI(this)}destroy(t){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.events.domElement.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(t)}update(t){this.pause||(this.plugins.update(t),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new gt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(t=window.innerWidth,e=window.innerHeight,i,s){this.screenWidth=t,this.screenHeight=e,typeof i<"u"&&(this._worldWidth=i),typeof s<"u"&&(this._worldHeight=s),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(t){this._worldWidth=t,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(t){this._worldHeight=t,this.plugins.resize()}getVisibleBounds(){return new gt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new dt(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new dt(t,e)):this.toGlobal(t)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new dt(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(t){this.moveCenter(t)}moveCenter(...t){let e,i;typeof t[0]=="number"?(e=t[0],i=t[1]):(e=t[0].x,i=t[0].y);const s=(this.worldScreenWidth/2-e)*this.scale.x,n=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==s||this.y!==n)&&(this.position.set(s,n),this.plugins.reset(),this.dirty=!0),this}get corner(){return new dt(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(...t){let e,i;return t.length===1?(e=-t[0].x*this.scale.x,i=-t[0].y*this.scale.y):(e=-t[0]*this.scale.x,i=-t[1]*this.scale.y),(e!==this.x||i!==this.y)&&(this.position.set(e,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(t){return this.screenWidth/t}findFitHeight(t){return this.screenHeight/t}findFit(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.min(i,s)}findCover(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.max(i,s)}fitWidth(t=this.worldWidth,e,i=!0,s){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitHeight(t=this.worldHeight,e,i=!0,s){let n;e&&(n=this.center),this.scale.y=this.screenHeight/t,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitWorld(t){let e;t&&(e=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),t&&e&&this.moveCenter(e),this}fit(t,e=this.worldWidth,i=this.worldHeight){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&s&&this.moveCenter(s),this}setZoom(t,e){let i;e&&(i=this.center),this.scale.set(t);const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&i&&this.moveCenter(i),this}zoomPercent(t,e){return this.setZoom(this.scale.x+this.scale.x*t,e)}zoom(t,e){return this.fitWidth(t+this.worldScreenWidth,e),this}get scaled(){return this.scale.x}set scaled(t){this.setZoom(t,!0)}snapZoom(t){return this.plugins.add("snap-zoom",new lI(this,t)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new dt(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(t){this.x=-t*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(t){this.x=-t*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(t){this.y=-t*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(t){this.y=-t*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(t){this._dirty=t}get forceHitArea(){return this._forceHitArea}set forceHitArea(t){t?(this._forceHitArea=t,this.hitArea=t):(this._forceHitArea=null,this.hitArea=new gt(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new qC(this,t)),this}clamp(t){return this.plugins.add("clamp",new YC(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new $C(this,t)),this}bounce(t){return this.plugins.add("bounce",new HC(this,t)),this}pinch(t){return this.plugins.add("pinch",new nI(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new aI(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new eI(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new uI(this,t)),this}animate(t){return this.plugins.add("animate",new ZC(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new jC(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new rI(this,t)),this}get pause(){return!!this._pause}set pause(t){this._pause=t,this.lastViewport=null,this.moving=!1,this.zooming=!1,t&&this.input.pause()}ensureVisible(t,e,i,s,n){n&&(i>this.worldScreenWidth||s>this.worldScreenHeight)&&(this.fit(!0,i,s),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;t<this.left?(this.left=t,o=!0):t+i>this.right&&(this.right=t+i,o=!0),e<this.top?(this.top=e,o=!0):e+s>this.bottom&&(this.bottom=e+s,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}function Mh(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function gI(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function od(r){let t,e,i;r.length!==2?(t=Mh,e=(a,h)=>Mh(r(a),h),i=(a,h)=>r(a)-h):(t=r===Mh||r===gI?r:yI,e=r,i=r);function s(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<0?l=u+1:c=u}while(l<c)}return l}function n(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<=0?l=u+1:c=u}while(l<c)}return l}function o(a,h,l=0,c=a.length){const u=s(a,h,l,c-1);return u>l&&i(a[u-1],h)>-i(a[u],h)?u-1:u}return{left:s,center:o,right:n}}function yI(){return 0}function bI(r){return r===null?NaN:+r}const xI=od(Mh).right;od(bI).center;const _I=Math.sqrt(50),vI=Math.sqrt(10),wI=Math.sqrt(2);function Rh(r,t,e){const i=(t-r)/Math.max(0,e),s=Math.floor(Math.log10(i)),n=i/Math.pow(10,s),o=n>=_I?10:n>=vI?5:n>=wI?2:1;let a,h,l;return s<0?(l=Math.pow(10,-s)/o,a=Math.round(r*l),h=Math.round(t*l),a/l<r&&++a,h/l>t&&--h,l=-l):(l=Math.pow(10,s)*o,a=Math.round(r/l),h=Math.round(t/l),a*l<r&&++a,h*l>t&&--h),h<a&&.5<=e&&e<2?Rh(r,t,e*2):[a,h,l]}function TI(r,t,e){if(t=+t,r=+r,e=+e,!(e>0))return[];if(r===t)return[r];const i=t<r,[s,n,o]=i?Rh(t,r,e):Rh(r,t,e);if(!(n>=s))return[];const a=n-s+1,h=new Array(a);if(i)if(o<0)for(let l=0;l<a;++l)h[l]=(n-l)/-o;else for(let l=0;l<a;++l)h[l]=(n-l)*o;else if(o<0)for(let l=0;l<a;++l)h[l]=(s+l)/-o;else for(let l=0;l<a;++l)h[l]=(s+l)*o;return h}function ad(r,t,e){return t=+t,r=+r,e=+e,Rh(r,t,e)[2]}function hd(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?ad(t,r,e):ad(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function ld(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function fy(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function Io(){}var Ao=.7,Ph=1/Ao,vn="\\s*([+-]?\\d+)\\s*",Mo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Oi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",SI=/^#([0-9a-f]{3,8})$/,EI=new RegExp(`^rgb\\(${vn},${vn},${vn}\\)$`),CI=new RegExp(`^rgb\\(${Oi},${Oi},${Oi}\\)$`),II=new RegExp(`^rgba\\(${vn},${vn},${vn},${Mo}\\)$`),AI=new RegExp(`^rgba\\(${Oi},${Oi},${Oi},${Mo}\\)$`),MI=new RegExp(`^hsl\\(${Mo},${Oi},${Oi}\\)$`),RI=new RegExp(`^hsla\\(${Mo},${Oi},${Oi},${Mo}\\)$`),py={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};ld(Io,Ro,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:my,formatHex:my,formatHex8:PI,formatHsl:LI,formatRgb:gy,toString:gy});function my(){return this.rgb().formatHex()}function PI(){return this.rgb().formatHex8()}function LI(){return vy(this).formatHsl()}function gy(){return this.rgb().formatRgb()}function Ro(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=SI.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?yy(t):e===3?new Le(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Lh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Lh(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=EI.exec(r))?new Le(t[1],t[2],t[3],1):(t=CI.exec(r))?new Le(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=II.exec(r))?Lh(t[1],t[2],t[3],t[4]):(t=AI.exec(r))?Lh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=MI.exec(r))?_y(t[1],t[2]/100,t[3]/100,1):(t=RI.exec(r))?_y(t[1],t[2]/100,t[3]/100,t[4]):py.hasOwnProperty(r)?yy(py[r]):r==="transparent"?new Le(NaN,NaN,NaN,0):null}function yy(r){return new Le(r>>16&255,r>>8&255,r&255,1)}function Lh(r,t,e,i){return i<=0&&(r=t=e=NaN),new Le(r,t,e,i)}function GI(r){return r instanceof Io||(r=Ro(r)),r?(r=r.rgb(),new Le(r.r,r.g,r.b,r.opacity)):new Le}function cd(r,t,e,i){return arguments.length===1?GI(r):new Le(r,t,e,i??1)}function Le(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}ld(Le,cd,fy(Io,{brighter(r){return r=r==null?Ph:Math.pow(Ph,r),new Le(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Ao:Math.pow(Ao,r),new Le(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Le(As(this.r),As(this.g),As(this.b),Gh(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:by,formatHex:by,formatHex8:FI,formatRgb:xy,toString:xy}));function by(){return`#${Ms(this.r)}${Ms(this.g)}${Ms(this.b)}`}function FI(){return`#${Ms(this.r)}${Ms(this.g)}${Ms(this.b)}${Ms((isNaN(this.opacity)?1:this.opacity)*255)}`}function xy(){const r=Gh(this.opacity);return`${r===1?"rgb(":"rgba("}${As(this.r)}, ${As(this.g)}, ${As(this.b)}${r===1?")":`, ${r})`}`}function Gh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function As(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Ms(r){return r=As(r),(r<16?"0":"")+r.toString(16)}function _y(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new pi(r,t,e,i)}function vy(r){if(r instanceof pi)return new pi(r.h,r.s,r.l,r.opacity);if(r instanceof Io||(r=Ro(r)),!r)return new pi;if(r instanceof pi)return r;r=r.rgb();var t=r.r/255,e=r.g/255,i=r.b/255,s=Math.min(t,e,i),n=Math.max(t,e,i),o=NaN,a=n-s,h=(n+s)/2;return a?(t===n?o=(e-i)/a+(e<i)*6:e===n?o=(i-t)/a+2:o=(t-e)/a+4,a/=h<.5?n+s:2-n-s,o*=60):a=h>0&&h<1?0:o,new pi(o,a,h,r.opacity)}function NI(r,t,e,i){return arguments.length===1?vy(r):new pi(r,t,e,i??1)}function pi(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}ld(pi,NI,fy(Io,{brighter(r){return r=r==null?Ph:Math.pow(Ph,r),new pi(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Ao:Math.pow(Ao,r),new pi(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<.5?e:1-e)*t,s=2*e-i;return new Le(ud(r>=240?r-240:r+120,s,i),ud(r,s,i),ud(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new pi(wy(this.h),Fh(this.s),Fh(this.l),Gh(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(){const r=Gh(this.opacity);return`${r===1?"hsl(":"hsla("}${wy(this.h)}, ${Fh(this.s)*100}%, ${Fh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function wy(r){return r=(r||0)%360,r<0?r+360:r}function Fh(r){return Math.max(0,Math.min(1,r||0))}function ud(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}const dd=r=>()=>r;function kI(r,t){return function(e){return r+e*t}}function DI(r,t,e){return r=Math.pow(r,e),t=Math.pow(t,e)-r,e=1/e,function(i){return Math.pow(r+i*t,e)}}function OI(r){return(r=+r)==1?Ty:function(t,e){return e-t?DI(t,e,r):dd(isNaN(t)?e:t)}}function Ty(r,t){var e=t-r;return e?kI(r,e):dd(isNaN(r)?t:r)}const Sy=function r(t){var e=OI(t);function i(s,n){var o=e((s=cd(s)).r,(n=cd(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=Ty(s.opacity,n.opacity);return function(c){return s.r=o(c),s.g=a(c),s.b=h(c),s.opacity=l(c),s+""}}return i.gamma=r,i}(1);function BI(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,i=t.slice(),s;return function(n){for(s=0;s<e;++s)i[s]=r[s]*(1-n)+t[s]*n;return i}}function UI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function XI(r,t){var e=t?t.length:0,i=r?Math.min(e,r.length):0,s=new Array(i),n=new Array(e),o;for(o=0;o<i;++o)s[o]=md(r[o],t[o]);for(;o<e;++o)n[o]=t[o];return function(a){for(o=0;o<i;++o)n[o]=s[o](a);return n}}function WI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function Nh(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function ZI(r,t){var e={},i={},s;(r===null||typeof r!="object")&&(r={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in r?e[s]=md(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var fd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pd=new RegExp(fd.source,"g");function VI(r){return function(){return r}}function HI(r){return function(t){return r(t)+""}}function KI(r,t){var e=fd.lastIndex=pd.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=fd.exec(r))&&(s=pd.exec(t));)(n=s.index)>e&&(n=t.slice(e,n),a[o]?a[o]+=n:a[++o]=n),(i=i[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,h.push({i:o,x:Nh(i,s)})),e=pd.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?HI(h[0].x):VI(t):(t=h.length,function(l){for(var c=0,u;c<t;++c)a[(u=h[c]).i]=u.x(l);return a.join("")})}function md(r,t){var e=typeof t,i;return t==null||e==="boolean"?dd(t):(e==="number"?Nh:e==="string"?(i=Ro(t))?(t=i,Sy):KI:t instanceof Ro?Sy:t instanceof Date?WI:UI(t)?BI:Array.isArray(t)?XI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ZI:Nh)(r,t)}function YI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function zI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function kh(r,t){if((e=(r=t?r.toExponential(t-1):r.toExponential()).indexOf("e"))<0)return null;var e,i=r.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+r.slice(e+1)]}function wn(r){return r=kh(Math.abs(r)),r?r[1]:NaN}function jI(r,t){return function(e,i){for(var s=e.length,n=[],o=0,a=r[0],h=0;s>0&&a>0&&(h+a+1>i&&(a=Math.max(1,i-h)),n.push(e.substring(s-=a,s+a)),!((h+=a+1)>i));)a=r[o=(o+1)%r.length];return n.reverse().join(t)}}function JI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var $I=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Dh(r){if(!(t=$I.exec(r)))throw new Error("invalid format: "+r);var t;return new gd({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Dh.prototype=gd.prototype;function gd(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}gd.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function QI(r){t:for(var t=r.length,e=1,i=-1,s;e<t;++e)switch(r[e]){case".":i=s=e;break;case"0":i===0&&(i=e),s=e;break;default:if(!+r[e])break t;i>0&&(i=0);break}return i>0?r.slice(0,i)+r.slice(s+1):r}var Ey;function qI(r,t){var e=kh(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(Ey=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=i.length;return n===o?i:n>o?i+new Array(n-o+1).join("0"):n>0?i.slice(0,n)+"."+i.slice(n):"0."+new Array(1-n).join("0")+kh(r,Math.max(0,t+n-1))[0]}function Cy(r,t){var e=kh(r,t);if(!e)return r+"";var i=e[0],s=e[1];return s<0?"0."+new Array(-s).join("0")+i:i.length>s+1?i.slice(0,s+1)+"."+i.slice(s+1):i+new Array(s-i.length+2).join("0")}const Iy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:zI,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:r=>Math.round(r).toString(8),p:(r,t)=>Cy(r*100,t),r:Cy,s:qI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function Ay(r){return r}var My=Array.prototype.map,Ry=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function t2(r){var t=r.grouping===void 0||r.thousands===void 0?Ay:jI(My.call(r.grouping,Number),r.thousands+""),e=r.currency===void 0?"":r.currency[0]+"",i=r.currency===void 0?"":r.currency[1]+"",s=r.decimal===void 0?".":r.decimal+"",n=r.numerals===void 0?Ay:JI(My.call(r.numerals,String)),o=r.percent===void 0?"%":r.percent+"",a=r.minus===void 0?"−":r.minus+"",h=r.nan===void 0?"NaN":r.nan+"";function l(u){u=Dh(u);var d=u.fill,f=u.align,p=u.sign,m=u.symbol,g=u.zero,y=u.width,x=u.comma,b=u.precision,v=u.trim,w=u.type;w==="n"?(x=!0,w="g"):Iy[w]||(b===void 0&&(b=12),v=!0,w="g"),(g||d==="0"&&f==="=")&&(g=!0,d="0",f="=");var S=m==="$"?e:m==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",C=m==="$"?i:/[%p]/.test(w)?o:"",I=Iy[w],M=/[defgprs%]/.test(w);b=b===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function L(G){var N=S,A=C,D,Z,K;if(w==="c")A=I(G)+A,G="";else{G=+G;var H=G<0||1/G<0;if(G=isNaN(G)?h:I(Math.abs(G),b),v&&(G=QI(G)),H&&+G==0&&p!=="+"&&(H=!1),N=(H?p==="("?p:a:p==="-"||p==="("?"":p)+N,A=(w==="s"?Ry[8+Ey/3]:"")+A+(H&&p==="("?")":""),M){for(D=-1,Z=G.length;++D<Z;)if(K=G.charCodeAt(D),48>K||K>57){A=(K===46?s+G.slice(D+1):G.slice(D))+A,G=G.slice(0,D);break}}}x&&!g&&(G=t(G,1/0));var j=N.length+G.length+A.length,B=j<y?new Array(y-j+1).join(d):"";switch(x&&g&&(G=t(B+G,B.length?y-A.length:1/0),B=""),f){case"<":G=N+G+A+B;break;case"=":G=N+B+G+A;break;case"^":G=B.slice(0,j=B.length>>1)+N+G+A+B.slice(j);break;default:G=B+N+G+A;break}return n(G)}return L.toString=function(){return u+""},L}function c(u,d){var f=l((u=Dh(u),u.type="f",u)),p=Math.max(-8,Math.min(8,Math.floor(wn(d)/3)))*3,m=Math.pow(10,-p),g=Ry[8+p/3];return function(y){return f(m*y)+g}}return{format:l,formatPrefix:c}}var Oh,Py,Ly;e2({thousands:",",grouping:[3],currency:["$",""]});function e2(r){return Oh=t2(r),Py=Oh.format,Ly=Oh.formatPrefix,Oh}function i2(r){return Math.max(0,-wn(Math.abs(r)))}function r2(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(wn(t)/3)))*3-wn(Math.abs(r)))}function s2(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,wn(t)-wn(r))+1}function Gy(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function n2(r){return function(){return r}}function o2(r){return+r}var Fy=[0,1];function Tn(r){return r}function yd(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:n2(isNaN(t)?NaN:.5)}function a2(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function h2(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=yd(s,i),n=e(o,n)):(i=yd(i,s),n=e(n,o)),function(a){return n(i(a))}}function l2(r,t,e){var i=Math.min(r.length,t.length)-1,s=new Array(i),n=new Array(i),o=-1;for(r[i]<r[0]&&(r=r.slice().reverse(),t=t.slice().reverse());++o<i;)s[o]=yd(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=xI(r,a,1,i)-1;return n[h](s[h](a))}}function Ny(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function c2(){var r=Fy,t=Fy,e=md,i,s,n,o=Tn,a,h,l;function c(){var d=Math.min(r.length,t.length);return o!==Tn&&(o=a2(r[0],r[d-1])),a=d>2?l2:h2,h=l=null,u}function u(d){return d==null||isNaN(d=+d)?n:(h||(h=a(r.map(i),t,e)))(i(o(d)))}return u.invert=function(d){return o(s((l||(l=a(t,r.map(i),Nh)))(d)))},u.domain=function(d){return arguments.length?(r=Array.from(d,o2),c()):r.slice()},u.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},u.rangeRound=function(d){return t=Array.from(d),e=YI,c()},u.clamp=function(d){return arguments.length?(o=d?!0:Tn,c()):o!==Tn},u.interpolate=function(d){return arguments.length?(e=d,c()):e},u.unknown=function(d){return arguments.length?(n=d,u):n},function(d,f){return i=d,s=f,c()}}function ky(){return c2()(Tn,Tn)}function u2(r,t,e,i){var s=hd(r,t,e),n;switch(i=Dh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=r2(s,o))&&(i.precision=n),Ly(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=s2(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=i2(s))&&(i.precision=n-(i.type==="%")*2);break}}return Py(i)}function d2(r){var t=r.domain;return r.ticks=function(e){var i=t();return TI(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return u2(s[0],s[s.length-1],e??10,i)},r.nice=function(e){e==null&&(e=10);var i=t(),s=0,n=i.length-1,o=i[s],a=i[n],h,l,c=10;for(a<o&&(l=o,o=a,a=l,l=s,s=n,n=l);c-- >0;){if(l=ad(o,a,e),l===h)return i[s]=o,i[n]=a,t(i);if(l>0)o=Math.floor(o/l)*l,a=Math.ceil(a/l)*l;else if(l<0)o=Math.ceil(o*l)/l,a=Math.floor(a*l)/l;else break;h=l}return r},r}function Dy(){var r=ky();return r.copy=function(){return Ny(r,Dy())},Gy.apply(r,arguments),d2(r)}function f2(r,t){r=r.slice();var e=0,i=r.length-1,s=r[e],n=r[i],o;return n<s&&(o=e,e=i,i=o,o=s,s=n,n=o),r[e]=t.floor(s),r[i]=t.ceil(n),r}const bd=new Date,xd=new Date;function se(r,t,e,i){function s(n){return r(n=arguments.length===0?new Date:new Date(+n)),n}return s.floor=n=>(r(n=new Date(+n)),n),s.ceil=n=>(r(n=new Date(n-1)),t(n,1),r(n),n),s.round=n=>{const o=s(n),a=s.ceil(n);return n-o<a-n?o:a},s.offset=(n,o)=>(t(n=new Date(+n),o==null?1:Math.floor(o)),n),s.range=(n,o,a)=>{const h=[];if(n=s.ceil(n),a=a==null?1:Math.floor(a),!(n<o)||!(a>0))return h;let l;do h.push(l=new Date(+n)),t(n,a),r(n);while(l<n&&n<o);return h},s.filter=n=>se(o=>{if(o>=o)for(;r(o),!n(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;t(o,-1),!n(o););else for(;--a>=0;)for(;t(o,1),!n(o););}),e&&(s.count=(n,o)=>(bd.setTime(+n),xd.setTime(+o),r(bd),r(xd),Math.floor(e(bd,xd))),s.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?s.filter(i?o=>i(o)%n===0:o=>s.count(0,o)%n===0):s)),s}const Bh=se(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Bh.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?se(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Bh),Bh.range;const cr=1e3,ei=cr*60,ur=ei*60,dr=ur*24,_d=dr*7,Oy=dr*30,vd=dr*365,Sn=se(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*cr)},(r,t)=>(t-r)/cr,r=>r.getUTCSeconds());Sn.range;const wd=se(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*cr)},(r,t)=>{r.setTime(+r+t*ei)},(r,t)=>(t-r)/ei,r=>r.getMinutes());wd.range,se(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*ei)},(r,t)=>(t-r)/ei,r=>r.getUTCMinutes()).range;const Td=se(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*cr-r.getMinutes()*ei)},(r,t)=>{r.setTime(+r+t*ur)},(r,t)=>(t-r)/ur,r=>r.getHours());Td.range,se(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*ur)},(r,t)=>(t-r)/ur,r=>r.getUTCHours()).range;const Po=se(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*ei)/dr,r=>r.getDate()-1);Po.range;const Sd=se(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/dr,r=>r.getUTCDate()-1);Sd.range,se(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/dr,r=>Math.floor(r/dr)).range;function Rs(r){return se(t=>{t.setDate(t.getDate()-(t.getDay()+7-r)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ei)/_d)}const Uh=Rs(0),Xh=Rs(1),p2=Rs(2),m2=Rs(3),En=Rs(4),g2=Rs(5),y2=Rs(6);Uh.range,Xh.range,p2.range,m2.range,En.range,g2.range,y2.range;function Ps(r){return se(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-r)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/_d)}const By=Ps(0),Wh=Ps(1),b2=Ps(2),x2=Ps(3),Cn=Ps(4),_2=Ps(5),v2=Ps(6);By.range,Wh.range,b2.range,x2.range,Cn.range,_2.range,v2.range;const Ed=se(r=>{r.setDate(1),r.setHours(0,0,0,0)},(r,t)=>{r.setMonth(r.getMonth()+t)},(r,t)=>t.getMonth()-r.getMonth()+(t.getFullYear()-r.getFullYear())*12,r=>r.getMonth());Ed.range,se(r=>{r.setUTCDate(1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCMonth(r.getUTCMonth()+t)},(r,t)=>t.getUTCMonth()-r.getUTCMonth()+(t.getUTCFullYear()-r.getUTCFullYear())*12,r=>r.getUTCMonth()).range;const fr=se(r=>{r.setMonth(0,1),r.setHours(0,0,0,0)},(r,t)=>{r.setFullYear(r.getFullYear()+t)},(r,t)=>t.getFullYear()-r.getFullYear(),r=>r.getFullYear());fr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:se(t=>{t.setFullYear(Math.floor(t.getFullYear()/r)*r),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*r)}),fr.range;const Ls=se(r=>{r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCFullYear(r.getUTCFullYear()+t)},(r,t)=>t.getUTCFullYear()-r.getUTCFullYear(),r=>r.getUTCFullYear());Ls.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:se(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/r)*r),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*r)}),Ls.range;function w2(r,t,e,i,s,n){const o=[[Sn,1,cr],[Sn,5,5*cr],[Sn,15,15*cr],[Sn,30,30*cr],[n,1,ei],[n,5,5*ei],[n,15,15*ei],[n,30,30*ei],[s,1,ur],[s,3,3*ur],[s,6,6*ur],[s,12,12*ur],[i,1,dr],[i,2,2*dr],[e,1,_d],[t,1,Oy],[t,3,3*Oy],[r,1,vd]];function a(l,c,u){const d=c<l;d&&([l,c]=[c,l]);const f=u&&typeof u.range=="function"?u:h(l,c,u),p=f?f.range(l,+c+1):[];return d?p.reverse():p}function h(l,c,u){const d=Math.abs(c-l)/u,f=od(([,,g])=>g).right(o,d);if(f===o.length)return r.every(hd(l/vd,c/vd,u));if(f===0)return Bh.every(Math.max(hd(l,c,u),1));const[p,m]=o[d/o[f-1][2]<o[f][2]/d?f-1:f];return p.every(m)}return[a,h]}const[T2,S2]=w2(fr,Ed,Uh,Po,Td,wd);function Cd(r){if(0<=r.y&&r.y<100){var t=new Date(-1,r.m,r.d,r.H,r.M,r.S,r.L);return t.setFullYear(r.y),t}return new Date(r.y,r.m,r.d,r.H,r.M,r.S,r.L)}function Id(r){if(0<=r.y&&r.y<100){var t=new Date(Date.UTC(-1,r.m,r.d,r.H,r.M,r.S,r.L));return t.setUTCFullYear(r.y),t}return new Date(Date.UTC(r.y,r.m,r.d,r.H,r.M,r.S,r.L))}function Lo(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function E2(r){var t=r.dateTime,e=r.date,i=r.time,s=r.periods,n=r.days,o=r.shortDays,a=r.months,h=r.shortMonths,l=Go(s),c=Fo(s),u=Go(n),d=Fo(n),f=Go(o),p=Fo(o),m=Go(a),g=Fo(a),y=Go(h),x=Fo(h),b={a:H,A:j,b:B,B:k,c:null,d:Hy,e:Hy,f:z2,g:sA,G:oA,H:H2,I:K2,j:Y2,L:Ky,m:j2,M:J2,p:F,q:V,Q:Qy,s:qy,S:$2,u:Q2,U:q2,V:tA,w:eA,W:iA,x:null,X:null,y:rA,Y:nA,Z:aA,"%":$y},v={a:et,A:ft,b:at,B:Tt,c:null,d:zy,e:zy,f:uA,g:vA,G:TA,H:hA,I:lA,j:cA,L:jy,m:dA,M:fA,p:It,q:Q,Q:Qy,s:qy,S:pA,u:mA,U:gA,V:yA,w:bA,W:xA,x:null,X:null,y:_A,Y:wA,Z:SA,"%":$y},w={a:L,A:G,b:N,B:A,c:D,d:Zy,e:Zy,f:X2,g:Wy,G:Xy,H:Vy,I:Vy,j:D2,L:U2,m:k2,M:O2,p:M,q:N2,Q:Z2,s:V2,S:B2,u:R2,U:P2,V:L2,w:M2,W:G2,x:Z,X:K,y:Wy,Y:Xy,Z:F2,"%":W2};b.x=S(e,b),b.X=S(i,b),b.c=S(t,b),v.x=S(e,v),v.X=S(i,v),v.c=S(t,v);function S(W,J){return function($){var O=[],pt=-1,yt=0,Rt=W.length,Ot,Fe,Ze;for($ instanceof Date||($=new Date(+$));++pt<Rt;)W.charCodeAt(pt)===37&&(O.push(W.slice(yt,pt)),(Fe=Uy[Ot=W.charAt(++pt)])!=null?Ot=W.charAt(++pt):Fe=Ot==="e"?" ":"0",(Ze=J[Ot])&&(Ot=Ze($,Fe)),O.push(Ot),yt=pt+1);return O.push(W.slice(yt,pt)),O.join("")}}function C(W,J){return function($){var O=Lo(1900,void 0,1),pt=I(O,W,$+="",0),yt,Rt;if(pt!=$.length)return null;if("Q"in O)return new Date(O.Q);if("s"in O)return new Date(O.s*1e3+("L"in O?O.L:0));if(J&&!("Z"in O)&&(O.Z=0),"p"in O&&(O.H=O.H%12+O.p*12),O.m===void 0&&(O.m="q"in O?O.q:0),"V"in O){if(O.V<1||O.V>53)return null;"w"in O||(O.w=1),"Z"in O?(yt=Id(Lo(O.y,0,1)),Rt=yt.getUTCDay(),yt=Rt>4||Rt===0?Wh.ceil(yt):Wh(yt),yt=Sd.offset(yt,(O.V-1)*7),O.y=yt.getUTCFullYear(),O.m=yt.getUTCMonth(),O.d=yt.getUTCDate()+(O.w+6)%7):(yt=Cd(Lo(O.y,0,1)),Rt=yt.getDay(),yt=Rt>4||Rt===0?Xh.ceil(yt):Xh(yt),yt=Po.offset(yt,(O.V-1)*7),O.y=yt.getFullYear(),O.m=yt.getMonth(),O.d=yt.getDate()+(O.w+6)%7)}else("W"in O||"U"in O)&&("w"in O||(O.w="u"in O?O.u%7:"W"in O?1:0),Rt="Z"in O?Id(Lo(O.y,0,1)).getUTCDay():Cd(Lo(O.y,0,1)).getDay(),O.m=0,O.d="W"in O?(O.w+6)%7+O.W*7-(Rt+5)%7:O.w+O.U*7-(Rt+6)%7);return"Z"in O?(O.H+=O.Z/100|0,O.M+=O.Z%100,Id(O)):Cd(O)}}function I(W,J,$,O){for(var pt=0,yt=J.length,Rt=$.length,Ot,Fe;pt<yt;){if(O>=Rt)return-1;if(Ot=J.charCodeAt(pt++),Ot===37){if(Ot=J.charAt(pt++),Fe=w[Ot in Uy?J.charAt(pt++):Ot],!Fe||(O=Fe(W,$,O))<0)return-1}else if(Ot!=$.charCodeAt(O++))return-1}return O}function M(W,J,$){var O=l.exec(J.slice($));return O?(W.p=c.get(O[0].toLowerCase()),$+O[0].length):-1}function L(W,J,$){var O=f.exec(J.slice($));return O?(W.w=p.get(O[0].toLowerCase()),$+O[0].length):-1}function G(W,J,$){var O=u.exec(J.slice($));return O?(W.w=d.get(O[0].toLowerCase()),$+O[0].length):-1}function N(W,J,$){var O=y.exec(J.slice($));return O?(W.m=x.get(O[0].toLowerCase()),$+O[0].length):-1}function A(W,J,$){var O=m.exec(J.slice($));return O?(W.m=g.get(O[0].toLowerCase()),$+O[0].length):-1}function D(W,J,$){return I(W,t,J,$)}function Z(W,J,$){return I(W,e,J,$)}function K(W,J,$){return I(W,i,J,$)}function H(W){return o[W.getDay()]}function j(W){return n[W.getDay()]}function B(W){return h[W.getMonth()]}function k(W){return a[W.getMonth()]}function F(W){return s[+(W.getHours()>=12)]}function V(W){return 1+~~(W.getMonth()/3)}function et(W){return o[W.getUTCDay()]}function ft(W){return n[W.getUTCDay()]}function at(W){return h[W.getUTCMonth()]}function Tt(W){return a[W.getUTCMonth()]}function It(W){return s[+(W.getUTCHours()>=12)]}function Q(W){return 1+~~(W.getUTCMonth()/3)}return{format:function(W){var J=S(W+="",b);return J.toString=function(){return W},J},parse:function(W){var J=C(W+="",!1);return J.toString=function(){return W},J},utcFormat:function(W){var J=S(W+="",v);return J.toString=function(){return W},J},utcParse:function(W){var J=C(W+="",!0);return J.toString=function(){return W},J}}}var Uy={"-":"",_:" ",0:"0"},ue=/^\s*\d+/,C2=/^%/,I2=/[\\^$*+?|[\]().{}]/g;function Mt(r,t,e){var i=r<0?"-":"",s=(i?-r:r)+"",n=s.length;return i+(n<e?new Array(e-n+1).join(t)+s:s)}function A2(r){return r.replace(I2,"\\$&")}function Go(r){return new RegExp("^(?:"+r.map(A2).join("|")+")","i")}function Fo(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function M2(r,t,e){var i=ue.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function R2(r,t,e){var i=ue.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function P2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function L2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function G2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Xy(r,t,e){var i=ue.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Wy(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function F2(r,t,e){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return i?(r.Z=i[1]?0:-(i[2]+(i[3]||"00")),e+i[0].length):-1}function N2(r,t,e){var i=ue.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function k2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function Zy(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function D2(r,t,e){var i=ue.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Vy(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function O2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function B2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function U2(r,t,e){var i=ue.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function X2(r,t,e){var i=ue.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function W2(r,t,e){var i=C2.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function Z2(r,t,e){var i=ue.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function V2(r,t,e){var i=ue.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function Hy(r,t){return Mt(r.getDate(),t,2)}function H2(r,t){return Mt(r.getHours(),t,2)}function K2(r,t){return Mt(r.getHours()%12||12,t,2)}function Y2(r,t){return Mt(1+Po.count(fr(r),r),t,3)}function Ky(r,t){return Mt(r.getMilliseconds(),t,3)}function z2(r,t){return Ky(r,t)+"000"}function j2(r,t){return Mt(r.getMonth()+1,t,2)}function J2(r,t){return Mt(r.getMinutes(),t,2)}function $2(r,t){return Mt(r.getSeconds(),t,2)}function Q2(r){var t=r.getDay();return t===0?7:t}function q2(r,t){return Mt(Uh.count(fr(r)-1,r),t,2)}function Yy(r){var t=r.getDay();return t>=4||t===0?En(r):En.ceil(r)}function tA(r,t){return r=Yy(r),Mt(En.count(fr(r),r)+(fr(r).getDay()===4),t,2)}function eA(r){return r.getDay()}function iA(r,t){return Mt(Xh.count(fr(r)-1,r),t,2)}function rA(r,t){return Mt(r.getFullYear()%100,t,2)}function sA(r,t){return r=Yy(r),Mt(r.getFullYear()%100,t,2)}function nA(r,t){return Mt(r.getFullYear()%1e4,t,4)}function oA(r,t){var e=r.getDay();return r=e>=4||e===0?En(r):En.ceil(r),Mt(r.getFullYear()%1e4,t,4)}function aA(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Mt(t/60|0,"0",2)+Mt(t%60,"0",2)}function zy(r,t){return Mt(r.getUTCDate(),t,2)}function hA(r,t){return Mt(r.getUTCHours(),t,2)}function lA(r,t){return Mt(r.getUTCHours()%12||12,t,2)}function cA(r,t){return Mt(1+Sd.count(Ls(r),r),t,3)}function jy(r,t){return Mt(r.getUTCMilliseconds(),t,3)}function uA(r,t){return jy(r,t)+"000"}function dA(r,t){return Mt(r.getUTCMonth()+1,t,2)}function fA(r,t){return Mt(r.getUTCMinutes(),t,2)}function pA(r,t){return Mt(r.getUTCSeconds(),t,2)}function mA(r){var t=r.getUTCDay();return t===0?7:t}function gA(r,t){return Mt(By.count(Ls(r)-1,r),t,2)}function Jy(r){var t=r.getUTCDay();return t>=4||t===0?Cn(r):Cn.ceil(r)}function yA(r,t){return r=Jy(r),Mt(Cn.count(Ls(r),r)+(Ls(r).getUTCDay()===4),t,2)}function bA(r){return r.getUTCDay()}function xA(r,t){return Mt(Wh.count(Ls(r)-1,r),t,2)}function _A(r,t){return Mt(r.getUTCFullYear()%100,t,2)}function vA(r,t){return r=Jy(r),Mt(r.getUTCFullYear()%100,t,2)}function wA(r,t){return Mt(r.getUTCFullYear()%1e4,t,4)}function TA(r,t){var e=r.getUTCDay();return r=e>=4||e===0?Cn(r):Cn.ceil(r),Mt(r.getUTCFullYear()%1e4,t,4)}function SA(){return"+0000"}function $y(){return"%"}function Qy(r){return+r}function qy(r){return Math.floor(+r/1e3)}var In,tb;EA({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function EA(r){return In=E2(r),tb=In.format,In.parse,In.utcFormat,In.utcParse,In}function CA(r){return new Date(r)}function IA(r){return r instanceof Date?+r:+new Date(+r)}function eb(r,t,e,i,s,n,o,a,h,l){var c=ky(),u=c.invert,d=c.domain,f=l(".%L"),p=l(":%S"),m=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),x=l("%b %d"),b=l("%B"),v=l("%Y");function w(S){return(h(S)<S?f:a(S)<S?p:o(S)<S?m:n(S)<S?g:i(S)<S?s(S)<S?y:x:e(S)<S?b:v)(S)}return c.invert=function(S){return new Date(u(S))},c.domain=function(S){return arguments.length?d(Array.from(S,IA)):d().map(CA)},c.ticks=function(S){var C=d();return r(C[0],C[C.length-1],S??10)},c.tickFormat=function(S,C){return C==null?w:l(C)},c.nice=function(S){var C=d();return(!S||typeof S.range!="function")&&(S=t(C[0],C[C.length-1],S??10)),S?d(f2(C,S)):c},c.copy=function(){return Ny(c,eb(r,t,e,i,s,n,o,a,h,l))},c}function AA(){return Gy.apply(eb(T2,S2,fr,Ed,Uh,Po,Td,wd,Sn,tb).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function No(r,t,e){this.k=r,this.x=t,this.y=e}No.prototype={constructor:No,scale:function(r){return r===1?this:new No(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new No(this.k,this.x+this.k*r,this.y+this.k*t)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},No.prototype;function ib(r){return r.mode==="temporal"||r.mode==="left-aligned"?MA(r):RA(r)}function MA({domain:r,range:t}){return AA().domain(r).range(t)}function RA({domain:r,range:t}){return Dy().domain(r).range(t)}function Ad(r){return{mode:it.horizontal,range:wR(),domain:TR(r)}}function PA(){return{mode:it.vertical}}let An=null;async function LA(){const r=await Wi();rb(r.start_time),tt.on("layoutSettingsUpdated",()=>rb(r.start_time))}function GA(){An=null}async function ii(){return An||await Ce("scaleCreated")}async function rb(r){await ee();const t=An?"scaleUpdated":"scaleCreated",e=Ad(r);An=ib(e),tt.emit(t,An)}let Ge=null,Md=null;async function FA(){const r=await Qt(),t=await bu();Ge=new mI({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Ge.zIndex=1,Ge.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),Ge.on("moved",()=>{tt.emit("viewportMoved",null)}).on("moved-end",()=>{tt.emit("viewportMoved",null)}),r.stage.addChild(Ge),tt.emit("viewportCreated",Ge),tt.on("applicationResized",XA),tt.on("scaleUpdated",()=>ko()),BA()}function NA(){Ge=null,Md=null}async function Rd({animate:r}={}){const e=(await te()).getChildByName(Pf);if(!e)throw new Error("Nodes container not found");VA();const{x:i,y:s,width:n,height:o}=e.getLocalBounds();if(!n||!o){DA({animate:r});return}kA({x:i,y:s,width:n,height:o,animate:r})}async function kA({x:r,y:t,width:e,height:i,animate:s}){const n=await Lt(),o=await te(),{guideTextSize:a,guideTextTopPadding:h,columnGap:l,rowGap:c,eventTargetSize:u}=n.styles,d=a+h,f=e+l*2,p=i+c*4+d+u,m=o.findFit(f,p);o.animate({position:{x:r+e/2,y:t+i/2+d},scale:Math.min(m,1),time:s?n.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{Vh(),ko()}})}async function DA({animate:r}){const t=await Wi(),e=await Lt(),i=await te(),s=await ii();let n=s(t.start_time)-e.styles.columnGap,o=s(t.end_time??new Date)+e.styles.columnGap;if(n>o){const c=n;n=o,o=c}const a=o-n,h=n+a/2,l=i.findFit(a,0);i.animate({position:{x:h,y:0},scale:l,time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{Vh(),ko()}})}async function te(){return Ge||await Ce("viewportCreated")}function sb(r){cy(Md,r)||(Md=r,tt.emit("viewportDateRangeUpdated",r))}function OA({xOffset:r,yOffset:t}){if(!Ge)return;const{x:e,y:i}=Ge.transform.position;Ge.setTransform(e+r,i+t,Ge.transform.scale.x,Ge.transform.scale.y)}async function BA(){const r=await te();ko(),r.on("moved",()=>ko())}async function ko(){const r=await nb();r&&sb(r)}async function nb(){const r=await te(),t=await ii(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function UA(r){const t=await nb(),e=await ee();if(r===void 0||e.isDependency()||cy(r,t))return;const i=await te(),s=await ii(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;sb(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function XA(){const r=await Qt(),t=await te(),e=await bu(),i=t.screenWidth,s=t.screenHeight,n=e.clientWidth,o=e.clientHeight,a=(n-i)/2,h=(o-s)/2;t.resize(r.screen.width,r.screen.height),OA({xOffset:a,yOffset:h})}class Zh{constructor(){Tf(this,"status","visible");Tf(this,"labels",new Set)}get visible(){return this.status==="visible"}get hidden(){return this.status==="hidden"}show(){if(this.status!=="visible"){for(const t of this.labels)t.visible=!0;this.status="visible"}}hide(){if(this.status!=="hidden"){for(const t of this.labels)t.visible=!1;this.status="hidden"}}toggle(t){t?this.show():this.hide()}add(t){this.labels.add(t),t.visible=this.visible}clear(){this.labels.clear()}}let Bi=null,ri=null,Ui=null,pr=null,mi=null;async function WA(){const r=await te(),t=await Qt();Bi=new DC({toggle:"renderable"}),ri=new Zh,Ui=new Zh,mi=new Zh,pr=new Zh,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.1,i=r.scale.x>.2,s=r.scale.x>.2,n=r.scale.x>.2;mi==null||mi.toggle(e),ri==null||ri.toggle(i),Ui==null||Ui.toggle(s),pr==null||pr.toggle(n),Bi==null||Bi.cull(t.renderer.screen),r.dirty=!1}}),tt.emit("cullCreated",Bi),tt.emit("labelCullCreated",ri),tt.emit("iconCullCreated",ri),tt.emit("edgeCullCreated",mi),tt.emit("toggleCullCreated",pr)}function ZA(){Bi=null,ri==null||ri.clear(),ri=null,Ui==null||Ui.clear(),Ui=null,mi==null||mi.clear(),mi=null,pr==null||pr.clear(),pr=null}async function Vh(){const r=await te();r.dirty=!0}function VA(){Bi&&Bi.uncull()}async function ob(){return Bi||await Ce("cullCreated")}async function HA(){return mi||await Ce("edgeCullCreated")}async function ab(){return ri||await Ce("labelCullCreated")}async function KA(){return Ui||await Ce("iconCullCreated")}async function hb(){const r=await ee(),t=await Lt();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return ly.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{Vh()}})}return{animate:e}}let Hh=new Map;function YA(){Hh=new Map}async function Do(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(Hh.has(e))return Hh.get(e);const i=await r(...t);return Hh.set(e,i),i}async function zA({size:r,stroke:t=1,radius:e=0}){const i=await Qt(),s=new ln;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new gt(0,0,r,r),resolution:10})}async function Oo(r){return await Do(zA,[r])}var Kh=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Kh||{});function lb(){const r=new $t;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await Oo(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function jA(){const r=await Qt(),t=new ln;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t,{wrapMode:vi.REPEAT})}async function Pd(){return await Do(jA,[])}function Ld(r,t){return Array.from({length:r},(e,i)=>t(i))}const JA=8,$A=2;async function QA(){const r=await Lt(),t=await ob(),e=await HA(),{animate:i}=await hb(),s=new Ct,{element:n,render:o}=await lb(),a=await Pd(),h=Ld(20,()=>new dt),l=new RS(a,h);let c=!1;s.name=rx,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function u(){return await o({size:10,rotate:Kh.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(p,m){const g=f(m);c||await u();for(const[y,x]of h.entries()){const{x:b,y:v}=g[y];i(x,{x:b,y:v},!c)}i(s,{x:p.x,y:p.y},!c),i(n,{x:m.x-JA,y:m.y},!c),c=!0}function f({x:p,y:m}){const g=[],y={x:0,y:0},x={x:p-$A,y:m},b={x:cb(y.x,{source:y,target:x}),y:y.y},v={x:cb(x.x,{source:y,target:x},!0),y:x.y};for(const[w]of h.entries()){if(w===h.length-1){g[w]=x;continue}const S=qA(w,{source:y,target:x,sourceBezier:b,targetBezier:v});g[w]=S}return g}return{element:s,render:u,setPosition:d}}function cb(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function qA(r,t){const e=r/20,{source:i,target:s,sourceBezier:n,targetBezier:o}=t,a=i.x+(n.x-i.x)*e,h=i.y+(n.y-i.y)*e,l=n.x+(o.x-n.x)*e,c=n.y+(o.y-n.y)*e,u=o.x+(s.x-o.x)*e,d=o.y+(s.y-o.y)*e,f=a+(l-a)*e,p=h+(c-h)*e,m=l+(u-l)*e,g=c+(d-c)*e,y=f+(m-f)*e,x=p+(g-p)*e;return{x:y,y:x}}async function tM({height:r,radius:t}){const e=await Qt(),i=new ln;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new gt(0,0,t,r),resolution:10})}async function eM(r){return await Do(tM,[r])}function iM(){const r=new $t,t=new $t;async function e(i){const s=await eM(i);return r.texture=s,t.texture=s,t.anchor.x=1,t.scale.x=-1,{left:r,right:t}}return{left:r,right:t,render:e}}async function mr(){const r=await Pd();return new $t(r)}async function Gd(){const r=new Ct,t=await mr(),{left:e,right:i,render:s}=await iM();r.addChild(t),r.addChild(e),r.addChild(i);async function n(h){const{width:l,x:c,visible:u}=a(h);return await s({height:h.height,radius:h.radius}),t.visible=u,t.width=l,t.height=h.height,t.x=c,e.visible=o(h.capLeft,h.radius),i.visible=o(h.capRight,h.radius),i.x=h.radius+l,t.tint=h.background,e.tint=h.background,i.tint=h.background,r}function o(h,l){return l===0?!1:h??!0}function a(h){const l=o(h.capLeft,h.radius),c=o(h.capRight,h.radius);let u=0;l&&(u+=h.radius),c&&(u+=h.radius);const d=Math.max(h.width-u,0),f=d>0,p=l?h.radius:0;return{width:d,visible:f,x:p}}return{element:r,render:n}}function Fd(){const r=new Ct,t=new $t,e=new $t,i=new $t,s=new $t,n=new $t,o=new $t,a=new $t,h=new $t;t.name="border-corner-top-left",e.name="border-corner-top-right",i.name="border-corner-bottom-left",s.name="border-corner-bottom-right",n.name="border-corner-left",o.name="border-corner-right",a.name="border-corner-top",h.name="border-corner-bottom",e.anchor.x=1,e.scale.x=-1,i.anchor.y=1,i.scale.y=-1,s.anchor.x=1,s.scale.x=-1,s.anchor.y=1,s.scale.y=-1,r.addChild(t),r.addChild(e),r.addChild(i),r.addChild(s),r.addChild(n),r.addChild(o),r.addChild(a),r.addChild(h);async function l(p){const{radius:m=0,color:g="#fff",stroke:y,width:x,height:b}=p,v=typeof m=="number",w={topLeft:c(v?m:m[0],x,b),topRight:c(v?m:m[1],x,b),bottomLeft:c(v?m:m[2],x,b),bottomRight:c(v?m:m[3],x,b)};return await u({width:x,height:b,stroke:y,cornerSizes:w}),await d({width:x,height:b,stroke:y,cornerSizes:w}),f(g),r}function c(p,m,g){const y=Math.min(m,g);return{size:p*2>y?y/2:p,radius:p}}async function u({width:p,height:m,stroke:g,cornerSizes:y}){const{topLeft:x,topRight:b,bottomLeft:v,bottomRight:w}=y,[S,C,I,M]=await Promise.all([Oo({...x,stroke:g}),Oo({...b,stroke:g}),Oo({...v,stroke:g}),Oo({...w,stroke:g})]);t.texture=S,e.texture=C,i.texture=M,s.texture=I,t.position.set(0,0),e.position.set(p-b.size,0),i.position.set(0,m-v.size),s.position.set(p-w.size,m-w.size)}async function d({width:p,height:m,stroke:g,cornerSizes:y}){const x=await Pd(),{topLeft:b,topRight:v,bottomLeft:w,bottomRight:S}=y;a.texture=x,n.texture=x,o.texture=x,h.texture=x,n.position.set(0,b.size),n.height=Math.max(m-b.size-w.size,0),n.width=g,o.position.set(p-g,v.size),o.height=Math.max(m-v.size-S.size,0),o.width=g,a.position.set(b.size,0),a.width=Math.max(p-b.size-v.size,0),a.height=g,h.position.set(w.size,m-g),h.width=Math.max(p-w.size-S.size,0),h.height=g}function f(p){t.tint=p,e.tint=p,i.tint=p,s.tint=p,a.tint=p,n.tint=p,o.tint=p,h.tint=p}return{element:r,render:l}}async function Yh(){const r=await Lt(),t=new Ct,{element:e,render:i}=await Fd();async function s({selected:n,width:o,height:a}){if(!n)return t.removeChild(e),t;const{selectedBorderColor:h,selectedBorderWidth:l,selectedBorderOffset:c,selectedBorderRadius:u}=r.styles;return e.position.set(-c,-c),t.addChild(e),await i({stroke:l,radius:u,width:o+c*2,height:a+c*2,color:h}),t}return{element:t,render:s}}async function rM(){const r=await Lt(),t=new Ct,{element:e,render:i}=await Gd(),{element:s,render:n}=await Yh();t.addChild(e),t.addChild(s);async function o({selected:a,width:h,height:l}){const{artifactBgColor:c,artifactBorderRadius:u}=r.styles,d={width:h,height:l,background:c,radius:u,capLeft:!0,capRight:!0};return await Promise.all([i(d),n({selected:a,width:h,height:l})]),t}return{element:t,render:o}}const sM=Object.freeze(Object.defineProperty({__proto__:null,Artifact:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15.7984%207.99134L12.7215%2012.9913C12.5599%2013.2539%2012.2797%2013.4202%2011.9718%2013.4362C11.664%2013.4523%2011.3679%2013.3159%2011.18%2013.0716L9.25692%2010.5716L10.7431%209.4284L11.8372%2010.8508L14.2016%207.00866L15.7984%207.99134Z'%20fill='white'/%3e%3c/svg%3e",ArtifactMarkdown:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15%207.1875H10V5.3125H15V7.1875ZM15%2010.9375H10V9.0625H15V10.9375ZM10%2014.6875H12.5V12.8125H10V14.6875Z'%20fill='white'/%3e%3c/svg%3e",ArtifactResult:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM9.52483%206.61458C9.7035%205.94774%2010.3889%205.55202%2011.0558%205.73069C11.7226%205.90937%2012.1183%206.59479%2011.9396%207.26162C11.761%207.92846%2011.0755%208.32418%2010.4087%208.14551C9.74188%207.96683%209.34615%207.28141%209.52483%206.61458ZM13.0604%2012.7383C13.239%2012.0715%2013.9245%2011.6757%2014.5913%2011.8544C15.2581%2012.0331%2015.6539%2012.7185%2015.4752%2013.3854C15.2965%2014.0522%2014.6111%2014.4479%2013.9442%2014.2692C13.2774%2014.0906%2012.8817%2013.4051%2013.0604%2012.7383ZM10.78%2014.27L15.78%206.77002L14.2199%205.72996L9.21995%2013.23L10.78%2014.27Z'%20fill='white'/%3e%3c/svg%3e",ArtifactTable:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM10%207.1875H11.875V5.3125H10V7.1875ZM10%2010.9375H11.875V9.0625H10V10.9375ZM11.875%2014.6875H10V12.8125H11.875V14.6875ZM13.125%207.1875H15V5.3125H13.125V7.1875ZM15%2010.9375H13.125V9.0625H15V10.9375ZM13.125%2014.6875H15V12.8125H13.125V14.6875Z'%20fill='white'/%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"}));function nM(r){const t={resolution:4};return ot.from(sM[r],t)}async function oM(r){return await Do(nM,[r])}async function aM({cullAtZoomThreshold:r=!0}={}){const t=await KA(),e=new $t;r&&t.add(e);async function i(s){const n=await oM(s);return e.texture=n,e}return{element:e,render:i}}var ub={exports:{}};(function(r){(function(){function t(m,g){document.addEventListener?m.addEventListener("scroll",g,!1):m.attachEvent("scroll",g)}function e(m){document.body?m():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),m()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),m())})}function i(m){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(m)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function s(m,g){m.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+g+";"}function n(m){var g=m.g.offsetWidth,y=g+100;return m.j.style.width=y+"px",m.i.scrollLeft=y,m.h.scrollLeft=m.h.scrollWidth+100,m.l!==g?(m.l=g,!0):!1}function o(m,g){function y(){var b=x;n(b)&&b.g.parentNode!==null&&g(b.l)}var x=m;t(m.h,y),t(m.i,y),n(m)}function a(m,g,y){g=g||{},y=y||window,this.family=m,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var h=null,l=null,c=null,u=null;function d(m){return l===null&&(f(m)&&/Apple/.test(window.navigator.vendor)?(m=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!m&&603>parseInt(m[1],10)):l=!1),l}function f(m){return u===null&&(u=!!m.document.fonts),u}function p(m,g){var y=m.style,x=m.weight;if(c===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}c=b.style.font!==""}return[y,x,c?m.stretch:"","100px",g].join(" ")}a.prototype.load=function(m,g){var y=this,x=m||"BESbswy",b=0,v=g||3e3,w=new Date().getTime();return new Promise(function(S,C){if(f(y.context)&&!d(y.context)){var I=new Promise(function(L,G){function N(){new Date().getTime()-w>=v?G(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(p(y,'"'+y.family+'"'),x).then(function(A){1<=A.length?L():setTimeout(N,25)},G)}N()}),M=new Promise(function(L,G){b=setTimeout(function(){G(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([M,I]).then(function(){clearTimeout(b),S(y)},C)}else e(function(){function L(){var V;(V=Z!=-1&&K!=-1||Z!=-1&&H!=-1||K!=-1&&H!=-1)&&((V=Z!=K&&Z!=H&&K!=H)||(h===null&&(V=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!V&&(536>parseInt(V[1],10)||parseInt(V[1],10)===536&&11>=parseInt(V[2],10))),V=h&&(Z==j&&K==j&&H==j||Z==B&&K==B&&H==B||Z==k&&K==k&&H==k)),V=!V),V&&(F.parentNode!==null&&F.parentNode.removeChild(F),clearTimeout(b),S(y))}function G(){if(new Date().getTime()-w>=v)F.parentNode!==null&&F.parentNode.removeChild(F),C(Error(""+v+"ms timeout exceeded"));else{var V=y.context.document.hidden;(V===!0||V===void 0)&&(Z=N.g.offsetWidth,K=A.g.offsetWidth,H=D.g.offsetWidth,L()),b=setTimeout(G,50)}}var N=new i(x),A=new i(x),D=new i(x),Z=-1,K=-1,H=-1,j=-1,B=-1,k=-1,F=document.createElement("div");F.dir="ltr",s(N,p(y,"sans-serif")),s(A,p(y,"serif")),s(D,p(y,"monospace")),F.appendChild(N.g),F.appendChild(A.g),F.appendChild(D.g),y.context.document.body.appendChild(F),j=N.g.offsetWidth,B=A.g.offsetWidth,k=D.g.offsetWidth,G(),o(N,function(V){Z=V,L()}),s(N,p(y,'"'+y.family+'",sans-serif')),o(A,function(V){K=V,L()}),s(A,p(y,'"'+y.family+'",serif')),o(D,function(V){H=V,L()}),s(D,p(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(ub);var hM=ub.exports;const lM=Ws(hM),db={inter:{fontFamily:"Inter",fontSize:16,lineHeight:20,fill:16777215}},fb={resolution:4,chars:fi.ASCII},pb="sans-serif",mb={inter:fM(db.inter)};let Nd=!1;async function cM(){const r=Object.values(db);await Promise.all(r.map(t=>uM(t))),Nd=!0,tt.emit("fontsLoaded",mb)}async function uM(r){const{fontFamily:t,...e}=r,i=new lM(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${pb}`),fi.from(t,{fontFamily:pb,...e},fb);return}fi.from(t,r,fb)}function dM(){Nd=!1}async function gb(){return Nd?mb:await Ce("fontsLoaded")}function fM(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new sE(s,i)}async function zh({cullAtZoomThreshold:r=!0}={}){const{inter:t}=await gb(),e=await ab(),i=t("");r&&e.add(i);async function s(n){return i.text=n,await i}return{element:i,render:s}}const pM=["result","markdown","table","unknown"],yb={markdown:"ArtifactMarkdown",table:"ArtifactTable",result:"ArtifactResult",unknown:"Artifact"},kd=["flow-run","task-run"];function mM(r){return kd.includes(r)}function jh(r){return kd.includes(r.kind)}function bb(r){return r.kind==="artifact"}function xb(r){return r.kind==="artifacts"}function _b(r){return r.kind==="state"}function vb(r){return r.kind==="event"}function wb(r){return r.kind==="events"}const gM=["COMPLETED","RUNNING","SCHEDULED","PENDING","FAILED","CANCELLED","CANCELLING","CRASHED","PAUSED"];async function Tb({cullAtZoomThreshold:r}){const t=await Lt(),e=new Ct,i=new Ct,{element:s,render:n}=await aM({cullAtZoomThreshold:r}),{element:o,render:a}=await zh({cullAtZoomThreshold:r}),{element:h,render:l}=await rM();let c=!1,u=null,d=null;i.addChild(s),i.addChild(o),e.addChild(h),e.addChild(i);async function f(y){if(y){const{selected:x,name:b,type:v}=y;c=x??c,u=b??u,d=v??d}return await Promise.all([p(),m()]),await g(),e}async function p(){if(!d)return s;const y=yb[d],{artifactIconSize:x,artifactIconColor:b,artifactPaddingLeft:v,artifactPaddingY:w}=t.styles,S=await n(y);return S.position={x:v,y:w},S.width=x,S.height=x,S.tint=b,S}async function m(){if(!u)return o.visible=!1,o;await a(u);const{artifactPaddingLeft:y,artifactPaddingY:x,artifactTextColor:b,artifactIconSize:v,artifactContentGap:w}=t.styles,S=y+v+w,C=x;return o.tint=b,o.scale.set(.75),o.position={x:S,y:C},o.visible=!0,o}async function g(){const{artifactPaddingLeft:y,artifactPaddingRight:x,artifactPaddingY:b}=t.styles,v={selected:c,width:i.width+y+x,height:i.height+b*2};return await l(v)}return{element:e,render:f}}let Kt=null,Jh=!1;async function yM(){const r=await te();r.on("click",()=>Xi(null)),r.on("drag-start",()=>{Jh=!0}),r.on("drag-end",()=>{setTimeout(()=>{Jh=!1})})}function bM(){Kt=null,Jh=!1}function Xi(r){if(!Jh&&!(!r&&!Kt||r&&gr(r))){if(Kt=r,r===null){tt.emit("itemSelected",null);return}tt.emit("itemSelected",r)}}function gr(r){if(Kt===null)return!1;const{kind:t}=r;switch(t){case"task-run":return jh(Kt)&&Kt.id===r.id;case"flow-run":return jh(Kt)&&Kt.id===r.id;case"artifact":return bb(Kt)&&Kt.id===r.id;case"artifacts":return xb(Kt)&&Kt.ids.length===r.ids.length&&Kt.ids.every(i=>r.ids.includes(i));case"state":return _b(Kt)&&Kt.id===r.id;case"event":return vb(Kt)&&Kt.id===r.id;case"events":return wb(Kt)&&Kt.ids.length===r.ids.length&&Kt.ids.every(i=>r.ids.includes(i));default:const e=t;throw new Error(`switch does not have case for value: ${e}`)}}function xM(){return Kt&&jh(Kt)?Kt:null}async function Dd(r,{cullAtZoomThreshold:t=!0,enableLocalClickHandling:e=!1}={}){const{element:i,render:s}=await Tb({cullAtZoomThreshold:t});let n=!1;i.eventMode="static",i.cursor="pointer",e&&i.on("click",c=>{c.stopPropagation(),Xi({kind:"artifact",id:r.id})}),tt.on("itemSelected",()=>{const c=gr({kind:"artifact",id:r.id});c!==n&&(n=c,o())});async function o(){await s({selected:n,name:r.key,type:r.type})}function a(){return n}function h(){return r.created}function l(){return r.id}return{element:i,render:o,getSelected:a,getDate:h,getId:l}}async function Sb(r,t){const e=await Wi(),i=await Lt();let s,n=null;async function o(){try{n=await i.fetchEvents(z.toValue(r)),t(n)}catch(h){console.error(h)}e.end_time||(s=setTimeout(()=>o(),i.fetchEventsInterval))}function a(){clearTimeout(s)}return{start:o,stop:a}}async function _M(){const r=await Lt(),t=await ab(),e=new Ct,{element:i,render:s}=await lb(),{element:n,render:o}=await Gd(),{element:a,render:h}=await Fd();t.add(e);let l=!1;e.eventMode="static",e.cursor="pointer",e.addChild(n),e.addChild(i),e.addChild(a),e.on("mouseover",u),e.on("mouseout",d);async function c({inside:f,isOpen:p}){l=f;const m={size:10,stroke:2,rotate:p?Kh.Up:Kh.Down},g=await s(m),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:r.styles.nodeToggleBgColor,radius:r.styles.nodeToggleBorderRadius},x=await o(y);x.alpha=f?0:.5;const b=await h({width:y.width,height:y.height,radius:y.radius,stroke:1,color:r.styles.nodeToggleBorderColor});b.alpha=f?0:1;const v={y:x.height/2,x:x.width/2},w=m.size/4;return g.x=v.x,g.y=p?v.y+w:v.y-w,e}function u(){n.alpha=l?.5:1}function d(){n.alpha=l?0:.5}return{element:e,render:c}}async function Eb(){const r=await Lt(),t=await ee(),e=new Ct,{element:i,render:s}=await Gd(),{element:n,render:o}=await Yh();e.addChild(i),e.addChild(n);async function a(l){const{background:c="#fff"}=r.styles.node(l),{nodeHeight:u,nodeRadius:d}=r.styles,f=gr({kind:l.kind,id:l.id}),p=h(l,d),m=l.state_type!=="RUNNING"||t.isDependency();return await Promise.all([s({width:p,height:u,radius:d,background:c,capRight:m}),o({selected:f,width:p,height:u})]),i}function h(l,c){const u=Bd();if(it.isTemporal()||it.isLeftAligned()){const d=l.start_time,f=l.end_time??new Date,m=Lf(f,d)/aa*u;return Math.max(m,c*2)}return u}return{element:e,render:a}}var Cb="Expected a function",Ib=NaN,vM="[object Symbol]",wM=/^\s+|\s+$/g,TM=/^[-+]0x[0-9a-f]+$/i,SM=/^0b[01]+$/i,EM=/^0o[0-7]+$/i,CM=parseInt,IM=typeof ve=="object"&&ve&&ve.Object===Object&&ve,AM=typeof self=="object"&&self&&self.Object===Object&&self,MM=IM||AM||Function("return this")(),RM=Object.prototype,PM=RM.toString,LM=Math.max,GM=Math.min,Od=function(){return MM.Date.now()};function FM(r,t,e){var i,s,n,o,a,h,l=0,c=!1,u=!1,d=!0;if(typeof r!="function")throw new TypeError(Cb);t=Ab(t)||0,$h(e)&&(c=!!e.leading,u="maxWait"in e,n=u?LM(Ab(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function f(S){var C=i,I=s;return i=s=void 0,l=S,o=r.apply(I,C),o}function p(S){return l=S,a=setTimeout(y,t),c?f(S):o}function m(S){var C=S-h,I=S-l,M=t-C;return u?GM(M,n-I):M}function g(S){var C=S-h,I=S-l;return h===void 0||C>=t||C<0||u&&I>=n}function y(){var S=Od();if(g(S))return x(S);a=setTimeout(y,m(S))}function x(S){return a=void 0,d&&i?f(S):(i=s=void 0,o)}function b(){a!==void 0&&clearTimeout(a),l=0,i=h=s=a=void 0}function v(){return a===void 0?o:x(Od())}function w(){var S=Od(),C=g(S);if(i=arguments,s=this,h=S,C){if(a===void 0)return p(h);if(u)return a=setTimeout(y,t),f(h)}return a===void 0&&(a=setTimeout(y,t)),o}return w.cancel=b,w.flush=v,w}function NM(r,t,e){var i=!0,s=!0;if(typeof r!="function")throw new TypeError(Cb);return $h(e)&&(i="leading"in e?!!e.leading:i,s="trailing"in e?!!e.trailing:s),FM(r,t,{leading:i,maxWait:t,trailing:s})}function $h(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function kM(r){return!!r&&typeof r=="object"}function DM(r){return typeof r=="symbol"||kM(r)&&PM.call(r)==vM}function Ab(r){if(typeof r=="number")return r;if(DM(r))return Ib;if($h(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=$h(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(wM,"");var e=SM.test(r);return e||EM.test(r)?CM(r.slice(2),e?2:8):TM.test(r)?Ib:+r}var OM=NM;const Mb=Ws(OM);async function Rb(){const{element:r,render:t}=await Tb({cullAtZoomThreshold:!1});let e=null,i=[],s=!1;r.eventMode="static",r.cursor="pointer",tt.on("itemSelected",()=>{const l=gr({kind:"artifacts",ids:i});l!==s&&e&&(s=l,n({ids:i,date:e}))});async function n(l){if(!l){e=null,i=[],r.visible=!1;return}const{ids:c,date:u}=l;e=u,i=c,await t({selected:s,type:"unknown",name:c.length.toString()}),r.visible=!0}function o(){return s}function a(){return e}function h(){return i}return{element:r,render:n,getSelected:o,getDate:a,getIds:h,isCluster:!0}}async function BM(){const r=await Qt(),t=await Wi(),e=await ee(),{element:i,render:s,update:n}=await Vb({isRoot:!0});i.zIndex=4;function o(a){if(it.isTemporal()&&!e.disableArtifacts){r.stage.addChild(i),s(a==null?void 0:a.artifacts);return}r.stage.removeChild(i)}t.artifacts&&o(t),tt.on("viewportMoved",()=>n()),tt.on("runDataCreated",a=>o(a)),tt.on("runDataUpdated",a=>o(a)),tt.on("configUpdated",()=>o()),tt.on("layoutSettingsUpdated",()=>o())}function _P(){}async function UM({radius:r}){const t=await Qt(),e=new ln;return e.beginFill("#fff"),e.drawCircle(0,0,r),e.endFill(),t.renderer.generateTexture(e,{resolution:10})}async function XM(r){return await Do(UM,[r])}async function Pb(r){const t=await XM(r);return new $t(t)}async function Lb(r){const t=new Ct,e=await Lt(),i=await mr(),s=await Pb({radius:e.styles.eventRadiusDefault}),{element:n,render:o}=await Yh();let a=!1;t.addChild(i),t.addChild(s),t.addChild(n),t.eventMode="static",t.cursor="pointer",t.on("mouseenter",()=>{a||s.scale.set(1.5)}),t.on("mouseleave",()=>{a||s.scale.set(1)}),tt.on("itemSelected",()=>{const u=gr({kind:"event",id:r.id,occurred:r.occurred});u!==a&&(a=u,s.scale.set(u?1.5:1),h())});function h(){const{eventColor:u,eventTargetSize:d,eventSelectedBorderInset:f}=e.styles;i.alpha=0,i.width=d,i.height=d,s.tint=u,s.anchor.set(.5),s.position.set(d/2,d/2),n.position.set(f,f),o({selected:a,width:d-f*2,height:d-f*2})}function l(){return r.id}function c(){return r.occurred}return{element:t,render:h,getId:l,getDate:c}}async function Gb(){const r=new Ct,t=await Lt(),e=await mr(),i=await Pb({radius:t.styles.eventClusterRadiusDefault}),{element:s,render:n}=await Yh(),{element:o,render:a}=await zh({cullAtZoomThreshold:!1});let h=null,l=[],c=!1;r.addChild(e),r.addChild(i),r.addChild(o),r.addChild(s),r.eventMode="static",r.cursor="pointer",r.on("mouseenter",()=>{c||i.scale.set(1.5)}),r.on("mouseleave",()=>{c||i.scale.set(1)}),tt.on("itemSelected",()=>{const x=gr({kind:"events",occurred:h,ids:l});x!==c&&(c=x,i.scale.set(x?1.5:1),h&&u({ids:l,date:h}))});async function u(x){if(!x){h=null,l=[],r.visible=!1;return}const{ids:b,date:v}=x;h=v,l=b,d(),f(),m(),await p(b.length.toString()),r.visible=!0}function d(){const{eventTargetSize:x}=t.styles;e.alpha=0,e.width=x,e.height=x}function f(){const{eventClusterColor:x,eventTargetSize:b}=t.styles;i.tint=x,i.anchor.set(.5),i.position.set(b/2,b/2)}async function p(x){if(l.length<2)return;const{eventTargetSize:b}=t.styles,v=-1;o.scale.set(.6),o.anchor.set(.5),o.position.set(b/2,b/2+v),await a(x)}function m(){const{eventSelectedBorderInset:x,eventTargetSize:b}=t.styles;s.position.set(x,x),n({selected:c,width:b-x*2,height:b-x*2})}function g(){return l}function y(){return h}return{element:r,render:u,getIds:g,getDate:y}}function Vr(r){return"getIds"in r}async function Fb({items:r,createCluster:t}){const e=[...r.values()].sort((o,a)=>o.element.x-a.element.x);async function i(o){let a,h=null,l=null;for(let c=o??0;c<e.length;c++){const u=e[c],d=u.element.x;if(u.element.visible=!0,h!==null&&a&&d<a){l=c;break}h=c,a=d+u.element.width}if(l!==null&&h!==null){const c=e[h],u=e[l];c.element.visible=!1,u.element.visible=!1;const d=await s(c,u);d&&(e.splice(h,1,d),e.splice(l,1)),i(h)}}async function s(o,a){const h=o.getDate(),l=a.getDate(),c=Vr(o)?o.getIds():[o.getId()],u=Vr(a)?a.getIds():[a.getId()];if(!h||!l)return console.error("flowRunArtifacts: visible item is missing date"),null;let d;Vr(o)?d=o:Vr(a)?d=a:d=await t();const f=[...c,...u],p=n(f);return await d.render({ids:f,date:p}),d}function n(o){const a=o.reduce((c,u)=>{const d=r.get(u),f=d==null?void 0:d.getDate();return f&&c.push(f.getTime()),c},[]),h=Math.min(...a),l=Math.max(...a);return new Date((h+l)/2)}await i()}async function Nb(r){const t=await Qt(),e=await te(),i=await Lt(),s=await ee();let n=await ii();const o=await h();o.element.on("click",c=>{c.stopPropagation();const{element:u}=o,d={x:u.position.x,y:u.position.y,width:u.width,height:u.height},f=Vr(o)?{kind:"events",ids:o.getIds(),occurred:o.getDate(),position:d}:{kind:"event",id:o.getId(),occurred:o.getDate(),position:d};Xi(f)}),tt.on("scaleUpdated",c=>{n=c,l()}),tt.on("viewportMoved",()=>l());async function a(c){await o.render(c),l()}async function h(){return r.type==="event"?await Lb(r.event):await Gb()}function l(){const c=o.getDate();if(!c||s.disableEvents||!it.isTemporal())return;const{element:u}=o,f=n(c)*e.scale._x+e.worldTransform.tx-u.width/2,p=t.screen.height-u.height-i.styles.eventBottomMargin;u.position.set(f,p)}return{...o,render:a}}async function kb(r){const t=await te(),e=await ee();let i=await ii();const s=await o();s.element.on("click",h=>{h.stopPropagation();const{element:l}=s,c=l.getGlobalPosition(),u={x:c.x,y:c.y,width:l.width*t.scale.x,height:l.height*t.scale.y},d=Vr(s)?{kind:"events",ids:s.getIds(),occurred:s.getDate(),position:u}:{kind:"event",id:s.getId(),occurred:s.getDate(),position:u};Xi(d)}),tt.on("scaleUpdated",h=>{i=h,a()});async function n(h){await s.render(h),a()}async function o(){return r.type==="event"?await Lb(r.event):await Gb()}function a(){const h=s.getDate(),{parentStartDate:l}=r;if(!h||e.disableEvents||!it.isTemporal()||!l)return;const{element:c}=s,d=i(h)-i(l)-c.width/2,f=-c.height;c.position.set(d,f)}return{...s,render:n}}async function Db({isRoot:r,parentStartDate:t}={}){const e=await ee(),i=new Map,s=new Map,n=[];let o=[];const a=new Ct;let h=null;tt.on("scaleUpdated",()=>u());async function l(p){if(p&&(h=p),!h)return;const m=[];for(const g of h)m.push(c(g));await Promise.all(m),u()}async function c(p){if(i.has(p.id))return i.get(p.id).render();if(s.has(p.id))return await s.get(p.id);const m=(async()=>{const g=r?await Nb({type:"event",event:p}):await kb({type:"event",event:p,parentStartDate:t});i.set(p.id,g),a.addChild(g.element)})();return s.set(p.id,m),await m,s.delete(p.id),i.get(p.id).render()}function u(){e.disableEvents||!it.isTemporal()||d()}const d=Mb(async()=>{o=[...n],await Fb({items:i,createCluster:f});for(const p of o)p.render()},250);async function f(){if(o.length>0)return o.pop();const p=r?await Nb({type:"cluster"}):await kb({type:"cluster",parentStartDate:t});return a.addChild(p.element),n.push(p),p}return{element:a,render:l,update:u}}let Bo=null,Mn=null;async function WM(){const r=await Qt(),t=await Lt(),e=await ee(),i=await Wi(),{element:s,render:n,update:o}=await Db({isRoot:!0});s.zIndex=2;async function a(l){if(!it.isTemporal()||e.disableEvents){r.stage.removeChild(s);return}r.stage.addChild(s),await n(l)}const h=await Sb(()=>({nodeId:t.runId,since:i.start_time,until:i.end_time??new Date}),l=>{const c=Mn?"eventDataUpdated":"eventDataCreated";Mn=l,tt.emit(c,Mn),a(l)});tt.on("configUpdated",()=>a()),tt.on("viewportMoved",()=>o()),tt.on("layoutSettingsUpdated",()=>a()),Bo=h.stop,h.start()}function ZM(){Bo==null||Bo(),Bo=null,Mn=null}async function VM(){return Mn||await Ce("eventDataCreated")}async function HM(r){const t=await Qt(),e=await te(),i=await Lt(),s=await Wi();let n=await ii();const o=new Ct,a=await mr(),h=await mr();let l=null,c=!1,u=!1;t.stage.addChild(h),o.addChild(a),a.eventMode="static",a.cursor="pointer",a.on("mouseover",()=>{c=!0,d()}),a.on("mouseleave",()=>{c=!1,d()}),a.on("click",()=>{const b={x:a.position.x,y:a.position.y,width:a.width,height:a.height};Xi({...r,kind:"state",position:b})}),tt.on("viewportMoved",()=>d()),tt.on("scaleUpdated",b=>{n=b,d()}),tt.on("itemSelected",()=>{const b=gr({kind:"state",...r});b!==u&&(u=b,c=!1,d())}),r.type==="RUNNING"&&!s.end_time&&g();function d(b){const{end:v}=b??{};if(v&&(l=v),s.end_time&&y(),!it.isTemporal()){h.visible=!1,o.visible=!1;return}const w=f();p(w),m(w),h.visible=!0,o.visible=!0}function f(){const{background:b="#fff"}=i.styles.state(r),v=Math.max(n(r.timestamp)*e.scale._x+e.worldTransform.tx,0);let w=0;return r.type==="RUNNING"&&!s.end_time?w=n(new Date)*e.scale._x+e.worldTransform.tx-v:l?w=n(l)*e.scale._x+e.worldTransform.tx-v:w=t.screen.width-v,{x:v,width:Math.max(w,0),background:b}}function p({x:b,width:v,background:w}){const{flowStateBarHeight:S,flowStateSelectedBarHeight:C}=i.styles,I=c||u?C:S;a.x=b,a.y=t.screen.height-I,a.width=v,a.height=I,a.tint=w}function m({x:b,width:v,background:w}){if(r.type==="RUNNING"){h.visible=!1;return}const{flowStateBarHeight:S,flowStateAreaAlpha:C}=i.styles;h.x=b,h.y=0,h.width=v,h.height=t.screen.height-S,h.tint=w,h.alpha=C}function g(){t.ticker.add(x)}function y(){t.ticker.remove(x)}function x(){d()}return{element:o,render:d}}function KM(r){return"isNodesFlowRunStateFactory"in r}async function YM(r){const t=await Qt(),e=await te(),i=await Lt(),s=await Wi();let n=await ii();const o=new Ct,a=await mr(),h=await mr();let l=null,c=null,u=0,d=0,f=!1,p=!1;o.visible=!1,o.addChild(h),o.addChild(a),a.eventMode="static",a.cursor="pointer",a.on("mouseover",()=>{f=!0,m()}),a.on("mouseleave",()=>{f=!1,m()}),a.on("click",S=>{S.stopPropagation();const C=a.getGlobalPosition(),I={x:C.x,y:C.y,width:a.width*e.scale.x,height:a.height*e.scale.y};Xi({...r,kind:"state",position:I})}),h.eventMode="none",h.cursor="default",tt.on("scaleUpdated",S=>{n=S,m()}),tt.on("itemSelected",()=>{const S=gr({kind:"state",...r});S!==p&&(p=S,f=!1,m())}),r.type==="RUNNING"&&!s.end_time&&b();function m(S){const{end:C,parentStartDate:I,width:M,height:L}=S??{};if(C&&(l=C),I&&(c=I),M&&(u=M),L&&(d=L),s.end_time&&v(),!it.isTemporal()){o.visible=!1;return}if(!c||u<=0){o.visible=!1;return}const G=g();if(G.width<=0){o.visible=!1;return}y(G),x(G),o.visible=!0}function g(){const{background:S="#fff"}=i.styles.state(r);if(!c)return{x:0,width:0,background:S};const C=n(c);let I=n(r.timestamp)-C;if(I>=u)return{x:u,width:0,background:S};I<0&&(I=0);let M=n(l??new Date)-C;M>u&&(M=u);const L=Math.max(M-I,0);return{x:I,width:L,background:S}}function y({x:S,width:C,background:I}){const{flowStateBarHeight:M,flowStateSelectedBarHeight:L}=i.styles,G=f||p?L:M;a.x=S,a.y=d-G,a.width=C,a.height=G,a.tint=I}function x({x:S,width:C,background:I}){const{flowStateBarHeight:M,flowStateAreaAlpha:L,nodeHeight:G}=i.styles,N=G/2;h.x=S,h.y=N,h.width=C,h.height=d-M-N,h.tint=I,h.alpha=L}function b(){t.ticker.add(w)}function v(){t.ticker.remove(w)}function w(){m()}return{element:o,render:m,isNodesFlowRunStateFactory:!0}}function Ob({isRoot:r}={}){const t=new Ct,e=new Map,i=new Map;let s=null;async function n(a,h){if(a&&(s=a),!s)return;const l=[];for(let c=0;c<s.length;c++)l.push(o(s[c],c,h));await Promise.all(l)}async function o(a,h,l){const c=s&&s.length>=h+1&&s[h+1],u=c?c.timestamp:void 0;let d;if(i.has(a.id)&&await i.get(a.id),e.has(a.id))d=e.get(a.id);else{const f=(async()=>{const p=r?await HM(a):await YM(a);e.set(a.id,p),t.addChild(p.element)})();i.set(a.id,f),await f,i.delete(a.id),d=e.get(a.id)}KM(d)?await d.render({end:u,...l}):await d.render(u?{end:u}:void 0)}return{element:t,render:n}}async function zM(){const r=await Qt(),t=await Wi(),{element:e,render:i}=await Ob({isRoot:!0});e.zIndex=3,r.stage.addChild(e);function s(n){i(n==null?void 0:n.states)}t.states&&s(t),tt.on("runDataUpdated",n=>s(n)),tt.on("configUpdated",()=>s()),tt.on("layoutSettingsUpdated",()=>s())}function vP(){}async function jM(){const r=await Qt(),t=await te(),e=await ee(),i=await Lt(),{inter:s}=await gb(),n=new Ct,o=await mr();n.addChild(o);const a=s("");n.addChild(a);let h=await ii(),l,c;tt.on("scaleUpdated",m=>{h=m,p()}),tt.on("viewportMoved",()=>{e.disableGuides||(p(),n.height!==r.screen.height&&d())});function u(m,g){l=m,c=g,d(),f(m)}function d(){o.width=i.styles.guideLineWidth,o.height=r.screen.height,o.tint=i.styles.guideLineColor}function f(m){a.text=c(m),a.fontSize=i.styles.guideTextSize,a.tint=i.styles.guideTextColor,a.position.set(i.styles.guideTextLeftPadding,i.styles.guideTextTopPadding)}function p(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:u}}class Bb extends Error{constructor(){super("Layout is not temporal")}}function JM(r){return r.toLocaleTimeString()}function Ub(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function $M(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function QM(r){return r.getHours()===0&&r.getMinutes()===0?`${Qh.date(r)}
|
|
1176
|
+
${Ub(r)}`:Ub(r)}const Qh={timeBySeconds:JM,timeByMinutesWithDates:QM,date:$M},ne={seconds:"seconds",minutes:"minutes",date:"date"},Uo={day:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.getTime()},week:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.setDate(r.getDate()-r.getDay()+1),t.getTime()}},At={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},Xb=[{ceiling:At.second*4,increment:At.second,labelFormat:ne.seconds},{ceiling:At.second*8,increment:At.second*5,labelFormat:ne.seconds},{ceiling:At.second*13,increment:At.second*10,labelFormat:ne.seconds},{ceiling:At.second*20,increment:At.second*15,labelFormat:ne.seconds},{ceiling:At.second*45,increment:At.second*30,labelFormat:ne.seconds},{ceiling:At.minute*4,increment:At.minute,labelFormat:ne.minutes},{ceiling:At.minute*8,increment:At.minute*5,labelFormat:ne.minutes},{ceiling:At.minute*13,increment:At.minute*10,labelFormat:ne.minutes},{ceiling:At.minute*28,increment:At.minute*15,labelFormat:ne.minutes},{ceiling:At.hour*1.24,increment:At.minute*30,labelFormat:ne.minutes},{ceiling:At.hour*3,increment:At.hour,labelFormat:ne.minutes},{ceiling:At.hour*8,increment:At.hour*2,getAnchor:Uo.day,labelFormat:ne.minutes},{ceiling:At.hour*13,increment:At.hour*6,getAnchor:Uo.day,labelFormat:ne.minutes},{ceiling:At.hour*22,increment:At.hour*12,getAnchor:Uo.day,labelFormat:ne.minutes},{ceiling:At.day*4,increment:At.day,getAnchor:Uo.day,labelFormat:ne.date},{ceiling:At.week*2,increment:At.week,getAnchor:Uo.week,labelFormat:ne.date},{ceiling:1/0,increment:At.week*4,labelFormat:ne.date}],qM=300;async function tR(){const r=await te(),t=await ee(),e=new Ct,i=new Map;let s=await ii();tt.on("scaleUpdated",d=>s=d),await o();function n(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:f,labelFormat:p}=a(),m=u(d,f);c(m,p)}catch(d){if(d instanceof Bb)return;console.error(d)}}async function o(){const d=[];Ld(30,async f=>{const p=jM();d.push(p);const m=await p;e.addChild(m.element),i.set(f,m)}),await Promise.all(d)}function a(){const d=r.left-qM,f=s.invert(d),p=s.invert(d+260/r.scale.x);if(!(f instanceof Date)||!(p instanceof Date))throw new Bb;const m=p.getTime()-f.getTime(),{increment:g,getAnchor:y,labelFormat:x}=h(m);return{anchor:y(f),increment:g,labelFormat:l(x)}}function h(d){const f=Xb.find(p=>p.ceiling>d)??Xb[0];return f.getAnchor||(f.getAnchor=p=>Math.floor(p.getTime()/f.increment)*f.increment),f}function l(d){switch(d){case ne.minutes:return Qh.timeByMinutesWithDates;case ne.date:return Qh.date;default:return Qh.timeBySeconds}}function c(d,f){const p=new Map(i.entries()),m=Array.from(p.keys()).filter(g=>!d.includes(g));i.clear();for(const g of d){if(p.has(g)){const x=p.get(g);i.set(g,x),x.render(new Date(g),f);continue}const y=p.get(m.pop()??-1);if(y===void 0){console.warn("Guides: No unused guides available to render.");continue}y.render(new Date(g),f),i.set(g,y)}}function u(d,f){return Ld(30,p=>d+f*p)}return{element:e,render:n}}async function eR(){const r=await Qt(),{element:t,render:e}=await tR();r.stage.addChild(t),e(),tt.on("viewportDateRangeUpdated",()=>e()),tt.on("layoutSettingsUpdated",()=>e()),tt.on("configUpdated",()=>e())}function wP(){}const iR=80;async function rR(){const r=await Qt(),t=await te(),e=await ee(),i=await Lt(),s=await mr();let n=await ii();tt.on("scaleUpdated",h=>n=h);function o(){if(!e.isTemporal()){s.visible=!1;return}s.width=i.styles.playheadWidth,s.height=r.stage.height,s.tint=i.styles.playheadColor,s.position.x=n(new Date)*t.scale.x+t.worldTransform.tx,a()}function a(){if(t.moving||!(s.position.x>0&&s.position.x<r.screen.width)||!(s.position.x>r.screen.width-iR))return;const c=t.left;t.zoomPercent(-.1,!0),t.left=c}return{element:s,render:o}}async function sR(){const r=await Qt(),t=await Wi(),{element:e,render:i}=await rR();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),tt.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function TP(){}function nR({stage:r,props:t}){cE(),FA(),LA(),eR(),pR(),BM(),WM(),zM(),sR(),gE(),cM(),hE(r),_E(t),WA(),_R(),yM()}function oR(){tt.clear();try{uE(),NA(),GA(),lE(),mR(),ZM(),vE(),yE(),dM(),ZA(),vR(),bM(),YA()}catch(r){console.error(r)}}async function Wb(r){const t=await Qt(),e=await te(),i=await Lt(),s=await ee(),n=await VM();let o=await ii(),a=n&&n.length>0;const h=await c();h.element.on("click",d=>{d.stopPropagation();const{element:f}=h,p=f.getGlobalPosition(),m={x:p.x,y:p.y,width:f.width,height:f.height},g=Vr(h)?{kind:"artifacts",ids:h.getIds(),position:m}:{kind:"artifact",id:h.getId()};Xi(g)}),tt.on("scaleUpdated",d=>{o=d,u()}),tt.on("viewportMoved",()=>u()),tt.on("eventDataCreated",d=>{a=d.length>0,u()}),tt.on("eventDataUpdated",d=>{a=d.length>0,u()});async function l(d){await h.render(d),u()}async function c(){return r.type==="artifact"?await Dd(r.artifact,{cullAtZoomThreshold:!1}):await Rb()}function u(){const d=h.getDate();if(!d||!it.isTemporal()||s.disableArtifacts)return;const f=h.getSelected(),{element:p}=h,{eventTargetSize:m,flowStateSelectedBarHeight:g}=i.styles;let y=0;if(f){const{selectedBorderOffset:S,selectedBorderWidth:C}=i.styles;y=S+C*2}const b=o(d)*e.scale._x+e.worldTransform.tx-(p.width-y)/2,v=a&&!s.disableEvents?m:g,w=t.screen.height-(p.height-y)-v;p.position.set(b,w)}return{...h,render:l}}async function Zb(r){const t=await te(),e=await Lt(),i=await ee();let s=await ii();const n=await a();n.element.on("click",l=>{console.log("artifact click"),l.stopPropagation();const{element:c}=n,u=c.getGlobalPosition(),d={x:u.x,y:u.y,width:c.width*t.scale.x,height:c.height*t.scale.y},f=Vr(n)?{kind:"artifacts",ids:n.getIds(),position:d}:{kind:"artifact",id:n.getId()};Xi(f)}),tt.on("scaleUpdated",l=>{s=l,h()});async function o(l){await n.render(l),h()}async function a(){return r.type==="artifact"?await Dd(r.artifact):await Rb()}function h(){const l=n.getDate(),{parentStartDate:c}=r;if(!l||!it.isTemporal()||i.disableArtifacts||!c)return;const u=n.getSelected(),{element:d}=n;let f=0;if(u){const{selectedBorderOffset:y,selectedBorderWidth:x}=e.styles;f=y+x*2}const m=s(l)-s(c)-(d.width-f)/2,g=-(d.height-f);d.position.set(m,g)}return{...n,render:o}}async function Vb({isRoot:r,parentStartDate:t}={}){const e=await ee(),i=new Map,s=new Map,n=[];let o=[];const a=new Ct;let h=null;async function l(p){if(p&&(h=p),!h)return;const m=[];for(const g of h)m.push(c(g));await Promise.all(m),u()}async function c(p){if(i.has(p.id))return i.get(p.id).render();s.has(p.id)&&await s.get(p.id);const m=(async()=>{const g=r?await Wb({type:"artifact",artifact:p}):await Zb({type:"artifact",artifact:p,parentStartDate:t});i.set(p.id,g),a.addChild(g.element)})();return s.set(p.id,m),await m,s.delete(p.id),i.get(p.id).render()}function u(){if(!(e.disableArtifacts||!it.isTemporal())){if(!it.isTemporal()){a.visible=!1;return}a.visible=!0,a.position.x=0,d()}}const d=Mb(async()=>{o=[...n],await Fb({items:i,createCluster:f});for(const p of o)p.render()},250);async function f(){if(o.length>0)return o.pop();const p=r?await Wb({type:"cluster"}):await Zb({type:"cluster",parentStartDate:t});return a.addChild(p.element),n.push(p),p}return{element:a,render:l,update:u}}class Hb extends Ct{updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t)this.children[t].updateTransform()}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(const t of this.children)if(t.calculateBounds(),t._mask){const e=t._mask.isMaskData?t._mask.maskObject:t._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(t._bounds,e._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds);this._bounds.updateID=this._boundsID}}async function aR(r){const t=new Hb,e=await Lt(),i=await ee(),{element:s,render:n}=await Eb(),{element:o,render:a}=await zh(),{element:h,render:l}=await _M(),{element:c,render:u}=await Fd(),{element:d,render:f,getSize:p,stopWorker:m}=await jb(),{element:g,render:y}=await Ob(),{element:x,render:b,update:v}=await Db({parentStartDate:r.start_time}),{element:w,render:S,update:C}=await Vb({parentStartDate:r.start_time});let I=!1,M=!1,L=r,G=!1;t.sortableChildren=!0,c.zIndex=0,s.zIndex=4,o.zIndex=5,h.zIndex=5,d.zIndex=2,x.zIndex=1,g.zIndex=2,w.zIndex=3,c.eventMode="none",c.cursor="default";const{start:N,stop:A}=await Yg(L.id,Q=>{M=!!Q.artifacts&&Q.artifacts.length>0,f(Q),B(Q.states),F(Q.artifacts),j()}),{start:D,stop:Z}=await Sb(()=>({nodeId:L.id,since:L.start_time,until:L.end_time??new Date}),Q=>{I=Q.length>0,k(Q)});t.addChild(s),t.addChild(o),t.addChild(h),h.on("click",Q=>{Q.stopPropagation(),H()}),d.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},d.on("rendered",()=>{Vh(),Tt()});async function K(Q){return L=Q,await n(Q),await ft(),await at(),G&&(await B(),await k(),await F(),await j()),t}async function H(){G?await et():await V()}async function j(){const{background:Q="#fff"}=e.styles.node(L),{width:W,height:J}=p(),{height:$}=It(),{nodeBorderRadius:O}=e.styles,pt=2;c.position={x:-pt,y:-pt};const yt=it.isTemporal()?$+pt*2:J+pt*2;await u({width:W+pt*2,height:yt,stroke:pt,radius:[O,O,0,0],color:Q})}async function B(Q){const{height:W}=It(),{width:J}=s;await y(Q??void 0,{parentStartDate:L.start_time,width:J,height:W})}async function k(Q){if(!G||!it.isTemporal()||i.disableEvents){t.removeChild(x);return}t.addChild(x);const{height:W}=It();if(x.position={x:0,y:W-e.styles.eventBottomMargin},Q){await b(Q);return}await v()}async function F(Q){if(!G||!it.isTemporal()||i.disableArtifacts){t.removeChild(w);return}t.addChild(w);const{eventTargetSize:W,flowStateSelectedBarHeight:J}=e.styles,{height:$}=It(),O=$-(I&&!i.disableEvents?W:J);if(w.position={x:0,y:O},Q){await S(Q);return}await C()}async function V(){G=!0,t.addChild(g),t.addChild(d),t.addChild(c),await Promise.all([N(),D(),K(L)]),Tt()}async function et(){G=!1,t.removeChild(g),t.removeChild(d),t.removeChild(c),t.removeChild(x),t.removeChild(w),m(),await Promise.all([A(),Z(),K(L)]),Tt()}async function ft(){const Q=e.styles.nodeToggleSize,W=e.styles.nodeHeight-Q,J=s.width>Q,$=await l({inside:J,isOpen:G});return $.x=J?W/2:s.width+e.styles.nodePadding,$.y=W/2,$}async function at(){const Q=await a(L.label),W=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,J=e.styles.nodePadding,$=h.x+h.width+J,O=s.width+J,pt=s.width>$+Q.width+J,yt=e.styles.nodeHeight/2-Q.height/2,Rt=pt?$:Math.max(O,$);return Q.position={x:Rt,y:yt},Q.tint=pt?W:e.styles.textDefault,Q}function Tt(){G&&(B(),k(),F(),j());const Q=It();t.emit("resized",Q)}function It(){const Q=p(),{nodeHeight:W,nodesPadding:J,eventTargetSize:$,eventBottomMargin:O,artifactPaddingY:pt,artifactIconSize:yt}=e.styles,Ot=M&&it.isTemporal()&&!i.disableArtifacts?yt+pt*2:0,Ze=I&&it.isTemporal()&&!i.disableEvents?$+O:0,Wo=G?Q.height+Ot+Ze+J*2:0,Kr=G?Q.width:0;return{height:W+Wo,width:Math.max(Kr,t.width)}}return{kind:"flow-run",element:t,bar:s,render:K}}async function hR(){const r=await Lt(),t=new Hb,{element:e,render:i}=await zh(),{element:s,render:n}=await Eb();t.addChild(s),t.addChild(e);async function o(h){return await Promise.all([n(h),i(h.label)]),a(),t}function a(){const h=r.styles.colorMode==="dark"?r.styles.textDefault:r.styles.textInverse,l=r.styles.nodePadding,c=s.width>l+e.width+l,u=c?l:s.width+l,d=r.styles.nodeHeight/2-e.height/2;e.position={x:u,y:d},e.tint=c?h:r.styles.textDefault}return{kind:"task-run",element:t,render:o,bar:s}}async function lR(r){const t=await Lt(),e=await Qt(),i=await ob(),s=await ee();let n=null;const o=new Map,{animate:a}=await hb(),{element:h,render:l,bar:c}=await C(r);let u=r,d=null,f=!1,p=!1;i.add(h),h.eventMode="static",h.cursor="pointer",h.name=ix,h.on("click",L=>{L.stopPropagation(),Xi({kind:u.kind,id:u.id})}),u.end_time||v(),tt.on("itemSelected",()=>{const L=gr({kind:u.kind,id:u.id});L!==f&&(f=L,l(u))});async function m(L){u=L;const G=I(L);return G===d||(d=G,await Promise.all([l(L),g(L.artifacts)]),L.end_time&&w()),h}async function g(L){if(!L||(x(),s.disableArtifacts||!it.isTemporal()))return;const G=[];for(const N of L)G.push(y(N));await Promise.all(G),b()}async function y(L){if(o.has(L.id))return o.get(L.id).render();const G=await Dd(L,{enableLocalClickHandling:!0});return o.set(L.id,G),n.addChild(G.element),G.render()}function x(){if(it.isTemporal()&&!s.disableArtifacts){n||(n=new Ct),h.addChild(n);return}n&&h.removeChild(n)}function b(){if(!n)return;const{artifactsGap:L,artifactsNodeOverlap:G}=t.styles;let N=0;for(const A of o.values())A.element.position.x=N,N+=A.element.width+L;n.position.y=-n.height+G,n.width<c.width&&(n.position.x=c.width-n.width)}function v(){e.ticker.add(S)}function w(){e.ticker.remove(S)}function S(){m(u)}async function C(L){const{kind:G}=L;switch(G){case"task-run":return await hR();case"flow-run":return await aR(L);default:const N=G;throw new Error(`switch does not have case for value: ${N}`)}}function I(L){var D;const G=L.end_time??new Date,N=((D=L.artifacts)==null?void 0:D.length)??0;return[L.state_type,G.getTime(),N,it.horizontal,it.horizontalScaleMultiplier,t.styles.colorMode,N>0&&s.disableArtifacts].join("-")}function M({x:L,y:G}){a(h,{x:L,y:G},!p),p=!0}return{element:h,render:m,bar:c,setPosition:M}}function Kb({gap:r=0,minimum:t=0}={}){const e=new Map;function i(c){const u=e.get(c)??[];return Math.max(...u.values(),z.toValue(t))+z.toValue(r)}function s(c){let u=0;for(let d=0;d<c;d++)u+=i(d);return u}function n(c){return s(c+1)-z.toValue(r)}function o({axis:c,nodeId:u,offset:d}){const f=e.get(c)??new Map;f.set(u,d),e.set(c,f)}function a({axis:c,nodeId:u}){let d,f;for(const[p,m]of e.entries())if(m.has(u)){d=p,f=m.get(u);break}d===c||d===void 0||f===void 0||(h({axis:d,nodeId:u}),o({axis:c,nodeId:u,offset:f}))}function h({axis:c,nodeId:u}){var d;(d=e.get(c))==null||d.delete(u)}function l(){e.clear()}return{getOffset:i,getTotalOffset:s,getTotalValue:n,setOffset:o,updateNodeAxis:a,removeOffset:h,clear:l}}function cR(r){throw new Error(`switch does not have case for value: ${r}`)}const Yb="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGlvbiBDbihuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjpuPGU/LTE6bj5lPzE6bj49ZT8wOk5hTn1mdW5jdGlvbiBudChuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjplPG4/LTE6ZT5uPzE6ZT49bj8wOk5hTn1mdW5jdGlvbiBSbihuKXtsZXQgZSx0LHI7bi5sZW5ndGghPT0yPyhlPUNuLHQ9KHUsbCk9PkNuKG4odSksbCkscj0odSxsKT0+bih1KS1sKTooZT1uPT09Q258fG49PT1udD9uOmV0LHQ9bixyPW4pO2Z1bmN0aW9uIG8odSxsLGY9MCxnPXUubGVuZ3RoKXtpZihmPGcpe2lmKGUobCxsKSE9PTApcmV0dXJuIGc7ZG97Y29uc3QgbT1mK2c+Pj4xO3QodVttXSxsKTwwP2Y9bSsxOmc9bX13aGls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UuanMubWFwCg==",uR=r=>Uint8Array.from(atob(r),t=>t.charCodeAt(0)),zb=typeof window<"u"&&window.Blob&&new Blob([uR(Yb)],{type:"text/javascript;charset=utf-8"});function dR(r){let t;try{if(t=zb&&(window.URL||window.webkitURL).createObjectURL(zb),!t)throw"";const e=new Worker(t,{name:r==null?void 0:r.name});return e.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+Yb,{name:r==null?void 0:r.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}function fR(r){const t=new dR;return t.onmessage=r,t}async function jb(){const r=new Map,t=new Map,e=new Ct,i=new Ct,s=await Lt();let n=null;const o=Kb({gap:()=>s.styles.rowGap,minimum:()=>s.styles.nodeHeight}),a=Kb({gap:()=>s.styles.columnGap,minimum:()=>Bd()});let h=null,l=null;e.name=Pf,tt.on("layoutUpdated",()=>{o.clear(),a.clear()}),tt.on("layoutSettingsUpdated",()=>{l&&e.parent&&c(l),A()}),tt.on("itemSelected",()=>{A()});async function c(B){u(),l=B,h=null,await Promise.all([f(B),m(B)]),y(B)}function u(){n||(n=fR(G))}function d(){n&&(n.terminate(),n=null)}async function f(B){const k=[];for(const F of B.nodes.values())k.push(p(F));await Promise.all(k)}async function p(B){const{render:k}=await v(B);return await k(B)}async function m(B){if((await ee()).disableEdges){e.removeChild(i);return}e.addChildAt(i,0);const F=[];for(const[V,{children:et}]of B.nodes)for(const{id:ft}of et)F.push(g(V,ft));await Promise.all(F)}async function g(B,k){const F=`${B}_${k}`;if(t.has(F))return;const V=await QA();t.has(F)||(t.set(F,V),i.addChild(V.element))}function y(B){if(!n)throw new Error("Layout worker not initialized");const k=new Map;for(const[F,{element:V}]of r)k.set(F,V.width);n.postMessage({type:"layout",data:B,widths:k,horizontalSettings:Ad(B.start_time),verticalSettings:PA()})}function x(){if(h)for(const[B,k]of t){const[F,V]=B.split("_"),et=h.positions.get(F),ft=h.positions.get(V),at=r.get(F);if(!et||!ft){console.warn(`Could not find edge in layout: Skipping ${B}`);continue}if(!at){console.warn(`Could not find parent node in nodes: Skipping ${F}`);continue}const Tt=at.bar.width,It=S(et),Q={x:It.x+Tt,y:It.y+s.styles.nodeHeight/2},W=S(ft),J={x:W.x-Q.x,y:W.y-Q.y+s.styles.nodeHeight/2};k.setPosition(Q,J)}}function b(){if(h){for(const[B,k]of r){const F=h.positions.get(B);if(!F){console.warn(`Could not find node in layout: Skipping ${B}`);continue}const V=S(F);k.setPosition(V),o.updateNodeAxis({nodeId:B,axis:F.y}),a.updateNodeAxis({nodeId:B,axis:F.column})}x(),e.emit("rendered"),e.emit("resized",L())}}async function v(B){const k=r.get(B.id);if(k)return k;const F=await lR(B);return F.element.on("resized",V=>w(B.id,V)),r.set(B.id,F),e.addChild(F.element),F}function w(B,k){if(!h)return;const F=r.get(B),V=h.positions.get(B);!F||!V||(o.setOffset({nodeId:B,axis:V.y,offset:k.height}),a.setOffset({nodeId:B,axis:V.column,offset:k.width}),b())}function S(B){const k=o.getTotalOffset(B.y);return{x:C(B),y:k}}function C(B){return it.isDependency()?a.getTotalOffset(B.column):B.x}function I(){return h?o.getTotalValue(h.maxRow):0}function M(){if(!h||!l)return 0;if(it.isDependency())return a.getTotalValue(h.maxColumn);const B=Ad(l.start_time),k=ib(B),F=k(l.end_time??new Date),V=k(l.start_time);return F-V}function L(){return{width:M(),height:I()}}function G({data:B}){const{type:k}=B;switch(k){case"layout":N(B);return;default:cR(k)}}function N(B){h=B.layout,b()}async function A(){const B=await ee(),k=xM();if(B.disableEdges||!k||!(l!=null&&l.nodes.has(k.id))){D([]);return}const F=H(k.id);D(F)}function D(B){Z(B),K(B)}function Z(B){for(const[k,{element:F}]of r){if(B.length===0||B.includes(k)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function K(B){for(const[k,{element:F}]of t){const[V,et]=k.split("_");if(B.length===0||B.includes(V)&&B.includes(et)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function H(B){const k=j(B,"parents"),F=j(B,"children");return[B,...k,...F]}function j(B,k){const F=l==null?void 0:l.nodes.get(B);if(!F)return[];const V=[];for(const{id:et}of F[k])V.push(et),V.push(...j(et,k));return V}return{element:e,stopWorker:d,getSize:L,render:c}}let Xo=null,Hr=null,Gs=null;async function pR(){const r=await te(),t=await Lt(),{element:e,render:i}=await jb();r.addChild(e),e.alpha=0;const s=await Yg(t.runId,async n=>{const o=Hr?"runDataUpdated":"runDataCreated";Hr=n,tt.emit(o,Hr),await ee(),i(n)});tt.on("configUpdated",()=>{Hr&&i(Hr)}),Gs=e,Xo=s.stop,Gs.once("rendered",()=>gR()),tt.on("layoutUpdated",()=>yR()),s.start()}function mR(){Xo==null||Xo(),Xo=null,Gs=null,Hr=null}async function Wi(){return Hr||await Ce("runDataCreated")}function gR(){Rd(),Te.shared.addOnce(()=>{Gs&&(Gs.alpha=1)})}async function yR(){if(!Gs)return;const r=await Lt();Gs.once("rendered",()=>{setTimeout(()=>{Rd({animate:!0})},r.animationDuration)})}function bR(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function xR({start_time:r,end_time:t,nodes:e},i,s){const n=Math.max(hx(t??new Date,r),1),o=i.styles.nodeHeight+i.styles.rowGap;return(e.size>0?e.size*o*.5:o*4)*s/(n*20)}async function _R(){const r=await Wi(),t=await Lt(),e=await Qt(),i=e.view.width/e.view.height,s=xR(r,t,i);qh(s,!0),r.nodes.size>t.disableAnimationsThreshold&&(it.disableAnimations=!0),bR(r.nodes)>t.disableEdgesThreshold&&(it.disableEdges=!0)}function vR(){it.horizontal="temporal",it.vertical="nearest-parent",it.horizontalScaleMultiplierDefault=0,it.horizontalScaleMultiplier=0,it.disableAnimations=!1,it.disableGuides=!1,it.disableEdges=!1,it.disableArtifacts=!1,it.disableEvents=!1}const it=z.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableGuides:!1,disableEdges:!1,disableArtifacts:!1,disableEvents:!1,isTemporal(){return this.horizontal==="temporal"},isDependency(){return this.horizontal==="dependency"},isWaterfall(){return this.vertical==="waterfall"},isNearestParent(){return this.vertical==="nearest-parent"},isLeftAligned(){return this.horizontal==="left-aligned"}});async function ee(){return Ud()?it:await Ce("layoutSettingsCreated")}function Bd(){return it.isDependency()?200:20*it.horizontalScaleMultiplier}function wR(){return[0,Bd()]}function TR(r){if(it.isDependency())return[0,1];const t=r,e=ox(t,1);return[t,e]}function qh(r,t=!1){if(it.horizontalScaleMultiplier===r)return;const e=Rn();it.horizontalScaleMultiplier=r,t&&(it.horizontalScaleMultiplierDefault=r),e()}function SR(){qh(it.horizontalScaleMultiplierDefault)}function ER(r){if(it.horizontal===r)return;const t=Rn();it.horizontal=r,it.disableGuides=it.isDependency()||it.isLeftAligned(),t()}function CR(r){if(it.vertical===r)return;const t=Rn();it.vertical=r,t()}function IR(r){if(it.disableEdges===r)return;const t=Rn();it.disableEdges=r,t()}function AR(r){if(it.disableArtifacts===r)return;const t=Rn();it.disableArtifacts=r,t()}function MR(r){if(it.disableEvents===r)return;const t=Rn();it.disableEvents=r,t()}function Rn(){const r=Ud()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=it;return()=>{Ud()&&tt.emit(r,it),(t!==it.horizontal||e!==it.vertical)&&tt.emit("layoutUpdated")}}function Ud(){return it.horizontalScaleMultiplier!==0}function Jb(r){if(!(r instanceof HTMLElement))return!1;const t=r.tagName.toLowerCase();return["input","textarea"].includes(t)}const RR={class:"flex items-center gap-2"},PR=z.defineComponent({__name:"RunGraphSettings",setup(r){const t=[ji.positions.topRight,ji.positions.bottomRight,ji.positions.topLeft,ji.positions.bottomLeft],e=[{label:"Temporal dependency",value:"temporal_nearest-parent"},{label:"Temporal sequence",value:"temporal_waterfall"},{label:"Dependency grid",value:"dependency_nearest-parent"},{label:"Sequential grid",value:"dependency_waterfall"},{label:"Comparative duration",value:"left-aligned_duration-sorted"}],i=z.computed({get(){return`${it.horizontal}_${it.vertical}`},set(u){const[d,f]=u.split("_");ER(d),CR(f)}}),s=z.computed({get(){return it.disableEdges},set(u){IR(u)}}),n=z.computed({get(){return it.disableArtifacts},set(u){AR(u)}}),o=z.computed({get(){return it.disableEvents},set(u){MR(u)}});function a(){const d=it.horizontalScaleMultiplier*1.25;qh(d)}function h(){const u=Math.abs(-.75),d=it.horizontalScaleMultiplier*u;qh(d)}_r.useKeyDown(["-","="],l);function l(u){if(!(Jb(u.target)||u.metaKey||u.ctrlKey))switch(u.key){case"-":h();break;case"=":a();break}}function c(){SR()}return(u,d)=>{const f=z.resolveComponent("p-radio-group"),p=z.resolveComponent("p-label"),m=z.resolveComponent("p-divider"),g=z.resolveComponent("p-checkbox"),y=z.resolveComponent("p-overflow-menu");return z.openBlock(),z.createBlock(z.unref(ji.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:z.withCtx(({toggle:x})=>[z.createVNode(z.unref(ji.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:x},null,8,["onClick"])]),default:z.withCtx(()=>[z.createVNode(y,{class:"run-graph-settings__menu"},{default:z.withCtx(()=>[z.createVNode(p,{label:"Layout"},{default:z.withCtx(()=>[z.createVNode(f,{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=x=>i.value=x),options:e},{label:z.withCtx(({option:x})=>[z.createTextVNode(z.toDisplayString(x.label),1)]),_:1},8,["modelValue"])]),_:1}),z.unref(it).isTemporal()||z.unref(it).isLeftAligned()?(z.openBlock(),z.createElementBlock(z.Fragment,{key:0},[z.createVNode(m),z.createVNode(p,{label:"Scaling"},{default:z.withCtx(()=>[z.createElementVNode("div",RR,[z.createVNode(z.unref(ji.PButton),{title:"Decrease scale (-)",small:"",icon:"MinusIcon",onClick:h}),z.createVNode(z.unref(ji.PButton),{title:"Increase scale (+)",small:"",icon:"PlusIcon",onClick:a}),z.createVNode(z.unref(ji.PButton),{small:"",onClick:c},{default:z.withCtx(()=>[z.createTextVNode(" Reset ")]),_:1})])]),_:1})],64)):z.createCommentVNode("",!0),z.createVNode(m),z.createVNode(g,{modelValue:s.value,"onUpdate:modelValue":d[1]||(d[1]=x=>s.value=x),label:"Hide dependency arrows"},null,8,["modelValue"]),z.createVNode(g,{modelValue:n.value,"onUpdate:modelValue":d[2]||(d[2]=x=>n.value=x),label:"Hide artifacts"},null,8,["modelValue"]),z.createVNode(g,{modelValue:o.value,"onUpdate:modelValue":d[3]||(d[3]=x=>o.value=x),label:"Hide events"},null,8,["modelValue"])]),_:1})]),_:1})}}}),LR={class:"run-graph__actions"},GR=z.defineComponent({__name:"RunGraph",props:{config:{},viewport:{},fullscreen:{type:[Boolean,null],default:null},selected:{default:null}},emits:["update:viewport","update:fullscreen","update:selected"],setup(r,{emit:t}){const e=r,i=t,s=z.ref(),n=z.ref(!1),o=z.computed({get(){return e.fullscreen??n.value},set(u){n.value=u,i("update:fullscreen",u)}});z.watch(()=>e.selected,u=>Xi(u)),tt.on("itemSelected",u=>i("update:selected",u)),z.watch(()=>e.viewport,u=>UA(u));const a=z.computed(()=>({root:{"run-graph--fullscreen":o.value}}));tt.on("viewportDateRangeUpdated",u=>i("update:viewport",u));function h(){Rd({animate:!0})}function l(){o.value=!o.value}z.onMounted(()=>{if(!s.value)throw new Error("Stage does not exist");nR({stage:s.value,props:e})}),z.onBeforeUnmount(()=>{oR()}),_r.useKeyDown(["c","f","Escape"],c);function c(u){if(!(Jb(u.target)||u.metaKey||u.ctrlKey))switch(u.key){case"c":h();break;case"f":l();break;case"Escape":o.value&&l();break}}return(u,d)=>{const f=z.resolveComponent("p-button");return z.openBlock(),z.createElementBlock("div",{class:z.normalizeClass(["run-graph",a.value.root])},[z.createElementVNode("div",{ref_key:"stage",ref:s,class:"run-graph__stage"},null,512),z.createElementVNode("div",LR,[z.createVNode(f,{title:"Recenter graph (c)",icon:"Target",flat:"",onClick:h}),z.createVNode(f,{title:"Toggle fullscreen (f)",icon:"ArrowsPointingOutIcon",flat:"",onClick:l}),z.createVNode(PR)])],2)}}});Ft.RunGraph=GR,Ft.artifactTypeIconMap=yb,Ft.artifactTypes=pM,Ft.isArtifactSelection=bb,Ft.isArtifactsSelection=xb,Ft.isEventSelection=vb,Ft.isEventsSelection=wb,Ft.isNodeSelection=jh,Ft.isRunGraphNodeType=mM,Ft.isStateSelection=_b,Ft.runGraphNodeKinds=kd,Ft.stateType=gM,Object.defineProperty(Ft,Symbol.toStringTag,{value:"Module"})});
|
|
1177
1177
|
//# sourceMappingURL=graphs.umd.js.map
|