8)throw new Error("max arguments reached");var h=this.name,a=this.items;this._aliasCount++;for(var m=0,p=a.length;m0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},t.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},t.prototype.remove=function(t){var e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},t.prototype.contains=function(t){return-1!==this.items.indexOf(t)},t.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},t.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),t}();exports.Runner=t,Object.defineProperties(t.prototype,{dispatch:{value:t.prototype.emit},run:{value:t.prototype.emit}});
+},{}],"F3Q6":[function(require,module,exports) {
+"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UPDATE_PRIORITY=exports.TickerPlugin=exports.Ticker=void 0;var t,e=require("@pixi/settings");e.settings.TARGET_FPMS=.06,exports.UPDATE_PRIORITY=t,function(t){t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY"}(t||(exports.UPDATE_PRIORITY=t={}));var i=function(){function t(t,e,i,s){void 0===e&&(e=null),void 0===i&&(i=0),void 0===s&&(s=!1),this.fn=t,this.context=e,this.priority=i,this.once=s,this.next=null,this.previous=null,this._destroyed=!1}return t.prototype.match=function(t,e){return void 0===e&&(e=null),this.fn===t&&this.context===e},t.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},t.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},t.prototype.destroy=function(t){void 0===t&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},t}(),s=function(){function s(){var t=this;this._head=new i(null,null,1/0),this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this.autoStart=!1,this.deltaTime=1,this.deltaMS=1/e.settings.TARGET_FPMS,this.elapsedMS=1/e.settings.TARGET_FPMS,this.lastTime=-1,this.speed=1,this.started=!1,this._protected=!1,this._lastFrame=-1,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&null===t._requestId&&t._head.next&&(t._requestId=requestAnimationFrame(t._tick)))}}return s.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},s.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},s.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},s.prototype.add=function(e,s,n){return void 0===n&&(n=t.NORMAL),this._addListener(new i(e,s,n))},s.prototype.addOnce=function(e,s,n){return void 0===n&&(n=t.NORMAL),this._addListener(new i(e,s,n,!0))},s.prototype._addListener=function(t){var e=this._head.next,i=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}else t.connect(i);return this._startIfPossible(),this},s.prototype.remove=function(t,e){for(var i=this._head.next;i;)i=i.match(t,e)?i.destroy():i.next;return this._head.next||this._cancelIfNeeded(),this},s.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},s.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},s.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},s.prototype.update=function(t){var i;if(void 0===t&&(t=performance.now()),t>this.lastTime){if((i=this.elapsedMS=t-this.lastTime)>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){var s=t-this._lastFrame|0;if(s=0;--n){var s=d[n];if(s.test&&s.test(t,r))return new s(t,e)}return new l(t,e)}var c=function(t){function e(e,r){var i=r||{},n=i.width,s=i.height;if(!n||!s)throw new Error("BufferResource width or height invalid");t.call(this,n,s),this.data=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.upload=function(t,e,i){var n=t.gl;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===r.ALPHA_MODES.UNPACK),i.width===e.width&&i.height===e.height?n.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.type,this.data):(i.width=e.width,i.height=e.height,n.texImage2D(e.target,0,i.internalFormat,e.width,e.height,0,e.format,i.type,this.data)),!0},e.prototype.dispose=function(){this.data=null},e.test=function(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array},e}(a),f={scaleMode:r.SCALE_MODES.NEAREST,format:r.FORMATS.RGBA,alphaMode:r.ALPHA_MODES.NPM},v=function(t){function n(n,s){void 0===n&&(n=null),void 0===s&&(s=null),t.call(this);var o=(s=s||{}).alphaMode,h=s.mipmap,u=s.anisotropicLevel,l=s.scaleMode,d=s.width,c=s.height,f=s.wrapMode,v=s.format,_=s.type,y=s.target,g=s.resolution,m=s.resourceOptions;!n||n instanceof a||((n=p(n,m)).internal=!0),this.width=d||0,this.height=c||0,this.resolution=g||i.settings.RESOLUTION,this.mipmap=void 0!==h?h:i.settings.MIPMAP_TEXTURES,this.anisotropicLevel=void 0!==u?u:i.settings.ANISOTROPIC_LEVEL,this.wrapMode=f||i.settings.WRAP_MODE,this.scaleMode=void 0!==l?l:i.settings.SCALE_MODE,this.format=v||r.FORMATS.RGBA,this.type=_||r.TYPES.UNSIGNED_BYTE,this.target=y||r.TARGETS.TEXTURE_2D,this.alphaMode=void 0!==o?o:r.ALPHA_MODES.UNPACK,void 0!==s.premultiplyAlpha&&(this.premultiplyAlpha=s.premultiplyAlpha),this.uid=(0,e.uid)(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=d>0&&c>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.setResource(n)}t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n;var s={realWidth:{configurable:!0},realHeight:{configurable:!0}};return s.realWidth.get=function(){return Math.ceil(this.width*this.resolution-1e-4)},s.realHeight.get=function(){return Math.ceil(this.height*this.resolution-1e-4)},n.prototype.setStyle=function(t,e){var r;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this},n.prototype.setSize=function(t,e,r){return this.resolution=r||this.resolution,this.width=t,this.height=e,this._refreshPOT(),this.update(),this},n.prototype.setRealSize=function(t,e,r){return this.resolution=r||this.resolution,this.width=t/this.resolution,this.height=e/this.resolution,this._refreshPOT(),this.update(),this},n.prototype._refreshPOT=function(){this.isPowerOfTwo=(0,e.isPow2)(this.realWidth)&&(0,e.isPow2)(this.realHeight)},n.prototype.setResolution=function(t){var e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=this.width*e/t,this.height=this.height*e/t,this.emit("update",this)),this._refreshPOT(),this)},n.prototype.setResource=function(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this},n.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},n.prototype.onError=function(t){this.emit("error",this,t)},n.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete e.BaseTextureCache[this.cacheId],delete e.TextureCache[this.cacheId],this.cacheId=null),this.dispose(),n.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},n.prototype.dispose=function(){this.emit("dispose",this)},n.from=function(t,r,s){void 0===s&&(s=i.settings.STRICT_TEXTURE_CACHE);var o="string"==typeof t,a=null;o?a=t:(t._pixiId||(t._pixiId="pixiid_"+(0,e.uid)()),a=t._pixiId);var h=e.BaseTextureCache[a];if(o&&s&&!h)throw new Error('The cacheId "'+a+'" does not exist in BaseTextureCache.');return h||((h=new n(t,r)).cacheId=a,n.addToCache(h,a)),h},n.fromBuffer=function(t,e,i,s){t=t||new Float32Array(e*i*4);var o=new c(t,{width:e,height:i}),a=t instanceof Float32Array?r.TYPES.FLOAT:r.TYPES.UNSIGNED_BYTE;return new n(o,Object.assign(f,s||{width:e,height:i,type:a}))},n.addToCache=function(t,r){r&&(-1===t.textureCacheIds.indexOf(r)&&t.textureCacheIds.push(r),e.BaseTextureCache[r]&&console.warn("BaseTexture added to the cache with an id ["+r+"] that already had an entry"),e.BaseTextureCache[r]=t)},n.removeFromCache=function(t){if("string"==typeof t){var r=e.BaseTextureCache[t];if(r){var i=r.textureCacheIds.indexOf(t);return i>-1&&r.textureCacheIds.splice(i,1),delete e.BaseTextureCache[t],r}}else if(t&&t.textureCacheIds){for(var n=0;n]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var x=function(t){function e(e,r){if(r=r||{},!(e instanceof HTMLVideoElement)){var i=document.createElement("video");i.setAttribute("preload","auto"),i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline",""),"string"==typeof e&&(e=[e]),t.crossOrigin(i,e[0].src||e[0],r.crossorigin);for(var n=0;n0&&!1===t.paused&&!1===t.ended&&t.readyState>2},e.prototype._isSourceReady=function(){return 3===this.source.readyState||4===this.source.readyState},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),!this._isAutoUpdating&&this.autoUpdate&&(n.Ticker.shared.add(this.update,this),this._isAutoUpdating=!0)},e.prototype._onPlayStop=function(){this._isAutoUpdating&&(n.Ticker.shared.remove(this.update,this),this._isAutoUpdating=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var e=this.valid;this.resize(t.videoWidth,t.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isAutoUpdating&&n.Ticker.shared.remove(this.update,this),this.source&&(this.source.removeEventListener("error",this._onError,!0),this.source.pause(),this.source.src="",this.source.load()),t.prototype.dispose.call(this)},r.autoUpdate.get=function(){return this._autoUpdate},r.autoUpdate.set=function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isAutoUpdating?(n.Ticker.shared.remove(this.update,this),this._isAutoUpdating=!1):this._autoUpdate&&!this._isAutoUpdating&&(n.Ticker.shared.add(this.update,this),this._isAutoUpdating=!0))},r.updateFPS.get=function(){return this._updateFPS},r.updateFPS.set=function(t){t!==this._updateFPS&&(this._updateFPS=t)},e.test=function(t,r){return t instanceof HTMLVideoElement||e.TYPES.indexOf(r)>-1},Object.defineProperties(e.prototype,r),e}(u);x.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"];var E=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.test=function(t){return!!window.createImageBitmap&&t instanceof ImageBitmap},e}(u);d.push(l,E,y,x,m,c,g,_);var T={INSTALLED:d,autoDetectResource:p,ArrayResource:_,BufferResource:c,CanvasResource:y,CubeResource:g,ImageResource:l,ImageBitmapResource:E,SVGResource:m,VideoResource:x,Resource:a,BaseImageResource:u};exports.resources=T;var b=function(t){this.renderer=t};exports.System=b,b.prototype.destroy=function(){this.renderer=null};var w=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.upload=function(t,e,i){var n=t.gl;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===r.ALPHA_MODES.UNPACK),i.width===e.width&&i.height===e.height?n.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.type,this.data):(i.width=e.width,i.height=e.height,n.texImage2D(e.target,0,n.DEPTH_COMPONENT16,e.width,e.height,0,e.format,e.type,this.data)),!0},e}(c),S=function(e,r){this.width=Math.ceil(e||100),this.height=Math.ceil(r||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new t.Runner("disposeFramebuffer",2)};exports.Framebuffer=S;var A={colorTexture:{configurable:!0}};A.colorTexture.get=function(){return this.colorTextures[0]},S.prototype.addColorTexture=function(t,e){return void 0===t&&(t=0),this.colorTextures[t]=e||new v(null,{scaleMode:0,resolution:1,mipmap:!1,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},S.prototype.addDepthTexture=function(t){return this.depthTexture=t||new v(new w(null,{width:this.width,height:this.height}),{scaleMode:0,resolution:1,width:this.width,height:this.height,mipmap:!1,format:r.FORMATS.DEPTH_COMPONENT,type:r.TYPES.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},S.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},S.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},S.prototype.resize=function(t,e){if(t=Math.ceil(t),e=Math.ceil(e),t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var r=0;r-1&&r.textureCacheIds.splice(i,1),delete e.TextureCache[t],r}}else if(t&&t.textureCacheIds){for(var n=0;nthis.baseTexture.width,o=r+n>this.baseTexture.height;if(s||o){var a=s&&o?"and":"or",h="X: "+e+" + "+i+" = "+(e+i)+" > "+this.baseTexture.width,u="Y: "+r+" + "+n+" = "+(r+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+h+" "+a+" "+u)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=t),this.valid&&this.updateUvs()},n.rotate.get=function(){return this._rotate},n.rotate.set=function(t){this._rotate=t,this.valid&&this.updateUvs()},n.width.get=function(){return this.orig.width},n.height.get=function(){return this.orig.height},Object.defineProperties(r.prototype,n),r}(e.EventEmitter);function M(){var t=document.createElement("canvas");t.width=16,t.height=16;var e=t.getContext("2d");return e.fillStyle="white",e.fillRect(0,0,16,16),new R(new v(new y(t)))}function P(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}exports.Texture=R,R.EMPTY=new R(new v),P(R.EMPTY),P(R.EMPTY.baseTexture),R.WHITE=M(),P(R.WHITE),P(R.WHITE.baseTexture);var D=function(t){function e(e,r){var i=null;if(!(e instanceof C)){var n=arguments[1],s=arguments[2],o=arguments[3],a=arguments[4];console.warn("Please use RenderTexture.create("+n+", "+s+") instead of the ctor directly."),i=arguments[0],r=null,e=new C({width:n,height:s,scaleMode:o,resolution:a})}t.call(this,e,r),this.legacyRenderer=i,this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.resize=function(t,e,r){void 0===r&&(r=!0),t=Math.ceil(t),e=Math.ceil(e),this.valid=t>0&&e>0,this._frame.width=this.orig.width=t,this._frame.height=this.orig.height=e,r&&this.baseTexture.resize(t,e),this.updateUvs()},e.prototype.setResolution=function(t){var e=this.baseTexture;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))},e.create=function(t){return"number"==typeof t&&(t={width:t,height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]}),new e(new C(t))},e}(R);exports.RenderTexture=D;var N=function(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0};exports.RenderTexturePool=N,N.prototype.createTexture=function(t,e){var r=new C(Object.assign({width:t,height:e,resolution:1},this.textureOptions));return new D(r)},N.prototype.getOptimalTexture=function(t,r,i){void 0===i&&(i=1);var n=N.SCREEN_KEY;t*=i,r*=i,this.enableFullScreen&&t===this._pixelsWidth&&r===this._pixelsHeight||(n=(65535&(t=(0,e.nextPow2)(t)))<<16|65535&(r=(0,e.nextPow2)(r))),this.texturePool[n]||(this.texturePool[n]=[]);var s=this.texturePool[n].pop();return s||(s=this.createTexture(t,r)),s.filterPoolKey=n,s.setResolution(i),s},N.prototype.getFilterTexture=function(t,e){var r=this.getOptimalTexture(t.width,t.height,e||t.resolution);return r.filterFrame=t.filterFrame,r},N.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},N.prototype.returnFilterTexture=function(t){this.returnTexture(t)},N.prototype.clear=function(t){if(t=!1!==t)for(var e in this.texturePool){var r=this.texturePool[e];if(r)for(var i=0;i0&&t.height>0,r)for(var i=0;i1){for(var u=0;u=0;--i)t[i]=r[i]||null,t[i]&&(t[i]._batchLocation=i)},e.prototype.boundArray=function(t,e,r,i){for(var n=t.elements,s=t.ids,o=t.count,a=0,h=0;h=0&&l=r.ENV.WEBGL2&&(n=t.getContext("webgl2",e)),n)this.webGLVersion=2;else if(this.webGLVersion=1,!(n=t.getContext("webgl",e)||t.getContext("experimental-webgl",e)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=n,this.getExtensions(),n},e.prototype.getExtensions=function(){var t=this.gl;1===this.webGLVersion?Object.assign(this.extensions,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBKIT_WEBGL_depth_texture"),loseContext:t.getExtension("WEBGL_lose_context"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,{anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),colorBufferFloat:t.getExtension("EXT_color_buffer_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear")})},e.prototype.handleContextLost=function(t){t.preventDefault()},e.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.run(this.gl)},e.prototype.destroy=function(){var t=this.renderer.view;t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},e.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},e.prototype.validateContext=function(t){t.getContextAttributes().stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly")},Object.defineProperties(e.prototype,n),e}(b),et=function(t){function e(e){t.call(this,e),this.managedFramebuffers=[],this.unknownFramebuffer=new S(10,10)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0}};return e.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new s.Rectangle,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var e=this.renderer.context.extensions.drawBuffers,n=this.renderer.context.extensions.depthTexture;i.settings.PREFER_ENV===r.ENV.WEBGL_LEGACY&&(e=null,n=null),e?t.drawBuffers=function(t){return e.drawBuffersWEBGL(t)}:(this.hasMRT=!1,t.drawBuffers=function(){}),n||(this.writeDepthTexture=!1)}},e.prototype.bind=function(t,e){var r=this.gl;if(t){var i=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,i.framebuffer)),i.dirtyId!==t.dirtyId&&(i.dirtyId=t.dirtyId,i.dirtyFormat!==t.dirtyFormat?(i.dirtyFormat=t.dirtyFormat,this.updateFramebuffer(t)):i.dirtySize!==t.dirtySize&&(i.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var n=0;n1&&e.drawBuffers(n),t.depthTexture)&&this.writeDepthTexture){var a=t.depthTexture;this.renderer.texture.bind(a,0),e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a._glTextures[this.CONTEXT_UID].texture,0)}r.stencil||!t.stencil&&!t.depth||(r.stencil=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,r.stencil),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height),t.depthTexture||e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r.stencil))},e.prototype.disposeFramebuffer=function(t,e){var r=t.glFramebuffers[this.CONTEXT_UID],i=this.gl;if(r){delete t.glFramebuffers[this.CONTEXT_UID];var n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(r.framebuffer),r.stencil&&i.deleteRenderbuffer(r.stencil))}},e.prototype.disposeAll=function(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var r=0;r=i.data.byteLength)e.bufferSubData(s,0,i.data);else{var o=i.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;n.byteLength=i.data.byteLength,e.bufferData(s,i.data,o)}}}},e.prototype.checkCompatibility=function(t,e){var r=t.attributes,i=e.attributeData;for(var n in i)if(!r[n])throw new Error('shader and geometry incompatible, geometry missing the "'+n+'" attribute')},e.prototype.getSignature=function(t,e){var r=t.attributes,i=e.attributeData,n=["g",t.id];for(var s in r)i[s]&&n.push(s);return n.join("-")},e.prototype.initGeometryVao=function(t,e){this.checkCompatibility(t,e);var r=this.gl,i=this.CONTEXT_UID,n=this.getSignature(t,e),s=t.glVertexArrayObjects[this.CONTEXT_UID],o=s[n];if(o)return s[e.id]=o,o;var a=t.buffers,h=t.attributes,u={},l={};for(var d in a)u[d]=0,l[d]=0;for(var p in h)!h[p].size&&e.attributeData[p]?h[p].size=e.attributeData[p].size:h[p].size||console.warn("PIXI Geometry attribute '"+p+"' size cannot be determined (likely the bound shader does not have the attribute)"),u[h[p].buffer]+=h[p].size*it[h[p].type];for(var c in h){var f=h[c],v=f.size;void 0===f.stride&&(u[f.buffer]===v*it[f.type]?f.stride=0:f.stride=u[f.buffer]),void 0===f.start&&(f.start=l[f.buffer],l[f.buffer]+=v*it[f.type])}o=r.createVertexArray(),r.bindVertexArray(o);for(var _=0;_=r.ENV.WEBGL2&&(t=e.getContext("webgl2",{})),t||((t=e.getContext("webgl",{})||e.getContext("experimental-webgl",{}))?t.getExtension("WEBGL_draw_buffers"):t=null),pt=t}return pt}function ft(){if(!lt){lt=r.PRECISION.MEDIUM;var t=ct();if(t&&t.getShaderPrecisionFormat){var e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);lt=e.precision?r.PRECISION.HIGH:r.PRECISION.MEDIUM}}return lt}function vt(t,e,i){if("precision"!==t.substring(0,9)){var n=e;return e===r.PRECISION.HIGH&&i!==r.PRECISION.HIGH&&(n=r.PRECISION.MEDIUM),"precision "+n+" float;\n"+t}return i!==r.PRECISION.HIGH&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t}var _t={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function yt(t){return _t[t]}var gt=null,mt={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray"};function xt(t,e){if(!gt){var r=Object.keys(mt);gt={};for(var i=0;i0&&(e+="\nelse "),re.name?1:-1});for(var u=0;u0?this._useCurrent():t.disable(t.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t=this.maskStack[this.maskStack.length-1]._scissorRect,e=this.renderer.renderTexture.current,r=this.renderer.projection,i=r.transform,n=r.sourceFrame,s=r.destinationFrame,o=e?e.resolution:this.renderer.resolution,a=(t.x-n.x)*o+s.x,h=(t.y-n.y)*o+s.y,u=t.width*o,l=t.height*o;i&&(a+=i.tx*o,h+=i.ty*o),e||(h=this.renderer.height-l-h),this.renderer.gl.scissor(a,h,u,l)},e}(te),re=function(t){function e(e){t.call(this,e),this.glConst=WebGLRenderingContext.STENCIL_TEST}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var e=t.maskObject,r=this.renderer.gl,i=t._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),r.enable(r.STENCIL_TEST)),t._stencilCounter++,r.colorMask(!1,!1,!1,!1),r.stencilFunc(r.EQUAL,i,this._getBitwiseMask()),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,this._useCurrent()},e.prototype.pop=function(t){var e=this.renderer.gl;0===this.getStackLength()?(e.disable(e.STENCIL_TEST),e.clear(e.STENCIL_BUFFER_BIT),e.clearStencil(0)):(e.colorMask(!1,!1,!1,!1),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,this._useCurrent())},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.colorMask(!0,!0,!0,!0),t.stencilFunc(t.EQUAL,this.getStackLength(),this._getBitwiseMask()),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e.prototype._getBitwiseMask=function(){return(1<>=1,r++;this.stateId=t.data}for(var i=0;ithis.checkCountMax&&(this.checkCount=0,this.run())))},e.prototype.run=function(){for(var t=this.renderer.texture,e=t.managedTextures,r=!1,i=0;ithis.maxIdle&&(t.destroyTexture(n,!0),e[i]=null,r=!0)}if(r){for(var s=0,o=0;o=0;r--)this.unload(t.children[r])},e}(b),ye=function(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=6408,this.internalFormat=5121};exports.GLTexture=ye;var ge=function(t){function i(e){t.call(this,e),this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new v}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion;var e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(var r=0;r=1:e.mipmap=0,2===this.webGLVersion||t.isPowerOfTwo?e.wrapMode=t.wrapMode:e.wrapMode=r.WRAP_MODES.CLAMP,t.resource&&t.resource.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)},i.prototype.setStyle=function(t,e){var i=this.gl;if(e.mipmap&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&t.anisotropicLevel>0&&t.scaleMode===r.SCALE_MODES.LINEAR){var s=Math.min(t.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,n.TEXTURE_MAX_ANISOTROPY_EXT,s)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode?i.LINEAR:i.NEAREST)},i}(b),me={FilterSystem:Z,BatchSystem:$,ContextSystem:tt,FramebufferSystem:et,GeometrySystem:nt,MaskSystem:Jt,ScissorSystem:ee,StencilSystem:re,ProjectionSystem:ie,RenderTextureSystem:se,ShaderSystem:he,StateSystem:ve,TextureGCSystem:_e,TextureSystem:ge};exports.systems=me;var xe=new s.Matrix,Ee=function(t){function n(n,a){t.call(this),(a=Object.assign({},i.settings.RENDER_OPTIONS,a)).roundPixels&&(i.settings.ROUND_PIXELS=a.roundPixels,(0,e.deprecation)("5.0.0","Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS",2)),this.options=a,this.type=r.RENDERER_TYPE.UNKNOWN,this.screen=new s.Rectangle(0,0,a.width,a.height),this.view=a.view||document.createElement("canvas"),this.resolution=a.resolution||i.settings.RESOLUTION,this.transparent=a.transparent,this.autoDensity=a.autoDensity||a.autoResize||!1,this.preserveDrawingBuffer=a.preserveDrawingBuffer,this.clearBeforeRender=a.clearBeforeRender,this._backgroundColor=0,this._backgroundColorRgba=[0,0,0,0],this._backgroundColorString="#000000",this.backgroundColor=a.backgroundColor||this._backgroundColor,this._tempDisplayObjectParent=new o.Container,this._lastObjectRendered=this._tempDisplayObjectParent,this.plugins={}}t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n;var a={width:{configurable:!0},height:{configurable:!0},backgroundColor:{configurable:!0}};return n.prototype.initPlugins=function(t){for(var e in t)this.plugins[e]=new t[e](this)},a.width.get=function(){return this.view.width},a.height.get=function(){return this.view.height},n.prototype.resize=function(t,e){this.screen.width=t,this.screen.height=e,this.view.width=t*this.resolution,this.view.height=e*this.resolution,this.autoDensity&&(this.view.style.width=t+"px",this.view.style.height=e+"px")},n.prototype.generateTexture=function(t,e,r,i){0===(i=i||t.getLocalBounds()).width&&(i.width=1),0===i.height&&(i.height=1);var n=D.create(0|i.width,0|i.height,e,r);return xe.tx=-i.x,xe.ty=-i.y,this.render(t,n,!1,xe,!!t.parent),n},n.prototype.destroy=function(t){for(var e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null;t&&this.view.parentNode&&this.view.parentNode.removeChild(this.view),this.plugins=null,this.type=r.RENDERER_TYPE.UNKNOWN,this.view=null,this.screen=null,this.resolution=0,this.transparent=!1,this.autoDensity=!1,this.blendModes=null,this.options=null,this.preserveDrawingBuffer=!1,this.clearBeforeRender=!1,this._backgroundColor=0,this._backgroundColorRgba=null,this._backgroundColorString=null,this._tempDisplayObjectParent=null,this._lastObjectRendered=null},a.backgroundColor.get=function(){return this._backgroundColor},a.backgroundColor.set=function(t){this._backgroundColor=t,this._backgroundColorString=(0,e.hex2string)(t),(0,e.hex2rgb)(t,this._backgroundColorRgba)},Object.defineProperties(n.prototype,a),n}(e.EventEmitter);exports.AbstractRenderer=Ee;var Te=function(i){function n(o){void 0===o&&(o={}),i.call(this,"WebGL",o),o=this.options,this.type=r.RENDERER_TYPE.WEBGL,this.gl=null,this.CONTEXT_UID=0,this.runners={destroy:new t.Runner("destroy"),contextChange:new t.Runner("contextChange",1),reset:new t.Runner("reset"),update:new t.Runner("update"),postrender:new t.Runner("postrender"),prerender:new t.Runner("prerender"),resize:new t.Runner("resize",2)},this.globalUniforms=new K({projectionMatrix:new s.Matrix},!0),this.addSystem(Jt,"mask").addSystem(tt,"context").addSystem(ve,"state").addSystem(he,"shader").addSystem(ge,"texture").addSystem(nt,"geometry").addSystem(et,"framebuffer").addSystem(ee,"scissor").addSystem(re,"stencil").addSystem(ie,"projection").addSystem(_e,"textureGC").addSystem(Z,"filter").addSystem(se,"renderTexture").addSystem($,"batch"),this.initPlugins(n.__plugins),o.context?this.context.initFromContext(o.context):this.context.initFromOptions({alpha:this.transparent,antialias:o.antialias,premultipliedAlpha:this.transparent&&"notMultiplied"!==this.transparent,stencil:!0,preserveDrawingBuffer:o.preserveDrawingBuffer,powerPreference:this.options.powerPreference}),this.renderingToScreen=!0,(0,e.sayHello)(2===this.context.webGLVersion?"WebGL 2":"WebGL 1"),this.resize(this.options.width,this.options.height)}return i&&(n.__proto__=i),n.prototype=Object.create(i&&i.prototype),n.prototype.constructor=n,n.create=function(t){if((0,e.isWebGLSupported)())return new n(t);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},n.prototype.addSystem=function(t,e){e||(e=t.name);var r=new t(this);if(this[e])throw new Error('Whoops! The name "'+e+'" is already in use');for(var i in this[e]=r,this.runners)this.runners[i].add(r);return this},n.prototype.render=function(t,e,r,i,n){if(this.renderingToScreen=!e,this.runners.prerender.run(),this.emit("prerender"),this.projection.transform=i,!this.context.isLost){if(e||(this._lastObjectRendered=t),!n){var s=t.parent;t.parent=this._tempDisplayObjectParent,t.updateTransform(),t.parent=s}this.renderTexture.bind(e),this.batch.currentRenderer.start(),(void 0!==r?r:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),e&&e.baseTexture.update(),this.runners.postrender.run(),this.projection.transform=null,this.emit("postrender")}},n.prototype.resize=function(t,e){i.prototype.resize.call(this,t,e),this.runners.resize.run(t,e)},n.prototype.reset=function(){return this.runners.reset.run(),this},n.prototype.clear=function(){this.framebuffer.bind(),this.framebuffer.clear()},n.prototype.destroy=function(t){for(var e in this.runners.destroy.run(),this.runners)this.runners[e].destroy();i.prototype.destroy.call(this,t),this.gl=null},n.registerPlugin=function(t,e){n.__plugins=n.__plugins||{},n.__plugins[t]=e},n}(Ee);function be(t){return Te.create(t)}exports.Renderer=Te;var we="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}";exports.defaultVertex=we;var Se="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n";exports.defaultFilterVertex=Se;var Ae=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.from=function(t,r){return new e(new g(t,r))},e}(v);exports.CubeTexture=Ae;var Ce=function(){this.texArray=null,this.blend=0,this.type=r.DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null};exports.BatchDrawCall=Ce;var Ie=function(){this.elements=[],this.ids=[],this.count=0};exports.BatchTextureArray=Ie,Ie.prototype.clear=function(){for(var t=0;tthis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},n.prototype.buildTexturesAndDrawCalls=function(){var t=this._bufferedTextures,e=this.MAX_TEXTURES,r=n._textureArrayPool,i=this.renderer.batch,s=this._tempBoundTextures,o=this.renderer.textureGC.count,a=++v._globalBatch,h=0,u=r[0],l=0;i.copyBoundTextures(s,e);for(var d=0;d=e&&(i.boundArray(u,s,a,e),this.buildDrawCalls(u,l,d),l=d,u=r[++h],++a),p._batchEnabled=a,p.touched=o,u.elements[u.count++]=p)}u.count>0&&(i.boundArray(u,s,a,e),this.buildDrawCalls(u,l,this._bufferSize),++h,++a);for(var c=0;c0&&(e+="\nelse "),r=0;c--){var l=p[c],u=this.recursiveFindHit(t,l,i,n,a);if(u){if(!l.parent)continue;a=!1,u&&(t.target&&(n=!1),s=!0)}}return o&&(n&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(r)&&(s=!0),e.interactive&&(s&&!t.target&&(t.target=e),i&&i(t,e,!!s))),s},p.prototype.findHit=function(t,e,i,n){this.recursiveFindHit(t,e,i,n,!1)};var c={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(t){t?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};exports.interactiveTarget=c,i.DisplayObject.mixin(c);var l=1,u={target:null,data:{global:null}},d=function(t){function i(e,i){t.call(this),i=i||{},this.renderer=e,this.autoPreventDefault=void 0===i.autoPreventDefault||i.autoPreventDefault,this.interactionFrequency=i.interactionFrequency||10,this.mouse=new o,this.mouse.identifier=l,this.mouse.global.set(-999999),this.activeInteractionData={},this.activeInteractionData[l]=this.mouse,this.interactionDataPool=[],this.eventData=new s,this.interactionDOMElement=null,this.moveWhenInside=!1,this.eventsAdded=!1,this.mouseOverRenderer=!1,this.supportsTouchEvents="ontouchstart"in window,this.supportsPointerEvents=!!window.PointerEvent,this.onPointerUp=this.onPointerUp.bind(this),this.processPointerUp=this.processPointerUp.bind(this),this.onPointerCancel=this.onPointerCancel.bind(this),this.processPointerCancel=this.processPointerCancel.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.processPointerDown=this.processPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.processPointerMove=this.processPointerMove.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.processPointerOverOut=this.processPointerOverOut.bind(this),this.onPointerOver=this.onPointerOver.bind(this),this.cursorStyles={default:"inherit",pointer:"pointer"},this.currentCursorMode=null,this.cursor=null,this.resolution=1,this.delayedEvents=[],this.search=new p,this.setTargetElement(this.renderer.view,this.renderer.resolution)}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.hitTest=function(t,e){return u.target=null,u.data.global=t,e||(e=this.renderer._lastObjectRendered),this.processInteractive(u,e,null,!0),u.target},i.prototype.setTargetElement=function(t,e){void 0===e&&(e=1),this.removeEvents(),this.interactionDOMElement=t,this.resolution=e,this.addEvents()},i.prototype.addEvents=function(){this.interactionDOMElement&&(e.Ticker.system.add(this.update,this,e.UPDATE_PRIORITY.INTERACTION),window.navigator.msPointerEnabled?(this.interactionDOMElement.style["-ms-content-zooming"]="none",this.interactionDOMElement.style["-ms-touch-action"]="none"):this.supportsPointerEvents&&(this.interactionDOMElement.style["touch-action"]="none"),this.supportsPointerEvents?(window.document.addEventListener("pointermove",this.onPointerMove,!0),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,!0),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,!0),window.addEventListener("pointercancel",this.onPointerCancel,!0),window.addEventListener("pointerup",this.onPointerUp,!0)):(window.document.addEventListener("mousemove",this.onPointerMove,!0),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,!0),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,!0),window.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,!0),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,!0),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,!0)),this.eventsAdded=!0)},i.prototype.removeEvents=function(){this.interactionDOMElement&&(e.Ticker.system.remove(this.update,this),window.navigator.msPointerEnabled?(this.interactionDOMElement.style["-ms-content-zooming"]="",this.interactionDOMElement.style["-ms-touch-action"]=""):this.supportsPointerEvents&&(this.interactionDOMElement.style["touch-action"]=""),this.supportsPointerEvents?(window.document.removeEventListener("pointermove",this.onPointerMove,!0),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,!0),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,!0),window.removeEventListener("pointercancel",this.onPointerCancel,!0),window.removeEventListener("pointerup",this.onPointerUp,!0)):(window.document.removeEventListener("mousemove",this.onPointerMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,!0),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,!0),window.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,!0),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.interactionDOMElement=null,this.eventsAdded=!1)},i.prototype.update=function(t){if(this._deltaTime+=t,!(this._deltaTimethis.maxSegments&&(i=this.maxSegments),i}};exports.GRAPHICS_CURVES=h;var n=function(){this.reset()};exports.FillStyle=n,n.prototype.clone=function(){var t=new n;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t},n.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=t.Texture.WHITE,this.matrix=null,this.visible=!1},n.prototype.destroy=function(){this.texture=null,this.matrix=null};var o={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var r=t.points,s=t.holes,h=e.points,n=e.indices;if(r.length>=6){for(var o=[],a=0;a196*v*v?(E=P-T,A=M-D,E/=C=Math.sqrt(E*E+A*A),A/=C,E*=v,A*=v,f.push(x-E*B,w-A*B),f.push(x+E*R,w+A*R),f.push(x-E*R*B,w-A*B),g++):(f.push(x+(k-x)*B,w+(N-w)*B),f.push(x-(k-x)*R,w-(N-w)*R))}}b=s[2*(d-2)],m=s[2*(d-2)+1],x=s[2*(d-1)],P=-(m-(w=s[2*(d-1)+1])),M=b-x,P/=C=Math.sqrt(P*P+M*M),M/=C,P*=v,M*=v,f.push(x-P*B,w-M*B),f.push(x+P*R,w+M*R);for(var W=i.indices,j=0;jn?l:n,o=(u=r[p+1])a?u:a;r.push(h,o,n,o,n,a,h,a);for(var c=r.length/2,f=0;fu*o}},m.arc=function(t,i,r,s,n,o,a,l,u){for(var p=a-o,c=h._segmentsCount(Math.abs(p)*n,40*Math.ceil(Math.abs(p)/e.PI_2)),f=p/(2*c),d=2*f,g=Math.cos(f),y=Math.sin(f),v=c-1,b=v%1/v,m=0;m<=v;++m){var x=f+o+d*(m+b*m),w=Math.cos(x),S=-Math.sin(x);u.push((g*w+y*S)*n+r,(g*-S+y*w)*n+s)}};var x=function(){};x.curveLength=function(t,e,i,r,s,h,n,o){for(var a=0,l=0,u=0,p=0,c=0,f=0,d=0,g=0,y=0,v=0,b=0,m=t,x=e,w=1;w<=10;++w)v=m-(g=(d=(f=(c=1-(l=w/10))*c)*c)*t+3*f*l*i+3*c*(u=l*l)*s+(p=u*l)*n),b=x-(y=d*e+3*f*l*r+3*c*u*h+p*o),m=g,x=y,a+=Math.sqrt(v*v+b*b);return a},x.curveTo=function(t,e,i,r,s,n,o){var a=o[o.length-2],l=o[o.length-1];o.length-=2;var u=h._segmentsCount(x.curveLength(a,l,t,e,i,r,s,n)),p=0,c=0,f=0,d=0,g=0;o.push(a,l);for(var y=1,v=0;y<=u;++y)f=(c=(p=1-(v=y/u))*p)*p,g=(d=v*v)*v,o.push(f*a+3*c*v*t+3*p*d*i+g*s,f*l+3*c*v*e+3*p*d*r+g*n)};var w=function(){};w.curveLength=function(t,e,i,r,s,h){var n=t-2*i+s,o=e-2*r+h,a=2*i-2*t,l=2*r-2*e,u=4*(n*n+o*o),p=4*(n*a+o*l),c=a*a+l*l,f=2*Math.sqrt(u+p+c),d=Math.sqrt(u),g=2*u*d,y=2*Math.sqrt(c),v=p/d;return(g*f+d*p*(f-y)+(4*c*u-p*p)*Math.log((2*d+v+f)/(v+y)))/(4*g)},w.curveTo=function(t,e,i,r,s){for(var n=s[s.length-2],o=s[s.length-1],a=h._segmentsCount(w.curveLength(n,o,t,e,i,r)),l=0,u=0,p=1;p<=a;++p){var c=p/a;l=n+(t-n)*c,u=o+(e-o)*c,s.push(l+(t+(i-t)*c-l)*c,u+(e+(r-e)*c-u)*c)}};var S=function(){this.reset()};S.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},S.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},S.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0};var _={};_[e.SHAPES.POLY]=o,_[e.SHAPES.CIRC]=a,_[e.SHAPES.ELIP]=a,_[e.SHAPES.RECT]=l,_[e.SHAPES.RREC]=u;var P=[],M=[],T={buildPoly:o,buildCircle:a,buildRectangle:l,buildRoundedRectangle:u,FILL_COMMANDS:_,BATCH_POOL:P,DRAW_CALL_POOL:M,buildLine:f,buildComplexPoly:y,bezierCurveTo:v,Star:b,ArcUtils:m,BezierUtils:x,QuadraticUtils:w,BatchPart:S};exports.graphicsUtils=T;var D=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type,this.points=[],this.holes=[]};exports.GraphicsData=D,D.prototype.clone=function(){return new D(this.shape,this.fillStyle,this.lineStyle,this.matrix)},D.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null};var E=new e.Point,A=new s.Bounds,C=function(h){function n(){h.call(this),this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.dirty=0,this.batchDirty=-1,this.cacheDirty=-1,this.clearDirty=0,this.drawCalls=[],this.batches=[],this.shapeIndex=0,this._bounds=new s.Bounds,this.boundsDirty=-1,this.boundsPadding=0,this.batchable=!1,this.indicesUint16=null,this.uvsFloat32=null,this.closePointEps=1e-4}h&&(n.__proto__=h),n.prototype=Object.create(h&&h.prototype),n.prototype.constructor=n;var a={bounds:{configurable:!0}};return a.bounds.get=function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},n.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},n.prototype.drawShape=function(t,e,i,r){var s=new D(t,e,i,r);return this.graphicsData.push(s),this.dirty++,this},n.prototype.drawHole=function(t,e){if(!this.graphicsData.length)return null;var i=new D(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},n.prototype.destroy=function(t){h.prototype.destroy.call(this,t);for(var e=0;e