UNPKG

phaser3-rex-plugins

Version:
2 lines (1 loc) 43.2 kB
var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var s={renderWebGL:function(e,s,i,a){s.updateData(),i.addToRenderList(s);var h=e.pipelines.set(s.pipeline),r=t(s,i,a),n=h.calcMatrix.copyFrom(r.calc),o=s._displayOriginX,l=s._displayOriginY,u=i.alpha*s.alpha;e.pipelines.preBatch(s);for(var d,p=s.geom,c=0,v=p.length;c<v;c++)(d=p[c]).visible&&d.webglRender(h,n,u,o,l);e.pipelines.postBatch(s)},renderCanvas:function(t,s,i,a){s.updateData(),i.addToRenderList(s);var h=t.currentContext;if(e(t,h,s,i,a)){for(var r,n=s._displayOriginX,o=s._displayOriginY,l=s.geom,u=0,d=l.length;u<d;u++)(r=l[u]).visible&&r.canvasRender(h,n,o);h.restore()}}},i=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t};const a=Phaser.GameObjects.Shape,h=Phaser.Utils.Array.Remove;class r extends a{constructor(t,e,s,i,a){void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=2),void 0===a&&(a=i),super(t,"rexShapes",[]),this._width=-1,this._height=-1,this.dirty=!0,this.isSizeChanged=!0,this.shapes={},this.setPosition(e,s),this.setSize(i,a),this.updateDisplayOrigin()}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setDirty(t){return void 0===t&&(t=!0),this.dirty=t,this}setSize(t,e){this.isSizeChanged=this.isSizeChanged||this._width!==t||this._height!==e,this.dirty=this.dirty||this.isSizeChanged,this._width=t,this._height=e,this.updateDisplayOrigin();var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=t,s.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}get fillColor(){return this._fillColor}set fillColor(t){this.setFillStyle(t,this._fillAlpha)}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this.setFillStyle(this._fillColor,t)}setFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.fillColor!==t||this.fillAlpha!==e,this._fillColor=t,this._fillAlpha=e,this}get lineWidth(){return this._lineWidth}set lineWidth(t){this.setStrokeStyle(t,this._strokeColor,this._strokeAlpha)}get strokeColor(){return this._strokeColor}set strokeColor(t){this.setStrokeStyle(this._lineWidth,t,this._strokeAlpha)}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this.setStrokeStyle(this._lineWidth,this._strokeColor,t)}setStrokeStyle(t,e,s){return void 0===s&&(s=1),this.dirty=this.dirty||this.lineWidth!==t||this.strokeColor!==e||this.strokeAlpha!==s,this._lineWidth=t,this._strokeColor=e,this._strokeAlpha=s,this}updateShapes(){}updateData(){if(!this.dirty)return this;this.updateShapes();for(var t=this.geom,e=0,s=t.length;e<s;e++){var i=t[e];i.dirty&&i.updateData()}return this.isSizeChanged=!1,this.dirty=!1,this}clear(){return this.geom.length=0,i(this.shapes),this.dirty=!0,this}getShape(t){return this.shapes[t]}getShapes(){return this.geom}addShape(t){this.geom.push(t);var e=t.name;return e&&(this.shapes[e]=t),this.dirty=!0,this}deleteShape(t){var e=this.getShape(t);return e&&(delete this.shapes[t],h(this.geom,e)),this}}Object.assign(r.prototype,s);var n={setEventEmitter(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(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const o=Phaser.Scene;var l=function(t){return t instanceof o};const u=Phaser.Game;var d=function(t){return t instanceof u};const p=Phaser.Utils.Objects.GetValue;class c{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(p(e,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this))}shutdown(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){var e;return this.parent=t,this.scene=null==(e=t)||"object"!=typeof e?null:l(e)?e:e.scene&&l(e.scene)?e.scene:e.parent&&e.parent.scene&&l(e.parent.scene)?e.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:d(t)?t:d(t.game)?t.game:l(t)?t.sys.game:l(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(c.prototype,n);const v=Phaser.Utils.Objects.GetValue;class g extends c{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(v(e,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=f[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const f={no:0,lazy:1,always:2},y=Phaser.Utils.Objects.GetValue;class m extends g{constructor(t,e){super(t,e);var s=this.scene?"update":"step";this.tickEventName=y(e,"tickEventName",s),this.isSceneTicker=!P(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var P=function(t){return"step"===t||"poststep"===t};const S=Phaser.Utils.Objects.GetValue,D=Phaser.Math.Clamp;class b{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=S(t,"state",k),this.timeScale=S(t,"timeScale",1),this.delay=S(t,"delay",0),this.repeat=S(t,"repeat",0),this.repeatCounter=S(t,"repeatCounter",0),this.repeatDelay=S(t,"repeatDelay",0),this.duration=S(t,"duration",0),this.nowTime=S(t,"nowTime",0),this.justRestart=S(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?_:T,this.repeatCounter=0,this}stop(){return this.state=k,this}update(t,e){this.state!==k&&this.state!==w&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter<this.repeat?(this.repeatCounter++,this.justRestart=!0,this.nowTime-=this.duration,this.repeatDelay>0&&(this.nowTime-=this.repeatDelay,this.state=M)):(this.nowTime=this.duration,this.state=w):this.nowTime>=0&&(this.state=_))}get t(){var t;switch(this.state){case k:case T:case M:t=0;break;case _:t=this.nowTime/this.duration;break;case w:t=1}return D(t,0,1)}set t(t){(t=D(t,-1,1))<0?(this.state=T,this.nowTime=-this.delay*t):(this.state=_,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===k}get isDelay(){return this.state===T}get isCountDown(){return this.state===_}get isRunning(){return this.state===T||this.state===_}get isDone(){return this.state===w}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const k=0,T=1,_=2,M=3,w=-1;class A extends m{constructor(t,e){super(t,e),this.timer=new b}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const E=Phaser.Utils.Objects.GetValue,R=Phaser.Utils.Objects.GetAdvancedValue,C=Phaser.Tweens.Builders.GetEaseFunction;class x extends A{resetFromJSON(t){return this.timer.resetFromJSON(E(t,"timer")),this.setEnable(E(t,"enable",!0)),this.setTarget(E(t,"target",this.parent)),this.setDelay(R(t,"delay",0)),this.setDuration(R(t,"duration",1e3)),this.setEase(E(t,"ease","Linear")),this.setRepeat(E(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=C(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var s=this.target,i=this.timer;return i.update(t,e),i.isDelay||this.updateTarget(s,i),this.emit("update",s,this),i.isDone&&this.complete(),this}updateTarget(t,e){}}const X=Phaser.Utils.Objects.GetValue,Y=Phaser.Math.Linear;class L extends x{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=X(t,"key","value");var s=e[this.propertyKey];return this.fromValue=X(t,"from",s),this.toValue=X(t,"to",s),this.setEase(X(t,"ease",this.ease)),this.setDuration(X(t,"duration",this.duration)),this.setRepeat(X(t,"repeat",0)),this.setDelay(X(t,"delay",0)),this.setRepeatDelay(X(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var s=e.t;s=this.easeFn(s),t[this.propertyKey]=Y(this.fromValue,this.toValue,s)}}var O={start:function(t){return this.easeValueTask||(this.easeValueTask=new L(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const V=Phaser.Utils.Objects.GetValue;class z extends r{constructor(t,e){super(t,V(e,"x",0),V(e,"y",0),V(e,"width",64),V(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),V(e,"start",!0)&&this.start()}resetFromConfig(t,e){var s;return void 0===e&&(e=!1),s=e?1e3:this.duration,this.setDuration(V(t,"duration",s)),s=e?"Linear":this.ease,this.setEase(V(t,"ease",s)),s=e?0:this.delay,this.setDelay(V(t,"delay",s)),s=e?0:this.repeatDelay,this.setRepeatDelay(V(t,"repeatDelay",s)),s=e?16777215:this.color,this.setColor(V(t,"color",s)),s=e?0:this.value,this.setValue(V(t,"value",s)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(z.prototype,O);var I={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,s){return null==t||null==e?this.isStroked=!1:(void 0===s&&(s=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=s),this}},j=function(t,e,s){for(var i=t,a=s,h=0,r=e.length;h<r;h++){var n=e[h];if(!i||"object"!=typeof i&&"function"!=typeof i||!(n in i))return F.found=!1,F;i=a=i[n]}return F.found=!0,F.value=a,F},F={},N={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var s=t;for(t in s)this.data[t]=s[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,s,i){var a=t&&("object"==typeof t||"function"==typeof t),h=i&&("object"==typeof i||"function"==typeof i);if(!a&&!h)return s;var r=String(e);if(a&&r in t)return t[r];if(h&&r in i)return i[r];if(-1===r.indexOf("."))return s;var n=r.split(".");if(a){var o=j(t,n,s);if(o.found)return o.value}if(h){var l=j(i,n,s);if(l.found)return l.value}return s}(this.data,t,e)},incData(t,e,s){return void 0===s&&(s=0),this.enableData(),this.setData(t,this.getData(t,s)+e),this},mulData(t,e,s){return void 0===s&&(s=0),this.enableData(),this.setData(t,this.getData(t,s)*e),this},clearData(){return this.data&&i(this.data),this}};class G{constructor(){this.name=void 0,this.dirty=!0,this.visible=!0,this.data=void 0,this.isFilled=!1,this.fillColor=void 0,this.fillAlpha=1,this.isStroked=!1,this.lineWidth=1,this.strokeColor=void 0,this.strokeAlpha=1}setName(t){return this.name=t,this}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}reset(){return this.setVisible().fillStyle().lineStyle(),this}webglRender(t,e,s,i,a){}canvasRender(t,e,s){}updateData(){this.dirty=!1}}Object.assign(G.prototype,I,N);var B=Phaser.Renderer.WebGL.Utils,W=Phaser.Renderer.WebGL.Utils;const H=1e-6,U=10,J=.5;var q=function(t,e){return function(t){if(!Array.isArray(t))return null;for(var e=[],s=0,i=t.length;s<i;s++){var a=Number(t[s]);isFinite(a)&&a>0&&e.push(a)}return e.length>0?e:null}(t)||function(t,e){var{segments:s=U,drawRatio:i=J}=t;if(s=Math.round(s),!isFinite(s)||s<=0)return null;if(!(e>H))return null;var a=e/s;if(!(a>H))return null;if((i=Math.max(0,Math.min(1,i)))>=.999999)return null;var h=a*i;h<=H&&(h=H);var r=a-h;return r<=H?null:[h,r]}(t,e)},K=function(t,e,s){if(t&&!(t.length<4)){var i=t.length-1;if(e||(i-=2),!(i<2))for(var a=t[0],h=t[1],r=2;r<i;r+=2){var n=t[r],o=t[r+1];s(a,h,n,o),a=n,h=o}}},Q=function(t,e,s){void 0===e&&(e={}),void 0===s&&(s={});var{closePath:i=!1,dashPattern:a,dashOffset:h=0}=e,r=function(t,e){var s=0;return K(t,e,(function(t,e,i,a){var h=i-t,r=a-e;s+=Math.sqrt(h*h+r*r)})),s}(t,i);if(null===(a=q(a,r)))return null;for(var n=[],o=[],l=0,u=0,d=a.length;u<d;u++)l+=a[u];if(l<=H)return s.strokePathData=t?t.slice():[],s.strokePathMask=void 0,s;for(var p=0,c=!0,v=a[p],g=function(){p=(p+1)%a.length,c=!c,v=a[p]},f=function(t,e){return isFinite(t)||(t=0),(t%=e)<0&&(t+=e),t}(h,l);f>H;)f<v-H?(v-=f,f=0):(f-=v,g());var y=function(t,e,s,i,a){if(0===n.length)n.push(t,e);else{var h=n[n.length-2],r=n[n.length-1];h===t&&r===e||n.push(t,e)}n.push(s,i),o.push(a?1:0)};return K(t,i,(function(t,e,s,i){var a=s-t,h=i-e,r=Math.sqrt(a*a+h*h);if(!(r<=H))for(var n=0;n<r-H;){var o=Math.min(v,r-n);if(o<=H)g();else{var l=n/r,u=(n+o)/r;y(t+a*l,e+h*l,t+a*u,e+h*u,c),n+=o,(v-=o)<=H&&g()}}})),!i&&n.length>=2&&n.push(n[n.length-2],n[n.length-1]),s.strokePathData=n,s.strokePathMask=o,s},Z={setDashPattern:function(t,e){return this.dashPattern=t,this.dashOffset=e||0,this.isDashed=!!t,this},clearDashPattern:function(){return this.setDashPattern(),this},setDashed:function(t){return void 0===t&&(t=!0),this.isDashed=t,this}},$={buildStrokePath:function(){if(this.isDashed){var t=Q(this.pathData,{closePath:this.closePath,dashPattern:this.dashPattern,dashOffset:this.dashOffset},this);t?(this.strokePathData=t.strokePathData,this.strokePathMask=t.strokePathMask):this.isDashed=!1}return this}};Object.assign($,Z);const tt=Phaser.Geom.Polygon.Earcut;class et extends G{constructor(){super(),this.pathData=[],this.isDashed=!1,this.strokePathData=void 0,this.strokePathMask=void 0,this.dashPattern=void 0,this.dashOffset=0,this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=tt(this.pathData),super.updateData(),this.buildStrokePath(),this}webglRender(t,e,s,i,a){this.isFilled&&function(t,e,s,i,a,h){for(var r=B.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*i),n=s.pathData,o=s.pathIndexes,l=0;l<o.length;l+=3){var u=2*o[l],d=2*o[l+1],p=2*o[l+2],c=n[u+0]-a,v=n[u+1]-h,g=n[d+0]-a,f=n[d+1]-h,y=n[p+0]-a,m=n[p+1]-h,P=e.getX(c,v),S=e.getY(c,v),D=e.getX(g,f),b=e.getY(g,f),k=e.getX(y,m),T=e.getY(y,m);t.batchTri(s,P,S,D,b,k,T,0,0,1,1,r,r,r,2)}}(t,e,this,s,i,a),this.isStroked&&function(t,e,s,i,a){var h=t.strokeTint,r=W.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*s);h.TL=r,h.TR=r,h.BL=r,h.BR=r;var n,o,l=e.isDashed&&!!e.strokePathData,u=l?e.strokePathData:e.pathData,d=u.length-1,p=e.lineWidth,c=p/2,v=u[0]-i,g=u[1]-a;if(e.closePath||(d-=2),l){var f=e.strokePathMask,y=0,m=0;for(P=2;P<d;P+=2)n=u[P]-i,o=u[P+1]-a,f[y]?(t.batchLine(v,g,n,o,c,c,p,m,!1),m++):m=0,v=n,g=o,y++}else for(var P=2;P<d;P+=2)n=u[P]-i,o=u[P+1]-a,t.batchLine(v,g,n,o,c,c,p,P-2,!!e.closePath&&P===d-1),v=n,g=o}(t,this,s,i,a)}canvasRender(t,e,s){this.isFilled&&function(t,e,s,i){var a=e.pathData;if(a&&!(a.length<4)){var h=a.length-1,r=a[0]-s,n=a[1]-i;t.beginPath(),t.moveTo(r,n),e.closePath||(h-=2);for(var o=2;o<h;o+=2){var l=a[o]-s,u=a[o+1]-i;t.lineTo(l,u)}e.closePath&&t.closePath(),function(t,e,s,i){var a=e.fillColor,h=i||e.fillAlpha,r=(16711680&a)>>>16,n=(65280&a)>>>8,o=255&a;t.fillStyle="rgba("+r+","+n+","+o+","+h+")"}(t,e),t.fill()}}(t,this,e,s),this.isStroked&&function(t,e,s,i){var a=e.isDashed&&!!e.strokePathData,h=a?e.strokePathData:e.pathData;if(h&&!(h.length<4)){var r=h.length-1,n=h[0]-s,o=h[1]-i;if(function(t,e,s,i){var a=e.strokeColor,h=i||e.strokeAlpha,r=(16711680&a)>>>16,n=(65280&a)>>>8,o=255&a;t.strokeStyle="rgba("+r+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth}(t,e),t.beginPath(),e.closePath||(r-=2),a){var l=e.strokePathMask,u=0;for(d=2;d<r;d+=2)p=h[d]-s,c=h[d+1]-i,l[u]&&(t.moveTo(n,o),t.lineTo(p,c)),n=p,o=c,u++}else{t.moveTo(n,o);for(var d=2;d<r;d+=2){var p=h[d]-s,c=h[d+1]-i;t.lineTo(p,c)}e.closePath&&t.closePath()}t.stroke()}}(t,this,e,s)}}Object.assign(et.prototype,$);var st=function(t,e,s){var i=s.length;if(i>=2){var a=s[i-2],h=s[i-1];if(t===a&&e===h)return s}return s.push(t,e),s};const it=Phaser.Math.DegToRad;var at=function(t,e,s,i,a,h,r,n,o){r&&h>a?h-=360:!r&&h<a&&(h+=360);var l=it(h-a)/n;a=it(a);for(var u=0;u<=n;u++){var d=a+l*u,p=t+s*Math.cos(d),c=e+i*Math.sin(d);st(p,c,o)}return o};const ht=Phaser.Math.Interpolation.QuadraticBezier,rt=Phaser.Math.Interpolation.CubicBezier,nt=Phaser.Math.Interpolation.CatmullRom;var ot=function(t){var e=t.length;if(e<2)return t;var s=t[e-2],i=t[e-1];return t.push(s),t.push(i),t},lt={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,s){s.length=0,null!=t&&s.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,s){return void 0===s&&(s=!1),s&&(t+=this.lastPointX,e+=this.lastPointY),st(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,s,i,a,h,r){return void 0===r&&(r=!1),at(t,e,s,i,a,h,r,this.iterations,this.pathData),this.lastPointX=this.pathData[this.pathData.length-2],this.lastPointY=this.pathData[this.pathData.length-1],this},arc(t,e,s,i,a,h){return this.ellipticalArc(t,e,s,s,i,a,h),this},quadraticBezierTo(t,e,s,i){return function(t,e,s,i,a,h){for(var r=h.length,n=h[r-2],o=h[r-1],l=1,u=a-1;l<=u;l++){var d=l/u;h.push(ht(d,n,t,s),ht(d,o,e,i))}}(t,e,s,i,this.iterations,this.pathData),this.lastPointX=s,this.lastPointY=i,this},cubicBezierTo(t,e,s,i,a,h){return function(t,e,s,i,a,h,r,n){for(var o=n.length,l=n[o-2],u=n[o-1],d=1,p=r-1;d<=p;d++){var c=d/p;n.push(rt(c,l,t,s,a),rt(c,u,e,i,h))}}(t,e,s,i,a,h,this.iterations,this.pathData),this.lastPointX=a,this.lastPointY=h,this},catmullRomTo(...t){return function(t,e,s){for(var i=s.length,a=[s[i-2]],h=[s[i-1]],r=0,n=t.length;r<n;r+=2)a.push(t[r]),h.push(t[r+1]);r=1;for(var o=e-1;r<=o;r++){var l=r/o;s.push(nt(a,l),nt(h,l))}}(t,this.iterations,this.pathData),this.lastPointX=t[t.length-2],this.lastPointY=t[t.length-1],this},close(){var t=this.pathData[0],e=this.pathData[1];return t===this.lastPointX&&e===this.lastPointY||this.lineTo(t,e),this.closePath=!0,this},end(){return ot(this.pathData),this}};const ut=Phaser.Math.RotateAround,dt=Phaser.Math.DegToRad;Phaser.Math.RotateAround;var pt={rotateAround(t,e,s){if(0===this.pathData.length)return this;!function(t,e,s,i){for(var a={x:0,y:0},h=0,r=i.length-1;h<r;h+=2)a.x=i[h],a.y=i[h+1],ut(a,t,e,s),i[h]=a.x,i[h+1]=a.y}(t,e,s=dt(s),this.pathData);var i=this.pathData.length;return this.lastPointX=this.pathData[i-2],this.lastPointY=this.pathData[i-1],this},scale(t,e,s,i){return 0===this.pathData.length||(function(t,e,s,i,a){for(var h=0,r=a.length-1;h<r;h+=2){var n=a[h]-t,o=a[h+1]-e;n*=s,o*=i,a[h]=n+t,a[h+1]=o+e}}(t,e,s,i,this.pathData),this.lastPointX=this.pathData[pathDataCnt-2],this.lastPointY=this.pathData[pathDataCnt-1]),this},offset(t,e){return function(t,e,s){for(var i=0,a=s.length-1;i<a;i+=2)s[i]+=t,s[i+1]+=e}(t,e,this.pathData),this}},ct={savePathData(){return this.pathDataSaved||(this.pathDataSave=[...this.pathData],this.pathData.length=0,this.pathDataSaved=!0),this},restorePathData(){return this.pathDataSaved?(function(t,e,s,i){void 0===s&&(s=0),void 0===i&&(i=e.length),t.length=i-s;for(var a=0,h=t.length;a<h;a++)t[a]=e[a+s]}(this.pathData,this.pathDataSave),this.pathDataSave=void 0,this.pathDataSaved=!1,this):this}};const vt=Phaser.Math.Distance.Between,gt=Phaser.Math.Wrap,ft=Phaser.Math.Linear;var yt=function(t,e,s,i,a){if(void 0===i&&(i=s,s=0),(s=St(s))!==(i=St(i))){var h=e[e.length-1],r=h*s,n=h*i;s<i?mt(t,e,r,n,a):(mt(t,e,r,h,a),mt(t,e,0,n,a)),ot(a)}},mt=function(t,e,s,i,a){for(var h=s>0,r=0,n=e.length;r<n;r++){var o=2*r,l=e[r];if(h){if(l<s)continue;if(l==s)h=!1;else{var u=1-(l-s)/(l-e[r-1]);a.push(Pt(t,o-2,o,u)),a.push(Pt(t,o-1,o+1,u)),h=!1}}if(!(l<=i)){u=1-(l-i)/(l-e[r-1]),a.push(Pt(t,o-2,o,u)),a.push(Pt(t,o-1,o+1,u));break}if(a.push(t[o]),a.push(t[o+1]),l===i)break}},Pt=function(t,e,s,i){var a=t[e],h=t[s];return ft(a,h,i)},St=function(t){return 0===t?0:t%1==0?1:gt(t,0,1)},Dt={updateAccumulationLengths(){if(null==this.accumulationLengths)this.accumulationLengths=[];else if(this.accumulationLengths.length===this.pathData.length/2)return this;for(var t,e,s,i,a=this.accumulationLengths,h=this.pathData,r=0,n=0,o=h.length;n<o;n+=2)s=h[n],i=h[n+1],r+=void 0===t?0:vt(t,e,s,i),a.push(r),t=s,e=i;return this.totalPathLength=r,this},setDisplayPathSegment(t,e){return this.pathDataSaved||(this.updateAccumulationLengths(),this.savePathData()),this.pathData.length=0,yt(this.pathDataSave,this.accumulationLengths,t,e,this.pathData),this},appendFromPathSegment(t,e,s){return void 0===e?this.pathData.push(...t.pathData):(t.updateAccumulationLengths(),yt(t.pathData,t.accumulationLengths,e,s,this.pathData)),this.firstPointX=this.pathData[0],this.firstPointY=this.pathData[1],this.lastPointX=this.pathData[this.pathData.length-2],this.lastPointY=this.pathData[this.pathData.length-1],this}},bt={draw(t,e,s){var i=this.toPoints();return e&&t.fillPoints(i,this.closePath,this.closePath),s&&t.strokePoints(i,this.closePath,this.closePath),this}};const kt=Phaser.Geom.Polygon;class Tt{constructor(t){void 0===t&&(t=[]),this.pathData=t,this.closePath=!1,this.setIterations(32),this.firstPointX=void 0,this.firstPointY=void 0,this.lastPointX=void 0,this.lastPointY=void 0,this.accumulationLengths=void 0}setIterations(t){return this.iterations=t,this}toPoints(){return function(t,e){void 0===e&&(e=[]);for(var s=0,i=t.length-1;s<i;s+=2)e.push({x:t[s],y:t[s+1]});return e}(this.pathData)}toPolygon(t){return function(t,e){return void 0===e&&(e=new kt),e.setTo(t),e}(this.pathData,t)}}Object.assign(Tt.prototype,lt,pt,ct,Dt,bt);class _t extends et{constructor(){super(),this.builder=new Tt(this.pathData)}get iterations(){return this.builder.iterations}set iterations(t){this.dirty=this.dirty||this.builder.iterations!==t,this.builder.setIterations(t)}setIterations(t){return this.iterations=t,this}get lastPointX(){return this.builder.lastPointX}get lastPointY(){return this.builder.lastPointY}start(){return this.builder.start(),this.dirty=!0,this}startAt(t,e){return this.builder.startAt(t,e),this.dirty=!0,this}lineTo(t,e,s){return this.builder.lineTo(t,e,s),this.dirty=!0,this}verticalLineTo(t,e){return this.builder.verticalLineTo(t,e),this.dirty=!0,this}horizontalLineTo(t,e){return this.builder.horizontalLineTo(t,e),this.dirty=!0,this}ellipticalArc(t,e,s,i,a,h,r){return this.builder.ellipticalArc(t,e,s,i,a,h,r),this.dirty=!0,this}arc(t,e,s,i,a,h){return this.builder.arc(t,e,s,i,a,h),this.dirty=!0,this}quadraticBezierTo(t,e,s,i){return this.builder.quadraticBezierTo(t,e,s,i),this.dirty=!0,this}cubicBezierTo(t,e,s,i,a,h){return this.builder.cubicBezierTo(t,e,s,i,a,h),this.dirty=!0,this}catmullRomTo(...t){return this.builder.catmullRomTo(...t),this.dirty=!0,this}close(){return this.builder.close(),this.closePath=this.builder.closePath,this.dirty=!0,this}end(){return this.builder.end(),this.dirty=!0,this}rotateAround(t,e,s){return this.builder.rotateAround(t,e,s),this.dirty=!0,this}scale(t,e,s,i){return this.builder.scale(t,e,s,i),this.dirty=!0,this}offset(t,e){return this.builder.offset(t,e),this.dirty=!0,this}toPolygon(t){return this.builder.toPolygon(t)}appendPathFrom(t,e,s){return this.builder.appendFromPathSegment(t.builder,e,s),this}copyPathFrom(t,e,s){return this.builder.clear().appendFromPathSegment(t.builder,e,s),this}setDisplayPathSegment(t,e){return this.builder.setDisplayPathSegment(t,e),this}}var Mt=function(t,e){return void 0===e&&(e=.5),t<=e?t/=e:t=1-(t-e)/(1-e),t};const wt=Phaser.Math.DegToRad,At=Phaser.Math.Linear,Et=Phaser.Math.Easing.Expo.In,Rt={right:0,down:1,left:2,up:3};var Ct=function(t,e,s,i,a,h,r,n,o,l,u){var d=Xt(e,0,i,a,h,r,n,o,l,u);t.startAt(d.x,d.y);var p=Xt(s,0,i,a,h,r,n,o,l,u);t.lineTo(p.x,p.y);var c=Xt(s,s,i,a,h,r,n,o,l,u);t.lineTo(c.x,c.y);var v=Xt(0,s,i,a,h,r,n,o,l,u);t.lineTo(v.x,v.y);var g=Xt(0,e,i,a,h,r,n,o,l,u);t.lineTo(g.x,g.y);var f=Xt(e,e,i,a,h,r,n,o,l,u);t.lineTo(f.x,f.y),t.close()},xt={},Xt=function(t,e,s,i,a,h,r,n,o,l){var u=t*s,d=e*i;return xt.x=r*u+n*d+a,xt.y=o*u+l*d+h,xt},Yt={setDirection(t){return"string"==typeof t&&(t=Rt[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new _t)},updateShapes(){var t,e,s,i,a,h;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var r=wt(315);s=Math.cos(r),i=Math.sin(r);var n=wt(45);a=Math.cos(n),h=Math.sin(n);break;case 3:t=this.centerX,e=this.centerY+this.radius,r=wt(135),s=Math.cos(r),i=Math.sin(r),n=wt(225),a=Math.cos(n),h=Math.sin(n);break;case 2:t=this.centerX+this.radius,e=this.centerY,r=wt(225),s=Math.cos(r),i=Math.sin(r),n=wt(315),a=Math.cos(n),h=Math.sin(n);break;default:t=this.centerX-this.radius,e=this.centerY,r=wt(45),s=Math.cos(r),i=Math.sin(r),n=wt(135),a=Math.cos(n),h=Math.sin(n)}for(var o=this.radius/7,l=this.getShapes(),u=0,d=l.length;u<d;u++){var p=l[u],c=(this.value+.1*(d-u))%1;c=Et(Mt(c));var v=At(.25,1,c);p.fillStyle(this.color,v);var g=3*u+1;Ct(p,g,g+2,o,o,t,e,s,i,a,h)}}};class Lt extends et{constructor(t,e,s,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=0),super(),this.setP0(t,e),this.setP1(s,i)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x0,this.y0),super.updateData(),this}}const Ot=Phaser.Math.Linear;var Vt={buildShapes(){for(var t=0;t<4;t++)this.addShape(new Lt);this.prevValue=void 0},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,a=e+s,h=2*s,r=this.getShapes(),n=r.length,o=2*s/n,l=.7*o;if(void 0===this.prevValue||this.prevValue>this.value)for(var u=0;u<n;u++){var d=r[u],p=void 0===this.prevValue?Math.random():d.getData("to");d.setData("from",p).setData("to",Math.random())}for(this.prevValue=this.value,u=0;u<n;u++){p=(d=r[u]).getData("from");var c=d.getData("to"),v=Ot(p,c,this.value)*h,g=i+o*(u+.5);d.lineStyle(l,this.color,1).setP0(g,a).setP1(g,a-v)}}};Phaser.Math.DegToRad;class zt extends et{constructor(t,e,s,i,a,h,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=0),void 0===a&&(a=0),void 0===h&&(h=360),void 0===r&&(r=!1),void 0===n&&(n=!1),super(),this.setCenterPosition(t,e),this.setRadius(s,i),this.setAngle(a,h,r),this.setPie(n),this.setIterations(32)}get x(){return this._x}set x(t){this.dirty=this.dirty||this._x!==t,this._x=t}get y(){return this._y}set y(t){this.dirty=this.dirty||this._y!==t,this._y=t}setCenterPosition(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this}get radiusX(){return this._radiusX}set radiusX(t){this.dirty=this.dirty||this._radiusX!==t,this._radiusX=t}get radiusY(){return this._radiusY}set radiusY(t){this.dirty=this.dirty||this._radiusY!==t,this._radiusY=t}setRadius(t,e){return void 0===e&&(e=t),this.radiusX=t,this.radiusY=e,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!==t,this._startAngle=t}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!==t,this._endAngle=t}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!==t,this._anticlockwise=t}setAngle(t,e,s){return void 0===s&&(s=!1),this.startAngle=t,this.endAngle=e,this.anticlockwise=s,this}get pie(){return this._pie}set pie(t){this.dirty=this.dirty||this._pie!==t,this._pie=t}setPie(t){return void 0===t&&(t=!0),this.pie=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){return this.pathData.length=0,this.pie&&this.pathData.push(this.x,this.y),at(this.x,this.y,this.radiusX,this.radiusY,this.startAngle,this.endAngle,this.anticlockwise,this.iterations,this.pathData),this.pie&&this.pathData.push(this.x,this.y),this.pathData.push(this.pathData[0],this.pathData[1]),super.updateData(),this}}class It extends zt{constructor(t,e,s){super(t,e,s,s,0,360)}}const jt=Phaser.Math.Linear;var Ft={buildShapes(){for(var t=0;t<3;t++)this.addShape(new It)},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=.1*s,a=Math.ceil(.25*i),h=1-Mt(this.value),r=jt(.3,.9,h)*s,n=this.getShapes(),o=0,l=n.length;o<l;o++){var u=n[o],d=(h=(this.value+o/l)%1,2*Math.PI*h);u.lineStyle(a,this.color).setRadius(i).setCenterPosition(t+Math.cos(d)*r,e+Math.sin(d)*r)}}};const Nt=Phaser.Math.Linear,Gt=Phaser.Math.Easing.Expo.In;var Bt={buildShapes(){for(var t=0;t<5;t++){var e=new Lt;this.addShape(e);var s=Mt(t/4)/2;e.setData("offset",s)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,a=2*s,h=this.getShapes(),r=h.length,n=2*s/r,o=.7*n,l=0;l<r;l++){var u=h[l],d=(this.value+u.getData("offset"))%1;d=Gt(Mt(d));var p=Nt(.4,1,d)*a,c=i+n*(l+.5);u.lineStyle(o,this.color,1).setP0(c,e-p/2).setP1(c,e+p/2)}}},Wt={buildShapes(){this.addShape((new _t).setName("border")),this.addShape((new _t).setName("fill"))},updateShapes(){var t=this.centerX,e=this.centerY,s=.7*this.radius,i=t-s,a=e-s,h=2*s;if(this.getShape("border").lineStyle(2,this.color,1).startAt(i,a).lineTo(h,0,!0).lineTo(0,h,!0).lineTo(-h,0,!0).lineTo(0,-h,!0).close(),this.value<.5){var r=h*(2*(.5-this.value));this.getShape("fill").fillStyle(this.color,1).startAt(i,a).lineTo(h,0,!0).lineTo(0,r,!0).lineTo(-h,0,!0).lineTo(0,-r,!0).close()}else{var n=2*(this.value-.5)*180;this.getShape("border").rotateAround(t,e,n),this.getShape("fill").fillStyle().lineStyle()}}};const Ht=Phaser.Math.RadToDeg,Ut=Phaser.Math.Angle.WrapDegrees,Jt=Phaser.Math.Angle.Wrap,qt=Phaser.Math.Angle.ShortestBetween,Kt=Phaser.Math.DegToRad,Qt=Phaser.Math.DegToRad(270);var Zt={buildShapes(){this.addShape((new It).setName("border")),this.addShape((new Lt).setName("minuteHand")),this.addShape((new Lt).setName("hourHand")),this.minuteHandAngle=0,this.hourHandAngle=0},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/25),a=s-i/2,h=.8*s,r=.5*s,n=this.minuteHandAngle;this.minuteHandAngle=2*Math.PI*this.value;var o=Ut(Ht(n)),l=Ut(Ht(this.minuteHandAngle)),u=qt(o,l);this.hourHandAngle=Jt(this.hourHandAngle+Kt(u)/12),this.getShape("border").lineStyle(i,this.color).setRadius(a).setCenterPosition(t,e);var d=this.minuteHandAngle+Qt;this.getShape("minuteHand").lineStyle(i,this.color).setP0(t,e).setP1(t+Math.cos(d)*h,e+Math.sin(d)*h),d=this.hourHandAngle+Qt,this.getShape("hourHand").lineStyle(i,this.color).setP0(t,e).setP1(t+Math.cos(d)*r,e+Math.sin(d)*r)}};const $t=Phaser.Math.Linear,te=Phaser.Math.Easing.Expo.In;var ee={buildShapes(){for(var t=0;t<4;t++){var e=new Lt;this.addShape(e)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,a=e-s,h=2*s/2,r=2*s/2,n=this.getShapes(),o=n.length,l=0;l<o;l++){var u=i+h*(l%2+.5),d=a+r*(Math.floor(l/2)+.5),p=n[l],c=(this.value+.1*(o-l))%1;c=te(Mt(c));var v=(o-l)/o,g=$t(.7,1,c)*r,f=$t(.7,1,c)*h;p.lineStyle(f,this.color,v).setP0(u-g/2,d).setP1(u+g/2,d)}}};const se=Phaser.Math.Linear;var ie={buildShapes(){for(var t=0;t<3;t++){var e=new It;this.addShape(e);var s=Mt(t/2)/2;e.setData("offset",s)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,a=this.getShapes(),h=a.length,r=2*s/h,n=r/2,o=0;o<h;o++){var l=a[o],u=(this.value+l.getData("offset"))%1;u=Mt(u);var d=se(.25,1,u),p=se(.5,1,u)*n;l.fillStyle(this.color,d).setRadius(p).setCenterPosition(i+r*(o+.5),e)}}};const ae=Phaser.Math.Linear,he=Phaser.Math.Easing.Expo.In;var re={buildShapes(){for(var t=0;t<3;t++){var e=new Lt;this.addShape(e)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,a=this.getShapes(),h=a.length,r=2*s/h,n=2*s,o=0;o<h;o++){var l=a[o],u=(this.value+.1*(h-o))%1;u=he(Mt(u));var d=(o+1)/h,p=ae(.7,1,u)*n,c=ae(.7,1,u)*r,v=i+r*(o+.5);l.lineStyle(c,this.color,d).setP0(v,e-p/2).setP1(v,e+p/2)}}};const ne=Phaser.Math.Linear;var oe={buildShapes(){for(var t=0;t<9;t++){var e=new It;this.addShape(e),e.setData("offset",Math.random())}this.isInitialize=!0},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=this.isInitialize||this.isSizeChanged,a=t-s,h=e-s,r=2*s/3,n=2*s/3,o=Math.min(r,n)/2*.8,l=this.getShapes(),u=0,d=l.length;u<d;u++){var p=a+r*(u%3+.5),c=h+n*(Math.floor(u/3)+.5),v=l[u],g=(this.value+v.getData("offset"))%1;g=Mt(g),v.fillStyle(this.color,ne(.25,1,g)),i&&v.setRadius(o).setCenterPosition(p,c)}this.isInitialize=!1}},le={buildShapes(){for(var t=0;t<2;t++)this.addShape(new _t)},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/25),a=s-i,h=.6*a,r=.7*a,n=1.2*a,o=this.getShapes(),l=0,u=o.length;l<u;l++){var d=o[l],p=(this.value+l/u)%1,c=Mt(p),v=t,g=e-15*p,f=a*p,y=h*p,m=r*p,P=n*p;d.lineStyle(i,this.color,c).startAt(v,g).cubicBezierTo(v,g-y,v-f,g-y,v-f,g).cubicBezierTo(v-f,g+y,v,g+m,v,g+P).cubicBezierTo(v,g+m,v+f,g+y,v+f,g).cubicBezierTo(v+f,g-y,v,g-y,v,g).close()}}};const ue=Phaser.Math.Linear;var de={buildShapes(){for(var t=0;t<12;t++)this.addShape(new Lt);this.isInitialize=!0},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.isInitialize||this.isSizeChanged,i=this.radius,a=i/2,h=Math.ceil(i/20),r=this.getShapes(),n=0,o=r.length;n<o;n++){var l=r[n],u=n/o,d=2*Math.PI*u,p=ue(.25,1,(1-this.value+u)%1);l.lineStyle(h,this.color,p),s&&l.setP0(t+Math.cos(d)*a,e+Math.sin(d)*a).setP1(t+Math.cos(d)*i,e+Math.sin(d)*i)}this.isInitialize=!1}},pe={buildShapes(){this.addShape((new It).setName("track")),this.addShape((new It).setName("thumb"))},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=.9*s,a=Math.ceil(i/25),h=.1*s,r=2*Math.PI*this.value;this.getShape("track").lineStyle(a,this.color,.7).setRadius(i).setCenterPosition(t,e),this.getShape("thumb").fillStyle(this.color).setRadius(h).setCenterPosition(t+Math.cos(r)*i,e+Math.sin(r)*i)}},ce={buildShapes(){this.addShape((new It).setName("track")),this.addShape((new zt).setName("arc"))},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/25),a=s-i/2;this.getShape("track").lineStyle(i,this.color,.5).setRadius(a).setCenterPosition(t,e);var h=360*this.value,r=h+60;this.getShape("arc").lineStyle(i,this.color,1).setRadius(a).setCenterPosition(t,e).setAngle(h,r)}};const ve=Phaser.Math.Linear;var ge={buildShapes(){for(var t=0;t<4;t++){var e=(new zt).setPie();this.addShape(e),e.setData("speed",ve(180,360,Math.random()))}this.prevValue=void 0},updateShapes(){var t,e=this.centerX,s=this.centerY,i=this.radius;void 0!==this.prevValue&&(t=this.value-this.prevValue,this.prevValue>this.value&&(t+=1));for(var a=this.getShapes(),h=0,r=a.length;h<r;h++){var n=a[h],o=(h+1)/r;if(void 0===this.prevValue){var l=90+(u=h/r*360);n.fillStyle(this.color,o).setRadius(i).setCenterPosition(e,s).setAngle(u,l).setData("angle",u)}else{var u=n.getData("angle")+n.getData("speed")*t;l=90+(u%=360),n.fillStyle(this.color,o).setRadius(i).setCenterPosition(e,s).setAngle(u,l).setData("angle",u)}}this.prevValue=this.value}},fe={buildShapes(){this.addShape(new It)},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=s*this.value,a=Math.ceil(s/25),h=Mt(this.value);this.getShapes()[0].lineStyle(a,this.color,h).setRadius(i).setCenterPosition(t,e)}};const ye=Phaser.Math.Linear,me=Phaser.Math.Easing.Expo.In;var Pe={buildShapes(){this.addShape((new It).setName("center")),this.addShape((new _t).setName("arc0")),this.addShape((new _t).setName("arc1")),this.isInitialize=!0},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=this.isInitialize||this.isSizeChanged,a=2*s/6,h=t-s+a,r=e+s-a,n=this.getShapes(),o=0,l=n.length;o<l;o++){var u=n[o],d=(this.value+.1*(l-o))%1;d=me(Mt(d));var p=ye(.25,1,d);switch(u.name){case"center":u.fillStyle(this.color,p),i&&u.setRadius(a).setCenterPosition(h,r);break;case"arc0":if(u.fillStyle(this.color,p),i){var c=2*a,v=3*a;u.startAt(h,r-c).lineTo(h,r-v).setIterations(8).arc(h,r,v,270,360).lineTo(h+c,r).setIterations(6).arc(h,r,c,360,270,!0).close()}break;case"arc1":u.fillStyle(this.color,p),i&&(c=4*a,v=5*a,u.startAt(h,r-c).lineTo(h,r-v).setIterations(8).arc(h,r,v,270,360).lineTo(h+c,r).setIterations(6).arc(h,r,c,360,270,!0).close())}}this.isInitialize=!1}},Se={buildShapes(){for(var t=0;t<2;t++)this.addShape(new It)},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/25),a=s-i,h=this.getShapes(),r=0,n=h.length;r<n;r++){var o=h[r],l=(this.value+r/n)%1,u=Mt(l);o.lineStyle(i,this.color,u).setRadius(l*a).setCenterPosition(t,e)}}},De={buildShapes(){this.addShape((new zt).setName("arc"))},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/10),a=s-i,h=720*this.value,r=h-180*Mt(this.value);this.getShape("arc").lineStyle(i,this.color,1).setRadius(a).setCenterPosition(t,e).setAngle(r+315,h+315)}};Phaser.Utils.Objects.GetValue;const be={leftArrow:Yt,rightArrow:Yt,upArrow:Yt,downArrow:Yt,audio:Vt,ball:Ft,bars:Bt,box:Wt,clock:Zt,cube:ee,dots:ie,facebook:re,grid:oe,hearts:le,ios:de,oribit:pe,oval:ce,pie:ge,puff:fe,radio:Pe,rings:Se,spinner:De},ke=[];for(var Te in be)ke.push(Te);const _e=Phaser.Utils.Array.GetRandom;var Me={setAnimationMode(t,e){be.hasOwnProperty(t)||(t=_e(ke)),this.animationMode=t;var s=be[t];switch(e&&this.resetFromConfig(e),t){case"leftArrow":s.setDirection.call(this,"left");break;case"rightArrow":s.setDirection.call(this,"right");break;case"upArrow":s.setDirection.call(this,"up");break;case"downArrow":s.setDirection.call(this,"down")}return this.clear(),s.buildShapes.call(this),this.updateShapes=s.updateShapes.bind(this),this.stop().start(),this},setRandomAnimationMode(t){var e=_e(ke);return this.setAnimationMode(e,t),this}};const we=Phaser.Utils.Objects.GetValue;class Ae extends z{constructor(t,e){super(t,e),this.type="rexSpinnerAIO",this.setAnimationMode(we(e,"animationMode"))}}return Object.assign(Ae.prototype,Me),Ae},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexaiospinner=e();