@pixi/graphics
Advanced tools
Comparing version 5.4.0-rc.3 to 6.0.0-rc
/*! | ||
* @pixi/graphics - v5.4.0-rc.3 | ||
* Compiled Thu, 10 Dec 2020 03:22:17 UTC | ||
* @pixi/graphics - v6.0.0-rc | ||
* Compiled Tue, 29 Dec 2020 19:58:03 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/graphics is licensed under the MIT License. | ||
*/ | ||
this.PIXI=this.PIXI||{};var _pixi_graphics=function(t,e,i,r,n,s){"use strict";var h,a;(h=t.LINE_JOIN||(t.LINE_JOIN={})).MITER="miter",h.BEVEL="bevel",h.ROUND="round",(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 i<this.minSegments?i=this.minSegments:i>this.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])})(t,e)};function c(t,e){function i(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var p={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,n=t.holes,s=e.points,h=e.indices;if(i.length>=6){for(var a=[],o=0;o<n.length;o++){var l=n[o];a.push(i.length/2),i=i.concat(l.points)}var u=r.earcut(i,a,2);if(!u)return;var c=s.length/2;for(o=0;o<u.length;o+=3)h.push(u[o]+c),h.push(u[o+1]+c),h.push(u[o+2]+c);for(o=0;o<i.length;o++)s.push(i[o])}}},d={build:function(t){var e,r,n=t.shape,s=t.points,h=n.x,a=n.y;if(s.length=0,t.type===i.SHAPES.CIRC)e=n.radius,r=n.radius;else{var o=t.shape;e=o.width,r=o.height}if(0!==e&&0!==r){var l=Math.floor(30*Math.sqrt(n.radius))||Math.floor(15*Math.sqrt(e+r));l/=2.3;for(var u=2*Math.PI/l,c=0;c<l-.5;c++)s.push(h+Math.sin(-u*c)*e,a+Math.cos(-u*c)*r);s.push(s[0],s[1])}},triangulate:function(t,e){var i=t.points,r=e.points,n=e.indices,s=r.length/2,h=s,a=t.shape,o=t.matrix,l=a.x,u=a.y;r.push(t.matrix?o.a*l+o.c*u+o.tx:l,t.matrix?o.b*l+o.d*u+o.ty:u);for(var c=0;c<i.length;c+=2)r.push(i[c],i[c+1]),n.push(s++,h,s)}},f={build:function(t){var e=t.shape,i=e.x,r=e.y,n=e.width,s=e.height,h=t.points;h.length=0,h.push(i,r,i+n,r,i+n,r+s,i,r+s)},triangulate:function(t,e){var i=t.points,r=e.points,n=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function y(t,e,i){return t+(e-t)*i}function g(t,e,i,r,n,s,h){void 0===h&&(h=[]);for(var a=h,o=0,l=0,u=0,c=0,p=0,d=0,f=0,g=0;f<=20;++f)o=y(t,i,g=f/20),l=y(e,r,g),u=y(i,n,g),c=y(r,s,g),p=y(o,u,g),d=y(l,c,g),a.push(p,d);return a}var v={build:function(t){var e=t.shape,i=t.points,r=e.x,n=e.y,s=e.width,h=e.height,a=Math.max(0,Math.min(e.radius,Math.min(s,h)/2));i.length=0,a?(g(r,n+a,r,n,r+a,n,i),g(r+s-a,n,r+s,n,r+s,n+a,i),g(r+s,n+h-a,r+s,n+h,r+s-a,n+h,i),g(r+a,n+h,r,n+h,r,n+h-a,i)):i.push(r,n,r+s,n,r+s,n+h,r,n+h)},triangulate:function(t,e){for(var i=t.points,n=e.points,s=e.indices,h=n.length/2,a=r.earcut(i,null,2),o=0,l=a.length;o<l;o+=3)s.push(a[o]+h),s.push(a[o+1]+h),s.push(a[o+2]+h);for(o=0,l=i.length;o<l;o++)n.push(i[o],i[++o])}};function b(t,e,i,r,n,s,h,a){var o,l;h?(o=r,l=-i):(o=-r,l=i);var u=t-i*n+o,c=e-r*n+l,p=t+i*s+o,d=e+r*s+l;return a.push(u,c),a.push(p,d),2}function m(t,e,i,r,n,s,h,a){var o=i-t,l=r-e,u=Math.atan2(o,l),c=Math.atan2(n-t,s-e);a&&u<c?u+=2*Math.PI:!a&&u>c&&(c+=2*Math.PI);var p=u,d=c-u,f=Math.abs(d),y=Math.sqrt(o*o+l*l),g=1+(15*f*Math.sqrt(y)/Math.PI>>0),v=d/g;if(p+=v,a){h.push(t,e),h.push(i,r);for(var b=1,m=p;b<g;b++,m+=v)h.push(t,e),h.push(t+Math.sin(m)*y,e+Math.cos(m)*y);h.push(t,e),h.push(n,s)}else{h.push(i,r),h.push(t,e);for(b=1,m=p;b<g;b++,m+=v)h.push(t+Math.sin(m)*y,e+Math.cos(m)*y),h.push(t,e);h.push(n,s),h.push(t,e)}return 2*g}function x(e,r){e.lineStyle.native?function(t,e){var r=0,n=t.shape,s=t.points||n.points,h=n.type!==i.SHAPES.POLY||n.closeStroke;if(0!==s.length){var a=e.points,o=e.indices,l=s.length/2,u=a.length/2,c=u;for(a.push(s[0],s[1]),r=1;r<l;r++)a.push(s[2*r],s[2*r+1]),o.push(c,c+1),c++;h&&o.push(c,u)}}(e,r):function(e,r){var n=e.shape,s=e.points||n.points.slice(),h=r.closePointEps;if(0!==s.length){var a=e.lineStyle,l=new i.Point(s[0],s[1]),u=new i.Point(s[s.length-2],s[s.length-1]),c=n.type!==i.SHAPES.POLY||n.closeStroke,p=Math.abs(l.x-u.x)<h&&Math.abs(l.y-u.y)<h;if(c){s=s.slice(),p&&(s.pop(),s.pop(),u.set(s[s.length-2],s[s.length-1]));var d=.5*(l.x+u.x),f=.5*(u.y+l.y);s.unshift(d,f),s.push(d,f)}var y=r.points,g=s.length/2,v=s.length,x=y.length/2,_=a.width/2,P=_*_,S=a.miterLimit*a.miterLimit,w=s[0],M=s[1],I=s[2],E=s[3],T=0,D=0,A=-(M-E),C=w-I,L=0,O=0,R=Math.sqrt(A*A+C*C);A/=R,C/=R,A*=_,C*=_;var B=a.alignment,N=2*(1-B),U=2*B;c||(a.cap===t.LINE_CAP.ROUND?v+=m(w-A*(N-U)*.5,M-C*(N-U)*.5,w-A*N,M-C*N,w+A*U,M+C*U,y,!0)+2:a.cap===t.LINE_CAP.SQUARE&&(v+=b(w,M,A,C,N,U,!0,y))),y.push(w-A*N,M-C*N),y.push(w+A*U,M+C*U);for(var H=1;H<g-1;++H){w=s[2*(H-1)],M=s[2*(H-1)+1],I=s[2*H],E=s[2*H+1],T=s[2*(H+1)],D=s[2*(H+1)+1],A=-(M-E),C=w-I,A/=R=Math.sqrt(A*A+C*C),C/=R,A*=_,C*=_,L=-(E-D),O=I-T,L/=R=Math.sqrt(L*L+O*O),O/=R,L*=_,O*=_;var j=I-w,F=M-E,z=I-T,k=D-E,q=F*z-k*j,G=q<0;if(Math.abs(q)<.1)y.push(I-A*N,E-C*N),y.push(I+A*U,E+C*U);else{var X=(-A+w)*(-C+E)-(-A+I)*(-C+M),W=(-L+T)*(-O+E)-(-L+I)*(-O+D),J=(j*W-z*X)/q,Y=(k*X-F*W)/q,V=(J-I)*(J-I)+(Y-E)*(Y-E),Q=I+(J-I)*N,Z=E+(Y-E)*N,K=I-(J-I)*U,$=E-(Y-E)*U,tt=G?N:U;V<=Math.min(j*j+F*F,z*z+k*k)+tt*tt*P?a.join===t.LINE_JOIN.BEVEL||V/P>S?(G?(y.push(Q,Z),y.push(I+A*U,E+C*U),y.push(Q,Z),y.push(I+L*U,E+O*U)):(y.push(I-A*N,E-C*N),y.push(K,$),y.push(I-L*N,E-O*N),y.push(K,$)),v+=2):a.join===t.LINE_JOIN.ROUND?G?(y.push(Q,Z),y.push(I+A*U,E+C*U),v+=m(I,E,I+A*U,E+C*U,I+L*U,E+O*U,y,!0)+4,y.push(Q,Z),y.push(I+L*U,E+O*U)):(y.push(I-A*N,E-C*N),y.push(K,$),v+=m(I,E,I-A*N,E-C*N,I-L*N,E-O*N,y,!1)+4,y.push(I-L*N,E-O*N),y.push(K,$)):(y.push(Q,Z),y.push(K,$)):(y.push(I-A*N,E-C*N),y.push(I+A*U,E+C*U),a.join===t.LINE_JOIN.BEVEL||V/P>S||(a.join===t.LINE_JOIN.ROUND?v+=G?m(I,E,I+A*U,E+C*U,I+L*U,E+O*U,y,!0)+2:m(I,E,I-A*N,E-C*N,I-L*N,E-O*N,y,!1)+2:(G?(y.push(K,$),y.push(K,$)):(y.push(Q,Z),y.push(Q,Z)),v+=2)),y.push(I-L*N,E-O*N),y.push(I+L*U,E+O*U),v+=2)}}w=s[2*(g-2)],M=s[2*(g-2)+1],I=s[2*(g-1)],A=-(M-(E=s[2*(g-1)+1])),C=w-I,A/=R=Math.sqrt(A*A+C*C),C/=R,A*=_,C*=_,y.push(I-A*N,E-C*N),y.push(I+A*U,E+C*U),c||(a.cap===t.LINE_CAP.ROUND?v+=m(I-A*(N-U)*.5,E-C*(N-U)*.5,I-A*N,E-C*N,I+A*U,E+C*U,y,!1)+2:a.cap===t.LINE_CAP.SQUARE&&(v+=b(I,E,A,C,N,U,!1,y)));var et=r.indices,it=o.epsilon*o.epsilon;for(H=x;H<v+x-2;++H)w=y[2*H],M=y[2*H+1],I=y[2*(H+1)],E=y[2*(H+1)+1],T=y[2*(H+2)],D=y[2*(H+2)+1],Math.abs(w*(E-D)+I*(D-M)+T*(M-E))<it||et.push(H,H+1,H+2)}}(e,r)}var _,P=function(t){function e(e,r,n,s,h,a){void 0===a&&(a=0);h=h||s/2;for(var o=-1*Math.PI/2+a,l=2*n,u=i.PI_2/l,c=[],p=0;p<l;p++){var d=p%2?h:s,f=p*u+o;c.push(e+d*Math.cos(f),r+d*Math.sin(f))}return t.call(this,c)||this}return c(e,t),e}(i.Polygon),S=function(){function t(){}return t.curveTo=function(t,e,i,r,n,s){var h=s[s.length-2],a=s[s.length-1]-e,o=h-t,l=r-e,u=i-t,c=Math.abs(a*u-o*l);if(c<1e-8||0===n)return s[s.length-2]===t&&s[s.length-1]===e||s.push(t,e),null;var p=a*a+o*o,d=l*l+u*u,f=a*l+o*u,y=n*Math.sqrt(p)/c,g=n*Math.sqrt(d)/c,v=y*f/p,b=g*f/d,m=y*u+g*o,x=y*l+g*a,_=o*(g+v),P=a*(g+v),S=u*(y+b),w=l*(y+b);return{cx:m+t,cy:x+e,radius:n,startAngle:Math.atan2(P-x,_-m),endAngle:Math.atan2(w-x,S-m),anticlockwise:o*l>u*a}},t.arc=function(t,e,r,n,s,h,a,l,u){for(var c=a-h,p=o._segmentsCount(Math.abs(c)*s,40*Math.ceil(Math.abs(c)/i.PI_2)),d=c/(2*p),f=2*d,y=Math.cos(d),g=Math.sin(d),v=p-1,b=v%1/v,m=0;m<=v;++m){var x=d+h+f*(m+b*m),_=Math.cos(x),P=-Math.sin(x);u.push((y*_+g*P)*s+r,(y*-P+g*_)*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,c=0,p=0,d=0,f=0,y=0,g=0,v=0,b=0,m=t,x=e,_=1;_<=10;++_)v=m-(y=(f=(d=(p=1-(l=_/10))*p)*p)*t+3*d*l*i+3*p*(u=l*l)*n+(c=u*l)*h),b=x-(g=f*e+3*d*l*r+3*p*u*s+c*a),m=y,x=g,o+=Math.sqrt(v*v+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 c=o._segmentsCount(t.curveLength(l,u,e,i,r,n,s,h)),p=0,d=0,f=0,y=0,g=0;a.push(l,u);for(var v=1,b=0;v<=c;++v)f=(d=(p=1-(b=v/c))*p)*p,g=(y=b*b)*b,a.push(f*l+3*d*b*e+3*p*y*r+g*s,f*u+3*d*b*i+3*p*y*n+g*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),c=4*(h*o+a*l),p=o*o+l*l,d=2*Math.sqrt(u+c+p),f=Math.sqrt(u),y=2*u*f,g=2*Math.sqrt(p),v=c/f;return(y*d+f*c*(d-g)+(4*p*u-c*c)*Math.log((2*f+v+d)/(v+g)))/(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,c=0,p=1;p<=l;++p){var d=p/l;u=h+(e-h)*d,c=a+(i-a)*d,s.push(u+(e+(r-e)*d-u)*d,c+(i+(n-i)*d-c)*d)}},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=((_={})[i.SHAPES.POLY]=p,_[i.SHAPES.CIRC]=d,_[i.SHAPES.ELIP]=d,_[i.SHAPES.RECT]=f,_[i.SHAPES.RREC]=v,_),T=[],D=[],A=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type,this.points=[],this.holes=[]}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,L=new s.Bounds,O=function(t){function h(){var e=t.call(this)||this;return e.uvsFloat32=null,e.indicesUint16=null,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.dirty=0,e.batchDirty=-1,e.cacheDirty=-1,e.clearDirty=0,e.drawCalls=[],e.batches=[],e.shapeIndex=0,e._bounds=new s.Bounds,e.boundsDirty=-1,e.boundsPadding=0,e.batchable=!1,e.indicesUint16=null,e.uvsFloat32=null,e.closePointEps=1e-4,e}return c(h,t),Object.defineProperty(h.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),h.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;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),D.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),T.push(e)}this.batches.length=0},h.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},h.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 A(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},h.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new A(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},h.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},h.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,C):C.copyFrom(t),r.shape.contains(C.x,C.y)))){var n=!1;if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(C.x,C.y)){n=!0;break}}if(!n)return!0}}return!1},h.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,s=null;this.batches.length>0&&(s=(r=this.batches[this.batches.length-1]).style);for(var h=this.shapeIndex;h<i.length;h++){this.shapeIndex++;var a=i[h],o=a.fillStyle,l=a.lineStyle;E[a.type].build(a),a.matrix&&this.transformPoints(a.points,a.matrix);for(var u=0;u<2;u++){var c=0===u?o:l;if(c.visible){var p=c.texture.baseTexture,d=this.indices.length,f=this.points.length/2;p.wrapMode=n.WRAP_MODES.REPEAT,0===u?this.processFill(a):this.processLine(a);var y=this.points.length/2-f;0!==y&&(r&&!this._compareStyles(s,c)&&(r.end(d,f),r=null),r||((r=T.pop()||new I).begin(c,d,f),this.batches.push(r),s=c),this.addUvs(this.points,e,c.texture,f,y,c.matrix))}}}var g=this.indices.length,v=this.points.length/2;if(r&&r.end(g,v),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var b=v>65535&&t;this.indicesUint16=b?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},h.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))},h.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(n&&!n.texture.baseTexture.valid)return!1}return!0},h.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],n=0;n<r.size;n++){var s=r.start+n;this.indicesUint16[s]=this.indicesUint16[s]-r.attribStart}},h.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<2*h.BATCHABLE_SIZE},h.prototype.buildDrawCalls=function(){for(var t=++e.BaseTexture._globalBatch,i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),D.push(this.drawCalls[i]);this.drawCalls.length=0;var r=this.colors,s=this.textureIds,h=D.pop();h||((h=new e.BatchDrawCall).texArray=new e.BatchTextureArray),h.texArray.count=0,h.start=0,h.size=0,h.type=n.DRAW_MODES.TRIANGLES;var a=0,o=null,l=0,u=!1,c=n.DRAW_MODES.TRIANGLES,p=0;this.drawCalls.push(h);for(i=0;i<this.batches.length;i++){var d=this.batches[i],f=d.style,y=f.texture.baseTexture;u!==!!f.native&&(c=(u=!!f.native)?n.DRAW_MODES.LINES:n.DRAW_MODES.TRIANGLES,o=null,a=8,t++),o!==y&&(o=y,y._batchEnabled!==t&&(8===a&&(t++,a=0,h.size>0&&((h=D.pop())||((h=new e.BatchDrawCall).texArray=new e.BatchTextureArray),this.drawCalls.push(h)),h.start=p,h.size=0,h.texArray.count=0,h.type=c),y.touched=1,y._batchEnabled=t,y._batchLocation=a,y.wrapMode=10497,h.texArray.elements[h.texArray.count++]=y,a++)),h.size+=d.size,p+=d.size,l=y._batchLocation,this.addColors(r,f.color,f.alpha,d.attribSize),this.addTextureIds(s,l,d.attribSize)}e.BaseTexture._globalBatch=t,this.packAttributes()},h.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<t.length/2;o++)s[a++]=t[2*o],s[a++]=t[2*o+1],s[a++]=e[2*o],s[a++]=e[2*o+1],h[a++]=i[o],s[a++]=r[o];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)},h.prototype.processFill=function(t){t.holes.length?(this.processHoles(t.holes),p.triangulate(t,this)):E[t.type].triangulate(t,this)},h.prototype.processLine=function(t){x(t,this);for(var e=0;e<t.holes.length;e++)x(t.holes[e],this)},h.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];E[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},h.prototype.calculateBounds=function(){var t=this._bounds,e=L,r=i.Matrix.IDENTITY;this._bounds.clear(),e.clear();for(var n=0;n<this.graphicsData.length;n++){var s=this.graphicsData[n],h=s.shape,a=s.type,o=s.lineStyle,l=s.matrix||i.Matrix.IDENTITY,u=0;if(o&&o.visible){var c=o.alignment;u=o.width,a===i.SHAPES.POLY?u*=.5+Math.abs(.5-c):u*=Math.max(0,c)}if(r!==l&&(e.isEmpty()||(t.addBoundsMatrix(e,r),e.clear()),r=l),a===i.SHAPES.RECT||a===i.SHAPES.RREC){var p=h;e.addFramePad(p.x,p.y,p.x+p.width,p.y+p.height,u,u)}else if(a===i.SHAPES.CIRC){var d=h;e.addFramePad(d.x,d.y,d.x,d.y,d.radius+u,d.radius+u)}else if(a===i.SHAPES.ELIP){var f=h;e.addFramePad(f.x,f.y,f.x,f.y,f.width+u,f.height+u)}else{var y=h;t.addVerticesMatrix(r,y.points,0,y.points.length,u,u)}}e.isEmpty()||t.addBoundsMatrix(e,r),t.pad(this.boundsPadding,this.boundsPadding)},h.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],n=t[2*i+1];t[2*i]=e.a*r+e.c*n+e.tx,t[2*i+1]=e.b*r+e.d*n+e.ty}},h.prototype.addColors=function(t,e,i,n){for(var s=(e>>16)+(65280&e)+((255&e)<<16),h=r.premultiplyTint(s,i);n-- >0;)t.push(h)},h.prototype.addTextureIds=function(t,e,i){for(;i-- >0;)t.push(e)},h.prototype.addUvs=function(t,e,i,r,n,s){void 0===s&&(s=null);for(var h=0,a=e.length,o=i.frame;h<n;){var l=t[2*(r+h)],u=t[2*(r+h)+1];if(s){var c=s.a*l+s.c*u+s.tx;u=s.b*l+s.d*u+s.ty,l=c}h++,e.push(l/o.width,u/o.height)}var p=i.baseTexture;(o.width<p.width||o.height<p.height)&&this.adjustUvs(e,i,a,n)},h.prototype.adjustUvs=function(t,e,i,r){for(var n=e.baseTexture,s=i+2*r,h=e.frame,a=h.width/n.width,o=h.height/n.height,l=h.x/h.width,u=h.y/h.height,c=Math.floor(t[i]+1e-6),p=Math.floor(t[i+1]+1e-6),d=i+2;d<s;d+=2)c=Math.min(c,Math.floor(t[d]+1e-6)),p=Math.min(p,Math.floor(t[d+1]+1e-6));l-=c,u-=p;for(d=i;d<s;d+=2)t[d]=(t[d]+l)*a,t[d+1]=(t[d+1]+u)*o},h.BATCHABLE_SIZE=100,h}(e.BatchGeometry),R=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.width=0,i.alignment=.5,i.native=!1,i.cap=t.LINE_CAP.BUTT,i.join=t.LINE_JOIN.MITER,i.miterLimit=10,i}return c(i,e),i.prototype.clone=function(){var t=new i;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},i.prototype.reset=function(){e.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},i}(l),B=new Float32Array(3),N={},U=function(s){function h(t){void 0===t&&(t=null);var i=s.call(this)||this;return i._geometry=t||new O,i._geometry.refCount++,i.shader=null,i.state=e.State.for2d(),i._fillStyle=new l,i._lineStyle=new R,i._matrix=null,i._holeMode=!1,i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i.pluginName="batch",i._transformID=-1,i.tint=16777215,i.blendMode=n.BLEND_MODES.NORMAL,i}return c(h,s),Object.defineProperty(h.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),h.prototype.clone=function(){return this.finishPoly(),new h(this._geometry)},Object.defineProperty(h.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),h.prototype.lineStyle=function(t){if(void 0===t&&(t=null),"number"==typeof t){var e=arguments;t={width:e[0]||0,color:e[1]||0,alpha:void 0!==e[2]?e[2]:1,alignment:void 0!==e[3]?e[3]:.5,native:!!e[4]}}return this.lineTextureStyle(t)},h.prototype.lineTextureStyle=function(i){if("number"==typeof i){var r=arguments,n=r[0],s=r[1],h=r[2],a=r[3],o=r[4],l=r[5],u=r[6];i={width:n,texture:s,color:h,alpha:a,matrix:o,alignment:l,native:u},Object.keys(i).forEach(function(t){return void 0===i[t]&&delete i[t]})}i=Object.assign({width:0,texture:e.Texture.WHITE,color:i&&i.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:t.LINE_CAP.BUTT,join:t.LINE_JOIN.MITER,miterLimit:10},i),this.currentPath&&this.startPoly();var c=i.width>0&&i.alpha>0;return c?(i.matrix&&(i.matrix=i.matrix.clone(),i.matrix.invert()),Object.assign(this._lineStyle,{visible:c},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,c=h.endAngle,p=h.anticlockwise;this.arc(a,o,l,u,c,p)}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 c=Math.abs(u[u.length-2]-a),p=Math.abs(u[u.length-1]-o);c<l&&p<l||u.push(a,o)}else this.moveTo(a,o),u=this.currentPath.points;return S.arc(a,o,t,e,r,n,s,h,u),this},h.prototype.beginFill=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=1),this.beginTextureFill({texture:e.Texture.WHITE,color:t,alpha:i})},h.prototype.beginTextureFill=function(t){if(t instanceof e.Texture){var i=arguments,r=i[0],n=i[1],s=i[2],h=i[3];t={texture:r,color:n,alpha:s,matrix:h},Object.keys(t).forEach(function(e){return void 0===t[e]&&delete t[e]})}t=Object.assign({texture:e.Texture.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var a=t.alpha>0;return a?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:a},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<arguments.length;n++)r[n]=e[n];var s=!0,h=r[0];h.points?(s=h.closeStroke,t=h.points):t=Array.isArray(r[0])?r[0]:r;var a=new i.Polygon(t);return a.closeStroke=s,this.drawShape(a),this},h.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},h.prototype.drawStar=function(t,e,i,r,n,s){return void 0===s&&(s=0),this.drawPolygon(new P(t,e,i,r,n,s))},h.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},h.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return 1===t.length&&t[0].shape.type===i.SHAPES.RECT&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)},h.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},h.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var n=0;n<i;n++){var s=t.batches[n],h=s.style.color,a=new Float32Array(this.vertexData.buffer,4*s.attribStart*2,2*s.attribSize),o=new Float32Array(t.uvsFloat32.buffer,4*s.attribStart*2,2*s.attribSize),l={vertexData:a,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*s.start,s.size),uvs:o,_batchRGB:r.hex2rgb(h),_tintRGB:h,_texture:s.style.texture,alpha:s.style.alpha,worldAlpha:1};this.batches[n]=l}},h.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},h.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,n=this.worldAlpha,s=e.uniforms,h=i.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(r>>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<o;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},h.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,n=e.size,s=e.start,h=i.count,a=0;a<h;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,n,s)},h.prototype._resolveDirectShader=function(t){var r=this.shader,n=this.pluginName;if(!r){if(!N[n]){for(var s=t.plugins.batch.MAX_TEXTURES,h=new Int32Array(s),a=0;a<s;a++)h[a]=a;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new i.Matrix,default:e.UniformGroup.from({uSamplers:h},!0)},l=t.plugins[n]._shader.program;N[n]=new e.Shader(l,o)}r=N[n]}return r},h.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,n=e.maxX,s=e.maxY;this._bounds.addFrame(this.transform,i,r,n,s)}},h.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,h._TEMP_POINT),this._geometry.containsPoint(h._TEMP_POINT)},h.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=r.hex2rgb(this.tint,B),e=0;e<this.batches.length;e++){var i=this.batches[e],n=i._batchRGB,s=(t[0]*n[0]*255<<16)+(t[1]*n[1]*255<<8)+(0|t[2]*n[2]*255);i._tintRGB=(s>>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,c=0;c<o.length;c+=2){var p=o[c],d=o[c+1];l[u++]=i*p+n*d+h,l[u++]=s*d+r*p+a}}},h.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0),this},h.prototype.setMatrix=function(t){return this._matrix=t,this},h.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},h.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},h.prototype.destroy=function(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,s.prototype.destroy.call(this,t)},h._TEMP_POINT=new i.Point,h}(s.Container),H={buildPoly:p,buildCircle:d,buildRectangle:f,buildRoundedRectangle:v,buildLine:x,Star:P,ArcUtils:S,BezierUtils:w,QuadraticUtils:M,BatchPart:I,FILL_COMMANDS:E,BATCH_POOL:T,DRAW_CALL_POOL:D};return t.FillStyle=l,t.GRAPHICS_CURVES=o,t.Graphics=U,t.GraphicsData=A,t.GraphicsGeometry=O,t.LineStyle=R,t.graphicsUtils=H,t}({},PIXI,PIXI,PIXI.utils,PIXI,PIXI);Object.assign(this.PIXI,_pixi_graphics); | ||
this.PIXI=this.PIXI||{};var _pixi_graphics=function(t,e,i,r,n,s){"use strict";var h,a;(h=t.LINE_JOIN||(t.LINE_JOIN={})).MITER="miter",h.BEVEL="bevel",h.ROUND="round",(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 i<this.minSegments?i=this.minSegments:i>this.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])})(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)}var c={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,n=t.holes,s=e.points,h=e.indices;if(i.length>=6){for(var a=[],o=0;o<n.length;o++){var l=n[o];a.push(i.length/2),i=i.concat(l.points)}var u=r.earcut(i,a,2);if(!u)return;var p=s.length/2;for(o=0;o<u.length;o+=3)h.push(u[o]+p),h.push(u[o+1]+p),h.push(u[o+2]+p);for(o=0;o<i.length;o++)s.push(i[o])}}},d={build:function(t){var e,r,n=t.shape,s=t.points,h=n.x,a=n.y;if(s.length=0,t.type===i.SHAPES.CIRC)e=n.radius,r=n.radius;else{var o=t.shape;e=o.width,r=o.height}if(0!==e&&0!==r){var l=Math.floor(30*Math.sqrt(n.radius))||Math.floor(15*Math.sqrt(e+r));l/=2.3;for(var u=2*Math.PI/l,p=0;p<l-.5;p++)s.push(h+Math.sin(-u*p)*e,a+Math.cos(-u*p)*r);s.push(s[0],s[1])}},triangulate:function(t,e){var i=t.points,r=e.points,n=e.indices,s=r.length/2,h=s,a=t.shape,o=t.matrix,l=a.x,u=a.y;r.push(t.matrix?o.a*l+o.c*u+o.tx:l,t.matrix?o.b*l+o.d*u+o.ty:u);for(var p=0;p<i.length;p+=2)r.push(i[p],i[p+1]),n.push(s++,h,s)}},f={build:function(t){var e=t.shape,i=e.x,r=e.y,n=e.width,s=e.height,h=t.points;h.length=0,h.push(i,r,i+n,r,i+n,r+s,i,r+s)},triangulate:function(t,e){var i=t.points,r=e.points,n=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function y(t,e,i){return t+(e-t)*i}function g(t,e,i,r,n,s,h){void 0===h&&(h=[]);for(var a=h,o=0,l=0,u=0,p=0,c=0,d=0,f=0,g=0;f<=20;++f)o=y(t,i,g=f/20),l=y(e,r,g),u=y(i,n,g),p=y(r,s,g),c=y(o,u,g),d=y(l,p,g),a.push(c,d);return a}var v={build:function(t){var e=t.shape,i=t.points,r=e.x,n=e.y,s=e.width,h=e.height,a=Math.max(0,Math.min(e.radius,Math.min(s,h)/2));i.length=0,a?(g(r,n+a,r,n,r+a,n,i),g(r+s-a,n,r+s,n,r+s,n+a,i),g(r+s,n+h-a,r+s,n+h,r+s-a,n+h,i),g(r+a,n+h,r,n+h,r,n+h-a,i)):i.push(r,n,r+s,n,r+s,n+h,r,n+h)},triangulate:function(t,e){for(var i=t.points,n=e.points,s=e.indices,h=n.length/2,a=r.earcut(i,null,2),o=0,l=a.length;o<l;o+=3)s.push(a[o]+h),s.push(a[o+1]+h),s.push(a[o+2]+h);for(o=0,l=i.length;o<l;o++)n.push(i[o],i[++o])}};function b(t,e,i,r,n,s,h,a){var o,l;h?(o=r,l=-i):(o=-r,l=i);var u=t-i*n+o,p=e-r*n+l,c=t+i*s+o,d=e+r*s+l;return a.push(u,p),a.push(c,d),2}function m(t,e,i,r,n,s,h,a){var o=i-t,l=r-e,u=Math.atan2(o,l),p=Math.atan2(n-t,s-e);a&&u<p?u+=2*Math.PI:!a&&u>p&&(p+=2*Math.PI);var c=u,d=p-u,f=Math.abs(d),y=Math.sqrt(o*o+l*l),g=1+(15*f*Math.sqrt(y)/Math.PI>>0),v=d/g;if(c+=v,a){h.push(t,e),h.push(i,r);for(var b=1,m=c;b<g;b++,m+=v)h.push(t,e),h.push(t+Math.sin(m)*y,e+Math.cos(m)*y);h.push(t,e),h.push(n,s)}else{h.push(i,r),h.push(t,e);for(b=1,m=c;b<g;b++,m+=v)h.push(t+Math.sin(m)*y,e+Math.cos(m)*y),h.push(t,e);h.push(n,s),h.push(t,e)}return 2*g}function x(e,r){e.lineStyle.native?function(t,e){var r=0,n=t.shape,s=t.points||n.points,h=n.type!==i.SHAPES.POLY||n.closeStroke;if(0!==s.length){var a=e.points,o=e.indices,l=s.length/2,u=a.length/2,p=u;for(a.push(s[0],s[1]),r=1;r<l;r++)a.push(s[2*r],s[2*r+1]),o.push(p,p+1),p++;h&&o.push(p,u)}}(e,r):function(e,r){var n=e.shape,s=e.points||n.points.slice(),h=r.closePointEps;if(0!==s.length){var a=e.lineStyle,l=new i.Point(s[0],s[1]),u=new i.Point(s[s.length-2],s[s.length-1]),p=n.type!==i.SHAPES.POLY||n.closeStroke,c=Math.abs(l.x-u.x)<h&&Math.abs(l.y-u.y)<h;if(p){s=s.slice(),c&&(s.pop(),s.pop(),u.set(s[s.length-2],s[s.length-1]));var d=.5*(l.x+u.x),f=.5*(u.y+l.y);s.unshift(d,f),s.push(d,f)}var y=r.points,g=s.length/2,v=s.length,x=y.length/2,_=a.width/2,P=_*_,S=a.miterLimit*a.miterLimit,w=s[0],M=s[1],I=s[2],E=s[3],D=0,T=0,A=-(M-E),C=w-I,L=0,R=0,B=Math.sqrt(A*A+C*C);A/=B,C/=B,A*=_,C*=_;var O=a.alignment,N=2*(1-O),U=2*O;p||(a.cap===t.LINE_CAP.ROUND?v+=m(w-A*(N-U)*.5,M-C*(N-U)*.5,w-A*N,M-C*N,w+A*U,M+C*U,y,!0)+2:a.cap===t.LINE_CAP.SQUARE&&(v+=b(w,M,A,C,N,U,!0,y))),y.push(w-A*N,M-C*N),y.push(w+A*U,M+C*U);for(var H=1;H<g-1;++H){w=s[2*(H-1)],M=s[2*(H-1)+1],I=s[2*H],E=s[2*H+1],D=s[2*(H+1)],T=s[2*(H+1)+1],A=-(M-E),C=w-I,A/=B=Math.sqrt(A*A+C*C),C/=B,A*=_,C*=_,L=-(E-T),R=I-D,L/=B=Math.sqrt(L*L+R*R),R/=B,L*=_,R*=_;var F=I-w,j=M-E,z=I-D,q=T-E,k=j*z-q*F,G=k<0;if(Math.abs(k)<.1)y.push(I-A*N,E-C*N),y.push(I+A*U,E+C*U);else{var X=(-A+w)*(-C+E)-(-A+I)*(-C+M),W=(-L+D)*(-R+E)-(-L+I)*(-R+T),J=(F*W-z*X)/k,Y=(q*X-j*W)/k,V=(J-I)*(J-I)+(Y-E)*(Y-E),Q=I+(J-I)*N,Z=E+(Y-E)*N,K=I-(J-I)*U,$=E-(Y-E)*U,tt=G?N:U;V<=Math.min(F*F+j*j,z*z+q*q)+tt*tt*P?a.join===t.LINE_JOIN.BEVEL||V/P>S?(G?(y.push(Q,Z),y.push(I+A*U,E+C*U),y.push(Q,Z),y.push(I+L*U,E+R*U)):(y.push(I-A*N,E-C*N),y.push(K,$),y.push(I-L*N,E-R*N),y.push(K,$)),v+=2):a.join===t.LINE_JOIN.ROUND?G?(y.push(Q,Z),y.push(I+A*U,E+C*U),v+=m(I,E,I+A*U,E+C*U,I+L*U,E+R*U,y,!0)+4,y.push(Q,Z),y.push(I+L*U,E+R*U)):(y.push(I-A*N,E-C*N),y.push(K,$),v+=m(I,E,I-A*N,E-C*N,I-L*N,E-R*N,y,!1)+4,y.push(I-L*N,E-R*N),y.push(K,$)):(y.push(Q,Z),y.push(K,$)):(y.push(I-A*N,E-C*N),y.push(I+A*U,E+C*U),a.join===t.LINE_JOIN.BEVEL||V/P>S||(a.join===t.LINE_JOIN.ROUND?v+=G?m(I,E,I+A*U,E+C*U,I+L*U,E+R*U,y,!0)+2:m(I,E,I-A*N,E-C*N,I-L*N,E-R*N,y,!1)+2:(G?(y.push(K,$),y.push(K,$)):(y.push(Q,Z),y.push(Q,Z)),v+=2)),y.push(I-L*N,E-R*N),y.push(I+L*U,E+R*U),v+=2)}}w=s[2*(g-2)],M=s[2*(g-2)+1],I=s[2*(g-1)],A=-(M-(E=s[2*(g-1)+1])),C=w-I,A/=B=Math.sqrt(A*A+C*C),C/=B,A*=_,C*=_,y.push(I-A*N,E-C*N),y.push(I+A*U,E+C*U),p||(a.cap===t.LINE_CAP.ROUND?v+=m(I-A*(N-U)*.5,E-C*(N-U)*.5,I-A*N,E-C*N,I+A*U,E+C*U,y,!1)+2:a.cap===t.LINE_CAP.SQUARE&&(v+=b(I,E,A,C,N,U,!1,y)));var et=r.indices,it=o.epsilon*o.epsilon;for(H=x;H<v+x-2;++H)w=y[2*H],M=y[2*H+1],I=y[2*(H+1)],E=y[2*(H+1)+1],D=y[2*(H+2)],T=y[2*(H+2)+1],Math.abs(w*(E-T)+I*(T-M)+D*(M-E))<it||et.push(H,H+1,H+2)}}(e,r)}var _,P=function(t){function e(e,r,n,s,h,a){void 0===a&&(a=0);h=h||s/2;for(var o=-1*Math.PI/2+a,l=2*n,u=i.PI_2/l,p=[],c=0;c<l;c++){var d=c%2?h:s,f=c*u+o;p.push(e+d*Math.cos(f),r+d*Math.sin(f))}return t.call(this,p)||this}return p(e,t),e}(i.Polygon),S=function(){function t(){}return t.curveTo=function(t,e,i,r,n,s){var h=s[s.length-2],a=s[s.length-1]-e,o=h-t,l=r-e,u=i-t,p=Math.abs(a*u-o*l);if(p<1e-8||0===n)return s[s.length-2]===t&&s[s.length-1]===e||s.push(t,e),null;var c=a*a+o*o,d=l*l+u*u,f=a*l+o*u,y=n*Math.sqrt(c)/p,g=n*Math.sqrt(d)/p,v=y*f/c,b=g*f/d,m=y*u+g*o,x=y*l+g*a,_=o*(g+v),P=a*(g+v),S=u*(y+b),w=l*(y+b);return{cx:m+t,cy:x+e,radius:n,startAngle:Math.atan2(P-x,_-m),endAngle:Math.atan2(w-x,S-m),anticlockwise:o*l>u*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)),d=p/(2*c),f=2*d,y=Math.cos(d),g=Math.sin(d),v=c-1,b=v%1/v,m=0;m<=v;++m){var x=d+h+f*(m+b*m),_=Math.cos(x),P=-Math.sin(x);u.push((y*_+g*P)*s+r,(y*-P+g*_)*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,d=0,f=0,y=0,g=0,v=0,b=0,m=t,x=e,_=1;_<=10;++_)v=m-(y=(f=(d=(c=1-(l=_/10))*c)*c)*t+3*d*l*i+3*c*(u=l*l)*n+(p=u*l)*h),b=x-(g=f*e+3*d*l*r+3*c*u*s+p*a),m=y,x=g,o+=Math.sqrt(v*v+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,d=0,f=0,y=0,g=0;a.push(l,u);for(var v=1,b=0;v<=p;++v)f=(d=(c=1-(b=v/p))*c)*c,g=(y=b*b)*b,a.push(f*l+3*d*b*e+3*c*y*r+g*s,f*u+3*d*b*i+3*c*y*n+g*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,d=2*Math.sqrt(u+p+c),f=Math.sqrt(u),y=2*u*f,g=2*Math.sqrt(c),v=p/f;return(y*d+f*p*(d-g)+(4*c*u-p*p)*Math.log((2*f+v+d)/(v+g)))/(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 d=c/l;u=h+(e-h)*d,p=a+(i-a)*d,s.push(u+(e+(r-e)*d-u)*d,p+(i+(n-i)*d-p)*d)}},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=((_={})[i.SHAPES.POLY]=c,_[i.SHAPES.CIRC]=d,_[i.SHAPES.ELIP]=d,_[i.SHAPES.RECT]=f,_[i.SHAPES.RREC]=v,_),D=[],T=[],A=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type,this.points=[],this.holes=[]}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,L=new s.Bounds,R=function(t){function h(){var e=t.call(this)||this;return e.uvsFloat32=null,e.indicesUint16=null,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.dirty=0,e.batchDirty=-1,e.cacheDirty=-1,e.clearDirty=0,e.drawCalls=[],e.batches=[],e.shapeIndex=0,e._bounds=new s.Bounds,e.boundsDirty=-1,e.boundsPadding=0,e.batchable=!1,e.indicesUint16=null,e.uvsFloat32=null,e.closePointEps=1e-4,e}return p(h,t),Object.defineProperty(h.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),h.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;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),T.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),D.push(e)}this.batches.length=0},h.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},h.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 A(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},h.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new A(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},h.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},h.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,C):C.copyFrom(t),r.shape.contains(C.x,C.y)))){var n=!1;if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(C.x,C.y)){n=!0;break}}if(!n)return!0}}return!1},h.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,s=null;this.batches.length>0&&(s=(r=this.batches[this.batches.length-1]).style);for(var h=this.shapeIndex;h<i.length;h++){this.shapeIndex++;var a=i[h],o=a.fillStyle,l=a.lineStyle;E[a.type].build(a),a.matrix&&this.transformPoints(a.points,a.matrix);for(var u=0;u<2;u++){var p=0===u?o:l;if(p.visible){var c=p.texture.baseTexture,d=this.indices.length,f=this.points.length/2;c.wrapMode=n.WRAP_MODES.REPEAT,0===u?this.processFill(a):this.processLine(a);var y=this.points.length/2-f;0!==y&&(r&&!this._compareStyles(s,p)&&(r.end(d,f),r=null),r||((r=D.pop()||new I).begin(p,d,f),this.batches.push(r),s=p),this.addUvs(this.points,e,p.texture,f,y,p.matrix))}}}var g=this.indices.length,v=this.points.length/2;if(r&&r.end(g,v),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var b=v>65535&&t;this.indicesUint16=b?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},h.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))},h.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(n&&!n.texture.baseTexture.valid)return!1}return!0},h.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],n=0;n<r.size;n++){var s=r.start+n;this.indicesUint16[s]=this.indicesUint16[s]-r.attribStart}},h.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<2*h.BATCHABLE_SIZE},h.prototype.buildDrawCalls=function(){for(var t=++e.BaseTexture._globalBatch,i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),T.push(this.drawCalls[i]);this.drawCalls.length=0;var r=this.colors,s=this.textureIds,h=T.pop();h||((h=new e.BatchDrawCall).texArray=new e.BatchTextureArray),h.texArray.count=0,h.start=0,h.size=0,h.type=n.DRAW_MODES.TRIANGLES;var a=0,o=null,l=0,u=!1,p=n.DRAW_MODES.TRIANGLES,c=0;this.drawCalls.push(h);for(i=0;i<this.batches.length;i++){var d=this.batches[i],f=d.style,y=f.texture.baseTexture;u!==!!f.native&&(p=(u=!!f.native)?n.DRAW_MODES.LINES:n.DRAW_MODES.TRIANGLES,o=null,a=8,t++),o!==y&&(o=y,y._batchEnabled!==t&&(8===a&&(t++,a=0,h.size>0&&((h=T.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=10497,h.texArray.elements[h.texArray.count++]=y,a++)),h.size+=d.size,c+=d.size,l=y._batchLocation,this.addColors(r,f.color,f.alpha,d.attribSize),this.addTextureIds(s,l,d.attribSize)}e.BaseTexture._globalBatch=t,this.packAttributes()},h.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<t.length/2;o++)s[a++]=t[2*o],s[a++]=t[2*o+1],s[a++]=e[2*o],s[a++]=e[2*o+1],h[a++]=i[o],s[a++]=r[o];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)},h.prototype.processFill=function(t){t.holes.length?(this.processHoles(t.holes),c.triangulate(t,this)):E[t.type].triangulate(t,this)},h.prototype.processLine=function(t){x(t,this);for(var e=0;e<t.holes.length;e++)x(t.holes[e],this)},h.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];E[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},h.prototype.calculateBounds=function(){var t=this._bounds,e=L,r=i.Matrix.IDENTITY;this._bounds.clear(),e.clear();for(var n=0;n<this.graphicsData.length;n++){var s=this.graphicsData[n],h=s.shape,a=s.type,o=s.lineStyle,l=s.matrix||i.Matrix.IDENTITY,u=0;if(o&&o.visible){var p=o.alignment;u=o.width,a===i.SHAPES.POLY?u*=.5+Math.abs(.5-p):u*=Math.max(0,p)}if(r!==l&&(e.isEmpty()||(t.addBoundsMatrix(e,r),e.clear()),r=l),a===i.SHAPES.RECT||a===i.SHAPES.RREC){var c=h;e.addFramePad(c.x,c.y,c.x+c.width,c.y+c.height,u,u)}else if(a===i.SHAPES.CIRC){var d=h;e.addFramePad(d.x,d.y,d.x,d.y,d.radius+u,d.radius+u)}else if(a===i.SHAPES.ELIP){var f=h;e.addFramePad(f.x,f.y,f.x,f.y,f.width+u,f.height+u)}else{var y=h;t.addVerticesMatrix(r,y.points,0,y.points.length,u,u)}}e.isEmpty()||t.addBoundsMatrix(e,r),t.pad(this.boundsPadding,this.boundsPadding)},h.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],n=t[2*i+1];t[2*i]=e.a*r+e.c*n+e.tx,t[2*i+1]=e.b*r+e.d*n+e.ty}},h.prototype.addColors=function(t,e,i,n){for(var s=(e>>16)+(65280&e)+((255&e)<<16),h=r.premultiplyTint(s,i);n-- >0;)t.push(h)},h.prototype.addTextureIds=function(t,e,i){for(;i-- >0;)t.push(e)},h.prototype.addUvs=function(t,e,i,r,n,s){void 0===s&&(s=null);for(var h=0,a=e.length,o=i.frame;h<n;){var l=t[2*(r+h)],u=t[2*(r+h)+1];if(s){var p=s.a*l+s.c*u+s.tx;u=s.b*l+s.d*u+s.ty,l=p}h++,e.push(l/o.width,u/o.height)}var c=i.baseTexture;(o.width<c.width||o.height<c.height)&&this.adjustUvs(e,i,a,n)},h.prototype.adjustUvs=function(t,e,i,r){for(var n=e.baseTexture,s=i+2*r,h=e.frame,a=h.width/n.width,o=h.height/n.height,l=h.x/h.width,u=h.y/h.height,p=Math.floor(t[i]+1e-6),c=Math.floor(t[i+1]+1e-6),d=i+2;d<s;d+=2)p=Math.min(p,Math.floor(t[d]+1e-6)),c=Math.min(c,Math.floor(t[d+1]+1e-6));l-=p,u-=c;for(d=i;d<s;d+=2)t[d]=(t[d]+l)*a,t[d+1]=(t[d+1]+u)*o},h.BATCHABLE_SIZE=100,h}(e.BatchGeometry),B=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.width=0,i.alignment=.5,i.native=!1,i.cap=t.LINE_CAP.BUTT,i.join=t.LINE_JOIN.MITER,i.miterLimit=10,i}return p(i,e),i.prototype.clone=function(){var t=new i;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},i.prototype.reset=function(){e.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},i}(l),O=new Float32Array(3),N={},U=function(s){function h(t){void 0===t&&(t=null);var i=s.call(this)||this;return i._geometry=t||new R,i._geometry.refCount++,i.shader=null,i.state=e.State.for2d(),i._fillStyle=new l,i._lineStyle=new B,i._matrix=null,i._holeMode=!1,i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i.pluginName="batch",i._transformID=-1,i.tint=16777215,i.blendMode=n.BLEND_MODES.NORMAL,i}return p(h,s),Object.defineProperty(h.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),h.prototype.clone=function(){return this.finishPoly(),new h(this._geometry)},Object.defineProperty(h.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),h.prototype.lineStyle=function(t){if(void 0===t&&(t=null),"number"==typeof t){var e=arguments;t={width:e[0]||0,color:e[1]||0,alpha:void 0!==e[2]?e[2]:1,alignment:void 0!==e[3]?e[3]:.5,native:!!e[4]}}return this.lineTextureStyle(t)},h.prototype.lineTextureStyle=function(i){i=Object.assign({width:0,texture:e.Texture.WHITE,color:i&&i.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:t.LINE_CAP.BUTT,join:t.LINE_JOIN.MITER,miterLimit:10},i),this.currentPath&&this.startPoly();var r=i.width>0&&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);p<l&&c<l||u.push(a,o)}else this.moveTo(a,o),u=this.currentPath.points;return S.arc(a,o,t,e,r,n,s,h,u),this},h.prototype.beginFill=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=1),this.beginTextureFill({texture:e.Texture.WHITE,color:t,alpha:i})},h.prototype.beginTextureFill=function(t){t=Object.assign({texture:e.Texture.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var i=t.alpha>0;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<arguments.length;n++)r[n]=e[n];var s=!0,h=r[0];h.points?(s=h.closeStroke,t=h.points):t=Array.isArray(r[0])?r[0]:r;var a=new i.Polygon(t);return a.closeStroke=s,this.drawShape(a),this},h.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},h.prototype.drawStar=function(t,e,i,r,n,s){return void 0===s&&(s=0),this.drawPolygon(new P(t,e,i,r,n,s))},h.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},h.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return 1===t.length&&t[0].shape.type===i.SHAPES.RECT&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)},h.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},h.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var n=0;n<i;n++){var s=t.batches[n],h=s.style.color,a=new Float32Array(this.vertexData.buffer,4*s.attribStart*2,2*s.attribSize),o=new Float32Array(t.uvsFloat32.buffer,4*s.attribStart*2,2*s.attribSize),l={vertexData:a,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*s.start,s.size),uvs:o,_batchRGB:r.hex2rgb(h),_tintRGB:h,_texture:s.style.texture,alpha:s.style.alpha,worldAlpha:1};this.batches[n]=l}},h.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},h.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,n=this.worldAlpha,s=e.uniforms,h=i.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(r>>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<o;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},h.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,n=e.size,s=e.start,h=i.count,a=0;a<h;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,n,s)},h.prototype._resolveDirectShader=function(t){var r=this.shader,n=this.pluginName;if(!r){if(!N[n]){for(var s=t.plugins.batch.MAX_TEXTURES,h=new Int32Array(s),a=0;a<s;a++)h[a]=a;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new i.Matrix,default:e.UniformGroup.from({uSamplers:h},!0)},l=t.plugins[n]._shader.program;N[n]=new e.Shader(l,o)}r=N[n]}return r},h.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,n=e.maxX,s=e.maxY;this._bounds.addFrame(this.transform,i,r,n,s)}},h.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,h._TEMP_POINT),this._geometry.containsPoint(h._TEMP_POINT)},h.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=r.hex2rgb(this.tint,O),e=0;e<this.batches.length;e++){var i=this.batches[e],n=i._batchRGB,s=(t[0]*n[0]*255<<16)+(t[1]*n[1]*255<<8)+(0|t[2]*n[2]*255);i._tintRGB=(s>>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<o.length;p+=2){var c=o[p],d=o[p+1];l[u++]=i*c+n*d+h,l[u++]=s*d+r*c+a}}},h.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0),this},h.prototype.setMatrix=function(t){return this._matrix=t,this},h.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},h.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},h.prototype.destroy=function(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,s.prototype.destroy.call(this,t)},h._TEMP_POINT=new i.Point,h}(s.Container),H={buildPoly:c,buildCircle:d,buildRectangle:f,buildRoundedRectangle:v,buildLine:x,Star:P,ArcUtils:S,BezierUtils:w,QuadraticUtils:M,BatchPart:I,FILL_COMMANDS:E,BATCH_POOL:D,DRAW_CALL_POOL:T};return t.FillStyle=l,t.GRAPHICS_CURVES=o,t.Graphics=U,t.GraphicsData=A,t.GraphicsGeometry=R,t.LineStyle=B,t.graphicsUtils=H,t}({},PIXI,PIXI,PIXI.utils,PIXI,PIXI);Object.assign(this.PIXI,_pixi_graphics); | ||
//# sourceMappingURL=graphics.min.js.map |
/*! | ||
* @pixi/graphics - v5.4.0-rc.3 | ||
* Compiled Thu, 10 Dec 2020 03:22:17 UTC | ||
* @pixi/graphics - v6.0.0-rc | ||
* Compiled Tue, 29 Dec 2020 19:58:03 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/graphics is licensed under the MIT License. | ||
*/ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@pixi/core"),math=require("@pixi/math"),utils=require("@pixi/utils"),constants=require("@pixi/constants"),display=require("@pixi/display");!function(t){t.MITER="miter",t.BEVEL="bevel",t.ROUND="round"}(exports.LINE_JOIN||(exports.LINE_JOIN={})),function(t){t.BUTT="butt",t.ROUND="round",t.SQUARE="square"}(exports.LINE_CAP||(exports.LINE_CAP={}));var GRAPHICS_CURVES={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 i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},FillStyle=function(){function t(){this.color=16777215,this.alpha=1,this.texture=core.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=core.Texture.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),extendStatics=function(t,e){return(extendStatics=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])})(t,e)};function __extends(t,e){function i(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var buildPoly={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,r=t.holes,s=e.points,n=e.indices;if(i.length>=6){for(var a=[],h=0;h<r.length;h++){var o=r[h];a.push(i.length/2),i=i.concat(o.points)}var l=utils.earcut(i,a,2);if(!l)return;var u=s.length/2;for(h=0;h<l.length;h+=3)n.push(l[h]+u),n.push(l[h+1]+u),n.push(l[h+2]+u);for(h=0;h<i.length;h++)s.push(i[h])}}},buildCircle={build:function(t){var e,i,r=t.shape,s=t.points,n=r.x,a=r.y;if(s.length=0,t.type===math.SHAPES.CIRC)e=r.radius,i=r.radius;else{var h=t.shape;e=h.width,i=h.height}if(0!==e&&0!==i){var o=Math.floor(30*Math.sqrt(r.radius))||Math.floor(15*Math.sqrt(e+i));o/=2.3;for(var l=2*Math.PI/o,u=0;u<o-.5;u++)s.push(n+Math.sin(-l*u)*e,a+Math.cos(-l*u)*i);s.push(s[0],s[1])}},triangulate:function(t,e){var i=t.points,r=e.points,s=e.indices,n=r.length/2,a=n,h=t.shape,o=t.matrix,l=h.x,u=h.y;r.push(t.matrix?o.a*l+o.c*u+o.tx:l,t.matrix?o.b*l+o.d*u+o.ty:u);for(var c=0;c<i.length;c+=2)r.push(i[c],i[c+1]),s.push(n++,a,n)}},buildRectangle={build:function(t){var e=t.shape,i=e.x,r=e.y,s=e.width,n=e.height,a=t.points;a.length=0,a.push(i,r,i+s,r,i+s,r+n,i,r+n)},triangulate:function(t,e){var i=t.points,r=e.points,s=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}};function getPt(t,e,i){return t+(e-t)*i}function quadraticBezierCurve(t,e,i,r,s,n,a){void 0===a&&(a=[]);for(var h=a,o=0,l=0,u=0,c=0,p=0,d=0,f=0,y=0;f<=20;++f)o=getPt(t,i,y=f/20),l=getPt(e,r,y),u=getPt(i,s,y),c=getPt(r,n,y),p=getPt(o,u,y),d=getPt(l,c,y),h.push(p,d);return h}var buildRoundedRectangle={build:function(t){var e=t.shape,i=t.points,r=e.x,s=e.y,n=e.width,a=e.height,h=Math.max(0,Math.min(e.radius,Math.min(n,a)/2));i.length=0,h?(quadraticBezierCurve(r,s+h,r,s,r+h,s,i),quadraticBezierCurve(r+n-h,s,r+n,s,r+n,s+h,i),quadraticBezierCurve(r+n,s+a-h,r+n,s+a,r+n-h,s+a,i),quadraticBezierCurve(r+h,s+a,r,s+a,r,s+a-h,i)):i.push(r,s,r+n,s,r+n,s+a,r,s+a)},triangulate:function(t,e){for(var i=t.points,r=e.points,s=e.indices,n=r.length/2,a=utils.earcut(i,null,2),h=0,o=a.length;h<o;h+=3)s.push(a[h]+n),s.push(a[h+1]+n),s.push(a[h+2]+n);for(h=0,o=i.length;h<o;h++)r.push(i[h],i[++h])}};function square(t,e,i,r,s,n,a,h){var o,l;a?(o=r,l=-i):(o=-r,l=i);var u=t-i*s+o,c=e-r*s+l,p=t+i*n+o,d=e+r*n+l;return h.push(u,c),h.push(p,d),2}function round(t,e,i,r,s,n,a,h){var o=i-t,l=r-e,u=Math.atan2(o,l),c=Math.atan2(s-t,n-e);h&&u<c?u+=2*Math.PI:!h&&u>c&&(c+=2*Math.PI);var p=u,d=c-u,f=Math.abs(d),y=Math.sqrt(o*o+l*l),g=1+(15*f*Math.sqrt(y)/Math.PI>>0),v=d/g;if(p+=v,h){a.push(t,e),a.push(i,r);for(var b=1,m=p;b<g;b++,m+=v)a.push(t,e),a.push(t+Math.sin(m)*y,e+Math.cos(m)*y);a.push(t,e),a.push(s,n)}else{a.push(i,r),a.push(t,e);for(b=1,m=p;b<g;b++,m+=v)a.push(t+Math.sin(m)*y,e+Math.cos(m)*y),a.push(t,e);a.push(s,n),a.push(t,e)}return 2*g}function buildNonNativeLine(t,e){var i=t.shape,r=t.points||i.points.slice(),s=e.closePointEps;if(0!==r.length){var n=t.lineStyle,a=new math.Point(r[0],r[1]),h=new math.Point(r[r.length-2],r[r.length-1]),o=i.type!==math.SHAPES.POLY||i.closeStroke,l=Math.abs(a.x-h.x)<s&&Math.abs(a.y-h.y)<s;if(o){r=r.slice(),l&&(r.pop(),r.pop(),h.set(r[r.length-2],r[r.length-1]));var u=.5*(a.x+h.x),c=.5*(h.y+a.y);r.unshift(u,c),r.push(u,c)}var p=e.points,d=r.length/2,f=r.length,y=p.length/2,g=n.width/2,v=g*g,b=n.miterLimit*n.miterLimit,m=r[0],_=r[1],x=r[2],S=r[3],P=0,A=0,w=-(_-S),M=m-x,D=0,E=0,C=Math.sqrt(w*w+M*M);w/=C,M/=C,w*=g,M*=g;var L=n.alignment,I=2*(1-L),T=2*L;o||(n.cap===exports.LINE_CAP.ROUND?f+=round(m-w*(I-T)*.5,_-M*(I-T)*.5,m-w*I,_-M*I,m+w*T,_+M*T,p,!0)+2:n.cap===exports.LINE_CAP.SQUARE&&(f+=square(m,_,w,M,I,T,!0,p))),p.push(m-w*I,_-M*I),p.push(m+w*T,_+M*T);for(var R=1;R<d-1;++R){m=r[2*(R-1)],_=r[2*(R-1)+1],x=r[2*R],S=r[2*R+1],P=r[2*(R+1)],A=r[2*(R+1)+1],w=-(_-S),M=m-x,w/=C=Math.sqrt(w*w+M*M),M/=C,w*=g,M*=g,D=-(S-A),E=x-P,D/=C=Math.sqrt(D*D+E*E),E/=C,D*=g,E*=g;var O=x-m,B=_-S,U=x-P,N=A-S,H=B*U-N*O,F=H<0;if(Math.abs(H)<.1)p.push(x-w*I,S-M*I),p.push(x+w*T,S+M*T);else{var G=(-w+m)*(-M+S)-(-w+x)*(-M+_),q=(-D+P)*(-E+S)-(-D+x)*(-E+A),z=(O*q-U*G)/H,j=(N*G-B*q)/H,W=(z-x)*(z-x)+(j-S)*(j-S),k=x+(z-x)*I,V=S+(j-S)*I,J=x-(z-x)*T,Y=S-(j-S)*T,Q=F?I:T;W<=Math.min(O*O+B*B,U*U+N*N)+Q*Q*v?n.join===exports.LINE_JOIN.BEVEL||W/v>b?(F?(p.push(k,V),p.push(x+w*T,S+M*T),p.push(k,V),p.push(x+D*T,S+E*T)):(p.push(x-w*I,S-M*I),p.push(J,Y),p.push(x-D*I,S-E*I),p.push(J,Y)),f+=2):n.join===exports.LINE_JOIN.ROUND?F?(p.push(k,V),p.push(x+w*T,S+M*T),f+=round(x,S,x+w*T,S+M*T,x+D*T,S+E*T,p,!0)+4,p.push(k,V),p.push(x+D*T,S+E*T)):(p.push(x-w*I,S-M*I),p.push(J,Y),f+=round(x,S,x-w*I,S-M*I,x-D*I,S-E*I,p,!1)+4,p.push(x-D*I,S-E*I),p.push(J,Y)):(p.push(k,V),p.push(J,Y)):(p.push(x-w*I,S-M*I),p.push(x+w*T,S+M*T),n.join===exports.LINE_JOIN.BEVEL||W/v>b||(n.join===exports.LINE_JOIN.ROUND?f+=F?round(x,S,x+w*T,S+M*T,x+D*T,S+E*T,p,!0)+2:round(x,S,x-w*I,S-M*I,x-D*I,S-E*I,p,!1)+2:(F?(p.push(J,Y),p.push(J,Y)):(p.push(k,V),p.push(k,V)),f+=2)),p.push(x-D*I,S-E*I),p.push(x+D*T,S+E*T),f+=2)}}m=r[2*(d-2)],_=r[2*(d-2)+1],x=r[2*(d-1)],w=-(_-(S=r[2*(d-1)+1])),M=m-x,w/=C=Math.sqrt(w*w+M*M),M/=C,w*=g,M*=g,p.push(x-w*I,S-M*I),p.push(x+w*T,S+M*T),o||(n.cap===exports.LINE_CAP.ROUND?f+=round(x-w*(I-T)*.5,S-M*(I-T)*.5,x-w*I,S-M*I,x+w*T,S+M*T,p,!1)+2:n.cap===exports.LINE_CAP.SQUARE&&(f+=square(x,S,w,M,I,T,!1,p)));var X=e.indices,Z=GRAPHICS_CURVES.epsilon*GRAPHICS_CURVES.epsilon;for(R=y;R<f+y-2;++R)m=p[2*R],_=p[2*R+1],x=p[2*(R+1)],S=p[2*(R+1)+1],P=p[2*(R+2)],A=p[2*(R+2)+1],Math.abs(m*(S-A)+x*(A-_)+P*(_-S))<Z||X.push(R,R+1,R+2)}}function buildNativeLine(t,e){var i=0,r=t.shape,s=t.points||r.points,n=r.type!==math.SHAPES.POLY||r.closeStroke;if(0!==s.length){var a=e.points,h=e.indices,o=s.length/2,l=a.length/2,u=l;for(a.push(s[0],s[1]),i=1;i<o;i++)a.push(s[2*i],s[2*i+1]),h.push(u,u+1),u++;n&&h.push(u,l)}}function buildLine(t,e){t.lineStyle.native?buildNativeLine(t,e):buildNonNativeLine(t,e)}var _a,Star=function(t){function e(e,i,r,s,n,a){void 0===a&&(a=0);n=n||s/2;for(var h=-1*Math.PI/2+a,o=2*r,l=math.PI_2/o,u=[],c=0;c<o;c++){var p=c%2?n:s,d=c*l+h;u.push(e+p*Math.cos(d),i+p*Math.sin(d))}return t.call(this,u)||this}return __extends(e,t),e}(math.Polygon),ArcUtils=function(){function t(){}return t.curveTo=function(t,e,i,r,s,n){var a=n[n.length-2],h=n[n.length-1]-e,o=a-t,l=r-e,u=i-t,c=Math.abs(h*u-o*l);if(c<1e-8||0===s)return n[n.length-2]===t&&n[n.length-1]===e||n.push(t,e),null;var p=h*h+o*o,d=l*l+u*u,f=h*l+o*u,y=s*Math.sqrt(p)/c,g=s*Math.sqrt(d)/c,v=y*f/p,b=g*f/d,m=y*u+g*o,_=y*l+g*h,x=o*(g+v),S=h*(g+v),P=u*(y+b),A=l*(y+b);return{cx:m+t,cy:_+e,radius:s,startAngle:Math.atan2(S-_,x-m),endAngle:Math.atan2(A-_,P-m),anticlockwise:o*l>u*h}},t.arc=function(t,e,i,r,s,n,a,h,o){for(var l=a-n,u=GRAPHICS_CURVES._segmentsCount(Math.abs(l)*s,40*Math.ceil(Math.abs(l)/math.PI_2)),c=l/(2*u),p=2*c,d=Math.cos(c),f=Math.sin(c),y=u-1,g=y%1/y,v=0;v<=y;++v){var b=c+n+p*(v+g*v),m=Math.cos(b),_=-Math.sin(b);o.push((d*m+f*_)*s+i,(d*-_+f*m)*s+r)}},t}(),BezierUtils=function(){function t(){}return t.curveLength=function(t,e,i,r,s,n,a,h){for(var o=0,l=0,u=0,c=0,p=0,d=0,f=0,y=0,g=0,v=0,b=0,m=t,_=e,x=1;x<=10;++x)v=m-(y=(f=(d=(p=1-(l=x/10))*p)*p)*t+3*d*l*i+3*p*(u=l*l)*s+(c=u*l)*a),b=_-(g=f*e+3*d*l*r+3*p*u*n+c*h),m=y,_=g,o+=Math.sqrt(v*v+b*b);return o},t.curveTo=function(e,i,r,s,n,a,h){var o=h[h.length-2],l=h[h.length-1];h.length-=2;var u=GRAPHICS_CURVES._segmentsCount(t.curveLength(o,l,e,i,r,s,n,a)),c=0,p=0,d=0,f=0,y=0;h.push(o,l);for(var g=1,v=0;g<=u;++g)d=(p=(c=1-(v=g/u))*c)*c,y=(f=v*v)*v,h.push(d*o+3*p*v*e+3*c*f*r+y*n,d*l+3*p*v*i+3*c*f*s+y*a)},t}(),QuadraticUtils=function(){function t(){}return t.curveLength=function(t,e,i,r,s,n){var a=t-2*i+s,h=e-2*r+n,o=2*i-2*t,l=2*r-2*e,u=4*(a*a+h*h),c=4*(a*o+h*l),p=o*o+l*l,d=2*Math.sqrt(u+c+p),f=Math.sqrt(u),y=2*u*f,g=2*Math.sqrt(p),v=c/f;return(y*d+f*c*(d-g)+(4*p*u-c*c)*Math.log((2*f+v+d)/(v+g)))/(4*y)},t.curveTo=function(e,i,r,s,n){for(var a=n[n.length-2],h=n[n.length-1],o=GRAPHICS_CURVES._segmentsCount(t.curveLength(a,h,e,i,r,s)),l=0,u=0,c=1;c<=o;++c){var p=c/o;l=a+(e-a)*p,u=h+(i-h)*p,n.push(l+(e+(r-e)*p-l)*p,u+(i+(s-i)*p-u)*p)}},t}(),BatchPart=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}(),FILL_COMMANDS=((_a={})[math.SHAPES.POLY]=buildPoly,_a[math.SHAPES.CIRC]=buildCircle,_a[math.SHAPES.ELIP]=buildCircle,_a[math.SHAPES.RECT]=buildRectangle,_a[math.SHAPES.RREC]=buildRoundedRectangle,_a),BATCH_POOL=[],DRAW_CALL_POOL=[],GraphicsData=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type,this.points=[],this.holes=[]}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}(),tmpPoint=new math.Point,tmpBounds=new display.Bounds,GraphicsGeometry=function(t){function e(){var e=t.call(this)||this;return e.uvsFloat32=null,e.indicesUint16=null,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.dirty=0,e.batchDirty=-1,e.cacheDirty=-1,e.clearDirty=0,e.drawCalls=[],e.batches=[],e.shapeIndex=0,e._bounds=new display.Bounds,e.boundsDirty=-1,e.boundsPadding=0,e.batchable=!1,e.indicesUint16=null,e.uvsFloat32=null,e.closePointEps=1e-4,e}return __extends(e,t),Object.defineProperty(e.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),e.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;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),DRAW_CALL_POOL.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),BATCH_POOL.push(e)}this.batches.length=0},e.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},e.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var s=new GraphicsData(t,e,i,r);return this.graphicsData.push(s),this.dirty++,this},e.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new GraphicsData(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},e.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},e.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,tmpPoint):tmpPoint.copyFrom(t),r.shape.contains(tmpPoint.x,tmpPoint.y)))){var s=!1;if(r.holes)for(var n=0;n<r.holes.length;n++){if(r.holes[n].shape.contains(tmpPoint.x,tmpPoint.y)){s=!0;break}}if(!s)return!0}}return!1},e.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,s=null;this.batches.length>0&&(s=(r=this.batches[this.batches.length-1]).style);for(var n=this.shapeIndex;n<i.length;n++){this.shapeIndex++;var a=i[n],h=a.fillStyle,o=a.lineStyle;FILL_COMMANDS[a.type].build(a),a.matrix&&this.transformPoints(a.points,a.matrix);for(var l=0;l<2;l++){var u=0===l?h:o;if(u.visible){var c=u.texture.baseTexture,p=this.indices.length,d=this.points.length/2;c.wrapMode=constants.WRAP_MODES.REPEAT,0===l?this.processFill(a):this.processLine(a);var f=this.points.length/2-d;0!==f&&(r&&!this._compareStyles(s,u)&&(r.end(p,d),r=null),r||((r=BATCH_POOL.pop()||new BatchPart).begin(u,p,d),this.batches.push(r),s=u),this.addUvs(this.points,e,u.texture,d,f,u.matrix))}}}var y=this.indices.length,g=this.points.length/2;if(r&&r.end(y,g),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var v=g>65535&&t;this.indicesUint16=v?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},e.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))},e.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,s=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(s&&!s.texture.baseTexture.valid)return!1}return!0},e.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],s=0;s<r.size;s++){var n=r.start+s;this.indicesUint16[n]=this.indicesUint16[n]-r.attribStart}},e.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,i=0;i<t.length;i++)if(t[i].style.native)return!1;return this.points.length<2*e.BATCHABLE_SIZE},e.prototype.buildDrawCalls=function(){for(var t=++core.BaseTexture._globalBatch,e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),DRAW_CALL_POOL.push(this.drawCalls[e]);this.drawCalls.length=0;var i=this.colors,r=this.textureIds,s=DRAW_CALL_POOL.pop();s||((s=new core.BatchDrawCall).texArray=new core.BatchTextureArray),s.texArray.count=0,s.start=0,s.size=0,s.type=constants.DRAW_MODES.TRIANGLES;var n=0,a=null,h=0,o=!1,l=constants.DRAW_MODES.TRIANGLES,u=0;this.drawCalls.push(s);for(e=0;e<this.batches.length;e++){var c=this.batches[e],p=c.style,d=p.texture.baseTexture;o!==!!p.native&&(l=(o=!!p.native)?constants.DRAW_MODES.LINES:constants.DRAW_MODES.TRIANGLES,a=null,n=8,t++),a!==d&&(a=d,d._batchEnabled!==t&&(8===n&&(t++,n=0,s.size>0&&((s=DRAW_CALL_POOL.pop())||((s=new core.BatchDrawCall).texArray=new core.BatchTextureArray),this.drawCalls.push(s)),s.start=u,s.size=0,s.texArray.count=0,s.type=l),d.touched=1,d._batchEnabled=t,d._batchLocation=n,d.wrapMode=10497,s.texArray.elements[s.texArray.count++]=d,n++)),s.size+=c.size,u+=c.size,h=d._batchLocation,this.addColors(i,p.color,p.alpha,c.attribSize),this.addTextureIds(r,h,c.attribSize)}core.BaseTexture._globalBatch=t,this.packAttributes()},e.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,s=new ArrayBuffer(3*t.length*4),n=new Float32Array(s),a=new Uint32Array(s),h=0,o=0;o<t.length/2;o++)n[h++]=t[2*o],n[h++]=t[2*o+1],n[h++]=e[2*o],n[h++]=e[2*o+1],a[h++]=i[o],n[h++]=r[o];this._buffer.update(s),this._indexBuffer.update(this.indicesUint16)},e.prototype.processFill=function(t){t.holes.length?(this.processHoles(t.holes),buildPoly.triangulate(t,this)):FILL_COMMANDS[t.type].triangulate(t,this)},e.prototype.processLine=function(t){buildLine(t,this);for(var e=0;e<t.holes.length;e++)buildLine(t.holes[e],this)},e.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];FILL_COMMANDS[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},e.prototype.calculateBounds=function(){var t=this._bounds,e=tmpBounds,i=math.Matrix.IDENTITY;this._bounds.clear(),e.clear();for(var r=0;r<this.graphicsData.length;r++){var s=this.graphicsData[r],n=s.shape,a=s.type,h=s.lineStyle,o=s.matrix||math.Matrix.IDENTITY,l=0;if(h&&h.visible){var u=h.alignment;l=h.width,a===math.SHAPES.POLY?l*=.5+Math.abs(.5-u):l*=Math.max(0,u)}if(i!==o&&(e.isEmpty()||(t.addBoundsMatrix(e,i),e.clear()),i=o),a===math.SHAPES.RECT||a===math.SHAPES.RREC){var c=n;e.addFramePad(c.x,c.y,c.x+c.width,c.y+c.height,l,l)}else if(a===math.SHAPES.CIRC){var p=n;e.addFramePad(p.x,p.y,p.x,p.y,p.radius+l,p.radius+l)}else if(a===math.SHAPES.ELIP){var d=n;e.addFramePad(d.x,d.y,d.x,d.y,d.width+l,d.height+l)}else{var f=n;t.addVerticesMatrix(i,f.points,0,f.points.length,l,l)}}e.isEmpty()||t.addBoundsMatrix(e,i),t.pad(this.boundsPadding,this.boundsPadding)},e.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],s=t[2*i+1];t[2*i]=e.a*r+e.c*s+e.tx,t[2*i+1]=e.b*r+e.d*s+e.ty}},e.prototype.addColors=function(t,e,i,r){for(var s=(e>>16)+(65280&e)+((255&e)<<16),n=utils.premultiplyTint(s,i);r-- >0;)t.push(n)},e.prototype.addTextureIds=function(t,e,i){for(;i-- >0;)t.push(e)},e.prototype.addUvs=function(t,e,i,r,s,n){void 0===n&&(n=null);for(var a=0,h=e.length,o=i.frame;a<s;){var l=t[2*(r+a)],u=t[2*(r+a)+1];if(n){var c=n.a*l+n.c*u+n.tx;u=n.b*l+n.d*u+n.ty,l=c}a++,e.push(l/o.width,u/o.height)}var p=i.baseTexture;(o.width<p.width||o.height<p.height)&&this.adjustUvs(e,i,h,s)},e.prototype.adjustUvs=function(t,e,i,r){for(var s=e.baseTexture,n=i+2*r,a=e.frame,h=a.width/s.width,o=a.height/s.height,l=a.x/a.width,u=a.y/a.height,c=Math.floor(t[i]+1e-6),p=Math.floor(t[i+1]+1e-6),d=i+2;d<n;d+=2)c=Math.min(c,Math.floor(t[d]+1e-6)),p=Math.min(p,Math.floor(t[d+1]+1e-6));l-=c,u-=p;for(d=i;d<n;d+=2)t[d]=(t[d]+l)*h,t[d+1]=(t[d+1]+u)*o},e.BATCHABLE_SIZE=100,e}(core.BatchGeometry),LineStyle=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=exports.LINE_CAP.BUTT,e.join=exports.LINE_JOIN.MITER,e.miterLimit=10,e}return __extends(e,t),e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(FillStyle),temp=new Float32Array(3),DEFAULT_SHADERS={},Graphics=function(t){function e(e){void 0===e&&(e=null);var i=t.call(this)||this;return i._geometry=e||new GraphicsGeometry,i._geometry.refCount++,i.shader=null,i.state=core.State.for2d(),i._fillStyle=new FillStyle,i._lineStyle=new LineStyle,i._matrix=null,i._holeMode=!1,i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i.pluginName="batch",i._transformID=-1,i.tint=16777215,i.blendMode=constants.BLEND_MODES.NORMAL,i}return __extends(e,t),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return this.finishPoly(),new e(this._geometry)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),e.prototype.lineStyle=function(t){if(void 0===t&&(t=null),"number"==typeof t){var e=arguments;t={width:e[0]||0,color:e[1]||0,alpha:void 0!==e[2]?e[2]:1,alignment:void 0!==e[3]?e[3]:.5,native:!!e[4]}}return this.lineTextureStyle(t)},e.prototype.lineTextureStyle=function(t){if("number"==typeof t){var e=arguments,i=e[0],r=e[1],s=e[2],n=e[3],a=e[4],h=e[5],o=e[6];t={width:i,texture:r,color:s,alpha:n,matrix:a,alignment:h,native:o},Object.keys(t).forEach(function(e){return void 0===t[e]&&delete t[e]})}t=Object.assign({width:0,texture:core.Texture.WHITE,color:t&&t.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:exports.LINE_CAP.BUTT,join:exports.LINE_JOIN.MITER,miterLimit:10},t),this.currentPath&&this.startPoly();var l=t.width>0&&t.alpha>0;return l?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:l},t)):this._lineStyle.reset(),this},e.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 math.Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new math.Polygon,this.currentPath.closeStroke=!1},e.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},e.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},e.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],s=i[i.length-1];return r===t&&s===e||i.push(t,e),this},e.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)},e.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var s=this.currentPath.points;return 0===s.length&&this.moveTo(0,0),QuadraticUtils.curveTo(t,e,i,r,s),this},e.prototype.bezierCurveTo=function(t,e,i,r,s,n){return this._initCurve(),BezierUtils.curveTo(t,e,i,r,s,n,this.currentPath.points),this},e.prototype.arcTo=function(t,e,i,r,s){this._initCurve(t,e);var n=this.currentPath.points,a=ArcUtils.curveTo(t,e,i,r,s,n);if(a){var h=a.cx,o=a.cy,l=a.radius,u=a.startAngle,c=a.endAngle,p=a.anticlockwise;this.arc(h,o,l,u,c,p)}return this},e.prototype.arc=function(t,e,i,r,s,n){if(void 0===n&&(n=!1),r===s)return this;if(!n&&s<=r?s+=math.PI_2:n&&r<=s&&(r+=math.PI_2),0===s-r)return this;var a=t+Math.cos(r)*i,h=e+Math.sin(r)*i,o=this._geometry.closePointEps,l=this.currentPath?this.currentPath.points:null;if(l){var u=Math.abs(l[l.length-2]-a),c=Math.abs(l[l.length-1]-h);u<o&&c<o||l.push(a,h)}else this.moveTo(a,h),l=this.currentPath.points;return ArcUtils.arc(a,h,t,e,i,r,s,n,l),this},e.prototype.beginFill=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=1),this.beginTextureFill({texture:core.Texture.WHITE,color:t,alpha:e})},e.prototype.beginTextureFill=function(t){if(t instanceof core.Texture){var e=arguments,i=e[0],r=e[1],s=e[2],n=e[3];t={texture:i,color:r,alpha:s,matrix:n},Object.keys(t).forEach(function(e){return void 0===t[e]&&delete t[e]})}t=Object.assign({texture:core.Texture.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var a=t.alpha>0;return a?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:a},t)):this._fillStyle.reset(),this},e.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},e.prototype.drawRect=function(t,e,i,r){return this.drawShape(new math.Rectangle(t,e,i,r))},e.prototype.drawRoundedRect=function(t,e,i,r,s){return this.drawShape(new math.RoundedRectangle(t,e,i,r,s))},e.prototype.drawCircle=function(t,e,i){return this.drawShape(new math.Circle(t,e,i))},e.prototype.drawEllipse=function(t,e,i,r){return this.drawShape(new math.Ellipse(t,e,i,r))},e.prototype.drawPolygon=function(){for(var t,e=arguments,i=[],r=0;r<arguments.length;r++)i[r]=e[r];var s=!0,n=i[0];n.points?(s=n.closeStroke,t=n.points):t=Array.isArray(i[0])?i[0]:i;var a=new math.Polygon(t);return a.closeStroke=s,this.drawShape(a),this},e.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},e.prototype.drawStar=function(t,e,i,r,s,n){return void 0===n&&(n=0),this.drawPolygon(new Star(t,e,i,r,s,n))},e.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},e.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return 1===t.length&&t[0].shape.type===math.SHAPES.RECT&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)},e.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},e.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var r=0;r<i;r++){var s=t.batches[r],n=s.style.color,a=new Float32Array(this.vertexData.buffer,4*s.attribStart*2,2*s.attribSize),h=new Float32Array(t.uvsFloat32.buffer,4*s.attribStart*2,2*s.attribSize),o={vertexData:a,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*s.start,s.size),uvs:h,_batchRGB:utils.hex2rgb(n),_tintRGB:n,_texture:s.style.texture,alpha:s.style.alpha,worldAlpha:1};this.batches[r]=o}},e.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},e.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,s=this.worldAlpha,n=e.uniforms,a=i.drawCalls;n.translationMatrix=this.transform.worldTransform,n.tint[0]=(r>>16&255)/255*s,n.tint[1]=(r>>8&255)/255*s,n.tint[2]=(255&r)/255*s,n.tint[3]=s,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var h=0,o=a.length;h<o;h++)this._renderDrawCallDirect(t,i.drawCalls[h])},e.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,s=e.size,n=e.start,a=i.count,h=0;h<a;h++)t.texture.bind(i.elements[h],h);t.geometry.draw(r,s,n)},e.prototype._resolveDirectShader=function(t){var e=this.shader,i=this.pluginName;if(!e){if(!DEFAULT_SHADERS[i]){for(var r=t.plugins.batch.MAX_TEXTURES,s=new Int32Array(r),n=0;n<r;n++)s[n]=n;var a={tint:new Float32Array([1,1,1,1]),translationMatrix:new math.Matrix,default:core.UniformGroup.from({uSamplers:s},!0)},h=t.plugins[i]._shader.program;DEFAULT_SHADERS[i]=new core.Shader(h,a)}e=DEFAULT_SHADERS[i]}return e},e.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,s=e.maxX,n=e.maxY;this._bounds.addFrame(this.transform,i,r,s,n)}},e.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,e._TEMP_POINT),this._geometry.containsPoint(e._TEMP_POINT)},e.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=utils.hex2rgb(this.tint,temp),e=0;e<this.batches.length;e++){var i=this.batches[e],r=i._batchRGB,s=(t[0]*r[0]*255<<16)+(t[1]*r[1]*255<<8)+(0|t[2]*r[2]*255);i._tintRGB=(s>>16)+(65280&s)+((255&s)<<16)}}},e.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,s=e.c,n=e.d,a=e.tx,h=e.ty,o=this._geometry.points,l=this.vertexData,u=0,c=0;c<o.length;c+=2){var p=o[c],d=o[c+1];l[u++]=i*p+s*d+a,l[u++]=n*d+r*p+h}}},e.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0),this},e.prototype.setMatrix=function(t){return this._matrix=t,this},e.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},e.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},e.prototype.destroy=function(e){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,t.prototype.destroy.call(this,e)},e._TEMP_POINT=new math.Point,e}(display.Container),graphicsUtils={buildPoly:buildPoly,buildCircle:buildCircle,buildRectangle:buildRectangle,buildRoundedRectangle:buildRoundedRectangle,buildLine:buildLine,Star:Star,ArcUtils:ArcUtils,BezierUtils:BezierUtils,QuadraticUtils:QuadraticUtils,BatchPart:BatchPart,FILL_COMMANDS:FILL_COMMANDS,BATCH_POOL:BATCH_POOL,DRAW_CALL_POOL:DRAW_CALL_POOL};exports.FillStyle=FillStyle,exports.GRAPHICS_CURVES=GRAPHICS_CURVES,exports.Graphics=Graphics,exports.GraphicsData=GraphicsData,exports.GraphicsGeometry=GraphicsGeometry,exports.LineStyle=LineStyle,exports.graphicsUtils=graphicsUtils; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@pixi/core"),math=require("@pixi/math"),utils=require("@pixi/utils"),constants=require("@pixi/constants"),display=require("@pixi/display");!function(t){t.MITER="miter",t.BEVEL="bevel",t.ROUND="round"}(exports.LINE_JOIN||(exports.LINE_JOIN={})),function(t){t.BUTT="butt",t.ROUND="round",t.SQUARE="square"}(exports.LINE_CAP||(exports.LINE_CAP={}));var GRAPHICS_CURVES={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 i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},FillStyle=function(){function t(){this.color=16777215,this.alpha=1,this.texture=core.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=core.Texture.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),extendStatics=function(t,e){return(extendStatics=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])})(t,e)};function __extends(t,e){function i(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var buildPoly={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,r=t.holes,s=e.points,n=e.indices;if(i.length>=6){for(var a=[],h=0;h<r.length;h++){var o=r[h];a.push(i.length/2),i=i.concat(o.points)}var l=utils.earcut(i,a,2);if(!l)return;var u=s.length/2;for(h=0;h<l.length;h+=3)n.push(l[h]+u),n.push(l[h+1]+u),n.push(l[h+2]+u);for(h=0;h<i.length;h++)s.push(i[h])}}},buildCircle={build:function(t){var e,i,r=t.shape,s=t.points,n=r.x,a=r.y;if(s.length=0,t.type===math.SHAPES.CIRC)e=r.radius,i=r.radius;else{var h=t.shape;e=h.width,i=h.height}if(0!==e&&0!==i){var o=Math.floor(30*Math.sqrt(r.radius))||Math.floor(15*Math.sqrt(e+i));o/=2.3;for(var l=2*Math.PI/o,u=0;u<o-.5;u++)s.push(n+Math.sin(-l*u)*e,a+Math.cos(-l*u)*i);s.push(s[0],s[1])}},triangulate:function(t,e){var i=t.points,r=e.points,s=e.indices,n=r.length/2,a=n,h=t.shape,o=t.matrix,l=h.x,u=h.y;r.push(t.matrix?o.a*l+o.c*u+o.tx:l,t.matrix?o.b*l+o.d*u+o.ty:u);for(var c=0;c<i.length;c+=2)r.push(i[c],i[c+1]),s.push(n++,a,n)}},buildRectangle={build:function(t){var e=t.shape,i=e.x,r=e.y,s=e.width,n=e.height,a=t.points;a.length=0,a.push(i,r,i+s,r,i+s,r+n,i,r+n)},triangulate:function(t,e){var i=t.points,r=e.points,s=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}};function getPt(t,e,i){return t+(e-t)*i}function quadraticBezierCurve(t,e,i,r,s,n,a){void 0===a&&(a=[]);for(var h=a,o=0,l=0,u=0,c=0,p=0,d=0,y=0,f=0;y<=20;++y)o=getPt(t,i,f=y/20),l=getPt(e,r,f),u=getPt(i,s,f),c=getPt(r,n,f),p=getPt(o,u,f),d=getPt(l,c,f),h.push(p,d);return h}var buildRoundedRectangle={build:function(t){var e=t.shape,i=t.points,r=e.x,s=e.y,n=e.width,a=e.height,h=Math.max(0,Math.min(e.radius,Math.min(n,a)/2));i.length=0,h?(quadraticBezierCurve(r,s+h,r,s,r+h,s,i),quadraticBezierCurve(r+n-h,s,r+n,s,r+n,s+h,i),quadraticBezierCurve(r+n,s+a-h,r+n,s+a,r+n-h,s+a,i),quadraticBezierCurve(r+h,s+a,r,s+a,r,s+a-h,i)):i.push(r,s,r+n,s,r+n,s+a,r,s+a)},triangulate:function(t,e){for(var i=t.points,r=e.points,s=e.indices,n=r.length/2,a=utils.earcut(i,null,2),h=0,o=a.length;h<o;h+=3)s.push(a[h]+n),s.push(a[h+1]+n),s.push(a[h+2]+n);for(h=0,o=i.length;h<o;h++)r.push(i[h],i[++h])}};function square(t,e,i,r,s,n,a,h){var o,l;a?(o=r,l=-i):(o=-r,l=i);var u=t-i*s+o,c=e-r*s+l,p=t+i*n+o,d=e+r*n+l;return h.push(u,c),h.push(p,d),2}function round(t,e,i,r,s,n,a,h){var o=i-t,l=r-e,u=Math.atan2(o,l),c=Math.atan2(s-t,n-e);h&&u<c?u+=2*Math.PI:!h&&u>c&&(c+=2*Math.PI);var p=u,d=c-u,y=Math.abs(d),f=Math.sqrt(o*o+l*l),g=1+(15*y*Math.sqrt(f)/Math.PI>>0),v=d/g;if(p+=v,h){a.push(t,e),a.push(i,r);for(var b=1,m=p;b<g;b++,m+=v)a.push(t,e),a.push(t+Math.sin(m)*f,e+Math.cos(m)*f);a.push(t,e),a.push(s,n)}else{a.push(i,r),a.push(t,e);for(b=1,m=p;b<g;b++,m+=v)a.push(t+Math.sin(m)*f,e+Math.cos(m)*f),a.push(t,e);a.push(s,n),a.push(t,e)}return 2*g}function buildNonNativeLine(t,e){var i=t.shape,r=t.points||i.points.slice(),s=e.closePointEps;if(0!==r.length){var n=t.lineStyle,a=new math.Point(r[0],r[1]),h=new math.Point(r[r.length-2],r[r.length-1]),o=i.type!==math.SHAPES.POLY||i.closeStroke,l=Math.abs(a.x-h.x)<s&&Math.abs(a.y-h.y)<s;if(o){r=r.slice(),l&&(r.pop(),r.pop(),h.set(r[r.length-2],r[r.length-1]));var u=.5*(a.x+h.x),c=.5*(h.y+a.y);r.unshift(u,c),r.push(u,c)}var p=e.points,d=r.length/2,y=r.length,f=p.length/2,g=n.width/2,v=g*g,b=n.miterLimit*n.miterLimit,m=r[0],_=r[1],x=r[2],S=r[3],P=0,A=0,w=-(_-S),M=m-x,D=0,C=0,L=Math.sqrt(w*w+M*M);w/=L,M/=L,w*=g,M*=g;var E=n.alignment,I=2*(1-E),T=2*E;o||(n.cap===exports.LINE_CAP.ROUND?y+=round(m-w*(I-T)*.5,_-M*(I-T)*.5,m-w*I,_-M*I,m+w*T,_+M*T,p,!0)+2:n.cap===exports.LINE_CAP.SQUARE&&(y+=square(m,_,w,M,I,T,!0,p))),p.push(m-w*I,_-M*I),p.push(m+w*T,_+M*T);for(var R=1;R<d-1;++R){m=r[2*(R-1)],_=r[2*(R-1)+1],x=r[2*R],S=r[2*R+1],P=r[2*(R+1)],A=r[2*(R+1)+1],w=-(_-S),M=m-x,w/=L=Math.sqrt(w*w+M*M),M/=L,w*=g,M*=g,D=-(S-A),C=x-P,D/=L=Math.sqrt(D*D+C*C),C/=L,D*=g,C*=g;var O=x-m,B=_-S,U=x-P,N=A-S,H=B*U-N*O,F=H<0;if(Math.abs(H)<.1)p.push(x-w*I,S-M*I),p.push(x+w*T,S+M*T);else{var G=(-w+m)*(-M+S)-(-w+x)*(-M+_),q=(-D+P)*(-C+S)-(-D+x)*(-C+A),z=(O*q-U*G)/H,j=(N*G-B*q)/H,W=(z-x)*(z-x)+(j-S)*(j-S),k=x+(z-x)*I,V=S+(j-S)*I,J=x-(z-x)*T,Y=S-(j-S)*T,Q=F?I:T;W<=Math.min(O*O+B*B,U*U+N*N)+Q*Q*v?n.join===exports.LINE_JOIN.BEVEL||W/v>b?(F?(p.push(k,V),p.push(x+w*T,S+M*T),p.push(k,V),p.push(x+D*T,S+C*T)):(p.push(x-w*I,S-M*I),p.push(J,Y),p.push(x-D*I,S-C*I),p.push(J,Y)),y+=2):n.join===exports.LINE_JOIN.ROUND?F?(p.push(k,V),p.push(x+w*T,S+M*T),y+=round(x,S,x+w*T,S+M*T,x+D*T,S+C*T,p,!0)+4,p.push(k,V),p.push(x+D*T,S+C*T)):(p.push(x-w*I,S-M*I),p.push(J,Y),y+=round(x,S,x-w*I,S-M*I,x-D*I,S-C*I,p,!1)+4,p.push(x-D*I,S-C*I),p.push(J,Y)):(p.push(k,V),p.push(J,Y)):(p.push(x-w*I,S-M*I),p.push(x+w*T,S+M*T),n.join===exports.LINE_JOIN.BEVEL||W/v>b||(n.join===exports.LINE_JOIN.ROUND?y+=F?round(x,S,x+w*T,S+M*T,x+D*T,S+C*T,p,!0)+2:round(x,S,x-w*I,S-M*I,x-D*I,S-C*I,p,!1)+2:(F?(p.push(J,Y),p.push(J,Y)):(p.push(k,V),p.push(k,V)),y+=2)),p.push(x-D*I,S-C*I),p.push(x+D*T,S+C*T),y+=2)}}m=r[2*(d-2)],_=r[2*(d-2)+1],x=r[2*(d-1)],w=-(_-(S=r[2*(d-1)+1])),M=m-x,w/=L=Math.sqrt(w*w+M*M),M/=L,w*=g,M*=g,p.push(x-w*I,S-M*I),p.push(x+w*T,S+M*T),o||(n.cap===exports.LINE_CAP.ROUND?y+=round(x-w*(I-T)*.5,S-M*(I-T)*.5,x-w*I,S-M*I,x+w*T,S+M*T,p,!1)+2:n.cap===exports.LINE_CAP.SQUARE&&(y+=square(x,S,w,M,I,T,!1,p)));var X=e.indices,Z=GRAPHICS_CURVES.epsilon*GRAPHICS_CURVES.epsilon;for(R=f;R<y+f-2;++R)m=p[2*R],_=p[2*R+1],x=p[2*(R+1)],S=p[2*(R+1)+1],P=p[2*(R+2)],A=p[2*(R+2)+1],Math.abs(m*(S-A)+x*(A-_)+P*(_-S))<Z||X.push(R,R+1,R+2)}}function buildNativeLine(t,e){var i=0,r=t.shape,s=t.points||r.points,n=r.type!==math.SHAPES.POLY||r.closeStroke;if(0!==s.length){var a=e.points,h=e.indices,o=s.length/2,l=a.length/2,u=l;for(a.push(s[0],s[1]),i=1;i<o;i++)a.push(s[2*i],s[2*i+1]),h.push(u,u+1),u++;n&&h.push(u,l)}}function buildLine(t,e){t.lineStyle.native?buildNativeLine(t,e):buildNonNativeLine(t,e)}var _a,Star=function(t){function e(e,i,r,s,n,a){void 0===a&&(a=0);n=n||s/2;for(var h=-1*Math.PI/2+a,o=2*r,l=math.PI_2/o,u=[],c=0;c<o;c++){var p=c%2?n:s,d=c*l+h;u.push(e+p*Math.cos(d),i+p*Math.sin(d))}return t.call(this,u)||this}return __extends(e,t),e}(math.Polygon),ArcUtils=function(){function t(){}return t.curveTo=function(t,e,i,r,s,n){var a=n[n.length-2],h=n[n.length-1]-e,o=a-t,l=r-e,u=i-t,c=Math.abs(h*u-o*l);if(c<1e-8||0===s)return n[n.length-2]===t&&n[n.length-1]===e||n.push(t,e),null;var p=h*h+o*o,d=l*l+u*u,y=h*l+o*u,f=s*Math.sqrt(p)/c,g=s*Math.sqrt(d)/c,v=f*y/p,b=g*y/d,m=f*u+g*o,_=f*l+g*h,x=o*(g+v),S=h*(g+v),P=u*(f+b),A=l*(f+b);return{cx:m+t,cy:_+e,radius:s,startAngle:Math.atan2(S-_,x-m),endAngle:Math.atan2(A-_,P-m),anticlockwise:o*l>u*h}},t.arc=function(t,e,i,r,s,n,a,h,o){for(var l=a-n,u=GRAPHICS_CURVES._segmentsCount(Math.abs(l)*s,40*Math.ceil(Math.abs(l)/math.PI_2)),c=l/(2*u),p=2*c,d=Math.cos(c),y=Math.sin(c),f=u-1,g=f%1/f,v=0;v<=f;++v){var b=c+n+p*(v+g*v),m=Math.cos(b),_=-Math.sin(b);o.push((d*m+y*_)*s+i,(d*-_+y*m)*s+r)}},t}(),BezierUtils=function(){function t(){}return t.curveLength=function(t,e,i,r,s,n,a,h){for(var o=0,l=0,u=0,c=0,p=0,d=0,y=0,f=0,g=0,v=0,b=0,m=t,_=e,x=1;x<=10;++x)v=m-(f=(y=(d=(p=1-(l=x/10))*p)*p)*t+3*d*l*i+3*p*(u=l*l)*s+(c=u*l)*a),b=_-(g=y*e+3*d*l*r+3*p*u*n+c*h),m=f,_=g,o+=Math.sqrt(v*v+b*b);return o},t.curveTo=function(e,i,r,s,n,a,h){var o=h[h.length-2],l=h[h.length-1];h.length-=2;var u=GRAPHICS_CURVES._segmentsCount(t.curveLength(o,l,e,i,r,s,n,a)),c=0,p=0,d=0,y=0,f=0;h.push(o,l);for(var g=1,v=0;g<=u;++g)d=(p=(c=1-(v=g/u))*c)*c,f=(y=v*v)*v,h.push(d*o+3*p*v*e+3*c*y*r+f*n,d*l+3*p*v*i+3*c*y*s+f*a)},t}(),QuadraticUtils=function(){function t(){}return t.curveLength=function(t,e,i,r,s,n){var a=t-2*i+s,h=e-2*r+n,o=2*i-2*t,l=2*r-2*e,u=4*(a*a+h*h),c=4*(a*o+h*l),p=o*o+l*l,d=2*Math.sqrt(u+c+p),y=Math.sqrt(u),f=2*u*y,g=2*Math.sqrt(p),v=c/y;return(f*d+y*c*(d-g)+(4*p*u-c*c)*Math.log((2*y+v+d)/(v+g)))/(4*f)},t.curveTo=function(e,i,r,s,n){for(var a=n[n.length-2],h=n[n.length-1],o=GRAPHICS_CURVES._segmentsCount(t.curveLength(a,h,e,i,r,s)),l=0,u=0,c=1;c<=o;++c){var p=c/o;l=a+(e-a)*p,u=h+(i-h)*p,n.push(l+(e+(r-e)*p-l)*p,u+(i+(s-i)*p-u)*p)}},t}(),BatchPart=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}(),FILL_COMMANDS=((_a={})[math.SHAPES.POLY]=buildPoly,_a[math.SHAPES.CIRC]=buildCircle,_a[math.SHAPES.ELIP]=buildCircle,_a[math.SHAPES.RECT]=buildRectangle,_a[math.SHAPES.RREC]=buildRoundedRectangle,_a),BATCH_POOL=[],DRAW_CALL_POOL=[],GraphicsData=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type,this.points=[],this.holes=[]}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}(),tmpPoint=new math.Point,tmpBounds=new display.Bounds,GraphicsGeometry=function(t){function e(){var e=t.call(this)||this;return e.uvsFloat32=null,e.indicesUint16=null,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.dirty=0,e.batchDirty=-1,e.cacheDirty=-1,e.clearDirty=0,e.drawCalls=[],e.batches=[],e.shapeIndex=0,e._bounds=new display.Bounds,e.boundsDirty=-1,e.boundsPadding=0,e.batchable=!1,e.indicesUint16=null,e.uvsFloat32=null,e.closePointEps=1e-4,e}return __extends(e,t),Object.defineProperty(e.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),e.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;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),DRAW_CALL_POOL.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),BATCH_POOL.push(e)}this.batches.length=0},e.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},e.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var s=new GraphicsData(t,e,i,r);return this.graphicsData.push(s),this.dirty++,this},e.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new GraphicsData(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},e.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},e.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,tmpPoint):tmpPoint.copyFrom(t),r.shape.contains(tmpPoint.x,tmpPoint.y)))){var s=!1;if(r.holes)for(var n=0;n<r.holes.length;n++){if(r.holes[n].shape.contains(tmpPoint.x,tmpPoint.y)){s=!0;break}}if(!s)return!0}}return!1},e.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,s=null;this.batches.length>0&&(s=(r=this.batches[this.batches.length-1]).style);for(var n=this.shapeIndex;n<i.length;n++){this.shapeIndex++;var a=i[n],h=a.fillStyle,o=a.lineStyle;FILL_COMMANDS[a.type].build(a),a.matrix&&this.transformPoints(a.points,a.matrix);for(var l=0;l<2;l++){var u=0===l?h:o;if(u.visible){var c=u.texture.baseTexture,p=this.indices.length,d=this.points.length/2;c.wrapMode=constants.WRAP_MODES.REPEAT,0===l?this.processFill(a):this.processLine(a);var y=this.points.length/2-d;0!==y&&(r&&!this._compareStyles(s,u)&&(r.end(p,d),r=null),r||((r=BATCH_POOL.pop()||new BatchPart).begin(u,p,d),this.batches.push(r),s=u),this.addUvs(this.points,e,u.texture,d,y,u.matrix))}}}var f=this.indices.length,g=this.points.length/2;if(r&&r.end(f,g),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var v=g>65535&&t;this.indicesUint16=v?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},e.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))},e.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,s=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(s&&!s.texture.baseTexture.valid)return!1}return!0},e.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],s=0;s<r.size;s++){var n=r.start+s;this.indicesUint16[n]=this.indicesUint16[n]-r.attribStart}},e.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,i=0;i<t.length;i++)if(t[i].style.native)return!1;return this.points.length<2*e.BATCHABLE_SIZE},e.prototype.buildDrawCalls=function(){for(var t=++core.BaseTexture._globalBatch,e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),DRAW_CALL_POOL.push(this.drawCalls[e]);this.drawCalls.length=0;var i=this.colors,r=this.textureIds,s=DRAW_CALL_POOL.pop();s||((s=new core.BatchDrawCall).texArray=new core.BatchTextureArray),s.texArray.count=0,s.start=0,s.size=0,s.type=constants.DRAW_MODES.TRIANGLES;var n=0,a=null,h=0,o=!1,l=constants.DRAW_MODES.TRIANGLES,u=0;this.drawCalls.push(s);for(e=0;e<this.batches.length;e++){var c=this.batches[e],p=c.style,d=p.texture.baseTexture;o!==!!p.native&&(l=(o=!!p.native)?constants.DRAW_MODES.LINES:constants.DRAW_MODES.TRIANGLES,a=null,n=8,t++),a!==d&&(a=d,d._batchEnabled!==t&&(8===n&&(t++,n=0,s.size>0&&((s=DRAW_CALL_POOL.pop())||((s=new core.BatchDrawCall).texArray=new core.BatchTextureArray),this.drawCalls.push(s)),s.start=u,s.size=0,s.texArray.count=0,s.type=l),d.touched=1,d._batchEnabled=t,d._batchLocation=n,d.wrapMode=10497,s.texArray.elements[s.texArray.count++]=d,n++)),s.size+=c.size,u+=c.size,h=d._batchLocation,this.addColors(i,p.color,p.alpha,c.attribSize),this.addTextureIds(r,h,c.attribSize)}core.BaseTexture._globalBatch=t,this.packAttributes()},e.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,s=new ArrayBuffer(3*t.length*4),n=new Float32Array(s),a=new Uint32Array(s),h=0,o=0;o<t.length/2;o++)n[h++]=t[2*o],n[h++]=t[2*o+1],n[h++]=e[2*o],n[h++]=e[2*o+1],a[h++]=i[o],n[h++]=r[o];this._buffer.update(s),this._indexBuffer.update(this.indicesUint16)},e.prototype.processFill=function(t){t.holes.length?(this.processHoles(t.holes),buildPoly.triangulate(t,this)):FILL_COMMANDS[t.type].triangulate(t,this)},e.prototype.processLine=function(t){buildLine(t,this);for(var e=0;e<t.holes.length;e++)buildLine(t.holes[e],this)},e.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];FILL_COMMANDS[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},e.prototype.calculateBounds=function(){var t=this._bounds,e=tmpBounds,i=math.Matrix.IDENTITY;this._bounds.clear(),e.clear();for(var r=0;r<this.graphicsData.length;r++){var s=this.graphicsData[r],n=s.shape,a=s.type,h=s.lineStyle,o=s.matrix||math.Matrix.IDENTITY,l=0;if(h&&h.visible){var u=h.alignment;l=h.width,a===math.SHAPES.POLY?l*=.5+Math.abs(.5-u):l*=Math.max(0,u)}if(i!==o&&(e.isEmpty()||(t.addBoundsMatrix(e,i),e.clear()),i=o),a===math.SHAPES.RECT||a===math.SHAPES.RREC){var c=n;e.addFramePad(c.x,c.y,c.x+c.width,c.y+c.height,l,l)}else if(a===math.SHAPES.CIRC){var p=n;e.addFramePad(p.x,p.y,p.x,p.y,p.radius+l,p.radius+l)}else if(a===math.SHAPES.ELIP){var d=n;e.addFramePad(d.x,d.y,d.x,d.y,d.width+l,d.height+l)}else{var y=n;t.addVerticesMatrix(i,y.points,0,y.points.length,l,l)}}e.isEmpty()||t.addBoundsMatrix(e,i),t.pad(this.boundsPadding,this.boundsPadding)},e.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],s=t[2*i+1];t[2*i]=e.a*r+e.c*s+e.tx,t[2*i+1]=e.b*r+e.d*s+e.ty}},e.prototype.addColors=function(t,e,i,r){for(var s=(e>>16)+(65280&e)+((255&e)<<16),n=utils.premultiplyTint(s,i);r-- >0;)t.push(n)},e.prototype.addTextureIds=function(t,e,i){for(;i-- >0;)t.push(e)},e.prototype.addUvs=function(t,e,i,r,s,n){void 0===n&&(n=null);for(var a=0,h=e.length,o=i.frame;a<s;){var l=t[2*(r+a)],u=t[2*(r+a)+1];if(n){var c=n.a*l+n.c*u+n.tx;u=n.b*l+n.d*u+n.ty,l=c}a++,e.push(l/o.width,u/o.height)}var p=i.baseTexture;(o.width<p.width||o.height<p.height)&&this.adjustUvs(e,i,h,s)},e.prototype.adjustUvs=function(t,e,i,r){for(var s=e.baseTexture,n=i+2*r,a=e.frame,h=a.width/s.width,o=a.height/s.height,l=a.x/a.width,u=a.y/a.height,c=Math.floor(t[i]+1e-6),p=Math.floor(t[i+1]+1e-6),d=i+2;d<n;d+=2)c=Math.min(c,Math.floor(t[d]+1e-6)),p=Math.min(p,Math.floor(t[d+1]+1e-6));l-=c,u-=p;for(d=i;d<n;d+=2)t[d]=(t[d]+l)*h,t[d+1]=(t[d+1]+u)*o},e.BATCHABLE_SIZE=100,e}(core.BatchGeometry),LineStyle=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=exports.LINE_CAP.BUTT,e.join=exports.LINE_JOIN.MITER,e.miterLimit=10,e}return __extends(e,t),e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(FillStyle),temp=new Float32Array(3),DEFAULT_SHADERS={},Graphics=function(t){function e(e){void 0===e&&(e=null);var i=t.call(this)||this;return i._geometry=e||new GraphicsGeometry,i._geometry.refCount++,i.shader=null,i.state=core.State.for2d(),i._fillStyle=new FillStyle,i._lineStyle=new LineStyle,i._matrix=null,i._holeMode=!1,i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i.pluginName="batch",i._transformID=-1,i.tint=16777215,i.blendMode=constants.BLEND_MODES.NORMAL,i}return __extends(e,t),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return this.finishPoly(),new e(this._geometry)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),e.prototype.lineStyle=function(t){if(void 0===t&&(t=null),"number"==typeof t){var e=arguments;t={width:e[0]||0,color:e[1]||0,alpha:void 0!==e[2]?e[2]:1,alignment:void 0!==e[3]?e[3]:.5,native:!!e[4]}}return this.lineTextureStyle(t)},e.prototype.lineTextureStyle=function(t){t=Object.assign({width:0,texture:core.Texture.WHITE,color:t&&t.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:exports.LINE_CAP.BUTT,join:exports.LINE_JOIN.MITER,miterLimit:10},t),this.currentPath&&this.startPoly();var e=t.width>0&&t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:e},t)):this._lineStyle.reset(),this},e.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 math.Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new math.Polygon,this.currentPath.closeStroke=!1},e.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},e.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},e.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],s=i[i.length-1];return r===t&&s===e||i.push(t,e),this},e.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)},e.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var s=this.currentPath.points;return 0===s.length&&this.moveTo(0,0),QuadraticUtils.curveTo(t,e,i,r,s),this},e.prototype.bezierCurveTo=function(t,e,i,r,s,n){return this._initCurve(),BezierUtils.curveTo(t,e,i,r,s,n,this.currentPath.points),this},e.prototype.arcTo=function(t,e,i,r,s){this._initCurve(t,e);var n=this.currentPath.points,a=ArcUtils.curveTo(t,e,i,r,s,n);if(a){var h=a.cx,o=a.cy,l=a.radius,u=a.startAngle,c=a.endAngle,p=a.anticlockwise;this.arc(h,o,l,u,c,p)}return this},e.prototype.arc=function(t,e,i,r,s,n){if(void 0===n&&(n=!1),r===s)return this;if(!n&&s<=r?s+=math.PI_2:n&&r<=s&&(r+=math.PI_2),0===s-r)return this;var a=t+Math.cos(r)*i,h=e+Math.sin(r)*i,o=this._geometry.closePointEps,l=this.currentPath?this.currentPath.points:null;if(l){var u=Math.abs(l[l.length-2]-a),c=Math.abs(l[l.length-1]-h);u<o&&c<o||l.push(a,h)}else this.moveTo(a,h),l=this.currentPath.points;return ArcUtils.arc(a,h,t,e,i,r,s,n,l),this},e.prototype.beginFill=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=1),this.beginTextureFill({texture:core.Texture.WHITE,color:t,alpha:e})},e.prototype.beginTextureFill=function(t){t=Object.assign({texture:core.Texture.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var e=t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:e},t)):this._fillStyle.reset(),this},e.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},e.prototype.drawRect=function(t,e,i,r){return this.drawShape(new math.Rectangle(t,e,i,r))},e.prototype.drawRoundedRect=function(t,e,i,r,s){return this.drawShape(new math.RoundedRectangle(t,e,i,r,s))},e.prototype.drawCircle=function(t,e,i){return this.drawShape(new math.Circle(t,e,i))},e.prototype.drawEllipse=function(t,e,i,r){return this.drawShape(new math.Ellipse(t,e,i,r))},e.prototype.drawPolygon=function(){for(var t,e=arguments,i=[],r=0;r<arguments.length;r++)i[r]=e[r];var s=!0,n=i[0];n.points?(s=n.closeStroke,t=n.points):t=Array.isArray(i[0])?i[0]:i;var a=new math.Polygon(t);return a.closeStroke=s,this.drawShape(a),this},e.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},e.prototype.drawStar=function(t,e,i,r,s,n){return void 0===n&&(n=0),this.drawPolygon(new Star(t,e,i,r,s,n))},e.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},e.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return 1===t.length&&t[0].shape.type===math.SHAPES.RECT&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)},e.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},e.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var r=0;r<i;r++){var s=t.batches[r],n=s.style.color,a=new Float32Array(this.vertexData.buffer,4*s.attribStart*2,2*s.attribSize),h=new Float32Array(t.uvsFloat32.buffer,4*s.attribStart*2,2*s.attribSize),o={vertexData:a,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*s.start,s.size),uvs:h,_batchRGB:utils.hex2rgb(n),_tintRGB:n,_texture:s.style.texture,alpha:s.style.alpha,worldAlpha:1};this.batches[r]=o}},e.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},e.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,s=this.worldAlpha,n=e.uniforms,a=i.drawCalls;n.translationMatrix=this.transform.worldTransform,n.tint[0]=(r>>16&255)/255*s,n.tint[1]=(r>>8&255)/255*s,n.tint[2]=(255&r)/255*s,n.tint[3]=s,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var h=0,o=a.length;h<o;h++)this._renderDrawCallDirect(t,i.drawCalls[h])},e.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,s=e.size,n=e.start,a=i.count,h=0;h<a;h++)t.texture.bind(i.elements[h],h);t.geometry.draw(r,s,n)},e.prototype._resolveDirectShader=function(t){var e=this.shader,i=this.pluginName;if(!e){if(!DEFAULT_SHADERS[i]){for(var r=t.plugins.batch.MAX_TEXTURES,s=new Int32Array(r),n=0;n<r;n++)s[n]=n;var a={tint:new Float32Array([1,1,1,1]),translationMatrix:new math.Matrix,default:core.UniformGroup.from({uSamplers:s},!0)},h=t.plugins[i]._shader.program;DEFAULT_SHADERS[i]=new core.Shader(h,a)}e=DEFAULT_SHADERS[i]}return e},e.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,s=e.maxX,n=e.maxY;this._bounds.addFrame(this.transform,i,r,s,n)}},e.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,e._TEMP_POINT),this._geometry.containsPoint(e._TEMP_POINT)},e.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=utils.hex2rgb(this.tint,temp),e=0;e<this.batches.length;e++){var i=this.batches[e],r=i._batchRGB,s=(t[0]*r[0]*255<<16)+(t[1]*r[1]*255<<8)+(0|t[2]*r[2]*255);i._tintRGB=(s>>16)+(65280&s)+((255&s)<<16)}}},e.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,s=e.c,n=e.d,a=e.tx,h=e.ty,o=this._geometry.points,l=this.vertexData,u=0,c=0;c<o.length;c+=2){var p=o[c],d=o[c+1];l[u++]=i*p+s*d+a,l[u++]=n*d+r*p+h}}},e.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0),this},e.prototype.setMatrix=function(t){return this._matrix=t,this},e.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},e.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},e.prototype.destroy=function(e){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,t.prototype.destroy.call(this,e)},e._TEMP_POINT=new math.Point,e}(display.Container),graphicsUtils={buildPoly:buildPoly,buildCircle:buildCircle,buildRectangle:buildRectangle,buildRoundedRectangle:buildRoundedRectangle,buildLine:buildLine,Star:Star,ArcUtils:ArcUtils,BezierUtils:BezierUtils,QuadraticUtils:QuadraticUtils,BatchPart:BatchPart,FILL_COMMANDS:FILL_COMMANDS,BATCH_POOL:BATCH_POOL,DRAW_CALL_POOL:DRAW_CALL_POOL};exports.FillStyle=FillStyle,exports.GRAPHICS_CURVES=GRAPHICS_CURVES,exports.Graphics=Graphics,exports.GraphicsData=GraphicsData,exports.GraphicsGeometry=GraphicsGeometry,exports.LineStyle=LineStyle,exports.graphicsUtils=graphicsUtils; | ||
//# sourceMappingURL=graphics.min.js.map |
/*! | ||
* @pixi/graphics - v5.4.0-rc.3 | ||
* Compiled Thu, 10 Dec 2020 03:22:17 UTC | ||
* @pixi/graphics - v6.0.0-rc | ||
* Compiled Tue, 29 Dec 2020 19:58:03 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/graphics is licensed under the MIT License. | ||
*/ | ||
import{Texture as t,BaseTexture as e,BatchDrawCall as i,BatchTextureArray as r,BatchGeometry as n,UniformGroup as s,Shader as h,State as a}from"@pixi/core";import{SHAPES as o,Point as l,Polygon as u,PI_2 as p,Matrix as c,Rectangle as f,RoundedRectangle as d,Circle as y,Ellipse as v}from"@pixi/math";import{earcut as g,premultiplyTint as b,hex2rgb as m}from"@pixi/utils";import{WRAP_MODES as x,DRAW_MODES as w,BLEND_MODES as _}from"@pixi/constants";import{Bounds as M,Container as P}from"@pixi/display";var S,T;!function(t){t.MITER="miter",t.BEVEL="bevel",t.ROUND="round"}(S||(S={})),function(t){t.BUTT="butt",t.ROUND="round",t.SQUARE="square"}(T||(T={}));var D={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 i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},A=function(){function e(){this.color=16777215,this.alpha=1,this.texture=t.WHITE,this.matrix=null,this.visible=!1,this.reset()}return e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t},e.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=t.WHITE,this.matrix=null,this.visible=!1},e.prototype.destroy=function(){this.texture=null,this.matrix=null},e}(),C=function(t,e){return(C=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])})(t,e)};function I(t,e){function i(){this.constructor=t}C(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var E={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,r=t.holes,n=e.points,s=e.indices;if(i.length>=6){for(var h=[],a=0;a<r.length;a++){var o=r[a];h.push(i.length/2),i=i.concat(o.points)}var l=g(i,h,2);if(!l)return;var u=n.length/2;for(a=0;a<l.length;a+=3)s.push(l[a]+u),s.push(l[a+1]+u),s.push(l[a+2]+u);for(a=0;a<i.length;a++)n.push(i[a])}}},R={build:function(t){var e,i,r=t.shape,n=t.points,s=r.x,h=r.y;if(n.length=0,t.type===o.CIRC)e=r.radius,i=r.radius;else{var a=t.shape;e=a.width,i=a.height}if(0!==e&&0!==i){var l=Math.floor(30*Math.sqrt(r.radius))||Math.floor(15*Math.sqrt(e+i));l/=2.3;for(var u=2*Math.PI/l,p=0;p<l-.5;p++)n.push(s+Math.sin(-u*p)*e,h+Math.cos(-u*p)*i);n.push(n[0],n[1])}},triangulate:function(t,e){var i=t.points,r=e.points,n=e.indices,s=r.length/2,h=s,a=t.shape,o=t.matrix,l=a.x,u=a.y;r.push(t.matrix?o.a*l+o.c*u+o.tx:l,t.matrix?o.b*l+o.d*u+o.ty:u);for(var p=0;p<i.length;p+=2)r.push(i[p],i[p+1]),n.push(s++,h,s)}},B={build:function(t){var e=t.shape,i=e.x,r=e.y,n=e.width,s=e.height,h=t.points;h.length=0,h.push(i,r,i+n,r,i+n,r+s,i,r+s)},triangulate:function(t,e){var i=t.points,r=e.points,n=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function L(t,e,i){return t+(e-t)*i}function O(t,e,i,r,n,s,h){void 0===h&&(h=[]);for(var a=h,o=0,l=0,u=0,p=0,c=0,f=0,d=0,y=0;d<=20;++d)o=L(t,i,y=d/20),l=L(e,r,y),u=L(i,n,y),p=L(r,s,y),c=L(o,u,y),f=L(l,p,y),a.push(c,f);return a}var U={build:function(t){var e=t.shape,i=t.points,r=e.x,n=e.y,s=e.width,h=e.height,a=Math.max(0,Math.min(e.radius,Math.min(s,h)/2));i.length=0,a?(O(r,n+a,r,n,r+a,n,i),O(r+s-a,n,r+s,n,r+s,n+a,i),O(r+s,n+h-a,r+s,n+h,r+s-a,n+h,i),O(r+a,n+h,r,n+h,r,n+h-a,i)):i.push(r,n,r+s,n,r+s,n+h,r,n+h)},triangulate:function(t,e){for(var i=t.points,r=e.points,n=e.indices,s=r.length/2,h=g(i,null,2),a=0,o=h.length;a<o;a+=3)n.push(h[a]+s),n.push(h[a+1]+s),n.push(h[a+2]+s);for(a=0,o=i.length;a<o;a++)r.push(i[a],i[++a])}};function j(t,e,i,r,n,s,h,a){var o,l;h?(o=r,l=-i):(o=-r,l=i);var u=t-i*n+o,p=e-r*n+l,c=t+i*s+o,f=e+r*s+l;return a.push(u,p),a.push(c,f),2}function F(t,e,i,r,n,s,h,a){var o=i-t,l=r-e,u=Math.atan2(o,l),p=Math.atan2(n-t,s-e);a&&u<p?u+=2*Math.PI:!a&&u>p&&(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<v;b++,m+=g)h.push(t,e),h.push(t+Math.sin(m)*y,e+Math.cos(m)*y);h.push(t,e),h.push(n,s)}else{h.push(i,r),h.push(t,e);for(b=1,m=c;b<v;b++,m+=g)h.push(t+Math.sin(m)*y,e+Math.cos(m)*y),h.push(t,e);h.push(n,s),h.push(t,e)}return 2*v}function N(t,e){t.lineStyle.native?function(t,e){var i=0,r=t.shape,n=t.points||r.points,s=r.type!==o.POLY||r.closeStroke;if(0!==n.length){var h=e.points,a=e.indices,l=n.length/2,u=h.length/2,p=u;for(h.push(n[0],n[1]),i=1;i<l;i++)h.push(n[2*i],n[2*i+1]),a.push(p,p+1),p++;s&&a.push(p,u)}}(t,e):function(t,e){var i=t.shape,r=t.points||i.points.slice(),n=e.closePointEps;if(0!==r.length){var s=t.lineStyle,h=new l(r[0],r[1]),a=new l(r[r.length-2],r[r.length-1]),u=i.type!==o.POLY||i.closeStroke,p=Math.abs(h.x-a.x)<n&&Math.abs(h.y-a.y)<n;if(u){r=r.slice(),p&&(r.pop(),r.pop(),a.set(r[r.length-2],r[r.length-1]));var c=.5*(h.x+a.x),f=.5*(a.y+h.y);r.unshift(c,f),r.push(c,f)}var d=e.points,y=r.length/2,v=r.length,g=d.length/2,b=s.width/2,m=b*b,x=s.miterLimit*s.miterLimit,w=r[0],_=r[1],M=r[2],P=r[3],A=0,C=0,I=-(_-P),E=w-M,R=0,B=0,L=Math.sqrt(I*I+E*E);I/=L,E/=L,I*=b,E*=b;var O=s.alignment,U=2*(1-O),N=2*O;u||(s.cap===T.ROUND?v+=F(w-I*(U-N)*.5,_-E*(U-N)*.5,w-I*U,_-E*U,w+I*N,_+E*N,d,!0)+2:s.cap===T.SQUARE&&(v+=j(w,_,I,E,U,N,!0,d))),d.push(w-I*U,_-E*U),d.push(w+I*N,_+E*N);for(var z=1;z<y-1;++z){w=r[2*(z-1)],_=r[2*(z-1)+1],M=r[2*z],P=r[2*z+1],A=r[2*(z+1)],C=r[2*(z+1)+1],I=-(_-P),E=w-M,I/=L=Math.sqrt(I*I+E*E),E/=L,I*=b,E*=b,R=-(P-C),B=M-A,R/=L=Math.sqrt(R*R+B*B),B/=L,R*=b,B*=b;var k=M-w,q=_-P,H=M-A,Y=C-P,G=q*H-Y*k,V=G<0;if(Math.abs(G)<.1)d.push(M-I*U,P-E*U),d.push(M+I*N,P+E*N);else{var W=(-I+w)*(-E+P)-(-I+M)*(-E+_),Q=(-R+A)*(-B+P)-(-R+M)*(-B+C),X=(k*Q-H*W)/G,Z=(Y*W-q*Q)/G,J=(X-M)*(X-M)+(Z-P)*(Z-P),K=M+(X-M)*U,$=P+(Z-P)*U,tt=M-(X-M)*N,et=P-(Z-P)*N,it=V?U:N;J<=Math.min(k*k+q*q,H*H+Y*Y)+it*it*m?s.join===S.BEVEL||J/m>x?(V?(d.push(K,$),d.push(M+I*N,P+E*N),d.push(K,$),d.push(M+R*N,P+B*N)):(d.push(M-I*U,P-E*U),d.push(tt,et),d.push(M-R*U,P-B*U),d.push(tt,et)),v+=2):s.join===S.ROUND?V?(d.push(K,$),d.push(M+I*N,P+E*N),v+=F(M,P,M+I*N,P+E*N,M+R*N,P+B*N,d,!0)+4,d.push(K,$),d.push(M+R*N,P+B*N)):(d.push(M-I*U,P-E*U),d.push(tt,et),v+=F(M,P,M-I*U,P-E*U,M-R*U,P-B*U,d,!1)+4,d.push(M-R*U,P-B*U),d.push(tt,et)):(d.push(K,$),d.push(tt,et)):(d.push(M-I*U,P-E*U),d.push(M+I*N,P+E*N),s.join===S.BEVEL||J/m>x||(s.join===S.ROUND?v+=V?F(M,P,M+I*N,P+E*N,M+R*N,P+B*N,d,!0)+2:F(M,P,M-I*U,P-E*U,M-R*U,P-B*U,d,!1)+2:(V?(d.push(tt,et),d.push(tt,et)):(d.push(K,$),d.push(K,$)),v+=2)),d.push(M-R*U,P-B*U),d.push(M+R*N,P+B*N),v+=2)}}w=r[2*(y-2)],_=r[2*(y-2)+1],M=r[2*(y-1)],I=-(_-(P=r[2*(y-1)+1])),E=w-M,I/=L=Math.sqrt(I*I+E*E),E/=L,I*=b,E*=b,d.push(M-I*U,P-E*U),d.push(M+I*N,P+E*N),u||(s.cap===T.ROUND?v+=F(M-I*(U-N)*.5,P-E*(U-N)*.5,M-I*U,P-E*U,M+I*N,P+E*N,d,!1)+2:s.cap===T.SQUARE&&(v+=j(M,P,I,E,U,N,!1,d)));var rt=e.indices,nt=D.epsilon*D.epsilon;for(z=g;z<v+g-2;++z)w=d[2*z],_=d[2*z+1],M=d[2*(z+1)],P=d[2*(z+1)+1],A=d[2*(z+2)],C=d[2*(z+2)+1],Math.abs(w*(P-C)+M*(C-_)+A*(_-P))<nt||rt.push(z,z+1,z+2)}}(t,e)}var z,k=function(t){function e(e,i,r,n,s,h){void 0===h&&(h=0);s=s||n/2;for(var a=-1*Math.PI/2+h,o=2*r,l=p/o,u=[],c=0;c<o;c++){var f=c%2?s:n,d=c*l+a;u.push(e+f*Math.cos(d),i+f*Math.sin(d))}return t.call(this,u)||this}return I(e,t),e}(u),q=function(){function t(){}return t.curveTo=function(t,e,i,r,n,s){var h=s[s.length-2],a=s[s.length-1]-e,o=h-t,l=r-e,u=i-t,p=Math.abs(a*u-o*l);if(p<1e-8||0===n)return s[s.length-2]===t&&s[s.length-1]===e||s.push(t,e),null;var c=a*a+o*o,f=l*l+u*u,d=a*l+o*u,y=n*Math.sqrt(c)/p,v=n*Math.sqrt(f)/p,g=y*d/c,b=v*d/f,m=y*u+v*o,x=y*l+v*a,w=o*(v+g),_=a*(v+g),M=u*(y+b),P=l*(y+b);return{cx:m+t,cy:x+e,radius:n,startAngle:Math.atan2(_-x,w-m),endAngle:Math.atan2(P-x,M-m),anticlockwise:o*l>u*a}},t.arc=function(t,e,i,r,n,s,h,a,o){for(var l=h-s,u=D._segmentsCount(Math.abs(l)*n,40*Math.ceil(Math.abs(l)/p)),c=l/(2*u),f=2*c,d=Math.cos(c),y=Math.sin(c),v=u-1,g=v%1/v,b=0;b<=v;++b){var m=c+s+f*(b+g*b),x=Math.cos(m),w=-Math.sin(m);o.push((d*x+y*w)*n+i,(d*-w+y*x)*n+r)}},t}(),H=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,x=e,w=1;w<=10;++w)g=m-(y=(d=(f=(c=1-(l=w/10))*c)*c)*t+3*f*l*i+3*c*(u=l*l)*n+(p=u*l)*h),b=x-(v=d*e+3*f*l*r+3*c*u*s+p*a),m=y,x=v,o+=Math.sqrt(g*g+b*b);return o},t.curveTo=function(e,i,r,n,s,h,a){var o=a[a.length-2],l=a[a.length-1];a.length-=2;var u=D._segmentsCount(t.curveLength(o,l,e,i,r,n,s,h)),p=0,c=0,f=0,d=0,y=0;a.push(o,l);for(var v=1,g=0;v<=u;++v)f=(c=(p=1-(g=v/u))*p)*p,y=(d=g*g)*g,a.push(f*o+3*c*g*e+3*p*d*r+y*s,f*l+3*c*g*i+3*p*d*n+y*h)},t}(),Y=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],o=D._segmentsCount(t.curveLength(h,a,e,i,r,n)),l=0,u=0,p=1;p<=o;++p){var c=p/o;l=h+(e-h)*c,u=a+(i-a)*c,s.push(l+(e+(r-e)*c-l)*c,u+(i+(n-i)*c-u)*c)}},t}(),G=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}(),V=((z={})[o.POLY]=E,z[o.CIRC]=R,z[o.ELIP]=R,z[o.RECT]=B,z[o.RREC]=U,z),W=[],Q=[],X=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type,this.points=[],this.holes=[]}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}(),Z=new l,J=new M,K=function(t){function n(){var e=t.call(this)||this;return e.uvsFloat32=null,e.indicesUint16=null,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.dirty=0,e.batchDirty=-1,e.cacheDirty=-1,e.clearDirty=0,e.drawCalls=[],e.batches=[],e.shapeIndex=0,e._bounds=new M,e.boundsDirty=-1,e.boundsPadding=0,e.batchable=!1,e.indicesUint16=null,e.uvsFloat32=null,e.closePointEps=1e-4,e}return I(n,t),Object.defineProperty(n.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),n.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;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Q.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),W.push(e)}this.batches.length=0},n.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},n.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 X(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},n.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new X(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},n.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},n.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,Z):Z.copyFrom(t),r.shape.contains(Z.x,Z.y)))){var n=!1;if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(Z.x,Z.y)){n=!0;break}}if(!n)return!0}}return!1},n.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,n=null;this.batches.length>0&&(n=(r=this.batches[this.batches.length-1]).style);for(var s=this.shapeIndex;s<i.length;s++){this.shapeIndex++;var h=i[s],a=h.fillStyle,o=h.lineStyle;V[h.type].build(h),h.matrix&&this.transformPoints(h.points,h.matrix);for(var l=0;l<2;l++){var u=0===l?a:o;if(u.visible){var p=u.texture.baseTexture,c=this.indices.length,f=this.points.length/2;p.wrapMode=x.REPEAT,0===l?this.processFill(h):this.processLine(h);var d=this.points.length/2-f;0!==d&&(r&&!this._compareStyles(n,u)&&(r.end(c,f),r=null),r||((r=W.pop()||new G).begin(u,c,f),this.batches.push(r),n=u),this.addUvs(this.points,e,u.texture,f,d,u.matrix))}}}var y=this.indices.length,v=this.points.length/2;if(r&&r.end(y,v),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var g=v>65535&&t;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},n.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))},n.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(n&&!n.texture.baseTexture.valid)return!1}return!0},n.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],n=0;n<r.size;n++){var s=r.start+n;this.indicesUint16[s]=this.indicesUint16[s]-r.attribStart}},n.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<2*n.BATCHABLE_SIZE},n.prototype.buildDrawCalls=function(){for(var t=++e._globalBatch,n=0;n<this.drawCalls.length;n++)this.drawCalls[n].texArray.clear(),Q.push(this.drawCalls[n]);this.drawCalls.length=0;var s=this.colors,h=this.textureIds,a=Q.pop();a||((a=new i).texArray=new r),a.texArray.count=0,a.start=0,a.size=0,a.type=w.TRIANGLES;var o=0,l=null,u=0,p=!1,c=w.TRIANGLES,f=0;this.drawCalls.push(a);for(n=0;n<this.batches.length;n++){var d=this.batches[n],y=d.style,v=y.texture.baseTexture;p!==!!y.native&&(c=(p=!!y.native)?w.LINES:w.TRIANGLES,l=null,o=8,t++),l!==v&&(l=v,v._batchEnabled!==t&&(8===o&&(t++,o=0,a.size>0&&((a=Q.pop())||((a=new i).texArray=new r),this.drawCalls.push(a)),a.start=f,a.size=0,a.texArray.count=0,a.type=c),v.touched=1,v._batchEnabled=t,v._batchLocation=o,v.wrapMode=10497,a.texArray.elements[a.texArray.count++]=v,o++)),a.size+=d.size,f+=d.size,u=v._batchLocation,this.addColors(s,y.color,y.alpha,d.attribSize),this.addTextureIds(h,u,d.attribSize)}e._globalBatch=t,this.packAttributes()},n.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<t.length/2;o++)s[a++]=t[2*o],s[a++]=t[2*o+1],s[a++]=e[2*o],s[a++]=e[2*o+1],h[a++]=i[o],s[a++]=r[o];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)},n.prototype.processFill=function(t){t.holes.length?(this.processHoles(t.holes),E.triangulate(t,this)):V[t.type].triangulate(t,this)},n.prototype.processLine=function(t){N(t,this);for(var e=0;e<t.holes.length;e++)N(t.holes[e],this)},n.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];V[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},n.prototype.calculateBounds=function(){var t=this._bounds,e=J,i=c.IDENTITY;this._bounds.clear(),e.clear();for(var r=0;r<this.graphicsData.length;r++){var n=this.graphicsData[r],s=n.shape,h=n.type,a=n.lineStyle,l=n.matrix||c.IDENTITY,u=0;if(a&&a.visible){var p=a.alignment;u=a.width,h===o.POLY?u*=.5+Math.abs(.5-p):u*=Math.max(0,p)}if(i!==l&&(e.isEmpty()||(t.addBoundsMatrix(e,i),e.clear()),i=l),h===o.RECT||h===o.RREC){var f=s;e.addFramePad(f.x,f.y,f.x+f.width,f.y+f.height,u,u)}else if(h===o.CIRC){var d=s;e.addFramePad(d.x,d.y,d.x,d.y,d.radius+u,d.radius+u)}else if(h===o.ELIP){var y=s;e.addFramePad(y.x,y.y,y.x,y.y,y.width+u,y.height+u)}else{var v=s;t.addVerticesMatrix(i,v.points,0,v.points.length,u,u)}}e.isEmpty()||t.addBoundsMatrix(e,i),t.pad(this.boundsPadding,this.boundsPadding)},n.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],n=t[2*i+1];t[2*i]=e.a*r+e.c*n+e.tx,t[2*i+1]=e.b*r+e.d*n+e.ty}},n.prototype.addColors=function(t,e,i,r){for(var n=b((e>>16)+(65280&e)+((255&e)<<16),i);r-- >0;)t.push(n)},n.prototype.addTextureIds=function(t,e,i){for(;i-- >0;)t.push(e)},n.prototype.addUvs=function(t,e,i,r,n,s){void 0===s&&(s=null);for(var h=0,a=e.length,o=i.frame;h<n;){var l=t[2*(r+h)],u=t[2*(r+h)+1];if(s){var p=s.a*l+s.c*u+s.tx;u=s.b*l+s.d*u+s.ty,l=p}h++,e.push(l/o.width,u/o.height)}var c=i.baseTexture;(o.width<c.width||o.height<c.height)&&this.adjustUvs(e,i,a,n)},n.prototype.adjustUvs=function(t,e,i,r){for(var n=e.baseTexture,s=i+2*r,h=e.frame,a=h.width/n.width,o=h.height/n.height,l=h.x/h.width,u=h.y/h.height,p=Math.floor(t[i]+1e-6),c=Math.floor(t[i+1]+1e-6),f=i+2;f<s;f+=2)p=Math.min(p,Math.floor(t[f]+1e-6)),c=Math.min(c,Math.floor(t[f+1]+1e-6));l-=p,u-=c;for(f=i;f<s;f+=2)t[f]=(t[f]+l)*a,t[f+1]=(t[f+1]+u)*o},n.BATCHABLE_SIZE=100,n}(n),$=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=T.BUTT,e.join=S.MITER,e.miterLimit=10,e}return I(e,t),e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(A),tt=new Float32Array(3),et={},it=function(e){function i(t){void 0===t&&(t=null);var i=e.call(this)||this;return i._geometry=t||new K,i._geometry.refCount++,i.shader=null,i.state=a.for2d(),i._fillStyle=new A,i._lineStyle=new $,i._matrix=null,i._holeMode=!1,i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i.pluginName="batch",i._transformID=-1,i.tint=16777215,i.blendMode=_.NORMAL,i}return I(i,e),Object.defineProperty(i.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),i.prototype.clone=function(){return this.finishPoly(),new i(this._geometry)},Object.defineProperty(i.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),i.prototype.lineStyle=function(t){if(void 0===t&&(t=null),"number"==typeof t){var e=arguments;t={width:e[0]||0,color:e[1]||0,alpha:void 0!==e[2]?e[2]:1,alignment:void 0!==e[3]?e[3]:.5,native:!!e[4]}}return this.lineTextureStyle(t)},i.prototype.lineTextureStyle=function(e){if("number"==typeof e){var i=arguments,r=i[0],n=i[1],s=i[2],h=i[3],a=i[4],o=i[5],l=i[6];e={width:r,texture:n,color:s,alpha:h,matrix:a,alignment:o,native:l},Object.keys(e).forEach(function(t){return void 0===e[t]&&delete e[t]})}e=Object.assign({width:0,texture:t.WHITE,color:e&&e.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:T.BUTT,join:S.MITER,miterLimit:10},e),this.currentPath&&this.startPoly();var u=e.width>0&&e.alpha>0;return u?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:u},e)):this._lineStyle.reset(),this},i.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 u,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new u,this.currentPath.closeStroke=!1},i.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},i.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},i.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},i.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)},i.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),Y.curveTo(t,e,i,r,n),this},i.prototype.bezierCurveTo=function(t,e,i,r,n,s){return this._initCurve(),H.curveTo(t,e,i,r,n,s,this.currentPath.points),this},i.prototype.arcTo=function(t,e,i,r,n){this._initCurve(t,e);var s=this.currentPath.points,h=q.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},i.prototype.arc=function(t,e,i,r,n,s){if(void 0===s&&(s=!1),r===n)return this;if(!s&&n<=r?n+=p:s&&r<=n&&(r+=p),0===n-r)return this;var h=t+Math.cos(r)*i,a=e+Math.sin(r)*i,o=this._geometry.closePointEps,l=this.currentPath?this.currentPath.points:null;if(l){var u=Math.abs(l[l.length-2]-h),c=Math.abs(l[l.length-1]-a);u<o&&c<o||l.push(h,a)}else this.moveTo(h,a),l=this.currentPath.points;return q.arc(h,a,t,e,i,r,n,s,l),this},i.prototype.beginFill=function(e,i){return void 0===e&&(e=0),void 0===i&&(i=1),this.beginTextureFill({texture:t.WHITE,color:e,alpha:i})},i.prototype.beginTextureFill=function(e){if(e instanceof t){var i=arguments,r=i[0],n=i[1],s=i[2],h=i[3];e={texture:r,color:n,alpha:s,matrix:h},Object.keys(e).forEach(function(t){return void 0===e[t]&&delete e[t]})}e=Object.assign({texture:t.WHITE,color:16777215,alpha:1,matrix:null},e),this.currentPath&&this.startPoly();var a=e.alpha>0;return a?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:a},e)):this._fillStyle.reset(),this},i.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},i.prototype.drawRect=function(t,e,i,r){return this.drawShape(new f(t,e,i,r))},i.prototype.drawRoundedRect=function(t,e,i,r,n){return this.drawShape(new d(t,e,i,r,n))},i.prototype.drawCircle=function(t,e,i){return this.drawShape(new y(t,e,i))},i.prototype.drawEllipse=function(t,e,i,r){return this.drawShape(new v(t,e,i,r))},i.prototype.drawPolygon=function(){for(var t,e=arguments,i=[],r=0;r<arguments.length;r++)i[r]=e[r];var n=!0,s=i[0];s.points?(n=s.closeStroke,t=s.points):t=Array.isArray(i[0])?i[0]:i;var h=new u(t);return h.closeStroke=n,this.drawShape(h),this},i.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},i.prototype.drawStar=function(t,e,i,r,n,s){return void 0===s&&(s=0),this.drawPolygon(new k(t,e,i,r,n,s))},i.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},i.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return 1===t.length&&t[0].shape.type===o.RECT&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)},i.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},i.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var r=0;r<i;r++){var n=t.batches[r],s=n.style.color,h=new Float32Array(this.vertexData.buffer,4*n.attribStart*2,2*n.attribSize),a=new Float32Array(t.uvsFloat32.buffer,4*n.attribStart*2,2*n.attribSize),o={vertexData:h,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*n.start,n.size),uvs:a,_batchRGB:m(s),_tintRGB:s,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=o}},i.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},i.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,n=this.worldAlpha,s=e.uniforms,h=i.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(r>>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<o;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},i.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,n=e.size,s=e.start,h=i.count,a=0;a<h;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,n,s)},i.prototype._resolveDirectShader=function(t){var e=this.shader,i=this.pluginName;if(!e){if(!et[i]){for(var r=t.plugins.batch.MAX_TEXTURES,n=new Int32Array(r),a=0;a<r;a++)n[a]=a;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new c,default:s.from({uSamplers:n},!0)},l=t.plugins[i]._shader.program;et[i]=new h(l,o)}e=et[i]}return e},i.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,n=e.maxX,s=e.maxY;this._bounds.addFrame(this.transform,i,r,n,s)}},i.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,i._TEMP_POINT),this._geometry.containsPoint(i._TEMP_POINT)},i.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=m(this.tint,tt),e=0;e<this.batches.length;e++){var i=this.batches[e],r=i._batchRGB,n=(t[0]*r[0]*255<<16)+(t[1]*r[1]*255<<8)+(0|t[2]*r[2]*255);i._tintRGB=(n>>16)+(65280&n)+((255&n)<<16)}}},i.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<o.length;p+=2){var c=o[p],f=o[p+1];l[u++]=i*c+n*f+h,l[u++]=s*f+r*c+a}}},i.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0),this},i.prototype.setMatrix=function(t){return this._matrix=t,this},i.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},i.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},i.prototype.destroy=function(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,e.prototype.destroy.call(this,t)},i._TEMP_POINT=new l,i}(P),rt={buildPoly:E,buildCircle:R,buildRectangle:B,buildRoundedRectangle:U,buildLine:N,Star:k,ArcUtils:q,BezierUtils:H,QuadraticUtils:Y,BatchPart:G,FILL_COMMANDS:V,BATCH_POOL:W,DRAW_CALL_POOL:Q};export{A as FillStyle,D as GRAPHICS_CURVES,it as Graphics,X as GraphicsData,K as GraphicsGeometry,T as LINE_CAP,S as LINE_JOIN,$ as LineStyle,rt as graphicsUtils}; | ||
import{Texture as t,BaseTexture as e,BatchDrawCall as i,BatchTextureArray as r,BatchGeometry as n,UniformGroup as s,Shader as h,State as a}from"@pixi/core";import{SHAPES as o,Point as l,Polygon as u,PI_2 as p,Matrix as c,Rectangle as f,RoundedRectangle as d,Circle as y,Ellipse as v}from"@pixi/math";import{earcut as g,premultiplyTint as b,hex2rgb as m}from"@pixi/utils";import{WRAP_MODES as x,DRAW_MODES as _,BLEND_MODES as w}from"@pixi/constants";import{Bounds as M,Container as P}from"@pixi/display";var S,T;!function(t){t.MITER="miter",t.BEVEL="bevel",t.ROUND="round"}(S||(S={})),function(t){t.BUTT="butt",t.ROUND="round",t.SQUARE="square"}(T||(T={}));var D={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 i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},A=function(){function e(){this.color=16777215,this.alpha=1,this.texture=t.WHITE,this.matrix=null,this.visible=!1,this.reset()}return e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t},e.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=t.WHITE,this.matrix=null,this.visible=!1},e.prototype.destroy=function(){this.texture=null,this.matrix=null},e}(),C=function(t,e){return(C=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])})(t,e)};function I(t,e){function i(){this.constructor=t}C(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var E={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,r=t.holes,n=e.points,s=e.indices;if(i.length>=6){for(var h=[],a=0;a<r.length;a++){var o=r[a];h.push(i.length/2),i=i.concat(o.points)}var l=g(i,h,2);if(!l)return;var u=n.length/2;for(a=0;a<l.length;a+=3)s.push(l[a]+u),s.push(l[a+1]+u),s.push(l[a+2]+u);for(a=0;a<i.length;a++)n.push(i[a])}}},R={build:function(t){var e,i,r=t.shape,n=t.points,s=r.x,h=r.y;if(n.length=0,t.type===o.CIRC)e=r.radius,i=r.radius;else{var a=t.shape;e=a.width,i=a.height}if(0!==e&&0!==i){var l=Math.floor(30*Math.sqrt(r.radius))||Math.floor(15*Math.sqrt(e+i));l/=2.3;for(var u=2*Math.PI/l,p=0;p<l-.5;p++)n.push(s+Math.sin(-u*p)*e,h+Math.cos(-u*p)*i);n.push(n[0],n[1])}},triangulate:function(t,e){var i=t.points,r=e.points,n=e.indices,s=r.length/2,h=s,a=t.shape,o=t.matrix,l=a.x,u=a.y;r.push(t.matrix?o.a*l+o.c*u+o.tx:l,t.matrix?o.b*l+o.d*u+o.ty:u);for(var p=0;p<i.length;p+=2)r.push(i[p],i[p+1]),n.push(s++,h,s)}},B={build:function(t){var e=t.shape,i=e.x,r=e.y,n=e.width,s=e.height,h=t.points;h.length=0,h.push(i,r,i+n,r,i+n,r+s,i,r+s)},triangulate:function(t,e){var i=t.points,r=e.points,n=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function L(t,e,i){return t+(e-t)*i}function O(t,e,i,r,n,s,h){void 0===h&&(h=[]);for(var a=h,o=0,l=0,u=0,p=0,c=0,f=0,d=0,y=0;d<=20;++d)o=L(t,i,y=d/20),l=L(e,r,y),u=L(i,n,y),p=L(r,s,y),c=L(o,u,y),f=L(l,p,y),a.push(c,f);return a}var U={build:function(t){var e=t.shape,i=t.points,r=e.x,n=e.y,s=e.width,h=e.height,a=Math.max(0,Math.min(e.radius,Math.min(s,h)/2));i.length=0,a?(O(r,n+a,r,n,r+a,n,i),O(r+s-a,n,r+s,n,r+s,n+a,i),O(r+s,n+h-a,r+s,n+h,r+s-a,n+h,i),O(r+a,n+h,r,n+h,r,n+h-a,i)):i.push(r,n,r+s,n,r+s,n+h,r,n+h)},triangulate:function(t,e){for(var i=t.points,r=e.points,n=e.indices,s=r.length/2,h=g(i,null,2),a=0,o=h.length;a<o;a+=3)n.push(h[a]+s),n.push(h[a+1]+s),n.push(h[a+2]+s);for(a=0,o=i.length;a<o;a++)r.push(i[a],i[++a])}};function F(t,e,i,r,n,s,h,a){var o,l;h?(o=r,l=-i):(o=-r,l=i);var u=t-i*n+o,p=e-r*n+l,c=t+i*s+o,f=e+r*s+l;return a.push(u,p),a.push(c,f),2}function j(t,e,i,r,n,s,h,a){var o=i-t,l=r-e,u=Math.atan2(o,l),p=Math.atan2(n-t,s-e);a&&u<p?u+=2*Math.PI:!a&&u>p&&(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<v;b++,m+=g)h.push(t,e),h.push(t+Math.sin(m)*y,e+Math.cos(m)*y);h.push(t,e),h.push(n,s)}else{h.push(i,r),h.push(t,e);for(b=1,m=c;b<v;b++,m+=g)h.push(t+Math.sin(m)*y,e+Math.cos(m)*y),h.push(t,e);h.push(n,s),h.push(t,e)}return 2*v}function N(t,e){t.lineStyle.native?function(t,e){var i=0,r=t.shape,n=t.points||r.points,s=r.type!==o.POLY||r.closeStroke;if(0!==n.length){var h=e.points,a=e.indices,l=n.length/2,u=h.length/2,p=u;for(h.push(n[0],n[1]),i=1;i<l;i++)h.push(n[2*i],n[2*i+1]),a.push(p,p+1),p++;s&&a.push(p,u)}}(t,e):function(t,e){var i=t.shape,r=t.points||i.points.slice(),n=e.closePointEps;if(0!==r.length){var s=t.lineStyle,h=new l(r[0],r[1]),a=new l(r[r.length-2],r[r.length-1]),u=i.type!==o.POLY||i.closeStroke,p=Math.abs(h.x-a.x)<n&&Math.abs(h.y-a.y)<n;if(u){r=r.slice(),p&&(r.pop(),r.pop(),a.set(r[r.length-2],r[r.length-1]));var c=.5*(h.x+a.x),f=.5*(a.y+h.y);r.unshift(c,f),r.push(c,f)}var d=e.points,y=r.length/2,v=r.length,g=d.length/2,b=s.width/2,m=b*b,x=s.miterLimit*s.miterLimit,_=r[0],w=r[1],M=r[2],P=r[3],A=0,C=0,I=-(w-P),E=_-M,R=0,B=0,L=Math.sqrt(I*I+E*E);I/=L,E/=L,I*=b,E*=b;var O=s.alignment,U=2*(1-O),N=2*O;u||(s.cap===T.ROUND?v+=j(_-I*(U-N)*.5,w-E*(U-N)*.5,_-I*U,w-E*U,_+I*N,w+E*N,d,!0)+2:s.cap===T.SQUARE&&(v+=F(_,w,I,E,U,N,!0,d))),d.push(_-I*U,w-E*U),d.push(_+I*N,w+E*N);for(var z=1;z<y-1;++z){_=r[2*(z-1)],w=r[2*(z-1)+1],M=r[2*z],P=r[2*z+1],A=r[2*(z+1)],C=r[2*(z+1)+1],I=-(w-P),E=_-M,I/=L=Math.sqrt(I*I+E*E),E/=L,I*=b,E*=b,R=-(P-C),B=M-A,R/=L=Math.sqrt(R*R+B*B),B/=L,R*=b,B*=b;var q=M-_,k=w-P,H=M-A,Y=C-P,G=k*H-Y*q,V=G<0;if(Math.abs(G)<.1)d.push(M-I*U,P-E*U),d.push(M+I*N,P+E*N);else{var W=(-I+_)*(-E+P)-(-I+M)*(-E+w),Q=(-R+A)*(-B+P)-(-R+M)*(-B+C),X=(q*Q-H*W)/G,Z=(Y*W-k*Q)/G,J=(X-M)*(X-M)+(Z-P)*(Z-P),K=M+(X-M)*U,$=P+(Z-P)*U,tt=M-(X-M)*N,et=P-(Z-P)*N,it=V?U:N;J<=Math.min(q*q+k*k,H*H+Y*Y)+it*it*m?s.join===S.BEVEL||J/m>x?(V?(d.push(K,$),d.push(M+I*N,P+E*N),d.push(K,$),d.push(M+R*N,P+B*N)):(d.push(M-I*U,P-E*U),d.push(tt,et),d.push(M-R*U,P-B*U),d.push(tt,et)),v+=2):s.join===S.ROUND?V?(d.push(K,$),d.push(M+I*N,P+E*N),v+=j(M,P,M+I*N,P+E*N,M+R*N,P+B*N,d,!0)+4,d.push(K,$),d.push(M+R*N,P+B*N)):(d.push(M-I*U,P-E*U),d.push(tt,et),v+=j(M,P,M-I*U,P-E*U,M-R*U,P-B*U,d,!1)+4,d.push(M-R*U,P-B*U),d.push(tt,et)):(d.push(K,$),d.push(tt,et)):(d.push(M-I*U,P-E*U),d.push(M+I*N,P+E*N),s.join===S.BEVEL||J/m>x||(s.join===S.ROUND?v+=V?j(M,P,M+I*N,P+E*N,M+R*N,P+B*N,d,!0)+2:j(M,P,M-I*U,P-E*U,M-R*U,P-B*U,d,!1)+2:(V?(d.push(tt,et),d.push(tt,et)):(d.push(K,$),d.push(K,$)),v+=2)),d.push(M-R*U,P-B*U),d.push(M+R*N,P+B*N),v+=2)}}_=r[2*(y-2)],w=r[2*(y-2)+1],M=r[2*(y-1)],I=-(w-(P=r[2*(y-1)+1])),E=_-M,I/=L=Math.sqrt(I*I+E*E),E/=L,I*=b,E*=b,d.push(M-I*U,P-E*U),d.push(M+I*N,P+E*N),u||(s.cap===T.ROUND?v+=j(M-I*(U-N)*.5,P-E*(U-N)*.5,M-I*U,P-E*U,M+I*N,P+E*N,d,!1)+2:s.cap===T.SQUARE&&(v+=F(M,P,I,E,U,N,!1,d)));var rt=e.indices,nt=D.epsilon*D.epsilon;for(z=g;z<v+g-2;++z)_=d[2*z],w=d[2*z+1],M=d[2*(z+1)],P=d[2*(z+1)+1],A=d[2*(z+2)],C=d[2*(z+2)+1],Math.abs(_*(P-C)+M*(C-w)+A*(w-P))<nt||rt.push(z,z+1,z+2)}}(t,e)}var z,q=function(t){function e(e,i,r,n,s,h){void 0===h&&(h=0);s=s||n/2;for(var a=-1*Math.PI/2+h,o=2*r,l=p/o,u=[],c=0;c<o;c++){var f=c%2?s:n,d=c*l+a;u.push(e+f*Math.cos(d),i+f*Math.sin(d))}return t.call(this,u)||this}return I(e,t),e}(u),k=function(){function t(){}return t.curveTo=function(t,e,i,r,n,s){var h=s[s.length-2],a=s[s.length-1]-e,o=h-t,l=r-e,u=i-t,p=Math.abs(a*u-o*l);if(p<1e-8||0===n)return s[s.length-2]===t&&s[s.length-1]===e||s.push(t,e),null;var c=a*a+o*o,f=l*l+u*u,d=a*l+o*u,y=n*Math.sqrt(c)/p,v=n*Math.sqrt(f)/p,g=y*d/c,b=v*d/f,m=y*u+v*o,x=y*l+v*a,_=o*(v+g),w=a*(v+g),M=u*(y+b),P=l*(y+b);return{cx:m+t,cy:x+e,radius:n,startAngle:Math.atan2(w-x,_-m),endAngle:Math.atan2(P-x,M-m),anticlockwise:o*l>u*a}},t.arc=function(t,e,i,r,n,s,h,a,o){for(var l=h-s,u=D._segmentsCount(Math.abs(l)*n,40*Math.ceil(Math.abs(l)/p)),c=l/(2*u),f=2*c,d=Math.cos(c),y=Math.sin(c),v=u-1,g=v%1/v,b=0;b<=v;++b){var m=c+s+f*(b+g*b),x=Math.cos(m),_=-Math.sin(m);o.push((d*x+y*_)*n+i,(d*-_+y*x)*n+r)}},t}(),H=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,x=e,_=1;_<=10;++_)g=m-(y=(d=(f=(c=1-(l=_/10))*c)*c)*t+3*f*l*i+3*c*(u=l*l)*n+(p=u*l)*h),b=x-(v=d*e+3*f*l*r+3*c*u*s+p*a),m=y,x=v,o+=Math.sqrt(g*g+b*b);return o},t.curveTo=function(e,i,r,n,s,h,a){var o=a[a.length-2],l=a[a.length-1];a.length-=2;var u=D._segmentsCount(t.curveLength(o,l,e,i,r,n,s,h)),p=0,c=0,f=0,d=0,y=0;a.push(o,l);for(var v=1,g=0;v<=u;++v)f=(c=(p=1-(g=v/u))*p)*p,y=(d=g*g)*g,a.push(f*o+3*c*g*e+3*p*d*r+y*s,f*l+3*c*g*i+3*p*d*n+y*h)},t}(),Y=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],o=D._segmentsCount(t.curveLength(h,a,e,i,r,n)),l=0,u=0,p=1;p<=o;++p){var c=p/o;l=h+(e-h)*c,u=a+(i-a)*c,s.push(l+(e+(r-e)*c-l)*c,u+(i+(n-i)*c-u)*c)}},t}(),G=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}(),V=((z={})[o.POLY]=E,z[o.CIRC]=R,z[o.ELIP]=R,z[o.RECT]=B,z[o.RREC]=U,z),W=[],Q=[],X=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type,this.points=[],this.holes=[]}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}(),Z=new l,J=new M,K=function(t){function n(){var e=t.call(this)||this;return e.uvsFloat32=null,e.indicesUint16=null,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.dirty=0,e.batchDirty=-1,e.cacheDirty=-1,e.clearDirty=0,e.drawCalls=[],e.batches=[],e.shapeIndex=0,e._bounds=new M,e.boundsDirty=-1,e.boundsPadding=0,e.batchable=!1,e.indicesUint16=null,e.uvsFloat32=null,e.closePointEps=1e-4,e}return I(n,t),Object.defineProperty(n.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),n.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;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Q.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),W.push(e)}this.batches.length=0},n.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},n.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 X(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},n.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new X(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},n.prototype.destroy=function(){t.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},n.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,Z):Z.copyFrom(t),r.shape.contains(Z.x,Z.y)))){var n=!1;if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(Z.x,Z.y)){n=!0;break}}if(!n)return!0}}return!1},n.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,n=null;this.batches.length>0&&(n=(r=this.batches[this.batches.length-1]).style);for(var s=this.shapeIndex;s<i.length;s++){this.shapeIndex++;var h=i[s],a=h.fillStyle,o=h.lineStyle;V[h.type].build(h),h.matrix&&this.transformPoints(h.points,h.matrix);for(var l=0;l<2;l++){var u=0===l?a:o;if(u.visible){var p=u.texture.baseTexture,c=this.indices.length,f=this.points.length/2;p.wrapMode=x.REPEAT,0===l?this.processFill(h):this.processLine(h);var d=this.points.length/2-f;0!==d&&(r&&!this._compareStyles(n,u)&&(r.end(c,f),r=null),r||((r=W.pop()||new G).begin(u,c,f),this.batches.push(r),n=u),this.addUvs(this.points,e,u.texture,f,d,u.matrix))}}}var y=this.indices.length,v=this.points.length/2;if(r&&r.end(y,v),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var g=v>65535&&t;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},n.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))},n.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(n&&!n.texture.baseTexture.valid)return!1}return!0},n.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],n=0;n<r.size;n++){var s=r.start+n;this.indicesUint16[s]=this.indicesUint16[s]-r.attribStart}},n.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<2*n.BATCHABLE_SIZE},n.prototype.buildDrawCalls=function(){for(var t=++e._globalBatch,n=0;n<this.drawCalls.length;n++)this.drawCalls[n].texArray.clear(),Q.push(this.drawCalls[n]);this.drawCalls.length=0;var s=this.colors,h=this.textureIds,a=Q.pop();a||((a=new i).texArray=new r),a.texArray.count=0,a.start=0,a.size=0,a.type=_.TRIANGLES;var o=0,l=null,u=0,p=!1,c=_.TRIANGLES,f=0;this.drawCalls.push(a);for(n=0;n<this.batches.length;n++){var d=this.batches[n],y=d.style,v=y.texture.baseTexture;p!==!!y.native&&(c=(p=!!y.native)?_.LINES:_.TRIANGLES,l=null,o=8,t++),l!==v&&(l=v,v._batchEnabled!==t&&(8===o&&(t++,o=0,a.size>0&&((a=Q.pop())||((a=new i).texArray=new r),this.drawCalls.push(a)),a.start=f,a.size=0,a.texArray.count=0,a.type=c),v.touched=1,v._batchEnabled=t,v._batchLocation=o,v.wrapMode=10497,a.texArray.elements[a.texArray.count++]=v,o++)),a.size+=d.size,f+=d.size,u=v._batchLocation,this.addColors(s,y.color,y.alpha,d.attribSize),this.addTextureIds(h,u,d.attribSize)}e._globalBatch=t,this.packAttributes()},n.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<t.length/2;o++)s[a++]=t[2*o],s[a++]=t[2*o+1],s[a++]=e[2*o],s[a++]=e[2*o+1],h[a++]=i[o],s[a++]=r[o];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)},n.prototype.processFill=function(t){t.holes.length?(this.processHoles(t.holes),E.triangulate(t,this)):V[t.type].triangulate(t,this)},n.prototype.processLine=function(t){N(t,this);for(var e=0;e<t.holes.length;e++)N(t.holes[e],this)},n.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];V[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},n.prototype.calculateBounds=function(){var t=this._bounds,e=J,i=c.IDENTITY;this._bounds.clear(),e.clear();for(var r=0;r<this.graphicsData.length;r++){var n=this.graphicsData[r],s=n.shape,h=n.type,a=n.lineStyle,l=n.matrix||c.IDENTITY,u=0;if(a&&a.visible){var p=a.alignment;u=a.width,h===o.POLY?u*=.5+Math.abs(.5-p):u*=Math.max(0,p)}if(i!==l&&(e.isEmpty()||(t.addBoundsMatrix(e,i),e.clear()),i=l),h===o.RECT||h===o.RREC){var f=s;e.addFramePad(f.x,f.y,f.x+f.width,f.y+f.height,u,u)}else if(h===o.CIRC){var d=s;e.addFramePad(d.x,d.y,d.x,d.y,d.radius+u,d.radius+u)}else if(h===o.ELIP){var y=s;e.addFramePad(y.x,y.y,y.x,y.y,y.width+u,y.height+u)}else{var v=s;t.addVerticesMatrix(i,v.points,0,v.points.length,u,u)}}e.isEmpty()||t.addBoundsMatrix(e,i),t.pad(this.boundsPadding,this.boundsPadding)},n.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],n=t[2*i+1];t[2*i]=e.a*r+e.c*n+e.tx,t[2*i+1]=e.b*r+e.d*n+e.ty}},n.prototype.addColors=function(t,e,i,r){for(var n=b((e>>16)+(65280&e)+((255&e)<<16),i);r-- >0;)t.push(n)},n.prototype.addTextureIds=function(t,e,i){for(;i-- >0;)t.push(e)},n.prototype.addUvs=function(t,e,i,r,n,s){void 0===s&&(s=null);for(var h=0,a=e.length,o=i.frame;h<n;){var l=t[2*(r+h)],u=t[2*(r+h)+1];if(s){var p=s.a*l+s.c*u+s.tx;u=s.b*l+s.d*u+s.ty,l=p}h++,e.push(l/o.width,u/o.height)}var c=i.baseTexture;(o.width<c.width||o.height<c.height)&&this.adjustUvs(e,i,a,n)},n.prototype.adjustUvs=function(t,e,i,r){for(var n=e.baseTexture,s=i+2*r,h=e.frame,a=h.width/n.width,o=h.height/n.height,l=h.x/h.width,u=h.y/h.height,p=Math.floor(t[i]+1e-6),c=Math.floor(t[i+1]+1e-6),f=i+2;f<s;f+=2)p=Math.min(p,Math.floor(t[f]+1e-6)),c=Math.min(c,Math.floor(t[f+1]+1e-6));l-=p,u-=c;for(f=i;f<s;f+=2)t[f]=(t[f]+l)*a,t[f+1]=(t[f+1]+u)*o},n.BATCHABLE_SIZE=100,n}(n),$=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=T.BUTT,e.join=S.MITER,e.miterLimit=10,e}return I(e,t),e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(A),tt=new Float32Array(3),et={},it=function(e){function i(t){void 0===t&&(t=null);var i=e.call(this)||this;return i._geometry=t||new K,i._geometry.refCount++,i.shader=null,i.state=a.for2d(),i._fillStyle=new A,i._lineStyle=new $,i._matrix=null,i._holeMode=!1,i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i.pluginName="batch",i._transformID=-1,i.tint=16777215,i.blendMode=w.NORMAL,i}return I(i,e),Object.defineProperty(i.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),i.prototype.clone=function(){return this.finishPoly(),new i(this._geometry)},Object.defineProperty(i.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),i.prototype.lineStyle=function(t){if(void 0===t&&(t=null),"number"==typeof t){var e=arguments;t={width:e[0]||0,color:e[1]||0,alpha:void 0!==e[2]?e[2]:1,alignment:void 0!==e[3]?e[3]:.5,native:!!e[4]}}return this.lineTextureStyle(t)},i.prototype.lineTextureStyle=function(e){e=Object.assign({width:0,texture:t.WHITE,color:e&&e.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:T.BUTT,join:S.MITER,miterLimit:10},e),this.currentPath&&this.startPoly();var i=e.width>0&&e.alpha>0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:i},e)):this._lineStyle.reset(),this},i.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 u,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new u,this.currentPath.closeStroke=!1},i.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},i.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},i.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},i.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)},i.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),Y.curveTo(t,e,i,r,n),this},i.prototype.bezierCurveTo=function(t,e,i,r,n,s){return this._initCurve(),H.curveTo(t,e,i,r,n,s,this.currentPath.points),this},i.prototype.arcTo=function(t,e,i,r,n){this._initCurve(t,e);var s=this.currentPath.points,h=k.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},i.prototype.arc=function(t,e,i,r,n,s){if(void 0===s&&(s=!1),r===n)return this;if(!s&&n<=r?n+=p:s&&r<=n&&(r+=p),0===n-r)return this;var h=t+Math.cos(r)*i,a=e+Math.sin(r)*i,o=this._geometry.closePointEps,l=this.currentPath?this.currentPath.points:null;if(l){var u=Math.abs(l[l.length-2]-h),c=Math.abs(l[l.length-1]-a);u<o&&c<o||l.push(h,a)}else this.moveTo(h,a),l=this.currentPath.points;return k.arc(h,a,t,e,i,r,n,s,l),this},i.prototype.beginFill=function(e,i){return void 0===e&&(e=0),void 0===i&&(i=1),this.beginTextureFill({texture:t.WHITE,color:e,alpha:i})},i.prototype.beginTextureFill=function(e){e=Object.assign({texture:t.WHITE,color:16777215,alpha:1,matrix:null},e),this.currentPath&&this.startPoly();var i=e.alpha>0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:i},e)):this._fillStyle.reset(),this},i.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},i.prototype.drawRect=function(t,e,i,r){return this.drawShape(new f(t,e,i,r))},i.prototype.drawRoundedRect=function(t,e,i,r,n){return this.drawShape(new d(t,e,i,r,n))},i.prototype.drawCircle=function(t,e,i){return this.drawShape(new y(t,e,i))},i.prototype.drawEllipse=function(t,e,i,r){return this.drawShape(new v(t,e,i,r))},i.prototype.drawPolygon=function(){for(var t,e=arguments,i=[],r=0;r<arguments.length;r++)i[r]=e[r];var n=!0,s=i[0];s.points?(n=s.closeStroke,t=s.points):t=Array.isArray(i[0])?i[0]:i;var h=new u(t);return h.closeStroke=n,this.drawShape(h),this},i.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},i.prototype.drawStar=function(t,e,i,r,n,s){return void 0===s&&(s=0),this.drawPolygon(new q(t,e,i,r,n,s))},i.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},i.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return 1===t.length&&t[0].shape.type===o.RECT&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)},i.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},i.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var r=0;r<i;r++){var n=t.batches[r],s=n.style.color,h=new Float32Array(this.vertexData.buffer,4*n.attribStart*2,2*n.attribSize),a=new Float32Array(t.uvsFloat32.buffer,4*n.attribStart*2,2*n.attribSize),o={vertexData:h,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*n.start,n.size),uvs:a,_batchRGB:m(s),_tintRGB:s,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=o}},i.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},i.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,n=this.worldAlpha,s=e.uniforms,h=i.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(r>>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<o;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},i.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,n=e.size,s=e.start,h=i.count,a=0;a<h;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,n,s)},i.prototype._resolveDirectShader=function(t){var e=this.shader,i=this.pluginName;if(!e){if(!et[i]){for(var r=t.plugins.batch.MAX_TEXTURES,n=new Int32Array(r),a=0;a<r;a++)n[a]=a;var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new c,default:s.from({uSamplers:n},!0)},l=t.plugins[i]._shader.program;et[i]=new h(l,o)}e=et[i]}return e},i.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,n=e.maxX,s=e.maxY;this._bounds.addFrame(this.transform,i,r,n,s)}},i.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,i._TEMP_POINT),this._geometry.containsPoint(i._TEMP_POINT)},i.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=m(this.tint,tt),e=0;e<this.batches.length;e++){var i=this.batches[e],r=i._batchRGB,n=(t[0]*r[0]*255<<16)+(t[1]*r[1]*255<<8)+(0|t[2]*r[2]*255);i._tintRGB=(n>>16)+(65280&n)+((255&n)<<16)}}},i.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<o.length;p+=2){var c=o[p],f=o[p+1];l[u++]=i*c+n*f+h,l[u++]=s*f+r*c+a}}},i.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0),this},i.prototype.setMatrix=function(t){return this._matrix=t,this},i.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},i.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},i.prototype.destroy=function(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,e.prototype.destroy.call(this,t)},i._TEMP_POINT=new l,i}(P),rt={buildPoly:E,buildCircle:R,buildRectangle:B,buildRoundedRectangle:U,buildLine:N,Star:q,ArcUtils:k,BezierUtils:H,QuadraticUtils:Y,BatchPart:G,FILL_COMMANDS:V,BATCH_POOL:W,DRAW_CALL_POOL:Q};export{A as FillStyle,D as GRAPHICS_CURVES,it as Graphics,X as GraphicsData,K as GraphicsGeometry,T as LINE_CAP,S as LINE_JOIN,$ as LineStyle,rt as graphicsUtils}; | ||
//# sourceMappingURL=graphics.min.js.map |
@@ -175,3 +175,3 @@ /// <reference path="./global.d.ts" /> | ||
/** | ||
* The transform aplpied to the texture. | ||
* The transform applied to the texture. | ||
* | ||
@@ -320,3 +320,3 @@ * @member {PIXI.Matrix} | ||
* @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style | ||
* @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) | ||
* @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outer) | ||
* @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP | ||
@@ -333,3 +333,3 @@ * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls | ||
* @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style | ||
* @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) | ||
* @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outer) | ||
* @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP | ||
@@ -352,3 +352,3 @@ * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style | ||
* @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture | ||
* @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) | ||
* @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outer) | ||
* @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP | ||
@@ -602,3 +602,3 @@ * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style | ||
/** | ||
* Recalcuate the tint by applying tin to batches using Graphics tint. | ||
* Recalculate the tint by applying tint to batches using Graphics tint. | ||
* @protected | ||
@@ -609,3 +609,3 @@ */ | ||
* If there's a transform update or a change to the shape of the | ||
* geometry, recaculate the vertices. | ||
* geometry, recalculate the vertices. | ||
* @protected | ||
@@ -803,3 +803,3 @@ */ | ||
* | ||
* @param {boolean} [aloow32Indices] - Allow using 32-bit indices for preventings artefacts when more that 65535 vertices | ||
* @param {boolean} [allow32Indices] - Allow using 32-bit indices for preventing artifacts when more that 65535 vertices | ||
*/ | ||
@@ -806,0 +806,0 @@ updateBatches(allow32Indices?: boolean): void; |
{ | ||
"name": "@pixi/graphics", | ||
"version": "5.4.0-rc.3", | ||
"version": "6.0.0-rc", | ||
"main": "dist/cjs/graphics.js", | ||
@@ -28,10 +28,10 @@ "module": "dist/esm/graphics.js", | ||
"dependencies": { | ||
"@pixi/constants": "5.4.0-rc.3", | ||
"@pixi/core": "5.4.0-rc.3", | ||
"@pixi/display": "5.4.0-rc.3", | ||
"@pixi/math": "5.4.0-rc.3", | ||
"@pixi/sprite": "5.4.0-rc.3", | ||
"@pixi/utils": "5.4.0-rc.3" | ||
"@pixi/constants": "6.0.0-rc", | ||
"@pixi/core": "6.0.0-rc", | ||
"@pixi/display": "6.0.0-rc", | ||
"@pixi/math": "6.0.0-rc", | ||
"@pixi/sprite": "6.0.0-rc", | ||
"@pixi/utils": "6.0.0-rc" | ||
}, | ||
"gitHead": "0c48db94f0521d85cc226fc4b15f69c30d53c765" | ||
"gitHead": "15513755f4d9f2112df5cc261b44f2dc1f05e00c" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1752923
11306
+ Added@pixi/constants@6.0.0-rc(transitive)
+ Added@pixi/core@6.0.0-rc(transitive)
+ Added@pixi/display@6.0.0-rc(transitive)
+ Added@pixi/math@6.0.0-rc(transitive)
+ Added@pixi/runner@6.0.0-rc(transitive)
+ Added@pixi/settings@6.0.0-rc(transitive)
+ Added@pixi/sprite@6.0.0-rc(transitive)
+ Added@pixi/ticker@6.0.0-rc(transitive)
+ Added@pixi/utils@6.0.0-rc(transitive)
+ Added@types/node@12.20.55(transitive)
- Removed@pixi/constants@5.4.0-rc.3(transitive)
- Removed@pixi/core@5.4.0-rc.3(transitive)
- Removed@pixi/display@5.4.0-rc.3(transitive)
- Removed@pixi/math@5.4.0-rc.3(transitive)
- Removed@pixi/runner@5.4.0-rc.3(transitive)
- Removed@pixi/settings@5.4.0-rc.3(transitive)
- Removed@pixi/sprite@5.4.0-rc.3(transitive)
- Removed@pixi/ticker@5.4.0-rc.3(transitive)
- Removed@pixi/utils@5.4.0-rc.3(transitive)
- Removedcss-color-names@1.0.1(transitive)
Updated@pixi/constants@6.0.0-rc
Updated@pixi/core@6.0.0-rc
Updated@pixi/display@6.0.0-rc
Updated@pixi/math@6.0.0-rc
Updated@pixi/sprite@6.0.0-rc
Updated@pixi/utils@6.0.0-rc