UNPKG

phaser4-rex-plugins

Version:
2 lines (1 loc) 40.1 kB
var t,e;t=void 0,e=function(){var t={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 e=Phaser.Scene;var s=function(t){return t instanceof e},i=function(t){return null==t||"object"!=typeof t?null:s(t)?t:t.scene&&s(t.scene)?t.scene:t.parent&&t.parent.scene&&s(t.parent.scene)?t.parent.scene:null};const r=Phaser.Game;var h=function(t){return t instanceof r};const a=Phaser.Utils.Objects.GetValue;class n{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(a(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=i(t),this.game=null==(e=t)||"object"!=typeof e?null:h(e)?e:h(e.game)?e.game:s(e)?e.sys.game:s(e.scene)?e.scene.sys.game:void 0,this}}function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}Object.assign(n.prototype,t);var l={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,s="~";function i(){}function r(t,e,s){this.fn=t,this.context=e,this.once=s||!1}function h(t,e,i,h,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var n=new r(i,h||t,a),o=s?s+e:e;return t._events[o]?t._events[o].fn?t._events[o]=[t._events[o],n]:t._events[o].push(n):(t._events[o]=n,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function n(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(s=!1)),n.prototype.eventNames=function(){var t,i,r=[];if(0===this._eventsCount)return r;for(i in t=this._events)e.call(t,i)&&r.push(s?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},n.prototype.listeners=function(t){var e=s?s+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,h=i.length,a=new Array(h);r<h;r++)a[r]=i[r].fn;return a},n.prototype.listenerCount=function(t){var e=s?s+t:t,i=this._events[e];return i?i.fn?1:i.length:0},n.prototype.emit=function(t,e,i,r,h,a){var n=s?s+t:t;if(!this._events[n])return!1;var o,l,c=this._events[n],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,i),!0;case 4:return c.fn.call(c.context,e,i,r),!0;case 5:return c.fn.call(c.context,e,i,r,h),!0;case 6:return c.fn.call(c.context,e,i,r,h,a),!0}for(l=1,o=new Array(d-1);l<d;l++)o[l-1]=arguments[l];c.fn.apply(c.context,o)}else{var u,p=c.length;for(l=0;l<p;l++)switch(c[l].once&&this.removeListener(t,c[l].fn,void 0,!0),d){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,e);break;case 3:c[l].fn.call(c[l].context,e,i);break;case 4:c[l].fn.call(c[l].context,e,i,r);break;default:if(!o)for(u=1,o=new Array(d-1);u<d;u++)o[u-1]=arguments[u];c[l].fn.apply(c[l].context,o)}}return!0},n.prototype.on=function(t,e,s){return h(this,t,e,s,!1)},n.prototype.once=function(t,e,s){return h(this,t,e,s,!0)},n.prototype.removeListener=function(t,e,i,r){var h=s?s+t:t;if(!this._events[h])return this;if(!e)return a(this,h),this;var n=this._events[h];if(n.fn)n.fn!==e||r&&!n.once||i&&n.context!==i||a(this,h);else{for(var o=0,l=[],c=n.length;o<c;o++)(n[o].fn!==e||r&&!n[o].once||i&&n[o].context!==i)&&l.push(n[o]);l.length?this._events[h]=1===l.length?l[0]:l:a(this,h)}return this},n.prototype.removeAllListeners=function(t){var e;return t?(e=s?s+t:t,this._events[e]&&a(this,e)):(this._events=new i,this._eventsCount=0),this},n.prototype.off=n.prototype.removeListener,n.prototype.addListener=n.prototype.on,n.prefixed=s,n.EventEmitter=n,t.exports=n}(l);var c=o(l.exports);class d extends c{shutdown(){this.removeAllListeners()}destroy(){this.removeAllListeners()}}var u={setEventEmitter(t,e){return void 0===e&&(e=d),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: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):[]}},p=function(t,e,s){if(!t||"number"==typeof t)return s;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return s;e=e.split(".")}for(var i=e,r=t,h=s,a=0;a<i.length;a++){if(e=i[a],!r.hasOwnProperty(e)){h=s;break}r=h=r[e]}return h};const v=["next","exit","enter"];let m=class{constructor(t){var e=p(t,"states",void 0);e&&this.addStates(e);var s=p(t,"extend",void 0);if(s)for(var i in s)this.hasOwnProperty(i)&&void 0!==this[i]||(this[i]=s[i]);var r=p(t,"eventEmitter",void 0),h=p(t,"EventEmitterClass",void 0);this.setEventEmitter(r,h),this._stateLock=!1,this.resetFromJSON(t)}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}resetFromJSON(t){this.setEnable(p(t,"enable",!0)),this.start(p(t,"start",void 0));var e=p(t,"init",void 0);return e&&e.call(this),this}toJSON(){return{curState:this.state,prevState:this.prevState,enable:this.enable,start:this._start}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}set state(t){if(this.enable&&!this._stateLock&&this._state!==t){if(this._prevState=this._state,this._state=t,this._stateLock=!0,this.emit("statechange",this),null!=this._prevState){var e="exit_"+this._prevState,s=this[e];s&&s.call(this),this.emit(e,this)}if(this._stateLock=!1,null!=this._state){var i="enter_"+this._state,r=this[i];r&&r.call(this),this.emit(i,this)}}}get state(){return this._state}get prevState(){return this._prevState}start(t){return this._start=t,this._prevState=void 0,this._state=t,this}goto(t){return null!=t&&(this.state=t),this}next(){var t,e=this["next_"+this.state];return e&&(t="string"==typeof e?e:e.call(this)),this.goto(t),this}get stateProperties(){return v}addState(t,e){"string"!=typeof t&&(t=(e=t).name);for(var s=this.stateProperties,i=0,r=s.length;i<r;i++){var h=s[i],a=e[h];a&&(this[`${h}_${t}`]=a)}return this}addStates(t){if(Array.isArray(t))for(var e=0,s=t.length;e<s;e++)this.addState(t[e]);else for(var i in t)this.addState(i,t[i]);return this}runMethod(t,e,s,i,r,h){var a=this[t+"_"+this.state];if(a){var n=arguments.length;switch(n){case 1:return a.call(this);case 2:return a.call(this,e);case 3:return a.call(this,e,s);case 4:return a.call(this,e,s,i);case 5:return a.call(this,e,s,i,r);case 6:return a.call(this,e,s,i,r,h)}for(var o=new Array(n-1),l=1;l<n;l++)o[l-1]=arguments[l];return a.apply(this,o)}}};Object.assign(m.prototype,u);var b=function(t,e,s,i,r){void 0===r&&(r=!1);var h=t._events[e];if(!h)return!1;for(var a=0,n=h.length;a<n;a++){var o=h[a];if(o.fn===s&&o.context===i&&o.once===r)return!0}return!1};const g=["next","exit","enter","update","preupdate","postupdate"];class f extends m{shutdown(){this.stopUpdate(),this.stopPreUpdate(),this.stopPostUpdate(),this._scene=void 0,super.shutdown()}resetFromJSON(t){return super.resetFromJSON(t),this._scene=p(t,"scene",void 0),this}get stateProperties(){return g}update(t,e){this.runMethod("update",t,e)}preupdate(t,e){this.runMethod("preupdate",t,e)}postupdate(t,e){this.runMethod("postupdate",t,e)}startUpdate(t){t||(t=this._scene);var e=t.sys.events;return b(e,"update",this.update,this)||(this._scene=t,e.on("update",this.update,this)),this}stopUpdate(){return this._scene?(this._scene.sys.events.off("update",this.update,this),this):this}startPreUpdate(t){t||(t=this._scene);var e=t.sys.events;return b(e,"preupdate",this.preupdate,this)||(this._scene=t,e.on("preupdate",this.preupdate,this)),this}stopPreUpdate(){return this._scene?(this._scene.sys.events.off("preupdate",this.preupdate,this),this):this}startPostUpdate(t){t||(t=this._scene);var e=t.sys.events;return b(e,"postupdate",this.postupdate,this)||(this._scene=t,e.on("postupdate",this.postupdate,this)),this}stopPostUpdate(){return this._scene?(this._scene.sys.events.off("postupdate",this.postupdate,this),this):this}}class y extends f{constructor(t,e){super(e),this.bejeweled=t,this.boardWrapper=t.boardWrapper,this.waitEvents=t.waitEvents}shutdown(){super.shutdown(),this.bejeweled=void 0,this.boardWrapper=void 0,this.waitEvents=void 0}destroy(){return this.shutdown(),this}next(){this.waitEvents.noWaitEvent?super.next():this.waitEvents.setCompleteCallback(this.next,this)}}var E=function(t,e,s){for(var i=0,r=t.length;i<r;i++){const e=t[i];var h=e.scene.tweens.add({targets:e,alpha:0,duration:500,onComplete(t,e){e[0].destroy()}});s.waitEvent(h,"complete")}},w=function(t,e){for(var s,i,r=e.getChessTileZ(),h=t.height-1;h>=0;h--)for(var a=0,n=t.width;a<n;a++)if(null!==(s=t.tileXYZToChess(a,h,r))){i=e.getChessMoveTo(s);do{i.moveToward(1)}while(i.lastMoveResult);i.isRunning&&e.waitEvent(i,"complete")}},T=function(t){return t&&"function"==typeof t.then};const C=Phaser.Utils.Objects.GetValue;Phaser.Structs.Set;let S=class extends y{constructor(t,e){super(t,e),this.totalMatchedLinesCount=0,this.eliminatedPieceArray=void 0,this.eliminatingAction=C(e,"eliminatingAction",E),this.fallingAction=C(e,"fallingAction",w),C(e,"debug",!1)&&this.on("statechange",this.printState,this)}shutdown(){return super.shutdown(),this.eliminatedPieceArray=void 0,this.eliminatingAction=void 0,this.fallingAction=void 0,this}destroy(){return this.shutdown(),this}setEliminatedPieces(t){return Array.isArray(t)&&(t=[...new Set(t)]),this.eliminatedPieceArray=t,this}getEliminatedPieces(){return this.eliminatedPieceArray}enter_START(){this.totalMatchedLinesCount=0,this.bejeweled.emit("match-start",this.boardWrapper.board,this.bejeweled),this.next()}next_START(){return this.getEliminatedPieces()?"ELIMINATING":"MATCH3"}enter_MATCH3(){var t=this.boardWrapper.getAllMatch();this.bejeweled.emit("match",t,this.boardWrapper.board,this.bejeweled);var e,s=t.length;switch(this.totalMatchedLinesCount+=s,s){case 0:e=[];break;case 1:e=[...t[0]];break;default:e=[];for(var i=0;i<s;i++)e.push(...t[i])}this.setEliminatedPieces(e),this.next()}next_MATCH3(){var t=this.getEliminatedPieces();return t&&0===t.length?"END":"ELIMINATING"}enter_ELIMINATING(){var t=this.boardWrapper.board,e=this.bejeweled,s=this.getEliminatedPieces();this.bejeweled.emit("eliminate",s,t,e);var i=this.eliminatingAction(s,t,e);T(i)&&(e.waitEvent(e,"eliminate.complete"),i.then((function(){e.emit("eliminate.complete")}))),s.forEach(t.removeChess,t),this.next()}next_ELIMINATING(){return"FALLING"}exit_ELIMINATING(){this.setEliminatedPieces()}enter_FALLING(){var t=this.boardWrapper.board,e=this.bejeweled;this.bejeweled.emit("fall",t,e);var s=this.fallingAction(t,e);T(s)&&(e.waitEvent(e,"fall.complete"),s.then((function(){e.emit("fall.complete")}))),this.next()}next_FALLING(){return"FILL"}enter_FILL(){this.boardWrapper.fillPrepareRows(),this.bejeweled.emit("fill",this.boardWrapper.board,this.bejeweled),this.next()}next_FILL(){return"MATCH3"}enter_END(){this.bejeweled.emit("match-end",this.boardWrapper.board,this.bejeweled),this.emit("complete")}printState(){console.log("Match state: "+this.prevState+" -> "+this.state)}};const A=Phaser.Utils.Objects.GetValue;class _ extends n{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(A(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=x[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 x={no:0,lazy:1,always:2},k=Phaser.Utils.Objects.GetValue;class L extends _{constructor(t,e){super(t,e);var s=this.scene?"update":"step";this.tickEventName=k(e,"tickEventName",s),this.isSceneTicker=!M(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 M=function(t){return"step"===t||"poststep"===t};const j=Phaser.Utils.Objects.GetValue,P=Phaser.Math.Clamp;class W{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=j(t,"state",R),this.timeScale=j(t,"timeScale",1),this.delay=j(t,"delay",0),this.repeat=j(t,"repeat",0),this.repeatCounter=j(t,"repeatCounter",0),this.repeatDelay=j(t,"repeatDelay",0),this.duration=j(t,"duration",0),this.nowTime=j(t,"nowTime",0),this.justRestart=j(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?O:D,this.repeatCounter=0,this}stop(){return this.state=R,this}update(t,e){this.state!==R&&this.state!==Y&&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=X)):(this.nowTime=this.duration,this.state=Y):this.nowTime>=0&&(this.state=O))}get t(){var t;switch(this.state){case R:case D:case X:t=0;break;case O:t=this.nowTime/this.duration;break;case Y:t=1}return P(t,0,1)}set t(t){(t=P(t,-1,1))<0?(this.state=D,this.nowTime=-this.delay*t):(this.state=O,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===R}get isDelay(){return this.state===D}get isCountDown(){return this.state===O}get isRunning(){return this.state===D||this.state===O}get isDone(){return this.state===Y}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const R=0,D=1,O=2,X=3,Y=-1;class N extends L{constructor(t,e){super(t,e),this.timer=new W}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 I=Phaser.Utils.Objects.GetValue,Z=Phaser.Utils.Objects.GetAdvancedValue,B=Phaser.Tweens.Builders.GetEaseFunction;class G extends N{resetFromJSON(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}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=B(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 U=Phaser.Utils.Objects.GetValue,F=Phaser.Utils.Objects.GetAdvancedValue,H=Phaser.Math.Linear;class J extends G{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(U(t,"mode",0)),this.setScaleRange(F(t,"start",void 0),F(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=V[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=F(t,"x",this.parent.scaleX),this.startY=F(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=F(e,"x",void 0),this.endY=F(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}start(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),super.start(),this}updateTarget(t,e){var s=e.t;e.isOddIteration&&(s=1-s),s=this.easeFn(s),this.hasScaleX&&(t.scaleX=H(this.startX,this.endX,s)),this.hasScaleY&&(t.scaleY=H(this.startY,this.endY,s))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const V={stop:0,destroy:1,yoyo:2};var z=function(t,e,s,i,r){var h,a;switch(void 0===i&&(i="Cubic"),s){case 0:case"x":h={x:0},a={x:t.scaleX};break;case 1:case"y":h={y:0},a={y:t.scaleY};break;default:h=0,a=t.scale}var n={mode:0,start:h,end:a,duration:e,ease:i};return void 0===r?r=new J(t,n):r.resetFromJSON(n),r.restart(),r},K=function(t,e,s){for(var i=0,r=t.length;i<r;i++){var h=z(t[i],500);s.waitEvent(h,"complete")}},$=function(t,e,s){},q=function(t,e,s){},Q=function(t,e,s,i){var r=s.chessToTileXYZ(t),h=s.chessToTileXYZ(e),a=r.x,n=r.y,o=h.x,l=h.y,c=r.z;s.setChessTileZ(e,`#${c}`);var d=i.getChessMoveTo(t),u=i.getChessMoveTo(e);d.moveTo(o,l),u.moveTo(a,n),s.setChessTileZ(e,c),d.isRunning&&i.waitEvent(d,"complete"),u.isRunning&&i.waitEvent(u,"complete")};const tt=Phaser.Utils.Objects.GetValue;class et extends y{constructor(t,e){super(t,e),this.selectedChess1,this.selectedChess2,this.clickedChess,this.matchState=new S(t,e),this.placeAction=tt(e,"placeAction",K),this.select1Action=tt(e,"select1Action",$),this.select2Action=tt(e,"select2Action",this.select1Action),this.clickAction=tt(e,"clickAction",q),this.swapAction=tt(e,"swapAction",Q),this.undoSwapAction=tt(e,"undoSwapAction",this.swapAction),tt(e,"debug",!1)&&this.on("statechange",this.printState,this)}shutdown(){return super.shutdown(),this.matchState.shutdown(),this.matchState=void 0,this.selectedChess1=void 0,this.selectedChess2=void 0,this.clickedChess=void 0,this}enter_START(){this.boardWrapper.init(),this.next()}next_START(){return"RESET"}enter_RESET(){for(var t=this.boardWrapper,e=!1;!e;)t.reset(),e=t.inputTest();this.next()}next_RESET(){return"PLACE"}enter_PLACE(){var t=this.boardWrapper.board,e=this.bejeweled;e.emit("place",t,e);var s=this.boardWrapper.getChessArray(),i=this.placeAction(s,t,e);T(i)&&(e.waitEvent(e,"place.complete"),i.then((function(){e.emit("place.complete")}))),this.next()}next_PLACE(){return"SELECT1START"}enter_SELECT1START(){this.clearInput(),this.bejeweled.emit("select1-start",this.boardWrapper.board,this.bejeweled)}selectChess1(t){return"SELECT1START"===this.state&&(t.getData("swappable")||t.getData("clickable"))&&(this.selectedChess1=t,this.next()),this}next_SELECT1START(){var t;return this.selectedChess1&&(t="SELECT1"),t}enter_SELECT1(){var t=this.boardWrapper.board,e=this.bejeweled,s=this.selectedChess1;this.bejeweled.emit("select1",s,t,e);var i=this.select1Action(s,t,e);T(i)&&(e.waitEvent(e,"select1.complete"),i.then((function(){e.emit("select1.complete")}))),this.next()}next_SELECT1(){return"SELECT2START"}enter_SELECT2START(){this.bejeweled.emit("select2-start",this.boardWrapper.board,this.bejeweled)}selectChess2(t){return"SELECT2START"===this.state&&t.getData("swappable")&&(this.selectedChess2=t,this.next()),this}clickChess(t){return"SELECT2START"===this.state&&t.getData("clickable")&&(this.clickedChess=t,this.next()),this}next_SELECT2START(){return this.clickedChess?"CLICK":this.boardWrapper.board.getNeighborChessDirection(this.selectedChess1,this.selectedChess2)<4?"SELECT2":"SELECT1START"}enter_SELECT2(){var t=this.boardWrapper.board,e=this.bejeweled,s=this.selectedChess2;this.bejeweled.emit("select2",s,t,e);var i=this.select2Action(s,t,e);T(i)&&(e.waitEvent(e,"select2.complete"),i.then((function(){e.emit("select2.complete")}))),this.next()}next_SELECT2(){return"SWAP"}enter_SWAP(){var t=this.boardWrapper.board,e=this.bejeweled,s=this.selectedChess1,i=this.selectedChess2;this.bejeweled.emit("swap",s,i,t,e);var r=this.swapAction(s,i,t,e);T(r)&&(e.waitEvent(e,"swap.complete"),r.then((function(){e.emit("swap.complete")}))),this.next()}next_SWAP(){return"MATCH3"}enter_CLICK(){var t=this.boardWrapper.board,e=this.bejeweled,s=this.clickedChess;this.bejeweled.emit("click",s,t,e);var i=this.clickAction(s,t,e);T(i)&&(e.waitEvent(e,"click.complete"),i.then((function(){e.emit("click.complete")}))),this.next()}setEliminatingChess(t){this.matchState.setEliminatedPieces(t)}next_CLICK(){return"MATCH3"}enter_MATCH3(){this.matchState.once("complete",this.next,this).goto("START")}next_MATCH3(){return 0===this.matchState.totalMatchedLinesCount?this.selectedChess2?"UNDOSWAP":"SELECT1START":this.boardWrapper.inputTest()?"SELECT1START":"RESET"}enter_UNDOSWAP(){var t=this.boardWrapper.board,e=this.bejeweled,s=this.selectedChess1,i=this.selectedChess2;this.bejeweled.emit("undo-swap",s,i,t,e);var r=this.undoSwapAction(s,i,t,e);T(r)&&(e.waitEvent(e,"undo-swap.complete"),r.then((function(){e.emit("undo-swap.complete")}))),this.next()}next_UNDOSWAP(){return"SELECT1START"}clearInput(){return this.selectedChess1=void 0,this.selectedChess2=void 0,this.clickedChess=void 0,this}isAwaitingInput(){var t=this.state;return"SELECT1START"===t||"SELECT2START"===t}runMatch3(){return this.isAwaitingInput()?(this.clearInput(),this.goto("MATCH3"),this):this}printState(){console.log("Main state: "+this.prevState+" -> "+this.state)}}var st={getChessArray(t){void 0===t&&(t=[]);for(var e=this.board,s=e.width-1,i=e.height/2,r=e.height-1,h=this.chessTileZ,a=i;a<=r;a++)for(var n=0;n<=s;n++){var o=e.tileXYZToChess(n,a,h);null!==o&&t.push(o)}return t},getChessArrayAtTileX(t,e){void 0===e&&(e=[]);var s=this.board,i=s.width-1;if(t<0||t>i)return e;for(var r=s.height/2,h=s.height-1,a=this.chessTileZ,n=r;n<=h;n++){var o=s.tileXYZToChess(t,n,a);null!==o&&e.push(o)}return e},getChessArrayAtTileY(t,e){void 0===e&&(e=[]);var s=this.board,i=s.height/2,r=s.height-1;if(t<i||t>r)return e;for(var h=s.width-1,a=this.chessTileZ,n=0;n<=h;n++){var o=s.tileXYZToChess(n,t,a);null!==o&&e.push(o)}return e},getChessArrayWithinTileRadius(t,e,s,i,r){void 0===r&&(r=[]);for(var h=this.board,a=h.width-1,n=h.height/2,o=h.height-1,l=this.chessTileZ,c=n;c<=o;c++)for(var d=0;d<=a;d++)if(!(Math.abs(d-t)>s||Math.abs(c-e)>i)){var u=h.tileXYZToChess(d,c,l);null!==u&&r.push(u)}return r},getChessArrayWithSymbol(t,e){void 0===e&&(e=[]);for(var s=this.board,i=s.width-1,r=s.height/2,h=s.height-1,a=this.chessTileZ,n=r;n<=h;n++)for(var o=0;o<=i;o++){var l=s.tileXYZToChess(o,n,a);null!==l&&l.getData("symbol")===t&&e.push(l)}return e},getNeighborChessAtAngle(t,e){var s=this.board.angleSnapToDirection(t,e);return this.getNeighborChessAtDirection(t,s)},getNeighborChessAtDirection(t,e){var s=this.board.getNeighborTileXY(t,e);return s?this.board.tileXYZToChess(s.x,s.y,this.chessTileZ):null}};const it=Phaser.Utils.Array.GetRandom;var rt=function(t,e,s,i,r,h){var a;if(Array.isArray(i)){var n=i;if(void 0!==h){for(var o=0,l=n.length;o<l;o++)a=n[o],-1===h.indexOf(a)&&ht.push(a);a=it(ht),ht.length=0}else a=it(n)}else a="function"==typeof i?r?i.call(r,t,e,s,h):i(t,e,s,h):i;return a},ht=[],at=function(){var t=this,e=this.chessTileZ;this.match.refreshSymbols((function(s,i){if(!t.isAtActivateArea(s.x,s.y))return null;var r=i.tileXYZToChess(s.x,s.y,e);if(null==r)return null;var h=r.getData("symbol");return(t.matchAcceptList&&!(h in t.matchAcceptList)||t.matchIgnoreList&&h in t.matchIgnoreList)&&(h=null),h}))},nt=function(t,e,s){return this.match.match(t,e,s),this};const ot=Phaser.Utils.Array.GetRandom;var lt=function(t){return this.match.anyMatch(t)},ct=function(t,e,s){var i=t.getSymbol(e.x,e.y),r=t.getSymbol(s.x,s.y);t.setSymbol(e.x,e.y,r),t.setSymbol(s.x,s.y,i)},dt=function(t,e){for(let s of e)if(!t.has(s))return!1;return!0},ut=Phaser.Geom.Rectangle,pt={enableBoardLayer(t){return this.layer||(void 0!==t&&!0!==t||(t=this.scene.add.layer()),this.layer=t),this},resetBoardMask(){return this.activateAreaMaskGameObject||(this.activateAreaMaskGameObject=this.scene.make.graphics().setVisible(!1),this.activateAreaMask=this.activateAreaMaskGameObject.createGeometryMask(),this.enableBoardLayer(),this.layer.setMask(this.activateAreaMask)),this.activateAreaMaskGameObject.clear().fillStyle(16777215).fillRectShape(this.getBoardBounds()),this}},vt={setActivateBoardWidth(t){return this.setBoardWidth(t),this},setActivateBoardHeight(t){return this.setBoardHeight(2*t),this},isAtActivateArea(t,e){var s=this.board.height;return e>=s/2&&e<=s-1}},mt={setMatchAcceptList(t){return this.matchAcceptList=t,this},setMatchIgnoreList(t){return this.matchIgnoreList=t,this}},bt={getSymbolAt(t,e){var s;return(s="number"==typeof t?this.board.tileXYZToChess(t,e,this.chessTileZ):t)?s.getData("symbol"):null},setSymbolAt(t,e,s){var i;return"number"==typeof t?i=this.board.tileXYZToChess(t,e,this.chessTileZ):(i=t,s=e),i&&i.setData("symbol",s),this}},gt={clear:function(){return this.board.removeAllChess(!0),this},init:function(){return this},reset:function(){var t=this.board;t.removeAllChess(!0);var e=this.initSymbols;this.initSymbols=void 0;var s=t.height;e&&e.length===s?this.fillAllRows(e):(this.fillActivateArea(e),this.fillPrepareRows()),this.breakMatch3()},createChess:function(t,e,s){this.scene;var i,r=this.board,h=this.chessCallbackScope,a=rt(r,t,e,s,h);return(i=h?this.chessCreateCallback.call(h,r):this.chessCreateCallback(r)).setData("swappable",!0),i.setData("clickable",!1),i.setData("symbol",void 0).setData("symbol",a),r.addChess(i,t,e,this.chessTileZ,!0),i.rexMoveTo=this.rexBoard.add.moveTo(i,this.chessMoveTo),this.layer&&this.layer.add(i),i},fillActivateArea:function(t){for(var e=void 0!==t,s=this.board,i=s.height,r=i/2,h=i-1,a=this.chessTileZ,n=r;n<=h;n++)for(var o=0,l=s.width;o<l;o++)if(!s.contains(o,n,a)){var c=this.candidateSymbols;if(e){var d=t[n-r][o];"?"!==d&&(c=d)}this.createChess(o,n,c)}},fillPrepareRows:function(){for(var t=this.board,e=t.height/2-1,s=this.chessTileZ,i=0;i<=e;i++)for(var r=0,h=t.width;r<h;r++)t.contains(r,i,s)||this.createChess(r,i,this.candidateSymbols)},fillAllRows:function(t){var e=this.board;e.removeAllChess(!0);for(var s=e.height-1,i=0;i<=s;i++)for(var r=0,h=e.width;r<h;r++){var a=this.candidateSymbols,n=t[i-0][r];"?"!==n&&(a=n),this.createChess(r,i,a)}},breakMatch3:function(){var t=this.chessTileZ,e=this.chessCallbackScope,s=this.candidateSymbols;at.call(this),nt.call(this,3,(function(i,r){for(var h=ot(i.tileXY),a=r.tileXYZToChess(h.x,h.y,t),n=r.getNeighborChess(a,null),o=[],l=0,c=n.length;l<c;l++)o.push(n[l].getData("symbol"));var d=rt(r,h.x,h.y,s,e,o);null!=d&&a.setData("symbol",d)}))},inputTest:function(){var t=this.match,e=this.board,s=e.grid.halfDirections;at.call(this);for(var i,r,h,a=this.chessTileZ,n={},o=0,l=e.height;o<l;o++)for(var c=0,d=e.width;c<d;c++)if(this.isAtActivateArea(c,o)){if((r=e.tileXYZToChess(c,o,a)).getData("clickable"))return!0;if(r.getData("swappable")){n.x=c,n.y=o;for(var u=0,p=s.length;u<p;u++)if(i=e.getNeighborTileXY(n,u),this.isAtActivateArea(i.x,i.y)&&e.tileXYZToChess(i.x,i.y,a).getData("swappable")&&(ct(t,n,i),h=lt.call(this,3),ct(t,n,i),h))return!0}}return!1},getAllMatch:function(){at.call(this);for(var t=this,e=[],s=5;s>=3;s--)nt.call(this,s,(function(s,i){for(var r=new Set(i.tileXYArrayToChessArray(s.tileXY,t.chessTileZ)),h=0,a=e.length;h<a;h++)if(dt(e[h],r))return;e.push(r)}));return e},dumpSymbols:function(){for(var t=this.board,e=this.chessTileZ,s=(t=this.board).height-1,i=[],r=0;r<=s;r++){var h=[];i.push(h);for(var a=0,n=t.width;a<n;a++){var o=t.tileXYZToChess(a,r,e),l=null==o?null:o.getData("symbol");h.push(l)}}return i},getBoardBounds:function(t){void 0===t&&(t=new ut);var e=this.board,s=e.grid,i=e.tileXYToWorldXY(0,e.height/2),r=i.x-s.width/2,h=i.y-s.height/2,a=this.activateBoardWidth*s.width,n=this.activateBoardHeight*s.height;return t.setTo(r,h,a,n),t}};Object.assign(gt,st,pt,vt,mt,bt);var ft=function(t){var e=function(t){return(t=i(t))?t.sys.renderer:null}(t);return!!e&&!!e.gl};Phaser.Filters.Mask;const yt=Phaser.Utils.Objects.GetValue;class Et{constructor(t,e){this.scene=t,this.rexBoard=t[yt(e,"rexBoard","rexBoard")];var s=yt(e,"board",{});if(s.hasOwnProperty("grid"))this.board=this.rexBoard.add.board(s);else{var i=yt(s,"x",0),r=yt(s,"y",0),h=yt(s,"cellSize",0),a=yt(s,"cellWidth",h),n=yt(s,"cellHeight",h),o=s.width,l=s.height;this.board=this.rexBoard.add.board({grid:{x:i+a/2,y:r+n/2-l*n,cellWidth:a,cellHeight:n}}),this.setActivateBoardWidth(o).setActivateBoardHeight(l)}var c=e.match||{};this.matchAcceptList=c.accept,delete c.accept,this.matchIgnoreList=c.ignore,delete c.ignore,this.match=this.rexBoard.add.match(c),this.match.setBoard(this.board),this.initSymbols=yt(e,"initSymbols");var d=e.chess;this.chessTileZ=yt(d,"tileZ",1),this.candidateSymbols=d.symbols,this.chessCallbackScope=d.scope,this.chessCreateCallback=d.create,this.chessMoveTo=d.moveTo||{},this.chessMoveTo.occupiedTest=!0,this.activateAreaMaskGameObject=void 0,this.layer=void 0;var u=yt(e,"layer",!1);u&&this.enableBoardLayer(u),yt(e,"mask",!0)&&this.resetBoardMask()}shutdown(){return this.match.destroy(),this.board.destroy(),this.activateAreaMaskGameObject&&(function(t){if(t.mask){if(ft(t)){var e=t.filters.external.list,s=e.indexOf(t.mask);e.splice(s,1)}else if(!t.clearMask)return;t.mask=null}}(this.layer),this.activateAreaMaskGameObject.destroy()),this.layer&&this.layer.destroy(),this.board=void 0,this.match=void 0,this.initSymbols=void 0,this.candidateSymbols=void 0,this.chessCallbackScope=void 0,this.chessCreateCallback=void 0,this.chessMoveTo=void 0,this}destroy(){return this.shutdown(),this}setBoardWidth(t){return this.board.setBoardWidth(t),this}setBoardHeight(t){return this.board.setBoardHeight(t),this}get activateBoardWidth(){return this.board.width}get activateBoardHeight(){return this.board.height/2}setInitSymbols(t){return this.initSymbols=t,this}chessToTileXYZ(t){return this.board.chessToTileXYZ(t)}worldXYToChess(t,e){return this.board.worldXYToChess(t,e,this.chessTileZ)}tileXYToChess(t,e){return this.board.tileXYZToChess(t,e,this.chessTileZ)}}Object.assign(Et.prototype,gt);const wt=Phaser.Utils.Objects.GetValue;class Tt{constructor(t,e){this.bejeweled=t,this.scene=t.scene,this.setEnable(wt(e,"input.enable",!0)),this.boot()}boot(){this.scene.input.on("pointerdown",this.selectChess1,this).on("pointermove",this.selectChess2,this).on("pointerup",this.clickChess,this)}shutdown(){this.scene.input.off("pointerdown",this.selectChess1,this).off("pointermove",this.selectChess2,this).off("pointerup",this.clickChess,this),this.bejeweled=void 0,this.scene=void 0}destroy(){return this.shutdown(),this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}selectChess1(t){if(!this.enable)return this;var e=this.bejeweled.worldXYToChess(t.worldX,t.worldY);e&&this.bejeweled.selectChess1(e)}selectChess2(t){if(!this.enable)return this;if(t.isDown){var e=this.bejeweled.worldXYToChess(t.worldX,t.worldY);e&&e!==this.bejeweled.getSelectedChess1()&&this.bejeweled.selectChess2(e)}}clickChess(t){if(!this.enable)return this;var e=this.bejeweled.worldXYToChess(t.worldX,t.worldY);e&&e===this.bejeweled.getSelectedChess1()&&this.bejeweled.clickChess(e)}}class Ct{constructor(t,e){this.setCompleteCallback(t,e),this.events=new Set}shutdown(){return this.setCompleteCallback(void 0,void 0),this.events.clear(),this.event=void 0,this}destroy(){return this.shutdown(),this}setCompleteCallback(t,e){return this.completeCallback=t,this.scope=e,this}waitCallback(){var t=this,e=function(){t.remove(e)};return this.events.add(e),e}waitEvent(t,e){return t.once(e,this.waitCallback()),this}remove(t){return this.events.delete(t),this.noWaitEvent&&(this.scope?this.completeCallback.call(this.scope):this.completeCallback()),this}clear(){return this.events.clear(),this}get noWaitEvent(){return 0===this.events.size}}var St={getSelectedChess1(){return this.mainState.selectedChess1},getSelectedChess2(){return this.mainState.selectedChess2},selectChess1(t){return this.mainState.selectChess1(t),this},selectChess2(t){return this.mainState.selectChess2(t),this},clickChess(t){return this.mainState.clickChess(t),this},setInputEnable(t){return this.input&&this.input.setEnable(t),this},isAwaitingInput(){return this.mainState.isAwaitingInput()}},At={setActivateBoardSize(t,e){return this.boardWrapper.setActivateWidth(t).setActivateHeight(e),this},getChessMoveTo:t=>t?t.rexMoveTo:void 0,getChessTileZ(){return this.boardWrapper.chessTileZ},chessToTileXY(t){return this.boardWrapper.chessToTileXYZ(t)},worldXYToChess(t,e){return this.boardWrapper.worldXYToChess(t,e)},tileXYToChess(t,e){return this.boardWrapper.tileXYToChess(t,e)},getNeighborChessAtAngle(t,e){return this.boardWrapper.getNeighborChessAtAngle(t,e)},getNeighborChessAtDirection(t,e){return this.boardWrapper.getNeighborChessAtDirection(t,e)},getChessArray(t){return this.boardWrapper.getChessArray(t)},getChessArrayAtTileX(t,e){return this.boardWrapper.getChessArrayAtTileX(t,e)},getChessArrayAtTileY(t,e){return this.boardWrapper.getChessArrayAtTileY(t,e)},getChessArrayWithinTileRadius(t,e,s,i,r){return this.boardWrapper.getChessArrayWithinTileRadius(t,e,s,i,r)},getChessArrayWithSymbol(t,e){return this.boardWrapper.getChessArrayWithSymbol(t,e)},createChess(t,e,s){return this.boardWrapper.createChess(t,e,s)},getSymbolAt(t,e){return this.boardWrapper.getSymbolAt(t,e)},setSymbolAt(t,e,s){this.boardWrapper.setSymbolAt(t,e,s)},dumpSymbols(){return this.boardWrapper.dumpSymbols()},loadSymbols(t){return this.boardWrapper.setInitSymbols(t),this.mainState.goto("RESET"),this},setEliminatingChess(t){return Array.isArray(t)||(t=[t]),this.mainState.setEliminatingChess(t),this},setMatchAcceptList(t){return this.boardWrapper.setMatchAcceptList(t),this},setMatchIgnoreList(t){return this.boardWrapper.setMatchIgnoreList(t),this},getBoardBounds(t){return this.boardWrapper.getBoardBounds(t)},getBoard(){return this.boardWrapper.board},getMatch(){return this.boardWrapper.match},getLayer(){return this.boardWrapper.layer}},_t={waitEvent(t,e){return void 0===e&&(e="complete"),this.waitEvents.waitEvent(t,e),this},waitCallback(){return this.waitEvents.waitCallback()},isWaitingEvent(){return!this.waitEvents.noWaitEvent}};const xt=Phaser.Data.DataManager;var kt={destroyDataManager(){this.data&&(this.data.destroy(),this.data=void 0)},setDataEnabled(){return this.data||(this.data=new xt(this)),this},setData(t,e){return this.data||(this.data=new xt(this)),this.data.set(t,e),this},incData(t,e){return this.data||(this.data=new xt(this)),this.data.inc(t,e),this},toggleData(t){return this.data||(this.data=new xt(this)),this.data.toggle(t),this},getData(t){return this.data||(this.data=new xt(this)),this.data.get(t)}},Lt={start(){return this.mainState.goto("START"),this},runMatch3(){return this.mainState.runMatch3(),this}},Mt={intersection:function(t,e){return t.size>e.size&&([t,e]=[e,t]),new Set([...t].filter((t=>e.has(t))))}};const jt=Phaser.Utils.Objects.GetValue;class Pt extends n{constructor(t,e){super(t,e),this.rexBoard=t[jt(e,"rexBoard","rexBoard")],this.boardWrapper=new Et(t,e);var s=jt(e,"input",!0);this.input=s?new Tt(this,e):void 0,this.waitEvents=new Ct,this.mainState=new et(this,e),this.boot()}boot(){this.scene.events.once("shutdown",this.destroy,this)}shutdown(t){return super.shutdown(t),this.input&&this.input.destroy(),this.boardWrapper.destroy(),this.mainState.destroy(),this.waitEvents.destroy(),this.destroyDataManager(),this.boardWrapper=void 0,this.mainState=void 0,this.input=void 0,this.waitEvents=void 0,this}destroy(t){return this.emit("destroy"),super.destroy(t),this}}return Object.assign(Pt.prototype,St,At,_t,kt,Lt,Mt),Pt},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexbejeweled=e();