text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcircularprogresscanvas=e()}(void 0,function(){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function i(t,e,i){return e&&s(t.prototype,e),i&&s(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function y(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(s){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=a(s);if(n){var i=a(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return y(t)}(this,t)}}function u(){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var s=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}(t,e);if(s){var n=Object.getOwnPropertyDescriptor(s,e);return n.get?n.get.call(arguments.length<3?t:i):n.value}}).apply(this,arguments)}var c=Phaser.Renderer.WebGL.Utils,t={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var n=e.frame,r=n.width,a=n.height,o=c.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),u=h.setTexture2D(n.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,n.glTexture,r,a,e.x,e.y,r/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,r,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,s,!1,u),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}},l=Phaser.Display.Color,e={clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill:function(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},loadFromURL:function(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise:function(i){var s=this;return new Promise(function(t,e){s.loadFromURL(i,t)})},getDataURL:function(t,e){return this.canvas.toDataURL(t,e)},getPixel:function(t,e,i){void 0===i&&(i=new l);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel:function(t,e,i,s,n,r){if("number"!=typeof i){var a=i;i=a.red,s=a.green,n=a.blue,r=a.alpha}void 0===r&&(r=0!==i||0!==s||0!==n?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=n,o.data[3]=r,this.context.putImageData(o,t,e),this.dirty=!0,this}},d={updateTexture:function(t,e){t&&(e?t.call(e,this.canvas,this.context):t(this.canvas,this.context)),this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!1;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=this.width,i.hitArea.height=this.height),this},generateTexture:function(t,e,i,s,n){var r=this.canvas;return void 0===s?s=r.width:s*=this.resolution,void 0===n?n=r.height:n*=this.resolution,function(t,e,i,s,n,r,a){var o,h=t.sys.textures,u=t.renderer;void 0===s&&(s=0),void 0===n&&(n=0),void 0===r&&(r=e.width),void 0===a&&(a=e.height);var c=(o=h.exists(i)?h.get(i):h.createCanvas(i,r,a)).getSourceImage();c.width!==r&&(c.width=r),c.height!==a&&(c.height=a);var l=c.getContext("2d");l.clearRect(0,0,r,a),l.drawImage(e,s,n,r,a),u.gl&&o&&u.canvasToTexture(c,o.source[0].glTexture,!0,0)}(this.scene,r,t,e,i,s,n),this},loadTexture:function(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i&&(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.context.drawImage(i.source.image,i.cutX,i.cutY,i.cutWidth,i.cutHeight,0,0,this.canvas.width,this.canvas.height),this.dirty=!0),this}},f=Phaser.Display.Canvas.CanvasPool,p=Phaser.GameObjects.GameObject,m=function(){r(o,p);var a=h(o);function o(t,e,i,s,n){var r;return v(this,o),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===n&&(n=1),(r=a.call(this,t,"rexCanvas")).renderer=t.sys.game.renderer,r.resolution=1,r._width=s,r._height=n,s=Math.max(Math.ceil(s*r.resolution),1),n=Math.max(Math.ceil(n*r.resolution),1),r.canvas=f.create(y(r),s,n),r.context=r.canvas.getContext("2d"),r.dirty=!1,r.setPosition(e,i),r.setOrigin(.5,.5),r.initPipeline(),r._crop=r.resetCropObject(),r.texture=t.sys.textures.addCanvas(null,r.canvas,!0),r.frame=r.texture.get(),r.frame.source.resolution=r.resolution,r.renderer&&r.renderer.gl&&(r.renderer.deleteTexture(r.frame.source.glTexture),r.frame.source.glTexture=null),r.dirty=!0,t.sys.game.events.on("contextrestored",r.onContextRestored,y(r)),r}return i(o,[{key:"onContextRestored",value:function(){this.dirty=!0}},{key:"preDestroy",value:function(){this.scene.sys.game.events.off("contextrestored",this.onContextRestored,this),f.remove(this.canvas),this.texture.destroy(),this.canvas=null,this.context=null}},{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height)}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t)}},{key:"setSize",value:function(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}},{key:"displayWidth",get:function(){return this.scaleX*this._width},set:function(t){this.scaleX=t/this._width}},{key:"displayHeight",get:function(){return this.scaleY*this._height},set:function(t){this.scaleY=t/this._height}},{key:"setDisplaySize",value:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}},{key:"getCanvas",value:function(t){return t||(this.dirty=!0),this.canvas}},{key:"getContext",value:function(t){return t||(this.dirty=!0),this.context}},{key:"needRedraw",value:function(){return this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}}]),o}(),k=Phaser.GameObjects.Components;Phaser.Class.mixin(m,[k.Alpha,k.BlendMode,k.Crop,k.Depth,k.Flip,k.GetBounds,k.Mask,k.Origin,k.Pipeline,k.ScrollFactor,k.Tint,k.Transform,k.Visible,t,e,d]);function g(t,e,i){if(null==t)return t;switch(n(t)){case"string":return t;case"number":return"#".concat(_(Math.floor(t).toString(16),6,"0",1));case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?"rgba(".concat(t.r,",").concat(t.g,",").concat(t.b,",").concat(t.a,")"):"rgb(".concat(t.r,",").concat(t.g,",").concat(t.b,")"):t.hasOwnProperty("h")?t.hasOwnProperty("a")?"hsla(".concat(t.h,",").concat(t.s,",").concat(t.l,",").concat(t.a,")"):"hsl(".concat(t.h,",").concat(t.s,",").concat(t.l,")"):t;default:return t}}function x(t,e,i,s,n,r,a,o,h,u,c,l){void 0===u&&(u=0),void 0===c&&(c=2*Math.PI),void 0===l&&(l=!1),e.beginPath(),e.ellipse(i,s,n,r,0,u,c,l),null!=a&&(e.fillStyle=a,e.fill()),null!=o&&(e.strokeStyle=o,e.lineWidth=h,e.stroke())}function C(t){return t instanceof T}var _=Phaser.Utils.String.Pad,b={setEventEmitter:function(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter:function(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter:function(){return this._eventEmitter},on:function(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once:function(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off:function(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit:function(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener:function(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener:function(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners:function(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount:function(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners:function(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames:function(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},T=Phaser.Scene,w=Phaser.Utils.Objects.GetValue,S=function(){function s(t,e){var i;v(this,s),this.parent=t,this.scene=null==(i=t)||"object"!==n(i)?null:C(i)?i:i.scene&&C(i.scene)?i.scene:i.parent&&i.parent.scene&&C(i.parent.scene)?i.parent.scene:void 0,this.isShutdown=!1,this.setEventEmitter(w(e,"eventEmitter",!0)),this.parent&&this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this)}return i(s,[{key:"shutdown",value:function(){this.isShutdown||(this.parent&&this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.isShutdown=!0)}},{key:"destroy",value:function(t){this.shutdown(t)}},{key:"onSceneDestroy",value:function(){this.destroy(!0)}},{key:"onParentDestroy",value:function(t,e){this.destroy(e)}}]),s}();Object.assign(S.prototype,b);var E=Phaser.Utils.Objects.GetValue,P=function(){r(n,S);var s=h(n);function n(t,e){var i;return v(this,n),(i=s.call(this,t,e))._isRunning=!1,i.isPaused=!1,i.tickingState=!1,i.setTickingMode(E(e,"tickingMode",1)),i}return i(n,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking()}},{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),u(a(n.prototype),"shutdown",this).call(this,t))}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=R[t]),this.tickingMode=t}},{key:"startTicking",value:function(){this.tickingState=!0}},{key:"stopTicking",value:function(){this.tickingState=!1}},{key:"isRunning",get:function(){return this._isRunning},set:function(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}},{key:"start",value:function(){return this.isPaused=!1,this.isRunning=!0,this}},{key:"pause",value:function(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}},{key:"resume",value:function(){return this.isPaused&&(this.isRunning=!0),this}},{key:"stop",value:function(){return this.isPaused=!1,this.isRunning=!1,this}},{key:"complete",value:function(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}]),n}(),R={no:0,lazy:1,always:2},O=function(){r(e,P);var t=h(e);function e(){return v(this,e),t.apply(this,arguments)}return i(e,[{key:"startTicking",value:function(){u(a(e.prototype),"startTicking",this).call(this),this.scene.sys.events.on("update",this.update,this)}},{key:"stopTicking",value:function(){u(a(e.prototype),"stopTicking",this).call(this),this.scene&&this.scene.sys.events.off("update",this.update,this)}}]),e}(),F=Phaser.Utils.Objects.GetValue,j=Phaser.Math.Clamp,D=function(){function e(t){v(this,e),this.resetFromJSON(t)}return i(e,[{key:"resetFromJSON",value:function(t){this.state=F(t,"state",V),this.timeScale=F(t,"timeScale",1),this.delay=F(t,"delay",0),this.repeat=F(t,"repeat",0),this.repeatCounter=F(t,"repeatCounter",0),this.duration=F(t,"duration",0),this.nowTime=F(t,"nowTime",0),this.justRestart=F(t,"justRestart",!1)}},{key:"toJSON",value:function(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}},{key:"destroy",value:function(){}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"setDelay",value:function(t){return void 0===t&&(t=0),this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatInfinity",value:function(){return this.repeat=-1,this}},{key:"start",value:function(){return this.nowTime=0<this.delay?-this.delay:0,this.state=0<=this.nowTime?L:M,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=V,this}},{key:"update",value:function(t,e){this.state!==V&&this.state!==A&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.state=0<=this.nowTime?L:M,this.justRestart=!1,this.nowTime>=this.duration&&(-1===this.repeat||this.repeatCounter<this.repeat?(this.repeatCounter++,this.justRestart=!0,this.nowTime-=this.duration):(this.nowTime=this.duration,this.state=A)))}},{key:"t",get:function(){var t;switch(this.state){case V:case M:t=0;break;case L:t=this.nowTime/this.duration;break;case A:t=1}return j(t,0,1)},set:function(t){(t=j(t,-1,1))<0?(this.state=M,this.nowTime=-this.delay*t):(this.state=L,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===V}},{key:"isDelay",get:function(){return this.state===M}},{key:"isCountDown",get:function(){return this.state===L}},{key:"isRunning",get:function(){return this.state===M||this.state===L}},{key:"isDone",get:function(){return this.state===A}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),e}(),V=0,M=1,L=2,A=-1,G=function(){r(n,O);var s=h(n);function n(t,e){var i;return v(this,n),(i=s.call(this,t,e)).timer=new D,i}return i(n,[{key:"shutdown",value:function(t){this.isShutdown||(u(a(n.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0)}},{key:"start",value:function(){return this.timer.start(),u(a(n.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),u(a(n.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),u(a(n.prototype),"complete",this).call(this),this}}]),n}(),I=Phaser.Utils.Objects.GetValue,z=Phaser.Utils.Objects.GetAdvancedValue,U=Phaser.Tweens.Builders.GetEaseFunction,B=function(){r(e,G);var t=h(e);function e(){return v(this,e),t.apply(this,arguments)}return i(e,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(I(t,"timer")),this.setEnable(I(t,"enable",!0)),this.setTarget(I(t,"target",this.parent)),this.setDelay(z(t,"delay",0)),this.setDuration(z(t,"duration",1e3)),this.setEase(I(t,"ease","Linear")),this.setRepeat(I(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=U(t),this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"start",value:function(){return this.timer.isRunning||u(a(e.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),u(a(e.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateGameObject(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(){}}]),e}(),N=Phaser.Utils.Objects.GetValue,W=Phaser.Math.Linear,J=function(){r(n,B);var s=h(n);function n(t,e){var i;return v(this,n),(i=s.call(this,t,e)).resetFromJSON(),i.boot(),i}return i(n,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=N(t,"key","value");var i=e[this.propertyKey];return this.fromValue=N(t,"from",i),this.toValue=N(t,"to",i),this.setEase(N(t,"ease",this.ease)),this.setDuration(N(t,"duration",this.duration)),this.timer.setDuration(this.duration),e[this.propertyKey]=this.fromValue,u(a(n.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=W(this.fromValue,this.toValue,i)}}]),n}(),X=Phaser.Math.Percent,Y={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=X(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new J(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this}},H=Phaser.Utils.Objects.GetValue,K=Phaser.Utils.Objects.IsPlainObject,q=Phaser.Math.Clamp,Q=Phaser.Math.Linear,Z=Phaser.Math.Percent,$=Phaser.Math.DegToRad(270),tt=function(){r(f,m);var d=h(f);function f(t,e,i,s,n,r,a){var o;v(this,f),K(e)&&(e=H(a=e,"x",0),i=H(a,"y",0),s=H(a,"radius",1),n=H(a,"barColor",void 0),r=H(a,"value",0));var h=2*s;(o=d.call(this,t,e,i,h,h)).type="rexCircularProgressCanvas",o.eventEmitter=H(a,"eventEmitter",y(o)),o.setRadius(s),o.setTrackColor(H(a,"trackColor",void 0)),o.setBarColor(n),o.setCenterColor(H(a,"centerColor",void 0)),o.setThickness(H(a,"thickness",.2)),o.setStartAngle(H(a,"startAngle",$)),o.setAnticlockwise(H(a,"anticlockwise",!1)),o.setTextColor(H(a,"textColor",void 0)),o.setTextStrokeColor(H(a,"textStrokeColor",void 0),H(a,"textStrokeThickness",void 0));var u=H(a,"textFont",void 0);u?o.setTextFont(u):o.setTextFont(H(a,"textSize","16px"),H(a,"textFamily","Courier"),H(a,"textStyle","")),o.setTextFormatCallback(H(a,"textFormatCallback",void 0),H(a,"textFormatCallbackScope",void 0));var c=H(a,"valuechangeCallback",null);if(null!==c){var l=H(a,"valuechangeCallbackScope",void 0);o.eventEmitter.on("valuechange",c,l)}return o.setEaseValuePropName("value").setEaseValueDuration(H(a,"easeValue.duration",0)).setEaseValueFunction(H(a,"easeValue.ease","Linear")),o.setValue(r),o}return i(f,[{key:"resize",value:function(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(u(a(f.prototype),"resize",this).call(this,t,t),this.setRadius(t/2)),this}},{key:"value",get:function(){return this._value},set:function(t){t=q(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}},{key:"setValue",value:function(t,e,i){return null==t||(void 0!==e&&(t=Z(t,e,i)),this.value=t),this}},{key:"addValue",value:function(t,e,i){return void 0!==e&&(t=Z(t,e,i)),this.value+=t,this}},{key:"getValue",value:function(t,e){var i=this.value;return void 0!==t&&(i=Q(t,e,i)),i}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t;var e=2*(this._radius=t);this.resize(e,e)}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"trackColor",get:function(){return this._trackColor},set:function(t){t=g(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){t=g(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}},{key:"setStartAngle",value:function(t){return this.startAngle=t,this}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}},{key:"setAnticlockwise",value:function(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}},{key:"thickness",get:function(){return this._thickness},set:function(t){t=q(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}},{key:"setThickness",value:function(t){return this.thickness=t,this}},{key:"centerColor",get:function(){return this._centerColor},set:function(t){t=g(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}},{key:"centerColor2",get:function(){return this._centerColor2},set:function(t){t=g(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}},{key:"setCenterColor",value:function(t,e){return this.centerColor=t,this.centerColor2=e,this}},{key:"textColor",get:function(){return this._textColor},set:function(t){t=g(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}},{key:"setTextColor",value:function(t){return this.textColor=t,this}},{key:"textStrokeColor",get:function(){return this._textStrokeColor},set:function(t){t=g(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}},{key:"textStrokeThickness",get:function(){return this._textStrokeThickness},set:function(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}},{key:"setTextStrokeColor",value:function(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}},{key:"textFont",get:function(){return this._textFont},set:function(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}},{key:"setTextFont",value:function(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}},{key:"setTextFormatCallback",value:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}},{key:"updateTexture",value:function(){return this.clear(),function(){var t,e,i,s,n,r,a,o,h,u,c,l=this.radius,d=this.thickness*this.radius,f=this.radius-d/2,v=this.radius-d,y=(this.canvas,this.context);if(this.trackColor&&0<d&&(y.save(),x(0,y,l,l,f,f,void 0,this.trackColor,d),y.restore()),this.barColor&&0<f){var p,m,k;if(1===this.value)p=!1,m=0,k=2*Math.PI;else p=this.anticlockwise,m=this.startAngle,k=2*Math.PI*(p?1-this.value:this.value)+m;y.save(),x(0,y,l,l,f,f,void 0,this.barColor,d,m,k,p),y.restore()}this.centerColor&&0<v&&(this.centerColor2?((t=this.context.createRadialGradient(l,l,0,l,l,v)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,y.save(),x(0,y,l,l,v,v,t),y.restore());this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(y.save(),e=y,s=i=l,n=this.getFormatText(),r=this.textFont,a=this.textColor,o=this.textStrokeColor,void 0===(h=this.textStrokeThickness)&&null!=o&&(h=2),void 0===(u="center")&&(u="start"),void 0===(c="middle")&&(c="alphabetic"),e.font=r,e.textAlign=u,e.textBaseline=c,e.fillStyle=a,e.strokeStyle=o,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=o&&"none"!==o&&0<h&&e.strokeText(n,i,s),null!=a&&"none"!==a&&e.fillText(n,i,s),y.restore())}.call(this),u(a(f.prototype),"updateTexture",this).call(this),this}},{key:"getFormatText",value:function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}]),f}();return Object.assign(tt.prototype,Y),tt});
  