UNPKG

phaser3-rex-plugins

Version:
2 lines (1 loc) 43.4 kB
!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).rexcheckboxplugin=e();}(undefined,(function(){function t(e){return t="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(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(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,(n=s.key,r=void 0,"symbol"==typeof(r=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===e?String:Number)(t)}(n,"string"))?r:String(r)),s);}var n,r;}function s(t,e,s){return e&&i(t.prototype,e),s&&i(t,s),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(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&&h(t,e);}function r(t){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},r(t)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function o(t){var e=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 i,s=r(t);if(e){var n=r(this).constructor;i=Reflect.construct(s,arguments,n);}else i=s.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 a(t)}(this,i)}}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=r(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}},u.apply(this,arguments)}function l(t){return function(t){if(Array.isArray(t))return c(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return c(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return c(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=new Array(e);i<e;i++)s[i]=t[i];return s}var d=Phaser.GameObjects.GetCalcMatrix,f=Phaser.Renderer.Canvas.SetTransform,p={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var n=t.pipelines.set(e.pipeline),r=d(e,i,s),h=n.calcMatrix.copyFrom(r.calc),a=e._displayOriginX,o=e._displayOriginY,u=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var l=e.geom,c=0,f=l.length;c<f;c++)l[c].webglRender(n,h,u,a,o);t.pipelines.postBatch(e);},renderCanvas:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var n=t.currentContext;if(f(t,n,e,i,s)){for(var r=e._displayOriginX,h=e._displayOriginY,a=e.geom,o=0,u=a.length;o<u;o++)a[o].canvasRender(n,r,h);n.restore();}}},v=function(e){if("object"!==t(e)||null===e)return e;if(Array.isArray(e))e.length=0;else for(var i in e)delete e[i];return e},y=Phaser.GameObjects.Shape,k=Phaser.Utils.Array.Remove,g=function(t){n(r,t);var i=o(r);function r(t,s,n,h,a){var o;return e(this,r),void 0===s&&(s=0),void 0===n&&(n=0),void 0===h&&(h=2),void 0===a&&(a=h),(o=i.call(this,t,"rexShapes",[]))._width=-1,o._height=-1,o.dirty=!0,o.isSizeChanged=!0,o.shapes={},o.setPosition(s,n),o.setSize(h,a),o.updateDisplayOrigin(),o}return s(r,[{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:"setDirty",value:function(t){return void 0===t&&(t=!0),this.dirty=t,this}},{key:"setSize",value:function(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 i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"fillColor",get:function(){return this._fillColor},set:function(t){this.setFillStyle(t,this._fillAlpha);}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this.setFillStyle(this._fillColor,t);}},{key:"setFillStyle",value:function(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}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this.setStrokeStyle(t,this._strokeColor,this._strokeAlpha);}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this.setStrokeStyle(this._lineWidth,t,this._strokeAlpha);}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this.setStrokeStyle(this._lineWidth,this._strokeColor,t);}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.lineWidth!==t||this.strokeColor!==e||this.strokeAlpha!==i,this._lineWidth=t,this._strokeColor=e,this._strokeAlpha=i,this}},{key:"updateShapes",value:function(){}},{key:"updateData",value:function(){if(!this.dirty)return this;this.updateShapes();for(var t=this.geom,e=0,i=t.length;e<i;e++){var s=t[e];s.dirty&&s.updateData();}return this.isSizeChanged=!1,this.dirty=!1,this}},{key:"clear",value:function(){return this.geom.length=0,v(this.shapes),this}},{key:"getShape",value:function(t){return this.shapes[t]}},{key:"getShapes",value:function(){return this.geom}},{key:"addShape",value:function(t){this.geom.push(t);var e=t.name;return e&&(this.shapes[e]=t),this.dirty=!0,this}},{key:"deleteShape",value:function(t){var e=this.getShape(t);return e&&(delete this.shapes[t],k(this.geom,e)),this}}]),r}(y);Object.assign(g.prototype,p);var m={setBoxFillStyle:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle:function(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle:function(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape:function(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},b={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,i){return null==t||null==e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},S={enableData:function(){return void 0===this.data&&(this.data={}),this},setData:function(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t];}else this.data[t]=e;return this},getData:function(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){for(var s=e.split("."),n=t,r=i,h=0;h<s.length;h++){if(!n.hasOwnProperty(s[h])){r=i;break}r=n[s[h]],n=n[s[h]];}return r}return i}return i}(this.data,t,e)},incData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData:function(){return this.data&&v(this.data),this}},P=function(){function t(){e(this,t),this.name=void 0,this.dirty=!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;}return s(t,[{key:"setName",value:function(t){return this.name=t,this}},{key:"reset",value:function(){return this.fillStyle().lineStyle(),this}},{key:"webglRender",value:function(t,e,i,s,n){}},{key:"canvasRender",value:function(t,e,i){}},{key:"updateData",value:function(){this.dirty=!1;}}]),t}();Object.assign(P.prototype,b,S);var D=Phaser.Renderer.WebGL.Utils,_=Phaser.Renderer.WebGL.Utils,T=Phaser.Geom.Polygon.Earcut,C=function(t){n(h,t);var i=o(h);function h(){var t;return e(this,h),(t=i.call(this)).pathData=[],t.pathIndexes=[],t.closePath=!1,t}return s(h,[{key:"updateData",value:function(){return this.pathIndexes=T(this.pathData),u(r(h.prototype),"updateData",this).call(this),this}},{key:"webglRender",value:function(t,e,i,s,n){this.isFilled&&function(t,e,i,s,n,r){for(var h=D.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),a=i.pathData,o=i.pathIndexes,u=0;u<o.length;u+=3){var l=2*o[u],c=2*o[u+1],d=2*o[u+2],f=a[l+0]-n,p=a[l+1]-r,v=a[c+0]-n,y=a[c+1]-r,k=a[d+0]-n,g=a[d+1]-r,m=e.getX(f,p),b=e.getY(f,p),S=e.getX(v,y),P=e.getY(v,y),_=e.getX(k,g),T=e.getY(k,g);t.batchTri(i,m,b,S,P,_,T,0,0,1,1,h,h,h,2);}}(t,e,this,i,s,n),this.isStroked&&function(t,e,i,s,n){var r=t.strokeTint,h=_.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*i);r.TL=h,r.TR=h,r.BL=h,r.BR=h;var a=e.pathData,o=a.length-1,u=e.lineWidth,l=u/2,c=a[0]-s,d=a[1]-n;e.closePath||(o-=2);for(var f=2;f<o;f+=2){var p=a[f]-s,v=a[f+1]-n;t.batchLine(c,d,p,v,l,l,u,f-2,!!e.closePath&&f===o-1),c=p,d=v;}}(t,this,i,s,n);}},{key:"canvasRender",value:function(t,e,i){var s=this.pathData,n=s.length-1,r=s[0]-e,h=s[1]-i;t.beginPath(),t.moveTo(r,h),this.closePath||(n-=2);for(var a=2;a<n;a+=2){var o=s[a]-e,u=s[a+1]-i;t.lineTo(o,u);}this.closePath&&t.closePath(),this.isFilled&&(!function(t,e,i,s){var n=i||e.fillColor,r=s||e.fillAlpha,h=(16711680&n)>>>16,a=(65280&n)>>>8,o=255&n;t.fillStyle="rgba("+h+","+a+","+o+","+r+")";}(t,this),t.fill()),this.isStroked&&(!function(t,e,i,s){var n=i||e.strokeColor,r=s||e.strokeAlpha,h=(16711680&n)>>>16,a=(65280&n)>>>8,o=255&n;t.strokeStyle="rgba("+h+","+a+","+o+","+r+")",t.lineWidth=e.lineWidth;}(t,this),t.stroke());}}]),h}(P),x=function(t,e,i){var s=i.length;if(s>=2){var n=i[s-2],r=i[s-1];if(t===n&&e===r)return i}return i.push(t,e),i},w=Phaser.Math.DegToRad,A=function(t,e,i,s,n,r,h,a,o){h&&r>n?r-=360:!h&&r<n&&(r+=360);var u=w(r-n)/a;n=w(n);for(var l=0;l<=a;l++){var c=n+u*l,d=t+i*Math.cos(c),f=e+s*Math.sin(c);x(d,f,o);}return o};Phaser.Math.DegToRad;var R=Phaser.Math.Interpolation.QuadraticBezier,E=Phaser.Math.Interpolation.CubicBezier,O=function(t){var e=t.length;if(e<2)return t;var i=t[e-2],s=t[e-1];return t.push(i),t.push(s),t},B={clear:function(){return this.start(),this},start:function(){return this.startAt(),this},startAt:function(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,i){i.length=0,null!=t&&i.push(t,e);}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo:function(t,e,i){return void 0===i&&(i=!1),i&&(t+=this.lastPointX,e+=this.lastPointY),x(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo:function(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo:function(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc:function(t,e,i,s,n,r,h){return void 0===h&&(h=!1),A(t,e,i,s,n,r,h,this.iterations,this.pathData),this.lastPointX=this.pathData[this.pathData.length-2],this.lastPointY=this.pathData[this.pathData.length-1],this},arc:function(t,e,i,s,n,r){return this.ellipticalArc(t,e,i,i,s,n,r),this},quadraticBezierTo:function(t,e,i,s){return function(t,e,i,s,n,r){for(var h=r.length,a=r[h-2],o=r[h-1],u=1,l=n-1;u<=l;u++){var c=u/l;r.push(R(c,a,t,i),R(c,o,e,s));}}(t,e,i,s,this.iterations,this.pathData),this.lastPointX=i,this.lastPointY=s,this.lastCX=t,this.lastCY=e,this},smoothQuadraticBezierTo:function(t,e){var i=2*this.lastPointX-this.lastCX,s=2*this.lastPointY-this.lastCY;return this.quadraticBezierTo(i,s,t,e),this},cubicBezierCurveTo:function(t,e,i,s,n,r){return function(t,e,i,s,n,r,h,a){for(var o=a.length,u=a[o-2],l=a[o-1],c=1,d=h-1;c<=d;c++){var f=c/d;a.push(E(f,u,t,i,n),E(f,l,e,s,r));}}(t,e,i,s,n,r,this.iterations,this.pathData),this.lastPointX=n,this.lastPointY=r,this.lastCX=i,this.lastCY=s,this},smoothCubicBezierCurveTo:function(t,e,i,s){var n=2*this.lastPointX-this.lastCX,r=2*this.lastPointY-this.lastCY;return this.cubicBezierCurveTo(n,r,t,e,i,s),this},close:function(){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:function(){return O(this.pathData),this}},L=Phaser.Math.RotateAround,j=function(t,e,i){for(var s=0,n=i.length-1;s<n;s+=2)i[s]+=t,i[s+1]+=e;return i},z=Phaser.Math.DegToRad,F=Phaser.Math.RotateAround,G={rotateAround:function(t,e,i){if(0===this.pathData.length)return this;!function(t,e,i,s){for(var n={x:0,y:0},r=0,h=s.length-1;r<h;r+=2)n.x=s[r],n.y=s[r+1],L(n,t,e,i),s[r]=n.x,s[r+1]=n.y;}(t,e,i=z(i),this.pathData);var s=this.pathData.length;if(this.lastPointX=this.pathData[s-2],this.lastPointY=this.pathData[s-1],void 0!==this.lastCX){var n={x:this.lastCX,y:this.lastCY};F(n,t,e,i),this.lastCX=n.x,this.lastCY=n.y;}return this},scale:function(t,e,i,s){if(0===this.pathData.length)return this;if(function(t,e,i,s,n){for(var r=0,h=n.length-1;r<h;r+=2){var a=n[r]-t,o=n[r+1]-e;a*=i,o*=s,n[r]=a+t,n[r+1]=o+e;}}(t,e,i,s,this.pathData),this.lastPointX=this.pathData[pathDataCnt-2],this.lastPointY=this.pathData[pathDataCnt-1],void 0!==this.lastCX){var n=this.lastCX-t,r=this.lastCY-e;n*=i,r*=s,this.lastCX=n+t,this.lastCY=r+e;}return this},offset:function(t,e){return j(t,e,this.pathData),this}},X={savePathData:function(){return this.pathDataSaved||(this.pathDataSave=l(this.pathData),this.pathData.length=0,this.pathDataSaved=!0),this},restorePathData:function(){return this.pathDataSaved?(function(t,e,i,s){void 0===i&&(i=0),void 0===s&&(s=e.length),t.length=s-i;for(var n=0,r=t.length;n<r;n++)t[n]=e[n+i];}(this.pathData,this.pathDataSave),this.pathDataSave=void 0,this.pathDataSaved=!1,this):this}},M=Phaser.Math.Distance.Between,Y=Phaser.Math.Wrap,I=Phaser.Math.Linear,V=function(t,e,i,s,n){if(void 0===s&&(s=i,i=0),(i=N(i))!==(s=N(s))){var r=e[e.length-1],h=r*i,a=r*s;i<s?U(t,e,h,a,n):(U(t,e,h,r,n),U(t,e,0,a,n)),O(n);}},U=function(t,e,i,s,n){for(var r=i>0,h=0,a=e.length;h<a;h++){var o=2*h,u=e[h];if(r){if(u<i)continue;if(u==i)r=!1;else {var l=1-(u-i)/(u-e[h-1]);n.push(W(t,o-2,o,l)),n.push(W(t,o-1,o+1,l)),r=!1;}}if(!(u<=s)){l=1-(u-s)/(u-e[h-1]);n.push(W(t,o-2,o,l)),n.push(W(t,o-1,o+1,l));break}if(n.push(t[o]),n.push(t[o+1]),u===s)break}},W=function(t,e,i,s){var n=t[e],r=t[i];return I(n,r,s)},N=function(t){return 0===t?0:t%1==0?1:Y(t,0,1)},J={updateAccumulationLengths:function(){if(null==this.accumulationLengths)this.accumulationLengths=[];else if(this.accumulationLengths.length===this.pathData.length/2)return this;for(var t,e,i,s,n=this.accumulationLengths,r=this.pathData,h=0,a=0,o=r.length;a<o;a+=2)i=r[a],s=r[a+1],h+=void 0===t?0:M(t,e,i,s),n.push(h),t=i,e=s;return this.totalPathLength=h,this},setDisplayPathSegment:function(t,e){return this.pathDataSaved||(this.updateAccumulationLengths(),this.savePathData()),this.pathData.length=0,V(this.pathDataSave,this.accumulationLengths,t,e,this.pathData),this},appendFromPathSegment:function(t,e,i){var s;void 0===e?(s=this.pathData).push.apply(s,l(t.pathData)):(t.updateAccumulationLengths(),V(t.pathData,t.accumulationLengths,e,i,this.pathData));return 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}},q=Phaser.Geom.Polygon,K=function(){function t(i){e(this,t),void 0===i&&(i=[]),this.pathData=i,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;}return s(t,[{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"toPoints",value:function(){return function(t,e){void 0===e&&(e=[]);for(var i=0,s=t.length-1;i<s;i+=2)e.push({x:t[i],y:t[i+1]});return e}(this.pathData)}},{key:"toPolygon",value:function(t){return function(t,e){return void 0===e&&(e=new q),e.setTo(t),e}(this.pathData,t)}}]),t}();Object.assign(K.prototype,B,G,X,J,{draw:function(t,e,i){var s=this.toPoints();return e&&t.fillPoints(s,this.closePath,this.closePath),i&&t.strokePoints(s,this.closePath,this.closePath),this}});var Q=function(t){n(r,t);var i=o(r);function r(){var t;return e(this,r),(t=i.call(this)).builder=new K(t.pathData),t}return s(r,[{key:"iterations",get:function(){return this.builder.iterations},set:function(t){this.dirty=this.dirty||this.builder.iterations!==t,this.builder.setIterations(t);}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"lastPointX",get:function(){return this.builder.lastPointX}},{key:"lastPointY",get:function(){return this.builder.lastPointY}},{key:"start",value:function(){return this.builder.start(),this.dirty=!0,this}},{key:"startAt",value:function(t,e){return this.builder.startAt(t,e),this.dirty=!0,this}},{key:"lineTo",value:function(t,e,i){return this.builder.lineTo(t,e,i),this.dirty=!0,this}},{key:"verticalLineTo",value:function(t,e){return this.builder.verticalLineTo(t,e),this.dirty=!0,this}},{key:"horizontalLineTo",value:function(t,e){return this.builder.horizontalLineTo(t,e),this.dirty=!0,this}},{key:"ellipticalArc",value:function(t,e,i,s,n,r,h){return this.builder.ellipticalArc(t,e,i,s,n,r,h),this.dirty=!0,this}},{key:"arc",value:function(t,e,i,s,n,r){return this.builder.arc(t,e,i,s,n,r),this.dirty=!0,this}},{key:"quadraticBezierTo",value:function(t,e,i,s){return this.builder.quadraticBezierTo(t,e,i,s),this.dirty=!0,this}},{key:"smoothQuadraticBezierTo",value:function(t,e){return this.builder.smoothQuadraticBezierTo(t,e),this.dirty=!0,this}},{key:"cubicBezierCurveTo",value:function(t,e,i,s,n,r){return this.builder.cubicBezierCurveTo(t,e,i,s,n,r),this.dirty=!0,this}},{key:"smoothCubicBezierCurveTo",value:function(t,e,i,s){return this.builder.smoothCubicBezierCurveTo(t,e,i,s),this.dirty=!0,this}},{key:"close",value:function(){return this.builder.close(),this.closePath=this.builder.closePath,this.dirty=!0,this}},{key:"end",value:function(){return this.builder.end(),this.dirty=!0,this}},{key:"rotateAround",value:function(t,e,i){return this.builder.rotateAround(t,e,i),this.dirty=!0,this}},{key:"scale",value:function(t,e,i,s){return this.builder.scale(t,e,i,s),this.dirty=!0,this}},{key:"offset",value:function(t,e){return this.builder.offset(t,e),this.dirty=!0,this}},{key:"toPolygon",value:function(t){return this.builder.toPolygon(t)}},{key:"appendPathFrom",value:function(t,e,i){return this.builder.appendFromPathSegment(t.builder,e,i),this}},{key:"copyPathFrom",value:function(t,e,i){return this.builder.clear().appendFromPathSegment(t.builder,e,i),this}},{key:"setDisplayPathSegment",value:function(t,e){return this.builder.setDisplayPathSegment(t,e),this}}]),r}(C);Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var H=Phaser.Utils.Objects.GetValue,$=function(t){n(h,t);var i=o(h);function h(t,s,n,r,a,o){var u;return e(this,h),void 0===t&&(t=0),void 0===s&&(s=0),void 0===n&&(n=0),void 0===r&&(r=n),void 0===a&&(a=0),void 0===o&&(o=6),(u=i.call(this)).setTopLeftPosition(t,s),u.setSize(n,r),u.setRadius(a),u.setIterations(o),u.closePath=!0,u}return s(h,[{key:"x",get:function(){return this._x},set:function(t){this.dirty=this.dirty||this._x!==t,this._x=t;}},{key:"y",get:function(){return this._y},set:function(t){this.dirty=this.dirty||this._y!==t,this._y=t;}},{key:"setTopLeftPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"width",get:function(){return this._width},set:function(t){this.dirty=this.dirty||this._width!==t,this._width=t;}},{key:"height",get:function(){return this._height},set:function(t){this.dirty=this.dirty||this._height!==t,this._height=t;}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"centerX",get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2;}},{key:"centerY",get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2;}},{key:"setCenterPosition",value:function(t,e){return this.centerX=t,this.centerY=e,this}},{key:"radiusTL",get:function(){return this._radiusTL},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t);}},{key:"radiusTR",get:function(){return this._radiusTR},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t);}},{key:"radiusBL",get:function(){return this._radiusBL},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t);}},{key:"radiusBR",get:function(){return this._radiusBR},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t);}},{key:"radius",get:function(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)},set:function(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=H(t,"tl",0),this.radiusTR=H(t,"tr",0),this.radiusBL=H(t,"bl",0),this.radiusBR=H(t,"br",0));}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"iterations",get:function(){return this._iterations},set:function(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t;}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"updateData",value:function(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,n=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?A(e,e,e,e,180,270,!1,n,t):A(0,0,e,e,90,0,!0,n,t):x(0,0,t);(e=this.radiusTR)>0?this._convexTR?A(i-e,e,e,e,270,360,!1,n,t):A(i,0,e,e,180,90,!0,n,t):x(i,0,t);(e=this.radiusBR)>0?this._convexBR?A(i-e,s-e,e,e,0,90,!1,n,t):A(i,s,e,e,270,180,!0,n,t):x(i,s,t);(e=this.radiusBL)>0?this._convexBL?A(e,s-e,e,e,90,180,!1,n,t):A(0,s,e,e,360,270,!0,n,t):x(0,s,t);return t.push(t[0],t[1]),j(this.x,this.y,t),u(r(h.prototype),"updateData",this).call(this),this}}]),h}(C);Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var Z={buildShapes:function(){this.addShape((new $).setName("box")).addShape((new Q).setName("checker"));},updateShapes:function(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,n=t-i,r=e-i,h=this.boxLineWidth,a=Math.max(s/10,2),o=this.getShape("box"),u=this.getShape("checker");if(this.isSizeChanged){var l=s*(1-this.boxSize)/2,c=h/2,d=s*this.boxSize-h;o.setTopLeftPosition(n+c+l,r+c+l).setSize(d,d),this.isCircleShape?o.setRadius(d/2):o.setRadius(0);l=s*(1-this.checkerSize)/2;var f=s*this.checkerSize/4,p=1*f,v=2*f,y=3*f;u.startAt(p,v).lineTo(v,y).lineTo(y,p).offset(n+l,r+l).end();}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(h,this.boxStrokeColor,this.boxStrokeAlpha),u.lineStyle(a,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(h,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),u.lineStyle()),this.checked&&u.setDisplayPathSegment(this.checkerAnimProgress);}},tt={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):[]}},et=Phaser.Scene,it=function(t){return t instanceof et},st=Phaser.Game,nt=function(t){return t instanceof st},rt=Phaser.Utils.Objects.GetValue,ht=function(){function i(t,s){e(this,i),this.setParent(t),this.isShutdown=!1,this.setEventEmitter(rt(s,"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));}return s(i,[{key:"shutdown",value:function(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);}},{key:"destroy",value:function(t){this.shutdown(t);}},{key:"onEnvDestroy",value:function(){this.destroy(!0);}},{key:"onParentDestroy",value:function(t,e){this.destroy(e);}},{key:"setParent",value:function(e){var i;return this.parent=e,this.scene=null==(i=e)||"object"!==t(i)?null:it(i)?i:i.scene&&it(i.scene)?i.scene:i.parent&&i.parent.scene&&it(i.parent.scene)?i.parent.scene:null,this.game=function(e){return null==e||"object"!==t(e)?null:nt(e)?e:nt(e.game)?e.game:it(e)?e.sys.game:it(e.scene)?e.scene.sys.game:void 0}(e),this}}]),i}();Object.assign(ht.prototype,tt);var at=Phaser.Utils.Objects.GetValue,ot=function(t){n(h,t);var i=o(h);function h(t,s){var n;return e(this,h),(n=i.call(this,t,s))._isRunning=!1,n.isPaused=!1,n.tickingState=!1,n.setTickingMode(at(s,"tickingMode",1)),n}return s(h,[{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(r(h.prototype),"shutdown",this).call(this,t));}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=ut[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);}}]),h}(ht),ut={no:0,lazy:1,always:2},lt=Phaser.Utils.Objects.GetValue,ct=function(t){n(h,t);var i=o(h);function h(t,s){var n;e(this,h);var r=(n=i.call(this,t,s)).scene?"update":"step";return n.tickEventName=lt(s,"tickEventName",r),n.isSceneTicker=!dt(n.tickEventName),n}return s(h,[{key:"startTicking",value:function(){u(r(h.prototype),"startTicking",this).call(this),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this);}},{key:"stopTicking",value:function(){u(r(h.prototype),"stopTicking",this).call(this),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);}}]),h}(ot),dt=function(t){return "step"===t||"poststep"===t},ft=Phaser.Utils.Objects.GetValue,pt=Phaser.Math.Clamp,vt=function(){function t(i){e(this,t),this.resetFromJSON(i);}return s(t,[{key:"resetFromJSON",value:function(t){this.state=ft(t,"state",yt),this.timeScale=ft(t,"timeScale",1),this.delay=ft(t,"delay",0),this.repeat=ft(t,"repeat",0),this.repeatCounter=ft(t,"repeatCounter",0),this.repeatDelay=ft(t,"repeatDelay",0),this.duration=ft(t,"duration",0),this.nowTime=ft(t,"nowTime",0),this.justRestart=ft(t,"justRestart",!1);}},{key:"toJSON",value:function(){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}}},{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:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"start",value:function(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?gt:kt,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=yt,this}},{key:"update",value:function(t,e){this.state!==yt&&this.state!==bt&&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=mt)):(this.nowTime=this.duration,this.state=bt):this.nowTime>=0&&(this.state=gt));}},{key:"t",get:function(){var t;switch(this.state){case yt:case kt:case mt:t=0;break;case gt:t=this.nowTime/this.duration;break;case bt:t=1;}return pt(t,0,1)},set:function(t){(t=pt(t,-1,1))<0?(this.state=kt,this.nowTime=-this.delay*t):(this.state=gt,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===yt}},{key:"isDelay",get:function(){return this.state===kt}},{key:"isCountDown",get:function(){return this.state===gt}},{key:"isRunning",get:function(){return this.state===kt||this.state===gt}},{key:"isDone",get:function(){return this.state===bt}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),yt=0,kt=1,gt=2,mt=3,bt=-1,St=function(t){n(h,t);var i=o(h);function h(t,s){var n;return e(this,h),(n=i.call(this,t,s)).timer=new vt,n}return s(h,[{key:"shutdown",value:function(t){this.isShutdown||(u(r(h.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),u(r(h.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),u(r(h.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),u(r(h.prototype),"complete",this).call(this),this}}]),h}(ct),Pt=Phaser.Utils.Objects.GetValue,Dt=Phaser.Utils.Objects.GetAdvancedValue,_t=Phaser.Tweens.Builders.GetEaseFunction,Tt=function(t){n(h,t);var i=o(h);function h(){return e(this,h),i.apply(this,arguments)}return s(h,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Pt(t,"timer")),this.setEnable(Pt(t,"enable",!0)),this.setTarget(Pt(t,"target",this.parent)),this.setDelay(Dt(t,"delay",0)),this.setDuration(Dt(t,"duration",1e3)),this.setEase(Pt(t,"ease","Linear")),this.setRepeat(Pt(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:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=_t(t),this}},{key:"start",value:function(){return this.timer.isRunning||u(r(h.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(r(h.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(t,e){}}]),h}(St),Ct=Phaser.Utils.Objects.GetValue,xt=Phaser.Math.Linear,wt=function(t){n(h,t);var i=o(h);function h(t,s){var n;return e(this,h),(n=i.call(this,t,s)).resetFromJSON(),n.boot(),n}return s(h,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Ct(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Ct(t,"from",i),this.toValue=Ct(t,"to",i),this.setEase(Ct(t,"ease",this.ease)),this.setDuration(Ct(t,"duration",this.duration)),this.setRepeat(Ct(t,"repeat",0)),this.setDelay(Ct(t,"delay",0)),this.setRepeatDelay(Ct(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,u(r(h.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=xt(this.fromValue,this.toValue,i);}}]),h}(Tt),At={setCheckerAnimationDuration:function(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation:function(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new wt(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation:function(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},Rt={};Object.assign(Rt,m,{setBoxSize:function(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize:function(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Z,At);var Et=Phaser.Utils.Objects.GetValue,Ot=Phaser.Utils.Objects.IsPlainObject,Bt=23730,Lt=function(t){n(r,t);var i=o(r);function r(t,s,n,h,a,o,u){var l;e(this,r),Ot(s)?(s=Et(u=s,"x",0),n=Et(u,"y",0),h=Et(u,"width",2),a=Et(u,"height",2),o=Et(u,"color",Bt)):Ot(o)&&(o=Et(u=o,"color",Bt)),(l=i.call(this,t,s,n,h,a)).type="rexCheckbox",void 0===o&&(o=Bt),l.setBoxShape(Et(u,"circleBox",!1)),l.setBoxFillStyle(o,Et(u,"boxFillAlpha",1)),l.setUncheckedBoxFillStyle(Et(u,"uncheckedColor",null),Et(u,"uncheckedBoxFillAlpha",1)),l.setBoxStrokeStyle(Et(u,"boxLineWidth",4),Et(u,"boxStrokeColor",o),Et(u,"boxStrokeAlpha",1)),l.setUncheckedBoxStrokeStyle(l.boxLineWidth,Et(u,"uncheckedBoxStrokeColor",l.boxStrokeColor),Et(u,"uncheckedBoxStrokeAlpha",l.boxStrokeAlpha)),l.setCheckerStyle(Et(u,"checkerColor",16777215),Et(u,"checkerAlpha",1)),l.setBoxSize(Et(u,"boxSize",1)),l.setCheckerSize(Et(u,"checkerSize",1)),l.setCheckerAnimationDuration(Et(u,"animationDuration",150)),l.buildShapes();var c=Et(u,"checked");return void 0===c&&(c=Et(u,"value",!1)),l.setValue(c),l}return s(r,[{key:"value",get:function(){return this._value},set:function(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t));}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"toggleValue",value:function(){return this.setValue(!this.value),this}},{key:"checked",get:function(){return this.value},set:function(t){this.value=t;}},{key:"setChecked",value:function(t){return void 0===t&&(t=!0),this.setValue(t),this}},{key:"toggleChecked",value:function(){return this.toggleValue(),this}},{key:"checkerAnimProgress",get:function(){return this._checkerAnimProgress},set:function(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0);}}]),r}(g);Object.assign(Lt.prototype,Rt);var jt=Phaser.Utils.Objects.GetValue,zt=function(t){n(h,t);var i=o(h);function h(t,s){var n;return e(this,h),(n=i.call(this,t,s))._enable=void 0,t.setInteractive(jt(s,"inputConfig",void 0)),n.resetFromJSON(s),n.boot(),n}return s(h,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(jt(t,"enable",!0)),this.setMode(jt(t,"mode",1)),this.setClickInterval(jt(t,"clickInterval",100)),this.setDragThreshold(jt(t,"threshold",void 0)),this}},{key:"boot",value:function(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.pointer=null,u(r(h.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Ft[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"onPress",value:function(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s));}},{key:"onRelease",value:function(t,e,i,s){this.pointer===t&&(this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0);}},{key:"onPointOut",value:function(t,e){this.pointer===t&&this.cancel();}},{key:"onMove",value:function(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel();}},{key:"click",value:function(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,s){return this.enable?(this.emit("over",this,this.parent,t,s),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),h}(ht),Ft={press:0,pointerdown:0,release:1,pointerup:1},Gt=Phaser.Utils.Objects.GetValue,Xt=function(t){n(r,t);var i=o(r);function r(t,s,n,h,o,u,l){var c;return e(this,r),(c=i.call(this,t,s,n,h,o,u,l))._click=new zt(a(c),Gt(l,"click")),c._click.on("click",(function(){this.toggleValue();}),a(c)),c.setReadOnly(Gt(l,"readOnly",!1)),c}return s(r,[{key:"readOnly",get:function(){return !this._click.enable},set:function(t){this._click.enable=!t;}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}}]),r}(Lt);function Mt(t,e,i,s,n,r){var h=new Xt(this.scene,t,e,i,s,n,r);return this.scene.add.existing(h),h}var Yt=Phaser.Utils.Objects.GetAdvancedValue,It=Phaser.GameObjects.BuildGameObject;function Vt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=Yt(t,"width",void 0),s=Yt(t,"height",i),n=Yt(t,"color",23730),r=new Xt(this.scene,0,0,i,s,n,t);return It(this.scene,r,t),r}function Ut(t,e,i,s,n,r){var h=new Lt(this.scene,t,e,i,s,n,r);return this.scene.add.existing(h),h}var Wt=Phaser.Utils.Objects.GetAdvancedValue,Nt=Phaser.GameObjects.BuildGameObject;function Jt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=Wt(t,"width",void 0),s=Wt(t,"height",i),n=Wt(t,"color",23730),r=new Lt(this.scene,0,0,i,s,n,t);return Nt(this.scene,r,t),r}var qt=function(t){return null==t||""===t||0===t.length},Kt=function(e,i,s,n){if(void 0===n&&(n="."),"object"===t(e)){if(qt(i)){if(null==s)return;"object"===t(s)&&(e=s);}else {"string"==typeof i&&(i=i.split(n));var r=i.pop(),h=function(e,i,s){var n=e;if(qt(i));else {var r;"string"==typeof i&&(i=i.split("."));for(var h=0,a=i.length;h<a;h++){var o;null!=n[r=i[h]]&&"object"===t(n[r])||(o=h===a-1?void 0===s?{}:s:{},n[r]=o),n=n[r];}}return n}(e,i);h[r]=s;}return e}},Qt=function(t){n(r,Phaser.Plugins.BasePlugin);var i=o(r);function r(t){var s;return e(this,r),s=i.call(this,t),t.registerGameObject("rexCheckbox",Mt,Vt),t.registerGameObject("rexCheckboxShape",Ut,Jt),s}return s(r,[{key:"start",value:function(){this.game.events.on("destroy",this.destroy,this);}}]),r}();return Kt(window,"RexPlugins.GameObjects.Checkbox",Xt),Kt(window,"RexPlugins.GameObjects.CheckboxShape",Lt),Qt}));