@prefecthq/graphs 0.1.5 → 0.1.6

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.
@@ -1,4 +1,4 @@
1
- (function(Ct,et){typeof exports=="object"&&typeof module<"u"?et(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],et):(Ct=typeof globalThis<"u"?globalThis:Ct||self,et(Ct["prefect-graphs"]={},Ct.Vue))})(this,function(Ct,et){"use strict";var Yv=Object.defineProperty;var Vv=(Ct,et,Ht)=>et in Ct?Yv(Ct,et,{enumerable:!0,configurable:!0,writable:!0,value:Ht}):Ct[et]=Ht;var ne=(Ct,et,Ht)=>(Vv(Ct,typeof et!="symbol"?et+"":et,Ht),Ht);var Ht=Math.PI*2,ra=180/Math.PI,na=Math.PI/180,yt;(function(r){r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC"})(yt||(yt={}));var X=function(){function r(e,t){e===void 0&&(e=0),t===void 0&&(t=0),this.x=0,this.y=0,this.x=e,this.y=t}return r.prototype.clone=function(){return new r(this.x,this.y)},r.prototype.copyFrom=function(e){return this.set(e.x,e.y),this},r.prototype.copyTo=function(e){return e.set(this.x,this.y),e},r.prototype.equals=function(e){return e.x===this.x&&e.y===this.y},r.prototype.set=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),this.x=e,this.y=t,this},r.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},r}(),mi=[new X,new X,new X,new X],j=function(){function r(e,t,i,n){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=0),this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(n),this.type=yt.RECT}return Object.defineProperty(r.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(r,"EMPTY",{get:function(){return new r(0,0,0,0)},enumerable:!1,configurable:!0}),r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this},r.prototype.copyTo=function(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},r.prototype.contains=function(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height},r.prototype.intersects=function(e,t){if(!t){var i=this.x<e.x?e.x:this.x,n=this.right>e.right?e.right:this.right;if(n<=i)return!1;var s=this.y<e.y?e.y:this.y,o=this.bottom>e.bottom?e.bottom:this.bottom;return o>s}var a=this.left,h=this.right,u=this.top,l=this.bottom;if(h<=a||l<=u)return!1;var f=mi[0].set(e.left,e.top),c=mi[1].set(e.left,e.bottom),d=mi[2].set(e.right,e.top),p=mi[3].set(e.right,e.bottom);if(d.x<=f.x||c.y<=f.y)return!1;var v=Math.sign(t.a*t.d-t.b*t.c);if(v===0||(t.apply(f,f),t.apply(c,c),t.apply(d,d),t.apply(p,p),Math.max(f.x,c.x,d.x,p.x)<=a||Math.min(f.x,c.x,d.x,p.x)>=h||Math.max(f.y,c.y,d.y,p.y)<=u||Math.min(f.y,c.y,d.y,p.y)>=l))return!1;var _=v*(c.y-f.y),m=v*(f.x-c.x),y=_*a+m*u,g=_*h+m*u,b=_*a+m*l,x=_*h+m*l;if(Math.max(y,g,b,x)<=_*f.x+m*f.y||Math.min(y,g,b,x)>=_*p.x+m*p.y)return!1;var T=v*(f.y-d.y),w=v*(d.x-f.x),I=T*a+w*u,S=T*h+w*u,P=T*a+w*l,E=T*h+w*l;return!(Math.max(I,S,P,E)<=T*f.x+w*f.y||Math.min(I,S,P,E)>=T*p.x+w*p.y)},r.prototype.pad=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this},r.prototype.fit=function(e){var t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),s=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=n,this.height=Math.max(s-n,0),this},r.prototype.ceil=function(e,t){e===void 0&&(e=1),t===void 0&&(t=.001);var i=Math.ceil((this.x+this.width-t)*e)/e,n=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=n-this.y,this},r.prototype.enlarge=function(e){var t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),s=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=n,this.height=s-n,this},r.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),sa=function(){function r(e,t,i){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),this.x=e,this.y=t,this.radius=i,this.type=yt.CIRC}return r.prototype.clone=function(){return new r(this.x,this.y,this.radius)},r.prototype.contains=function(e,t){if(this.radius<=0)return!1;var i=this.radius*this.radius,n=this.x-e,s=this.y-t;return n*=n,s*=s,n+s<=i},r.prototype.getBounds=function(){return new j(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)},r.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"},r}(),oa=function(){function r(e,t,i,n){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=0),this.x=e,this.y=t,this.width=i,this.height=n,this.type=yt.ELIP}return r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;var i=(e-this.x)/this.width,n=(t-this.y)/this.height;return i*=i,n*=n,i+n<=1},r.prototype.getBounds=function(){return new j(this.x-this.width,this.y-this.height,this.width,this.height)},r.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),gi=function(){function r(){for(var e=arguments,t=[],i=0;i<arguments.length;i++)t[i]=e[i];var n=Array.isArray(t[0])?t[0]:t;if(typeof n[0]!="number"){for(var s=[],o=0,a=n.length;o<a;o++)s.push(n[o].x,n[o].y);n=s}this.points=n,this.type=yt.POLY,this.closeStroke=!0}return r.prototype.clone=function(){var e=this.points.slice(),t=new r(e);return t.closeStroke=this.closeStroke,t},r.prototype.contains=function(e,t){for(var i=!1,n=this.points.length/2,s=0,o=n-1;s<n;o=s++){var a=this.points[s*2],h=this.points[s*2+1],u=this.points[o*2],l=this.points[o*2+1],f=h>t!=l>t&&e<(u-a)*((t-h)/(l-h))+a;f&&(i=!i)}return i},r.prototype.toString=function(){return"[@pixi/math:Polygon"+("closeStroke="+this.closeStroke)+("points="+this.points.reduce(function(e,t){return e+", "+t},"")+"]")},r}(),aa=function(){function r(e,t,i,n,s){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=0),s===void 0&&(s=20),this.x=e,this.y=t,this.width=i,this.height=n,this.radius=s,this.type=yt.RREC}return r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height,this.radius)},r.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){var i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;var n=e-(this.x+i),s=t-(this.y+i),o=i*i;if(n*n+s*s<=o||(n=e-(this.x+this.width-i),n*n+s*s<=o)||(s=t-(this.y+this.height-i),n*n+s*s<=o)||(n=e-(this.x+i),n*n+s*s<=o))return!0}return!1},r.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+("width="+this.width+" height="+this.height+" radius="+this.radius+"]")},r}(),Ie=function(){function r(e,t,i,n){i===void 0&&(i=0),n===void 0&&(n=0),this._x=i,this._y=n,this.cb=e,this.scope=t}return r.prototype.clone=function(e,t){return e===void 0&&(e=this.cb),t===void 0&&(t=this.scope),new r(e,t,this._x,this._y)},r.prototype.set=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this},r.prototype.copyFrom=function(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this},r.prototype.copyTo=function(e){return e.set(this._x,this._y),e},r.prototype.equals=function(e){return e.x===this._x&&e.y===this._y},r.prototype.toString=function(){return"[@pixi/math:ObservablePoint x="+0+" y="+0+" scope="+this.scope+"]"},Object.defineProperty(r.prototype,"x",{get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"y",{get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),r}(),mt=function(){function r(e,t,i,n,s,o){e===void 0&&(e=1),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=0),o===void 0&&(o=0),this.array=null,this.a=e,this.b=t,this.c=i,this.d=n,this.tx=s,this.ty=o}return r.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},r.prototype.set=function(e,t,i,n,s,o){return this.a=e,this.b=t,this.c=i,this.d=n,this.tx=s,this.ty=o,this},r.prototype.toArray=function(e,t){this.array||(this.array=new Float32Array(9));var i=t||this.array;return e?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i},r.prototype.apply=function(e,t){t=t||new X;var i=e.x,n=e.y;return t.x=this.a*i+this.c*n+this.tx,t.y=this.b*i+this.d*n+this.ty,t},r.prototype.applyInverse=function(e,t){t=t||new X;var i=1/(this.a*this.d+this.c*-this.b),n=e.x,s=e.y;return t.x=this.d*i*n+-this.c*i*s+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*s+-this.b*i*n+(-this.ty*this.a+this.tx*this.b)*i,t},r.prototype.translate=function(e,t){return this.tx+=e,this.ty+=t,this},r.prototype.scale=function(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this},r.prototype.rotate=function(e){var t=Math.cos(e),i=Math.sin(e),n=this.a,s=this.c,o=this.tx;return this.a=n*t-this.b*i,this.b=n*i+this.b*t,this.c=s*t-this.d*i,this.d=s*i+this.d*t,this.tx=o*t-this.ty*i,this.ty=o*i+this.ty*t,this},r.prototype.append=function(e){var t=this.a,i=this.b,n=this.c,s=this.d;return this.a=e.a*t+e.b*n,this.b=e.a*i+e.b*s,this.c=e.c*t+e.d*n,this.d=e.c*i+e.d*s,this.tx=e.tx*t+e.ty*n+this.tx,this.ty=e.tx*i+e.ty*s+this.ty,this},r.prototype.setTransform=function(e,t,i,n,s,o,a,h,u){return this.a=Math.cos(a+u)*s,this.b=Math.sin(a+u)*s,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=e-(i*this.a+n*this.c),this.ty=t-(i*this.b+n*this.d),this},r.prototype.prepend=function(e){var t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){var i=this.a,n=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this},r.prototype.decompose=function(e){var t=this.a,i=this.b,n=this.c,s=this.d,o=e.pivot,a=-Math.atan2(-n,s),h=Math.atan2(i,t),u=Math.abs(a+h);return u<1e-5||Math.abs(Ht-u)<1e-5?(e.rotation=h,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=h),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(n*n+s*s),e.position.x=this.tx+(o.x*t+o.y*n),e.position.y=this.ty+(o.x*i+o.y*s),e},r.prototype.invert=function(){var e=this.a,t=this.b,i=this.c,n=this.d,s=this.tx,o=e*n-t*i;return this.a=n/o,this.b=-t/o,this.c=-i/o,this.d=e/o,this.tx=(i*this.ty-n*s)/o,this.ty=-(e*this.ty-t*s)/o,this},r.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},r.prototype.clone=function(){var e=new r;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyTo=function(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyFrom=function(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this},r.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(r,"IDENTITY",{get:function(){return new r},enumerable:!1,configurable:!0}),Object.defineProperty(r,"TEMP_MATRIX",{get:function(){return new r},enumerable:!1,configurable:!0}),r}(),fe=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ce=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],de=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],pe=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],lr=[],Gn=[],yi=Math.sign;function ha(){for(var r=0;r<16;r++){var e=[];lr.push(e);for(var t=0;t<16;t++)for(var i=yi(fe[r]*fe[t]+de[r]*ce[t]),n=yi(ce[r]*fe[t]+pe[r]*ce[t]),s=yi(fe[r]*de[t]+de[r]*pe[t]),o=yi(ce[r]*de[t]+pe[r]*pe[t]),a=0;a<16;a++)if(fe[a]===i&&ce[a]===n&&de[a]===s&&pe[a]===o){e.push(a);break}}for(var r=0;r<16;r++){var h=new mt;h.set(fe[r],ce[r],de[r],pe[r],0,0),Gn.push(h)}}ha();var at={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(r){return fe[r]},uY:function(r){return ce[r]},vX:function(r){return de[r]},vY:function(r){return pe[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,e){return lr[r][e]},sub:function(r,e){return lr[r][at.inv(e)]},rotate180:function(r){return r^4},isVertical:function(r){return(r&3)===2},byDirection:function(r,e){return Math.abs(r)*2<=Math.abs(e)?e>=0?at.S:at.N:Math.abs(e)*2<=Math.abs(r)?r>0?at.E:at.W:e>0?r>0?at.SE:at.SW:r>0?at.NE:at.NW},matrixAppendRotationInv:function(r,e,t,i){t===void 0&&(t=0),i===void 0&&(i=0);var n=Gn[at.inv(e)];n.tx=t,n.ty=i,r.append(n)}},kn=function(){function r(){this.worldTransform=new mt,this.localTransform=new mt,this.position=new Ie(this.onChange,this,0,0),this.scale=new Ie(this.onChange,this,1,1),this.pivot=new Ie(this.onChange,this,0,0),this.skew=new Ie(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return r.prototype.onChange=function(){this._localID++},r.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},r.prototype.toString=function(){return"[@pixi/math:Transform "+("position=("+this.position.x+", "+this.position.y+") ")+("rotation="+this.rotation+" ")+("scale=("+this.scale.x+", "+this.scale.y+") ")+("skew=("+this.skew.x+", "+this.skew.y+") ")+"]"},r.prototype.updateLocalTransform=function(){var e=this.localTransform;this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1)},r.prototype.updateTransform=function(e){var t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==e._worldID){var i=e.worldTransform,n=this.worldTransform;n.a=t.a*i.a+t.b*i.c,n.b=t.a*i.b+t.b*i.d,n.c=t.c*i.a+t.d*i.c,n.d=t.c*i.b+t.d*i.d,n.tx=t.tx*i.a+t.ty*i.c+i.tx,n.ty=t.tx*i.b+t.ty*i.d+i.ty,this._parentID=e._worldID,this._worldID++}},r.prototype.setFromMatrix=function(e){e.decompose(this),this._localID++},Object.defineProperty(r.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,this.updateSkew())},enumerable:!1,configurable:!0}),r.IDENTITY=new r,r}();const ve=new j;class ua{constructor(e={}){this._recursive=typeof e.recursive=="boolean"?e.recursive:!0,this._toggle=e.toggle||"visible",this._targetList=new Set}add(e){return this._targetList.add(e),this}addAll(e){for(let t=0,i=e.length;t<i;t++)this._targetList.add(e[t]);return this}remove(e){return this._targetList.delete(e),this}removeAll(e){for(let t=0,i=e.length;t<i;t++)this._targetList.delete(e[t]);return this}clear(){return this._targetList.clear(),this}cull(e,t=!1){return t||this.uncull(),this._targetList.forEach(i=>{t||i.getBounds(!1,ve),this._recursive?this.cullRecursive(e,i,t):(t&&i._bounds.getRectangle(e),i[this._toggle]=ve.right>e.left&&ve.left<e.right&&ve.bottom>e.top&&ve.top<e.bottom)}),this}uncull(){return this._targetList.forEach(e=>{this._recursive?this.uncullRecursive(e):e[this._toggle]=!1}),this}cullRecursive(e,t,i){const n=i?t._bounds.getRectangle(ve):t.getBounds(!0,ve);if(t[this._toggle]=n.right>e.left&&n.left<e.right&&n.bottom>e.top&&n.top<e.bottom,!(n.left>=e.left&&n.top>=e.top&&n.right<=e.right&&n.bottom<=e.bottom)&&t[this._toggle]&&t.children&&t.children.length){const o=t.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(e,o[a])}}uncullRecursive(e){if(e[this._toggle]=!0,e.children&&e.children.length){const t=e.children;for(let i=0,n=t.length;i<n;i++)this.uncullRecursive(t[i])}}}function la(r){var e=this.constructor;return this.then(function(t){return e.resolve(r()).then(function(){return t})},function(t){return e.resolve(r()).then(function(){return e.reject(t)})})}function fa(r){var e=this;return new e(function(t,i){if(!(r&&typeof r.length<"u"))return i(new TypeError(typeof r+" "+r+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var n=Array.prototype.slice.call(r);if(n.length===0)return t([]);var s=n.length;function o(h,u){if(u&&(typeof u=="object"||typeof u=="function")){var l=u.then;if(typeof l=="function"){l.call(u,function(f){o(h,f)},function(f){n[h]={status:"rejected",reason:f},--s===0&&t(n)});return}}n[h]={status:"fulfilled",value:u},--s===0&&t(n)}for(var a=0;a<n.length;a++)o(a,n[a])})}var ca=setTimeout;function Hn(r){return Boolean(r&&typeof r.length<"u")}function da(){}function pa(r,e){return function(){r.apply(e,arguments)}}function lt(r){if(!(this instanceof lt))throw new TypeError("Promises must be constructed via new");if(typeof r!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],Wn(r,this)}function Xn(r,e){for(;r._state===3;)r=r._value;if(r._state===0){r._deferreds.push(e);return}r._handled=!0,lt._immediateFn(function(){var t=r._state===1?e.onFulfilled:e.onRejected;if(t===null){(r._state===1?fr:We)(e.promise,r._value);return}var i;try{i=t(r._value)}catch(n){We(e.promise,n);return}fr(e.promise,i)})}function fr(r,e){try{if(e===r)throw new TypeError("A promise cannot be resolved with itself.");if(e&&(typeof e=="object"||typeof e=="function")){var t=e.then;if(e instanceof lt){r._state=3,r._value=e,cr(r);return}else if(typeof t=="function"){Wn(pa(t,e),r);return}}r._state=1,r._value=e,cr(r)}catch(i){We(r,i)}}function We(r,e){r._state=2,r._value=e,cr(r)}function cr(r){r._state===2&&r._deferreds.length===0&&lt._immediateFn(function(){r._handled||lt._unhandledRejectionFn(r._value)});for(var e=0,t=r._deferreds.length;e<t;e++)Xn(r,r._deferreds[e]);r._deferreds=null}function va(r,e,t){this.onFulfilled=typeof r=="function"?r:null,this.onRejected=typeof e=="function"?e:null,this.promise=t}function Wn(r,e){var t=!1;try{r(function(i){t||(t=!0,fr(e,i))},function(i){t||(t=!0,We(e,i))})}catch(i){if(t)return;t=!0,We(e,i)}}lt.prototype.catch=function(r){return this.then(null,r)},lt.prototype.then=function(r,e){var t=new this.constructor(da);return Xn(this,new va(r,e,t)),t},lt.prototype.finally=la,lt.all=function(r){return new lt(function(e,t){if(!Hn(r))return t(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(r);if(i.length===0)return e([]);var n=i.length;function s(a,h){try{if(h&&(typeof h=="object"||typeof h=="function")){var u=h.then;if(typeof u=="function"){u.call(h,function(l){s(a,l)},t);return}}i[a]=h,--n===0&&e(i)}catch(l){t(l)}}for(var o=0;o<i.length;o++)s(o,i[o])})},lt.allSettled=fa,lt.resolve=function(r){return r&&typeof r=="object"&&r.constructor===lt?r:new lt(function(e){e(r)})},lt.reject=function(r){return new lt(function(e,t){t(r)})},lt.race=function(r){return new lt(function(e,t){if(!Hn(r))return t(new TypeError("Promise.race accepts an array"));for(var i=0,n=r.length;i<n;i++)lt.resolve(r[i]).then(e,t)})},lt._immediateFn=typeof setImmediate=="function"&&function(r){setImmediate(r)}||function(r){ca(r,0)},lt._unhandledRejectionFn=function(e){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};var jn=Object.getOwnPropertySymbols,_a=Object.prototype.hasOwnProperty,ma=Object.prototype.propertyIsEnumerable;function ga(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function ya(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var e={},t=0;t<10;t++)e["_"+String.fromCharCode(t)]=t;var i=Object.getOwnPropertyNames(e).map(function(s){return e[s]});if(i.join("")!=="0123456789")return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(s){n[s]=s}),Object.keys(Object.assign({},n)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var xa=ya()?Object.assign:function(r,e){for(var t,i=ga(r),n,s=1;s<arguments.length;s++){t=Object(arguments[s]);for(var o in t)_a.call(t,o)&&(i[o]=t[o]);if(jn){n=jn(t);for(var a=0;a<n.length;a++)ma.call(t,n[a])&&(i[n[a]]=t[n[a]])}}return i};typeof globalThis>"u"&&(typeof self<"u"?self.globalThis=self:typeof global<"u"&&(global.globalThis=global)),globalThis.Promise||(globalThis.Promise=lt),Object.assign||(Object.assign=xa);var ba=16;if(Date.now&&Date.prototype.getTime||(Date.now=function(){return new Date().getTime()}),!(globalThis.performance&&globalThis.performance.now)){var Ta=Date.now();globalThis.performance||(globalThis.performance={}),globalThis.performance.now=function(){return Date.now()-Ta}}for(var pr=Date.now(),zn=["ms","moz","webkit","o"],vr=0;vr<zn.length&&!globalThis.requestAnimationFrame;++vr){var _r=zn[vr];globalThis.requestAnimationFrame=globalThis[_r+"RequestAnimationFrame"],globalThis.cancelAnimationFrame=globalThis[_r+"CancelAnimationFrame"]||globalThis[_r+"CancelRequestAnimationFrame"]}globalThis.requestAnimationFrame||(globalThis.requestAnimationFrame=function(r){if(typeof r!="function")throw new TypeError(r+"is not a function");var e=Date.now(),t=ba+pr-e;return t<0&&(t=0),pr=e,globalThis.self.setTimeout(function(){pr=Date.now(),r(performance.now())},t)}),globalThis.cancelAnimationFrame||(globalThis.cancelAnimationFrame=function(r){return clearTimeout(r)}),Math.sign||(Math.sign=function(e){return e=Number(e),e===0||isNaN(e)?e:e>0?1:-1}),Number.isInteger||(Number.isInteger=function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e}),globalThis.ArrayBuffer||(globalThis.ArrayBuffer=Array),globalThis.Float32Array||(globalThis.Float32Array=Array),globalThis.Uint32Array||(globalThis.Uint32Array=Array),globalThis.Uint16Array||(globalThis.Uint16Array=Array),globalThis.Uint8Array||(globalThis.Uint8Array=Array),globalThis.Int32Array||(globalThis.Int32Array=Array);var $t;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})($t||($t={}));var je;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(je||(je={}));var xi;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(xi||(xi={}));var U;(function(r){r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR"})(U||(U={}));var It;(function(r){r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(It||(It={}));var A;(function(r){r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL"})(A||(A={}));var _e;(function(r){r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"})(_e||(_e={}));var L;(function(r){r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT"})(L||(L={}));var bi;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(bi||(bi={}));var Xt;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(Xt||(Xt={}));var Wt;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(Wt||(Wt={}));var Ot;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(Ot||(Ot={}));var Mt;(function(r){r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"})(Mt||(Mt={}));var Dt;(function(r){r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT"})(Dt||(Dt={}));var Ti;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(Ti||(Ti={}));var At;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(At||(At={}));var _t;(function(r){r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR"})(_t||(_t={}));var Yn;(function(r){r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA"})(Yn||(Yn={}));var ft;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(ft||(ft={}));var jt;(function(r){r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"})(jt||(jt={}));var wa={createCanvas:function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,t},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var r;return(r=document.baseURI)!==null&&r!==void 0?r:window.location.href},fetch:function(r,e){return fetch(r,e)}},mr=/iPhone/i,Vn=/iPod/i,qn=/iPad/i,$n=/\biOS-universal(?:.+)Mac\b/i,gr=/\bAndroid(?:.+)Mobile\b/i,Zn=/Android/i,Oe=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,wi=/Silk/i,Zt=/Windows Phone/i,Kn=/\bWindows(?:.+)ARM\b/i,Qn=/BlackBerry/i,Jn=/BB10/i,ts=/Opera Mini/i,es=/\b(CriOS|Chrome)(?:.+)Mobile/i,is=/Mobile(?:.+)Firefox\b/i,rs=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function Ea(r){return function(e){return e.test(r)}}function Sa(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=Ea(t),s={apple:{phone:n(mr)&&!n(Zt),ipod:n(Vn),tablet:!n(mr)&&(n(qn)||rs(e))&&!n(Zt),universal:n($n),device:(n(mr)||n(Vn)||n(qn)||n($n)||rs(e))&&!n(Zt)},amazon:{phone:n(Oe),tablet:!n(Oe)&&n(wi),device:n(Oe)||n(wi)},android:{phone:!n(Zt)&&n(Oe)||!n(Zt)&&n(gr),tablet:!n(Zt)&&!n(Oe)&&!n(gr)&&(n(wi)||n(Zn)),device:!n(Zt)&&(n(Oe)||n(wi)||n(gr)||n(Zn))||n(/\bokhttp\b/i)},windows:{phone:n(Zt),tablet:n(Kn),device:n(Zt)||n(Kn)},other:{blackberry:n(Qn),blackberry10:n(Jn),opera:n(ts),firefox:n(is),chrome:n(es),device:n(Qn)||n(Jn)||n(ts)||n(is)||n(es)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var zt=Sa(globalThis.navigator);function Pa(){return!zt.apple.device}function Ca(r){var e=!0;if(zt.tablet||zt.phone){if(zt.apple.device){var t=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(t){var i=parseInt(t[1],10);i<11&&(e=!1)}}if(zt.android.device){var t=navigator.userAgent.match(/Android\s([0-9.]*)/);if(t){var i=parseInt(t[1],10);i<7&&(e=!1)}}}return e?r:4}var F={ADAPTER:wa,MIPMAP_TEXTURES:Ot.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:ft.NONE,SPRITE_MAX_TEXTURES:Ca(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:Ti.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:Wt.CLAMP,SCALE_MODE:Xt.LINEAR,PRECISION_VERTEX:At.HIGH,PRECISION_FRAGMENT:zt.apple.device?At.HIGH:At.MEDIUM,CAN_UPLOAD_SAME_BUFFER:Pa(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},ns={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(h,u,l){this.fn=h,this.context=u,this.once=l||!1}function s(h,u,l,f,c){if(typeof l!="function")throw new TypeError("The listener must be a function");var d=new n(l,f||h,c),p=t?t+u:u;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],d]:h._events[p].push(d):(h._events[p]=d,h._eventsCount++),h}function o(h,u){--h._eventsCount===0?h._events=new i:delete h._events[u]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],l,f;if(this._eventsCount===0)return u;for(f in l=this._events)e.call(l,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},a.prototype.listeners=function(u){var l=t?t+u:u,f=this._events[l];if(!f)return[];if(f.fn)return[f.fn];for(var c=0,d=f.length,p=new Array(d);c<d;c++)p[c]=f[c].fn;return p},a.prototype.listenerCount=function(u){var l=t?t+u:u,f=this._events[l];return f?f.fn?1:f.length:0},a.prototype.emit=function(u,l,f,c,d,p){var v=t?t+u:u;if(!this._events[v])return!1;var _=this._events[v],m=arguments.length,y,g;if(_.fn){switch(_.once&&this.removeListener(u,_.fn,void 0,!0),m){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,l),!0;case 3:return _.fn.call(_.context,l,f),!0;case 4:return _.fn.call(_.context,l,f,c),!0;case 5:return _.fn.call(_.context,l,f,c,d),!0;case 6:return _.fn.call(_.context,l,f,c,d,p),!0}for(g=1,y=new Array(m-1);g<m;g++)y[g-1]=arguments[g];_.fn.apply(_.context,y)}else{var b=_.length,x;for(g=0;g<b;g++)switch(_[g].once&&this.removeListener(u,_[g].fn,void 0,!0),m){case 1:_[g].fn.call(_[g].context);break;case 2:_[g].fn.call(_[g].context,l);break;case 3:_[g].fn.call(_[g].context,l,f);break;case 4:_[g].fn.call(_[g].context,l,f,c);break;default:if(!y)for(x=1,y=new Array(m-1);x<m;x++)y[x-1]=arguments[x];_[g].fn.apply(_[g].context,y)}}return!0},a.prototype.on=function(u,l,f){return s(this,u,l,f,!1)},a.prototype.once=function(u,l,f){return s(this,u,l,f,!0)},a.prototype.removeListener=function(u,l,f,c){var d=t?t+u:u;if(!this._events[d])return this;if(!l)return o(this,d),this;var p=this._events[d];if(p.fn)p.fn===l&&(!c||p.once)&&(!f||p.context===f)&&o(this,d);else{for(var v=0,_=[],m=p.length;v<m;v++)(p[v].fn!==l||c&&!p[v].once||f&&p[v].context!==f)&&_.push(p[v]);_.length?this._events[d]=_.length===1?_[0]:_:o(this,d)}return this},a.prototype.removeAllListeners=function(u){var l;return u?(l=t?t+u:u,this._events[l]&&o(this,l)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,r.exports=a})(ns);const ze=ns.exports;var Ei={exports:{}};Ei.exports=Si,Ei.exports.default=Si;function Si(r,e,t){t=t||2;var i=e&&e.length,n=i?e[0]*t:r.length,s=ss(r,0,n,t,!0),o=[];if(!s||s.next===s.prev)return o;var a,h,u,l,f,c,d;if(i&&(s=Ma(r,e,s,t)),r.length>80*t){a=u=r[0],h=l=r[1];for(var p=t;p<n;p+=t)f=r[p],c=r[p+1],f<a&&(a=f),c<h&&(h=c),f>u&&(u=f),c>l&&(l=c);d=Math.max(u-a,l-h),d=d!==0?32767/d:0}return Ye(s,o,t,a,h,d,0),o}function ss(r,e,t,i,n){var s,o;if(n===br(r,e,t,i)>0)for(s=e;s<t;s+=i)o=hs(s,r[s],r[s+1],o);else for(s=t-i;s>=e;s-=i)o=hs(s,r[s],r[s+1],o);return o&&Pi(o,o.next)&&(qe(o),o=o.next),o}function me(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(Pi(t,t.next)||ht(t.prev,t,t.next)===0)){if(qe(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Ye(r,e,t,i,n,s,o){if(r){!o&&s&&La(r,i,n,s);for(var a=r,h,u;r.prev!==r.next;){if(h=r.prev,u=r.next,s?Ra(r,i,n,s):Aa(r)){e.push(h.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),qe(r),r=u.next,a=u.next;continue}if(r=u,r===a){o?o===1?(r=Ia(me(r),e,t),Ye(r,e,t,i,n,s,2)):o===2&&Oa(r,e,t,i,n,s):Ye(me(r),e,t,i,n,s,1);break}}}}function Aa(r){var e=r.prev,t=r,i=r.next;if(ht(e,t,i)>=0)return!1;for(var n=e.x,s=t.x,o=i.x,a=e.y,h=t.y,u=i.y,l=n<s?n<o?n:o:s<o?s:o,f=a<h?a<u?a:u:h<u?h:u,c=n>s?n>o?n:o:s>o?s:o,d=a>h?a>u?a:u:h>u?h:u,p=i.next;p!==e;){if(p.x>=l&&p.x<=c&&p.y>=f&&p.y<=d&&Me(n,a,s,h,o,u,p.x,p.y)&&ht(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Ra(r,e,t,i){var n=r.prev,s=r,o=r.next;if(ht(n,s,o)>=0)return!1;for(var a=n.x,h=s.x,u=o.x,l=n.y,f=s.y,c=o.y,d=a<h?a<u?a:u:h<u?h:u,p=l<f?l<c?l:c:f<c?f:c,v=a>h?a>u?a:u:h>u?h:u,_=l>f?l>c?l:c:f>c?f:c,m=yr(d,p,e,t,i),y=yr(v,_,e,t,i),g=r.prevZ,b=r.nextZ;g&&g.z>=m&&b&&b.z<=y;){if(g.x>=d&&g.x<=v&&g.y>=p&&g.y<=_&&g!==n&&g!==o&&Me(a,l,h,f,u,c,g.x,g.y)&&ht(g.prev,g,g.next)>=0||(g=g.prevZ,b.x>=d&&b.x<=v&&b.y>=p&&b.y<=_&&b!==n&&b!==o&&Me(a,l,h,f,u,c,b.x,b.y)&&ht(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;g&&g.z>=m;){if(g.x>=d&&g.x<=v&&g.y>=p&&g.y<=_&&g!==n&&g!==o&&Me(a,l,h,f,u,c,g.x,g.y)&&ht(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;b&&b.z<=y;){if(b.x>=d&&b.x<=v&&b.y>=p&&b.y<=_&&b!==n&&b!==o&&Me(a,l,h,f,u,c,b.x,b.y)&&ht(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Ia(r,e,t){var i=r;do{var n=i.prev,s=i.next.next;!Pi(n,s)&&os(n,i,i.next,s)&&Ve(n,s)&&Ve(s,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),qe(i),qe(i.next),i=r=s),i=i.next}while(i!==r);return me(i)}function Oa(r,e,t,i,n,s){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ka(o,a)){var h=as(o,a);o=me(o,o.next),h=me(h,h.next),Ye(o,e,t,i,n,s,0),Ye(h,e,t,i,n,s,0);return}a=a.next}o=o.next}while(o!==r)}function Ma(r,e,t,i){var n=[],s,o,a,h,u;for(s=0,o=e.length;s<o;s++)a=e[s]*i,h=s<o-1?e[s+1]*i:r.length,u=ss(r,a,h,i,!1),u===u.next&&(u.steiner=!0),n.push(Ga(u));for(n.sort(Da),s=0;s<n.length;s++)t=Fa(n[s],t);return t}function Da(r,e){return r.x-e.x}function Fa(r,e){var t=Na(r,e);if(!t)return e;var i=as(t,r);return me(i,i.next),me(t,t.next)}function Na(r,e){var t=e,i=r.x,n=r.y,s=-1/0,o;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){var a=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>s&&(s=a,o=t.x<t.next.x?t:t.next,a===i))return o}t=t.next}while(t!==e);if(!o)return null;var h=o,u=o.x,l=o.y,f=1/0,c;t=o;do i>=t.x&&t.x>=u&&i!==t.x&&Me(n<l?i:s,n,u,l,n<l?s:i,n,t.x,t.y)&&(c=Math.abs(n-t.y)/(i-t.x),Ve(t,r)&&(c<f||c===f&&(t.x>o.x||t.x===o.x&&Ba(o,t)))&&(o=t,f=c)),t=t.next;while(t!==h);return o}function Ba(r,e){return ht(r.prev,r,e.prev)<0&&ht(e.next,r,r.next)<0}function La(r,e,t,i){var n=r;do n.z===0&&(n.z=yr(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==r);n.prevZ.nextZ=null,n.prevZ=null,Ua(n)}function Ua(r){var e,t,i,n,s,o,a,h,u=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<u&&(a++,i=i.nextZ,!!i);e++);for(h=u;a>0||h>0&&i;)a!==0&&(h===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,a--):(n=i,i=i.nextZ,h--),s?s.nextZ=n:r=n,n.prevZ=s,s=n;t=i}s.nextZ=null,u*=2}while(o>1);return r}function yr(r,e,t,i,n){return r=(r-t)*n|0,e=(e-i)*n|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function Ga(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Me(r,e,t,i,n,s,o,a){return(n-o)*(e-a)>=(r-o)*(s-a)&&(r-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(n-o)*(i-a)}function ka(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Ha(r,e)&&(Ve(r,e)&&Ve(e,r)&&Xa(r,e)&&(ht(r.prev,r,e.prev)||ht(r,e.prev,e))||Pi(r,e)&&ht(r.prev,r,r.next)>0&&ht(e.prev,e,e.next)>0)}function ht(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Pi(r,e){return r.x===e.x&&r.y===e.y}function os(r,e,t,i){var n=Ai(ht(r,e,t)),s=Ai(ht(r,e,i)),o=Ai(ht(t,i,r)),a=Ai(ht(t,i,e));return!!(n!==s&&o!==a||n===0&&Ci(r,t,e)||s===0&&Ci(r,i,e)||o===0&&Ci(t,r,i)||a===0&&Ci(t,e,i))}function Ci(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Ai(r){return r>0?1:r<0?-1:0}function Ha(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&os(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ve(r,e){return ht(r.prev,r,r.next)<0?ht(r,e,r.next)>=0&&ht(r,r.prev,e)>=0:ht(r,e,r.prev)<0||ht(r,r.next,e)<0}function Xa(r,e){var t=r,i=!1,n=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function as(r,e){var t=new xr(r.i,r.x,r.y),i=new xr(e.i,e.x,e.y),n=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=n,n.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function hs(r,e,t,i){var n=new xr(r,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function qe(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function xr(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Si.deviation=function(r,e,t,i){var n=e&&e.length,s=n?e[0]*t:r.length,o=Math.abs(br(r,0,s,t));if(n)for(var a=0,h=e.length;a<h;a++){var u=e[a]*t,l=a<h-1?e[a+1]*t:r.length;o-=Math.abs(br(r,u,l,t))}var f=0;for(a=0;a<i.length;a+=3){var c=i[a]*t,d=i[a+1]*t,p=i[a+2]*t;f+=Math.abs((r[c]-r[p])*(r[d+1]-r[c+1])-(r[c]-r[d])*(r[p+1]-r[c+1]))}return o===0&&f===0?0:Math.abs((f-o)/o)};function br(r,e,t,i){for(var n=0,s=e,o=t-i;s<t;s+=i)n+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return n}Si.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,n=0;n<r.length;n++){for(var s=0;s<r[n].length;s++)for(var o=0;o<e;o++)t.vertices.push(r[n][s][o]);n>0&&(i+=r[n-1].length,t.holes.push(i))}return t};var Tr={exports:{}};(function(r,e){(function(t){var i=e&&!e.nodeType&&e,n=r&&!r.nodeType&&r,s=typeof dr=="object"&&dr;(s.global===s||s.window===s||s.self===s)&&(t=s);var o,a=2147483647,h=36,u=1,l=26,f=38,c=700,d=72,p=128,v="-",_=/^xn--/,m=/[^\x20-\x7E]/,y=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=h-u,x=Math.floor,T=String.fromCharCode,w;function I(O){throw RangeError(g[O])}function S(O,C){for(var B=O.length,$=[];B--;)$[B]=C(O[B]);return $}function P(O,C){var B=O.split("@"),$="";B.length>1&&($=B[0]+"@",O=B[1]),O=O.replace(y,".");var Z=O.split("."),pt=S(Z,C).join(".");return $+pt}function E(O){for(var C=[],B=0,$=O.length,Z,pt;B<$;)Z=O.charCodeAt(B++),Z>=55296&&Z<=56319&&B<$?(pt=O.charCodeAt(B++),(pt&64512)==56320?C.push(((Z&1023)<<10)+(pt&1023)+65536):(C.push(Z),B--)):C.push(Z);return C}function D(O){return S(O,function(C){var B="";return C>65535&&(C-=65536,B+=T(C>>>10&1023|55296),C=56320|C&1023),B+=T(C),B}).join("")}function N(O){return O-48<10?O-22:O-65<26?O-65:O-97<26?O-97:h}function W(O,C){return O+22+75*(O<26)-((C!=0)<<5)}function R(O,C,B){var $=0;for(O=B?x(O/c):O>>1,O+=x(O/C);O>b*l>>1;$+=h)O=x(O/b);return x($+(b+1)*O/(O+f))}function M(O){var C=[],B=O.length,$,Z=0,pt=p,nt=d,st,bt,wt,vt,tt,rt,ot,V,St;for(st=O.lastIndexOf(v),st<0&&(st=0),bt=0;bt<st;++bt)O.charCodeAt(bt)>=128&&I("not-basic"),C.push(O.charCodeAt(bt));for(wt=st>0?st+1:0;wt<B;){for(vt=Z,tt=1,rt=h;wt>=B&&I("invalid-input"),ot=N(O.charCodeAt(wt++)),(ot>=h||ot>x((a-Z)/tt))&&I("overflow"),Z+=ot*tt,V=rt<=nt?u:rt>=nt+l?l:rt-nt,!(ot<V);rt+=h)St=h-V,tt>x(a/St)&&I("overflow"),tt*=St;$=C.length+1,nt=R(Z-vt,$,vt==0),x(Z/$)>a-pt&&I("overflow"),pt+=x(Z/$),Z%=$,C.splice(Z++,0,pt)}return D(C)}function G(O){var C,B,$,Z,pt,nt,st,bt,wt,vt,tt,rt=[],ot,V,St,Pt;for(O=E(O),ot=O.length,C=p,B=0,pt=d,nt=0;nt<ot;++nt)tt=O[nt],tt<128&&rt.push(T(tt));for($=Z=rt.length,Z&&rt.push(v);$<ot;){for(st=a,nt=0;nt<ot;++nt)tt=O[nt],tt>=C&&tt<st&&(st=tt);for(V=$+1,st-C>x((a-B)/V)&&I("overflow"),B+=(st-C)*V,C=st,nt=0;nt<ot;++nt)if(tt=O[nt],tt<C&&++B>a&&I("overflow"),tt==C){for(bt=B,wt=h;vt=wt<=pt?u:wt>=pt+l?l:wt-pt,!(bt<vt);wt+=h)Pt=bt-vt,St=h-vt,rt.push(T(W(vt+Pt%St,0))),bt=x(Pt/St);rt.push(T(W(bt,0))),pt=R(B,V,$==Z),B=0,++$}++B,++C}return rt.join("")}function ut(O){return P(O,function(C){return _.test(C)?M(C.slice(4).toLowerCase()):C})}function z(O){return P(O,function(C){return m.test(C)?"xn--"+G(C):C})}if(o={version:"1.3.2",ucs2:{decode:E,encode:D},decode:M,encode:G,toASCII:z,toUnicode:ut},i&&n)if(r.exports==i)n.exports=o;else for(w in o)o.hasOwnProperty(w)&&(i[w]=o[w]);else t.punycode=o})(dr)})(Tr,Tr.exports);var Wa={isString:function(r){return typeof r=="string"},isObject:function(r){return typeof r=="object"&&r!==null},isNull:function(r){return r===null},isNullOrUndefined:function(r){return r==null}},$e={};function ja(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var za=function(r,e,t,i){e=e||"&",t=t||"=";var n={};if(typeof r!="string"||r.length===0)return n;var s=/\+/g;r=r.split(e);var o=1e3;i&&typeof i.maxKeys=="number"&&(o=i.maxKeys);var a=r.length;o>0&&a>o&&(a=o);for(var h=0;h<a;++h){var u=r[h].replace(s,"%20"),l=u.indexOf(t),f,c,d,p;l>=0?(f=u.substr(0,l),c=u.substr(l+1)):(f=u,c=""),d=decodeURIComponent(f),p=decodeURIComponent(c),ja(n,d)?Array.isArray(n[d])?n[d].push(p):n[d]=[n[d],p]:n[d]=p}return n},Ze=function(r){switch(typeof r){case"string":return r;case"boolean":return r?"true":"false";case"number":return isFinite(r)?r:"";default:return""}},Ya=function(r,e,t,i){return e=e||"&",t=t||"=",r===null&&(r=void 0),typeof r=="object"?Object.keys(r).map(function(n){var s=encodeURIComponent(Ze(n))+t;return Array.isArray(r[n])?r[n].map(function(o){return s+encodeURIComponent(Ze(o))}).join(e):s+encodeURIComponent(Ze(r[n]))}).join(e):i?encodeURIComponent(Ze(i))+t+encodeURIComponent(Ze(r)):""};$e.decode=$e.parse=za,$e.encode=$e.stringify=Ya;var Va=Tr.exports,Yt=Wa,qa=Ri,$a=oh,Za=sh;function Ft(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Ka=/^([a-z0-9.+-]+:)/i,Qa=/:[0-9]*$/,Ja=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,th=["<",">",'"',"`"," ","\r",`
1
+ (function(Ct,et){typeof exports=="object"&&typeof module<"u"?et(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],et):(Ct=typeof globalThis<"u"?globalThis:Ct||self,et(Ct["prefect-graphs"]={},Ct.Vue))})(this,function(Ct,et){"use strict";var zv=Object.defineProperty;var Yv=(Ct,et,Ht)=>et in Ct?zv(Ct,et,{enumerable:!0,configurable:!0,writable:!0,value:Ht}):Ct[et]=Ht;var ne=(Ct,et,Ht)=>(Yv(Ct,typeof et!="symbol"?et+"":et,Ht),Ht);var Ht=Math.PI*2,ra=180/Math.PI,na=Math.PI/180,yt;(function(r){r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC"})(yt||(yt={}));var X=function(){function r(e,t){e===void 0&&(e=0),t===void 0&&(t=0),this.x=0,this.y=0,this.x=e,this.y=t}return r.prototype.clone=function(){return new r(this.x,this.y)},r.prototype.copyFrom=function(e){return this.set(e.x,e.y),this},r.prototype.copyTo=function(e){return e.set(this.x,this.y),e},r.prototype.equals=function(e){return e.x===this.x&&e.y===this.y},r.prototype.set=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),this.x=e,this.y=t,this},r.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},r}(),mi=[new X,new X,new X,new X],j=function(){function r(e,t,i,n){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=0),this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(n),this.type=yt.RECT}return Object.defineProperty(r.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(r,"EMPTY",{get:function(){return new r(0,0,0,0)},enumerable:!1,configurable:!0}),r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this},r.prototype.copyTo=function(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},r.prototype.contains=function(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height},r.prototype.intersects=function(e,t){if(!t){var i=this.x<e.x?e.x:this.x,n=this.right>e.right?e.right:this.right;if(n<=i)return!1;var s=this.y<e.y?e.y:this.y,o=this.bottom>e.bottom?e.bottom:this.bottom;return o>s}var a=this.left,h=this.right,u=this.top,l=this.bottom;if(h<=a||l<=u)return!1;var f=mi[0].set(e.left,e.top),c=mi[1].set(e.left,e.bottom),d=mi[2].set(e.right,e.top),p=mi[3].set(e.right,e.bottom);if(d.x<=f.x||c.y<=f.y)return!1;var v=Math.sign(t.a*t.d-t.b*t.c);if(v===0||(t.apply(f,f),t.apply(c,c),t.apply(d,d),t.apply(p,p),Math.max(f.x,c.x,d.x,p.x)<=a||Math.min(f.x,c.x,d.x,p.x)>=h||Math.max(f.y,c.y,d.y,p.y)<=u||Math.min(f.y,c.y,d.y,p.y)>=l))return!1;var _=v*(c.y-f.y),m=v*(f.x-c.x),y=_*a+m*u,g=_*h+m*u,b=_*a+m*l,x=_*h+m*l;if(Math.max(y,g,b,x)<=_*f.x+m*f.y||Math.min(y,g,b,x)>=_*p.x+m*p.y)return!1;var T=v*(f.y-d.y),w=v*(d.x-f.x),I=T*a+w*u,S=T*h+w*u,P=T*a+w*l,E=T*h+w*l;return!(Math.max(I,S,P,E)<=T*f.x+w*f.y||Math.min(I,S,P,E)>=T*p.x+w*p.y)},r.prototype.pad=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this},r.prototype.fit=function(e){var t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),s=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=n,this.height=Math.max(s-n,0),this},r.prototype.ceil=function(e,t){e===void 0&&(e=1),t===void 0&&(t=.001);var i=Math.ceil((this.x+this.width-t)*e)/e,n=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=n-this.y,this},r.prototype.enlarge=function(e){var t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),s=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=n,this.height=s-n,this},r.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),sa=function(){function r(e,t,i){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),this.x=e,this.y=t,this.radius=i,this.type=yt.CIRC}return r.prototype.clone=function(){return new r(this.x,this.y,this.radius)},r.prototype.contains=function(e,t){if(this.radius<=0)return!1;var i=this.radius*this.radius,n=this.x-e,s=this.y-t;return n*=n,s*=s,n+s<=i},r.prototype.getBounds=function(){return new j(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)},r.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"},r}(),oa=function(){function r(e,t,i,n){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=0),this.x=e,this.y=t,this.width=i,this.height=n,this.type=yt.ELIP}return r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;var i=(e-this.x)/this.width,n=(t-this.y)/this.height;return i*=i,n*=n,i+n<=1},r.prototype.getBounds=function(){return new j(this.x-this.width,this.y-this.height,this.width,this.height)},r.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),gi=function(){function r(){for(var e=arguments,t=[],i=0;i<arguments.length;i++)t[i]=e[i];var n=Array.isArray(t[0])?t[0]:t;if(typeof n[0]!="number"){for(var s=[],o=0,a=n.length;o<a;o++)s.push(n[o].x,n[o].y);n=s}this.points=n,this.type=yt.POLY,this.closeStroke=!0}return r.prototype.clone=function(){var e=this.points.slice(),t=new r(e);return t.closeStroke=this.closeStroke,t},r.prototype.contains=function(e,t){for(var i=!1,n=this.points.length/2,s=0,o=n-1;s<n;o=s++){var a=this.points[s*2],h=this.points[s*2+1],u=this.points[o*2],l=this.points[o*2+1],f=h>t!=l>t&&e<(u-a)*((t-h)/(l-h))+a;f&&(i=!i)}return i},r.prototype.toString=function(){return"[@pixi/math:Polygon"+("closeStroke="+this.closeStroke)+("points="+this.points.reduce(function(e,t){return e+", "+t},"")+"]")},r}(),aa=function(){function r(e,t,i,n,s){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=0),s===void 0&&(s=20),this.x=e,this.y=t,this.width=i,this.height=n,this.radius=s,this.type=yt.RREC}return r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height,this.radius)},r.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){var i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;var n=e-(this.x+i),s=t-(this.y+i),o=i*i;if(n*n+s*s<=o||(n=e-(this.x+this.width-i),n*n+s*s<=o)||(s=t-(this.y+this.height-i),n*n+s*s<=o)||(n=e-(this.x+i),n*n+s*s<=o))return!0}return!1},r.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+("width="+this.width+" height="+this.height+" radius="+this.radius+"]")},r}(),Ie=function(){function r(e,t,i,n){i===void 0&&(i=0),n===void 0&&(n=0),this._x=i,this._y=n,this.cb=e,this.scope=t}return r.prototype.clone=function(e,t){return e===void 0&&(e=this.cb),t===void 0&&(t=this.scope),new r(e,t,this._x,this._y)},r.prototype.set=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this},r.prototype.copyFrom=function(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this},r.prototype.copyTo=function(e){return e.set(this._x,this._y),e},r.prototype.equals=function(e){return e.x===this._x&&e.y===this._y},r.prototype.toString=function(){return"[@pixi/math:ObservablePoint x="+0+" y="+0+" scope="+this.scope+"]"},Object.defineProperty(r.prototype,"x",{get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"y",{get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),r}(),mt=function(){function r(e,t,i,n,s,o){e===void 0&&(e=1),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=0),o===void 0&&(o=0),this.array=null,this.a=e,this.b=t,this.c=i,this.d=n,this.tx=s,this.ty=o}return r.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},r.prototype.set=function(e,t,i,n,s,o){return this.a=e,this.b=t,this.c=i,this.d=n,this.tx=s,this.ty=o,this},r.prototype.toArray=function(e,t){this.array||(this.array=new Float32Array(9));var i=t||this.array;return e?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i},r.prototype.apply=function(e,t){t=t||new X;var i=e.x,n=e.y;return t.x=this.a*i+this.c*n+this.tx,t.y=this.b*i+this.d*n+this.ty,t},r.prototype.applyInverse=function(e,t){t=t||new X;var i=1/(this.a*this.d+this.c*-this.b),n=e.x,s=e.y;return t.x=this.d*i*n+-this.c*i*s+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*s+-this.b*i*n+(-this.ty*this.a+this.tx*this.b)*i,t},r.prototype.translate=function(e,t){return this.tx+=e,this.ty+=t,this},r.prototype.scale=function(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this},r.prototype.rotate=function(e){var t=Math.cos(e),i=Math.sin(e),n=this.a,s=this.c,o=this.tx;return this.a=n*t-this.b*i,this.b=n*i+this.b*t,this.c=s*t-this.d*i,this.d=s*i+this.d*t,this.tx=o*t-this.ty*i,this.ty=o*i+this.ty*t,this},r.prototype.append=function(e){var t=this.a,i=this.b,n=this.c,s=this.d;return this.a=e.a*t+e.b*n,this.b=e.a*i+e.b*s,this.c=e.c*t+e.d*n,this.d=e.c*i+e.d*s,this.tx=e.tx*t+e.ty*n+this.tx,this.ty=e.tx*i+e.ty*s+this.ty,this},r.prototype.setTransform=function(e,t,i,n,s,o,a,h,u){return this.a=Math.cos(a+u)*s,this.b=Math.sin(a+u)*s,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=e-(i*this.a+n*this.c),this.ty=t-(i*this.b+n*this.d),this},r.prototype.prepend=function(e){var t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){var i=this.a,n=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this},r.prototype.decompose=function(e){var t=this.a,i=this.b,n=this.c,s=this.d,o=e.pivot,a=-Math.atan2(-n,s),h=Math.atan2(i,t),u=Math.abs(a+h);return u<1e-5||Math.abs(Ht-u)<1e-5?(e.rotation=h,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=h),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(n*n+s*s),e.position.x=this.tx+(o.x*t+o.y*n),e.position.y=this.ty+(o.x*i+o.y*s),e},r.prototype.invert=function(){var e=this.a,t=this.b,i=this.c,n=this.d,s=this.tx,o=e*n-t*i;return this.a=n/o,this.b=-t/o,this.c=-i/o,this.d=e/o,this.tx=(i*this.ty-n*s)/o,this.ty=-(e*this.ty-t*s)/o,this},r.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},r.prototype.clone=function(){var e=new r;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyTo=function(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyFrom=function(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this},r.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(r,"IDENTITY",{get:function(){return new r},enumerable:!1,configurable:!0}),Object.defineProperty(r,"TEMP_MATRIX",{get:function(){return new r},enumerable:!1,configurable:!0}),r}(),fe=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ce=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],de=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],pe=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],lr=[],Gn=[],yi=Math.sign;function ha(){for(var r=0;r<16;r++){var e=[];lr.push(e);for(var t=0;t<16;t++)for(var i=yi(fe[r]*fe[t]+de[r]*ce[t]),n=yi(ce[r]*fe[t]+pe[r]*ce[t]),s=yi(fe[r]*de[t]+de[r]*pe[t]),o=yi(ce[r]*de[t]+pe[r]*pe[t]),a=0;a<16;a++)if(fe[a]===i&&ce[a]===n&&de[a]===s&&pe[a]===o){e.push(a);break}}for(var r=0;r<16;r++){var h=new mt;h.set(fe[r],ce[r],de[r],pe[r],0,0),Gn.push(h)}}ha();var at={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(r){return fe[r]},uY:function(r){return ce[r]},vX:function(r){return de[r]},vY:function(r){return pe[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,e){return lr[r][e]},sub:function(r,e){return lr[r][at.inv(e)]},rotate180:function(r){return r^4},isVertical:function(r){return(r&3)===2},byDirection:function(r,e){return Math.abs(r)*2<=Math.abs(e)?e>=0?at.S:at.N:Math.abs(e)*2<=Math.abs(r)?r>0?at.E:at.W:e>0?r>0?at.SE:at.SW:r>0?at.NE:at.NW},matrixAppendRotationInv:function(r,e,t,i){t===void 0&&(t=0),i===void 0&&(i=0);var n=Gn[at.inv(e)];n.tx=t,n.ty=i,r.append(n)}},kn=function(){function r(){this.worldTransform=new mt,this.localTransform=new mt,this.position=new Ie(this.onChange,this,0,0),this.scale=new Ie(this.onChange,this,1,1),this.pivot=new Ie(this.onChange,this,0,0),this.skew=new Ie(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return r.prototype.onChange=function(){this._localID++},r.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},r.prototype.toString=function(){return"[@pixi/math:Transform "+("position=("+this.position.x+", "+this.position.y+") ")+("rotation="+this.rotation+" ")+("scale=("+this.scale.x+", "+this.scale.y+") ")+("skew=("+this.skew.x+", "+this.skew.y+") ")+"]"},r.prototype.updateLocalTransform=function(){var e=this.localTransform;this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1)},r.prototype.updateTransform=function(e){var t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==e._worldID){var i=e.worldTransform,n=this.worldTransform;n.a=t.a*i.a+t.b*i.c,n.b=t.a*i.b+t.b*i.d,n.c=t.c*i.a+t.d*i.c,n.d=t.c*i.b+t.d*i.d,n.tx=t.tx*i.a+t.ty*i.c+i.tx,n.ty=t.tx*i.b+t.ty*i.d+i.ty,this._parentID=e._worldID,this._worldID++}},r.prototype.setFromMatrix=function(e){e.decompose(this),this._localID++},Object.defineProperty(r.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,this.updateSkew())},enumerable:!1,configurable:!0}),r.IDENTITY=new r,r}();const ve=new j;class ua{constructor(e={}){this._recursive=typeof e.recursive=="boolean"?e.recursive:!0,this._toggle=e.toggle||"visible",this._targetList=new Set}add(e){return this._targetList.add(e),this}addAll(e){for(let t=0,i=e.length;t<i;t++)this._targetList.add(e[t]);return this}remove(e){return this._targetList.delete(e),this}removeAll(e){for(let t=0,i=e.length;t<i;t++)this._targetList.delete(e[t]);return this}clear(){return this._targetList.clear(),this}cull(e,t=!1){return t||this.uncull(),this._targetList.forEach(i=>{t||i.getBounds(!1,ve),this._recursive?this.cullRecursive(e,i,t):(t&&i._bounds.getRectangle(e),i[this._toggle]=ve.right>e.left&&ve.left<e.right&&ve.bottom>e.top&&ve.top<e.bottom)}),this}uncull(){return this._targetList.forEach(e=>{this._recursive?this.uncullRecursive(e):e[this._toggle]=!1}),this}cullRecursive(e,t,i){const n=i?t._bounds.getRectangle(ve):t.getBounds(!0,ve);if(t[this._toggle]=n.right>e.left&&n.left<e.right&&n.bottom>e.top&&n.top<e.bottom,!(n.left>=e.left&&n.top>=e.top&&n.right<=e.right&&n.bottom<=e.bottom)&&t[this._toggle]&&t.children&&t.children.length){const o=t.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(e,o[a])}}uncullRecursive(e){if(e[this._toggle]=!0,e.children&&e.children.length){const t=e.children;for(let i=0,n=t.length;i<n;i++)this.uncullRecursive(t[i])}}}function la(r){var e=this.constructor;return this.then(function(t){return e.resolve(r()).then(function(){return t})},function(t){return e.resolve(r()).then(function(){return e.reject(t)})})}function fa(r){var e=this;return new e(function(t,i){if(!(r&&typeof r.length<"u"))return i(new TypeError(typeof r+" "+r+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var n=Array.prototype.slice.call(r);if(n.length===0)return t([]);var s=n.length;function o(h,u){if(u&&(typeof u=="object"||typeof u=="function")){var l=u.then;if(typeof l=="function"){l.call(u,function(f){o(h,f)},function(f){n[h]={status:"rejected",reason:f},--s===0&&t(n)});return}}n[h]={status:"fulfilled",value:u},--s===0&&t(n)}for(var a=0;a<n.length;a++)o(a,n[a])})}var ca=setTimeout;function Hn(r){return Boolean(r&&typeof r.length<"u")}function da(){}function pa(r,e){return function(){r.apply(e,arguments)}}function lt(r){if(!(this instanceof lt))throw new TypeError("Promises must be constructed via new");if(typeof r!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],Wn(r,this)}function Xn(r,e){for(;r._state===3;)r=r._value;if(r._state===0){r._deferreds.push(e);return}r._handled=!0,lt._immediateFn(function(){var t=r._state===1?e.onFulfilled:e.onRejected;if(t===null){(r._state===1?fr:We)(e.promise,r._value);return}var i;try{i=t(r._value)}catch(n){We(e.promise,n);return}fr(e.promise,i)})}function fr(r,e){try{if(e===r)throw new TypeError("A promise cannot be resolved with itself.");if(e&&(typeof e=="object"||typeof e=="function")){var t=e.then;if(e instanceof lt){r._state=3,r._value=e,cr(r);return}else if(typeof t=="function"){Wn(pa(t,e),r);return}}r._state=1,r._value=e,cr(r)}catch(i){We(r,i)}}function We(r,e){r._state=2,r._value=e,cr(r)}function cr(r){r._state===2&&r._deferreds.length===0&&lt._immediateFn(function(){r._handled||lt._unhandledRejectionFn(r._value)});for(var e=0,t=r._deferreds.length;e<t;e++)Xn(r,r._deferreds[e]);r._deferreds=null}function va(r,e,t){this.onFulfilled=typeof r=="function"?r:null,this.onRejected=typeof e=="function"?e:null,this.promise=t}function Wn(r,e){var t=!1;try{r(function(i){t||(t=!0,fr(e,i))},function(i){t||(t=!0,We(e,i))})}catch(i){if(t)return;t=!0,We(e,i)}}lt.prototype.catch=function(r){return this.then(null,r)},lt.prototype.then=function(r,e){var t=new this.constructor(da);return Xn(this,new va(r,e,t)),t},lt.prototype.finally=la,lt.all=function(r){return new lt(function(e,t){if(!Hn(r))return t(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(r);if(i.length===0)return e([]);var n=i.length;function s(a,h){try{if(h&&(typeof h=="object"||typeof h=="function")){var u=h.then;if(typeof u=="function"){u.call(h,function(l){s(a,l)},t);return}}i[a]=h,--n===0&&e(i)}catch(l){t(l)}}for(var o=0;o<i.length;o++)s(o,i[o])})},lt.allSettled=fa,lt.resolve=function(r){return r&&typeof r=="object"&&r.constructor===lt?r:new lt(function(e){e(r)})},lt.reject=function(r){return new lt(function(e,t){t(r)})},lt.race=function(r){return new lt(function(e,t){if(!Hn(r))return t(new TypeError("Promise.race accepts an array"));for(var i=0,n=r.length;i<n;i++)lt.resolve(r[i]).then(e,t)})},lt._immediateFn=typeof setImmediate=="function"&&function(r){setImmediate(r)}||function(r){ca(r,0)},lt._unhandledRejectionFn=function(e){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};var jn=Object.getOwnPropertySymbols,_a=Object.prototype.hasOwnProperty,ma=Object.prototype.propertyIsEnumerable;function ga(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function ya(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var e={},t=0;t<10;t++)e["_"+String.fromCharCode(t)]=t;var i=Object.getOwnPropertyNames(e).map(function(s){return e[s]});if(i.join("")!=="0123456789")return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(s){n[s]=s}),Object.keys(Object.assign({},n)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var xa=ya()?Object.assign:function(r,e){for(var t,i=ga(r),n,s=1;s<arguments.length;s++){t=Object(arguments[s]);for(var o in t)_a.call(t,o)&&(i[o]=t[o]);if(jn){n=jn(t);for(var a=0;a<n.length;a++)ma.call(t,n[a])&&(i[n[a]]=t[n[a]])}}return i};typeof globalThis>"u"&&(typeof self<"u"?self.globalThis=self:typeof global<"u"&&(global.globalThis=global)),globalThis.Promise||(globalThis.Promise=lt),Object.assign||(Object.assign=xa);var ba=16;if(Date.now&&Date.prototype.getTime||(Date.now=function(){return new Date().getTime()}),!(globalThis.performance&&globalThis.performance.now)){var Ta=Date.now();globalThis.performance||(globalThis.performance={}),globalThis.performance.now=function(){return Date.now()-Ta}}for(var pr=Date.now(),zn=["ms","moz","webkit","o"],vr=0;vr<zn.length&&!globalThis.requestAnimationFrame;++vr){var _r=zn[vr];globalThis.requestAnimationFrame=globalThis[_r+"RequestAnimationFrame"],globalThis.cancelAnimationFrame=globalThis[_r+"CancelAnimationFrame"]||globalThis[_r+"CancelRequestAnimationFrame"]}globalThis.requestAnimationFrame||(globalThis.requestAnimationFrame=function(r){if(typeof r!="function")throw new TypeError(r+"is not a function");var e=Date.now(),t=ba+pr-e;return t<0&&(t=0),pr=e,globalThis.self.setTimeout(function(){pr=Date.now(),r(performance.now())},t)}),globalThis.cancelAnimationFrame||(globalThis.cancelAnimationFrame=function(r){return clearTimeout(r)}),Math.sign||(Math.sign=function(e){return e=Number(e),e===0||isNaN(e)?e:e>0?1:-1}),Number.isInteger||(Number.isInteger=function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e}),globalThis.ArrayBuffer||(globalThis.ArrayBuffer=Array),globalThis.Float32Array||(globalThis.Float32Array=Array),globalThis.Uint32Array||(globalThis.Uint32Array=Array),globalThis.Uint16Array||(globalThis.Uint16Array=Array),globalThis.Uint8Array||(globalThis.Uint8Array=Array),globalThis.Int32Array||(globalThis.Int32Array=Array);var $t;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})($t||($t={}));var je;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(je||(je={}));var xi;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(xi||(xi={}));var U;(function(r){r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR"})(U||(U={}));var It;(function(r){r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(It||(It={}));var A;(function(r){r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL"})(A||(A={}));var _e;(function(r){r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"})(_e||(_e={}));var L;(function(r){r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT"})(L||(L={}));var bi;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(bi||(bi={}));var Xt;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(Xt||(Xt={}));var Wt;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(Wt||(Wt={}));var Ot;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(Ot||(Ot={}));var Mt;(function(r){r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"})(Mt||(Mt={}));var Dt;(function(r){r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT"})(Dt||(Dt={}));var Ti;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(Ti||(Ti={}));var At;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(At||(At={}));var _t;(function(r){r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR"})(_t||(_t={}));var Yn;(function(r){r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA"})(Yn||(Yn={}));var ft;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(ft||(ft={}));var jt;(function(r){r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"})(jt||(jt={}));var wa={createCanvas:function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,t},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var r;return(r=document.baseURI)!==null&&r!==void 0?r:window.location.href},fetch:function(r,e){return fetch(r,e)}},mr=/iPhone/i,Vn=/iPod/i,qn=/iPad/i,$n=/\biOS-universal(?:.+)Mac\b/i,gr=/\bAndroid(?:.+)Mobile\b/i,Zn=/Android/i,Oe=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,wi=/Silk/i,Zt=/Windows Phone/i,Kn=/\bWindows(?:.+)ARM\b/i,Qn=/BlackBerry/i,Jn=/BB10/i,ts=/Opera Mini/i,es=/\b(CriOS|Chrome)(?:.+)Mobile/i,is=/Mobile(?:.+)Firefox\b/i,rs=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function Ea(r){return function(e){return e.test(r)}}function Sa(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=Ea(t),s={apple:{phone:n(mr)&&!n(Zt),ipod:n(Vn),tablet:!n(mr)&&(n(qn)||rs(e))&&!n(Zt),universal:n($n),device:(n(mr)||n(Vn)||n(qn)||n($n)||rs(e))&&!n(Zt)},amazon:{phone:n(Oe),tablet:!n(Oe)&&n(wi),device:n(Oe)||n(wi)},android:{phone:!n(Zt)&&n(Oe)||!n(Zt)&&n(gr),tablet:!n(Zt)&&!n(Oe)&&!n(gr)&&(n(wi)||n(Zn)),device:!n(Zt)&&(n(Oe)||n(wi)||n(gr)||n(Zn))||n(/\bokhttp\b/i)},windows:{phone:n(Zt),tablet:n(Kn),device:n(Zt)||n(Kn)},other:{blackberry:n(Qn),blackberry10:n(Jn),opera:n(ts),firefox:n(is),chrome:n(es),device:n(Qn)||n(Jn)||n(ts)||n(is)||n(es)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var zt=Sa(globalThis.navigator);function Pa(){return!zt.apple.device}function Ca(r){var e=!0;if(zt.tablet||zt.phone){if(zt.apple.device){var t=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(t){var i=parseInt(t[1],10);i<11&&(e=!1)}}if(zt.android.device){var t=navigator.userAgent.match(/Android\s([0-9.]*)/);if(t){var i=parseInt(t[1],10);i<7&&(e=!1)}}}return e?r:4}var F={ADAPTER:wa,MIPMAP_TEXTURES:Ot.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:ft.NONE,SPRITE_MAX_TEXTURES:Ca(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:Ti.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:Wt.CLAMP,SCALE_MODE:Xt.LINEAR,PRECISION_VERTEX:At.HIGH,PRECISION_FRAGMENT:zt.apple.device?At.HIGH:At.MEDIUM,CAN_UPLOAD_SAME_BUFFER:Pa(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},ns={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(h,u,l){this.fn=h,this.context=u,this.once=l||!1}function s(h,u,l,f,c){if(typeof l!="function")throw new TypeError("The listener must be a function");var d=new n(l,f||h,c),p=t?t+u:u;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],d]:h._events[p].push(d):(h._events[p]=d,h._eventsCount++),h}function o(h,u){--h._eventsCount===0?h._events=new i:delete h._events[u]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],l,f;if(this._eventsCount===0)return u;for(f in l=this._events)e.call(l,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},a.prototype.listeners=function(u){var l=t?t+u:u,f=this._events[l];if(!f)return[];if(f.fn)return[f.fn];for(var c=0,d=f.length,p=new Array(d);c<d;c++)p[c]=f[c].fn;return p},a.prototype.listenerCount=function(u){var l=t?t+u:u,f=this._events[l];return f?f.fn?1:f.length:0},a.prototype.emit=function(u,l,f,c,d,p){var v=t?t+u:u;if(!this._events[v])return!1;var _=this._events[v],m=arguments.length,y,g;if(_.fn){switch(_.once&&this.removeListener(u,_.fn,void 0,!0),m){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,l),!0;case 3:return _.fn.call(_.context,l,f),!0;case 4:return _.fn.call(_.context,l,f,c),!0;case 5:return _.fn.call(_.context,l,f,c,d),!0;case 6:return _.fn.call(_.context,l,f,c,d,p),!0}for(g=1,y=new Array(m-1);g<m;g++)y[g-1]=arguments[g];_.fn.apply(_.context,y)}else{var b=_.length,x;for(g=0;g<b;g++)switch(_[g].once&&this.removeListener(u,_[g].fn,void 0,!0),m){case 1:_[g].fn.call(_[g].context);break;case 2:_[g].fn.call(_[g].context,l);break;case 3:_[g].fn.call(_[g].context,l,f);break;case 4:_[g].fn.call(_[g].context,l,f,c);break;default:if(!y)for(x=1,y=new Array(m-1);x<m;x++)y[x-1]=arguments[x];_[g].fn.apply(_[g].context,y)}}return!0},a.prototype.on=function(u,l,f){return s(this,u,l,f,!1)},a.prototype.once=function(u,l,f){return s(this,u,l,f,!0)},a.prototype.removeListener=function(u,l,f,c){var d=t?t+u:u;if(!this._events[d])return this;if(!l)return o(this,d),this;var p=this._events[d];if(p.fn)p.fn===l&&(!c||p.once)&&(!f||p.context===f)&&o(this,d);else{for(var v=0,_=[],m=p.length;v<m;v++)(p[v].fn!==l||c&&!p[v].once||f&&p[v].context!==f)&&_.push(p[v]);_.length?this._events[d]=_.length===1?_[0]:_:o(this,d)}return this},a.prototype.removeAllListeners=function(u){var l;return u?(l=t?t+u:u,this._events[l]&&o(this,l)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,r.exports=a})(ns);const ze=ns.exports;var Ei={exports:{}};Ei.exports=Si,Ei.exports.default=Si;function Si(r,e,t){t=t||2;var i=e&&e.length,n=i?e[0]*t:r.length,s=ss(r,0,n,t,!0),o=[];if(!s||s.next===s.prev)return o;var a,h,u,l,f,c,d;if(i&&(s=Ma(r,e,s,t)),r.length>80*t){a=u=r[0],h=l=r[1];for(var p=t;p<n;p+=t)f=r[p],c=r[p+1],f<a&&(a=f),c<h&&(h=c),f>u&&(u=f),c>l&&(l=c);d=Math.max(u-a,l-h),d=d!==0?32767/d:0}return Ye(s,o,t,a,h,d,0),o}function ss(r,e,t,i,n){var s,o;if(n===br(r,e,t,i)>0)for(s=e;s<t;s+=i)o=hs(s,r[s],r[s+1],o);else for(s=t-i;s>=e;s-=i)o=hs(s,r[s],r[s+1],o);return o&&Pi(o,o.next)&&(qe(o),o=o.next),o}function me(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(Pi(t,t.next)||ht(t.prev,t,t.next)===0)){if(qe(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Ye(r,e,t,i,n,s,o){if(r){!o&&s&&La(r,i,n,s);for(var a=r,h,u;r.prev!==r.next;){if(h=r.prev,u=r.next,s?Ra(r,i,n,s):Aa(r)){e.push(h.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),qe(r),r=u.next,a=u.next;continue}if(r=u,r===a){o?o===1?(r=Ia(me(r),e,t),Ye(r,e,t,i,n,s,2)):o===2&&Oa(r,e,t,i,n,s):Ye(me(r),e,t,i,n,s,1);break}}}}function Aa(r){var e=r.prev,t=r,i=r.next;if(ht(e,t,i)>=0)return!1;for(var n=e.x,s=t.x,o=i.x,a=e.y,h=t.y,u=i.y,l=n<s?n<o?n:o:s<o?s:o,f=a<h?a<u?a:u:h<u?h:u,c=n>s?n>o?n:o:s>o?s:o,d=a>h?a>u?a:u:h>u?h:u,p=i.next;p!==e;){if(p.x>=l&&p.x<=c&&p.y>=f&&p.y<=d&&Me(n,a,s,h,o,u,p.x,p.y)&&ht(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Ra(r,e,t,i){var n=r.prev,s=r,o=r.next;if(ht(n,s,o)>=0)return!1;for(var a=n.x,h=s.x,u=o.x,l=n.y,f=s.y,c=o.y,d=a<h?a<u?a:u:h<u?h:u,p=l<f?l<c?l:c:f<c?f:c,v=a>h?a>u?a:u:h>u?h:u,_=l>f?l>c?l:c:f>c?f:c,m=yr(d,p,e,t,i),y=yr(v,_,e,t,i),g=r.prevZ,b=r.nextZ;g&&g.z>=m&&b&&b.z<=y;){if(g.x>=d&&g.x<=v&&g.y>=p&&g.y<=_&&g!==n&&g!==o&&Me(a,l,h,f,u,c,g.x,g.y)&&ht(g.prev,g,g.next)>=0||(g=g.prevZ,b.x>=d&&b.x<=v&&b.y>=p&&b.y<=_&&b!==n&&b!==o&&Me(a,l,h,f,u,c,b.x,b.y)&&ht(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;g&&g.z>=m;){if(g.x>=d&&g.x<=v&&g.y>=p&&g.y<=_&&g!==n&&g!==o&&Me(a,l,h,f,u,c,g.x,g.y)&&ht(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;b&&b.z<=y;){if(b.x>=d&&b.x<=v&&b.y>=p&&b.y<=_&&b!==n&&b!==o&&Me(a,l,h,f,u,c,b.x,b.y)&&ht(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Ia(r,e,t){var i=r;do{var n=i.prev,s=i.next.next;!Pi(n,s)&&os(n,i,i.next,s)&&Ve(n,s)&&Ve(s,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),qe(i),qe(i.next),i=r=s),i=i.next}while(i!==r);return me(i)}function Oa(r,e,t,i,n,s){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ka(o,a)){var h=as(o,a);o=me(o,o.next),h=me(h,h.next),Ye(o,e,t,i,n,s,0),Ye(h,e,t,i,n,s,0);return}a=a.next}o=o.next}while(o!==r)}function Ma(r,e,t,i){var n=[],s,o,a,h,u;for(s=0,o=e.length;s<o;s++)a=e[s]*i,h=s<o-1?e[s+1]*i:r.length,u=ss(r,a,h,i,!1),u===u.next&&(u.steiner=!0),n.push(Ga(u));for(n.sort(Da),s=0;s<n.length;s++)t=Fa(n[s],t);return t}function Da(r,e){return r.x-e.x}function Fa(r,e){var t=Na(r,e);if(!t)return e;var i=as(t,r);return me(i,i.next),me(t,t.next)}function Na(r,e){var t=e,i=r.x,n=r.y,s=-1/0,o;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){var a=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>s&&(s=a,o=t.x<t.next.x?t:t.next,a===i))return o}t=t.next}while(t!==e);if(!o)return null;var h=o,u=o.x,l=o.y,f=1/0,c;t=o;do i>=t.x&&t.x>=u&&i!==t.x&&Me(n<l?i:s,n,u,l,n<l?s:i,n,t.x,t.y)&&(c=Math.abs(n-t.y)/(i-t.x),Ve(t,r)&&(c<f||c===f&&(t.x>o.x||t.x===o.x&&Ba(o,t)))&&(o=t,f=c)),t=t.next;while(t!==h);return o}function Ba(r,e){return ht(r.prev,r,e.prev)<0&&ht(e.next,r,r.next)<0}function La(r,e,t,i){var n=r;do n.z===0&&(n.z=yr(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==r);n.prevZ.nextZ=null,n.prevZ=null,Ua(n)}function Ua(r){var e,t,i,n,s,o,a,h,u=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<u&&(a++,i=i.nextZ,!!i);e++);for(h=u;a>0||h>0&&i;)a!==0&&(h===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,a--):(n=i,i=i.nextZ,h--),s?s.nextZ=n:r=n,n.prevZ=s,s=n;t=i}s.nextZ=null,u*=2}while(o>1);return r}function yr(r,e,t,i,n){return r=(r-t)*n|0,e=(e-i)*n|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function Ga(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Me(r,e,t,i,n,s,o,a){return(n-o)*(e-a)>=(r-o)*(s-a)&&(r-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(n-o)*(i-a)}function ka(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Ha(r,e)&&(Ve(r,e)&&Ve(e,r)&&Xa(r,e)&&(ht(r.prev,r,e.prev)||ht(r,e.prev,e))||Pi(r,e)&&ht(r.prev,r,r.next)>0&&ht(e.prev,e,e.next)>0)}function ht(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Pi(r,e){return r.x===e.x&&r.y===e.y}function os(r,e,t,i){var n=Ai(ht(r,e,t)),s=Ai(ht(r,e,i)),o=Ai(ht(t,i,r)),a=Ai(ht(t,i,e));return!!(n!==s&&o!==a||n===0&&Ci(r,t,e)||s===0&&Ci(r,i,e)||o===0&&Ci(t,r,i)||a===0&&Ci(t,e,i))}function Ci(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Ai(r){return r>0?1:r<0?-1:0}function Ha(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&os(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ve(r,e){return ht(r.prev,r,r.next)<0?ht(r,e,r.next)>=0&&ht(r,r.prev,e)>=0:ht(r,e,r.prev)<0||ht(r,r.next,e)<0}function Xa(r,e){var t=r,i=!1,n=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function as(r,e){var t=new xr(r.i,r.x,r.y),i=new xr(e.i,e.x,e.y),n=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=n,n.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function hs(r,e,t,i){var n=new xr(r,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function qe(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function xr(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Si.deviation=function(r,e,t,i){var n=e&&e.length,s=n?e[0]*t:r.length,o=Math.abs(br(r,0,s,t));if(n)for(var a=0,h=e.length;a<h;a++){var u=e[a]*t,l=a<h-1?e[a+1]*t:r.length;o-=Math.abs(br(r,u,l,t))}var f=0;for(a=0;a<i.length;a+=3){var c=i[a]*t,d=i[a+1]*t,p=i[a+2]*t;f+=Math.abs((r[c]-r[p])*(r[d+1]-r[c+1])-(r[c]-r[d])*(r[p+1]-r[c+1]))}return o===0&&f===0?0:Math.abs((f-o)/o)};function br(r,e,t,i){for(var n=0,s=e,o=t-i;s<t;s+=i)n+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return n}Si.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,n=0;n<r.length;n++){for(var s=0;s<r[n].length;s++)for(var o=0;o<e;o++)t.vertices.push(r[n][s][o]);n>0&&(i+=r[n-1].length,t.holes.push(i))}return t};var Tr={exports:{}};(function(r,e){(function(t){var i=e&&!e.nodeType&&e,n=r&&!r.nodeType&&r,s=typeof dr=="object"&&dr;(s.global===s||s.window===s||s.self===s)&&(t=s);var o,a=2147483647,h=36,u=1,l=26,f=38,c=700,d=72,p=128,v="-",_=/^xn--/,m=/[^\x20-\x7E]/,y=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=h-u,x=Math.floor,T=String.fromCharCode,w;function I(O){throw RangeError(g[O])}function S(O,C){for(var B=O.length,$=[];B--;)$[B]=C(O[B]);return $}function P(O,C){var B=O.split("@"),$="";B.length>1&&($=B[0]+"@",O=B[1]),O=O.replace(y,".");var Z=O.split("."),pt=S(Z,C).join(".");return $+pt}function E(O){for(var C=[],B=0,$=O.length,Z,pt;B<$;)Z=O.charCodeAt(B++),Z>=55296&&Z<=56319&&B<$?(pt=O.charCodeAt(B++),(pt&64512)==56320?C.push(((Z&1023)<<10)+(pt&1023)+65536):(C.push(Z),B--)):C.push(Z);return C}function D(O){return S(O,function(C){var B="";return C>65535&&(C-=65536,B+=T(C>>>10&1023|55296),C=56320|C&1023),B+=T(C),B}).join("")}function N(O){return O-48<10?O-22:O-65<26?O-65:O-97<26?O-97:h}function W(O,C){return O+22+75*(O<26)-((C!=0)<<5)}function R(O,C,B){var $=0;for(O=B?x(O/c):O>>1,O+=x(O/C);O>b*l>>1;$+=h)O=x(O/b);return x($+(b+1)*O/(O+f))}function M(O){var C=[],B=O.length,$,Z=0,pt=p,nt=d,st,bt,wt,vt,tt,rt,ot,V,St;for(st=O.lastIndexOf(v),st<0&&(st=0),bt=0;bt<st;++bt)O.charCodeAt(bt)>=128&&I("not-basic"),C.push(O.charCodeAt(bt));for(wt=st>0?st+1:0;wt<B;){for(vt=Z,tt=1,rt=h;wt>=B&&I("invalid-input"),ot=N(O.charCodeAt(wt++)),(ot>=h||ot>x((a-Z)/tt))&&I("overflow"),Z+=ot*tt,V=rt<=nt?u:rt>=nt+l?l:rt-nt,!(ot<V);rt+=h)St=h-V,tt>x(a/St)&&I("overflow"),tt*=St;$=C.length+1,nt=R(Z-vt,$,vt==0),x(Z/$)>a-pt&&I("overflow"),pt+=x(Z/$),Z%=$,C.splice(Z++,0,pt)}return D(C)}function G(O){var C,B,$,Z,pt,nt,st,bt,wt,vt,tt,rt=[],ot,V,St,Pt;for(O=E(O),ot=O.length,C=p,B=0,pt=d,nt=0;nt<ot;++nt)tt=O[nt],tt<128&&rt.push(T(tt));for($=Z=rt.length,Z&&rt.push(v);$<ot;){for(st=a,nt=0;nt<ot;++nt)tt=O[nt],tt>=C&&tt<st&&(st=tt);for(V=$+1,st-C>x((a-B)/V)&&I("overflow"),B+=(st-C)*V,C=st,nt=0;nt<ot;++nt)if(tt=O[nt],tt<C&&++B>a&&I("overflow"),tt==C){for(bt=B,wt=h;vt=wt<=pt?u:wt>=pt+l?l:wt-pt,!(bt<vt);wt+=h)Pt=bt-vt,St=h-vt,rt.push(T(W(vt+Pt%St,0))),bt=x(Pt/St);rt.push(T(W(bt,0))),pt=R(B,V,$==Z),B=0,++$}++B,++C}return rt.join("")}function ut(O){return P(O,function(C){return _.test(C)?M(C.slice(4).toLowerCase()):C})}function z(O){return P(O,function(C){return m.test(C)?"xn--"+G(C):C})}if(o={version:"1.3.2",ucs2:{decode:E,encode:D},decode:M,encode:G,toASCII:z,toUnicode:ut},i&&n)if(r.exports==i)n.exports=o;else for(w in o)o.hasOwnProperty(w)&&(i[w]=o[w]);else t.punycode=o})(dr)})(Tr,Tr.exports);var Wa={isString:function(r){return typeof r=="string"},isObject:function(r){return typeof r=="object"&&r!==null},isNull:function(r){return r===null},isNullOrUndefined:function(r){return r==null}},$e={};function ja(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var za=function(r,e,t,i){e=e||"&",t=t||"=";var n={};if(typeof r!="string"||r.length===0)return n;var s=/\+/g;r=r.split(e);var o=1e3;i&&typeof i.maxKeys=="number"&&(o=i.maxKeys);var a=r.length;o>0&&a>o&&(a=o);for(var h=0;h<a;++h){var u=r[h].replace(s,"%20"),l=u.indexOf(t),f,c,d,p;l>=0?(f=u.substr(0,l),c=u.substr(l+1)):(f=u,c=""),d=decodeURIComponent(f),p=decodeURIComponent(c),ja(n,d)?Array.isArray(n[d])?n[d].push(p):n[d]=[n[d],p]:n[d]=p}return n},Ze=function(r){switch(typeof r){case"string":return r;case"boolean":return r?"true":"false";case"number":return isFinite(r)?r:"";default:return""}},Ya=function(r,e,t,i){return e=e||"&",t=t||"=",r===null&&(r=void 0),typeof r=="object"?Object.keys(r).map(function(n){var s=encodeURIComponent(Ze(n))+t;return Array.isArray(r[n])?r[n].map(function(o){return s+encodeURIComponent(Ze(o))}).join(e):s+encodeURIComponent(Ze(r[n]))}).join(e):i?encodeURIComponent(Ze(i))+t+encodeURIComponent(Ze(r)):""};$e.decode=$e.parse=za,$e.encode=$e.stringify=Ya;var Va=Tr.exports,Yt=Wa,qa=Ri,$a=oh,Za=sh;function Ft(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Ka=/^([a-z0-9.+-]+:)/i,Qa=/:[0-9]*$/,Ja=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,th=["<",">",'"',"`"," ","\r",`
2
2
  `," "],eh=["{","}","|","\\","^","`"].concat(th),wr=["'"].concat(eh),us=["%","/","?",";","#"].concat(wr),ls=["/","?","#"],ih=255,fs=/^[+a-z0-9A-Z_-]{0,63}$/,rh=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,nh={javascript:!0,"javascript:":!0},Er={javascript:!0,"javascript:":!0},De={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Sr=$e;function Ri(r,e,t){if(r&&Yt.isObject(r)&&r instanceof Ft)return r;var i=new Ft;return i.parse(r,e,t),i}Ft.prototype.parse=function(r,e,t){if(!Yt.isString(r))throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),n=i!==-1&&i<r.indexOf("#")?"?":"#",s=r.split(n),o=/\\/g;s[0]=s[0].replace(o,"/"),r=s.join(n);var a=r;if(a=a.trim(),!t&&r.split("#").length===1){var h=Ja.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],e?this.query=Sr.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var u=Ka.exec(a);if(u){u=u[0];var l=u.toLowerCase();this.protocol=l,a=a.substr(u.length)}if(t||u||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=a.substr(0,2)==="//";f&&!(u&&Er[u])&&(a=a.substr(2),this.slashes=!0)}if(!Er[u]&&(f||u&&!De[u])){for(var c=-1,d=0;d<ls.length;d++){var p=a.indexOf(ls[d]);p!==-1&&(c===-1||p<c)&&(c=p)}var v,_;c===-1?_=a.lastIndexOf("@"):_=a.lastIndexOf("@",c),_!==-1&&(v=a.slice(0,_),a=a.slice(_+1),this.auth=decodeURIComponent(v)),c=-1;for(var d=0;d<us.length;d++){var p=a.indexOf(us[d]);p!==-1&&(c===-1||p<c)&&(c=p)}c===-1&&(c=a.length),this.host=a.slice(0,c),a=a.slice(c),this.parseHost(),this.hostname=this.hostname||"";var m=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!m)for(var y=this.hostname.split(/\./),d=0,g=y.length;d<g;d++){var b=y[d];if(b&&!b.match(fs)){for(var x="",T=0,w=b.length;T<w;T++)b.charCodeAt(T)>127?x+="x":x+=b[T];if(!x.match(fs)){var I=y.slice(0,d),S=y.slice(d+1),P=b.match(rh);P&&(I.push(P[1]),S.unshift(P[2])),S.length&&(a="/"+S.join(".")+a),this.hostname=I.join(".");break}}}this.hostname.length>ih?this.hostname="":this.hostname=this.hostname.toLowerCase(),m||(this.hostname=Va.toASCII(this.hostname));var E=this.port?":"+this.port:"",D=this.hostname||"";this.host=D+E,this.href+=this.host,m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!nh[l])for(var d=0,g=wr.length;d<g;d++){var N=wr[d];if(a.indexOf(N)!==-1){var W=encodeURIComponent(N);W===N&&(W=escape(N)),a=a.split(N).join(W)}}var R=a.indexOf("#");R!==-1&&(this.hash=a.substr(R),a=a.slice(0,R));var M=a.indexOf("?");if(M!==-1?(this.search=a.substr(M),this.query=a.substr(M+1),e&&(this.query=Sr.parse(this.query)),a=a.slice(0,M)):e&&(this.search="",this.query={}),a&&(this.pathname=a),De[l]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var E=this.pathname||"",G=this.search||"";this.path=E+G}return this.href=this.format(),this};function sh(r){return Yt.isString(r)&&(r=Ri(r)),r instanceof Ft?r.format():Ft.prototype.format.call(r)}Ft.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var e=this.protocol||"",t=this.pathname||"",i=this.hash||"",n=!1,s="";this.host?n=r+this.host:this.hostname&&(n=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&Yt.isObject(this.query)&&Object.keys(this.query).length&&(s=Sr.stringify(this.query));var o=this.search||s&&"?"+s||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||De[e])&&n!==!1?(n="//"+(n||""),t&&t.charAt(0)!=="/"&&(t="/"+t)):n||(n=""),i&&i.charAt(0)!=="#"&&(i="#"+i),o&&o.charAt(0)!=="?"&&(o="?"+o),t=t.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),o=o.replace("#","%23"),e+n+t+o+i};function oh(r,e){return Ri(r,!1,!0).resolve(e)}Ft.prototype.resolve=function(r){return this.resolveObject(Ri(r,!1,!0)).format()},Ft.prototype.resolveObject=function(r){if(Yt.isString(r)){var e=new Ft;e.parse(r,!1,!0),r=e}for(var t=new Ft,i=Object.keys(this),n=0;n<i.length;n++){var s=i[n];t[s]=this[s]}if(t.hash=r.hash,r.href==="")return t.href=t.format(),t;if(r.slashes&&!r.protocol){for(var o=Object.keys(r),a=0;a<o.length;a++){var h=o[a];h!=="protocol"&&(t[h]=r[h])}return De[t.protocol]&&t.hostname&&!t.pathname&&(t.path=t.pathname="/"),t.href=t.format(),t}if(r.protocol&&r.protocol!==t.protocol){if(!De[r.protocol]){for(var u=Object.keys(r),l=0;l<u.length;l++){var f=u[l];t[f]=r[f]}return t.href=t.format(),t}if(t.protocol=r.protocol,!r.host&&!Er[r.protocol]){for(var g=(r.pathname||"").split("/");g.length&&!(r.host=g.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),t.pathname=g.join("/")}else t.pathname=r.pathname;if(t.search=r.search,t.query=r.query,t.host=r.host||"",t.auth=r.auth,t.hostname=r.hostname||r.host,t.port=r.port,t.pathname||t.search){var c=t.pathname||"",d=t.search||"";t.path=c+d}return t.slashes=t.slashes||r.slashes,t.href=t.format(),t}var p=t.pathname&&t.pathname.charAt(0)==="/",v=r.host||r.pathname&&r.pathname.charAt(0)==="/",_=v||p||t.host&&r.pathname,m=_,y=t.pathname&&t.pathname.split("/")||[],g=r.pathname&&r.pathname.split("/")||[],b=t.protocol&&!De[t.protocol];if(b&&(t.hostname="",t.port=null,t.host&&(y[0]===""?y[0]=t.host:y.unshift(t.host)),t.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(g[0]===""?g[0]=r.host:g.unshift(r.host)),r.host=null),_=_&&(g[0]===""||y[0]==="")),v)t.host=r.host||r.host===""?r.host:t.host,t.hostname=r.hostname||r.hostname===""?r.hostname:t.hostname,t.search=r.search,t.query=r.query,y=g;else if(g.length)y||(y=[]),y.pop(),y=y.concat(g),t.search=r.search,t.query=r.query;else if(!Yt.isNullOrUndefined(r.search)){if(b){t.hostname=t.host=y.shift();var x=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;x&&(t.auth=x.shift(),t.host=t.hostname=x.shift())}return t.search=r.search,t.query=r.query,(!Yt.isNull(t.pathname)||!Yt.isNull(t.search))&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!y.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var T=y.slice(-1)[0],w=(t.host||r.host||y.length>1)&&(T==="."||T==="..")||T==="",I=0,S=y.length;S>=0;S--)T=y[S],T==="."?y.splice(S,1):T===".."?(y.splice(S,1),I++):I&&(y.splice(S,1),I--);if(!_&&!m)for(;I--;I)y.unshift("..");_&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),w&&y.join("/").substr(-1)!=="/"&&y.push("");var P=y[0]===""||y[0]&&y[0].charAt(0)==="/";if(b){t.hostname=t.host=P?"":y.length?y.shift():"";var x=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;x&&(t.auth=x.shift(),t.host=t.hostname=x.shift())}return _=_||t.host&&y.length,_&&!P&&y.unshift(""),y.length?t.pathname=y.join("/"):(t.pathname=null,t.path=null),(!Yt.isNull(t.pathname)||!Yt.isNull(t.search))&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=r.auth||t.auth,t.slashes=t.slashes||r.slashes,t.href=t.format(),t},Ft.prototype.parseHost=function(){var r=this.host,e=Qa.exec(r);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),r=r.substr(0,r.length-e.length)),r&&(this.hostname=r)};var Fe={parse:qa,format:Za,resolve:$a};F.RETINA_PREFIX=/@([0-9\.]+)x/,F.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var cs=!1,ds="6.5.8";function ah(r){var e;if(!cs){if(F.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var t=[`
3
3
  %c %c %c PixiJS `+ds+" - ✰ "+r+` ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥
4
4
 
@@ -1053,5 +1053,5 @@ void main()
1053
1053
 
1054
1054
  gl_FragColor = color;
1055
1055
  }
1056
- `;(function(r){qp(e,r);function e(t,i){t===void 0&&(t=.5),i===void 0&&(i=Math.random());var n=r.call(this,Ks,$p,{uNoise:0,uSeed:0})||this;return n.noise=t,n.seed=i,n}return Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(t){this.uniforms.uNoise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(t){this.uniforms.uSeed=t},enumerable:!1,configurable:!0}),e})(ae);var Xo=new mt;dt.prototype._cacheAsBitmap=!1,dt.prototype._cacheData=null,dt.prototype._cacheAsBitmapResolution=null,dt.prototype._cacheAsBitmapMultisample=ft.NONE;var Zp=function(){function r(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}return r}();Object.defineProperties(dt.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(r){if(this._cacheAsBitmap!==r){this._cacheAsBitmap=r;var e;r?(this._cacheData||(this._cacheData=new Zp),e=this._cacheData,e.originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(e=this._cacheData,e.sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}}}),dt.prototype._renderCached=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(e),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(e))},dt.prototype._initCachedDisplayObject=function(e){var t;if(!(this._cacheData&&this._cacheData.sprite)){var i=this.alpha;this.alpha=1,e.batch.flush();var n=this.getLocalBounds(null,!0).clone();if(this.filters&&this.filters.length){var s=this.filters[0].padding;n.pad(s)}n.ceil(F.RESOLUTION);var o=e.renderTexture.current,a=e.renderTexture.sourceFrame.clone(),h=e.renderTexture.destinationFrame.clone(),u=e.projection.transform,l=xe.create({width:n.width,height:n.height,resolution:this.cacheAsBitmapResolution||e.resolution,multisample:(t=this.cacheAsBitmapMultisample)!==null&&t!==void 0?t:e.multisample}),f="cacheAsBitmap_"+ge();this._cacheData.textureCacheId=f,Y.addToCache(l.baseTexture,f),k.addToCache(l,f);var c=this.transform.localTransform.copyTo(Xo).invert().translate(-n.x,-n.y);this.render=this._cacheData.originalRender,e.render(this,{renderTexture:l,clear:!0,transform:c,skipUpdateTransform:!1}),e.framebuffer.blit(),e.projection.transform=u,e.renderTexture.bind(o,a,h),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;var d=new ui(l);d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-(n.x/n.width),d.anchor.y=-(n.y/n.height),d.alpha=i,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=d.containsPoint.bind(d)}},dt.prototype._renderCachedCanvas=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(e),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(e))},dt.prototype._initCachedDisplayObjectCanvas=function(e){if(!(this._cacheData&&this._cacheData.sprite)){var t=this.getLocalBounds(null,!0),i=this.alpha;this.alpha=1;var n=e.context,s=e._projTransform;t.ceil(F.RESOLUTION);var o=xe.create({width:t.width,height:t.height}),a="cacheAsBitmap_"+ge();this._cacheData.textureCacheId=a,Y.addToCache(o.baseTexture,a),k.addToCache(o,a);var h=Xo;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,e.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),e.context=n,e._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;var u=new ui(o);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(t.x/t.width),u.anchor.y=-(t.y/t.height),u.alpha=i,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u)}},dt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},dt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},dt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,Y.removeFromCache(this._cacheData.textureCacheId),k.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},dt.prototype._cacheAsBitmapDestroy=function(e){this.cacheAsBitmap=!1,this.destroy(e)};dt.prototype.name=null,Et.prototype.getChildByName=function(e,t){for(var i=0,n=this.children.length;i<n;i++)if(this.children[i].name===e)return this.children[i];if(t)for(var i=0,n=this.children.length;i<n;i++){var s=this.children[i];if(s.getChildByName){var o=s.getChildByName(e,!0);if(o)return o}}return null};dt.prototype.getGlobalPosition=function(e,t){return e===void 0&&(e=new X),t===void 0&&(t=!1),this.parent?this.parent.toGlobal(this.position,e,t):(e.x=this.position.x,e.y=this.position.y),e};var Kp=function(){function r(){}return r.init=function(e){var t=this;Object.defineProperty(this,"resizeTo",{set:function(i){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=i,i&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){t._resizeTo&&(t.cancelResize(),t._resizeId=requestAnimationFrame(function(){return t.resize()}))},this.cancelResize=function(){t._resizeId&&(cancelAnimationFrame(t._resizeId),t._resizeId=null)},this.resize=function(){if(t._resizeTo){t.cancelResize();var i,n;if(t._resizeTo===globalThis.window)i=globalThis.innerWidth,n=globalThis.innerHeight;else{var s=t._resizeTo,o=s.clientWidth,a=s.clientHeight;i=o,n=a}t.renderer.resize(i,n)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null},r.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},r.extension=J.Application,r}(),Wo=function(){function r(e){var t=this;this.stage=new Et,e=Object.assign({forceCanvas:!1},e),this.renderer=Pc(e),r._plugins.forEach(function(i){i.init.call(t,e)})}return r.registerPlugin=function(e){Nt("6.5.0","Application.registerPlugin() is deprecated, use extensions.add()"),Qt.add({type:J.Application,ref:e})},r.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(r.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),r.prototype.destroy=function(e,t){var i=this,n=r._plugins.slice(0);n.reverse(),n.forEach(function(s){s.destroy.call(i)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null},r._plugins=[],r}();Qt.handleByList(J.Application,Wo._plugins),Qt.add(Kp);var Dn=function(r,e){return Dn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Dn(r,e)};function He(r,e){Dn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Qp=function(r){He(e,r);function e(t,i,n,s){t===void 0&&(t=100),i===void 0&&(i=100),n===void 0&&(n=10),s===void 0&&(s=10);var o=r.call(this)||this;return o.segWidth=n,o.segHeight=s,o.width=t,o.height=i,o.build(),o}return e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,i=[],n=[],s=[],o=this.segWidth-1,a=this.segHeight-1,h=this.width/o,u=this.height/a,l=0;l<t;l++){var f=l%this.segWidth,c=l/this.segWidth|0;i.push(f*h,c*u),n.push(f/o,c/a)}for(var d=o*a,l=0;l<d;l++){var p=l%o,v=l/o|0,_=v*this.segWidth+p,m=v*this.segWidth+p+1,y=(v+1)*this.segWidth+p,g=(v+1)*this.segWidth+p+1;s.push(_,m,y,m,g,y)}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(n),this.indexBuffer.data=new Uint16Array(s),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},e}(ir),Jp=function(r){He(e,r);function e(t,i,n){t===void 0&&(t=200),n===void 0&&(n=0);var s=r.call(this,new Float32Array(i.length*4),new Float32Array(i.length*4),new Uint16Array((i.length-1)*6))||this;return s.points=i,s._width=t,s.textureScale=n,s.build(),s}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),e.prototype.build=function(){var t=this.points;if(t){var i=this.getBuffer("aVertexPosition"),n=this.getBuffer("aTextureCoord"),s=this.getIndex();if(!(t.length<1)){i.data.length/4!==t.length&&(i.data=new Float32Array(t.length*4),n.data=new Float32Array(t.length*4),s.data=new Uint16Array((t.length-1)*6));var o=n.data,a=s.data;o[0]=0,o[1]=0,o[2]=0,o[3]=1;for(var h=0,u=t[0],l=this._width*this.textureScale,f=t.length,c=0;c<f;c++){var d=c*4;if(this.textureScale>0){var p=u.x-t[c].x,v=u.y-t[c].y,_=Math.sqrt(p*p+v*v);u=t[c],h+=_/l}else h=c/(f-1);o[d]=h,o[d+1]=0,o[d+2]=h,o[d+3]=1}for(var m=0,c=0;c<f-1;c++){var d=c*2;a[m++]=d,a[m++]=d+1,a[m++]=d+2,a[m++]=d+2,a[m++]=d+1,a[m++]=d+3}n.update(),s.update(),this.updateVertices()}}},e.prototype.updateVertices=function(){var t=this.points;if(!(t.length<1)){for(var i=t[0],n,s=0,o=0,a=this.buffers[0].data,h=t.length,u=0;u<h;u++){var l=t[u],f=u*4;u<t.length-1?n=t[u+1]:n=l,o=-(n.x-i.x),s=n.y-i.y;var c=Math.sqrt(s*s+o*o),d=this.textureScale>0?this.textureScale*this._width/2:this._width/2;s/=c,o/=c,s*=d,o*=d,a[f]=l.x+s,a[f+1]=l.y+o,a[f+2]=l.x-s,a[f+3]=l.y-o,i=l}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(ir);(function(r){He(e,r);function e(t,i,n){n===void 0&&(n=0);var s=this,o=new Jp(t.height,i,n),a=new di(t);return n>0&&(t.baseTexture.wrapMode=Wt.REPEAT),s=r.call(this,o,a)||this,s.autoUpdate=!0,s}return e.prototype._render=function(t){var i=this.geometry;(this.autoUpdate||i._width!==this.shader.texture.height)&&(i._width=this.shader.texture.height,i.update()),r.prototype._render.call(this,t)},e})(ci);var tv=function(r){He(e,r);function e(t,i,n){var s=this,o=new Qp(t.width,t.height,i,n),a=new di(k.WHITE);return s=r.call(this,o,a)||this,s.texture=t,s.autoResize=!0,s}return e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry,i=this.shader.texture,n=i.width,s=i.height;this.autoResize&&(t.width!==n||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())},Object.defineProperty(e.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),e.prototype._render=function(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),r.prototype._render.call(this,t)},e.prototype.destroy=function(t){this.shader.texture.off("update",this.textureUpdated,this),r.prototype.destroy.call(this,t)},e}(ci);(function(r){He(e,r);function e(t,i,n,s,o){t===void 0&&(t=k.EMPTY);var a=this,h=new ir(i,n,s);h.getBuffer("aVertexPosition").static=!1;var u=new di(t);return a=r.call(this,h,u,null,o)||this,a.autoUpdate=!0,a}return Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype._render=function(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),r.prototype._render.call(this,t)},e})(ci);var sr=10;(function(r){He(e,r);function e(t,i,n,s,o){i===void 0&&(i=sr),n===void 0&&(n=sr),s===void 0&&(s=sr),o===void 0&&(o=sr);var a=r.call(this,k.WHITE,4,4)||this;return a._origWidth=t.orig.width,a._origHeight=t.orig.height,a._width=a._origWidth,a._height=a._origHeight,a._leftWidth=i,a._rightWidth=s,a._topHeight=n,a._bottomHeight=o,a.texture=t,a}return e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,i=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*i,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*i,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,i=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*i,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*i,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,i=this._width>t?1:this._width/t,n=this._topHeight+this._bottomHeight,s=this._height>n?1:this._height/n,o=Math.min(i,s);return o},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,i=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var n=1/this._origWidth,s=1/this._origHeight;i[0]=i[8]=i[16]=i[24]=0,i[1]=i[3]=i[5]=i[7]=0,i[6]=i[14]=i[22]=i[30]=1,i[25]=i[27]=i[29]=i[31]=1,i[2]=i[10]=i[18]=i[26]=n*this._leftWidth,i[4]=i[12]=i[20]=i[28]=1-n*this._rightWidth,i[9]=i[11]=i[13]=i[15]=s*this._topHeight,i[17]=i[19]=i[21]=i[23]=1-s*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e})(tv);var Fn=function(r,e){return Fn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Fn(r,e)};function ev(r,e){Fn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}(function(r){ev(e,r);function e(t,i){i===void 0&&(i=!0);var n=r.call(this,t[0]instanceof k?t[0]:t[0].texture)||this;return n._textures=null,n._durations=null,n._autoUpdate=i,n._isConnectedToTicker=!1,n.animationSpeed=1,n.loop=!0,n.updateAnchor=!1,n.onComplete=null,n.onFrameChange=null,n.onLoop=null,n._currentTime=0,n._playing=!1,n._previousFrame=null,n.textures=t,n}return e.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(xt.shared.remove(this.update,this),this._isConnectedToTicker=!1))},e.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(xt.shared.add(this.update,this,Jt.HIGH),this._isConnectedToTicker=!0))},e.prototype.gotoAndStop=function(t){this.stop();var i=this.currentFrame;this._currentTime=t,i!==this.currentFrame&&this.updateTexture()},e.prototype.gotoAndPlay=function(t){var i=this.currentFrame;this._currentTime=t,i!==this.currentFrame&&this.updateTexture(),this.play()},e.prototype.update=function(t){if(this._playing){var i=this.animationSpeed*t,n=this.currentFrame;if(this._durations!==null){var s=this._currentTime%1*this._durations[this.currentFrame];for(s+=i/60*1e3;s<0;)this._currentTime--,s+=this._durations[this.currentFrame];var o=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);s>=this._durations[this.currentFrame];)s-=this._durations[this.currentFrame]*o,this._currentTime+=o;this._currentTime+=s/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):n!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<n?this.onLoop():this.animationSpeed<0&&this.currentFrame>n&&this.onLoop()),this.updateTexture())}},e.prototype.updateTexture=function(){var t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},e.prototype.destroy=function(t){this.stop(),r.prototype.destroy.call(this,t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},e.fromFrames=function(t){for(var i=[],n=0;n<t.length;++n)i.push(k.from(t[n]));return new e(i)},e.fromImages=function(t){for(var i=[],n=0;n<t.length;++n)i.push(k.from(t[n]));return new e(i)},Object.defineProperty(e.prototype,"totalFrames",{get:function(){return this._textures.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this._textures},set:function(t){if(t[0]instanceof k)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(var i=0;i<t.length;i++)this._textures.push(t[i].texture),this._durations.push(t[i].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentFrame",{get:function(){var t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(xt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(xt.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),e})(ui);Qt.add(kc,Yc,zc,Ud,dp,eo,xp,Mp,ud,Fd,Nd,vp,nf,td);var jo={exports:{}};(function(r){(function(){function e(v,_){document.addEventListener?v.addEventListener("scroll",_,!1):v.attachEvent("scroll",_)}function t(v){document.body?v():document.addEventListener?document.addEventListener("DOMContentLoaded",function _(){document.removeEventListener("DOMContentLoaded",_),v()}):document.attachEvent("onreadystatechange",function _(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",_),v())})}function i(v){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(v)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function n(v,_){v.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+_+";"}function s(v){var _=v.g.offsetWidth,m=_+100;return v.j.style.width=m+"px",v.i.scrollLeft=m,v.h.scrollLeft=v.h.scrollWidth+100,v.l!==_?(v.l=_,!0):!1}function o(v,_){function m(){var g=y;s(g)&&g.g.parentNode!==null&&_(g.l)}var y=v;e(v.h,m),e(v.i,m),s(v)}function a(v,_,m){_=_||{},m=m||window,this.family=v,this.style=_.style||"normal",this.weight=_.weight||"normal",this.stretch=_.stretch||"normal",this.context=m}var h=null,u=null,l=null,f=null;function c(v){return u===null&&(d(v)&&/Apple/.test(window.navigator.vendor)?(v=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),u=!!v&&603>parseInt(v[1],10)):u=!1),u}function d(v){return f===null&&(f=!!v.document.fonts),f}function p(v,_){var m=v.style,y=v.weight;if(l===null){var g=document.createElement("div");try{g.style.font="condensed 100px sans-serif"}catch{}l=g.style.font!==""}return[m,y,l?v.stretch:"","100px",_].join(" ")}a.prototype.load=function(v,_){var m=this,y=v||"BESbswy",g=0,b=_||3e3,x=new Date().getTime();return new Promise(function(T,w){if(d(m.context)&&!c(m.context)){var I=new Promise(function(P,E){function D(){new Date().getTime()-x>=b?E(Error(""+b+"ms timeout exceeded")):m.context.document.fonts.load(p(m,'"'+m.family+'"'),y).then(function(N){1<=N.length?P():setTimeout(D,25)},E)}D()}),S=new Promise(function(P,E){g=setTimeout(function(){E(Error(""+b+"ms timeout exceeded"))},b)});Promise.race([S,I]).then(function(){clearTimeout(g),T(m)},w)}else t(function(){function P(){var B;(B=R!=-1&&M!=-1||R!=-1&&G!=-1||M!=-1&&G!=-1)&&((B=R!=M&&R!=G&&M!=G)||(h===null&&(B=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!B&&(536>parseInt(B[1],10)||parseInt(B[1],10)===536&&11>=parseInt(B[2],10))),B=h&&(R==ut&&M==ut&&G==ut||R==z&&M==z&&G==z||R==O&&M==O&&G==O)),B=!B),B&&(C.parentNode!==null&&C.parentNode.removeChild(C),clearTimeout(g),T(m))}function E(){if(new Date().getTime()-x>=b)C.parentNode!==null&&C.parentNode.removeChild(C),w(Error(""+b+"ms timeout exceeded"));else{var B=m.context.document.hidden;(B===!0||B===void 0)&&(R=D.g.offsetWidth,M=N.g.offsetWidth,G=W.g.offsetWidth,P()),g=setTimeout(E,50)}}var D=new i(y),N=new i(y),W=new i(y),R=-1,M=-1,G=-1,ut=-1,z=-1,O=-1,C=document.createElement("div");C.dir="ltr",n(D,p(m,"sans-serif")),n(N,p(m,"serif")),n(W,p(m,"monospace")),C.appendChild(D.g),C.appendChild(N.g),C.appendChild(W.g),m.context.document.body.appendChild(C),ut=D.g.offsetWidth,z=N.g.offsetWidth,O=W.g.offsetWidth,E(),o(D,function(B){R=B,P()}),n(D,p(m,'"'+m.family+'",sans-serif')),o(N,function(B){M=B,P()}),n(N,p(m,'"'+m.family+'",serif')),o(W,function(B){G=B,P()}),n(W,p(m,'"'+m.family+'",monospace'))})})},r.exports=a})()})(jo);const iv=jo.exports,rv=["0123456789","abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ",`.,:;!?()[]{}<>|/\\@'"`].join(""),Nn=new Ae({fontFamily:"InterVariable",fontSize:24,lineHeight:32});function nv(){const r=window.devicePixelRatio||2;return new Promise(e=>{new iv("InterVariable").load().then(()=>{const i={resolution:r,chars:rv};kt.from("NodeTextDefault",{...Nn,fill:1120295},i),kt.from("NodeTextInverse",{...Nn,fill:16777215},i),kt.from("TimeMarkerLabel",{fontFamily:"InterVariable",fontSize:16,lineHeight:24,fill:9741240},i),e({nodeTextDefault:{fontName:"NodeTextDefault",fontSize:24},nodeTextInverse:{fontName:"NodeTextInverse",fontSize:24},nodeTextMetrics:Nn,timeMarkerLabel:{fontName:"TimeMarkerLabel",fontSize:12}})})})}const sv=nv(),zo=()=>sv;function ov(r){const e=new Wo({backgroundAlpha:0,width:r.clientWidth,height:r.clientHeight,resolution:window.devicePixelRatio||2,autoDensity:!0,antialias:!0,resizeTo:r});return r.appendChild(e.view),e}class Rt{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 av=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hv(r,e,t){return t={path:e,exports:{},require:function(i,n){return uv(i,n??t.path)}},r(t,t.exports),t.exports}function uv(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Yo=hv(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(av)});function or(r,e){if(r){if(typeof r=="function")return r;if(typeof r=="string")return Yo[r]}else return Yo[e]}const lv={removeOnInterrupt:!1,ease:"linear",time:1e3};class re extends Rt{__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),re.prototype.__init.call(this),re.prototype.__init2.call(this),re.prototype.__init3.call(this),re.prototype.__init4.call(this),re.prototype.__init5.call(this),re.prototype.__init6.call(this),re.prototype.__init7.call(this),this.options=Object.assign({},lv,t),this.options.ease=or(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 X(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 X(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 ar(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 fv={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class cv extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},fv,t),this.ease=or(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 X(t*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new X(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 X(0,0),bottomRight:new X(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===ar([t,"access",s=>s.options,"optionalAccess",s=>s.friction])||t.y&&t.percentChangeY===ar([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||{},!ar([i,"optionalAccess",s=>s.active])&&!ar([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 dv={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class pv extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},dv,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 vv={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class _v extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},vv,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 mv={friction:.98,bounce:.8,minSpeed:.01},le=16;class gv extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},mv,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*le/o*(Math.pow(s,n/le)-Math.pow(s,i/le)),this.x*=Math.pow(this.percentChangeX,e/le)}if(this.y){const s=this.percentChangeY,o=Math.log(s);this.parent.y+=this.y*le/o*(Math.pow(s,n/le)-Math.pow(s,i/le)),this.y*=Math.pow(this.percentChangeY,e/le)}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 yv={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 Bn extends Rt{__init(){this.windowEventHandlers=new Array}constructor(e,t={}){super(e),Bn.prototype.__init.call(this),this.options=Object.assign({},yv,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 X(this.last.x,this.last.y),world:this.parent.toWorld(new X(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 X(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 xv={speed:0,acceleration:null,radius:null};class bv extends Rt{constructor(e,t,i={}){super(e),this.target=t,this.options=Object.assign({},xv,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 Tv={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class wv extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},Tv,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 Ev={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class pi extends Rt{__init(){this.active=!1}__init2(){this.pinching=!1}__init3(){this.moved=!1}constructor(e,t={}){super(e),pi.prototype.__init.call(this),pi.prototype.__init2.call(this),pi.prototype.__init3.call(this),this.options=Object.assign({},Ev,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 Sv={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class Pv extends Rt{constructor(e,t,i,n={}){super(e),this.options=Object.assign({},Sv,n),this.ease=or(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 Cv={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class Av extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},Cv,t),this.ease=or(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 Rv={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class Iv extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},Rv,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 Ov{constructor(e){this.viewport=e,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new j(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 X;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 hr(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 vi=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class Mv{constructor(e){this.viewport=e,this.list=[],this.plugins={}}add(e,t,i=vi.length){const n=this.plugins[e];n&&n.destroy(),this.plugins[e]=t;const s=vi.indexOf(e);s!==-1&&vi.splice(s,1),vi.splice(i,0,e),this.sort()}get(e,t){return t&&hr([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]&&(hr([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){hr([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.pause,"call",t=>t()])}resume(e){hr([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.resume,"call",t=>t()])}sort(){this.list=[];for(const e of vi)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 Dv={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:xt.shared};class Ln extends Et{__init(){this._disableOnContextMenu=e=>e.preventDefault()}constructor(e={}){super(),Ln.prototype.__init.call(this),this.options=Object.assign({},{divWheel:document.body},Dv,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 Ov(this),this.plugins=new Mv(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 j(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 j(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(e,t){return arguments.length===2?this.toLocal(new X(e,t)):this.toLocal(e)}toScreen(e,t){return arguments.length===2?this.toGlobal(new X(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 X(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 X(-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 Av(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 X(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 j(0,0,this.worldWidth,this.worldHeight))}drag(e){return this.plugins.add("drag",new Bn(this,e)),this}clamp(e){return this.plugins.add("clamp",new pv(this,e)),this}decelerate(e){return this.plugins.add("decelerate",new gv(this,e)),this}bounce(e){return this.plugins.add("bounce",new cv(this,e)),this}pinch(e){return this.plugins.add("pinch",new pi(this,e)),this}snap(e,t,i){return this.plugins.add("snap",new Pv(this,e,t,i)),this}follow(e,t){return this.plugins.add("follow",new bv(this,e,t)),this}wheel(e){return this.plugins.add("wheel",new Iv(this,e)),this}animate(e){return this.plugins.add("animate",new re(this,e)),this}clampZoom(e){return this.plugins.add("clamp-zoom",new _v(this,e)),this}mouseEdges(e){return this.plugins.add("mouse-edges",new wv(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"})}}function Fv(r,e){const t=r.clientWidth,i=r.clientHeight,n=new Ln({screenWidth:t,screenHeight:i,passiveWheel:!1,interaction:e.renderer.plugins.interaction,divWheel:r});return n.drag({wheel:!1,pressDrag:!0}).wheel({trackpadPinch:!0,wheelZoom:!1}).clampZoom({minWidth:t/2,maxWidth:t*20}).decelerate({friction:.9}),e.stage.addChild(n),n}let Vt={};const Nv=80,Bv=260;let Vo=10,Re=1e3*30;const Un=4e3,q={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},qo=[{ceiling:q.second*4,span:q.second},{ceiling:q.second*8,span:q.second*5},{ceiling:q.second*13,span:q.second*10},{ceiling:q.second*20,span:q.second*15},{ceiling:q.second*45,span:q.second*30},{ceiling:q.minute*4,span:q.minute},{ceiling:q.minute*8,span:q.minute*5},{ceiling:q.minute*13,span:q.minute*10},{ceiling:q.minute*28,span:q.minute*15},{ceiling:q.hour*1.24,span:q.minute*30},{ceiling:q.hour*3,span:q.hour},{ceiling:q.hour*8,span:q.hour*5},{ceiling:q.hour*13,span:q.hour*10},{ceiling:q.hour*22,span:q.hour*12},{ceiling:q.day*4,span:q.day},{ceiling:q.week*2,span:q.week},{ceiling:1/0,span:q.week*4}];function Lv(r){if(!r.stage){console.error("TimelineGuides: stage is undefined");return}const{stage:e,app:t}=r;Zo(r),Vo=Math.ceil(e.clientWidth/(Bv-Nv/2)),t.ticker.add(()=>{Uv(r)})}function Uv(r){const{isRunning:e,xScale:t}=r,i=Re;Zo(r);const n=Object.keys(Vt)[Object.keys(Vt).length-1];i!==Re||e&&Vt[n].x+Re<t(new Date)+Un?(Object.keys(Vt).length>0&&(Object.keys(Vt).forEach(s=>{Vt[s].destroy()}),Vt={}),Gv(r)):Hv(r)}function Gv(r){const{timelineGuidesContainer:e,dateScale:t,overallGraphWidth:i}=r;let n;const s=t(i+Un);for(n=new Date(Math.ceil(t(-Un)/Re)*Re);n.getTime()<s;){const a=kv(n,r);Vt[n.getTime()]=a,e.addChild(a),n=new Date(n.getTime()+Re)}}function kv(r,e){const{app:t,textStyles:i}=e,n=new Et;n.position.set($o(r,e),0);const s=new Ce;s.beginFill(13227490),s.drawRect(0,0,1,t.screen.height),s.endFill();const o=new Pn(r.toLocaleTimeString(),i.timeMarkerLabel);return o.position.set(4,4),n.addChild(s),n.addChild(o),n}function Hv(r){Object.keys(Vt).forEach(e=>{Vt[e].position.set($o(new Date(Number(e)),r),0)})}function $o(r,e){const{viewport:t,xScale:i}=e;return i(r)*t.scale._x+t.worldTransform.tx}function Zo(r){var o;const{viewport:e,dateScale:t,minimumStartDate:i}=r,n=Math.ceil((e.right-e.left)/Vo),s=t(n)-i.getTime();Re=((o=qo.find(a=>a.ceiling>s))==null?void 0:o.span)??qo[0].span}const _i={padding:16,borderRadius:8,labelGap:4},Ko={completed:42557,running:43247,scheduled:6321549,pending:6321549,failed:15728657,cancelled:15728657,crashed:15728657,paused:16035840};class Qo extends Et{constructor(t,i,n){super();ne(this,"nodeData");ne(this,"xScale");ne(this,"label");ne(this,"box");ne(this,"apxLabelWidth",0);ne(this,"nodeWidth");ne(this,"yPositionIndex",0);ne(this,"isLabelInBox",!0);this.nodeData=t,this.xScale=i,this.yPositionIndex=n,this.nodeWidth=this.getNodeWidth(),this.drawLabel(),this.box=new Ce,this.drawBox(),this.addChild(this.box),this.updatePosition()}getNodeWidth(){return this.xScale(this.nodeData.end??new Date)-this.xScale(this.nodeData.start)}async drawLabel(){var i;const t=await zo();this.apxLabelWidth===0&&(this.apxLabelWidth=Gt.measureText(this.nodeData.label,t.nodeTextMetrics).width),(i=this.label)==null||i.destroy(),this.apxLabelWidth>this.nodeWidth?(this.isLabelInBox=!1,this.label=new Pn(this.nodeData.label,t.nodeTextDefault)):(this.isLabelInBox=!0,this.label=new Pn(this.nodeData.label,t.nodeTextInverse)),this.label.position.set(this.isLabelInBox?_i.padding:this.nodeWidth+_i.labelGap,_i.padding),this.addChild(this.label)}get boxColor(){return this.nodeData.state?Ko[this.nodeData.state]:Ko.pending}drawBox(){var t;this.box.beginFill(this.boxColor),this.box.drawRoundedRect(0,0,this.nodeWidth,((t=this.label)!=null&&t.height?this.label.height:32)+_i.padding*2,_i.borderRadius),this.box.endFill()}updatePosition(){this.position.set(this.xScale(this.nodeData.start),this.yPositionIndex*120)}update(){const t=this.getNodeWidth();t!==this.nodeWidth&&(this.nodeWidth=t,this.box.clear(),this.drawBox(),(!this.isLabelInBox||this.apxLabelWidth>this.nodeWidth)&&this.drawLabel()),this.updatePosition()}}function Xv(r){let e,t;return r.forEach(i=>{(e===void 0||e>i.start||isNaN(i.start.getDate()))&&(e=i.start),i.end!==null&&(t===void 0||t<i.end||isNaN(i.end.getDate()))&&(t=i.end)}),{min:e??new Date(NaN),max:t??new Date(NaN)}}const Wv={class:"flow-run-timeline"},jv={class:"flow-run-timeline__zoom-controls"},zv=et.defineComponent({__name:"FlowRunTimeline",props:{graphData:null,isRunning:{type:Boolean}},setup(r){const e=r,t=et.ref(),i={defaultViewportPadding:40,playheadBg:5145342,playheadWidth:2,playheadGlowPadding:8};let n=et.ref(!0),s,o,a,h=new ua,u=!1,l,f=et.ref(),c;const d=new Et;let p,v=new Map;et.onMounted(()=>{if(!t.value){console.error("Stage reference not found in initPixiApp");return}_(),s=ov(t.value),g(),o=Fv(t.value,s),zo().then(E=>{a=E,Lv({app:s,viewport:o,stage:t.value,timelineGuidesContainer:d,minimumStartDate:l,overallGraphWidth:c,isRunning:e.isRunning,dateScale:I,xScale:w,textStyles:a}),x(),y(),b(),n.value=!1})}),et.onBeforeUnmount(()=>{s.destroy(!0)});function _(){var W;const E=Array.from(e.graphData).filter(R=>R.end).flatMap(({start:R,end:M})=>({start:R,end:M}));e.isRunning===!0&&E.push({start:new Date,end:new Date});const{min:D,max:N}=Xv(E);l=D,f.value=N,c=(W=t.value)!=null&&W.clientWidth?t.value.clientWidth*2:2e3}const m=et.computed(()=>{if(!f.value)return 0;const E=1e3*60,D=f.value.getTime()-l.getTime();return D<E?E:D});function y(){if(!e.isRunning)return;const E=new Ce;E.beginFill(i.playheadBg,.1),E.drawRect(0,0,i.playheadWidth+i.playheadGlowPadding*2,s.screen.height),E.endFill(),E.beginFill(i.playheadBg),E.drawRect(i.playheadGlowPadding,0,i.playheadWidth,s.screen.height),E.endFill(),s.stage.addChild(E),s.ticker.add(()=>{e.isRunning?(E.x=w(new Date)*o.scale._x+o.worldTransform.tx-i.playheadGlowPadding-i.playheadWidth/2,f.value=new Date):E.destroyed||E.destroy()})}function g(){s.stage.addChild(d)}function b(){h.addAll(o.children),o.on("frame-end",()=>{(o.dirty||u)&&(h.cull(s.renderer.screen),o.dirty=!1,u=!1)})}function x(){p=T(),o.ensureVisible(p.x-i.defaultViewportPadding,p.y-i.defaultViewportPadding,p.width+i.defaultViewportPadding*2,p.height+i.defaultViewportPadding*2,!0),o.moveCenter(p.x+p.width/2,p.y+p.height/2),e.isRunning&&s.ticker.add(()=>{e.isRunning&&v.forEach(E=>E.node.update())})}function T(){const E=new Et,D=e.graphData.map((N,W)=>{const R=new Qo(N,w,W);return v.set(N.id,{node:R,end:N.end,state:N.state}),R});return E.addChild(...D),o.addChild(E),E}et.watchEffect(()=>{n.value||e.graphData.forEach(E=>{if(v.has(E.id)){const D=v.get(E.id);(D.end!==E.end||D.state!==E.state)&&D.node.update()}else{const D=new Qo(E,w,v.size-1);p.addChild(D),u=!0}})});function w(E){return Math.ceil((E.getTime()-l.getTime())*(c/m.value))}function I(E){return Math.ceil(l.getTime()+E*(m.value/c))}function S(){o.zoom(400,!0)}function P(){o.zoom(-400,!0)}return(E,D)=>{const N=et.resolveComponent("p-button");return et.openBlock(),et.createElementBlock("div",Wv,[et.createElementVNode("div",jv,[et.createVNode(N,{icon:"MinusIcon",inset:"",rounded:"","aria-label":"Zoom out",onClick:S}),et.createVNode(N,{icon:"PlusIcon",inset:"",rounded:"","aria-label":"Zoom in",onClick:P})]),et.createElementVNode("div",{ref_key:"stage",ref:t,class:"flow-run-timeline__canvas-container"},null,512)])}}}),qv="";Ct.FlowRunTimeline=zv,Object.defineProperty(Ct,Symbol.toStringTag,{value:"Module"})});
1056
+ `;(function(r){qp(e,r);function e(t,i){t===void 0&&(t=.5),i===void 0&&(i=Math.random());var n=r.call(this,Ks,$p,{uNoise:0,uSeed:0})||this;return n.noise=t,n.seed=i,n}return Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(t){this.uniforms.uNoise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(t){this.uniforms.uSeed=t},enumerable:!1,configurable:!0}),e})(ae);var Xo=new mt;dt.prototype._cacheAsBitmap=!1,dt.prototype._cacheData=null,dt.prototype._cacheAsBitmapResolution=null,dt.prototype._cacheAsBitmapMultisample=ft.NONE;var Zp=function(){function r(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}return r}();Object.defineProperties(dt.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(r){if(this._cacheAsBitmap!==r){this._cacheAsBitmap=r;var e;r?(this._cacheData||(this._cacheData=new Zp),e=this._cacheData,e.originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(e=this._cacheData,e.sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}}}),dt.prototype._renderCached=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(e),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(e))},dt.prototype._initCachedDisplayObject=function(e){var t;if(!(this._cacheData&&this._cacheData.sprite)){var i=this.alpha;this.alpha=1,e.batch.flush();var n=this.getLocalBounds(null,!0).clone();if(this.filters&&this.filters.length){var s=this.filters[0].padding;n.pad(s)}n.ceil(F.RESOLUTION);var o=e.renderTexture.current,a=e.renderTexture.sourceFrame.clone(),h=e.renderTexture.destinationFrame.clone(),u=e.projection.transform,l=xe.create({width:n.width,height:n.height,resolution:this.cacheAsBitmapResolution||e.resolution,multisample:(t=this.cacheAsBitmapMultisample)!==null&&t!==void 0?t:e.multisample}),f="cacheAsBitmap_"+ge();this._cacheData.textureCacheId=f,Y.addToCache(l.baseTexture,f),k.addToCache(l,f);var c=this.transform.localTransform.copyTo(Xo).invert().translate(-n.x,-n.y);this.render=this._cacheData.originalRender,e.render(this,{renderTexture:l,clear:!0,transform:c,skipUpdateTransform:!1}),e.framebuffer.blit(),e.projection.transform=u,e.renderTexture.bind(o,a,h),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;var d=new ui(l);d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-(n.x/n.width),d.anchor.y=-(n.y/n.height),d.alpha=i,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=d.containsPoint.bind(d)}},dt.prototype._renderCachedCanvas=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(e),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(e))},dt.prototype._initCachedDisplayObjectCanvas=function(e){if(!(this._cacheData&&this._cacheData.sprite)){var t=this.getLocalBounds(null,!0),i=this.alpha;this.alpha=1;var n=e.context,s=e._projTransform;t.ceil(F.RESOLUTION);var o=xe.create({width:t.width,height:t.height}),a="cacheAsBitmap_"+ge();this._cacheData.textureCacheId=a,Y.addToCache(o.baseTexture,a),k.addToCache(o,a);var h=Xo;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,e.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),e.context=n,e._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;var u=new ui(o);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(t.x/t.width),u.anchor.y=-(t.y/t.height),u.alpha=i,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u)}},dt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},dt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},dt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,Y.removeFromCache(this._cacheData.textureCacheId),k.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},dt.prototype._cacheAsBitmapDestroy=function(e){this.cacheAsBitmap=!1,this.destroy(e)};dt.prototype.name=null,Et.prototype.getChildByName=function(e,t){for(var i=0,n=this.children.length;i<n;i++)if(this.children[i].name===e)return this.children[i];if(t)for(var i=0,n=this.children.length;i<n;i++){var s=this.children[i];if(s.getChildByName){var o=s.getChildByName(e,!0);if(o)return o}}return null};dt.prototype.getGlobalPosition=function(e,t){return e===void 0&&(e=new X),t===void 0&&(t=!1),this.parent?this.parent.toGlobal(this.position,e,t):(e.x=this.position.x,e.y=this.position.y),e};var Kp=function(){function r(){}return r.init=function(e){var t=this;Object.defineProperty(this,"resizeTo",{set:function(i){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=i,i&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){t._resizeTo&&(t.cancelResize(),t._resizeId=requestAnimationFrame(function(){return t.resize()}))},this.cancelResize=function(){t._resizeId&&(cancelAnimationFrame(t._resizeId),t._resizeId=null)},this.resize=function(){if(t._resizeTo){t.cancelResize();var i,n;if(t._resizeTo===globalThis.window)i=globalThis.innerWidth,n=globalThis.innerHeight;else{var s=t._resizeTo,o=s.clientWidth,a=s.clientHeight;i=o,n=a}t.renderer.resize(i,n)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null},r.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},r.extension=J.Application,r}(),Wo=function(){function r(e){var t=this;this.stage=new Et,e=Object.assign({forceCanvas:!1},e),this.renderer=Pc(e),r._plugins.forEach(function(i){i.init.call(t,e)})}return r.registerPlugin=function(e){Nt("6.5.0","Application.registerPlugin() is deprecated, use extensions.add()"),Qt.add({type:J.Application,ref:e})},r.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(r.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),r.prototype.destroy=function(e,t){var i=this,n=r._plugins.slice(0);n.reverse(),n.forEach(function(s){s.destroy.call(i)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null},r._plugins=[],r}();Qt.handleByList(J.Application,Wo._plugins),Qt.add(Kp);var Dn=function(r,e){return Dn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Dn(r,e)};function He(r,e){Dn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Qp=function(r){He(e,r);function e(t,i,n,s){t===void 0&&(t=100),i===void 0&&(i=100),n===void 0&&(n=10),s===void 0&&(s=10);var o=r.call(this)||this;return o.segWidth=n,o.segHeight=s,o.width=t,o.height=i,o.build(),o}return e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,i=[],n=[],s=[],o=this.segWidth-1,a=this.segHeight-1,h=this.width/o,u=this.height/a,l=0;l<t;l++){var f=l%this.segWidth,c=l/this.segWidth|0;i.push(f*h,c*u),n.push(f/o,c/a)}for(var d=o*a,l=0;l<d;l++){var p=l%o,v=l/o|0,_=v*this.segWidth+p,m=v*this.segWidth+p+1,y=(v+1)*this.segWidth+p,g=(v+1)*this.segWidth+p+1;s.push(_,m,y,m,g,y)}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(n),this.indexBuffer.data=new Uint16Array(s),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},e}(ir),Jp=function(r){He(e,r);function e(t,i,n){t===void 0&&(t=200),n===void 0&&(n=0);var s=r.call(this,new Float32Array(i.length*4),new Float32Array(i.length*4),new Uint16Array((i.length-1)*6))||this;return s.points=i,s._width=t,s.textureScale=n,s.build(),s}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),e.prototype.build=function(){var t=this.points;if(t){var i=this.getBuffer("aVertexPosition"),n=this.getBuffer("aTextureCoord"),s=this.getIndex();if(!(t.length<1)){i.data.length/4!==t.length&&(i.data=new Float32Array(t.length*4),n.data=new Float32Array(t.length*4),s.data=new Uint16Array((t.length-1)*6));var o=n.data,a=s.data;o[0]=0,o[1]=0,o[2]=0,o[3]=1;for(var h=0,u=t[0],l=this._width*this.textureScale,f=t.length,c=0;c<f;c++){var d=c*4;if(this.textureScale>0){var p=u.x-t[c].x,v=u.y-t[c].y,_=Math.sqrt(p*p+v*v);u=t[c],h+=_/l}else h=c/(f-1);o[d]=h,o[d+1]=0,o[d+2]=h,o[d+3]=1}for(var m=0,c=0;c<f-1;c++){var d=c*2;a[m++]=d,a[m++]=d+1,a[m++]=d+2,a[m++]=d+2,a[m++]=d+1,a[m++]=d+3}n.update(),s.update(),this.updateVertices()}}},e.prototype.updateVertices=function(){var t=this.points;if(!(t.length<1)){for(var i=t[0],n,s=0,o=0,a=this.buffers[0].data,h=t.length,u=0;u<h;u++){var l=t[u],f=u*4;u<t.length-1?n=t[u+1]:n=l,o=-(n.x-i.x),s=n.y-i.y;var c=Math.sqrt(s*s+o*o),d=this.textureScale>0?this.textureScale*this._width/2:this._width/2;s/=c,o/=c,s*=d,o*=d,a[f]=l.x+s,a[f+1]=l.y+o,a[f+2]=l.x-s,a[f+3]=l.y-o,i=l}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(ir);(function(r){He(e,r);function e(t,i,n){n===void 0&&(n=0);var s=this,o=new Jp(t.height,i,n),a=new di(t);return n>0&&(t.baseTexture.wrapMode=Wt.REPEAT),s=r.call(this,o,a)||this,s.autoUpdate=!0,s}return e.prototype._render=function(t){var i=this.geometry;(this.autoUpdate||i._width!==this.shader.texture.height)&&(i._width=this.shader.texture.height,i.update()),r.prototype._render.call(this,t)},e})(ci);var tv=function(r){He(e,r);function e(t,i,n){var s=this,o=new Qp(t.width,t.height,i,n),a=new di(k.WHITE);return s=r.call(this,o,a)||this,s.texture=t,s.autoResize=!0,s}return e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry,i=this.shader.texture,n=i.width,s=i.height;this.autoResize&&(t.width!==n||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())},Object.defineProperty(e.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),e.prototype._render=function(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),r.prototype._render.call(this,t)},e.prototype.destroy=function(t){this.shader.texture.off("update",this.textureUpdated,this),r.prototype.destroy.call(this,t)},e}(ci);(function(r){He(e,r);function e(t,i,n,s,o){t===void 0&&(t=k.EMPTY);var a=this,h=new ir(i,n,s);h.getBuffer("aVertexPosition").static=!1;var u=new di(t);return a=r.call(this,h,u,null,o)||this,a.autoUpdate=!0,a}return Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype._render=function(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),r.prototype._render.call(this,t)},e})(ci);var sr=10;(function(r){He(e,r);function e(t,i,n,s,o){i===void 0&&(i=sr),n===void 0&&(n=sr),s===void 0&&(s=sr),o===void 0&&(o=sr);var a=r.call(this,k.WHITE,4,4)||this;return a._origWidth=t.orig.width,a._origHeight=t.orig.height,a._width=a._origWidth,a._height=a._origHeight,a._leftWidth=i,a._rightWidth=s,a._topHeight=n,a._bottomHeight=o,a.texture=t,a}return e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,i=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*i,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*i,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,i=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*i,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*i,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,i=this._width>t?1:this._width/t,n=this._topHeight+this._bottomHeight,s=this._height>n?1:this._height/n,o=Math.min(i,s);return o},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,i=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var n=1/this._origWidth,s=1/this._origHeight;i[0]=i[8]=i[16]=i[24]=0,i[1]=i[3]=i[5]=i[7]=0,i[6]=i[14]=i[22]=i[30]=1,i[25]=i[27]=i[29]=i[31]=1,i[2]=i[10]=i[18]=i[26]=n*this._leftWidth,i[4]=i[12]=i[20]=i[28]=1-n*this._rightWidth,i[9]=i[11]=i[13]=i[15]=s*this._topHeight,i[17]=i[19]=i[21]=i[23]=1-s*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e})(tv);var Fn=function(r,e){return Fn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Fn(r,e)};function ev(r,e){Fn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}(function(r){ev(e,r);function e(t,i){i===void 0&&(i=!0);var n=r.call(this,t[0]instanceof k?t[0]:t[0].texture)||this;return n._textures=null,n._durations=null,n._autoUpdate=i,n._isConnectedToTicker=!1,n.animationSpeed=1,n.loop=!0,n.updateAnchor=!1,n.onComplete=null,n.onFrameChange=null,n.onLoop=null,n._currentTime=0,n._playing=!1,n._previousFrame=null,n.textures=t,n}return e.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(xt.shared.remove(this.update,this),this._isConnectedToTicker=!1))},e.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(xt.shared.add(this.update,this,Jt.HIGH),this._isConnectedToTicker=!0))},e.prototype.gotoAndStop=function(t){this.stop();var i=this.currentFrame;this._currentTime=t,i!==this.currentFrame&&this.updateTexture()},e.prototype.gotoAndPlay=function(t){var i=this.currentFrame;this._currentTime=t,i!==this.currentFrame&&this.updateTexture(),this.play()},e.prototype.update=function(t){if(this._playing){var i=this.animationSpeed*t,n=this.currentFrame;if(this._durations!==null){var s=this._currentTime%1*this._durations[this.currentFrame];for(s+=i/60*1e3;s<0;)this._currentTime--,s+=this._durations[this.currentFrame];var o=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);s>=this._durations[this.currentFrame];)s-=this._durations[this.currentFrame]*o,this._currentTime+=o;this._currentTime+=s/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):n!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<n?this.onLoop():this.animationSpeed<0&&this.currentFrame>n&&this.onLoop()),this.updateTexture())}},e.prototype.updateTexture=function(){var t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},e.prototype.destroy=function(t){this.stop(),r.prototype.destroy.call(this,t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},e.fromFrames=function(t){for(var i=[],n=0;n<t.length;++n)i.push(k.from(t[n]));return new e(i)},e.fromImages=function(t){for(var i=[],n=0;n<t.length;++n)i.push(k.from(t[n]));return new e(i)},Object.defineProperty(e.prototype,"totalFrames",{get:function(){return this._textures.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this._textures},set:function(t){if(t[0]instanceof k)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(var i=0;i<t.length;i++)this._textures.push(t[i].texture),this._durations.push(t[i].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentFrame",{get:function(){var t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(xt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(xt.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),e})(ui);Qt.add(kc,Yc,zc,Ud,dp,eo,xp,Mp,ud,Fd,Nd,vp,nf,td);var jo={exports:{}};(function(r){(function(){function e(v,_){document.addEventListener?v.addEventListener("scroll",_,!1):v.attachEvent("scroll",_)}function t(v){document.body?v():document.addEventListener?document.addEventListener("DOMContentLoaded",function _(){document.removeEventListener("DOMContentLoaded",_),v()}):document.attachEvent("onreadystatechange",function _(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",_),v())})}function i(v){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(v)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function n(v,_){v.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+_+";"}function s(v){var _=v.g.offsetWidth,m=_+100;return v.j.style.width=m+"px",v.i.scrollLeft=m,v.h.scrollLeft=v.h.scrollWidth+100,v.l!==_?(v.l=_,!0):!1}function o(v,_){function m(){var g=y;s(g)&&g.g.parentNode!==null&&_(g.l)}var y=v;e(v.h,m),e(v.i,m),s(v)}function a(v,_,m){_=_||{},m=m||window,this.family=v,this.style=_.style||"normal",this.weight=_.weight||"normal",this.stretch=_.stretch||"normal",this.context=m}var h=null,u=null,l=null,f=null;function c(v){return u===null&&(d(v)&&/Apple/.test(window.navigator.vendor)?(v=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),u=!!v&&603>parseInt(v[1],10)):u=!1),u}function d(v){return f===null&&(f=!!v.document.fonts),f}function p(v,_){var m=v.style,y=v.weight;if(l===null){var g=document.createElement("div");try{g.style.font="condensed 100px sans-serif"}catch{}l=g.style.font!==""}return[m,y,l?v.stretch:"","100px",_].join(" ")}a.prototype.load=function(v,_){var m=this,y=v||"BESbswy",g=0,b=_||3e3,x=new Date().getTime();return new Promise(function(T,w){if(d(m.context)&&!c(m.context)){var I=new Promise(function(P,E){function D(){new Date().getTime()-x>=b?E(Error(""+b+"ms timeout exceeded")):m.context.document.fonts.load(p(m,'"'+m.family+'"'),y).then(function(N){1<=N.length?P():setTimeout(D,25)},E)}D()}),S=new Promise(function(P,E){g=setTimeout(function(){E(Error(""+b+"ms timeout exceeded"))},b)});Promise.race([S,I]).then(function(){clearTimeout(g),T(m)},w)}else t(function(){function P(){var B;(B=R!=-1&&M!=-1||R!=-1&&G!=-1||M!=-1&&G!=-1)&&((B=R!=M&&R!=G&&M!=G)||(h===null&&(B=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!B&&(536>parseInt(B[1],10)||parseInt(B[1],10)===536&&11>=parseInt(B[2],10))),B=h&&(R==ut&&M==ut&&G==ut||R==z&&M==z&&G==z||R==O&&M==O&&G==O)),B=!B),B&&(C.parentNode!==null&&C.parentNode.removeChild(C),clearTimeout(g),T(m))}function E(){if(new Date().getTime()-x>=b)C.parentNode!==null&&C.parentNode.removeChild(C),w(Error(""+b+"ms timeout exceeded"));else{var B=m.context.document.hidden;(B===!0||B===void 0)&&(R=D.g.offsetWidth,M=N.g.offsetWidth,G=W.g.offsetWidth,P()),g=setTimeout(E,50)}}var D=new i(y),N=new i(y),W=new i(y),R=-1,M=-1,G=-1,ut=-1,z=-1,O=-1,C=document.createElement("div");C.dir="ltr",n(D,p(m,"sans-serif")),n(N,p(m,"serif")),n(W,p(m,"monospace")),C.appendChild(D.g),C.appendChild(N.g),C.appendChild(W.g),m.context.document.body.appendChild(C),ut=D.g.offsetWidth,z=N.g.offsetWidth,O=W.g.offsetWidth,E(),o(D,function(B){R=B,P()}),n(D,p(m,'"'+m.family+'",sans-serif')),o(N,function(B){M=B,P()}),n(N,p(m,'"'+m.family+'",serif')),o(W,function(B){G=B,P()}),n(W,p(m,'"'+m.family+'",monospace'))})})},r.exports=a})()})(jo);const iv=jo.exports,rv=["0123456789","abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ",`.,:;!?()[]{}<>|/\\@'"`].join(""),Nn=new Ae({fontFamily:"InterVariable",fontSize:24,lineHeight:32});function nv(){const r=window.devicePixelRatio||2;return new Promise(e=>{new iv("InterVariable").load().then(()=>{const i={resolution:r,chars:rv};kt.from("NodeTextDefault",{...Nn,fill:1120295},i),kt.from("NodeTextInverse",{...Nn,fill:16777215},i),kt.from("TimeMarkerLabel",{fontFamily:"InterVariable",fontSize:16,lineHeight:24,fill:9741240},i),e({nodeTextDefault:{fontName:"NodeTextDefault",fontSize:24},nodeTextInverse:{fontName:"NodeTextInverse",fontSize:24},nodeTextMetrics:Nn,timeMarkerLabel:{fontName:"TimeMarkerLabel",fontSize:12}})})})}const zo=()=>nv();function sv(r){const e=new Wo({backgroundAlpha:0,width:r.clientWidth,height:r.clientHeight,resolution:window.devicePixelRatio||2,autoDensity:!0,antialias:!0,resizeTo:r});return r.appendChild(e.view),e}class Rt{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 ov=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function av(r,e,t){return t={path:e,exports:{},require:function(i,n){return hv(i,n??t.path)}},r(t,t.exports),t.exports}function hv(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Yo=av(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(ov)});function or(r,e){if(r){if(typeof r=="function")return r;if(typeof r=="string")return Yo[r]}else return Yo[e]}const uv={removeOnInterrupt:!1,ease:"linear",time:1e3};class re extends Rt{__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),re.prototype.__init.call(this),re.prototype.__init2.call(this),re.prototype.__init3.call(this),re.prototype.__init4.call(this),re.prototype.__init5.call(this),re.prototype.__init6.call(this),re.prototype.__init7.call(this),this.options=Object.assign({},uv,t),this.options.ease=or(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 X(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 X(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 ar(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 lv={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class fv extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},lv,t),this.ease=or(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 X(t*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new X(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 X(0,0),bottomRight:new X(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===ar([t,"access",s=>s.options,"optionalAccess",s=>s.friction])||t.y&&t.percentChangeY===ar([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||{},!ar([i,"optionalAccess",s=>s.active])&&!ar([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 cv={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class dv extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},cv,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 pv={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class vv extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},pv,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 _v={friction:.98,bounce:.8,minSpeed:.01},le=16;class mv extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},_v,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*le/o*(Math.pow(s,n/le)-Math.pow(s,i/le)),this.x*=Math.pow(this.percentChangeX,e/le)}if(this.y){const s=this.percentChangeY,o=Math.log(s);this.parent.y+=this.y*le/o*(Math.pow(s,n/le)-Math.pow(s,i/le)),this.y*=Math.pow(this.percentChangeY,e/le)}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 gv={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 Bn extends Rt{__init(){this.windowEventHandlers=new Array}constructor(e,t={}){super(e),Bn.prototype.__init.call(this),this.options=Object.assign({},gv,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 X(this.last.x,this.last.y),world:this.parent.toWorld(new X(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 X(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 yv={speed:0,acceleration:null,radius:null};class xv extends Rt{constructor(e,t,i={}){super(e),this.target=t,this.options=Object.assign({},yv,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 bv={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class Tv extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},bv,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 wv={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class pi extends Rt{__init(){this.active=!1}__init2(){this.pinching=!1}__init3(){this.moved=!1}constructor(e,t={}){super(e),pi.prototype.__init.call(this),pi.prototype.__init2.call(this),pi.prototype.__init3.call(this),this.options=Object.assign({},wv,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 Ev={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class Sv extends Rt{constructor(e,t,i,n={}){super(e),this.options=Object.assign({},Ev,n),this.ease=or(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 Pv={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class Cv extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},Pv,t),this.ease=or(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 Av={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class Rv extends Rt{constructor(e,t={}){super(e),this.options=Object.assign({},Av,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 Iv{constructor(e){this.viewport=e,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new j(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 X;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 hr(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 vi=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class Ov{constructor(e){this.viewport=e,this.list=[],this.plugins={}}add(e,t,i=vi.length){const n=this.plugins[e];n&&n.destroy(),this.plugins[e]=t;const s=vi.indexOf(e);s!==-1&&vi.splice(s,1),vi.splice(i,0,e),this.sort()}get(e,t){return t&&hr([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]&&(hr([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){hr([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.pause,"call",t=>t()])}resume(e){hr([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.resume,"call",t=>t()])}sort(){this.list=[];for(const e of vi)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 Mv={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:xt.shared};class Ln extends Et{__init(){this._disableOnContextMenu=e=>e.preventDefault()}constructor(e={}){super(),Ln.prototype.__init.call(this),this.options=Object.assign({},{divWheel:document.body},Mv,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 Iv(this),this.plugins=new Ov(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 j(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 j(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(e,t){return arguments.length===2?this.toLocal(new X(e,t)):this.toLocal(e)}toScreen(e,t){return arguments.length===2?this.toGlobal(new X(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 X(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 X(-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 Cv(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 X(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 j(0,0,this.worldWidth,this.worldHeight))}drag(e){return this.plugins.add("drag",new Bn(this,e)),this}clamp(e){return this.plugins.add("clamp",new dv(this,e)),this}decelerate(e){return this.plugins.add("decelerate",new mv(this,e)),this}bounce(e){return this.plugins.add("bounce",new fv(this,e)),this}pinch(e){return this.plugins.add("pinch",new pi(this,e)),this}snap(e,t,i){return this.plugins.add("snap",new Sv(this,e,t,i)),this}follow(e,t){return this.plugins.add("follow",new xv(this,e,t)),this}wheel(e){return this.plugins.add("wheel",new Rv(this,e)),this}animate(e){return this.plugins.add("animate",new re(this,e)),this}clampZoom(e){return this.plugins.add("clamp-zoom",new vv(this,e)),this}mouseEdges(e){return this.plugins.add("mouse-edges",new Tv(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"})}}function Dv(r,e){const t=r.clientWidth,i=r.clientHeight,n=new Ln({screenWidth:t,screenHeight:i,passiveWheel:!1,interaction:e.renderer.plugins.interaction,divWheel:r});return n.drag({wheel:!1,pressDrag:!0}).wheel({trackpadPinch:!0,wheelZoom:!1}).clampZoom({minWidth:t/2,maxWidth:t*20}).decelerate({friction:.9}),e.stage.addChild(n),n}let Vt={};const Fv=80,Nv=260;let Vo=10,Re=1e3*30;const Un=4e3,q={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},qo=[{ceiling:q.second*4,span:q.second},{ceiling:q.second*8,span:q.second*5},{ceiling:q.second*13,span:q.second*10},{ceiling:q.second*20,span:q.second*15},{ceiling:q.second*45,span:q.second*30},{ceiling:q.minute*4,span:q.minute},{ceiling:q.minute*8,span:q.minute*5},{ceiling:q.minute*13,span:q.minute*10},{ceiling:q.minute*28,span:q.minute*15},{ceiling:q.hour*1.24,span:q.minute*30},{ceiling:q.hour*3,span:q.hour},{ceiling:q.hour*8,span:q.hour*5},{ceiling:q.hour*13,span:q.hour*10},{ceiling:q.hour*22,span:q.hour*12},{ceiling:q.day*4,span:q.day},{ceiling:q.week*2,span:q.week},{ceiling:1/0,span:q.week*4}];function Bv(r){if(!r.stage){console.error("TimelineGuides: stage is undefined");return}const{stage:e,app:t}=r;Zo(r),Vo=Math.ceil(e.clientWidth/(Nv-Fv/2)),t.ticker.add(()=>{Lv(r)})}function Lv(r){const{isRunning:e,xScale:t}=r,i=Re;Zo(r);const n=Object.keys(Vt)[Object.keys(Vt).length-1];i!==Re||e&&Vt[n].x+Re<t(new Date)+Un?(Object.keys(Vt).length>0&&(Object.keys(Vt).forEach(s=>{Vt[s].destroy()}),Vt={}),Uv(r)):kv(r)}function Uv(r){const{timelineGuidesContainer:e,dateScale:t,overallGraphWidth:i}=r;let n;const s=t(i+Un);for(n=new Date(Math.ceil(t(-Un)/Re)*Re);n.getTime()<s;){const a=Gv(n,r);Vt[n.getTime()]=a,e.addChild(a),n=new Date(n.getTime()+Re)}}function Gv(r,e){const{app:t,textStyles:i}=e,n=new Et;n.position.set($o(r,e),0);const s=new Ce;s.beginFill(13227490),s.drawRect(0,0,1,t.screen.height),s.endFill();const o=new Pn(r.toLocaleTimeString(),i.timeMarkerLabel);return o.position.set(4,4),n.addChild(s),n.addChild(o),n}function kv(r){Object.keys(Vt).forEach(e=>{Vt[e].position.set($o(new Date(Number(e)),r),0)})}function $o(r,e){const{viewport:t,xScale:i}=e;return i(r)*t.scale._x+t.worldTransform.tx}function Zo(r){var o;const{viewport:e,dateScale:t,minimumStartDate:i}=r,n=Math.ceil((e.right-e.left)/Vo),s=t(n)-i.getTime();Re=((o=qo.find(a=>a.ceiling>s))==null?void 0:o.span)??qo[0].span}const _i={padding:16,borderRadius:8,labelGap:4},Ko={completed:42557,running:43247,scheduled:6321549,pending:6321549,failed:15728657,cancelled:15728657,crashed:15728657,paused:16035840};class Qo extends Et{constructor(t,i,n){super();ne(this,"nodeData");ne(this,"xScale");ne(this,"label");ne(this,"box");ne(this,"apxLabelWidth",0);ne(this,"nodeWidth");ne(this,"yPositionIndex",0);ne(this,"isLabelInBox",!0);this.nodeData=t,this.xScale=i,this.yPositionIndex=n,this.nodeWidth=this.getNodeWidth(),this.drawLabel(),this.box=new Ce,this.drawBox(),this.addChild(this.box),this.updatePosition()}getNodeWidth(){return this.xScale(this.nodeData.end??new Date)-this.xScale(this.nodeData.start)}async drawLabel(){var i;const t=await zo();this.apxLabelWidth===0&&(this.apxLabelWidth=Gt.measureText(this.nodeData.label,t.nodeTextMetrics).width),(i=this.label)==null||i.destroy(),this.apxLabelWidth>this.nodeWidth?(this.isLabelInBox=!1,this.label=new Pn(this.nodeData.label,t.nodeTextDefault)):(this.isLabelInBox=!0,this.label=new Pn(this.nodeData.label,t.nodeTextInverse)),this.label.position.set(this.isLabelInBox?_i.padding:this.nodeWidth+_i.labelGap,_i.padding),this.addChild(this.label)}get boxColor(){return this.nodeData.state?Ko[this.nodeData.state]:Ko.pending}drawBox(){var t;this.box.beginFill(this.boxColor),this.box.drawRoundedRect(0,0,this.nodeWidth,((t=this.label)!=null&&t.height?this.label.height:32)+_i.padding*2,_i.borderRadius),this.box.endFill()}updatePosition(){this.position.set(this.xScale(this.nodeData.start),this.yPositionIndex*120)}update(){const t=this.getNodeWidth();t!==this.nodeWidth&&(this.nodeWidth=t,this.box.clear(),this.drawBox(),(!this.isLabelInBox||this.apxLabelWidth>this.nodeWidth)&&this.drawLabel()),this.updatePosition()}}function Hv(r){let e,t;return r.forEach(i=>{(e===void 0||e>i.start||isNaN(i.start.getDate()))&&(e=i.start),i.end!==null&&(t===void 0||t<i.end||isNaN(i.end.getDate()))&&(t=i.end)}),{min:e??new Date(NaN),max:t??new Date(NaN)}}const Xv={class:"flow-run-timeline"},Wv={class:"flow-run-timeline__zoom-controls"},jv=et.defineComponent({__name:"FlowRunTimeline",props:{graphData:null,isRunning:{type:Boolean}},setup(r){const e=r,t=et.ref(),i={defaultViewportPadding:40,playheadBg:5145342,playheadWidth:2,playheadGlowPadding:8};let n=et.ref(!0),s,o,a,h=new ua,u=!1,l,f=et.ref(),c;const d=new Et;let p,v=new Map;et.onMounted(()=>{if(!t.value){console.error("Stage reference not found in initPixiApp");return}_(),s=sv(t.value),g(),o=Dv(t.value,s),zo().then(E=>{a=E,Bv({app:s,viewport:o,stage:t.value,timelineGuidesContainer:d,minimumStartDate:l,overallGraphWidth:c,isRunning:e.isRunning,dateScale:I,xScale:w,textStyles:a}),x(),y(),b(),n.value=!1})}),et.onBeforeUnmount(()=>{s.destroy(!0)});function _(){var W;const E=Array.from(e.graphData).filter(R=>R.end).flatMap(({start:R,end:M})=>({start:R,end:M}));e.isRunning===!0&&E.push({start:new Date,end:new Date});const{min:D,max:N}=Hv(E);l=D,f.value=N,c=(W=t.value)!=null&&W.clientWidth?t.value.clientWidth*2:2e3}const m=et.computed(()=>{if(!f.value)return 0;const E=1e3*60,D=f.value.getTime()-l.getTime();return D<E?E:D});function y(){if(!e.isRunning)return;const E=new Ce;E.beginFill(i.playheadBg,.1),E.drawRect(0,0,i.playheadWidth+i.playheadGlowPadding*2,s.screen.height),E.endFill(),E.beginFill(i.playheadBg),E.drawRect(i.playheadGlowPadding,0,i.playheadWidth,s.screen.height),E.endFill(),s.stage.addChild(E),s.ticker.add(()=>{e.isRunning?(E.x=w(new Date)*o.scale._x+o.worldTransform.tx-i.playheadGlowPadding-i.playheadWidth/2,f.value=new Date):E.destroyed||E.destroy()})}function g(){s.stage.addChild(d)}function b(){h.addAll(o.children),o.on("frame-end",()=>{(o.dirty||u)&&(h.cull(s.renderer.screen),o.dirty=!1,u=!1)})}function x(){p=T(),o.ensureVisible(p.x-i.defaultViewportPadding,p.y-i.defaultViewportPadding,p.width+i.defaultViewportPadding*2,p.height+i.defaultViewportPadding*2,!0),o.moveCenter(p.x+p.width/2,p.y+p.height/2),e.isRunning&&s.ticker.add(()=>{e.isRunning&&v.forEach(E=>E.node.update())})}function T(){const E=new Et,D=e.graphData.map((N,W)=>{const R=new Qo(N,w,W);return v.set(N.id,{node:R,end:N.end,state:N.state}),R});return E.addChild(...D),o.addChild(E),E}et.watchEffect(()=>{n.value||e.graphData.forEach(E=>{if(v.has(E.id)){const D=v.get(E.id);(D.end!==E.end||D.state!==E.state)&&D.node.update()}else{const D=new Qo(E,w,v.size-1);p.addChild(D),u=!0}})});function w(E){return Math.ceil((E.getTime()-l.getTime())*(c/m.value))}function I(E){return Math.ceil(l.getTime()+E*(m.value/c))}function S(){o.zoom(400,!0)}function P(){o.zoom(-400,!0)}return(E,D)=>{const N=et.resolveComponent("p-button");return et.openBlock(),et.createElementBlock("div",Xv,[et.createElementVNode("div",Wv,[et.createVNode(N,{icon:"MinusIcon",inset:"",rounded:"","aria-label":"Zoom out",onClick:S}),et.createVNode(N,{icon:"PlusIcon",inset:"",rounded:"","aria-label":"Zoom in",onClick:P})]),et.createElementVNode("div",{ref_key:"stage",ref:t,class:"flow-run-timeline__canvas-container"},null,512)])}}}),Vv="";Ct.FlowRunTimeline=jv,Object.defineProperty(Ct,Symbol.toStringTag,{value:"Module"})});
1057
1057
  //# sourceMappingURL=graphs.umd.js.map