/*! * @pixi/graphics - v6.5.10 * Compiled Thu, 06 Jul 2023 15:25:11 UTC * * @pixi/graphics is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ this.PIXI=this.PIXI||{};var _pixi_graphics=function(t,e,i,r,n,s){"use strict";var h,a;t.LINE_JOIN=void 0,(h=t.LINE_JOIN||(t.LINE_JOIN={})).MITER="miter",h.BEVEL="bevel",h.ROUND="round",t.LINE_CAP=void 0,(a=t.LINE_CAP||(t.LINE_CAP={})).BUTT="butt",a.ROUND="round",a.SQUARE="square";var o={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var i=Math.ceil(t/this.maxLength);return ithis.maxSegments&&(i=this.maxSegments),i}},l=function(){function t(){this.color=16777215,this.alpha=1,this.texture=e.Texture.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=e.Texture.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),u=function(t,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},u(t,e)};function p(t,e){function i(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function c(t,e){var i,r;void 0===e&&(e=!1);var n=t.length;if(!(n<6)){for(var s=0,h=0,a=t[n-2],o=t[n-1];h0||e&&s<=0){var p=n/2;for(h=p+p%2;h=6){c(i,!1);for(var a=[],o=0;o=0&&a>=0&&n>=0&&s>=0){var d=Math.ceil(2.3*Math.sqrt(h+a)),y=8*d+(n?4:0)+(s?4:0);if(o.length=y,0!==y){if(0===d)return o.length=8,o[0]=o[6]=e+n,o[1]=o[3]=r+s,o[2]=o[4]=e-n,void(o[5]=o[7]=r-s);var v=0,g=4*d+(n?2:0)+2,b=g,m=y,_=e+(I=n+h),x=e-I,P=r+(E=s);if(o[v++]=_,o[v++]=P,o[--g]=P,o[--g]=x,s){var S=r-E;o[b++]=x,o[b++]=S,o[--m]=S,o[--m]=_}for(var w=1;wp&&(p+=2*Math.PI);var c=u,f=p-u,d=Math.abs(f),y=Math.sqrt(o*o+l*l),v=1+(15*d*Math.sqrt(y)/Math.PI>>0),g=f/v;if(c+=g,a){h.push(t,e),h.push(i,r);for(var b=1,m=c;b=0&&(a.join===t.LINE_JOIN.ROUND?g+=_(I,E,I-T*B,E-C*B,I-R*B,E-L*B,y,!1)+4:g+=2,y.push(I-R*U,E-L*U),y.push(I+R*B,E+L*B));else{var X=(-T+w)*(-C+E)-(-T+I)*(-C+M),J=(-R+A)*(-L+E)-(-R+I)*(-L+D),V=(H*J-z*X)/G,Y=(q*X-F*J)/G,Q=(V-I)*(V-I)+(Y-E)*(Y-E),Z=I+(V-I)*B,K=E+(Y-E)*B,$=I-(V-I)*U,tt=E-(Y-E)*U,et=W?B:U;Q<=Math.min(H*H+F*F,z*z+q*q)+et*et*P?a.join===t.LINE_JOIN.BEVEL||Q/P>S?(W?(y.push(Z,K),y.push(I+T*U,E+C*U),y.push(Z,K),y.push(I+R*U,E+L*U)):(y.push(I-T*B,E-C*B),y.push($,tt),y.push(I-R*B,E-L*B),y.push($,tt)),g+=2):a.join===t.LINE_JOIN.ROUND?W?(y.push(Z,K),y.push(I+T*U,E+C*U),g+=_(I,E,I+T*U,E+C*U,I+R*U,E+L*U,y,!0)+4,y.push(Z,K),y.push(I+R*U,E+L*U)):(y.push(I-T*B,E-C*B),y.push($,tt),g+=_(I,E,I-T*B,E-C*B,I-R*B,E-L*B,y,!1)+4,y.push(I-R*B,E-L*B),y.push($,tt)):(y.push(Z,K),y.push($,tt)):(y.push(I-T*B,E-C*B),y.push(I+T*U,E+C*U),a.join===t.LINE_JOIN.ROUND?g+=W?_(I,E,I+T*U,E+C*U,I+R*U,E+L*U,y,!0)+2:_(I,E,I-T*B,E-C*B,I-R*B,E-L*B,y,!1)+2:a.join===t.LINE_JOIN.MITER&&Q/P<=S&&(W?(y.push($,tt),y.push($,tt)):(y.push(Z,K),y.push(Z,K)),g+=2),y.push(I-R*B,E-L*B),y.push(I+R*U,E+L*U),g+=2)}}w=s[2*(v-2)],M=s[2*(v-2)+1],I=s[2*(v-1)],T=-(M-(E=s[2*(v-1)+1])),C=w-I,T/=N=Math.sqrt(T*T+C*C),C/=N,T*=x,C*=x,y.push(I-T*B,E-C*B),y.push(I+T*U,E+C*U),p||(a.cap===t.LINE_CAP.ROUND?g+=_(I-T*(B-U)*.5,E-C*(B-U)*.5,I-T*B,E-C*B,I+T*U,E+C*U,y,!1)+2:a.cap===t.LINE_CAP.SQUARE&&(g+=m(I,E,T,C,B,U,!1,y)));var it=r.indices,rt=o.epsilon*o.epsilon;for(j=b;ju*a}},t.arc=function(t,e,r,n,s,h,a,l,u){for(var p=a-h,c=o._segmentsCount(Math.abs(p)*s,40*Math.ceil(Math.abs(p)/i.PI_2)),f=p/(2*c),d=2*f,y=Math.cos(f),v=Math.sin(f),g=c-1,b=g%1/g,m=0;m<=g;++m){var _=f+h+d*(m+b*m),x=Math.cos(_),P=-Math.sin(_);u.push((y*x+v*P)*s+r,(y*-P+v*x)*s+n)}},t}(),w=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s,h,a){for(var o=0,l=0,u=0,p=0,c=0,f=0,d=0,y=0,v=0,g=0,b=0,m=t,_=e,x=1;x<=10;++x)g=m-(y=(d=(f=(c=1-(l=x/10))*c)*c)*t+3*f*l*i+3*c*(u=l*l)*n+(p=u*l)*h),b=_-(v=d*e+3*f*l*r+3*c*u*s+p*a),m=y,_=v,o+=Math.sqrt(g*g+b*b);return o},t.curveTo=function(e,i,r,n,s,h,a){var l=a[a.length-2],u=a[a.length-1];a.length-=2;var p=o._segmentsCount(t.curveLength(l,u,e,i,r,n,s,h)),c=0,f=0,d=0,y=0,v=0;a.push(l,u);for(var g=1,b=0;g<=p;++g)d=(f=(c=1-(b=g/p))*c)*c,v=(y=b*b)*b,a.push(d*l+3*f*b*e+3*c*y*r+v*s,d*u+3*f*b*i+3*c*y*n+v*h)},t}(),M=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s){var h=t-2*i+n,a=e-2*r+s,o=2*i-2*t,l=2*r-2*e,u=4*(h*h+a*a),p=4*(h*o+a*l),c=o*o+l*l,f=2*Math.sqrt(u+p+c),d=Math.sqrt(u),y=2*u*d,v=2*Math.sqrt(c),g=p/d;return(y*f+d*p*(f-v)+(4*c*u-p*p)*Math.log((2*d+g+f)/(g+v)))/(4*y)},t.curveTo=function(e,i,r,n,s){for(var h=s[s.length-2],a=s[s.length-1],l=o._segmentsCount(t.curveLength(h,a,e,i,r,n)),u=0,p=0,c=1;c<=l;++c){var f=c/l;u=h+(e-h)*f,p=a+(i-a)*f,s.push(u+(e+(r-e)*f-u)*f,p+(i+(n-i)*f-p)*f)}},t}(),I=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),E=((P={})[i.SHAPES.POLY]=f,P[i.SHAPES.CIRC]=d,P[i.SHAPES.ELIP]=d,P[i.SHAPES.RECT]=y,P[i.SHAPES.RREC]=b,P),A=[],D=[],T=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),C=new i.Point,R=function(t){function i(){var e=t.call(this)||this;return e.closePointEps=1e-4,e.boundsPadding=0,e.uvsFloat32=null,e.indicesUint16=null,e.batchable=!1,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.drawCalls=[],e.batchDirty=-1,e.batches=[],e.dirty=0,e.cacheDirty=-1,e.clearDirty=0,e.shapeIndex=0,e._bounds=new s.Bounds,e.boundsDirty=-1,e}return p(i,t),Object.defineProperty(i.prototype,"bounds",{get:function(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),i.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},i.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var n=new T(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},i.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new T(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},i.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e0&&(r=(i=this.batches[this.batches.length-1]).style);for(var s=this.shapeIndex;s65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&g===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=g?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},i.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},i.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t131070)return!1;for(var t=this.batches,e=0;e0&&((h=D.pop())||((h=new e.BatchDrawCall).texArray=new e.BatchTextureArray),this.drawCalls.push(h)),h.start=c,h.size=0,h.texArray.count=0,h.type=p),y.touched=1,y._batchEnabled=t,y._batchLocation=a,y.wrapMode=n.WRAP_MODES.REPEAT,h.texArray.elements[h.texArray.count++]=y,a++)),h.size+=f.size,c+=f.size,l=y._batchLocation,this.addColors(r,d.color,d.alpha,f.attribSize,f.attribStart),this.addTextureIds(s,l,f.attribSize,f.attribStart)}e.BaseTexture._globalBatch=t,this.packAttributes()},i.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,n=new ArrayBuffer(3*t.length*4),s=new Float32Array(n),h=new Uint32Array(n),a=0,o=0;o>16)+(65280&e)+((255&e)<<16),a=r.premultiplyTint(h,i);t.length=Math.max(t.length,s+n);for(var o=0;o0&&i.alpha>0;return r?(i.matrix&&(i.matrix=i.matrix.clone(),i.matrix.invert()),Object.assign(this._lineStyle,{visible:r},i)):this._lineStyle.reset(),this},h.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new i.Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new i.Polygon,this.currentPath.closeStroke=!1},h.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},h.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},h.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],n=i[i.length-1];return r===t&&n===e||i.push(t,e),this},h.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},h.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),M.curveTo(t,e,i,r,n),this},h.prototype.bezierCurveTo=function(t,e,i,r,n,s){return this._initCurve(),w.curveTo(t,e,i,r,n,s,this.currentPath.points),this},h.prototype.arcTo=function(t,e,i,r,n){this._initCurve(t,e);var s=this.currentPath.points,h=S.curveTo(t,e,i,r,n,s);if(h){var a=h.cx,o=h.cy,l=h.radius,u=h.startAngle,p=h.endAngle,c=h.anticlockwise;this.arc(a,o,l,u,p,c)}return this},h.prototype.arc=function(t,e,r,n,s,h){if(void 0===h&&(h=!1),n===s)return this;if(!h&&s<=n?s+=i.PI_2:h&&n<=s&&(n+=i.PI_2),0===s-n)return this;var a=t+Math.cos(n)*r,o=e+Math.sin(n)*r,l=this._geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var p=Math.abs(u[u.length-2]-a),c=Math.abs(u[u.length-1]-o);p0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this},h.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},h.prototype.drawRect=function(t,e,r,n){return this.drawShape(new i.Rectangle(t,e,r,n))},h.prototype.drawRoundedRect=function(t,e,r,n,s){return this.drawShape(new i.RoundedRectangle(t,e,r,n,s))},h.prototype.drawCircle=function(t,e,r){return this.drawShape(new i.Circle(t,e,r))},h.prototype.drawEllipse=function(t,e,r,n){return this.drawShape(new i.Ellipse(t,e,r,n))},h.prototype.drawPolygon=function(){for(var t,e=arguments,r=[],n=0;n>16&255)/255*n,s.tint[1]=(r>>8&255)/255*n,s.tint[2]=(255&r)/255*n,s.tint[3]=n,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var a=0,o=h.length;a>16)+(65280&s)+((255&s)<<16)}}},h.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,s=e.d,h=e.tx,a=e.ty,o=this._geometry.points,l=this.vertexData,u=0,p=0;p