},setTo:function(a,b){returnthis.x=a||0,this.y=b||(0!==b?this.x:0),this},set:function(a,b){returnthis.x=a||0,this.y=b||(0!==b?this.x:0),this},add:function(a,b){returnthis.x+=a,this.y+=b,this},subtract:function(a,b){returnthis.x-=a,this.y-=b,this},multiply:function(a,b){returnthis.x*=a,this.y*=b,this},divide:function(a,b){returnthis.x/=a,this.y/=b,this},clampX:function(a,b){returnthis.x=c.Math.clamp(this.x,a,b),this},clampY:function(a,b){returnthis.y=c.Math.clamp(this.y,a,b),this},clamp:function(a,b){returnthis.x=c.Math.clamp(this.x,a,b),this.y=c.Math.clamp(this.y,a,b),this},clone:function(a){return"undefined"==typeofa||null===a?a=newc.Point(this.x,this.y):a.setTo(this.x,this.y),a},copyTo:function(a){returna.x=this.x,a.y=this.y,a},distance:function(a,b){returnc.Point.distance(this,a,b)},equals:function(a){returna.x===this.x&&a.y===this.y},angle:function(a,b){return"undefined"==typeofb&&(b=!1),b?c.Math.radToDeg(Math.atan2(a.y-this.y,a.x-this.x)):Math.atan2(a.y-this.y,a.x-this.x)},rotate:function(a,b,d,e,f){returnc.Point.rotate(this,a,b,d,e,f)},getMagnitude:function(){returnMath.sqrt(this.x*this.x+this.y*this.y)},getMagnitudeSq:function(){returnthis.x*this.x+this.y*this.y},setMagnitude:function(a){returnthis.normalize().multiply(a,a)},normalize:function(){if(!this.isZero()){vara=this.getMagnitude();this.x/=a,this.y/=a}returnthis},isZero:function(){return0===this.x&&0===this.y},dot:function(a){returnthis.x*a.x+this.y*a.y},cross:function(a){returnthis.x*a.y-this.y*a.x},perp:function(){returnthis.setTo(-this.y,this.x)},rperp:function(){returnthis.setTo(this.y,-this.x)},normalRightHand:function(){returnthis.setTo(-1*this.y,this.x)},floor:function(){returnthis.setTo(Math.floor(this.x),Math.floor(this.y))},ceil:function(){returnthis.setTo(Math.ceil(this.x),Math.ceil(this.y))},toString:function(){return"[{Point (x="+this.x+" y="+this.y+")}]"}},c.Point.prototype.constructor=c.Point,c.Point.add=function(a,b,d){return"undefined"==typeofd&&(d=newc.Point),d.x=a.x+b.x,d.y=a.y+b.y,d},c.Point.subtract=function(a,b,d){return"undefined"==typeofd&&(d=newc.Point),d.x=a.x-b.x,d.y=a.y-b.y,d},c.Point.multiply=function(a,b,d){return"undefined"==typeofd&&(d=newc.Point),d.x=a.x*b.x,d.y=a.y*b.y,d},c.Point.divide=function(a,b,d){return"undefined"==typeofd&&(d=newc.Point),d.x=a.x/b.x,d.y=a.y/b.y,d},c.Point.equals=function(a,b){returna.x===b.x&&a.y===b.y},c.Point.angle=function(a,b){returnMath.atan2(a.y-b.y,a.x-b.x)},c.Point.negative=function(a,b){return"undefined"==typeofb&&(b=newc.Point),b.setTo(-a.x,-a.y)},c.Point.multiplyAdd=function(a,b,d,e){return"undefined"==typeofe&&(e=newc.Point),e.setTo(a.x+b.x*d,a.y+b.y*d)},c.Point.interpolate=function(a,b,d,e){return"undefined"==typeofe&&(e=newc.Point),e.setTo(a.x+(b.x-a.x)*d,a.y+(b.y-a.y)*d)},c.Point.perp=function(a,b){return"undefined"==typeofb&&(b=newc.Point),b.setTo(-a.y,a.x)},c.Point.rperp=function(a,b){return"undefined"==typeofb&&(b=newc.Point),b.setTo(a.y,-a.x)},c.Point.distance=function(a,b,d){vare=c.Math.distance(a.x,a.y,b.x,b.y);returnd?Math.round(e):e},c.Point.project=function(a,b,d){"undefined"==typeofd&&(d=newc.Point);vare=a.dot(b)/b.getMagnitudeSq();return0!==e&&d.setTo(e*b.x,e*b.y),d},c.Point.projectUnit=function(a,b,d){"undefined"==typeofd&&(d=newc.Point);vare=a.dot(b);return0!==e&&d.setTo(e*b.x,e*b.y),d},c.Point.normalRightHand=function(a,b){return"undefined"==typeofb&&(b=newc.Point),b.setTo(-1*a.y,a.x)},c.Point.normalize=function(a,b){"undefined"==typeofb&&(b=newc.Point);vard=a.getMagnitude();return0!==d&&b.setTo(a.x/d,a.y/d),b},c.Point.rotate=function(a,b,d,e,f,g){"undefined"==typeoff&&(f=!1),"undefined"==typeofg&&(g=null),f&&(e=c.Math.degToRad(e)),null===g&&(g=Math.sqrt((b-a.x)*(b-a.x)+(d-a.y)*(d-a.y)));varh=e+Math.atan2(a.y-d,a.x-b);returna.x=b+g*Math.cos(h),a.y=d+g*Math.sin(h),a},c.Point.centroid=function(a,b){if("undefined"==typeofb&&(b=newc.Point),"[object Array]"!==Object.prototype.toString.call(a))thrownewError("Phaser.Point. Parameter 'points' must be an array");vard=a.length;if(1>d)thrownewError("Phaser.
},c.Component.FixedToCamera.prototype={_fixedToCamera:!1,fixedToCamera:{get:function(){returnthis._fixedToCamera},set:function(a){a?(this._fixedToCamera=!0,this.cameraOffset.set(this.x,this.y)):this._fixedToCamera=!1}},cameraOffset:newc.Point},c.Component.Health=function(){},c.Component.Health.prototype={health:1,maxHealth:100,damage:function(a){returnthis.alive&&(this.health-=a,this.health<=0&&this.kill()),this},heal:function(a){returnthis.alive&&(this.health+=a,this.health>this.maxHealth&&(this.health=this.maxHealth)),this}},c.Component.InCamera=function(){},c.Component.InCamera.prototype={inCamera:{get:function(){returnthis.game.world.camera.view.intersects(this._bounds)}}},c.Component.InputEnabled=function(){},c.Component.InputEnabled.prototype={input:null,inputEnabled:{get:function(){returnthis.input&&this.input.enabled},set:function(a){a?null===this.input?(this.input=newc.InputHandler(this),this.input.start()):this.input&&!this.input.enabled&&this.input.start():this.input&&this.input.enabled&&this.input.stop()}}},c.Component.InWorld=function(){},c.Component.InWorld.preUpdate=function(){if((this.autoCull||this.checkWorldBounds)&&(this._bounds.copyFrom(this.getBounds()),this._bounds.x+=this.game.camera.view.x,this._bounds.y+=this.game.camera.view.y,this.autoCull&&(this.game.world.camera.view.intersects(this._bounds)?(this.renderable=!0,this.game.world.camera.totalInView++):this.renderable=!1),this.checkWorldBounds))if(this._outOfBoundsFired&&this.game.world.bounds.intersects(this._bounds))this._outOfBoundsFired=!1,this.events.onEnterBounds$dispatch(this);elseif(!this._outOfBoundsFired&&!this.game.world.bounds.intersects(this._bounds)&&(this._outOfBoundsFired=!0,this.events.onOutOfBounds$dispatch(this),this.outOfBoundsKill))returnthis.kill(),!1;return!0},c.Component.InWorld.prototype={checkWorldBounds:!1,outOfBoundsKill:!1,_outOfBoundsFired:!1,inWorld:{get:function(){returnthis.game.world.bounds.intersects(this.getBounds())}}},c.Component.LifeSpan=function(){},c.Component.LifeSpan.preUpdate=function(){returnthis.lifespan>0&&(this.lifespan-=this.game.time.physicsElapsedMS,this.lifespan<=0)?(this.kill(),!1):!0},c.Component.LifeSpan.prototype={alive:!0,lifespan:0,revive:function(a){return"undefined"==typeofa&&(a=1),this.alive=!0,this.exists=!0,this.visible=!0,"number"==typeofthis.health&&(this.health=a),this.events&&this.events.onRevived$dispatch(this),this},kill:function(){returnthis.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled$dispatch(this),this}},c.Component.LoadTexture=function(){},c.Component.LoadTexture.prototype={customRender:!1,_frame:null,loadTexture:function(a,b,d){b=b||0,(d||"undefined"==typeofd)&&this.animations&&this.animations.stop(),this.key=a,this.customRender=!1;vare=!0,f=!this.texture.baseTexture.scaleMode;if(c.RenderTexture&&ainstanceofc.RenderTexture)this.key=a.key,this.setTexture(a);elseif(c.BitmapData&&ainstanceofc.BitmapData)this.customRender=!0,this.setTexture(a.texture),this.game.cache.getFrameData(a.key,c.Cache.BITMAPDATA)&&(e=!this.animations.loadFrameData(this.game.cache.getFrameData(a.key,c.Cache.BITMAPDATA),b));elseif(c.Video&&ainstanceofc.Video){this.customRender=!0;varg=a.texture.valid;this.setTexture(a.texture),this.setFrame(a.texture.frame.clone()),a.onChangeSource.add(this.resizeFrame,this),this.texture.valid=g}elseainstanceofPIXI.Texture?this.setTexture(a):null===a||"undefined"==typeofa?(this.key="__default",this.setTexture(PIXI.TextureCache[this.key])):"string"!=typeofa||this.game.cache.checkImageKey(a)?(this.setTexture(newPIXI.Texture(PIXI.BaseTextureCache[a])),e=!this.animations.loadFrameData(this.game.cache.getFrameData(a),b)):(console.warn("Texture with key '"+a+"' not found."),this.key="__missing",this.setTexture(PIXI.TextureCache[this.key]));e&&(this._frame=c.Rectangle.clone(this.texture.frame)),f||(this.texture.baseTexture.scaleMode=1)},setFrame:function(a){this._frame=a,this.texture.frame.x=a.x,this.texture.frame.y=a.y,this.texture.frame.width=a.width,this.texture.frame.height=a.height,this.texture.crop.x=a.x,this.t
},isTweening:function(a){returnthis._tweens.some(function(b){returnb.target===a})},_pauseAll:function(){for(vara=this._tweens.length-1;a>=0;a--)this._tweens[a]._pause()},_resumeAll:function(){for(vara=this._tweens.length-1;a>=0;a--)this._tweens[a]._resume()},pauseAll:function(){for(vara=this._tweens.length-1;a>=0;a--)this._tweens[a].pause()},resumeAll:function(){for(vara=this._tweens.length-1;a>=0;a--)this._tweens[a].resume(!0)}},c.TweenManager.prototype.constructor=c.TweenManager,c.Tween=function(a,b,d){this.game=b,this.target=a,this.manager=d,this.timeline=[],this.reverse=!1,this.timeScale=1,this.repeatCounter=0,this.pendingDelete=!1,this.onStart=newc.Signal,this.onLoop=newc.Signal,this.onRepeat=newc.Signal,this.onChildComplete=newc.Signal,this.onComplete=newc.Signal,this.isRunning=!1,this.current=0,this.properties={},this.chainedTween=null,this.isPaused=!1,this._onUpdateCallback=null,this._onUpdateCallbackContext=null,this._pausedTime=0,this._codePaused=!1,this._hasStarted=!1},c.Tween.prototype={to:function(a,b,d,e,f,g,h){return("undefined"==typeofb||0>=b)&&(b=1e3),("undefined"==typeofd||null===d)&&(d=c.Easing.Default),"undefined"==typeofe&&(e=!1),"undefined"==typeoff&&(f=0),"undefined"==typeofg&&(g=0),"undefined"==typeofh&&(h=!1),"string"==typeofd&&this.manager.easeMap[d]&&(d=this.manager.easeMap[d]),this.isRunning?(console.warn("Phaser.Tween.to cannot be called after Tween.start"),this):(this.timeline.push(newc.TweenData(this).to(a,b,d,f,g,h)),e&&this.start(),this)},from:function(a,b,d,e,f,g,h){return"undefined"==typeofb&&(b=1e3),("undefined"==typeofd||null===d)&&(d=c.Easing.Default),"undefined"==typeofe&&(e=!1),"undefined"==typeoff&&(f=0),"undefined"==typeofg&&(g=0),"undefined"==typeofh&&(h=!1),"string"==typeofd&&this.manager.easeMap[d]&&(d=this.manager.easeMap[d]),this.isRunning?(console.warn("Phaser.Tween.from cannot be called after Tween.start"),this):(this.timeline.push(newc.TweenData(this).from(a,b,d,f,g,h)),e&&this.start(),this)},start:function(a){if("undefined"==typeofa&&(a=0),null===this.game||null===this.target||0===this.timeline.length||this.isRunning)returnthis;for(varb=0;b<this.timeline.length;b++)for(varcinthis.timeline[b].vEnd)this.properties[c]=this.target[c]||0,Array.isArray(this.properties[c])||(this.properties[c]*=1);for(varb=0;b<this.timeline.length;b++)this.timeline[b].loadValues();returnthis.manager.add(this),this.isRunning=!0,(0>a||a>this.timeline.length-1)&&(a=0),this.current=a,this.timeline[this.current].start(),this},stop:function(a){return"undefined"==typeofa&&(a=!1),this.isRunning=!1,this._onUpdateCallback=null,this._onUpdateCallbackContext=null,a&&(this.onComplete.dispatch(this.target,this),this.chainedTween&&this.chainedTween.start()),this.manager.remove(this),this},updateTweenData:function(a,b,c){if(0===this.timeline.length)returnthis;if("undefined"==typeofc&&(c=0),-1===c)for(vard=0;d<this.timeline.length;d++)this.timeline[d][a]=b;elsethis.timeline[c][a]=b;returnthis},delay:function(a,b){returnthis.updateTweenData("delay",a,b)},repeat:function(a,b,c){return"undefined"==typeofb&&(b=0),this.updateTweenData("repeatCounter",a,c),this.updateTweenData("repeatDelay",b,c)},repeatDelay:function(a,b){returnthis.updateTweenData("repeatDelay",a,b)},yoyo:function(a,b,c){return"undefined"==typeofb&&(b=0),this.updateTweenData("yoyo",a,c),this.updateTweenData("yoyoDelay",b,c)},yoyoDelay:function(a,b){returnthis.updateTweenData("yoyoDelay",a,b)},easing:function(a,b){return"string"==typeofa&&this.manager.easeMap[a]&&(a=this.manager.easeMap[a]),this.updateTweenData("easingFunction",a,b)},interpolation:function(a,b,d){return"undefined"==typeofb&&(b=c.Math),this.updateTweenData("interpolationFunction",a,d),this.updateTweenData("interpolationContext",b,d)},repeatAll:function(a){return"undefined"==typeofa&&(a=0),this.repeatCounter=a,this},chain:function(){for(vara=arguments.length;a--;)a>0?arguments[a-1].chainedTween=arguments[a]:this.chainedTween=arguments[a];returnthis},loop:function(a){return"undefined"==typeofa&&(a=!0),a?this.repeatAll(-1):this.repeatC
returna},getRect:function(a){return"undefined"==typeofa?a=newc.Rectangle(this.x,this.y,this.width,this.height):a.setTo(this.x,this.y,this.width,this.height),a}},c.Frame.prototype.constructor=c.Frame,c.FrameData=function(){this._frames=[],this._frameNames=[]},c.FrameData.prototype={addFrame:function(a){returna.index=this._frames.length,this._frames.push(a),""!==a.name&&(this._frameNames[a.name]=a.index),a},getFrame:function(a){returna>=this._frames.length&&(a=0),this._frames[a]},getFrameByName:function(a){return"number"==typeofthis._frameNames[a]?this._frames[this._frameNames[a]]:null},checkFrameName:function(a){returnnull==this._frameNames[a]?!1:!0},clone:function(){for(vara=newc.FrameData,b=0;b<this._frames.length;b++)a._frames.push(this._frames[b].clone());for(vardinthis._frameNames)this._frameNames.hasOwnProperty(d)&&a._frameNames.push(this._frameNames[d]);returna},getFrameRange:function(a,b,c){"undefined"==typeofc&&(c=[]);for(vard=a;b>=d;d++)c.push(this._frames[d]);returnc},getFrames:function(a,b,c){if("undefined"==typeofb&&(b=!0),"undefined"==typeofc&&(c=[]),"undefined"==typeofa||0===a.length)for(vard=0;d<this._frames.length;d++)c.push(this._frames[d]);elsefor(vard=0;d<a.length;d++)c.push(b?this.getFrame(a[d]):this.getFrameByName(a[d]));returnc},getFrameIndexes:function(a,b,c){if("undefined"==typeofb&&(b=!0),"undefined"==typeofc&&(c=[]),"undefined"==typeofa||0===a.length)for(vard=0;d<this._frames.length;d++)c.push(this._frames[d].index);elsefor(vard=0;d<a.length;d++)b?c.push(this._frames[a[d]].index):this.getFrameByName(a[d])&&c.push(this.getFrameByName(a[d]).index);returnc}},c.FrameData.prototype.constructor=c.FrameData,Object.defineProperty(c.FrameData.prototype,"total",{get:function(){returnthis._frames.length}}),c.AnimationParser={spriteSheet:function(a,b,d,e,f,g,h){vari=a.cache.getImage(b);if(null==i)returnnull;varj=i.width,k=i.height;0>=d&&(d=Math.floor(-j/Math.min(-1,d))),0>=e&&(e=Math.floor(-k/Math.min(-1,e)));varl=Math.floor((j-g)/(d+h)),m=Math.floor((k-g)/(e+h)),n=l*m;if(-1!==f&&(n=f),0===j||0===k||d>j||e>k||0===n)returnconsole.warn("Phaser.AnimationParser.spriteSheet: '"+b+"'s width/height zero or width/height < given frameWidth/frameHeight"),null;for(varo=newc.FrameData,p=g,q=g,r=0;n>r;r++)o.addFrame(newc.Frame(r,p,q,d,e,"")),p+=d+h,p+d>j&&(p=g,q+=e+h);returno},JSONData:function(a,b){if(!b.frames)returnconsole.warn("Phaser.AnimationParser.JSONData: Invalid Texture Atlas JSON given, missing 'frames' array"),voidconsole.log(b);for(vard,e=newc.FrameData,f=b.frames,g=0;g<f.length;g++)d=e.addFrame(newc.Frame(g,f[g].frame.x,f[g].frame.y,f[g].frame.w,f[g].frame.h,f[g].filename)),f[g].trimmed&&d.setTrim(f[g].trimmed,f[g].sourceSize.w,f[g].sourceSize.h,f[g].spriteSourceSize.x,f[g].spriteSourceSize.y,f[g].spriteSourceSize.w,f[g].spriteSourceSize.h);returne},JSONDataHash:function(a,b){if(!b.frames)returnconsole.warn("Phaser.AnimationParser.JSONDataHash: Invalid Texture Atlas JSON given, missing 'frames' object"),voidconsole.log(b);vard,e=newc.FrameData,f=b.frames,g=0;for(varhinf)d=e.addFrame(newc.Frame(g,f[h].frame.x,f[h].frame.y,f[h].frame.w,f[h].frame.h,h)),f[h].trimmed&&d.setTrim(f[h].trimmed,f[h].sourceSize.w,f[h].sourceSize.h,f[h].spriteSourceSize.x,f[h].spriteSourceSize.y,f[h].spriteSourceSize.w,f[h].spriteSourceSize.h),g++;returne},XMLData:function(a,b){if(!b.getElementsByTagName("TextureAtlas"))returnvoidconsole.warn("Phaser.AnimationParser.XMLData: Invalid Texture Atlas XML given, missing <TextureAtlas> tag");for(vard,e,f,g,h,i,j,k,l,m,n,o=newc.FrameData,p=b.getElementsByTagName("SubTexture"),q=0;q<p.length;q++)f=p[q].attributes,e=f.name.value,g=parseInt(f.x.value,10),h=parseInt(f.y.value,10),i=parseInt(f.width.value,10),j=parseInt(f.height.value,10),k=null,l=null,f.frameX&&(k=Math.abs(parseInt(f.frameX.value,10)),l=Math.abs(parseInt(f.frameY.value,10)),m=parseInt(f.frameWidth.value,10),n=parseInt(f.frameHeight.value,10)),d=o.addFrame(newc.Frame(q,g,h,i,j,e)),(null!==k||null!==l)&&d.setTrim(!0,i,j,k,l,m,n);returno}},c.Cache=function(a){this.game
varg=this;f.onerror=function(){try{returne.call(g,a,f)}catch(b){g.asyncComplete(a,b.message||"Exception")}},f.ontimeout=function(){try{returne.call(g,a,f)}catch(b){g.asyncComplete(a,b.message||"Exception")}},f.onprogress=function(){},f.onload=function(){try{returnd.call(g,a,f)}catch(b){g.asyncComplete(a,b.message||"Exception")}},a.requestObject=f,a.requestUrl=b,setTimeout(function(){f.send()},0)},getVideoURL:function(a){for(varb=0;b<a.length;b++){varc,d=a[b];if(d.uri)d=d.uri,c=d.type;else{if(0===d.indexOf("blob:")||0===d.indexOf("data:"))returnd;d.indexOf("?")>=0&&(d=d.substr(0,d.indexOf("?")));vare=d.substr((Math.max(0,d.lastIndexOf("."))||1/0)+1);c=e.toLowerCase()}if(this.game.device.canPlayVideo(c))returna[b]}returnnull},getAudioURL:function(a){if(this.game.sound.noAudio)returnnull;for(varb=0;b<a.length;b++){varc,d=a[b];if(d.uri)d=d.uri,c=d.type;else{if(0===d.indexOf("blob:")||0===d.indexOf("data:"))returnd;d.indexOf("?")>=0&&(d=d.substr(0,d.indexOf("?")));vare=d.substr((Math.max(0,d.lastIndexOf("."))||1/0)+1);c=e.toLowerCase()}if(this.game.device.canPlayAudio(c))returna[b]}returnnull},fileError:function(a,b,c){vard=a.requestUrl||this.transformUrl(a.url,a),e="error loading asset from URL "+d;!c&&b&&(c=b.status),c&&(e=e+" ("+c+")"),this.asyncComplete(a,e)},fileComplete:function(a,b){vard=!0;switch(a.type){case"packfile":vare=JSON.parse(b.responseText);a.data=e||{};break;case"image":this.game.cache.addImage(a.key,a.url,a.data);break;case"spritesheet":this.game.cache.addSpriteSheet(a.key,a.url,a.data,a.frameWidth,a.frameHeight,a.frameMax,a.margin,a.spacing);break;case"textureatlas":if(null==a.atlasURL)this.game.cache.addTextureAtlas(a.key,a.url,a.data,a.atlasData,a.format);elseif(d=!1,a.format==c.Loader.TEXTURE_ATLAS_JSON_ARRAY||a.format==c.Loader.TEXTURE_ATLAS_JSON_HASH)this.xhrLoad(a,this.transformUrl(a.atlasURL,a),"text",this.jsonLoadComplete);else{if(a.format!=c.Loader.TEXTURE_ATLAS_XML_STARLING)thrownewError("Phaser.Loader. Invalid Texture Atlas format: "+a.format);this.xhrLoad(a,this.transformUrl(a.atlasURL,a),"text",this.xmlLoadComplete)}break;case"bitmapfont":a.atlasURL?(d=!1,this.xhrLoad(a,this.transformUrl(a.atlasURL,a),"text",function(a,b){varc;try{c=JSON.parse(b.responseText)}catch(d){}c?(a.atlasType="json",this.jsonLoadComplete(a,b)):(a.atlasType="xml",this.xmlLoadComplete(a,b))})):this.game.cache.addBitmapFont(a.key,a.url,a.data,a.atlasData,a.atlasType,a.xSpacing,a.ySpacing);break;case"video":if(a.asBlob)try{a.data=newBlob([newUint8Array(b.response)])}catch(f){thrownewError("Phaser.Loader. Unable to parse video file as Blob: "+a.key)}this.game.cache.addVideo(a.key,a.url,a.data,a.asBlob);break;case"audio":this.game.sound.usingWebAudio?(a.data=b.response,this.game.cache.addSound(a.key,a.url,a.data,!0,!1),a.autoDecode&&this.game.sound.decode(a.key)):this.game.cache.addSound(a.key,a.url,a.data,!1,!0);break;case"text":a.data=b.responseText,this.game.cache.addText(a.key,a.url,a.data);break;case"physics":vare=JSON.parse(b.responseText);this.game.cache.addPhysicsData(a.key,a.url,e,a.format);break;case"script":a.data=document.createElement("script"),a.data.language="javascript",a.data.type="text/javascript",a.data.defer=!1,a.data.text=b.responseText,document.head.appendChild(a.data),a.callback&&(a.data=a.callback.call(a.callbackContext,a.key,b.responseText));break;case"binary":a.data=a.callback?a.callback.call(a.callbackContext,a.key,b.response):b.response,this.game.cache.addBinary(a.key,a.data)}d&&this.asyncComplete(a)},jsonLoadComplete:function(a,b){varc=JSON.parse(b.responseText);"tilemap"===a.type?this.game.cache.addTilemap(a.key,a.url,c,a.format):"bitmapfont"===a.type?this.game.cache.addBitmapFont(a.key,a.url,a.data,c,a.atlasType,a.xSpacing,a.ySpacing):"json"===a.type?this.game.cache.addJSON(a.key,a.url,c):this.game.cache.addTextureAtlas(a.key,a.url,a.data,c,a.format),this.asyncComplete(a)},csvLoadComplete:function(a,b){varc=b.responseText;this.game.cache.addTilemap(a.key,a.url,c,a.format),this.asyncComplete(a)},xmlLoadComplete:function(a,b){varc=b.responseText,d=this.parseXml(c
varm=Math.floor((0+d)/h),n=Math.floor((f-1+d)/h);this.renderRegion(c,d,i,m,j,n)}if(l>=k){this.context.clearRect(0,k*h-d,e,(l-k+1)*h);varo=Math.floor((0+c)/g),p=Math.floor((e-1+c)/g);this.renderRegion(c,d,o,k,p,l)}},c.TilemapLayer.prototype.renderFull=function(){vara=this._mc.scrollX,b=this._mc.scrollY,c=this.canvas.width,d=this.canvas.height,e=this._mc.tileWidth,f=this._mc.tileHeight,g=Math.floor(a/e),h=Math.floor((c-1+a)/e),i=Math.floor(b/f),j=Math.floor((d-1+b)/f);this.context.clearRect(0,0,c,d),this.renderRegion(a,b,g,i,h,j)},c.TilemapLayer.prototype.render=function(){vara=!1;if(this.visible){this.context.save(),(this.dirty||this.layer.dirty)&&(this.layer.dirty=!1,a=!0);varb=this.canvas.width,c=this.canvas.height,d=0|this._scrollX,e=0|this._scrollY,f=this._mc,g=f.scrollX-d,h=f.scrollY-e;if(a||0!==g||0!==h||f.renderWidth!==b||f.renderHeight!==c)returnf.scrollX=d,f.scrollY=e,(f.renderWidth!==b||f.renderHeight!==c)&&(f.renderWidth=b,f.renderHeight=c),this.debug&&(this.context.globalAlpha=this.debugSettings.debugAlpha,this.debugSettings.forceFullRedraw&&(a=!0)),!a&&this.renderSettings.enableScrollDelta&&Math.abs(g)+Math.abs(h)<Math.min(b,c)?this.renderDeltaScroll(g,h):this.renderFull(),this.debug&&(this.context.globalAlpha=1,this.renderDebug()),this.texture.baseTexture.dirty(),this.dirty=!1,this.context.restore(),!0}},c.TilemapLayer.prototype.renderDebug=function(){vara,b,c,d,e,f,g=this._mc.scrollX,h=this._mc.scrollY,i=this.context,j=this.canvas.width,k=this.canvas.height,l=this.layer.width,m=this.layer.height,n=this._mc.tileWidth,o=this._mc.tileHeight,p=Math.floor(g/n),q=Math.floor((j-1+g)/n),r=Math.floor(h/o),s=Math.floor((k-1+h)/o),t=p*n-g,u=r*o-h,v=(p+(1<<20)*l)%l,w=(r+(1<<20)*m)%m;for(i.strokeStyle=this.debugSettings.facingEdgeStroke,d=w,f=s-r,b=u;f>=0;d++,f--,b+=o){d>=m&&(d-=m);varx=this.layer.data[d];for(c=v,e=q-p,a=t;e>=0;c++,e--,a+=n){c>=l&&(c-=l);vary=x[c];!y||y.index<0||!y.collides||(this.debugSettings.collidingTileOverfill&&(i.fillStyle=this.debugSettings.collidingTileOverfill,i.fillRect(a,b,this._mc.cw,this._mc.ch)),this.debugSettings.facingEdgeStroke&&(i.beginPath(),y.faceTop&&(i.moveTo(a,b),i.lineTo(a+this._mc.cw,b)),y.faceBottom&&(i.moveTo(a,b+this._mc.ch),i.lineTo(a+this._mc.cw,b+this._mc.ch)),y.faceLeft&&(i.moveTo(a,b),i.lineTo(a,b+this._mc.ch)),y.faceRight&&(i.moveTo(a+this._mc.cw,b),i.lineTo(a+this._mc.cw,b+this._mc.ch)),i.stroke()))}}},Object.defineProperty(c.TilemapLayer.prototype,"wrap",{get:function(){returnthis._wrap},set:function(a){this._wrap=a,this.dirty=!0}}),Object.defineProperty(c.TilemapLayer.prototype,"scrollX",{get:function(){returnthis._scrollX},set:function(a){this._scrollX=a}}),Object.defineProperty(c.TilemapLayer.prototype,"scrollY",{get:function(){returnthis._scrollY},set:function(a){this._scrollY=a}}),Object.defineProperty(c.TilemapLayer.prototype,"collisionWidth",{get:function(){returnthis._mc.cw},set:function(a){this._mc.cw=0|a,this.dirty=!0}}),Object.defineProperty(c.TilemapLayer.prototype,"collisionHeight",{get:function(){returnthis._mc.ch},set:function(a){this._mc.ch=0|a,this.dirty=!0}}),c.TilemapParser={parse:function(a,b,d,e,f,g){if("undefined"==typeofd&&(d=32),"undefined"==typeofe&&(e=32),"undefined"==typeoff&&(f=10),"undefined"==typeofg&&(g=10),"undefined"==typeofb)returnthis.getEmptyData();if(null===b)returnthis.getEmptyData(d,e,f,g);varh=a.cache.getTilemapData(b);if(h){if(h.format===c.Tilemap.CSV)returnthis.parseCSV(b,h.data,d,e);if(!h.format||h.format===c.Tilemap.TILED_JSON)returnthis.parseTiledJSON(h.data)}elseconsole.warn("Phaser.TilemapParser.parse - No map data found for key "+b)},parseCSV:function(a,b,d,e){varf=this.getEmptyData();b=b.trim();for(varg=[],h=b.split("\n"),i=h.length,j=0,k=0;k<h.length;k++){g[k]=[];for(varl=h[k].split(","),m=0;m<l.length;m++)g[k][m]=newc.Tile(f.layers[0],parseInt(l[m],10),m,k,d,e);0===j&&(j=l.length)}returnf.format=c.Tilemap.CSV,f.name=a,f.width=j,f.height=i,f.tileWidth=d,f.tileHeight=e,f.widthInPixels=j*d,f.heightInPixels=i*e,f.layers[0].width=j,f.layers[0].height=i,f.layers[0].widthInPixels=f.widthInPixe