vard=a.length;if(1>d)thrownewError("Phaser.Point. Parameter 'points' array must not be empty");if(1===d)returnc.copyFrom(a[0]),c;for(vare=0;d>e;e++)b.Point.add(c,a[e],c);returnc.divide(d,d),c},b.Point.parse=function(a,c,d){c=c||"x",d=d||"y";vare=newb.Point;returna[c]&&(e.x=parseInt(a[c],10)),a[d]&&(e.y=parseInt(a[d],10)),e},PIXI.Point=b.Point,b.Rectangle=function(a,b,c,d){a=a||0,b=b||0,c=c||0,d=d||0,this.x=a,this.y=b,this.width=c,this.height=d},b.Rectangle.prototype={offset:function(a,b){returnthis.x+=a,this.y+=b,this},offsetPoint:function(a){returnthis.offset(a.x,a.y)},setTo:function(a,b,c,d){returnthis.x=a,this.y=b,this.width=c,this.height=d,this},centerOn:function(a,b){returnthis.centerX=a,this.centerY=b,this},floor:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y)},floorAll:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.width=Math.floor(this.width),this.height=Math.floor(this.height)},copyFrom:function(a){returnthis.setTo(a.x,a.y,a.width,a.height)},copyTo:function(a){returna.x=this.x,a.y=this.y,a.width=this.width,a.height=this.height,a},inflate:function(a,c){returnb.Rectangle.inflate(this,a,c)},size:function(a){returnb.Rectangle.size(this,a)},clone:function(a){returnb.Rectangle.clone(this,a)},contains:function(a,c){returnb.Rectangle.contains(this,a,c)},containsRect:function(a){returnb.Rectangle.containsRect(a,this)},equals:function(a){returnb.Rectangle.equals(this,a)},intersection:function(a,c){returnb.Rectangle.intersection(this,a,c)},intersects:function(a,c){returnb.Rectangle.intersects(this,a,c)},intersectsRaw:function(a,c,d,e,f){returnb.Rectangle.intersectsRaw(this,a,c,d,e,f)},union:function(a,c){returnb.Rectangle.union(this,a,c)},toString:function(){return"[{Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+" empty="+this.empty+")}]"}},Object.defineProperty(b.Rectangle.prototype,"halfWidth",{get:function(){returnMath.round(this.width/2)}}),Object.defineProperty(b.Rectangle.prototype,"halfHeight",{get:function(){returnMath.round(this.height/2)}}),Object.defineProperty(b.Rectangle.prototype,"bottom",{get:function(){returnthis.y+this.height},set:function(a){this.height=a<=this.y?0:a-this.y}}),Object.defineProperty(b.Rectangle.prototype,"bottomRight",{get:function(){returnnewb.Point(this.right,this.bottom)},set:function(a){this.right=a.x,this.bottom=a.y}}),Object.defineProperty(b.Rectangle.prototype,"left",{get:function(){returnthis.x},set:function(a){this.width=a>=this.right?0:this.right-a,this.x=a}}),Object.defineProperty(b.Rectangle.prototype,"right",{get:function(){returnthis.x+this.width},set:function(a){this.width=a<=this.x?0:a-this.x}}),Object.defineProperty(b.Rectangle.prototype,"volume",{get:function(){returnthis.width*this.height}}),Object.defineProperty(b.Rectangle.prototype,"perimeter",{get:function(){return2*this.width+2*this.height}}),Object.defineProperty(b.Rectangle.prototype,"centerX",{get:function(){returnthis.x+this.halfWidth},set:function(a){this.x=a-this.halfWidth}}),Object.defineProperty(b.Rectangle.prototype,"centerY",{get:function(){returnthis.y+this.halfHeight},set:function(a){this.y=a-this.halfHeight}}),Object.defineProperty(b.Rectangle.prototype,"randomX",{get:function(){returnthis.x+Math.random()*this.width}}),Object.defineProperty(b.Rectangle.prototype,"randomY",{get:function(){returnthis.y+Math.random()*this.height}}),Object.defineProperty(b.Rectangle.prototype,"top",{get:function(){returnthis.y},set:function(a){a>=this.bottom?(this.height=0,this.y=a):this.height=this.bottom-a}}),Object.defineProperty(b.Rectangle.prototype,"topLeft",{get:function(){returnnewb.Point(this.x,this.y)},set:function(a){this.x=a.x,this.y=a.y}}),Object.defineProperty(b.Rectangle.prototype,"topRight",{get:function(){returnnewb.Point(this.x+this.width,this.y)},set:function(a){this.right=a.x,this.y=a.y}}),Object.defineProperty(b.Rectangle.prototype,"empty",{get:function(){return!this.width||!this.height},set:function(a){a===!0&&this.setTo(0,0,0,0)}}),b.Rectangle.prototype.constructor=b.Rectangle,b.Rectangle.i
},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.total}}),Object.defineProperty(b.AnimationManager.prototype,"paused",{get:function(){returnthis.currentAnim.isPaused},set:function(a){this.currentAnim.paused=a}}),Object.defineProperty(b.AnimationManager.prototype,"name",{get:function(){returnthis.currentAnim?this.currentAnim.name:void0}}),Object.defineProperty(b.AnimationManager.prototype,"frame",{get:function(){returnthis.currentFrame?this._frameIndex:void0},set:function(a){"number"==typeofa&&null!==this._frameData.getFrame(a)&&(this.currentFrame=this._frameData.getFrame(a),this.currentFrame&&(this._frameIndex=a,this.sprite.setFrame(this.currentFrame),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&&null!==this._frameData.getFrameByName(a)?(this.currentFrame=this._frameData.getFrameByName(a),this.currentFrame&&(this._frameIndex=this.currentFrame.index,this.sprite.setFrame(this.currentFrame),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.onUpdate=null,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.setFrame(this.currentFrame),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._parent.setFrame(this.currentFrame),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._frames[d]).name===a&&(c=d);elseif("number"==typeofa)if(b)c=a;elsefor(vard=0;d<this._frames.length;d++)this.frames[d]===c&&(c=d);c&&(this._frameIndex=c-1,this._timeNextFrame=this.game.time.now,this.update())},stop:function(a,b){"undefined"==typeofa&&(a=!1),"undefined"==typeofb&&(b=!1),this.isPlaying=!1,this.isFinished=!0,this.paused=!1,a&&(this.currentFrame=this._frameData.getFrame(this._frames[0]),this._parent.setFrame(this.currentFrame)),b&&(this._parent.events.onAnimationComplete.
g=h.parseFromString(e,"text/xml")}elseg=newActiveXObject("Microsoft.XMLDOM"),g.async="false",g.loadXML(e)}catch(i){g=void0}if(!g||!g.documentElement||g.getElementsByTagName("parsererror").length)thrownewError("Phaser.Loader. Invalid Texture Atlas XML given");e=g}}this.addToFileList("textureatlas",a,c,{atlasURL:null,atlasData:e,format:f})}returnthis},removeFile:function(a,b){varc=this.getAsset(a,b);c!==!1&&this._fileList.splice(c.index,1)},removeAll:function(){this._fileList.length=0},start:function(){this.isLoading||(this._packList.length>0?(this._packIndex=0,this.loadPack()):this.beginLoad())},beginLoad:function(){this.progress=0,this.progressFloat=0,this.hasLoaded=!1,this.isLoading=!0,this.onLoadStart.dispatch(this._fileList.length),this._fileList.length>0?(this._fileIndex=0,this._progressChunk=100/this._fileList.length,this.loadFile()):(this.progress=100,this.progressFloat=100,this.hasLoaded=!0,this.isLoading=!1,this.onLoadComplete.dispatch())},loadPack:function(){if(!this._packList[this._packIndex])returnvoidconsole.warn("Phaser.Loader loadPackList invalid index "+this._packIndex);vara=this._packList[this._packIndex];null!==a.data?this.packLoadComplete(this._packIndex,!1):this.xhrLoad(this._packIndex,this.baseURL+a.url,"text","packLoadComplete","packLoadError")},packLoadComplete:function(a,c){if("undefined"==typeofc&&(c=!0),!this._packList[a])returnvoidconsole.warn("Phaser.Loader packLoadComplete invalid index "+a);vard=this._packList[a];if(d.loaded=!0,c)vare=JSON.parse(this._xhr.responseText);elsevare=this._packList[a].data;if(e[d.key])for(varf,g=0;g<e[d.key].length;g++)switch(f=e[d.key][g],f.type){case"image":this.image(f.key,f.url,f.overwrite);break;case"text":this.text(f.key,f.url,f.overwrite);break;case"json":this.json(f.key,f.url,f.overwrite);break;case"xml":this.xml(f.key,f.url,f.overwrite);break;case"script":this.script(f.key,f.url,f.callback,d.callbackContext);break;case"binary":this.binary(f.key,f.url,f.callback,d.callbackContext);break;case"spritesheet":this.spritesheet(f.key,f.url,f.frameWidth,f.frameHeight,f.frameMax,f.margin,f.spacing);break;case"audio":this.audio(f.key,f.urls,f.autoDecode);break;case"tilemap":this.tilemap(f.key,f.url,f.data,b.Tilemap[f.format]);break;case"physics":this.physics(f.key,f.url,f.data,b.Loader[f.format]);break;case"bitmapFont":this.bitmapFont(f.key,f.textureURL,f.xmlURL,f.xmlData,f.xSpacing,f.ySpacing);break;case"atlasJSONArray":this.atlasJSONArray(f.key,f.textureURL,f.atlasURL,f.atlasData);break;case"atlasJSONHash":this.atlasJSONHash(f.key,f.textureURL,f.atlasURL,f.atlasData);break;case"atlasXML":this.atlasXML(f.key,f.textureURL,f.atlasURL,f.atlasData);break;case"atlas":this.atlas(f.key,f.textureURL,f.atlasURL,f.atlasData,b.Loader[f.format])}this.nextPack(a,!0)},packError:function(a){this._packList[a].loaded=!0,this._packList[a].error=!0,this.onFileError.dispatch(this._packList[a].key,this._packList[a]),console.warn("Phaser.Loader error loading pack file: "+this._packList[a].key+" from URL "+this._packList[a].url),this.nextPack(a,!1)},nextPack:function(a,b){this.onPackComplete.dispatch(this._packList[a].key,b,this.totalLoadedPacks(),this._packList.length),this._packIndex++,this._packIndex<this._packList.length?this.loadPack():this.beginLoad()},loadFile:function(){if(!this._fileList[this._fileIndex])returnvoidconsole.warn("Phaser.Loader loadFile invalid index "+this._fileIndex);vara=this._fileList[this._fileIndex],c=this;switch(this.onFileStart.dispatch(this.progress,a.key,a.url),a.type){case"image":case"spritesheet":case"textureatlas":case"bitmapfont":a.data=newImage,a.data.name=a.key,a.data.onload=function(){returnc.fileComplete(c._fileIndex)},a.data.onerror=function(){returnc.fileError(c._fileIndex)},this.crossOrigin&&(a.data.crossOrigin=this.crossOrigin),a.data.src=this.baseURL+a.url;break;case"audio":a.url=this.getAudioURL(a.url),null!==a.url?this.game.sound.usingWebAudio?this.xhrLoad(this._fileIndex,this.baseURL+a.url,"arraybuffer","fileComplete","fileError"):this.game.sound.usingAudioTag&&(this.game.sound.touchLocked?(a.data=newAudio,a.data.n
},this)},spriteInfo:function(a,b,c,d){this.start(b,c,d),this.line("Sprite: ("+a.width+" x "+a.height+") anchor: "+a.anchor.x+" x "+a.anchor.y),this.line("x: "+a.x.toFixed(1)+" y: "+a.y.toFixed(1)),this.line("angle: "+a.angle.toFixed(1)+" rotation: "+a.rotation.toFixed(1)),this.line("visible: "+a.visible+" in camera: "+a.inCamera),this.stop()},spriteCoords:function(a,b,c,d){this.start(b,c,d,100),a.name&&this.line(a.name),this.line("x:",a.x.toFixed(2),"y:",a.y.toFixed(2)),this.line("pos x:",a.position.x.toFixed(2),"pos y:",a.position.y.toFixed(2)),this.line("world x:",a.world.x.toFixed(2),"world y:",a.world.y.toFixed(2)),this.stop()},lineInfo:function(a,b,c,d){this.start(b,c,d,80),this.line("start.x:",a.start.x.toFixed(2),"start.y:",a.start.y.toFixed(2)),this.line("end.x:",a.end.x.toFixed(2),"end.y:",a.end.y.toFixed(2)),this.line("length:",a.length.toFixed(2),"angle:",a.angle),this.stop()},pixel:function(a,b,c,d){d=d||2,this.start(),this.context.fillStyle=c,this.context.fillRect(a,b,d,d),this.stop()},geom:function(a,c,d,e){"undefined"==typeofd&&(d=!0),"undefined"==typeofe&&(e=0),c=c||"rgba(0,255,0,0.4)",this.start(),this.context.fillStyle=c,this.context.strokeStyle=c,ainstanceofb.Rectangle||1===e?d?this.context.fillRect(a.x-this.game.camera.x,a.y-this.game.camera.y,a.width,a.height):this.context.strokeRect(a.x-this.game.camera.x,a.y-this.game.camera.y,a.width,a.height):ainstanceofb.Circle||2===e?(this.context.beginPath(),this.context.arc(a.x-this.game.camera.x,a.y-this.game.camera.y,a.radius,0,2*Math.PI,!1),this.context.closePath(),d?this.context.fill():this.context.stroke()):ainstanceofb.Point||3===e?this.context.fillRect(a.x-this.game.camera.x,a.y-this.game.camera.y,4,4):(ainstanceofb.Line||4===e)&&(this.context.lineWidth=1,this.context.beginPath(),this.context.moveTo(a.start.x+.5-this.game.camera.x,a.start.y+.5-this.game.camera.y),this.context.lineTo(a.end.x+.5-this.game.camera.x,a.end.y+.5-this.game.camera.y),this.context.closePath(),this.context.stroke()),this.stop()},rectangle:function(a,b,c){"undefined"==typeofc&&(c=!0),b=b||"rgba(0, 255, 0, 0.4)",this.start(),c?(this.context.fillStyle=b,this.context.fillRect(a.x-this.game.camera.x,a.y-this.game.camera.y,a.width,a.height)):(this.context.strokeStyle=b,this.context.strokeRect(a.x-this.game.camera.x,a.y-this.game.camera.y,a.width,a.height)),this.stop()},text:function(a,b,c,d,e){d=d||"rgb(255,255,255)",e=e||"16px Courier",this.start(),this.context.font=e,this.renderShadow&&(this.context.fillStyle="rgb(0,0,0)",this.context.fillText(a,b+1,c+1)),this.context.fillStyle=d,this.context.fillText(a,b,c),this.stop()},quadTree:function(a,b){b=b||"rgba(255,0,0,0.3)",this.start();varc=a.bounds;if(0===a.nodes.length){this.context.strokeStyle=b,this.context.strokeRect(c.x,c.y,c.width,c.height),this.text("size: "+a.objects.length,c.x+4,c.y+16,"rgb(0,200,0)","12px Courier"),this.context.strokeStyle="rgb(0,255,0)";for(vard=0;d<a.objects.length;d++)this.context.strokeRect(a.objects[d].x,a.objects[d].y,a.objects[d].width,a.objects[d].height)}elsefor(vard=0;d<a.nodes.length;d++)this.quadTree(a.nodes[d]);this.stop()},body:function(a,c,d){a.body&&(this.start(),a.body.type===b.Physics.ARCADE?b.Physics.Arcade.Body.render(this.context,a.body,c,d):a.body.type===b.Physics.NINJA?b.Physics.Ninja.Body.render(this.context,a.body,c,d):a.body.type===b.Physics.BOX2D&&b.Physics.Box2D.renderBody(this.context,a.body,c),this.stop())},bodyInfo:function(a,c,d,e){a.body&&(this.start(c,d,e,210),a.body.type===b.Physics.ARCADE?b.Physics.Arcade.Body.renderBodyInfo(this,a.body):a.body.type===b.Physics.BOX2D&&this.game.physics.box2d.renderBodyInfo(this,a.body),this.stop())},box2dWorld:function(){this.start(),this.context.translate(-this.game.camera.view.x,-this.game.camera.view.y,0),this.game.physics.box2d.renderDebugDraw(this.context),this.stop()},box2dBody:function(a,c){this.start(),b.Physics.Box2D.renderBody(this.context,a,c),this.stop()}},b.Utils.Debug.prototype.constructor=b.Utils.Debug,b.Color={packPixel:function(a,c,d,e){returnb.Device.LITTLE_ENDIAN?(e<<24|d<<16|c<<8|a)>>>0:(a<<24|c<<16|d<<8