!function(a){if("object"==typeofexports)module.exports=a();elseif("function"==typeofdefine,1){varb;"undefined"!=typeofwindow?b=window:"undefined"!=typeofglobal?b=global:"undefined"!=typeofself&&(b=self),b.p2=a()}elsedefine(a)}(function(){returnfunctiona(b,c,d){functione(g,h){if(!c[g]){if(!b[g]){vari="function"==typeofrequire&&require;if(!h&&i)returni(g,!0);if(f)returnf(g,!0);thrownewError("Cannot find module '"+g+"'")}varj=c[g]={exports:{}};b[g][0].call(j.exports,function(a){varc=b[g][1][a];returne(c?c:a)},j,j.exports,a,b,c,d)}returnc[g].exports}for(varf="function"==typeofrequire&&require,g=0;g<d.length;g++)e(d[g]);returne}({1:[function(a,b,c){functiond(){}vare=a("./Scalar");b.exports=d,d.lineInt=function(a,b,c){c=c||0;vard,f,g,h,i,j,k,l=[0,0];returnd=a[1][1]-a[0][1],f=a[0][0]-a[1][0],g=d*a[0][0]+f*a[0][1],h=b[1][1]-b[0][1],i=b[0][0]-b[1][0],j=h*b[0][0]+i*b[0][1],k=d*i-h*f,e.eq(k,0,c)||(l[0]=(i*g-f*j)/k,l[1]=(d*j-h*g)/k),l},d.segmentsIntersect=function(a,b,c,d){vare=b[0]-a[0],f=b[1]-a[1],g=d[0]-c[0],h=d[1]-c[1];if(g*f-h*e==0)return!1;vari=(e*(c[1]-a[1])+f*(a[0]-c[0]))/(g*f-h*e),j=(g*(a[1]-c[1])+h*(c[0]-a[0]))/(h*e-g*f);returni>=0&&i<=1&&j>=0&&j<=1}},{"./Scalar":4}],2:[function(a,b,c){functiond(){}b.exports=d,d.area=function(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])},d.left=function(a,b,c){returnd.area(a,b,c)>0},d.leftOn=function(a,b,c){returnd.area(a,b,c)>=0},d.right=function(a,b,c){returnd.area(a,b,c)<0},d.rightOn=function(a,b,c){returnd.area(a,b,c)<=0};vare=[],f=[];d.collinear=function(a,b,c,g){if(g){varh=e,i=f;h[0]=b[0]-a[0],h[1]=b[1]-a[1],i[0]=c[0]-b[0],i[1]=c[1]-b[1];varj=h[0]*i[0]+h[1]*i[1],k=Math.sqrt(h[0]*h[0]+h[1]*h[1]),l=Math.sqrt(i[0]*i[0]+i[1]*i[1]),m=Math.acos(j/(k*l));returnm<g}return0==d.area(a,b,c)},d.sqdist=function(a,b){varc=b[0]-a[0],d=b[1]-a[1];returnc*c+d*d}},{}],3:[function(a,b,c){functiond(){this.vertices=[]}functione(a,b,c,d,e){e=e||0;varf=b[1]-a[1],g=a[0]-b[0],i=f*a[0]+g*a[1],j=d[1]-c[1],k=c[0]-d[0],l=j*c[0]+k*c[1],m=f*k-j*g;returnh.eq(m,0,e)?[0,0]:[(k*i-g*l)/m,(f*l-j*i)/m]}varf=a("./Line"),g=a("./Point"),h=a("./Scalar");b.exports=d,d.prototype.at=function(a){varb=this.vertices,c=b.length;returnb[a<0?a%c+c:a%c]},d.prototype.first=function(){returnthis.vertices[0]},d.prototype.last=function(){returnthis.vertices[this.vertices.length-1]},d.prototype.clear=function(){this.vertices.length=0},d.prototype.append=function(a,b,c){if("undefined"==typeofb)thrownewError("From is not given!");if("undefined"==typeofc)thrownewError("To is not given!");if(c-1<b)thrownewError("lol1");if(c>a.vertices.length)thrownewError("lol2");if(b<0)thrownewError("lol3");for(vard=b;d<c;d++)this.vertices.push(a.vertices[d])},d.prototype.makeCCW=function(){for(vara=0,b=this.vertices,c=1;c<this.vertices.length;++c)(b[c][1]<b[a][1]||b[c][1]==b[a][1]&&b[c][0]>b[a][0])&&(a=c);g.left(this.at(a-1),this.at(a),this.at(a+1))||this.reverse()},d.prototype.reverse=function(){for(vara=[],b=0,c=this.vertices.length;b!==c;b++)a.push(this.vertices.pop());this.vertices=a},d.prototype.isReflex=function(a){returng.right(this.at(a-1),this.at(a),this.at(a+1))};vari=[],j=[];d.prototype.canSee=function(a,b){varc,d,e=i,h=j;if(g.leftOn(this.at(a+1),this.at(a),this.at(b))&&g.rightOn(this.at(a-1),this.at(a),this.at(b)))return!1;d=g.sqdist(this.at(a),this.at(b));for(vark=0;k!==this.vertices.length;++k)if((k+1)%this.vertices.length!==a&&k!==a&&g.leftOn(this.at(a),this.at(b),this.at(k+1))&&g.rightOn(this.at(a),this.at(b),this.at(k))&&(e[0]=this.at(a),e[1]=this.at(b),h[0]=this.at(k),h[1]=this.at(k+1),c=f.lineInt(e,h),g.sqdist(this.at(a),c)<d))return!1;return!0},d.prototype.copy=function(a,b,c){vare=c||newd;if(e.clear(),a<b)for(varf=a;f<=b;f++)e.vertices.push(this.vertices[f]);else{for(varf=0;f<=b;f++)e.vertices.push(this.vertices[f]);for(varf=a;f<this.vertices.length;f++)e.vertices.push(this.vertices[f])}returne},d.prototype.getCutEdges=function(){for(vara=[],b=[],c=[],e=newd,f=Number.MAX_VALUE,g=0;g<this.vertices.length;++g)if(this.isReflex(g))for(varh=0;h<thi
this.type=d.STATIC,"undefined"!=typeofa.type?this.type=a.type:a.mass?this.type=d.DYNAMIC:this.type=d.STATIC,this.boundingRadius=0,this.aabb=newj,this.aabbNeedsUpdate=!0,this.allowSleep=void0===a.allowSleep||a.allowSleep,this.wantsToSleep=!1,this.sleepState=d.AWAKE,this.sleepSpeedLimit=void0!==a.sleepSpeedLimit?a.sleepSpeedLimit:.2,this.sleepTimeLimit=void0!==a.sleepTimeLimit?a.sleepTimeLimit:1,this.gravityScale=void0!==a.gravityScale?a.gravityScale:1,this.collisionResponse=void0===a.collisionResponse||a.collisionResponse,this.idleTime=0,this.timeLastSleepy=0,this.ccdSpeedThreshold=void0!==a.ccdSpeedThreshold?a.ccdSpeedThreshold:-1,this.ccdIterations=void0!==a.ccdIterations?a.ccdIterations:10,this.concavePath=null,this._wakeUpAfterNarrowphase=!1,this.updateMassProperties()}vare=a("../math/vec2"),f=a("poly-decomp"),g=a("../shapes/Convex"),h=a("../collision/RaycastResult"),i=a("../collision/Ray"),j=a("../collision/AABB"),k=a("../events/EventEmitter");b.exports=d,d.prototype=newk,d.prototype.constructor=d,d._idCounter=0,d.prototype.updateSolveMassProperties=function(){this.sleepState===d.SLEEPING||this.type===d.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve=0):(this.invMassSolve=this.invMass,this.invInertiaSolve=this.invInertia)},d.prototype.setDensity=function(a){varb=this.getArea();this.mass=b*a,this.updateMassProperties()},d.prototype.getArea=function(){for(vara=0,b=0;b<this.shapes.length;b++)a+=this.shapes[b].area;returna},d.prototype.getAABB=function(){returnthis.aabbNeedsUpdate&&this.updateAABB(),this.aabb};varl=newj,m=e.create();d.prototype.updateAABB=function(){for(vara=this.shapes,b=a.length,c=m,d=this.angle,f=0;f!==b;f++){varg=a[f],h=g.angle+d;e.rotate(c,g.position,d),e.add(c,c,this.position),g.computeAABB(l,c,h),0===f?this.aabb.copy(l):this.aabb.extend(l)}this.aabbNeedsUpdate=!1},d.prototype.updateBoundingRadius=function(){for(vara=this.shapes,b=a.length,c=0,d=0;d!==b;d++){varf=a[d],g=e.length(f.position),h=f.boundingRadius;g+h>c&&(c=g+h)}this.boundingRadius=c},d.prototype.addShape=function(a,b,c){if(a.body)thrownewError("A shape can only be added to one body.");a.body=this,b?e.copy(a.position,b):e.set(a.position,0,0),a.angle=c||0,this.shapes.push(a),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0},d.prototype.removeShape=function(a){varb=this.shapes.indexOf(a);returnb!==-1&&(this.shapes.splice(b,1),this.aabbNeedsUpdate=!0,a.body=null,!0)},d.prototype.updateMassProperties=function(){if(this.type===d.STATIC||this.type===d.KINEMATIC)this.mass=Number.MAX_VALUE,this.invMass=0,this.inertia=Number.MAX_VALUE,this.invInertia=0;else{vara=this.shapes,b=a.length,c=this.mass/b,f=0;if(this.fixedRotation)this.inertia=Number.MAX_VALUE,this.invInertia=0;else{for(varg=0;g<b;g++){varh=a[g],i=e.squaredLength(h.position),j=h.computeMomentOfInertia(c);f+=j+c*i}this.inertia=f,this.invInertia=f>0?1/f:0}this.invMass=1/this.mass,e.set(this.massMultiplier,this.fixedX?0:1,this.fixedY?0:1)}};e.create();d.prototype.applyForce=function(a,b){if(e.add(this.force,this.force,a),b){varc=e.crossLength(b,a);this.angularForce+=c}};varn=e.create(),o=e.create(),p=e.create();d.prototype.applyForceLocal=function(a,b){b=b||p;varc=n,d=o;this.vectorToWorldFrame(c,a),this.vectorToWorldFrame(d,b),this.applyForce(c,d)};varq=e.create();d.prototype.applyImpulse=function(a,b){if(this.type===d.DYNAMIC){varc=q;if(e.scale(c,a,this.invMass),e.multiply(c,this.massMultiplier,c),e.add(this.velocity,c,this.velocity),b){varf=e.crossLength(b,a);f*=this.invInertia,this.angularVelocity+=f}}};varr=e.create(),s=e.create(),t=e.create();d.prototype.applyImpulseLocal=function(a,b){b=b||t;varc=r,d=s;this.vectorToWorldFrame(c,a),this.vectorToWorldFrame(d,b),this.applyImpulse(c,d)},d.prototype.toLocalFrame=function(a,b){e.toLocalFrame(a,b,this.position,this.angle)},d.prototype.toWorldFrame=function(a,b){e.toGlobalFrame(a,b,this.position,this.angle)},d.prototype.vectorToLocalFrame=function(a,b){e.vectorToLocalFrame(a,b,this.angle)},d.prototype.vectorToWorldFrame=function(a,b){e.vectorToGlobalFrame(a,b,this.angle
this.useZeroRHS=!1,this.frictionIterations=void0!==a.frictionIterations?0:a.frictionIterations,this.usedIterations=0}functione(a){for(varb=a.length;b--;)a[b]=0}varf=a("../math/vec2"),g=a("./Solver"),h=a("../utils/Utils"),i=a("../equations/FrictionEquation");b.exports=d,d.prototype=newg,d.prototype.constructor=d,d.prototype.solve=function(a,b){this.sortEquations();varc=0,g=this.iterations,j=this.frictionIterations,k=this.equations,l=k.length,m=Math.pow(this.tolerance*l,2),n=b.bodies,o=b.bodies.length,p=(f.add,f.set,this.useZeroRHS),q=this.lambda;if(this.usedIterations=0,l)for(varr=0;r!==o;r++){vars=n[r];s.updateSolveMassProperties()}q.length<l&&(q=this.lambda=newh.ARRAY_TYPE(l+this.arrayStep),this.Bs=newh.ARRAY_TYPE(l+this.arrayStep),this.invCs=newh.ARRAY_TYPE(l+this.arrayStep)),e(q);for(vart=this.invCs,u=this.Bs,q=this.lambda,r=0;r!==k.length;r++){varv=k[r];(v.timeStep!==a||v.needsUpdate)&&(v.timeStep=a,v.update()),u[r]=v.computeB(v.a,v.b,a),t[r]=v.computeInvC(v.epsilon)}varv,w,r,x;if(0!==l){for(r=0;r!==o;r++){vars=n[r];s.resetConstraintVelocity()}if(j){for(c=0;c!==j;c++){for(w=0,x=0;x!==l;x++){v=k[x];vary=d.iterateEquation(x,v,v.epsilon,u,t,q,p,a,c);w+=Math.abs(y)}if(this.usedIterations++,w*w<=m)break}for(d.updateMultipliers(k,q,1/a),x=0;x!==l;x++){varz=k[x];if(zinstanceofi){for(varA=0,B=0;B!==z.contactEquations.length;B++)A+=z.contactEquations[B].multiplier;A*=z.frictionCoefficient/z.contactEquations.length,z.maxForce=A,z.minForce=-A}}}for(c=0;c!==g;c++){for(w=0,x=0;x!==l;x++){v=k[x];vary=d.iterateEquation(x,v,v.epsilon,u,t,q,p,a,c);w+=Math.abs(y)}if(this.usedIterations++,w*w<=m)break}for(r=0;r!==o;r++)n[r].addConstraintVelocity();d.updateMultipliers(k,q,1/a)}},d.updateMultipliers=function(a,b,c){for(vard=a.length;d--;)a[d].multiplier=b[d]*c},d.iterateEquation=function(a,b,c,d,e,f,g,h,i){varj=d[a],k=e[a],l=f[a],m=b.computeGWlambda(),n=b.maxForce,o=b.minForce;g&&(j=0);varp=k*(j-m-c*l),q=l+p;returnq<o*h?p=o*h-l:q>n*h&&(p=n*h-l),f[a]+=p,b.addToWlambda(p),p}},{"../equations/FrictionEquation":23,"../math/vec2":30,"../utils/Utils":57,"./Solver":47}],47:[function(a,b,c){functiond(a,b){a=a||{},e.call(this),this.type=b,this.equations=[],this.equationSortFunction=a.equationSortFunction||!1}vare=(a("../utils/Utils"),a("../events/EventEmitter"));b.exports=d,d.prototype=newe,d.prototype.constructor=d,d.prototype.solve=function(a,b){thrownewError("Solver.solve should be implemented by subclasses!")};varf={bodies:[]};d.prototype.solveIsland=function(a,b){this.removeAllEquations(),b.equations.length&&(this.addEquations(b.equations),f.bodies.length=0,b.getBodies(f.bodies),f.bodies.length&&this.solve(a,f))},d.prototype.sortEquations=function(){this.equationSortFunction&&this.equations.sort(this.equationSortFunction)},d.prototype.addEquation=function(a){a.enabled&&this.equations.push(a)},d.prototype.addEquations=function(a){for(varb=0,c=a.length;b!==c;b++){vard=a[b];d.enabled&&this.equations.push(d)}},d.prototype.removeEquation=function(a){varb=this.equations.indexOf(a);b!==-1&&this.equations.splice(b,1)},d.prototype.removeAllEquations=function(){this.equations.length=0},d.GS=1,d.ISLAND=2},{"../events/EventEmitter":26,"../utils/Utils":57}],48:[function(a,b,c){functiond(){f.apply(this,arguments)}vare=a("../equations/ContactEquation"),f=a("./Pool");b.exports=d,d.prototype=newf,d.prototype.constructor=d,d.prototype.create=function(){returnnewe},d.prototype.destroy=function(a){returna.bodyA=a.bodyB=null,this}},{"../equations/ContactEquation":21,"./Pool":55}],49:[function(a,b,c){functiond(){f.apply(this,arguments)}vare=a("../equations/FrictionEquation"),f=a("./Pool");b.exports=d,d.prototype=newf,d.prototype.constructor=d,d.prototype.create=function(){returnnewe},d.prototype.destroy=function(a){returna.bodyA=a.bodyB=null,this}},{"../equations/FrictionEquation":23,"./Pool":55}],50:[function(a,b,c){functiond(){f.apply(this,arguments)}vare=a("../world/IslandNode"),f=a("./Pool");b.exports=d,d.prototype=newf,d.prototype.constructor=d,d.prototype.create=function(){returnnewe},d.prototype.destroy=fu
varb=this.children.indexOf(a);if(b===-1)thrownewError("The supplied DisplayObject must be a child of the caller");returnb},d.DisplayObjectContainer.prototype.setChildIndex=function(a,b){if(b<0||b>=this.children.length)thrownewError("The supplied index is out of bounds");varc=this.getChildIndex(a);this.children.splice(c,1),this.children.splice(b,0,a)},d.DisplayObjectContainer.prototype.getChildAt=function(a){if(a<0||a>=this.children.length)thrownewError("getChildAt: Supplied index "+a+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");returnthis.children[a]},d.DisplayObjectContainer.prototype.removeChild=function(a){varb=this.children.indexOf(a);if(b!==-1)returnthis.removeChildAt(b)},d.DisplayObjectContainer.prototype.removeChildAt=function(a){varb=this.getChildAt(a);returnb&&(b.parent=void0,this.children.splice(a,1)),b},d.DisplayObjectContainer.prototype.removeChildren=function(a,b){void0===a&&(a=0),void0===b&&(b=this.children.length);varc=b-a;if(c>0&&c<=b){for(vard=this.children.splice(a,c),e=0;e<d.length;e++){varf=d[e];f.parent=void0}returnd}if(0===c&&0===this.children.length)return[];thrownewError("removeChildren: Range Error, numeric values are outside the acceptable range")},d.DisplayObjectContainer.prototype.updateTransform=function(){if(this.visible&&(this.displayObjectUpdateTransform(),!this._cacheAsBitmap))for(vara=0;a<this.children.length;a++)this.children[a].updateTransform()},d.DisplayObjectContainer.prototype.displayObjectContainerUpdateTransform=d.DisplayObjectContainer.prototype.updateTransform,d.DisplayObjectContainer.prototype.getBounds=function(a){varb=a&&ainstanceofd.DisplayObject,c=!0;b?c=ainstanceofd.DisplayObjectContainer&&a.contains(this):a=this;vare;if(b){varf=a.worldTransform;for(a.worldTransform=d.identityMatrix,e=0;e<a.children.length;e++)a.children[e].updateTransform()}varg,h,i,j=1/0,k=1/0,l=-(1/0),m=-(1/0),n=!1;for(e=0;e<this.children.length;e++){varo=this.children[e];o.visible&&(n=!0,g=this.children[e].getBounds(),j=j<g.x?j:g.x,k=k<g.y?k:g.y,h=g.width+g.x,i=g.height+g.y,l=l>h?l:h,m=m>i?m:i)}varp=this._bounds;if(!n){p=newd.Rectangle;varq=p.x,r=p.width+p.x,s=p.y,t=p.height+p.y,u=this.worldTransform,v=u.a,w=u.b,x=u.c,y=u.d,z=u.tx,A=u.ty,B=v*r+x*t+z,C=y*t+w*r+A,D=v*q+x*t+z,E=y*t+w*q+A,F=v*q+x*s+z,G=y*s+w*q+A,H=v*r+x*s+z,I=y*s+w*r+A;l=B,m=C,j=B,k=C,j=D<j?D:j,j=F<j?F:j,j=H<j?H:j,k=E<k?E:k,k=G<k?G:k,k=I<k?I:k,l=D>l?D:l,l=F>l?F:l,l=H>l?H:l,m=E>m?E:m,m=G>m?G:m,m=I>m?I:m}if(p.x=j,p.y=k,p.width=l-j,p.height=m-k,b)for(a.worldTransform=f,e=0;e<a.children.length;e++)a.children[e].updateTransform();if(!c){varJ=a.getBounds();p.x-=J.x,p.y-=J.y}returnp},d.DisplayObjectContainer.prototype.getLocalBounds=function(){returnthis.getBounds(this)},d.DisplayObjectContainer.prototype.contains=function(a){return!!a&&(a===this||this.contains(a.parent))},d.DisplayObjectContainer.prototype._renderWebGL=function(a){if(this.visible&&!(this.alpha<=0)){if(this._cacheAsBitmap)returnvoidthis._renderCachedSprite(a);varb;if(this._mask||this._filters){for(this._filters&&(a.spriteBatch.flush(),a.filterManager.pushFilter(this._filterBlock)),this._mask&&(a.spriteBatch.stop(),a.maskManager.pushMask(this.mask,a),a.spriteBatch.start()),b=0;b<this.children.length;b++)this.children[b]._renderWebGL(a);a.spriteBatch.stop(),this._mask&&a.maskManager.popMask(this._mask,a),this._filters&&a.filterManager.popFilter(),a.spriteBatch.start()}elsefor(b=0;b<this.children.length;b++)this.children[b]._renderWebGL(a)}},d.DisplayObjectContainer.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha){if(this._cacheAsBitmap)returnvoidthis._renderCachedSprite(a);this._mask&&a.maskManager.pushMask(this._mask,a);for(varb=0;b<this.children.length;b++)this.children[b]._renderCanvas(a);this._mask&&a.maskManager.popMask(a)}},Object.defineProperty(d.DisplayObjectContainer.prototype,"width",{get:function(){returnthis.getLocalBounds().width*this.scale.x},set:function(a){varb=this.getLocalBounds().width;0!==b?this.scale.x=a/b:this.scale.x=1,this._width=a
d.glContexts[this.glContextId]=a,d.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),this.extensions.compression={},etc1=a.getExtension("WEBGL_compressed_texture_etc1")||a.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),pvrtc=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),s3tc=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),etc1&&(this.extensions.compression.ETC1=etc1),pvrtc&&(this.extensions.compression.PVRTC=pvrtc),s3tc&&(this.extensions.compression.S3TC=s3tc)},d.WebGLRenderer.prototype.setTexturePriority=function(a){if(!d._enableMultiTextureToggle)returnvoidconsole.warn("setTexturePriority error: Multi Texture support hasn't been enabled in the Phaser Game Config.");for(varb=this.maxTextures,c=this.game.cache._cache.image,e=null,f=(this.gl,0);f<this.currentBatchedTextures.length;f++)e=a[g],einc&&(c[e].base.textureIndex=0);this.currentBatchedTextures.length=0;for(varg=0;g<a.length;++g)e=a[g],einc&&(g+1<b?c[e].base.textureIndex=g+1:c[e].base.textureIndex=b-1,this.currentBatchedTextures.push(e));returnthis.currentBatchedTextures},d.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)}},d.WebGLRenderer.prototype.renderDisplayObject=function(a,b,c,e){this.renderSession.blendModeManager.setBlendMode(d.blendModes.NORMAL),this.renderSession.drawCount=0,this.renderSession.flipY=c?-1:1,this.renderSession.projection=b,this.renderSession.offset=this.offset,this.spriteBatch.begin(this.renderSession),this.filterManager.begin(this.renderSession,c),a._renderWebGL(this.renderSession,e),this.spriteBatch.end()},d.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},d.WebGLRenderer.prototype.updateCompressedTexture=function(a){if(!a.hasLoaded)return!1;varb=this.gl,c=a.source;returna._glTextures[b.id]||(a._glTextures[b.id]=b.createTexture()),b.activeTexture(b.TEXTURE0+a.textureIndex),b.bindTexture(b.TEXTURE_2D,a._glTextures[b.id]),b.compressedTexImage2D(b.TEXTURE_2D,0,c.glExtensionFormat,c.width,c.height,0,c.textureData),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,a.scaleMode===d.scaleModes.LINEAR?b.LINEAR:b.NEAREST),a.mipmap&&d.isPowerOfTwo(a.width,a.height)?(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,a.scaleMode===d.scaleModes.LINEAR?b.LINEAR_MIPMAP_LINEAR:b.NEAREST_MIPMAP_NEAREST),b.generateMipmap(b.TEXTURE_2D)):b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,a.scaleMode===d.scaleModes.LINEAR?b.LINEAR:b.NEAREST),a._powerOf2?(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.REPEAT),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.REPEAT)):(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE)),a._dirty[b.id]=!1,!0},d.WebGLRenderer.prototype.updateTexture=function(a){if(!a.hasLoaded)return!1;if(a.source.compressionAlgorithm)returnthis.updateCompressedTexture(a);varb=this.gl;returna._glTextures[b.id]||(a._glTextures[b.id]=b.createTexture()),b.activeTexture(b.TEXTURE0+a.textureIndex),b.bindTexture(b.TE
this.onLoadStart.dispatch()),this.onLoadComplete.dispatch(),this.game.state.loadComplete(),this.reset())},asyncComplete:function(a,b){void0===b&&(b=""),a.loaded=!0,a.error=!!b,b&&(a.errorMessage=b,console.warn("Phaser.Loader - "+a.type+"["+a.key+"]: "+b)),this.processLoadQueue()},processPack:function(a){varb=a.data[a.key];if(!b)returnvoidconsole.warn("Phaser.Loader - "+a.key+": pack has data, but not for pack key");for(vard=0;d<b.length;d++){vare=b[d];switch(e.type){case"image":this.image(e.key,e.url,e.overwrite);break;case"text":this.text(e.key,e.url,e.overwrite);break;case"json":this.json(e.key,e.url,e.overwrite);break;case"xml":this.xml(e.key,e.url,e.overwrite);break;case"script":this.script(e.key,e.url,e.callback,a.callbackContext||this);break;case"binary":this.binary(e.key,e.url,e.callback,a.callbackContext||this);break;case"spritesheet":this.spritesheet(e.key,e.url,e.frameWidth,e.frameHeight,e.frameMax,e.margin,e.spacing);break;case"video":this.video(e.key,e.urls);break;case"audio":this.audio(e.key,e.urls,e.autoDecode);break;case"audiosprite":this.audiosprite(e.key,e.urls,e.jsonURL,e.jsonData,e.autoDecode);break;case"tilemap":this.tilemap(e.key,e.url,e.data,c.Tilemap[e.format]);break;case"physics":this.physics(e.key,e.url,e.data,c.Loader[e.format]);break;case"bitmapFont":this.bitmapFont(e.key,e.textureURL,e.atlasURL,e.atlasData,e.xSpacing,e.ySpacing);break;case"atlasJSONArray":this.atlasJSONArray(e.key,e.textureURL,e.atlasURL,e.atlasData);break;case"atlasJSONHash":this.atlasJSONHash(e.key,e.textureURL,e.atlasURL,e.atlasData);break;case"atlasXML":this.atlasXML(e.key,e.textureURL,e.atlasURL,e.atlasData);break;case"atlas":this.atlas(e.key,e.textureURL,e.atlasURL,e.atlasData,c.Loader[e.format]);break;case"shader":this.shader(e.key,e.url,e.overwrite)}}},transformUrl:function(a,b){return!!a&&(a.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/)?a:this.baseURL+b.path+a)},loadFile:function(a){switch(a.type){case"packfile":this.xhrLoad(a,this.transformUrl(a.url,a),"text",this.fileComplete);break;case"image":case"spritesheet":case"textureatlas":case"bitmapfont":this.loadImageTag(a);break;case"audio":a.url=this.getAudioURL(a.url),a.url?this.game.sound.usingWebAudio?this.xhrLoad(a,this.transformUrl(a.url,a),"arraybuffer",this.fileComplete):this.game.sound.usingAudioTag&&this.loadAudioTag(a):this.fileError(a,null,"No supported audio URL specified or device does not have audio playback support");break;case"video":a.url=this.getVideoURL(a.url),a.url?a.asBlob?this.xhrLoad(a,this.transformUrl(a.url,a),"blob",this.fileComplete):this.loadVideoTag(a):this.fileError(a,null,"No supported video URL specified or device does not have video playback support");break;case"json":this.xhrLoad(a,this.transformUrl(a.url,a),"text",this.jsonLoadComplete);break;case"xml":this.xhrLoad(a,this.transformUrl(a.url,a),"text",this.xmlLoadComplete);break;case"tilemap":a.format===c.Tilemap.TILED_JSON?this.xhrLoad(a,this.transformUrl(a.url,a),"text",this.jsonLoadComplete):a.format===c.Tilemap.CSV?this.xhrLoad(a,this.transformUrl(a.url,a),"text",this.csvLoadComplete):this.asyncComplete(a,"invalid Tilemap format: "+a.format);break;case"text":case"script":case"shader":case"physics":this.xhrLoad(a,this.transformUrl(a.url,a),"text",this.fileComplete);break;case"texture":"truecolor"===a.key.split("_").pop()&&this.loadImageTag(a);break;case"binary":this.xhrLoad(a,this.transformUrl(a.url,a),"arraybuffer",this.fileComplete)}},loadImageTag:function(a){varb=this;a.data=newImage,a.data.name=a.key,this.crossOrigin&&(a.data.crossOrigin=this.crossOrigin),a.data.onload=function(){a.data.onload&&(a.data.onload=null,a.data.onerror=null,b.fileComplete(a))},a.data.onerror=function(){a.data.onload&&(a.data.onload=null,a.data.onerror=null,b.fileError(a))},a.data.src=this.transformUrl(a.url,a),a.data.complete&&a.data.width&&a.data.height&&(a.data.onload=null,a.data.onerror=null,this.fileComplete(a))},loadVideoTag:function(a){varb=this;a.data=document.createElement("video"),a.data.name=a.key,a.data.controls=!1,a.data.autoplay=!1;vard=function(){a.data.removeEventListener
bodies:[],data:[]}],images:[],objects:{},collision:{},tilesets:[],tiles:[]}},parseTiledJSON:function(a){functionb(a,b){varc={};for(vardinb){vare=b[d];"undefined"!=typeofa[e]&&(c[e]=a[e])}returnc}if("orthogonal"!==a.orientation)returnconsole.warn("TilemapParser.parseTiledJSON - Only orthogonal map types are supported in this version of Phaser"),null;for(vard={width:a.width,height:a.height,tileWidth:a.tilewidth,tileHeight:a.tileheight,orientation:a.orientation,format:c.Tilemap.TILED_JSON,version:a.version,properties:a.properties,widthInPixels:a.width*a.tilewidth,heightInPixels:a.height*a.tileheight},e=[],f=0;f<a.layers.length;f++)if("tilelayer"===a.layers[f].type){varg=a.layers[f];if(!g.compression&&g.encoding&&"base64"===g.encoding){for(varh=window.atob(g.data),i=h.length,j=newArray(i),k=0;k<i;k+=4)j[k/4]=(h.charCodeAt(k)|h.charCodeAt(k+1)<<8|h.charCodeAt(k+2)<<16|h.charCodeAt(k+3)<<24)>>>0;g.data=j,deleteg.encoding}elseif(g.compression){console.warn("TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer '"+g.name+"'");continue}varl={name:g.name,x:g.x,y:g.y,width:g.width,height:g.height,widthInPixels:g.width*a.tilewidth,heightInPixels:g.height*a.tileheight,alpha:g.opacity,visible:g.visible,properties:{},indexes:[],callbacks:[],bodies:[]};g.properties&&(l.properties=g.properties);for(varm,n,o,p,q=0,r=[],s=[],t=0,i=g.data.length;t<i;t++){if(m=0,n=!1,p=g.data[t],o=0,p>536870912)switch(p>2147483648&&(p-=2147483648,o+=4),p>1073741824&&(p-=1073741824,o+=2),p>536870912&&(p-=536870912,o+=1),o){case5:m=Math.PI/2;break;case6:m=Math.PI;break;case3:m=3*Math.PI/2;break;case4:m=0,n=!0;break;case7:m=Math.PI/2,n=!0;break;case2:m=Math.PI,n=!0;break;case1:m=3*Math.PI/2,n=!0}if(p>0){varu=newc.Tile(l,p,q,s.length,a.tilewidth,a.tileheight);u.rotation=m,u.flipped=n,0!==o&&(u.flippedVal=o),r.push(u)}elsec.TilemapParser.INSERT_NULL?r.push(null):r.push(newc.Tile(l,(-1),q,s.length,a.tilewidth,a.tileheight));q++,q===g.width&&(s.push(r),q=0,r=[])}l.data=s,e.push(l)}d.layers=e;for(varv=[],f=0;f<a.layers.length;f++)if("imagelayer"===a.layers[f].type){varw=a.layers[f],x={name:w.name,image:w.image,x:w.x,y:w.y,alpha:w.opacity,visible:w.visible,properties:{}};w.properties&&(x.properties=w.properties),v.push(x)}d.images=v;for(vary=[],z=[],A=null,f=0;f<a.tilesets.length;f++){varB=a.tilesets[f];if(B.image){varC=newc.Tileset(B.name,B.firstgid,B.tilewidth,B.tileheight,B.margin,B.spacing,B.properties);B.tileproperties&&(C.tileProperties=B.tileproperties),C.updateTileData(B.imagewidth,B.imageheight),y.push(C)}else{varD=newc.ImageCollection(B.name,B.firstgid,B.tilewidth,B.tileheight,B.margin,B.spacing,B.properties);for(varEinB.tiles){varx=B.tiles[E].image,p=B.firstgid+parseInt(E,10);D.addImage(p,x)}z.push(D)}A&&(A.lastgid=B.firstgid-1),A=B}d.tilesets=y,d.imagecollections=z;for(varF={},G={},f=0;f<a.layers.length;f++)if("objectgroup"===a.layers[f].type){varH=a.layers[f];F[H.name]=[],G[H.name]=[];for(varI=0,i=H.objects.length;I<i;I++)if(H.objects[I].gid){varJ={gid:H.objects[I].gid,name:H.objects[I].name,type:H.objects[I].hasOwnProperty("type")?H.objects[I].type:"",x:H.objects[I].x,y:H.objects[I].y,visible:H.objects[I].visible,properties:H.objects[I].properties};H.objects[I].rotation&&(J.rotation=H.objects[I].rotation),F[H.name].push(J)}elseif(H.objects[I].polyline){varJ={name:H.objects[I].name,type:H.objects[I].type,x:H.objects[I].x,y:H.objects[I].y,width:H.objects[I].width,height:H.objects[I].height,visible:H.objects[I].visible,properties:H.objects[I].properties};H.objects[I].rotation&&(J.rotation=H.objects[I].rotation),J.polyline=[];for(varK=0;K<H.objects[I].polyline.length;K++)J.polyline.push([H.objects[I].polyline[K].x,H.objects[I].polyline[K].y]);G[H.name].push(J),F[H.name].push(J)}elseif(H.objects[I].polygon){varJ=b(H.objects[I],["name","type","x","y","visible","rotation","properties"]);J.polygon=[];for(varK=0;K<H.objects[I].polygon.length;K++)J.polygon.push([H.objects[I].polygon[K].x,H.objects[I].polygon[K].y]);F[H.name].push(J)}elseif(H.objects[I].ellipse){varJ=b(H.objects[I],["na
this.onPlay.dispatch(this,this.loop,this.playbackRate)))},complete:function(){this.onComplete.dispatch(this)},play:function(a,b){returnvoid0===a&&(a=!1),void0===b&&(b=1),this.game.sound.onMute&&(this.game.sound.onMute.add(this.setMute,this),this.game.sound.onUnMute.add(this.unsetMute,this),this.game.sound.mute&&this.setMute()),this.game.onPause.add(this.setPause,this),this.game.onResume.add(this.setResume,this),this._endCallback=this.complete.bind(this),this.video.addEventListener("ended",this._endCallback,!0),this.video.addEventListener("webkitendfullscreen",this._endCallback,!0),a?this.video.loop="loop":this.video.loop="",this.video.playbackRate=b,this.touchLocked?this._pending=!0:(this._pending=!1,null!==this.key&&(4!==this.video.readyState?(this.retry=this.retryLimit,this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval)):(this._playCallback=this.playHandler.bind(this),this.video.addEventListener("playing",this._playCallback,!0))),this.video.play(),this.onPlay.dispatch(this,a,b)),this},playHandler:function(){this.video.removeEventListener("playing",this._playCallback,!0),this.updateTexture()},stop:function(){returnthis.game.sound.onMute&&(this.game.sound.onMute.remove(this.setMute,this),this.game.sound.onUnMute.remove(this.unsetMute,this)),this.game.onPause.remove(this.setPause,this),this.game.onResume.remove(this.setResume,this),this.isStreaming?(this.video.mozSrcObject?(this.video.mozSrcObject.stop(),this.video.src=null):(this.video.src="",this.videoStream.active?this.videoStream.active=!1:this.videoStream.getTracks?this.videoStream.getTracks().forEach(function(a){a.stop()}):this.videoStream.stop()),this.videoStream=null,this.isStreaming=!1):(this.video.removeEventListener("ended",this._endCallback,!0),this.video.removeEventListener("webkitendfullscreen",this._endCallback,!0),this.video.removeEventListener("playing",this._playCallback,!0),this.touchLocked?this._pending=!1:this.video.pause()),this},add:function(a){if(Array.isArray(a))for(varb=0;b<a.length;b++)a[b].loadTexture&&a[b].loadTexture(this);elsea.loadTexture(this);returnthis},addToWorld:function(a,b,c,d,e,f){e=e||1,f=f||1;varg=this.game.add.image(a,b,this);returng.anchor.set(c,d),g.scale.set(e,f),g},render:function(){!this.disableTextureUpload&&this.playing&&this.baseTexture.dirty()},setMute:function(){this._muted||(this._muted=!0,this.video.muted=!0)},unsetMute:function(){this._muted&&!this._codeMuted&&(this._muted=!1,this.video.muted=!1)},setPause:function(){this._paused||this.touchLocked||(this._paused=!0,this.video.pause())},setResume:function(){!this._paused||this._codePaused||this.touchLocked||(this._paused=!1,this.video.ended||this.video.play())},changeSource:function(a,b){returnvoid0===b&&(b=!0),this.texture.valid=!1,this.video.pause(),this.retry=this.retryLimit,this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval),this.video.src=a,this.video.load(),this._autoplay=b,b||(this.paused=!0),this},checkVideoProgress:function(){4===this.video.readyState?this.updateTexture():(this.retry--,this.retry>0?this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval):console.warn("Phaser.Video: Unable to start downloading video in time",this.isStreaming))},setTouchLock:function(){this.game.input.touch.addTouchLockCallback(this.unlock,this),this.touchLocked=!0},unlock:function(){if(this.touchLocked=!1,this.video.play(),this.onPlay.dispatch(this,this.loop,this.playbackRate),this.key){vara=this.game.cache.getVideo(this.key);a&&!a.isBlob&&(a.locked=!1)}return!0},grab:function(a,b,c){returnvoid0===a&&(a=!1),void0===b&&(b=1),void0===c&&(c=null),null===this.snapshot?voidconsole.warn("Video.grab cannot run because Phaser.BitmapData is unavailable"):(a&&this.snapshot.cls(),this.snapshot.copy(this.video,0,0,this.width,this.height,0,0,this.width,this.height,0,0,0,1,1,b,c),this.snapshot)},removeVideoElement:function(){if(this.video){for(this.video.parentNode&&this.video.parentNode.removeChild(this.video);this.video.hasChildNodes();)this.video.removeChild(this.video.fi