this.blendModeManager=newb.WebGLBlendModeManager,this.renderSession={},this.renderSession.game=this.game,this.renderSession.gl=this.gl,this.renderSession.drawCount=0,this.renderSession.shaderManager=this.shaderManager,this.renderSession.maskManager=this.maskManager,this.renderSession.filterManager=this.filterManager,this.renderSession.blendModeManager=this.blendModeManager,this.renderSession.spriteBatch=this.spriteBatch,this.renderSession.stencilManager=this.stencilManager,this.renderSession.renderer=this,this.renderSession.resolution=this.resolution,this.initContext(),this.mapBlendModes()},b.WebGLRenderer.prototype.constructor=b.WebGLRenderer,b.WebGLRenderer.prototype.initContext=function(){vara=this.view.getContext("webgl",this._contextOptions)||this.view.getContext("experimental-webgl",this._contextOptions);if(this.gl=a,!a)thrownewError("This browser does not support webGL. Try using the canvas renderer");this.glContextId=a.id=b.WebGLRenderer.glContextId++,b.glContexts[this.glContextId]=a,b.instances[this.glContextId]=this,a.disable(a.DEPTH_TEST),a.disable(a.CULL_FACE),a.enable(a.BLEND),this.shaderManager.setContext(a),this.spriteBatch.setContext(a),this.maskManager.setContext(a),this.filterManager.setContext(a),this.blendModeManager.setContext(a),this.stencilManager.setContext(a),this.renderSession.gl=this.gl,this.resize(this.width,this.height)},b.WebGLRenderer.prototype.render=function(a){if(!this.contextLost){varb=this.gl;b.viewport(0,0,this.width,this.height),b.bindFramebuffer(b.FRAMEBUFFER,null),this.game.clearBeforeRender&&(b.clearColor(a._bgColor.r,a._bgColor.g,a._bgColor.b,a._bgColor.a),b.clear(b.COLOR_BUFFER_BIT)),this.offset.x=this.game.camera._shake.x,this.offset.y=this.game.camera._shake.y,this.renderDisplayObject(a,this.projection)}},b.WebGLRenderer.prototype.renderDisplayObject=function(a,c,d,e){this.renderSession.blendModeManager.setBlendMode(b.blendModes.NORMAL),this.renderSession.drawCount=0,this.renderSession.flipY=d?-1:1,this.renderSession.projection=c,this.renderSession.offset=this.offset,this.spriteBatch.begin(this.renderSession),this.filterManager.begin(this.renderSession,d),a._renderWebGL(this.renderSession,e),this.spriteBatch.end()},b.WebGLRenderer.prototype.resize=function(a,b){this.width=a*this.resolution,this.height=b*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.gl.viewport(0,0,this.width,this.height),this.projection.x=this.width/2/this.resolution,this.projection.y=-this.height/2/this.resolution},b.WebGLRenderer.prototype.updateTexture=function(a){if(!a.hasLoaded)return!1;varc=this.gl;returna._glTextures[c.id]||(a._glTextures[c.id]=c.createTexture()),c.bindTexture(c.TEXTURE_2D,a._glTextures[c.id]),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultipliedAlpha),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a.source),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR:c.NEAREST),a.mipmap&&b.isPowerOfTwo(a.width,a.height)?(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR_MIPMAP_LINEAR:c.NEAREST_MIPMAP_NEAREST),c.generateMipmap(c.TEXTURE_2D)):c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR:c.NEAREST),a._powerOf2?(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.REPEAT),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.REPEAT)):(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE)),a._dirty[c.id]=!1,!0},b.WebGLRenderer.prototype.destroy=function(){b.glContexts[this.glContextId]=null,this.projection=null,this.offset=null,this.shaderManager.destroy(),this.spriteBatch.destroy(),this.maskManager.destroy(),this.filterManager.destroy(),this.shaderManager=null,this.spriteBatch=null,this.maskManager=null,this.filterManager=null,this.gl=null,this.renderSession=null,b.CanvasPool.remove(this),b.instances[this.glContextId]=null,b
returnvoid0===d&&(d=newc.Point),d.x=a.x*b.x,d.y=a.y*b.y,d},c.Point.divide=function(a,b,d){returnvoid0===d&&(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){returnvoid0===b&&(b=newc.Point),b.setTo(-a.x,-a.y)},c.Point.multiplyAdd=function(a,b,d,e){returnvoid0===e&&(e=newc.Point),e.setTo(a.x+b.x*d,a.y+b.y*d)},c.Point.interpolate=function(a,b,d,e){returnvoid0===e&&(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){returnvoid0===b&&(b=newc.Point),b.setTo(-a.y,a.x)},c.Point.rperp=function(a,b){returnvoid0===b&&(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){void0===d&&(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){void0===d&&(d=newc.Point);vare=a.dot(b);return0!==e&&d.setTo(e*b.x,e*b.y),d},c.Point.normalRightHand=function(a,b){returnvoid0===b&&(b=newc.Point),b.setTo(-1*a.y,a.x)},c.Point.normalize=function(a,b){void0===b&&(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){if(f&&(e=c.Math.degToRad(e)),void0===g){a.subtract(b,d);varh=Math.sin(e),i=Math.cos(e),j=i*a.x-h*a.y,k=h*a.x+i*a.y;a.x=j+b,a.y=k+d}else{varl=e+Math.atan2(a.y-d,a.x-b);a.x=b+g*Math.cos(l),a.y=d+g*Math.sin(l)}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(1>d)thrownewError("Phaser.Point. Parameter 'points' array must not be empty");if(1===d)returnb.copyFrom(a[0]),b;for(vare=0;d>e;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.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},clone:function(a){varb=this._points.slice();returnvoid0===a||null===a?a=newc.Polygon(b):a.setTo(b),a},contains:function(a,b){for(varc=this._points.length,d=!1,e=-1,f=c-1;++e<c;f=e){varg=this._points[e].x,h=this._points[e].y,i=this._points[f].x,j=this._points[f].y;(b>=h&&j>b||b>=j&&h>b)&&(i-g)*(b-h)/(j-h)+g>a&&(d=!d)}returnd},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;d>c;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;g>f;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){returnvoi
},b},addBitmapFont:function(a,b,d,e,f,g,h){vari={url:b,data:d,font:null,base:newPIXI.BaseTexture(d)};void0===g&&(g=0),void0===h&&(h=0),"json"===f?i.font=c.LoaderParser.jsonBitmapFont(e,i.base,g,h):i.font=c.LoaderParser.xmlBitmapFont(e,i.base,g,h),this._cache.bitmapFont[a]=i,this._resolveURL(b,i)},addJSON:function(a,b,c){this._cache.json[a]={url:b,data:c},this._resolveURL(b,this._cache.json[a])},addXML:function(a,b,c){this._cache.xml[a]={url:b,data:c},this._resolveURL(b,this._cache.xml[a])},addVideo:function(a,b,c,d){this._cache.video[a]={url:b,data:c,isBlob:d,locked:!0},this._resolveURL(b,this._cache.video[a])},addShader:function(a,b,c){this._cache.shader[a]={url:b,data:c},this._resolveURL(b,this._cache.shader[a])},addRenderTexture:function(a,b){this._cache.renderTexture[a]={texture:b,frame:newc.Frame(0,0,0,b.width,b.height,"","")}},addSpriteSheet:function(a,b,d,e,f,g,h,i){void0===g&&(g=-1),void0===h&&(h=0),void0===i&&(i=0);varj={key:a,url:b,data:d,frameWidth:e,frameHeight:f,margin:h,spacing:i,base:newPIXI.BaseTexture(d),frameData:c.AnimationParser.spriteSheet(this.game,d,e,f,g,h,i)};this._cache.image[a]=j,this._resolveURL(b,j)},addTextureAtlas:function(a,b,d,e,f){varg={key:a,url:b,data:d,base:newPIXI.BaseTexture(d)};f===c.Loader.TEXTURE_ATLAS_XML_STARLING?g.frameData=c.AnimationParser.XMLData(this.game,e,a):f===c.Loader.TEXTURE_ATLAS_JSON_PYXEL?g.frameData=c.AnimationParser.JSONDataPyxel(this.game,e,a):Array.isArray(e.frames)?g.frameData=c.AnimationParser.JSONData(this.game,e,a):g.frameData=c.AnimationParser.JSONDataHash(this.game,e,a),this._cache.image[a]=g,this._resolveURL(b,g)},reloadSound:function(a){varb=this,c=this.getSound(a);c&&(c.data.src=c.url,c.data.addEventListener("canplaythrough",function(){returnb.reloadSoundComplete(a)},!1),c.data.load())},reloadSoundComplete:function(a){varb=this.getSound(a);b&&(b.locked=!1,this.onSoundUnlock.dispatch(a))},updateSound:function(a,b,c){vard=this.getSound(a);d&&(d[b]=c)},decodedSound:function(a,b){varc=this.getSound(a);c.data=b,c.decoded=!0,c.isDecoding=!1},isSoundDecoded:function(a){varb=this.getItem(a,c.Cache.SOUND,"isSoundDecoded");returnb?b.decoded:void0},isSoundReady:function(a){varb=this.getItem(a,c.Cache.SOUND,"isSoundDecoded");returnb?b.decoded&&!this.game.sound.touchLocked:void0},checkKey:function(a,b){returnthis._cacheMap[a][b]?!0:!1},checkURL:function(a){returnthis._urlMap[this._resolveURL(a)]?!0:!1},checkCanvasKey:function(a){returnthis.checkKey(c.Cache.CANVAS,a)},checkImageKey:function(a){returnthis.checkKey(c.Cache.IMAGE,a)},checkTextureKey:function(a){returnthis.checkKey(c.Cache.TEXTURE,a)},checkSoundKey:function(a){returnthis.checkKey(c.Cache.SOUND,a)},checkTextKey:function(a){returnthis.checkKey(c.Cache.TEXT,a)},checkPhysicsKey:function(a){returnthis.checkKey(c.Cache.PHYSICS,a)},checkTilemapKey:function(a){returnthis.checkKey(c.Cache.TILEMAP,a)},checkBinaryKey:function(a){returnthis.checkKey(c.Cache.BINARY,a)},checkBitmapDataKey:function(a){returnthis.checkKey(c.Cache.BITMAPDATA,a)},checkBitmapFontKey:function(a){returnthis.checkKey(c.Cache.BITMAPFONT,a)},checkJSONKey:function(a){returnthis.checkKey(c.Cache.JSON,a)},checkXMLKey:function(a){returnthis.checkKey(c.Cache.XML,a)},checkVideoKey:function(a){returnthis.checkKey(c.Cache.VIDEO,a)},checkShaderKey:function(a){returnthis.checkKey(c.Cache.SHADER,a)},checkRenderTextureKey:function(a){returnthis.checkKey(c.Cache.RENDER_TEXTURE,a)},getItem:function(a,b,c,d){returnthis.checkKey(b,a)?void0===d?this._cacheMap[b][a]:this._cacheMap[b][a][d]:(c&&console.warn("Phaser.Cache."+c+': Key "'+a+'" not found in Cache.'),null)},getCanvas:function(a){returnthis.getItem(a,c.Cache.CANVAS,"getCanvas","canvas")},getImage:function(a,b){(void0===a||null===a)&&(a="__default"),void0===b&&(b=!1);vard=this.getItem(a,c.Cache.IMAGE,"getImage");returnnull===d&&(d=this.getItem("__missing",c.Cache.IMAGE,"getImage")),b?d:d.data},getTextureFrame:function(a){returnthis.getItem(a,c.Cache.TEXTURE,"getTextureFrame","frame")},getSound:function(a){returnthis.getItem(a,c.Cache.SOUND,"getSound")},
this.boundsFull.width=Math.round(this.manager.width*this.scaleFluidInversed.x),this.boundsFull.height=Math.round(this.manager.height*this.scaleFluidInversed.y),this.boundsFluid.centerOn(this.manager.bounds.centerX,this.manager.bounds.centerY),this.boundsNone.centerOn(this.manager.bounds.centerX,this.manager.bounds.centerY),this.positionFluid.set(this.boundsFluid.x,this.boundsFluid.y),this.positionNone.set(this.boundsNone.x,this.boundsNone.y)},fitSprite:function(a){this.manager.scaleSprite(a),a.x=this.manager.bounds.centerX,a.y=this.manager.bounds.centerY},debug:function(){this.game.debug.text(this.boundsFluid.width+" x "+this.boundsFluid.height,this.boundsFluid.x+4,this.boundsFluid.y+16),this.game.debug.geom(this.boundsFluid,"rgba(255,0,0,0.9",!1)}},c.FlexGrid.prototype.constructor=c.FlexGrid,c.FlexLayer=function(a,b,d,e){c.Group.call(this,a.game,null,"__flexLayer"+a.game.rnd.uuid(),!1),this.manager=a.manager,this.grid=a,this.persist=!1,this.position=b,this.bounds=d,this.scale=e,this.topLeft=d.topLeft,this.topMiddle=newc.Point(d.halfWidth,0),this.topRight=d.topRight,this.bottomLeft=d.bottomLeft,this.bottomMiddle=newc.Point(d.halfWidth,d.bottom),this.bottomRight=d.bottomRight},c.FlexLayer.prototype=Object.create(c.Group.prototype),c.FlexLayer.prototype.constructor=c.FlexLayer,c.FlexLayer.prototype.resize=function(){},c.FlexLayer.prototype.debug=function(){this.game.debug.text(this.bounds.width+" x "+this.bounds.height,this.bounds.x+4,this.bounds.y+16),this.game.debug.geom(this.bounds,"rgba(0,0,255,0.9",!1),this.game.debug.geom(this.topLeft,"rgba(255,255,255,0.9"),this.game.debug.geom(this.topMiddle,"rgba(255,255,255,0.9"),this.game.debug.geom(this.topRight,"rgba(255,255,255,0.9")},c.Color={packPixel:function(a,b,d,e){returnc.Device.LITTLE_ENDIAN?(e<<24|d<<16|b<<8|a)>>>0:(a<<24|b<<16|d<<8|e)>>>0},unpackPixel:function(a,b,d,e){return(void0===b||null===b)&&(b=c.Color.createColor()),(void0===d||null===d)&&(d=!1),(void0===e||null===e)&&(e=!1),c.Device.LITTLE_ENDIAN?(b.a=(4278190080&a)>>>24,b.b=(16711680&a)>>>16,b.g=(65280&a)>>>8,b.r=255&a):(b.r=(4278190080&a)>>>24,b.g=(16711680&a)>>>16,b.b=(65280&a)>>>8,b.a=255&a),b.color=a,b.rgba="rgba("+b.r+","+b.g+","+b.b+","+b.a/255+")",d&&c.Color.RGBtoHSL(b.r,b.g,b.b,b),e&&c.Color.RGBtoHSV(b.r,b.g,b.b,b),b},fromRGBA:function(a,b){returnb||(b=c.Color.createColor()),b.r=(4278190080&a)>>>24,b.g=(16711680&a)>>>16,b.b=(65280&a)>>>8,b.a=255&a,b.rgba="rgba("+b.r+","+b.g+","+b.b+","+b.a+")",b},toRGBA:function(a,b,c,d){returna<<24|b<<16|c<<8|d},RGBtoHSL:function(a,b,d,e){e||(e=c.Color.createColor(a,b,d,1)),a/=255,b/=255,d/=255;varf=Math.min(a,b,d),g=Math.max(a,b,d);if(e.h=0,e.s=0,e.l=(g+f)/2,g!==f){varh=g-f;e.s=e.l>.5?h/(2-g-f):h/(g+f),g===a?e.h=(b-d)/h+(d>b?6:0):g===b?e.h=(d-a)/h+2:g===d&&(e.h=(a-b)/h+4),e.h/=6}returne},HSLtoRGB:function(a,b,d,e){if(e?(e.r=d,e.g=d,e.b=d):e=c.Color.createColor(d,d,d),0!==b){varf=.5>d?d*(1+b):d+b-d*b,g=2*d-f;e.r=c.Color.hueToColor(g,f,a+1/3),e.g=c.Color.hueToColor(g,f,a),e.b=c.Color.hueToColor(g,f,a-1/3)}returne.r=Math.floor(255*e.r|0),e.g=Math.floor(255*e.g|0),e.b=Math.floor(255*e.b|0),c.Color.updateColor(e),e},RGBtoHSV:function(a,b,d,e){e||(e=c.Color.createColor(a,b,d,255)),a/=255,b/=255,d/=255;varf=Math.min(a,b,d),g=Math.max(a,b,d),h=g-f;returne.h=0,e.s=0===g?0:h/g,e.v=g,g!==f&&(g===a?e.h=(b-d)/h+(d>b?6:0):g===b?e.h=(d-a)/h+2:g===d&&(e.h=(a-b)/h+4),e.h/=6),e},HSVtoRGB:function(a,b,d,e){void0===e&&(e=c.Color.createColor(0,0,0,1,a,b,0,d));varf,g,h,i=Math.floor(6*a),j=6*a-i,k=d*(1-b),l=d*(1-j*b),m=d*(1-(1-j)*b);switch(i%6){case0:f=d,g=m,h=k;break;case1:f=l,g=d,h=k;break;case2:f=k,g=d,h=m;break;case3:f=k,g=l,h=d;break;case4:f=m,g=k,h=d;break;case5:f=d,g=k,h=l}returne.r=Math.floor(255*f),e.g=Math.floor(255*g),e.b=Math.floor(255*h),c.Color.updateColor(e),e},hueToColor:function(a,b,c){return0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+(b-a)*(2/3-c)*6:a},createColor:function(a,b,d,e,f,g,h,i){varj={r:a||0,g:b||0,b:d||0,a:e||1,h:f||0,s:g||0,l:h||0,v:i||0,color:0,color32:0,rgba:""};returnc.Color.updateColor(j)},updateColor:function(a