var PIXI=PIXI||{};PIXI.Point=function(a,b){this.x=a||0;this.y=b||0};PIXI.Point.clone=function(){return new PIXI.Point(this.x,this.y)};PIXI.Point.constructor=PIXI.Point;PIXI.Rectangle=function(a,b,c,d){this.x=a||0;this.y=b||0;this.width=c||0;this.height=d||0};PIXI.Rectangle.clone=function(){return new PIXI.Rectangle(this.x,this.y,this.width,this.height)};PIXI.Rectangle.constructor=PIXI.Rectangle; PIXI.DisplayObject=function(){this.position=new PIXI.Point;this.scale=new PIXI.Point(1,1);this.rotation=0;this.alpha=1;this.visible=!0;this.cacheVisible=!1;this.stage=this.parent=null;this.worldAlpha=1;this.color=[];this.worldTransform=PIXI.mat3.create();this.localTransform=PIXI.mat3.create();this.dynamic=!0;this._sr=0;this._cr=1;this.renderable=!1;this.interactive=!0};PIXI.DisplayObject.constructor=PIXI.DisplayObject; PIXI.DisplayObject.prototype.updateTransform=function(){this.rotation!=this.rotationCache&&(this.rotationCache=this.rotation,this._sr=Math.sin(this.rotation),this._cr=Math.cos(this.rotation));var a=this.localTransform,b=this.parent.worldTransform,c=this.worldTransform;a[0]=this._cr*this.scale.x;a[1]=-this._sr*this.scale.y;a[3]=this._sr*this.scale.x;a[4]=this._cr*this.scale.y;a[2]=this.position.x;a[5]=this.position.y;var d=a[0],e=a[1],f=a[2],g=a[3],h=a[4],a=a[5];b00=b[0];b01=b[1];b02=b[2];b10=b[3]; b11=b[4];b12=b[5];c[0]=b00*d+b01*g;c[1]=b00*e+b01*h;c[2]=b00*f+b01*a+b02;c[3]=b10*d+b11*g;c[4]=b10*e+b11*h;c[5]=b10*f+b11*a+b12;this.worldAlpha=this.alpha*this.parent.worldAlpha};PIXI.DisplayObjectContainer=function(){PIXI.DisplayObject.call(this);this.children=[];this.renderable=!1};PIXI.DisplayObjectContainer.constructor=PIXI.DisplayObjectContainer;PIXI.DisplayObjectContainer.prototype=Object.create(PIXI.DisplayObject.prototype); PIXI.DisplayObjectContainer.prototype.addChild=function(a){void 0!=a.parent&&a.parent.removeChild(a);a.parent=this;a.childIndex=this.children.length;this.children.push(a);this.stage&&this.stage.__addChild(a)}; PIXI.DisplayObjectContainer.prototype.addChildAt=function(a,b){if(0<=b&&b<=this.children.length){void 0!=a.parent&&a.parent.removeChild(a);b==this.children.length?this.children.push(a):this.children.splice(b,0,a);a.parent=this;a.childIndex=b;for(var c=this.children.length,d=b;d<c;d++)this.children[d].childIndex=d;this.stage&&this.stage.__addChild(a)}else throw Error(a+" The index "+b+" supplied is out of bounds "+this.children.length);}; PIXI.DisplayObjectContainer.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(-1!==b){this.stage&&this.stage.__removeChild(a);a.parent=void 0;this.children.splice(b,1);a=b;for(b=this.children.length;a<b;a++)this.children[a].childIndex-=1}else throw Error(a+" The supplied DisplayObject must be a child of the caller "+this);}; PIXI.DisplayObjectContainer.prototype.updateTransform=function(){if(this.visible){PIXI.DisplayObject.prototype.updateTransform.call(this);for(var a=0,b=this.children.length;a<b;a++)this.children[a].updateTransform()}};PIXI.blendModes={};PIXI.blendModes.NORMAL=0;PIXI.blendModes.SCREEN=1; PIXI.Sprite=function(a){PIXI.DisplayObjectContainer.call(this);this.anchor=new PIXI.Point;this.texture=a;this.blendMode=PIXI.blendModes.NORMAL;this.height=this.width=1;a.baseTexture.hasLoaded?(this.width=this.texture.frame.width,this.height=this.texture.frame.height,this.updateFrame=!0):(this.onTextureUpdateBind=this.onTextureUpdate.bind(this),this.texture.addEventListener("update",this.onTextureUpdateBind));this.renderable=!0;this.interactive=!1};PIXI.Sprite.constructor=PIXI.Sprite; PIXI.Sprite.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Sprite.prototype.setTexture=function(a){this.texture.baseTexture!=a.baseTexture&&(this.textureChange=!0);this.texture=a;this.width=a.frame.width;this.height=a.frame.height;this.updateFrame=!0};PIXI.Sprite.prototype.setInteractive=function(a){this.interactive=a;this.stage&&(this.stage.dirty=!0)}; PIXI.Sprite.prototype.onTextureUpdate=function(){this.width=this.texture.frame.width;this.height=this.texture.frame.height;this.updateFrame=!0};PIXI.Sprite.fromFrame=function(a){var b=PIXI.TextureCache[a];if(!b)throw Error("The frameId '"+a+"' does not exist in the texture cache"+this);return new PIXI.Sprite(b)};PIXI.Sprite.fromImage=function(a){a=PIXI.Texture.fromImage(a);return new PIXI.Sprite(a)}; PIXI.MovieClip=function(a){PIXI.Sprite.call(this,a[0]);this.textures=a;this.currentFrame=0;this.animationSpeed=1};PIXI.MovieClip.constructor=PIXI.MovieClip;PIXI.MovieClip.prototype=Object.create(PIXI.Sprite.prototype);PIXI.MovieClip.prototype.stop=function(){this.playing=!1};PIXI.MovieClip.prototype.play=function(){this.playing=!0};PIXI.MovieClip.prototype.gotoAndStop=function(a){this.playing=!1;this.currentFrame=a;this.setTexture(this.textures[(this.currentFrame+0.5|0)%this.textures.length])}; PIXI.MovieClip.prototype.gotoAndPlay=function(a){this.currentFrame=a;this.playing=!0};PIXI.MovieClip.prototype.updateTransform=function(){PIXI.Sprite.prototype.updateTransform.call(this);this.playing&&(this.currentFrame+=this.animationSpeed,this.setTexture(this.textures[(this.currentFrame+0.5|0)%this.textures.length]))}; PIXI.InteractionManager=function(a){this.stage=a;this.tempPoint=new PIXI.Point;this.mouseoverEnabled=!0;this.mouse=new PIXI.InteractionData;this.touchs={};this.pool=[];this.interactiveItems=[]};PIXI.InteractionManager.constructor=PIXI.InteractionManager;PIXI.InteractionManager.prototype.disableMouseOver=function(){this.mouseoverEnabled&&(this.mouseoverEnabled=!1,this.target&&this.target.view.removeEventListener("mousemove",this.onMouseMove.bind(this)))}; PIXI.InteractionManager.prototype.enableMouseOver=function(){this.mouseoverEnabled||(this.mouseoverEnabled=!1,this.target&&this.target.view.addEventListener("mousemove",this.onMouseMove.bind(this)))};PIXI.InteractionManager.prototype.collectInteractiveSprite=function(a){a=a.children;for(var b=a.length-1;0<=b;b--){var c=a[b];if(c instanceof PIXI.Sprite)c.interactive&&this.interactiveItems.push(c);else if(!c.interactive)continue;0<c.children.length&&this.collectInteractiveSprite(c)}}; PIXI.InteractionManager.prototype.setTarget=function(a){this.target=a;this.mouseoverEnabled&&a.view.addEventListener("mousemove",this.onMouseMove.bind(this),!0);a.view.addEventListener("mousedown",this.onMouseDown.bind(this),!0);a.view.addEventListener("mouseup",this.onMouseUp.bind(this),!0);a.view.addEventListener("mouseout",this.onMouseUp.bind(this),!0);a.view.addEventListener("touchstart",this.onTouchStart.bind(this),!0);a.view.addEventListener("touchend",this.onTouchEnd.bind(this),!0);a.view.addEventListener("touchmove", this.onTouchMove.bind(this),!0)}; PIXI.InteractionManager.prototype.hitTest=function(a){this.dirty&&(this.dirty=!1,this.interactiveItems=[],this.collectInteractiveSprite(this.stage));for(var b=this.tempPoint,c=a.global,d=this.interactiveItems.length,e=0;e<d;e++){var f=this.interactiveItems[e];if(f.visible){var g=f.worldTransform,h=g[0],k=g[1],m=g[2],n=g[3],p=g[4],g=g[5],j=1/(h*p+k*-n);b.x=p*j*c.x+-k*j*c.y+(g*k-m*p)*j;b.y=h*j*c.y+-n*j*c.x+(-g*h+m*n)*j;h=-f.width*f.anchor.x;if(b.x>h&&b.x<h+f.width&&(h=-f.height*f.anchor.y,b.y>h&&b.y< h+f.height))return a.local.x=b.x,a.local.y=b.y,f}}return null}; PIXI.InteractionManager.prototype.onMouseMove=function(a){a.preventDefault();var b=this.target.view.getBoundingClientRect();this.mouse.global.x=(a.clientX-b.left)*(this.target.width/b.width);this.mouse.global.y=(a.clientY-b.top)*(this.target.height/b.height);a=this.hitTest(this.mouse);this.currentOver!=a&&(this.currentOver&&(this.mouse.target=this.currentOver,this.currentOver.mouseout&&this.currentOver.mouseout(this.mouse),this.currentOver=null),this.target.view.style.cursor="default");a&&this.currentOver!= a&&(this.currentOver=a,this.target.view.style.cursor="pointer",this.mouse.target=a,a.mouseover&&a.mouseover(this.mouse))};PIXI.InteractionManager.prototype.onMouseDown=function(a){var b=this.target.view.getBoundingClientRect();this.mouse.global.x=(a.clientX-b.left)*(this.target.width/b.width);this.mouse.global.y=(a.clientY-b.top)*(this.target.height/b.height);if(a=this.hitTest(this.mouse))this.currentDown=a,this.mouse.target=a,a.mousedown&&a.mousedown(this.mouse)}; PIXI.InteractionManager.prototype.onMouseUp=function(){this.currentOver&&(this.mouse.target=this.currentOver,this.currentOver.mouseup&&this.currentOver.mouseup(this.mouse));this.currentDown&&(this.mouse.target=this.currentDown,this.currentOver==this.currentDown&&this.currentDown.click&&this.currentDown.click(this.mouse),this.currentDown=null)}; PIXI.InteractionManager.prototype.onTouchMove=function(a){a.preventDefault();var b=this.target.view.getBoundingClientRect();a=a.changedTouches;for(var c=0;c<a.length;c++){var d=a[c],e=this.touchs[d.identifier];e.global.x=(d.clientX-b.left)*(this.target.width/b.width);e.global.y=(d.clientY-b.top)*(this.target.height/b.height)}}; PIXI.InteractionManager.prototype.onTouchStart=function(a){a.preventDefault();var b=this.target.view.getBoundingClientRect();a=a.changedTouches;for(var c=0;c<a.length;c++){var d=a[c],e=this.pool.pop();e||(e=new PIXI.InteractionData);this.touchs[d.identifier]=e;e.global.x=(d.clientX-b.left)*(this.target.width/b.width);e.global.y=(d.clientY-b.top)*(this.target.height/b.height);if(d=this.hitTest(e))e.currentDown=d,e.target=d,d.touchstart&&d.touchstart(e)}}; PIXI.InteractionManager.prototype.onTouchEnd=function(a){a.preventDefault();var b=this.target.view.getBoundingClientRect();a=a.changedTouches;for(var c=0;c<a.length;c++){var d=a[c],e=this.touchs[d.identifier];e.global.x=(d.clientX-b.left)*(this.target.width/b.width);e.global.y=(d.clientY-b.top)*(this.target.height/b.height);e.currentDown&&(e.currentDown.touchend&&e.currentDown.touchend(e),this.hitTest(e)==e.currentDown&&e.currentDown.tap&&e.currentDown.tap(e),e.currentDown=null);this.pool.push(e); this.touchs[d.identifier]=null}};PIXI.InteractionData=function(){this.global=new PIXI.Point;this.local=new PIXI.Point};PIXI.InteractionData.constructor=PIXI.InteractionData;PIXI.Stage=function(a,b){PIXI.DisplayObjectContainer.call(this);this.worldTransform=PIXI.mat3.create();this.__childrenAdded=[];this.__childrenRemoved=[];this.childIndex=0;this.stage=this;this.interactive=!!b;this.interactionManager=new PIXI.InteractionManager(this);this.setBackgroundColor(a)};PIXI.Stage.constructor=PIXI.Stage; PIXI.Stage.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Stage.prototype.updateTransform=function(){this.worldAlpha=1;for(var a=0,b=this.children.length;a<b;a++)this.children[a].updateTransform();this.dirty&&(this.dirty=!1,this.interactionManager.dirty=!0)};PIXI.Stage.prototype.setBackgroundColor=function(a){this.backgroundColor=a||0;this.backgroundColorSplit=HEXtoRGB(this.backgroundColor);this.backgroundColorString="#"+this.backgroundColor.toString(16)}; PIXI.Stage.prototype.__addChild=function(a){a.interactive&&(this.dirty=!0);a.stage=this;if(a.children)for(var b=0;b<a.children.length;b++)this.__addChild(a.children[b])};PIXI.Stage.prototype.__removeChild=function(a){a.interactive&&(this.dirty=!0);this.__childrenRemoved.push(a);a.stage=void 0;if(a.children)for(var b=0,c=a.children.length;b<c;b++)this.__removeChild(a.children[b])}; window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}();function HEXtoRGB(a){return[(a>>16&255)/255,(a>>8&255)/255,(a&255)/255]} "function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){var a=Array.prototype.slice;return function(b){function c(){var f=e.concat(a.call(arguments));d.apply(this instanceof c?this:b,f)}var d=this,e=a.call(arguments,1);if("function"!=typeof d)throw new TypeError;c.prototype=function g(a){a&&(g.prototype=a);if(!(this instanceof g))return new g}(d.prototype);return c}}()); var AjaxRequest=function(){var a=["Msxml2.XMLHTTP","Microsoft.XMLHTTP"];if(window.ActiveXObject)for(var b=0;b<a.length;b++)try{return new ActiveXObject(a[b])}catch(c){}else return window.XMLHttpRequest?new XMLHttpRequest:!1}; PIXI.EventTarget=function(){var a={};this.addEventListener=function(b,c){void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)}};function determineMatrixArrayType(){PIXI.Matrix="undefined"!==typeof Float32Array?Float32Array:Array;return PIXI.Matrix}determineMatrixArrayType();PIXI.mat3={}; PIXI.mat3.create=function(){var a=new PIXI.Matrix(9);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};PIXI.mat4={};PIXI.mat4.create=function(){var a=new PIXI.Matrix(16);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a}; PIXI.mat3.multiply=function(a,b,c){c||(c=a);var d=a[0],e=a[1],f=a[2],g=a[3],h=a[4],k=a[5],m=a[6],n=a[7];a=a[8];var p=b[0],j=b[1],q=b[2],r=b[3],s=b[4],t=b[5],u=b[6],l=b[7];b=b[8];c[0]=p*d+j*g+q*m;c[1]=p*e+j*h+q*n;c[2]=p*f+j*k+q*a;c[3]=r*d+s*g+t*m;c[4]=r*e+s*h+t*n;c[5]=r*f+s*k+t*a;c[6]=u*d+l*g+b*m;c[7]=u*e+l*h+b*n;c[8]=u*f+l*k+b*a;return c}; PIXI.mat3.toMat4=function(a,b){b||(b=PIXI.mat4.create());b[15]=1;b[14]=0;b[13]=0;b[12]=0;b[11]=0;b[10]=a[8];b[9]=a[7];b[8]=a[6];b[7]=0;b[6]=a[5];b[5]=a[4];b[4]=a[3];b[3]=0;b[2]=a[2];b[1]=a[1];b[0]=a[0];return b};PIXI.mat4.create=function(){var a=new PIXI.Matrix(16);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a}; PIXI.mat4.transpose=function(a,b){if(!b||a===b){var c=a[1],d=a[2],e=a[3],f=a[6],g=a[7],h=a[11];a[1]=a[4];a[2]=a[8];a[3]=a[12];a[4]=c;a[6]=a[9];a[7]=a[13];a[8]=d;a[9]=f;a[11]=a[14];a[12]=e;a[13]=g;a[14]=h;return a}b[0]=a[0];b[1]=a[4];b[2]=a[8];b[3]=a[12];b[4]=a[1];b[5]=a[5];b[6]=a[9];b[7]=a[13];b[8]=a[2];b[9]=a[6];b[10]=a[10];b[11]=a[14];b[12]=a[3];b[13]=a[7];b[14]=a[11];b[15]=a[15];return b}; PIXI.mat4.multiply=function(a,b,c){c||(c=a);var d=a[0],e=a[1],f=a[2],g=a[3],h=a[4],k=a[5],m=a[6],n=a[7],p=a[8],j=a[9],q=a[10],r=a[11],s=a[12],t=a[13],u=a[14];a=a[15];var l=b[0],v=b[1],w=b[2],x=b[3];c[0]=l*d+v*h+w*p+x*s;c[1]=l*e+v*k+w*j+x*t;c[2]=l*f+v*m+w*q+x*u;c[3]=l*g+v*n+w*r+x*a;l=b[4];v=b[5];w=b[6];x=b[7];c[4]=l*d+v*h+w*p+x*s;c[5]=l*e+v*k+w*j+x*t;c[6]=l*f+v*m+w*q+x*u;c[7]=l*g+v*n+w*r+x*a;l=b[8];v=b[9];w=b[10];x=b[11];c[8]=l*d+v*h+w*p+x*s;c[9]=l*e+v*k+w*j+x*t;c[10]=l*f+v*m+w*q+x*u;c[11]=l*g+v*n+ w*r+x*a;l=b[12];v=b[13];w=b[14];x=b[15];c[12]=l*d+v*h+w*p+x*s;c[13]=l*e+v*k+w*j+x*t;c[14]=l*f+v*m+w*q+x*u;c[15]=l*g+v*n+w*r+x*a;return c};PIXI.autoDetectRenderer=function(a,b,c){a||(a=800);b||(b=600);var d;try{d=!!window.WebGLRenderingContext&&!!document.createElement("canvas").getContext("experimental-webgl")}catch(e){d=!1}return d?new PIXI.WebGLRenderer(a,b,c):new PIXI.CanvasRenderer(a,b,c)}; PIXI.shaderFragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {","gl_FragColor \x3d texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));","gl_FragColor \x3d gl_FragColor * vColor;","}"]; PIXI.shaderVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform mat4 uMVMatrix;","varying vec2 vTextureCoord;","varying float vColor;","void main(void) {","gl_Position \x3d uMVMatrix * vec4(aVertexPosition, 1.0, 1.0);","vTextureCoord \x3d aTextureCoord;","vColor \x3d aColor;","}"]; PIXI.CompileVertexShader=function(a,b){for(var c="",d=0;d<b.length;d++)c+=b[d];d=a.createShader(a.VERTEX_SHADER);a.shaderSource(d,c);a.compileShader(d);return!a.getShaderParameter(d,a.COMPILE_STATUS)?(alert(a.getShaderInfoLog(d)),null):d};PIXI.CompileFragmentShader=function(a,b){for(var c="",d=0;d<b.length;d++)c+=b[d];d=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(d,c);a.compileShader(d);return!a.getShaderParameter(d,a.COMPILE_STATUS)?(alert(a.getShaderInfoLog(d)),null):d}; PIXI._defaultFrame=new PIXI.Rectangle(0,0,1,1); PIXI.WebGLRenderer=function(a,b,c){this.width=a||800;this.height=b||600;this.view=c||document.createElement("canvas");this.view.width=this.width;this.view.height=this.height;this.view.background="#FF0000";var d=this;this.view.addEventListener("webglcontextlost",function(a){d.handleContextLost(a)},!1);this.view.addEventListener("webglcontextrestored",function(a){d.handleContextRestored(a)},!1);this.batchs=[];try{this.gl=this.view.getContext("experimental-webgl",{alpha:!1})}catch(e){throw Error(" This browser does not support webGL. Try using the canvas renderer"+ this);}this.initShaders();a=this.gl;this.batch=new PIXI.WebGLBatch(a);a.disable(a.DEPTH_TEST);a.enable(a.BLEND);a.colorMask(!0,!0,!0,!1);this.projectionMatrix=PIXI.mat4.create();this.resize(this.width,this.height);this.contextLost=!1};PIXI.WebGLRenderer.constructor=PIXI.WebGLRenderer; PIXI.WebGLRenderer.prototype.initShaders=function(){var a=this.gl,b=PIXI.CompileFragmentShader(a,PIXI.shaderFragmentSrc),c=PIXI.CompileVertexShader(a,PIXI.shaderVertexSrc),d=this.shaderProgram=a.createProgram();a.attachShader(d,c);a.attachShader(d,b);a.linkProgram(d);a.getProgramParameter(d,a.LINK_STATUS)||alert("Could not initialise shaders");a.useProgram(d);d.vertexPositionAttribute=a.getAttribLocation(d,"aVertexPosition");a.enableVertexAttribArray(d.vertexPositionAttribute);d.textureCoordAttribute= a.getAttribLocation(d,"aTextureCoord");a.enableVertexAttribArray(d.textureCoordAttribute);d.colorAttribute=a.getAttribLocation(d,"aColor");a.enableVertexAttribArray(d.colorAttribute);d.mvMatrixUniform=a.getUniformLocation(d,"uMVMatrix");d.samplerUniform=a.getUniformLocation(d,"uSampler");PIXI.shaderProgram=this.shaderProgram}; PIXI.WebGLRenderer.prototype.checkVisibility=function(a,b){for(var c=a.children,d=0;d<c.length;d++){var e=c[d],f=e.visible&&b;e.textureChange&&(e.textureChange=!1,f&&(this.removeDisplayObject(e),this.addDisplayObject(e)));e.cacheVisible!=f&&(e.cacheVisible=f,e.cacheVisible?this.addDisplayObject(e):this.removeDisplayObject(e));0<e.children.length&&this.checkVisibility(e,f)}}; PIXI.WebGLRenderer.prototype.render=function(a){if(!this.contextLost){for(var b=0;b<a.__childrenRemoved.length;b++)this.removeDisplayObject(a.__childrenRemoved[b]);for(b=0;b<PIXI.texturesToUpdate.length;b++)this.updateTexture(PIXI.texturesToUpdate[b]);a.__childrenRemoved=[];a.__childrenAdded=[];PIXI.texturesToUpdate=[];this.checkVisibility(a,!0);a.updateTransform();b=this.gl;b.clear(b.COLOR_BUFFER_BIT);b.clearColor(a.backgroundColorSplit[0],a.backgroundColorSplit[1],a.backgroundColorSplit[2],1);b.blendFunc(b.ONE, b.ONE_MINUS_SRC_ALPHA);b.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform,!1,this.projectionMatrix);for(var c,b=0;b<this.batchs.length;b++)c=this.batchs[b],c instanceof PIXI.WebGLBatch?this.batchs[b].render():c instanceof PIXI.Strip&&c.visible&&this.renderStrip(c);a.interactive&&!a._interactiveEventsAdded&&(a._interactiveEventsAdded=!0,a.interactionManager.setTarget(this))}}; PIXI.WebGLRenderer.prototype.updateTexture=function(a){var b=this.gl;a._glTexture||(a._glTexture=b.createTexture());a.hasLoaded&&(b.bindTexture(b.TEXTURE_2D,a._glTexture),b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,a.source),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE),b.bindTexture(b.TEXTURE_2D,null));this.refreshBatchs=!0}; PIXI.WebGLRenderer.prototype.addDisplayObject=function(a){if(a.stage&&!a.__inWebGL&&(a.batch=null,a.renderable)){a.__inWebGL=!0;var b=a;do{if(0==b.childIndex)b=b.parent;else for(b=b.parent.children[b.childIndex-1];0!=b.children.length;)b=b.children[b.children.length-1];if(b==a.stage)break}while(!b.renderable||!b.__inWebGL);var c=a;do{if(0==c.children.length){for(;c.childIndex==c.parent.children.length-1;)if(c=c.parent,c==a.stage){c=null;break}c&&(c=c.parent.children[c.childIndex+1])}else c=c.children[0]; if(!c)break}while(!c.renderable||!c.__inWebGL);if(a instanceof PIXI.Sprite){var d;if(b instanceof PIXI.Sprite){if((d=b.batch)&&d.texture==a.texture.baseTexture&&d.blendMode==a.blendMode){d.insertAfter(a,b);return}}else d=b;if(c&&c instanceof PIXI.Sprite&&(b=c.batch)){if(b.texture==a.texture.baseTexture&&b.blendMode==a.blendMode){b.insertBefore(a,c);return}if(b==d){c=d.split(c);b=PIXI._getBatch(this.gl);d=this.batchs.indexOf(d);b.init(a);this.batchs.splice(d+1,0,b,c);return}}b=PIXI._getBatch(this.gl); b.init(a);d?(d=this.batchs.indexOf(d),this.batchs.splice(d+1,0,b)):this.batchs.push(b)}else a instanceof PIXI.Strip&&(this.initStrip(a),this.batchs.push(a));this.batchUpdate=!0}}; PIXI.WebGLRenderer.prototype.removeDisplayObject=function(a){a.cacheVisible=!1;if(a.renderable){a.__inWebGL=!1;var b;if(a instanceof PIXI.Sprite){var c=a.batch;if(!c)return;c.remove(a);0==c.size&&(b=c)}else b=a;b&&(a=this.batchs.indexOf(b),-1!=a&&(!(0==a||a==this.batchs.length-1)&&this.batchs[a-1]instanceof PIXI.WebGLBatch&&this.batchs[a+1]instanceof PIXI.WebGLBatch&&this.batchs[a-1].texture==this.batchs[a+1].texture&&this.batchs[a-1].blendMode==this.batchs[a+1].blendMode?(this.batchs[a-1].merge(this.batchs[a+ 1]),b instanceof PIXI.WebGLBatch&&PIXI._returnBatch(b),PIXI._returnBatch(this.batchs[a+1]),this.batchs.splice(a,2)):(this.batchs.splice(a,1),b instanceof PIXI.WebGLBatch&&PIXI._returnBatch(b))))}};PIXI.WebGLRenderer.prototype.resize=function(a,b){this.width=a;this.height=b;this.view.width=a;this.view.height=b;this.gl.viewport(0,0,this.width,this.height);var c=this.projectionMatrix;c[0]=2/this.width;c[5]=-2/this.height;c[12]=-1;c[13]=1}; PIXI.WebGLRenderer.prototype.initStrip=function(a){var b=this.gl;a._vertexBuffer=b.createBuffer();a._indexBuffer=b.createBuffer();a._uvBuffer=b.createBuffer();a._colorBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,a._vertexBuffer);b.bufferData(b.ARRAY_BUFFER,a.verticies,b.DYNAMIC_DRAW);b.bindBuffer(b.ARRAY_BUFFER,a._uvBuffer);b.bufferData(b.ARRAY_BUFFER,a.uvs,b.STATIC_DRAW);b.bindBuffer(b.ARRAY_BUFFER,a._colorBuffer);b.bufferData(b.ARRAY_BUFFER,a.colors,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, a._indexBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,a.indices,b.STATIC_DRAW)}; PIXI.WebGLRenderer.prototype.renderStrip=function(a){var b=this.gl,c=this.shaderProgram,d=PIXI.mat3.toMat4(a.worldTransform);PIXI.mat4.transpose(d);PIXI.mat4.multiply(this.projectionMatrix,d,d);b.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform,!1,d);a.blendMode==PIXI.blendModes.NORMAL?b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA):b.blendFunc(b.ONE,b.ONE_MINUS_SRC_COLOR);a.dirty?(a.dirty=!1,b.bindBuffer(b.ARRAY_BUFFER,a._vertexBuffer),b.bufferData(b.ARRAY_BUFFER,a.verticies,b.STATIC_DRAW),b.vertexAttribPointer(c.vertexPositionAttribute, 2,b.FLOAT,!1,0,0),b.bindBuffer(b.ARRAY_BUFFER,a._uvBuffer),b.bufferData(b.ARRAY_BUFFER,a.uvs,b.STATIC_DRAW),b.vertexAttribPointer(c.textureCoordAttribute,2,b.FLOAT,!1,0,0),b.activeTexture(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,a.texture.baseTexture._glTexture),b.bindBuffer(b.ARRAY_BUFFER,a._colorBuffer),b.bufferData(b.ARRAY_BUFFER,a.colors,b.STATIC_DRAW),b.vertexAttribPointer(c.colorAttribute,1,b.FLOAT,!1,0,0),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,a._indexBuffer),b.bufferData(b.ELEMENT_ARRAY_BUFFER, a.indices,b.STATIC_DRAW)):(b.bindBuffer(b.ARRAY_BUFFER,a._vertexBuffer),b.bufferSubData(b.ARRAY_BUFFER,0,a.verticies),b.vertexAttribPointer(c.vertexPositionAttribute,2,b.FLOAT,!1,0,0),b.bindBuffer(b.ARRAY_BUFFER,a._uvBuffer),b.vertexAttribPointer(c.textureCoordAttribute,2,b.FLOAT,!1,0,0),b.activeTexture(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,a.texture.baseTexture._glTexture),b.bindBuffer(b.ARRAY_BUFFER,a._colorBuffer),b.vertexAttribPointer(c.colorAttribute,1,b.FLOAT,!1,0,0),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, a._indexBuffer));b.drawElements(b.TRIANGLE_STRIP,a.indices.length,b.UNSIGNED_SHORT,0);b.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform,!1,this.projectionMatrix)};PIXI.WebGLRenderer.prototype.handleContextLost=function(a){a.preventDefault();this.contextLost=!0}; PIXI.WebGLRenderer.prototype.handleContextRestored=function(){this.gl=this.view.getContext("experimental-webgl",{alpha:!0});this.initShaders();for(var a=0;a<PIXI.TextureCache.length;a++)this.updateTexture(PIXI.TextureCache[a]);for(a=0;a<this.batchs.length;a++)this.batchs[a].restoreLostContext(this.gl),this.batchs[a].dirty=!0;PIXI._restoreBatchs(this.gl);this.contextLost=!1};PIXI._batchs=[];PIXI._getBatch=function(a){return 0==PIXI._batchs.length?new PIXI.WebGLBatch(a):PIXI._batchs.pop()}; PIXI._returnBatch=function(a){a.clean();PIXI._batchs.push(a)};PIXI._restoreBatchs=function(a){for(var b=0;b<PIXI._batchs.length;b++)PIXI._batchs[b].restoreLostContext(a)};PIXI.WebGLBatch=function(a){this.gl=a;this.size=0;this.vertexBuffer=a.createBuffer();this.indexBuffer=a.createBuffer();this.uvBuffer=a.createBuffer();this.colorBuffer=a.createBuffer();this.blendMode=PIXI.blendModes.NORMAL;this.dynamicSize=1};PIXI.WebGLBatch.constructor=PIXI.WebGLBatch; PIXI.WebGLBatch.prototype.clean=function(){this.verticies=[];this.uvs=[];this.indices=[];this.colors=[];this.dynamicSize=1;this.last=this.texture=null;this.size=0;this.head;this.tail};PIXI.WebGLBatch.prototype.restoreLostContext=function(a){this.gl=a;this.vertexBuffer=a.createBuffer();this.indexBuffer=a.createBuffer();this.uvBuffer=a.createBuffer();this.colorBuffer=a.createBuffer()}; PIXI.WebGLBatch.prototype.init=function(a){a.batch=this;this.dirty=!0;this.blendMode=a.blendMode;this.texture=a.texture.baseTexture;this.tail=this.head=a;this.size=1;this.growBatch()};PIXI.WebGLBatch.prototype.insertBefore=function(a,b){this.size++;a.batch=this;this.dirty=!0;var c=b.__prev;b.__prev=a;a.__next=b;c?(a.__prev=c,c.__next=a):this.head=a}; PIXI.WebGLBatch.prototype.insertAfter=function(a,b){this.size++;a.batch=this;this.dirty=!0;var c=b.__next;b.__next=a;a.__prev=b;c?(a.__next=c,c.__prev=a):this.tail=a};PIXI.WebGLBatch.prototype.remove=function(a){this.size--;0==this.size?(a.batch=null,a.__prev=null,a.__next=null):(a.__prev?a.__prev.__next=a.__next:(this.head=a.__next,this.head.__prev=null),a.__next?a.__next.__prev=a.__prev:(this.tail=a.__prev,this.tail.__next=null),a.batch=null,a.__next=null,a.__prev=null,this.dirty=!0)}; PIXI.WebGLBatch.prototype.split=function(a){this.dirty=!0;var b=new PIXI.WebGLBatch(this.gl);b.init(a);b.tail=this.tail;this.tail=a.__prev;this.tail.__next=null;a.__prev=null;for(var c=0;a;)c++,a.batch=b,a=a.__next;b.size=c;this.size-=c;return b};PIXI.WebGLBatch.prototype.merge=function(a){this.dirty=!0;this.tail.__next=a.head;a.head.__prev=this.tail;this.size+=a.size;this.tail=a.tail;for(a=a.head;a;)a.batch=this,a=a.__next}; PIXI.WebGLBatch.prototype.growBatch=function(){var a=this.gl;this.dynamicSize=1==this.size?1:1.5*this.size;this.verticies=new Float32Array(8*this.dynamicSize);a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer);a.bufferData(a.ARRAY_BUFFER,this.verticies,a.DYNAMIC_DRAW);this.uvs=new Float32Array(8*this.dynamicSize);a.bindBuffer(a.ARRAY_BUFFER,this.uvBuffer);a.bufferData(a.ARRAY_BUFFER,this.uvs,a.DYNAMIC_DRAW);this.dirtyUVS=!0;this.colors=new Float32Array(4*this.dynamicSize);a.bindBuffer(a.ARRAY_BUFFER, this.colorBuffer);a.bufferData(a.ARRAY_BUFFER,this.colors,a.DYNAMIC_DRAW);this.dirtyColors=!0;this.indices=new Uint16Array(6*this.dynamicSize);for(var b=this.indices.length/6,c=0;c<b;c++){var d=6*c,e=4*c;this.indices[d+0]=e+0;this.indices[d+1]=e+1;this.indices[d+2]=e+2;this.indices[d+3]=e+0;this.indices[d+4]=e+2;this.indices[d+5]=e+3}a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer);a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.indices,a.STATIC_DRAW)}; PIXI.WebGLBatch.prototype.refresh=function(){this.dynamicSize<this.size&&this.growBatch();for(var a=0,b,c=this.head;c;){b=8*a;var d=c.texture,e=d.frame,f=d.baseTexture.width,d=d.baseTexture.height;this.uvs[b+0]=e.x/f;this.uvs[b+1]=e.y/d;this.uvs[b+2]=(e.x+e.width)/f;this.uvs[b+3]=e.y/d;this.uvs[b+4]=(e.x+e.width)/f;this.uvs[b+5]=(e.y+e.height)/d;this.uvs[b+6]=e.x/f;this.uvs[b+7]=(e.y+e.height)/d;c.updateFrame=!1;colorIndex=4*a;this.colors[colorIndex]=this.colors[colorIndex+1]=this.colors[colorIndex+ 2]=this.colors[colorIndex+3]=c.worldAlpha;c=c.__next;a++}this.dirtyColors=this.dirtyUVS=!0}; PIXI.WebGLBatch.prototype.update=function(){for(var a,b,c,d,e,f,g,h,k,m,n,p=0,j=this.head;j;)b=j.width,c=j.height,d=j.anchor.x-j.texture.trim.x,e=j.anchor.y-j.texture.trim.y,f=b*(1-d),b*=-d,d=c*(1-e),e=c*-e,c=8*p,a=j.worldTransform,g=a[0],h=a[3],k=a[1],m=a[4],n=a[2],a=a[5],this.verticies[c+0]=g*b+k*e+n,this.verticies[c+1]=m*e+h*b+a,this.verticies[c+2]=g*f+k*e+n,this.verticies[c+3]=m*e+h*f+a,this.verticies[c+4]=g*f+k*d+n,this.verticies[c+5]=m*d+h*f+a,this.verticies[c+6]=g*b+k*d+n,this.verticies[c+ 7]=m*d+h*b+a,j.updateFrame&&(this.dirtyUVS=!0,d=j.texture,f=d.frame,b=d.baseTexture.width,d=d.baseTexture.height,this.uvs[c+0]=f.x/b,this.uvs[c+1]=f.y/d,this.uvs[c+2]=(f.x+f.width)/b,this.uvs[c+3]=f.y/d,this.uvs[c+4]=(f.x+f.width)/b,this.uvs[c+5]=(f.y+f.height)/d,this.uvs[c+6]=f.x/b,this.uvs[c+7]=(f.y+f.height)/d,j.updateFrame=!1),j.cacheAlpha!=j.worldAlpha&&(j.cacheAlpha=j.worldAlpha,f=4*p,this.colors[f]=this.colors[f+1]=this.colors[f+2]=this.colors[f+3]=j.worldAlpha,this.dirtyColors=!0),p++,j=j.__next}; PIXI.WebGLBatch.prototype.render=function(){this.dirty&&(this.refresh(),this.dirty=!1);if(0!=this.size){this.update();var a=this.gl;this.blendMode==PIXI.blendModes.NORMAL?a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA):a.blendFunc(a.ONE,a.ONE_MINUS_SRC_COLOR);var b=PIXI.shaderProgram;a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer);a.bufferSubData(a.ARRAY_BUFFER,0,this.verticies);a.vertexAttribPointer(b.vertexPositionAttribute,2,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,this.uvBuffer);this.dirtyUVS&&(this.dirtyUVS= !1,a.bufferSubData(a.ARRAY_BUFFER,0,this.uvs));a.vertexAttribPointer(b.textureCoordAttribute,2,a.FLOAT,!1,0,0);a.activeTexture(a.TEXTURE0);a.bindTexture(a.TEXTURE_2D,this.texture._glTexture);a.bindBuffer(a.ARRAY_BUFFER,this.colorBuffer);this.dirtyColors&&(this.dirtyColors=!1,a.bufferSubData(a.ARRAY_BUFFER,0,this.colors));a.vertexAttribPointer(b.colorAttribute,1,a.FLOAT,!1,0,0);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer);a.drawElements(a.TRIANGLES,6*this.size,a.UNSIGNED_SHORT,0)}}; PIXI.CanvasRenderer=function(a,b,c){this.width=a||800;this.height=b||600;this.refresh=!0;this.view=c||document.createElement("canvas");this.view.width=this.width;this.view.height=this.height;this.count=0;this.context=this.view.getContext("2d")};PIXI.CanvasRenderer.constructor=PIXI.CanvasRenderer; PIXI.CanvasRenderer.prototype.render=function(a){a.__childrenAdded=[];a.__childrenRemoved=[];PIXI.texturesToUpdate=[];this.context.setTransform(1,0,0,1,0,0);a.updateTransform();this.context.setTransform(1,0,0,1,0,0);this.view.style.backgroundColor!=a.backgroundColorString&&(this.view.style.backgroundColor=a.backgroundColorString);this.context.clearRect(0,0,this.width,this.height);this.renderDisplayObject(a);a.interactive&&!a._interactiveEventsAdded&&(a._interactiveEventsAdded=!0,a.interactionManager.setTarget(this))}; PIXI.CanvasRenderer.prototype.resize=function(a,b){this.width=a;this.height=b;this.view.width=a;this.view.height=b}; PIXI.CanvasRenderer.prototype.renderDisplayObject=function(a){var b=a.worldTransform,c=this.context;c.globalCompositeOperation="source-over";if(a.visible){if(a instanceof PIXI.Sprite){var d=a.texture.frame;d&&(c.globalAlpha=a.worldAlpha,c.setTransform(b[0],b[3],b[1],b[4],b[2],b[5]),c.drawImage(a.texture.baseTexture.source,d.x,d.y,d.width,d.height,(a.anchor.x-a.texture.trim.x)*-d.width,(a.anchor.y-a.texture.trim.y)*-d.height,a.width,a.height))}else a instanceof PIXI.Strip&&(c.setTransform(b[0],b[3], b[1],b[4],b[2],b[5]),this.renderStrip(a));for(b=0;b<a.children.length;b++)this.renderDisplayObject(a.children[b])}};PIXI.CanvasRenderer.prototype.renderStripFlat=function(a){var b=this.context;a=a.verticies;var c=a.length/2;this.count++;b.beginPath();for(var d=1;d<c-2;d++){var e=2*d,f=a[e+2],g=a[e+4],h=a[e+3],k=a[e+5];b.moveTo(a[e],a[e+1]);b.lineTo(f,h);b.lineTo(g,k)}b.fillStyle="#FF0000";b.fill();b.closePath()}; PIXI.CanvasRenderer.prototype.renderStrip=function(a){var b=this.context,c=a.verticies,d=a.uvs,e=c.length/2;this.count++;for(var f=1;f<e-2;f++){var g=2*f,h=c[g],k=c[g+2],m=c[g+4],n=c[g+1],p=c[g+3],j=c[g+5],q=d[g]*a.texture.width,r=d[g+2]*a.texture.width,s=d[g+4]*a.texture.width,t=d[g+1]*a.texture.height,u=d[g+3]*a.texture.height,g=d[g+5]*a.texture.height;b.save();b.beginPath();b.moveTo(h,n);b.lineTo(k,p);b.lineTo(m,j);b.closePath();b.clip();var l=q*u+t*s+r*g-u*s-t*r-q*g;b.transform((h*u+t*m+k*g-u* m-t*k-h*g)/l,(n*u+t*j+p*g-u*j-t*p-n*g)/l,(q*k+h*s+r*m-k*s-h*r-q*m)/l,(q*p+n*s+r*j-p*s-n*r-q*j)/l,(q*u*m+t*k*s+h*r*g-h*u*s-t*r*m-q*k*g)/l,(q*u*j+t*p*s+n*r*g-n*u*s-t*r*j-q*p*g)/l);b.drawImage(a.texture.baseTexture.source,0,0);b.restore()}}; PIXI.Strip=function(a,b,c){PIXI.DisplayObjectContainer.call(this);this.texture=a;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=b;this.height=c;a.baseTexture.hasLoaded?(this.width=this.texture.frame.width, this.height=this.texture.frame.height,this.updateFrame=!0):(this.onTextureUpdateBind=this.onTextureUpdate.bind(this),this.texture.addEventListener("update",this.onTextureUpdateBind));this.renderable=!0};PIXI.Strip.constructor=PIXI.Strip;PIXI.Strip.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Strip.prototype.setTexture=function(a){this.texture=a;this.width=a.frame.width;this.height=a.frame.height;this.updateFrame=!0}; PIXI.Strip.prototype.onTextureUpdate=function(){this.updateFrame=!0};PIXI.Rope=function(a,b){PIXI.Strip.call(this,a);this.points=b;try{this.verticies=new Float32Array(4*b.length),this.uvs=new Float32Array(4*b.length),this.colors=new Float32Array(2*b.length),this.indices=new Uint16Array(2*b.length)}catch(c){this.verticies=verticies,this.uvs=uvs,this.colors=colors,this.indices=indices}this.refresh()};PIXI.Rope.constructor=PIXI.Rope;PIXI.Rope.prototype=Object.create(PIXI.Strip.prototype); PIXI.Rope.prototype.refresh=function(){var a=this.points;if(!(1>a.length)){var b=this.uvs,c=this.indices,d=this.colors;this.count-=0.2;b[0]=0;b[1]=1;b[2]=0;b[3]=1;d[0]=1;d[1]=1;c[0]=0;c[1]=1;for(var a=a.length,e=1;e<a;e++){var f=4*e,g=e/(a-1);b[f]=g;b[f+1]=0;b[f+2]=g;b[f+3]=1;f=2*e;d[f]=1;d[f+1]=1;f=2*e;c[f]=f;c[f+1]=f+1}}}; PIXI.Rope.prototype.updateTransform=function(){var a=this.points;if(!(1>a.length)){var b=this.verticies,c=a[0],d,e=d=0,f=a[0];this.count-=0.2;b[0]=f.x+d;b[1]=f.y+e;b[2]=f.x-d;b[3]=f.y-e;for(var g=a.length,h=1;h<g;h++){var f=a[h],k=4*h;d=h<a.length-1?a[h+1]:f;e=-(d.x-c.x);d=d.y-c.y;var c=Math.sqrt(d*d+e*e),m=this.texture.height/2;d/=c;e/=c;d*=m;e*=m;b[k]=f.x+d;b[k+1]=f.y+e;b[k+2]=f.x-d;b[k+3]=f.y-e;c=f}PIXI.DisplayObjectContainer.prototype.updateTransform.call(this)}}; PIXI.Rope.prototype.setTexture=function(a){this.texture=a;this.updateFrame=!0};PIXI.BaseTextureCache={};PIXI.texturesToUpdate=[]; PIXI.BaseTexture=function(a){PIXI.EventTarget.call(this);this.height=this.width=100;this.source=a;if(this.source instanceof Image)if(this.source.complete)this.hasLoaded=!0,this.width=this.source.width,this.height=this.source.height,PIXI.texturesToUpdate.push(this);else{var b=this;this.source.onload=function(){b.hasLoaded=!0;b.width=b.source.width;b.height=b.source.height;PIXI.texturesToUpdate.push(b);b.dispatchEvent({type:"loaded",content:b})}}else this.hasLoaded=!0,this.width=this.source.width,this.height= this.source.height,PIXI.texturesToUpdate.push(this)};PIXI.BaseTexture.constructor=PIXI.BaseTexture;PIXI.BaseTexture.prototype.fromImage=function(){};PIXI.TextureCache={};PIXI.FrameCache={}; PIXI.Texture=function(a,b){PIXI.EventTarget.call(this);b||(this.noFrame=!0,b=new PIXI.Rectangle(0,0,1,1));this.trim=new PIXI.Point;this.baseTexture=a;this.frame=b;this.scope=this;if(a.hasLoaded)this.noFrame&&(b=new PIXI.Rectangle(0,0,a.width,a.height)),this.setFrame(b);else{var c=this;a.addEventListener("loaded",function(){c.onBaseTextureLoaded()})}};PIXI.Texture.constructor=PIXI.Texture; PIXI.Texture.prototype.onBaseTextureLoaded=function(){var a=this.baseTexture;a.removeEventListener("loaded",this.onLoaded);this.noFrame&&(this.frame=new PIXI.Rectangle(0,0,a.width,a.height));this.noFrame=!1;this.width=this.frame.width;this.height=this.frame.height;this.scope.dispatchEvent({type:"update",content:this})}; PIXI.Texture.prototype.setFrame=function(a){this.frame=a;this.width=a.width;this.height=a.height;if(a.x+a.width>this.baseTexture.width||a.y+a.height>this.baseTexture.height)throw Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);}; PIXI.Texture.fromImage=function(a,b){var c=PIXI.TextureCache[a];c||(c=PIXI.BaseTextureCache[a],c||(c=new Image,b&&(c.crossOrigin=""),c.src=a,c=new PIXI.BaseTexture(c),PIXI.BaseTextureCache[a]=c),c=new PIXI.Texture(c),PIXI.TextureCache[a]=c);return c};PIXI.Texture.fromFrame=function(a){var b=PIXI.TextureCache[a];if(!b)throw Error("The frameId '"+a+"' does not exist in the texture cache "+this);return b}; PIXI.Texture.fromCanvas=function(a){var b=PIXI.TextureCache[a];b||(b=PIXI.BaseTextureCache[a],b||(b=new PIXI.BaseTexture(a),PIXI.BaseTextureCache[a]=b),b=new PIXI.Texture(b),PIXI.TextureCache[a]=b);return b};PIXI.Texture.addTextureToCache=function(a,b){PIXI.TextureCache[b]=a};PIXI.Texture.removeTextureFromCache=function(a){var b=PIXI.TextureCache[a];PIXI.TextureCache[a]=null;return b}; PIXI.SpriteSheetLoader=function(a){PIXI.EventTarget.call(this);this.url=a;this.baseUrl=a.replace(/[^\/]*$/,"");this.texture;this.frames={};this.crossorigin=!1};PIXI.SpriteSheetLoader.constructor=PIXI.SpriteSheetLoader; PIXI.SpriteSheetLoader.prototype.load=function(){this.ajaxRequest=new AjaxRequest;var a=this;this.ajaxRequest.onreadystatechange=function(){a.onLoaded()};this.ajaxRequest.open("GET",this.url,!0);this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/json");this.ajaxRequest.send(null)}; PIXI.SpriteSheetLoader.prototype.onLoaded=function(){if(4==this.ajaxRequest.readyState&&(200==this.ajaxRequest.status||-1==window.location.href.indexOf("http"))){var a=eval("("+this.ajaxRequest.responseText+")");this.texture=PIXI.Texture.fromImage(this.baseUrl+a.meta.image,this.crossorigin).baseTexture;var a=a.frames,b;for(b in a){var c=a[b].frame;PIXI.TextureCache[b]=new PIXI.Texture(this.texture,{x:c.x,y:c.y,width:c.w,height:c.h});a[b].trimmed&&(PIXI.TextureCache[b].realSize=a[b].spriteSourceSize, PIXI.TextureCache[b].trim.x=0)}if(this.texture.hasLoaded)this.dispatchEvent({type:"loaded",content:this});else{var d=this;this.texture.addEventListener("loaded",function(){d.dispatchEvent({type:"loaded",content:d})})}}};PIXI.AssetLoader=function(a){PIXI.EventTarget.call(this);this.assetURLs=a;this.assets=[];this.crossorigin=!1};PIXI.AssetLoader.constructor=PIXI.AssetLoader; PIXI.AssetLoader.prototype.load=function(){this.loadCount=this.assetURLs.length;for(var a=["jpeg","jpg","png","gif"],b=["json"],c=0;c<this.assetURLs.length;c++){for(var d=this.assetURLs[c],e=d.split(".").pop().toLowerCase(),f=null,g=0;g<a.length;g++)if(e==a[g]){f="img";break}if("img"!=f)for(g=0;g<b.length;g++)if(e==b[g]){f="atlas";break}if("img"==f)if(d=PIXI.Texture.fromImage(d,this.crossorigin),d.baseTexture.hasLoaded){if(this.loadCount--,0==this.loadCount&&(this.dispatchEvent({type:"onComplete", content:this}),this.onComplete))this.onComplete()}else{var h=this;d.baseTexture.addEventListener("loaded",function(){h.onAssetLoaded()});this.assets.push(d)}else if("atlas"==f)d=new PIXI.SpriteSheetLoader(d),d.crossorigin=this.crossorigin,this.assets.push(d),h=this,d.addEventListener("loaded",function(){h.onAssetLoaded()}),d.load();else throw Error(d+" is an unsupported file type "+this);}}; PIXI.AssetLoader.prototype.onAssetLoaded=function(){this.loadCount--;this.dispatchEvent({type:"onProgress",content:this});if(this.onProgress)this.onProgress();if(0==this.loadCount&&(this.dispatchEvent({type:"onComplete",content:this}),this.onComplete))this.onComplete()};