b.CanvasRenderer=function(a){this.game=a,b.defaultRenderer||(b.defaultRenderer=this),this.type=b.CANVAS_RENDERER,this.resolution=a.resolution,this.clearBeforeRender=a.clearBeforeRender,this.transparent=a.transparent,this.autoResize=!1,this.width=a.width*this.resolution,this.height=a.height*this.resolution,this.view=a.canvas,this.context=this.view.getContext("2d",{alpha:this.transparent}),this.refresh=!0,this.count=0,this.maskManager=newb.CanvasMaskManager,this.renderSession={context:this.context,maskManager:this.maskManager,scaleMode:null,smoothProperty:Phaser.Canvas.getSmoothingPrefix(this.context),roundPixels:!1},this.mapBlendModes(),this.resize(this.width,this.height)},b.CanvasRenderer.prototype.constructor=b.CanvasRenderer,b.CanvasRenderer.prototype.render=function(a){this.context.setTransform(1,0,0,1,0,0),this.context.globalAlpha=1,this.renderSession.currentBlendMode=0,this.renderSession.shakeX=this.game.camera._shake.x,this.renderSession.shakeY=this.game.camera._shake.y,this.context.globalCompositeOperation="source-over",navigator.isCocoonJS&&this.view.screencanvas&&(this.context.fillStyle="black",this.context.clear()),this.clearBeforeRender&&(this.transparent?this.context.clearRect(0,0,this.width,this.height):a._bgColor&&(this.context.fillStyle=a._bgColor.rgba,this.context.fillRect(0,0,this.width,this.height))),this.renderDisplayObject(a)},b.CanvasRenderer.prototype.destroy=function(a){void0===a&&(a=!0),a&&this.view.parent&&this.view.parent.removeChild(this.view),this.view=null,this.context=null,this.maskManager=null,this.renderSession=null},b.CanvasRenderer.prototype.resize=function(a,c){this.width=a*this.resolution,this.height=c*this.resolution,this.view.width=this.width,this.view.height=this.height,this.autoResize&&(this.view.style.width=this.width/this.resolution+"px",this.view.style.height=this.height/this.resolution+"px"),this.renderSession.smoothProperty&&(this.context[this.renderSession.smoothProperty]=this.renderSession.scaleMode===b.scaleModes.LINEAR)},b.CanvasRenderer.prototype.renderDisplayObject=function(a,b,c){this.renderSession.context=b||this.context,this.renderSession.resolution=this.resolution,a._renderCanvas(this.renderSession,c)},b.CanvasRenderer.prototype.mapBlendModes=function(){if(!b.blendModesCanvas){vara=[],c=b.blendModes,d=b.canUseNewCanvasBlendModes();a[c.NORMAL]="source-over",a[c.ADD]="lighter",a[c.MULTIPLY]=d?"multiply":"source-over",a[c.SCREEN]=d?"screen":"source-over",a[c.OVERLAY]=d?"overlay":"source-over",a[c.DARKEN]=d?"darken":"source-over",a[c.LIGHTEN]=d?"lighten":"source-over",a[c.COLOR_DODGE]=d?"color-dodge":"source-over",a[c.COLOR_BURN]=d?"color-burn":"source-over",a[c.HARD_LIGHT]=d?"hard-light":"source-over",a[c.SOFT_LIGHT]=d?"soft-light":"source-over",a[c.DIFFERENCE]=d?"difference":"source-over",a[c.EXCLUSION]=d?"exclusion":"source-over",a[c.HUE]=d?"hue":"source-over",a[c.SATURATION]=d?"saturation":"source-over",a[c.COLOR]=d?"color":"source-over",a[c.LUMINOSITY]=d?"luminosity":"source-over",b.blendModesCanvas=a}},b.BaseTexture=function(a,c){this.resolution=1,this.width=100,this.height=100,this.scaleMode=c||b.scaleModes.DEFAULT,this.hasLoaded=!1,this.source=a,this.premultipliedAlpha=!0,this._glTextures=[],this.mipmap=!1,this._dirty=[!0,!0,!0,!0],a&&((this.source.complete||this.source.getContext)&&this.source.width&&this.source.height&&(this.hasLoaded=!0,this.width=this.source.naturalWidth||this.source.width,this.height=this.source.naturalHeight||this.source.height,this.dirty()),this.skipRender=!1,this._powerOf2=!1)},b.BaseTexture.prototype.constructor=b.BaseTexture,b.BaseTexture.prototype.forceLoaded=function(a,b){this.hasLoaded=!0,this.width=a,this.height=b,this.dirty()},b.BaseTexture.prototype.destroy=function(){this.source&&b.CanvasPool.removeByCanvas(this.source),this.source=null,this.unloadFromGPU()},b.BaseTexture.prototype.updateSourceImage=function(a){console.warn("PIXI.BaseTexture.updateSourceImage is deprecated. Use Phaser.Sprite.loadTexture instead.")},b.BaseTexture.prototype.dirty=function(){for(vara=0;a<this._glTextures.length;a++)this._dirty[a]=!0},b.BaseText
}returna},c.Point.centroid=function(a,b){if(void0===b&&(b=newc.Point),"[object Array]"!==Object.prototype.toString.call(a))thrownewError("Phaser.Point. Parameter 'points' must be an array");vard=a.length;if(d<1)thrownewError("Phaser.Point. Parameter 'points' array must not be empty");if(1===d)returnb.copyFrom(a[0]),b;for(vare=0;e<d;e++)c.Point.add(b,a[e],b);returnb.divide(d,d),b},c.Point.parse=function(a,b,d){b=b||"x",d=d||"y";vare=newc.Point;returna[b]&&(e.x=parseInt(a[b],10)),a[d]&&(e.y=parseInt(a[d],10)),e},PIXI.Point=c.Point,c.Polygon=function(){this.area=0,this._points=[],arguments.length>0&&this.setTo.apply(this,arguments),this.closed=!0,this.flattened=!1,this.type=c.POLYGON},c.Polygon.prototype={toNumberArray:function(a){void0===a&&(a=[]);for(varb=0;b<this._points.length;b++)"number"==typeofthis._points[b]?(a.push(this._points[b]),a.push(this._points[b+1]),b++):(a.push(this._points[b].x),a.push(this._points[b].y));returna},flatten:function(){returnthis._points=this.toNumberArray(),this.flattened=!0,this},clone:function(a){varb=this._points.slice();returnvoid0===a||null===a?a=newc.Polygon(b):a.setTo(b),a},contains:function(a,b){varc=!1;if(this.flattened)for(vard=-2,e=this._points.length-2;(d+=2)<this._points.length;e=d){varf=this._points[d],g=this._points[d+1],h=this._points[e],i=this._points[e+1];(g<=b&&b<i||i<=b&&b<g)&&a<(h-f)*(b-g)/(i-g)+f&&(c=!c)}elsefor(vard=-1,e=this._points.length-1;++d<this._points.length;e=d){varf=this._points[d].x,g=this._points[d].y,h=this._points[e].x,i=this._points[e].y;(g<=b&&b<i||i<=b&&b<g)&&a<(h-f)*(b-g)/(i-g)+f&&(c=!c)}returnc},setTo:function(a){if(this.area=0,this._points=[],arguments.length>0){Array.isArray(a)||(a=Array.prototype.slice.call(arguments));for(varb=Number.MAX_VALUE,c=0,d=a.length;c<d;c++){if("number"==typeofa[c]){vare=newPIXI.Point(a[c],a[c+1]);c++}elseif(Array.isArray(a[c]))vare=newPIXI.Point(a[c][0],a[c][1]);elsevare=newPIXI.Point(a[c].x,a[c].y);this._points.push(e),e.y<b&&(b=e.y)}this.calculateArea(b)}returnthis},calculateArea:function(a){for(varb,c,d,e,f=0,g=this._points.length;f<g;f++)b=this._points[f],c=f===g-1?this._points[0]:this._points[f+1],d=(b.y-a+(c.y-a))/2,e=b.x-c.x,this.area+=d*e;returnthis.area}},c.Polygon.prototype.constructor=c.Polygon,Object.defineProperty(c.Polygon.prototype,"points",{get:function(){returnthis._points},set:function(a){null!=a?this.setTo(a):this.setTo()}}),PIXI.Polygon=c.Polygon,c.Rectangle=function(a,b,d,e){a=a||0,b=b||0,d=d||0,e=e||0,this.x=a,this.y=b,this.width=d,this.height=e,this.type=c.RECTANGLE},c.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},scale:function(a,b){returnvoid0===b&&(b=a),this.width*=a,this.height*=b,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)},ceil:function(){this.x=Math.ceil(this.x),this.y=Math.ceil(this.y)},ceilAll:function(){this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.width=Math.ceil(this.width),this.height=Math.ceil(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,b){returnc.Rectangle.inflate(this,a,b)},size:function(a){returnc.Rectangle.size(this,a)},resize:function(a,b){returnthis.width=a,this.height=b,this},clone:function(a){returnc.Rectangle.clone(this,a)},contains:function(a,b){returnc.Rectangle.contains(this,a,b)},containsRect:function(a){returnc.Rectangle.containsRect(a,this)},equals:function(a){returnc.Rectangle.equals(this,a)},intersection:function(a,b){returnc.Rectangle.intersection(this,a,b)},intersects:function(a){returnc.Rectangle.intersects(this,a)},intersectsRaw:function(a,b,d,e,f){returnc.R
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},JSONDataPyxel:function(a,b){vard=["layers","tilewidth","tileheight","tileswide","tileshigh"];if(d.forEach(function(a){if(!b[a])returnconsole.warn("Phaser.AnimationParser.JSONDataPyxel: Invalid Pyxel Tilemap JSON given, missing '"+a+"' key."),voidconsole.log(b)}),1!=b.layers.length)returnconsole.warn("Phaser.AnimationParser.JSONDataPyxel: Too many layers, this parser only supports flat Tilemaps."),voidconsole.log(b);for(vare,f=newc.FrameData,g=b.tileheight,h=b.tilewidth,i=b.layers[0].tiles,j=0;j<i.length;j++)e=f.addFrame(newc.Frame(j,i[j].x,i[j].y,h,g,"frame_"+j)),e.setTrim(!1);returnf},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=a,this.autoResolveURL=!1,this._cache={canvas:{},image:{},texture:{},sound:{},video:{},text:{},json:{},xml:{},physics:{},tilemap:{},binary:{},bitmapData:{},bitmapFont:{},shader:{},renderTexture:{}},this._urlMap={},this._urlResolver=newImage,this._urlTemp=null,this.onSoundUnlock=newc.Signal,this._cacheMap=[],this._cacheMap[c.Cache.CANVAS]=this._cache.canvas,this._cacheMap[c.Cache.IMAGE]=this._cache.image,this._cacheMap[c.Cache.TEXTURE]=this._cache.texture,this._cacheMap[c.Cache.SOUND]=this._cache.sound,this._cacheMap[c.Cache.TEXT]=this._cache.text,this._cacheMap[c.Cache.PHYSICS]=this._cache.physics,this._cacheMap[c.Cache.TILEMAP]=this._cache.tilemap,this._cacheMap[c.Cache.BINARY]=this._cache.binary,this._cacheMap[c.Cache.BITMAPDATA]=this._cache.bitmapData,this._cacheMap[c.Cache.BITMAPFONT]=this._cache.bitmapFont,this._cacheMap[c.Cache.JSON]=this._cache.json,this._cacheMap[c.Cache.XML]=this._cache.xml,this._cacheMap[c.Cache.VIDEO]=this._cache.video,this._cacheMap[c.Cache.SHADER]=this._cache.shader,this._cacheMap[c.Cache.RENDER_TEXTURE]=this._cache.renderTexture,this.addDefaultImage(),this.addMissingImage()},c.Cache.CANVAS=1,c.Cache.IMAGE=2,c.Cache.TEXTURE=3,c.Cache.SOUND=4,c.Cache.TEXT=5,c.Cache.PHYSICS=6,c.Cache.TILEMAP=7,c.Cache.BINARY=8,c.Cache.BITMAPDATA=9,c.Cache.BITMAPFONT=10,c.Cache.JSON=11,c.Cache.XML=12,c.Cache.VIDEO=13,c.Cache.SHADER=14,c.Cache.RENDER_TEXTURE=15,c.Cache.DEFAULT=null,c.Cache.MISSING=null,c.Cache.prototype={addCanvas:function(a,b,c){void0===c&&(c=b.getContext("2d")),this._cache.canvas[a]={canvas:b,context:c}},addImage:function(a,b,d){this.checkImageKey(a)&&this.removeImage(a);vare={key:a,url:b,data:d,base:newPIXI.BaseTexture(d),frame:newc.Frame(0,0,0,d.width,d.height,a),frameData:newc.FrameData};returne.frameData.addFrame(newc.Frame(0,0,0,d.width,d.height,b)),this._cache.image[a]=e,this._resolveURL(b,e),"__default"===a?c.Cache.DEFAULT=newPIXI.Texture(e.base):"__missing"===a&&(c.Cache.MISSING=newPIXI.Texture(e.base)),e},addDefaultImage:function(){vara=newImage;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUg
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(a){}c?(a.atlasType="json",this.jsonLoadComplete(a,b)):(a.atlasType="xml",this.xmlLoadComplete(a,b))})):this.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=b.response}catch(b){thrownewError("Phaser.Loader. Unable to parse video file as Blob: "+a.key)}this.cache.addVideo(a.key,a.url,a.data,a.asBlob);break;case"audio":this.game.sound.usingWebAudio?(a.data=b.response,this.cache.addSound(a.key,a.url,a.data,!0,!1),a.autoDecode&&this.game.sound.decode(a.key)):this.cache.addSound(a.key,a.url,a.data,!1,!0);break;case"text":a.data=b.responseText,this.cache.addText(a.key,a.url,a.data);break;case"shader":a.data=b.responseText,this.cache.addShader(a.key,a.url,a.data);break;case"physics":vare=JSON.parse(b.responseText);this.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.callback?a.data=a.callback.call(a.callbackContext,a.key,b.response):a.data=b.response,this.cache.addBinary(a.key,a.data)}d&&this.asyncComplete(a)},jsonLoadComplete:function(a,b){varc=JSON.parse(b.responseText);"tilemap"===a.type?this.cache.addTilemap(a.key,a.url,c,a.format):"bitmapfont"===a.type?this.cache.addBitmapFont(a.key,a.url,a.data,c,a.atlasType,a.xSpacing,a.ySpacing):"json"===a.type?this.cache.addJSON(a.key,a.url,c):this.cache.addTextureAtlas(a.key,a.url,a.data,c,a.format),this.asyncComplete(a)},csvLoadComplete:function(a,b){varc=b.responseText;this.cache.addTilemap(a.key,a.url,c,a.format),this.asyncComplete(a)},xmlLoadComplete:function(a,b){varc=b.responseText,d=this.parseXml(c);if(!d){vare=b.responseType||b.contentType;returnconsole.warn("Phaser.Loader - "+a.key+": invalid XML ("+e+")"),voidthis.asyncComplete(a,"invalid XML")}"bitmapfont"===a.type?this.cache.addBitmapFont(a.key,a.url,a.data,d,a.atlasType,a.xSpacing,a.ySpacing):"textureatlas"===a.type?this.cache.addTextureAtlas(a.key,a.url,a.data,d,a.format):"xml"===a.type&&this.cache.addXML(a.key,a.url,d),this.asyncComplete(a)},parseXml:function(a){varb;try{if(window.DOMParser){varc=newDOMParser;b=c.parseFromString(a,"text/xml")}elseb=newActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a)}catch(a){b=null}returnb&&b.documentElement&&!b.getElementsByTagName("parsererror").length?b:null},updateProgress:function(){this.preloadSprite&&(0===this.preloadSprite.direction?this.preloadSprite.rect.width=Math.floor(this.preloadSprite.width/100*this.progress):this.preloadSprite.rect.height=Math.floor(this.preloadSprite.height/100*this.progress),this.preloadSprite.sprite?this.preloadSprite.sprite.updateCrop():this.preloadSprite=null)},totalLoadedFiles:function(){returnthis._loadedFileCount},totalQueuedFiles:function(){returnthis._totalFileCount-this._loadedFileCount},totalLoadedPacks:function(){returnthis._totalPackCount},totalQueuedPacks:function(){returnthis._totalPackCount-this._loadedPackCount}},Object.defineProperty(c.Loader.prototype,"progressFloat",{get:function(){vara=this._loadedFileCount/this._totalFileCount*100;returnc.Math.clamp(a||0,0,100)}}),Object.defineProperty(c.Loader.prototype,"progress",{get:function(){returnMath.round(this.progressFloat)}}),c.Loader.prototype.constructor=c.Loader,c.LoaderParser={bitmapFont:function(a,b,c,d){returnthis.xmlBitmapFont(a,b,c,d)},xmlBitmapFont:function(a,b,c,d){vare={},f=a.getElementsByTagName("info")[0],g=a.getElementsByTagName("common")[0];e.font=f.getAttribute("face"),e.size=parseInt(f.getAttribute("size"),10),e.lineHeight=parseInt(g.getAttribute("lineHeight"),10)+d,e.chars={};for(varh=a.getElementsByTagName("char"),i=0;i<h.length;i++){varj=pars