Files
phaser/build/phaser-min.js
T

1 line
256 KiB
JavaScript

var PIXI=PIXI||{};var Phaser=Phaser||{VERSION:"1.0.0",GAMES:[],AUTO:0,CANVAS:1,WEBGL:2};PIXI.InteractionManager=function(c){};Phaser.Utils={isPlainObject:function(d){if(typeof(d)!=="object"||d.nodeType||d===d.window){return false}try{if(d.constructor&&!hasOwn.call(d.constructor.prototype,"isPrototypeOf")){return false}}catch(c){return false}return true},extend:function(){var n,e,c,d,k,l,j=arguments[0]||{},h=1,f=arguments.length,m=false;if(typeof j==="boolean"){m=j;j=arguments[1]||{};h=2}if(f===h){j=this;--h}for(;h<f;h++){if((n=arguments[h])!=null){for(e in n){c=j[e];d=n[e];if(j===d){continue}if(m&&d&&(Phaser.Utils.isPlainObject(d)||(k=Array.isArray(d)))){if(k){k=false;l=c&&Array.isArray(c)?c:[]}else{l=c&&Phaser.Utils.isPlainObject(c)?c:{}}j[e]=extend(m,l,d)}else{if(d!==undefined){j[e]=d}}}}}return j}};function HEXtoRGB(c){return[(c>>16&255)/255,(c>>8&255)/255,(c&255)/255]}if(typeof Function.prototype.bind!="function"){Function.prototype.bind=(function(){var c=Array.prototype.slice;return function(d){var h=this,i=c.call(arguments,1);if(typeof h!="function"){throw new TypeError()}function e(){var j=i.concat(c.call(arguments));h.apply(this instanceof e?this:d,j)}e.prototype=(function f(j){j&&(f.prototype=j);if(!(this instanceof f)){return new f}})(h.prototype);return e}})()}function determineMatrixArrayType(){PIXI.Matrix=(typeof Float32Array!=="undefined")?Float32Array:Array;return PIXI.Matrix}determineMatrixArrayType();PIXI.mat3={};PIXI.mat3.create=function(){var c=new PIXI.Matrix(9);c[0]=1;c[1]=0;c[2]=0;c[3]=0;c[4]=1;c[5]=0;c[6]=0;c[7]=0;c[8]=1;return c};PIXI.mat3.identity=function(c){c[0]=1;c[1]=0;c[2]=0;c[3]=0;c[4]=1;c[5]=0;c[6]=0;c[7]=0;c[8]=1;return c};PIXI.mat4={};PIXI.mat4.create=function(){var c=new PIXI.Matrix(16);c[0]=1;c[1]=0;c[2]=0;c[3]=0;c[4]=0;c[5]=1;c[6]=0;c[7]=0;c[8]=0;c[9]=0;c[10]=1;c[11]=0;c[12]=0;c[13]=0;c[14]=0;c[15]=1;return c};PIXI.mat3.multiply=function(t,j,k){if(!k){k=t}var A=t[0],z=t[1],w=t[2],i=t[3],h=t[4],f=t[5],q=t[6],p=t[7],o=t[8],n=j[0],m=j[1],l=j[2],v=j[3],u=j[4],s=j[5],e=j[6],d=j[7],c=j[8];k[0]=n*A+m*i+l*q;k[1]=n*z+m*h+l*p;k[2]=n*w+m*f+l*o;k[3]=v*A+u*i+s*q;k[4]=v*z+u*h+s*p;k[5]=v*w+u*f+s*o;k[6]=e*A+d*i+c*q;k[7]=e*z+d*h+c*p;k[8]=e*w+d*f+c*o;return k};PIXI.mat3.clone=function(d){var c=new PIXI.Matrix(9);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];return c};PIXI.mat3.transpose=function(e,d){if(!d||e===d){var h=e[1],f=e[2],c=e[5];e[1]=e[3];e[2]=e[6];e[3]=h;e[5]=e[7];e[6]=f;e[7]=c;return e}d[0]=e[0];d[1]=e[3];d[2]=e[6];d[3]=e[1];d[4]=e[4];d[5]=e[7];d[6]=e[2];d[7]=e[5];d[8]=e[8];return d};PIXI.mat3.toMat4=function(d,c){if(!c){c=PIXI.mat4.create()}c[15]=1;c[14]=0;c[13]=0;c[12]=0;c[11]=0;c[10]=d[8];c[9]=d[7];c[8]=d[6];c[7]=0;c[6]=d[5];c[5]=d[4];c[4]=d[3];c[3]=0;c[2]=d[2];c[1]=d[1];c[0]=d[0];return c};PIXI.mat4.create=function(){var c=new PIXI.Matrix(16);c[0]=1;c[1]=0;c[2]=0;c[3]=0;c[4]=0;c[5]=1;c[6]=0;c[7]=0;c[8]=0;c[9]=0;c[10]=1;c[11]=0;c[12]=0;c[13]=0;c[14]=0;c[15]=1;return c};PIXI.mat4.transpose=function(f,e){if(!e||f===e){var k=f[1],i=f[2],h=f[3],c=f[6],j=f[7],d=f[11];f[1]=f[4];f[2]=f[8];f[3]=f[12];f[4]=k;f[6]=f[9];f[7]=f[13];f[8]=i;f[9]=c;f[11]=f[14];f[12]=h;f[13]=j;f[14]=d;return f}e[0]=f[0];e[1]=f[4];e[2]=f[8];e[3]=f[12];e[4]=f[1];e[5]=f[5];e[6]=f[9];e[7]=f[13];e[8]=f[2];e[9]=f[6];e[10]=f[10];e[11]=f[14];e[12]=f[3];e[13]=f[7];e[14]=f[11];e[15]=f[15];return e};PIXI.mat4.multiply=function(s,k,m){if(!m){m=s}var A=s[0],z=s[1],v=s[2],t=s[3];var j=s[4],h=s[5],e=s[6],c=s[7];var q=s[8],p=s[9],o=s[10],n=s[11];var C=s[12],B=s[13],w=s[14],u=s[15];var l=k[0],i=k[1],f=k[2],d=k[3];m[0]=l*A+i*j+f*q+d*C;m[1]=l*z+i*h+f*p+d*B;m[2]=l*v+i*e+f*o+d*w;m[3]=l*t+i*c+f*n+d*u;l=k[4];i=k[5];f=k[6];d=k[7];m[4]=l*A+i*j+f*q+d*C;m[5]=l*z+i*h+f*p+d*B;m[6]=l*v+i*e+f*o+d*w;m[7]=l*t+i*c+f*n+d*u;l=k[8];i=k[9];f=k[10];d=k[11];m[8]=l*A+i*j+f*q+d*C;m[9]=l*z+i*h+f*p+d*B;m[10]=l*v+i*e+f*o+d*w;m[11]=l*t+i*c+f*n+d*u;l=k[12];i=k[13];f=k[14];d=k[15];m[12]=l*A+i*j+f*q+d*C;m[13]=l*z+i*h+f*p+d*B;m[14]=l*v+i*e+f*o+d*w;m[15]=l*t+i*c+f*n+d*u;return m};PIXI.Point=function(c,d){this.x=c||0;this.y=d||0};PIXI.Point.prototype.clone=function(){return new PIXI.Point(this.x,this.y)};PIXI.Point.prototype.constructor=PIXI.Point;PIXI.Rectangle=function(d,f,e,c){this.x=d||0;this.y=f||0;this.width=e||0;this.height=c||0};PIXI.Rectangle.prototype.clone=function(){return new PIXI.Rectangle(this.x,this.y,this.width,this.height)};PIXI.Rectangle.prototype.contains=function(c,f){if(this.width<=0||this.height<=0){return false}var d=this.x;if(c>=d&&c<=d+this.width){var e=this.y;if(f>=e&&f<=e+this.height){return true}}return false};PIXI.Rectangle.prototype.constructor=PIXI.Rectangle;PIXI.DisplayObject=function(){this.last=this;this.first=this;this.position=new PIXI.Point();this.scale=new PIXI.Point(1,1);this.pivot=new PIXI.Point(0,0);this.rotation=0;this.alpha=1;this.visible=true;this.hitArea=null;this.buttonMode=false;this.renderable=false;this.parent=null;this.stage=null;this.worldAlpha=1;this._interactive=false;this.worldTransform=PIXI.mat3.create();this.localTransform=PIXI.mat3.create();this.color=[];this.dynamic=true;this._sr=0;this._cr=1};PIXI.DisplayObject.prototype.constructor=PIXI.DisplayObject;PIXI.DisplayObject.prototype.setInteractive=function(c){this.interactive=c};Object.defineProperty(PIXI.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(c){this._interactive=c;if(this.stage){this.stage.dirty=true}}});Object.defineProperty(PIXI.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(c){this._mask=c;if(c){this.addFilter(c)}else{this.removeFilter()}}});PIXI.DisplayObject.prototype.addFilter=function(l){if(this.filter){return}this.filter=true;var c=new PIXI.FilterBlock();var f=new PIXI.FilterBlock();c.mask=l;f.mask=l;c.first=c.last=this;f.first=f.last=this;c.open=true;var e=c;var h=c;var k;var j;j=this.first._iPrev;if(j){k=j._iNext;e._iPrev=j;j._iNext=e}else{k=this}if(k){k._iPrev=h;h._iNext=k}var e=f;var h=f;var k=null;var j=null;j=this.last;k=j._iNext;if(k){k._iPrev=h;h._iNext=k}e._iPrev=j;j._iNext=e;var d=this;var i=this.last;while(d){if(d.last==i){d.last=f}d=d.parent}this.first=c;if(this.__renderGroup){this.__renderGroup.addFilterBlocks(c,f)}l.renderable=false};PIXI.DisplayObject.prototype.removeFilter=function(){if(!this.filter){return}this.filter=false;var e=this.first;var i=e._iNext;var j=e._iPrev;if(i){i._iPrev=j}if(j){j._iNext=i}this.first=e._iNext;var f=this.last;var i=f._iNext;var j=f._iPrev;if(i){i._iPrev=j}j._iNext=i;var h=f._iPrev;var d=this;while(d.last==f){d.last=h;d=d.parent;if(!d){break}}var c=e.mask;c.renderable=true;if(this.__renderGroup){this.__renderGroup.removeFilterBlocks(e,f)}};PIXI.DisplayObject.prototype.updateTransform=function(){if(this.rotation!==this.rotationCache){this.rotationCache=this.rotation;this._sr=Math.sin(this.rotation);this._cr=Math.cos(this.rotation)}var u=this.localTransform;var h=this.parent.worldTransform;var c=this.worldTransform;u[0]=this._cr*this.scale.x;u[1]=-this._sr*this.scale.y;u[3]=this._sr*this.scale.x;u[4]=this._cr*this.scale.y;var p=this.pivot.x;var o=this.pivot.y;var k=u[0],j=u[1],i=this.position.x-u[0]*p-o*u[1],t=u[3],s=u[4],q=this.position.y-u[4]*o-p*u[3],n=h[0],m=h[1],l=h[2],f=h[3],e=h[4],d=h[5];u[2]=i;u[5]=q;c[0]=n*k+m*t;c[1]=n*j+m*s;c[2]=n*i+m*q+l;c[3]=f*k+e*t;c[4]=f*j+e*s;c[5]=f*i+e*q+d;this.worldAlpha=this.alpha*this.parent.worldAlpha;this.vcount=PIXI.visibleCount};PIXI.visibleCount=0;PIXI.DisplayObjectContainer=function(){PIXI.DisplayObject.call(this);this.children=[]};PIXI.DisplayObjectContainer.prototype=Object.create(PIXI.DisplayObject.prototype);PIXI.DisplayObjectContainer.prototype.constructor=PIXI.DisplayObjectContainer;PIXI.DisplayObjectContainer.prototype.addChild=function(k){if(k.parent!=undefined){k.parent.removeChild(k)}k.parent=this;this.children.push(k);if(this.stage){var h=k;do{if(h.interactive){this.stage.dirty=true}h.stage=this.stage;h=h._iNext}while(h)}var f=k.first;var e=k.last;var i;var j;if(this.filter){j=this.last._iPrev}else{j=this.last}i=j._iNext;var d=this;var c=j;while(d){if(d.last==c){d.last=k.last}d=d.parent}if(i){i._iPrev=e;e._iNext=i}f._iPrev=j;j._iNext=f;if(this.__renderGroup){if(k.__renderGroup){k.__renderGroup.removeDisplayObjectAndChildren(k)}this.__renderGroup.addDisplayObjectAndChildren(k)}};PIXI.DisplayObjectContainer.prototype.addChildAt=function(d,h){if(h>=0&&h<=this.children.length){if(d.parent!=undefined){d.parent.removeChild(d)}d.parent=this;if(this.stage){var f=d;do{if(f.interactive){this.stage.dirty=true}f.stage=this.stage;f=f._iNext}while(f)}var e=d.first;var i=d.last;var l;var k;if(h==this.children.length){k=this.last;var c=this;var j=this.last;while(c){if(c.last==j){c.last=d.last}c=c.parent}}else{if(h==0){k=this}else{k=this.children[h-1].last}}l=k._iNext;if(l){l._iPrev=i;i._iNext=l}e._iPrev=k;k._iNext=e;this.children.splice(h,0,d);if(this.__renderGroup){if(d.__renderGroup){d.__renderGroup.removeDisplayObjectAndChildren(d)}this.__renderGroup.addDisplayObjectAndChildren(d)}}else{throw new Error(d+" The index "+h+" supplied is out of bounds "+this.children.length)}};PIXI.DisplayObjectContainer.prototype.swapChildren=function(d,c){return};PIXI.DisplayObjectContainer.prototype.getChildAt=function(c){if(c>=0&&c<this.children.length){return this.children[c]}else{throw new Error(child+" Both the supplied DisplayObjects must be a child of the caller "+this)}};PIXI.DisplayObjectContainer.prototype.removeChild=function(d){var h=this.children.indexOf(d);if(h!==-1){var e=d.first;var i=d.last;var k=i._iNext;var j=e._iPrev;if(k){k._iPrev=j}j._iNext=k;if(this.last==i){var l=e._iPrev;var c=this;while(c.last==i.last){c.last=l;c=c.parent;if(!c){break}}}i._iNext=null;e._iPrev=null;if(this.stage){var f=d;do{if(f.interactive){this.stage.dirty=true}f.stage=null;f=f._iNext}while(f)}if(d.__renderGroup){d.__renderGroup.removeDisplayObjectAndChildren(d)}d.parent=undefined;this.children.splice(h,1)}else{throw new Error(d+" The supplied DisplayObject must be a child of the caller "+this)}};PIXI.DisplayObjectContainer.prototype.updateTransform=function(){if(!this.visible){return}PIXI.DisplayObject.prototype.updateTransform.call(this);for(var d=0,c=this.children.length;d<c;d++){this.children[d].updateTransform()}};PIXI.blendModes={};PIXI.blendModes.NORMAL=0;PIXI.blendModes.SCREEN=1;PIXI.Sprite=function(c){PIXI.DisplayObjectContainer.call(this);this.anchor=new PIXI.Point();this.texture=c;this.blendMode=PIXI.blendModes.NORMAL;this._width=0;this._height=0;if(c.baseTexture.hasLoaded){this.updateFrame=true}else{this.onTextureUpdateBind=this.onTextureUpdate.bind(this);this.texture.addEventListener("update",this.onTextureUpdateBind)}this.renderable=true};PIXI.Sprite.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Sprite.prototype.constructor=PIXI.Sprite;Object.defineProperty(PIXI.Sprite.prototype,"width",{get:function(){return this.scale.x*this.texture.frame.width},set:function(c){this.scale.x=c/this.texture.frame.width;this._width=c}});Object.defineProperty(PIXI.Sprite.prototype,"height",{get:function(){return this.scale.y*this.texture.frame.height},set:function(c){this.scale.y=c/this.texture.frame.height;this._height=c}});PIXI.Sprite.prototype.setTexture=function(c){if(this.texture.baseTexture!=c.baseTexture){this.textureChange=true;this.texture=c;if(this.__renderGroup){this.__renderGroup.updateTexture(this)}}else{this.texture=c}this.updateFrame=true};PIXI.Sprite.prototype.onTextureUpdate=function(c){console.log("pot");if(this._width){this.scale.x=this._width/this.texture.frame.width}if(this._height){this.scale.y=this._height/this.texture.frame.height}this.updateFrame=true};PIXI.Sprite.fromFrame=function(d){var c=PIXI.TextureCache[d];if(!c){throw new Error("The frameId '"+d+"' does not exist in the texture cache"+this)}return new PIXI.Sprite(c)};PIXI.Sprite.fromImage=function(c){var d=PIXI.Texture.fromImage(c);return new PIXI.Sprite(d)};PIXI.MovieClip=function(c){PIXI.Sprite.call(this,c[0]);this.textures=c;this.animationSpeed=1;this.loop=true;this.onComplete=null;this.currentFrame=0;this.playing=false};PIXI.MovieClip.prototype=Object.create(PIXI.Sprite.prototype);PIXI.MovieClip.prototype.constructor=PIXI.MovieClip;PIXI.MovieClip.prototype.stop=function(){this.playing=false};PIXI.MovieClip.prototype.play=function(){this.playing=true};PIXI.MovieClip.prototype.gotoAndStop=function(d){this.playing=false;this.currentFrame=d;var c=(this.currentFrame+0.5)|0;this.setTexture(this.textures[c%this.textures.length])};PIXI.MovieClip.prototype.gotoAndPlay=function(c){this.currentFrame=c;this.playing=true};PIXI.MovieClip.prototype.updateTransform=function(){PIXI.Sprite.prototype.updateTransform.call(this);if(!this.playing){return}this.currentFrame+=this.animationSpeed;var c=(this.currentFrame+0.5)|0;if(this.loop||c<this.textures.length){this.setTexture(this.textures[c%this.textures.length])}else{if(c>=this.textures.length){this.gotoAndStop(this.textures.length-1);if(this.onComplete){this.onComplete()}}}};PIXI.Stage=function(d,c){PIXI.DisplayObjectContainer.call(this);this.worldTransform=PIXI.mat3.create();this.interactive=c;this.interactionManager=new PIXI.InteractionManager(this);this.dirty=true;this.__childrenAdded=[];this.__childrenRemoved=[];this.stage=this;this.stage.hitArea=new PIXI.Rectangle(0,0,100000,100000);this.setBackgroundColor(d);this.worldVisible=true};PIXI.Stage.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Stage.prototype.constructor=PIXI.Stage;PIXI.Stage.prototype.updateTransform=function(){this.worldAlpha=1;this.vcount=PIXI.visibleCount;for(var d=0,c=this.children.length;d<c;d++){this.children[d].updateTransform()}if(this.dirty){this.dirty=false;this.interactionManager.dirty=true}if(this.interactive){this.interactionManager.update()}};PIXI.Stage.prototype.setBackgroundColor=function(c){this.backgroundColor=c||0;this.backgroundColorSplit=HEXtoRGB(this.backgroundColor);var d=this.backgroundColor.toString(16);d="000000".substr(0,6-d.length)+d;this.backgroundColorString="#"+d};PIXI.Stage.prototype.getMousePosition=function(){return this.interactionManager.mouse.global};PIXI.CustomRenderable=function(){PIXI.DisplayObject.call(this)};PIXI.CustomRenderable.prototype=Object.create(PIXI.DisplayObject.prototype);PIXI.CustomRenderable.prototype.constructor=PIXI.CustomRenderable;PIXI.CustomRenderable.prototype.renderCanvas=function(c){};PIXI.CustomRenderable.prototype.initWebGL=function(c){};PIXI.CustomRenderable.prototype.renderWebGL=function(d,c){};PIXI.Strip=function(f,e,c){PIXI.DisplayObjectContainer.call(this);this.texture=f;this.blendMode=PIXI.blendModes.NORMAL;try{this.uvs=new Float32Array([0,1,1,1,1,0,0,1]);this.verticies=new Float32Array([0,0,0,0,0,0,0,0,0]);this.colors=new Float32Array([1,1,1,1]);this.indices=new Uint16Array([0,1,2,3])}catch(d){this.uvs=[0,1,1,1,1,0,0,1];this.verticies=[0,0,0,0,0,0,0,0,0];this.colors=[1,1,1,1];this.indices=[0,1,2,3]}this.width=e;this.height=c;if(f.baseTexture.hasLoaded){this.width=this.texture.frame.width;this.height=this.texture.frame.height;this.updateFrame=true}else{this.onTextureUpdateBind=this.onTextureUpdate.bind(this);this.texture.addEventListener("update",this.onTextureUpdateBind)}this.renderable=true};PIXI.Strip.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Strip.prototype.constructor=PIXI.Strip;PIXI.Strip.prototype.setTexture=function(c){this.texture=c;this.width=c.frame.width;this.height=c.frame.height;this.updateFrame=true};PIXI.Strip.prototype.onTextureUpdate=function(c){this.updateFrame=true};PIXI.Rope=function(e,d){PIXI.Strip.call(this,e);this.points=d;try{this.verticies=new Float32Array(d.length*4);this.uvs=new Float32Array(d.length*4);this.colors=new Float32Array(d.length*2);this.indices=new Uint16Array(d.length*2)}catch(c){this.verticies=verticies;this.uvs=uvs;this.colors=colors;this.indices=indices}this.refresh()};PIXI.Rope.prototype=Object.create(PIXI.Strip.prototype);PIXI.Rope.prototype.constructor=PIXI.Rope;PIXI.Rope.prototype.refresh=function(){var o=this.points;if(o.length<1){return}var e=this.uvs;var p=this.indices;var c=this.colors;var m=o[0];var l;var d={x:0,y:0};var n=o[0];this.count-=0.2;e[0]=0;e[1]=1;e[2]=0;e[3]=1;c[0]=1;c[1]=1;p[0]=0;p[1]=1;var k=o.length;for(var f=1;f<k;f++){var n=o[f];var j=f*4;var h=f/(k-1);if(f%2){e[j]=h;e[j+1]=0;e[j+2]=h;e[j+3]=1}else{e[j]=h;e[j+1]=0;e[j+2]=h;e[j+3]=1}j=f*2;c[j]=1;c[j+1]=1;j=f*2;p[j]=j;p[j+1]=j+1;m=n}};PIXI.Rope.prototype.updateTransform=function(){var p=this.points;if(p.length<1){return}var c=this.verticies;var n=p[0];var l;var d={x:0,y:0};var o=p[0];this.count-=0.2;c[0]=o.x+d.x;c[1]=o.y+d.y;c[2]=o.x-d.x;c[3]=o.y-d.y;var m=p.length;for(var f=1;f<m;f++){var o=p[f];var j=f*4;if(f<p.length-1){l=p[f+1]}else{l=o}d.y=-(l.x-n.x);d.x=l.y-n.y;var k=(1-(f/(m-1)))*10;if(k>1){k=1}var e=Math.sqrt(d.x*d.x+d.y*d.y);var h=this.texture.height/2;d.x/=e;d.y/=e;d.x*=h;d.y*=h;c[j]=o.x+d.x;c[j+1]=o.y+d.y;c[j+2]=o.x-d.x;c[j+3]=o.y-d.y;n=o}PIXI.DisplayObjectContainer.prototype.updateTransform.call(this)};PIXI.Rope.prototype.setTexture=function(c){this.texture=c;this.updateFrame=true};PIXI.Spine=function(d){PIXI.DisplayObjectContainer.call(this);this.spineData=PIXI.AnimCache[d];if(!this.spineData){throw new Error("Spine data must be preloaded using PIXI.SpineLoader or PIXI.AssetLoader: "+d)}this.skeleton=new spine.Skeleton(this.spineData);this.skeleton.updateWorldTransform();this.stateData=new spine.AnimationStateData(this.spineData);this.state=new spine.AnimationState(this.stateData);this.slotContainers=[];for(var h=0,l=this.skeleton.drawOrder.length;h<l;h++){var k=this.skeleton.drawOrder[h];var j=k.attachment;var c=new PIXI.DisplayObjectContainer();this.slotContainers.push(c);this.addChild(c);if(!(j instanceof spine.RegionAttachment)){continue}var f=j.rendererObject.name;var e=this.createSprite(k,j.rendererObject);k.currentSprite=e;k.currentSpriteName=f;c.addChild(e)}};PIXI.Spine.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Spine.prototype.constructor=PIXI.Spine;PIXI.Spine.prototype.updateTransform=function(){this.lastTime=this.lastTime||Date.now();var e=(Date.now()-this.lastTime)*0.001;this.lastTime=Date.now();this.state.update(e);this.state.apply(this.skeleton);this.skeleton.updateWorldTransform();var c=this.skeleton.drawOrder;for(var h=0,d=c.length;h<d;h++){var l=c[h];var j=l.attachment;var k=this.slotContainers[h];if(!(j instanceof spine.RegionAttachment)){k.visible=false;continue}if(j.rendererObject){if(!l.currentSpriteName||l.currentSpriteName!=j.name){var f=j.rendererObject.name;if(l.currentSprite!==undefined){l.currentSprite.visible=false}l.sprites=l.sprites||{};if(l.sprites[f]!==undefined){l.sprites[f].visible=true}else{var m=this.createSprite(l,j.rendererObject);k.addChild(m)}l.currentSprite=l.sprites[f];l.currentSpriteName=f}}k.visible=true;var o=l.bone;k.position.x=o.worldX+j.x*o.m00+j.y*o.m01;k.position.y=o.worldY+j.x*o.m10+j.y*o.m11;k.scale.x=o.worldScaleX;k.scale.y=o.worldScaleY;k.rotation=-(l.bone.worldRotation*Math.PI/180)}PIXI.DisplayObjectContainer.prototype.updateTransform.call(this)};PIXI.Spine.prototype.createSprite=function(f,e){var c=PIXI.TextureCache[e.name]?e.name:e.name+".png";var d=new PIXI.Sprite(PIXI.Texture.fromFrame(c));d.scale=e.scale;d.rotation=e.rotation;d.anchor.x=d.anchor.y=0.5;f.sprites=f.sprites||{};f.sprites[e.name]=d;return d};var spine={};spine.BoneData=function(c,d){this.name=c;this.parent=d};spine.BoneData.prototype={length:0,x:0,y:0,rotation:0,scaleX:1,scaleY:1};spine.SlotData=function(c,d){this.name=c;this.boneData=d};spine.SlotData.prototype={r:1,g:1,b:1,a:1,attachmentName:null};spine.Bone=function(d,c){this.data=d;this.parent=c;this.setToSetupPose()};spine.Bone.yDown=false;spine.Bone.prototype={x:0,y:0,rotation:0,scaleX:1,scaleY:1,m00:0,m01:0,worldX:0,m10:0,m11:0,worldY:0,worldRotation:0,worldScaleX:1,worldScaleY:1,updateWorldTransform:function(e,d){var f=this.parent;if(f!=null){this.worldX=this.x*f.m00+this.y*f.m01+f.worldX;this.worldY=this.x*f.m10+this.y*f.m11+f.worldY;this.worldScaleX=f.worldScaleX*this.scaleX;this.worldScaleY=f.worldScaleY*this.scaleY;this.worldRotation=f.worldRotation+this.rotation}else{this.worldX=this.x;this.worldY=this.y;this.worldScaleX=this.scaleX;this.worldScaleY=this.scaleY;this.worldRotation=this.rotation}var i=this.worldRotation*Math.PI/180;var h=Math.cos(i);var c=Math.sin(i);this.m00=h*this.worldScaleX;this.m10=c*this.worldScaleX;this.m01=-c*this.worldScaleY;this.m11=h*this.worldScaleY;if(e){this.m00=-this.m00;this.m01=-this.m01}if(d){this.m10=-this.m10;this.m11=-this.m11}if(spine.Bone.yDown){this.m10=-this.m10;this.m11=-this.m11}},setToSetupPose:function(){var c=this.data;this.x=c.x;this.y=c.y;this.rotation=c.rotation;this.scaleX=c.scaleX;this.scaleY=c.scaleY}};spine.Slot=function(c,e,d){this.data=c;this.skeleton=e;this.bone=d;this.setToSetupPose()};spine.Slot.prototype={r:1,g:1,b:1,a:1,_attachmentTime:0,attachment:null,setAttachment:function(c){this.attachment=c;this._attachmentTime=this.skeleton.time},setAttachmentTime:function(c){this._attachmentTime=this.skeleton.time-c},getAttachmentTime:function(){return this.skeleton.time-this._attachmentTime},setToSetupPose:function(){var d=this.data;this.r=d.r;this.g=d.g;this.b=d.b;this.a=d.a;var f=this.skeleton.data.slots;for(var c=0,e=f.length;c<e;c++){if(f[c]==d){this.setAttachment(!d.attachmentName?null:this.skeleton.getAttachmentBySlotIndex(c,d.attachmentName));break}}}};spine.Skin=function(c){this.name=c;this.attachments={}};spine.Skin.prototype={addAttachment:function(c,d,e){this.attachments[c+":"+d]=e},getAttachment:function(c,d){return this.attachments[c+":"+d]},_attachAll:function(h,k){for(var e in k.attachments){var f=e.indexOf(":");var c=parseInt(e.substring(0,f));var d=e.substring(f+1);var j=h.slots[c];if(j.attachment&&j.attachment.name==d){var i=this.getAttachment(c,d);if(i){j.setAttachment(i)}}}}};spine.Animation=function(c,d,e){this.name=c;this.timelines=d;this.duration=e};spine.Animation.prototype={apply:function(h,f,c){if(c&&this.duration!=0){f%=this.duration}var e=this.timelines;for(var d=0,j=e.length;d<j;d++){e[d].apply(h,f,1)}},mix:function(j,h,c,f){if(c&&this.duration!=0){h%=this.duration}var e=this.timelines;for(var d=0,k=e.length;d<k;d++){e[d].apply(j,h,f)}}};spine.binarySearch=function(d,i,e){var c=0;var f=Math.floor(d.length/e)-2;if(f==0){return e}var h=f>>>1;while(true){if(d[(h+1)*e]<=i){c=h+1}else{f=h}if(c==f){return(c+1)*e}h=(c+f)>>>1}};spine.linearSearch=function(c,h,f){for(var d=0,e=c.length-f;d<=e;d+=f){if(c[d]>h){return d}}return -1};spine.Curves=function(c){this.curves=[];this.curves.length=(c-1)*6};spine.Curves.prototype={setLinear:function(c){this.curves[c*6]=0},setStepped:function(c){this.curves[c*6]=-1},setCurve:function(l,o,v,n,u){var p=1/10;var k=p*p;var j=k*p;var e=3*p;var d=3*k;var c=6*k;var w=6*j;var t=-o*2+n;var s=-v*2+u;var h=(o-n)*3+1;var f=(v-u)*3+1;var q=l*6;var m=this.curves;m[q]=o*e+t*d+h*j;m[q+1]=v*e+s*d+f*j;m[q+2]=t*c+h*w;m[q+3]=s*c+f*w;m[q+4]=h*w;m[q+5]=f*w},getCurvePercent:function(f,m){m=m<0?0:(m>1?1:m);var k=f*6;var s=this.curves;var c=s[k];if(!c){return m}if(c==-1){return 0}var t=s[k+1];var q=s[k+2];var p=s[k+3];var j=s[k+4];var h=s[k+5];var o=c,n=t;var l=10-2;while(true){if(o>=m){var e=o-c;var d=n-t;return d+(n-d)*(m-e)/(o-e)}if(l==0){break}l--;c+=q;t+=p;q+=j;p+=h;o+=c;n+=t}return n+(1-n)*(m-o)/(1-o)}};spine.RotateTimeline=function(c){this.curves=new spine.Curves(c);this.frames=[];this.frames.length=c*2};spine.RotateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(e,c,d){e*=2;this.frames[e]=c;this.frames[e+1]=d},apply:function(e,d,f){var l=this.frames;if(d<l[0]){return}var m=e.bones[this.boneIndex];if(d>=l[l.length-2]){var h=m.data.rotation+l[l.length-1]-m.rotation;while(h>180){h-=360}while(h<-180){h+=360}m.rotation+=h*f;return}var c=spine.binarySearch(l,d,2);var i=l[c-1];var k=l[c];var j=1-(d-k)/(l[c-2]-k);j=this.curves.getCurvePercent(c/2-1,j);var h=l[c+1]-i;while(h>180){h-=360}while(h<-180){h+=360}h=m.data.rotation+(i+h*j)-m.rotation;while(h>180){h-=360}while(h<-180){h+=360}m.rotation+=h*f}};spine.TranslateTimeline=function(c){this.curves=new spine.Curves(c);this.frames=[];this.frames.length=c*3};spine.TranslateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(f,d,c,e){f*=3;this.frames[f]=d;this.frames[f+1]=c;this.frames[f+2]=e},apply:function(e,d,f){var l=this.frames;if(d<l[0]){return}var m=e.bones[this.boneIndex];if(d>=l[l.length-3]){m.x+=(m.data.x+l[l.length-2]-m.x)*f;m.y+=(m.data.y+l[l.length-1]-m.y)*f;return}var c=spine.binarySearch(l,d,3);var i=l[c-2];var h=l[c-1];var k=l[c];var j=1-(d-k)/(l[c+-3]-k);j=this.curves.getCurvePercent(c/3-1,j);m.x+=(m.data.x+i+(l[c+1]-i)*j-m.x)*f;m.y+=(m.data.y+h+(l[c+2]-h)*j-m.y)*f}};spine.ScaleTimeline=function(c){this.curves=new spine.Curves(c);this.frames=[];this.frames.length=c*3};spine.ScaleTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(f,d,c,e){f*=3;this.frames[f]=d;this.frames[f+1]=c;this.frames[f+2]=e},apply:function(e,d,f){var l=this.frames;if(d<l[0]){return}var m=e.bones[this.boneIndex];if(d>=l[l.length-3]){m.scaleX+=(m.data.scaleX-1+l[l.length-2]-m.scaleX)*f;m.scaleY+=(m.data.scaleY-1+l[l.length-1]-m.scaleY)*f;return}var c=spine.binarySearch(l,d,3);var i=l[c-2];var h=l[c-1];var k=l[c];var j=1-(d-k)/(l[c+-3]-k);j=this.curves.getCurvePercent(c/3-1,j);m.scaleX+=(m.data.scaleX-1+i+(l[c+1]-i)*j-m.scaleX)*f;m.scaleY+=(m.data.scaleY-1+h+(l[c+2]-h)*j-m.scaleY)*f}};spine.ColorTimeline=function(c){this.curves=new spine.Curves(c);this.frames=[];this.frames.length=c*5};spine.ColorTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(f,d,c,e){f*=5;this.frames[f]=d;this.frames[f+1]=r;this.frames[f+2]=g;this.frames[f+3]=b;this.frames[f+4]=a},apply:function(h,f,j){var q=this.frames;if(f<q[0]){return}var v=h.slots[this.slotIndex];if(f>=q[q.length-5]){var k=q.length-1;v.r=q[k-3];v.g=q[k-2];v.b=q[k-1];v.a=q[k];return}var d=spine.binarySearch(q,f,5);var u=q[d-4];var e=q[d-3];var l=q[d-2];var n=q[d-1];var p=q[d];var o=1-(f-p)/(q[d-5]-p);o=this.curves.getCurvePercent(d/5-1,o);var c=u+(q[d+1]-u)*o;var m=e+(q[d+2]-e)*o;var s=l+(q[d+3]-l)*o;var t=n+(q[d+4]-n)*o;if(j<1){v.r+=(c-v.r)*j;v.g+=(m-v.g)*j;v.b+=(s-v.b)*j;v.a+=(t-v.a)*j}else{v.r=c;v.g=m;v.b=s;v.a=t}}};spine.AttachmentTimeline=function(c){this.curves=new spine.Curves(c);this.frames=[];this.frames.length=c;this.attachmentNames=[];this.attachmentNames.length=c};spine.AttachmentTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length},setFrame:function(e,d,c){this.frames[e]=d;this.attachmentNames[e]=c},apply:function(f,e,d){var h=this.frames;if(e<h[0]){return}var i;if(e>=h[h.length-1]){i=h.length-1}else{i=spine.binarySearch(h,e,1)-1}var c=this.attachmentNames[i];f.slots[this.slotIndex].setAttachment(!c?null:f.getAttachmentBySlotIndex(this.slotIndex,c))}};spine.SkeletonData=function(){this.bones=[];this.slots=[];this.skins=[];this.animations=[]};spine.SkeletonData.prototype={defaultSkin:null,findBone:function(e){var c=this.bones;for(var d=0,f=c.length;d<f;d++){if(c[d].name==e){return c[d]}}return null},findBoneIndex:function(e){var c=this.bones;for(var d=0,f=c.length;d<f;d++){if(c[d].name==e){return d}}return -1},findSlot:function(c){var e=this.slots;for(var d=0,f=e.length;d<f;d++){if(e[d].name==c){return slot[d]}}return null},findSlotIndex:function(c){var e=this.slots;for(var d=0,f=e.length;d<f;d++){if(e[d].name==c){return d}}return -1},findSkin:function(c){var e=this.skins;for(var d=0,f=e.length;d<f;d++){if(e[d].name==c){return e[d]}}return null},findAnimation:function(d){var f=this.animations;for(var c=0,e=f.length;c<e;c++){if(f[c].name==d){return f[c]}}return null}};spine.Skeleton=function(c){this.data=c;this.bones=[];for(var d=0,l=c.bones.length;d<l;d++){var j=c.bones[d];var e=!j.parent?null:this.bones[c.bones.indexOf(j.parent)];this.bones.push(new spine.Bone(j,e))}this.slots=[];this.drawOrder=[];for(var d=0,l=c.slots.length;d<l;d++){var f=c.slots[d];var h=this.bones[c.bones.indexOf(f.boneData)];var k=new spine.Slot(f,this,h);this.slots.push(k);this.drawOrder.push(k)}};spine.Skeleton.prototype={x:0,y:0,skin:null,r:1,g:1,b:1,a:1,time:0,flipX:false,flipY:false,updateWorldTransform:function(){var e=this.flipX;var d=this.flipY;var c=this.bones;for(var f=0,h=c.length;f<h;f++){c[f].updateWorldTransform(e,d)}},setToSetupPose:function(){this.setBonesToSetupPose();this.setSlotsToSetupPose()},setBonesToSetupPose:function(){var c=this.bones;for(var d=0,e=c.length;d<e;d++){c[d].setToSetupPose()}},setSlotsToSetupPose:function(){var d=this.slots;for(var c=0,e=d.length;c<e;c++){d[c].setToSetupPose(c)}},getRootBone:function(){return this.bones.length==0?null:this.bones[0]},findBone:function(e){var c=this.bones;for(var d=0,f=c.length;d<f;d++){if(c[d].data.name==e){return c[d]}}return null},findBoneIndex:function(e){var c=this.bones;for(var d=0,f=c.length;d<f;d++){if(c[d].data.name==e){return d}}return -1},findSlot:function(c){var e=this.slots;for(var d=0,f=e.length;d<f;d++){if(e[d].data.name==c){return e[d]}}return null},findSlotIndex:function(c){var e=this.slots;for(var d=0,f=e.length;d<f;d++){if(e[d].data.name==c){return d}}return -1},setSkinByName:function(c){var d=this.data.findSkin(c);if(!d){throw"Skin not found: "+c}this.setSkin(d)},setSkin:function(c){if(this.skin&&c){c._attachAll(this,this.skin)}this.skin=c},getAttachmentBySlotName:function(d,c){return this.getAttachmentBySlotIndex(this.data.findSlotIndex(d),c)},getAttachmentBySlotIndex:function(d,c){if(this.skin){var e=this.skin.getAttachment(d,c);if(e){return e}}if(this.data.defaultSkin){return this.data.defaultSkin.getAttachment(d,c)}return null},setAttachment:function(d,c){var f=this.slots;for(var e=0,k=f.size;e<k;e++){var j=f[e];if(j.data.name==d){var h=null;if(c){h=this.getAttachment(e,c);if(h==null){throw"Attachment not found: "+c+", for slot: "+d}}j.setAttachment(h);return}}throw"Slot not found: "+d},update:function(c){time+=c}};spine.AttachmentType={region:0};spine.RegionAttachment=function(){this.offset=[];this.offset.length=8;this.uvs=[];this.uvs.length=8};spine.RegionAttachment.prototype={x:0,y:0,rotation:0,scaleX:1,scaleY:1,width:0,height:0,rendererObject:null,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,setUVs:function(e,c,h,i,d){var f=this.uvs;if(d){f[2]=e;f[3]=i;f[4]=e;f[5]=c;f[6]=h;f[7]=c;f[0]=h;f[1]=i}else{f[0]=e;f[1]=i;f[2]=e;f[3]=c;f[4]=h;f[5]=c;f[6]=h;f[7]=i}},updateOffset:function(){var t=this.width/this.regionOriginalWidth*this.scaleX;var s=this.height/this.regionOriginalHeight*this.scaleY;var d=-this.width/2*this.scaleX+this.regionOffsetX*t;var v=-this.height/2*this.scaleY+this.regionOffsetY*s;var j=d+this.regionWidth*t;var q=v+this.regionHeight*s;var u=this.rotation*Math.PI/180;var e=Math.cos(u);var c=Math.sin(u);var l=d*e+this.x;var k=d*c;var o=v*e+this.y;var m=v*c;var p=j*e+this.x;var n=j*c;var h=q*e+this.y;var f=q*c;var i=this.offset;i[0]=l-m;i[1]=o+k;i[2]=l-f;i[3]=h+k;i[4]=p-f;i[5]=h+n;i[6]=p-m;i[7]=o+n},computeVertices:function(i,h,k,f){i+=k.worldX;h+=k.worldY;var l=k.m00;var j=k.m01;var e=k.m10;var d=k.m11;var c=this.offset;f[0]=c[0]*l+c[1]*j+i;f[1]=c[0]*e+c[1]*d+h;f[2]=c[2]*l+c[3]*j+i;f[3]=c[2]*e+c[3]*d+h;f[4]=c[4]*l+c[5]*j+i;f[5]=c[4]*e+c[5]*d+h;f[6]=c[6]*l+c[7]*j+i;f[7]=c[6]*e+c[7]*d+h}};spine.AnimationStateData=function(c){this.skeletonData=c;this.animationToMixTime={}};spine.AnimationStateData.prototype={defaultMix:0,setMixByName:function(d,c,e){var h=this.skeletonData.findAnimation(d);if(!h){throw"Animation not found: "+d}var f=this.skeletonData.findAnimation(c);if(!f){throw"Animation not found: "+c}this.setMix(h,f,e)},setMix:function(e,d,c){this.animationToMixTime[e.name+":"+d.name]=c},getMix:function(e,d){var c=this.animationToMixTime[e.name+":"+d.name];return c?c:this.defaultMix}};spine.AnimationState=function(c){this.data=c;this.queue=[]};spine.AnimationState.prototype={current:null,previous:null,currentTime:0,previousTime:0,currentLoop:false,previousLoop:false,mixTime:0,mixDuration:0,update:function(d){this.currentTime+=d;this.previousTime+=d;this.mixTime+=d;if(this.queue.length>0){var c=this.queue[0];if(this.currentTime>=c.delay){this._setAnimation(c.animation,c.loop);this.queue.shift()}}},apply:function(d){if(!this.current){return}if(this.previous){this.previous.apply(d,this.previousTime,this.previousLoop);var c=this.mixTime/this.mixDuration;if(c>=1){c=1;this.previous=null}this.current.mix(d,this.currentTime,this.currentLoop,c)}else{this.current.apply(d,this.currentTime,this.currentLoop)}},clearAnimation:function(){this.previous=null;this.current=null;this.queue.length=0},_setAnimation:function(d,c){this.previous=null;if(d&&this.current){this.mixDuration=this.data.getMix(this.current,d);if(this.mixDuration>0){this.mixTime=0;this.previous=this.current;this.previousTime=this.currentTime;this.previousLoop=this.currentLoop}}this.current=d;this.currentLoop=c;this.currentTime=0},setAnimationByName:function(d,c){var e=this.data.skeletonData.findAnimation(d);if(!e){throw"Animation not found: "+d}this.setAnimation(e,c)},setAnimation:function(d,c){this.queue.length=0;this._setAnimation(d,c)},addAnimationByName:function(e,c,d){var f=this.data.skeletonData.findAnimation(e);if(!f){throw"Animation not found: "+e}this.addAnimation(f,c,d)},addAnimation:function(h,c,e){var f={};f.animation=h;f.loop=c;if(!e||e<=0){var d=this.queue.length==0?this.current:this.queue[this.queue.length-1].animation;if(d!=null){e=d.duration-this.data.getMix(d,h)+(e||0)}else{e=0}}f.delay=e;this.queue.push(f)},isComplete:function(){return !this.current||this.currentTime>=this.current.duration}};spine.SkeletonJson=function(c){this.attachmentLoader=c};spine.SkeletonJson.prototype={scale:1,readSkeletonData:function(u){var c=new spine.SkeletonData();var B=u.bones;for(var z=0,s=B.length;z<s;z++){var D=B[z];var k=null;if(D.parent){k=c.findBone(D.parent);if(!k){throw"Parent bone not found: "+D.parent}}var d=new spine.BoneData(D.name,k);d.length=(D.length||0)*this.scale;d.x=(D.x||0)*this.scale;d.y=(D.y||0)*this.scale;d.rotation=(D.rotation||0);d.scaleX=D.scaleX||1;d.scaleY=D.scaleY||1;c.bones.push(d)}var m=u.slots;for(var z=0,s=m.length;z<s;z++){var A=m[z];var d=c.findBone(A.bone);if(!d){throw"Slot bone not found: "+A.bone}var e=new spine.SlotData(A.name,d);var w=A.color;if(w){e.r=spine.SkeletonJson.toColor(w,0);e.g=spine.SkeletonJson.toColor(w,1);e.b=spine.SkeletonJson.toColor(w,2);e.a=spine.SkeletonJson.toColor(w,3)}e.attachmentName=A.attachment;c.slots.push(e)}var E=u.skins;for(var o in E){if(!E.hasOwnProperty(o)){continue}var q=E[o];var v=new spine.Skin(o);for(var f in q){if(!q.hasOwnProperty(f)){continue}var C=c.findSlotIndex(f);var t=q[f];for(var p in t){if(!t.hasOwnProperty(p)){continue}var l=this.readAttachment(v,p,t[p]);if(l!=null){v.addAttachment(C,p,l)}}}c.skins.push(v);if(v.name=="default"){c.defaultSkin=v}}var j=u.animations;for(var h in j){if(!j.hasOwnProperty(h)){continue}this.readAnimation(h,j[h],c)}return c},readAttachment:function(f,c,e){c=e.name||c;var d=spine.AttachmentType[e.type||"region"];if(d==spine.AttachmentType.region){var h=new spine.RegionAttachment();h.x=(e.x||0)*this.scale;h.y=(e.y||0)*this.scale;h.scaleX=e.scaleX||1;h.scaleY=e.scaleY||1;h.rotation=e.rotation||0;h.width=(e.width||32)*this.scale;h.height=(e.height||32)*this.scale;h.updateOffset();h.rendererObject={};h.rendererObject.name=c;h.rendererObject.scale={};h.rendererObject.scale.x=h.scaleX;h.rendererObject.scale.y=h.scaleY;h.rendererObject.rotation=-h.rotation*Math.PI/180;return h}throw"Unknown attachment type: "+d},readAnimation:function(J,I,e){var v=[];var c=0;var C=I.bones;for(var j in C){if(!C.hasOwnProperty(j)){continue}var m=e.findBoneIndex(j);if(m==-1){throw"Bone not found: "+j}var G=C[j];for(var s in G){if(!G.hasOwnProperty(s)){continue}var d=G[s];if(s=="rotate"){var h=new spine.RotateTimeline(d.length);h.boneIndex=m;var o=0;for(var A=0,w=d.length;A<w;A++){var k=d[A];h.setFrame(o,k.time,k.angle);spine.SkeletonJson.readCurve(h,o,k);o++}v.push(h);c=Math.max(c,h.frames[h.getFrameCount()*2-2])}else{if(s=="translate"||s=="scale"){var h;var f=1;if(s=="scale"){h=new spine.ScaleTimeline(d.length)}else{h=new spine.TranslateTimeline(d.length);f=this.scale}h.boneIndex=m;var o=0;for(var A=0,w=d.length;A<w;A++){var k=d[A];var q=(k.x||0)*f;var p=(k.y||0)*f;h.setFrame(o,k.time,q,p);spine.SkeletonJson.readCurve(h,o,k);o++}v.push(h);c=Math.max(c,h.frames[h.getFrameCount()*3-3])}else{throw"Invalid timeline type for a bone: "+s+" ("+j+")"}}}}var t=I.slots;for(var l in t){if(!t.hasOwnProperty(l)){continue}var B=t[l];var E=e.findSlotIndex(l);for(var s in B){if(!B.hasOwnProperty(s)){continue}var d=B[s];if(s=="color"){var h=new spine.ColorTimeline(d.length);h.slotIndex=E;var o=0;for(var A=0,w=d.length;A<w;A++){var k=d[A];var z=k.color;var u=spine.SkeletonJson.toColor(z,0);var D=spine.SkeletonJson.toColor(z,1);var F=spine.SkeletonJson.toColor(z,2);var H=spine.SkeletonJson.toColor(z,3);h.setFrame(o,k.time,u,D,F,H);spine.SkeletonJson.readCurve(h,o,k);o++}v.push(h);c=Math.max(c,h.frames[h.getFrameCount()*5-5])}else{if(s=="attachment"){var h=new spine.AttachmentTimeline(d.length);h.slotIndex=E;var o=0;for(var A=0,w=d.length;A<w;A++){var k=d[A];h.setFrame(o++,k.time,k.name)}v.push(h);c=Math.max(c,h.frames[h.getFrameCount()-1])}else{throw"Invalid timeline type for a slot: "+s+" ("+l+")"}}}}e.animations.push(new spine.Animation(J,v,c))}};spine.SkeletonJson.readCurve=function(c,f,e){var d=e.curve;if(!d){return}if(d=="stepped"){c.curves.setStepped(f)}else{if(d instanceof Array){c.curves.setCurve(f,d[0],d[1],d[2],d[3])}}};spine.SkeletonJson.toColor=function(c,d){if(c.length!=8){throw"Color hexidecimal length must be 8, recieved: "+c}return parseInt(c.substring(d*2,2),16)/255};spine.Atlas=function(j,c){this.textureLoader=c;this.pages=[];this.regions=[];var e=new spine.AtlasReader(j);var m=[];m.length=4;var f=null;while(true){var o=e.readLine();if(o==null){break}o=e.trim(o);if(o.length==0){f=null}else{if(!f){f=new spine.AtlasPage();f.name=o;f.format=spine.Atlas.Format[e.readValue()];e.readTuple(m);f.minFilter=spine.Atlas.TextureFilter[m[0]];f.magFilter=spine.Atlas.TextureFilter[m[1]];var l=e.readValue();f.uWrap=spine.Atlas.TextureWrap.clampToEdge;f.vWrap=spine.Atlas.TextureWrap.clampToEdge;if(l=="x"){f.uWrap=spine.Atlas.TextureWrap.repeat}else{if(l=="y"){f.vWrap=spine.Atlas.TextureWrap.repeat}else{if(l=="xy"){f.uWrap=f.vWrap=spine.Atlas.TextureWrap.repeat}}}c.load(f,o);this.pages.push(f)}else{var i=new spine.AtlasRegion();i.name=o;i.page=f;i.rotate=e.readValue()=="true";e.readTuple(m);var k=parseInt(m[0]);var h=parseInt(m[1]);e.readTuple(m);var d=parseInt(m[0]);var n=parseInt(m[1]);i.u=k/f.width;i.v=h/f.height;if(i.rotate){i.u2=(k+n)/f.width;i.v2=(h+d)/f.height}else{i.u2=(k+d)/f.width;i.v2=(h+n)/f.height}i.x=k;i.y=h;i.width=Math.abs(d);i.height=Math.abs(n);if(e.readTuple(m)==4){i.splits=[parseInt(m[0]),parseInt(m[1]),parseInt(m[2]),parseInt(m[3])];if(e.readTuple(m)==4){i.pads=[parseInt(m[0]),parseInt(m[1]),parseInt(m[2]),parseInt(m[3])];e.readTuple(m)}}i.originalWidth=parseInt(m[0]);i.originalHeight=parseInt(m[1]);e.readTuple(m);i.offsetX=parseInt(m[0]);i.offsetY=parseInt(m[1]);i.index=parseInt(e.readValue());this.regions.push(i)}}}};spine.Atlas.prototype={findRegion:function(c){var f=this.regions;for(var d=0,e=f.length;d<e;d++){if(f[d].name==c){return f[d]}}return null},dispose:function(){var c=this.pages;for(var d=0,e=c.length;d<e;d++){this.textureLoader.unload(c[d].rendererObject)}},updateUVs:function(d){var h=this.regions;for(var c=0,f=h.length;c<f;c++){var e=h[c];if(e.page!=d){continue}e.u=e.x/d.width;e.v=e.y/d.height;if(e.rotate){e.u2=(e.x+e.height)/d.width;e.v2=(e.y+e.width)/d.height}else{e.u2=(e.x+e.width)/d.width;e.v2=(e.y+e.height)/d.height}}}};spine.Atlas.Format={alpha:0,intensity:1,luminanceAlpha:2,rgb565:3,rgba4444:4,rgb888:5,rgba8888:6};spine.Atlas.TextureFilter={nearest:0,linear:1,mipMap:2,mipMapNearestNearest:3,mipMapLinearNearest:4,mipMapNearestLinear:5,mipMapLinearLinear:6};spine.Atlas.TextureWrap={mirroredRepeat:0,clampToEdge:1,repeat:2};spine.AtlasPage=function(){};spine.AtlasPage.prototype={name:null,format:null,minFilter:null,magFilter:null,uWrap:null,vWrap:null,rendererObject:null,width:0,height:0};spine.AtlasRegion=function(){};spine.AtlasRegion.prototype={page:null,name:null,x:0,y:0,width:0,height:0,u:0,v:0,u2:0,v2:0,offsetX:0,offsetY:0,originalWidth:0,originalHeight:0,index:0,rotate:false,splits:null,pads:null};spine.AtlasReader=function(c){this.lines=c.split(/\r\n|\r|\n/)};spine.AtlasReader.prototype={index:0,trim:function(c){return c.replace(/^\s+|\s+$/g,"")},readLine:function(){if(this.index>=this.lines.length){return null}return this.lines[this.index++]},readValue:function(){var c=this.readLine();var d=c.indexOf(":");if(d==-1){throw"Invalid line: "+c}return this.trim(c.substring(d+1))},readTuple:function(d){var e=this.readLine();var h=e.indexOf(":");if(h==-1){throw"Invalid line: "+e}var f=0,j=h+1;for(;f<3;f++){var c=e.indexOf(",",j);if(c==-1){if(f==0){throw"Invalid line: "+e}break}d[f]=this.trim(e.substr(j,c-j));j=c+1}d[f]=this.trim(e.substring(j));return f+1}};spine.AtlasAttachmentLoader=function(c){this.atlas=c};spine.AtlasAttachmentLoader.prototype={newAttachment:function(f,d,c){switch(d){case spine.AttachmentType.region:var e=this.atlas.findRegion(c);if(!e){throw"Region not found in atlas: "+c+" ("+d+")"}var h=new spine.RegionAttachment(c);h.rendererObject=e;h.setUVs(e.u,e.v,e.u2,e.v2,e.rotate);h.regionOffsetX=e.offsetX;h.regionOffsetY=e.offsetY;h.regionWidth=e.width;h.regionHeight=e.height;h.regionOriginalWidth=e.originalWidth;h.regionOriginalHeight=e.originalHeight;return h}throw"Unknown attachment type: "+d}};PIXI.AnimCache={};spine.Bone.yDown=true;PIXI.TilingSprite=function(e,d,c){PIXI.DisplayObjectContainer.call(this);this.texture=e;this.width=d;this.height=c;this.tileScale=new PIXI.Point(1,1);this.tilePosition=new PIXI.Point(0,0);this.renderable=true;this.blendMode=PIXI.blendModes.NORMAL};PIXI.TilingSprite.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.TilingSprite.prototype.constructor=PIXI.TilingSprite;PIXI.TilingSprite.prototype.setTexture=function(c){this.texture=c;this.updateFrame=true};PIXI.TilingSprite.prototype.onTextureUpdate=function(c){this.updateFrame=true};PIXI.FilterBlock=function(c){this.graphics=c;this.visible=true;this.renderable=true};PIXI.MaskFilter=function(c){this.graphics};PIXI.Graphics=function(){PIXI.DisplayObjectContainer.call(this);this.renderable=true;this.fillAlpha=1;this.lineWidth=0;this.lineColor="black";this.graphicsData=[];this.currentPath={points:[]}};PIXI.Graphics.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Graphics.prototype.constructor=PIXI.Graphics;PIXI.Graphics.prototype.lineStyle=function(c,d,e){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.lineWidth=c||0;this.lineColor=d||0;this.lineAlpha=(e==undefined)?1:e;this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[],type:PIXI.Graphics.POLY};this.graphicsData.push(this.currentPath)};PIXI.Graphics.prototype.moveTo=function(c,d){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.currentPath=this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[],type:PIXI.Graphics.POLY};this.currentPath.points.push(c,d);this.graphicsData.push(this.currentPath)};PIXI.Graphics.prototype.lineTo=function(c,d){this.currentPath.points.push(c,d);this.dirty=true};PIXI.Graphics.prototype.beginFill=function(c,d){this.filling=true;this.fillColor=c||0;this.fillAlpha=(d==undefined)?1:d};PIXI.Graphics.prototype.endFill=function(){this.filling=false;this.fillColor=null;this.fillAlpha=1};PIXI.Graphics.prototype.drawRect=function(d,f,e,c){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[d,f,e,c],type:PIXI.Graphics.RECT};this.graphicsData.push(this.currentPath);this.dirty=true};PIXI.Graphics.prototype.drawCircle=function(d,e,c){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[d,e,c,c],type:PIXI.Graphics.CIRC};this.graphicsData.push(this.currentPath);this.dirty=true};PIXI.Graphics.prototype.drawElipse=function(d,f,e,c){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[d,f,e,c],type:PIXI.Graphics.ELIP};this.graphicsData.push(this.currentPath);this.dirty=true};PIXI.Graphics.prototype.clear=function(){this.lineWidth=0;this.filling=false;this.dirty=true;this.clearDirty=true;this.graphicsData=[]};PIXI.Graphics.POLY=0;PIXI.Graphics.RECT=1;PIXI.Graphics.CIRC=2;PIXI.Graphics.ELIP=3;PIXI.CanvasGraphics=function(){};PIXI.CanvasGraphics.renderGraphics=function(A,d){var s=A.worldAlpha;for(var v=0;v<A.graphicsData.length;v++){var C=A.graphicsData[v];var u=C.points;d.strokeStyle=color="#"+("00000"+(C.lineColor|0).toString(16)).substr(-6);d.lineWidth=C.lineWidth;if(C.type==PIXI.Graphics.POLY){d.beginPath();d.moveTo(u[0],u[1]);for(var t=1;t<u.length/2;t++){d.lineTo(u[t*2],u[t*2+1])}if(u[0]==u[u.length-2]&&u[1]==u[u.length-1]){d.closePath()}if(C.fill){d.globalAlpha=C.fillAlpha*s;d.fillStyle=color="#"+("00000"+(C.fillColor|0).toString(16)).substr(-6);d.fill()}if(C.lineWidth){d.globalAlpha=C.lineAlpha*s;d.stroke()}}else{if(C.type==PIXI.Graphics.RECT){if(C.fillColor){d.globalAlpha=C.fillAlpha*s;d.fillStyle=color="#"+("00000"+(C.fillColor|0).toString(16)).substr(-6);d.fillRect(u[0],u[1],u[2],u[3])}if(C.lineWidth){d.globalAlpha=C.lineAlpha*s;d.strokeRect(u[0],u[1],u[2],u[3])}}else{if(C.type==PIXI.Graphics.CIRC){d.beginPath();d.arc(u[0],u[1],u[2],0,2*Math.PI);d.closePath();if(C.fill){d.globalAlpha=C.fillAlpha*s;d.fillStyle=color="#"+("00000"+(C.fillColor|0).toString(16)).substr(-6);d.fill()}if(C.lineWidth){d.globalAlpha=C.lineAlpha*s;d.stroke()}}else{if(C.type==PIXI.Graphics.ELIP){var e=C.points;var n=e[2]*2;var z=e[3]*2;var m=e[0]-n/2;var l=e[1]-z/2;d.beginPath();var o=0.5522848,k=(n/2)*o,f=(z/2)*o,q=m+n,c=l+z,p=m+n/2,B=l+z/2;d.moveTo(m,B);d.bezierCurveTo(m,B-f,p-k,l,p,l);d.bezierCurveTo(p+k,l,q,B-f,q,B);d.bezierCurveTo(q,B+f,p+k,c,p,c);d.bezierCurveTo(p-k,c,m,B+f,m,B);d.closePath();if(C.fill){d.globalAlpha=C.fillAlpha*s;d.fillStyle=color="#"+("00000"+(C.fillColor|0).toString(16)).substr(-6);d.fill()}if(C.lineWidth){d.globalAlpha=C.lineAlpha*s;d.stroke()}}}}}}};PIXI.CanvasGraphics.renderGraphicsMask=function(B,d){var s=B.worldAlpha;var z=B.graphicsData.length;if(z>1){z=1;console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object")}for(var v=0;v<1;v++){var D=B.graphicsData[v];var u=D.points;if(D.type==PIXI.Graphics.POLY){d.beginPath();d.moveTo(u[0],u[1]);for(var t=1;t<u.length/2;t++){d.lineTo(u[t*2],u[t*2+1])}if(u[0]==u[u.length-2]&&u[1]==u[u.length-1]){d.closePath()}}else{if(D.type==PIXI.Graphics.RECT){d.beginPath();d.rect(u[0],u[1],u[2],u[3]);d.closePath()}else{if(D.type==PIXI.Graphics.CIRC){d.beginPath();d.arc(u[0],u[1],u[2],0,2*Math.PI);d.closePath()}else{if(D.type==PIXI.Graphics.ELIP){var e=D.points;var n=e[2]*2;var A=e[3]*2;var m=e[0]-n/2;var l=e[1]-A/2;d.beginPath();var o=0.5522848,k=(n/2)*o,f=(A/2)*o,q=m+n,c=l+A,p=m+n/2,C=l+A/2;d.moveTo(m,C);d.bezierCurveTo(m,C-f,p-k,l,p,l);d.bezierCurveTo(p+k,l,q,C-f,q,C);d.bezierCurveTo(q,C+f,p+k,c,p,c);d.bezierCurveTo(p-k,c,m,C+f,m,C);d.closePath()}}}}}};PIXI.CanvasRenderer=function(e,c,d,f){this.transparent=f;this.width=e||800;this.height=c||600;this.view=d||document.createElement("canvas");this.context=this.view.getContext("2d");this.refresh=true;this.view.width=this.width;this.view.height=this.height;this.count=0};PIXI.CanvasRenderer.prototype.constructor=PIXI.CanvasRenderer;PIXI.CanvasRenderer.prototype.render=function(c){PIXI.texturesToUpdate=[];PIXI.texturesToDestroy=[];PIXI.visibleCount++;c.updateTransform();if(this.view.style.backgroundColor!=c.backgroundColorString&&!this.transparent){this.view.style.backgroundColor=c.backgroundColorString}this.context.setTransform(1,0,0,1,0,0);this.context.clearRect(0,0,this.width,this.height);this.renderDisplayObject(c);if(c.interactive){if(!c._interactiveEventsAdded){c._interactiveEventsAdded=true;c.interactionManager.setTarget(this)}}if(PIXI.Texture.frameUpdates.length>0){PIXI.Texture.frameUpdates=[]}};PIXI.CanvasRenderer.prototype.resize=function(d,c){this.width=d;this.height=c;this.view.width=d;this.view.height=c};PIXI.CanvasRenderer.prototype.renderDisplayObject=function(j){var f;var h=this.context;h.globalCompositeOperation="source-over";var e=j.last._iNext;j=j.first;do{f=j.worldTransform;if(!j.visible){j=j.last._iNext;continue}if(!j.renderable){j=j._iNext;continue}if(j instanceof PIXI.Sprite){var i=j.texture.frame;if(i){h.globalAlpha=j.worldAlpha;h.setTransform(f[0],f[3],f[1],f[4],f[2],f[5]);h.drawImage(j.texture.baseTexture.source,i.x,i.y,i.width,i.height,(j.anchor.x)*-i.width,(j.anchor.y)*-i.height,i.width,i.height)}}else{if(j instanceof PIXI.Strip){h.setTransform(f[0],f[3],f[1],f[4],f[2],f[5]);this.renderStrip(j)}else{if(j instanceof PIXI.TilingSprite){h.setTransform(f[0],f[3],f[1],f[4],f[2],f[5]);this.renderTilingSprite(j)}else{if(j instanceof PIXI.CustomRenderable){j.renderCanvas(this)}else{if(j instanceof PIXI.Graphics){h.setTransform(f[0],f[3],f[1],f[4],f[2],f[5]);PIXI.CanvasGraphics.renderGraphics(j,h)}else{if(j instanceof PIXI.FilterBlock){if(j.open){h.save();var d=j.mask.alpha;var c=j.mask.worldTransform;h.setTransform(c[0],c[3],c[1],c[4],c[2],c[5]);j.mask.worldAlpha=0.5;h.worldAlpha=0;PIXI.CanvasGraphics.renderGraphicsMask(j.mask,h);h.clip();j.mask.worldAlpha=d}else{h.restore()}}}}}}}j=j._iNext}while(j!=e)};PIXI.CanvasRenderer.prototype.renderStripFlat=function(e){var f=this.context;var h=e.verticies;var l=e.uvs;var j=h.length/2;this.count++;f.beginPath();for(var m=1;m<j-2;m++){var n=m*2;var k=h[n],d=h[n+2],c=h[n+4];var q=h[n+1],p=h[n+3],o=h[n+5];f.moveTo(k,q);f.lineTo(d,p);f.lineTo(c,o)}f.fillStyle="#FF0000";f.fill();f.closePath()};PIXI.CanvasRenderer.prototype.renderTilingSprite=function(f){var e=this.context;e.globalAlpha=f.worldAlpha;if(!f.__tilePattern){f.__tilePattern=e.createPattern(f.texture.baseTexture.source,"repeat")}e.beginPath();var c=f.tilePosition;var d=f.tileScale;e.scale(d.x,d.y);e.translate(c.x,c.y);e.fillStyle=f.__tilePattern;e.fillRect(-c.x,-c.y,f.width/d.x,f.height/d.y);e.scale(1/d.x,1/d.y);e.translate(-c.x,-c.y);e.closePath()};PIXI.CanvasRenderer.prototype.renderStrip=function(w){var h=this.context;var f=w.verticies;var v=w.uvs;var p=f.length/2;this.count++;for(var z=1;z<p-2;z++){var u=z*2;var F=f[u],E=f[u+2],C=f[u+4];var n=f[u+1],l=f[u+3],e=f[u+5];var D=v[u]*w.texture.width,B=v[u+2]*w.texture.width,A=v[u+4]*w.texture.width;var k=v[u+1]*w.texture.height,d=v[u+3]*w.texture.height,c=v[u+5]*w.texture.height;h.save();h.beginPath();h.moveTo(F,n);h.lineTo(E,l);h.lineTo(C,e);h.closePath();h.clip();var G=D*d+k*A+B*c-d*A-k*B-D*c;var t=F*d+k*C+E*c-d*C-k*E-F*c;var s=D*E+F*A+B*C-E*A-F*B-D*C;var q=D*d*C+k*E*A+F*B*c-F*d*A-k*B*C-D*E*c;var o=n*d+k*e+l*c-d*e-k*l-n*c;var m=D*l+n*A+B*e-l*A-n*B-D*e;var j=D*d*e+k*l*A+n*B*c-n*d*A-k*B*e-D*l*c;h.transform(t/G,o/G,s/G,m/G,q/G,j/G);h.drawImage(w.texture.baseTexture.source,0,0);h.restore()}};PIXI._batchs=[];PIXI._getBatch=function(c){if(PIXI._batchs.length==0){return new PIXI.WebGLBatch(c)}else{return PIXI._batchs.pop()}};PIXI._returnBatch=function(c){c.clean();PIXI._batchs.push(c)};PIXI._restoreBatchs=function(d){for(var c=0;c<PIXI._batchs.length;c++){PIXI._batchs[c].restoreLostContext(d)}};PIXI.WebGLBatch=function(c){this.gl=c;this.size=0;this.vertexBuffer=c.createBuffer();this.indexBuffer=c.createBuffer();this.uvBuffer=c.createBuffer();this.colorBuffer=c.createBuffer();this.blendMode=PIXI.blendModes.NORMAL;this.dynamicSize=1};PIXI.WebGLBatch.prototype.constructor=PIXI.WebGLBatch;PIXI.WebGLBatch.prototype.clean=function(){this.verticies=[];this.uvs=[];this.indices=[];this.colors=[];this.dynamicSize=1;this.texture=null;this.last=null;this.size=0;this.head;this.tail};PIXI.WebGLBatch.prototype.restoreLostContext=function(c){this.gl=c;this.vertexBuffer=c.createBuffer();this.indexBuffer=c.createBuffer();this.uvBuffer=c.createBuffer();this.colorBuffer=c.createBuffer()};PIXI.WebGLBatch.prototype.init=function(c){c.batch=this;this.dirty=true;this.blendMode=c.blendMode;this.texture=c.texture.baseTexture;this.head=c;this.tail=c;this.size=1;this.growBatch()};PIXI.WebGLBatch.prototype.insertBefore=function(c,e){this.size++;c.batch=this;this.dirty=true;var d=e.__prev;e.__prev=c;c.__next=e;if(d){c.__prev=d;d.__next=c}else{this.head=c}};PIXI.WebGLBatch.prototype.insertAfter=function(d,c){this.size++;d.batch=this;this.dirty=true;var e=c.__next;c.__next=d;d.__prev=c;if(e){d.__next=e;e.__prev=d}else{this.tail=d}};PIXI.WebGLBatch.prototype.remove=function(c){this.size--;if(this.size==0){c.batch=null;c.__prev=null;c.__next=null;return}if(c.__prev){c.__prev.__next=c.__next}else{this.head=c.__next;this.head.__prev=null}if(c.__next){c.__next.__prev=c.__prev}else{this.tail=c.__prev;this.tail.__next=null}c.batch=null;c.__next=null;c.__prev=null;this.dirty=true};PIXI.WebGLBatch.prototype.split=function(d){this.dirty=true;var c=new PIXI.WebGLBatch(this.gl);c.init(d);c.texture=this.texture;c.tail=this.tail;this.tail=d.__prev;this.tail.__next=null;d.__prev=null;var e=0;while(d){e++;d.batch=c;d=d.__next}c.size=e;this.size-=e;return c};PIXI.WebGLBatch.prototype.merge=function(c){this.dirty=true;this.tail.__next=c.head;c.head.__prev=this.tail;this.size+=c.size;this.tail=c.tail;var d=c.head;while(d){d.batch=this;d=d.__next}};PIXI.WebGLBatch.prototype.growBatch=function(){var h=this.gl;if(this.size==1){this.dynamicSize=1}else{this.dynamicSize=this.size*1.5}this.verticies=new Float32Array(this.dynamicSize*8);h.bindBuffer(h.ARRAY_BUFFER,this.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,this.verticies,h.DYNAMIC_DRAW);this.uvs=new Float32Array(this.dynamicSize*8);h.bindBuffer(h.ARRAY_BUFFER,this.uvBuffer);h.bufferData(h.ARRAY_BUFFER,this.uvs,h.DYNAMIC_DRAW);this.dirtyUVS=true;this.colors=new Float32Array(this.dynamicSize*4);h.bindBuffer(h.ARRAY_BUFFER,this.colorBuffer);h.bufferData(h.ARRAY_BUFFER,this.colors,h.DYNAMIC_DRAW);this.dirtyColors=true;this.indices=new Uint16Array(this.dynamicSize*6);var d=this.indices.length/6;for(var c=0;c<d;c++){var f=c*6;var e=c*4;this.indices[f+0]=e+0;this.indices[f+1]=e+1;this.indices[f+2]=e+2;this.indices[f+3]=e+0;this.indices[f+4]=e+2;this.indices[f+5]=e+3}h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,this.indexBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,this.indices,h.STATIC_DRAW)};PIXI.WebGLBatch.prototype.refresh=function(){var v=this.gl;if(this.dynamicSize<this.size){this.growBatch()}var p=0;var u,t,s,f,e,m,l,k,j,i;var C,B,z,w,D,A;var q=this.head;while(q){i=p*8;var o=q.texture;var n=o.frame;var E=o.baseTexture.width;var h=o.baseTexture.height;this.uvs[i+0]=n.x/E;this.uvs[i+1]=n.y/h;this.uvs[i+2]=(n.x+n.width)/E;this.uvs[i+3]=n.y/h;this.uvs[i+4]=(n.x+n.width)/E;this.uvs[i+5]=(n.y+n.height)/h;this.uvs[i+6]=n.x/E;this.uvs[i+7]=(n.y+n.height)/h;q.updateFrame=false;colorIndex=p*4;this.colors[colorIndex]=this.colors[colorIndex+1]=this.colors[colorIndex+2]=this.colors[colorIndex+3]=q.worldAlpha;q=q.__next;p++}this.dirtyUVS=true;this.dirtyColors=true};PIXI.WebGLBatch.prototype.update=function(){var A=this.gl;var z,w,v,f,e,p,o,n,m,l,k,i;var G,E,C,B,F,D;var t=0;var u=this.head;while(u){if(u.vcount===PIXI.visibleCount){w=u.texture.frame.width;v=u.texture.frame.height;f=u.anchor.x;e=u.anchor.y;p=w*(1-f);o=w*-f;n=v*(1-e);m=v*-e;l=t*8;z=u.worldTransform;G=z[0];E=z[3];C=z[1];B=z[4];F=z[2];D=z[5];this.verticies[l+0]=G*o+C*m+F;this.verticies[l+1]=B*m+E*o+D;this.verticies[l+2]=G*p+C*m+F;this.verticies[l+3]=B*m+E*p+D;this.verticies[l+4]=G*p+C*n+F;this.verticies[l+5]=B*n+E*p+D;this.verticies[l+6]=G*o+C*n+F;this.verticies[l+7]=B*n+E*o+D;if(u.updateFrame||u.texture.updateFrame){this.dirtyUVS=true;var s=u.texture;var q=s.frame;var H=s.baseTexture.width;var j=s.baseTexture.height;this.uvs[l+0]=q.x/H;this.uvs[l+1]=q.y/j;this.uvs[l+2]=(q.x+q.width)/H;this.uvs[l+3]=q.y/j;this.uvs[l+4]=(q.x+q.width)/H;this.uvs[l+5]=(q.y+q.height)/j;this.uvs[l+6]=q.x/H;this.uvs[l+7]=(q.y+q.height)/j;u.updateFrame=false}if(u.cacheAlpha!=u.worldAlpha){u.cacheAlpha=u.worldAlpha;var h=t*4;this.colors[h]=this.colors[h+1]=this.colors[h+2]=this.colors[h+3]=u.worldAlpha;this.dirtyColors=true}}else{l=t*8;this.verticies[l+0]=0;this.verticies[l+1]=0;this.verticies[l+2]=0;this.verticies[l+3]=0;this.verticies[l+4]=0;this.verticies[l+5]=0;this.verticies[l+6]=0;this.verticies[l+7]=0}t++;u=u.__next}};PIXI.WebGLBatch.prototype.render=function(h,d){h=h||0;if(d==undefined){d=this.size}if(this.dirty){this.refresh();this.dirty=false}if(this.size==0){return}this.update();var e=this.gl;var f=PIXI.shaderProgram;e.useProgram(f);e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer);e.bufferSubData(e.ARRAY_BUFFER,0,this.verticies);e.vertexAttribPointer(f.vertexPositionAttribute,2,e.FLOAT,false,0,0);e.bindBuffer(e.ARRAY_BUFFER,this.uvBuffer);if(this.dirtyUVS){this.dirtyUVS=false;e.bufferSubData(e.ARRAY_BUFFER,0,this.uvs)}e.vertexAttribPointer(f.textureCoordAttribute,2,e.FLOAT,false,0,0);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,this.texture._glTexture);e.bindBuffer(e.ARRAY_BUFFER,this.colorBuffer);if(this.dirtyColors){this.dirtyColors=false;e.bufferSubData(e.ARRAY_BUFFER,0,this.colors)}e.vertexAttribPointer(f.colorAttribute,1,e.FLOAT,false,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var c=d-h;e.drawElements(e.TRIANGLES,c*6,e.UNSIGNED_SHORT,h*2*6)};PIXI.WebGLGraphics=function(){};PIXI.WebGLGraphics.renderGraphics=function(e,d){var f=PIXI.gl;if(!e._webGL){e._webGL={points:[],indices:[],lastIndex:0,buffer:f.createBuffer(),indexBuffer:f.createBuffer()}}if(e.dirty){e.dirty=false;if(e.clearDirty){e.clearDirty=false;e._webGL.lastIndex=0;e._webGL.points=[];e._webGL.indices=[]}PIXI.WebGLGraphics.updateGraphics(e)}PIXI.activatePrimitiveShader();var c=PIXI.mat3.clone(e.worldTransform);PIXI.mat3.transpose(c);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);f.uniformMatrix3fv(PIXI.primitiveProgram.translationMatrix,false,c);f.uniform2f(PIXI.primitiveProgram.projectionVector,d.x,d.y);f.uniform1f(PIXI.primitiveProgram.alpha,e.worldAlpha);f.bindBuffer(f.ARRAY_BUFFER,e._webGL.buffer);f.vertexAttribPointer(PIXI.shaderProgram.vertexPositionAttribute,2,f.FLOAT,false,0,0);f.vertexAttribPointer(PIXI.primitiveProgram.vertexPositionAttribute,2,f.FLOAT,false,4*6,0);f.vertexAttribPointer(PIXI.primitiveProgram.colorAttribute,4,f.FLOAT,false,4*6,2*4);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,e._webGL.indexBuffer);f.drawElements(f.TRIANGLE_STRIP,e._webGL.indices.length,f.UNSIGNED_SHORT,0);PIXI.activateDefaultShader()};PIXI.WebGLGraphics.updateGraphics=function(c){for(var d=c._webGL.lastIndex;d<c.graphicsData.length;d++){var e=c.graphicsData[d];if(e.type==PIXI.Graphics.POLY){if(e.fill){if(e.points.length>3){PIXI.WebGLGraphics.buildPoly(e,c._webGL)}}if(e.lineWidth>0){PIXI.WebGLGraphics.buildLine(e,c._webGL)}}else{if(e.type==PIXI.Graphics.RECT){PIXI.WebGLGraphics.buildRectangle(e,c._webGL)}else{if(e.type==PIXI.Graphics.CIRC||e.type==PIXI.Graphics.ELIP){PIXI.WebGLGraphics.buildCircle(e,c._webGL)}}}}c._webGL.lastIndex=c.graphicsData.length;var f=PIXI.gl;c._webGL.glPoints=new Float32Array(c._webGL.points);f.bindBuffer(f.ARRAY_BUFFER,c._webGL.buffer);f.bufferData(f.ARRAY_BUFFER,c._webGL.glPoints,f.STATIC_DRAW);c._webGL.glIndicies=new Uint16Array(c._webGL.indices);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,c._webGL.indexBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,c._webGL.glIndicies,f.STATIC_DRAW)};PIXI.WebGLGraphics.buildRectangle=function(s,i){var f=s.points;var n=f[0];var m=f[1];var d=f[2];var q=f[3];if(s.fill){var h=HEXtoRGB(s.fillColor);var e=s.fillAlpha;var c=h[0]*e;var j=h[1]*e;var l=h[2]*e;var o=i.points;var p=i.indices;var k=o.length/6;o.push(n,m);o.push(c,j,l,e);o.push(n+d,m);o.push(c,j,l,e);o.push(n,m+q);o.push(c,j,l,e);o.push(n+d,m+q);o.push(c,j,l,e);p.push(k,k,k+1,k+2,k+3,k+3)}if(s.lineWidth){s.points=[n,m,n+d,m,n+d,m+q,n,m+q,n,m];PIXI.WebGLGraphics.buildLine(s,i)}};PIXI.WebGLGraphics.buildCircle=function(k,w){var f=k.points;var j=f[0];var h=f[1];var o=f[2];var n=f[3];var l=40;var t=(Math.PI*2)/l;if(k.fill){var p=HEXtoRGB(k.fillColor);var d=k.fillAlpha;var m=p[0]*d;var s=p[1]*d;var u=p[2]*d;var v=w.points;var e=w.indices;var c=v.length/6;e.push(c);for(var q=0;q<l+1;q++){v.push(j,h,m,s,u,d);v.push(j+Math.sin(t*q)*o,h+Math.cos(t*q)*n,m,s,u,d);e.push(c++,c++)}e.push(c-1)}if(k.lineWidth){k.points=[];for(var q=0;q<l+1;q++){k.points.push(j+Math.sin(t*q)*o,h+Math.cos(t*q)*n)}PIXI.WebGLGraphics.buildLine(k,w)}};PIXI.WebGLGraphics.buildLine=function(V,E){var O=true;var H=V.points;if(H.length==0){return}var t=new PIXI.Point(H[0],H[1]);var n=new PIXI.Point(H[H.length-2],H[H.length-1]);if(t.x==n.x&&t.y==n.y){H.pop();H.pop();n=new PIXI.Point(H[H.length-2],H[H.length-1]);var v=n.x+(t.x-n.x)*0.5;var s=n.y+(t.y-n.y)*0.5;H.unshift(v,s);H.push(v,s)}var S=E.points;var l=E.indices;var u=H.length/2;var q=H.length;var U=S.length/6;var c=V.lineWidth/2;var G=HEXtoRGB(V.lineColor);var Q=V.lineAlpha;var M=G[0]*Q;var T=G[1]*Q;var W=G[2]*Q;var J,I,B,A,k,j;var L,K,z,w,h,f;var e,d;var P,F,p,N,D,o;var X,C,m;J=H[0];I=H[1];B=H[2];A=H[3];L=-(I-A);K=J-B;m=Math.sqrt(L*L+K*K);L/=m;K/=m;L*=c;K*=c;S.push(J-L,I-K,M,T,W,Q);S.push(J+L,I+K,M,T,W,Q);for(var R=1;R<u-1;R++){J=H[(R-1)*2];I=H[(R-1)*2+1];B=H[(R)*2];A=H[(R)*2+1];k=H[(R+1)*2];j=H[(R+1)*2+1];L=-(I-A);K=J-B;m=Math.sqrt(L*L+K*K);L/=m;K/=m;L*=c;K*=c;z=-(A-j);w=B-k;m=Math.sqrt(z*z+w*w);z/=m;w/=m;z*=c;w*=c;P=(-K+I)-(-K+A);F=(-L+B)-(-L+J);p=(-L+J)*(-K+A)-(-L+B)*(-K+I);N=(-w+j)-(-w+A);D=(-z+B)-(-z+k);o=(-z+k)*(-w+A)-(-z+B)*(-w+j);X=P*D-N*F;if(X==0){X+=1}px=(F*o-D*p)/X;py=(N*p-P*o)/X;C=(px-B)*(px-B)+(py-A)+(py-A);if(C>140*140){h=L-z;f=K-w;m=Math.sqrt(h*h+f*f);h/=m;f/=m;h*=c;f*=c;S.push(B-h,A-f);S.push(M,T,W,Q);S.push(B+h,A+f);S.push(M,T,W,Q);S.push(B-h,A-f);S.push(M,T,W,Q);q++}else{S.push(px,py);S.push(M,T,W,Q);S.push(B-(px-B),A-(py-A));S.push(M,T,W,Q)}}J=H[(u-2)*2];I=H[(u-2)*2+1];B=H[(u-1)*2];A=H[(u-1)*2+1];L=-(I-A);K=J-B;m=Math.sqrt(L*L+K*K);L/=m;K/=m;L*=c;K*=c;S.push(B-L,A-K);S.push(M,T,W,Q);S.push(B+L,A+K);S.push(M,T,W,Q);l.push(U);for(var R=0;R<q;R++){l.push(U++)}l.push(U-1)};PIXI.WebGLGraphics.buildPoly=function(s,k){var p=s.points;if(p.length<6){return}var o=k.points;var q=k.indices;var d=p.length/2;var h=HEXtoRGB(s.fillColor);var f=s.fillAlpha;var c=h[0]*f;var l=h[1]*f;var n=h[2]*f;var e=PIXI.PolyK.Triangulate(p);var m=o.length/6;for(var j=0;j<e.length;j+=3){q.push(e[j]+m);q.push(e[j]+m);q.push(e[j+1]+m);q.push(e[j+2]+m);q.push(e[j+2]+m)}for(var j=0;j<d;j++){o.push(p[j*2],p[j*2+1],c,l,n,f)}};function HEXtoRGB(c){return[(c>>16&255)/255,(c>>8&255)/255,(c&255)/255]}PIXI._defaultFrame=new PIXI.Rectangle(0,0,1,1);PIXI.gl;PIXI.WebGLRenderer=function(i,c,f,l,d){this.transparent=!!l;this.width=i||800;this.height=c||600;this.view=f||document.createElement("canvas");this.view.width=this.width;this.view.height=this.height;var h=this;this.view.addEventListener("webglcontextlost",function(e){h.handleContextLost(e)},false);this.view.addEventListener("webglcontextrestored",function(e){h.handleContextRestored(e)},false);this.batchs=[];try{PIXI.gl=this.gl=this.view.getContext("experimental-webgl",{alpha:this.transparent,antialias:!!d,premultipliedAlpha:false,stencil:true})}catch(j){throw new Error(" This browser does not support webGL. Try using the canvas renderer"+this)}PIXI.initPrimitiveShader();PIXI.initDefaultShader();PIXI.initDefaultStripShader();PIXI.activateDefaultShader();var k=this.gl;PIXI.WebGLRenderer.gl=k;this.batch=new PIXI.WebGLBatch(k);k.disable(k.DEPTH_TEST);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.colorMask(true,true,true,this.transparent);PIXI.projection=new PIXI.Point(400,300);this.resize(this.width,this.height);this.contextLost=false;this.stageRenderGroup=new PIXI.WebGLRenderGroup(this.gl)};PIXI.WebGLRenderer.prototype.constructor=PIXI.WebGLRenderer;PIXI.WebGLRenderer.getBatch=function(){if(PIXI._batchs.length==0){return new PIXI.WebGLBatch(PIXI.WebGLRenderer.gl)}else{return PIXI._batchs.pop()}};PIXI.WebGLRenderer.returnBatch=function(c){c.clean();PIXI._batchs.push(c)};PIXI.WebGLRenderer.prototype.render=function(c){if(this.contextLost){return}if(this.__stage!==c){this.__stage=c;this.stageRenderGroup.setRenderable(c)}PIXI.WebGLRenderer.updateTextures();PIXI.visibleCount++;c.updateTransform();var e=this.gl;e.colorMask(true,true,true,this.transparent);e.viewport(0,0,this.width,this.height);e.bindFramebuffer(e.FRAMEBUFFER,null);e.clearColor(c.backgroundColorSplit[0],c.backgroundColorSplit[1],c.backgroundColorSplit[2],!this.transparent);e.clear(e.COLOR_BUFFER_BIT);this.stageRenderGroup.backgroundColor=c.backgroundColorSplit;this.stageRenderGroup.render(PIXI.projection);if(c.interactive){if(!c._interactiveEventsAdded){c._interactiveEventsAdded=true;c.interactionManager.setTarget(this)}}if(PIXI.Texture.frameUpdates.length>0){for(var d=0;d<PIXI.Texture.frameUpdates.length;d++){PIXI.Texture.frameUpdates[d].updateFrame=false}PIXI.Texture.frameUpdates=[]}};PIXI.WebGLRenderer.updateTextures=function(){for(var c=0;c<PIXI.texturesToUpdate.length;c++){PIXI.WebGLRenderer.updateTexture(PIXI.texturesToUpdate[c])}for(var c=0;c<PIXI.texturesToDestroy.length;c++){PIXI.WebGLRenderer.destroyTexture(PIXI.texturesToDestroy[c])}PIXI.texturesToUpdate=[];PIXI.texturesToDestroy=[]};PIXI.WebGLRenderer.updateTexture=function(c){var d=PIXI.gl;if(!c._glTexture){c._glTexture=d.createTexture()}if(c.hasLoaded){d.bindTexture(d.TEXTURE_2D,c._glTexture);d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,true);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,c.source);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR);if(!c._powerOf2){d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE)}else{d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.REPEAT);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.REPEAT)}d.bindTexture(d.TEXTURE_2D,null)}};PIXI.WebGLRenderer.destroyTexture=function(c){var d=PIXI.gl;if(c._glTexture){c._glTexture=d.createTexture();d.deleteTexture(d.TEXTURE_2D,c._glTexture)}};PIXI.WebGLRenderer.prototype.resize=function(d,c){this.width=d;this.height=c;this.view.width=d;this.view.height=c;this.gl.viewport(0,0,this.width,this.height);PIXI.projection.x=this.width/2;PIXI.projection.y=this.height/2};PIXI.WebGLRenderer.prototype.handleContextLost=function(c){c.preventDefault();this.contextLost=true};PIXI.WebGLRenderer.prototype.handleContextRestored=function(f){this.gl=this.view.getContext("experimental-webgl",{alpha:true});this.initShaders();for(var d in PIXI.TextureCache){var e=PIXI.TextureCache[d].baseTexture;e._glTexture=null;PIXI.WebGLRenderer.updateTexture(e)}for(var c=0;c<this.batchs.length;c++){this.batchs[c].restoreLostContext(this.gl);this.batchs[c].dirty=true}PIXI._restoreBatchs(this.gl);this.contextLost=false};PIXI.WebGLRenderGroup=function(c){this.gl=c;this.root;this.backgroundColor;this.batchs=[];this.toRemove=[]};PIXI.WebGLRenderGroup.prototype.constructor=PIXI.WebGLRenderGroup;PIXI.WebGLRenderGroup.prototype.setRenderable=function(c){if(this.root){this.removeDisplayObjectAndChildren(this.root)}c.worldVisible=c.visible;this.root=c;this.addDisplayObjectAndChildren(c)};PIXI.WebGLRenderGroup.prototype.render=function(c){PIXI.WebGLRenderer.updateTextures();var h=this.gl;h.uniform2f(PIXI.shaderProgram.projectionVector,c.x,c.y);h.blendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA);var f;for(var e=0;e<this.batchs.length;e++){f=this.batchs[e];if(f instanceof PIXI.WebGLBatch){this.batchs[e].render();continue}var d=f.vcount===PIXI.visibleCount;if(f instanceof PIXI.TilingSprite){if(d){this.renderTilingSprite(f,c)}}else{if(f instanceof PIXI.Strip){if(d){this.renderStrip(f,c)}}else{if(f instanceof PIXI.Graphics){if(d&&f.renderable){PIXI.WebGLGraphics.renderGraphics(f,c)}}else{if(f instanceof PIXI.FilterBlock){if(f.open){h.enable(h.STENCIL_TEST);h.colorMask(false,false,false,false);h.stencilFunc(h.ALWAYS,1,255);h.stencilOp(h.KEEP,h.KEEP,h.REPLACE);PIXI.WebGLGraphics.renderGraphics(f.mask,c);h.colorMask(true,true,true,false);h.stencilFunc(h.NOTEQUAL,0,255);h.stencilOp(h.KEEP,h.KEEP,h.KEEP)}else{h.disable(h.STENCIL_TEST)}}}}}}};PIXI.WebGLRenderGroup.prototype.handleFilter=function(d,c){};PIXI.WebGLRenderGroup.prototype.renderSpecific=function(m,l){PIXI.WebGLRenderer.updateTextures();var j=this.gl;j.uniform2f(PIXI.shaderProgram.projectionVector,l.x,l.y);var s;var e;var k;var t;var q=m.first;while(q._iNext){q=q._iNext;if(q.renderable&&q.__renderGroup){break}}var o=q.batch;if(q instanceof PIXI.Sprite){o=q.batch;var n=o.head;var h=n;if(n==q){s=0}else{s=1;while(n.__next!=q){s++;n=n.__next}}}else{o=q}var c=m;var d;var p=m;while(p.children.length>0){p=p.children[p.children.length-1];if(p.renderable){c=p}}if(c instanceof PIXI.Sprite){d=c.batch;var n=d.head;if(n==c){k=0}else{k=1;while(n.__next!=c){k++;n=n.__next}}}else{d=c}if(o==d){if(o instanceof PIXI.WebGLBatch){o.render(s,k+1)}else{this.renderSpecial(o,l)}return}e=this.batchs.indexOf(o);t=this.batchs.indexOf(d);if(o instanceof PIXI.WebGLBatch){o.render(s)}else{this.renderSpecial(o,l)}for(var f=e+1;f<t;f++){renderable=this.batchs[f];if(renderable instanceof PIXI.WebGLBatch){this.batchs[f].render()}else{this.renderSpecial(renderable,l)}}if(d instanceof PIXI.WebGLBatch){d.render(0,k+1)}else{this.renderSpecial(d,l)}};PIXI.WebGLRenderGroup.prototype.renderSpecial=function(e,c){var d=e.vcount===PIXI.visibleCount;if(e instanceof PIXI.TilingSprite){if(d){this.renderTilingSprite(e,c)}}else{if(e instanceof PIXI.Strip){if(d){this.renderStrip(e,c)}}else{if(e instanceof PIXI.CustomRenderable){if(d){e.renderWebGL(this,c)}}else{if(e instanceof PIXI.Graphics){if(d&&e.renderable){PIXI.WebGLGraphics.renderGraphics(e,c)}}else{if(e instanceof PIXI.FilterBlock){var f=PIXI.gl;if(e.open){f.enable(f.STENCIL_TEST);f.colorMask(false,false,false,false);f.stencilFunc(f.ALWAYS,1,255);f.stencilOp(f.KEEP,f.KEEP,f.REPLACE);PIXI.WebGLGraphics.renderGraphics(e.mask,c);f.colorMask(true,true,true,true);f.stencilFunc(f.NOTEQUAL,0,255);f.stencilOp(f.KEEP,f.KEEP,f.KEEP)}else{f.disable(f.STENCIL_TEST)}}}}}}};PIXI.WebGLRenderGroup.prototype.updateTexture=function(e){this.removeObject(e);var c=e.first;while(c!=this.root){c=c._iPrev;if(c.renderable&&c.__renderGroup){break}}var d=e.last;while(d._iNext){d=d._iNext;if(d.renderable&&d.__renderGroup){break}}this.insertObject(e,c,d)};PIXI.WebGLRenderGroup.prototype.addFilterBlocks=function(f,d){f.__renderGroup=this;d.__renderGroup=this;var c=f;while(c!=this.root){c=c._iPrev;if(c.renderable&&c.__renderGroup){break}}this.insertAfter(f,c);var e=d;while(e!=this.root){e=e._iPrev;if(e.renderable&&e.__renderGroup){break}}this.insertAfter(d,e)};PIXI.WebGLRenderGroup.prototype.removeFilterBlocks=function(d,c){this.removeObject(d);this.removeObject(c)};PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren=function(h){if(h.__renderGroup){h.__renderGroup.removeDisplayObjectAndChildren(h)}var c=h.first;while(c!=this.root.first){c=c._iPrev;if(c.renderable&&c.__renderGroup){break}}var d=h.last;while(d._iNext){d=d._iNext;if(d.renderable&&d.__renderGroup){break}}var f=h.first;var e=h.last._iNext;do{f.__renderGroup=this;if(f.renderable){this.insertObject(f,c,d);c=f}f=f._iNext}while(f!=e)};PIXI.WebGLRenderGroup.prototype.removeDisplayObjectAndChildren=function(c){if(c.__renderGroup!=this){return}var d=c.last;do{c.__renderGroup=null;if(c.renderable){this.removeObject(c)}c=c._iNext}while(c)};PIXI.WebGLRenderGroup.prototype.insertObject=function(j,i,k){var c=i;var d=k;if(j instanceof PIXI.Sprite){var l;var e;if(c instanceof PIXI.Sprite){l=c.batch;if(l){if(l.texture==j.texture.baseTexture&&l.blendMode==j.blendMode){l.insertAfter(j,c);return}}}else{l=c}if(d){if(d instanceof PIXI.Sprite){e=d.batch;if(e){if(e.texture==j.texture.baseTexture&&e.blendMode==j.blendMode){e.insertBefore(j,d);return}else{if(e==l){var m=l.split(d);var f=PIXI.WebGLRenderer.getBatch();var h=this.batchs.indexOf(l);f.init(j);this.batchs.splice(h+1,0,f,m);return}}}}else{e=d}}var f=PIXI.WebGLRenderer.getBatch();f.init(j);if(l){var h=this.batchs.indexOf(l);this.batchs.splice(h+1,0,f)}else{this.batchs.push(f)}return}else{if(j instanceof PIXI.TilingSprite){this.initTilingSprite(j)}else{if(j instanceof PIXI.Strip){this.initStrip(j)}else{if(j){}}}}this.insertAfter(j,c)};PIXI.WebGLRenderGroup.prototype.insertAfter=function(e,h){if(h instanceof PIXI.Sprite){var f=h.batch;if(f){if(f.tail==h){var d=this.batchs.indexOf(f);this.batchs.splice(d+1,0,e)}else{var c=f.split(h.__next);var d=this.batchs.indexOf(f);this.batchs.splice(d+1,0,e,c)}}else{this.batchs.push(e)}}else{var d=this.batchs.indexOf(h);this.batchs.splice(d+1,0,e)}};PIXI.WebGLRenderGroup.prototype.removeObject=function(f){var e;if(f instanceof PIXI.Sprite){var d=f.batch;if(!d){return}d.remove(f);if(d.size==0){e=d}}else{e=f}if(e){var c=this.batchs.indexOf(e);if(c==-1){return}if(c==0||c==this.batchs.length-1){this.batchs.splice(c,1);if(e instanceof PIXI.WebGLBatch){PIXI.WebGLRenderer.returnBatch(e)}return}if(this.batchs[c-1] instanceof PIXI.WebGLBatch&&this.batchs[c+1] instanceof PIXI.WebGLBatch){if(this.batchs[c-1].texture==this.batchs[c+1].texture&&this.batchs[c-1].blendMode==this.batchs[c+1].blendMode){this.batchs[c-1].merge(this.batchs[c+1]);if(e instanceof PIXI.WebGLBatch){PIXI.WebGLRenderer.returnBatch(e)}PIXI.WebGLRenderer.returnBatch(this.batchs[c+1]);this.batchs.splice(c,2);return}}this.batchs.splice(c,1);if(e instanceof PIXI.WebGLBatch){PIXI.WebGLRenderer.returnBatch(e)}}};PIXI.WebGLRenderGroup.prototype.initTilingSprite=function(c){var d=this.gl;c.verticies=new Float32Array([0,0,c.width,0,c.width,c.height,0,c.height]);c.uvs=new Float32Array([0,0,1,0,1,1,0,1]);c.colors=new Float32Array([1,1,1,1]);c.indices=new Uint16Array([0,1,3,2]);c._vertexBuffer=d.createBuffer();c._indexBuffer=d.createBuffer();c._uvBuffer=d.createBuffer();c._colorBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,c._vertexBuffer);d.bufferData(d.ARRAY_BUFFER,c.verticies,d.STATIC_DRAW);d.bindBuffer(d.ARRAY_BUFFER,c._uvBuffer);d.bufferData(d.ARRAY_BUFFER,c.uvs,d.DYNAMIC_DRAW);d.bindBuffer(d.ARRAY_BUFFER,c._colorBuffer);d.bufferData(d.ARRAY_BUFFER,c.colors,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,c._indexBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,c.indices,d.STATIC_DRAW);if(c.texture.baseTexture._glTexture){d.bindTexture(d.TEXTURE_2D,c.texture.baseTexture._glTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.REPEAT);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.REPEAT);c.texture.baseTexture._powerOf2=true}else{c.texture.baseTexture._powerOf2=true}};PIXI.WebGLRenderGroup.prototype.renderStrip=function(e,d){var f=this.gl;var h=PIXI.shaderProgram;f.useProgram(PIXI.stripShaderProgram);var c=PIXI.mat3.clone(e.worldTransform);PIXI.mat3.transpose(c);f.uniformMatrix3fv(PIXI.stripShaderProgram.translationMatrix,false,c);f.uniform2f(PIXI.stripShaderProgram.projectionVector,d.x,d.y);f.uniform1f(PIXI.stripShaderProgram.alpha,e.worldAlpha);if(!e.dirty){f.bindBuffer(f.ARRAY_BUFFER,e._vertexBuffer);f.bufferSubData(f.ARRAY_BUFFER,0,e.verticies);f.vertexAttribPointer(h.vertexPositionAttribute,2,f.FLOAT,false,0,0);f.bindBuffer(f.ARRAY_BUFFER,e._uvBuffer);f.vertexAttribPointer(h.textureCoordAttribute,2,f.FLOAT,false,0,0);f.activeTexture(f.TEXTURE0);f.bindTexture(f.TEXTURE_2D,e.texture.baseTexture._glTexture);f.bindBuffer(f.ARRAY_BUFFER,e._colorBuffer);f.vertexAttribPointer(h.colorAttribute,1,f.FLOAT,false,0,0);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,e._indexBuffer)}else{e.dirty=false;f.bindBuffer(f.ARRAY_BUFFER,e._vertexBuffer);f.bufferData(f.ARRAY_BUFFER,e.verticies,f.STATIC_DRAW);f.vertexAttribPointer(h.vertexPositionAttribute,2,f.FLOAT,false,0,0);f.bindBuffer(f.ARRAY_BUFFER,e._uvBuffer);f.bufferData(f.ARRAY_BUFFER,e.uvs,f.STATIC_DRAW);f.vertexAttribPointer(h.textureCoordAttribute,2,f.FLOAT,false,0,0);f.activeTexture(f.TEXTURE0);f.bindTexture(f.TEXTURE_2D,e.texture.baseTexture._glTexture);f.bindBuffer(f.ARRAY_BUFFER,e._colorBuffer);f.bufferData(f.ARRAY_BUFFER,e.colors,f.STATIC_DRAW);f.vertexAttribPointer(h.colorAttribute,1,f.FLOAT,false,0,0);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,e._indexBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,e.indices,f.STATIC_DRAW)}f.drawElements(f.TRIANGLE_STRIP,e.indices.length,f.UNSIGNED_SHORT,0);f.useProgram(PIXI.shaderProgram)};PIXI.WebGLRenderGroup.prototype.renderTilingSprite=function(l,i){var f=this.gl;var c=PIXI.shaderProgram;var e=l.tilePosition;var m=l.tileScale;var h=e.x/l.texture.baseTexture.width;var d=e.y/l.texture.baseTexture.height;var k=(l.width/l.texture.baseTexture.width)/m.x;var j=(l.height/l.texture.baseTexture.height)/m.y;l.uvs[0]=0-h;l.uvs[1]=0-d;l.uvs[2]=(1*k)-h;l.uvs[3]=0-d;l.uvs[4]=(1*k)-h;l.uvs[5]=(1*j)-d;l.uvs[6]=0-h;l.uvs[7]=(1*j)-d;f.bindBuffer(f.ARRAY_BUFFER,l._uvBuffer);f.bufferSubData(f.ARRAY_BUFFER,0,l.uvs);this.renderStrip(l,i)};PIXI.WebGLRenderGroup.prototype.initStrip=function(c){var d=this.gl;var e=this.shaderProgram;c._vertexBuffer=d.createBuffer();c._indexBuffer=d.createBuffer();c._uvBuffer=d.createBuffer();c._colorBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,c._vertexBuffer);d.bufferData(d.ARRAY_BUFFER,c.verticies,d.DYNAMIC_DRAW);d.bindBuffer(d.ARRAY_BUFFER,c._uvBuffer);d.bufferData(d.ARRAY_BUFFER,c.uvs,d.STATIC_DRAW);d.bindBuffer(d.ARRAY_BUFFER,c._colorBuffer);d.bufferData(d.ARRAY_BUFFER,c.colors,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,c._indexBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,c.indices,d.STATIC_DRAW)};PIXI.shaderFragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {","gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));","gl_FragColor = gl_FragColor * vColor;","}"];PIXI.shaderVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform vec2 projectionVector;","varying vec2 vTextureCoord;","varying float vColor;","void main(void) {","gl_Position = vec4( aVertexPosition.x / projectionVector.x -1.0, aVertexPosition.y / -projectionVector.y + 1.0 , 0.0, 1.0);","vTextureCoord = aTextureCoord;","vColor = aColor;","}"];PIXI.stripShaderFragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying float vColor;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {","gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));","gl_FragColor = gl_FragColor * alpha;","}"];PIXI.stripShaderVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","varying vec2 vTextureCoord;","varying float vColor;","void main(void) {","vec3 v = translationMatrix * vec3(aVertexPosition, 1.0);","gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);","vTextureCoord = aTextureCoord;","vColor = aColor;","}"];PIXI.primitiveShaderFragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {","gl_FragColor = vColor;","}"];PIXI.primitiveShaderVertexSrc=["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform float alpha;","varying vec4 vColor;","void main(void) {","vec3 v = translationMatrix * vec3(aVertexPosition, 1.0);","gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);","vColor = aColor * alpha;","}"];PIXI.initPrimitiveShader=function(){var c=PIXI.gl;var d=PIXI.compileProgram(PIXI.primitiveShaderVertexSrc,PIXI.primitiveShaderFragmentSrc);c.useProgram(d);d.vertexPositionAttribute=c.getAttribLocation(d,"aVertexPosition");d.colorAttribute=c.getAttribLocation(d,"aColor");d.projectionVector=c.getUniformLocation(d,"projectionVector");d.translationMatrix=c.getUniformLocation(d,"translationMatrix");d.alpha=c.getUniformLocation(d,"alpha");PIXI.primitiveProgram=d};PIXI.initDefaultShader=function(){var c=this.gl;var d=PIXI.compileProgram(PIXI.shaderVertexSrc,PIXI.shaderFragmentSrc);c.useProgram(d);d.vertexPositionAttribute=c.getAttribLocation(d,"aVertexPosition");d.projectionVector=c.getUniformLocation(d,"projectionVector");d.textureCoordAttribute=c.getAttribLocation(d,"aTextureCoord");d.colorAttribute=c.getAttribLocation(d,"aColor");d.samplerUniform=c.getUniformLocation(d,"uSampler");PIXI.shaderProgram=d};PIXI.initDefaultStripShader=function(){var c=this.gl;var d=PIXI.compileProgram(PIXI.stripShaderVertexSrc,PIXI.stripShaderFragmentSrc);c.useProgram(d);d.vertexPositionAttribute=c.getAttribLocation(d,"aVertexPosition");d.projectionVector=c.getUniformLocation(d,"projectionVector");d.textureCoordAttribute=c.getAttribLocation(d,"aTextureCoord");d.translationMatrix=c.getUniformLocation(d,"translationMatrix");d.alpha=c.getUniformLocation(d,"alpha");d.colorAttribute=c.getAttribLocation(d,"aColor");d.projectionVector=c.getUniformLocation(d,"projectionVector");d.samplerUniform=c.getUniformLocation(d,"uSampler");PIXI.stripShaderProgram=d};PIXI.CompileVertexShader=function(d,c){return PIXI._CompileShader(d,c,d.VERTEX_SHADER)};PIXI.CompileFragmentShader=function(d,c){return PIXI._CompileShader(d,c,d.FRAGMENT_SHADER)};PIXI._CompileShader=function(h,f,e){var d=f.join("\n");var c=h.createShader(e);h.shaderSource(c,d);h.compileShader(c);if(!h.getShaderParameter(c,h.COMPILE_STATUS)){alert(h.getShaderInfoLog(c));return null}return c};PIXI.compileProgram=function(c,e){var h=PIXI.gl;var d=PIXI.CompileFragmentShader(h,e);var f=PIXI.CompileVertexShader(h,c);var i=h.createProgram();h.attachShader(i,f);h.attachShader(i,d);h.linkProgram(i);if(!h.getProgramParameter(i,h.LINK_STATUS)){alert("Could not initialise shaders")}return i};PIXI.activateDefaultShader=function(){var c=PIXI.gl;var d=PIXI.shaderProgram;c.useProgram(d);c.enableVertexAttribArray(d.vertexPositionAttribute);c.enableVertexAttribArray(d.textureCoordAttribute);c.enableVertexAttribArray(d.colorAttribute)};PIXI.activatePrimitiveShader=function(){var c=PIXI.gl;c.disableVertexAttribArray(PIXI.shaderProgram.textureCoordAttribute);c.disableVertexAttribArray(PIXI.shaderProgram.colorAttribute);c.useProgram(PIXI.primitiveProgram);c.enableVertexAttribArray(PIXI.primitiveProgram.vertexPositionAttribute);c.enableVertexAttribArray(PIXI.primitiveProgram.colorAttribute)};PIXI.BitmapText=function(d,c){PIXI.DisplayObjectContainer.call(this);this.setText(d);this.setStyle(c);this.updateText();this.dirty=false};PIXI.BitmapText.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.BitmapText.prototype.constructor=PIXI.BitmapText;PIXI.BitmapText.prototype.setText=function(c){this.text=c||" ";this.dirty=true};PIXI.BitmapText.prototype.setStyle=function(d){d=d||{};d.align=d.align||"left";this.style=d;var c=d.font.split(" ");this.fontName=c[c.length-1];this.fontSize=c.length>=2?parseInt(c[c.length-2],10):PIXI.BitmapText.fonts[this.fontName].size;this.dirty=true};PIXI.BitmapText.prototype.updateText=function(){var k=PIXI.BitmapText.fonts[this.fontName];var o=new PIXI.Point();var l=null;var n=[];var t=0;var f=[];var s=0;var h=this.fontSize/k.size;for(var j=0;j<this.text.length;j++){var q=this.text.charCodeAt(j);if(/(?:\r\n|\r|\n)/.test(this.text.charAt(j))){f.push(o.x);t=Math.max(t,o.x);s++;o.x=0;o.y+=k.lineHeight;l=null;continue}var e=k.chars[q];if(!e){continue}if(l&&e[l]){o.x+=e.kerning[l]}n.push({texture:e.texture,line:s,charCode:q,position:new PIXI.Point(o.x+e.xOffset,o.y+e.yOffset)});o.x+=e.xAdvance;l=q}f.push(o.x);t=Math.max(t,o.x);var p=[];for(j=0;j<=s;j++){var d=0;if(this.style.align=="right"){d=t-f[j]}else{if(this.style.align=="center"){d=(t-f[j])/2}}p.push(d)}for(j=0;j<n.length;j++){var m=new PIXI.Sprite(n[j].texture);m.position.x=(n[j].position.x+p[n[j].line])*h;m.position.y=n[j].position.y*h;m.scale.x=m.scale.y=h;this.addChild(m)}this.width=o.x*h;this.height=(o.y+k.lineHeight)*h};PIXI.BitmapText.prototype.updateTransform=function(){if(this.dirty){while(this.children.length>0){this.removeChild(this.getChildAt(0))}this.updateText();this.dirty=false}PIXI.DisplayObjectContainer.prototype.updateTransform.call(this)};PIXI.BitmapText.fonts={};PIXI.Text=function(d,c){this.canvas=document.createElement("canvas");this.context=this.canvas.getContext("2d");PIXI.Sprite.call(this,PIXI.Texture.fromCanvas(this.canvas));this.setText(d);this.setStyle(c);this.updateText();this.dirty=false};PIXI.Text.prototype=Object.create(PIXI.Sprite.prototype);PIXI.Text.prototype.constructor=PIXI.Text;PIXI.Text.prototype.setStyle=function(c){c=c||{};c.font=c.font||"bold 20pt Arial";c.fill=c.fill||"black";c.align=c.align||"left";c.stroke=c.stroke||"black";c.strokeThickness=c.strokeThickness||0;c.wordWrap=c.wordWrap||false;c.wordWrapWidth=c.wordWrapWidth||100;this.style=c;this.dirty=true};PIXI.Sprite.prototype.setText=function(c){this.text=c.toString()||" ";this.dirty=true};PIXI.Text.prototype.updateText=function(){this.context.font=this.style.font;var j=this.text;if(this.style.wordWrap){j=this.wordWrap(this.text)}var h=j.split(/(?:\r\n|\r|\n)/);var e=[];var d=0;for(var k=0;k<h.length;k++){var c=this.context.measureText(h[k]).width;e[k]=c;d=Math.max(d,c)}this.canvas.width=d+this.style.strokeThickness;var l=this.determineFontHeight("font: "+this.style.font+";")+this.style.strokeThickness;this.canvas.height=l*h.length;this.context.fillStyle=this.style.fill;this.context.font=this.style.font;this.context.strokeStyle=this.style.stroke;this.context.lineWidth=this.style.strokeThickness;this.context.textBaseline="top";for(k=0;k<h.length;k++){var f=new PIXI.Point(this.style.strokeThickness/2,this.style.strokeThickness/2+k*l);if(this.style.align=="right"){f.x+=d-e[k]}else{if(this.style.align=="center"){f.x+=(d-e[k])/2}}if(this.style.stroke&&this.style.strokeThickness){this.context.strokeText(h[k],f.x,f.y)}if(this.style.fill){this.context.fillText(h[k],f.x,f.y)}}this.updateTexture()};PIXI.Text.prototype.updateTexture=function(){this.texture.baseTexture.width=this.canvas.width;this.texture.baseTexture.height=this.canvas.height;this.texture.frame.width=this.canvas.width;this.texture.frame.height=this.canvas.height;this._width=this.canvas.width;this._height=this.canvas.height;PIXI.texturesToUpdate.push(this.texture.baseTexture)};PIXI.Text.prototype.updateTransform=function(){if(this.dirty){this.updateText();this.dirty=false}PIXI.Sprite.prototype.updateTransform.call(this)};PIXI.Text.prototype.determineFontHeight=function(h){var d=PIXI.Text.heightCache[h];if(!d){var c=document.getElementsByTagName("body")[0];var f=document.createElement("div");var e=document.createTextNode("M");f.appendChild(e);f.setAttribute("style",h+";position:absolute;top:0;left:0");c.appendChild(f);d=f.offsetHeight;PIXI.Text.heightCache[h]=d;c.removeChild(f)}return d};PIXI.Text.prototype.wordWrap=function(j){var f=function(k,n,o,i,l){var m=Math.floor((i-o)/2)+o;if(m==o){return 1}if(k.measureText(n.substring(0,m)).width<=l){if(k.measureText(n.substring(0,m+1)).width>l){return m}else{return arguments.callee(k,n,m,i,l)}}else{return arguments.callee(k,n,o,m,l)}};var h=function(i,l,k){if(i.measureText(l).width<=k||l.length<1){return l}var m=f(i,l,0,l.length,k);return l.substring(0,m)+"\n"+arguments.callee(i,l.substring(m),k)};var c="";var d=j.split("\n");for(var e=0;e<d.length;e++){c+=h(this.context,d[e],this.style.wordWrapWidth)+"\n"}return c};PIXI.Text.prototype.destroy=function(c){if(c){this.texture.destroy()}};PIXI.Text.heightCache={};PIXI.BaseTextureCache={};PIXI.texturesToUpdate=[];PIXI.texturesToDestroy=[];PIXI.BaseTexture=function(d){PIXI.EventTarget.call(this);this.width=100;this.height=100;this.hasLoaded=false;this.source=d;if(!d){return}if(this.source instanceof Image||this.source instanceof HTMLImageElement){if(this.source.complete){this.hasLoaded=true;this.width=this.source.width;this.height=this.source.height;PIXI.texturesToUpdate.push(this)}else{var c=this;this.source.onload=function(){c.hasLoaded=true;c.width=c.source.width;c.height=c.source.height;PIXI.texturesToUpdate.push(c);c.dispatchEvent({type:"loaded",content:c})}}}else{this.hasLoaded=true;this.width=this.source.width;this.height=this.source.height;PIXI.texturesToUpdate.push(this)}this._powerOf2=false};PIXI.BaseTexture.prototype.constructor=PIXI.BaseTexture;PIXI.BaseTexture.prototype.destroy=function(){if(this.source instanceof Image){this.source.src=null}this.source=null;PIXI.texturesToDestroy.push(this)};PIXI.BaseTexture.fromImage=function(d,c){var e=PIXI.BaseTextureCache[d];if(!e){var f=new Image();if(c){f.crossOrigin=""}f.src=d;e=new PIXI.BaseTexture(f);PIXI.BaseTextureCache[d]=e}return e};PIXI.TextureCache={};PIXI.FrameCache={};PIXI.Texture=function(d,e){PIXI.EventTarget.call(this);if(!e){this.noFrame=true;e=new PIXI.Rectangle(0,0,1,1)}if(d instanceof PIXI.Texture){d=d.baseTexture}this.baseTexture=d;this.frame=e;this.trim=new PIXI.Point();this.scope=this;if(d.hasLoaded){if(this.noFrame){e=new PIXI.Rectangle(0,0,d.width,d.height)}this.setFrame(e)}else{var c=this;d.addEventListener("loaded",function(){c.onBaseTextureLoaded()})}};PIXI.Texture.prototype.constructor=PIXI.Texture;PIXI.Texture.prototype.onBaseTextureLoaded=function(d){var c=this.baseTexture;c.removeEventListener("loaded",this.onLoaded);if(this.noFrame){this.frame=new PIXI.Rectangle(0,0,c.width,c.height)}this.noFrame=false;this.width=this.frame.width;this.height=this.frame.height;this.scope.dispatchEvent({type:"update",content:this})};PIXI.Texture.prototype.destroy=function(c){if(c){this.baseTexture.destroy()}};PIXI.Texture.prototype.setFrame=function(c){this.frame=c;this.width=c.width;this.height=c.height;if(c.x+c.width>this.baseTexture.width||c.y+c.height>this.baseTexture.height){throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this)}this.updateFrame=true;PIXI.Texture.frameUpdates.push(this)};PIXI.Texture.fromImage=function(d,c){var e=PIXI.TextureCache[d];if(!e){e=new PIXI.Texture(PIXI.BaseTexture.fromImage(d,c));PIXI.TextureCache[d]=e}return e};PIXI.Texture.fromFrame=function(d){var c=PIXI.TextureCache[d];if(!c){throw new Error("The frameId '"+d+"' does not exist in the texture cache "+this)}return c};PIXI.Texture.fromCanvas=function(c){var d=new PIXI.BaseTexture(c);return new PIXI.Texture(d)};PIXI.Texture.addTextureToCache=function(c,d){PIXI.TextureCache[d]=c};PIXI.Texture.removeTextureFromCache=function(d){var c=PIXI.TextureCache[d];PIXI.TextureCache[d]=null;return c};PIXI.Texture.frameUpdates=[];PIXI.RenderTexture=function(d,c){PIXI.EventTarget.call(this);this.width=d||100;this.height=c||100;this.indetityMatrix=PIXI.mat3.create();this.frame=new PIXI.Rectangle(0,0,this.width,this.height);if(PIXI.gl){this.initWebGL()}else{this.initCanvas()}};PIXI.RenderTexture.prototype=Object.create(PIXI.Texture.prototype);PIXI.RenderTexture.prototype.constructor=PIXI.RenderTexture;PIXI.RenderTexture.prototype.initWebGL=function(){var c=PIXI.gl;this.glFramebuffer=c.createFramebuffer();c.bindFramebuffer(c.FRAMEBUFFER,this.glFramebuffer);this.glFramebuffer.width=this.width;this.glFramebuffer.height=this.height;this.baseTexture=new PIXI.BaseTexture();this.baseTexture.width=this.width;this.baseTexture.height=this.height;this.baseTexture._glTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,this.baseTexture._glTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,this.width,this.height,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR);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);this.baseTexture.isRender=true;c.bindFramebuffer(c.FRAMEBUFFER,this.glFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,this.baseTexture._glTexture,0);this.projection=new PIXI.Point(this.width/2,this.height/2);this.render=this.renderWebGL};PIXI.RenderTexture.prototype.resize=function(d,c){this.width=d;this.height=c;if(PIXI.gl){this.projection.x=this.width/2;this.projection.y=this.height/2;var e=PIXI.gl;e.bindTexture(e.TEXTURE_2D,this.baseTexture._glTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,null)}else{this.frame.width=this.width;this.frame.height=this.height;this.renderer.resize(this.width,this.height)}};PIXI.RenderTexture.prototype.initCanvas=function(){this.renderer=new PIXI.CanvasRenderer(this.width,this.height,null,0);this.baseTexture=new PIXI.BaseTexture(this.renderer.view);this.frame=new PIXI.Rectangle(0,0,this.width,this.height);this.render=this.renderCanvas};PIXI.RenderTexture.prototype.renderWebGL=function(m,k,l){var h=PIXI.gl;h.colorMask(true,true,true,true);h.viewport(0,0,this.width,this.height);h.bindFramebuffer(h.FRAMEBUFFER,this.glFramebuffer);if(l){h.clearColor(0,0,0,0);h.clear(h.COLOR_BUFFER_BIT)}var d=m.children;var c=m.worldTransform;m.worldTransform=PIXI.mat3.create();m.worldTransform[4]=-1;m.worldTransform[5]=this.projection.y*2;if(k){m.worldTransform[2]=k.x;m.worldTransform[5]-=k.y}PIXI.visibleCount++;m.vcount=PIXI.visibleCount;for(var f=0,e=d.length;f<e;f++){d[f].updateTransform()}var n=m.__renderGroup;if(n){if(m==n.root){n.render(this.projection)}else{n.renderSpecific(m,this.projection)}}else{if(!this.renderGroup){this.renderGroup=new PIXI.WebGLRenderGroup(h)}this.renderGroup.setRenderable(m);this.renderGroup.render(this.projection)}m.worldTransform=c};PIXI.RenderTexture.prototype.renderCanvas=function(k,d,c){var h=k.children;k.worldTransform=PIXI.mat3.create();if(d){k.worldTransform[2]=d.x;k.worldTransform[5]=d.y}for(var f=0,e=h.length;f<e;f++){h[f].updateTransform()}if(c){this.renderer.context.clearRect(0,0,this.width,this.height)}this.renderer.renderDisplayObject(k);this.renderer.context.setTransform(1,0,0,1,0,0)};PIXI.EventTarget=function(){var c={};this.addEventListener=this.on=function(d,e){if(c[d]===undefined){c[d]=[]}if(c[d].indexOf(e)===-1){c[d].push(e)}};this.dispatchEvent=this.emit=function(d){for(var e in c[d.type]){c[d.type][e](d)}};this.removeEventListener=this.off=function(e,f){var d=c[e].indexOf(f);if(d!==-1){c[e].splice(d,1)}}};PIXI.PolyK={};PIXI.PolyK.Triangulate=function(l){var C=true;var m=l.length>>1;if(m<3){return[]}var z=[];var k=[];for(var v=0;v<m;v++){k.push(v)}var v=0;var s=m;while(s>3){var t=k[(v+0)%s];var q=k[(v+1)%s];var o=k[(v+2)%s];var h=l[2*t],e=l[2*t+1];var A=l[2*q],w=l[2*q+1];var d=l[2*o],c=l[2*o+1];var f=false;if(PIXI.PolyK._convex(h,e,A,w,d,c,C)){f=true;for(var u=0;u<s;u++){var B=k[u];if(B==t||B==q||B==o){continue}if(PIXI.PolyK._PointInTriangle(l[2*B],l[2*B+1],h,e,A,w,d,c)){f=false;break}}}if(f){z.push(t,q,o);k.splice((v+1)%s,1);s--;v=0}else{if(v++>3*s){if(C){var z=[];k=[];for(var v=0;v<m;v++){k.push(v)}v=0;s=m;C=false}else{console.log("PIXI Warning: shape too complex to fill");return[]}}}}z.push(k[0],k[1],k[2]);return z};PIXI.PolyK._PointInTriangle=function(s,q,n,m,D,C,j,h){var f=j-n;var e=h-m;var l=D-n;var k=C-m;var B=s-n;var z=q-m;var A=f*f+e*e;var w=f*l+e*k;var t=f*B+e*z;var d=l*l+k*k;var c=l*B+k*z;var i=1/(A*d-w*w);var p=(d*t-w*c)*i;var o=(A*c-w*t)*i;return(p>=0)&&(o>=0)&&(p+o<1)};PIXI.PolyK._convex=function(f,e,i,h,c,j,d){return((e-h)*(c-i)+(i-f)*(j-h)>=0)==d};Phaser.Camera=function(e,i,d,h,f,c){this.game=e;this.world=e.world;this.id=0;this.view=new Phaser.Rectangle(d,h,f,c);this.screenView=new Phaser.Rectangle(d,h,f,c)};Phaser.Camera.FOLLOW_LOCKON=0;Phaser.Camera.FOLLOW_PLATFORMER=1;Phaser.Camera.FOLLOW_TOPDOWN=2;Phaser.Camera.FOLLOW_TOPDOWN_TIGHT=3;Phaser.Camera.prototype={game:null,world:null,id:0,view:null,deadzone:null,visible:true,target:null,follow:function(i,e){if(typeof e==="undefined"){e=Phaser.Camera.FOLLOW_LOCKON}this.target=i;var f;switch(e){case Phaser.Types.CAMERA_FOLLOW_PLATFORMER:var c=this.width/8;var d=this.height/3;this.deadzone=new Phaser.Rectangle((this.width-c)/2,(this.height-d)/2-d*0.25,c,d);break;case Phaser.Types.CAMERA_FOLLOW_TOPDOWN:f=Math.max(this.width,this.height)/4;this.deadzone=new Phaser.Rectangle((this.width-f)/2,(this.height-f)/2,f,f);break;case Phaser.Types.CAMERA_FOLLOW_TOPDOWN_TIGHT:f=Math.max(this.width,this.height)/8;this.deadzone=new Phaser.Rectangle((this.width-f)/2,(this.height-f)/2,f,f);break;case Phaser.Types.CAMERA_FOLLOW_LOCKON:default:this.deadzone=null;break}},focusOnXY:function(c,d){c+=(c>0)?1e-7:-1e-7;d+=(d>0)?1e-7:-1e-7;this.view.x=Math.round(c-this.view.halfWidth);this.view.y=Math.round(d-this.view.halfHeight)},update:function(){if(this.target!==null){if(this.deadzone==null){this.focusOnXY(this.target.x,this.target.y)}else{var e;var d=this.target.x+((this.target.x>0)?1e-7:-1e-7);var c=this.target.y+((this.target.y>0)?1e-7:-1e-7);e=d-this.deadzone.x;if(this.view.x>e){this.view.x=e}e=d+this.target.width-this.deadzone.x-this.deadzone.width;if(this.view.x<e){this.view.x=e}e=c-this.deadzone.y;if(this.view.y>e){this.view.y=e}e=c+this.target.height-this.deadzone.y-this.deadzone.height;if(this.view.y<e){this.view.y=e}}}if(this.view.x<this.world.bounds.left){this.view.x=this.world.bounds.left}if(this.view.x>this.world.bounds.right-this.width){this.view.x=(this.world.bounds.right-this.width)+1}if(this.view.y<this.world.bounds.top){this.view.y=this.world.bounds.top}if(this.view.y>this.world.bounds.bottom-this.height){this.view.y=(this.world.bounds.bottom-this.height)+1}this.view.floor()},setPosition:function(c,d){this.view.x=c;this.view.y=d},setSize:function(d,c){this.view.width=d;this.view.height=c}};Object.defineProperty(Phaser.Camera.prototype,"x",{get:function(){return this.view.x},set:function(c){this.view.x=c},enumerable:true,configurable:true});Object.defineProperty(Phaser.Camera.prototype,"y",{get:function(){return this.view.y},set:function(c){this.view.y=c},enumerable:true,configurable:true});Object.defineProperty(Phaser.Camera.prototype,"width",{get:function(){return this.view.width},set:function(c){this.view.width=c},enumerable:true,configurable:true});Object.defineProperty(Phaser.Camera.prototype,"height",{get:function(){return this.view.height},set:function(c){this.view.height=c},enumerable:true,configurable:true});Phaser.State=function(){};Phaser.State.prototype={link:function(c){this.game=c;this.cache=c.cache;this.load=c.load;this.math=c.math;this.time=c.time;this.tweens=c.tweens},preload:function(){},create:function(){},update:function(){},render:function(){},paused:function(){},destroy:function(){}};Phaser.StateManager=function(d,c){this.game=d;this.states={};if(c!==null){this._pendingState=c}};Phaser.StateManager.prototype={game:null,_pendingState:null,_created:false,states:{},current:"",onInitCallback:null,onPreloadCallback:null,onCreateCallback:null,onUpdateCallback:null,onRenderCallback:null,onPreRenderCallback:null,onLoadUpdateCallback:null,onLoadRenderCallback:null,onPausedCallback:null,onShutDownCallback:null,boot:function(){if(this._pendingState!==null){if(typeof this._pendingState==="string"){this.start(this._pendingState,false,false)}else{this.add("default",this._pendingState,true)}}},add:function(d,e,c){if(typeof c==="undefined"){c=false}var f;if(e instanceof Phaser.State){f=e;f.link(this.game)}else{if(typeof e==="object"){f=e}else{if(typeof e==="function"){f=new e(this.game)}}}this.states[d]=f;if(c){if(this.game.isBooted){this.start(d)}else{this._pendingState=d}}return f},remove:function(c){if(this.current==c){this.callbackContext=null;this.onInitCallback=null;this.onShutDownCallback=null;this.onPreloadCallback=null;this.onLoadRenderCallback=null;this.onLoadUpdateCallback=null;this.onCreateCallback=null;this.onUpdateCallback=null;this.onRenderCallback=null;this.onPausedCallback=null;this.onDestroyCallback=null}delete this.states[c]},start:function(d,c,e){if(typeof c==="undefined"){c=true}if(typeof e==="undefined"){e=false}if(this.game.isBooted==false){this._pendingState=d;return}if(this.checkState(d)==false){return}else{if(this.current){this.onShutDownCallback.call(this.callbackContext)}if(c){if(e==true){this.game.cache.destroy()}}this.setCurrentState(d)}if(this.onPreloadCallback){this.game.load.reset();this.onPreloadCallback.call(this.callbackContext);if(this.game.load.queueSize==0){this.game.loadComplete();if(this.onCreateCallback){this.onCreateCallback.call(this.callbackContext)}this._created=true}else{this.game.load.start()}}else{if(this.onCreateCallback){this.onCreateCallback.call(this.callbackContext)}this._created=true;this.game.loadComplete()}},dummy:function(){},checkState:function(c){if(this.states[c]){var d=false;if(this.states[c]["preload"]){d=true}if(d==false&&this.states[c]["loadRender"]){d=true}if(d==false&&this.states[c]["loadUpdate"]){d=true}if(d==false&&this.states[c]["create"]){d=true}if(d==false&&this.states[c]["update"]){d=true}if(d==false&&this.states[c]["preRender"]){d=true}if(d==false&&this.states[c]["render"]){d=true}if(d==false&&this.states[c]["paused"]){d=true}if(d==false){console.warn("Invalid Phaser State object given. Must contain at least a one of the required functions.");return false}return true}else{console.warn("Phaser.StateManager - No state found with the key: "+c);return false}},setCurrentState:function(c){this.callbackContext=this.states[c];this.onInitCallback=this.states[c]["init"]||this.dummy;this.onPreloadCallback=this.states[c]["preload"]||null;this.onLoadRenderCallback=this.states[c]["loadRender"]||null;this.onLoadUpdateCallback=this.states[c]["loadUpdate"]||null;this.onCreateCallback=this.states[c]["create"]||null;this.onUpdateCallback=this.states[c]["update"]||null;this.onPreRenderCallback=this.states[c]["preRender"]||null;this.onRenderCallback=this.states[c]["render"]||null;this.onPausedCallback=this.states[c]["paused"]||null;this.onShutDownCallback=this.states[c]["shutdown"]||this.dummy;this.current=c;this._created=false;this.onInitCallback.call(this.callbackContext)},loadComplete:function(){if(this._created==false&&this.onCreateCallback){this.onCreateCallback.call(this.callbackContext);this._created=true}},update:function(){if(this._created&&this.onUpdateCallback){this.onUpdateCallback.call(this.callbackContext)}else{if(this.onLoadUpdateCallback){this.onLoadUpdateCallback.call(this.callbackContext)}}},preRender:function(){if(this.onPreRenderCallback){this.onPreRenderCallback.call(this.callbackContext)}},render:function(){if(this._created&&this.onRenderCallback){this.onRenderCallback.call(this.callbackContext)}else{if(this.onLoadRenderCallback){this.onLoadRenderCallback.call(this.callbackContext)}}},destroy:function(){this.callbackContext=null;this.onInitCallback=null;this.onShutDownCallback=null;this.onPreloadCallback=null;this.onLoadRenderCallback=null;this.onLoadUpdateCallback=null;this.onCreateCallback=null;this.onUpdateCallback=null;this.onRenderCallback=null;this.onPausedCallback=null;this.onDestroyCallback=null;this.game=null;this.states={};this._pendingState=null}};Phaser.LinkedList=function(){};Phaser.LinkedList.prototype={next:null,prev:null,first:null,last:null,total:0,sprite:{name:"HD"},add:function(c){if(this.total==0&&this.first==null&&this.last==null){this.first=c;this.last=c;this.next=c;c.prev=this;this.total++;return}this.last.next=c;c.prev=this.last;this.last=c;this.total++;return c},remove:function(d){if(this.first==null&&this.last==null){return}this.total--;if(this.first==d&&this.last==d){this.first=null;this.last=null;this.next=null;d.next=null;d.prev=null;return}var c=d.prev;if(d.next){d.next.prev=d.prev}c.next=d.next},dump:function(){console.log("\nNode\t\t|\t\tNext\t\t|\t\tPrev\t\t|\t\tFirst\t\t|\t\tLast");console.log("\t\t\t|\t\t\t\t\t|\t\t\t\t\t|\t\t\t\t\t|");var h="-";var j="-";var d="-";var i="-";if(this.next){h=this.next.sprite.name}if(this.prev){j=this.prev.sprite.name}if(this.first){d=this.first.sprite.name}if(this.last){i=this.last.sprite.name}if(typeof h==="undefined"){h="-"}if(typeof j==="undefined"){j="-"}if(typeof d==="undefined"){d="-"}if(typeof i==="undefined"){i="-"}console.log("HD\t\t\t|\t\t"+h+"\t\t\t|\t\t"+j+"\t\t\t|\t\t"+d+"\t\t\t|\t\t"+i);var c=this;var f=c.last.next;c=c.first;do{var e=c.sprite.name||"*";var h="-";var j="-";var d="-";var i="-";if(c.next){h=c.next.sprite.name}if(c.prev){j=c.prev.sprite.name}if(c.first){d=c.first.sprite.name}if(c.last){i=c.last.sprite.name}if(typeof h==="undefined"){h="-"}if(typeof j==="undefined"){j="-"}if(typeof d==="undefined"){d="-"}if(typeof i==="undefined"){i="-"}console.log(e+"\t\t\t|\t\t"+h+"\t\t\t|\t\t"+j+"\t\t\t|\t\t"+d+"\t\t\t|\t\t"+i);c=c.next}while(c!=f)}};Phaser.Signal=function(){this._bindings=[];this._prevParams=null;var c=this;this.dispatch=function(){Phaser.Signal.prototype.dispatch.apply(c,arguments)}};Phaser.Signal.prototype={memorize:false,_shouldPropagate:true,active:true,validateListener:function(c,d){if(typeof c!=="function"){throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",d))}},_registerListener:function(h,e,f,d){var c=this._indexOfListener(h,f),i;if(c!==-1){i=this._bindings[c];if(i.isOnce()!==e){throw new Error("You cannot add"+(e?"":"Once")+"() then add"+(!e?"":"Once")+"() the same listener without removing the relationship first.")}}else{i=new Phaser.SignalBinding(this,h,e,f,d);this._addBinding(i)}if(this.memorize&&this._prevParams){i.execute(this._prevParams)}return i},_addBinding:function(c){var d=this._bindings.length;do{--d}while(this._bindings[d]&&c._priority<=this._bindings[d]._priority);this._bindings.splice(d+1,0,c)},_indexOfListener:function(d,c){var f=this._bindings.length,e;while(f--){e=this._bindings[f];if(e._listener===d&&e.context===c){return f}}return -1},has:function(d,c){return this._indexOfListener(d,c)!==-1},add:function(e,d,c){this.validateListener(e,"add");return this._registerListener(e,false,d,c)},addOnce:function(e,d,c){this.validateListener(e,"addOnce");return this._registerListener(e,true,d,c)},remove:function(e,d){this.validateListener(e,"remove");var c=this._indexOfListener(e,d);if(c!==-1){this._bindings[c]._destroy();this._bindings.splice(c,1)}return e},removeAll:function(){var c=this._bindings.length;while(c--){this._bindings[c]._destroy()}this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=false},dispatch:function(d){if(!this.active){return}var c=Array.prototype.slice.call(arguments),f=this._bindings.length,e;if(this.memorize){this._prevParams=c}if(!f){return}e=this._bindings.slice();this._shouldPropagate=true;do{f--}while(e[f]&&this._shouldPropagate&&e[f].execute(c)!==false)},forget:function(){this._prevParams=null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Phaser.Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};Phaser.SignalBinding=function(h,f,d,e,c){this._listener=f;this._isOnce=d;this.context=e;this._signal=h;this._priority=c||0};Phaser.SignalBinding.prototype={active:true,params:null,execute:function(c){var e,d;if(this.active&&!!this._listener){d=this.params?this.params.concat(c):c;e=this._listener.apply(this.context,d);if(this._isOnce){this.detach()}}return e},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return(!!this._signal&&!!this._listener)},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal;delete this._listener;delete this.context},toString:function(){return"[Phaser.SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}};Phaser.Plugin=function(c,d){this.game=c;this.parent=d;this.active=false;this.visible=false;this.hasPreUpdate=false;this.hasUpdate=false;this.hasPostUpdate=false;this.hasPreRender=false;this.hasRender=false;this.hasPostRender=false};Phaser.Plugin.prototype={preUpdate:function(){},update:function(){},postUpdate:function(){},preRender:function(){},render:function(){},postRender:function(){},destroy:function(){this.game=null;this.parent=null;this.active=false;this.visible=false}};Phaser.PluginManager=function(c,d){this.game=c;this._parent=d;this.plugins=[];this._pluginsLength=0};Phaser.PluginManager.prototype={add:function(d){var c=false;if(typeof d==="function"){d=new d(this.game,this._parent)}else{d.game=this.game;d.parent=this._parent}if(typeof d.preUpdate==="function"){d.hasPreUpdate=true;c=true}if(typeof d.update==="function"){d.hasUpdate=true;c=true}if(typeof d.postUpdate==="function"){d.hasPostUpdate=true;c=true}if(typeof d.preRender==="function"){d.hasPreRender=true;c=true}if(typeof d.render==="function"){d.hasRender=true;c=true}if(typeof d.postRender==="function"){d.hasPostRender=true;c=true}if(c){if(d.hasPreUpdate||d.hasUpdate||d.hasPostUpdate){d.active=true}if(d.hasPreRender||d.hasRender||d.hasPostRender){d.visible=true}this._pluginsLength=this.plugins.push(d);return d}else{return null}},remove:function(c){this._pluginsLength--},preUpdate:function(){if(this._pluginsLength==0){return}for(this._p=0;this._p<this._pluginsLength;this._p++){if(this.plugins[this._p].active&&this.plugins[this._p].hasPreUpdate){this.plugins[this._p].preUpdate()}}},update:function(){if(this._pluginsLength==0){return}for(this._p=0;this._p<this._pluginsLength;this._p++){if(this.plugins[this._p].active&&this.plugins[this._p].hasUpdate){this.plugins[this._p].update()}}},postUpdate:function(){if(this._pluginsLength==0){return}for(this._p=0;this._p<this._pluginsLength;this._p++){if(this.plugins[this._p].active&&this.plugins[this._p].hasPostUpdate){this.plugins[this._p].postUpdate()}}},preRender:function(){if(this._pluginsLength==0){return}for(this._p=0;this._p<this._pluginsLength;this._p++){if(this.plugins[this._p].visible&&this.plugins[this._p].hasPreRender){this.plugins[this._p].preRender()}}},render:function(){if(this._pluginsLength==0){return}for(this._p=0;this._p<this._pluginsLength;this._p++){if(this.plugins[this._p].visible&&this.plugins[this._p].hasRender){this.plugins[this._p].render()}}},postRender:function(){if(this._pluginsLength==0){return}for(this._p=0;this._p<this._pluginsLength;this._p++){if(this.plugins[this._p].visible&&this.plugins[this._p].hasPostRender){this.plugins[this._p].postRender()}}},destroy:function(){this.plugins.length=0;this._pluginsLength=0;this.game=null;this._parent=null}};Phaser.Stage=function(c){this.game=c;this.canvas=c.renderer.view;this.offset=new Phaser.Point;Phaser.Canvas.getOffset(this.canvas,this.offset);this.bounds=new Phaser.Rectangle(this.offset.x,this.offset.y,this.game.width,this.game.height);var d=this;this._onChange=function(e){return d.visibilityChange(e)};document.addEventListener("visibilitychange",this._onChange,false);document.addEventListener("webkitvisibilitychange",this._onChange,false);document.addEventListener("pagehide",this._onChange,false);document.addEventListener("pageshow",this._onChange,false);window.onblur=this._onChange;window.onfocus=this._onChange};Phaser.Stage.prototype={_onChange:null,canvas:null,bounds:null,offset:null,visibilityChange:function(c){if(this.disableVisibilityChange){return}if(c.type=="pagehide"||c.type=="blur"||document.hidden==true||document.webkitHidden==true){this.game.paused=true}else{this.game.paused=false}}};Phaser.Group=function(c,e,d){e=e||null;this.game=c;this.name=d||"group";this._container=new PIXI.DisplayObjectContainer();if(e){e.addChild(this._container)}else{this.game.world.add(this._container)}this.exists=true;this._sortIndex="y"};Phaser.Group.prototype={add:function(c){if(c.group!==this){c.group=this;this._container.addChild(c)}return c},addAt:function(d,c){if(d.group!==this){d.group=this;this._container.addChildAt(d,c)}return d},getAt:function(c){return this._container.getChildAt(c)},create:function(c,h,d,e){var f=new Phaser.Sprite(this.game,c,h,d,e);f.group=this;this._container.addChild(f);return f},swap:function(k,i){if(k===i||!k.parent||!i.parent){console.warn("You cannot swap a child with itself or swap un-parented children");return false}var e=k._iPrev;var d=k._iNext;var j=i._iPrev;var h=i._iNext;var c=this._container.last._iNext;var f=this._container.first;do{if(f!==k&&f!==i){if(f.first===k){f.first=i}else{if(f.first===i){f.first=k}}if(f.last===k){f.last=i}else{if(f.last===i){f.last=k}}}f=f._iNext}while(f!=c);if(k._iNext==i){k._iNext=h;k._iPrev=i;i._iNext=k;i._iPrev=e;if(e){e._iNext=i}if(h){h._iPrev=k}return true}else{if(i._iNext==k){k._iNext=i;k._iPrev=j;i._iNext=d;i._iPrev=k;if(j){j._iNext=k}if(d){h._iPrev=i}return true}else{k._iNext=h;k._iPrev=j;i._iNext=d;i._iPrev=e;if(e){e._iNext=i}if(d){d._iPrev=i}if(j){j._iNext=k}if(h){h._iPrev=k}return true}}return false},bringToTop:function(c){if(c!==this._container.last){this.swap(c,this._container.last)}return c},getIndex:function(c){return this._container.children.indexOf(c)},replace:function(e,c){if(!this._container.first._iNext){return}var d=this.getIndex(e);if(d!=-1){if(c.parent!=undefined){c.parent.removeChild(c)}this._container.removeChild(e);this._container.addChildAt(c,d)}},sort:function(d,c){},sortHandler:function(d,c){},setProperty:function(f,d,e,c){c=c||0;if(d.length==1){if(c==0){f[d[0]]=e}else{if(c==1){f[d[0]]+=e}else{if(c==2){f[d[0]]-=e}else{if(c==3){f[d[0]]*=e}else{if(c==4){f[d[0]]/=e}}}}}}else{if(d.length==2){if(c==0){f[d[0]][d[1]]=e}else{if(c==1){f[d[0]][d[1]]+=e}else{if(c==2){f[d[0]][d[1]]-=e}else{if(c==3){f[d[0]][d[1]]*=e}else{if(c==4){f[d[0]][d[1]]/=e}}}}}}else{if(d.length==3){if(c==0){f[d[0]][d[1]][d[2]]=e}else{if(c==1){f[d[0]][d[1]][d[2]]+=e}else{if(c==2){f[d[0]][d[1]][d[2]]-=e}else{if(c==3){f[d[0]][d[1]][d[2]]*=e}else{if(c==4){f[d[0]][d[1]][d[2]]/=e}}}}}}else{if(d.length==4){if(c==0){f[d[0]][d[1]][d[2]][d[3]]=e}else{if(c==1){f[d[0]][d[1]][d[2]][d[3]]+=e}else{if(c==2){f[d[0]][d[1]][d[2]][d[3]]-=e}else{if(c==3){f[d[0]][d[1]][d[2]][d[3]]*=e}else{if(c==4){f[d[0]][d[1]][d[2]][d[3]]/=e}}}}}}else{}}}}},setAll:function(f,h,d,i,c){f=f.split(".");d=d||false;i=i||false;c=c||0;if(this._container.first._iNext){var e=this._container.first._iNext;do{if((d==false||(d&&e.alive))&&(i==false||(i&&e.visible))){this.setProperty(e,f,h,c)}e=e._iNext}while(e!=this._container.last._iNext)}},addAll:function(d,e,c,f){this.setAll(d,e,c,f,1)},subAll:function(d,e,c,f){this.setAll(d,e,c,f,2)},multiplyAll:function(d,e,c,f){this.setAll(d,e,c,f,3)},divideAll:function(d,e,c,f){this.setAll(d,e,c,f,4)},callAll:function(f,c){var d=Array.prototype.splice.call(arguments,2);if(this._container.first._iNext){var e=this._container.first._iNext;do{if(e.exists&&e[f]){e[f].apply(e,d)}e=e._iNext}while(e!=this._container.last._iNext)}},forEach:function(f,c,e){e=e||false;if(this._container.first._iNext){var d=this._container.first._iNext;do{if(e==false||(e&&d.exists)){f.call(c,d)}d=d._iNext}while(d!=this._container.last._iNext)}},forEachAlive:function(){if(this._container.first._iNext){var c=this._container.first._iNext;do{if(c.alive){callback.call(callbackContext,c)}c=c._iNext}while(c!=this._container.last._iNext)}},forEachDead:function(){if(this._container.first._iNext){var c=this._container.first._iNext;do{if(c.alive==false){callback.call(callbackContext,c)}c=c._iNext}while(c!=this._container.last._iNext)}},getFirstExists:function(d){d=d||true;if(this._container.first._iNext){var c=this._container.first._iNext;do{if(c.exists==d){return c}c=c._iNext}while(c!=this._container.last._iNext)}return null},getFirstAlive:function(){if(this._container.first._iNext){var c=this._container.first._iNext;do{if(c.alive){return c}c=c._iNext}while(c!=this._container.last._iNext)}return null},getFirstDead:function(){if(this._container.first._iNext){var c=this._container.first._iNext;do{if(!c.alive){return c}c=c._iNext}while(c!=this._container.last._iNext)}return null},countLiving:function(){var d=-1;if(this._container.first._iNext){var c=this._container.first._iNext;do{if(c.alive){d++}c=c._iNext}while(c!=this._container.last._iNext)}return d},countDead:function(){var d=-1;if(this._container.first._iNext){var c=this._container.first._iNext;do{if(!c.alive){d++}c=c._iNext}while(c!=this._container.last._iNext)}return d},getRandom:function(d,c){d=d||0;c=c||this._container.children.length;return this.game.math.getRandom(this._container.children,d,c)},remove:function(c){this._container.removeChild(c)},removeAll:function(){do{this._container.removeChild(this._container.children[0])}while(this._container.children.length>0)},removeBetween:function(e,d){if(e>d||e<0||d>this._container.children.length){return false}for(var c=e;c<d;c++){var f=this._container.children[c];this._container.removeChild(f)}},destroy:function(){this.removeAll();this._container.parent.removeChild(this._container);this._container=null;this.game=null;this.exists=false},dump:function(){console.log("\nNode\t\t|\t\tNext\t\t|\t\tPrev\t\t|\t\tFirst\t\t|\t\tLast");console.log("\t\t\t|\t\t\t\t\t|\t\t\t\t\t|\t\t\t\t\t|");var j=this._container;var e=j.last._iNext;j=j.first;do{var d=j.name||"*";var f="-";var i="-";var c="-";var h="-";if(j._iNext){f=j._iNext.name}if(j._iPrev){i=j._iPrev.name}if(j.first){c=j.first.name}if(j.last){h=j.last.name}if(typeof f==="undefined"){f="-"}if(typeof i==="undefined"){i="-"}if(typeof c==="undefined"){c="-"}if(typeof h==="undefined"){h="-"}console.log(d+"\t\t\t|\t\t"+f+"\t\t\t|\t\t"+i+"\t\t\t|\t\t"+c+"\t\t\t|\t\t"+h);j=j._iNext}while(j!=e)}};Object.defineProperty(Phaser.Group.prototype,"x",{get:function(){return this._container.position.x},set:function(c){this._container.position.x=c},enumerable:true,configurable:true});Object.defineProperty(Phaser.Group.prototype,"y",{get:function(){return this._container.position.y},set:function(c){this._container.position.y=c},enumerable:true,configurable:true});Object.defineProperty(Phaser.Group.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this._container.rotation)},set:function(c){this._container.rotation=Phaser.Math.degToRad(c)},enumerable:true,configurable:true});Object.defineProperty(Phaser.Group.prototype,"rotation",{get:function(){return this._container.rotation},set:function(c){this._container.rotation=c},enumerable:true,configurable:true});Object.defineProperty(Phaser.Group.prototype,"visible",{get:function(){return this._container.visible},set:function(c){this._container.visible=c},enumerable:true,configurable:true});Phaser.World=function(c){this.game=c;this._stage=new PIXI.Stage(0);this._stage.name="_stage_root";this.bounds=new Phaser.Rectangle(0,0,c.width,c.height)};Phaser.World.prototype={_stage:null,_stage:null,_length:0,bounds:null,camera:null,currentRenderOrderID:0,boot:function(){this.camera=new Phaser.Camera(this.game,0,0,0,this.game.width,this.game.height);this.game.camera=this.camera},add:function(c){this._stage.addChild(c);return c},addAt:function(c,d){this._stage.addChildAt(c,d);return c},getAt:function(c){return this._stage.getChildAt(c)},remove:function(c){this._stage.removeChild(c);return c},update:function(){this.camera.update();this.currentRenderOrderID=0;if(this._stage.first._iNext){var c=this._stage.first._iNext;do{if(c.update){c.update()}c=c._iNext}while(c!=this._stage.last._iNext)}},setSize:function(d,c){this.bounds.width=d;this.bounds.height=c},bringToTop:function(c){if(c!==this._stage.last){this.swapChildren(c,this._stage.last)}return c},swapChildren:function(k,i){if(k===i||!k.parent||!i.parent){console.warn("You cannot swap a child with itself or swap un-parented children");return false}var e=k._iPrev;var d=k._iNext;var j=i._iPrev;var h=i._iNext;var c=this._stage.last._iNext;var f=this._stage.first;do{if(f!==k&&f!==i){if(f.first===k){f.first=i}else{if(f.first===i){f.first=k}}if(f.last===k){f.last=i}else{if(f.last===i){f.last=k}}}f=f._iNext}while(f!=c);if(k._iNext==i){k._iNext=h;k._iPrev=i;i._iNext=k;i._iPrev=e;if(e){e._iNext=i}if(h){h._iPrev=k}return true}else{if(i._iNext==k){k._iNext=i;k._iPrev=j;i._iNext=d;i._iPrev=k;if(j){j._iNext=k}if(d){h._iPrev=i}return true}else{k._iNext=h;k._iPrev=j;i._iNext=d;i._iPrev=e;if(e){e._iNext=i}if(d){d._iPrev=i}if(j){j._iNext=k}if(h){h._iPrev=k}return true}}return false}};Object.defineProperty(Phaser.World.prototype,"width",{get:function(){return this.bounds.width},set:function(c){this.bounds.width=c},enumerable:true,configurable:true});Object.defineProperty(Phaser.World.prototype,"height",{get:function(){return this.bounds.height},set:function(c){this.bounds.height=c},enumerable:true,configurable:true});Object.defineProperty(Phaser.World.prototype,"centerX",{get:function(){return this.bounds.halfWidth},enumerable:true,configurable:true});Object.defineProperty(Phaser.World.prototype,"centerY",{get:function(){return this.bounds.halfHeight},enumerable:true,configurable:true});Object.defineProperty(Phaser.World.prototype,"randomX",{get:function(){return Math.round(Math.random()*this.bounds.width)},enumerable:true,configurable:true});Object.defineProperty(Phaser.World.prototype,"randomY",{get:function(){return Math.round(Math.random()*this.bounds.height)},enumerable:true,configurable:true});Phaser.Game=function(f,c,i,e,h,j,d){f=f||800;c=c||600;i=i||Phaser.AUTO;e=e||"";h=h||null;j=j||false;d=d||true;this.id=Phaser.GAMES.push(this)-1;this.parent=e;this.width=f;this.height=c;this.transparent=j;this.antialias=d;this.renderType=i;this.state=new Phaser.StateManager(this,h);var k=this;this._onBoot=function(){return k.boot()};if(document.readyState==="complete"||document.readyState==="interactive"){window.setTimeout(this._onBoot,0)}else{document.addEventListener("DOMContentLoaded",this._onBoot,false);window.addEventListener("load",this._onBoot,false)}return this};Phaser.Game.prototype={_tempState:null,_onBoot:null,id:0,width:0,height:0,transparent:false,antialias:true,parent:"",renderType:0,renderer:null,_loadComplete:false,paused:false,isBooted:false,isRunning:false,raf:null,state:null,add:null,cache:null,input:null,load:null,math:null,net:null,sound:null,stage:null,time:null,tweens:null,world:null,physics:null,rnd:null,device:null,camera:null,canvas:null,context:null,debug:null,boot:function(){if(this.isBooted){return}if(!document.body){window.setTimeout(this._onBoot,20)}else{document.removeEventListener("DOMContentLoaded",this._onBoot);window.removeEventListener("load",this._onBoot);this.onPause=new Phaser.Signal;this.onResume=new Phaser.Signal;this.isBooted=true;this.device=new Phaser.Device();this.math=Phaser.Math;this.rnd=new Phaser.RandomDataGenerator([(Date.now()*Math.random()).toString()]);this.setUpRenderer();this.world=new Phaser.World(this);this.stage=new Phaser.Stage(this);this.add=new Phaser.GameObjectFactory(this);this.cache=new Phaser.Cache(this);this.load=new Phaser.Loader(this);this.time=new Phaser.Time(this);this.tweens=new Phaser.TweenManager(this);this.input=new Phaser.Input(this);this.sound=new Phaser.SoundManager(this);this.physics=new Phaser.Physics.Arcade(this);this.plugins=new Phaser.PluginManager(this,this);this.net=new Phaser.Net(this);this.debug=new Phaser.Utils.Debug(this);this.load.onLoadComplete.add(this.loadComplete,this);this.world.boot();this.state.boot();this.input.boot();if(this.renderType==Phaser.CANVAS){console.log("%cPhaser "+Phaser.VERSION+" initialized. Rendering to Canvas","color: #ffff33; background: #000000")}else{console.log("%cPhaser "+Phaser.VERSION+" initialized. Rendering to WebGL","color: #ffff33; background: #000000")}this.isRunning=true;this._loadComplete=false;this.raf=new Phaser.RequestAnimationFrame(this);this.raf.start()}},setUpRenderer:function(){if(this.renderType==Phaser.CANVAS||(this.renderType==Phaser.AUTO&&this.device.webGL==false)){if(this.device.canvas){this.renderType=Phaser.CANVAS;this.renderer=new PIXI.CanvasRenderer(this.width,this.height,null,this.transparent);Phaser.Canvas.setSmoothingEnabled(this.renderer.context,this.antialias);this.canvas=this.renderer.view;this.context=this.renderer.context}else{throw new Error("Phaser.Game - cannot create Canvas or WebGL context, aborting.")}}else{this.renderer=new PIXI.WebGLRenderer(this.width,this.height,null,this.transparent,this.antialias);this.canvas=this.renderer.view;this.context=null}Phaser.Canvas.addToDOM(this.renderer.view,this.parent,true);Phaser.Canvas.setTouchAction(this.renderer.view)},loadComplete:function(){this._loadComplete=true;this.state.loadComplete()},update:function(c){this.time.update(c);if(!this.paused){this.plugins.preUpdate();this.physics.preUpdate();this.input.update();this.tweens.update();this.sound.update();this.world.update();this.state.update();this.plugins.update();this.renderer.render(this.world._stage);this.state.render();this.plugins.postRender()}},destroy:function(){this.state.destroy();this.state=null;this.cache=null;this.input=null;this.load=null;this.sound=null;this.stage=null;this.time=null;this.world=null;this.isBooted=false}};Phaser.Input=function(c){this.game=c;this.inputObjects=[];this.totalTrackedObjects=0};Phaser.Input.MOUSE_OVERRIDES_TOUCH=0;Phaser.Input.TOUCH_OVERRIDES_MOUSE=1;Phaser.Input.MOUSE_TOUCH_COMBINE=2;Phaser.Input.prototype={game:null,pollRate:0,_pollCounter:0,_oldPosition:null,_x:0,_y:0,disabled:false,multiInputOverride:Phaser.Input.MOUSE_TOUCH_COMBINE,position:null,speed:null,circle:null,scale:null,maxPointers:10,currentPointers:0,tapRate:200,doubleTapRate:300,holdRate:2000,justPressedRate:200,justReleasedRate:200,recordPointerHistory:false,recordRate:100,recordLimit:100,pointer1:null,pointer2:null,pointer3:null,pointer4:null,pointer5:null,pointer6:null,pointer7:null,pointer8:null,pointer9:null,pointer10:null,activePointer:null,mousePointer:null,mouse:null,keyboard:null,touch:null,mspointer:null,onDown:null,onUp:null,onTap:null,onHold:null,interactiveItems:new Phaser.LinkedList(),boot:function(){this.mousePointer=new Phaser.Pointer(this.game,0);this.pointer1=new Phaser.Pointer(this.game,1);this.pointer2=new Phaser.Pointer(this.game,2);this.mouse=new Phaser.Mouse(this.game);this.keyboard=new Phaser.Keyboard(this.game);this.touch=new Phaser.Touch(this.game);this.mspointer=new Phaser.MSPointer(this.game);this.onDown=new Phaser.Signal();this.onUp=new Phaser.Signal();this.onTap=new Phaser.Signal();this.onHold=new Phaser.Signal();this.scale=new Phaser.Point(1,1);this.speed=new Phaser.Point();this.position=new Phaser.Point();this._oldPosition=new Phaser.Point();this.circle=new Phaser.Circle(0,0,44);this.activePointer=this.mousePointer;this.currentPointers=0;this.mouse.start();this.keyboard.start();this.touch.start();this.mspointer.start();this.mousePointer.active=true},addPointer:function(){var d=0;for(var c=10;c>0;c--){if(this["pointer"+c]===null){d=c}}if(d==0){console.warn("You can only have 10 Pointer objects");return null}else{this["pointer"+d]=new Phaser.Pointer(this.game,d);return this["pointer"+d]}},update:function(){if(this.pollRate>0&&this._pollCounter<this.pollRate){this._pollCounter++;return}this.speed.x=this.position.x-this._oldPosition.x;this.speed.y=this.position.y-this._oldPosition.y;this._oldPosition.copyFrom(this.position);this.mousePointer.update();this.pointer1.update();this.pointer2.update();if(this.pointer3){this.pointer3.update()}if(this.pointer4){this.pointer4.update()}if(this.pointer5){this.pointer5.update()}if(this.pointer6){this.pointer6.update()}if(this.pointer7){this.pointer7.update()}if(this.pointer8){this.pointer8.update()}if(this.pointer9){this.pointer9.update()}if(this.pointer10){this.pointer10.update()}this._pollCounter=0},reset:function(d){d=d||false;this.keyboard.reset();this.mousePointer.reset();for(var c=1;c<=10;c++){if(this["pointer"+c]){this["pointer"+c].reset()}}this.currentPointers=0;if(d==true){this.onDown.dispose();this.onUp.dispose();this.onTap.dispose();this.onHold.dispose();this.onDown=new Phaser.Signal();this.onUp=new Phaser.Signal();this.onTap=new Phaser.Signal();this.onHold=new Phaser.Signal();for(var c=0;c<this.totalTrackedObjects;c++){if(this.inputObjects[c]&&this.inputObjects[c].input){this.inputObjects[c].input.reset()}}this.inputObjects.length=0;this.totalTrackedObjects=0}this._pollCounter=0},resetSpeed:function(c,d){this._oldPosition.setTo(c,d);this.speed.setTo(0,0)},startPointer:function(d){if(this.maxPointers<10&&this.totalActivePointers==this.maxPointers){return null}if(this.pointer1.active==false){return this.pointer1.start(d)}else{if(this.pointer2.active==false){return this.pointer2.start(d)}else{for(var c=3;c<=10;c++){if(this["pointer"+c]&&this["pointer"+c].active==false){return this["pointer"+c].start(d)}}}}return null},updatePointer:function(d){if(this.pointer1.active&&this.pointer1.identifier==d.identifier){return this.pointer1.move(d)}else{if(this.pointer2.active&&this.pointer2.identifier==d.identifier){return this.pointer2.move(d)}else{for(var c=3;c<=10;c++){if(this["pointer"+c]&&this["pointer"+c].active&&this["pointer"+c].identifier==d.identifier){return this["pointer"+c].move(d)}}}}return null},stopPointer:function(d){if(this.pointer1.active&&this.pointer1.identifier==d.identifier){return this.pointer1.stop(d)}else{if(this.pointer2.active&&this.pointer2.identifier==d.identifier){return this.pointer2.stop(d)}else{for(var c=3;c<=10;c++){if(this["pointer"+c]&&this["pointer"+c].active&&this["pointer"+c].identifier==d.identifier){return this["pointer"+c].stop(d)}}}}return null},getPointer:function(d){d=d||false;if(this.pointer1.active==d){return this.pointer1}else{if(this.pointer2.active==d){return this.pointer2}else{for(var c=3;c<=10;c++){if(this["pointer"+c]&&this["pointer"+c].active==d){return this["pointer"+c]}}}}return null},getPointerFromIdentifier:function(c){if(this.pointer1.identifier==c){return this.pointer1}else{if(this.pointer2.identifier==c){return this.pointer2}else{for(var d=3;d<=10;d++){if(this["pointer"+d]&&this["pointer"+d].identifier==c){return this["pointer"+d]}}}}return null},getDistance:function(d,c){},getAngle:function(d,c){}};Object.defineProperty(Phaser.Input.prototype,"x",{get:function(){return this._x},set:function(c){this._x=Math.floor(c)},enumerable:true,configurable:true});Object.defineProperty(Phaser.Input.prototype,"y",{get:function(){return this._y},set:function(c){this._y=Math.floor(c)},enumerable:true,configurable:true});Object.defineProperty(Phaser.Input.prototype,"pollLocked",{get:function(){return(this.pollRate>0&&this._pollCounter<this.pollRate)},enumerable:true,configurable:true});Object.defineProperty(Phaser.Input.prototype,"totalInactivePointers",{get:function(){return 10-this.currentPointers},enumerable:true,configurable:true});Object.defineProperty(Phaser.Input.prototype,"totalActivePointers",{get:function(){this.currentPointers=0;for(var c=1;c<=10;c++){if(this["pointer"+c]&&this["pointer"+c].active){this.currentPointers++}}return this.currentPointers},enumerable:true,configurable:true});Object.defineProperty(Phaser.Input.prototype,"worldX",{get:function(){return this.game.camera.view.x+this.x},enumerable:true,configurable:true});Object.defineProperty(Phaser.Input.prototype,"worldY",{get:function(){return this.game.camera.view.y+this.y},enumerable:true,configurable:true});Phaser.Keyboard=function(c){this.game=c;this._keys={};this._capture={}};Phaser.Keyboard.prototype={game:null,disabled:false,_onKeyDown:null,_onKeyUp:null,start:function(){var c=this;this._onKeyDown=function(d){return c.onKeyDown(d)};this._onKeyUp=function(d){return c.onKeyUp(d)};document.body.addEventListener("keydown",this._onKeyDown,false);document.body.addEventListener("keyup",this._onKeyUp,false)},stop:function(){document.body.removeEventListener("keydown",this._onKeyDown);document.body.removeEventListener("keyup",this._onKeyUp)},addKeyCapture:function(c){if(typeof c==="object"){for(var d in c){this._capture[c[d]]=true}}else{this._capture[c]=true}},removeKeyCapture:function(c){delete this._capture[c]},clearCaptures:function(){this._capture={}},onKeyDown:function(c){if(this.game.input.disabled||this.disabled){return}if(this._capture[c.keyCode]){c.preventDefault()}if(!this._keys[c.keyCode]){this._keys[c.keyCode]={isDown:true,timeDown:this.game.time.now,timeUp:0}}else{this._keys[c.keyCode].isDown=true;this._keys[c.keyCode].timeDown=this.game.time.now}},onKeyUp:function(c){if(this.game.input.disabled||this.disabled){return}if(this._capture[c.keyCode]){c.preventDefault()}if(!this._keys[c.keyCode]){this._keys[c.keyCode]={isDown:false,timeDown:0,timeUp:this.game.time.now}}else{this._keys[c.keyCode].isDown=false;this._keys[c.keyCode].timeUp=this.game.time.now}},reset:function(){for(var c in this._keys){this._keys[c].isDown=false}},justPressed:function(c,d){if(typeof d==="undefined"){d=250}if(this._keys[c]&&this._keys[c].isDown===true&&(this.game.time.now-this._keys[c].timeDown<d)){return true}return false},justReleased:function(c,d){if(typeof d==="undefined"){d=250}if(this._keys[c]&&this._keys[c].isDown===false&&(this.game.time.now-this._keys[c].timeUp<d)){return true}return false},isDown:function(c){if(this._keys[c]){return this._keys[c].isDown}return false}};Phaser.Keyboard.A="A".charCodeAt(0);Phaser.Keyboard.B="B".charCodeAt(0);Phaser.Keyboard.C="C".charCodeAt(0);Phaser.Keyboard.D="D".charCodeAt(0);Phaser.Keyboard.E="E".charCodeAt(0);Phaser.Keyboard.F="F".charCodeAt(0);Phaser.Keyboard.G="G".charCodeAt(0);Phaser.Keyboard.H="H".charCodeAt(0);Phaser.Keyboard.I="I".charCodeAt(0);Phaser.Keyboard.J="J".charCodeAt(0);Phaser.Keyboard.K="K".charCodeAt(0);Phaser.Keyboard.L="L".charCodeAt(0);Phaser.Keyboard.M="M".charCodeAt(0);Phaser.Keyboard.N="N".charCodeAt(0);Phaser.Keyboard.O="O".charCodeAt(0);Phaser.Keyboard.P="P".charCodeAt(0);Phaser.Keyboard.Q="Q".charCodeAt(0);Phaser.Keyboard.R="R".charCodeAt(0);Phaser.Keyboard.S="S".charCodeAt(0);Phaser.Keyboard.T="T".charCodeAt(0);Phaser.Keyboard.U="U".charCodeAt(0);Phaser.Keyboard.V="V".charCodeAt(0);Phaser.Keyboard.W="W".charCodeAt(0);Phaser.Keyboard.X="X".charCodeAt(0);Phaser.Keyboard.Y="Y".charCodeAt(0);Phaser.Keyboard.Z="Z".charCodeAt(0);Phaser.Keyboard.ZERO="0".charCodeAt(0);Phaser.Keyboard.ONE="1".charCodeAt(0);Phaser.Keyboard.TWO="2".charCodeAt(0);Phaser.Keyboard.THREE="3".charCodeAt(0);Phaser.Keyboard.FOUR="4".charCodeAt(0);Phaser.Keyboard.FIVE="5".charCodeAt(0);Phaser.Keyboard.SIX="6".charCodeAt(0);Phaser.Keyboard.SEVEN="7".charCodeAt(0);Phaser.Keyboard.EIGHT="8".charCodeAt(0);Phaser.Keyboard.NINE="9".charCodeAt(0);Phaser.Keyboard.NUMPAD_0=96;Phaser.Keyboard.NUMPAD_1=97;Phaser.Keyboard.NUMPAD_2=98;Phaser.Keyboard.NUMPAD_3=99;Phaser.Keyboard.NUMPAD_4=100;Phaser.Keyboard.NUMPAD_5=101;Phaser.Keyboard.NUMPAD_6=102;Phaser.Keyboard.NUMPAD_7=103;Phaser.Keyboard.NUMPAD_8=104;Phaser.Keyboard.NUMPAD_9=105;Phaser.Keyboard.NUMPAD_MULTIPLY=106;Phaser.Keyboard.NUMPAD_ADD=107;Phaser.Keyboard.NUMPAD_ENTER=108;Phaser.Keyboard.NUMPAD_SUBTRACT=109;Phaser.Keyboard.NUMPAD_DECIMAL=110;Phaser.Keyboard.NUMPAD_DIVIDE=111;Phaser.Keyboard.F1=112;Phaser.Keyboard.F2=113;Phaser.Keyboard.F3=114;Phaser.Keyboard.F4=115;Phaser.Keyboard.F5=116;Phaser.Keyboard.F6=117;Phaser.Keyboard.F7=118;Phaser.Keyboard.F8=119;Phaser.Keyboard.F9=120;Phaser.Keyboard.F10=121;Phaser.Keyboard.F11=122;Phaser.Keyboard.F12=123;Phaser.Keyboard.F13=124;Phaser.Keyboard.F14=125;Phaser.Keyboard.F15=126;Phaser.Keyboard.COLON=186;Phaser.Keyboard.EQUALS=187;Phaser.Keyboard.UNDERSCORE=189;Phaser.Keyboard.QUESTION_MARK=191;Phaser.Keyboard.TILDE=192;Phaser.Keyboard.OPEN_BRACKET=219;Phaser.Keyboard.BACKWARD_SLASH=220;Phaser.Keyboard.CLOSED_BRACKET=221;Phaser.Keyboard.QUOTES=222;Phaser.Keyboard.BACKSPACE=8;Phaser.Keyboard.TAB=9;Phaser.Keyboard.CLEAR=12;Phaser.Keyboard.ENTER=13;Phaser.Keyboard.SHIFT=16;Phaser.Keyboard.CONTROL=17;Phaser.Keyboard.ALT=18;Phaser.Keyboard.CAPS_LOCK=20;Phaser.Keyboard.ESC=27;Phaser.Keyboard.SPACEBAR=32;Phaser.Keyboard.PAGE_UP=33;Phaser.Keyboard.PAGE_DOWN=34;Phaser.Keyboard.END=35;Phaser.Keyboard.HOME=36;Phaser.Keyboard.LEFT=37;Phaser.Keyboard.UP=38;Phaser.Keyboard.RIGHT=39;Phaser.Keyboard.DOWN=40;Phaser.Keyboard.INSERT=45;Phaser.Keyboard.DELETE=46;Phaser.Keyboard.HELP=47;Phaser.Keyboard.NUM_LOCK=144;Phaser.Mouse=function(c){this.game=c;this.callbackContext=this.game;this.mouseDownCallback=null;this.mouseMoveCallback=null;this.mouseUpCallback=null};Phaser.Mouse.LEFT_BUTTON=0;Phaser.Mouse.MIDDLE_BUTTON=1;Phaser.Mouse.RIGHT_BUTTON=2;Phaser.Mouse.prototype={game:null,disabled:false,start:function(){var c=this;if(this.game.device.android&&this.game.device.chrome==false){return}this._onMouseDown=function(d){return c.onMouseDown(d)};this._onMouseMove=function(d){return c.onMouseMove(d)};this._onMouseUp=function(d){return c.onMouseUp(d)};this.game.stage.canvas.addEventListener("mousedown",this._onMouseDown,true);this.game.stage.canvas.addEventListener("mousemove",this._onMouseMove,true);this.game.stage.canvas.addEventListener("mouseup",this._onMouseUp,true)},onMouseDown:function(c){if(this.mouseDownCallback){this.mouseDownCallback.call(this.callbackContext,c)}if(this.game.input.disabled||this.disabled){return}c.identifier=0;this.game.input.mousePointer.start(c)},onMouseMove:function(c){if(this.mouseMoveCallback){this.mouseMoveCallback.call(this.callbackContext,c)}if(this.game.input.disabled||this.disabled){return}c.identifier=0;this.game.input.mousePointer.move(c)},onMouseUp:function(c){if(this.mouseUpCallback){this.mouseUpCallback.call(this.callbackContext,c)}if(this.game.input.disabled||this.disabled){return}c.identifier=0;this.game.input.mousePointer.stop(c)},stop:function(){this.game.stage.canvas.removeEventListener("mousedown",this._onMouseDown);this.game.stage.canvas.removeEventListener("mousemove",this._onMouseMove);this.game.stage.canvas.removeEventListener("mouseup",this._onMouseUp)}};Phaser.MSPointer=function(c){this.game=c;this.callbackContext=this.game;this.mouseDownCallback=null;this.mouseMoveCallback=null;this.mouseUpCallback=null};Phaser.MSPointer.prototype={game:null,disabled:false,_onMSPointerDown:null,_onMSPointerMove:null,_onMSPointerUp:null,start:function(){var c=this;if(this.game.device.mspointer==true){this._onMSPointerDown=function(d){return c.onPointerDown(d)};this._onMSPointerMove=function(d){return c.onPointerMove(d)};this._onMSPointerUp=function(d){return c.onPointerUp(d)};this.game.stage.canvas.addEventListener("MSPointerDown",this._onMSPointerDown,false);this.game.stage.canvas.addEventListener("MSPointerMove",this._onMSPointerMove,false);this.game.stage.canvas.addEventListener("MSPointerUp",this._onMSPointerUp,false);this.game.stage.canvas.style["-ms-content-zooming"]="none";this.game.stage.canvas.style["-ms-touch-action"]="none"}},onPointerDown:function(c){if(this.game.input.disabled||this.disabled){return}c.preventDefault();c.identifier=c.pointerId;this.game.input.startPointer(c)},onPointerMove:function(c){if(this.game.input.disabled||this.disabled){return}c.preventDefault();c.identifier=c.pointerId;this.game.input.updatePointer(c)},onPointerUp:function(c){if(this.game.input.disabled||this.disabled){return}c.preventDefault();c.identifier=c.pointerId;this.game.input.stopPointer(c)},stop:function(){this.game.stage.canvas.removeEventListener("MSPointerDown",this._onMSPointerDown);this.game.stage.canvas.removeEventListener("MSPointerMove",this._onMSPointerMove);this.game.stage.canvas.removeEventListener("MSPointerUp",this._onMSPointerUp)}};Phaser.Pointer=function(c,d){this.game=c;this.id=d;this.active=false;this.position=new Phaser.Point();this.positionDown=new Phaser.Point();this.circle=new Phaser.Circle(0,0,44);if(d==0){this.isMouse=true}};Phaser.Pointer.prototype={_holdSent:false,_history:[],_nextDrop:0,_stateReset:false,positionDown:null,position:null,circle:null,withinGame:false,clientX:-1,clientY:-1,pageX:-1,pageY:-1,screenX:-1,screenY:-1,x:-1,y:-1,isMouse:false,isDown:false,isUp:true,timeDown:0,timeUp:0,previousTapTime:0,totalTouches:0,msSinceLastClick:Number.MAX_VALUE,targetObject:null,start:function(c){this.identifier=c.identifier;this.target=c.target;if(c.button){this.button=c.button}this._history.length=0;this.active=true;this.withinGame=true;this.isDown=true;this.isUp=false;this.msSinceLastClick=this.game.time.now-this.timeDown;this.timeDown=this.game.time.now;this._holdSent=false;this.move(c);this.positionDown.setTo(this.x,this.y);if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.x=this.x;this.game.input.y=this.y;this.game.input.position.setTo(this.x,this.y);this.game.input.onDown.dispatch(this);this.game.input.resetSpeed(this.x,this.y)}this._stateReset=false;this.totalTouches++;if(this.isMouse==false){this.game.input.currentPointers++}if(this.targetObject!==null){this.targetObject._touchedHandler(this)}return this},update:function(){if(this.active){if(this._holdSent==false&&this.duration>=this.game.input.holdRate){if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.onHold.dispatch(this)}this._holdSent=true}if(this.game.input.recordPointerHistory&&this.game.time.now>=this._nextDrop){this._nextDrop=this.game.time.now+this.game.input.recordRate;this._history.push({x:this.position.x,y:this.position.y});if(this._history.length>this.game.input.recordLimit){this._history.shift()}}}},move:function(d){if(this.game.input.pollLocked){return}if(d.button){this.button=d.button}this.clientX=d.clientX;this.clientY=d.clientY;this.pageX=d.pageX;this.pageY=d.pageY;this.screenX=d.screenX;this.screenY=d.screenY;this.x=(this.pageX-this.game.stage.offset.x)*this.game.input.scale.x;this.y=(this.pageY-this.game.stage.offset.y)*this.game.input.scale.y;this.position.setTo(this.x,this.y);this.circle.x=this.x;this.circle.y=this.y;if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.activePointer=this;this.game.input.x=this.x;this.game.input.y=this.y;this.game.input.position.setTo(this.game.input.x,this.game.input.y);this.game.input.circle.x=this.game.input.x;this.game.input.circle.y=this.game.input.y}if(this.game.paused){return this}if(this.targetObject!==null&&this.targetObject.isDragged==true){if(this.targetObject.update(this)==false){this.targetObject=null}return this}this._highestRenderOrderID=-1;this._highestRenderObject=null;this._highestInputPriorityID=-1;if(this.game.input.interactiveItems.total>0){var c=this.game.input.interactiveItems.next;do{if(c.priorityID>this._highestInputPriorityID||(c.priorityID==this._highestInputPriorityID&&c.sprite.renderOrderID>this._highestRenderOrderID)){if(c.checkPointerOver(this)){this._highestRenderOrderID=c.sprite.renderOrderID;this._highestInputPriorityID=c.priorityID;this._highestRenderObject=c}}c=c.next}while(c!=null)}if(this._highestRenderObject==null){if(this.targetObject){this.targetObject._pointerOutHandler(this);this.targetObject=null}}else{if(this.targetObject==null){this.targetObject=this._highestRenderObject;this._highestRenderObject._pointerOverHandler(this)}else{if(this.targetObject==this._highestRenderObject){if(this._highestRenderObject.update(this)==false){this.targetObject=null}}else{this.targetObject._pointerOutHandler(this);this.targetObject=this._highestRenderObject;this.targetObject._pointerOverHandler(this)}}}return this},leave:function(c){this.withinGame=false;this.move(c)},stop:function(d){if(this._stateReset){d.preventDefault();return}this.timeUp=this.game.time.now;if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.onUp.dispatch(this);if(this.duration>=0&&this.duration<=this.game.input.tapRate){if(this.timeUp-this.previousTapTime<this.game.input.doubleTapRate){this.game.input.onTap.dispatch(this,true)}else{this.game.input.onTap.dispatch(this,false)}this.previousTapTime=this.timeUp}}if(this.id>0){this.active=false}this.withinGame=false;this.isDown=false;this.isUp=true;if(this.isMouse==false){this.game.input.currentPointers--}if(this.game.input.interactiveItems.total>0){var c=this.game.input.interactiveItems.next;do{if(c){c._releasedHandler(this)}c=c.next}while(c!=null)}if(this.targetObject){this.targetObject._releasedHandler(this)}this.targetObject=null;return this},justPressed:function(c){c=c||this.game.input.justPressedRate;return(this.isDown===true&&(this.timeDown+c)>this.game.time.now)},justReleased:function(c){c=c||this.game.input.justReleasedRate;return(this.isUp===true&&(this.timeUp+c)>this.game.time.now)},reset:function(){if(this.isMouse==false){this.active=false}this.identifier=null;this.isDown=false;this.isUp=true;this.totalTouches=0;this._holdSent=false;this._history.length=0;this._stateReset=true;if(this.targetObject){this.targetObject._releasedHandler(this)}this.targetObject=null},toString:function(){return"[{Pointer (id="+this.id+" identifer="+this.identifier+" active="+this.active+" duration="+this.duration+" withinGame="+this.withinGame+" x="+this.x+" y="+this.y+" clientX="+this.clientX+" clientY="+this.clientY+" screenX="+this.screenX+" screenY="+this.screenY+" pageX="+this.pageX+" pageY="+this.pageY+")}]"}};Object.defineProperty(Phaser.Pointer.prototype,"duration",{get:function(){if(this.isUp){return -1}return this.game.time.now-this.timeDown},enumerable:true,configurable:true});Object.defineProperty(Phaser.Pointer.prototype,"worldX",{get:function(){return this.game.world.camera.x+this.x},enumerable:true,configurable:true});Object.defineProperty(Phaser.Pointer.prototype,"worldY",{get:function(){return this.game.world.camera.y+this.y},enumerable:true,configurable:true});Phaser.Touch=function(c){this.game=c;this.callbackContext=this.game;this.touchStartCallback=null;this.touchMoveCallback=null;this.touchEndCallback=null;this.touchEnterCallback=null;this.touchLeaveCallback=null;this.touchCancelCallback=null};Phaser.Touch.prototype={game:null,disabled:false,_onTouchStart:null,_onTouchMove:null,_onTouchEnd:null,_onTouchEnter:null,_onTouchLeave:null,_onTouchCancel:null,_onTouchMove:null,start:function(){var c=this;if(this.game.device.touch){this._onTouchStart=function(d){return c.onTouchStart(d)};this._onTouchMove=function(d){return c.onTouchMove(d)};this._onTouchEnd=function(d){return c.onTouchEnd(d)};this._onTouchEnter=function(d){return c.onTouchEnter(d)};this._onTouchLeave=function(d){return c.onTouchLeave(d)};this._onTouchCancel=function(d){return c.onTouchCancel(d)};this._documentTouchMove=function(d){return c.consumeTouchMove(d)};this.game.stage.canvas.addEventListener("touchstart",this._onTouchStart,false);this.game.stage.canvas.addEventListener("touchmove",this._onTouchMove,false);this.game.stage.canvas.addEventListener("touchend",this._onTouchEnd,false);this.game.stage.canvas.addEventListener("touchenter",this._onTouchEnter,false);this.game.stage.canvas.addEventListener("touchleave",this._onTouchLeave,false);this.game.stage.canvas.addEventListener("touchcancel",this._onTouchCancel,false);document.addEventListener("touchmove",this._documentTouchMove,false)}},consumeTouchMove:function(c){c.preventDefault()},onTouchStart:function(d){if(this.touchStartCallback){this.touchStartCallback.call(this.callbackContext,d)}if(this.game.input.disabled||this.disabled){return}d.preventDefault();for(var c=0;c<d.changedTouches.length;c++){this.game.input.startPointer(d.changedTouches[c])}},onTouchCancel:function(d){if(this.touchCancelCallback){this.touchCancelCallback.call(this.callbackContext,d)}if(this.game.input.disabled||this.disabled){return}d.preventDefault();for(var c=0;c<d.changedTouches.length;c++){this.game.input.stopPointer(d.changedTouches[c])}},onTouchEnter:function(d){if(this.touchEnterCallback){this.touchEnterCallback.call(this.callbackContext,d)}if(this.game.input.disabled||this.disabled){return}d.preventDefault();for(var c=0;c<d.changedTouches.length;c++){}},onTouchLeave:function(d){if(this.touchLeaveCallback){this.touchLeaveCallback.call(this.callbackContext,d)}d.preventDefault();for(var c=0;c<d.changedTouches.length;c++){}},onTouchMove:function(d){if(this.touchMoveCallback){this.touchMoveCallback.call(this.callbackContext,d)}d.preventDefault();for(var c=0;c<d.changedTouches.length;c++){this.game.input.updatePointer(d.changedTouches[c])}},onTouchEnd:function(d){if(this.touchEndCallback){this.touchEndCallback.call(this.callbackContext,d)}d.preventDefault();for(var c=0;c<d.changedTouches.length;c++){this.game.input.stopPointer(d.changedTouches[c])}},stop:function(){if(this.game.device.touch){this.game.stage.canvas.removeEventListener("touchstart",this._onTouchStart);this.game.stage.canvas.removeEventListener("touchmove",this._onTouchMove);this.game.stage.canvas.removeEventListener("touchend",this._onTouchEnd);this.game.stage.canvas.removeEventListener("touchenter",this._onTouchEnter);this.game.stage.canvas.removeEventListener("touchleave",this._onTouchLeave);this.game.stage.canvas.removeEventListener("touchcancel",this._onTouchCancel);document.removeEventListener("touchmove",this._documentTouchMove)}}};Phaser.InputHandler=function(c){this.game=c.game;this.sprite=c;this.enabled=false;this.last=this;this.first=this;this.priorityID=0;this.isDragged=false;this.dragPixelPerfect=false;this.allowHorizontalDrag=true;this.allowVerticalDrag=true;this.bringToTop=false;this.snapOnDrag=false;this.snapOnRelease=false;this.snapX=0;this.snapY=0;this.draggable=false;this.boundsRect=null;this.boundsSprite=null;this.consumePointerEvent=false;this._tempPoint=new Phaser.Point};Phaser.InputHandler.prototype={game:null,sprite:null,parent:null,next:null,prev:null,first:null,last:null,start:function(e,f,c){e=e||0;f=f||false;c=c||false;if(this.enabled==false){this.game.input.interactiveItems.add(this);this.checkBody=f;this.useHandCursor=c;this.priorityID=e;this._pointerData=[];for(var d=0;d<10;d++){this._pointerData.push({id:d,x:0,y:0,isDown:false,isUp:false,isOver:false,isOut:false,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:false})}this.snapOffset=new Phaser.Point;this.enabled=true;if(this.sprite.events&&this.sprite.events.onInputOver==null){this.sprite.events.onInputOver=new Phaser.Signal;this.sprite.events.onInputOut=new Phaser.Signal;this.sprite.events.onInputDown=new Phaser.Signal;this.sprite.events.onInputUp=new Phaser.Signal;this.sprite.events.onDragStart=new Phaser.Signal;this.sprite.events.onDragStop=new Phaser.Signal}}return this.sprite},reset:function(){this.enabled=false;for(var c=0;c<10;c++){this._pointerData[c]={id:c,x:0,y:0,isDown:false,isUp:false,isOver:false,isOut:false,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:false}}},stop:function(){if(this.enabled==false){return}else{this.enabled=false;this.game.input.interactiveItems.remove(this)}},destroy:function(){if(this.enabled){this.stop();this.sprite=null}},pointerX:function(c){c=c||0;return this._pointerData[c].x},pointerY:function(c){c=c||0;return this._pointerData[c].y},pointerDown:function(c){c=c||0;return this._pointerData[c].isDown},pointerUp:function(c){c=c||0;return this._pointerData[c].isUp},pointerTimeDown:function(c){c=c||0;return this._pointerData[c].timeDown},pointerTimeUp:function(c){c=c||0;return this._pointerData[c].timeUp},pointerOver:function(c){c=c||0;return this._pointerData[c].isOver},pointerOut:function(c){c=c||0;return this._pointerData[c].isOut},pointerTimeOver:function(c){c=c||0;return this._pointerData[c].timeOver},pointerTimeOut:function(c){c=c||0;return this._pointerData[c].timeOut},pointerDragged:function(c){c=c||0;return this._pointerData[c].isDragged},checkPointerOver:function(h){if(this.enabled&&this.sprite.visible){this.sprite.getLocalUnmodifiedPosition(this._tempPoint,h.x,h.y);var f=this.sprite.texture.frame.width,c=this.sprite.texture.frame.height,d=-f*this.sprite.anchor.x,e;if(this._tempPoint.x>d&&this._tempPoint.x<d+f){e=-c*this.sprite.anchor.y;if(this._tempPoint.y>e&&this._tempPoint.y<e+c){return true}}}else{return false}},update:function(c){if(this.enabled==false||this.sprite.visible==false){this._pointerOutHandler(c);return false}if(this.draggable&&this._draggedPointerID==c.id){return this.updateDrag(c)}else{if(this._pointerData[c.id].isOver==true){if(this.checkPointerOver(c)){this._pointerData[c.id].x=c.x-this.sprite.x;this._pointerData[c.id].y=c.y-this.sprite.y;return true}else{this._pointerOutHandler(c);return false}}}},_pointerOverHandler:function(c){if(this._pointerData[c.id].isOver==false){this._pointerData[c.id].isOver=true;this._pointerData[c.id].isOut=false;this._pointerData[c.id].timeOver=this.game.time.now;this._pointerData[c.id].x=c.x-this.sprite.x;this._pointerData[c.id].y=c.y-this.sprite.y;if(this.useHandCursor&&this._pointerData[c.id].isDragged==false){this.game.stage.canvas.style.cursor="pointer"}this.sprite.events.onInputOver.dispatch(this.sprite,c)}},_pointerOutHandler:function(c){this._pointerData[c.id].isOver=false;this._pointerData[c.id].isOut=true;this._pointerData[c.id].timeOut=this.game.time.now;if(this.useHandCursor&&this._pointerData[c.id].isDragged==false){this.game.stage.canvas.style.cursor="default"}this.sprite.events.onInputOut.dispatch(this.sprite,c)},_touchedHandler:function(c){if(this._pointerData[c.id].isDown==false&&this._pointerData[c.id].isOver==true){this._pointerData[c.id].isDown=true;this._pointerData[c.id].isUp=false;this._pointerData[c.id].timeDown=this.game.time.now;this.sprite.events.onInputDown.dispatch(this.sprite,c);if(this.draggable&&this.isDragged==false){this.startDrag(c)}if(this.bringToTop){this.sprite.bringToTop()}}return this.consumePointerEvent},_releasedHandler:function(c){if(this._pointerData[c.id].isDown&&c.isUp){this._pointerData[c.id].isDown=false;this._pointerData[c.id].isUp=true;this._pointerData[c.id].timeUp=this.game.time.now;this._pointerData[c.id].downDuration=this._pointerData[c.id].timeUp-this._pointerData[c.id].timeDown;if(this.checkPointerOver(c)){this.sprite.events.onInputUp.dispatch(this.sprite,c)}else{if(this.useHandCursor){this.game.stage.canvas.style.cursor="default"}}if(this.draggable&&this.isDragged&&this._draggedPointerID==c.id){this.stopDrag(c)}}},updateDrag:function(c){if(c.isUp){this.stopDrag(c);return false}if(this.allowHorizontalDrag){this.sprite.x=c.x+this._dragPoint.x+this.dragOffset.x}if(this.allowVerticalDrag){this.sprite.y=c.y+this._dragPoint.y+this.dragOffset.y}if(this.boundsRect){this.checkBoundsRect()}if(this.boundsSprite){this.checkBoundsSprite()}if(this.snapOnDrag){this.sprite.x=Math.floor(this.sprite.x/this.snapX)*this.snapX;this.sprite.y=Math.floor(this.sprite.y/this.snapY)*this.snapY}return true},justOver:function(d,c){d=d||0;c=c||500;return(this._pointerData[d].isOver&&this.overDuration(d)<c)},justOut:function(d,c){d=d||0;c=c||500;return(this._pointerData[d].isOut&&(this.game.time.now-this._pointerData[d].timeOut<c))},justPressed:function(d,c){d=d||0;c=c||500;return(this._pointerData[d].isDown&&this.downDuration(d)<c)},justReleased:function(d,c){d=d||0;c=c||500;return(this._pointerData[d].isUp&&(this.game.time.now-this._pointerData[d].timeUp<c))},overDuration:function(c){c=c||0;if(this._pointerData[c].isOver){return this.game.time.now-this._pointerData[c].timeOver}return -1},downDuration:function(c){c=c||0;if(this._pointerData[c].isDown){return this.game.time.now-this._pointerData[c].timeDown}return -1},enableDrag:function(d,h,c,f,i,e){d=d||false;h=h||false;c=c||false;f=f||255;i=i||null;e=e||null;this._dragPoint=new Phaser.Point();this.draggable=true;this.bringToTop=h;this.dragOffset=new Phaser.Point();this.dragFromCenter=d;this.dragPixelPerfect=c;this.dragPixelPerfectAlpha=f;if(i){this.boundsRect=i}if(e){this.boundsSprite=e}},disableDrag:function(){if(this._pointerData){for(var c=0;c<10;c++){this._pointerData[c].isDragged=false}}this.draggable=false;this.isDragged=false;this._draggedPointerID=-1},startDrag:function(c){this.isDragged=true;this._draggedPointerID=c.id;this._pointerData[c.id].isDragged=true;if(this.dragFromCenter){this._dragPoint.setTo(this.sprite.x-c.x,this.sprite.y-c.y)}else{this._dragPoint.setTo(this.sprite.x-c.x,this.sprite.y-c.y)}this.updateDrag(c);if(this.bringToTop){this.sprite.bringToTop()}this.sprite.events.onDragStart.dispatch(this.sprite,c)},stopDrag:function(c){this.isDragged=false;this._draggedPointerID=-1;this._pointerData[c.id].isDragged=false;if(this.snapOnRelease){this.sprite.x=Math.floor(this.sprite.x/this.snapX)*this.snapX;this.sprite.y=Math.floor(this.sprite.y/this.snapY)*this.snapY}this.sprite.events.onDragStop.dispatch(this.sprite,c);this.sprite.events.onInputUp.dispatch(this.sprite,c)},setDragLock:function(c,d){c=c||true;d=d||true;this.allowHorizontalDrag=c;this.allowVerticalDrag=d},enableSnap:function(f,e,d,c){d=d||true;c=c||false;this.snapOnDrag=d;this.snapOnRelease=c;this.snapX=f;this.snapY=e},disableSnap:function(){this.snapOnDrag=false;this.snapOnRelease=false},checkBoundsRect:function(){if(this.sprite.x<this.boundsRect.left){this.sprite.x=this.boundsRect.x}else{if((this.sprite.x+this.sprite.width)>this.boundsRect.right){this.sprite.x=this.boundsRect.right-this.sprite.width}}if(this.sprite.y<this.boundsRect.top){this.sprite.y=this.boundsRect.top}else{if((this.sprite.y+this.sprite.height)>this.boundsRect.bottom){this.sprite.y=this.boundsRect.bottom-this.sprite.height}}},checkBoundsSprite:function(){if(this.sprite.x<this.boundsSprite.x){this.sprite.x=this.boundsSprite.x}else{if((this.sprite.x+this.sprite.width)>(this.boundsSprite.x+this.boundsSprite.width)){this.sprite.x=(this.boundsSprite.x+this.boundsSprite.width)-this.sprite.width}}if(this.sprite.y<this.boundsSprite.y){this.sprite.y=this.boundsSprite.y}else{if((this.sprite.y+this.sprite.height)>(this.boundsSprite.y+this.boundsSprite.height)){this.sprite.y=(this.boundsSprite.y+this.boundsSprite.height)-this.sprite.height}}}};Phaser.Canvas={getOffset:function(d,c){if(typeof c==="undefined"){c=new Phaser.Point}var e=d.getBoundingClientRect();var j=d.clientTop||document.body.clientTop||0;var i=d.clientLeft||document.body.clientLeft||0;var f=window.pageYOffset||d.scrollTop||document.body.scrollTop;var h=window.pageXOffset||d.scrollLeft||document.body.scrollLeft;c.x=e.left+h-i;c.y=e.top+f-j;return c},getAspectRatio:function(c){return c.width/c.height},setBackgroundColor:function(d,c){if(typeof c==="undefined"){c="rgb(0,0,0)"}d.style.backgroundColor=c;return d},setTouchAction:function(c,d){if(typeof d==="undefined"){d="none"}c.style.msTouchAction=d;c.style["ms-touch-action"]=d;c.style["touch-action"]=d;return c},addToDOM:function(c,d,e){if(typeof d==="undefined"){d=""}if(typeof e==="undefined"){e=true}if((d!==""||d!==null)&&document.getElementById(d)){document.getElementById(d).appendChild(c);if(e){document.getElementById(d).style.overflow="hidden"}}else{document.body.appendChild(c)}return c},setTransform:function(h,j,i,e,c,f,d){h.setTransform(e,f,d,c,j,i);return h},setSmoothingEnabled:function(c,d){c.imageSmoothingEnabled=d;c.mozImageSmoothingEnabled=d;c.oImageSmoothingEnabled=d;c.webkitImageSmoothingEnabled=d;c.msImageSmoothingEnabled=d;return c},setImageRenderingCrisp:function(c){c.style["image-rendering"]="crisp-edges";c.style["image-rendering"]="-moz-crisp-edges";c.style["image-rendering"]="-webkit-optimize-contrast";c.style.msInterpolationMode="nearest-neighbor";return c},setImageRenderingBicubic:function(c){c.style["image-rendering"]="auto";c.style.msInterpolationMode="bicubic";return c}};Phaser.Events=function(c){this.parent=c;this.onAddedToGroup=new Phaser.Signal;this.onRemovedFromGroup=new Phaser.Signal;this.onKilled=new Phaser.Signal;this.onRevived=new Phaser.Signal;this.onOutOfBounds=new Phaser.Signal;this.onInputOver=null;this.onInputOut=null;this.onInputDown=null;this.onInputUp=null;this.onDragStart=null;this.onDragStop=null};Phaser.GameObjectFactory=function(c){this.game=c;this.world=this.game.world};Phaser.GameObjectFactory.prototype={game:null,world:null,sprite:function(c,f,d,e){return this.world.add(new Phaser.Sprite(this.game,c,f,d,e))},child:function(e,c,i,d,f){var h=this.world.add(new Phaser.Sprite(this.game,c,i,d,f));e.addChild(h);return h},tween:function(d,c){return this.game.tweens.create(d,c)},group:function(d,c){return new Phaser.Group(this.game,d,c)},audio:function(d,e,c){return this.game.sound.add(d,e,c)},tileSprite:function(d,i,f,c,e,h){return this.world.add(new Phaser.TileSprite(this.game,d,i,f,c,e,h))},text:function(c,f,e,d){return this.world.add(new Phaser.Text(this.game,c,f,e,d))}};Phaser.Sprite=function(d,c,h,e,f){c=c||0;h=h||0;e=e||null;f=f||null;this.game=d;this.exists=true;this.alive=true;this.group=null;this.name="";this.renderOrderID=-1;if(e){PIXI.Sprite.call(this,PIXI.TextureCache[e])}else{PIXI.Sprite.call(this)}this.events=new Phaser.Events(this);this.animations=new Phaser.AnimationManager(this);if(this.game.cache.isSpriteSheet(e)){this.animations.loadFrameData(this.game.cache.getFrameData(e));if(f!==null){if(typeof f==="string"){this.frameName=f}else{this.frame=f}}}else{this.currentFrame=this.game.cache.getFrame(e)}this.input=new Phaser.InputHandler(this);this.anchor=new Phaser.Point();this.x=c;this.y=h;this.position.x=c;this.position.y=h;this.autoCull=false;this.scale=new Phaser.Point(1,1);this.scrollFactor=new Phaser.Point(1,1);this._cache={dirty:false,a00:1,a01:0,a02:c,a10:0,a11:1,a12:h,id:1,i01:0,i10:0,idi:1,left:null,right:null,top:null,bottom:null,x:-1,y:-1,scaleX:1,scaleY:1,width:this.currentFrame.sourceSizeW,height:this.currentFrame.sourceSizeH,halfWidth:Math.floor(this.currentFrame.sourceSizeW/2),halfHeight:Math.floor(this.currentFrame.sourceSizeH/2),frameID:this.currentFrame.uuid,frameWidth:this.currentFrame.width,frameHeight:this.currentFrame.height,boundsX:0,boundsY:0,cameraVisible:true};this.offset=new Phaser.Point;this.center=new Phaser.Point(c+Math.floor(this._cache.width/2),h+Math.floor(this._cache.height/2));this.topLeft=new Phaser.Point(c,h);this.topRight=new Phaser.Point(c+this._cache.width,h);this.bottomRight=new Phaser.Point(c+this._cache.width,h+this._cache.height);this.bottomLeft=new Phaser.Point(c,h+this._cache.height);this.bounds=new Phaser.Rectangle(c,h,this._cache.width,this._cache.height);this.body=new Phaser.Physics.Arcade.Body(this)};Phaser.Sprite.prototype=Object.create(PIXI.Sprite.prototype);Phaser.Sprite.prototype.constructor=Phaser.Sprite;Phaser.Sprite.prototype.update=function(){if(!this.exists){this.renderOrderID=-1;return}this._cache.dirty=false;if(this.animations.update()){this._cache.dirty=true}this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);if(this.position.x!=this._cache.x||this.position.y!=this._cache.y){this.position.x=this._cache.x;this.position.y=this._cache.y;this._cache.dirty=true}if(this.visible){this.renderOrderID=this.game.world.currentRenderOrderID++;if(this.worldTransform[0]!=this._cache.a00||this.worldTransform[1]!=this._cache.a01){this._cache.a00=this.worldTransform[0];this._cache.a01=this.worldTransform[1];this._cache.i01=this.worldTransform[1];this._cache.scaleX=Math.sqrt((this._cache.a00*this._cache.a00)+(this._cache.a01*this._cache.a01));this._cache.a01*=-1;this._cache.dirty=true}if(this.worldTransform[3]!=this._cache.a10||this.worldTransform[4]!=this._cache.a11){this._cache.a10=this.worldTransform[3];this._cache.i10=this.worldTransform[3];this._cache.a11=this.worldTransform[4];this._cache.scaleY=Math.sqrt((this._cache.a10*this._cache.a10)+(this._cache.a11*this._cache.a11));this._cache.a10*=-1;this._cache.dirty=true}if(this.worldTransform[2]!=this._cache.a02||this.worldTransform[5]!=this._cache.a12){this._cache.a02=this.worldTransform[2];this._cache.a12=this.worldTransform[5];this._cache.dirty=true}if(this.currentFrame.uuid!=this._cache.frameID){this._cache.frameWidth=this.texture.frame.width;this._cache.frameHeight=this.texture.frame.height;this._cache.frameID=this.currentFrame.uuid;this._cache.dirty=true}if(this._cache.dirty){this._cache.width=Math.floor(this.currentFrame.sourceSizeW*this._cache.scaleX);this._cache.height=Math.floor(this.currentFrame.sourceSizeH*this._cache.scaleY);this._cache.halfWidth=Math.floor(this._cache.width/2);this._cache.halfHeight=Math.floor(this._cache.height/2);this._cache.id=1/(this._cache.a00*this._cache.a11+this._cache.a01*-this._cache.a10);this._cache.idi=1/(this._cache.a00*this._cache.a11+this._cache.i01*-this._cache.i10);this.updateBounds()}}else{if(this._cache.dirty&&this.visible==false){this.bounds.x-=this._cache.boundsX-this._cache.x;this._cache.boundsX=this._cache.x;this.bounds.y-=this._cache.boundsy-this._cache.y;this._cache.boundsY=this._cache.y}}if(this._cache.dirty){this._cache.cameraVisible=Phaser.Rectangle.intersects(this.game.world.camera.screenView,this.bounds,0);if(this.autoCull==true){this.visible=this._cache.cameraVisible}this.body.updateBounds(this.center.x,this.center.y,this._cache.scaleX,this._cache.scaleY)}this.body.update()};Phaser.Sprite.prototype.postUpdate=function(){this.body.postUpdate()};Phaser.Sprite.prototype.updateBounds=function(){this.offset.setTo(this._cache.a02-(this.anchor.x*this._cache.width),this._cache.a12-(this.anchor.y*this._cache.height));this.getLocalPosition(this.center,this.offset.x+this._cache.halfWidth,this.offset.y+this._cache.halfHeight);this.getLocalPosition(this.topLeft,this.offset.x,this.offset.y);this.getLocalPosition(this.topRight,this.offset.x+this._cache.width,this.offset.y);this.getLocalPosition(this.bottomLeft,this.offset.x,this.offset.y+this._cache.height);this.getLocalPosition(this.bottomRight,this.offset.x+this._cache.width,this.offset.y+this._cache.height);this._cache.left=Phaser.Math.min(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);this._cache.right=Phaser.Math.max(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);this._cache.top=Phaser.Math.min(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);this._cache.bottom=Phaser.Math.max(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);this.bounds.setTo(this._cache.left,this._cache.top,this._cache.right-this._cache.left,this._cache.bottom-this._cache.top);this._cache.boundsX=this._cache.x;this._cache.boundsY=this._cache.y};Phaser.Sprite.prototype.getLocalPosition=function(d,c,e){d.x=((this._cache.a11*this._cache.id*c+-this._cache.a01*this._cache.id*e+(this._cache.a12*this._cache.a01-this._cache.a02*this._cache.a11)*this._cache.id)*this._cache.scaleX)+this._cache.a02;d.y=((this._cache.a00*this._cache.id*e+-this._cache.a10*this._cache.id*c+(-this._cache.a12*this._cache.a00+this._cache.a02*this._cache.a10)*this._cache.id)*this._cache.scaleY)+this._cache.a12;return d};Phaser.Sprite.prototype.getLocalUnmodifiedPosition=function(d,c,e){d.x=this._cache.a11*this._cache.idi*c+-this._cache.i01*this._cache.idi*e+(this._cache.a12*this._cache.i01-this._cache.a02*this._cache.a11)*this._cache.idi;d.y=this._cache.a00*this._cache.idi*e+-this._cache.i10*this._cache.idi*c+(-this._cache.a12*this._cache.a00+this._cache.a02*this._cache.i10)*this._cache.idi;return d};Phaser.Sprite.prototype.bringToTop=function(){if(this.group){this.group.bringToTop(this)}else{this.game.world.bringToTop(this)}};Phaser.Sprite.prototype.getBounds=function(e){e=e||new Phaser.Rectangle;var h=Phaser.Math.min(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);var d=Phaser.Math.max(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);var f=Phaser.Math.min(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);var c=Phaser.Math.max(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);e.x=h;e.y=f;e.width=d-h;e.height=c-f;return e};Object.defineProperty(Phaser.Sprite.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this.rotation)},set:function(c){this.rotation=Phaser.Math.degToRad(c)}});Object.defineProperty(Phaser.Sprite.prototype,"frame",{get:function(){return this.animations.frame},set:function(c){this.animations.frame=c}});Object.defineProperty(Phaser.Sprite.prototype,"frameName",{get:function(){return this.animations.frameName},set:function(c){this.animations.frameName=c}});Object.defineProperty(Phaser.Sprite.prototype,"inCamera",{get:function(){return this._cache.cameraVisible}});Object.defineProperty(Phaser.Sprite.prototype,"inputEnabled",{get:function(){return(this.input.enabled)},set:function(c){if(c){if(this.input.enabled==false){this.input.start()}}else{if(this.input.enabled){this.input.stop()}}}});Phaser.TileSprite=function(e,d,j,h,c,f,i){d=d||0;j=j||0;h=h||256;c=c||256;f=f||null;i=i||null;Phaser.Sprite.call(this,e,d,j,f,i);this.texture=PIXI.TextureCache[f];PIXI.TilingSprite.call(this,this.texture,h,c);this.tileScale=new Phaser.Point(1,1);this.tilePosition=new Phaser.Point(0,0)};Phaser.TileSprite.prototype=Phaser.Utils.extend(true,PIXI.TilingSprite.prototype,Phaser.Sprite.prototype);Phaser.TileSprite.prototype.constructor=Phaser.TileSprite;Phaser.Text=function(d,c,i,h,e){c=c||0;i=i||0;h=h||"";e=e||"";this.canvas=document.createElement("canvas");this.context=this.canvas.getContext("2d");var f=d.rnd.uuid();PIXI.TextureCache[f]=new PIXI.Texture(new PIXI.BaseTexture(this.canvas));Phaser.Sprite.call(this,d,c,i,f);this.setText(h);this.setStyle(e);this.updateText();this.dirty=false};Phaser.Text.prototype=Phaser.Utils.extend(true,Phaser.Sprite.prototype,PIXI.Text.prototype);Phaser.Text.prototype.constructor=Phaser.Text;Phaser.Canvas={getOffset:function(d,c){if(typeof c==="undefined"){c=new Phaser.Point}var e=d.getBoundingClientRect();var j=d.clientTop||document.body.clientTop||0;var i=d.clientLeft||document.body.clientLeft||0;var f=window.pageYOffset||d.scrollTop||document.body.scrollTop;var h=window.pageXOffset||d.scrollLeft||document.body.scrollLeft;c.x=e.left+h-i;c.y=e.top+f-j;return c},getAspectRatio:function(c){return c.width/c.height},setBackgroundColor:function(d,c){if(typeof c==="undefined"){c="rgb(0,0,0)"}d.style.backgroundColor=c;return d},setTouchAction:function(c,d){if(typeof d==="undefined"){d="none"}c.style.msTouchAction=d;c.style["ms-touch-action"]=d;c.style["touch-action"]=d;return c},addToDOM:function(c,d,e){if(typeof d==="undefined"){d=""}if(typeof e==="undefined"){e=true}if((d!==""||d!==null)&&document.getElementById(d)){document.getElementById(d).appendChild(c);if(e){document.getElementById(d).style.overflow="hidden"}}else{document.body.appendChild(c)}return c},setTransform:function(h,j,i,e,c,f,d){h.setTransform(e,f,d,c,j,i);return h},setSmoothingEnabled:function(c,d){c.imageSmoothingEnabled=d;c.mozImageSmoothingEnabled=d;c.oImageSmoothingEnabled=d;c.webkitImageSmoothingEnabled=d;c.msImageSmoothingEnabled=d;return c},setImageRenderingCrisp:function(c){c.style["image-rendering"]="crisp-edges";c.style["image-rendering"]="-moz-crisp-edges";c.style["image-rendering"]="-webkit-optimize-contrast";c.style.msInterpolationMode="nearest-neighbor";return c},setImageRenderingBicubic:function(c){c.style["image-rendering"]="auto";c.style.msInterpolationMode="bicubic";return c}};Phaser.Device=function(){this.patchAndroidClearRectBug=false;this.desktop=false;this.iOS=false;this.android=false;this.chromeOS=false;this.linux=false;this.macOS=false;this.windows=false;this.canvas=false;this.file=false;this.fileSystem=false;this.localStorage=false;this.webGL=false;this.worker=false;this.touch=false;this.mspointer=false;this.css3D=false;this.arora=false;this.chrome=false;this.epiphany=false;this.firefox=false;this.ie=false;this.ieVersion=0;this.mobileSafari=false;this.midori=false;this.opera=false;this.safari=false;this.webApp=false;this.audioData=false;this.webAudio=false;this.ogg=false;this.opus=false;this.mp3=false;this.wav=false;this.m4a=false;this.webm=false;this.iPhone=false;this.iPhone4=false;this.iPad=false;this.pixelRatio=0;this._checkAudio();this._checkBrowser();this._checkCSS3D();this._checkDevice();this._checkFeatures();this._checkOS()};Phaser.Device.prototype={_checkOS:function(){var c=navigator.userAgent;if(/Android/.test(c)){this.android=true}else{if(/CrOS/.test(c)){this.chromeOS=true}else{if(/iP[ao]d|iPhone/i.test(c)){this.iOS=true}else{if(/Linux/.test(c)){this.linux=true}else{if(/Mac OS/.test(c)){this.macOS=true}else{if(/Windows/.test(c)){this.windows=true}}}}}}if(this.windows||this.macOS||this.linux){this.desktop=true}},_checkFeatures:function(){this.canvas=!!window.CanvasRenderingContext2D;try{this.localStorage=!!localStorage.getItem}catch(c){this.localStorage=false}this.file=!!window.File&&!!window.FileReader&&!!window.FileList&&!!window.Blob;this.fileSystem=!!window.requestFileSystem;this.webGL=(function(){try{return !!window.WebGLRenderingContext&&!!document.createElement("canvas").getContext("experimental-webgl")}catch(d){return false}})();this.worker=!!window.Worker;if("ontouchstart" in document.documentElement||window.navigator.msPointerEnabled){this.touch=true}if(window.navigator.msPointerEnabled){this.mspointer=true}},_checkBrowser:function(){var c=navigator.userAgent;if(/Arora/.test(c)){this.arora=true}else{if(/Chrome/.test(c)){this.chrome=true}else{if(/Epiphany/.test(c)){this.epiphany=true}else{if(/Firefox/.test(c)){this.firefox=true}else{if(/Mobile Safari/.test(c)){this.mobileSafari=true}else{if(/MSIE (\d+\.\d+);/.test(c)){this.ie=true;this.ieVersion=parseInt(RegExp.$1)}else{if(/Midori/.test(c)){this.midori=true}else{if(/Opera/.test(c)){this.opera=true}else{if(/Safari/.test(c)){this.safari=true}}}}}}}}}if(navigator.standalone){this.webApp=true}},_checkAudio:function(){this.audioData=!!(window.Audio);this.webAudio=!!(window.webkitAudioContext||window.AudioContext);var f=document.createElement("audio");var c=false;try{if(c=!!f.canPlayType){if(f.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")){this.ogg=true}if(f.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")){this.opus=true}if(f.canPlayType("audio/mpeg;").replace(/^no$/,"")){this.mp3=true}if(f.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")){this.wav=true}if(f.canPlayType("audio/x-m4a;")||f.canPlayType("audio/aac;").replace(/^no$/,"")){this.m4a=true}if(f.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")){this.webm=true}}}catch(d){}},_checkDevice:function(){this.pixelRatio=window.devicePixelRatio||1;this.iPhone=navigator.userAgent.toLowerCase().indexOf("iphone")!=-1;this.iPhone4=(this.pixelRatio==2&&this.iPhone);this.iPad=navigator.userAgent.toLowerCase().indexOf("ipad")!=-1},_checkCSS3D:function(){var e=document.createElement("p");var f;var d={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(e,null);for(var c in d){if(e.style[c]!==undefined){e.style[c]="translate3d(1px,1px,1px)";f=window.getComputedStyle(e).getPropertyValue(d[c])}}document.body.removeChild(e);this.css3D=(f!==undefined&&f.length>0&&f!=="none")},canPlayAudio:function(c){if(c=="mp3"&&this.mp3){return true}else{if(c=="ogg"&&(this.ogg||this.opus)){return true}else{if(c=="m4a"&&this.m4a){return true}else{if(c=="wav"&&this.wav){return true}else{if(c=="webm"&&this.webm){return true}}}}}return false},isConsoleOpen:function(){if(window.console&&window.console.firebug){return true}if(window.console){console.profile();console.profileEnd();if(console.clear){console.clear()}return console.profiles.length>0}return false}};Phaser.RequestAnimationFrame=function(d){this.game=d;this._isSetTimeOut=false;this.isRunning=false;var e=["ms","moz","webkit","o"];for(var c=0;c<e.length&&!window.requestAnimationFrame;c++){window.requestAnimationFrame=window[e[c]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[e[c]+"CancelAnimationFrame"]}};Phaser.RequestAnimationFrame.prototype={_onLoop:null,start:function(){this.isRunning=true;var c=this;if(!window.requestAnimationFrame){this._isSetTimeOut=true;this._onLoop=function(){return c.updateSetTimeout()};this._timeOutID=window.setTimeout(this._onLoop,0)}else{this._isSetTimeOut=false;this._onLoop=function(d){return c.updateRAF(d)};window.requestAnimationFrame(this._onLoop)}},updateRAF:function(c){this.game.update(c);window.requestAnimationFrame(this._onLoop)},updateSetTimeout:function(){this.game.update(Date.now());this._timeOutID=window.setTimeout(this._onLoop,this.game.time.timeToCall)},stop:function(){if(this._isSetTimeOut){clearTimeout(this._timeOutID)}else{window.cancelAnimationFrame}this.isRunning=false},isSetTimeOut:function(){return this._isSetTimeOut},isRAF:function(){return(this._isSetTimeOut===false)}};Phaser.RandomDataGenerator=function(c){if(typeof c==="undefined"){c=[]}this.sow(c)};Phaser.RandomDataGenerator.prototype={c:1,s0:0,s1:0,s2:0,rnd:function(){var c=2091639*this.s0+this.c*2.3283064365386963e-10;this.c=c|0;this.s0=this.s1;this.s1=this.s2;this.s2=c-this.c;return this.s2},sow:function(d){if(typeof d==="undefined"){d=[]}this.s0=this.hash(" ");this.s1=this.hash(this.s0);this.s2=this.hash(this.s1);var c;for(var e=0;c=d[e++];){this.s0-=this.hash(c);this.s0+=~~(this.s0<0);this.s1-=this.hash(c);this.s1+=~~(this.s1<0);this.s2-=this.hash(c);this.s2+=~~(this.s2<0)}},hash:function(e){var d,c,f;f=4022871197;e=e.toString();for(c=0;c<e.length;c++){f+=e.charCodeAt(c);d=0.02519603282416938*f;f=d>>>0;d-=f;d*=f;f=d>>>0;d-=f;f+=d*4294967296}return(f>>>0)*2.3283064365386963e-10},integer:function(){return this.rnd.apply(this)*4294967296},frac:function(){return this.rnd.apply(this)+(this.rnd.apply(this)*2097152|0)*1.1102230246251565e-16},real:function(){return this.integer()+this.frac()},integerInRange:function(d,c){return Math.floor(this.realInRange(d,c))},realInRange:function(d,c){d=d||0;c=c||0;return this.frac()*(c-d)+d},normal:function(){return 1-2*this.frac()},uuid:function(){var d,c;for(c=d="";d++<36;c+=~d%5|d*3&4?(d^15?8^this.frac()*(d^20?16:4):4).toString(16):"-"){}return c},pick:function(c){return c[this.integerInRange(0,c.length)]},weightedPick:function(c){return c[~~(Math.pow(this.frac(),2)*c.length)]},timestamp:function(d,c){return this.realInRange(d||946684800000,c||1577862000000)},angle:function(){return this.integerInRange(-180,180)}};Phaser.Math={PI2:Math.PI*2,fuzzyEqual:function(d,c,e){if(typeof e==="undefined"){e=0.0001}return Math.abs(d-c)<e},fuzzyLessThan:function(d,c,e){if(typeof e==="undefined"){e=0.0001}return d<c+e},fuzzyGreaterThan:function(d,c,e){if(typeof e==="undefined"){e=0.0001}return d>c-e},fuzzyCeil:function(c,d){if(typeof d==="undefined"){d=0.0001}return Math.ceil(c-d)},fuzzyFloor:function(c,d){if(typeof d==="undefined"){d=0.0001}return Math.floor(c+d)},average:function(){var c=[];for(var e=0;e<(arguments.length-0);e++){c[e]=arguments[e+0]}var f=0;for(var d=0;d<c.length;d++){f+=c[d]}return f/c.length},truncate:function(c){return(c>0)?Math.floor(c):Math.ceil(c)},shear:function(c){return c%1},snapTo:function(c,e,d){if(typeof d==="undefined"){d=0}if(e==0){return c}c-=d;c=e*Math.round(c/e);return d+c},snapToFloor:function(c,e,d){if(typeof d==="undefined"){d=0}if(e==0){return c}c-=d;c=e*Math.floor(c/e);return d+c},snapToCeil:function(c,e,d){if(typeof d==="undefined"){d=0}if(e==0){return c}c-=d;c=e*Math.ceil(c/e);return d+c},snapToInArray:function(e,d,h){if(typeof h==="undefined"){h=true}if(h){d.sort()}if(e<d[0]){return d[0]}var f=1;while(d[f]<e){f++}var c=d[f-1];var j=(f<d.length)?d[f]:Number.POSITIVE_INFINITY;return((j-e)<=(e-c))?j:c},roundTo:function(e,c,d){if(typeof c==="undefined"){c=0}if(typeof d==="undefined"){d=10}var f=Math.pow(d,-c);return Math.round(e*f)/f},floorTo:function(e,c,d){if(typeof c==="undefined"){c=0}if(typeof d==="undefined"){d=10}var f=Math.pow(d,-c);return Math.floor(e*f)/f},ceilTo:function(e,c,d){if(typeof c==="undefined"){c=0}if(typeof d==="undefined"){d=10}var f=Math.pow(d,-c);return Math.ceil(e*f)/f},interpolateFloat:function(d,c,e){return(c-d)*e+d},angleBetween:function(d,f,c,e){return Math.atan2(e-f,c-d)},normalizeAngle:function(e,d){if(typeof d==="undefined"){d=true}var c=(d)?GameMath.PI:180;return this.wrap(e,c,-c)},nearestAngleBetween:function(d,c,f){if(typeof f==="undefined"){f=true}var e=(f)?GameMath.PI:180;d=this.normalizeAngle(d,f);c=this.normalizeAngle(c,f);if(d<-e/2&&c>e/2){d+=e*2}if(c<-e/2&&d>e/2){c+=e*2}return c-d},interpolateAngles:function(d,c,e,f,h){if(typeof f==="undefined"){f=true}if(typeof h==="undefined"){h=null}d=this.normalizeAngle(d,f);c=this.normalizeAngleToAnother(c,d,f);return(typeof h==="function")?h(e,d,c-d,1):this.interpolateFloat(d,c,e)},chanceRoll:function(c){if(typeof c==="undefined"){c=50}if(c<=0){return false}else{if(c>=100){return true}else{if(Math.random()*100>=c){return false}else{return true}}}},maxAdd:function(e,d,c){e+=d;if(e>c){e=c}return e},minSub:function(e,d,c){e-=d;if(e<c){e=c}return e},wrapValue:function(e,d,c){var f;e=Math.abs(e);d=Math.abs(d);c=Math.abs(c);f=(e+d)%c;return f},randomSign:function(){return(Math.random()>0.5)?1:-1},isOdd:function(c){return(c&1)},isEven:function(c){if(c&1){return false}else{return true}},max:function(){for(var e=1,d=0,c=arguments.length;e<c;e++){if(arguments[d]<arguments[e]){d=e}}return arguments[d]},min:function(){for(var e=1,d=0,c=arguments.length;e<c;e++){if(arguments[e]<arguments[d]){d=e}}return arguments[d]},wrapAngle:function(d){var c=d;if(d>=-180&&d<=180){return d}c=(d+180)%360;if(c<0){c+=360}return c-180},angleLimit:function(f,e,d){var c=f;if(f>d){c=d}else{if(f<e){c=e}}return c},linearInterpolation:function(e,d){var c=e.length-1;var j=c*d;var h=Math.floor(j);if(d<0){return this.linear(e[0],e[1],j)}if(d>1){return this.linear(e[c],e[c-1],c-j)}return this.linear(e[h],e[h+1>c?c:h+1],j-h)},bezierInterpolation:function(e,d){var c=0;var h=e.length-1;for(var f=0;f<=h;f++){c+=Math.pow(1-d,h-f)*Math.pow(d,f)*e[f]*this.bernstein(h,f)}return c},catmullRomInterpolation:function(e,d){var c=e.length-1;var j=c*d;var h=Math.floor(j);if(e[0]===e[c]){if(d<0){h=Math.floor(j=c*(1+d))}return this.catmullRom(e[(h-1+c)%c],e[h],e[(h+1)%c],e[(h+2)%c],j-h)}else{if(d<0){return e[0]-(this.catmullRom(e[0],e[0],e[1],e[1],-j)-e[0])}if(d>1){return e[c]-(this.catmullRom(e[c],e[c],e[c-1],e[c-1],j-c)-e[c])}return this.catmullRom(e[h?h-1:0],e[h],e[c<h+1?c:h+1],e[c<h+2?c:h+2],j-h)}},linear:function(e,d,c){return(d-e)*c+e},bernstein:function(d,c){return this.factorial(d)/this.factorial(c)/this.factorial(d-c)},catmullRom:function(k,j,h,f,l){var i=(h-k)*0.5,e=(f-j)*0.5,d=l*l,c=l*d;return(2*j-2*h+i+e)*c+(-3*j+3*h-2*i-e)*d+i*l+j},difference:function(d,c){return Math.abs(d-c)},getRandom:function(e,f,d){if(typeof f==="undefined"){f=0}if(typeof d==="undefined"){d=0}if(e!=null){var c=d;if((c==0)||(c>e.length-f)){c=e.length-f}if(c>0){return e[f+Math.floor(Math.random()*c)]}}return null},floor:function(c){var d=c|0;return(c>0)?(d):((d!=c)?(d-1):(d))},ceil:function(c){var d=c|0;return(c>0)?((d!=c)?(d+1):(d)):(d)},sinCosGenerator:function(d,l,e,j){if(typeof l==="undefined"){l=1}if(typeof e==="undefined"){e=1}if(typeof j==="undefined"){j=1}var k=l;var n=e;var h=j*Math.PI/d;var f=[];var m=[];for(var i=0;i<d;i++){n-=k*h;k+=n*h;f[i]=n;m[i]=k}return{sin:m,cos:f}},shift:function(c){var d=c.shift();c.push(d);return d},shuffleArray:function(f){for(var e=f.length-1;e>0;e--){var d=Math.floor(Math.random()*(e+1));var c=f[e];f[e]=f[d];f[d]=c}return f},distance:function(f,i,e,h){var d=f-e;var c=i-h;return Math.sqrt(d*d+c*c)},distanceRounded:function(d,f,c,e){return Math.round(Phaser.Math.distance(d,f,c,e))},clamp:function(d,e,c){return(d<e)?e:((d>c)?c:d)},clampBottom:function(c,d){return c<d?d:c},mapLinear:function(d,e,c,h,f){return h+(d-e)*(f-h)/(c-e)},smoothstep:function(d,e,c){if(d<=e){return 0}if(d>=c){return 1}d=(d-e)/(c-e);return d*d*(3-2*d)},smootherstep:function(d,e,c){if(d<=e){return 0}if(d>=c){return 1}d=(d-e)/(c-e);return d*d*d*(d*(d*6-15)+10)},sign:function(c){return(c<0)?-1:((c>0)?1:0)},degToRad:function(){var c=Math.PI/180;return function(d){return d*c}}(),radToDeg:function(){var c=180/Math.PI;return function(d){return d*c}}()};Phaser.QuadTree=function(i,d,k,h,c,f,e,j){this.physicsManager=i;this.ID=i.quadTreeID;i.quadTreeID++;this.maxObjects=f||10;this.maxLevels=e||4;this.level=j||0;this.bounds={x:Math.round(d),y:Math.round(k),width:h,height:c,subWidth:Math.floor(h/2),subHeight:Math.floor(c/2),right:Math.round(d)+Math.floor(h/2),bottom:Math.round(k)+Math.floor(c/2)};this.objects=[];this.nodes=[]};Phaser.QuadTree.prototype={split:function(){this.level++;this.nodes[0]=new Phaser.QuadTree(this.physicsManager,this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level);this.nodes[1]=new Phaser.QuadTree(this.physicsManager,this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level);this.nodes[2]=new Phaser.QuadTree(this.physicsManager,this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level);this.nodes[3]=new Phaser.QuadTree(this.physicsManager,this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level)},insert:function(c){var e=0;var d;if(this.nodes[0]!=null){d=this.getIndex(c);if(d!==-1){this.nodes[d].insert(c);return}}this.objects.push(c);if(this.objects.length>this.maxObjects&&this.level<this.maxLevels){if(this.nodes[0]==null){this.split()}while(e<this.objects.length){d=this.getIndex(this.objects[e]);if(d!==-1){this.nodes[d].insert(this.objects.splice(e,1)[0])}else{e++}}}},getIndex:function(d){var c=-1;if(d.x<this.bounds.right&&d.right<this.bounds.right){if((d.y<this.bounds.bottom&&d.bottom<this.bounds.bottom)){c=1}else{if((d.y>this.bounds.bottom)){c=2}}}else{if(d.x>this.bounds.right){if((d.y<this.bounds.bottom&&d.bottom<this.bounds.bottom)){c=0}else{if((d.y>this.bounds.bottom)){c=3}}}}return c},retrieve:function(c){var d=this.objects;c.body.quadTreeIndex=this.getIndex(c.body);c.body.quadTreeIDs.push(this.ID);if(this.nodes[0]){if(c.body.quadTreeIndex!==-1){d=d.concat(this.nodes[c.body.quadTreeIndex].retrieve(c))}else{d=d.concat(this.nodes[0].retrieve(c));d=d.concat(this.nodes[1].retrieve(c));d=d.concat(this.nodes[2].retrieve(c));d=d.concat(this.nodes[3].retrieve(c))}}return d},clear:function(){this.objects=[];for(var d=0,c=this.nodes.length;d<c;d++){if(this.nodes[d]){this.nodes[d].clear();delete this.nodes[d]}}}};Phaser.Circle=function(c,e,d){if(typeof c==="undefined"){c=0}if(typeof e==="undefined"){e=0}if(typeof d==="undefined"){d=0}this._diameter=0;this._radius=0;this.x=0;this.y=0;this.setTo(c,e,d)};Phaser.Circle.prototype={circumference:function(){return 2*(Math.PI*this._radius)},setTo:function(c,e,d){this.x=c;this.y=e;this._diameter=d;this._radius=d*0.5;return this},copyFrom:function(c){return this.setTo(c.x,c.y,c.diameter)},copyTo:function(c){c[x]=this.x;c[y]=this.y;c[diameter]=this._diameter;return c},distance:function(d,c){if(typeof c==="undefined"){c=false}if(c){return Phaser.Math.distanceRound(this.x,this.y,d.x,d.y)}else{return Phaser.Math.distance(this.x,this.y,d.x,d.y)}},clone:function(c){if(typeof c==="undefined"){c=new Phaser.Circle()}return c.setTo(a.x,a.y,a.diameter)},contains:function(c,d){return Phaser.Circle.contains(this,c,d)},circumferencePoint:function(e,d,c){return Phaser.Circle.circumferencePoint(this,e,d,c)},offset:function(d,c){this.x+=d;this.y+=c;return this},offsetPoint:function(c){return this.offset(c.x,c.y)},toString:function(){return"[{Phaser.Circle (x="+this.x+" y="+this.y+" diameter="+this.diameter+" radius="+this.radius+")}]"}};Object.defineProperty(Phaser.Circle.prototype,"diameter",{get:function(){return this._diameter},set:function(c){if(c>0){this._diameter=c;this._radius=c*0.5}},enumerable:true,configurable:true});Object.defineProperty(Phaser.Circle.prototype,"radius",{get:function(){return this._radius},set:function(c){if(c>0){this._radius=c;this._diameter=c*2}},enumerable:true,configurable:true});Object.defineProperty(Phaser.Circle.prototype,"left",{get:function(){return this.x-this._radius},set:function(c){if(c>this.x){this._radius=0;this._diameter=0}else{this.radius=this.x-c}},enumerable:true,configurable:true});Object.defineProperty(Phaser.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(c){if(c<this.x){this._radius=0;this._diameter=0}else{this.radius=c-this.x}},enumerable:true,configurable:true});Object.defineProperty(Phaser.Circle.prototype,"top",{get:function(){return this.y-this._radius},set:function(c){if(c>this.y){this._radius=0;this._diameter=0}else{this.radius=this.y-c}},enumerable:true,configurable:true});Object.defineProperty(Phaser.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(c){if(c<this.y){this._radius=0;this._diameter=0}else{this.radius=c-this.y}},enumerable:true,configurable:true});Object.defineProperty(Phaser.Circle.prototype,"area",{get:function(){if(this._radius>0){return Math.PI*this._radius*this._radius}else{return 0}},enumerable:true,configurable:true});Object.defineProperty(Phaser.Circle.prototype,"empty",{get:function(){return(this._diameter==0)},set:function(c){this.setTo(0,0,0)},enumerable:true,configurable:true});Phaser.Circle.contains=function(e,c,h){if(c>=e.left&&c<=e.right&&h>=e.top&&h<=e.bottom){var f=(e.x-c)*(e.x-c);var d=(e.y-h)*(e.y-h);return(f+d)<=(e.radius*e.radius)}return false};Phaser.Circle.equals=function(d,c){return(d.x==c.x&&d.y==c.y&&d.diameter==c.diameter)};Phaser.Circle.intersects=function(d,c){return(Phaser.Math.distance(d.x,d.y,c.x,c.y)<=(d.radius+c.radius))};Phaser.Circle.circumferencePoint=function(c,f,e,d){if(typeof e==="undefined"){e=false}if(typeof d==="undefined"){d=new Phaser.Point()}if(e===true){f=Phaser.Math.radToDeg(f)}d.x=c.x+c.radius*Math.cos(f);d.y=c.y+c.radius*Math.sin(f);return d};Phaser.Circle.intersectsRectangle=function(o,e){var i=Math.abs(o.x-e.x-e.halfWidth);var n=e.halfWidth+o.radius;if(i>n){return false}var h=Math.abs(o.y-e.y-e.halfHeight);var l=e.halfHeight+o.radius;if(h>l){return false}if(i<=e.halfWidth||h<=e.halfHeight){return true}var j=i-e.halfWidth;var f=h-e.halfHeight;var m=j*j;var d=f*f;var k=o.radius*o.radius;return m+d<=k};Phaser.Point=function(c,d){if(typeof c==="undefined"){c=0}if(typeof d==="undefined"){d=0}this.x=c;this.y=d};Phaser.Point.prototype={copyFrom:function(c){return this.setTo(c.x,c.y)},invert:function(){return this.setTo(this.y,this.x)},setTo:function(c,d){this.x=c;this.y=d;return this},add:function(c,d){this.x+=c;this.y+=d;return this},subtract:function(c,d){this.x-=c;this.y-=d;return this},multiply:function(c,d){this.x*=c;this.y*=d;return this},divide:function(c,d){this.x/=c;this.y/=d;return this},clampX:function(d,c){this.x=Phaser.Math.clamp(this.x,d,c);return this},clampY:function(d,c){this.y=Phaser.Math.clamp(this.y,d,c);return this},clamp:function(d,c){this.x=Phaser.Math.clamp(this.x,d,c);this.y=Phaser.Math.clamp(this.y,d,c);return this},clone:function(c){if(typeof c==="undefined"){c=new Phaser.Point}return c.setTo(this.x,this.y)},copyFrom:function(c){return this.setTo(c.x,c.y)},copyTo:function(c){c[x]=this.x;c[y]=this.y;return c},distance:function(d,c){return Phaser.Point.distance(this,d,c)},equals:function(c){return(c.x==this.x&&c.y==this.y)},rotate:function(c,h,e,d,f){return Phaser.Point.rotate(this,c,h,e,d,f)},toString:function(){return"[{Point (x="+this.x+" y="+this.y+")}]"}};Phaser.Point.add=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x+c.x;e.y=d.y+c.y;return e};Phaser.Point.subtract=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x-c.x;e.y=d.y-c.y;return e};Phaser.Point.multiply=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x*c.x;e.y=d.y*c.y;return e};Phaser.Point.divide=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x/c.x;e.y=d.y/c.y;return e};Phaser.Point.equals=function(d,c){return(d.x==c.x&&d.y==c.y)};Phaser.Point.distance=function(d,c,e){if(typeof e==="undefined"){e=false}if(e){return Phaser.Math.distanceRound(d.x,d.y,c.x,c.y)}else{return Phaser.Math.distance(d.x,d.y,c.x,c.y)}},Phaser.Point.rotate=function(d,c,i,f,e,h){e=e||false;h=h||null;if(e){f=Phaser.Math.radToDeg(f)}if(h===null){h=Math.sqrt(((c-d.x)*(c-d.x))+((i-d.y)*(i-d.y)))}return d.setTo(c+h*Math.cos(f),i+h*Math.sin(f))};Phaser.Rectangle=function(d,f,e,c){d=d||0;f=f||0;e=e||0;c=c||0;this.x=d;this.y=f;this.width=e;this.height=c};Phaser.Rectangle.prototype={x:0,y:0,width:0,height:0,offset:function(d,c){this.x+=d;this.y+=c;return this},offsetPoint:function(c){return this.offset(c.x,c.y)},setTo:function(d,f,e,c){this.x=d;this.y=f;this.width=e;this.height=c;return this},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y)},copyFrom:function(c){return this.setTo(c.x,c.y,c.width,c.height)},copyTo:function(c){c.x=this.x;c.y=this.y;c.width=this.width;c.height=this.height;return c},inflate:function(d,c){return Phaser.Rectangle.inflate(this,d,c)},size:function(c){return Phaser.Rectangle.size(this,c)},clone:function(c){return Phaser.Rectangle.clone(this,c)},contains:function(c,d){return Phaser.Rectangle.contains(this,c,d)},containsRect:function(c){return Phaser.Rectangle.containsRect(this,c)},equals:function(c){return Phaser.Rectangle.equals(this,c)},intersection:function(c,d){return Phaser.Rectangle.intersection(this,c,output)},intersects:function(c,d){return Phaser.Rectangle.intersects(this,c,d)},intersectsRaw:function(h,e,f,d,c){return Phaser.Rectangle.intersectsRaw(this,h,e,f,d,c)},union:function(c,d){return Phaser.Rectangle.union(this,c,d)},toString:function(){return"[{Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+" empty="+this.empty+")}]"}};Object.defineProperty(Phaser.Rectangle.prototype,"halfWidth",{get:function(){return Math.round(this.width/2)},enumerable:true,configurable:true});Object.defineProperty(Phaser.Rectangle.prototype,"halfHeight",{get:function(){return Math.round(this.height/2)},enumerable:true,configurable:true});Object.defineProperty(Phaser.Rectangle.prototype,"bottom",{get:function(){return this.y+this.height},set:function(c){if(c<=this.y){this.height=0}else{this.height=(this.y-c)}},enumerable:true,configurable:true});Object.defineProperty(Phaser.Rectangle.prototype,"bottomRight",{get:function(){return new Phaser.Point(this.right,this.bottom)},set:function(c){this.right=c.x;this.bottom=c.y},enumerable:true,configurable:true});Object.defineProperty(Phaser.Rectangle.prototype,"left",{get:function(){return this.x},set:function(c){if(c>=this.right){this.width=0}else{this.width=this.right-c}this.x=c},enumerable:true,configurable:true});Object.defineProperty(Phaser.Rectangle.prototype,"right",{get:function(){return this.x+this.width},set:function(c){if(c<=this.x){this.width=0}else{this.width=this.x+c}},enumerable:true,configurable:true});Object.defineProperty(Phaser.Rectangle.prototype,"volume",{get:function(){return this.width*this.height},enumerable:true,configurable:true});Object.defineProperty(Phaser.Rectangle.prototype,"perimeter",{get:function(){return(this.width*2)+(this.height*2)},enumerable:true,configurable:true});Object.defineProperty(Phaser.Rectangle.prototype,"centerX",{get:function(){return this.x+this.halfWidth},set:function(c){this.x=c-this.halfWidth},enumerable:true,configurable:true});Object.defineProperty(Phaser.Rectangle.prototype,"centerY",{get:function(){return this.y+this.halfHeight},set:function(c){this.y=c-this.halfHeight},enumerable:true,configurable:true});Object.defineProperty(Phaser.Rectangle.prototype,"top",{get:function(){return this.y},set:function(c){if(c>=this.bottom){this.height=0;this.y=c}else{this.height=(this.bottom-c)}},enumerable:true,configurable:true});Object.defineProperty(Phaser.Rectangle.prototype,"topLeft",{get:function(){return new Phaser.Point(this.x,this.y)},set:function(c){this.x=c.x;this.y=c.y},enumerable:true,configurable:true});Object.defineProperty(Phaser.Rectangle.prototype,"empty",{get:function(){return(!this.width||!this.height)},set:function(c){this.setTo(0,0,0,0)},enumerable:true,configurable:true});Phaser.Rectangle.inflate=function(d,e,c){d.x-=e;d.width+=2*e;d.y-=c;d.height+=2*c;return d};Phaser.Rectangle.inflatePoint=function(d,c){return Phaser.Phaser.Rectangle.inflate(d,c.x,c.y)};Phaser.Rectangle.size=function(c,d){if(typeof d==="undefined"){d=new Phaser.Point()}return d.setTo(c.width,c.height)};Phaser.Rectangle.clone=function(c,d){if(typeof d==="undefined"){d=new Phaser.Rectangle()}return d.setTo(c.x,c.y,c.width,c.height)};Phaser.Rectangle.contains=function(d,c,e){return(c>=d.x&&c<=d.right&&e>=d.y&&e<=d.bottom)};Phaser.Rectangle.containsPoint=function(d,c){return Phaser.Phaser.Rectangle.contains(d,c.x,c.y)};Phaser.Rectangle.containsRect=function(d,c){if(d.volume>c.volume){return false}return(d.x>=c.x&&d.y>=c.y&&d.right<=c.right&&d.bottom<=c.bottom)};Phaser.Rectangle.equals=function(d,c){return(d.x==c.x&&d.y==c.y&&d.width==c.width&&d.height==c.height)};Phaser.Rectangle.intersection=function(d,c,e){e=e||new Phaser.Rectangle;if(Phaser.Rectangle.intersects(d,c)){e.x=Math.max(d.x,c.x);e.y=Math.max(d.y,c.y);e.width=Math.min(d.right,c.right)-e.x;e.height=Math.min(d.bottom,c.bottom)-e.y}return e};Phaser.Rectangle.intersects=function(d,c,e){e=e||0;return !(d.left>c.right+e||d.right<c.left-e||d.top>c.bottom+e||d.bottom<c.top-e)};Phaser.Rectangle.intersectsRaw=function(c,i,f,h,e,d){if(typeof d==="undefined"){d=0}return !(i>c.right+d||f<c.left-d||h>c.bottom+d||e<c.top-d)};Phaser.Rectangle.union=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Rectangle()}return e.setTo(Math.min(d.x,c.x),Math.min(d.y,c.y),Math.max(d.right,c.right),Math.max(d.bottom,c.bottom))};Phaser.Net=function(c){this.game=c};Phaser.Net.prototype={getHostName:function(){if(window.location&&window.location.hostname){return window.location.hostname}return null},checkDomainName:function(c){return window.location.hostname.indexOf(c)!==-1},updateQueryString:function(e,h,k,d){if(typeof k==="undefined"){k=false}if(typeof d==="undefined"){d=""}if(d==""){d=window.location.href}var c="";var f=new RegExp("([?|&])"+e+"=.*?(&|#|$)(.*)","gi");if(f.test(d)){if(typeof h!=="undefined"&&h!==null){c=d.replace(f,"$1"+e+"="+h+"$2$3")}else{c=d.replace(f,"$1$3").replace(/(&|\?)$/,"")}}else{if(typeof h!=="undefined"&&h!==null){var j=d.indexOf("?")!==-1?"&":"?";var i=d.split("#");d=i[0]+j+e+"="+h;if(i[1]){d+="#"+i[1]}c=d}else{c=d}}if(k){window.location.href=c}else{return c}},getQueryString:function(h){if(typeof h==="undefined"){h=""}var d={};var c=location.search.substring(1).split("&");for(var f in c){var e=c[f].split("=");if(e.length>1){if(h&&h==this.decodeURI(e[0])){return this.decodeURI(e[1])}else{d[this.decodeURI(e[0])]=this.decodeURI(e[1])}}}return d},decodeURI:function(c){return decodeURIComponent(c.replace(/\+/g," "))}};Phaser.TweenManager=function(c){this.game=c;this._tweens=[]};Phaser.TweenManager.prototype={REVISION:"11dev",getAll:function(){return this._tweens},removeAll:function(){this._tweens=[]},add:function(c){this._tweens.push(c)},create:function(c,d){if(typeof d==="undefined"){d=false}if(d){c.tween=new Phaser.Tween(c,this.game);return c.tween}else{return new Phaser.Tween(c,this.game)}},remove:function(d){var c=this._tweens.indexOf(d);if(c!==-1){this._tweens.splice(c,1)}},update:function(){if(this._tweens.length===0){return false}var c=0,d=this._tweens.length;while(c<d){if(this._tweens[c].update(this.game.time.now)){c++}else{this._tweens.splice(c,1);d--}}return true},pauseAll:function(){for(var c=this._tweens.length-1;c>=0;c--){this._tweens[c].pause()}},resumeAll:function(){for(var c=this._tweens.length-1;c>=0;c--){this._tweens[c].resume()}}};Phaser.Tween=function(d,c){this._object=d;this.game=c;this._manager=this.game.tweens;this._valuesStart={};this._valuesEnd={};this._valuesStartRepeat={};this._duration=1000;this._repeat=0;this._yoyo=false;this._reversed=false;this._delayTime=0;this._startTime=null;this._easingFunction=Phaser.Easing.Linear.None;this._interpolationFunction=Phaser.Math.linearInterpolation;this._chainedTweens=[];this._onStartCallback=null;this._onStartCallbackFired=false;this._onUpdateCallback=null;this._onCompleteCallback=null;this._pausedTime=0;for(var e in d){this._valuesStart[e]=parseFloat(d[e],10)}this.onStart=new Phaser.Signal();this.onComplete=new Phaser.Signal();this.isRunning=false};Phaser.Tween.prototype={to:function(e,i,j,d,c,h,f){i=i||1000;j=j||null;d=d||false;c=c||0;h=h||0;f=f||false;this._repeat=h;this._duration=i;this._valuesEnd=e;if(j!==null){this._easingFunction=j}if(c>0){this._delayTime=c}this._yoyo=f;if(d){return this.start()}else{return this}},start:function(d){if(this.game===null||this._object===null){return}this._manager.add(this);this.onStart.dispatch(this._object);this.isRunning=true;this._onStartCallbackFired=false;this._startTime=this.game.time.now+this._delayTime;for(var c in this._valuesEnd){if(this._valuesEnd[c] instanceof Array){if(this._valuesEnd[c].length===0){continue}this._valuesEnd[c]=[this._object[c]].concat(this._valuesEnd[c])}this._valuesStart[c]=this._object[c];if((this._valuesStart[c] instanceof Array)===false){this._valuesStart[c]*=1}this._valuesStartRepeat[c]=this._valuesStart[c]||0}return this},stop:function(){this._manager.remove(this);this.isRunning=false;return this},delay:function(c){this._delayTime=c;return this},repeat:function(c){this._repeat=c;return this},yoyo:function(c){this._yoyo=c;return this},easing:function(c){this._easingFunction=c;return this},interpolation:function(c){this._interpolationFunction=c;return this},chain:function(){this._chainedTweens=arguments;return this},onStart:function(c){this._onStartCallback=c;return this},onUpdate:function(c){this._onUpdateCallback=c;return this},onComplete:function(c){this._onCompleteCallback=c;return this},pause:function(){this._paused=true},resume:function(){this._paused=false;this._startTime+=this.game.time.pauseDuration},update:function(d){if(this._paused||d<this._startTime){return true}var l;if(d<this._startTime){return true}if(this._onStartCallbackFired===false){if(this._onStartCallback!==null){this._onStartCallback.call(this._object)}this._onStartCallbackFired=true}var m=(d-this._startTime)/this._duration;m=m>1?1:m;var k=this._easingFunction(m);for(l in this._valuesEnd){var c=this._valuesStart[l]||0;var e=this._valuesEnd[l];if(e instanceof Array){this._object[l]=this._interpolationFunction(e,k)}else{if(typeof(e)==="string"){e=c+parseFloat(e,10)}if(typeof(e)==="number"){this._object[l]=c+(e-c)*k}}}if(this._onUpdateCallback!==null){this._onUpdateCallback.call(this._object,k)}if(m==1){if(this._repeat>0){if(isFinite(this._repeat)){this._repeat--}for(l in this._valuesStartRepeat){if(typeof(this._valuesEnd[l])==="string"){this._valuesStartRepeat[l]=this._valuesStartRepeat[l]+parseFloat(this._valuesEnd[l],10)}if(this._yoyo){var f=this._valuesStartRepeat[l];this._valuesStartRepeat[l]=this._valuesEnd[l];this._valuesEnd[l]=f;this._reversed=!this._reversed}this._valuesStart[l]=this._valuesStartRepeat[l]}this._startTime=d+this._delayTime;this.onComplete.dispatch(this._object);if(this._onCompleteCallback!==null){this._onCompleteCallback.call(this._object)}return true}else{this.onComplete.dispatch(this._object);if(this._onCompleteCallback!==null){this._onCompleteCallback.call(this._object)}for(var h=0,j=this._chainedTweens.length;h<j;h++){this._chainedTweens[h].start(d)}return false}}return true}};Phaser.Easing={Linear:{None:function(c){return c}},Quadratic:{In:function(c){return c*c},Out:function(c){return c*(2-c)},InOut:function(c){if((c*=2)<1){return 0.5*c*c}return -0.5*(--c*(c-2)-1)}},Cubic:{In:function(c){return c*c*c},Out:function(c){return --c*c*c+1},InOut:function(c){if((c*=2)<1){return 0.5*c*c*c}return 0.5*((c-=2)*c*c+2)}},Quartic:{In:function(c){return c*c*c*c},Out:function(c){return 1-(--c*c*c*c)},InOut:function(c){if((c*=2)<1){return 0.5*c*c*c*c}return -0.5*((c-=2)*c*c*c-2)}},Quintic:{In:function(c){return c*c*c*c*c},Out:function(c){return --c*c*c*c*c+1},InOut:function(c){if((c*=2)<1){return 0.5*c*c*c*c*c}return 0.5*((c-=2)*c*c*c*c+2)}},Sinusoidal:{In:function(c){return 1-Math.cos(c*Math.PI/2)},Out:function(c){return Math.sin(c*Math.PI/2)},InOut:function(c){return 0.5*(1-Math.cos(Math.PI*c))}},Exponential:{In:function(c){return c===0?0:Math.pow(1024,c-1)},Out:function(c){return c===1?1:1-Math.pow(2,-10*c)},InOut:function(c){if(c===0){return 0}if(c===1){return 1}if((c*=2)<1){return 0.5*Math.pow(1024,c-1)}return 0.5*(-Math.pow(2,-10*(c-1))+2)}},Circular:{In:function(c){return 1-Math.sqrt(1-c*c)},Out:function(c){return Math.sqrt(1-(--c*c))},InOut:function(c){if((c*=2)<1){return -0.5*(Math.sqrt(1-c*c)-1)}return 0.5*(Math.sqrt(1-(c-=2)*c)+1)}},Elastic:{In:function(d){var e,c=0.1,f=0.4;if(d===0){return 0}if(d===1){return 1}if(!c||c<1){c=1;e=f/4}else{e=f*Math.asin(1/c)/(2*Math.PI)}return -(c*Math.pow(2,10*(d-=1))*Math.sin((d-e)*(2*Math.PI)/f))},Out:function(d){var e,c=0.1,f=0.4;if(d===0){return 0}if(d===1){return 1}if(!c||c<1){c=1;e=f/4}else{e=f*Math.asin(1/c)/(2*Math.PI)}return(c*Math.pow(2,-10*d)*Math.sin((d-e)*(2*Math.PI)/f)+1)},InOut:function(d){var e,c=0.1,f=0.4;if(d===0){return 0}if(d===1){return 1}if(!c||c<1){c=1;e=f/4}else{e=f*Math.asin(1/c)/(2*Math.PI)}if((d*=2)<1){return -0.5*(c*Math.pow(2,10*(d-=1))*Math.sin((d-e)*(2*Math.PI)/f))}return c*Math.pow(2,-10*(d-=1))*Math.sin((d-e)*(2*Math.PI)/f)*0.5+1}},Back:{In:function(c){var d=1.70158;return c*c*((d+1)*c-d)},Out:function(c){var d=1.70158;return --c*c*((d+1)*c+d)+1},InOut:function(c){var d=1.70158*1.525;if((c*=2)<1){return 0.5*(c*c*((d+1)*c-d))}return 0.5*((c-=2)*c*((d+1)*c+d)+2)}},Bounce:{In:function(c){return 1-TWEEN.Easing.Bounce.Out(1-c)},Out:function(c){if(c<(1/2.75)){return 7.5625*c*c}else{if(c<(2/2.75)){return 7.5625*(c-=(1.5/2.75))*c+0.75}else{if(c<(2.5/2.75)){return 7.5625*(c-=(2.25/2.75))*c+0.9375}else{return 7.5625*(c-=(2.625/2.75))*c+0.984375}}}},InOut:function(c){if(c<0.5){return TWEEN.Easing.Bounce.In(c*2)*0.5}return TWEEN.Easing.Bounce.Out(c*2-1)*0.5+0.5}}};Phaser.Time=function(c){this.game=c};Phaser.Time.prototype={game:null,_started:0,_timeLastSecond:0,_pauseStarted:0,physicsElapsed:0,time:0,pausedTime:0,now:0,elapsed:0,fps:0,fpsMin:1000,fpsMax:0,msMin:1000,msMax:0,frames:0,pauseDuration:0,timeToCall:0,lastTime:0,totalElapsedSeconds:function(){return(this.now-this._started)*0.001},update:function(c){this.now=c;this.timeToCall=Math.max(0,16-(c-this.lastTime));this.elapsed=this.now-this.time;this.msMin=Math.min(this.msMin,this.elapsed);this.msMax=Math.max(this.msMax,this.elapsed);this.frames++;if(this.now>this._timeLastSecond+1000){this.fps=Math.round((this.frames*1000)/(this.now-this._timeLastSecond));this.fpsMin=Math.min(this.fpsMin,this.fps);this.fpsMax=Math.max(this.fpsMax,this.fps);this._timeLastSecond=this.now;this.frames=0}this.time=this.now;this.lastTime=c+this.timeToCall;this.physicsElapsed=1*(this.elapsed/1000);if(this.game.paused){this.pausedTime=this.now-this._pauseStarted}},gamePaused:function(){this._pauseStarted=this.now},gameResumed:function(){this.elapsed=0;this.physicsElapsed=0;this.time=Date.now();this.pauseDuration=this.pausedTime},elapsedSince:function(c){return this.now-c},elapsedSecondsSince:function(c){return(this.now-c)*0.001},reset:function(){this._started=this.now}};Phaser.AnimationManager=function(c){this._frameData=null;this.currentFrame=null;this._parent=c;this.game=c.game;this._anims={}};Phaser.AnimationManager.prototype={updateIfVisible:true,loadFrameData:function(c){this._frameData=c;this.frame=0},add:function(f,h,e,d,c){h=h||null;e=e||60;d=d||false;c=c||true;if(this._frameData==null){console.warn("No frameData available for Phaser.Animation "+f);return}if(h==null){h=this._frameData.getFrameIndexes()}else{if(this.validateFrames(h,c)==false){console.warn("Invalid frames given to Phaser.Animation "+f);return}}if(c==false){h=this._frameData.getFrameIndexesByName(h)}this._anims[f]=new Phaser.Animation(this.game,this._parent,this._frameData,f,h,e,d);this.currentAnim=this._anims[f];this.currentFrame=this.currentAnim.currentFrame;this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);return this._anims[f]},validateFrames:function(e,c){for(var d=0;d<e.length;d++){if(c==true){if(e[d]>this._frameData.total){return false}}else{if(this._frameData.checkFrameName(e[d])==false){return false}}}return true},play:function(e,d,c){d=d||null;c=c||null;if(this._anims[e]){if(this.currentAnim==this._anims[e]){if(this.currentAnim.isPlaying==false){return this.currentAnim.play(d,c)}}else{this.currentAnim=this._anims[e];return this.currentAnim.play(d,c)}}},stop:function(c){if(this._anims[c]){this.currentAnim=this._anims[c];this.currentAnim.stop()}},update:function(){if(this.updateIfVisible&&this._parent.visible==false){return false}if(this.currentAnim&&this.currentAnim.update()==true){this.currentFrame=this.currentAnim.currentFrame;this._parent.currentFrame=this.currentFrame;return true}return false},destroy:function(){this._anims={};this._frameData=null;this._frameIndex=0;this.currentAnim=null;this.currentFrame=null}};Object.defineProperty(Phaser.AnimationManager.prototype,"frameData",{get:function(){return this._frameData},enumerable:true,configurable:true});Object.defineProperty(Phaser.AnimationManager.prototype,"frameTotal",{get:function(){if(this._frameData){return this._frameData.total}else{return -1}},enumerable:true,configurable:true});Object.defineProperty(Phaser.AnimationManager.prototype,"frame",{get:function(){if(this.currentFrame){return this._frameIndex}},set:function(c){if(this._frameData&&this._frameData.getFrame(c)!==null){this.currentFrame=this._frameData.getFrame(c);this._frameIndex=c;this._parent.currentFrame=this.currentFrame;this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}},enumerable:true,configurable:true});Object.defineProperty(Phaser.AnimationManager.prototype,"frameName",{get:function(){if(this.currentFrame){return this.currentFrame.name}},set:function(c){if(this._frameData&&this._frameData.getFrameByName(c)){this.currentFrame=this._frameData.getFrameByName(c);this._frameIndex=this.currentFrame.index;this._parent.currentFrame=this.currentFrame;this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}else{console.warn("Cannot set frameName: "+c)}},enumerable:true,configurable:true});Phaser.Animation=function(d,i,h,f,j,e,c){this.game=d;this._parent=i;this._frames=j;this._frameData=h;this.name=f;this.delay=1000/e;this.looped=c;this.isFinished=false;this.isPlaying=false;this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex])};Phaser.Animation.prototype={play:function(d,c){d=d||null;c=c||null;if(d!==null){this.delay=1000/d}if(c!==null){this.looped=c}this.isPlaying=true;this.isFinished=false;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.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);return this},restart:function(){this.isPlaying=true;this.isFinished=false;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])},stop:function(){this.isPlaying=false;this.isFinished=true},update:function(){if(this.isPlaying==true&&this.game.time.now>=this._timeNextFrame){this._frameIndex++;if(this._frameIndex==this._frames.length){if(this.looped){this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]);this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}else{this.onComplete()}}else{this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]);this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}this._timeLastFrame=this.game.time.now;this._timeNextFrame=this.game.time.now+this.delay;return true}return false},destroy:function(){this.game=null;this._parent=null;this._frames=null;this._frameData=null;this.currentFrame=null;this.isPlaying=false},onComplete:function(){this.isPlaying=false;this.isFinished=true}};Object.defineProperty(Phaser.Animation.prototype,"frameTotal",{get:function(){return this._frames.length},enumerable:true,configurable:true});Object.defineProperty(Phaser.Animation.prototype,"frame",{get:function(){if(this.currentFrame!==null){return this.currentFrame.index}else{return this._frameIndex}},set:function(c){this.currentFrame=this._frameData.getFrame(c);if(this.currentFrame!==null){this._frameIndex=c;this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}},enumerable:true,configurable:true});Phaser.Animation.Frame=function(d,i,h,c,e,f){this.x=d;this.y=i;this.width=h;this.height=c;this.sourceSizeW=h;this.sourceSizeH=c;this.centerX=Math.floor(h/2);this.centerY=Math.floor(c/2);this.name=e;this.uuid=f;this.distance=Phaser.Math.distance(0,0,h,c)};Phaser.Animation.Frame.prototype={uuid:"",x:0,y:0,width:0,height:0,centerX:0,centerY:0,distance:0,index:0,name:"",rotated:false,rotationDirection:"cw",trimmed:false,sourceSizeW:0,sourceSizeH:0,spriteSourceSizeX:0,spriteSourceSizeY:0,spriteSourceSizeW:0,spriteSourceSizeH:0,setTrim:function(h,f,j,d,c,e,i){this.trimmed=h;if(h){this.width=f;this.height=j;this.sourceSizeW=f;this.sourceSizeH=j;this.centerX=Math.floor(f/2);this.centerY=Math.floor(j/2);this.spriteSourceSizeX=d;this.spriteSourceSizeY=c;this.spriteSourceSizeW=e;this.spriteSourceSizeH=i}}};Phaser.Animation.FrameData=function(){};Phaser.Animation.FrameData.prototype={_frames:[],_frameNames:[],addFrame:function(c){c.index=this._frames.length;this._frames.push(c);if(c.name!==""){this._frameNames[c.name]=c.index}return c},getFrame:function(c){if(this._frames[c]){return this._frames[c]}return null},getFrameByName:function(c){if(this._frameNames[c]!==""){return this._frames[this._frameNames[c]]}return null},checkFrameName:function(c){if(this._frameNames[c]==null){return false}return true},getFrameRange:function(f,c,d){if(typeof d==="undefined"){d=[]}for(var e=f;e<=c;e++){d.push(this._frames[e])}return d},getFrameIndexes:function(c){if(typeof c==="undefined"){c=[]}for(var d=0;d<this._frames.length;d++){c.push(d)}return c},getFrameIndexesByName:function(d){var c=[];for(var e=0;e<d.length;e++){if(this.getFrameByName(d[e])){c.push(this.getFrameByName(d[e]).index)}}return c},getAllFrames:function(){return this._frames},getFrames:function(d){var c=[];for(var e=0;e<d.length;e++){c.push(this._frames[e])}return c}};Object.defineProperty(Phaser.Animation.FrameData.prototype,"total",{get:function(){return this._frames.length},enumerable:true,configurable:true});Phaser.Animation.Parser={spriteSheet:function(s,q,o,h,f){var l=s.cache.getImage(q);if(l==null){return null}var d=l.width;var t=l.height;var u=Math.round(d/o);var e=Math.round(t/h);var n=u*e;if(f!==-1){n=f}if(d==0||t==0||d<o||t<h||n===0){throw new Error("AnimationLoader.parseSpriteSheet: width/height zero or width/height < given frameWidth/frameHeight");return null}var k=new Phaser.Animation.FrameData();var p=0;var m=0;for(var j=0;j<n;j++){var c=s.rnd.uuid();k.addFrame(new Phaser.Animation.Frame(p,m,o,h,"",c));PIXI.TextureCache[c]=new PIXI.Texture(PIXI.BaseTextureCache[q],{x:p,y:m,width:o,height:h});p+=o;if(p===d){p=0;m+=h}}return k},JSONData:function(c,e,k){if(!e.frames){console.log(e);throw new Error("Phaser.AnimationLoader.parseJSONData: Invalid Texture Atlas JSON given, missing 'frames' array")}var h=new Phaser.Animation.FrameData();var j=e.frames;var l;for(var d=0;d<j.length;d++){var f=c.rnd.uuid();l=h.addFrame(new Phaser.Animation.Frame(j[d].frame.x,j[d].frame.y,j[d].frame.w,j[d].frame.h,j[d].filename,f));PIXI.TextureCache[f]=new PIXI.Texture(PIXI.BaseTextureCache[k],{x:j[key].frame.x,y:j[key].frame.y,width:j[key].frame.w,height:j[key].frame.h});if(j[d].trimmed){l.setTrim(j[d].trimmed,j[d].sourceSize.w,j[d].sourceSize.h,j[d].spriteSourceSize.x,j[d].spriteSourceSize.y,j[d].spriteSourceSize.w,j[d].spriteSourceSize.h);PIXI.TextureCache[f].realSize=j[key].spriteSourceSize;PIXI.TextureCache[f].trim.x=0}}return h},JSONDataHash:function(c,e,j){if(!e.frames){console.log(e);throw new Error("Phaser.AnimationLoader.parseJSONDataHash: Invalid Texture Atlas JSON given, missing 'frames' object")}var h=new Phaser.Animation.FrameData();var i=e.frames;var k;for(var d in i){var f=c.rnd.uuid();k=h.addFrame(new Phaser.Animation.Frame(i[d].frame.x,i[d].frame.y,i[d].frame.w,i[d].frame.h,d,f));PIXI.TextureCache[f]=new PIXI.Texture(PIXI.BaseTextureCache[j],{x:i[d].frame.x,y:i[d].frame.y,width:i[d].frame.w,height:i[d].frame.h});if(i[d].trimmed){k.setTrim(i[d].trimmed,i[d].sourceSize.w,i[d].sourceSize.h,i[d].spriteSourceSize.x,i[d].spriteSourceSize.y,i[d].spriteSourceSize.w,i[d].spriteSourceSize.h);PIXI.TextureCache[f].realSize=i[d].spriteSourceSize;PIXI.TextureCache[f].trim.x=0}}return h},XMLData:function(m,j,k){if(!j.getElementsByTagName("TextureAtlas")){throw new Error("Phaser.AnimationLoader.parseXMLData: Invalid Texture Atlas XML given, missing <TextureAtlas> tag")}var e=new Phaser.Animation.FrameData();var l=j.getElementsByTagName("SubTexture");var h;for(var f=0;f<l.length;f++){var c=m.rnd.uuid();var d=l[f].attributes;h=e.addFrame(new Phaser.Animation.Frame(d.x.nodeValue,d.y.nodeValue,d.width.nodeValue,d.height.nodeValue,d.name.nodeValue,c));PIXI.TextureCache[c]=new PIXI.Texture(PIXI.BaseTextureCache[k],{x:d.x.nodeValue,y:d.y.nodeValue,width:d.width.nodeValue,height:d.height.nodeValue});if(d.frameX.nodeValue!="-0"||d.frameY.nodeValue!="-0"){h.setTrim(true,d.width.nodeValue,d.height.nodeValue,Math.abs(d.frameX.nodeValue),Math.abs(d.frameY.nodeValue),d.frameWidth.nodeValue,d.frameHeight.nodeValue);PIXI.TextureCache[c].realSize={x:Math.abs(d.frameX.nodeValue),y:Math.abs(d.frameY.nodeValue),w:d.frameWidth.nodeValue,h:d.frameHeight.nodeValue};PIXI.TextureCache[c].trim.x=0}}return e}};Phaser.Cache=function(c){this.game=c};Phaser.Cache.prototype={game:null,_canvases:{},_images:{},_sounds:{},_text:{},addCanvas:function(e,c,d){this._canvases[e]={canvas:c,context:d}},addSpriteSheet:function(f,e,h,c,d,i){this._images[f]={url:e,data:h,spriteSheet:true,frameWidth:c,frameHeight:d};PIXI.BaseTextureCache[f]=new PIXI.BaseTexture(h);PIXI.TextureCache[f]=new PIXI.Texture(PIXI.BaseTextureCache[f]);this._images[f].frameData=Phaser.Animation.Parser.spriteSheet(this.game,f,c,d,i)},addTextureAtlas:function(e,d,f,c,h){this._images[e]={url:d,data:f,spriteSheet:true};PIXI.BaseTextureCache[e]=new PIXI.BaseTexture(f);PIXI.TextureCache[e]=new PIXI.Texture(PIXI.BaseTextureCache[e]);if(h==Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY){this._images[e].frameData=Phaser.Animation.Parser.JSONData(this.game,c,e)}else{if(h==Phaser.Loader.TEXTURE_ATLAS_JSON_HASH){this._images[e].frameData=Phaser.Animation.Parser.JSONDataHash(this.game,c,e)}else{if(h==Phaser.Loader.TEXTURE_ATLAS_XML_STARLING){this._images[e].frameData=Phaser.Animation.Parser.XMLData(this.game,c,e)}}}},addImage:function(d,c,e){this._images[d]={url:c,data:e,spriteSheet:false};this._images[d].frame=new Phaser.Animation.Frame(0,0,e.width,e.height,"","");PIXI.BaseTextureCache[d]=new PIXI.BaseTexture(e);PIXI.TextureCache[d]=new PIXI.Texture(PIXI.BaseTextureCache[d])},addSound:function(h,f,j,e,i){e=e||true;i=i||false;var d=this.game.sound.touchLocked;var c=false;if(i){c=true}this._sounds[h]={url:f,data:j,locked:d,isDecoding:false,decoded:c,webAudio:e,audioTag:i}},reloadSound:function(c){var d=this;if(this._sounds[c]){this._sounds[c].data.src=this._sounds[c].url;this._sounds[c].data.addEventListener("canplaythrough",function(){return d.reloadSoundComplete(c)},false);this._sounds[c].data.load()}},reloadSoundComplete:function(c){if(this._sounds[c]){this._sounds[c].locked=false;this.onSoundUnlock.dispatch(c)}},updateSound:function(c,e,d){if(this._sounds[c]){this._sounds[c][e]=d}},decodedSound:function(c,d){this._sounds[c].data=d;this._sounds[c].decoded=true;this._sounds[c].isDecoding=false},addText:function(d,c,e){this._text[d]={url:c,data:e}},getCanvas:function(c){if(this._canvases[c]){return this._canvases[c].canvas}return null},getImage:function(c){if(this._images[c]){return this._images[c].data}return null},getFrameData:function(c){if(this._images[c]&&this._images[c].frameData){return this._images[c].frameData}return null},getFrame:function(c){if(this._images[c]&&this._images[c].spriteSheet==false){return this._images[c].frame}return null},getSound:function(c){if(this._sounds[c]){return this._sounds[c]}return null},getSoundData:function(c){if(this._sounds[c]){return this._sounds[c].data}return null},isSoundDecoded:function(c){if(this._sounds[c]){return this._sounds[c].decoded}},isSoundReady:function(c){return(this._sounds[c]&&this._sounds[c].decoded==true&&this._sounds[c].locked==false)},isSpriteSheet:function(c){if(this._images[c]){return this._images[c].spriteSheet}return false},getText:function(c){if(this._text[c]){return this._text[c].data}return null},getKeys:function(e){var c=[];for(var d in e){c.push(d)}return c},getImageKeys:function(){return this.getKeys(this._images)},getSoundKeys:function(){return this.getKeys(this._sounds)},getTextKeys:function(){return this.getKeys(this._text)},removeCanvas:function(c){delete this._canvases[c]},removeImage:function(c){delete this._images[c]},removeSound:function(c){delete this._sounds[c]},removeText:function(c){delete this._text[c]},destroy:function(){for(var c in this._canvases){delete this._canvases[c.key]}for(var c in this._images){delete this._images[c.key]}for(var c in this._sounds){delete this._sounds[c.key]}for(var c in this._text){delete this._text[c.key]}}};Phaser.Loader=function(c){this.game=c;this._xhr=new XMLHttpRequest();this.onFileComplete=new Phaser.Signal;this.onFileError=new Phaser.Signal;this.onLoadStart=new Phaser.Signal;this.onLoadComplete=new Phaser.Signal};Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY=0;Phaser.Loader.TEXTURE_ATLAS_JSON_HASH=1;Phaser.Loader.TEXTURE_ATLAS_XML_STARLING=2;Phaser.Loader.prototype={game:null,_keys:[],_fileList:{},_progressChunk:0,_xhr:null,queueSize:0,isLoading:false,hasLoaded:false,progress:0,crossOrigin:"",baseURL:"",onFileComplete:null,onFileError:null,onLoadStart:null,onLoadComplete:null,checkKeyExists:function(c){if(this._fileList[c]){return true}else{return false}},reset:function(){this.queueSize=0;this.isLoading=false},addToFileList:function(f,e,c,d){var h={type:f,key:e,url:c,data:null,error:false,loaded:false};if(typeof d!=="undefined"){for(var i in d){h[i]=d[i]}}this._fileList[e]=h;this._keys.push(e);this.queueSize++},image:function(e,d,c){if(typeof c==="undefined"){c=false}if(c||this.checkKeyExists(e)==false){this.addToFileList("image",e,d)}},text:function(e,d,c){if(typeof c==="undefined"){c=false}if(c||this.checkKeyExists(e)==false){this.addToFileList("text",e,d)}},spritesheet:function(f,e,c,d,h){if(typeof h==="undefined"){h=-1}if(this.checkKeyExists(f)===false){this.addToFileList("spritesheet",f,e,{frameWidth:c,frameHeight:d,frameMax:h})}},audio:function(d,e,c){if(typeof c==="undefined"){c=true}if(this.checkKeyExists(d)===false){this.addToFileList("audio",d,e,{buffer:null,autoDecode:c})}},atlasJSONArray:function(e,d,f,c){if(typeof f==="undefined"){f=null}if(typeof c==="undefined"){c=null}this.atlas(e,d,f,c,Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY)},atlasJSONHash:function(e,d,f,c){if(typeof f==="undefined"){f=null}if(typeof c==="undefined"){c=null}this.atlas(e,d,f,c,Phaser.Loader.TEXTURE_ATLAS_JSON_HASH)},atlasXML:function(e,d,f,c){if(typeof f==="undefined"){f=null}if(typeof c==="undefined"){c=null}this.atlas(e,d,f,c,Phaser.Loader.TEXTURE_ATLAS_XML_STARLING)},atlas:function(h,f,i,c,k){if(typeof i==="undefined"){i=null}if(typeof c==="undefined"){c=null}if(typeof k==="undefined"){k=Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY}if(this.checkKeyExists(h)===false){if(i){this.addToFileList("textureatlas",h,f,{atlasURL:i,format:k})}else{switch(k){case Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY:if(typeof c==="string"){c=JSON.parse(c)}break;case Phaser.Loader.TEXTURE_ATLAS_XML_STARLING:if(typeof c==="string"){var d;try{if(window.DOMParser){var l=new DOMParser();d=l.parseFromString(c,"text/xml")}else{d=new ActiveXObject("Microsoft.XMLDOM");d.async="false";d.loadXML(c)}}catch(j){d=undefined}if(!d||!d.documentElement||d.getElementsByTagName("parsererror").length){throw new Error("Phaser.Loader. Invalid Texture Atlas XML given")}else{c=d}}break}this.addToFileList("textureatlas",h,f,{atlasURL:null,atlasData:c,format:k})}}},removeFile:function(c){delete this._fileList[c]},removeAll:function(){this._fileList={}},start:function(){if(this.isLoading){return}this.progress=0;this.hasLoaded=false;this.isLoading=true;this.onLoadStart.dispatch(this.queueSize);if(this._keys.length>0){this._progressChunk=100/this._keys.length;this.loadFile()}else{this.progress=100;this.hasLoaded=true;this.onLoadComplete.dispatch()}},loadFile:function(){var c=this._fileList[this._keys.shift()];var d=this;switch(c.type){case"image":case"spritesheet":case"textureatlas":c.data=new Image();c.data.name=c.key;c.data.onload=function(){return d.fileComplete(c.key)};c.data.onerror=function(){return d.fileError(c.key)};c.data.crossOrigin=this.crossOrigin;c.data.src=this.baseURL+c.url;break;case"audio":c.url=this.getAudioURL(c.url);if(c.url!==null){if(this.game.sound.usingWebAudio){this._xhr.open("GET",this.baseURL+c.url,true);this._xhr.responseType="arraybuffer";this._xhr.onload=function(){return d.fileComplete(c.key)};this._xhr.onerror=function(){return d.fileError(c.key)};this._xhr.send()}else{if(this.game.sound.usingAudioTag){if(this.game.sound.touchLocked){c.data=new Audio();c.data.name=c.key;c.data.preload="auto";c.data.src=this.baseURL+c.url;this.fileComplete(c.key)}else{c.data=new Audio();c.data.name=c.key;c.data.onerror=function(){return d.fileError(c.key)};c.data.preload="auto";c.data.src=this.baseURL+c.url;c.data.addEventListener("canplaythrough",Phaser.GAMES[this.game.id].load.fileComplete(c.key),false);c.data.load()}}}}break;case"text":this._xhr.open("GET",this.baseURL+c.url,true);this._xhr.responseType="text";this._xhr.onload=function(){return d.fileComplete(c.key)};this._xhr.onerror=function(){return d.fileError(c.key)};this._xhr.send();break}},getAudioURL:function(d){var e;for(var c=0;c<d.length;c++){e=d[c].toLowerCase();e=e.substr((Math.max(0,e.lastIndexOf("."))||Infinity)+1);if(this.game.device.canPlayAudio(e)){return d[c]}}return null},fileError:function(c){this._fileList[c].loaded=true;this._fileList[c].error=true;this.onFileError.dispatch(c);console.warn("Phaser.Loader error loading file: "+c);this.nextFile(c,false)},fileComplete:function(d){if(!this._fileList[d]){console.warn("Phaser.Loader fileComplete invalid key "+d);return}this._fileList[d].loaded=true;var c=this._fileList[d];var f=true;var h=this;switch(c.type){case"image":this.game.cache.addImage(c.key,c.url,c.data);break;case"spritesheet":this.game.cache.addSpriteSheet(c.key,c.url,c.data,c.frameWidth,c.frameHeight,c.frameMax);break;case"textureatlas":if(c.atlasURL==null){this.game.cache.addTextureAtlas(c.key,c.url,c.data,c.atlasData,c.format)}else{f=false;this._xhr.open("GET",this.baseURL+c.atlasURL,true);this._xhr.responseType="text";if(c.format==Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY||c.format==Phaser.Loader.TEXTURE_ATLAS_JSON_HASH){this._xhr.onload=function(){return h.jsonLoadComplete(c.key)}}else{if(c.format==Phaser.Loader.TEXTURE_ATLAS_XML_STARLING){this._xhr.onload=function(){return h.xmlLoadComplete(c.key)}}}this._xhr.onerror=function(){return h.dataLoadError(c.key)};this._xhr.send()}break;case"audio":if(this.game.sound.usingWebAudio){c.data=this._xhr.response;this.game.cache.addSound(c.key,c.url,c.data,true,false);if(c.autoDecode){this.game.cache.updateSound(d,"isDecoding",true);var e=this;var d=c.key;this.game.sound.context.decodeAudioData(c.data,function(i){if(i){e.game.cache.decodedSound(d,i)}})}}else{c.data.removeEventListener("canplaythrough",Phaser.GAMES[this.game.id].load.fileComplete);this.game.cache.addSound(c.key,c.url,c.data,false,true)}break;case"text":c.data=this._xhr.response;this.game.cache.addText(c.key,c.url,c.data);break}if(f){this.nextFile(d,true)}},jsonLoadComplete:function(d){var e=JSON.parse(this._xhr.response);var c=this._fileList[d];this.game.cache.addTextureAtlas(c.key,c.url,c.data,e,c.format);this.nextFile(d,true)},dataLoadError:function(d){var c=this._fileList[d];c.error=true;throw new Error("Phaser.Loader dataLoadError: "+d);this.nextFile(d,true)},xmlLoadComplete:function(h){var c=this._xhr.response;var d;try{if(window.DOMParser){var j=new DOMParser();d=j.parseFromString(c,"text/xml")}else{d=new ActiveXObject("Microsoft.XMLDOM");d.async="false";d.loadXML(c)}}catch(i){d=undefined}if(!d||!d.documentElement||d.getElementsByTagName("parsererror").length){throw new Error("Phaser.Loader. Invalid XML given")}var f=this._fileList[h];this.game.cache.addTextureAtlas(f.key,f.url,f.data,d,f.format);this.nextFile(h,true)},nextFile:function(c,d){this.progress=Math.round(this.progress+this._progressChunk);if(this.progress>100){this.progress=100}this.onFileComplete.dispatch(this.progress,c,d,this.queueSize-this._keys.length,this.queueSize);if(this._keys.length>0){this.loadFile()}else{this.hasLoaded=true;this.isLoading=false;this.removeAll();this.onLoadComplete.dispatch()}}};Phaser.Sound=function(d,e,f,c){f=f||1;c=c||false;this.game=d;this.key=e;this._volume=f;this.loop=c;this.usingWebAudio=this.game.sound.usingWebAudio;this.usingAudioTag=this.game.sound.usingAudioTag;if(this.usingWebAudio){this.context=this.game.sound.context;this.masterGainNode=this.game.sound.masterGain;if(typeof this.context.createGain==="undefined"){this.gainNode=this.context.createGainNode()}else{this.gainNode=this.context.createGain()}this.gainNode.gain.value=f*this.game.sound.volume;this.gainNode.connect(this.masterGainNode)}else{if(this.game.cache.getSound(e)&&this.game.cache.getSound(e).locked==false){this._sound=this.game.cache.getSoundData(e);this.totalDuration=this._sound.duration}else{this.game.cache.onSoundUnlock.add(this.soundHasUnlocked,this)}}this.onDecoded=new Phaser.Signal;this.onPlay=new Phaser.Signal;this.onPause=new Phaser.Signal;this.onResume=new Phaser.Signal;this.onLoop=new Phaser.Signal;this.onStop=new Phaser.Signal;this.onMute=new Phaser.Signal;this.onMarkerComplete=new Phaser.Signal};Phaser.Sound.prototype={game:null,context:null,_buffer:null,_muted:false,key:"",name:"",markers:{},usingWebAudio:false,usingAudioTag:false,autoplay:false,totalDuration:0,startTime:0,currentTime:0,duration:0,stopTime:0,paused:false,loop:false,isPlaying:false,currentMarker:"",pendingPlayback:false,override:false,onDecoded:null,onPlay:null,onPause:null,onResume:null,onLoop:null,onStop:null,onMute:null,onMarkerComplete:null,soundHasUnlocked:function(c){if(c==this.key){this._sound=this.game.cache.getSoundData(this.key);this.totalDuration=this._sound.duration;console.log("sound has unlocked",this._sound)}},addMarker:function(d,h,e,f,c){f=f||1;c=c||false;this.markers[d]={name:d,start:h,stop:e,volume:f,duration:e-h,loop:c}},removeMarker:function(c){delete this.markers[c]},update:function(){if(this.pendingPlayback&&this.game.cache.isSoundReady(this.key)){this.pendingPlayback=false;this.play(this._tempMarker,this._tempPosition,this._tempVolume,this._tempLoop)}if(this.isPlaying){this.currentTime=this.game.time.now-this.startTime;if(this.currentTime>=this.duration){if(this.usingWebAudio){if(this.loop){this.onLoop.dispatch(this);if(this.currentMarker==""){this.currentTime=0;this.startTime=this.game.time.now}else{this.play(this.currentMarker,0,this.volume,true,true)}}else{this.stop()}}else{if(this.loop){this.onLoop.dispatch(this);this.play(this.currentMarker,0,this.volume,true,true)}else{this.stop()}}}}},play:function(e,c,h,d,f){e=e||"";c=c||0;h=h||1;d=d||false;f=f||false;console.log("play",e,"current is",this.currentMarker);if(this.isPlaying==true&&f==false&&this.override==false){return}if(this.isPlaying&&this.override){if(this.usingWebAudio){if(typeof this._sound.stop==="undefined"){this._sound.noteOff(0)}else{this._sound.stop(0)}}else{if(this.usingAudioTag){this._sound.pause();this._sound.currentTime=0}}}this.currentMarker=e;if(e!==""&&this.markers[e]){this.position=this.markers[e].start;this.volume=this.markers[e].volume;this.loop=this.markers[e].loop;this.duration=this.markers[e].duration*1000;this._tempMarker=e;this._tempPosition=this.position;this._tempVolume=this.volume;this._tempLoop=this.loop}else{this.position=c;this.volume=h;this.loop=d;this.duration=0;this._tempMarker=e;this._tempPosition=c;this._tempVolume=h;this._tempLoop=d}if(this.usingWebAudio){if(this.game.cache.isSoundDecoded(this.key)){if(this._buffer==null){this._buffer=this.game.cache.getSoundData(this.key)}this._sound=this.context.createBufferSource();this._sound.buffer=this._buffer;this._sound.connect(this.gainNode);this.totalDuration=this._sound.buffer.duration;if(this.duration==0){this.duration=this.totalDuration*1000}if(this.loop&&e==""){this._sound.loop=true}if(typeof this._sound.start==="undefined"){this._sound.noteGrainOn(0,this.position,this.duration/1000)}else{this._sound.start(0,this.position,this.duration/1000)}this.isPlaying=true;this.startTime=this.game.time.now;this.currentTime=0;this.stopTime=this.startTime+this.duration;this.onPlay.dispatch(this)}else{this.pendingPlayback=true;if(this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).isDecoding==false){this.game.sound.decode(this.key,this)}}}else{if(this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).locked){this.game.cache.reloadSound(this.key);this.pendingPlayback=true}else{if(this._sound&&this._sound.readyState==4){if(this.duration==0){this.duration=this.totalDuration*1000}this._sound.currentTime=this.position;this._sound.muted=this._muted;if(this._muted){this._sound.volume=0}else{this._sound.volume=this._volume}this._sound.play();this.isPlaying=true;this.startTime=this.game.time.now;this.currentTime=0;this.stopTime=this.startTime+this.duration;this.onPlay.dispatch(this)}else{this.pendingPlayback=true}}}},restart:function(e,c,f,d){e=e||"";c=c||0;f=f||1;d=d||false;this.play(e,c,f,d,true)},pause:function(){if(this.isPlaying&&this._sound){this.stop();this.isPlaying=false;this.paused=true;this.onPause.dispatch(this)}},resume:function(){if(this.paused&&this._sound){if(this.usingWebAudio){if(typeof this._sound.start==="undefined"){this._sound.noteGrainOn(0,this.position,this.duration)}else{this._sound.start(0,this.position,this.duration)}}else{this._sound.play()}this.isPlaying=true;this.paused=false;this.onResume.dispatch(this)}},stop:function(){if(this.isPlaying&&this._sound){if(this.usingWebAudio){if(typeof this._sound.stop==="undefined"){this._sound.noteOff(0)}else{this._sound.stop(0)}}else{if(this.usingAudioTag){this._sound.pause();this._sound.currentTime=0}}}this.isPlaying=false;var c=this.currentMarker;this.currentMarker="";this.onStop.dispatch(this,c)}};Object.defineProperty(Phaser.Sound.prototype,"isDecoding",{get:function(){return this.game.cache.getSound(this.key).isDecoding},enumerable:true,configurable:true});Object.defineProperty(Phaser.Sound.prototype,"isDecoded",{get:function(){return this.game.cache.isSoundDecoded(this.key)},enumerable:true,configurable:true});Object.defineProperty(Phaser.Sound.prototype,"mute",{get:function(){return this._muted},set:function(c){c=c||null;if(c){this._muted=true;if(this.usingWebAudio){this._muteVolume=this.gainNode.gain.value;this.gainNode.gain.value=0}else{if(this.usingAudioTag&&this._sound){this._muteVolume=this._sound.volume;this._sound.volume=0}}}else{this._muted=false;if(this.usingWebAudio){this.gainNode.gain.value=this._muteVolume}else{if(this.usingAudioTag&&this._sound){this._sound.volume=this._muteVolume}}}this.onMute.dispatch(this)},enumerable:true,configurable:true});Object.defineProperty(Phaser.Sound.prototype,"volume",{get:function(){return this._volume},set:function(c){this._volume=c;if(this.usingWebAudio){this.gainNode.gain.value=c}else{if(this.usingAudioTag&&this._sound){this._sound.volume=c}}},enumerable:true,configurable:true});Phaser.SoundManager=function(c){this.game=c;this.onSoundDecode=new Phaser.Signal;if(this.game.device.iOS&&this.game.device.webAudio==false){this.channels=1}if(c.device.iOS||(window.PhaserGlobal&&window.PhaserGlobal.fakeiOSTouchLock)){this.game.input.touch.callbackContext=this;this.game.input.touch.touchStartCallback=this.unlock;this.game.input.mouse.callbackContext=this;this.game.input.mouse.mouseDownCallback=this.unlock;this.touchLocked=true}else{this.touchLocked=false}if(window.PhaserGlobal){if(window.PhaserGlobal.disableAudio==true){this.usingWebAudio=false;this.noAudio=true;return}if(window.PhaserGlobal.disableWebAudio==true){this.usingWebAudio=false;this.usingAudioTag=true;this.noAudio=false;return}}if(!!window.AudioContext){this.context=new window.AudioContext()}else{if(!!window.webkitAudioContext){this.context=new window.webkitAudioContext()}else{if(!!window.Audio){this.usingWebAudio=false;this.usingAudioTag=true}else{this.usingWebAudio=false;this.noAudio=true}}}if(this.context!==null){if(typeof this.context.createGain==="undefined"){this.masterGain=this.context.createGainNode()}else{this.masterGain=this.context.createGain()}this.masterGain.gain.value=1;this.masterGain.connect(this.context.destination)}};Phaser.SoundManager.prototype={game:null,_muted:false,_unlockSource:null,_volume:1,_muted:false,_sounds:[],context:null,usingWebAudio:true,usingAudioTag:false,noAudio:false,touchLocked:false,onSoundDecode:null,channels:32,unlock:function(){if(this.touchLocked==false){return}console.log("SoundManager touch unlocked");if(this.game.device.webAudio&&(window.PhaserGlobal&&window.PhaserGlobal.disableWebAudio==false)){var c=this.context.createBuffer(1,1,22050);this._unlockSource=this.context.createBufferSource();this._unlockSource.buffer=c;this._unlockSource.connect(this.context.destination);this._unlockSource.noteOn(0)}else{this.touchLocked=false;this._unlockSource=null;this.game.input.touch.callbackContext=null;this.game.input.touch.touchStartCallback=null;this.game.input.mouse.callbackContext=null;this.game.input.mouse.mouseDownCallback=null}},stopAll:function(){for(var c=0;c<this._sounds.length;c++){if(this._sounds[c]){this._sounds[c].stop()}}},pauseAll:function(){for(var c=0;c<this._sounds.length;c++){if(this._sounds[c]){this._sounds[c].pause()}}},resumeAll:function(){for(var c=0;c<this._sounds.length;c++){if(this._sounds[c]){this._sounds[c].resume()}}},decode:function(d,f){f=f||null;var c=this.game.cache.getSoundData(d);if(c){if(this.game.cache.isSoundDecoded(d)===false){this.game.cache.updateSound(d,"isDecoding",true);var e=this;this.context.decodeAudioData(c,function(h){e.game.cache.decodedSound(d,h);if(f){e.onSoundDecode.dispatch(f)}})}}},update:function(){if(this.touchLocked){if(this.game.device.webAudio&&this._unlockSource!==null){if((this._unlockSource.playbackState===this._unlockSource.PLAYING_STATE||this._unlockSource.playbackState===this._unlockSource.FINISHED_STATE)){this.touchLocked=false;this._unlockSource=null;this.game.input.touch.callbackContext=null;this.game.input.touch.touchStartCallback=null}}}for(var c=0;c<this._sounds.length;c++){this._sounds[c].update()}},add:function(d,e,c){e=e||1;c=c||false;var f=new Phaser.Sound(this.game,d,e,c);this._sounds.push(f);return f}};Object.defineProperty(Phaser.SoundManager.prototype,"mute",{get:function(){return this._muted},set:function(d){d=d||null;if(d){if(this._muted){return}this._muted=true;if(this.usingWebAudio){this._muteVolume=this.masterGain.gain.value;this.masterGain.gain.value=0}for(var c=0;c<this._sounds.length;c++){if(this._sounds[c].usingAudioTag){this._sounds[c].mute=true}}}else{if(this._muted==false){return}this._muted=false;if(this.usingWebAudio){this.masterGain.gain.value=this._muteVolume}for(var c=0;c<this._sounds.length;c++){if(this._sounds[c].usingAudioTag){this._sounds[c].mute=false}}}},enumerable:true,configurable:true});Object.defineProperty(Phaser.SoundManager.prototype,"volume",{get:function(){if(this.usingWebAudio){return this.masterGain.gain.value}else{return this._volume}},set:function(d){d=this.game.math.clamp(d,1,0);this._volume=d;if(this.usingWebAudio){this.masterGain.gain.value=d}for(var c=0;c<this._sounds.length;c++){if(this._sounds[c].usingAudioTag){this._sounds[c].volume=this._sounds[c].volume*d}}},enumerable:true,configurable:true});Phaser.Utils={};Phaser.Utils.Debug=function(c){this.game=c;this.context=c.context};Phaser.Utils.Debug.prototype={font:"14px Courier",lineHeight:16,renderShadow:true,currentX:0,currentY:0,currentAlpha:1,context:null,start:function(c,e,d){if(this.context==null){return}c=c||null;e=e||null;d=d||"rgb(255,255,255)";if(c&&e){this.currentX=c;this.currentY=e;this.currentColor=d}this.currentAlpha=this.context.globalAlpha;this.context.save();this.context.setTransform(1,0,0,1,0,0);this.context.fillStyle=d;this.context.font=this.font;this.context.globalAlpha=1},stop:function(){this.context.restore();this.context.globalAlpha=this.currentAlpha},line:function(d,c,e){if(this.context==null){return}c=c||null;e=e||null;if(c!==null){this.currentX=c}if(e!==null){this.currentY=e}if(this.renderShadow){this.context.fillStyle="rgb(0,0,0)";this.context.fillText(d,this.currentX+1,this.currentY+1);this.context.fillStyle=this.currentColor}this.context.fillText(d,this.currentX,this.currentY);this.currentY+=this.lineHeight},renderQuadTree:function(c,d){d=d||"rgba(255,0,0,0.3)";this.start();var f=c.bounds;if(c.nodes.length===0){this.context.strokeStyle=d;this.context.strokeRect(f.x,f.y,f.width,f.height);this.renderText(c.ID+" / "+c.objects.length,f.x+4,f.y+16,"rgb(0,200,0)","12px Courier")}else{for(var e=0;e<c.nodes.length;e++){this.renderQuadTree(c.nodes[e])}}this.stop()},renderSpriteCorners:function(f,e,d,c){if(this.context==null){return}e=e||false;d=d||false;c=c||"rgb(255,0,255)";this.start(0,0,c);if(d){this.context.strokeStyle="rgba(255,0,255,0.5)";this.context.strokeRect(f.bounds.x,f.bounds.y,f.bounds.width,f.bounds.height);this.context.stroke()}this.context.beginPath();this.context.moveTo(f.topLeft.x,f.topLeft.y);this.context.lineTo(f.topRight.x,f.topRight.y);this.context.lineTo(f.bottomRight.x,f.bottomRight.y);this.context.lineTo(f.bottomLeft.x,f.bottomLeft.y);this.context.closePath();this.context.strokeStyle="rgba(0,0,255,0.8)";this.context.stroke();this.renderPoint(f.center);this.renderPoint(f.topLeft);this.renderPoint(f.topRight);this.renderPoint(f.bottomLeft);this.renderPoint(f.bottomRight);if(e){this.currentColor=c;this.line("x: "+Math.floor(f.topLeft.x)+" y: "+Math.floor(f.topLeft.y),f.topLeft.x,f.topLeft.y);this.line("x: "+Math.floor(f.topRight.x)+" y: "+Math.floor(f.topRight.y),f.topRight.x,f.topRight.y);this.line("x: "+Math.floor(f.bottomLeft.x)+" y: "+Math.floor(f.bottomLeft.y),f.bottomLeft.x,f.bottomLeft.y);this.line("x: "+Math.floor(f.bottomRight.x)+" y: "+Math.floor(f.bottomRight.y),f.bottomRight.x,f.bottomRight.y)}this.stop()},renderSoundInfo:function(e,c,f,d){if(this.context==null){return}d=d||"rgb(255,255,255)";this.start(c,f,d);this.line("Sound: "+e.key+" Locked: "+e.game.sound.touchLocked+" Pending Playback: "+e.pendingPlayback);this.line("Decoded: "+e.isDecoded+" Decoding: "+e.isDecoding);this.line("Total Duration: "+e.totalDuration+" Playing: "+e.isPlaying);this.line("Time: "+e.currentTime);this.line("Volume: "+e.volume+" Muted: "+e.mute);this.line("WebAudio: "+e.usingWebAudio+" Audio: "+e.usingAudioTag);if(e.currentMarker!==""){this.line("Marker: "+e.currentMarker+" Duration: "+e.duration);this.line("Start: "+e.markers[e.currentMarker].start+" Stop: "+e.markers[e.currentMarker].stop);this.line("Position: "+e.position)}this.stop()},renderCameraInfo:function(e,c,f,d){if(this.context==null){return}d=d||"rgb(255,255,0)";this.start(c,f,d);this.line("Camera ("+e.width+" x "+e.height+")");this.line("X: "+e.x+" Y: "+e.y);this.stop()},renderPointer:function(h,f,d,e,c){if(this.context==null||h==null){return}f=f||false;d=d||"rgba(0,255,0,0.5)";e=e||"rgba(255,0,0,0.5)";c=c||"rgb(255,255,255)";if(f==true&&h.isUp==true){return}this.start(h.x,h.y-100,c);this.context.beginPath();this.context.arc(h.x,h.y,h.circle.radius,0,Math.PI*2);if(h.active){this.context.fillStyle=d}else{this.context.fillStyle=e}this.context.fill();this.context.closePath();this.context.beginPath();this.context.moveTo(h.positionDown.x,h.positionDown.y);this.context.lineTo(h.position.x,h.position.y);this.context.lineWidth=2;this.context.stroke();this.context.closePath();this.line("ID: "+h.id+" Active: "+h.active);this.line("World X: "+h.worldX+" World Y: "+h.worldY);this.line("Screen X: "+h.x+" Screen Y: "+h.y);this.line("Duration: "+h.duration+" ms");this.stop()},renderSpriteInputInfo:function(e,c,f,d){d=d||"rgb(255,255,255)";this.start(c,f,d);this.line("Sprite Input: ("+e.width+" x "+e.height+")");this.line("x: "+e.input.pointerX().toFixed(1)+" y: "+e.input.pointerY().toFixed(1));this.line("over: "+e.input.pointerOver()+" duration: "+e.input.overDuration().toFixed(0));this.line("down: "+e.input.pointerDown()+" duration: "+e.input.downDuration().toFixed(0));this.line("just over: "+e.input.justOver()+" just out: "+e.input.justOut());this.stop()},renderInputInfo:function(c,e,d){if(this.context==null){return}d=d||"rgb(255,255,0)";this.start(c,e,d);this.line("Input");this.line("X: "+this.game.input.x+" Y: "+this.game.input.y);this.line("World X: "+this.game.input.worldX+" World Y: "+this.game.input.worldY);this.line("Scale X: "+this.game.input.scale.x.toFixed(1)+" Scale Y: "+this.game.input.scale.x.toFixed(1));this.line("Screen X: "+this.game.input.activePointer.screenX+" Screen Y: "+this.game.input.activePointer.screenY);this.stop()},renderSpriteInfo:function(e,c,f,d){if(this.context==null){return}d=d||"rgb(255, 255, 255)";this.start(c,f,d);this.line("Sprite: ("+e.width+" x "+e.height+") anchor: "+e.anchor.x+" x "+e.anchor.y);this.line("x: "+e.x.toFixed(1)+" y: "+e.y.toFixed(1)+" rotation: "+e.rotation.toFixed(1));this.line("visible: "+e.visible);this.line("in camera: "+e.inCamera)},renderWorldTransformInfo:function(e,c,f,d){if(this.context==null){return}d=d||"rgb(255, 255, 255)";this.start(c,f,d);this.line("World Transform");this.line("skewX: "+e.worldTransform[3]);this.line("skewY: "+e.worldTransform[1]);this.line("scaleX: "+e.worldTransform[0]);this.line("scaleY: "+e.worldTransform[4]);this.line("transX: "+e.worldTransform[2]);this.line("transY: "+e.worldTransform[5])},renderLocalTransformInfo:function(e,c,f,d){if(this.context==null){return}d=d||"rgb(255, 255, 255)";this.start(c,f,d);this.line("Local Transform");this.line("skewX: "+e.localTransform[3]);this.line("skewY: "+e.localTransform[1]);this.line("scaleX: "+e.localTransform[0]);this.line("scaleY: "+e.localTransform[4]);this.line("transX: "+e.localTransform[2]);this.line("transY: "+e.localTransform[5]);this.line("sX: "+e._sx);this.line("sY: "+e._sy)},renderPointInfo:function(d,c,f,e){if(this.context==null){return}e=e||"rgb(255, 255, 255)";this.start(c,f,e);this.line("px: "+d.x.toFixed(1)+" py: "+d.y.toFixed(1));this.stop()},renderSpriteBounds:function(d,c){if(this.context==null){return}c=c||"rgba(0, 255, 0, 0.2)";this.start();this.context.fillStyle=c;this.context.fillRect(d.worldView.x,d.worldView.y,d.worldView.width,d.worldView.height);this.stop()},renderPixel:function(c,e,d){if(this.context==null){return}d=d||"rgba(0,255,0,1)";this.start();this.context.fillStyle=d;this.context.fillRect(c,e,2,2);this.stop()},renderPoint:function(c,d){if(this.context==null){return}d=d||"rgba(0,255,0,1)";this.start();this.context.fillStyle=d;this.context.fillRect(c.x,c.y,4,4);this.stop()},renderRectangle:function(d,c){if(this.context==null){return}c=c||"rgba(0,255,0,0.3)";this.start();this.context.fillStyle=c;this.context.fillRect(d.x,d.y,d.width,d.height);this.stop()},renderCircle:function(d,c){if(this.context==null){return}c=c||"rgba(0,255,0,0.3)";this.start();this.context.beginPath();this.context.fillStyle=c;this.context.arc(d.x,d.y,d.radius,0,Math.PI*2,false);this.context.fill();this.context.closePath();this.stop()},renderText:function(f,c,h,e,d){if(this.context==null){return}e=e||"rgb(255,255,255)";d=d||"16px Courier";this.start();this.context.font=d;this.context.fillStyle=e;this.context.fillText(f,c,h);this.stop()}};Phaser.Physics={};Phaser.Physics.Arcade=function(c){this.game=c;this.gravity=new Phaser.Point;this.bounds=new Phaser.Rectangle(0,0,c.world.width,c.world.height);this.maxObjects=10;this.maxLevels=4;this.OVERLAP_BIAS=4;this.TILE_OVERLAP=false;this.quadTree=new Phaser.QuadTree(this,this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels);this.quadTreeID=0;this._obj1Bounds=new Phaser.Rectangle;this._obj2Bounds=new Phaser.Rectangle;this._overlap=0;this._maxOverlap=0;this._obj1Velocity=0;this._obj2Velocity=0;this._obj1NewVelocity=0;this._obj2NewVelocity=0;this._average=0};Phaser.Physics.Arcade.prototype={updateMotion:function(c){this._velocityDelta=(this.computeVelocity(0,false,c.angularVelocity,c.angularAcceleration,c.angularDrag,c.maxAngular)-c.angularVelocity)/2;c.angularVelocity+=this._velocityDelta;c.rotation+=c.angularVelocity*this.game.time.physicsElapsed;this._velocityDelta=(this.computeVelocity(1,c,c.velocity.x,c.acceleration.x,c.drag.x)-c.velocity.x)/2;c.velocity.x+=this._velocityDelta;this._delta=c.velocity.x*this.game.time.physicsElapsed;c.x+=this._delta;this._velocityDelta=(this.computeVelocity(2,c,c.velocity.y,c.acceleration.y,c.drag.y)-c.velocity.y)/2;c.velocity.y+=this._velocityDelta;this._delta=c.velocity.y*this.game.time.physicsElapsed;c.y+=this._delta},computeVelocity:function(f,d,i,h,e,c){c=c||10000;if(f==1&&d.allowGravity){i+=this.gravity.x+d.gravity.x}else{if(f==2&&d.allowGravity){i+=this.gravity.y+d.gravity.y}}if(h!==0){i+=h*this.game.time.physicsElapsed}else{if(e!==0){this._drag=e*this.game.time.physicsElapsed;if(i-this._drag>0){i=i-this._drag}else{if(i+this._drag<0){i+=this._drag}else{i=0}}}}if(i!=0){if(i>c){i=c}else{if(i<-c){i=-c}}}return i},preUpdate:function(){this.quadTree.clear();this.quadTreeID=0;this.quadTree=new Phaser.QuadTree(this,this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels)},postUpdate:function(){this.quadTree.clear()},collide:function(d,e,c){return this.overlap(d,null,e,this.separate,c)},collideGroup:function(k,h,e){h=h||null;e=e||h;for(var j=0,c=k.length;j<c;j++){for(var f=0,d=k.length;f<d;f++){if(this.separate(k[j].body,k[f].body)){if(h){h.call(e,k[j],k[f].sprite)}}}}},overlap:function(m,l,j,d,e){l=l||null;j=j||null;d=d||this.separate;e=e||this;var k=this.quadTree.retrieve(m);var c=[];for(var f=0,h=k.length;f<h;f++){if(d.call(e,m.body,k[f])){if(j){j.call(e,m,k[f].sprite)}c.push(k[f])}}return(c.length)},separate:function(d,c){return this.separateX(d,c)||this.separateY(d,c)},separateX:function(d,c){if(d.immovable&&c.immovable){return false}this._overlap=0;if(d.deltaX()!=c.deltaX()){this._obj1Bounds.setTo(d.x-((d.deltaX()>0)?d.deltaX():0),d.lastY,d.width+((d.deltaX()>0)?d.deltaX():-d.deltaX()),d.height);this._obj2Bounds.setTo(c.x-((c.deltaX()>0)?c.deltaX():0),c.lastY,c.width+((c.deltaX()>0)?c.deltaX():-c.deltaX()),c.height);if((this._obj1Bounds.right>this._obj2Bounds.x)&&(this._obj1Bounds.x<this._obj2Bounds.right)&&(this._obj1Bounds.bottom>this._obj2Bounds.y)&&(this._obj1Bounds.y<this._obj2Bounds.bottom)){this._maxOverlap=d.deltaAbsX()+c.deltaAbsX()+this.OVERLAP_BIAS;if(d.deltaX()>c.deltaX()){this._overlap=d.x+d.width-c.x;if((this._overlap>this._maxOverlap)||d.allowCollision.right==false||c.allowCollision.left==false){this._overlap=0}else{d.touching.right=true;c.touching.left=true}}else{if(d.deltaX()<c.deltaX()){this._overlap=d.x-c.width-c.x;if((-this._overlap>this._maxOverlap)||d.allowCollision.left==false||c.allowCollision.right==false){this._overlap=0}else{d.touching.left=true;c.touching.right=true}}}}}if(this._overlap!=0){this._obj1Velocity=d.velocity.x;this._obj2Velocity=c.velocity.x;if(!d.immovable&&!c.immovable){this._overlap*=0.5;d.x=d.x-this._overlap;c.x+=this._overlap;this._obj1NewVelocity=Math.sqrt((this._obj2Velocity*this._obj2Velocity*c.mass)/d.mass)*((this._obj2Velocity>0)?1:-1);this._obj2NewVelocity=Math.sqrt((this._obj1Velocity*this._obj1Velocity*d.mass)/c.mass)*((this._obj1Velocity>0)?1:-1);this._average=(this._obj1NewVelocity+this._obj2NewVelocity)*0.5;this._obj1NewVelocity-=this._average;this._obj2NewVelocity-=this._average;d.velocity.x=this._average+this._obj1NewVelocity*d.bounce.x;c.velocity.x=this._average+this._obj2NewVelocity*c.bounce.x}else{if(!d.immovable){d.x=d.x-this._overlap;d.velocity.x=this._obj2Velocity-this._obj1Velocity*d.bounce.x}else{if(!c.immovable){c.x+=this._overlap;c.velocity.x=this._obj1Velocity-this._obj2Velocity*c.bounce.x}}}return true}else{return false}},separateY:function(d,c){if(d.immovable&&c.immovable){return false}this._overlap=0;if(d.deltaY()!=c.deltaY()){this._obj1Bounds.setTo(d.x,d.y-((d.deltaY()>0)?d.deltaY():0),d.width,d.height+d.deltaAbsY());this._obj2Bounds.setTo(c.x,c.y-((c.deltaY()>0)?c.deltaY():0),c.width,c.height+c.deltaAbsY());if((this._obj1Bounds.right>this._obj2Bounds.x)&&(this._obj1Bounds.x<this._obj2Bounds.right)&&(this._obj1Bounds.bottom>this._obj2Bounds.y)&&(this._obj1Bounds.y<this._obj2Bounds.bottom)){this._maxOverlap=d.deltaAbsY()+c.deltaAbsY()+this.OVERLAP_BIAS;if(d.deltaY()>c.deltaY()){this._overlap=d.y+d.height-c.y;if((this._overlap>this._maxOverlap)||d.allowCollision.down==false||c.allowCollision.up==false){this._overlap=0}else{d.touching.down=true;c.touching.up=true}}else{if(d.deltaY()<c.deltaY()){this._overlap=d.y-c.height-c.y;if((-this._overlap>this._maxOverlap)||d.allowCollision.up==false||c.allowCollision.down==false){this._overlap=0}else{d.touching.up=true;c.touching.down=true}}}}}if(this._overlap!=0){this._obj1Velocity=d.velocity.y;this._obj2Velocity=c.velocity.y;if(!d.immovable&&!c.immovable){this._overlap*=0.5;d.y=d.y-this._overlap;c.y+=this._overlap;this._obj1NewVelocity=Math.sqrt((this._obj2Velocity*this._obj2Velocity*c.mass)/d.mass)*((this._obj2Velocity>0)?1:-1);this._obj2NewVelocity=Math.sqrt((this._obj1Velocity*this._obj1Velocity*d.mass)/c.mass)*((this._obj1Velocity>0)?1:-1);this._average=(this._obj1NewVelocity+this._obj2NewVelocity)*0.5;this._obj1NewVelocity-=this._average;this._obj2NewVelocity-=this._average;d.velocity.y=this._average+this._obj1NewVelocity*d.bounce.y;c.velocity.y=this._average+this._obj2NewVelocity*c.bounce.y}else{if(!d.immovable){d.y=d.y-this._overlap;d.velocity.y=this._obj2Velocity-this._obj1Velocity*d.bounce.y;if(c.active&&c.moves&&(d.deltaY()>c.deltaY())){d.x+=c.x-c.lastX}}else{if(!c.immovable){c.y+=this._overlap;c.velocity.y=this._obj1Velocity-this._obj2Velocity*c.bounce.y;if(d.sprite.active&&d.moves&&(d.deltaY()<c.deltaY())){c.x+=d.x-d.lastX}}}}return true}else{return false}},velocityFromAngle:function(f,e,c){e=e||0;c=c||new Phaser.Point;var d=this.game.math.degToRad(f);return c.setTo((Math.cos(d)*e),(Math.sin(d)*e))},moveTowardsObject:function(i,f,h,e){h=h||60;e=e||0;var c=this.angleBetween(i,f);if(e>0){var j=this.distanceBetween(i,f);h=j/(e/1000)}i.body.velocity.x=Math.cos(c)*h;i.body.velocity.y=Math.sin(c)*h},accelerateTowardsObject:function(h,e,f,c,i){c=c||1000;i=i||1000;var d=this.angleBetween(h,e);h.body.velocity.x=0;h.body.velocity.y=0;h.body.acceleration.x=Math.cos(d)*f;h.body.acceleration.y=Math.sin(d)*f;h.body.maxVelocity.x=c;h.body.maxVelocity.y=i},moveTowardsMouse:function(h,f,e){f=f||60;e=e||0;var c=this.angleBetweenMouse(h);if(e>0){var i=this.distanceToMouse(h);f=i/(e/1000)}h.body.velocity.x=Math.cos(c)*f;h.body.velocity.y=Math.sin(c)*f},accelerateTowardsMouse:function(f,e,c,h){c=c||1000;h=h||1000;var d=this.angleBetweenMouse(f);f.body.velocity.x=0;f.body.velocity.y=0;f.body.acceleration.x=Math.cos(d)*e;f.body.acceleration.y=Math.sin(d)*e;f.body.maxVelocity.x=c;f.body.maxVelocity.y=h},moveTowardsPoint:function(h,i,f,e){f=f||60;e=e||0;var c=this.angleBetweenPoint(h,i);if(e>0){var j=this.distanceToPoint(h,i);f=j/(e/1000)}h.body.velocity.x=Math.cos(c)*f;h.body.velocity.y=Math.sin(c)*f},accelerateTowardsPoint:function(f,h,e,c,i){c=c||1000;i=i||1000;var d=this.angleBetweenPoint(f,h);f.body.velocity.x=0;f.body.velocity.y=0;f.body.acceleration.x=Math.cos(d)*e;f.body.acceleration.y=Math.sin(d)*e;f.body.maxVelocity.x=c;f.body.maxVelocity.y=i},distanceBetween:function(e,c){var f=e.center.x-c.center.x;var d=e.center.y-c.center.y;return Math.sqrt(f*f+d*d)},distanceToPoint:function(d,f){var e=d.center.x-f.x;var c=d.center.y-f.y;return Math.sqrt(e*e+c*c)},distanceToMouse:function(d){var e=d.center.x-this.game.input.x;var c=d.center.y-this.game.input.y;return Math.sqrt(e*e+c*c)},angleBetweenPoint:function(d,h,f){f=f||false;var e=h.x-d.center.x;var c=h.y-d.center.y;if(f){return this.game.math.radToDeg(Math.atan2(c,e))}else{return Math.atan2(c,e)}},angleBetween:function(e,c,h){h=h||false;var f=c.center.x-e.center.x;var d=c.center.y-e.center.y;if(h){return this.game.math.radToDeg(Math.atan2(d,f))}else{return Math.atan2(d,f)}},velocityFromFacing:function(c,d){},angleBetweenMouse:function(d,f){f=f||false;var e=this.game.input.x-d.bounds.x;var c=this.game.input.y-d.bounds.y;if(f){return this.game.math.radToDeg(Math.atan2(c,e))}else{return Math.atan2(c,e)}}};Phaser.Physics.Arcade.Body=function(c){this.sprite=c;this.game=c.game;this.offset=new Phaser.Point;this.x=c.x;this.y=c.y;this.sourceWidth=c.currentFrame.sourceSizeW;this.sourceHeight=c.currentFrame.sourceSizeH;this.width=c.currentFrame.sourceSizeW;this.height=c.currentFrame.sourceSizeH;this.halfWidth=Math.floor(c.currentFrame.sourceSizeW/2);this.halfHeight=Math.floor(c.currentFrame.sourceSizeH/2);this._sx=c.scale.x;this._sy=c.scale.y;this.velocity=new Phaser.Point;this.acceleration=new Phaser.Point;this.drag=new Phaser.Point;this.gravity=new Phaser.Point;this.bounce=new Phaser.Point;this.maxVelocity=new Phaser.Point(10000,10000);this.angularVelocity=0;this.angularAcceleration=0;this.angularDrag=0;this.maxAngular=1000;this.mass=1;this.quadTreeIDs=[];this.quadTreeIndex=-1;this.allowCollision={none:false,any:true,up:true,down:true,left:true,right:true};this.touching={none:true,up:false,down:false,left:false,right:false};this.wasTouching={none:true,up:false,down:false,left:false,right:false};this.immovable=false;this.moves=true;this.rotation=0;this.allowRotation=true;this.allowGravity=true;this.collideWorldBounds=false;this.lastX=c.x;this.lastY=c.y};Phaser.Physics.Arcade.Body.prototype={updateBounds:function(f,e,d,c){if(d!=this._sx||c!=this._sy){this.width=this.sourceWidth*d;this.height=this.sourceHeight*c;this.halfWidth=Math.floor(this.width/2);this.halfHeight=Math.floor(this.height/2);this._sx=d;this._sy=c}},update:function(){this.wasTouching.none=this.touching.none;this.wasTouching.up=this.touching.up;this.wasTouching.down=this.touching.down;this.wasTouching.left=this.touching.left;this.wasTouching.right=this.touching.right;this.touching.none=true;this.touching.up=false;this.touching.down=false;this.touching.left=false;this.touching.right=false;this.lastX=this.x;this.lastY=this.y;this.rotation=this.sprite.angle;this.x=(this.sprite.x-(this.sprite.anchor.x*this.width))+this.offset.x;this.y=(this.sprite.y-(this.sprite.anchor.y*this.height))+this.offset.y;if(this.moves){this.game.physics.updateMotion(this)}if(this.collideWorldBounds){this.checkWorldBounds()}if(this.allowCollision.none==false&&this.sprite.visible&&this.sprite.alive){this.quadTreeIDs=[];this.quadTreeIndex=-1;this.game.physics.quadTree.insert(this)}this.sprite.x=this.x-this.offset.x+(this.sprite.anchor.x*this.width);this.sprite.y=this.y-this.offset.y+(this.sprite.anchor.y*this.height);if(this.allowRotation){this.sprite.angle=this.rotation}},postUpdate:function(){this.sprite.x=this.x-this.offset.x+(this.sprite.anchor.x*this.width);this.sprite.y=this.y-this.offset.y+(this.sprite.anchor.y*this.height);if(this.allowRotation){this.sprite.angle=this.rotation}},checkWorldBounds:function(){if(this.x<this.game.world.bounds.x){this.x=this.game.world.bounds.x;this.velocity.x*=-this.bounce.x}else{if(this.right>this.game.world.bounds.right){this.x=this.game.world.bounds.right-this.width;this.velocity.x*=-this.bounce.x}}if(this.y<this.game.world.bounds.y){this.y=this.game.world.bounds.y;this.velocity.y*=-this.bounce.y}else{if(this.bottom>this.game.world.bounds.bottom){this.y=this.game.world.bounds.bottom-this.height;this.velocity.y*=-this.bounce.y}}},setSize:function(e,d,c,f){c=c||this.offset.x;f=f||this.offset.y;this.sourceWidth=e;this.sourceHeight=d;this.width=this.sourceWidth*this._sx;this.height=this.sourceHeight*this._sy;this.halfWidth=Math.floor(this.width/2);this.halfHeight=Math.floor(this.height/2);this.offset.setTo(c,f)},deltaAbsX:function(){return(this.deltaX()>0?this.deltaX():-this.deltaX())},deltaAbsY:function(){return(this.deltaY()>0?this.deltaY():-this.deltaY())},deltaX:function(){return this.x-this.lastX},deltaY:function(){return this.y-this.lastY}};Object.defineProperty(Phaser.Physics.Arcade.Body.prototype,"bottom",{get:function(){return this.y+this.height},set:function(c){if(c<=this.y){this.height=0}else{this.height=(this.y-c)}},enumerable:true,configurable:true});Object.defineProperty(Phaser.Physics.Arcade.Body.prototype,"right",{get:function(){return this.x+this.width},set:function(c){if(c<=this.x){this.width=0}else{this.width=this.x+c}},enumerable:true,configurable:true});