@prefecthq/graphs 2.0.1 → 2.0.2

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.
@@ -1573,5 +1573,5 @@ ${e.timeByMinutes(r)}`:e.timeByMinutes(r)}const sl={timelineGuides:0,viewport:10
1573
1573
  * Subject to the terms at https://greensock.com/standard-license or for
1574
1574
  * Club GreenSock members, the agreement issued with that membership.
1575
1575
  * @author: Jack Doyle, jack@greensock.com
1576
- */var ef,di,fr,Sa,Gi,rf,Pa,vx=function(){return typeof window<"u"},Qe={},ki=180/Math.PI,cr=Math.PI/180,dr=Math.atan2,nf=1e8,Ca=/([A-Z])/g,_x=/(left|right|width|margin|padding|x)/i,gx=/[\s,\(]\S/,ke={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Ra=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},mx=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},yx=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},xx=function(e,t){var i=t.s+t.c*e;t.set(t.t,t.p,~~(i+(i<0?-.5:.5))+t.u,t)},sf=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},of=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},bx=function(e,t,i){return e.style[t]=i},Tx=function(e,t,i){return e.style.setProperty(t,i)},wx=function(e,t,i){return e._gsap[t]=i},Ex=function(e,t,i){return e._gsap.scaleX=e._gsap.scaleY=i},Sx=function(e,t,i,n,s){var o=e._gsap;o.scaleX=o.scaleY=i,o.renderTransform(s,o)},Px=function(e,t,i,n,s){var o=e._gsap;o[t]=i,o.renderTransform(s,o)},bt="transform",Pe=bt+"Origin",Cx=function r(e,t){var i=this,n=this.target,s=n.style;if(e in Qe){if(this.tfm=this.tfm||{},e!=="transform")e=ke[e]||e,~e.indexOf(",")?e.split(",").forEach(function(o){return i.tfm[o]=ti(n,o)}):this.tfm[e]=n._gsap.x?n._gsap[e]:ti(n,e);else return ke.transform.split(",").forEach(function(o){return r.call(i,o,t)});if(this.props.indexOf(bt)>=0)return;n._gsap.svg&&(this.svgo=n.getAttribute("data-svg-origin"),this.props.push(Pe,t,"")),e=bt}(s||t)&&this.props.push(e,t,s[e])},af=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},Rx=function(){var e=this.props,t=this.target,i=t.style,n=t._gsap,s,o;for(s=0;s<e.length;s+=3)e[s+1]?t[e[s]]=e[s+2]:e[s+2]?i[e[s]]=e[s+2]:i.removeProperty(e[s].substr(0,2)==="--"?e[s]:e[s].replace(Ca,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)n[o]=this.tfm[o];n.svg&&(n.renderTransform(),t.setAttribute("data-svg-origin",this.svgo||"")),s=Pa(),(!s||!s.isStart)&&!i[bt]&&(af(i),n.uncache=1)}},hf=function(e,t){var i={target:e,props:[],revert:Rx,save:Cx};return e._gsap||Qt.core.getCache(e),t&&t.split(",").forEach(function(n){return i.save(n)}),i},uf,Oa=function(e,t){var i=di.createElementNS?di.createElementNS((t||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),e):di.createElement(e);return i.style?i:di.createElement(e)},Xe=function r(e,t,i){var n=getComputedStyle(e);return n[t]||n.getPropertyValue(t.replace(Ca,"-$1").toLowerCase())||n.getPropertyValue(t)||!i&&r(e,pr(t)||t,1)||""},lf="O,Moz,ms,Ms,Webkit".split(","),pr=function(e,t,i){var n=t||Gi,s=n.style,o=5;if(e in s&&!i)return e;for(e=e.charAt(0).toUpperCase()+e.substr(1);o--&&!(lf[o]+e in s););return o<0?null:(o===3?"ms":o>=0?lf[o]:"")+e},Aa=function(){vx()&&window.document&&(ef=window,di=ef.document,fr=di.documentElement,Gi=Oa("div")||{style:{}},Oa("div"),bt=pr(bt),Pe=bt+"Origin",Gi.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",uf=!!pr("perspective"),Pa=Qt.core.reverting,Sa=1)},Ia=function r(e){var t=Oa("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,n=this.nextSibling,s=this.style.cssText,o;if(fr.appendChild(t),t.appendChild(this),this.style.display="block",e)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(n?i.insertBefore(this,n):i.appendChild(this)),fr.removeChild(t),this.style.cssText=s,o},ff=function(e,t){for(var i=t.length;i--;)if(e.hasAttribute(t[i]))return e.getAttribute(t[i])},cf=function(e){var t;try{t=e.getBBox()}catch{t=Ia.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===Ia||(t=Ia.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+ff(e,["x","cx","x1"])||0,y:+ff(e,["y","cy","y1"])||0,width:0,height:0}:t},df=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&cf(e))},$r=function(e,t){if(t){var i=e.style;t in Qe&&t!==Pe&&(t=bt),i.removeProperty?((t.substr(0,2)==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),i.removeProperty(t.replace(Ca,"-$1").toLowerCase())):i.removeAttribute(t)}},pi=function(e,t,i,n,s,o){var a=new Jt(e._pt,t,i,0,1,o?of:sf);return e._pt=a,a.b=n,a.e=s,e._props.push(i),a},pf={deg:1,rad:1,turn:1},Ox={grid:1,flex:1},vi=function r(e,t,i,n){var s=parseFloat(i)||0,o=(i+"").trim().substr((s+"").length)||"px",a=Gi.style,h=_x.test(t),u=e.tagName.toLowerCase()==="svg",l=(u?"client":"offset")+(h?"Width":"Height"),f=100,c=n==="px",d=n==="%",v,p,_,g;return n===o||!s||pf[n]||pf[o]?s:(o!=="px"&&!c&&(s=r(e,t,i,"px")),g=e.getCTM&&df(e),(d||o==="%")&&(Qe[t]||~t.indexOf("adius"))?(v=g?e.getBBox()[h?"width":"height"]:e[l],Ot(d?s/v*f:s/100*v)):(a[h?"width":"height"]=f+(c?o:n),p=~t.indexOf("adius")||n==="em"&&e.appendChild&&!u?e:e.parentNode,g&&(p=(e.ownerSVGElement||{}).parentNode),(!p||p===di||!p.appendChild)&&(p=di.body),_=p._gsap,_&&d&&_.width&&h&&_.time===oe.time&&!_.uncache?Ot(s/_.width*f):((d||o==="%")&&!Ox[Xe(p,"display")]&&(a.position=Xe(e,"position")),p===e&&(a.position="static"),p.appendChild(Gi),v=Gi[l],p.removeChild(Gi),a.position="absolute",h&&d&&(_=Di(p),_.time=oe.time,_.width=p[l]),Ot(c?v*s/f:v&&s?f/v*s:0))))},ti=function(e,t,i,n){var s;return Sa||Aa(),t in ke&&t!=="transform"&&(t=ke[t],~t.indexOf(",")&&(t=t.split(",")[0])),Qe[t]&&t!=="transform"?(s=Qr(e,n),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:fs(Xe(e,Pe))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||n||~(s+"").indexOf("calc("))&&(s=ls[t]&&ls[t](e,t,i)||Xe(e,t)||gl(e,t)||(t==="opacity"?1:0))),i&&!~(s+"").trim().indexOf(" ")?vi(e,t,s,i)+i:s},Ax=function(e,t,i,n){if(!i||i==="none"){var s=pr(t,e,1),o=s&&Xe(e,s,1);o&&o!==i?(t=s,i=o):t==="borderColor"&&(i=Xe(e,"borderTopColor"))}var a=new Jt(this._pt,e.style,t,0,1,$l),h=0,u=0,l,f,c,d,v,p,_,g,y,m,b,x;if(a.b=i,a.e=n,i+="",n+="",n==="auto"&&(e.style[t]=n,n=Xe(e,t)||n,e.style[t]=i),l=[i,n],Xl(l),i=l[0],n=l[1],c=i.match(rr)||[],x=n.match(rr)||[],x.length){for(;f=rr.exec(n);)_=f[0],y=n.substring(h,f.index),v?v=(v+1)%5:(y.substr(-5)==="rgba("||y.substr(-5)==="hsla(")&&(v=1),_!==(p=c[u++]||"")&&(d=parseFloat(p)||0,b=p.substr((d+"").length),_.charAt(1)==="="&&(_=nr(d,_)+b),g=parseFloat(_),m=_.substr((g+"").length),h=rr.lastIndex-m.length,m||(m=m||re.units[t]||b,h===n.length&&(n+=m,a.e+=m)),b!==m&&(d=vi(e,t,p,m)||0),a._pt={_next:a._pt,p:y||u===1?y:",",s:d,c:g-d,m:v&&v<4||t==="zIndex"?Math.round:0});a.c=h<n.length?n.substring(h,n.length):""}else a.r=t==="display"&&n==="none"?of:sf;return ll.test(n)&&(a.e=0),this._pt=a,a},vf={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},Ix=function(e){var t=e.split(" "),i=t[0],n=t[1]||"50%";return(i==="top"||i==="bottom"||n==="left"||n==="right")&&(e=i,i=n,n=e),t[0]=vf[i]||i,t[1]=vf[n]||n,t.join(" ")},Mx=function(e,t){if(t.tween&&t.tween._time===t.tween._dur){var i=t.t,n=i.style,s=t.u,o=i._gsap,a,h,u;if(s==="all"||s===!0)n.cssText="",h=1;else for(s=s.split(","),u=s.length;--u>-1;)a=s[u],Qe[a]&&(h=1,a=a==="transformOrigin"?Pe:bt),$r(i,a);h&&($r(i,bt),o&&(o.svg&&i.removeAttribute("transform"),Qr(i,1),o.uncache=1,af(n)))}},ls={clearProps:function(e,t,i,n,s){if(s.data!=="isFromStart"){var o=e._pt=new Jt(e._pt,t,i,0,0,Mx);return o.u=n,o.pr=-10,o.tween=s,e._props.push(i),1}}},Jr=[1,0,0,1,0,0],_f={},gf=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},mf=function(e){var t=Xe(e,bt);return gf(t)?Jr:t.substr(7).match(ul).map(Ot)},Ma=function(e,t){var i=e._gsap||Di(e),n=e.style,s=mf(e),o,a,h,u;return i.svg&&e.getAttribute("transform")?(h=e.transform.baseVal.consolidate().matrix,s=[h.a,h.b,h.c,h.d,h.e,h.f],s.join(",")==="1,0,0,1,0,0"?Jr:s):(s===Jr&&!e.offsetParent&&e!==fr&&!i.svg&&(h=n.display,n.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(u=1,a=e.nextElementSibling,fr.appendChild(e)),s=mf(e),h?n.display=h:$r(e,"display"),u&&(a?o.insertBefore(e,a):o?o.appendChild(e):fr.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},Na=function(e,t,i,n,s,o){var a=e._gsap,h=s||Ma(e,!0),u=a.xOrigin||0,l=a.yOrigin||0,f=a.xOffset||0,c=a.yOffset||0,d=h[0],v=h[1],p=h[2],_=h[3],g=h[4],y=h[5],m=t.split(" "),b=parseFloat(m[0])||0,x=parseFloat(m[1])||0,T,w,S,E;i?h!==Jr&&(w=d*_-v*p)&&(S=b*(_/w)+x*(-p/w)+(p*y-_*g)/w,E=b*(-v/w)+x*(d/w)-(d*y-v*g)/w,b=S,x=E):(T=cf(e),b=T.x+(~m[0].indexOf("%")?b/100*T.width:b),x=T.y+(~(m[1]||m[0]).indexOf("%")?x/100*T.height:x)),n||n!==!1&&a.smooth?(g=b-u,y=x-l,a.xOffset=f+(g*d+y*p)-g,a.yOffset=c+(g*v+y*_)-y):a.xOffset=a.yOffset=0,a.xOrigin=b,a.yOrigin=x,a.smooth=!!n,a.origin=t,a.originIsAbsolute=!!i,e.style[Pe]="0px 0px",o&&(pi(o,a,"xOrigin",u,b),pi(o,a,"yOrigin",l,x),pi(o,a,"xOffset",f,a.xOffset),pi(o,a,"yOffset",c,a.yOffset)),e.setAttribute("data-svg-origin",b+" "+x)},Qr=function(e,t){var i=e._gsap||new Yl(e);if("x"in i&&!t&&!i.uncache)return i;var n=e.style,s=i.scaleX<0,o="px",a="deg",h=getComputedStyle(e),u=Xe(e,Pe)||"0",l,f,c,d,v,p,_,g,y,m,b,x,T,w,S,E,P,O,I,F,k,A,M,L,q,z,N,R,U,J,V,it;return l=f=c=p=_=g=y=m=b=0,d=v=1,i.svg=!!(e.getCTM&&df(e)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(n[bt]=(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[bt]!=="none"?h[bt]:"")),n.scale=n.rotate=n.translate="none"),w=Ma(e,i.svg),i.svg&&(i.uncache?(q=e.getBBox(),u=i.xOrigin-q.x+"px "+(i.yOrigin-q.y)+"px",L=""):L=!t&&e.getAttribute("data-svg-origin"),Na(e,L||u,!!L||i.originIsAbsolute,i.smooth!==!1,w)),x=i.xOrigin||0,T=i.yOrigin||0,w!==Jr&&(O=w[0],I=w[1],F=w[2],k=w[3],l=A=w[4],f=M=w[5],w.length===6?(d=Math.sqrt(O*O+I*I),v=Math.sqrt(k*k+F*F),p=O||I?dr(I,O)*ki:0,y=F||k?dr(F,k)*ki+p:0,y&&(v*=Math.abs(Math.cos(y*cr))),i.svg&&(l-=x-(x*O+T*F),f-=T-(x*I+T*k))):(it=w[6],J=w[7],N=w[8],R=w[9],U=w[10],V=w[11],l=w[12],f=w[13],c=w[14],S=dr(it,U),_=S*ki,S&&(E=Math.cos(-S),P=Math.sin(-S),L=A*E+N*P,q=M*E+R*P,z=it*E+U*P,N=A*-P+N*E,R=M*-P+R*E,U=it*-P+U*E,V=J*-P+V*E,A=L,M=q,it=z),S=dr(-F,U),g=S*ki,S&&(E=Math.cos(-S),P=Math.sin(-S),L=O*E-N*P,q=I*E-R*P,z=F*E-U*P,V=k*P+V*E,O=L,I=q,F=z),S=dr(I,O),p=S*ki,S&&(E=Math.cos(S),P=Math.sin(S),L=O*E+I*P,q=A*E+M*P,I=I*E-O*P,M=M*E-A*P,O=L,A=q),_&&Math.abs(_)+Math.abs(p)>359.9&&(_=p=0,g=180-g),d=Ot(Math.sqrt(O*O+I*I+F*F)),v=Ot(Math.sqrt(M*M+it*it)),S=dr(A,M),y=Math.abs(S)>2e-4?S*ki:0,b=V?1/(V<0?-V:V):0),i.svg&&(L=e.getAttribute("transform"),i.forceCSS=e.setAttribute("transform","")||!gf(Xe(e,bt)),L&&e.setAttribute("transform",L))),Math.abs(y)>90&&Math.abs(y)<270&&(s?(d*=-1,y+=p<=0?180:-180,p+=p<=0?180:-180):(v*=-1,y+=y<=0?180:-180)),t=t||i.uncache,i.x=l-((i.xPercent=l&&(!t&&i.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-l)?-50:0)))?e.offsetWidth*i.xPercent/100:0)+o,i.y=f-((i.yPercent=f&&(!t&&i.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-f)?-50:0)))?e.offsetHeight*i.yPercent/100:0)+o,i.z=c+o,i.scaleX=Ot(d),i.scaleY=Ot(v),i.rotation=Ot(p)+a,i.rotationX=Ot(_)+a,i.rotationY=Ot(g)+a,i.skewX=y+a,i.skewY=m+a,i.transformPerspective=b+o,(i.zOrigin=parseFloat(u.split(" ")[2])||0)&&(n[Pe]=fs(u)),i.xOffset=i.yOffset=0,i.force3D=re.force3D,i.renderTransform=i.svg?Dx:uf?yf:Nx,i.uncache=0,i},fs=function(e){return(e=e.split(" "))[0]+" "+e[1]},Da=function(e,t,i){var n=Yt(t);return Ot(parseFloat(t)+parseFloat(vi(e,"x",i+"px",n)))+n},Nx=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,yf(e,t)},Xi="0deg",tn="0px",Hi=") ",yf=function(e,t){var i=t||this,n=i.xPercent,s=i.yPercent,o=i.x,a=i.y,h=i.z,u=i.rotation,l=i.rotationY,f=i.rotationX,c=i.skewX,d=i.skewY,v=i.scaleX,p=i.scaleY,_=i.transformPerspective,g=i.force3D,y=i.target,m=i.zOrigin,b="",x=g==="auto"&&e&&e!==1||g===!0;if(m&&(f!==Xi||l!==Xi)){var T=parseFloat(l)*cr,w=Math.sin(T),S=Math.cos(T),E;T=parseFloat(f)*cr,E=Math.cos(T),o=Da(y,o,w*E*-m),a=Da(y,a,-Math.sin(T)*-m),h=Da(y,h,S*E*-m+m)}_!==tn&&(b+="perspective("+_+Hi),(n||s)&&(b+="translate("+n+"%, "+s+"%) "),(x||o!==tn||a!==tn||h!==tn)&&(b+=h!==tn||x?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+Hi),u!==Xi&&(b+="rotate("+u+Hi),l!==Xi&&(b+="rotateY("+l+Hi),f!==Xi&&(b+="rotateX("+f+Hi),(c!==Xi||d!==Xi)&&(b+="skew("+c+", "+d+Hi),(v!==1||p!==1)&&(b+="scale("+v+", "+p+Hi),y.style[bt]=b||"translate(0, 0)"},Dx=function(e,t){var i=t||this,n=i.xPercent,s=i.yPercent,o=i.x,a=i.y,h=i.rotation,u=i.skewX,l=i.skewY,f=i.scaleX,c=i.scaleY,d=i.target,v=i.xOrigin,p=i.yOrigin,_=i.xOffset,g=i.yOffset,y=i.forceCSS,m=parseFloat(o),b=parseFloat(a),x,T,w,S,E;h=parseFloat(h),u=parseFloat(u),l=parseFloat(l),l&&(l=parseFloat(l),u+=l,h+=l),h||u?(h*=cr,u*=cr,x=Math.cos(h)*f,T=Math.sin(h)*f,w=Math.sin(h-u)*-c,S=Math.cos(h-u)*c,u&&(l*=cr,E=Math.tan(u-l),E=Math.sqrt(1+E*E),w*=E,S*=E,l&&(E=Math.tan(l),E=Math.sqrt(1+E*E),x*=E,T*=E)),x=Ot(x),T=Ot(T),w=Ot(w),S=Ot(S)):(x=f,S=c,T=w=0),(m&&!~(o+"").indexOf("px")||b&&!~(a+"").indexOf("px"))&&(m=vi(d,"x",o,"px"),b=vi(d,"y",a,"px")),(v||p||_||g)&&(m=Ot(m+v-(v*x+p*w)+_),b=Ot(b+p-(v*T+p*S)+g)),(n||s)&&(E=d.getBBox(),m=Ot(m+n/100*E.width),b=Ot(b+s/100*E.height)),E="matrix("+x+","+T+","+w+","+S+","+m+","+b+")",d.setAttribute("transform",E),y&&(d.style[bt]=E)},Fx=function(e,t,i,n,s){var o=360,a=kt(s),h=parseFloat(s)*(a&&~s.indexOf("rad")?ki:1),u=h-n,l=n+u+"deg",f,c;return a&&(f=s.split("_")[1],f==="short"&&(u%=o,u!==u%(o/2)&&(u+=u<0?o:-o)),f==="cw"&&u<0?u=(u+o*nf)%o-~~(u/o)*o:f==="ccw"&&u>0&&(u=(u-o*nf)%o-~~(u/o)*o)),e._pt=c=new Jt(e._pt,t,i,n,u,mx),c.e=l,c.u="deg",e._props.push(i),c},xf=function(e,t){for(var i in t)e[i]=t[i];return e},Lx=function(e,t,i){var n=xf({},i._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,u,l,f,c,d,v;n.svg?(u=i.getAttribute("transform"),i.setAttribute("transform",""),o[bt]=t,a=Qr(i,1),$r(i,bt),i.setAttribute("transform",u)):(u=getComputedStyle(i)[bt],o[bt]=t,a=Qr(i,1),o[bt]=u);for(h in Qe)u=n[h],l=a[h],u!==l&&s.indexOf(h)<0&&(d=Yt(u),v=Yt(l),f=d!==v?vi(i,h,u,v):parseFloat(u),c=parseFloat(l),e._pt=new Jt(e._pt,a,h,f,c-f,Ra),e._pt.u=v||0,e._props.push(h));xf(a,n)};Kt("padding,margin,Width,Radius",function(r,e){var t="Top",i="Right",n="Bottom",s="Left",o=(e<3?[t,i,n,s]:[t+s,t+i,n+i,n+s]).map(function(a){return e<2?r+a:"border"+a+r});ls[e>1?"border"+r:r]=function(a,h,u,l,f){var c,d;if(arguments.length<4)return c=o.map(function(v){return ti(a,v,u)}),d=c.join(" "),d.split(c[0]).length===5?c[0]:d;c=(l+"").split(" "),d={},o.forEach(function(v,p){return d[v]=c[p]=c[p]||c[(p-1)/2|0]}),a.init(h,d,f)}});var bf={name:"css",register:Aa,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,i,n,s){var o=this._props,a=e.style,h=i.vars.startAt,u,l,f,c,d,v,p,_,g,y,m,b,x,T,w,S;Sa||Aa(),this.styles=this.styles||hf(e),S=this.styles.props,this.tween=i;for(p in t)if(p!=="autoRound"&&(l=t[p],!(se[p]&&Vl(p,t,i,n,e,s)))){if(d=typeof l,v=ls[p],d==="function"&&(l=l.call(i,n,e,s),d=typeof l),d==="string"&&~l.indexOf("random(")&&(l=Vr(l)),v)v(this,e,p,l,i)&&(w=1);else if(p.substr(0,2)==="--")u=(getComputedStyle(e).getPropertyValue(p)+"").trim(),l+="",fi.lastIndex=0,fi.test(u)||(_=Yt(u),g=Yt(l)),g?_!==g&&(u=vi(e,p,u,g)+g):_&&(l+=_),this.add(a,"setProperty",u,l,n,s,0,0,p),o.push(p),S.push(p,0,a[p]);else if(d!=="undefined"){if(h&&p in h?(u=typeof h[p]=="function"?h[p].call(i,n,e,s):h[p],kt(u)&&~u.indexOf("random(")&&(u=Vr(u)),Yt(u+"")||(u+=re.units[p]||Yt(ti(e,p))||""),(u+"").charAt(1)==="="&&(u=ti(e,p))):u=ti(e,p),c=parseFloat(u),y=d==="string"&&l.charAt(1)==="="&&l.substr(0,2),y&&(l=l.substr(2)),f=parseFloat(l),p in ke&&(p==="autoAlpha"&&(c===1&&ti(e,"visibility")==="hidden"&&f&&(c=0),S.push("visibility",0,a.visibility),pi(this,a,"visibility",c?"inherit":"hidden",f?"inherit":"hidden",!f)),p!=="scale"&&p!=="transform"&&(p=ke[p],~p.indexOf(",")&&(p=p.split(",")[0]))),m=p in Qe,m){if(this.styles.save(p),b||(x=e._gsap,x.renderTransform&&!t.parseTransform||Qr(e,t.parseTransform),T=t.smoothOrigin!==!1&&x.smooth,b=this._pt=new Jt(this._pt,a,bt,0,1,x.renderTransform,x,0,-1),b.dep=1),p==="scale")this._pt=new Jt(this._pt,x,"scaleY",x.scaleY,(y?nr(x.scaleY,y+f):f)-x.scaleY||0,Ra),this._pt.u=0,o.push("scaleY",p),p+="X";else if(p==="transformOrigin"){S.push(Pe,0,a[Pe]),l=Ix(l),x.svg?Na(e,l,0,T,0,this):(g=parseFloat(l.split(" ")[2])||0,g!==x.zOrigin&&pi(this,x,"zOrigin",x.zOrigin,g),pi(this,a,p,fs(u),fs(l)));continue}else if(p==="svgOrigin"){Na(e,l,1,T,0,this);continue}else if(p in _f){Fx(this,x,p,c,y?nr(c,y+l):l);continue}else if(p==="smoothOrigin"){pi(this,x,"smooth",x.smooth,l);continue}else if(p==="force3D"){x[p]=l;continue}else if(p==="transform"){Lx(this,l,e);continue}}else p in a||(p=pr(p)||p);if(m||(f||f===0)&&(c||c===0)&&!gx.test(l)&&p in a)_=(u+"").substr((c+"").length),f||(f=0),g=Yt(l)||(p in re.units?re.units[p]:_),_!==g&&(c=vi(e,p,u,g)),this._pt=new Jt(this._pt,m?x:a,p,c,(y?nr(c,y+f):f)-c,!m&&(g==="px"||p==="zIndex")&&t.autoRound!==!1?xx:Ra),this._pt.u=g||0,_!==g&&g!=="%"&&(this._pt.b=u,this._pt.r=yx);else if(p in a)Ax.call(this,e,p,u,y?y+l:l);else if(p in e)this.add(e,p,u||e[p],y?y+l:l,n,s);else if(p!=="parseTransform"){ia(p,l);continue}m||(p in a?S.push(p,0,a[p]):S.push(p,1,u||e[p])),o.push(p)}}w&&Jl(this)},render:function(e,t){if(t.tween._time||!Pa())for(var i=t._pt;i;)i.r(e,i.d),i=i._next;else t.styles.revert()},get:ti,aliases:ke,getSetter:function(e,t,i){var n=ke[t];return n&&n.indexOf(",")<0&&(t=n),t in Qe&&t!==Pe&&(e._gsap.x||ti(e,"x"))?i&&rf===i?t==="scale"?Ex:wx:(rf=i||{})&&(t==="scale"?Sx:Px):e.style&&!Ko(e.style[t])?bx:~t.indexOf("-")?Tx:xa(e,t)},core:{_removeProperty:$r,_getMatrix:Ma}};Qt.utils.checkPrefix=pr,Qt.core.getStyleSaver=hf,function(r,e,t,i){var n=Kt(r+","+e+","+t,function(s){Qe[s]=1});Kt(e,function(s){re.units[s]="deg",_f[s]=1}),ke[n[13]]=r+","+e,Kt(i,function(s){var o=s.split(":");ke[o[1]]=n[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"),Kt("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){re.units[r]="px"}),Qt.registerPlugin(bf);var Vt=Qt.registerPlugin(bf)||Qt;Vt.core.Tween;const cs=16,en=8,Fa=4,Tf=.7,Bx=.25;class Ux extends ot{constructor({graphState:t}){super();C(this,"graphState");C(this,"dimensionsObject",new ut);C(this,"dots",[]);C(this,"unWatchers",[]);this.graphState=t,this.initDimensions(),this.initDots(),this.initWatchers()}initWatchers(){const{styleOptions:t}=this.graphState,i=X.watch(t,()=>{this.destroyDots(),this.initDots()});this.unWatchers.push(i)}initDimensions(){const t=en*3+Fa*2,i=cs*2+en;this.dimensionsObject.width=t,this.dimensionsObject.height=i,this.addChild(this.dimensionsObject)}initDots(){const{colorTextDefault:t}=this.graphState.styleOptions.value,i=new Se;i.beginFill(t),i.drawCircle(0,0,en/2),i.endFill(),i.alpha=0,i.position.y=cs;const n=i.clone();n.alpha=0,n.position.set(en+Fa,cs);const s=i.clone();s.alpha=0,s.position.set((en+Fa)*2,cs),this.dots.push(i,n,s),this.addChild(i,n,s),this.initAnimation()}initAnimation(){const t=(i,n=0)=>{Vt.to(i,{alpha:1,duration:Tf,delay:n,onComplete:()=>{Vt.to(i,{alpha:0,duration:Tf,onComplete:()=>t(i)})}})};this.dots.forEach((i,n)=>{t(i,n*Bx)})}destroyDots(){this.dots.forEach(t=>{Vt.killTweensOf(t),t.destroy()}),this.dots=[]}destroy(){this.unWatchers.forEach(t=>t()),this.removeChildren(),this.dimensionsObject.destroy(),this.destroyDots(),super.destroy.call(this)}}const La=10;let Ce,Re,Oe,Ae;const ds=0,Ba={multisample:2,resolution:4};function ps(){Ce=new Map,Re=new Map,Oe=new Map,Ae=new Map}function Gx(){Ce&&(Ce.forEach(r=>{r.destroy()}),Ce.clear(),Ce=void 0),Re&&(Re.forEach(({cap:r,body:e})=>{r.destroy(),e.destroy()}),Re.clear(),Re=void 0),Oe&&(Oe.forEach(r=>{r.destroy()}),Oe.clear(),Oe=void 0),Ae&&(Ae.forEach(({corner:r,edge:e})=>{r.destroy(),e.destroy()}),Ae.clear(),Ae=void 0)}function rn({pixiApp:r,fill:e}){const t=e||ds;if(Ce||ps(),!(Ce!=null&&Ce.has(t))){const i=new Se;i.beginFill(t),i.drawRect(0,0,La,La),i.endFill(),t===ds&&(i.alpha=0);const n=r.renderer.generateTexture(i);Ce.set(t,n)}return Ce.get(t)}function Ua({pixiApp:r,fill:e,borderRadius:t,boxCapWidth:i,height:n}){const s=e||ds;if(Re||ps(),!(Re!=null&&Re.has(s))){const o=new Se;o.beginFill(s),o.moveTo(i,0),o.lineTo(i,n),o.lineTo(0+t,n),o.bezierCurveTo(0,n,0,n-t,0,n-t),o.lineTo(0,t),o.bezierCurveTo(0,0,t,0,t,0),o.lineTo(i,0),o.endFill(),s===ds&&(o.alpha=0);const a=rn({pixiApp:r,fill:s}),h=r.renderer.generateTexture(o,Ba),u=a;Re.set(s,{cap:h,body:u})}return Re.get(s)}function wf({pixiApp:r,strokeColor:e,edgeWidth:t,edgeLength:i}){if(Oe||ps(),!(Oe!=null&&Oe.has(e))){const n=new Se;n.lineStyle(t,e,1,.5),n.moveTo(-i,-i),n.lineTo(0,0),n.lineTo(-i,i);const s=r.renderer.generateTexture(n,Ba);Oe.set(e,s)}return Oe.get(e)}function kx({pixiApp:r,borderRadius:e,borderColor:t,borderWidth:i}){Ae||ps();const n={borderRadius:e,borderColor:t,borderWidth:i};if(!(Ae!=null&&Ae.has(n))){const s=new Se;s.lineStyle(i,t),s.moveTo(0,e),s.bezierCurveTo(0,e,0,0,e,0);const o=rn({pixiApp:r,fill:t}),a=r.renderer.generateTexture(s,Ba);Ae.set(n,{corner:a,edge:o})}return Ae.get(n)}const Ef=.2,Sf="power2.out";class Ga extends ot{constructor({graphState:t,width:i,height:n,borderRadius:s,borderColor:o,borderWidth:a}){super();C(this,"graphState");C(this,"rectWidth");C(this,"rectHeight");C(this,"borderRadius");C(this,"borderColor");C(this,"borderWidth");C(this,"topLeft");C(this,"topRight");C(this,"bottomRight");C(this,"bottomLeft");C(this,"topEdge");C(this,"rightEdge");C(this,"bottomEdge");C(this,"leftEdge");this.graphState=t,this.rectWidth=i,this.rectHeight=n,this.borderRadius=s,this.borderColor=o,this.borderWidth=a,this.initRect()}initRect(){const{borderRadius:t,borderColor:i,borderWidth:n}=this,{pixiApp:s}=this.graphState,{corner:o,edge:a}=kx({pixiApp:s,borderRadius:t,borderColor:i,borderWidth:n});this.topLeft=new ut(o),this.topRight=new ut(o),this.topRight.position.set(this.rectWidth,0),this.topRight.rotation=Math.PI/2,this.bottomRight=new ut(o),this.bottomRight.position.set(this.rectWidth,this.rectHeight),this.bottomRight.rotation=Math.PI,this.bottomLeft=new ut(o),this.bottomLeft.position.set(0,this.rectHeight),this.bottomLeft.rotation=Math.PI*1.5,this.topEdge=new ut(a),this.topEdge.position.set(this.borderRadius,0),this.topEdge.width=this.rectWidth-this.borderRadius*2,this.topEdge.height=n,this.rightEdge=new ut(a),this.rightEdge.position.set(this.rectWidth-this.borderWidth,this.borderRadius),this.rightEdge.height=this.rectHeight-this.borderRadius*2,this.rightEdge.width=n,this.bottomEdge=new ut(a),this.bottomEdge.position.set(this.borderRadius,this.rectHeight-this.borderWidth),this.bottomEdge.width=this.rectWidth-this.borderRadius*2,this.bottomEdge.height=n,this.leftEdge=new ut(a),this.leftEdge.position.set(0,this.borderRadius),this.leftEdge.height=this.rectHeight-this.borderRadius*2,this.leftEdge.width=n,this.addChild(this.topLeft),this.addChild(this.topRight),this.addChild(this.bottomRight),this.addChild(this.bottomLeft),this.addChild(this.topEdge),this.addChild(this.rightEdge),this.addChild(this.bottomEdge),this.addChild(this.leftEdge),this.resize({width:this.rectWidth,height:this.rectHeight})}resize({width:t,height:i,animate:n}){const{topRight:s,bottomRight:o,bottomLeft:a,topEdge:h,rightEdge:u,bottomEdge:l,leftEdge:f}=this;this.scale.x=1,this.rectWidth=t,this.rectHeight=i;const c=this.borderRadius*2,v=t<c?c:t;if(t<c&&(this.scale.x=t/c),!n||this.graphState.suppressMotion.value){s.position.x=v,o.position.set(v,this.rectHeight),a.position.y=this.rectHeight,h.width=v-c,u.height=this.rectHeight-c,u.position.x=v-this.borderWidth,l.width=v-c,l.position.y=this.rectHeight-this.borderWidth,f.height=this.rectHeight-c;return}const p={duration:Ef,ease:Sf};Vt.to(s,{x:v,...p}),Vt.to(o,{x:v,y:this.rectHeight,...p}),Vt.to(a,{y:this.rectHeight,...p}),Vt.to(h,{width:v-c,...p}),Vt.to(u,{height:this.rectHeight-c,x:v-this.borderWidth,...p}),Vt.to(l,{width:v-c,y:this.rectHeight-this.borderWidth,...p}),Vt.to(f,{height:this.rectHeight-c,...p})}killTweens(){const{topRight:t,bottomRight:i,bottomLeft:n,topEdge:s,rightEdge:o,bottomEdge:a,leftEdge:h}=this;Vt.killTweensOf([t,i,n,s,o,a,h])}destroy(){this.killTweens(),super.destroy.call(this)}}const Pf=64,vs=20;class Xx extends ot{constructor({sourceNode:t,targetNode:i,state:n}){super();C(this,"sourceNode");C(this,"targetNode");C(this,"graphState");C(this,"sourceX",0);C(this,"sourceY",0);C(this,"targetX",0);C(this,"targetY",0);C(this,"sourceControlPointX",0);C(this,"sourceControlPointY",0);C(this,"targetControlPointX",0);C(this,"targetControlPointY",0);C(this,"edgePoints");C(this,"edge");C(this,"arrow",new ot);C(this,"unWatchers",[]);C(this,"getXBezier",(t,i)=>{const{sourceX:n,targetX:s}=this,o=(s-n)/2;return t+(o>Pf?o:Pf)*(i?-1:1)});C(this,"getPointBezierPosition",t=>{const{sourceX:i,sourceY:n,targetX:s,targetY:o,sourceControlPointX:a,sourceControlPointY:h,targetControlPointX:u,targetControlPointY:l}=this,f=i+(a-i)*t,c=n+(h-n)*t,d=a+(u-a)*t,v=h+(l-h)*t,p=u+(s-u)*t,_=l+(o-l)*t,g=f+(d-f)*t,y=c+(v-c)*t,m=d+(p-d)*t,b=v+(_-v)*t,x=g+(m-g)*t,T=y+(b-y)*t;return{x,y:T}});this.sourceNode=t,this.targetNode=i,this.graphState=n,this.assignBezierPositions(),this.edgePoints=this.initEdgePoints(),this.edge=this.initEdge(),this.addChild(this.edge),this.drawArrow(),this.addChild(this.arrow),this.initCulling(),this.initWatchers()}initCulling(){const{cull:t}=this.graphState;t.add(this.arrow)}initWatchers(){const{styleOptions:t,viewport:i}=this.graphState;this.unWatchers.push(X.watch([t],()=>{this.updateStyle()},{deep:!0})),i.on("frame-end",()=>{this.sourceNode.destroyed||this.targetNode.destroyed||this.hasEdgeChanged()&&this.update()})}assignBezierPositions(){this.sourceX=this.getSourceX(),this.sourceY=this.getNodeY(this.sourceNode),this.targetX=this.targetNode.x,this.targetY=this.getNodeY(this.targetNode),this.sourceControlPointX=this.getXBezier(this.sourceX),this.sourceControlPointY=this.sourceY,this.targetControlPointX=this.getXBezier(this.targetX,!0),this.targetControlPointY=this.targetY}initEdge(){const{spacingEdgeWidth:t}=this.graphState.styleOptions.value,i=this.getEdgeTexture();return new Jy(i,this.edgePoints,t/La)}initEdgePoints(){const t=[];for(let s=0;s<vs;s++){const o=s===vs-1?{x:this.targetX,y:this.targetY}:this.getPointBezierPosition(s/vs);t.push(new j(o.x,o.y))}const i=this.getTargetAnchorPointPosition(),n=new j(i.x,i.y);return t.push(n),t}drawArrow(){const{arrow:t,targetX:i,targetY:n}=this,{pixiApp:s,styleOptions:o}=this.graphState,{colorEdge:a,spacingEdgeWidth:h,spacingNodeEdgeLength:u}=o.value,l=wf({pixiApp:s,strokeColor:a,edgeWidth:h,edgeLength:u}),f=new ut(l);f.anchor.set(1,.5),t.addChild(f),t.position.set(i,n)}update(){this.assignBezierPositions(),this.arrow.position.set(this.targetX,this.targetY),this.edgePoints.forEach((t,i)=>{const n=i===this.edgePoints.length-1?this.getTargetAnchorPointPosition():this.getPointBezierPosition(i/vs);t.set(n.x,n.y)})}updateStyle(){this.arrow.removeChildren(),this.drawArrow(),this.edge.texture=this.getEdgeTexture()}hasEdgeChanged(){const t=this.getSourceX(),i=this.getNodeY(this.sourceNode),n=this.targetNode.x,s=this.getNodeY(this.targetNode);return t!==this.sourceX||i!==this.sourceY||n!==this.targetX||s!==this.targetY}getSourceX(){return this.sourceNode.x+this.sourceNode.getChildByName(Xa).getLocalBounds().width}getNodeY(t){return t.y+t.getChildByName(Xa).getLocalBounds().height/2}getEdgeTexture(){const{pixiApp:t,styleOptions:i}=this.graphState,{colorEdge:n}=i.value;return rn({pixiApp:t,fill:n})}getTargetAnchorPointPosition(){return{x:this.targetX-2,y:this.targetY}}destroy(){const{cull:t}=this.graphState;t.remove(this.arrow),this.unWatchers.forEach(i=>i()),super.destroy.call(this)}}const ae={nodeDetails:"nodeDetailsClick",subNodesToggle:"subNodesToggleClick"},ka="nodeResize",Cf={fadeIn:.25,move:.5},Xa="box",Hx="None",Wx=.2;class zx extends ot{constructor({nodeData:t,state:i,layout:n,layoutRows:s}){super();C(this,"nodeData");C(this,"state");C(this,"layout");C(this,"layoutRows");C(this,"currentState");C(this,"hasSubNodes",!1);C(this,"isRunningNode",!1);C(this,"runningNodeTicker",null);C(this,"unWatchers",[]);C(this,"positionInitialized",!1);C(this,"nodeWidth");C(this,"nodeHeight");C(this,"boxCapWidth",0);C(this,"box",new ot);C(this,"leftBoxCap");C(this,"rightBoxCap");C(this,"boxBody");C(this,"subNodesToggle");C(this,"subNodesToggleWidth",0);C(this,"isSubNodesToggleFloating",!1);C(this,"isLoadingSubNodes",!1);C(this,"subNodesLoadingIndicator",null);C(this,"noSubNodesMessage",null);C(this,"label");C(this,"apxLabelWidth",0);C(this,"isLabelInBox",!0);C(this,"isSubNodesExpanded",!1);C(this,"subNodesOutlineContainer",new ot);C(this,"subNodesOutline");C(this,"subNodesContent",null);C(this,"subNodesHeight",0);C(this,"subNodesContentTicker",null);C(this,"isSelected",!1);C(this,"selectedRing");C(this,"initializePosition",()=>{this.positionInitialized=!0,this.updatePosition({skipAnimation:!0,includeXPos:!0})});C(this,"getSubNodesData",()=>{if(!this.nodeData.subflowRunId)return new Map;const{expandedSubNodes:t}=this.state,i=t.value.get(this.nodeData.subflowRunId).data;return"value"in i?i.value:i});this.interactive=!1,this.nodeData=t,this.state=i,this.layout=n,this.layoutRows=s,this.currentState=t.state.toString(),this.hasSubNodes=t.subflowRunId!==null,this.updateIsRunningNode(),this.boxCapWidth=i.styleOptions.value.borderRadiusNode,this.nodeWidth=this.getNodeWidth(),this.nodeHeight=this.getNodeHeight(),this.addChild(this.subNodesOutlineContainer),this.drawSubNodesOutline(),this.initBox(),this.initSubNodesToggle(),this.drawLabel(),this.initSelectedRing(),this.initWatchers()}initWatchers(){const{layoutRows:t,unWatchers:i,hasSubNodes:n,isRunningNode:s}=this,{pixiApp:o,styleOptions:a,styleNode:h,selectedNodeId:u,subNodeLabels:l,expandedSubNodes:f,viewport:c}=this.state;i.push(X.watch(t,()=>{this.updatePosition()}),X.watch([a,h],()=>{this.drawBox(),this.drawLabel(),this.noSubNodesMessage&&this.drawNoSubNodesMessage()},{deep:!0}),X.watch(u,d=>{const v=this.nodeData.subflowRunId??this.nodeData.id;if(d&&d===v){this.select();return}this.isSelected&&this.deselect()})),n&&i.push(X.watch(f,()=>{var d,v;if(this.nodeData.subflowRunId){if(!this.isSubNodesExpanded&&f.value.has(this.nodeData.subflowRunId)){if(this.isSubNodesExpanded=!0,(d=this.subNodesToggle)==null||d.setExpanded(),this.getSubNodesData().size===0&&!this.isLoadingSubNodes){this.isLoadingSubNodes=!0,this.drawLoadingSubNodes();return}this.expandSubNodes();return}if(this.isSubNodesExpanded){if(!f.value.has(this.nodeData.subflowRunId)){(v=this.subNodesToggle)==null||v.setCollapsed(),this.isSubNodesExpanded=!1,this.isLoadingSubNodes=!1,this.collapseSubNodes();return}const p=this.getSubNodesData();if(this.isLoadingSubNodes&&(this.isLoadingSubNodes=!1,this.destroySubNodesLoadingIndicator(),p.size===0)){this.drawNoSubNodesMessage();return}if(!this.subNodesContent){this.expandSubNodes();return}this.subNodesContent.update(p)}}},{deep:!0}),X.watch(l,()=>{var d;this.getLabelText()!==((d=this.label)==null?void 0:d.text)&&this.drawLabel(!0)},{deep:!0})),s&&(this.runningNodeTicker=()=>{this.update()},o.ticker.add(this.runningNodeTicker)),c.on("frame-end",()=>{if(c.scale.x<Wx){this.label&&(this.label.visible=!1),this.subNodesOutline&&!this.isSubNodesExpanded&&(this.subNodesOutline.visible=!1);return}this.label&&(this.label.visible=!0),this.subNodesOutline&&(this.subNodesOutline.visible=!0)})}drawSubNodesOutline(){var d;if(!this.hasSubNodes)return;(d=this.subNodesOutline)==null||d.destroy();const{nodeHeight:t,state:i}=this,{styleOptions:n,styleNode:s}=i,{borderRadiusNode:o,alphaSubNodesOutlineDimmed:a,spacingSubNodesOutlineBorderWidth:h,spacingSubNodesOutlineOffset:u}=n.value,{fill:l}=s.value(this.nodeData),f=ie(l),c=this.getOutlineWidth();this.subNodesOutline=new Ga({graphState:i,width:c,height:t,borderRadius:o,borderWidth:h,borderColor:f}),this.subNodesOutline.position.set(u,u),this.subNodesOutline.alpha=a,this.subNodesOutlineContainer.addChild(this.subNodesOutline)}initBox(){const{box:t}=this;t.name=Xa,this.drawBox(),this.addChild(t),t.interactive=!0,t.buttonMode=!0,t.on("click",()=>{this.emitSelection()}),this.state.cull.add(t)}drawBox(){var p,_,g;const{pixiApp:t,styleOptions:i,styleNode:n}=this.state,{isRunningNode:s,nodeWidth:o,nodeHeight:a,box:h,boxCapWidth:u}=this,{borderRadiusNode:l}=i.value,{fill:f}=n.value(this.nodeData),c=ie(f);(p=this.leftBoxCap)==null||p.destroy(),(_=this.boxBody)==null||_.destroy(),(g=this.rightBoxCap)==null||g.destroy(),this.box.removeChildren();const{cap:d,body:v}=Ua({pixiApp:t,fill:c,borderRadius:l,boxCapWidth:u,height:a});this.leftBoxCap=new ut(d),this.boxBody=new ut(v),this.boxBody.width=this.getBoxBodyWidth(),this.boxBody.height=a,this.boxBody.position.set(u,0),h.addChild(this.leftBoxCap),h.addChild(this.boxBody),s||(this.rightBoxCap=new ut(d),this.rightBoxCap.scale.x=-1,this.rightBoxCap.position.x=o,h.addChild(this.rightBoxCap))}initSubNodesToggle(){if(!this.hasSubNodes)return;const{state:t,nodeWidth:i,nodeHeight:n,nodeData:s}=this,{spacingNodeLabelMargin:o,borderRadiusNode:a}=this.state.styleOptions.value;this.subNodesToggleWidth=n,this.isSubNodesToggleFloating=this.subNodesToggleWidth+a>i,this.subNodesToggle=new Jx({graphState:t,nodeData:s,floating:this.isSubNodesToggleFloating,size:this.subNodesToggleWidth}),this.subNodesToggle.position.x=this.isSubNodesToggleFloating?i+o:0,this.subNodesToggle.on("click",()=>{this.emitSubNodesToggle()}),this.addChild(this.subNodesToggle)}async drawLabel(t){const{apxLabelWidth:i,nodeData:n}=this,{styleOptions:s,styleNode:o,cull:a}=this.state,h=await Xr(s.value),{spacingNodeXPadding:u}=s.value,{inverseTextOnFill:l}=o.value(n),f=l?h.nodeTextInverse:h.nodeTextDefault,c=this.getLabelText();if(i===0||t){const p=ue.measureText(c,h.nodeTextStyles).width*1.07;this.apxLabelWidth=p+u*2}this.isLabelInBox=this.checkIsLabelInBox();const d=this.isLabelInBox?f:h.nodeTextDefault;this.label&&(a.remove(this.label),this.label.destroy()),this.label=new Zn(c,d),this.updateLabelPosition(),this.isLabelInBox||(this.label.interactive=!0,this.label.buttonMode=!0,this.label.on("click",()=>{this.emitSelection()})),a.add(this.label),this.addChild(this.label)}initSelectedRing(){const{width:t,height:i,margin:n}=this.getSelectedRingSize(),{colorNodeSelection:s,spacingNodeSelectionWidth:o,borderRadiusNode:a}=this.state.styleOptions.value;this.selectedRing=new Ga({graphState:this.state,width:t,height:i,borderRadius:a,borderColor:s,borderWidth:o}),this.selectedRing.position.set(-n,-n),this.selectedRing.alpha=0,this.addChild(this.selectedRing)}select(){this.isSelected=!0,this.selectedRing.alpha=1,this.centerViewportToNodeAfterDelay()}deselect(){this.isSelected=!1,this.selectedRing.alpha=0,this.state.selectedNodeId.value||this.centerViewportToNodeAfterDelay()}centerViewportToNodeAfterDelay(){const{viewport:t,suppressMotion:i}=this.state;setTimeout(()=>{const n=(this.worldTransform.tx-t.x)/t.scale.x+this.box.width/2,s=(this.worldTransform.ty-t.y)/t.scale.y+this.box.height/2;t.animate({position:{x:n,y:s},time:i.value?0:1e3,ease:"easeInOutQuad",removeOnInterrupt:!0})},100)}expandSubNodes(){var n;if(!this.nodeData.subflowRunId)return;const t=this.state.expandedSubNodes.value.get(this.nodeData.subflowRunId);if(!this.hasSubNodes||!t)return;const i=X.unref(t.data);(n=this.subNodesContent)==null||n.destroy(),this.subNodesContent=new Af({isSubNodes:!0,data:i,state:this.state}),this.subNodesContent.on(ae.nodeDetails,s=>{this.emit(ae.nodeDetails,s)}),this.subNodesContent.on(ae.subNodesToggle,s=>{this.emitSubNodesToggle(s)}),this.updateSubNodesContentPosition(),this.subNodesContent.on(Ha,()=>this.updateSubNodesContentPosition()),this.addChild(this.subNodesContent),this.initSubNodesTicker()}drawLoadingSubNodes(){const{state:t,box:i}=this,{spacingNodeMargin:n}=t.styleOptions.value;this.destroySubNodesLoadingIndicator(),this.subNodesLoadingIndicator=new Ux({graphState:t}),this.subNodesLoadingIndicator.position.set(i.width/2-this.subNodesLoadingIndicator.width/2,i.y+i.height+n),this.addChild(this.subNodesLoadingIndicator),this.initSubNodesTicker()}async drawNoSubNodesMessage(){const{box:t}=this,{styleOptions:i}=this.state,n=await Xr(i.value);this.destroyNoSubNodesMessage(),this.noSubNodesMessage=new Zn(Hx,n.nodeTextSubdued),this.noSubNodesMessage.anchor.set(.5,0),this.noSubNodesMessage.position.set(t.width/2,t.y+t.height+i.value.spacingNodeMargin),this.addChild(this.noSubNodesMessage),this.initSubNodesTicker()}updateSubNodesContentPosition(){const{subNodesContent:t,box:i}=this,{spacingNodeMargin:n}=this.state.styleOptions.value;if(!t)return;const s=t.getEarliestNodeStart(),o=s?-this.state.timeScale.dateToX(s):0,a=i.y+i.height+n;t.position.set(o,a)}initSubNodesTicker(){const{pixiApp:t}=this.state;this.subNodesContentTicker||(this.subNodesHeight=0,this.subNodesContentTicker=()=>{const i=this.getSubContentHeight();i!==this.subNodesHeight&&(this.updateSubNodesOutlineSize(),this.updateSelectedRingSize(),this.subNodesHeight=i,this.emit(ka))},t.ticker.add(this.subNodesContentTicker,null,ee.LOW))}async collapseSubNodes(){this.destroySubNodesContent(),this.updateSelectedRingSize(),await this.updateSubNodesOutlineSize(),this.emit(ka)}update(t){var o;let i=!1,n=!1;t&&(this.nodeData=t,i=this.currentState!==this.nodeData.state,this.currentState=this.nodeData.state.toString(),this.updateIsRunningNode(),n=((o=this.label)==null?void 0:o.text)!==this.nodeData.label),this.isRunningNode&&this.nodeData.end&&(this.isRunningNode=!1,this.destroyRunningNodeTicker());const s=this.getNodeWidth();if(i&&(this.drawBox(),this.drawSubNodesOutline()),n&&this.drawLabel(),s!==this.nodeWidth){this.nodeWidth=s,this.updateBoxWidth(),this.updateSelectedRingSize(),this.updateSubNodesOutlineSize(!0),this.updateSubNodesTogglePosition();const a=this.isLabelInBox!==this.checkIsLabelInBox(2);!n&&a?this.drawLabel():this.isLabelInBox||this.updateLabelPosition()}}updatePosition(t){if(!this.positionInitialized||!this.nodeData.start)return;const{skipAnimation:i,includeXPos:n}=t??{},{suppressMotion:s}=this.state,{id:o}=this.nodeData,{row:a}=this.layout.value[o];if(!this.layoutRows.value[a])return;const{yPos:h}=this.layoutRows.value[a],u=n?this.state.timeScale.dateToX(this.nodeData.start):this.position.x;if(!(this.position.y===h&&this.position.x===u)){if(i||s.value){this.position.set(u,h);return}Vt.to(this,{x:u,y:h,duration:Cf.move,ease:"power1.out"}).then(()=>{this.state.cullScreen()})}}updateIsRunningNode(){this.isRunningNode=this.state.isRunning.value&&!this.nodeData.end}updateBoxWidth(){var t;this.boxBody.width=this.getBoxBodyWidth(),(t=this.rightBoxCap)==null||t.position.set(this.nodeWidth,0)}async updateSubNodesOutlineSize(t){if(!this.subNodesOutline)return;const{isSubNodesExpanded:i,subNodesOutline:n,nodeHeight:s}=this,{spacingSubNodesOutlineOffset:o,alphaSubNodesOutlineDimmed:a,spacingNodeMargin:h}=this.state.styleOptions.value,{suppressMotion:u}=this.state,l=this.getOutlineWidth(),f=i?s+this.getSubContentHeight()+h:s;n.resize({width:l,height:f,animate:!0}),await new Promise(c=>{const d=t||u.value?0:Ef,v=i?-o:o,p=i?-o:o,_=i?1:a;if(t||u.value){n.position.set(v,p),n.alpha=_,c(null);return}Vt.to(n,{x:v,y:p,alpha:_,duration:d,ease:Sf}).then(()=>c(null))})}updateLabelPosition(){if(!this.label)return;const{state:t,nodeWidth:i,hasSubNodes:n,isSubNodesToggleFloating:s,subNodesToggleWidth:o}=this,{spacingNodeXPadding:a,spacingNodeLabelMargin:h,spacingNodeYPadding:u}=t.styleOptions.value,l=()=>n&&s?i+h+o+a:i+h,f=()=>n&&!s?o+a:a,c=this.isLabelInBox?f():l();this.label.position.set(c,u)}updateSelectedRingSize(){const{width:t,height:i}=this.getSelectedRingSize();this.selectedRing.resize({width:t,height:i})}updateSubNodesTogglePosition(){if(!this.subNodesToggle)return;const{nodeWidth:t}=this,{borderRadiusNode:i,spacingNodeLabelMargin:n}=this.state.styleOptions.value;this.isSubNodesToggleFloating=this.subNodesToggleWidth+i>t,this.subNodesToggle.updateFloatingState(this.isSubNodesToggleFloating),this.subNodesToggle.position.x=this.isSubNodesToggleFloating?t+n:0}getNodeWidth(){const{isRunningNode:t,boxCapWidth:i,nodeData:n}=this;if(!n.start)return 0;const s=t?i:i*2,o=this.state.timeScale.dateToX(n.end??new Date)-this.state.timeScale.dateToX(n.start);return o>s?o:s}getNodeHeight(){const{textLineHeightDefault:t,spacingNodeYPadding:i}=this.state.styleOptions.value;return t+i*2}getBoxBodyWidth(){const{isRunningNode:t,nodeWidth:i,boxCapWidth:n}=this;return t?i-n:i-n*2}getOutlineWidth(){const{nodeWidth:t,isSubNodesExpanded:i}=this,{spacingSubNodesOutlineOffset:n}=this.state.styleOptions.value;if(i)return t+n*2;const s=this.boxCapWidth*2,o=t-n*2;return o>=s?o:s}getLabelText(){if(!this.hasSubNodes)return this.nodeData.label;const{subNodeLabels:t}=this.state,{subflowRunId:i}=this.nodeData;return t.value.has(i)?t.value.get(i):this.nodeData.label}checkIsLabelInBox(t=0){const{hasSubNodes:i,isSubNodesToggleFloating:n,subNodesToggle:s}=this;return i&&!n?this.apxLabelWidth+t<this.nodeWidth-s.width:this.apxLabelWidth+t<this.nodeWidth}getSelectedRingSize(){const{nodeWidth:t,nodeHeight:i,hasSubNodes:n,isSubNodesExpanded:s}=this,{spacingNodeSelectionMargin:o,spacingNodeSelectionWidth:a,spacingSubNodesOutlineBorderWidth:h,spacingSubNodesOutlineOffset:u}=this.state.styleOptions.value,l=o+a,f=t+l*2,c=n&&!s?i+h+u+l*2:i+l*2;return{width:f,height:c,margin:l}}emitSelection(){const{id:t,subflowRunId:i}=this.nodeData,n={id:this.hasSubNodes?i:t,type:this.hasSubNodes?"subFlowRun":"task"};this.emit(ae.nodeDetails,n)}getSubContentHeight(){var i,n,s;const{spacingNodeMargin:t}=this.state.styleOptions.value;return(i=this.subNodesContent)!=null&&i.height?this.subNodesContent.height:(n=this.subNodesLoadingIndicator)!=null&&n.height?this.subNodesLoadingIndicator.height+t:(s=this.noSubNodesMessage)!=null&&s.height?this.noSubNodesMessage.height+t:0}emitSubNodesToggle(t){this.emit(ae.subNodesToggle,t??this.nodeData.subflowRunId)}destroySubNodesContent(){var t;this.subNodesContentTicker&&(this.state.pixiApp.ticker.remove(this.subNodesContentTicker),this.subNodesContentTicker=null),this.destroyNoSubNodesMessage(),this.destroySubNodesLoadingIndicator(),(t=this.subNodesContent)==null||t.destroy(),this.subNodesContent=null}destroySubNodesLoadingIndicator(){var t;(t=this.subNodesLoadingIndicator)==null||t.destroy(),this.subNodesLoadingIndicator=null}destroyNoSubNodesMessage(){var t;(t=this.noSubNodesMessage)==null||t.destroy(),this.noSubNodesMessage=null}destroyRunningNodeTicker(){this.runningNodeTicker&&(this.state.pixiApp.ticker.remove(this.runningNodeTicker),this.runningNodeTicker=null)}killTweens(){Vt.killTweensOf([this,this.subNodesOutline])}destroy(){var i,n,s,o,a,h,u;const{cull:t}=this.state;t.remove(this.box),this.label&&t.remove(this.label),this.killTweens(),this.isSelected&&this.emit(ae.nodeDetails,null),this.isSubNodesExpanded&&this.emitSubNodesToggle(),this.destroyRunningNodeTicker(),this.destroySubNodesContent(),(i=this.subNodesOutline)==null||i.destroy(),(n=this.leftBoxCap)==null||n.destroy(),(s=this.rightBoxCap)==null||s.destroy(),(o=this.boxBody)==null||o.destroy(),this.box.destroy(),(a=this.subNodesToggle)==null||a.destroy(),(h=this.label)==null||h.destroy(),(u=this.selectedRing)==null||u.destroy(),this.unWatchers.forEach(l=>l()),super.destroy.call(this)}}const Rf="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IFM9KHttaW5pbXVtU3RhcnRUaW1lOnMsZ3JhcGhYRG9tYWluOmMsaW5pdGlhbE92ZXJhbGxUaW1lU3Bhbjp1fSk9Pih7ZGF0ZVRvWDprKHMsYyx1KSx4VG9EYXRlOkEocyxjLHUpfSk7ZnVuY3Rpb24gayhzLGMsdSl7cmV0dXJuIGZ1bmN0aW9uKHApe3JldHVybiBNYXRoLmNlaWwoKHAuZ2V0VGltZSgpLXMpKihjL3UpKX19ZnVuY3Rpb24gQShzLGMsdSl7cmV0dXJuIGZ1bmN0aW9uKHApe3JldHVybiBuZXcgRGF0ZShNYXRoLmNlaWwocytwKih1L2MpKSl9fWNvbnN0IEM9MDthc3luYyBmdW5jdGlvbiBNKHtkYXRhOnMsdGltZVNjYWxlOmMsY3VycmVudEFweENoYXJhY3RlcldpZHRoOnUsbWluaW11bU5vZGVFZGdlR2FwOnB9KXtjb25zdCBpPXt9O2FzeW5jIGZ1bmN0aW9uIGIoKXtmb3IgYXdhaXQoY29uc3RbLGVdb2Ygcyl7aWYoIWUuc3RhcnQpY29udGludWU7Y29uc3QgdD1jLmRhdGVUb1goZS5lbmQ/P25ldyBEYXRlKSxvPWUubGFiZWwubGVuZ3RoKnUsbj10K28sYT1jLmRhdGVUb1gobmV3IERhdGUoZS5zdGFydCkpLHI9YXdhaXQgTihlLGEpO2lbZS5pZF09e3JvdzpyLHN0YXJ0WDphLGVuZFg6bn19fWFzeW5jIGZ1bmN0aW9uIE4oZSx0KXtpZihlLnVwc3RyZWFtLmxlbmd0aD09PTEpe2lmKGUudXBzdHJlYW1bMF1pbiBpKXtjb25zdCBvPWlbZS51cHN0cmVhbVswXV07cmV0dXJuIGF3YWl0IGcobyx0KX1yZXR1cm4gY29uc29sZS53YXJuKCJ0aW1lbGluZU5vZGVzIGxheW91dCB3b3JrZXI6IFBhcmVudCBub2RlIG5vdCBmb3VuZCBpbiBsYXlvdXQiLGUudXBzdHJlYW1bMF0pLEN9aWYoZS51cHN0cmVhbS5sZW5ndGg+MCl7Y29uc3Qgbj1lLnVwc3RyZWFtLm1hcChsPT5pW2xdKS5maWx0ZXIobD0+ISFsKS5tYXAobD0+bC5yb3cpLHI9bi5yZWR1Y2UoKGwsdyk9PmwrdywwKS9uLmxlbmd0aCxmPU1hdGgucm91bmQocik7aWYobSh0LGYpKXtjb25zdCBsPVQodCxmKSx3PWwuZmlsdGVyKHk9PmUudXBzdHJlYW0uaW5jbHVkZXMoeSkpO2lmKHcubGVuZ3RoPjB8fGwubGVuZ3RoPjEpe2NvbnN0W3ldPXcubGVuZ3RoPjA/dzpsLEw9aVt5XTtyZXR1cm4gTC5uZXh0RGVwZW5kZW5jeVNob3ZlPVcobixmLEwubmV4dERlcGVuZGVuY3lTaG92ZSksYXdhaXQgZyhMLHQpfXJldHVybiBhd2FpdCBSKHtjb21wZXRpbmdMYXlvdXRJdGVtSWQ6bFswXSx1cHN0cmVhbVBvc2l0aW9uczpuLG5vZGVTdGFydFg6dCxkZXNpcmVkUG9zaXRpb246Zn0pfX1yZXR1cm4geCh0LEMpfWZ1bmN0aW9uIHgoZSx0KXtyZXR1cm4gbShlLHQpP3goZSx0KzEpOnR9YXN5bmMgZnVuY3Rpb24gZyhlLHQpe2UubmV4dERlcGVuZGVuY3lTaG92ZSE9PTEmJmUubmV4dERlcGVuZGVuY3lTaG92ZSE9PS0xJiYoZS5uZXh0RGVwZW5kZW5jeVNob3ZlPTEpO2NvbnN0e3JvdzpvLG5leHREZXBlbmRlbmN5U2hvdmU6bn09ZTtyZXR1cm4gbSh0LG8pP249PT0xJiYhbSh0LG8rMSk/KGUubmV4dERlcGVuZGVuY3lTaG92ZT0tMSxvKzEpOm0odCxvLTEpPyhhd2FpdCBkKHtkaXJlY3Rpb246bixub2RlU3RhcnRYOnQsZGVzaXJlZFBvc2l0aW9uOm8rbn0pLGUubmV4dERlcGVuZGVuY3lTaG92ZT1uPT09MT8tMToxLG8rbik6KGUubmV4dERlcGVuZGVuY3lTaG92ZT0xLG8tMSk6b31mdW5jdGlvbiBtKGUsdCl7Y29uc3Qgbz1PYmplY3Qua2V5cyhpKTtyZXR1cm4gby5sZW5ndGg+MCYmby5zb21lKG49Pntjb25zdCBhPWlbbl07cmV0dXJuIE8oe2ZpcnN0Tm9kZUVuZFg6YS5lbmRYLGZpcnN0Tm9kZVBvc2l0aW9uOmEucm93LGxhc3ROb2RlU3RhcnRYOmUsbGFzdE5vZGVQb3NpdGlvbjp0fSl9KX1hc3luYyBmdW5jdGlvbiBkKHtkaXJlY3Rpb246ZSxub2RlU3RhcnRYOnQsZGVzaXJlZFBvc2l0aW9uOm99KXtjb25zdCBuPVQodCxvKTtpZihuKWZvciBhd2FpdChjb25zdCBhIG9mIG4pe2NvbnN0IHI9aVthXSxmPXIucm93K2U7YXdhaXQgZCh7ZGlyZWN0aW9uOmUsbm9kZVN0YXJ0WDpyLnN0YXJ0WCxkZXNpcmVkUG9zaXRpb246Zn0pLHIucm93PWZ9fWZ1bmN0aW9uIE8oe2ZpcnN0Tm9kZUVuZFg6ZSxmaXJzdE5vZGVQb3NpdGlvbjp0LGxhc3ROb2RlU3RhcnRYOm8sbGFzdE5vZGVQb3NpdGlvbjpufSl7cmV0dXJuIHQ9PT1uJiZlK3A+PW99ZnVuY3Rpb24gVChlLHQpe2NvbnN0IG89W107aWYoT2JqZWN0LmtleXMoaSkuZm9yRWFjaChuPT57Y29uc3QgYT1pW25dO08oe2ZpcnN0Tm9kZUVuZFg6YS5lbmRYLGZpcnN0Tm9kZVBvc2l0aW9uOmEucm93LGxhc3ROb2RlU3RhcnRYOmUsbGFzdE5vZGVQb3NpdGlvbjp0fSkmJm8ucHVzaChuKX0pLG8ubGVuZ3RoIT09MClyZXR1cm4gby5zb3J0KChuLGEpPT57Y29uc3Qgcj1pW25dLGY9aVthXTtyZXR1cm4gci5lbmRYPGYuZW5kWD8xOnIuZW5kWD5mLmVuZFg/LTE6MH0pLG99ZnVuY3Rpb24gVyhlLHQsbyl7Y29uc3Qgbj1lLmZpbHRlcihyPT5yPHQpLmxlbmd0aCxhPWUuZmlsdGVyKHI9PnI+dCkubGVuZ3RoO3JldHVybiBuPmE/LTE6bz8/MX1hc3luYyBmdW5jdGlvbiBSKHtkZXNpcmVkUG9zaXRpb246ZSxub2RlU3RhcnRYOnQsdXBzdHJlYW1Qb3NpdGlvbnM6byxjb21wZXRpbmdMYXlvdXRJdGVtSWQ6bn0pe2NvbnN0IGE9aVtuXSxbcixmXT1VKG4pLGw9by5maWx0ZXIoeT0+eTxlKS5sZW5ndGgsdz1vLmZpbHRlcih5PT55PmUpLmxlbmd0aDtpZihsPncpe2lmKHI+ZiYmcj5sKXJldHVybiBhd2FpdCBkKHtkaXJlY3Rpb246LTEsbm9kZVN0YXJ0WDp0LGRlc2lyZWRQb3NpdGlvbjplfSksZTtpZihmPnIpcmV0dXJuIGF3YWl0IGQoe2RpcmVjdGlvbjoxLG5vZGVTdGFydFg6dCxkZXNpcmVkUG9zaXRpb246ZX0pLGU7YS5uZXh0RGVwZW5kZW5jeVNob3ZlPS0xfWlmKHc+bCl7aWYoZj5yJiZmPncpcmV0dXJuIGF3YWl0IGQoe2RpcmVjdGlvbjoxLG5vZGVTdGFydFg6dCxkZXNpcmVkUG9zaXRpb246ZX0pLGU7aWYocj5mKXJldHVybiBhd2FpdCBkKHtkaXJlY3Rpb246LTEsbm9kZVN0YXJ0WDp0LGRlc2lyZWRQb3NpdGlvbjplfSksZTthLm5leHREZXBlbmRlbmN5U2hvdmU9MX1yZXR1cm4gYXdhaXQgZyhhLHQpfWZ1bmN0aW9uIFUoZSl7Y29uc3QgdD1zLmdldChlKSxvPWlbZV07cmV0dXJuIHQudXBzdHJlYW0ucmVkdWNlKChuLGEpPT57aWYoZSBpbiBpKXtjb25zdCByPWlbYV07cmV0dXJuIHIucm93PG8ucm93JiYoblswXSs9MSksci5yb3c+by5yb3cmJihuWzFdKz0xKSxufXJldHVybiBjb25zb2xlLndhcm4oIm5vZGVMYXlvdXQud29ya2VyLnRzOiBQYXJlbnQgbm9kZSBub3QgZm91bmQgb24gbGF5b3V0IGRhdGEiLGUpLG59LFswLDBdKX1yZXR1cm4gYXdhaXQgYigpLGl9ZnVuY3Rpb24gaihzKXtjb25zdCBjPXt9O2xldCB1PTA7cmV0dXJuIHMuZm9yRWFjaCgocCxpKT0+e2NbaV09e3Jvdzp1LHN0YXJ0WDowLGVuZFg6MH0sdSsrfSksY31sZXQgRCxJPTE0LFg9MCx2LFA9bmV3IE1hcCxoPXt9O29ubWVzc2FnZT1hc3luYyh7ZGF0YTp7bGF5b3V0U2V0dGluZzpzLGRhdGE6YyxhcHhDaGFyYWN0ZXJXaWR0aDp1LHNwYWNpbmdNaW5pbXVtTm9kZUVkZ2VHYXA6cCx0aW1lU2NhbGVBcmdzOmksY2VudGVyVmlld3BvcnRBZnRlcjpifX0pPT57aWYocCYmKFg9cCkscyYmKHY9cyksdSYmKEk9dSksaSl7Y29uc3R7bWluaW11bVN0YXJ0VGltZTpOLGdyYXBoWERvbWFpbjp4LGluaXRpYWxPdmVyYWxsVGltZVNwYW46Z309aTtEPVMoe21pbmltdW1TdGFydFRpbWU6TixncmFwaFhEb21haW46eCxpbml0aWFsT3ZlcmFsbFRpbWVTcGFuOmd9KX1jJiZEJiZ2JiYoUD1jLGF3YWl0IEIoKSxwb3N0TWVzc2FnZSh7bGF5b3V0OmgsY2VudGVyVmlld3BvcnRBZnRlcjpifSkpfTthc3luYyBmdW5jdGlvbiBCKCl7dj09PSJ3YXRlcmZhbGwiJiYoaD1qKFApKSx2PT09Im5lYXJlc3RQYXJlbnQiJiYoaD1hd2FpdCBNKHtkYXRhOlAsdGltZVNjYWxlOkQsY3VycmVudEFweENoYXJhY3RlcldpZHRoOkksbWluaW11bU5vZGVFZGdlR2FwOlh9KSksRSgpfWZ1bmN0aW9uIEUoKXtjb25zdCBzPU9iamVjdC52YWx1ZXMoaCkucmVkdWNlKChjLHUpPT51LnJvdzxjP3Uucm93OmMsMCk7czwwJiZPYmplY3QudmFsdWVzKGgpLmZvckVhY2goYz0+e2Mucm93Kz1NYXRoLmFicyhzKX0pfX0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPW5vZGVMYXlvdXQud29ya2VyLWJhNTRlMTY4LmpzLm1hcAo=",Of=typeof window<"u"&&window.Blob&&new Blob([atob(Rf)],{type:"text/javascript;charset=utf-8"});function Yx(){let r;try{if(r=Of&&(window.URL||window.webkitURL).createObjectURL(Of),!r)throw"";return new Worker(r)}catch{return new Worker("data:application/javascript;base64,"+Rf)}finally{r&&(window.URL||window.webkitURL).revokeObjectURL(r)}}const Ha="timelineUpdateEvent";class Af extends ot{constructor({nodeContentContainerName:t,isSubNodes:i,data:n,state:s}){super();C(this,"layoutWorker",new Yx);C(this,"isSubNodes");C(this,"data");C(this,"state");C(this,"nodeContainer",new ot);C(this,"nodeRecords",new Map);C(this,"layout",X.ref({}));C(this,"layoutRows",X.ref([]));C(this,"edgeContainer",new ot);C(this,"edgeRecords",[]);C(this,"unWatchers",[]);C(this,"isSelectionPathHighlighted",!1);t&&(this.nodeContainer.name=t),this.isSubNodes=i,this.data=n,this.state=s,this.initDeselectLayer(),this.initLayoutWorker(),this.initWatchers()}initWatchers(){const{layoutSetting:t,hideEdges:i,selectedNodeId:n}=this.state;this.unWatchers.push(X.watch(t,()=>{this.updateLayoutSetting()}),X.watch(i,()=>{this.updateHideEdges()}),X.watch(n,()=>{if(n.value&&this.nodeRecords.has(n.value)){this.isSelectionPathHighlighted&&this.unHighlightSelectedNodePath(),this.isSelectionPathHighlighted=!0,this.highlightSelectedNodePath();return}this.isSelectionPathHighlighted&&(!n.value||!this.nodeRecords.has(n.value))&&this.unHighlightSelectedNodePath()}))}async initLayoutWorker(){const{styleOptions:t,timeScaleArgs:i,layoutSetting:n,centerViewport:s,suppressMotion:o}=this.state,a=await Xr(t.value),{spacingMinimumNodeEdgeGap:h}=t.value,u=ue.measureText("M",a.nodeTextStyles).width,l={data:X.toRaw(this.data),timeScaleArgs:i,spacingMinimumNodeEdgeGap:h,apxCharacterWidth:u,layoutSetting:n.value};this.layoutWorker.onmessage=({data:f})=>{this.layout.value=f.layout,this.renderLayout(),this.isSelectionPathHighlighted&&this.highlightSelectedNodePath(),f.centerViewportAfter&&!this.isSubNodes&&setTimeout(()=>{s()},o.value?10:Cf.move*1e3*1.1),this.emit(Ha)},this.layoutWorker.postMessage(l)}initDeselectLayer(){if(this.isSubNodes)return;const{pixiApp:t,viewport:i}=this.state,n=new s0(t,i);this.addChild(n),n.on("click",()=>{this.emitNullSelection()})}renderLayout(){const{layout:t}=this,i=this.nodeRecords.size===0,n=[];Object.keys(t.value).forEach(s=>{const o=this.data.get(s);o&&(this.nodeRecords.has(s)?this.nodeRecords.get(s).update(o):(this.createNode(o),n.push(s)))}),this.updateLayoutRows(),n.forEach(s=>{this.nodeRecords.get(s).initializePosition()}),i&&(this.addChild(this.edgeContainer),this.addChild(this.nodeContainer),this.isSubNodes||this.state.centerViewport({skipAnimation:!0}))}createNode(t){const{state:i,layout:n,layoutRows:s}=this,o=new zx({nodeData:t,state:i,layout:n,layoutRows:s});this.registerEmits(o),this.nodeRecords.set(t.id,o),this.addNodeEdges(t),this.nodeContainer.addChild(o),o.on(ka,()=>{this.updateLayoutRows()})}addNodeEdges(t){t.upstream.forEach(i=>{const n=this.nodeRecords.get(i),s=this.nodeRecords.get(t.id);if(!n||!s){console.warn("timelineNodes: could not find source or target node for edge, skipping");return}const o=new Xx({sourceNode:n,targetNode:s,state:this.state});this.state.hideEdges.value&&(o.renderable=!1),this.edgeRecords.push({edge:o,sourceId:i,targetId:t.id}),this.edgeContainer.addChild(o)})}update(t){if(this.data=t,t.size!==this.nodeRecords.size){const i={data:X.toRaw(this.data)};this.layoutWorker.postMessage(i);return}this.nodeRecords.forEach((i,n)=>{const s=this.data.get(n);s&&i.update(s)}),this.emit(Ha)}updateHideEdges(){const{hideEdges:t,viewport:i}=this.state;this.edgeRecords.forEach(({edge:n})=>n.renderable=!t.value),t.value||(i.dirty=!0,i.updateTransform()),this.isSelectionPathHighlighted&&this.highlightSelectedNodePath()}updateLayoutRows(t=0){const{layout:i}=this,{spacingNodeMargin:n,spacingNodeSelectionMargin:s}=this.state.styleOptions.value,o=Math.max(...Object.values(i.value).map(u=>u.row));let a=[];const h=Object.keys(i.value).reduce((u,l)=>{var v;const{row:f}=i.value[l],c=u.get(f)??0,d=((v=this.nodeRecords.get(l))==null?void 0:v.height)??0;return u.set(f,Math.max(d,c)),u},new Map);for(let u=t;u<=o;u++){const l=a[u-1],f=h.get(u)??0;if(l===void 0){a.push({yPos:0,height:f});continue}const c=l.yPos+l.height-s*2+n;a.push({yPos:c,height:f})}t>0&&(a=this.layoutRows.value.slice(0,t).concat(a)),this.layoutRows.value=a}updateLayoutSetting(){const{layoutSetting:t}=this.state,i={data:X.toRaw(this.data),layoutSetting:t.value,centerViewportAfter:!0};this.layoutWorker.postMessage(i)}highlightSelectedNodePath(){const t=this.state.selectedNodeId.value,i=t&&this.nodeRecords.get(t);if(!t||!i)return;const{alphaNodeDimmed:n}=this.state.styleOptions.value,s=[...this.getAllUpstreamEdges(t),...this.getAllDownstreamEdges(t)],o=new Map;o.set(t,i),this.edgeRecords.forEach(a=>{if(s.includes(a)){const h=this.nodeRecords.get(a.sourceId),u=this.nodeRecords.get(a.targetId);o.set(a.sourceId,h),o.set(a.targetId,u),a.edge.renderable=!0;return}a.edge.alpha=n}),this.nodeRecords.forEach((a,h)=>{o.has(h)||(a.alpha=n)})}getAllUpstreamEdges(t){const i=[],n=this.data.get(t);return n==null||n.upstream.forEach(s=>{const o=this.edgeRecords.find(a=>a.sourceId===s&&a.targetId===t);if(o){i.push(o);const a=this.getAllUpstreamEdges(s);i.push(...a)}}),i}getAllDownstreamEdges(t){const i=[];return this.data.forEach(n=>{if(n.upstream.includes(t)){const s=this.edgeRecords.find(o=>o.targetId===n.id&&o.sourceId===t);if(s){i.push(s);const o=this.getAllDownstreamEdges(n.id);i.push(...o)}}}),i}unHighlightSelectedNodePath(){const{hideEdges:t}=this.state;this.edgeRecords.forEach(({edge:i})=>{t.value&&(i.renderable=!1),i.alpha=1}),this.nodeRecords.forEach(i=>{i.alpha=1})}registerEmits(t){t.on(ae.nodeDetails,i=>{this.emit(ae.nodeDetails,i)}),t.on(ae.subNodesToggle,i=>{this.emit(ae.subNodesToggle,i)})}emitNullSelection(){this.emit(ae.nodeDetails,null)}getEarliestNodeStart(){if(this.data.size<1)return null;let t=new Date;return this.data.forEach(({start:i})=>{i&&i.getTime()<t.getTime()&&(t=i)}),t}destroy(){this.nodeRecords.forEach(t=>t.destroy()),this.nodeRecords.clear(),this.edgeRecords.forEach(t=>t.edge.destroy()),this.removeChildren(),this.unWatchers.forEach(t=>t()),this.layoutWorker.terminate(),this.layoutWorker.onmessage=null,this.isSubNodes||Gx(),super.destroy.call(this)}}class Vx extends ot{constructor(t){super();C(this,"state");C(this,"unwatch");C(this,"playhead",new Se);C(this,"label");this.state=t,this.state.cull.add(this),this.zIndex=sl.playhead,this.drawPlayhead(),this.drawTimeLabel(),this.unwatch=X.watch(this.state.styleOptions,()=>{this.playhead.clear(),this.drawPlayhead()}),this.interactive=!1}drawPlayhead(){const{colorPlayheadBg:t,spacingPlayheadWidth:i,spacingPlayheadGlowPadding:n}=this.state.styleOptions.value;this.playhead.beginFill(t,.1),this.playhead.drawRect(0,0,i+n*2,this.state.pixiApp.screen.height),this.playhead.endFill(),this.playhead.beginFill(t),this.playhead.drawRect(n,0,i,this.state.pixiApp.screen.height),this.playhead.endFill(),this.addChild(this.playhead)}async drawTimeLabel(){const{spacingGuideLabelPadding:t,spacingPlayheadGlowPadding:i}=this.state.styleOptions.value,n=await Xr(this.state.styleOptions.value),{timeBySeconds:s}=this.state.formatDateFns.value,o=s(new Date);this.label=new Zn(o,n.playheadTimerLabel),this.label.x=-this.label.width-(i+t),this.label.y=this.getTimeLabelY(),this.addChild(this.label),setInterval(()=>{const a=new Date;this.label.text=s(a)},1e3)}getTimeLabelY(){const{spacingGuideLabelPadding:t}=this.state.styleOptions.value;return this.state.pixiApp.screen.height-(this.label.height+t)}updatePosition(){const{spacingPlayheadWidth:t,spacingPlayheadGlowPadding:i}=this.state.styleOptions.value;this.position.x=this.state.timeScale.dateToX(new Date)*this.state.viewport.scale._x+this.state.viewport.worldTransform.tx-i-t/2,this.playhead.height!==this.state.pixiApp.screen.height&&(this.playhead.height=this.state.pixiApp.screen.height,this.label.y=this.getTimeLabelY())}destroy(){this.state.cull.remove(this),this.unwatch(),this.playhead.destroy(),super.destroy.call(this)}}const jx=({minimumStartTime:r,graphXDomain:e,initialOverallTimeSpan:t})=>({dateToX:Zx(r,e,t),xToDate:qx(r,e,t)});function Zx(r,e,t){return function(i){return Math.ceil((i.getTime()-r)*(e/t))}}function qx(r,e,t){return function(i){return new Date(Math.ceil(r+i*(t/e)))}}const Wa={leftCap:"leftCap",body:"body",rightCap:"rightCap"},Kx=.2,$x=.2;class Jx extends ot{constructor({graphState:t,nodeData:i,size:n,floating:s}){super();C(this,"graphState");C(this,"nodeData");C(this,"size");C(this,"isFloating");C(this,"isExpanded",!1);C(this,"textColor");C(this,"toggleBox",new ot);C(this,"hoverShade",new ot);C(this,"toggleArrow");C(this,"toggleBorder");C(this,"divider");C(this,"unWatchers",[]);this.interactive=!0,this.buttonMode=!0,t.cull.add(this),this.graphState=t,this.nodeData=i,this.size=n,this.isFloating=s,this.textColor=this.getTextColor(),this.addChild(this.toggleBox),this.addChild(this.hoverShade),this.initShapes(),this.on("pointerover",()=>{this.hover()}),this.on("pointerout",()=>{this.unHover()}),this.initWatchers()}initWatchers(){const{viewport:t,styleOptions:i,styleNode:n}=this.graphState;this.unWatchers.push(X.watch([i,n],()=>{this.redraw()},{deep:!0})),t.on("frame-end",()=>{t.scale.x<$x?this.visible=!1:this.visible=!0})}initShapes(){this.drawToggleBox(),this.drawHoverShade(),this.drawDivider(),this.drawToggleArrow(),this.drawToggleBorder()}drawToggleBox(){if(this.toggleBox.removeChildren(),!this.isFloating)return;const{size:t,toggleBox:i}=this,{pixiApp:n,styleOptions:s}=this.graphState,{colorButtonBg:o,borderRadiusButton:a}=s.value,{cap:h,body:u}=Ua({pixiApp:n,fill:o,borderRadius:a,boxCapWidth:a,height:t}),l=new ut(h),f=new ut(u);f.x=a,f.width=t-a*2,f.height=t;const c=new ut(h);c.scale.x=-1,c.x=t,i.addChild(l),i.addChild(f),i.addChild(c)}drawHoverShade(){const{hoverShade:t,size:i,isFloating:n}=this,{borderRadiusButton:s,colorButtonBgHover:o}=this.graphState.styleOptions.value,{onFillSubNodeToggleHoverBg:a,onFillSubNodeToggleHoverBgAlpha:h}=this.graphState.styleNode.value(this.nodeData),u=ie(a);t.removeChildren();const{cap:l,body:f}=Ua({pixiApp:this.graphState.pixiApp,fill:n?o:u,borderRadius:s,boxCapWidth:s,height:i}),c=new ut(l);c.name=Wa.leftCap,c.alpha=n?1:h;const d=new ut(f);d.name=Wa.body,d.x=s,d.width=n?i-s*2:i-s,d.height=i,d.alpha=n?1:h;const v=new ut(l);v.name=Wa.rightCap,v.scale.x=-1,v.x=i,v.alpha=n?1:0,t.addChild(c),t.addChild(d),t.addChild(v),t.alpha=0}drawDivider(){var o;if((o=this.divider)==null||o.destroy(),this.isFloating)return;const{size:t,textColor:i}=this,{pixiApp:n}=this.graphState,s=rn({pixiApp:n,fill:i});this.divider=new ut(s),this.divider.width=1,this.divider.height=t,this.divider.x=t,this.addChild(this.divider)}drawToggleArrow(){var a;const{size:t,textColor:i,isExpanded:n}=this,{pixiApp:s}=this.graphState;(a=this.toggleArrow)==null||a.destroy();const o=wf({pixiApp:s,strokeColor:i,edgeWidth:2,edgeLength:8});this.toggleArrow=new ut(o),this.toggleArrow.transform.rotation=n?Math.PI/2*-1:Math.PI/2,this.toggleArrow.anchor.set(.5,.5),this.toggleArrow.position.set(t/2,t/2),this.addChild(this.toggleArrow)}drawToggleBorder(){var a;(a=this.toggleBorder)==null||a.destroy();const{size:t,isFloating:i}=this,{colorButtonBorder:n,borderRadiusButton:s,spacingButtonBorderWidth:o}=this.graphState.styleOptions.value;!n||!i||(this.toggleBorder=new Ga({graphState:this.graphState,width:t,height:t,borderRadius:s,borderWidth:o,borderColor:n}),this.addChild(this.toggleBorder))}setToggleArrowRotation(t){const{suppressMotion:i}=this.graphState;this.toggleArrow&&Vt.to(this.toggleArrow,{rotation:t,duration:i.value?0:Kx,ease:"power2.inOut"})}getTextColor(){const{styleOptions:t,styleNode:i}=this.graphState,{colorTextDefault:n,colorTextInverse:s}=t.value,{inverseTextOnFill:o}=i.value(this.nodeData);return this.isFloating?n:o?s:n}redraw(){this.textColor=this.getTextColor(),this.initShapes()}hover(){this.hoverShade.alpha=1}unHover(){this.hoverShade.alpha=0}setExpanded(){this.isExpanded=!0,this.setToggleArrowRotation(Math.PI/2*-1)}setCollapsed(){this.isExpanded=!1,this.setToggleArrowRotation(Math.PI/2)}updateFloatingState(t){this.isFloating!==t&&(this.isFloating=t,this.redraw())}destroy(){this.graphState.cull.remove(this),super.destroy.call(this)}}function If(r){let{left:e,right:t}=r;function i(){const{left:n,right:s}=r;return n===e&&s===t?!1:(e=n,t=s,!0)}return i}class Qx extends ot{constructor(t){super();C(this,"state");C(this,"viewportUpdated");C(this,"format");C(this,"date");C(this,"line");C(this,"label");C(this,"unwatch");C(this,"tick",()=>{!this.date||!this.viewportUpdated()||this.updatePosition()});this.state=t,this.viewportUpdated=If(t.viewport),this.state.pixiApp.ticker.add(this.tick),this.interactive=!1,this.createLine(),this.createLabel(),this.unwatch=X.watch(t.styleOptions,()=>{this.createLine(),this.createLabel()})}setDate(t){var n;const i=t.getTime()!==((n=this.date)==null?void 0:n.getTime());this.date=t,i&&(this.updatePosition(),this.updateLabel())}setFormat(t){this.format=t,this.updateLabel()}destroy(){this.state.pixiApp.ticker.remove(this.tick),super.destroy.call(this)}createLine(){const t=rn({pixiApp:this.state.pixiApp,fill:this.state.styleOptions.value.colorGuideLine});this.line=new ut(t),this.line.width=1,this.line.height=this.state.pixiApp.screen.height,this.addChild(this.line)}async createLabel(){const t=await Xr(this.state.styleOptions.value);this.label=new Zn("",t.timeMarkerLabel);const i=this.state.styleOptions.value.spacingGuideLabelPadding;this.label.position.set(i,i),this.addChild(this.label),this.updateLabel()}getPositionX(){if(!this.date)throw new Error("Guide position requested for undefined date");const{viewport:t}=this.state;return this.state.timeScale.dateToX(this.date)*t.scale._x+t.worldTransform.tx}updatePosition(){const t=this.getPositionX();this.position.set(t,0)}updateLabel(){!this.format||!this.date||!this.label||(this.label.text=this.format(this.date))}}const tb=20,eb=260,za=100;class ib extends ot{constructor(t){super();C(this,"state");C(this,"guides",[]);C(this,"viewportUpdated");C(this,"unwatch");C(this,"tick",()=>{this.viewportUpdated()&&this.updateGuides()});this.state=t,this.viewportUpdated=If(t.viewport),this.state.pixiApp.ticker.add(this.tick),this.unwatch=X.watch([this.state.styleOptions,this.state.formatDateFns],()=>{this.updateGuides()})}destroy(){this.state.pixiApp.ticker.remove(this.tick),this.unwatch(),super.destroy.call(this)}getViewportDates(){const t=this.state.timeScale.xToDate(this.state.viewport.left-za),i=this.state.timeScale.xToDate(this.state.viewport.right+za),n=i.getTime()-t.getTime();return{startDate:t,endDate:i,span:n}}getTimeSpan(){const t=this.state.pixiApp.screen.width+za*2,i=Math.ceil(t/eb),{span:n}=this.getViewportDates(),s=Math.ceil(n/i);return x0(s)}getFirstGuideDate(t,i){const n=Math.ceil(t.getTime()/i)*i;return new Date(n)}getGuideDates(){const{startDate:t,endDate:i}=this.getViewportDates(),{span:n}=this.getTimeSpan(),s=[];let o=this.getFirstGuideDate(t,n);if(o.getTime()>=i.getTime())throw new Error("first guide date is equal or after the desired end date");for(;o.getTime()<i.getTime();)s.push(o),o=rc(o,n);for(;s.length>tb;)s.shift(),s.pop();return s}getLabelFormat(){const{labelFormat:t}=this.getTimeSpan();return b0(t,this.state.formatDateFns.value)}updateGuides(){const t=this.getGuideDates(),i=this.guides.splice(t.length);t.forEach((n,s)=>this.updateOrCreateGuide(s,n)),this.removeGuides(i)}updateOrCreateGuide(t,i){const n=this.guides.at(t),s=n??new Qx(this.state);return s.setDate(i),s.setFormat(this.getLabelFormat()),this.guides[t]=s,n||this.addChild(s),s}removeGuides(t){t.forEach(i=>{i.destroy(),this.removeChild(i)})}}const Mf={timeBySeconds:v0,timeByMinutes:_0,date:g0},Nf=()=>({fill:"black",inverseTextOnFill:!0,onFillSubNodeToggleHoverBg:"black",onFillSubNodeToggleHoverBgAlpha:.4}),rb=500,Df="rootNodesContainer",nb=X.defineComponent({__name:"FlowRunTimeline",props:{data:{},isRunning:{type:Boolean},theme:{},formatDateFns:{},selectedNodeId:{},layout:{},hideEdges:{type:Boolean},subNodeLabels:{},expandedSubNodes:{},visibleDateRange:{}},emits:["selection","subNodeToggle","update:visibleDateRange"],setup(r,{expose:e,emit:t}){const i=r;e({centerViewport:ht,moveViewportCenter:vt});const n=X.computed({get(){return i.visibleDateRange},set(G){t("update:visibleDateRange",G)}}),s=X.ref(),o=X.computed(()=>{var G;return((G=i.theme)==null?void 0:G.node)??Nf}),a=X.computed(()=>{var G;return f0((G=i.theme)==null?void 0:G.defaults)}),h=X.computed(()=>i.selectedNodeId??null),u=X.computed(()=>i.layout??"nearestParent"),l=X.computed(()=>i.isRunning??!1),f=X.computed(()=>i.hideEdges??!1),c=X.computed(()=>i.subNodeLabels??new Map),d=X.computed(()=>i.expandedSubNodes??new Map),v=X.computed(()=>{const G=window.matchMedia("(prefers-reduced-motion: reduce)").matches;return i.data.size>rb||G}),p=X.ref(!1),_=X.computed(()=>({...Mf,...i.formatDateFns})),g=X.ref(!0);let y,m;const b=new tc;let x,T,w;const S=X.ref();let E,P,O,I,F=null,k,A=null;X.onMounted(async()=>{if(!s.value){console.error("Stage reference not found in initPixiApp");return}R(),T=jx(x),y=o0(s.value),y.stage.sortableChildren=!0,m=await w0(s.value,y),q(),N(),J(),V(),M(),rt(),it(),pt(),g.value=!1});function M(){A&&(O=new ib(A),y.stage.addChild(O))}X.onUnmounted(()=>{L()});function L(){O.destroy(),I==null||I.destroy(),k.destroy(),m.destroy(),y.destroy(!0)}function q(){m.on("drag-start",()=>{p.value=!0}).on("drag-end",()=>{p.value=!1})}function z(){n.value={startDate:T.xToDate(m.left),endDate:T.xToDate(m.right),internalOrigin:!0}}function N(){m.on("moved",()=>{z()}),m.on("resize",()=>{z()}),X.watch(()=>i.visibleDateRange,()=>{if(!n.value)return;if(n.value.internalOrigin){n.value.internalOrigin=!1;return}const G=T.dateToX(n.value.startDate),nt=T.dateToX(n.value.endDate),gt=G+(nt-G)/2;m.fitWidth(nt-G,!0),m.moveCenter(gt,m.center.y)},{deep:!0})}function R(){const{min:nt,max:gt,span:$}=m0(i.data,6e4,l.value);w=nt,S.value=gt,E=$,P=U(),x={minimumStartTime:w.getTime(),graphXDomain:P,initialOverallTimeSpan:E}}function U(){const{spacingNodeYPadding:G,textLineHeightDefault:nt,spacingNodeMargin:gt,spacingSubNodesOutlineOffset:$}=a.value,jt=i.data.size,Ie=nt+G*2+$*2+gt,ei=s.value.clientWidth/s.value.clientHeight,xs=Ie*jt*ei,bs=jt>=120?jt/100:1.2;return xs*bs}function J(){n0(a.value),X.watch(a,G=>{r0(G)})}function V(){A={pixiApp:y,viewport:m,cull:b,cullScreen:_t,timeScale:T,timeScaleArgs:x,styleOptions:a,styleNode:o,layoutSetting:u,isRunning:l,hideEdges:f,subNodeLabels:c,selectedNodeId:h,expandedSubNodes:d,suppressMotion:v,centerViewport:ht,formatDateFns:_}}function it(){!l.value||!A||(I=new Vx(A),y.stage.addChild(I),dt())}function dt(){F||!I||(F=()=>{if(l.value&&I&&!I.destroyed){const G=I.position.x>0&&I.position.x<y.screen.width;if(S.value=new Date,I.updatePosition(),!m.moving&&G&&I.position.x>y.screen.width-a.value.spacingViewportPaddingDefault){const nt=T.xToDate(m.left);m.zoomPercent(-.1,!0),m.left=T.dateToX(nt)}}},y.ticker.add(F))}X.watch(l,G=>{g.value||(I&&F&&(I.destroy(),y.ticker.remove(F),F=null),G&&it())});function pt(){m.on("frame-end",()=>{m.dirty&&(_t(),m.dirty=!1)})}function Mt(){b.uncull()}function Bt(){_t()}function _t(){b.cull(y.renderer.screen)}function rt(){A&&(k=new Af({nodeContentContainerName:Df,data:i.data,state:A}),m.addChild(k),k.on(ae.nodeDetails,G=>{p.value||t("selection",G)}),k.on(ae.subNodesToggle,G=>{p.value||t("subNodeToggle",G)}),X.watch(()=>i.data,()=>{k.update(i.data),m.dirty=!0}))}function ht({skipAnimation:G}={}){const{spacingViewportPaddingDefault:nt}=a.value,gt=500;Mt();const{x:$,y:jt,width:Ie,height:ei}=k.getChildByName(Df).getLocalBounds();Bt();const _r=m.findFit(Ie+nt*2,ei+nt*2);m.animate({position:{x:$+Ie/2,y:jt+ei/2},scale:_r>1?1:_r,time:G||v.value?0:gt,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{G&&z()}})}function vt({xOffset:G,yOffset:nt}){const{x:gt,y:$}=m.transform.position;m.setTransform(gt+G,$+nt,m.transform.scale.x,m.transform.scale.y)}return(G,nt)=>(X.openBlock(),X.createElementBlock("div",{ref_key:"stage",ref:s,class:"g-flow-run-timeline"},null,512))}}),Db="";class he{constructor(e){this.parent=e,this.paused=!1}destroy(){}down(e){return!1}move(e){return!1}up(e){return!1}wheel(e){return!1}update(e){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var sb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ob(r,e,t){return t={path:e,exports:{},require:function(i,n){return ab(i,n??t.path)}},r(t,t.exports),t.exports}function ab(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Ff=ob(function(r,e){(function(){var t,i;i=function(n){return r.exports=n},t={linear:function(n,s,o,a){return o*n/a+s},easeInQuad:function(n,s,o,a){return o*(n/=a)*n+s},easeOutQuad:function(n,s,o,a){return-o*(n/=a)*(n-2)+s},easeInOutQuad:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n+s:-o/2*(--n*(n-2)-1)+s},easeInCubic:function(n,s,o,a){return o*(n/=a)*n*n+s},easeOutCubic:function(n,s,o,a){return o*((n=n/a-1)*n*n+1)+s},easeInOutCubic:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n+s:o/2*((n-=2)*n*n+2)+s},easeInQuart:function(n,s,o,a){return o*(n/=a)*n*n*n+s},easeOutQuart:function(n,s,o,a){return-o*((n=n/a-1)*n*n*n-1)+s},easeInOutQuart:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n*n+s:-o/2*((n-=2)*n*n*n-2)+s},easeInQuint:function(n,s,o,a){return o*(n/=a)*n*n*n*n+s},easeOutQuint:function(n,s,o,a){return o*((n=n/a-1)*n*n*n*n+1)+s},easeInOutQuint:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n*n*n+s:o/2*((n-=2)*n*n*n*n+2)+s},easeInSine:function(n,s,o,a){return-o*Math.cos(n/a*(Math.PI/2))+o+s},easeOutSine:function(n,s,o,a){return o*Math.sin(n/a*(Math.PI/2))+s},easeInOutSine:function(n,s,o,a){return-o/2*(Math.cos(Math.PI*n/a)-1)+s},easeInExpo:function(n,s,o,a){return n===0?s:o*Math.pow(2,10*(n/a-1))+s},easeOutExpo:function(n,s,o,a){return n===a?s+o:o*(-Math.pow(2,-10*n/a)+1)+s},easeInOutExpo:function(n,s,o,a){return(n/=a/2)<1?o/2*Math.pow(2,10*(n-1))+s:o/2*(-Math.pow(2,-10*--n)+2)+s},easeInCirc:function(n,s,o,a){return-o*(Math.sqrt(1-(n/=a)*n)-1)+s},easeOutCirc:function(n,s,o,a){return o*Math.sqrt(1-(n=n/a-1)*n)+s},easeInOutCirc:function(n,s,o,a){return(n/=a/2)<1?-o/2*(Math.sqrt(1-n*n)-1)+s:o/2*(Math.sqrt(1-(n-=2)*n)+1)+s},easeInElastic:function(n,s,o,a){var h,u,l;return l=1.70158,u=0,h=o,n===0||(n/=a),u||(u=a*.3),h<Math.abs(o)?(h=o,l=u/4):l=u/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(n-=1))*Math.sin((n*a-l)*(2*Math.PI)/u))+s},easeOutElastic:function(n,s,o,a){var h,u,l;return l=1.70158,u=0,h=o,n===0||(n/=a),u||(u=a*.3),h<Math.abs(o)?(h=o,l=u/4):l=u/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*n)*Math.sin((n*a-l)*(2*Math.PI)/u)+o+s},easeInOutElastic:function(n,s,o,a){var h,u,l;return l=1.70158,u=0,h=o,n===0||(n/=a/2),u||(u=a*(.3*1.5)),h<Math.abs(o)?(h=o,l=u/4):l=u/(2*Math.PI)*Math.asin(o/h),n<1?-.5*(h*Math.pow(2,10*(n-=1))*Math.sin((n*a-l)*(2*Math.PI)/u))+s:h*Math.pow(2,-10*(n-=1))*Math.sin((n*a-l)*(2*Math.PI)/u)*.5+o+s},easeInBack:function(n,s,o,a,h){return h===void 0&&(h=1.70158),o*(n/=a)*n*((h+1)*n-h)+s},easeOutBack:function(n,s,o,a,h){return h===void 0&&(h=1.70158),o*((n=n/a-1)*n*((h+1)*n+h)+1)+s},easeInOutBack:function(n,s,o,a,h){return h===void 0&&(h=1.70158),(n/=a/2)<1?o/2*(n*n*(((h*=1.525)+1)*n-h))+s:o/2*((n-=2)*n*(((h*=1.525)+1)*n+h)+2)+s},easeInBounce:function(n,s,o,a){var h;return h=t.easeOutBounce(a-n,0,o,a),o-h+s},easeOutBounce:function(n,s,o,a){return(n/=a)<1/2.75?o*(7.5625*n*n)+s:n<2/2.75?o*(7.5625*(n-=1.5/2.75)*n+.75)+s:n<2.5/2.75?o*(7.5625*(n-=2.25/2.75)*n+.9375)+s:o*(7.5625*(n-=2.625/2.75)*n+.984375)+s},easeInOutBounce:function(n,s,o,a){var h;return n<a/2?(h=t.easeInBounce(n*2,0,o,a),h*.5+s):(h=t.easeOutBounce(n*2-a,0,o,a),h*.5+o*.5+s)}},i(t)}).call(sb)});function _s(r,e){if(r){if(typeof r=="function")return r;if(typeof r=="string")return Ff[r]}else return Ff[e]}const hb={removeOnInterrupt:!1,ease:"linear",time:1e3};class He extends he{__init(){this.startWidth=null}__init2(){this.startHeight=null}__init3(){this.deltaWidth=null}__init4(){this.deltaHeight=null}__init5(){this.width=null}__init6(){this.height=null}__init7(){this.time=0}constructor(e,t={}){super(e),He.prototype.__init.call(this),He.prototype.__init2.call(this),He.prototype.__init3.call(this),He.prototype.__init4.call(this),He.prototype.__init5.call(this),He.prototype.__init6.call(this),He.prototype.__init7.call(this),this.options=Object.assign({},hb,t),this.options.ease=_s(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(e){if(this.paused)return;this.time+=e;const t=new j(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,n=this.parent.height;this.complete(),(i!==this.parent.width||n!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:t,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const n=this.startWidth,s=this.deltaWidth;this.parent.fitWidth(n+s*i,this.keepCenter,this.height===null)}if(this.height!==null){const n=this.startHeight,s=this.deltaHeight;this.parent.fitHeight(n+s*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 n=this.startX,s=this.startY,o=this.deltaX,a=this.deltaY,h=new j(this.parent.x,this.parent.y);this.parent.moveCenter(n+o*i,s+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:t,type:"animate"})}}}function gs(r){let e,t=r[0],i=1;for(;i<r.length;){const n=r[i],s=r[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&t==null)return;n==="access"||n==="optionalAccess"?(e=t,t=s(t)):(n==="call"||n==="optionalCall")&&(t=s((...o)=>t.call(e,...o)),e=void 0)}return t}const ub={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class Lf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},ub,t),this.ease=_s(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(e){if(!this.paused){if(this.bounce(),this.toX){const t=this.toX;t.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),t.time>=this.options.time?(this.parent.x=t.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(t.time,t.start,t.delta,this.options.time)}if(this.toY){const t=this.toY;t.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),t.time>=this.options.time?(this.parent.y=t.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(t.time,t.start,t.delta,this.options.time)}}}calcUnderflowX(){let e;switch(this.underflowX){case-1:e=0;break;case 1:e=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:e=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return e}calcUnderflowY(){let e;switch(this.underflowY){case-1:e=0;break;case 1:e=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:e=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return e}oob(){const e=this.options.bounceBox;if(e){const t=typeof e.x>"u"?0:e.x,i=typeof e.y>"u"?0:e.y,n=typeof e.width>"u"?this.parent.worldWidth:e.width,s=typeof e.height>"u"?this.parent.worldHeight:e.height;return{left:this.parent.left<t,right:this.parent.right>n,top:this.parent.top<i,bottom:this.parent.bottom>s,topLeft:new j(t*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new j(n*this.parent.scale.x-this.parent.screenWidth,s*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 j(0,0),bottomRight:new j(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){if(this.paused)return;let e,t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.x&&t.percentChangeX===gs([t,"access",s=>s.options,"optionalAccess",s=>s.friction])||t.y&&t.percentChangeY===gs([t,"access",s=>s.options,"optionalAccess",s=>s.friction]))&&(e=this.oob(),(e.left&&this.left||e.right&&this.right)&&(t.percentChangeX=this.options.friction),(e.top&&this.top||e.bottom&&this.bottom)&&(t.percentChangeY=this.options.friction));const i=this.parent.plugins.get("drag",!0)||{},n=this.parent.plugins.get("pinch",!0)||{};if(t=t||{},!gs([i,"optionalAccess",s=>s.active])&&!gs([n,"optionalAccess",s=>s.active])&&(!this.toX||!this.toY)&&(!t.x||!t.y)){e=e||this.oob();const s=e.topLeft,o=e.bottomRight;if(!this.toX&&!t.x){let a=null;e.left&&this.left?a=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-s.x:e.right&&this.right&&(a=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-o.x),a!==null&&this.parent.x!==a&&(this.toX={time:0,start:this.parent.x,delta:a-this.parent.x,end:a},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!t.y){let a=null;e.top&&this.top?a=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-s.y:e.bottom&&this.bottom&&(a=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-o.y),a!==null&&this.parent.y!==a&&(this.toY={time:0,start:this.parent.y,delta:a-this.parent.y,end:a},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const lb={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class Bf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},lb,t),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 e=this.options.underflow.toLowerCase();e==="none"?this.noUnderflow=!0:e==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=e.indexOf("left")!==-1?-1:e.indexOf("right")!==-1?1:0,this.underflowY=e.indexOf("top")!==-1?-1:e.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 e={x:this.parent.x,y:this.parent.y},t=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,t.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,t.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:e,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,t.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,t.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:e,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 fb={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class Uf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},fb,t),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&e<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,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&e>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,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&t<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,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&t>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 e={x:null,y:null},t={x:null,y:null};if(typeof this.options.minScale=="number")e.x=this.options.minScale,e.y=this.options.minScale;else if(this.options.minScale!==null){const s=this.options.minScale;e.x=typeof s.x>"u"?null:s.x,e.y=typeof s.y>"u"?null:s.y}if(typeof this.options.maxScale=="number")t.x=this.options.maxScale,t.y=this.options.maxScale;else if(this.options.maxScale!==null){const s=this.options.maxScale;t.x=typeof s.x>"u"?null:s.x,t.y=typeof s.y>"u"?null:s.y}let i=this.parent.scale.x,n=this.parent.scale.y;e.x!==null&&i<e.x&&(i=e.x),t.x!==null&&i>t.x&&(i=t.x),e.y!==null&&n<e.y&&(n=e.y),t.y!==null&&n>t.y&&(n=t.y),(i!==this.parent.scale.x||n!==this.parent.scale.y)&&(this.parent.scale.set(i,n),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const cb={friction:.98,bounce:.8,minSpeed:.01},_i=16;class Gf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},cb,t),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.moved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const e=this.parent.input.count();return(e===1||e>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}moved(e){if(this.saved.length){const t=this.saved[this.saved.length-1];e.type==="clamp-x"?t.x===e.original.x&&(t.x=this.parent.x):e.type==="clamp-y"&&t.y===e.original.y&&(t.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const e=performance.now();for(const t of this.saved)if(t.time>=e-100){const i=e-t.time;this.x=(this.parent.x-t.x)/i,this.y=(this.parent.y-t.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(e){e=e||{},typeof e.x<"u"&&(this.x=e.x,this.percentChangeX=this.options.friction),typeof e.y<"u"&&(this.y=e.y,this.percentChangeY=this.options.friction)}update(e){if(this.paused)return;const t=this.x||this.y,i=this.timeSinceRelease,n=this.timeSinceRelease+e;if(this.x){const s=this.percentChangeX,o=Math.log(s);this.parent.x+=this.x*_i/o*(Math.pow(s,n/_i)-Math.pow(s,i/_i)),this.x*=Math.pow(this.percentChangeX,e/_i)}if(this.y){const s=this.percentChangeY,o=Math.log(s);this.parent.y+=this.y*_i/o*(Math.pow(s,n/_i)-Math.pow(s,i/_i)),this.y*=Math.pow(this.percentChangeY,e/_i)}this.timeSinceRelease+=e,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)),t&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const db={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 ms extends he{__init(){this.windowEventHandlers=new Array}constructor(e,t={}){super(e),ms.prototype.__init.call(this),this.options=Object.assign({},db,t),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(e){const t=n=>{e.includes(n.code)&&(this.keyIsPressed=!0)},i=n=>{e.includes(n.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",t)}addWindowEventHandler(e,t){window.addEventListener(e,t),this.windowEventHandlers.push({event:e,handler:t})}destroy(){this.windowEventHandlers.forEach(({event:e,handler:t})=>{window.removeEventListener(e,t)})}mouseButtons(e){!e||e==="all"?this.mouse=[!0,!0,!0]:this.mouse=[e.indexOf("left")!==-1,e.indexOf("middle")!==-1,e.indexOf("right")!==-1]}parseUnderflow(){const e=this.options.underflow.toLowerCase();e==="center"?(this.underflowX=0,this.underflowY=0):(e.includes("left")?this.underflowX=-1:e.includes("right")?this.underflowX=1:this.underflowX=0,e.includes("top")?this.underflowY=-1:e.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(e){const t=e.data.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!t||this.mouse[e.data.button]))}checkKeyPress(e){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&e.data.pointerType==="touch"}down(e){return this.paused||!this.options.pressDrag?!1:this.checkButtons(e)&&this.checkKeyPress(e)?(this.last={x:e.data.global.x,y:e.data.global.y},this.current=e.data.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(e){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===e.data.pointerId){const t=e.data.global.x,i=e.data.global.y,n=this.parent.input.count();if(n===1||n>1&&!this.parent.plugins.get("pinch",!0)){const s=t-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(s)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:t,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:e,screen:new j(this.last.x,this.last.y),world:this.parent.toWorld(new j(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(e){if(this.paused)return!1;const t=this.parent.input.touches;if(t.length===1){const i=t[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 j(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:e,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(e){if(this.paused)return!1;if(this.options.wheel){const t=this.parent.plugins.get("wheel",!0);if(!t||!t.options.wheelZoom&&!e.ctrlKey){const i=e.deltaMode?this.options.lineHeight:1,n=[e.deltaX,e.deltaY],[s,o]=this.options.wheelSwapAxes?n.reverse():n;return this.xDirection&&(this.parent.x+=s*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||e.preventDefault(),this.parent.options.stopPropagation&&e.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const e=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,e.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,e.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,e.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,e.y=0)}}const pb={speed:0,acceleration:null,radius:null};class kf extends he{constructor(e,t,i={}){super(e),this.target=t,this.options=Object.assign({},pb,i),this.velocity={x:0,y:0}}update(e){if(this.paused)return;const t=this.parent.center;let i=this.target.x,n=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-t.y,2)+Math.pow(this.target.x-t.x,2))>this.options.radius){const h=Math.atan2(this.target.y-t.y,this.target.x-t.x);i=this.target.x-Math.cos(h)*this.options.radius,n=this.target.y-Math.sin(h)*this.options.radius}else return;const s=i-t.x,o=n-t.y;if(s||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(n-t.y,i-t.x),h=Math.sqrt(Math.pow(s,2)+Math.pow(o,2));if(h){const u=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>u?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*e,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*e,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 l=Math.cos(a)*this.velocity.x,f=Math.sin(a)*this.velocity.y,c=Math.abs(l)>Math.abs(s)?i:t.x+l,d=Math.abs(f)>Math.abs(o)?n:t.y+f;this.parent.moveCenter(c,d),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(n-t.y,i-t.x),h=Math.cos(a)*this.options.speed,u=Math.sin(a)*this.options.speed,l=Math.abs(h)>Math.abs(s)?i:t.x+h,f=Math.abs(u)>Math.abs(o)?n:t.y+u;this.parent.moveCenter(l,f),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,n),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const vb={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class Xf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},vb,t),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 e=this.options.distance;e!==null?(this.left=e,this.top=e,this.right=this.parent.screenWidth-e,this.bottom=this.parent.screenHeight-e):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(e){if(this.paused||e.data.pointerType!=="mouse"&&e.data.identifier!==1||!this.options.allowButtons&&e.data.buttons!==0)return!1;const t=e.data.global.x,i=e.data.global.y;if(this.radiusSquared){const n=this.parent.toScreen(this.parent.center);if(Math.pow(n.x-t,2)+Math.pow(n.y-i,2)>=this.radiusSquared){const o=Math.atan2(n.y-i,n.x-t);this.options.linear?(this.horizontal=Math.round(Math.cos(o))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(o))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(o)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(o)*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&&t<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&t>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 e=this.parent.plugins.get("decelerate",!0);this.horizontal&&e&&!this.options.noDecelerate&&e.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const e=this.parent.plugins.get("decelerate",!0);this.vertical&&e&&!this.options.noDecelerate&&e.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 e=this.parent.center;this.horizontal&&(e.x+=this.horizontal*this.options.speed),this.vertical&&(e.y+=this.vertical*this.options.speed),this.parent.moveCenter(e),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const _b={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class vr extends he{__init(){this.active=!1}__init2(){this.pinching=!1}__init3(){this.moved=!1}constructor(e,t={}){super(e),vr.prototype.__init.call(this),vr.prototype.__init2.call(this),vr.prototype.__init3.call(this),this.options=Object.assign({},_b,t)}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(e){if(this.paused||!this.active)return!1;const t=e.data.global.x,i=e.data.global.y,n=this.parent.input.touches;if(n.length>=2){const s=n[0],o=n[1],a=s.last&&o.last?Math.sqrt(Math.pow(o.last.x-s.last.x,2)+Math.pow(o.last.y-s.last.y,2)):null;if(s.id===e.data.pointerId?s.last={x:t,y:i,data:e.data}:o.id===e.data.pointerId&&(o.last={x:t,y:i,data:e.data}),a){let h;const u={x:s.last.x+(o.last.x-s.last.x)/2,y:s.last.y+(o.last.y-s.last.y)/2};this.options.center||(h=this.parent.toLocal(u));let l=Math.sqrt(Math.pow(o.last.x-s.last.x,2)+Math.pow(o.last.y-s.last.y,2));l=l===0?l=1e-10:l;const f=(1-a/l)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=f),this.isAxisY()&&(this.parent.scale.y+=f),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:u});const c=this.parent.plugins.get("clamp-zoom",!0);if(c&&c.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const d=this.parent.toGlobal(h);this.parent.x+=(u.x-d.x)*this.options.factor,this.parent.y+=(u.y-d.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(u.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(u.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=u,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 gb={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class Hf extends he{constructor(e,t,i,n={}){super(e),this.options=Object.assign({},gb,n),this.ease=_s(n.ease,"easeInOutSine"),this.x=t,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const e=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-e.x,this.deltaY=this.y-e.y,this.startX=e.x,this.startY=e.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 e=this.parent.plugins.get("decelerate",!0);e&&(e.x||e.y)&&(e.percentChangeX=e.percentChangeY=this.options.friction)}return!1}update(e){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const t=this.snapping;t.time+=e;let i,n,s;const o=this.startX,a=this.startY,h=this.deltaX,u=this.deltaY;if(t.time>this.options.time)i=!0,n=o+h,s=a+u;else{const l=this.ease(t.time,0,1,this.options.time);n=o+h*l,s=a+u*l}this.options.topLeft?this.parent.moveCorner(n,s):this.parent.moveCenter(n,s),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 t=this.options.topLeft?this.parent.corner:this.parent.center;(t.x!==this.x||t.y!==this.y)&&this.snapStart()}}}const mb={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class Wf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},mb,t),this.ease=_s(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=e.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=e.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?(e.container.scale.x=this.xScale,e.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):t.forceStart&&this.createSnapping()}createSnapping(){const e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,n=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:e,startY:t,deltaX:i-e,deltaY:n-t},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(e){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let t;if(!this.options.center&&!this.options.noMove&&(t=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+=e,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 s=this.snapping,o=this.ease(s.time,s.startX,s.deltaX,this.options.time),a=this.ease(s.time,s.startY,s.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const n=this.parent.plugins.get("clamp-zoom",!0);n&&n.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(t))}}resume(){this.snapping=null,super.resume()}}const yb={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class zf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},yb,t),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(e){window.addEventListener("keydown",t=>{e.includes(t.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",t=>{e.includes(t.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 e=this.smoothingCenter,t=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x+=t.x),this.isAxisY()&&(this.parent.scale.y+=t.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const n=this.parent.plugins.get("clamp-zoom",!0);if(n&&n.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const s=this.parent.toGlobal(i);this.parent.x+=e.x-s.x,this.parent.y+=e.y-s.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(e){if(this.paused)return;const t=this.parent.input.getPointerPosition(e),i=-e.deltaY*(e.deltaMode?this.options.lineHeight:1)/200,n=Math.pow(2,(1+this.options.percent)*i);let s;this.options.center||(s=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x*=n),this.isAxisY()&&(this.parent.scale.y*=n),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(s);this.parent.x+=t.x-a.x,this.parent.y+=t.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:e.deltaX,dy:e.deltaY,dz:e.deltaZ},event:e,viewport:this.parent})}wheel(e){if(this.paused||!this.checkKeyPress())return!1;if(e.ctrlKey&&this.options.trackpadPinch)this.pinch(e);else if(this.options.wheelZoom){const t=this.parent.input.getPointerPosition(e),n=(this.options.reverse?-1:1)*-e.deltaY*(e.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*n);if(this.options.smooth){const o={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+o.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+o.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=t}else{let o;this.options.center||(o=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const a=this.parent.plugins.get("clamp-zoom",!0);if(a&&a.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const h=this.parent.toGlobal(o);this.parent.x+=t.x-h.x,this.parent.y+=t.y-h.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:e.deltaX,dy:e.deltaY,dz:e.deltaZ},event:e,viewport:this.parent})}return!this.parent.options.passiveWheel}}class Yf{constructor(e){this.viewport=e,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new K(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,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.on("pointerout",this.up,this),this.wheelFunction=e=>this.handleWheel(e),this.viewport.options.divWheel.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.divWheel.removeEventListener("wheel",this.wheelFunction)}down(e){if(this.viewport.pause||!this.viewport.worldVisible)return;if(e.data.pointerType==="mouse"?this.isMouseDown=!0:this.get(e.data.pointerId)||this.touches.push({id:e.data.pointerId,last:null}),this.count()===1){this.last=e.data.global.clone();const i=this.viewport.plugins.get("decelerate",!0),n=this.viewport.plugins.get("bounce",!0);(!i||!i.isActive())&&(!n||!n.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(e)&&this.viewport.options.stopPropagation&&e.stopPropagation()}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(e){return Math.abs(e)>=this.viewport.threshold}move(e){if(this.viewport.pause||!this.viewport.worldVisible)return;const t=this.viewport.plugins.move(e);if(this.clickedAvailable&&this.last){const i=e.data.global.x-this.last.x,n=e.data.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(n))&&(this.clickedAvailable=!1)}t&&this.viewport.options.stopPropagation&&e.stopPropagation()}up(e){if(this.viewport.pause||!this.viewport.worldVisible)return;e.data.pointerType==="mouse"&&(this.isMouseDown=!1),e.data.pointerType!=="mouse"&&this.remove(e.data.pointerId);const t=this.viewport.plugins.up(e);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:e,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this}),this.clickedAvailable=!1),t&&this.viewport.options.stopPropagation&&e.stopPropagation()}getPointerPosition(e){const t=new j;if(this.viewport.options.interaction)this.viewport.options.interaction.mapPositionToPoint(t,e.clientX,e.clientY);else if(this.viewport.options.useDivWheelForInputManager&&this.viewport.options.divWheel){const i=this.viewport.options.divWheel.getBoundingClientRect();t.x=e.clientX-i.left,t.y=e.clientY-i.top}else t.x=e.clientX,t.y=e.clientY;return t}handleWheel(e){if(this.viewport.pause||!this.viewport.worldVisible||this.viewport.options.interaction&&this.viewport.options.interaction.interactionDOMElement!==e.target)return;const t=this.viewport.toLocal(this.getPointerPosition(e));this.viewport.left<=t.x&&t.x<=this.viewport.right&&this.viewport.top<=t.y&&t.y<=this.viewport.bottom&&this.viewport.plugins.wheel(e)&&!this.viewport.options.passiveWheel&&e.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(e){for(const t of this.touches)if(t.id===e)return t;return null}remove(e){for(let t=0;t<this.touches.length;t++)if(this.touches[t].id===e){this.touches.splice(t,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}function ys(r){let e,t=r[0],i=1;for(;i<r.length;){const n=r[i],s=r[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&t==null)return;n==="access"||n==="optionalAccess"?(e=t,t=s(t)):(n==="call"||n==="optionalCall")&&(t=s((...o)=>t.call(e,...o)),e=void 0)}return t}const nn=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class Vf{constructor(e){this.viewport=e,this.list=[],this.plugins={}}add(e,t,i=nn.length){const n=this.plugins[e];n&&n.destroy(),this.plugins[e]=t;const s=nn.indexOf(e);s!==-1&&nn.splice(s,1),nn.splice(i,0,e),this.sort()}get(e,t){return t&&ys([this,"access",i=>i.plugins,"access",i=>i[e],"optionalAccess",i=>i.paused])?null:this.plugins[e]}update(e){for(const t of this.list)t.update(e)}resize(){for(const e of this.list)e.resize()}reset(){for(const e of this.list)e.reset()}removeAll(){this.list.forEach(e=>{e.destroy()}),this.plugins={},this.sort()}remove(e){this.plugins[e]&&(ys([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.destroy,"call",t=>t()]),delete this.plugins[e],this.viewport.emit(`${e}-remove`),this.sort())}pause(e){ys([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.pause,"call",t=>t()])}resume(e){ys([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.resume,"call",t=>t()])}sort(){this.list=[];for(const e of nn)this.plugins[e]&&this.list.push(this.plugins[e])}down(e){let t=!1;for(const i of this.list)i.down(e)&&(t=!0);return t}move(e){let t=!1;for(const i of this.viewport.plugins.list)i.move(e)&&(t=!0);return t}up(e){let t=!1;for(const i of this.list)i.up(e)&&(t=!0);return t}wheel(e){let t=!1;for(const i of this.list)i.wheel(e)&&(t=!0);return t}}const xb={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,interaction:null,disableOnContextMenu:!1,ticker:Gt.shared};class Ya extends ot{__init(){this._disableOnContextMenu=e=>e.preventDefault()}constructor(e={}){super(),Ya.prototype.__init.call(this),this.options=Object.assign({},{divWheel:document.body},xb,e),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.divWheel=this.options.divWheel||document.body,this.options.disableOnContextMenu&&this.options.divWheel.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new Yf(this),this.plugins=new Vf(this)}destroy(e){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.divWheel.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(e)}update(e){this.pause||(this.plugins.update(e),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 K(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(e=window.innerWidth,t=window.innerHeight,i,n){this.screenWidth=e,this.screenHeight=t,typeof i<"u"&&(this._worldWidth=i),typeof n<"u"&&(this._worldHeight=n),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(e){this._worldWidth=e,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(e){this._worldHeight=e,this.plugins.resize()}getVisibleBounds(){return new K(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(e,t){return arguments.length===2?this.toLocal(new j(e,t)):this.toLocal(e)}toScreen(e,t){return arguments.length===2?this.toGlobal(new j(e,t)):this.toGlobal(e)}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 j(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(e){this.moveCenter(e)}moveCenter(...e){let t,i;typeof e[0]=="number"?(t=e[0],i=e[1]):(t=e[0].x,i=e[0].y);const n=(this.worldScreenWidth/2-t)*this.scale.x,s=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==n||this.y!==s)&&(this.position.set(n,s),this.plugins.reset(),this.dirty=!0),this}get corner(){return new j(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(e){this.moveCorner(e)}moveCorner(...e){let t,i;return e.length===1?(t=-e[0].x*this.scale.x,i=-e[0].y*this.scale.y):(t=-e[0]*this.scale.x,i=-e[1]*this.scale.y),(t!==this.x||i!==this.y)&&(this.position.set(t,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(e){return this.screenWidth/e}findFitHeight(e){return this.screenHeight/e}findFit(e,t){const i=this.screenWidth/e,n=this.screenHeight/t;return Math.min(i,n)}findCover(e,t){const i=this.screenWidth/e,n=this.screenHeight/t;return Math.max(i,n)}fitWidth(e=this.worldWidth,t,i=!0,n){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!n&&o&&o.clamp(),t&&s&&this.moveCenter(s),this}fitHeight(e=this.worldHeight,t,i=!0,n){let s;t&&(s=this.center),this.scale.y=this.screenHeight/e,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!n&&o&&o.clamp(),t&&s&&this.moveCenter(s),this}fitWorld(e){let t;e&&(t=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(),e&&t&&this.moveCenter(t),this}fit(e,t=this.worldWidth,i=this.worldHeight){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,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 s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&n&&this.moveCenter(n),this}setZoom(e,t){let i;t&&(i=this.center),this.scale.set(e);const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&i&&this.moveCenter(i),this}zoomPercent(e,t){return this.setZoom(this.scale.x+this.scale.x*e,t)}zoom(e,t){return this.fitWidth(e+this.worldScreenWidth,t),this}get scaled(){return this.scale.x}set scaled(e){this.setZoom(e,!0)}snapZoom(e){return this.plugins.add("snap-zoom",new Wf(this,e)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new j(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(e){this.x=-e*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(e){this.x=-e*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(e){this.y=-e*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(e){this.y=-e*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(e){this._dirty=e}get forceHitArea(){return this._forceHitArea}set forceHitArea(e){e?(this._forceHitArea=e,this.hitArea=e):(this._forceHitArea=null,this.hitArea=new K(0,0,this.worldWidth,this.worldHeight))}drag(e){return this.plugins.add("drag",new ms(this,e)),this}clamp(e){return this.plugins.add("clamp",new Bf(this,e)),this}decelerate(e){return this.plugins.add("decelerate",new Gf(this,e)),this}bounce(e){return this.plugins.add("bounce",new Lf(this,e)),this}pinch(e){return this.plugins.add("pinch",new vr(this,e)),this}snap(e,t,i){return this.plugins.add("snap",new Hf(this,e,t,i)),this}follow(e,t){return this.plugins.add("follow",new kf(this,e,t)),this}wheel(e){return this.plugins.add("wheel",new zf(this,e)),this}animate(e){return this.plugins.add("animate",new He(this,e)),this}clampZoom(e){return this.plugins.add("clamp-zoom",new Uf(this,e)),this}mouseEdges(e){return this.plugins.add("mouse-edges",new Xf(this,e)),this}get pause(){return!!this._pause}set pause(e){this._pause=e,this.lastViewport=null,this.moving=!1,this.zooming=!1,e&&this.input.pause()}ensureVisible(e,t,i,n,s){s&&(i>this.worldScreenWidth||n>this.worldScreenHeight)&&(this.fit(!0,i,n),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;e<this.left?(this.left=e,o=!0):e+i>this.right&&(this.right=e+i,o=!0),t<this.top?(this.top=t,o=!0):t+n>this.bottom&&(this.bottom=t+n,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}const bb=Object.freeze(Object.defineProperty({__proto__:null,Animate:He,Bounce:Lf,Clamp:Bf,ClampZoom:Uf,Decelerate:Gf,Drag:ms,Follow:kf,InputManager:Yf,MouseEdges:Xf,Pinch:vr,Plugin:he,PluginManager:Vf,Snap:Hf,SnapZoom:Wf,Viewport:Ya,Wheel:zf},Symbol.toStringTag,{value:"Module"}));Zt.FlowRunTimeline=nb,Zt.formatDateFnsDefault=Mf,Zt.nodeThemeFnDefault=Nf,Object.defineProperty(Zt,Symbol.toStringTag,{value:"Module"})});
1576
+ */var ef,di,fr,Sa,Gi,rf,Pa,vx=function(){return typeof window<"u"},Qe={},ki=180/Math.PI,cr=Math.PI/180,dr=Math.atan2,nf=1e8,Ca=/([A-Z])/g,_x=/(left|right|width|margin|padding|x)/i,gx=/[\s,\(]\S/,ke={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Ra=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},mx=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},yx=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},xx=function(e,t){var i=t.s+t.c*e;t.set(t.t,t.p,~~(i+(i<0?-.5:.5))+t.u,t)},sf=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},of=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},bx=function(e,t,i){return e.style[t]=i},Tx=function(e,t,i){return e.style.setProperty(t,i)},wx=function(e,t,i){return e._gsap[t]=i},Ex=function(e,t,i){return e._gsap.scaleX=e._gsap.scaleY=i},Sx=function(e,t,i,n,s){var o=e._gsap;o.scaleX=o.scaleY=i,o.renderTransform(s,o)},Px=function(e,t,i,n,s){var o=e._gsap;o[t]=i,o.renderTransform(s,o)},bt="transform",Pe=bt+"Origin",Cx=function r(e,t){var i=this,n=this.target,s=n.style;if(e in Qe){if(this.tfm=this.tfm||{},e!=="transform")e=ke[e]||e,~e.indexOf(",")?e.split(",").forEach(function(o){return i.tfm[o]=ti(n,o)}):this.tfm[e]=n._gsap.x?n._gsap[e]:ti(n,e);else return ke.transform.split(",").forEach(function(o){return r.call(i,o,t)});if(this.props.indexOf(bt)>=0)return;n._gsap.svg&&(this.svgo=n.getAttribute("data-svg-origin"),this.props.push(Pe,t,"")),e=bt}(s||t)&&this.props.push(e,t,s[e])},af=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},Rx=function(){var e=this.props,t=this.target,i=t.style,n=t._gsap,s,o;for(s=0;s<e.length;s+=3)e[s+1]?t[e[s]]=e[s+2]:e[s+2]?i[e[s]]=e[s+2]:i.removeProperty(e[s].substr(0,2)==="--"?e[s]:e[s].replace(Ca,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)n[o]=this.tfm[o];n.svg&&(n.renderTransform(),t.setAttribute("data-svg-origin",this.svgo||"")),s=Pa(),(!s||!s.isStart)&&!i[bt]&&(af(i),n.uncache=1)}},hf=function(e,t){var i={target:e,props:[],revert:Rx,save:Cx};return e._gsap||Qt.core.getCache(e),t&&t.split(",").forEach(function(n){return i.save(n)}),i},uf,Oa=function(e,t){var i=di.createElementNS?di.createElementNS((t||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),e):di.createElement(e);return i.style?i:di.createElement(e)},Xe=function r(e,t,i){var n=getComputedStyle(e);return n[t]||n.getPropertyValue(t.replace(Ca,"-$1").toLowerCase())||n.getPropertyValue(t)||!i&&r(e,pr(t)||t,1)||""},lf="O,Moz,ms,Ms,Webkit".split(","),pr=function(e,t,i){var n=t||Gi,s=n.style,o=5;if(e in s&&!i)return e;for(e=e.charAt(0).toUpperCase()+e.substr(1);o--&&!(lf[o]+e in s););return o<0?null:(o===3?"ms":o>=0?lf[o]:"")+e},Aa=function(){vx()&&window.document&&(ef=window,di=ef.document,fr=di.documentElement,Gi=Oa("div")||{style:{}},Oa("div"),bt=pr(bt),Pe=bt+"Origin",Gi.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",uf=!!pr("perspective"),Pa=Qt.core.reverting,Sa=1)},Ia=function r(e){var t=Oa("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,n=this.nextSibling,s=this.style.cssText,o;if(fr.appendChild(t),t.appendChild(this),this.style.display="block",e)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(n?i.insertBefore(this,n):i.appendChild(this)),fr.removeChild(t),this.style.cssText=s,o},ff=function(e,t){for(var i=t.length;i--;)if(e.hasAttribute(t[i]))return e.getAttribute(t[i])},cf=function(e){var t;try{t=e.getBBox()}catch{t=Ia.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===Ia||(t=Ia.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+ff(e,["x","cx","x1"])||0,y:+ff(e,["y","cy","y1"])||0,width:0,height:0}:t},df=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&cf(e))},$r=function(e,t){if(t){var i=e.style;t in Qe&&t!==Pe&&(t=bt),i.removeProperty?((t.substr(0,2)==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),i.removeProperty(t.replace(Ca,"-$1").toLowerCase())):i.removeAttribute(t)}},pi=function(e,t,i,n,s,o){var a=new Jt(e._pt,t,i,0,1,o?of:sf);return e._pt=a,a.b=n,a.e=s,e._props.push(i),a},pf={deg:1,rad:1,turn:1},Ox={grid:1,flex:1},vi=function r(e,t,i,n){var s=parseFloat(i)||0,o=(i+"").trim().substr((s+"").length)||"px",a=Gi.style,h=_x.test(t),u=e.tagName.toLowerCase()==="svg",l=(u?"client":"offset")+(h?"Width":"Height"),f=100,c=n==="px",d=n==="%",v,p,_,g;return n===o||!s||pf[n]||pf[o]?s:(o!=="px"&&!c&&(s=r(e,t,i,"px")),g=e.getCTM&&df(e),(d||o==="%")&&(Qe[t]||~t.indexOf("adius"))?(v=g?e.getBBox()[h?"width":"height"]:e[l],Ot(d?s/v*f:s/100*v)):(a[h?"width":"height"]=f+(c?o:n),p=~t.indexOf("adius")||n==="em"&&e.appendChild&&!u?e:e.parentNode,g&&(p=(e.ownerSVGElement||{}).parentNode),(!p||p===di||!p.appendChild)&&(p=di.body),_=p._gsap,_&&d&&_.width&&h&&_.time===oe.time&&!_.uncache?Ot(s/_.width*f):((d||o==="%")&&!Ox[Xe(p,"display")]&&(a.position=Xe(e,"position")),p===e&&(a.position="static"),p.appendChild(Gi),v=Gi[l],p.removeChild(Gi),a.position="absolute",h&&d&&(_=Di(p),_.time=oe.time,_.width=p[l]),Ot(c?v*s/f:v&&s?f/v*s:0))))},ti=function(e,t,i,n){var s;return Sa||Aa(),t in ke&&t!=="transform"&&(t=ke[t],~t.indexOf(",")&&(t=t.split(",")[0])),Qe[t]&&t!=="transform"?(s=Qr(e,n),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:fs(Xe(e,Pe))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||n||~(s+"").indexOf("calc("))&&(s=ls[t]&&ls[t](e,t,i)||Xe(e,t)||gl(e,t)||(t==="opacity"?1:0))),i&&!~(s+"").trim().indexOf(" ")?vi(e,t,s,i)+i:s},Ax=function(e,t,i,n){if(!i||i==="none"){var s=pr(t,e,1),o=s&&Xe(e,s,1);o&&o!==i?(t=s,i=o):t==="borderColor"&&(i=Xe(e,"borderTopColor"))}var a=new Jt(this._pt,e.style,t,0,1,$l),h=0,u=0,l,f,c,d,v,p,_,g,y,m,b,x;if(a.b=i,a.e=n,i+="",n+="",n==="auto"&&(e.style[t]=n,n=Xe(e,t)||n,e.style[t]=i),l=[i,n],Xl(l),i=l[0],n=l[1],c=i.match(rr)||[],x=n.match(rr)||[],x.length){for(;f=rr.exec(n);)_=f[0],y=n.substring(h,f.index),v?v=(v+1)%5:(y.substr(-5)==="rgba("||y.substr(-5)==="hsla(")&&(v=1),_!==(p=c[u++]||"")&&(d=parseFloat(p)||0,b=p.substr((d+"").length),_.charAt(1)==="="&&(_=nr(d,_)+b),g=parseFloat(_),m=_.substr((g+"").length),h=rr.lastIndex-m.length,m||(m=m||re.units[t]||b,h===n.length&&(n+=m,a.e+=m)),b!==m&&(d=vi(e,t,p,m)||0),a._pt={_next:a._pt,p:y||u===1?y:",",s:d,c:g-d,m:v&&v<4||t==="zIndex"?Math.round:0});a.c=h<n.length?n.substring(h,n.length):""}else a.r=t==="display"&&n==="none"?of:sf;return ll.test(n)&&(a.e=0),this._pt=a,a},vf={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},Ix=function(e){var t=e.split(" "),i=t[0],n=t[1]||"50%";return(i==="top"||i==="bottom"||n==="left"||n==="right")&&(e=i,i=n,n=e),t[0]=vf[i]||i,t[1]=vf[n]||n,t.join(" ")},Mx=function(e,t){if(t.tween&&t.tween._time===t.tween._dur){var i=t.t,n=i.style,s=t.u,o=i._gsap,a,h,u;if(s==="all"||s===!0)n.cssText="",h=1;else for(s=s.split(","),u=s.length;--u>-1;)a=s[u],Qe[a]&&(h=1,a=a==="transformOrigin"?Pe:bt),$r(i,a);h&&($r(i,bt),o&&(o.svg&&i.removeAttribute("transform"),Qr(i,1),o.uncache=1,af(n)))}},ls={clearProps:function(e,t,i,n,s){if(s.data!=="isFromStart"){var o=e._pt=new Jt(e._pt,t,i,0,0,Mx);return o.u=n,o.pr=-10,o.tween=s,e._props.push(i),1}}},Jr=[1,0,0,1,0,0],_f={},gf=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},mf=function(e){var t=Xe(e,bt);return gf(t)?Jr:t.substr(7).match(ul).map(Ot)},Ma=function(e,t){var i=e._gsap||Di(e),n=e.style,s=mf(e),o,a,h,u;return i.svg&&e.getAttribute("transform")?(h=e.transform.baseVal.consolidate().matrix,s=[h.a,h.b,h.c,h.d,h.e,h.f],s.join(",")==="1,0,0,1,0,0"?Jr:s):(s===Jr&&!e.offsetParent&&e!==fr&&!i.svg&&(h=n.display,n.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(u=1,a=e.nextElementSibling,fr.appendChild(e)),s=mf(e),h?n.display=h:$r(e,"display"),u&&(a?o.insertBefore(e,a):o?o.appendChild(e):fr.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},Na=function(e,t,i,n,s,o){var a=e._gsap,h=s||Ma(e,!0),u=a.xOrigin||0,l=a.yOrigin||0,f=a.xOffset||0,c=a.yOffset||0,d=h[0],v=h[1],p=h[2],_=h[3],g=h[4],y=h[5],m=t.split(" "),b=parseFloat(m[0])||0,x=parseFloat(m[1])||0,T,w,S,E;i?h!==Jr&&(w=d*_-v*p)&&(S=b*(_/w)+x*(-p/w)+(p*y-_*g)/w,E=b*(-v/w)+x*(d/w)-(d*y-v*g)/w,b=S,x=E):(T=cf(e),b=T.x+(~m[0].indexOf("%")?b/100*T.width:b),x=T.y+(~(m[1]||m[0]).indexOf("%")?x/100*T.height:x)),n||n!==!1&&a.smooth?(g=b-u,y=x-l,a.xOffset=f+(g*d+y*p)-g,a.yOffset=c+(g*v+y*_)-y):a.xOffset=a.yOffset=0,a.xOrigin=b,a.yOrigin=x,a.smooth=!!n,a.origin=t,a.originIsAbsolute=!!i,e.style[Pe]="0px 0px",o&&(pi(o,a,"xOrigin",u,b),pi(o,a,"yOrigin",l,x),pi(o,a,"xOffset",f,a.xOffset),pi(o,a,"yOffset",c,a.yOffset)),e.setAttribute("data-svg-origin",b+" "+x)},Qr=function(e,t){var i=e._gsap||new Yl(e);if("x"in i&&!t&&!i.uncache)return i;var n=e.style,s=i.scaleX<0,o="px",a="deg",h=getComputedStyle(e),u=Xe(e,Pe)||"0",l,f,c,d,v,p,_,g,y,m,b,x,T,w,S,E,P,O,I,F,k,A,M,L,q,z,N,R,U,J,V,it;return l=f=c=p=_=g=y=m=b=0,d=v=1,i.svg=!!(e.getCTM&&df(e)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(n[bt]=(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[bt]!=="none"?h[bt]:"")),n.scale=n.rotate=n.translate="none"),w=Ma(e,i.svg),i.svg&&(i.uncache?(q=e.getBBox(),u=i.xOrigin-q.x+"px "+(i.yOrigin-q.y)+"px",L=""):L=!t&&e.getAttribute("data-svg-origin"),Na(e,L||u,!!L||i.originIsAbsolute,i.smooth!==!1,w)),x=i.xOrigin||0,T=i.yOrigin||0,w!==Jr&&(O=w[0],I=w[1],F=w[2],k=w[3],l=A=w[4],f=M=w[5],w.length===6?(d=Math.sqrt(O*O+I*I),v=Math.sqrt(k*k+F*F),p=O||I?dr(I,O)*ki:0,y=F||k?dr(F,k)*ki+p:0,y&&(v*=Math.abs(Math.cos(y*cr))),i.svg&&(l-=x-(x*O+T*F),f-=T-(x*I+T*k))):(it=w[6],J=w[7],N=w[8],R=w[9],U=w[10],V=w[11],l=w[12],f=w[13],c=w[14],S=dr(it,U),_=S*ki,S&&(E=Math.cos(-S),P=Math.sin(-S),L=A*E+N*P,q=M*E+R*P,z=it*E+U*P,N=A*-P+N*E,R=M*-P+R*E,U=it*-P+U*E,V=J*-P+V*E,A=L,M=q,it=z),S=dr(-F,U),g=S*ki,S&&(E=Math.cos(-S),P=Math.sin(-S),L=O*E-N*P,q=I*E-R*P,z=F*E-U*P,V=k*P+V*E,O=L,I=q,F=z),S=dr(I,O),p=S*ki,S&&(E=Math.cos(S),P=Math.sin(S),L=O*E+I*P,q=A*E+M*P,I=I*E-O*P,M=M*E-A*P,O=L,A=q),_&&Math.abs(_)+Math.abs(p)>359.9&&(_=p=0,g=180-g),d=Ot(Math.sqrt(O*O+I*I+F*F)),v=Ot(Math.sqrt(M*M+it*it)),S=dr(A,M),y=Math.abs(S)>2e-4?S*ki:0,b=V?1/(V<0?-V:V):0),i.svg&&(L=e.getAttribute("transform"),i.forceCSS=e.setAttribute("transform","")||!gf(Xe(e,bt)),L&&e.setAttribute("transform",L))),Math.abs(y)>90&&Math.abs(y)<270&&(s?(d*=-1,y+=p<=0?180:-180,p+=p<=0?180:-180):(v*=-1,y+=y<=0?180:-180)),t=t||i.uncache,i.x=l-((i.xPercent=l&&(!t&&i.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-l)?-50:0)))?e.offsetWidth*i.xPercent/100:0)+o,i.y=f-((i.yPercent=f&&(!t&&i.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-f)?-50:0)))?e.offsetHeight*i.yPercent/100:0)+o,i.z=c+o,i.scaleX=Ot(d),i.scaleY=Ot(v),i.rotation=Ot(p)+a,i.rotationX=Ot(_)+a,i.rotationY=Ot(g)+a,i.skewX=y+a,i.skewY=m+a,i.transformPerspective=b+o,(i.zOrigin=parseFloat(u.split(" ")[2])||0)&&(n[Pe]=fs(u)),i.xOffset=i.yOffset=0,i.force3D=re.force3D,i.renderTransform=i.svg?Dx:uf?yf:Nx,i.uncache=0,i},fs=function(e){return(e=e.split(" "))[0]+" "+e[1]},Da=function(e,t,i){var n=Yt(t);return Ot(parseFloat(t)+parseFloat(vi(e,"x",i+"px",n)))+n},Nx=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,yf(e,t)},Xi="0deg",tn="0px",Hi=") ",yf=function(e,t){var i=t||this,n=i.xPercent,s=i.yPercent,o=i.x,a=i.y,h=i.z,u=i.rotation,l=i.rotationY,f=i.rotationX,c=i.skewX,d=i.skewY,v=i.scaleX,p=i.scaleY,_=i.transformPerspective,g=i.force3D,y=i.target,m=i.zOrigin,b="",x=g==="auto"&&e&&e!==1||g===!0;if(m&&(f!==Xi||l!==Xi)){var T=parseFloat(l)*cr,w=Math.sin(T),S=Math.cos(T),E;T=parseFloat(f)*cr,E=Math.cos(T),o=Da(y,o,w*E*-m),a=Da(y,a,-Math.sin(T)*-m),h=Da(y,h,S*E*-m+m)}_!==tn&&(b+="perspective("+_+Hi),(n||s)&&(b+="translate("+n+"%, "+s+"%) "),(x||o!==tn||a!==tn||h!==tn)&&(b+=h!==tn||x?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+Hi),u!==Xi&&(b+="rotate("+u+Hi),l!==Xi&&(b+="rotateY("+l+Hi),f!==Xi&&(b+="rotateX("+f+Hi),(c!==Xi||d!==Xi)&&(b+="skew("+c+", "+d+Hi),(v!==1||p!==1)&&(b+="scale("+v+", "+p+Hi),y.style[bt]=b||"translate(0, 0)"},Dx=function(e,t){var i=t||this,n=i.xPercent,s=i.yPercent,o=i.x,a=i.y,h=i.rotation,u=i.skewX,l=i.skewY,f=i.scaleX,c=i.scaleY,d=i.target,v=i.xOrigin,p=i.yOrigin,_=i.xOffset,g=i.yOffset,y=i.forceCSS,m=parseFloat(o),b=parseFloat(a),x,T,w,S,E;h=parseFloat(h),u=parseFloat(u),l=parseFloat(l),l&&(l=parseFloat(l),u+=l,h+=l),h||u?(h*=cr,u*=cr,x=Math.cos(h)*f,T=Math.sin(h)*f,w=Math.sin(h-u)*-c,S=Math.cos(h-u)*c,u&&(l*=cr,E=Math.tan(u-l),E=Math.sqrt(1+E*E),w*=E,S*=E,l&&(E=Math.tan(l),E=Math.sqrt(1+E*E),x*=E,T*=E)),x=Ot(x),T=Ot(T),w=Ot(w),S=Ot(S)):(x=f,S=c,T=w=0),(m&&!~(o+"").indexOf("px")||b&&!~(a+"").indexOf("px"))&&(m=vi(d,"x",o,"px"),b=vi(d,"y",a,"px")),(v||p||_||g)&&(m=Ot(m+v-(v*x+p*w)+_),b=Ot(b+p-(v*T+p*S)+g)),(n||s)&&(E=d.getBBox(),m=Ot(m+n/100*E.width),b=Ot(b+s/100*E.height)),E="matrix("+x+","+T+","+w+","+S+","+m+","+b+")",d.setAttribute("transform",E),y&&(d.style[bt]=E)},Fx=function(e,t,i,n,s){var o=360,a=kt(s),h=parseFloat(s)*(a&&~s.indexOf("rad")?ki:1),u=h-n,l=n+u+"deg",f,c;return a&&(f=s.split("_")[1],f==="short"&&(u%=o,u!==u%(o/2)&&(u+=u<0?o:-o)),f==="cw"&&u<0?u=(u+o*nf)%o-~~(u/o)*o:f==="ccw"&&u>0&&(u=(u-o*nf)%o-~~(u/o)*o)),e._pt=c=new Jt(e._pt,t,i,n,u,mx),c.e=l,c.u="deg",e._props.push(i),c},xf=function(e,t){for(var i in t)e[i]=t[i];return e},Lx=function(e,t,i){var n=xf({},i._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,u,l,f,c,d,v;n.svg?(u=i.getAttribute("transform"),i.setAttribute("transform",""),o[bt]=t,a=Qr(i,1),$r(i,bt),i.setAttribute("transform",u)):(u=getComputedStyle(i)[bt],o[bt]=t,a=Qr(i,1),o[bt]=u);for(h in Qe)u=n[h],l=a[h],u!==l&&s.indexOf(h)<0&&(d=Yt(u),v=Yt(l),f=d!==v?vi(i,h,u,v):parseFloat(u),c=parseFloat(l),e._pt=new Jt(e._pt,a,h,f,c-f,Ra),e._pt.u=v||0,e._props.push(h));xf(a,n)};Kt("padding,margin,Width,Radius",function(r,e){var t="Top",i="Right",n="Bottom",s="Left",o=(e<3?[t,i,n,s]:[t+s,t+i,n+i,n+s]).map(function(a){return e<2?r+a:"border"+a+r});ls[e>1?"border"+r:r]=function(a,h,u,l,f){var c,d;if(arguments.length<4)return c=o.map(function(v){return ti(a,v,u)}),d=c.join(" "),d.split(c[0]).length===5?c[0]:d;c=(l+"").split(" "),d={},o.forEach(function(v,p){return d[v]=c[p]=c[p]||c[(p-1)/2|0]}),a.init(h,d,f)}});var bf={name:"css",register:Aa,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,i,n,s){var o=this._props,a=e.style,h=i.vars.startAt,u,l,f,c,d,v,p,_,g,y,m,b,x,T,w,S;Sa||Aa(),this.styles=this.styles||hf(e),S=this.styles.props,this.tween=i;for(p in t)if(p!=="autoRound"&&(l=t[p],!(se[p]&&Vl(p,t,i,n,e,s)))){if(d=typeof l,v=ls[p],d==="function"&&(l=l.call(i,n,e,s),d=typeof l),d==="string"&&~l.indexOf("random(")&&(l=Vr(l)),v)v(this,e,p,l,i)&&(w=1);else if(p.substr(0,2)==="--")u=(getComputedStyle(e).getPropertyValue(p)+"").trim(),l+="",fi.lastIndex=0,fi.test(u)||(_=Yt(u),g=Yt(l)),g?_!==g&&(u=vi(e,p,u,g)+g):_&&(l+=_),this.add(a,"setProperty",u,l,n,s,0,0,p),o.push(p),S.push(p,0,a[p]);else if(d!=="undefined"){if(h&&p in h?(u=typeof h[p]=="function"?h[p].call(i,n,e,s):h[p],kt(u)&&~u.indexOf("random(")&&(u=Vr(u)),Yt(u+"")||(u+=re.units[p]||Yt(ti(e,p))||""),(u+"").charAt(1)==="="&&(u=ti(e,p))):u=ti(e,p),c=parseFloat(u),y=d==="string"&&l.charAt(1)==="="&&l.substr(0,2),y&&(l=l.substr(2)),f=parseFloat(l),p in ke&&(p==="autoAlpha"&&(c===1&&ti(e,"visibility")==="hidden"&&f&&(c=0),S.push("visibility",0,a.visibility),pi(this,a,"visibility",c?"inherit":"hidden",f?"inherit":"hidden",!f)),p!=="scale"&&p!=="transform"&&(p=ke[p],~p.indexOf(",")&&(p=p.split(",")[0]))),m=p in Qe,m){if(this.styles.save(p),b||(x=e._gsap,x.renderTransform&&!t.parseTransform||Qr(e,t.parseTransform),T=t.smoothOrigin!==!1&&x.smooth,b=this._pt=new Jt(this._pt,a,bt,0,1,x.renderTransform,x,0,-1),b.dep=1),p==="scale")this._pt=new Jt(this._pt,x,"scaleY",x.scaleY,(y?nr(x.scaleY,y+f):f)-x.scaleY||0,Ra),this._pt.u=0,o.push("scaleY",p),p+="X";else if(p==="transformOrigin"){S.push(Pe,0,a[Pe]),l=Ix(l),x.svg?Na(e,l,0,T,0,this):(g=parseFloat(l.split(" ")[2])||0,g!==x.zOrigin&&pi(this,x,"zOrigin",x.zOrigin,g),pi(this,a,p,fs(u),fs(l)));continue}else if(p==="svgOrigin"){Na(e,l,1,T,0,this);continue}else if(p in _f){Fx(this,x,p,c,y?nr(c,y+l):l);continue}else if(p==="smoothOrigin"){pi(this,x,"smooth",x.smooth,l);continue}else if(p==="force3D"){x[p]=l;continue}else if(p==="transform"){Lx(this,l,e);continue}}else p in a||(p=pr(p)||p);if(m||(f||f===0)&&(c||c===0)&&!gx.test(l)&&p in a)_=(u+"").substr((c+"").length),f||(f=0),g=Yt(l)||(p in re.units?re.units[p]:_),_!==g&&(c=vi(e,p,u,g)),this._pt=new Jt(this._pt,m?x:a,p,c,(y?nr(c,y+f):f)-c,!m&&(g==="px"||p==="zIndex")&&t.autoRound!==!1?xx:Ra),this._pt.u=g||0,_!==g&&g!=="%"&&(this._pt.b=u,this._pt.r=yx);else if(p in a)Ax.call(this,e,p,u,y?y+l:l);else if(p in e)this.add(e,p,u||e[p],y?y+l:l,n,s);else if(p!=="parseTransform"){ia(p,l);continue}m||(p in a?S.push(p,0,a[p]):S.push(p,1,u||e[p])),o.push(p)}}w&&Jl(this)},render:function(e,t){if(t.tween._time||!Pa())for(var i=t._pt;i;)i.r(e,i.d),i=i._next;else t.styles.revert()},get:ti,aliases:ke,getSetter:function(e,t,i){var n=ke[t];return n&&n.indexOf(",")<0&&(t=n),t in Qe&&t!==Pe&&(e._gsap.x||ti(e,"x"))?i&&rf===i?t==="scale"?Ex:wx:(rf=i||{})&&(t==="scale"?Sx:Px):e.style&&!Ko(e.style[t])?bx:~t.indexOf("-")?Tx:xa(e,t)},core:{_removeProperty:$r,_getMatrix:Ma}};Qt.utils.checkPrefix=pr,Qt.core.getStyleSaver=hf,function(r,e,t,i){var n=Kt(r+","+e+","+t,function(s){Qe[s]=1});Kt(e,function(s){re.units[s]="deg",_f[s]=1}),ke[n[13]]=r+","+e,Kt(i,function(s){var o=s.split(":");ke[o[1]]=n[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"),Kt("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){re.units[r]="px"}),Qt.registerPlugin(bf);var Vt=Qt.registerPlugin(bf)||Qt;Vt.core.Tween;const cs=16,en=8,Fa=4,Tf=.7,Bx=.25;class Ux extends ot{constructor({graphState:t}){super();C(this,"graphState");C(this,"dimensionsObject",new ut);C(this,"dots",[]);C(this,"unWatchers",[]);this.graphState=t,this.initDimensions(),this.initDots(),this.initWatchers()}initWatchers(){const{styleOptions:t}=this.graphState,i=X.watch(t,()=>{this.destroyDots(),this.initDots()});this.unWatchers.push(i)}initDimensions(){const t=en*3+Fa*2,i=cs*2+en;this.dimensionsObject.width=t,this.dimensionsObject.height=i,this.addChild(this.dimensionsObject)}initDots(){const{colorTextDefault:t}=this.graphState.styleOptions.value,i=new Se;i.beginFill(t),i.drawCircle(0,0,en/2),i.endFill(),i.alpha=0,i.position.y=cs;const n=i.clone();n.alpha=0,n.position.set(en+Fa,cs);const s=i.clone();s.alpha=0,s.position.set((en+Fa)*2,cs),this.dots.push(i,n,s),this.addChild(i,n,s),this.initAnimation()}initAnimation(){const t=(i,n=0)=>{Vt.to(i,{alpha:1,duration:Tf,delay:n,onComplete:()=>{Vt.to(i,{alpha:0,duration:Tf,onComplete:()=>t(i)})}})};this.dots.forEach((i,n)=>{t(i,n*Bx)})}destroyDots(){this.dots.forEach(t=>{Vt.killTweensOf(t),t.destroy()}),this.dots=[]}destroy(){this.unWatchers.forEach(t=>t()),this.removeChildren(),this.dimensionsObject.destroy(),this.destroyDots(),super.destroy.call(this)}}const La=10;let Ce,Re,Oe,Ae;const ds=0,Ba={multisample:2,resolution:4};function ps(){Ce=new Map,Re=new Map,Oe=new Map,Ae=new Map}function Gx(){Ce&&(Ce.forEach(r=>{r.destroy()}),Ce.clear(),Ce=void 0),Re&&(Re.forEach(({cap:r,body:e})=>{r.destroy(),e.destroy()}),Re.clear(),Re=void 0),Oe&&(Oe.forEach(r=>{r.destroy()}),Oe.clear(),Oe=void 0),Ae&&(Ae.forEach(({corner:r,edge:e})=>{r.destroy(),e.destroy()}),Ae.clear(),Ae=void 0)}function rn({pixiApp:r,fill:e}){const t=e||ds;if(Ce||ps(),!(Ce!=null&&Ce.has(t))){const i=new Se;i.beginFill(t),i.drawRect(0,0,La,La),i.endFill(),t===ds&&(i.alpha=0);const n=r.renderer.generateTexture(i);Ce.set(t,n)}return Ce.get(t)}function Ua({pixiApp:r,fill:e,borderRadius:t,boxCapWidth:i,height:n}){const s=e||ds;if(Re||ps(),!(Re!=null&&Re.has(s))){const o=new Se;o.beginFill(s),o.moveTo(i,0),o.lineTo(i,n),o.lineTo(0+t,n),o.bezierCurveTo(0,n,0,n-t,0,n-t),o.lineTo(0,t),o.bezierCurveTo(0,0,t,0,t,0),o.lineTo(i,0),o.endFill(),s===ds&&(o.alpha=0);const a=rn({pixiApp:r,fill:s}),h=r.renderer.generateTexture(o,Ba),u=a;Re.set(s,{cap:h,body:u})}return Re.get(s)}function wf({pixiApp:r,strokeColor:e,edgeWidth:t,edgeLength:i}){if(Oe||ps(),!(Oe!=null&&Oe.has(e))){const n=new Se;n.lineStyle(t,e,1,.5),n.moveTo(-i,-i),n.lineTo(0,0),n.lineTo(-i,i);const s=r.renderer.generateTexture(n,Ba);Oe.set(e,s)}return Oe.get(e)}function kx({pixiApp:r,borderRadius:e,borderColor:t,borderWidth:i}){Ae||ps();const n={borderRadius:e,borderColor:t,borderWidth:i};if(!(Ae!=null&&Ae.has(n))){const s=new Se;s.lineStyle(i,t),s.moveTo(0,e),s.bezierCurveTo(0,e,0,0,e,0);const o=rn({pixiApp:r,fill:t}),a=r.renderer.generateTexture(s,Ba);Ae.set(n,{corner:a,edge:o})}return Ae.get(n)}const Ef=.2,Sf="power2.out";class Ga extends ot{constructor({graphState:t,width:i,height:n,borderRadius:s,borderColor:o,borderWidth:a}){super();C(this,"graphState");C(this,"rectWidth");C(this,"rectHeight");C(this,"borderRadius");C(this,"borderColor");C(this,"borderWidth");C(this,"topLeft");C(this,"topRight");C(this,"bottomRight");C(this,"bottomLeft");C(this,"topEdge");C(this,"rightEdge");C(this,"bottomEdge");C(this,"leftEdge");this.graphState=t,this.rectWidth=i,this.rectHeight=n,this.borderRadius=s,this.borderColor=o,this.borderWidth=a,this.initRect()}initRect(){const{borderRadius:t,borderColor:i,borderWidth:n}=this,{pixiApp:s}=this.graphState,{corner:o,edge:a}=kx({pixiApp:s,borderRadius:t,borderColor:i,borderWidth:n});this.topLeft=new ut(o),this.topRight=new ut(o),this.topRight.position.set(this.rectWidth,0),this.topRight.rotation=Math.PI/2,this.bottomRight=new ut(o),this.bottomRight.position.set(this.rectWidth,this.rectHeight),this.bottomRight.rotation=Math.PI,this.bottomLeft=new ut(o),this.bottomLeft.position.set(0,this.rectHeight),this.bottomLeft.rotation=Math.PI*1.5,this.topEdge=new ut(a),this.topEdge.position.set(this.borderRadius,0),this.topEdge.width=this.rectWidth-this.borderRadius*2,this.topEdge.height=n,this.rightEdge=new ut(a),this.rightEdge.position.set(this.rectWidth-this.borderWidth,this.borderRadius),this.rightEdge.height=this.rectHeight-this.borderRadius*2,this.rightEdge.width=n,this.bottomEdge=new ut(a),this.bottomEdge.position.set(this.borderRadius,this.rectHeight-this.borderWidth),this.bottomEdge.width=this.rectWidth-this.borderRadius*2,this.bottomEdge.height=n,this.leftEdge=new ut(a),this.leftEdge.position.set(0,this.borderRadius),this.leftEdge.height=this.rectHeight-this.borderRadius*2,this.leftEdge.width=n,this.addChild(this.topLeft),this.addChild(this.topRight),this.addChild(this.bottomRight),this.addChild(this.bottomLeft),this.addChild(this.topEdge),this.addChild(this.rightEdge),this.addChild(this.bottomEdge),this.addChild(this.leftEdge),this.resize({width:this.rectWidth,height:this.rectHeight})}resize({width:t,height:i,animate:n}){const{topRight:s,bottomRight:o,bottomLeft:a,topEdge:h,rightEdge:u,bottomEdge:l,leftEdge:f}=this;this.scale.x=1,this.rectWidth=t,this.rectHeight=i;const c=this.borderRadius*2,v=t<c?c:t;if(t<c&&(this.scale.x=t/c),!n||this.graphState.suppressMotion.value){s.position.x=v,o.position.set(v,this.rectHeight),a.position.y=this.rectHeight,h.width=v-c,u.height=this.rectHeight-c,u.position.x=v-this.borderWidth,l.width=v-c,l.position.y=this.rectHeight-this.borderWidth,f.height=this.rectHeight-c;return}const p={duration:Ef,ease:Sf};Vt.to(s,{x:v,...p}),Vt.to(o,{x:v,y:this.rectHeight,...p}),Vt.to(a,{y:this.rectHeight,...p}),Vt.to(h,{width:v-c,...p}),Vt.to(u,{height:this.rectHeight-c,x:v-this.borderWidth,...p}),Vt.to(l,{width:v-c,y:this.rectHeight-this.borderWidth,...p}),Vt.to(f,{height:this.rectHeight-c,...p})}killTweens(){const{topRight:t,bottomRight:i,bottomLeft:n,topEdge:s,rightEdge:o,bottomEdge:a,leftEdge:h}=this;Vt.killTweensOf([t,i,n,s,o,a,h])}destroy(){this.killTweens(),super.destroy.call(this)}}const Pf=64,vs=20;class Xx extends ot{constructor({sourceNode:t,targetNode:i,state:n}){super();C(this,"sourceNode");C(this,"targetNode");C(this,"graphState");C(this,"sourceX",0);C(this,"sourceY",0);C(this,"targetX",0);C(this,"targetY",0);C(this,"sourceControlPointX",0);C(this,"sourceControlPointY",0);C(this,"targetControlPointX",0);C(this,"targetControlPointY",0);C(this,"edgePoints");C(this,"edge");C(this,"arrow",new ot);C(this,"unWatchers",[]);C(this,"getXBezier",(t,i)=>{const{sourceX:n,targetX:s}=this,o=(s-n)/2;return t+(o>Pf?o:Pf)*(i?-1:1)});C(this,"getPointBezierPosition",t=>{const{sourceX:i,sourceY:n,targetX:s,targetY:o,sourceControlPointX:a,sourceControlPointY:h,targetControlPointX:u,targetControlPointY:l}=this,f=i+(a-i)*t,c=n+(h-n)*t,d=a+(u-a)*t,v=h+(l-h)*t,p=u+(s-u)*t,_=l+(o-l)*t,g=f+(d-f)*t,y=c+(v-c)*t,m=d+(p-d)*t,b=v+(_-v)*t,x=g+(m-g)*t,T=y+(b-y)*t;return{x,y:T}});this.sourceNode=t,this.targetNode=i,this.graphState=n,this.assignBezierPositions(),this.edgePoints=this.initEdgePoints(),this.edge=this.initEdge(),this.addChild(this.edge),this.drawArrow(),this.addChild(this.arrow),this.initCulling(),this.initWatchers()}initCulling(){const{cull:t}=this.graphState;t.add(this.arrow)}initWatchers(){const{styleOptions:t,viewport:i}=this.graphState;this.unWatchers.push(X.watch([t],()=>{this.updateStyle()},{deep:!0})),i.on("frame-end",()=>{this.sourceNode.destroyed||this.targetNode.destroyed||this.hasEdgeChanged()&&this.update()})}assignBezierPositions(){this.sourceX=this.getSourceX(),this.sourceY=this.getNodeY(this.sourceNode),this.targetX=this.targetNode.x,this.targetY=this.getNodeY(this.targetNode),this.sourceControlPointX=this.getXBezier(this.sourceX),this.sourceControlPointY=this.sourceY,this.targetControlPointX=this.getXBezier(this.targetX,!0),this.targetControlPointY=this.targetY}initEdge(){const{spacingEdgeWidth:t}=this.graphState.styleOptions.value,i=this.getEdgeTexture();return new Jy(i,this.edgePoints,t/La)}initEdgePoints(){const t=[];for(let s=0;s<vs;s++){const o=s===vs-1?{x:this.targetX,y:this.targetY}:this.getPointBezierPosition(s/vs);t.push(new j(o.x,o.y))}const i=this.getTargetAnchorPointPosition(),n=new j(i.x,i.y);return t.push(n),t}drawArrow(){const{arrow:t,targetX:i,targetY:n}=this,{pixiApp:s,styleOptions:o}=this.graphState,{colorEdge:a,spacingEdgeWidth:h,spacingNodeEdgeLength:u}=o.value,l=wf({pixiApp:s,strokeColor:a,edgeWidth:h,edgeLength:u}),f=new ut(l);f.anchor.set(1,.5),t.addChild(f),t.position.set(i,n)}update(){this.assignBezierPositions(),this.arrow.position.set(this.targetX,this.targetY),this.edgePoints.forEach((t,i)=>{const n=i===this.edgePoints.length-1?this.getTargetAnchorPointPosition():this.getPointBezierPosition(i/vs);t.set(n.x,n.y)})}updateStyle(){this.arrow.removeChildren(),this.drawArrow(),this.edge.texture=this.getEdgeTexture()}hasEdgeChanged(){const t=this.getSourceX(),i=this.getNodeY(this.sourceNode),n=this.targetNode.x,s=this.getNodeY(this.targetNode);return t!==this.sourceX||i!==this.sourceY||n!==this.targetX||s!==this.targetY}getSourceX(){return this.sourceNode.x+this.sourceNode.getChildByName(Xa).getLocalBounds().width}getNodeY(t){return t.y+t.getChildByName(Xa).getLocalBounds().height/2}getEdgeTexture(){const{pixiApp:t,styleOptions:i}=this.graphState,{colorEdge:n}=i.value;return rn({pixiApp:t,fill:n})}getTargetAnchorPointPosition(){return{x:this.targetX-2,y:this.targetY}}destroy(){const{cull:t}=this.graphState;t.remove(this.arrow),this.unWatchers.forEach(i=>i()),super.destroy.call(this)}}const ae={nodeDetails:"nodeDetailsClick",subNodesToggle:"subNodesToggleClick"},ka="nodeResize",Cf={fadeIn:.25,move:.5},Xa="box",Hx="None",Wx=.2;class zx extends ot{constructor({nodeData:t,state:i,layout:n,layoutRows:s}){super();C(this,"nodeData");C(this,"state");C(this,"layout");C(this,"layoutRows");C(this,"currentState");C(this,"hasSubNodes",!1);C(this,"isRunningNode",!1);C(this,"runningNodeTicker",null);C(this,"unWatchers",[]);C(this,"positionInitialized",!1);C(this,"nodeWidth");C(this,"nodeHeight");C(this,"boxCapWidth",0);C(this,"box",new ot);C(this,"leftBoxCap");C(this,"rightBoxCap");C(this,"boxBody");C(this,"subNodesToggle");C(this,"subNodesToggleWidth",0);C(this,"isSubNodesToggleFloating",!1);C(this,"isLoadingSubNodes",!1);C(this,"subNodesLoadingIndicator",null);C(this,"noSubNodesMessage",null);C(this,"label");C(this,"apxLabelWidth",0);C(this,"isLabelInBox",!0);C(this,"isSubNodesExpanded",!1);C(this,"subNodesOutlineContainer",new ot);C(this,"subNodesOutline");C(this,"subNodesContent",null);C(this,"subNodesHeight",0);C(this,"subNodesContentTicker",null);C(this,"isSelected",!1);C(this,"selectedRing");C(this,"initializePosition",()=>{this.positionInitialized=!0,this.updatePosition({skipAnimation:!0,includeXPos:!0})});C(this,"getSubNodesData",()=>{if(!this.nodeData.subflowRunId)return new Map;const{expandedSubNodes:t}=this.state,i=t.value.get(this.nodeData.subflowRunId).data;return"value"in i?i.value:i});this.interactive=!1,this.nodeData=t,this.state=i,this.layout=n,this.layoutRows=s,this.currentState=t.state.toString(),this.hasSubNodes=t.subflowRunId!==null,this.updateIsRunningNode(),this.boxCapWidth=i.styleOptions.value.borderRadiusNode,this.nodeWidth=this.getNodeWidth(),this.nodeHeight=this.getNodeHeight(),this.addChild(this.subNodesOutlineContainer),this.drawSubNodesOutline(),this.initBox(),this.initSubNodesToggle(),this.drawLabel(),this.initSelectedRing(),this.initWatchers()}initWatchers(){const{layoutRows:t,unWatchers:i,hasSubNodes:n,isRunningNode:s}=this,{pixiApp:o,styleOptions:a,styleNode:h,selectedNodeId:u,subNodeLabels:l,expandedSubNodes:f,viewport:c}=this.state;i.push(X.watch(t,()=>{this.updatePosition()}),X.watch([a,h],()=>{this.drawBox(),this.drawLabel(),this.noSubNodesMessage&&this.drawNoSubNodesMessage()},{deep:!0}),X.watch(u,d=>{const v=this.nodeData.subflowRunId??this.nodeData.id;if(d&&d===v){this.select();return}this.isSelected&&this.deselect()})),n&&i.push(X.watch(f,()=>{var d,v;if(this.nodeData.subflowRunId){if(!this.isSubNodesExpanded&&f.value.has(this.nodeData.subflowRunId)){if(this.isSubNodesExpanded=!0,(d=this.subNodesToggle)==null||d.setExpanded(),this.getSubNodesData().size===0&&!this.isLoadingSubNodes){this.isLoadingSubNodes=!0,this.drawLoadingSubNodes();return}this.expandSubNodes();return}if(this.isSubNodesExpanded){if(!f.value.has(this.nodeData.subflowRunId)){(v=this.subNodesToggle)==null||v.setCollapsed(),this.isSubNodesExpanded=!1,this.isLoadingSubNodes=!1,this.collapseSubNodes();return}const p=this.getSubNodesData();if(this.isLoadingSubNodes&&(this.isLoadingSubNodes=!1,this.destroySubNodesLoadingIndicator(),p.size===0)){this.drawNoSubNodesMessage();return}if(!this.subNodesContent){this.expandSubNodes();return}this.subNodesContent.update(p)}}},{deep:!0}),X.watch(l,()=>{var d;this.getLabelText()!==((d=this.label)==null?void 0:d.text)&&this.drawLabel(!0)},{deep:!0})),s&&(this.runningNodeTicker=()=>{this.update()},o.ticker.add(this.runningNodeTicker)),c.on("frame-end",()=>{if(c.scale.x<Wx){this.label&&(this.label.visible=!1),this.subNodesOutline&&!this.isSubNodesExpanded&&(this.subNodesOutline.visible=!1);return}this.label&&(this.label.visible=!0),this.subNodesOutline&&(this.subNodesOutline.visible=!0)})}drawSubNodesOutline(){var d;if(!this.hasSubNodes)return;(d=this.subNodesOutline)==null||d.destroy();const{nodeHeight:t,state:i}=this,{styleOptions:n,styleNode:s}=i,{borderRadiusNode:o,alphaSubNodesOutlineDimmed:a,spacingSubNodesOutlineBorderWidth:h,spacingSubNodesOutlineOffset:u}=n.value,{fill:l}=s.value(this.nodeData),f=ie(l),c=this.getOutlineWidth();this.subNodesOutline=new Ga({graphState:i,width:c,height:t,borderRadius:o,borderWidth:h,borderColor:f}),this.subNodesOutline.position.set(u,u),this.subNodesOutline.alpha=a,this.subNodesOutlineContainer.addChild(this.subNodesOutline)}initBox(){const{box:t}=this;t.name=Xa,this.drawBox(),this.addChild(t),t.interactive=!0,t.buttonMode=!0,t.on("click",()=>{this.emitSelection()}),this.state.cull.add(t)}drawBox(){var p,_,g;const{pixiApp:t,styleOptions:i,styleNode:n}=this.state,{isRunningNode:s,nodeWidth:o,nodeHeight:a,box:h,boxCapWidth:u}=this,{borderRadiusNode:l}=i.value,{fill:f}=n.value(this.nodeData),c=ie(f);(p=this.leftBoxCap)==null||p.destroy(),(_=this.boxBody)==null||_.destroy(),(g=this.rightBoxCap)==null||g.destroy(),this.box.removeChildren();const{cap:d,body:v}=Ua({pixiApp:t,fill:c,borderRadius:l,boxCapWidth:u,height:a});this.leftBoxCap=new ut(d),this.boxBody=new ut(v),this.boxBody.width=this.getBoxBodyWidth(),this.boxBody.height=a,this.boxBody.position.set(u,0),h.addChild(this.leftBoxCap),h.addChild(this.boxBody),s||(this.rightBoxCap=new ut(d),this.rightBoxCap.scale.x=-1,this.rightBoxCap.position.x=o,h.addChild(this.rightBoxCap))}initSubNodesToggle(){if(!this.hasSubNodes)return;const{state:t,nodeWidth:i,nodeHeight:n,nodeData:s}=this,{spacingNodeLabelMargin:o,borderRadiusNode:a}=this.state.styleOptions.value;this.subNodesToggleWidth=n,this.isSubNodesToggleFloating=this.subNodesToggleWidth+a>i,this.subNodesToggle=new Jx({graphState:t,nodeData:s,floating:this.isSubNodesToggleFloating,size:this.subNodesToggleWidth}),this.subNodesToggle.position.x=this.isSubNodesToggleFloating?i+o:0,this.subNodesToggle.on("click",()=>{this.emitSubNodesToggle()}),this.addChild(this.subNodesToggle)}async drawLabel(t){const{apxLabelWidth:i,nodeData:n}=this,{styleOptions:s,styleNode:o,cull:a}=this.state,h=await Xr(s.value),{spacingNodeXPadding:u}=s.value,{inverseTextOnFill:l}=o.value(n),f=l?h.nodeTextInverse:h.nodeTextDefault,c=this.getLabelText();if(i===0||t){const p=ue.measureText(c,h.nodeTextStyles).width*1.07;this.apxLabelWidth=p+u*2}this.isLabelInBox=this.checkIsLabelInBox();const d=this.isLabelInBox?f:h.nodeTextDefault;this.label&&(a.remove(this.label),this.label.destroy()),this.label=new Zn(c,d),this.updateLabelPosition(),this.isLabelInBox||(this.label.interactive=!0,this.label.buttonMode=!0,this.label.on("click",()=>{this.emitSelection()})),a.add(this.label),this.addChild(this.label)}initSelectedRing(){const{width:t,height:i,margin:n}=this.getSelectedRingSize(),{colorNodeSelection:s,spacingNodeSelectionWidth:o,borderRadiusNode:a}=this.state.styleOptions.value;this.selectedRing=new Ga({graphState:this.state,width:t,height:i,borderRadius:a,borderColor:s,borderWidth:o}),this.selectedRing.position.set(-n,-n),this.selectedRing.alpha=0,this.addChild(this.selectedRing)}select(){this.isSelected=!0,this.selectedRing.alpha=1,this.centerViewportToNodeAfterDelay()}deselect(){this.isSelected=!1,this.selectedRing.alpha=0,this.state.selectedNodeId.value||this.centerViewportToNodeAfterDelay()}centerViewportToNodeAfterDelay(){const{viewport:t,suppressMotion:i}=this.state;setTimeout(()=>{const n=(this.worldTransform.tx-t.x)/t.scale.x+this.box.width/2,s=(this.worldTransform.ty-t.y)/t.scale.y+this.box.height/2;t.animate({position:{x:n,y:s},time:i.value?0:1e3,ease:"easeInOutQuad",removeOnInterrupt:!0})},100)}expandSubNodes(){var n;if(!this.nodeData.subflowRunId)return;const t=this.state.expandedSubNodes.value.get(this.nodeData.subflowRunId);if(!this.hasSubNodes||!t)return;const i=X.unref(t.data);(n=this.subNodesContent)==null||n.destroy(),this.subNodesContent=new Af({isSubNodes:!0,data:i,state:this.state}),this.subNodesContent.on(ae.nodeDetails,s=>{this.emit(ae.nodeDetails,s)}),this.subNodesContent.on(ae.subNodesToggle,s=>{this.emitSubNodesToggle(s)}),this.updateSubNodesContentPosition(),this.subNodesContent.on(Ha,()=>this.updateSubNodesContentPosition()),this.addChild(this.subNodesContent),this.initSubNodesTicker()}drawLoadingSubNodes(){const{state:t,box:i}=this,{spacingNodeMargin:n}=t.styleOptions.value;this.destroySubNodesLoadingIndicator(),this.subNodesLoadingIndicator=new Ux({graphState:t}),this.subNodesLoadingIndicator.position.set(i.width/2-this.subNodesLoadingIndicator.width/2,i.y+i.height+n),this.addChild(this.subNodesLoadingIndicator),this.initSubNodesTicker()}async drawNoSubNodesMessage(){const{box:t}=this,{styleOptions:i}=this.state,n=await Xr(i.value);this.destroyNoSubNodesMessage(),this.noSubNodesMessage=new Zn(Hx,n.nodeTextSubdued),this.noSubNodesMessage.anchor.set(.5,0),this.noSubNodesMessage.position.set(t.width/2,t.y+t.height+i.value.spacingNodeMargin),this.addChild(this.noSubNodesMessage),this.initSubNodesTicker()}updateSubNodesContentPosition(){const{subNodesContent:t,box:i}=this,{spacingNodeMargin:n}=this.state.styleOptions.value;if(!t)return;const s=t.getEarliestNodeStart(),o=s?-this.state.timeScale.dateToX(s):0,a=i.y+i.height+n;t.position.set(o,a)}initSubNodesTicker(){const{pixiApp:t}=this.state;this.subNodesContentTicker||(this.subNodesHeight=0,this.subNodesContentTicker=()=>{const i=this.getSubContentHeight();i!==this.subNodesHeight&&(this.updateSubNodesOutlineSize(),this.updateSelectedRingSize(),this.subNodesHeight=i,this.emit(ka))},t.ticker.add(this.subNodesContentTicker,null,ee.LOW))}async collapseSubNodes(){this.destroySubNodesContent(),this.updateSelectedRingSize(),await this.updateSubNodesOutlineSize(),this.emit(ka)}update(t){var o;let i=!1,n=!1;t&&(this.nodeData=t,i=this.currentState!==this.nodeData.state,this.currentState=this.nodeData.state.toString(),this.updateIsRunningNode(),n=((o=this.label)==null?void 0:o.text)!==this.nodeData.label),this.isRunningNode&&this.nodeData.end&&(this.isRunningNode=!1,this.destroyRunningNodeTicker());const s=this.getNodeWidth();if(i&&(this.drawBox(),this.drawSubNodesOutline()),n&&this.drawLabel(),s!==this.nodeWidth){this.nodeWidth=s,this.updateBoxWidth(),this.updateSelectedRingSize(),this.updateSubNodesOutlineSize(!0),this.updateSubNodesTogglePosition();const a=this.isLabelInBox!==this.checkIsLabelInBox(2);!n&&a?this.drawLabel():this.isLabelInBox||this.updateLabelPosition()}}updatePosition(t){if(!this.positionInitialized||!this.nodeData.start)return;const{skipAnimation:i,includeXPos:n}=t??{},{suppressMotion:s}=this.state,{id:o}=this.nodeData,{row:a}=this.layout.value[o];if(!this.layoutRows.value[a])return;const{yPos:h}=this.layoutRows.value[a],u=n?this.state.timeScale.dateToX(this.nodeData.start):this.position.x;if(!(this.position.y===h&&this.position.x===u)){if(i||s.value){this.position.set(u,h);return}Vt.to(this,{x:u,y:h,duration:Cf.move,ease:"power1.out"}).then(()=>{this.state.cullScreen()})}}updateIsRunningNode(){this.isRunningNode=this.state.isRunning.value&&!this.nodeData.end}updateBoxWidth(){var t;this.boxBody.width=this.getBoxBodyWidth(),(t=this.rightBoxCap)==null||t.position.set(this.nodeWidth,0)}async updateSubNodesOutlineSize(t){if(!this.subNodesOutline)return;const{isSubNodesExpanded:i,subNodesOutline:n,nodeHeight:s}=this,{spacingSubNodesOutlineOffset:o,alphaSubNodesOutlineDimmed:a,spacingNodeMargin:h}=this.state.styleOptions.value,{suppressMotion:u}=this.state,l=this.getOutlineWidth(),f=i?s+this.getSubContentHeight()+h:s;n.resize({width:l,height:f,animate:!0}),await new Promise(c=>{const d=t||u.value?0:Ef,v=i?-o:o,p=i?-o:o,_=i?1:a;if(t||u.value){n.position.set(v,p),n.alpha=_,c(null);return}Vt.to(n,{x:v,y:p,alpha:_,duration:d,ease:Sf}).then(()=>c(null))})}updateLabelPosition(){if(!this.label)return;const{state:t,nodeWidth:i,hasSubNodes:n,isSubNodesToggleFloating:s,subNodesToggleWidth:o}=this,{spacingNodeXPadding:a,spacingNodeLabelMargin:h,spacingNodeYPadding:u}=t.styleOptions.value,l=()=>n&&s?i+h+o+a:i+h,f=()=>n&&!s?o+a:a,c=this.isLabelInBox?f():l();this.label.position.set(c,u)}updateSelectedRingSize(){const{width:t,height:i}=this.getSelectedRingSize();this.selectedRing.resize({width:t,height:i})}updateSubNodesTogglePosition(){if(!this.subNodesToggle)return;const{nodeWidth:t}=this,{borderRadiusNode:i,spacingNodeLabelMargin:n}=this.state.styleOptions.value;this.isSubNodesToggleFloating=this.subNodesToggleWidth+i>t,this.subNodesToggle.updateFloatingState(this.isSubNodesToggleFloating),this.subNodesToggle.position.x=this.isSubNodesToggleFloating?t+n:0}getNodeWidth(){const{isRunningNode:t,boxCapWidth:i,nodeData:n}=this;if(!n.start)return 0;const s=t?i:i*2,o=this.state.timeScale.dateToX(n.end??new Date)-this.state.timeScale.dateToX(n.start);return o>s?o:s}getNodeHeight(){const{textLineHeightDefault:t,spacingNodeYPadding:i}=this.state.styleOptions.value;return t+i*2}getBoxBodyWidth(){const{isRunningNode:t,nodeWidth:i,boxCapWidth:n}=this;return t?i-n:i-n*2}getOutlineWidth(){const{nodeWidth:t,isSubNodesExpanded:i}=this,{spacingSubNodesOutlineOffset:n}=this.state.styleOptions.value;if(i)return t+n*2;const s=this.boxCapWidth*2,o=t-n*2;return o>=s?o:s}getLabelText(){if(!this.hasSubNodes)return this.nodeData.label;const{subNodeLabels:t}=this.state,{subflowRunId:i}=this.nodeData;return t.value.has(i)?t.value.get(i):this.nodeData.label}checkIsLabelInBox(t=0){const{hasSubNodes:i,isSubNodesToggleFloating:n,subNodesToggle:s}=this;return i&&!n?this.apxLabelWidth+t<this.nodeWidth-s.width:this.apxLabelWidth+t<this.nodeWidth}getSelectedRingSize(){const{nodeWidth:t,nodeHeight:i,hasSubNodes:n,isSubNodesExpanded:s}=this,{spacingNodeSelectionMargin:o,spacingNodeSelectionWidth:a,spacingSubNodesOutlineBorderWidth:h,spacingSubNodesOutlineOffset:u}=this.state.styleOptions.value,l=o+a,f=t+l*2,c=n&&!s?i+h+u+l*2:i+l*2;return{width:f,height:c,margin:l}}emitSelection(){const{id:t,subflowRunId:i}=this.nodeData,n={id:this.hasSubNodes?i:t,type:this.hasSubNodes?"subFlowRun":"task"};this.emit(ae.nodeDetails,n)}getSubContentHeight(){var i,n,s;const{spacingNodeMargin:t}=this.state.styleOptions.value;return(i=this.subNodesContent)!=null&&i.height?this.subNodesContent.height:(n=this.subNodesLoadingIndicator)!=null&&n.height?this.subNodesLoadingIndicator.height+t:(s=this.noSubNodesMessage)!=null&&s.height?this.noSubNodesMessage.height+t:0}emitSubNodesToggle(t){this.emit(ae.subNodesToggle,t??this.nodeData.subflowRunId)}destroySubNodesContent(){var t;this.subNodesContentTicker&&(this.state.pixiApp.ticker.remove(this.subNodesContentTicker),this.subNodesContentTicker=null),this.destroyNoSubNodesMessage(),this.destroySubNodesLoadingIndicator(),(t=this.subNodesContent)==null||t.destroy(),this.subNodesContent=null}destroySubNodesLoadingIndicator(){var t;(t=this.subNodesLoadingIndicator)==null||t.destroy(),this.subNodesLoadingIndicator=null}destroyNoSubNodesMessage(){var t;(t=this.noSubNodesMessage)==null||t.destroy(),this.noSubNodesMessage=null}destroyRunningNodeTicker(){this.runningNodeTicker&&(this.state.pixiApp.ticker.remove(this.runningNodeTicker),this.runningNodeTicker=null)}killTweens(){Vt.killTweensOf([this,this.subNodesOutline])}destroy(){var i,n,s,o,a,h,u;const{cull:t}=this.state;t.remove(this.box),this.label&&t.remove(this.label),this.killTweens(),this.isSelected&&this.emit(ae.nodeDetails,null),this.isSubNodesExpanded&&this.emitSubNodesToggle(),this.destroyRunningNodeTicker(),this.destroySubNodesContent(),(i=this.subNodesOutline)==null||i.destroy(),(n=this.leftBoxCap)==null||n.destroy(),(s=this.rightBoxCap)==null||s.destroy(),(o=this.boxBody)==null||o.destroy(),this.box.destroy(),(a=this.subNodesToggle)==null||a.destroy(),(h=this.label)==null||h.destroy(),(u=this.selectedRing)==null||u.destroy(),this.unWatchers.forEach(l=>l()),super.destroy.call(this)}}const Rf="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IFM9KHttaW5pbXVtU3RhcnRUaW1lOnMsZ3JhcGhYRG9tYWluOmMsaW5pdGlhbE92ZXJhbGxUaW1lU3Bhbjp1fSk9Pih7ZGF0ZVRvWDprKHMsYyx1KSx4VG9EYXRlOkEocyxjLHUpfSk7ZnVuY3Rpb24gayhzLGMsdSl7cmV0dXJuIGZ1bmN0aW9uKHApe3JldHVybiBNYXRoLmNlaWwoKHAuZ2V0VGltZSgpLXMpKihjL3UpKX19ZnVuY3Rpb24gQShzLGMsdSl7cmV0dXJuIGZ1bmN0aW9uKHApe3JldHVybiBuZXcgRGF0ZShNYXRoLmNlaWwocytwKih1L2MpKSl9fWNvbnN0IEM9MDthc3luYyBmdW5jdGlvbiBNKHtkYXRhOnMsdGltZVNjYWxlOmMsY3VycmVudEFweENoYXJhY3RlcldpZHRoOnUsbWluaW11bU5vZGVFZGdlR2FwOnB9KXtjb25zdCBpPXt9O2FzeW5jIGZ1bmN0aW9uIGIoKXtmb3IgYXdhaXQoY29uc3RbLGVdb2Ygcyl7aWYoIWUuc3RhcnQpY29udGludWU7Y29uc3QgdD1jLmRhdGVUb1goZS5lbmQ/P25ldyBEYXRlKSxvPWUubGFiZWwubGVuZ3RoKnUsbj10K28sYT1jLmRhdGVUb1gobmV3IERhdGUoZS5zdGFydCkpLHI9YXdhaXQgTihlLGEpO2lbZS5pZF09e3JvdzpyLHN0YXJ0WDphLGVuZFg6bn19fWFzeW5jIGZ1bmN0aW9uIE4oZSx0KXtpZihlLnVwc3RyZWFtLmxlbmd0aD09PTEpe2lmKGUudXBzdHJlYW1bMF1pbiBpKXtjb25zdCBvPWlbZS51cHN0cmVhbVswXV07cmV0dXJuIGF3YWl0IGcobyx0KX1yZXR1cm4gY29uc29sZS53YXJuKCJ0aW1lbGluZU5vZGVzIGxheW91dCB3b3JrZXI6IFBhcmVudCBub2RlIG5vdCBmb3VuZCBpbiBsYXlvdXQiLGUudXBzdHJlYW1bMF0pLEN9aWYoZS51cHN0cmVhbS5sZW5ndGg+MCl7Y29uc3Qgbj1lLnVwc3RyZWFtLm1hcChsPT5pW2xdKS5maWx0ZXIobD0+ISFsKS5tYXAobD0+bC5yb3cpLHI9bi5yZWR1Y2UoKGwsdyk9PmwrdywwKS9uLmxlbmd0aCxmPU1hdGgucm91bmQocik7aWYobSh0LGYpKXtjb25zdCBsPVQodCxmKSx3PWwuZmlsdGVyKHk9PmUudXBzdHJlYW0uaW5jbHVkZXMoeSkpO2lmKHcubGVuZ3RoPjB8fGwubGVuZ3RoPjEpe2NvbnN0W3ldPXcubGVuZ3RoPjA/dzpsLEw9aVt5XTtyZXR1cm4gTC5uZXh0RGVwZW5kZW5jeVNob3ZlPVcobixmLEwubmV4dERlcGVuZGVuY3lTaG92ZSksYXdhaXQgZyhMLHQpfXJldHVybiBhd2FpdCBSKHtjb21wZXRpbmdMYXlvdXRJdGVtSWQ6bFswXSx1cHN0cmVhbVBvc2l0aW9uczpuLG5vZGVTdGFydFg6dCxkZXNpcmVkUG9zaXRpb246Zn0pfX1yZXR1cm4geCh0LEMpfWZ1bmN0aW9uIHgoZSx0KXtyZXR1cm4gbShlLHQpP3goZSx0KzEpOnR9YXN5bmMgZnVuY3Rpb24gZyhlLHQpe2UubmV4dERlcGVuZGVuY3lTaG92ZSE9PTEmJmUubmV4dERlcGVuZGVuY3lTaG92ZSE9PS0xJiYoZS5uZXh0RGVwZW5kZW5jeVNob3ZlPTEpO2NvbnN0e3JvdzpvLG5leHREZXBlbmRlbmN5U2hvdmU6bn09ZTtyZXR1cm4gbSh0LG8pP249PT0xJiYhbSh0LG8rMSk/KGUubmV4dERlcGVuZGVuY3lTaG92ZT0tMSxvKzEpOm0odCxvLTEpPyhhd2FpdCBkKHtkaXJlY3Rpb246bixub2RlU3RhcnRYOnQsZGVzaXJlZFBvc2l0aW9uOm8rbn0pLGUubmV4dERlcGVuZGVuY3lTaG92ZT1uPT09MT8tMToxLG8rbik6KGUubmV4dERlcGVuZGVuY3lTaG92ZT0xLG8tMSk6b31mdW5jdGlvbiBtKGUsdCl7Y29uc3Qgbz1PYmplY3Qua2V5cyhpKTtyZXR1cm4gby5sZW5ndGg+MCYmby5zb21lKG49Pntjb25zdCBhPWlbbl07cmV0dXJuIE8oe2ZpcnN0Tm9kZUVuZFg6YS5lbmRYLGZpcnN0Tm9kZVBvc2l0aW9uOmEucm93LGxhc3ROb2RlU3RhcnRYOmUsbGFzdE5vZGVQb3NpdGlvbjp0fSl9KX1hc3luYyBmdW5jdGlvbiBkKHtkaXJlY3Rpb246ZSxub2RlU3RhcnRYOnQsZGVzaXJlZFBvc2l0aW9uOm99KXtjb25zdCBuPVQodCxvKTtpZihuKWZvciBhd2FpdChjb25zdCBhIG9mIG4pe2NvbnN0IHI9aVthXSxmPXIucm93K2U7YXdhaXQgZCh7ZGlyZWN0aW9uOmUsbm9kZVN0YXJ0WDpyLnN0YXJ0WCxkZXNpcmVkUG9zaXRpb246Zn0pLHIucm93PWZ9fWZ1bmN0aW9uIE8oe2ZpcnN0Tm9kZUVuZFg6ZSxmaXJzdE5vZGVQb3NpdGlvbjp0LGxhc3ROb2RlU3RhcnRYOm8sbGFzdE5vZGVQb3NpdGlvbjpufSl7cmV0dXJuIHQ9PT1uJiZlK3A+PW99ZnVuY3Rpb24gVChlLHQpe2NvbnN0IG89W107aWYoT2JqZWN0LmtleXMoaSkuZm9yRWFjaChuPT57Y29uc3QgYT1pW25dO08oe2ZpcnN0Tm9kZUVuZFg6YS5lbmRYLGZpcnN0Tm9kZVBvc2l0aW9uOmEucm93LGxhc3ROb2RlU3RhcnRYOmUsbGFzdE5vZGVQb3NpdGlvbjp0fSkmJm8ucHVzaChuKX0pLG8ubGVuZ3RoIT09MClyZXR1cm4gby5zb3J0KChuLGEpPT57Y29uc3Qgcj1pW25dLGY9aVthXTtyZXR1cm4gci5lbmRYPGYuZW5kWD8xOnIuZW5kWD5mLmVuZFg/LTE6MH0pLG99ZnVuY3Rpb24gVyhlLHQsbyl7Y29uc3Qgbj1lLmZpbHRlcihyPT5yPHQpLmxlbmd0aCxhPWUuZmlsdGVyKHI9PnI+dCkubGVuZ3RoO3JldHVybiBuPmE/LTE6bz8/MX1hc3luYyBmdW5jdGlvbiBSKHtkZXNpcmVkUG9zaXRpb246ZSxub2RlU3RhcnRYOnQsdXBzdHJlYW1Qb3NpdGlvbnM6byxjb21wZXRpbmdMYXlvdXRJdGVtSWQ6bn0pe2NvbnN0IGE9aVtuXSxbcixmXT1VKG4pLGw9by5maWx0ZXIoeT0+eTxlKS5sZW5ndGgsdz1vLmZpbHRlcih5PT55PmUpLmxlbmd0aDtpZihsPncpe2lmKHI+ZiYmcj5sKXJldHVybiBhd2FpdCBkKHtkaXJlY3Rpb246LTEsbm9kZVN0YXJ0WDp0LGRlc2lyZWRQb3NpdGlvbjplfSksZTtpZihmPnIpcmV0dXJuIGF3YWl0IGQoe2RpcmVjdGlvbjoxLG5vZGVTdGFydFg6dCxkZXNpcmVkUG9zaXRpb246ZX0pLGU7YS5uZXh0RGVwZW5kZW5jeVNob3ZlPS0xfWlmKHc+bCl7aWYoZj5yJiZmPncpcmV0dXJuIGF3YWl0IGQoe2RpcmVjdGlvbjoxLG5vZGVTdGFydFg6dCxkZXNpcmVkUG9zaXRpb246ZX0pLGU7aWYocj5mKXJldHVybiBhd2FpdCBkKHtkaXJlY3Rpb246LTEsbm9kZVN0YXJ0WDp0LGRlc2lyZWRQb3NpdGlvbjplfSksZTthLm5leHREZXBlbmRlbmN5U2hvdmU9MX1yZXR1cm4gYXdhaXQgZyhhLHQpfWZ1bmN0aW9uIFUoZSl7Y29uc3QgdD1zLmdldChlKSxvPWlbZV07cmV0dXJuIHQudXBzdHJlYW0ucmVkdWNlKChuLGEpPT57aWYoZSBpbiBpKXtjb25zdCByPWlbYV07cmV0dXJuIHIucm93PG8ucm93JiYoblswXSs9MSksci5yb3c+by5yb3cmJihuWzFdKz0xKSxufXJldHVybiBjb25zb2xlLndhcm4oIm5vZGVMYXlvdXQud29ya2VyLnRzOiBQYXJlbnQgbm9kZSBub3QgZm91bmQgb24gbGF5b3V0IGRhdGEiLGUpLG59LFswLDBdKX1yZXR1cm4gYXdhaXQgYigpLGl9ZnVuY3Rpb24gaihzKXtjb25zdCBjPXt9O2xldCB1PTA7cmV0dXJuIHMuZm9yRWFjaCgocCxpKT0+e2NbaV09e3Jvdzp1LHN0YXJ0WDowLGVuZFg6MH0sdSsrfSksY31sZXQgRCxJPTE0LFg9MCx2LFA9bmV3IE1hcCxoPXt9O29ubWVzc2FnZT1hc3luYyh7ZGF0YTp7bGF5b3V0U2V0dGluZzpzLGRhdGE6YyxhcHhDaGFyYWN0ZXJXaWR0aDp1LHNwYWNpbmdNaW5pbXVtTm9kZUVkZ2VHYXA6cCx0aW1lU2NhbGVBcmdzOmksY2VudGVyVmlld3BvcnRBZnRlcjpifX0pPT57aWYocCYmKFg9cCkscyYmKHY9cyksdSYmKEk9dSksaSl7Y29uc3R7bWluaW11bVN0YXJ0VGltZTpOLGdyYXBoWERvbWFpbjp4LGluaXRpYWxPdmVyYWxsVGltZVNwYW46Z309aTtEPVMoe21pbmltdW1TdGFydFRpbWU6TixncmFwaFhEb21haW46eCxpbml0aWFsT3ZlcmFsbFRpbWVTcGFuOmd9KX1jJiZEJiZ2JiYoUD1jLGF3YWl0IEIoKSxwb3N0TWVzc2FnZSh7bGF5b3V0OmgsY2VudGVyVmlld3BvcnRBZnRlcjpifSkpfTthc3luYyBmdW5jdGlvbiBCKCl7dj09PSJ3YXRlcmZhbGwiJiYoaD1qKFApKSx2PT09Im5lYXJlc3RQYXJlbnQiJiYoaD1hd2FpdCBNKHtkYXRhOlAsdGltZVNjYWxlOkQsY3VycmVudEFweENoYXJhY3RlcldpZHRoOkksbWluaW11bU5vZGVFZGdlR2FwOlh9KSksRSgpfWZ1bmN0aW9uIEUoKXtjb25zdCBzPU9iamVjdC52YWx1ZXMoaCkucmVkdWNlKChjLHUpPT51LnJvdzxjP3Uucm93OmMsMCk7czwwJiZPYmplY3QudmFsdWVzKGgpLmZvckVhY2goYz0+e2Mucm93Kz1NYXRoLmFicyhzKX0pfX0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPW5vZGVMYXlvdXQud29ya2VyLWJhNTRlMTY4LmpzLm1hcAo=",Of=typeof window<"u"&&window.Blob&&new Blob([atob(Rf)],{type:"text/javascript;charset=utf-8"});function Yx(){let r;try{if(r=Of&&(window.URL||window.webkitURL).createObjectURL(Of),!r)throw"";return new Worker(r)}catch{return new Worker("data:application/javascript;base64,"+Rf)}finally{r&&(window.URL||window.webkitURL).revokeObjectURL(r)}}const Ha="timelineUpdateEvent";class Af extends ot{constructor({nodeContentContainerName:t,isSubNodes:i,data:n,state:s}){super();C(this,"layoutWorker",new Yx);C(this,"isSubNodes");C(this,"data");C(this,"state");C(this,"nodeContainer",new ot);C(this,"nodeRecords",new Map);C(this,"layout",X.ref({}));C(this,"layoutRows",X.ref([]));C(this,"edgeContainer",new ot);C(this,"edgeRecords",[]);C(this,"unWatchers",[]);C(this,"isSelectionPathHighlighted",!1);t&&(this.nodeContainer.name=t),this.isSubNodes=i,this.data=n,this.state=s,this.initDeselectLayer(),this.initLayoutWorker(),this.initWatchers()}initWatchers(){const{layoutSetting:t,hideEdges:i,selectedNodeId:n}=this.state;this.unWatchers.push(X.watch(t,()=>{this.updateLayoutSetting()}),X.watch(i,()=>{this.updateHideEdges()}),X.watch(n,()=>{if(n.value&&this.nodeRecords.has(n.value)){this.isSelectionPathHighlighted&&this.unHighlightSelectedNodePath(),this.isSelectionPathHighlighted=!0,this.highlightSelectedNodePath();return}this.isSelectionPathHighlighted&&(!n.value||!this.nodeRecords.has(n.value))&&this.unHighlightSelectedNodePath()}))}async initLayoutWorker(){const{styleOptions:t,timeScaleArgs:i,layoutSetting:n,centerViewport:s,suppressMotion:o}=this.state,a=await Xr(t.value),{spacingMinimumNodeEdgeGap:h}=t.value,u=ue.measureText("M",a.nodeTextStyles).width,l={data:X.toRaw(this.data),timeScaleArgs:i,spacingMinimumNodeEdgeGap:h,apxCharacterWidth:u,layoutSetting:n.value};this.layoutWorker.onmessage=({data:f})=>{this.layout.value=f.layout,this.renderLayout(),this.isSelectionPathHighlighted&&this.highlightSelectedNodePath(),f.centerViewportAfter&&!this.isSubNodes&&setTimeout(()=>{s()},o.value?10:Cf.move*1e3*1.1),this.emit(Ha)},this.layoutWorker.postMessage(l)}initDeselectLayer(){if(this.isSubNodes)return;const{pixiApp:t,viewport:i}=this.state,n=new s0(t,i);this.addChild(n),n.on("click",()=>{this.emitNullSelection()})}renderLayout(){const{layout:t}=this,i=this.nodeRecords.size===0,n=[];Object.keys(t.value).forEach(s=>{const o=this.data.get(s);o&&(this.nodeRecords.has(s)?this.nodeRecords.get(s).update(o):(this.createNode(o),n.push(s)))}),this.updateLayoutRows(),n.forEach(s=>{this.nodeRecords.get(s).initializePosition()}),i&&(this.addChild(this.edgeContainer),this.addChild(this.nodeContainer),this.isSubNodes||this.state.centerViewport({skipAnimation:!0}))}createNode(t){const{state:i,layout:n,layoutRows:s}=this,o=new zx({nodeData:t,state:i,layout:n,layoutRows:s});this.registerEmits(o),this.nodeRecords.set(t.id,o),this.addNodeEdges(t),this.nodeContainer.addChild(o),o.on(ka,()=>{this.updateLayoutRows()})}addNodeEdges(t){t.upstream.forEach(i=>{const n=this.nodeRecords.get(i),s=this.nodeRecords.get(t.id);if(!n||!s){console.warn("timelineNodes: could not find source or target node for edge, skipping");return}const o=new Xx({sourceNode:n,targetNode:s,state:this.state});this.state.hideEdges.value&&(o.renderable=!1),this.edgeRecords.push({edge:o,sourceId:i,targetId:t.id}),this.edgeContainer.addChild(o)})}update(t){if(this.data=t,t.size!==this.nodeRecords.size){const i={data:X.toRaw(this.data)};this.layoutWorker.postMessage(i);return}this.nodeRecords.forEach((i,n)=>{const s=this.data.get(n);s&&i.update(s)}),this.emit(Ha)}updateHideEdges(){const{hideEdges:t,viewport:i}=this.state;this.edgeRecords.forEach(({edge:n})=>n.renderable=!t.value),t.value||(i.dirty=!0,i.updateTransform()),this.isSelectionPathHighlighted&&this.highlightSelectedNodePath()}updateLayoutRows(t=0){const{layout:i}=this,{spacingNodeMargin:n,spacingNodeSelectionMargin:s}=this.state.styleOptions.value,o=Math.max(...Object.values(i.value).map(u=>u.row));let a=[];const h=Object.keys(i.value).reduce((u,l)=>{var v;const{row:f}=i.value[l],c=u.get(f)??0,d=((v=this.nodeRecords.get(l))==null?void 0:v.height)??0;return u.set(f,Math.max(d,c)),u},new Map);for(let u=t;u<=o;u++){const l=a[u-1],f=h.get(u)??0;if(l===void 0){a.push({yPos:0,height:f});continue}const c=l.yPos+l.height-s*2+n;a.push({yPos:c,height:f})}t>0&&(a=this.layoutRows.value.slice(0,t).concat(a)),this.layoutRows.value=a}updateLayoutSetting(){const{layoutSetting:t}=this.state,i={data:X.toRaw(this.data),layoutSetting:t.value,centerViewportAfter:!0};this.layoutWorker.postMessage(i)}highlightSelectedNodePath(){const t=this.state.selectedNodeId.value,i=t&&this.nodeRecords.get(t);if(!t||!i)return;const{alphaNodeDimmed:n}=this.state.styleOptions.value,s=[...this.getAllUpstreamEdges(t),...this.getAllDownstreamEdges(t)],o=new Map;o.set(t,i),this.edgeRecords.forEach(a=>{if(s.includes(a)){const h=this.nodeRecords.get(a.sourceId),u=this.nodeRecords.get(a.targetId);o.set(a.sourceId,h),o.set(a.targetId,u),a.edge.renderable=!0;return}a.edge.alpha=n}),this.nodeRecords.forEach((a,h)=>{o.has(h)||(a.alpha=n)})}getAllUpstreamEdges(t){const i=[],n=this.data.get(t);return n==null||n.upstream.forEach(s=>{const o=this.edgeRecords.find(a=>a.sourceId===s&&a.targetId===t);if(o){i.push(o);const a=this.getAllUpstreamEdges(s);i.push(...a)}}),i}getAllDownstreamEdges(t){const i=[];return this.data.forEach(n=>{if(n.upstream.includes(t)){const s=this.edgeRecords.find(o=>o.targetId===n.id&&o.sourceId===t);if(s){i.push(s);const o=this.getAllDownstreamEdges(n.id);i.push(...o)}}}),i}unHighlightSelectedNodePath(){const{hideEdges:t}=this.state;this.edgeRecords.forEach(({edge:i})=>{t.value&&(i.renderable=!1),i.alpha=1}),this.nodeRecords.forEach(i=>{i.alpha=1})}registerEmits(t){t.on(ae.nodeDetails,i=>{this.emit(ae.nodeDetails,i)}),t.on(ae.subNodesToggle,i=>{this.emit(ae.subNodesToggle,i)})}emitNullSelection(){this.emit(ae.nodeDetails,null)}getEarliestNodeStart(){if(this.data.size<1)return null;let t=new Date;return this.data.forEach(({start:i})=>{i&&i.getTime()<t.getTime()&&(t=i)}),t}destroy(){this.nodeRecords.forEach(t=>t.destroy()),this.nodeRecords.clear(),this.edgeRecords.forEach(t=>t.edge.destroy()),this.removeChildren(),this.unWatchers.forEach(t=>t()),this.layoutWorker.terminate(),this.layoutWorker.onmessage=null,this.isSubNodes||Gx(),super.destroy.call(this)}}class Vx extends ot{constructor(t){super();C(this,"state");C(this,"unwatch");C(this,"playhead",new Se);C(this,"label");this.state=t,this.state.cull.add(this),this.zIndex=sl.playhead,this.drawPlayhead(),this.drawTimeLabel(),this.unwatch=X.watch(this.state.styleOptions,()=>{this.playhead.clear(),this.drawPlayhead()}),this.interactive=!1}drawPlayhead(){const{colorPlayheadBg:t,spacingPlayheadWidth:i,spacingPlayheadGlowPadding:n}=this.state.styleOptions.value;this.playhead.beginFill(t,.1),this.playhead.drawRect(0,0,i+n*2,this.state.pixiApp.screen.height),this.playhead.endFill(),this.playhead.beginFill(t),this.playhead.drawRect(n,0,i,this.state.pixiApp.screen.height),this.playhead.endFill(),this.addChild(this.playhead)}async drawTimeLabel(){const{spacingGuideLabelPadding:t,spacingPlayheadGlowPadding:i}=this.state.styleOptions.value,n=await Xr(this.state.styleOptions.value),{timeBySeconds:s}=this.state.formatDateFns.value,o=s(new Date);this.label=new Zn(o,n.playheadTimerLabel),this.label.x=-this.label.width-(i+t),this.label.y=this.getTimeLabelY(),this.addChild(this.label),setInterval(()=>{const a=new Date;this.label.text=s(a)},1e3)}getTimeLabelY(){const{spacingGuideLabelPadding:t}=this.state.styleOptions.value;return this.state.pixiApp.screen.height-(this.label.height+t)}updatePosition(){const{spacingPlayheadWidth:t,spacingPlayheadGlowPadding:i}=this.state.styleOptions.value;this.position.x=this.state.timeScale.dateToX(new Date)*this.state.viewport.scale._x+this.state.viewport.worldTransform.tx-i-t/2,this.playhead.height!==this.state.pixiApp.screen.height&&(this.playhead.height=this.state.pixiApp.screen.height,this.label.y=this.getTimeLabelY())}destroy(){this.state.cull.remove(this),this.unwatch(),this.playhead.destroy(),super.destroy.call(this)}}const jx=({minimumStartTime:r,graphXDomain:e,initialOverallTimeSpan:t})=>({dateToX:Zx(r,e,t),xToDate:qx(r,e,t)});function Zx(r,e,t){return function(i){return Math.ceil((i.getTime()-r)*(e/t))}}function qx(r,e,t){return function(i){return new Date(Math.ceil(r+i*(t/e)))}}const Wa={leftCap:"leftCap",body:"body",rightCap:"rightCap"},Kx=.2,$x=.2;class Jx extends ot{constructor({graphState:t,nodeData:i,size:n,floating:s}){super();C(this,"graphState");C(this,"nodeData");C(this,"size");C(this,"isFloating");C(this,"isExpanded",!1);C(this,"textColor");C(this,"toggleBox",new ot);C(this,"hoverShade",new ot);C(this,"toggleArrow");C(this,"toggleBorder");C(this,"divider");C(this,"unWatchers",[]);this.interactive=!0,this.buttonMode=!0,t.cull.add(this),this.graphState=t,this.nodeData=i,this.size=n,this.isFloating=s,this.textColor=this.getTextColor(),this.addChild(this.toggleBox),this.addChild(this.hoverShade),this.initShapes(),this.on("pointerover",()=>{this.hover()}),this.on("pointerout",()=>{this.unHover()}),this.initWatchers()}initWatchers(){const{viewport:t,styleOptions:i,styleNode:n}=this.graphState;this.unWatchers.push(X.watch([i,n],()=>{this.redraw()},{deep:!0})),t.on("frame-end",()=>{t.scale.x<$x?this.visible=!1:this.visible=!0})}initShapes(){this.drawToggleBox(),this.drawHoverShade(),this.drawDivider(),this.drawToggleArrow(),this.drawToggleBorder()}drawToggleBox(){if(this.toggleBox.removeChildren(),!this.isFloating)return;const{size:t,toggleBox:i}=this,{pixiApp:n,styleOptions:s}=this.graphState,{colorButtonBg:o,borderRadiusButton:a}=s.value,{cap:h,body:u}=Ua({pixiApp:n,fill:o,borderRadius:a,boxCapWidth:a,height:t}),l=new ut(h),f=new ut(u);f.x=a,f.width=t-a*2,f.height=t;const c=new ut(h);c.scale.x=-1,c.x=t,i.addChild(l),i.addChild(f),i.addChild(c)}drawHoverShade(){const{hoverShade:t,size:i,isFloating:n}=this,{borderRadiusButton:s,colorButtonBgHover:o}=this.graphState.styleOptions.value,{onFillSubNodeToggleHoverBg:a,onFillSubNodeToggleHoverBgAlpha:h}=this.graphState.styleNode.value(this.nodeData),u=ie(a);t.removeChildren();const{cap:l,body:f}=Ua({pixiApp:this.graphState.pixiApp,fill:n?o:u,borderRadius:s,boxCapWidth:s,height:i}),c=new ut(l);c.name=Wa.leftCap,c.alpha=n?1:h;const d=new ut(f);d.name=Wa.body,d.x=s,d.width=n?i-s*2:i-s,d.height=i,d.alpha=n?1:h;const v=new ut(l);v.name=Wa.rightCap,v.scale.x=-1,v.x=i,v.alpha=n?1:0,t.addChild(c),t.addChild(d),t.addChild(v),t.alpha=0}drawDivider(){var o;if((o=this.divider)==null||o.destroy(),this.isFloating)return;const{size:t,textColor:i}=this,{pixiApp:n}=this.graphState,s=rn({pixiApp:n,fill:i});this.divider=new ut(s),this.divider.width=1,this.divider.height=t,this.divider.x=t,this.addChild(this.divider)}drawToggleArrow(){var a;const{size:t,textColor:i,isExpanded:n}=this,{pixiApp:s}=this.graphState;(a=this.toggleArrow)==null||a.destroy();const o=wf({pixiApp:s,strokeColor:i,edgeWidth:2,edgeLength:8});this.toggleArrow=new ut(o),this.toggleArrow.transform.rotation=n?Math.PI/2*-1:Math.PI/2,this.toggleArrow.anchor.set(.5,.5),this.toggleArrow.position.set(t/2,t/2),this.addChild(this.toggleArrow)}drawToggleBorder(){var a;(a=this.toggleBorder)==null||a.destroy();const{size:t,isFloating:i}=this,{colorButtonBorder:n,borderRadiusButton:s,spacingButtonBorderWidth:o}=this.graphState.styleOptions.value;!n||!i||(this.toggleBorder=new Ga({graphState:this.graphState,width:t,height:t,borderRadius:s,borderWidth:o,borderColor:n}),this.addChild(this.toggleBorder))}setToggleArrowRotation(t){const{suppressMotion:i}=this.graphState;this.toggleArrow&&Vt.to(this.toggleArrow,{rotation:t,duration:i.value?0:Kx,ease:"power2.inOut"})}getTextColor(){const{styleOptions:t,styleNode:i}=this.graphState,{colorTextDefault:n,colorTextInverse:s}=t.value,{inverseTextOnFill:o}=i.value(this.nodeData);return this.isFloating?n:o?s:n}redraw(){this.textColor=this.getTextColor(),this.initShapes()}hover(){this.hoverShade.alpha=1}unHover(){this.hoverShade.alpha=0}setExpanded(){this.isExpanded=!0,this.setToggleArrowRotation(Math.PI/2*-1)}setCollapsed(){this.isExpanded=!1,this.setToggleArrowRotation(Math.PI/2)}updateFloatingState(t){this.isFloating!==t&&(this.isFloating=t,this.redraw())}destroy(){this.graphState.cull.remove(this),super.destroy.call(this)}}function If(r){let{left:e,right:t,height:i}=r;function n(){const{left:s,right:o,height:a}=r;return s===e&&o===t&&a===i?!1:(e=s,t=o,i=a,!0)}return n}class Qx extends ot{constructor(t){super();C(this,"state");C(this,"viewportUpdated");C(this,"format");C(this,"date");C(this,"line");C(this,"label");C(this,"unwatch");C(this,"tick",()=>{!this.date||!this.viewportUpdated()||(this.updatePosition(),this.updateLineHeight())});this.state=t,this.viewportUpdated=If(t.viewport),this.state.pixiApp.ticker.add(this.tick),this.interactive=!1,this.createLine(),this.createLabel(),this.unwatch=X.watch(t.styleOptions,()=>{this.createLine(),this.createLabel()})}setDate(t){var n;const i=t.getTime()!==((n=this.date)==null?void 0:n.getTime());this.date=t,i&&(this.updatePosition(),this.updateLabel())}setFormat(t){this.format=t,this.updateLabel()}destroy(){this.state.pixiApp.ticker.remove(this.tick),super.destroy.call(this)}createLine(){const t=rn({pixiApp:this.state.pixiApp,fill:this.state.styleOptions.value.colorGuideLine});this.line=new ut(t),this.line.width=1,this.line.height=this.state.pixiApp.screen.height,this.addChild(this.line)}async createLabel(){const t=await Xr(this.state.styleOptions.value);this.label=new Zn("",t.timeMarkerLabel);const i=this.state.styleOptions.value.spacingGuideLabelPadding;this.label.position.set(i,i),this.addChild(this.label),this.updateLabel()}getPositionX(){if(!this.date)throw new Error("Guide position requested for undefined date");const{viewport:t}=this.state;return this.state.timeScale.dateToX(this.date)*t.scale._x+t.worldTransform.tx}updateLineHeight(){this.line&&(this.line.height=this.state.pixiApp.screen.height)}updatePosition(){const t=this.getPositionX();this.position.set(t,0)}updateLabel(){!this.format||!this.date||!this.label||(this.label.text=this.format(this.date))}}const tb=20,eb=260,za=100;class ib extends ot{constructor(t){super();C(this,"state");C(this,"guides",[]);C(this,"viewportUpdated");C(this,"unwatch");C(this,"tick",()=>{this.viewportUpdated()&&this.updateGuides()});this.state=t,this.viewportUpdated=If(t.viewport),this.state.pixiApp.ticker.add(this.tick),this.unwatch=X.watch([this.state.styleOptions,this.state.formatDateFns],()=>{this.updateGuides()})}destroy(){this.state.pixiApp.ticker.remove(this.tick),this.unwatch(),super.destroy.call(this)}getViewportDates(){const t=this.state.timeScale.xToDate(this.state.viewport.left-za),i=this.state.timeScale.xToDate(this.state.viewport.right+za),n=i.getTime()-t.getTime();return{startDate:t,endDate:i,span:n}}getTimeSpan(){const t=this.state.pixiApp.screen.width+za*2,i=Math.ceil(t/eb),{span:n}=this.getViewportDates(),s=Math.ceil(n/i);return x0(s)}getFirstGuideDate(t,i){const n=Math.ceil(t.getTime()/i)*i;return new Date(n)}getGuideDates(){const{startDate:t,endDate:i}=this.getViewportDates(),{span:n}=this.getTimeSpan(),s=[];let o=this.getFirstGuideDate(t,n);if(o.getTime()>=i.getTime())throw new Error("first guide date is equal or after the desired end date");for(;o.getTime()<i.getTime();)s.push(o),o=rc(o,n);for(;s.length>tb;)s.shift(),s.pop();return s}getLabelFormat(){const{labelFormat:t}=this.getTimeSpan();return b0(t,this.state.formatDateFns.value)}updateGuides(){const t=this.getGuideDates(),i=this.guides.splice(t.length);t.forEach((n,s)=>this.updateOrCreateGuide(s,n)),this.removeGuides(i)}updateOrCreateGuide(t,i){const n=this.guides.at(t),s=n??new Qx(this.state);return s.setDate(i),s.setFormat(this.getLabelFormat()),this.guides[t]=s,n||this.addChild(s),s}removeGuides(t){t.forEach(i=>{i.destroy(),this.removeChild(i)})}}const Mf={timeBySeconds:v0,timeByMinutes:_0,date:g0},Nf=()=>({fill:"black",inverseTextOnFill:!0,onFillSubNodeToggleHoverBg:"black",onFillSubNodeToggleHoverBgAlpha:.4}),rb=500,Df="rootNodesContainer",nb=X.defineComponent({__name:"FlowRunTimeline",props:{data:{},isRunning:{type:Boolean},theme:{},formatDateFns:{},selectedNodeId:{},layout:{},hideEdges:{type:Boolean},subNodeLabels:{},expandedSubNodes:{},visibleDateRange:{}},emits:["selection","subNodeToggle","update:visibleDateRange"],setup(r,{expose:e,emit:t}){const i=r;e({centerViewport:ht,moveViewportCenter:vt});const n=X.computed({get(){return i.visibleDateRange},set(G){t("update:visibleDateRange",G)}}),s=X.ref(),o=X.computed(()=>{var G;return((G=i.theme)==null?void 0:G.node)??Nf}),a=X.computed(()=>{var G;return f0((G=i.theme)==null?void 0:G.defaults)}),h=X.computed(()=>i.selectedNodeId??null),u=X.computed(()=>i.layout??"nearestParent"),l=X.computed(()=>i.isRunning??!1),f=X.computed(()=>i.hideEdges??!1),c=X.computed(()=>i.subNodeLabels??new Map),d=X.computed(()=>i.expandedSubNodes??new Map),v=X.computed(()=>{const G=window.matchMedia("(prefers-reduced-motion: reduce)").matches;return i.data.size>rb||G}),p=X.ref(!1),_=X.computed(()=>({...Mf,...i.formatDateFns})),g=X.ref(!0);let y,m;const b=new tc;let x,T,w;const S=X.ref();let E,P,O,I,F=null,k,A=null;X.onMounted(async()=>{if(!s.value){console.error("Stage reference not found in initPixiApp");return}R(),T=jx(x),y=o0(s.value),y.stage.sortableChildren=!0,m=await w0(s.value,y),q(),N(),J(),V(),M(),rt(),it(),pt(),g.value=!1});function M(){A&&(O=new ib(A),y.stage.addChild(O))}X.onUnmounted(()=>{L()});function L(){O.destroy(),I==null||I.destroy(),k.destroy(),m.destroy(),y.destroy(!0)}function q(){m.on("drag-start",()=>{p.value=!0}).on("drag-end",()=>{p.value=!1})}function z(){n.value={startDate:T.xToDate(m.left),endDate:T.xToDate(m.right),internalOrigin:!0}}function N(){m.on("moved",()=>{z()}),m.on("resize",()=>{z()}),X.watch(()=>i.visibleDateRange,()=>{if(!n.value)return;if(n.value.internalOrigin){n.value.internalOrigin=!1;return}const G=T.dateToX(n.value.startDate),nt=T.dateToX(n.value.endDate),gt=G+(nt-G)/2;m.fitWidth(nt-G,!0),m.moveCenter(gt,m.center.y)},{deep:!0})}function R(){const{min:nt,max:gt,span:$}=m0(i.data,6e4,l.value);w=nt,S.value=gt,E=$,P=U(),x={minimumStartTime:w.getTime(),graphXDomain:P,initialOverallTimeSpan:E}}function U(){const{spacingNodeYPadding:G,textLineHeightDefault:nt,spacingNodeMargin:gt,spacingSubNodesOutlineOffset:$}=a.value,jt=i.data.size,Ie=nt+G*2+$*2+gt,ei=s.value.clientWidth/s.value.clientHeight,xs=Ie*jt*ei,bs=jt>=120?jt/100:1.2;return xs*bs}function J(){n0(a.value),X.watch(a,G=>{r0(G)})}function V(){A={pixiApp:y,viewport:m,cull:b,cullScreen:_t,timeScale:T,timeScaleArgs:x,styleOptions:a,styleNode:o,layoutSetting:u,isRunning:l,hideEdges:f,subNodeLabels:c,selectedNodeId:h,expandedSubNodes:d,suppressMotion:v,centerViewport:ht,formatDateFns:_}}function it(){!l.value||!A||(I=new Vx(A),y.stage.addChild(I),dt())}function dt(){F||!I||(F=()=>{if(l.value&&I&&!I.destroyed){const G=I.position.x>0&&I.position.x<y.screen.width;if(S.value=new Date,I.updatePosition(),!m.moving&&G&&I.position.x>y.screen.width-a.value.spacingViewportPaddingDefault){const nt=T.xToDate(m.left);m.zoomPercent(-.1,!0),m.left=T.dateToX(nt)}}},y.ticker.add(F))}X.watch(l,G=>{g.value||(I&&F&&(I.destroy(),y.ticker.remove(F),F=null),G&&it())});function pt(){m.on("frame-end",()=>{m.dirty&&(_t(),m.dirty=!1)})}function Mt(){b.uncull()}function Bt(){_t()}function _t(){b.cull(y.renderer.screen)}function rt(){A&&(k=new Af({nodeContentContainerName:Df,data:i.data,state:A}),m.addChild(k),k.on(ae.nodeDetails,G=>{p.value||t("selection",G)}),k.on(ae.subNodesToggle,G=>{p.value||t("subNodeToggle",G)}),X.watch(()=>i.data,()=>{k.update(i.data),m.dirty=!0}))}function ht({skipAnimation:G}={}){const{spacingViewportPaddingDefault:nt}=a.value,gt=500;Mt();const{x:$,y:jt,width:Ie,height:ei}=k.getChildByName(Df).getLocalBounds();Bt();const _r=m.findFit(Ie+nt*2,ei+nt*2);m.animate({position:{x:$+Ie/2,y:jt+ei/2},scale:_r>1?1:_r,time:G||v.value?0:gt,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{G&&z()}})}function vt({xOffset:G,yOffset:nt}){const{x:gt,y:$}=m.transform.position;m.setTransform(gt+G,$+nt,m.transform.scale.x,m.transform.scale.y)}return(G,nt)=>(X.openBlock(),X.createElementBlock("div",{ref_key:"stage",ref:s,class:"g-flow-run-timeline"},null,512))}}),Db="";class he{constructor(e){this.parent=e,this.paused=!1}destroy(){}down(e){return!1}move(e){return!1}up(e){return!1}wheel(e){return!1}update(e){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var sb=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ob(r,e,t){return t={path:e,exports:{},require:function(i,n){return ab(i,n??t.path)}},r(t,t.exports),t.exports}function ab(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Ff=ob(function(r,e){(function(){var t,i;i=function(n){return r.exports=n},t={linear:function(n,s,o,a){return o*n/a+s},easeInQuad:function(n,s,o,a){return o*(n/=a)*n+s},easeOutQuad:function(n,s,o,a){return-o*(n/=a)*(n-2)+s},easeInOutQuad:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n+s:-o/2*(--n*(n-2)-1)+s},easeInCubic:function(n,s,o,a){return o*(n/=a)*n*n+s},easeOutCubic:function(n,s,o,a){return o*((n=n/a-1)*n*n+1)+s},easeInOutCubic:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n+s:o/2*((n-=2)*n*n+2)+s},easeInQuart:function(n,s,o,a){return o*(n/=a)*n*n*n+s},easeOutQuart:function(n,s,o,a){return-o*((n=n/a-1)*n*n*n-1)+s},easeInOutQuart:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n*n+s:-o/2*((n-=2)*n*n*n-2)+s},easeInQuint:function(n,s,o,a){return o*(n/=a)*n*n*n*n+s},easeOutQuint:function(n,s,o,a){return o*((n=n/a-1)*n*n*n*n+1)+s},easeInOutQuint:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n*n*n+s:o/2*((n-=2)*n*n*n*n+2)+s},easeInSine:function(n,s,o,a){return-o*Math.cos(n/a*(Math.PI/2))+o+s},easeOutSine:function(n,s,o,a){return o*Math.sin(n/a*(Math.PI/2))+s},easeInOutSine:function(n,s,o,a){return-o/2*(Math.cos(Math.PI*n/a)-1)+s},easeInExpo:function(n,s,o,a){return n===0?s:o*Math.pow(2,10*(n/a-1))+s},easeOutExpo:function(n,s,o,a){return n===a?s+o:o*(-Math.pow(2,-10*n/a)+1)+s},easeInOutExpo:function(n,s,o,a){return(n/=a/2)<1?o/2*Math.pow(2,10*(n-1))+s:o/2*(-Math.pow(2,-10*--n)+2)+s},easeInCirc:function(n,s,o,a){return-o*(Math.sqrt(1-(n/=a)*n)-1)+s},easeOutCirc:function(n,s,o,a){return o*Math.sqrt(1-(n=n/a-1)*n)+s},easeInOutCirc:function(n,s,o,a){return(n/=a/2)<1?-o/2*(Math.sqrt(1-n*n)-1)+s:o/2*(Math.sqrt(1-(n-=2)*n)+1)+s},easeInElastic:function(n,s,o,a){var h,u,l;return l=1.70158,u=0,h=o,n===0||(n/=a),u||(u=a*.3),h<Math.abs(o)?(h=o,l=u/4):l=u/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(n-=1))*Math.sin((n*a-l)*(2*Math.PI)/u))+s},easeOutElastic:function(n,s,o,a){var h,u,l;return l=1.70158,u=0,h=o,n===0||(n/=a),u||(u=a*.3),h<Math.abs(o)?(h=o,l=u/4):l=u/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*n)*Math.sin((n*a-l)*(2*Math.PI)/u)+o+s},easeInOutElastic:function(n,s,o,a){var h,u,l;return l=1.70158,u=0,h=o,n===0||(n/=a/2),u||(u=a*(.3*1.5)),h<Math.abs(o)?(h=o,l=u/4):l=u/(2*Math.PI)*Math.asin(o/h),n<1?-.5*(h*Math.pow(2,10*(n-=1))*Math.sin((n*a-l)*(2*Math.PI)/u))+s:h*Math.pow(2,-10*(n-=1))*Math.sin((n*a-l)*(2*Math.PI)/u)*.5+o+s},easeInBack:function(n,s,o,a,h){return h===void 0&&(h=1.70158),o*(n/=a)*n*((h+1)*n-h)+s},easeOutBack:function(n,s,o,a,h){return h===void 0&&(h=1.70158),o*((n=n/a-1)*n*((h+1)*n+h)+1)+s},easeInOutBack:function(n,s,o,a,h){return h===void 0&&(h=1.70158),(n/=a/2)<1?o/2*(n*n*(((h*=1.525)+1)*n-h))+s:o/2*((n-=2)*n*(((h*=1.525)+1)*n+h)+2)+s},easeInBounce:function(n,s,o,a){var h;return h=t.easeOutBounce(a-n,0,o,a),o-h+s},easeOutBounce:function(n,s,o,a){return(n/=a)<1/2.75?o*(7.5625*n*n)+s:n<2/2.75?o*(7.5625*(n-=1.5/2.75)*n+.75)+s:n<2.5/2.75?o*(7.5625*(n-=2.25/2.75)*n+.9375)+s:o*(7.5625*(n-=2.625/2.75)*n+.984375)+s},easeInOutBounce:function(n,s,o,a){var h;return n<a/2?(h=t.easeInBounce(n*2,0,o,a),h*.5+s):(h=t.easeOutBounce(n*2-a,0,o,a),h*.5+o*.5+s)}},i(t)}).call(sb)});function _s(r,e){if(r){if(typeof r=="function")return r;if(typeof r=="string")return Ff[r]}else return Ff[e]}const hb={removeOnInterrupt:!1,ease:"linear",time:1e3};class He extends he{__init(){this.startWidth=null}__init2(){this.startHeight=null}__init3(){this.deltaWidth=null}__init4(){this.deltaHeight=null}__init5(){this.width=null}__init6(){this.height=null}__init7(){this.time=0}constructor(e,t={}){super(e),He.prototype.__init.call(this),He.prototype.__init2.call(this),He.prototype.__init3.call(this),He.prototype.__init4.call(this),He.prototype.__init5.call(this),He.prototype.__init6.call(this),He.prototype.__init7.call(this),this.options=Object.assign({},hb,t),this.options.ease=_s(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(e){if(this.paused)return;this.time+=e;const t=new j(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,n=this.parent.height;this.complete(),(i!==this.parent.width||n!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:t,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const n=this.startWidth,s=this.deltaWidth;this.parent.fitWidth(n+s*i,this.keepCenter,this.height===null)}if(this.height!==null){const n=this.startHeight,s=this.deltaHeight;this.parent.fitHeight(n+s*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 n=this.startX,s=this.startY,o=this.deltaX,a=this.deltaY,h=new j(this.parent.x,this.parent.y);this.parent.moveCenter(n+o*i,s+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:t,type:"animate"})}}}function gs(r){let e,t=r[0],i=1;for(;i<r.length;){const n=r[i],s=r[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&t==null)return;n==="access"||n==="optionalAccess"?(e=t,t=s(t)):(n==="call"||n==="optionalCall")&&(t=s((...o)=>t.call(e,...o)),e=void 0)}return t}const ub={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class Lf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},ub,t),this.ease=_s(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(e){if(!this.paused){if(this.bounce(),this.toX){const t=this.toX;t.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),t.time>=this.options.time?(this.parent.x=t.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(t.time,t.start,t.delta,this.options.time)}if(this.toY){const t=this.toY;t.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),t.time>=this.options.time?(this.parent.y=t.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(t.time,t.start,t.delta,this.options.time)}}}calcUnderflowX(){let e;switch(this.underflowX){case-1:e=0;break;case 1:e=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:e=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return e}calcUnderflowY(){let e;switch(this.underflowY){case-1:e=0;break;case 1:e=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:e=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return e}oob(){const e=this.options.bounceBox;if(e){const t=typeof e.x>"u"?0:e.x,i=typeof e.y>"u"?0:e.y,n=typeof e.width>"u"?this.parent.worldWidth:e.width,s=typeof e.height>"u"?this.parent.worldHeight:e.height;return{left:this.parent.left<t,right:this.parent.right>n,top:this.parent.top<i,bottom:this.parent.bottom>s,topLeft:new j(t*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new j(n*this.parent.scale.x-this.parent.screenWidth,s*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 j(0,0),bottomRight:new j(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){if(this.paused)return;let e,t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.x&&t.percentChangeX===gs([t,"access",s=>s.options,"optionalAccess",s=>s.friction])||t.y&&t.percentChangeY===gs([t,"access",s=>s.options,"optionalAccess",s=>s.friction]))&&(e=this.oob(),(e.left&&this.left||e.right&&this.right)&&(t.percentChangeX=this.options.friction),(e.top&&this.top||e.bottom&&this.bottom)&&(t.percentChangeY=this.options.friction));const i=this.parent.plugins.get("drag",!0)||{},n=this.parent.plugins.get("pinch",!0)||{};if(t=t||{},!gs([i,"optionalAccess",s=>s.active])&&!gs([n,"optionalAccess",s=>s.active])&&(!this.toX||!this.toY)&&(!t.x||!t.y)){e=e||this.oob();const s=e.topLeft,o=e.bottomRight;if(!this.toX&&!t.x){let a=null;e.left&&this.left?a=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-s.x:e.right&&this.right&&(a=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-o.x),a!==null&&this.parent.x!==a&&(this.toX={time:0,start:this.parent.x,delta:a-this.parent.x,end:a},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!t.y){let a=null;e.top&&this.top?a=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-s.y:e.bottom&&this.bottom&&(a=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-o.y),a!==null&&this.parent.y!==a&&(this.toY={time:0,start:this.parent.y,delta:a-this.parent.y,end:a},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const lb={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class Bf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},lb,t),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 e=this.options.underflow.toLowerCase();e==="none"?this.noUnderflow=!0:e==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=e.indexOf("left")!==-1?-1:e.indexOf("right")!==-1?1:0,this.underflowY=e.indexOf("top")!==-1?-1:e.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 e={x:this.parent.x,y:this.parent.y},t=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,t.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,t.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:e,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,t.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,t.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:e,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 fb={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class Uf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},fb,t),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&e<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,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&e>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,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&t<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,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&t>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 e={x:null,y:null},t={x:null,y:null};if(typeof this.options.minScale=="number")e.x=this.options.minScale,e.y=this.options.minScale;else if(this.options.minScale!==null){const s=this.options.minScale;e.x=typeof s.x>"u"?null:s.x,e.y=typeof s.y>"u"?null:s.y}if(typeof this.options.maxScale=="number")t.x=this.options.maxScale,t.y=this.options.maxScale;else if(this.options.maxScale!==null){const s=this.options.maxScale;t.x=typeof s.x>"u"?null:s.x,t.y=typeof s.y>"u"?null:s.y}let i=this.parent.scale.x,n=this.parent.scale.y;e.x!==null&&i<e.x&&(i=e.x),t.x!==null&&i>t.x&&(i=t.x),e.y!==null&&n<e.y&&(n=e.y),t.y!==null&&n>t.y&&(n=t.y),(i!==this.parent.scale.x||n!==this.parent.scale.y)&&(this.parent.scale.set(i,n),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const cb={friction:.98,bounce:.8,minSpeed:.01},_i=16;class Gf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},cb,t),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.moved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const e=this.parent.input.count();return(e===1||e>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}moved(e){if(this.saved.length){const t=this.saved[this.saved.length-1];e.type==="clamp-x"?t.x===e.original.x&&(t.x=this.parent.x):e.type==="clamp-y"&&t.y===e.original.y&&(t.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const e=performance.now();for(const t of this.saved)if(t.time>=e-100){const i=e-t.time;this.x=(this.parent.x-t.x)/i,this.y=(this.parent.y-t.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(e){e=e||{},typeof e.x<"u"&&(this.x=e.x,this.percentChangeX=this.options.friction),typeof e.y<"u"&&(this.y=e.y,this.percentChangeY=this.options.friction)}update(e){if(this.paused)return;const t=this.x||this.y,i=this.timeSinceRelease,n=this.timeSinceRelease+e;if(this.x){const s=this.percentChangeX,o=Math.log(s);this.parent.x+=this.x*_i/o*(Math.pow(s,n/_i)-Math.pow(s,i/_i)),this.x*=Math.pow(this.percentChangeX,e/_i)}if(this.y){const s=this.percentChangeY,o=Math.log(s);this.parent.y+=this.y*_i/o*(Math.pow(s,n/_i)-Math.pow(s,i/_i)),this.y*=Math.pow(this.percentChangeY,e/_i)}this.timeSinceRelease+=e,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)),t&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const db={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 ms extends he{__init(){this.windowEventHandlers=new Array}constructor(e,t={}){super(e),ms.prototype.__init.call(this),this.options=Object.assign({},db,t),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(e){const t=n=>{e.includes(n.code)&&(this.keyIsPressed=!0)},i=n=>{e.includes(n.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",t)}addWindowEventHandler(e,t){window.addEventListener(e,t),this.windowEventHandlers.push({event:e,handler:t})}destroy(){this.windowEventHandlers.forEach(({event:e,handler:t})=>{window.removeEventListener(e,t)})}mouseButtons(e){!e||e==="all"?this.mouse=[!0,!0,!0]:this.mouse=[e.indexOf("left")!==-1,e.indexOf("middle")!==-1,e.indexOf("right")!==-1]}parseUnderflow(){const e=this.options.underflow.toLowerCase();e==="center"?(this.underflowX=0,this.underflowY=0):(e.includes("left")?this.underflowX=-1:e.includes("right")?this.underflowX=1:this.underflowX=0,e.includes("top")?this.underflowY=-1:e.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(e){const t=e.data.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!t||this.mouse[e.data.button]))}checkKeyPress(e){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&e.data.pointerType==="touch"}down(e){return this.paused||!this.options.pressDrag?!1:this.checkButtons(e)&&this.checkKeyPress(e)?(this.last={x:e.data.global.x,y:e.data.global.y},this.current=e.data.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(e){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===e.data.pointerId){const t=e.data.global.x,i=e.data.global.y,n=this.parent.input.count();if(n===1||n>1&&!this.parent.plugins.get("pinch",!0)){const s=t-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(s)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:t,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:e,screen:new j(this.last.x,this.last.y),world:this.parent.toWorld(new j(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(e){if(this.paused)return!1;const t=this.parent.input.touches;if(t.length===1){const i=t[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 j(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:e,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(e){if(this.paused)return!1;if(this.options.wheel){const t=this.parent.plugins.get("wheel",!0);if(!t||!t.options.wheelZoom&&!e.ctrlKey){const i=e.deltaMode?this.options.lineHeight:1,n=[e.deltaX,e.deltaY],[s,o]=this.options.wheelSwapAxes?n.reverse():n;return this.xDirection&&(this.parent.x+=s*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||e.preventDefault(),this.parent.options.stopPropagation&&e.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const e=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,e.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,e.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,e.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,e.y=0)}}const pb={speed:0,acceleration:null,radius:null};class kf extends he{constructor(e,t,i={}){super(e),this.target=t,this.options=Object.assign({},pb,i),this.velocity={x:0,y:0}}update(e){if(this.paused)return;const t=this.parent.center;let i=this.target.x,n=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-t.y,2)+Math.pow(this.target.x-t.x,2))>this.options.radius){const h=Math.atan2(this.target.y-t.y,this.target.x-t.x);i=this.target.x-Math.cos(h)*this.options.radius,n=this.target.y-Math.sin(h)*this.options.radius}else return;const s=i-t.x,o=n-t.y;if(s||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(n-t.y,i-t.x),h=Math.sqrt(Math.pow(s,2)+Math.pow(o,2));if(h){const u=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>u?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*e,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*e,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 l=Math.cos(a)*this.velocity.x,f=Math.sin(a)*this.velocity.y,c=Math.abs(l)>Math.abs(s)?i:t.x+l,d=Math.abs(f)>Math.abs(o)?n:t.y+f;this.parent.moveCenter(c,d),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(n-t.y,i-t.x),h=Math.cos(a)*this.options.speed,u=Math.sin(a)*this.options.speed,l=Math.abs(h)>Math.abs(s)?i:t.x+h,f=Math.abs(u)>Math.abs(o)?n:t.y+u;this.parent.moveCenter(l,f),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,n),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const vb={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class Xf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},vb,t),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 e=this.options.distance;e!==null?(this.left=e,this.top=e,this.right=this.parent.screenWidth-e,this.bottom=this.parent.screenHeight-e):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(e){if(this.paused||e.data.pointerType!=="mouse"&&e.data.identifier!==1||!this.options.allowButtons&&e.data.buttons!==0)return!1;const t=e.data.global.x,i=e.data.global.y;if(this.radiusSquared){const n=this.parent.toScreen(this.parent.center);if(Math.pow(n.x-t,2)+Math.pow(n.y-i,2)>=this.radiusSquared){const o=Math.atan2(n.y-i,n.x-t);this.options.linear?(this.horizontal=Math.round(Math.cos(o))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(o))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(o)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(o)*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&&t<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&t>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 e=this.parent.plugins.get("decelerate",!0);this.horizontal&&e&&!this.options.noDecelerate&&e.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const e=this.parent.plugins.get("decelerate",!0);this.vertical&&e&&!this.options.noDecelerate&&e.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 e=this.parent.center;this.horizontal&&(e.x+=this.horizontal*this.options.speed),this.vertical&&(e.y+=this.vertical*this.options.speed),this.parent.moveCenter(e),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const _b={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class vr extends he{__init(){this.active=!1}__init2(){this.pinching=!1}__init3(){this.moved=!1}constructor(e,t={}){super(e),vr.prototype.__init.call(this),vr.prototype.__init2.call(this),vr.prototype.__init3.call(this),this.options=Object.assign({},_b,t)}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(e){if(this.paused||!this.active)return!1;const t=e.data.global.x,i=e.data.global.y,n=this.parent.input.touches;if(n.length>=2){const s=n[0],o=n[1],a=s.last&&o.last?Math.sqrt(Math.pow(o.last.x-s.last.x,2)+Math.pow(o.last.y-s.last.y,2)):null;if(s.id===e.data.pointerId?s.last={x:t,y:i,data:e.data}:o.id===e.data.pointerId&&(o.last={x:t,y:i,data:e.data}),a){let h;const u={x:s.last.x+(o.last.x-s.last.x)/2,y:s.last.y+(o.last.y-s.last.y)/2};this.options.center||(h=this.parent.toLocal(u));let l=Math.sqrt(Math.pow(o.last.x-s.last.x,2)+Math.pow(o.last.y-s.last.y,2));l=l===0?l=1e-10:l;const f=(1-a/l)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=f),this.isAxisY()&&(this.parent.scale.y+=f),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:u});const c=this.parent.plugins.get("clamp-zoom",!0);if(c&&c.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const d=this.parent.toGlobal(h);this.parent.x+=(u.x-d.x)*this.options.factor,this.parent.y+=(u.y-d.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(u.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(u.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=u,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 gb={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class Hf extends he{constructor(e,t,i,n={}){super(e),this.options=Object.assign({},gb,n),this.ease=_s(n.ease,"easeInOutSine"),this.x=t,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const e=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-e.x,this.deltaY=this.y-e.y,this.startX=e.x,this.startY=e.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 e=this.parent.plugins.get("decelerate",!0);e&&(e.x||e.y)&&(e.percentChangeX=e.percentChangeY=this.options.friction)}return!1}update(e){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const t=this.snapping;t.time+=e;let i,n,s;const o=this.startX,a=this.startY,h=this.deltaX,u=this.deltaY;if(t.time>this.options.time)i=!0,n=o+h,s=a+u;else{const l=this.ease(t.time,0,1,this.options.time);n=o+h*l,s=a+u*l}this.options.topLeft?this.parent.moveCorner(n,s):this.parent.moveCenter(n,s),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 t=this.options.topLeft?this.parent.corner:this.parent.center;(t.x!==this.x||t.y!==this.y)&&this.snapStart()}}}const mb={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class Wf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},mb,t),this.ease=_s(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=e.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=e.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?(e.container.scale.x=this.xScale,e.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):t.forceStart&&this.createSnapping()}createSnapping(){const e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,n=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:e,startY:t,deltaX:i-e,deltaY:n-t},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(e){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let t;if(!this.options.center&&!this.options.noMove&&(t=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+=e,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 s=this.snapping,o=this.ease(s.time,s.startX,s.deltaX,this.options.time),a=this.ease(s.time,s.startY,s.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const n=this.parent.plugins.get("clamp-zoom",!0);n&&n.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(t))}}resume(){this.snapping=null,super.resume()}}const yb={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class zf extends he{constructor(e,t={}){super(e),this.options=Object.assign({},yb,t),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(e){window.addEventListener("keydown",t=>{e.includes(t.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",t=>{e.includes(t.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 e=this.smoothingCenter,t=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x+=t.x),this.isAxisY()&&(this.parent.scale.y+=t.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const n=this.parent.plugins.get("clamp-zoom",!0);if(n&&n.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const s=this.parent.toGlobal(i);this.parent.x+=e.x-s.x,this.parent.y+=e.y-s.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(e){if(this.paused)return;const t=this.parent.input.getPointerPosition(e),i=-e.deltaY*(e.deltaMode?this.options.lineHeight:1)/200,n=Math.pow(2,(1+this.options.percent)*i);let s;this.options.center||(s=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x*=n),this.isAxisY()&&(this.parent.scale.y*=n),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(s);this.parent.x+=t.x-a.x,this.parent.y+=t.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:e.deltaX,dy:e.deltaY,dz:e.deltaZ},event:e,viewport:this.parent})}wheel(e){if(this.paused||!this.checkKeyPress())return!1;if(e.ctrlKey&&this.options.trackpadPinch)this.pinch(e);else if(this.options.wheelZoom){const t=this.parent.input.getPointerPosition(e),n=(this.options.reverse?-1:1)*-e.deltaY*(e.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*n);if(this.options.smooth){const o={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+o.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+o.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=t}else{let o;this.options.center||(o=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const a=this.parent.plugins.get("clamp-zoom",!0);if(a&&a.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const h=this.parent.toGlobal(o);this.parent.x+=t.x-h.x,this.parent.y+=t.y-h.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:e.deltaX,dy:e.deltaY,dz:e.deltaZ},event:e,viewport:this.parent})}return!this.parent.options.passiveWheel}}class Yf{constructor(e){this.viewport=e,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new K(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,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.on("pointerout",this.up,this),this.wheelFunction=e=>this.handleWheel(e),this.viewport.options.divWheel.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.divWheel.removeEventListener("wheel",this.wheelFunction)}down(e){if(this.viewport.pause||!this.viewport.worldVisible)return;if(e.data.pointerType==="mouse"?this.isMouseDown=!0:this.get(e.data.pointerId)||this.touches.push({id:e.data.pointerId,last:null}),this.count()===1){this.last=e.data.global.clone();const i=this.viewport.plugins.get("decelerate",!0),n=this.viewport.plugins.get("bounce",!0);(!i||!i.isActive())&&(!n||!n.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(e)&&this.viewport.options.stopPropagation&&e.stopPropagation()}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(e){return Math.abs(e)>=this.viewport.threshold}move(e){if(this.viewport.pause||!this.viewport.worldVisible)return;const t=this.viewport.plugins.move(e);if(this.clickedAvailable&&this.last){const i=e.data.global.x-this.last.x,n=e.data.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(n))&&(this.clickedAvailable=!1)}t&&this.viewport.options.stopPropagation&&e.stopPropagation()}up(e){if(this.viewport.pause||!this.viewport.worldVisible)return;e.data.pointerType==="mouse"&&(this.isMouseDown=!1),e.data.pointerType!=="mouse"&&this.remove(e.data.pointerId);const t=this.viewport.plugins.up(e);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:e,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this}),this.clickedAvailable=!1),t&&this.viewport.options.stopPropagation&&e.stopPropagation()}getPointerPosition(e){const t=new j;if(this.viewport.options.interaction)this.viewport.options.interaction.mapPositionToPoint(t,e.clientX,e.clientY);else if(this.viewport.options.useDivWheelForInputManager&&this.viewport.options.divWheel){const i=this.viewport.options.divWheel.getBoundingClientRect();t.x=e.clientX-i.left,t.y=e.clientY-i.top}else t.x=e.clientX,t.y=e.clientY;return t}handleWheel(e){if(this.viewport.pause||!this.viewport.worldVisible||this.viewport.options.interaction&&this.viewport.options.interaction.interactionDOMElement!==e.target)return;const t=this.viewport.toLocal(this.getPointerPosition(e));this.viewport.left<=t.x&&t.x<=this.viewport.right&&this.viewport.top<=t.y&&t.y<=this.viewport.bottom&&this.viewport.plugins.wheel(e)&&!this.viewport.options.passiveWheel&&e.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(e){for(const t of this.touches)if(t.id===e)return t;return null}remove(e){for(let t=0;t<this.touches.length;t++)if(this.touches[t].id===e){this.touches.splice(t,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}function ys(r){let e,t=r[0],i=1;for(;i<r.length;){const n=r[i],s=r[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&t==null)return;n==="access"||n==="optionalAccess"?(e=t,t=s(t)):(n==="call"||n==="optionalCall")&&(t=s((...o)=>t.call(e,...o)),e=void 0)}return t}const nn=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class Vf{constructor(e){this.viewport=e,this.list=[],this.plugins={}}add(e,t,i=nn.length){const n=this.plugins[e];n&&n.destroy(),this.plugins[e]=t;const s=nn.indexOf(e);s!==-1&&nn.splice(s,1),nn.splice(i,0,e),this.sort()}get(e,t){return t&&ys([this,"access",i=>i.plugins,"access",i=>i[e],"optionalAccess",i=>i.paused])?null:this.plugins[e]}update(e){for(const t of this.list)t.update(e)}resize(){for(const e of this.list)e.resize()}reset(){for(const e of this.list)e.reset()}removeAll(){this.list.forEach(e=>{e.destroy()}),this.plugins={},this.sort()}remove(e){this.plugins[e]&&(ys([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.destroy,"call",t=>t()]),delete this.plugins[e],this.viewport.emit(`${e}-remove`),this.sort())}pause(e){ys([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.pause,"call",t=>t()])}resume(e){ys([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.resume,"call",t=>t()])}sort(){this.list=[];for(const e of nn)this.plugins[e]&&this.list.push(this.plugins[e])}down(e){let t=!1;for(const i of this.list)i.down(e)&&(t=!0);return t}move(e){let t=!1;for(const i of this.viewport.plugins.list)i.move(e)&&(t=!0);return t}up(e){let t=!1;for(const i of this.list)i.up(e)&&(t=!0);return t}wheel(e){let t=!1;for(const i of this.list)i.wheel(e)&&(t=!0);return t}}const xb={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,interaction:null,disableOnContextMenu:!1,ticker:Gt.shared};class Ya extends ot{__init(){this._disableOnContextMenu=e=>e.preventDefault()}constructor(e={}){super(),Ya.prototype.__init.call(this),this.options=Object.assign({},{divWheel:document.body},xb,e),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.divWheel=this.options.divWheel||document.body,this.options.disableOnContextMenu&&this.options.divWheel.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new Yf(this),this.plugins=new Vf(this)}destroy(e){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.divWheel.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(e)}update(e){this.pause||(this.plugins.update(e),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 K(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(e=window.innerWidth,t=window.innerHeight,i,n){this.screenWidth=e,this.screenHeight=t,typeof i<"u"&&(this._worldWidth=i),typeof n<"u"&&(this._worldHeight=n),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(e){this._worldWidth=e,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(e){this._worldHeight=e,this.plugins.resize()}getVisibleBounds(){return new K(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(e,t){return arguments.length===2?this.toLocal(new j(e,t)):this.toLocal(e)}toScreen(e,t){return arguments.length===2?this.toGlobal(new j(e,t)):this.toGlobal(e)}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 j(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(e){this.moveCenter(e)}moveCenter(...e){let t,i;typeof e[0]=="number"?(t=e[0],i=e[1]):(t=e[0].x,i=e[0].y);const n=(this.worldScreenWidth/2-t)*this.scale.x,s=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==n||this.y!==s)&&(this.position.set(n,s),this.plugins.reset(),this.dirty=!0),this}get corner(){return new j(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(e){this.moveCorner(e)}moveCorner(...e){let t,i;return e.length===1?(t=-e[0].x*this.scale.x,i=-e[0].y*this.scale.y):(t=-e[0]*this.scale.x,i=-e[1]*this.scale.y),(t!==this.x||i!==this.y)&&(this.position.set(t,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(e){return this.screenWidth/e}findFitHeight(e){return this.screenHeight/e}findFit(e,t){const i=this.screenWidth/e,n=this.screenHeight/t;return Math.min(i,n)}findCover(e,t){const i=this.screenWidth/e,n=this.screenHeight/t;return Math.max(i,n)}fitWidth(e=this.worldWidth,t,i=!0,n){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!n&&o&&o.clamp(),t&&s&&this.moveCenter(s),this}fitHeight(e=this.worldHeight,t,i=!0,n){let s;t&&(s=this.center),this.scale.y=this.screenHeight/e,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!n&&o&&o.clamp(),t&&s&&this.moveCenter(s),this}fitWorld(e){let t;e&&(t=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(),e&&t&&this.moveCenter(t),this}fit(e,t=this.worldWidth,i=this.worldHeight){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,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 s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&n&&this.moveCenter(n),this}setZoom(e,t){let i;t&&(i=this.center),this.scale.set(e);const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&i&&this.moveCenter(i),this}zoomPercent(e,t){return this.setZoom(this.scale.x+this.scale.x*e,t)}zoom(e,t){return this.fitWidth(e+this.worldScreenWidth,t),this}get scaled(){return this.scale.x}set scaled(e){this.setZoom(e,!0)}snapZoom(e){return this.plugins.add("snap-zoom",new Wf(this,e)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new j(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(e){this.x=-e*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(e){this.x=-e*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(e){this.y=-e*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(e){this.y=-e*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(e){this._dirty=e}get forceHitArea(){return this._forceHitArea}set forceHitArea(e){e?(this._forceHitArea=e,this.hitArea=e):(this._forceHitArea=null,this.hitArea=new K(0,0,this.worldWidth,this.worldHeight))}drag(e){return this.plugins.add("drag",new ms(this,e)),this}clamp(e){return this.plugins.add("clamp",new Bf(this,e)),this}decelerate(e){return this.plugins.add("decelerate",new Gf(this,e)),this}bounce(e){return this.plugins.add("bounce",new Lf(this,e)),this}pinch(e){return this.plugins.add("pinch",new vr(this,e)),this}snap(e,t,i){return this.plugins.add("snap",new Hf(this,e,t,i)),this}follow(e,t){return this.plugins.add("follow",new kf(this,e,t)),this}wheel(e){return this.plugins.add("wheel",new zf(this,e)),this}animate(e){return this.plugins.add("animate",new He(this,e)),this}clampZoom(e){return this.plugins.add("clamp-zoom",new Uf(this,e)),this}mouseEdges(e){return this.plugins.add("mouse-edges",new Xf(this,e)),this}get pause(){return!!this._pause}set pause(e){this._pause=e,this.lastViewport=null,this.moving=!1,this.zooming=!1,e&&this.input.pause()}ensureVisible(e,t,i,n,s){s&&(i>this.worldScreenWidth||n>this.worldScreenHeight)&&(this.fit(!0,i,n),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;e<this.left?(this.left=e,o=!0):e+i>this.right&&(this.right=e+i,o=!0),t<this.top?(this.top=t,o=!0):t+n>this.bottom&&(this.bottom=t+n,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}const bb=Object.freeze(Object.defineProperty({__proto__:null,Animate:He,Bounce:Lf,Clamp:Bf,ClampZoom:Uf,Decelerate:Gf,Drag:ms,Follow:kf,InputManager:Yf,MouseEdges:Xf,Pinch:vr,Plugin:he,PluginManager:Vf,Snap:Hf,SnapZoom:Wf,Viewport:Ya,Wheel:zf},Symbol.toStringTag,{value:"Module"}));Zt.FlowRunTimeline=nb,Zt.formatDateFnsDefault=Mf,Zt.nodeThemeFnDefault=Nf,Object.defineProperty(Zt,Symbol.toStringTag,{value:"Module"})});
1577
1577
  //# sourceMappingURL=graphs.umd.js.map