},reset:function(){this.first=null,this.last=null,this.next=null,this.prev=null,this.total=0},remove:function(a){return1===this.total?(this.reset(),void(a.next=a.prev=null)):(a===this.first?this.first=this.first.next:a===this.last&&(this.last=this.last.prev),a.prev&&(a.prev.next=a.next),a.next&&(a.next.prev=a.prev),a.next=a.prev=null,null===this.first&&(this.last=null),voidthis.total--)},callAll:function(a){if(this.first&&this.last){varb=this.first;dob&&b[a]&&b[a].call(b),b=b.next;while(b!=this.last.next)}}},b.LinkedList.prototype.constructor=b.LinkedList,b.ArrayList=function(){this.total=0,this.position=0,this.list=[]},b.ArrayList.prototype={add:function(a){returnthis.exists(a)||(this.list.push(a),this.total++),a},getIndex:function(a){returnthis.list.indexOf(a)},exists:function(a){returnthis.list.indexOf(a)>-1},reset:function(){this.list.length=0,this.total=0},remove:function(a){varb=this.list.indexOf(a);returnb>-1?(this.list.splice(b,1),this.total--,a):void0},callAll:function(a){for(varb=Array.prototype.splice.call(arguments,1),c=this.list.length;c--;)this.list[c]&&this.list[c][a]&&this.list[c][a].apply(this.list[c],b)}},Object.defineProperty(b.ArrayList.prototype,"first",{get:function(){returnthis.position=0,this.total>0?this.list[0]:null}}),Object.defineProperty(b.ArrayList.prototype,"next",{get:function(){returnthis.position<this.total?(this.position++,this.list[this.position]):null}}),b.ArrayList.prototype.constructor=b.ArrayList,b.Signal=function(){this._bindings=[],this._prevParams=null;vara=this;this.dispatch=function(){b.Signal.prototype.dispatch.apply(a,arguments)}},b.Signal.prototype={memorize:!1,_shouldPropagate:!0,active:!0,validateListener:function(a,b){if("function"!=typeofa)thrownewError("listener is a required param of {fn}() and should be a Function.".replace("{fn}",b))},_registerListener:function(a,c,d,e){varf,g=this._indexOfListener(a,d);if(-1!==g){if(f=this._bindings[g],f.isOnce()!==c)thrownewError("You cannot add"+(c?"":"Once")+"() then add"+(c?"Once":"")+"() the same listener without removing the relationship first.")}elsef=newb.SignalBinding(this,a,c,d,e),this._addBinding(f);returnthis.memorize&&this._prevParams&&f.execute(this._prevParams),f},_addBinding:function(a){varb=this._bindings.length;do--b;while(this._bindings[b]&&a._priority<=this._bindings[b]._priority);this._bindings.splice(b+1,0,a)},_indexOfListener:function(a,b){for(varc,d=this._bindings.length;d--;)if(c=this._bindings[d],c._listener===a&&c.context===b)returnd;return-1},has:function(a,b){return-1!==this._indexOfListener(a,b)},add:function(a,b,c){returnthis.validateListener(a,"add"),this._registerListener(a,!1,b,c)},addOnce:function(a,b,c){returnthis.validateListener(a,"addOnce"),this._registerListener(a,!0,b,c)},remove:function(a,b){this.validateListener(a,"remove");varc=this._indexOfListener(a,b);return-1!==c&&(this._bindings[c]._destroy(),this._bindings.splice(c,1)),a},removeAll:function(){for(vara=this._bindings.length;a--;)this._bindings[a]._destroy();this._bindings.length=0},getNumListeners:function(){returnthis._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(){if(this.active){vara,b=Array.prototype.slice.call(arguments),c=this._bindings.length;if(this.memorize&&(this._prevParams=b),c){a=this._bindings.slice(),this._shouldPropagate=!0;doc--;while(a[c]&&this._shouldPropagate&&a[c].execute(b)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),deletethis._bindings,deletethis._prevParams},toString:function(){return"[Phaser.Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}},b.Signal.prototype.constructor=b.Signal,b.SignalBinding=function(a,b,c,d,e){this._listener=b,this._isOnce=c,this.context=d,this._signal=a,this._priority=e||0},b.SignalBinding.prototype={active:!0,params:null,execute:function(a){varb,c;returnthis.active&&this._listener&&(c=this.params?this.params.concat(a):a,b=this._listener.apply(this.context,c),this._isOnce&&this.detach()),b},detach:function(){returnthis.isBound()?this._signal.remove(th
if(this.currentAnim.isPlaying===!1)returnthis.currentAnim.paused=!1,this.currentAnim.play(b,c,d)}},stop:function(a,b){"undefined"==typeofb&&(b=!1),"string"==typeofa?this._anims[a]&&(this.currentAnim=this._anims[a],this.currentAnim.stop(b)):this.currentAnim&&this.currentAnim.stop(b)},update:function(){returnthis.updateIfVisible&&!this.sprite.visible?!1:this.currentAnim&&this.currentAnim.update()===!0?(this.currentFrame=this.currentAnim.currentFrame,!0):!1},getAnimation:function(a){return"string"==typeofa&&this._anims[a]?this._anims[a]:null},refreshFrame:function(){this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1)},destroy:function(){vara=null;for(varainthis._anims)this._anims.hasOwnProperty(a)&&this._anims[a].destroy();this._anims={},this._frameData=null,this._frameIndex=0,this.currentAnim=null,this.currentFrame=null}},b.AnimationManager.prototype.constructor=b.AnimationManager,Object.defineProperty(b.AnimationManager.prototype,"frameData",{get:function(){returnthis._frameData}}),Object.defineProperty(b.AnimationManager.prototype,"frameTotal",{get:function(){returnthis._frameData?this._frameData.total:-1}}),Object.defineProperty(b.AnimationManager.prototype,"paused",{get:function(){returnthis.currentAnim.isPaused},set:function(a){this.currentAnim.paused=a}}),Object.defineProperty(b.AnimationManager.prototype,"frame",{get:function(){returnthis.currentFrame?this._frameIndex:void0},set:function(a){"number"==typeofa&&this._frameData&&null!==this._frameData.getFrame(a)&&(this.currentFrame=this._frameData.getFrame(a),this.currentFrame&&(this._frameIndex=a,this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1)))}}),Object.defineProperty(b.AnimationManager.prototype,"frameName",{get:function(){returnthis.currentFrame?this.currentFrame.name:void0},set:function(a){"string"==typeofa&&this._frameData&&null!==this._frameData.getFrameByName(a)?(this.currentFrame=this._frameData.getFrameByName(a),this.currentFrame&&(this._frameIndex=this.currentFrame.index,this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1))):console.warn("Cannot set frameName: "+a)}}),b.Animation=function(a,c,d,e,f,g,h){this.game=a,this._parent=c,this._frameData=e,this.name=d,this._frames=[],this._frames=this._frames.concat(f),this.delay=1e3/g,this.loop=h,this.loopCount=0,this.killOnComplete=!1,this.isFinished=!1,this.isPlaying=!1,this.isPaused=!1,this._pauseStartTime=0,this._frameIndex=0,this._frameDiff=0,this._frameSkip=1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.onStart=newb.Signal,this.onComplete=newb.Signal,this.onLoop=newb.Signal,this.game.onPause.add(this.onPause,this),this.game.onResume.add(this.onResume,this)},b.Animation.prototype={play:function(a,b,c){return"number"==typeofa&&(this.delay=1e3/a),"boolean"==typeofb&&(this.loop=b),"undefined"!=typeofc&&(this.killOnComplete=c),this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.now,this._timeNextFrame=this.game.time.now+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1),this._parent.events.onAnimationStart.dispatch(this._parent,this),this.onStart.dispatch(this._parent,this),this},restart:function(){this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.now,this._timeNextFrame=this.game.time.now+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.onStart.dispatch(this._parent,this)},setFrame:function(a,b){varc;if("undefined"==typeofb&&(b=!1),"string"==typeofa)for(vard=0;d<this._frames.length;d++)this._frameData.getFrame(this._fra
break;case"textureatlas":if(null==c.atlasURL)this.game.cache.addTextureAtlas(c.key,c.url,c.data,c.atlasData,c.format);else{if(d=!1,this._xhr.open("GET",this.baseURL+c.atlasURL,!0),this._xhr.responseType="text",c.format==b.Loader.TEXTURE_ATLAS_JSON_ARRAY||c.format==b.Loader.TEXTURE_ATLAS_JSON_HASH)this._xhr.onload=function(){returne.jsonLoadComplete(a)};else{if(c.format!=b.Loader.TEXTURE_ATLAS_XML_STARLING)thrownewError("Phaser.Loader. Invalid Texture Atlas format: "+c.format);this._xhr.onload=function(){returne.xmlLoadComplete(a)}}this._xhr.onerror=function(){returne.dataLoadError(a)},this._xhr.send()}break;case"bitmapfont":null==c.xmlURL?this.game.cache.addBitmapFont(c.key,c.url,c.data,c.xmlData,c.xSpacing,c.ySpacing):(d=!1,this._xhr.open("GET",this.baseURL+c.xmlURL,!0),this._xhr.responseType="text",this._xhr.onload=function(){returne.xmlLoadComplete(a)},this._xhr.onerror=function(){returne.dataLoadError(a)},this._xhr.send());break;case"audio":if(this.game.sound.usingWebAudio){if(c.data=this._xhr.response,this.game.cache.addSound(c.key,c.url,c.data,!0,!1),c.autoDecode){varf=this,g=c.key;this.game.cache.updateSound(g,"isDecoding",!0),this.game.sound.context.decodeAudioData(c.data,function(a){a&&(f.game.cache.decodedSound(g,a),f.game.sound.onSoundDecode.dispatch(g,f.game.cache.getSound(g)))})}}elsec.data.removeEventListener("canplaythrough",b.GAMES[this.game.id].load.fileComplete),this.game.cache.addSound(c.key,c.url,c.data,!1,!0);break;case"text":c.data=this._xhr.responseText,this.game.cache.addText(c.key,c.url,c.data);break;case"physics":varh=JSON.parse(this._xhr.responseText);this.game.cache.addPhysicsData(c.key,c.url,h,c.format);break;case"script":c.data=document.createElement("script"),c.data.language="javascript",c.data.type="text/javascript",c.data.defer=!1,c.data.text=this._xhr.responseText,document.head.appendChild(c.data),c.callback&&(c.data=c.callback.call(c.callbackContext,c.key,this._xhr.responseText));break;case"binary":c.data=c.callback?c.callback.call(c.callbackContext,c.key,this._xhr.response):this._xhr.response,this.game.cache.addBinary(c.key,c.data)}d&&this.nextFile(a,!0)},jsonLoadComplete:function(a){if(!this._fileList[a])returnvoidconsole.warn("Phaser.Loader jsonLoadComplete invalid index "+a);varb=this._fileList[a],c=JSON.parse(this._xhr.responseText);b.loaded=!0,"tilemap"===b.type?this.game.cache.addTilemap(b.key,b.url,c,b.format):"json"===b.type?this.game.cache.addJSON(b.key,b.url,c):this.game.cache.addTextureAtlas(b.key,b.url,b.data,c,b.format),this.nextFile(a,!0)},csvLoadComplete:function(a){if(!this._fileList[a])returnvoidconsole.warn("Phaser.Loader csvLoadComplete invalid index "+a);varb=this._fileList[a],c=this._xhr.responseText;b.loaded=!0,this.game.cache.addTilemap(b.key,b.url,c,b.format),this.nextFile(a,!0)},dataLoadError:function(a){varb=this._fileList[a];b.loaded=!0,b.error=!0,console.warn("Phaser.Loader dataLoadError: "+b.key),this.nextFile(a,!0)},xmlLoadComplete:function(a){varb,c=this._xhr.responseText;try{if(window.DOMParser){vard=newDOMParser;b=d.parseFromString(c,"text/xml")}elseb=newActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(c)}catch(e){b=void0}if(!b||!b.documentElement||b.getElementsByTagName("parsererror").length)thrownewError("Phaser.Loader. Invalid XML given");varf=this._fileList[a];f.loaded=!0,"bitmapfont"==f.type?this.game.cache.addBitmapFont(f.key,f.url,f.data,b,f.xSpacing,f.ySpacing):"textureatlas"==f.type&&this.game.cache.addTextureAtlas(f.key,f.url,f.data,b,f.format),this.nextFile(a,!0)},nextFile:function(a,b){this.progressFloat+=this._progressChunk,this.progress=Math.round(this.progressFloat),this.progress>100&&(this.progress=100),null!==this.preloadSprite&&(0===this.preloadSprite.direction?(this.preloadSprite.rect.width=Math.floor(this.preloadSprite.width/100*this.progress),this.preloadSprite.sprite.crop(this.preloadSprite.rect)):(this.preloadSprite.rect.height=Math.floor(this.preloadSprite.height/100*this.progress),this.preloadSprite.sprite.crop(this.preloadSprite.rect))),this.onFileComplete.dispatch(this.progress,this._fileL
returnd=d.concat("Alpha: "+c.alpha+" Red: "+c.red+" Green: "+c.green+" Blue: "+c.blue)+"\n"},RGBtoHexstring:function(a){varc=b.Color.getRGB(a);return"0x"+b.Color.colorToHexstring(c.alpha)+b.Color.colorToHexstring(c.red)+b.Color.colorToHexstring(c.green)+b.Color.colorToHexstring(c.blue)},RGBtoWebstring:function(a){varc=b.Color.getRGB(a);return"#"+b.Color.colorToHexstring(c.red)+b.Color.colorToHexstring(c.green)+b.Color.colorToHexstring(c.blue)},colorToHexstring:function(a){varb="0123456789ABCDEF",c=a%16,d=(a-c)/16,e=b.charAt(d)+b.charAt(c);returne}},b.Physics=function(a,b){b=b||{},this.game=a,this.config=b,this.arcade=null,this.p2=null,this.ninja=null,this.box2d=null,this.chipmunk=null,this.parseConfig()},b.Physics.ARCADE=0,b.Physics.P2JS=1,b.Physics.NINJA=2,b.Physics.BOX2D=3,b.Physics.CHIPMUNK=5,b.Physics.prototype={parseConfig:function(){this.config.hasOwnProperty("arcade")&&this.config.arcade!==!0||!b.Physics.hasOwnProperty("Arcade")||(this.arcade=newb.Physics.Arcade(this.game),this.game.time.deltaCap=.2),this.config.hasOwnProperty("ninja")&&this.config.ninja===!0&&b.Physics.hasOwnProperty("Ninja")&&(this.ninja=newb.Physics.Ninja(this.game)),this.config.hasOwnProperty("p2")&&this.config.p2===!0&&b.Physics.hasOwnProperty("P2")&&(this.p2=newb.Physics.P2(this.game,this.config))},startSystem:function(a){if(a===b.Physics.ARCADE?this.arcade=newb.Physics.Arcade(this.game):a===b.Physics.P2JS&&(this.p2=newb.Physics.P2(this.game,this.config)),a===b.Physics.NINJA)this.ninja=newb.Physics.Ninja(this.game);else{if(a===b.Physics.BOX2D&&null===this.box2d)thrownewError("The Box2D physics system has not been implemented yet.");if(a===b.Physics.CHIPMUNK&&null===this.chipmunk)thrownewError("The Chipmunk physics system has not been implemented yet.")}},enable:function(a,c,d){"undefined"==typeofc&&(c=b.Physics.ARCADE),"undefined"==typeofd&&(d=!1),c===b.Physics.ARCADE?this.arcade.enable(a):c===b.Physics.P2JS&&this.p2?this.p2.enable(a,d):c===b.Physics.NINJA&&this.ninja&&this.ninja.enableAABB(a)},preUpdate:function(){this.p2&&this.p2.preUpdate()},update:function(){this.p2&&this.p2.update()},setBoundsToWorld:function(){this.arcade&&this.arcade.setBoundsToWorld(),this.ninja&&this.ninja.setBoundsToWorld(),this.p2&&this.p2.setBoundsToWorld()},clear:function(){this.p2&&this.p2.clear()},destroy:function(){this.p2&&this.p2.destroy(),this.arcade=null,this.ninja=null,this.p2=null}},b.Physics.prototype.constructor=b.Physics,b.Physics.Arcade=function(a){this.game=a,this.gravity=newb.Point,this.bounds=newb.Rectangle(0,0,a.world.width,a.world.height),this.checkCollision={up:!0,down:!0,left:!0,right:!0},this.maxObjects=10,this.maxLevels=4,this.OVERLAP_BIAS=4,this.TILE_BIAS=16,this.forceX=!1,this.quadTree=newb.QuadTree(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels),this._overlap=0,this._maxOverlap=0,this._velocity1=0,this._velocity2=0,this._newVelocity1=0,this._newVelocity2=0,this._average=0,this._mapData=[],this._result=!1,this._total=0,this._angle=0,this._dx=0,this._dy=0},b.Physics.Arcade.prototype.constructor=b.Physics.Arcade,b.Physics.Arcade.prototype={setBounds:function(a,b,c,d){this.bounds.setTo(a,b,c,d)},setBoundsToWorld:function(){this.bounds.setTo(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height)},enable:function(a,c){"undefined"==typeofc&&(c=!0);vard=1;if(Array.isArray(a))for(d=a.length;d--;)a[d]instanceofb.Group?this.enable(a[d].children,c):(this.enableBody(a[d]),c&&a[d].hasOwnProperty("children")&&a[d].children.length>0&&this.enable(a[d],!0));elseainstanceofb.Group?this.enable(a.children,c):(this.enableBody(a),c&&a.hasOwnProperty("children")&&a.children.length>0&&this.enable(a.children,!0))},enableBody:function(a){a.hasOwnProperty("body")&&null===a.body&&(a.body=newb.Physics.Arcade.Body(a))},updateMotion:function(a){this._velocityDelta=this.computeVelocity(0,a,a.angularVelocity,a.angularAcceleration,a.angularDrag,a.maxAngular)-a.angularVelocity,a.angularVelocity+=this
},b.Tile.prototype={containsPoint:function(a,b){return!(a<this.worldX||b<this.worldY||a>this.right||b>this.bottom)},intersects:function(a,b,c,d){returnc<=this.worldX?!1:d<=this.worldY?!1:a>=this.worldX+this.width?!1:b>=this.worldY+this.height?!1:!0},setCollisionCallback:function(a,b){this.collisionCallback=a,this.collisionCallbackContext=b},destroy:function(){this.collisionCallback=null,this.collisionCallbackContext=null,this.properties=null},setCollision:function(a,b,c,d){this.collideLeft=a,this.collideRight=b,this.collideUp=c,this.collideDown=d},resetCollision:function(){this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1},isInteresting:function(a,b){returna&&b?this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.faceTop||this.faceBottom||this.faceLeft||this.faceRight||this.collisionCallback:a?this.collideLeft||this.collideRight||this.collideUp||this.collideDown:b?this.faceTop||this.faceBottom||this.faceLeft||this.faceRight:!1},copy:function(a){this.index=a.index,this.alpha=a.alpha,this.properties=a.properties,this.collideUp=a.collideUp,this.collideDown=a.collideDown,this.collideLeft=a.collideLeft,this.collideRight=a.collideRight,this.collisionCallback=a.collisionCallback,this.collisionCallbackContext=a.collisionCallbackContext}},b.Tile.prototype.constructor=b.Tile,Object.defineProperty(b.Tile.prototype,"collides",{get:function(){returnthis.collideLeft||this.collideRight||this.collideUp||this.collideDown}}),Object.defineProperty(b.Tile.prototype,"canCollide",{get:function(){returnthis.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}}),Object.defineProperty(b.Tile.prototype,"left",{get:function(){returnthis.worldX}}),Object.defineProperty(b.Tile.prototype,"right",{get:function(){returnthis.worldX+this.width}}),Object.defineProperty(b.Tile.prototype,"top",{get:function(){returnthis.worldY}}),Object.defineProperty(b.Tile.prototype,"bottom",{get:function(){returnthis.worldY+this.height}}),b.Tilemap=function(a,c,d,e,f,g){this.game=a,this.key=c;varh=b.TilemapParser.parse(this.game,c,d,e,f,g);null!==h&&(this.width=h.width,this.height=h.height,this.tileWidth=h.tileWidth,this.tileHeight=h.tileHeight,this.orientation=h.orientation,this.format=h.format,this.version=h.version,this.properties=h.properties,this.widthInPixels=h.widthInPixels,this.heightInPixels=h.heightInPixels,this.layers=h.layers,this.tilesets=h.tilesets,this.tiles=h.tiles,this.objects=h.objects,this.collideIndexes=[],this.collision=h.collision,this.images=h.images,this.currentLayer=0,this.debugMap=[],this._results=[],this._tempA=0,this._tempB=0)},b.Tilemap.CSV=0,b.Tilemap.TILED_JSON=1,b.Tilemap.prototype={create:function(a,b,c,d,e,f){return"undefined"==typeoff&&(f=this.game.world),this.width=b,this.height=c,this.setTileSize(d,e),this.layers.length=0,this.createBlankLayer(a,b,c,d,e,f)},setTileSize:function(a,b){this.tileWidth=a,this.tileHeight=b,this.widthInPixels=this.width*a,this.heightInPixels=this.height*b},addTilesetImage:function(a,c,d,e,f,g,h){if("undefined"==typeofd&&(d=this.tileWidth),"undefined"==typeofe&&(e=this.tileHeight),"undefined"==typeoff&&(f=0),"undefined"==typeofg&&(g=0),"undefined"==typeofh&&(h=0),0===d&&(d=32),0===e&&(e=32),"undefined"==typeofc){if("string"!=typeofa)returnnull;if(c=a,!this.game.cache.checkImageKey(c))returnconsole.warn('Phaser.Tilemap.addTilesetImage: Invalid image key given: "'+c+'"'),null}if("string"==typeofa&&(a=this.getTilesetIndex(a),null===a&&this.format===b.Tilemap.TILED_JSON))returnconsole.warn('Phaser.Tilemap.addTilesetImage: No data found in the JSON matching the tileset name: "'+c+'"'),null;if(this.tilesets[a])returnthis.tilesets[a].setImage(this.game.cache.getImage(c)),this.tilesets[a];vari=newb.Tileset(c,h,d,e,f,g,{});i.setImage(this.game.cache.getImage(c)),this.tilesets.push(i);for(varj=this.tilesets.length-1,k=f,l=f,m=0,n=0,o=0,p=h;p<h+i.total&&(this.tiles[p]=[k,l,j],k+=d+g,m++,m!==i.total)&&(n++,n!==i.columns||(k=f,l+=e+g,n=0,o+