iwmlib/lib/3rdparty/pixi/pixi.js.map

1 line
1.6 MiB
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"sources":["node_modules/browser-pack/_prelude.js","node_modules/bit-twiddle/twiddle.js","node_modules/earcut/src/earcut.js","node_modules/eventemitter3/index.js","node_modules/ismobilejs/dist/isMobile.min.js","node_modules/mini-signals/lib/mini-signals.js","node_modules/object-assign/index.js","node_modules/parse-uri/index.js","node_modules/path-browserify/index.js","node_modules/pixi-gl-core/src/GLBuffer.js","node_modules/pixi-gl-core/src/GLFramebuffer.js","node_modules/pixi-gl-core/src/GLShader.js","node_modules/pixi-gl-core/src/GLTexture.js","node_modules/pixi-gl-core/src/VertexArrayObject.js","node_modules/pixi-gl-core/src/createContext.js","node_modules/pixi-gl-core/src/index.js","node_modules/pixi-gl-core/src/setVertexAttribArrays.js","node_modules/pixi-gl-core/src/shader/compileProgram.js","node_modules/pixi-gl-core/src/shader/defaultValue.js","node_modules/pixi-gl-core/src/shader/extractAttributes.js","node_modules/pixi-gl-core/src/shader/extractUniforms.js","node_modules/pixi-gl-core/src/shader/generateUniformAccessObject.js","node_modules/pixi-gl-core/src/shader/index.js","node_modules/pixi-gl-core/src/shader/mapSize.js","node_modules/pixi-gl-core/src/shader/mapType.js","node_modules/pixi-gl-core/src/shader/setPrecision.js","node_modules/process/browser.js","node_modules/punycode/punycode.js","node_modules/querystring-es3/decode.js","node_modules/querystring-es3/encode.js","node_modules/querystring-es3/index.js","node_modules/remove-array-items/index.js","node_modules/resource-loader/lib/Loader.js","node_modules/resource-loader/lib/Resource.js","node_modules/resource-loader/lib/async.js","node_modules/resource-loader/lib/b64.js","node_modules/resource-loader/lib/index.js","node_modules/resource-loader/lib/middlewares/parsing/blob.js","node_modules/url/url.js","node_modules/url/util.js","src/accessibility/AccessibilityManager.js","src/accessibility/accessibleTarget.js","src/accessibility/index.js","src/core/Application.js","src/core/Shader.js","src/core/autoDetectRenderer.js","src/core/const.js","src/core/display/Bounds.js","src/core/display/Container.js","src/core/display/DisplayObject.js","src/core/display/Transform.js","src/core/display/TransformBase.js","src/core/display/TransformStatic.js","src/core/graphics/Graphics.js","src/core/graphics/GraphicsData.js","src/core/graphics/canvas/CanvasGraphicsRenderer.js","src/core/graphics/utils/bezierCurveTo.js","src/core/graphics/webgl/GraphicsRenderer.js","src/core/graphics/webgl/WebGLGraphicsData.js","src/core/graphics/webgl/shaders/PrimitiveShader.js","src/core/graphics/webgl/utils/buildCircle.js","src/core/graphics/webgl/utils/buildLine.js","src/core/graphics/webgl/utils/buildPoly.js","src/core/graphics/webgl/utils/buildRectangle.js","src/core/graphics/webgl/utils/buildRoundedRectangle.js","src/core/index.js","src/core/math/GroupD8.js","src/core/math/Matrix.js","src/core/math/ObservablePoint.js","src/core/math/Point.js","src/core/math/index.js","src/core/math/shapes/Circle.js","src/core/math/shapes/Ellipse.js","src/core/math/shapes/Polygon.js","src/core/math/shapes/Rectangle.js","src/core/math/shapes/RoundedRectangle.js","src/core/renderers/SystemRenderer.js","src/core/renderers/canvas/CanvasRenderer.js","src/core/renderers/canvas/utils/CanvasMaskManager.js","src/core/renderers/canvas/utils/CanvasRenderTarget.js","src/core/renderers/canvas/utils/canUseNewCanvasBlendModes.js","src/core/renderers/canvas/utils/mapCanvasBlendModesToPixi.js","src/core/renderers/webgl/TextureGarbageCollector.js","src/core/renderers/webgl/TextureManager.js","src/core/renderers/webgl/WebGLRenderer.js","src/core/renderers/webgl/WebGLState.js","src/core/renderers/webgl/filters/Filter.js","src/core/renderers/webgl/filters/extractUniformsFromSrc.js","src/core/renderers/webgl/filters/filterTransforms.js","src/core/renderers/webgl/filters/spriteMask/SpriteMaskFilter.js","src/core/renderers/webgl/managers/FilterManager.js","src/core/renderers/webgl/managers/MaskManager.js","src/core/renderers/webgl/managers/StencilManager.js","src/core/renderers/webgl/managers/WebGLManager.js","src/core/renderers/webgl/utils/ObjectRenderer.js","src/core/renderers/webgl/utils/Quad.js","src/core/renderers/webgl/utils/RenderTarget.js","src/core/renderers/webgl/utils/checkMaxIfStatmentsInShader.js","src/core/renderers/webgl/utils/mapWebGLBlendModesToPixi.js","src/core/renderers/webgl/utils/mapWebGLDrawModesToPixi.js","src/core/renderers/webgl/utils/validateContext.js","src/core/settings.js","src/core/sprites/Sprite.js","src/core/sprites/canvas/CanvasSpriteRenderer.js","src/core/sprites/canvas/CanvasTinter.js","src/core/sprites/webgl/BatchBuffer.js","src/core/sprites/webgl/SpriteRenderer.js","src/core/sprites/webgl/generateMultiTextureShader.js","src/core/text/Text.js","src/core/text/TextMetrics.js","src/core/text/TextStyle.js","src/core/textures/BaseRenderTexture.js","src/core/textures/BaseTexture.js","src/core/textures/RenderTexture.js","src/core/textures/Spritesheet.js","src/core/textures/Texture.js","src/core/textures/TextureMatrix.js","src/core/textures/TextureUvs.js","src/core/textures/VideoBaseTexture.js","src/core/ticker/Ticker.js","src/core/ticker/TickerListener.js","src/core/ticker/index.js","src/core/utils/canUploadSameBuffer.js","src/core/utils/createIndicesForQuads.js","src/core/utils/determineCrossOrigin.js","src/core/utils/index.js","src/core/utils/mapPremultipliedBlendModes.js","src/core/utils/maxRecommendedTextures.js","src/core/utils/mixin.js","src/core/utils/pluginTarget.js","src/core/utils/trimCanvas.js","src/deprecation.js","src/extract/canvas/CanvasExtract.js","src/extract/index.js","src/extract/webgl/WebGLExtract.js","src/extras/AnimatedSprite.js","src/extras/BitmapText.js","src/extras/TilingSprite.js","src/extras/cacheAsBitmap.js","src/extras/getChildByName.js","src/extras/getGlobalPosition.js","src/extras/index.js","src/extras/webgl/TilingSpriteRenderer.js","src/filters/alpha/AlphaFilter.js","src/filters/blur/BlurFilter.js","src/filters/blur/BlurXFilter.js","src/filters/blur/BlurYFilter.js","src/filters/blur/generateBlurFragSource.js","src/filters/blur/generateBlurVertSource.js","src/filters/blur/getMaxBlurKernelSize.js","src/filters/colormatrix/ColorMatrixFilter.js","src/filters/displacement/DisplacementFilter.js","src/filters/fxaa/FXAAFilter.js","src/filters/index.js","src/filters/noise/NoiseFilter.js","src/interaction/InteractionData.js","src/interaction/InteractionEvent.js","src/interaction/InteractionManager.js","src/interaction/InteractionTrackingData.js","src/interaction/index.js","src/interaction/interactiveTarget.js","src/loaders/bitmapFontParser.js","src/loaders/index.js","src/loaders/loader.js","src/loaders/spritesheetParser.js","src/loaders/textureParser.js","src/mesh/Mesh.js","src/mesh/NineSlicePlane.js","src/mesh/Plane.js","src/mesh/Rope.js","src/mesh/canvas/CanvasMeshRenderer.js","src/mesh/index.js","src/mesh/webgl/MeshRenderer.js","src/particles/ParticleContainer.js","src/particles/index.js","src/particles/webgl/ParticleBuffer.js","src/particles/webgl/ParticleRenderer.js","src/particles/webgl/ParticleShader.js","src/polyfill/Math.sign.js","src/polyfill/Number.isInteger.js","src/polyfill/Object.assign.js","src/polyfill/index.js","src/polyfill/requestAnimationFrame.js","src/prepare/BasePrepare.js","src/prepare/canvas/CanvasPrepare.js","src/prepare/index.js","src/prepare/limiters/CountLimiter.js","src/prepare/limiters/TimeLimiter.js","src/prepare/webgl/WebGLPrepare.js","src/index.js"],"names":[],"mappings":";;;;;;;AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1oBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvTA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AChOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7UA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1QA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACxLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACrhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrFA;AACA;AACA;AACA;AACA;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACltBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/tCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5tBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AChBA;;IAAY,I;;AACZ;;;;AACA;;;;;;;;;;AAEA;AACA,KAAK,KAAL,CAAW,MAAX,CAAkB,UAAlB,CACI,KAAK,aAAL,CAAmB,SADvB;;AAKA,IAAM,eAAe,CAArB;;AAEA,IAAM,iBAAiB,GAAvB;AACA,IAAM,kBAAkB,CAAxB;AACA,IAAM,kBAAkB,CAAxB;AACA,IAAM,mBAAmB,CAAzB;;AAEA,IAAM,gBAAgB,CAAtB;AACA,IAAM,iBAAiB,CAAC,IAAxB;AACA,IAAM,iBAAiB,CAAC,IAAxB;AACA,IAAM,kBAAkB,CAAxB;;AAEA;;;;;;;;;;;;;;IAaqB,oB;AAEjB;;;AAGA,kCAAY,QAAZ,EACA;AAAA;;AACI,YAAI,CAAC,qBAAO,MAAP,IAAiB,qBAAO,KAAzB,KAAmC,CAAC,UAAU,UAAlD,EACA;AACI,iBAAK,eAAL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BAAY,OAAZ;AACH;;AAED;AACA,OAAO,IAAP,GAAc,OAAd,C,CAAuB","file":"pixi.js","sourcesContent":["(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()","/**\n * Bit twiddling hacks for JavaScript.\n *\n * Author: Mikola Lysenko\n *\n * Ported from Stanford bit twiddling hack library:\n * http://graphics.stanford.edu/~seander/bithacks.html\n */\n\n\"use strict\"; \"use restrict\";\n\n//Number of bits in an integer\nvar INT_BITS = 32;\n\n//Constants\nexports.INT_BITS = INT_BITS;\nexports.INT_MAX = 0x7fffffff;\nexports.INT_MIN = -1<<(INT_BITS-1);\n\n//Returns -1, 0, +1 depending on sign of x\nexports.sign = function(v) {\n return (v > 0) - (v < 0);\n}\n\n//Computes absolute value of integer\nexports.abs = function(v) {\n var mask = v >> (INT_BITS-1);\n return (v ^ mask) - mask;\n}\n\n//Computes minimum of integers x and y\nexports.min = function(x, y) {\n return y ^ ((x ^ y) & -(x < y));\n}\n\n//Computes maximum of integers x and y\nexports.max = function(x, y) {\n return x ^ ((x ^ y) & -(x < y));\n}\n\n//Checks if a number is a power of two\nexports.isPow2 = function(v) {\n return !(v & (v-1)) && (!!v);\n}\n\n//Computes log base 2 of v\nexports.log2 = function(v) {\n var r, shift;\n r = (v > 0xFFFF) << 4; v >>>= r;\n shift = (v > 0xFF ) << 3; v >>>= shift; r |= shift;\n shift = (v > 0xF ) << 2; v >>>= shift; r |= shift;\n shift = (v > 0x3 ) << 1; v >>>= shift; r |= shift;\n return r | (v >> 1);\n}\n\n//Computes log base 10 of v\nexports.log10 = function(v) {\n return (v >= 1000000000) ? 9 : (v >= 100000000) ? 8 : (v >= 10000000) ? 7 :\n (v >= 1000000) ? 6 : (v >= 100000) ? 5 : (v >= 10000) ? 4 :\n (v >= 1000) ? 3 : (v >= 100) ? 2 : (v >= 10) ? 1 : 0;\n}\n\n//Counts number of bits\nexports.popCount = function(v) {\n v = v - ((v >>> 1) & 0x55555555);\n v = (v & 0x33333333) + ((v >>> 2) & 0x33333333);\n return ((v + (v >>> 4) & 0xF0F0F0F) * 0x1010101) >>> 24;\n}\n\n//Counts number of trailing zeros\nfunction countTrailingZeros(v) {\n var c = 32;\n v &= -v;\n if (v) c--;\n if (v & 0x0000FFFF) c -= 16;\n if (v & 0x00FF00FF) c -= 8;\n if (v & 0x0F0F0F0F) c -= 4;\n if (v & 0x33333333) c -= 2;\n if (v & 0x55555555) c -= 1;\n return c;\n}\nexports.countTrailingZeros = countTrailingZeros;\n\n//Rounds to next power of 2\nexports.nextPow2 = function(v) {\n v += v === 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v + 1;\n}\n\n//Rounds down to previous power of 2\nexports.prevPow2 = function(v) {\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v - (v>>>1);\n}\n\n//Computes parity of word\nexports.parity = function(v) {\n v ^= v >>> 16;\n v ^= v >>> 8;\n v ^= v >>> 4;\n v &= 0xf;\n return (0x6996 >>> v) & 1;\n}\n\nvar REVERSE_TABLE = new Array(256);\n\n(function(tab) {\n for(var i=0; i<256; ++i) {\n var v = i, r = i, s = 7;\n for (v >>>= 1; v; v >>>= 1) {\n r <<= 1;\n r |= v & 1;\n --s;\n }\n tab[i] = (r << s) & 0xff;\n }\n})(REVERSE_TABLE);\n\n//Reverse bits in a 32 bit word\nexports.reverse = function(v) {\n return (REVERSE_TABLE[ v & 0xff] << 24) |\n (REVERSE_TABLE[(v >>> 8) & 0xff] << 16) |\n (REVERSE_TABLE[(v >>> 16) & 0xff] << 8) |\n REVERSE_TABLE[(v >>> 24) & 0xff];\n}\n\n//Interleave bits of 2 coordinates with 16 bits. Useful for fast quadtree codes\nexports.interleave2 = function(x, y) {\n x &= 0xFFFF;\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y &= 0xFFFF;\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n//Extracts the nth interleaved component\nexports.deinterleave2 = function(v, n) {\n v = (v >>> n) & 0x55555555;\n v = (v | (v >>> 1)) & 0x33333333;\n v = (v | (v >>> 2)) & 0x0F0F0F0F;\n v = (v | (v >>> 4)) & 0x00FF00FF;\n v = (v | (v >>> 16)) & 0x000FFFF;\n return (v << 16) >> 16;\n}\n\n\n//Interleave bits of 3 coordinates, each with 10 bits. Useful for fast octree codes\nexports.interleave3 = function(x, y, z) {\n x &= 0x3FF;\n x = (x | (x<<16)) & 4278190335;\n x = (x | (x<<8)) & 251719695;\n x = (x | (x<<4)) & 3272356035;\n x = (x | (x<<2)) & 1227133513;\n\n y &= 0x3FF;\n y = (y | (y<<16)) & 4278190335;\n y = (y | (y<<8)) & 251719695;\n y = (y | (y<<4)) & 3272356035;\n y = (y | (y<<2)) & 1227133513;\n x |= (y << 1);\n \n z &= 0x3FF;\n z = (z | (z<<16)) & 4278190335;\n z = (z | (z<<8)) & 251719695;\n z = (z | (z<<4)) & 3272356035;\n z = (z | (z<<2)) & 1227133513;\n \n return x | (z << 2);\n}\n\n//Extracts nth interleaved component of a 3-tuple\nexports.deinterleave3 = function(v, n) {\n v = (v >>> n) & 1227133513;\n v = (v | (v>>>2)) & 3272356035;\n v = (v | (v>>>4)) & 251719695;\n v = (v | (v>>>8)) & 4278190335;\n v = (v | (v>>>16)) & 0x3FF;\n return (v<<22)>>22;\n}\n\n//Computes next combination in colexicographic order (this is mistakenly called nextPermutation on the bit twiddling hacks page)\nexports.nextCombination = function(v) {\n var t = v | (v - 1);\n return (t + 1) | (((~t & -~t) - 1) >>> (countTrailingZeros(v) + 1));\n}\n\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(ear, triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m.next;\n\n while (p !== stop) {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n }\n\n return m;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n if ((equals(p1, q1) && equals(p2, q2)) ||\n (equals(p1, q2) && equals(p2, q1))) return true;\n return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @api private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {Mixed} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @api private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @api public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @api public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Boolean} exists Only check if there are listeners.\n * @returns {Array|Boolean}\n * @api public\n */\nEventEmitter.prototype.listeners = function listeners(event, exists) {\n var evt = prefix ? prefix + event : event\n , available = this._events[evt];\n\n if (exists) return !!available;\n if (!available) return [];\n if (available.fn) return [available.fn];\n\n for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n ee[i] = available[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @api public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn The listener function.\n * @param {Mixed} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n var listener = new EE(fn, context || this)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;\n else if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [this._events[evt], listener];\n\n return this;\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn The listener function.\n * @param {Mixed} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n var listener = new EE(fn, context || this, true)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;\n else if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [this._events[evt], listener];\n\n return this;\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {String|Symbol} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {Mixed} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn\n && (!once || listeners.once)\n && (!context || listeners.context === context)\n ) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn\n || (once && !listeners[i].once)\n || (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {String|Symbol} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @api public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) {\n if (--this._eventsCount === 0) this._events = new Events();\n else delete this._events[evt];\n }\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// This function doesn't apply anymore.\n//\nEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n return this;\n};\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","!function(e){var n=/iPhone/i,t=/iPod/i,r=/iPad/i,a=/\\bAndroid(?:.+)Mobile\\b/i,p=/Android/i,l=/\\bAndroid(?:.+)SD4930UR\\b/i,b=/\\bAndroid(?:.+)(?:KF[A-Z]{2,4})\\b/i,f=/Windows Phone/i,u=/\\bWindows(?:.+)ARM\\b/i,c=/BlackBerry/i,s=/BB10/i,v=/Opera Mini/i,h=/\\b(CriOS|Chrome)(?:.+)Mobile/i,w=/\\Mobile(?:.+)Firefox\\b/i;function m(e,i){return e.test(i)}function i(e){var i=e||(\"undefined\"!=typeof navigator?navigator.userAgent:\"\"),o=i.split(\"[FBAN\");void 0!==o[1]&&(i=o[0]),void 0!==(o=i.split(\"Twitter\"))[1]&&(i=o[0]);var d={apple:{phone:m(n,i)&&!m(f,i),ipod:m(t,i),tablet:!m(n,i)&&m(r,i)&&!m(f,i),device:(m(n,i)||m(t,i)||m(r,i))&&!m(f,i)},amazon:{phone:m(l,i),tablet:!m(l,i)&&m(b,i),device:m(l,i)||m(b,i)},android:{phone:!m(f,i)&&m(l,i)||!m(f,i)&&m(a,i),tablet:!m(f,i)&&!m(l,i)&&!m(a,i)&&(m(b,i)||m(p,i)),device:!m(f,i)&&(m(l,i)||m(b,i)||m(a,i)||m(p,i))},windows:{phone:m(f,i),tablet:m(u,i),device:m(f,i)||m(u,i)},other:{blackberry:m(c,i),blackberry10:m(s,i),opera:m(v,i),firefox:m(w,i),chrome:m(h,i),device:m(c,i)||m(s,i)||m(v,i)||m(w,i)||m(h,i)}};return d.any=d.apple.device||d.android.device||d.windows.device||d.other.device,d.phone=d.apple.phone||d.android.phone||d.windows.phone,d.tablet=d.apple.tablet||d.android.tablet||d.windows.tablet,d}\"undefined\"!=typeof module&&module.exports&&\"undefined\"==typeof window?module.exports=i:\"undefined\"!=typeof module&&module.exports&&\"undefined\"!=typeof window?module.exports=i():\"function\"==typeof define&&define.amd?define([],e.isMobile=i()):e.isMobile=i()}(this);","'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\nvar MiniSignalBinding = (function () {\n function MiniSignalBinding(fn, once, thisArg) {\n if (once === undefined) once = false;\n\n _classCallCheck(this, MiniSignalBinding);\n\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n _createClass(MiniSignalBinding, [{\n key: 'detach',\n value: function detach() {\n if (this._owner === null) return false;\n this._owner.detach(this);\n return true;\n }\n }]);\n\n return MiniSignalBinding;\n})();\n\nfunction _addMiniSignalBinding(self, node) {\n if (!self._head) {\n self._head = node;\n self._tail = node;\n } else {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\nvar MiniSignal = (function () {\n function MiniSignal() {\n _classCallCheck(this, MiniSignal);\n\n this._head = this._tail = undefined;\n }\n\n _createClass(MiniSignal, [{\n key: 'handlers',\n value: function handlers() {\n var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];\n\n var node = this._head;\n\n if (exists) return !!node;\n\n var ee = [];\n\n while (node) {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n }, {\n key: 'has',\n value: function has(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.');\n }\n\n return node._owner === this;\n }\n }, {\n key: 'dispatch',\n value: function dispatch() {\n var node = this._head;\n\n if (!node) return false;\n\n while (node) {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, arguments);\n node = node._next;\n }\n\n return true;\n }\n }, {\n key: 'add',\n value: function add(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg));\n }\n }, {\n key: 'once',\n value: function once(fn) {\n var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n if (typeof fn !== 'function') {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg));\n }\n }, {\n key: 'detach',\n value: function detach(node) {\n if (!(node instanceof MiniSignalBinding)) {\n throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.');\n }\n if (node._owner !== this) return this;\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head) {\n this._head = node._next;\n if (node._next === null) {\n this._tail = null;\n }\n } else if (node === this._tail) {\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n return this;\n }\n }, {\n key: 'detachAll',\n value: function detachAll() {\n var node = this._head;\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node) {\n node._owner = null;\n node = node._next;\n }\n return this;\n }\n }]);\n\n return MiniSignal;\n})();\n\nMiniSignal.MiniSignalBinding = MiniSignalBinding;\n\nexports['default'] = MiniSignal;\nmodule.exports = exports['default'];\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","'use strict'\n\nmodule.exports = function parseURI (str, opts) {\n opts = opts || {}\n\n var o = {\n key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n }\n\n var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str)\n var uri = {}\n var i = 14\n\n while (i--) uri[o.key[i]] = m[i] || ''\n\n uri[o.q.name] = {}\n uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {\n if ($1) uri[o.q.name][$1] = $2\n })\n\n return uri\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isAbsolute).join('/');\n\n if (!path && !isAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n};\n\n\nexports.basename = function(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\n\nexports.extname = function(path) {\n return splitPath(path)[3];\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n ? function (str, start, len) { return str.substr(start, len) }\n : function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n","var EMPTY_ARRAY_BUFFER = new ArrayBuffer(0);\n\n/**\n * Helper class to create a webGL buffer\n *\n * @class\n * @memberof PIXI.glCore\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param type {gl.ARRAY_BUFFER | gl.ELEMENT_ARRAY_BUFFER} @mat\n * @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data\n * @param drawType {gl.STATIC_DRAW|gl.DYNAMIC_DRAW|gl.STREAM_DRAW}\n */\nvar Buffer = function(gl, type, data, drawType)\n{\n\n\t/**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n\tthis.gl = gl;\n\n\t/**\n * The WebGL buffer, created upon instantiation\n *\n * @member {WebGLBuffer}\n */\n\tthis.buffer = gl.createBuffer();\n\n\t/**\n * The type of the buffer\n *\n * @member {gl.ARRAY_BUFFER|gl.ELEMENT_ARRAY_BUFFER}\n */\n\tthis.type = type || gl.ARRAY_BUFFER;\n\n\t/**\n * The draw type of the buffer\n *\n * @member {gl.STATIC_DRAW|gl.DYNAMIC_DRAW|gl.STREAM_DRAW}\n */\n\tthis.drawType = drawType || gl.STATIC_DRAW;\n\n\t/**\n * The data in the buffer, as a typed array\n *\n * @member {ArrayBuffer| SharedArrayBuffer|ArrayBufferView}\n */\n\tthis.data = EMPTY_ARRAY_BUFFER;\n\n\tif(data)\n\t{\n\t\tthis.upload(data);\n\t}\n\n\tthis._updateID = 0;\n};\n\n/**\n * Uploads the buffer to the GPU\n * @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data to upload\n * @param offset {Number} if only a subset of the data should be uploaded, this is the amount of data to subtract\n * @param dontBind {Boolean} whether to bind the buffer before uploading it\n */\nBuffer.prototype.upload = function(data, offset, dontBind)\n{\n\t// todo - needed?\n\tif(!dontBind) this.bind();\n\n\tvar gl = this.gl;\n\n\tdata = data || this.data;\n\toffset = offset || 0;\n\n\tif(this.data.byteLength >= data.byteLength)\n\t{\n\t\tgl.bufferSubData(this.type, offset, data);\n\t}\n\telse\n\t{\n\t\tgl.bufferData(this.type, data, this.drawType);\n\t}\n\n\tthis.data = data;\n};\n/**\n * Binds the buffer\n *\n */\nBuffer.prototype.bind = function()\n{\n\tvar gl = this.gl;\n\tgl.bindBuffer(this.type, this.buffer);\n};\n\nBuffer.createVertexBuffer = function(gl, data, drawType)\n{\n\treturn new Buffer(gl, gl.ARRAY_BUFFER, data, drawType);\n};\n\nBuffer.createIndexBuffer = function(gl, data, drawType)\n{\n\treturn new Buffer(gl, gl.ELEMENT_ARRAY_BUFFER, data, drawType);\n};\n\nBuffer.create = function(gl, type, data, drawType)\n{\n\treturn new Buffer(gl, type, data, drawType);\n};\n\n/**\n * Destroys the buffer\n *\n */\nBuffer.prototype.destroy = function(){\n\tthis.gl.deleteBuffer(this.buffer);\n};\n\nmodule.exports = Buffer;\n","\nvar Texture = require('./GLTexture');\n\n/**\n * Helper class to create a webGL Framebuffer\n *\n * @class\n * @memberof PIXI.glCore\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param width {Number} the width of the drawing area of the frame buffer\n * @param height {Number} the height of the drawing area of the frame buffer\n */\nvar Framebuffer = function(gl, width, height)\n{\n /**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = gl;\n\n /**\n * The frame buffer\n *\n * @member {WebGLFramebuffer}\n */\n this.framebuffer = gl.createFramebuffer();\n\n /**\n * The stencil buffer\n *\n * @member {WebGLRenderbuffer}\n */\n this.stencil = null;\n\n /**\n * The stencil buffer\n *\n * @member {PIXI.glCore.GLTexture}\n */\n this.texture = null;\n\n /**\n * The width of the drawing area of the buffer\n *\n * @member {Number}\n */\n this.width = width || 100;\n /**\n * The height of the drawing area of the buffer\n *\n * @member {Number}\n */\n this.height = height || 100;\n};\n\n/**\n * Adds a texture to the frame buffer\n * @param texture {PIXI.glCore.GLTexture}\n */\nFramebuffer.prototype.enableTexture = function(texture)\n{\n var gl = this.gl;\n\n this.texture = texture || new Texture(gl);\n\n this.texture.bind();\n\n //gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n\n this.bind();\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.texture.texture, 0);\n};\n\n/**\n * Initialises the stencil buffer\n */\nFramebuffer.prototype.enableStencil = function()\n{\n if(this.stencil)return;\n\n var gl = this.gl;\n\n this.stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.stencil);\n\n // TODO.. this is depth AND stencil?\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, this.width , this.height );\n\n\n};\n\n/**\n * Erases the drawing area and fills it with a colour\n * @param r {Number} the red value of the clearing colour\n * @param g {Number} the green value of the clearing colour\n * @param b {Number} the blue value of the clearing colour\n * @param a {Number} the alpha value of the clearing colour\n */\nFramebuffer.prototype.clear = function( r, g, b, a )\n{\n this.bind();\n\n var gl = this.gl;\n\n gl.clearColor(r, g, b, a);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n};\n\n/**\n * Binds the frame buffer to the WebGL context\n */\nFramebuffer.prototype.bind = function()\n{\n var gl = this.gl;\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer );\n};\n\n/**\n * Unbinds the frame buffer to the WebGL context\n */\nFramebuffer.prototype.unbind = function()\n{\n var gl = this.gl;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null );\n};\n/**\n * Resizes the drawing area of the buffer to the given width and height\n * @param width {Number} the new width\n * @param height {Number} the new height\n */\nFramebuffer.prototype.resize = function(width, height)\n{\n var gl = this.gl;\n\n this.width = width;\n this.height = height;\n\n if ( this.texture )\n {\n this.texture.uploadData(null, width, height);\n }\n\n if ( this.stencil )\n {\n // update the stencil buffer width and height\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.stencil);\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height);\n }\n};\n\n/**\n * Destroys this buffer\n */\nFramebuffer.prototype.destroy = function()\n{\n var gl = this.gl;\n\n //TODO\n if(this.texture)\n {\n this.texture.destroy();\n }\n\n gl.deleteFramebuffer(this.framebuffer);\n\n this.gl = null;\n\n this.stencil = null;\n this.texture = null;\n};\n\n/**\n * Creates a frame buffer with a texture containing the given data\n * @static\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param width {Number} the width of the drawing area of the frame buffer\n * @param height {Number} the height of the drawing area of the frame buffer\n * @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data\n */\nFramebuffer.createRGBA = function(gl, width, height, data)\n{\n var texture = Texture.fromData(gl, null, width, height);\n texture.enableNearestScaling();\n texture.enableWrapClamp();\n\n //now create the framebuffer object and attach the texture to it.\n var fbo = new Framebuffer(gl, width, height);\n fbo.enableTexture(texture);\n //fbo.enableStencil(); // get this back on soon!\n\n //fbo.enableStencil(); // get this back on soon!\n\n fbo.unbind();\n\n return fbo;\n};\n\n/**\n * Creates a frame buffer with a texture containing the given data\n * @static\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param width {Number} the width of the drawing area of the frame buffer\n * @param height {Number} the height of the drawing area of the frame buffer\n * @param data {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} an array of data\n */\nFramebuffer.createFloat32 = function(gl, width, height, data)\n{\n // create a new texture..\n var texture = new Texture.fromData(gl, data, width, height);\n texture.enableNearestScaling();\n texture.enableWrapClamp();\n\n //now create the framebuffer object and attach the texture to it.\n var fbo = new Framebuffer(gl, width, height);\n fbo.enableTexture(texture);\n\n fbo.unbind();\n\n return fbo;\n};\n\nmodule.exports = Framebuffer;\n","\nvar compileProgram = require('./shader/compileProgram'),\n\textractAttributes = require('./shader/extractAttributes'),\n\textractUniforms = require('./shader/extractUniforms'),\n\tsetPrecision = require('./shader/setPrecision'),\n\tgenerateUniformAccessObject = require('./shader/generateUniformAccessObject');\n\n/**\n * Helper class to create a webGL Shader\n *\n * @class\n * @memberof PIXI.glCore\n * @param gl {WebGLRenderingContext}\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings.\n * @param precision {string} The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'.\n * @param attributeLocations {object} A key value pair showing which location eact attribute should sit eg {position:0, uvs:1}\n */\nvar Shader = function(gl, vertexSrc, fragmentSrc, precision, attributeLocations)\n{\n\t/**\n\t * The current WebGL rendering context\n\t *\n\t * @member {WebGLRenderingContext}\n\t */\n\tthis.gl = gl;\n\n\tif(precision)\n\t{\n\t\tvertexSrc = setPrecision(vertexSrc, precision);\n\t\tfragmentSrc = setPrecision(fragmentSrc, precision);\n\t}\n\n\t/**\n\t * The shader program\n\t *\n\t * @member {WebGLProgram}\n\t */\n\t// First compile the program..\n\tthis.program = compileProgram(gl, vertexSrc, fragmentSrc, attributeLocations);\n\n\t/**\n\t * The attributes of the shader as an object containing the following properties\n\t * {\n\t * \ttype,\n\t * \tsize,\n\t * \tlocation,\n\t * \tpointer\n\t * }\n\t * @member {Object}\n\t */\n\t// next extract the attributes\n\tthis.attributes = extractAttributes(gl, this.program);\n\n this.uniformData = extractUniforms(gl, this.program);\n\n\t/**\n\t * The uniforms of the shader as an object containing the following properties\n\t * {\n\t * \tgl,\n\t * \tdata\n\t * }\n\t * @member {Object}\n\t */\n\tthis.uniforms = generateUniformAccessObject( gl, this.uniformData );\n\n};\n/**\n * Uses this shader\n * \n * @return {PIXI.glCore.GLShader} Returns itself.\n */\nShader.prototype.bind = function()\n{\n\tthis.gl.useProgram(this.program);\n\treturn this;\n};\n\n/**\n * Destroys this shader\n * TODO\n */\nShader.prototype.destroy = function()\n{\n\tthis.attributes = null;\n\tthis.uniformData = null;\n\tthis.uniforms = null;\n\n\tvar gl = this.gl;\n\tgl.deleteProgram(this.program);\n};\n\n\nmodule.exports = Shader;\n","\n/**\n * Helper class to create a WebGL Texture\n *\n * @class\n * @memberof PIXI.glCore\n * @param gl {WebGLRenderingContext} The current WebGL context\n * @param width {number} the width of the texture\n * @param height {number} the height of the texture\n * @param format {number} the pixel format of the texture. defaults to gl.RGBA\n * @param type {number} the gl type of the texture. defaults to gl.UNSIGNED_BYTE\n */\nvar Texture = function(gl, width, height, format, type)\n{\n\t/**\n\t * The current WebGL rendering context\n\t *\n\t * @member {WebGLRenderingContext}\n\t */\n\tthis.gl = gl;\n\n\n\t/**\n\t * The WebGL texture\n\t *\n\t * @member {WebGLTexture}\n\t */\n\tthis.texture = gl.createTexture();\n\n\t/**\n\t * If mipmapping was used for this texture, enable and disable with enableMipmap()\n\t *\n\t * @member {Boolean}\n\t */\n\t// some settings..\n\tthis.mipmap = false;\n\n\n\t/**\n\t * Set to true to enable pre-multiplied alpha\n\t *\n\t * @member {Boolean}\n\t */\n\tthis.premultiplyAlpha = false;\n\n\t/**\n\t * The width of texture\n\t *\n\t * @member {Number}\n\t */\n\tthis.width = width || -1;\n\t/**\n\t * The height of texture\n\t *\n\t * @member {Number}\n\t */\n\tthis.height = height || -1;\n\n\t/**\n\t * The pixel format of the texture. defaults to gl.RGBA\n\t *\n\t * @member {Number}\n\t */\n\tthis.format = format || gl.RGBA;\n\n\t/**\n\t * The gl type of the texture. defaults to gl.UNSIGNED_BYTE\n\t *\n\t * @member {Number}\n\t */\n\tthis.type = type || gl.UNSIGNED_BYTE;\n\n\n};\n\n/**\n * Uploads this texture to the GPU\n * @param source {HTMLImageElement|ImageData|HTMLVideoElement} the source image of the texture\n */\nTexture.prototype.upload = function(source)\n{\n\tthis.bind();\n\n\tvar gl = this.gl;\n\n\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);\n\n\tvar newWidth = source.videoWidth || source.width;\n\tvar newHeight = source.videoHeight || source.height;\n\n\tif(newHeight !== this.height || newWidth !== this.width)\n\t{\n\t\tgl.texImage2D(gl.TEXTURE_2D, 0, this.format, this.format, this.type, source);\n\t}\n\telse\n\t{\n \tgl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.format, this.type, source);\n\t}\n\n\t// if the source is a video, we need to use the videoWidth / videoHeight properties as width / height will be incorrect.\n\tthis.width = newWidth;\n\tthis.height = newHeight;\n\n};\n\nvar FLOATING_POINT_AVAILABLE = false;\n\n/**\n * Use a data source and uploads this texture to the GPU\n * @param data {TypedArray} the data to upload to the texture\n * @param width {number} the new width of the texture\n * @param height {number} the new height of the texture\n */\nTexture.prototype.uploadData = function(data, width, height)\n{\n\tthis.bind();\n\n\tvar gl = this.gl;\n\n\n\tif(data instanceof Float32Array)\n\t{\n\t\tif(!FLOATING_POINT_AVAILABLE)\n\t\t{\n\t\t\tvar ext = gl.getExtension(\"OES_texture_float\");\n\n\t\t\tif(ext)\n\t\t\t{\n\t\t\t\tFLOATING_POINT_AVAILABLE = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow new Error('floating point textures not available');\n\t\t\t}\n\t\t}\n\n\t\tthis.type = gl.FLOAT;\n\t}\n\telse\n\t{\n\t\t// TODO support for other types\n\t\tthis.type = this.type || gl.UNSIGNED_BYTE;\n\t}\n\n\t// what type of data?\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);\n\n\n\tif(width !== this.width || height !== this.height)\n\t{\n\t\tgl.texImage2D(gl.TEXTURE_2D, 0, this.format, width, height, 0, this.format, this.type, data || null);\n\t}\n\telse\n\t{\n\t\tgl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, width, height, this.format, this.type, data || null);\n\t}\n\n\tthis.width = width;\n\tthis.height = height;\n\n\n//\ttexSubImage2D\n};\n\n/**\n * Binds the texture\n * @param location\n */\nTexture.prototype.bind = function(location)\n{\n\tvar gl = this.gl;\n\n\tif(location !== undefined)\n\t{\n\t\tgl.activeTexture(gl.TEXTURE0 + location);\n\t}\n\n\tgl.bindTexture(gl.TEXTURE_2D, this.texture);\n};\n\n/**\n * Unbinds the texture\n */\nTexture.prototype.unbind = function()\n{\n\tvar gl = this.gl;\n\tgl.bindTexture(gl.TEXTURE_2D, null);\n};\n\n/**\n * @param linear {Boolean} if we want to use linear filtering or nearest neighbour interpolation\n */\nTexture.prototype.minFilter = function( linear )\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tif(this.mipmap)\n\t{\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, linear ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n\t}\n\telse\n\t{\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, linear ? gl.LINEAR : gl.NEAREST);\n\t}\n};\n\n/**\n * @param linear {Boolean} if we want to use linear filtering or nearest neighbour interpolation\n */\nTexture.prototype.magFilter = function( linear )\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, linear ? gl.LINEAR : gl.NEAREST);\n};\n\n/**\n * Enables mipmapping\n */\nTexture.prototype.enableMipmap = function()\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tthis.mipmap = true;\n\n\tgl.generateMipmap(gl.TEXTURE_2D);\n};\n\n/**\n * Enables linear filtering\n */\nTexture.prototype.enableLinearScaling = function()\n{\n\tthis.minFilter(true);\n\tthis.magFilter(true);\n};\n\n/**\n * Enables nearest neighbour interpolation\n */\nTexture.prototype.enableNearestScaling = function()\n{\n\tthis.minFilter(false);\n\tthis.magFilter(false);\n};\n\n/**\n * Enables clamping on the texture so WebGL will not repeat it\n */\nTexture.prototype.enableWrapClamp = function()\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n};\n\n/**\n * Enable tiling on the texture\n */\nTexture.prototype.enableWrapRepeat = function()\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);\n};\n\nTexture.prototype.enableWrapMirrorRepeat = function()\n{\n\tvar gl = this.gl;\n\n\tthis.bind();\n\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.MIRRORED_REPEAT);\n};\n\n\n/**\n * Destroys this texture\n */\nTexture.prototype.destroy = function()\n{\n\tvar gl = this.gl;\n\t//TODO\n\tgl.deleteTexture(this.texture);\n};\n\n/**\n * @static\n * @param gl {WebGLRenderingContext} The current WebGL context\n * @param source {HTMLImageElement|ImageData} the source image of the texture\n * @param premultiplyAlpha {Boolean} If we want to use pre-multiplied alpha\n */\nTexture.fromSource = function(gl, source, premultiplyAlpha)\n{\n\tvar texture = new Texture(gl);\n\ttexture.premultiplyAlpha = premultiplyAlpha || false;\n\ttexture.upload(source);\n\n\treturn texture;\n};\n\n/**\n * @static\n * @param gl {WebGLRenderingContext} The current WebGL context\n * @param data {TypedArray} the data to upload to the texture\n * @param width {number} the new width of the texture\n * @param height {number} the new height of the texture\n */\nTexture.fromData = function(gl, data, width, height)\n{\n\t//console.log(data, width, height);\n\tvar texture = new Texture(gl);\n\ttexture.uploadData(data, width, height);\n\n\treturn texture;\n};\n\n\nmodule.exports = Texture;\n","\n// state object//\nvar setVertexAttribArrays = require( './setVertexAttribArrays' );\n\n/**\n * Helper class to work with WebGL VertexArrayObjects (vaos)\n * Only works if WebGL extensions are enabled (they usually are)\n *\n * @class\n * @memberof PIXI.glCore\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n */\nfunction VertexArrayObject(gl, state)\n{\n this.nativeVaoExtension = null;\n\n if(!VertexArrayObject.FORCE_NATIVE)\n {\n this.nativeVaoExtension = gl.getExtension('OES_vertex_array_object') ||\n gl.getExtension('MOZ_OES_vertex_array_object') ||\n gl.getExtension('WEBKIT_OES_vertex_array_object');\n }\n\n this.nativeState = state;\n\n if(this.nativeVaoExtension)\n {\n this.nativeVao = this.nativeVaoExtension.createVertexArrayOES();\n\n var maxAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n\n // VAO - overwrite the state..\n this.nativeState = {\n tempAttribState: new Array(maxAttribs),\n attribState: new Array(maxAttribs)\n };\n }\n\n /**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = gl;\n\n /**\n * An array of attributes\n *\n * @member {Array}\n */\n this.attributes = [];\n\n /**\n * @member {PIXI.glCore.GLBuffer}\n */\n this.indexBuffer = null;\n\n /**\n * A boolean flag\n *\n * @member {Boolean}\n */\n this.dirty = false;\n}\n\nVertexArrayObject.prototype.constructor = VertexArrayObject;\nmodule.exports = VertexArrayObject;\n\n/**\n* Some devices behave a bit funny when using the newer extensions (im looking at you ipad 2!)\n* If you find on older devices that things have gone a bit weird then set this to true.\n*/\n/**\n * Lets the VAO know if you should use the WebGL extension or the native methods.\n * Some devices behave a bit funny when using the newer extensions (im looking at you ipad 2!)\n * If you find on older devices that things have gone a bit weird then set this to true.\n * @static\n * @property {Boolean} FORCE_NATIVE\n */\nVertexArrayObject.FORCE_NATIVE = false;\n\n/**\n * Binds the buffer\n */\nVertexArrayObject.prototype.bind = function()\n{\n if(this.nativeVao)\n {\n this.nativeVaoExtension.bindVertexArrayOES(this.nativeVao);\n\n if(this.dirty)\n {\n this.dirty = false;\n this.activate();\n return this;\n }\n if (this.indexBuffer)\n {\n this.indexBuffer.bind();\n }\n }\n else\n {\n this.activate();\n }\n\n return this;\n};\n\n/**\n * Unbinds the buffer\n */\nVertexArrayObject.prototype.unbind = function()\n{\n if(this.nativeVao)\n {\n this.nativeVaoExtension.bindVertexArrayOES(null);\n }\n\n return this;\n};\n\n/**\n * Uses this vao\n */\nVertexArrayObject.prototype.activate = function()\n{\n\n var gl = this.gl;\n var lastBuffer = null;\n\n for (var i = 0; i < this.attributes.length; i++)\n {\n var attrib = this.attributes[i];\n\n if(lastBuffer !== attrib.buffer)\n {\n attrib.buffer.bind();\n lastBuffer = attrib.buffer;\n }\n\n gl.vertexAttribPointer(attrib.attribute.location,\n attrib.attribute.size,\n attrib.type || gl.FLOAT,\n attrib.normalized || false,\n attrib.stride || 0,\n attrib.start || 0);\n }\n\n setVertexAttribArrays(gl, this.attributes, this.nativeState);\n\n if(this.indexBuffer)\n {\n this.indexBuffer.bind();\n }\n\n return this;\n};\n\n/**\n *\n * @param buffer {PIXI.gl.GLBuffer}\n * @param attribute {*}\n * @param type {String}\n * @param normalized {Boolean}\n * @param stride {Number}\n * @param start {Number}\n */\nVertexArrayObject.prototype.addAttribute = function(buffer, attribute, type, normalized, stride, start)\n{\n this.attributes.push({\n buffer: buffer,\n attribute: attribute,\n\n location: attribute.location,\n type: type || this.gl.FLOAT,\n normalized: normalized || false,\n stride: stride || 0,\n start: start || 0\n });\n\n this.dirty = true;\n\n return this;\n};\n\n/**\n *\n * @param buffer {PIXI.gl.GLBuffer}\n */\nVertexArrayObject.prototype.addIndex = function(buffer/*, options*/)\n{\n this.indexBuffer = buffer;\n\n this.dirty = true;\n\n return this;\n};\n\n/**\n * Unbinds this vao and disables it\n */\nVertexArrayObject.prototype.clear = function()\n{\n // var gl = this.gl;\n\n // TODO - should this function unbind after clear?\n // for now, no but lets see what happens in the real world!\n if(this.nativeVao)\n {\n this.nativeVaoExtension.bindVertexArrayOES(this.nativeVao);\n }\n\n this.attributes.length = 0;\n this.indexBuffer = null;\n\n return this;\n};\n\n/**\n * @param type {Number}\n * @param size {Number}\n * @param start {Number}\n */\nVertexArrayObject.prototype.draw = function(type, size, start)\n{\n var gl = this.gl;\n\n if(this.indexBuffer)\n {\n gl.drawElements(type, size || this.indexBuffer.data.length, gl.UNSIGNED_SHORT, (start || 0) * 2 );\n }\n else\n {\n // TODO need a better way to calculate size..\n gl.drawArrays(type, start, size || this.getSize());\n }\n\n return this;\n};\n\n/**\n * Destroy this vao\n */\nVertexArrayObject.prototype.destroy = function()\n{\n // lose references\n this.gl = null;\n this.indexBuffer = null;\n this.attributes = null;\n this.nativeState = null;\n\n if(this.nativeVao)\n {\n this.nativeVaoExtension.deleteVertexArrayOES(this.nativeVao);\n }\n\n this.nativeVaoExtension = null;\n this.nativeVao = null;\n};\n\nVertexArrayObject.prototype.getSize = function()\n{\n var attrib = this.attributes[0];\n return attrib.buffer.data.length / (( attrib.stride/4 ) || attrib.attribute.size);\n};\n","\n/**\n * Helper class to create a webGL Context\n *\n * @class\n * @memberof PIXI.glCore\n * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from\n * @param options {Object} An options object that gets passed in to the canvas element containing the context attributes,\n * see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext for the options available\n * @return {WebGLRenderingContext} the WebGL context\n */\nvar createContext = function(canvas, options)\n{\n var gl = canvas.getContext('webgl', options) || \n canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support webGL. Try using the canvas renderer');\n }\n\n return gl;\n};\n\nmodule.exports = createContext;\n","var gl = {\n createContext: require('./createContext'),\n setVertexAttribArrays: require('./setVertexAttribArrays'),\n GLBuffer: require('./GLBuffer'),\n GLFramebuffer: require('./GLFramebuffer'),\n GLShader: require('./GLShader'),\n GLTexture: require('./GLTexture'),\n VertexArrayObject: require('./VertexArrayObject'),\n shader: require('./shader')\n};\n\n// Export for Node-compatible environments\nif (typeof module !== 'undefined' && module.exports)\n{\n // Export the module\n module.exports = gl;\n}\n\n// Add to the browser window pixi.gl\nif (typeof window !== 'undefined')\n{\n // add the window object\n window.PIXI = window.PIXI || {};\n window.PIXI.glCore = gl;\n}\n","// var GL_MAP = {};\n\n/**\n * @param gl {WebGLRenderingContext} The current WebGL context\n * @param attribs {*}\n * @param state {*}\n */\nvar setVertexAttribArrays = function (gl, attribs, state)\n{\n var i;\n if(state)\n {\n var tempAttribState = state.tempAttribState,\n attribState = state.attribState;\n\n for (i = 0; i < tempAttribState.length; i++)\n {\n tempAttribState[i] = false;\n }\n\n // set the new attribs\n for (i = 0; i < attribs.length; i++)\n {\n tempAttribState[attribs[i].attribute.location] = true;\n }\n\n for (i = 0; i < attribState.length; i++)\n {\n if (attribState[i] !== tempAttribState[i])\n {\n attribState[i] = tempAttribState[i];\n\n if (state.attribState[i])\n {\n gl.enableVertexAttribArray(i);\n }\n else\n {\n gl.disableVertexAttribArray(i);\n }\n }\n }\n\n }\n else\n {\n for (i = 0; i < attribs.length; i++)\n {\n var attrib = attribs[i];\n gl.enableVertexAttribArray(attrib.attribute.location);\n }\n }\n};\n\nmodule.exports = setVertexAttribArrays;\n","\n/**\n * @class\n * @memberof PIXI.glCore.shader\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings.\n * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations\n * @return {WebGLProgram} the shader program\n */\nvar compileProgram = function(gl, vertexSrc, fragmentSrc, attributeLocations)\n{\n var glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc);\n var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc);\n\n var program = gl.createProgram();\n\n gl.attachShader(program, glVertShader);\n gl.attachShader(program, glFragShader);\n\n // optionally, set the attributes manually for the program rather than letting WebGL decide..\n if(attributeLocations)\n {\n for(var i in attributeLocations)\n {\n gl.bindAttribLocation(program, attributeLocations[i], i);\n }\n }\n\n\n gl.linkProgram(program);\n\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n console.error('Pixi.js Error: Could not initialize shader.');\n console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS));\n console.error('gl.getError()', gl.getError());\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n\n gl.deleteProgram(program);\n program = null;\n }\n\n // clean up some shaders\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n return program;\n};\n\n/**\n * @private\n * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram}\n * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param vertexSrc {string|string[]} The vertex shader source as an array of strings.\n * @return {WebGLShader} the shader\n */\nvar compileShader = function (gl, type, src)\n{\n var shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n console.log(gl.getShaderInfoLog(shader));\n return null;\n }\n\n return shader;\n};\n\nmodule.exports = compileProgram;\n","/**\n * @class\n * @memberof PIXI.glCore.shader\n * @param type {String} Type of value\n * @param size {Number}\n */\nvar defaultValue = function(type, size) \n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2': \n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4': \n return new Float32Array(4 * size);\n \n case 'int':\n case 'sampler2D':\n return 0;\n\n case 'ivec2': \n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4': \n return new Int32Array(4 * size);\n\n case 'bool': \n return false;\n\n case 'bvec2':\n\n return booleanArray( 2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3': \n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n};\n\nvar booleanArray = function(size)\n{\n var array = new Array(size);\n\n for (var i = 0; i < array.length; i++) \n {\n array[i] = false;\n }\n\n return array;\n};\n\nmodule.exports = defaultValue;\n","\nvar mapType = require('./mapType');\nvar mapSize = require('./mapSize');\n\n/**\n * Extracts the attributes\n * @class\n * @memberof PIXI.glCore.shader\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param program {WebGLProgram} The shader program to get the attributes from\n * @return attributes {Object}\n */\nvar extractAttributes = function(gl, program)\n{\n var attributes = {};\n\n var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (var i = 0; i < totalAttributes; i++)\n {\n var attribData = gl.getActiveAttrib(program, i);\n var type = mapType(gl, attribData.type);\n\n attributes[attribData.name] = {\n type:type,\n size:mapSize(type),\n location:gl.getAttribLocation(program, attribData.name),\n //TODO - make an attribute object\n pointer: pointer\n };\n }\n\n return attributes;\n};\n\nvar pointer = function(type, normalized, stride, start){\n // console.log(this.location)\n gl.vertexAttribPointer(this.location,this.size, type || gl.FLOAT, normalized || false, stride || 0, start || 0);\n};\n\nmodule.exports = extractAttributes;\n","var mapType = require('./mapType');\nvar defaultValue = require('./defaultValue');\n\n/**\n * Extracts the uniforms\n * @class\n * @memberof PIXI.glCore.shader\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param program {WebGLProgram} The shader program to get the uniforms from\n * @return uniforms {Object}\n */\nvar extractUniforms = function(gl, program)\n{\n\tvar uniforms = {};\n\n var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n for (var i = 0; i < totalUniforms; i++)\n {\n \tvar uniformData = gl.getActiveUniform(program, i);\n \tvar name = uniformData.name.replace(/\\[.*?\\]/, \"\");\n var type = mapType(gl, uniformData.type );\n\n \tuniforms[name] = {\n \t\ttype:type,\n \t\tsize:uniformData.size,\n \t\tlocation:gl.getUniformLocation(program, name),\n \t\tvalue:defaultValue(type, uniformData.size)\n \t};\n }\n\n\treturn uniforms;\n};\n\nmodule.exports = extractUniforms;\n","/**\n * Extracts the attributes\n * @class\n * @memberof PIXI.glCore.shader\n * @param gl {WebGLRenderingContext} The current WebGL rendering context\n * @param uniforms {Array} @mat ?\n * @return attributes {Object}\n */\nvar generateUniformAccessObject = function(gl, uniformData)\n{\n // this is the object we will be sending back.\n // an object hierachy will be created for structs\n var uniforms = {data:{}};\n\n uniforms.gl = gl;\n\n var uniformKeys= Object.keys(uniformData);\n\n for (var i = 0; i < uniformKeys.length; i++)\n {\n var fullName = uniformKeys[i];\n\n var nameTokens = fullName.split('.');\n var name = nameTokens[nameTokens.length - 1];\n\n\n var uniformGroup = getUniformGroup(nameTokens, uniforms);\n\n var uniform = uniformData[fullName];\n uniformGroup.data[name] = uniform;\n\n uniformGroup.gl = gl;\n\n Object.defineProperty(uniformGroup, name, {\n get: generateGetter(name),\n set: generateSetter(name, uniform)\n });\n }\n\n return uniforms;\n};\n\nvar generateGetter = function(name)\n{\n return function() {\n return this.data[name].value;\n };\n};\n\nvar GLSL_SINGLE_SETTERS = {\n float: function setSingleFloat(gl, location, value) { gl.uniform1f(location, value); },\n vec2: function setSingleVec2(gl, location, value) { gl.uniform2f(location, value[0], value[1]); },\n vec3: function setSingleVec3(gl, location, value) { gl.uniform3f(location, value[0], value[1], value[2]); },\n vec4: function setSingleVec4(gl, location, value) { gl.uniform4f(location, value[0], value[1], value[2], value[3]); },\n\n int: function setSingleInt(gl, location, value) { gl.uniform1i(location, value); },\n ivec2: function setSingleIvec2(gl, location, value) { gl.uniform2i(location, value[0], value[1]); },\n ivec3: function setSingleIvec3(gl, location, value) { gl.uniform3i(location, value[0], value[1], value[2]); },\n ivec4: function setSingleIvec4(gl, location, value) { gl.uniform4i(location, value[0], value[1], value[2], value[3]); },\n\n bool: function setSingleBool(gl, location, value) { gl.uniform1i(location, value); },\n bvec2: function setSingleBvec2(gl, location, value) { gl.uniform2i(location, value[0], value[1]); },\n bvec3: function setSingleBvec3(gl, location, value) { gl.uniform3i(location, value[0], value[1], value[2]); },\n bvec4: function setSingleBvec4(gl, location, value) { gl.uniform4i(location, value[0], value[1], value[2], value[3]); },\n\n mat2: function setSingleMat2(gl, location, value) { gl.uniformMatrix2fv(location, false, value); },\n mat3: function setSingleMat3(gl, location, value) { gl.uniformMatrix3fv(location, false, value); },\n mat4: function setSingleMat4(gl, location, value) { gl.uniformMatrix4fv(location, false, value); },\n\n sampler2D: function setSingleSampler2D(gl, location, value) { gl.uniform1i(location, value); },\n};\n\nvar GLSL_ARRAY_SETTERS = {\n float: function setFloatArray(gl, location, value) { gl.uniform1fv(location, value); },\n vec2: function setVec2Array(gl, location, value) { gl.uniform2fv(location, value); },\n vec3: function setVec3Array(gl, location, value) { gl.uniform3fv(location, value); },\n vec4: function setVec4Array(gl, location, value) { gl.uniform4fv(location, value); },\n int: function setIntArray(gl, location, value) { gl.uniform1iv(location, value); },\n ivec2: function setIvec2Array(gl, location, value) { gl.uniform2iv(location, value); },\n ivec3: function setIvec3Array(gl, location, value) { gl.uniform3iv(location, value); },\n ivec4: function setIvec4Array(gl, location, value) { gl.uniform4iv(location, value); },\n bool: function setBoolArray(gl, location, value) { gl.uniform1iv(location, value); },\n bvec2: function setBvec2Array(gl, location, value) { gl.uniform2iv(location, value); },\n bvec3: function setBvec3Array(gl, location, value) { gl.uniform3iv(location, value); },\n bvec4: function setBvec4Array(gl, location, value) { gl.uniform4iv(location, value); },\n sampler2D: function setSampler2DArray(gl, location, value) { gl.uniform1iv(location, value); },\n};\n\nfunction generateSetter(name, uniform)\n{\n return function(value) {\n this.data[name].value = value;\n var location = this.data[name].location;\n if (uniform.size === 1)\n {\n GLSL_SINGLE_SETTERS[uniform.type](this.gl, location, value);\n }\n else\n {\n // glslSetArray(gl, location, type, value) {\n GLSL_ARRAY_SETTERS[uniform.type](this.gl, location, value);\n }\n };\n}\n\nfunction getUniformGroup(nameTokens, uniform)\n{\n var cur = uniform;\n\n for (var i = 0; i < nameTokens.length - 1; i++)\n {\n var o = cur[nameTokens[i]] || {data:{}};\n cur[nameTokens[i]] = o;\n cur = o;\n }\n\n return cur;\n}\n\n\nmodule.exports = generateUniformAccessObject;\n","module.exports = {\n compileProgram: require('./compileProgram'),\n defaultValue: require('./defaultValue'),\n extractAttributes: require('./extractAttributes'),\n extractUniforms: require('./extractUniforms'),\n generateUniformAccessObject: require('./generateUniformAccessObject'),\n setPrecision: require('./setPrecision'),\n mapSize: require('./mapSize'),\n mapType: require('./mapType')\n};","/**\n * @class\n * @memberof PIXI.glCore.shader\n * @param type {String}\n * @return {Number}\n */\nvar mapSize = function(type) \n{ \n return GLSL_TO_SIZE[type];\n};\n\n\nvar GLSL_TO_SIZE = {\n 'float': 1,\n 'vec2': 2,\n 'vec3': 3,\n 'vec4': 4,\n\n 'int': 1,\n 'ivec2': 2,\n 'ivec3': 3,\n 'ivec4': 4,\n\n 'bool': 1,\n 'bvec2': 2,\n 'bvec3': 3,\n 'bvec4': 4,\n\n 'mat2': 4,\n 'mat3': 9,\n 'mat4': 16,\n\n 'sampler2D': 1\n};\n\nmodule.exports = mapSize;\n","\n\nvar mapType = function(gl, type) \n{\n if(!GL_TABLE) \n {\n var typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for(var i = 0; i < typeNames.length; ++i) \n {\n var tn = typeNames[i];\n GL_TABLE[ gl[tn] ] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n};\n\nvar GL_TABLE = null;\n\nvar GL_TO_GLSL_TYPES = {\n 'FLOAT': 'float',\n 'FLOAT_VEC2': 'vec2',\n 'FLOAT_VEC3': 'vec3',\n 'FLOAT_VEC4': 'vec4',\n\n 'INT': 'int',\n 'INT_VEC2': 'ivec2',\n 'INT_VEC3': 'ivec3',\n 'INT_VEC4': 'ivec4',\n \n 'BOOL': 'bool',\n 'BOOL_VEC2': 'bvec2',\n 'BOOL_VEC3': 'bvec3',\n 'BOOL_VEC4': 'bvec4',\n \n 'FLOAT_MAT2': 'mat2',\n 'FLOAT_MAT3': 'mat3',\n 'FLOAT_MAT4': 'mat4',\n \n 'SAMPLER_2D': 'sampler2D' \n};\n\nmodule.exports = mapType;\n","/**\n * Sets the float precision on the shader. If the precision is already present this function will do nothing\n * @param {string} src the shader source\n * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'.\n *\n * @return {string} modified shader source\n */\nvar setPrecision = function(src, precision)\n{\n if(src.substring(0, 9) !== 'precision')\n {\n return 'precision ' + precision + ' float;\\n' + src;\n }\n\n return src;\n};\n\nmodule.exports = setPrecision;\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","/*! https://mths.be/punycode v1.4.1 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow new RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see <https://mathiasbynens.be/notes/javascript-encoding>\n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * https://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.4.1',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see <https://mathiasbynens.be/notes/javascript-encoding>\n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) {\n\t\t\t// in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else {\n\t\t\t// in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return map(objectKeys(obj), function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (isArray(obj[k])) {\n return map(obj[k], function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f(xs[i], i));\n }\n return res;\n}\n\nvar objectKeys = Object.keys || function (obj) {\n var res = [];\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);\n }\n return res;\n};\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","'use strict'\n\n/**\n * Remove a range of items from an array\n *\n * @function removeItems\n * @param {Array<*>} arr The target array\n * @param {number} startIdx The index to begin removing from (inclusive)\n * @param {number} removeCount How many items to remove\n */\nmodule.exports = function removeItems(arr, startIdx, removeCount)\n{\n var i, length = arr.length\n\n if (startIdx >= length || removeCount === 0) {\n return\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount)\n\n var len = length - removeCount\n\n for (i = startIdx; i < len; ++i) {\n arr[i] = arr[i + removeCount]\n }\n\n arr.length = len\n}\n","'use strict';\n\nexports.__esModule = true;\nexports.Loader = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _miniSignals = require('mini-signals');\n\nvar _miniSignals2 = _interopRequireDefault(_miniSignals);\n\nvar _parseUri = require('parse-uri');\n\nvar _parseUri2 = _interopRequireDefault(_parseUri);\n\nvar _async = require('./async');\n\nvar async = _interopRequireWildcard(_async);\n\nvar _Resource = require('./Resource');\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n// some constants\nvar MAX_PROGRESS = 100;\nvar rgxExtractUrlHash = /(#[\\w-]+)?$/;\n\n/**\n * Manages the state and loading of multiple resources to load.\n *\n * @class\n */\n\nvar Loader = exports.Loader = function () {\n /**\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\n function Loader() {\n var _this = this;\n\n var baseUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var concurrency = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;\n\n _classCallCheck(this, Loader);\n\n /**\n * The base url for all resources loaded by this loader.\n *\n * @member {string}\n */\n this.baseUrl = baseUrl;\n\n /**\n * The progress percent of the loader going through the queue.\n *\n * @member {number}\n */\n this.progress = 0;\n\n /**\n * Loading state of the loader, true if it is currently loading resources.\n *\n * @member {boolean}\n */\n this.loading = false;\n\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n *\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n *\n * @member {string}\n */\n this.defaultQueryString = '';\n\n /**\n * The middleware to run before loading each resource.\n *\n * @private\n * @member {function[]}\n */\n this._beforeMiddleware = [];\n\n /**\n * The middleware to run after loading each resource.\n *\n * @private\n * @member {function[]}\n */\n this._afterMiddleware = [];\n\n /**\n * The tracks the resources we are currently completing parsing for.\n *\n * @private\n * @member {Resource[]}\n */\n this._resourcesParsing = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n *\n * @private\n * @member {function}\n * @param {Resource} r - The resource to load\n * @param {Function} d - The dequeue function\n * @return {undefined}\n */\n this._boundLoadResource = function (r, d) {\n return _this._loadResource(r, d);\n };\n\n /**\n * The resources waiting to be loaded.\n *\n * @private\n * @member {Resource[]}\n */\n this._queue = async.queue(this._boundLoadResource, concurrency);\n\n this._queue.pause();\n\n /**\n * All the resources for this loader keyed by name.\n *\n * @member {object<string, Resource>}\n */\n this.resources = {};\n\n /**\n * Dispatched once per loaded or errored resource.\n *\n * The callback looks like {@link Loader.OnProgressSignal}.\n *\n * @member {Signal}\n */\n this.onProgress = new _miniSignals2.default();\n\n /**\n * Dispatched once per errored resource.\n *\n * The callback looks like {@link Loader.OnErrorSignal}.\n *\n * @member {Signal}\n */\n this.onError = new _miniSignals2.default();\n\n /**\n * Dispatched once per loaded resource.\n *\n * The callback looks like {@link Loader.OnLoadSignal}.\n *\n * @member {Signal}\n */\n this.onLoad = new _miniSignals2.default();\n\n /**\n * Dispatched when the loader begins to process the queue.\n *\n * The callback looks like {@link Loader.OnStartSignal}.\n *\n * @member {Signal}\n */\n this.onStart = new _miniSignals2.default();\n\n /**\n * Dispatched when the queued resources all load.\n *\n * The callback looks like {@link Loader.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onComplete = new _miniSignals2.default();\n\n // Add default before middleware\n for (var i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) {\n this.pre(Loader._defaultBeforeMiddleware[i]);\n }\n\n // Add default after middleware\n for (var _i = 0; _i < Loader._defaultAfterMiddleware.length; ++_i) {\n this.use(Loader._defaultAfterMiddleware[_i]);\n }\n }\n\n /**\n * When the progress changes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnProgressSignal\n * @param {Loader} loader - The loader the progress is advancing on.\n * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance.\n */\n\n /**\n * When an error occurrs the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnErrorSignal\n * @param {Loader} loader - The loader the error happened in.\n * @param {Resource} resource - The resource that caused the error.\n */\n\n /**\n * When a load completes the loader and resource are disaptched.\n *\n * @memberof Loader\n * @callback OnLoadSignal\n * @param {Loader} loader - The loader that laoded the resource.\n * @param {Resource} resource - The resource that has completed loading.\n */\n\n /**\n * When the loader starts loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnStartSignal\n * @param {Loader} loader - The loader that has started loading resources.\n */\n\n /**\n * When the loader completes loading resources it dispatches this callback.\n *\n * @memberof Loader\n * @callback OnCompleteSignal\n * @param {Loader} loader - The loader that has finished loading resources.\n */\n\n /**\n * Options for a call to `.add()`.\n *\n * @see Loader#add\n *\n * @typedef {object} IAddOptions\n * @property {string} [name] - The name of the resource to load, if not passed the url is used.\n * @property {string} [key] - Alias for `name`.\n * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @property {Loader.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener.\n * @property {Loader.OnCompleteSignal} [callback] - Alias for `onComplete`.\n * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object.\n */\n\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n *\n * @param {string|IAddOptions} [name] - The name of the resource to load, if not passed the url is used.\n * @param {string} [url] - The url for this resource, relative to the baseUrl of this loader.\n * @param {IAddOptions} [options] - The options for the load.\n * @param {Loader.OnCompleteSignal} [cb] - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n\n\n Loader.prototype.add = function add(name, url, options, cb) {\n // special case of an array of objects or urls\n if (Array.isArray(name)) {\n for (var i = 0; i < name.length; ++i) {\n this.add(name[i]);\n }\n\n return this;\n }\n\n // if an object is passed instead of params\n if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {\n cb = url || name.callback || name.onComplete;\n options = name;\n url = name.url;\n name = name.name || name.key || name.url;\n }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string') {\n cb = options;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string') {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function') {\n cb = options;\n options = null;\n }\n\n // if loading already you can only add resources that have a parent.\n if (this.loading && (!options || !options.parentResource)) {\n throw new Error('Cannot add resources while the loader is running.');\n }\n\n // check if resource already exists.\n if (this.resources[name]) {\n throw new Error('Resource named \"' + name + '\" already exists.');\n }\n\n // add base url if this isn't an absolute url\n url = this._prepareUrl(url);\n\n // create the store the resource\n this.resources[name] = new _Resource.Resource(name, url, options);\n\n if (typeof cb === 'function') {\n this.resources[name].onAfterMiddleware.once(cb);\n }\n\n // if actively loading, make sure to adjust progress chunks for that parent and its children\n if (this.loading) {\n var parent = options.parentResource;\n var incompleteChildren = [];\n\n for (var _i2 = 0; _i2 < parent.children.length; ++_i2) {\n if (!parent.children[_i2].isComplete) {\n incompleteChildren.push(parent.children[_i2]);\n }\n }\n\n var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (var _i3 = 0; _i3 < incompleteChildren.length; ++_i3) {\n incompleteChildren[_i3].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n }\n\n // add the resource to the queue\n this._queue.push(this.resources[name]);\n\n return this;\n };\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n\n\n Loader.prototype.pre = function pre(fn) {\n this._beforeMiddleware.push(fn);\n\n return this;\n };\n\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @param {function} fn - The middleware function to register.\n * @return {this} Returns itself.\n */\n\n\n Loader.prototype.use = function use(fn) {\n this._afterMiddleware.push(fn);\n\n return this;\n };\n\n /**\n * Resets the queue of the loader to prepare for a new load.\n *\n * @return {this} Returns itself.\n */\n\n\n Loader.prototype.reset = function reset() {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n this._queue.pause();\n\n // abort all resource loads\n for (var k in this.resources) {\n var res = this.resources[k];\n\n if (res._onLoadBinding) {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading) {\n res.abort();\n }\n }\n\n this.resources = {};\n\n return this;\n };\n\n /**\n * Starts loading the queued resources.\n *\n * @param {function} [cb] - Optional callback that will be bound to the `complete` event.\n * @return {this} Returns itself.\n */\n\n\n Loader.prototype.load = function load(cb) {\n // register complete callback if they pass one\n if (typeof cb === 'function') {\n this.onComplete.once(cb);\n }\n\n // if the queue has already started we are done here\n if (this.loading) {\n return this;\n }\n\n if (this._queue.idle()) {\n this._onStart();\n this._onComplete();\n } else {\n // distribute progress chunks\n var numTasks = this._queue._tasks.length;\n var chunk = MAX_PROGRESS / numTasks;\n\n for (var i = 0; i < this._queue._tasks.length; ++i) {\n this._queue._tasks[i].data.progressChunk = chunk;\n }\n\n // notify we are starting\n this._onStart();\n\n // start loading\n this._queue.resume();\n }\n\n return this;\n };\n\n /**\n * The number of resources to load concurrently.\n *\n * @member {number}\n * @default 10\n */\n\n\n /**\n * Prepares a url for usage based on the configuration of this object\n *\n * @private\n * @param {string} url - The url to prepare.\n * @return {string} The prepared url.\n */\n Loader.prototype._prepareUrl = function _prepareUrl(url) {\n var parsedUrl = (0, _parseUri2.default)(url, { strictMode: true });\n var result = void 0;\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) {\n result = url;\n }\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 && url.charAt(0) !== '/') {\n result = this.baseUrl + '/' + url;\n } else {\n result = this.baseUrl + url;\n }\n\n // if we need to add a default querystring, there is a bit more work\n if (this.defaultQueryString) {\n var hash = rgxExtractUrlHash.exec(result)[0];\n\n result = result.substr(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1) {\n result += '&' + this.defaultQueryString;\n } else {\n result += '?' + this.defaultQueryString;\n }\n\n result += hash;\n }\n\n return result;\n };\n\n /**\n * Loads a single resource.\n *\n * @private\n * @param {Resource} resource - The resource to load.\n * @param {function} dequeue - The function to call when we need to dequeue this item.\n */\n\n\n Loader.prototype._loadResource = function _loadResource(resource, dequeue) {\n var _this2 = this;\n\n resource._dequeue = dequeue;\n\n // run before middleware\n async.eachSeries(this._beforeMiddleware, function (fn, next) {\n fn.call(_this2, resource, function () {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n }, function () {\n if (resource.isComplete) {\n _this2._onLoad(resource);\n } else {\n resource._onLoadBinding = resource.onComplete.once(_this2._onLoad, _this2);\n resource.load();\n }\n }, true);\n };\n\n /**\n * Called once loading has started.\n *\n * @private\n */\n\n\n Loader.prototype._onStart = function _onStart() {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n };\n\n /**\n * Called once each resource has loaded.\n *\n * @private\n */\n\n\n Loader.prototype._onComplete = function _onComplete() {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n };\n\n /**\n * Called each time a resources is loaded.\n *\n * @private\n * @param {Resource} resource - The resource that was loaded\n */\n\n\n Loader.prototype._onLoad = function _onLoad(resource) {\n var _this3 = this;\n\n resource._onLoadBinding = null;\n\n // remove this resource from the async queue, and add it to our list of resources that are being parsed\n this._resourcesParsing.push(resource);\n resource._dequeue();\n\n // run all the after middleware for this resource\n async.eachSeries(this._afterMiddleware, function (fn, next) {\n fn.call(_this3, resource, next);\n }, function () {\n resource.onAfterMiddleware.dispatch(resource);\n\n _this3.progress = Math.min(MAX_PROGRESS, _this3.progress + resource.progressChunk);\n _this3.onProgress.dispatch(_this3, resource);\n\n if (resource.error) {\n _this3.onError.dispatch(resource.error, _this3, resource);\n } else {\n _this3.onLoad.dispatch(_this3, resource);\n }\n\n _this3._resourcesParsing.splice(_this3._resourcesParsing.indexOf(resource), 1);\n\n // do completion check\n if (_this3._queue.idle() && _this3._resourcesParsing.length === 0) {\n _this3._onComplete();\n }\n }, true);\n };\n\n _createClass(Loader, [{\n key: 'concurrency',\n get: function get() {\n return this._queue.concurrency;\n }\n // eslint-disable-next-line require-jsdoc\n ,\n set: function set(concurrency) {\n this._queue.concurrency = concurrency;\n }\n }]);\n\n return Loader;\n}();\n\n/**\n * A default array of middleware to run before loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\n\n\nLoader._defaultBeforeMiddleware = [];\n\n/**\n * A default array of middleware to run after loading each resource.\n * Each of these middlewares are added to any new Loader instances when they are created.\n *\n * @private\n * @member {function[]}\n */\nLoader._defaultAfterMiddleware = [];\n\n/**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\nLoader.pre = function LoaderPreStatic(fn) {\n Loader._defaultBeforeMiddleware.push(fn);\n\n return Loader;\n};\n\n/**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @static\n * @param {function} fn - The middleware function to register.\n * @return {Loader} Returns itself.\n */\nLoader.use = function LoaderUseStatic(fn) {\n Loader._defaultAfterMiddleware.push(fn);\n\n return Loader;\n};\n//# sourceMappingURL=Loader.js.map","'use strict';\n\nexports.__esModule = true;\nexports.Resource = undefined;\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _parseUri = require('parse-uri');\n\nvar _parseUri2 = _interopRequireDefault(_parseUri);\n\nvar _miniSignals = require('mini-signals');\n\nvar _miniSignals2 = _interopRequireDefault(_miniSignals);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n// tests if CORS is supported in XHR, if not we need to use XDR\nvar useXdr = !!(window.XDomainRequest && !('withCredentials' in new XMLHttpRequest()));\nvar tempAnchor = null;\n\n// some status constants\nvar STATUS_NONE = 0;\nvar STATUS_OK = 200;\nvar STATUS_EMPTY = 204;\nvar STATUS_IE_BUG_EMPTY = 1223;\nvar STATUS_TYPE_OK = 2;\n\n// noop\nfunction _noop() {} /* empty */\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * @class\n */\n\nvar Resource = exports.Resource = function () {\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.LOAD_TYPE} loadType - The load type to set it to.\n */\n Resource.setExtensionLoadType = function setExtensionLoadType(extname, loadType) {\n setExtMap(Resource._loadTypeMap, extname, loadType);\n };\n\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n\n\n Resource.setExtensionXhrType = function setExtensionXhrType(extname, xhrType) {\n setExtMap(Resource._xhrTypeMap, extname, xhrType);\n };\n\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object.\n */\n\n\n function Resource(name, url, options) {\n _classCallCheck(this, Resource);\n\n if (typeof name !== 'string' || typeof url !== 'string') {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n\n /**\n * The state flags of this resource.\n *\n * @private\n * @member {number}\n */\n this._flags = 0;\n\n // set data url flag, needs to be set early for some _determineX checks to work.\n this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n\n /**\n * The name of this resource.\n *\n * @readonly\n * @member {string}\n */\n this.name = name;\n\n /**\n * The url used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n this.url = url;\n\n /**\n * The extension used to load this resource.\n *\n * @readonly\n * @member {string}\n */\n this.extension = this._getExtension();\n\n /**\n * The data that was loaded by the resource.\n *\n * @member {any}\n */\n this.data = null;\n\n /**\n * Is this request cross-origin? If unset, determined automatically.\n *\n * @member {string}\n */\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n *\n * @member {number}\n */\n this.timeout = options.timeout || 0;\n\n /**\n * The method of loading to use for this resource.\n *\n * @member {Resource.LOAD_TYPE}\n */\n this.loadType = options.loadType || this._determineLoadType();\n\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n *\n * @member {string}\n */\n this.xhrType = options.xhrType;\n\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n *\n * @member {Resource.IMetadata}\n */\n this.metadata = options.metadata || {};\n\n /**\n * The error that occurred while loading (if any).\n *\n * @readonly\n * @member {Error}\n */\n this.error = null;\n\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `Resource.LOAD_TYPE.XHR`.\n *\n * @readonly\n * @member {XMLHttpRequest}\n */\n this.xhr = null;\n\n /**\n * The child resources this resource owns.\n *\n * @readonly\n * @member {Resource[]}\n */\n this.children = [];\n\n /**\n * The resource type.\n *\n * @readonly\n * @member {Resource.TYPE}\n */\n this.type = Resource.TYPE.UNKNOWN;\n\n /**\n * The progress chunk owned by this resource.\n *\n * @readonly\n * @member {number}\n */\n this.progressChunk = 0;\n\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n *\n * @private\n * @member {function}\n */\n this._dequeue = _noop;\n\n /**\n * Used a storage place for the on load binding used privately by the loader.\n *\n * @private\n * @member {function}\n */\n this._onLoadBinding = null;\n\n /**\n * The timer for element loads to check if they timeout.\n *\n * @private\n * @member {number}\n */\n this._elementTimer = 0;\n\n /**\n * The `complete` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundComplete = this.complete.bind(this);\n\n /**\n * The `_onError` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnError = this._onError.bind(this);\n\n /**\n * The `_onProgress` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnProgress = this._onProgress.bind(this);\n\n /**\n * The `_onTimeout` function bound to this resource's context.\n *\n * @private\n * @member {function}\n */\n this._boundOnTimeout = this._onTimeout.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link Resource.OnStartSignal}.\n *\n * @member {Signal}\n */\n this.onStart = new _miniSignals2.default();\n\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link Resource.OnProgressSignal}.\n *\n * @member {Signal}\n */\n this.onProgress = new _miniSignals2.default();\n\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onComplete = new _miniSignals2.default();\n\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link Resource.OnCompleteSignal}.\n *\n * @member {Signal}\n */\n this.onAfterMiddleware = new _miniSignals2.default();\n }\n\n /**\n * When the resource starts to load.\n *\n * @memberof Resource\n * @callback OnStartSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n *\n * @memberof Resource\n * @callback OnProgressSignal\n * @param {Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n *\n * @memberof Resource\n * @callback OnCompleteSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof Resource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n *\n * @readonly\n * @member {boolean}\n */\n\n\n /**\n * Marks the resource as complete.\n *\n */\n Resource.prototype.complete = function complete() {\n this._clearEvents();\n this._finish();\n };\n\n /**\n * Aborts the loading of this resource, with an optional message.\n *\n * @param {string} message - The message to use for the error\n */\n\n\n Resource.prototype.abort = function abort(message) {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error) {\n return;\n }\n\n // store error\n this.error = new Error(message);\n\n // clear events before calling aborts\n this._clearEvents();\n\n // abort the actual loading\n if (this.xhr) {\n this.xhr.abort();\n } else if (this.xdr) {\n this.xdr.abort();\n } else if (this.data) {\n // single source\n if (this.data.src) {\n this.data.src = Resource.EMPTY_GIF;\n }\n // multi-source\n else {\n while (this.data.firstChild) {\n this.data.removeChild(this.data.firstChild);\n }\n }\n }\n\n // done now.\n this._finish();\n };\n\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n *\n * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n\n\n Resource.prototype.load = function load(cb) {\n var _this = this;\n\n if (this.isLoading) {\n return;\n }\n\n if (this.isComplete) {\n if (cb) {\n setTimeout(function () {\n return cb(_this);\n }, 1);\n }\n\n return;\n } else if (cb) {\n this.onComplete.once(cb);\n }\n\n this._setFlag(Resource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this);\n\n // if unset, determine the value\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType) {\n case Resource.LOAD_TYPE.IMAGE:\n this.type = Resource.TYPE.IMAGE;\n this._loadElement('image');\n break;\n\n case Resource.LOAD_TYPE.AUDIO:\n this.type = Resource.TYPE.AUDIO;\n this._loadSourceElement('audio');\n break;\n\n case Resource.LOAD_TYPE.VIDEO:\n this.type = Resource.TYPE.VIDEO;\n this._loadSourceElement('video');\n break;\n\n case Resource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (useXdr && this.crossOrigin) {\n this._loadXdr();\n } else {\n this._loadXhr();\n }\n break;\n }\n };\n\n /**\n * Checks if the flag is set.\n *\n * @private\n * @param {number} flag - The flag to check.\n * @return {boolean} True if the flag is set.\n */\n\n\n Resource.prototype._hasFlag = function _hasFlag(flag) {\n return (this._flags & flag) !== 0;\n };\n\n /**\n * (Un)Sets the flag.\n *\n * @private\n * @param {number} flag - The flag to (un)set.\n * @param {boolean} value - Whether to set or (un)set the flag.\n */\n\n\n Resource.prototype._setFlag = function _setFlag(flag, value) {\n this._flags = value ? this._flags | flag : this._flags & ~flag;\n };\n\n /**\n * Clears all the events from the underlying loading source.\n *\n * @private\n */\n\n\n Resource.prototype._clearEvents = function _clearEvents() {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener) {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr) {\n if (this.xhr.removeEventListener) {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n } else {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n };\n\n /**\n * Finalizes the load.\n *\n * @private\n */\n\n\n Resource.prototype._finish = function _finish() {\n if (this.isComplete) {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true);\n this._setFlag(Resource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n };\n\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n\n\n Resource.prototype._loadElement = function _loadElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n } else if (type === 'image' && typeof window.Image !== 'undefined') {\n this.data = new Image();\n } else {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n };\n\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n *\n * @private\n * @param {string} type - The type of element to use.\n */\n\n\n Resource.prototype._loadSourceElement = function _loadSourceElement(type) {\n if (this.metadata.loadElement) {\n this.data = this.metadata.loadElement;\n } else if (type === 'audio' && typeof window.Audio !== 'undefined') {\n this.data = new Audio();\n } else {\n this.data = document.createElement(type);\n }\n\n if (this.data === null) {\n this.abort('Unsupported element: ' + type);\n\n return;\n }\n\n if (this.crossOrigin) {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource) {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if (navigator.isCocoonJS) {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n } else if (Array.isArray(this.url)) {\n var mimeTypes = this.metadata.mimeType;\n\n for (var i = 0; i < this.url.length; ++i) {\n this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes));\n }\n } else {\n var _mimeTypes = this.metadata.mimeType;\n\n this.data.appendChild(this._createSource(type, this.url, Array.isArray(_mimeTypes) ? _mimeTypes[0] : _mimeTypes));\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n\n this.data.load();\n\n if (this.timeout) {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout);\n }\n };\n\n /**\n * Loads this resources using an XMLHttpRequest.\n *\n * @private\n */\n\n\n Resource.prototype._loadXhr = function _loadXhr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n var xhr = this.xhr = new XMLHttpRequest();\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n xhr.timeout = this.timeout;\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT;\n } else {\n xhr.responseType = this.xhrType;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n };\n\n /**\n * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross).\n *\n * @private\n */\n\n\n Resource.prototype._loadXdr = function _loadXdr() {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string') {\n this.xhrType = this._determineXhrType();\n }\n\n var xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef\n\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(function () {\n return xdr.send();\n }, 1);\n };\n\n /**\n * Creates a source used in loading via an element.\n *\n * @private\n * @param {string} type - The element type (video or audio).\n * @param {string} url - The source URL to load from.\n * @param {string} [mime] - The mime type of the video\n * @return {HTMLSourceElement} The source element.\n */\n\n\n Resource.prototype._createSource = function _createSource(type, url, mime) {\n if (!mime) {\n mime = type + '/' + this._getExtension(url);\n }\n\n var source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n };\n\n /**\n * Called if a load errors out.\n *\n * @param {Event} event - The error event from the element that emits it.\n * @private\n */\n\n\n Resource.prototype._onError = function _onError(event) {\n this.abort('Failed to load element using: ' + event.target.nodeName);\n };\n\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n *\n * @private\n * @param {XMLHttpRequestProgressEvent|Event} event - Progress event.\n */\n\n\n Resource.prototype._onProgress = function _onProgress(event) {\n if (event && event.lengthComputable) {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n };\n\n /**\n * Called if a timeout event fires for an element.\n *\n * @private\n */\n\n\n Resource.prototype._onTimeout = function _onTimeout() {\n this.abort('Load timed out.');\n };\n\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n\n\n Resource.prototype._xhrOnError = function _xhrOnError() {\n var xhr = this.xhr;\n\n this.abort(reqType(xhr) + ' Request failed. Status: ' + xhr.status + ', text: \"' + xhr.statusText + '\"');\n };\n\n /**\n * Called if an error event fires for xhr/xdr.\n *\n * @private\n */\n\n\n Resource.prototype._xhrOnTimeout = function _xhrOnTimeout() {\n var xhr = this.xhr;\n\n this.abort(reqType(xhr) + ' Request timed out.');\n };\n\n /**\n * Called if an abort event fires for xhr/xdr.\n *\n * @private\n */\n\n\n Resource.prototype._xhrOnAbort = function _xhrOnAbort() {\n var xhr = this.xhr;\n\n this.abort(reqType(xhr) + ' Request was aborted by the user.');\n };\n\n /**\n * Called when data successfully loads from an xhr/xdr request.\n *\n * @private\n * @param {XMLHttpRequestLoadEvent|Event} event - Load event\n */\n\n\n Resource.prototype._xhrOnLoad = function _xhrOnLoad() {\n var xhr = this.xhr;\n var text = '';\n var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') {\n text = xhr.responseText;\n }\n\n // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) {\n status = STATUS_OK;\n }\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY) {\n status = STATUS_EMPTY;\n }\n\n var statusType = status / 100 | 0;\n\n if (statusType === STATUS_TYPE_OK) {\n // if text, just return it\n if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) {\n this.data = text;\n this.type = Resource.TYPE.TEXT;\n }\n // if json, parse into json object\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) {\n try {\n this.data = JSON.parse(text);\n this.type = Resource.TYPE.JSON;\n } catch (e) {\n this.abort('Error trying to parse loaded json: ' + e);\n\n return;\n }\n }\n // if xml, parse into an xml document or div element\n else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) {\n try {\n if (window.DOMParser) {\n var domparser = new DOMParser();\n\n this.data = domparser.parseFromString(text, 'text/xml');\n } else {\n var div = document.createElement('div');\n\n div.innerHTML = text;\n\n this.data = div;\n }\n\n this.type = Resource.TYPE.XML;\n } catch (e) {\n this.abort('Error trying to parse loaded xml: ' + e);\n\n return;\n }\n }\n // other types just return the response\n else {\n this.data = xhr.response || text;\n }\n } else {\n this.abort('[' + xhr.status + '] ' + xhr.statusText + ': ' + xhr.responseURL);\n\n return;\n }\n\n this.complete();\n };\n\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n *\n * @private\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\n\n\n Resource.prototype._determineCrossOrigin = function _determineCrossOrigin(url, loc) {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0) {\n return '';\n }\n\n // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match window.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n if (window.origin !== window.location.origin) {\n return 'anonymous';\n }\n\n // default is window.location\n loc = loc || window.location;\n\n if (!tempAnchor) {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n url = (0, _parseUri2.default)(tempAnchor.href, { strictMode: true });\n\n var samePort = !url.port && loc.port === '' || url.port === loc.port;\n var protocol = url.protocol ? url.protocol + ':' : '';\n\n // if cross origin\n if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) {\n return 'anonymous';\n }\n\n return '';\n };\n\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n\n\n Resource.prototype._determineXhrType = function _determineXhrType() {\n return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT;\n };\n\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {Resource.LOAD_TYPE} The loadType to use.\n */\n\n\n Resource.prototype._determineLoadType = function _determineLoadType() {\n return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR;\n };\n\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n *\n * @private\n * @return {string} The extension.\n */\n\n\n Resource.prototype._getExtension = function _getExtension() {\n var url = this.url;\n var ext = '';\n\n if (this.isDataUrl) {\n var slashIndex = url.indexOf('/');\n\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n } else {\n var queryStart = url.indexOf('?');\n var hashStart = url.indexOf('#');\n var index = Math.min(queryStart > -1 ? queryStart : url.length, hashStart > -1 ? hashStart : url.length);\n\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n };\n\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n *\n * @private\n * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for.\n * @return {string} The mime type to use.\n */\n\n\n Resource.prototype._getMimeFromXhrType = function _getMimeFromXhrType(type) {\n switch (type) {\n case Resource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case Resource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case Resource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case Resource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case Resource.XHR_RESPONSE_TYPE.DEFAULT:\n case Resource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n default:\n return 'text/plain';\n }\n };\n\n _createClass(Resource, [{\n key: 'isDataUrl',\n get: function get() {\n return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL);\n }\n\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n *\n * @readonly\n * @member {boolean}\n */\n\n }, {\n key: 'isComplete',\n get: function get() {\n return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE);\n }\n\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n *\n * @readonly\n * @member {boolean}\n */\n\n }, {\n key: 'isLoading',\n get: function get() {\n return this._hasFlag(Resource.STATUS_FLAGS.LOADING);\n }\n }]);\n\n return Resource;\n}();\n\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\n\n\nResource.STATUS_FLAGS = {\n NONE: 0,\n DATA_URL: 1 << 0,\n COMPLETE: 1 << 1,\n LOADING: 1 << 2\n};\n\n/**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.TYPE = {\n UNKNOWN: 0,\n JSON: 1,\n XML: 2,\n IMAGE: 3,\n AUDIO: 4,\n VIDEO: 5,\n TEXT: 6\n};\n\n/**\n * The types of loading a resource can use.\n *\n * @static\n * @readonly\n * @enum {number}\n */\nResource.LOAD_TYPE = {\n /** Uses XMLHttpRequest to load the resource. */\n XHR: 1,\n /** Uses an `Image` object to load the resource. */\n IMAGE: 2,\n /** Uses an `Audio` object to load the resource. */\n AUDIO: 3,\n /** Uses a `Video` object to load the resource. */\n VIDEO: 4\n};\n\n/**\n * The XHR ready states, used internally.\n *\n * @static\n * @readonly\n * @enum {string}\n */\nResource.XHR_RESPONSE_TYPE = {\n /** string */\n DEFAULT: 'text',\n /** ArrayBuffer */\n BUFFER: 'arraybuffer',\n /** Blob */\n BLOB: 'blob',\n /** Document */\n DOCUMENT: 'document',\n /** Object */\n JSON: 'json',\n /** String */\n TEXT: 'text'\n};\n\nResource._loadTypeMap = {\n // images\n gif: Resource.LOAD_TYPE.IMAGE,\n png: Resource.LOAD_TYPE.IMAGE,\n bmp: Resource.LOAD_TYPE.IMAGE,\n jpg: Resource.LOAD_TYPE.IMAGE,\n jpeg: Resource.LOAD_TYPE.IMAGE,\n tif: Resource.LOAD_TYPE.IMAGE,\n tiff: Resource.LOAD_TYPE.IMAGE,\n webp: Resource.LOAD_TYPE.IMAGE,\n tga: Resource.LOAD_TYPE.IMAGE,\n svg: Resource.LOAD_TYPE.IMAGE,\n 'svg+xml': Resource.LOAD_TYPE.IMAGE, // for SVG data urls\n\n // audio\n mp3: Resource.LOAD_TYPE.AUDIO,\n ogg: Resource.LOAD_TYPE.AUDIO,\n wav: Resource.LOAD_TYPE.AUDIO,\n\n // videos\n mp4: Resource.LOAD_TYPE.VIDEO,\n webm: Resource.LOAD_TYPE.VIDEO\n};\n\nResource._xhrTypeMap = {\n // xml\n xhtml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: Resource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // images\n gif: Resource.XHR_RESPONSE_TYPE.BLOB,\n png: Resource.XHR_RESPONSE_TYPE.BLOB,\n bmp: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpg: Resource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: Resource.XHR_RESPONSE_TYPE.BLOB,\n tif: Resource.XHR_RESPONSE_TYPE.BLOB,\n tiff: Resource.XHR_RESPONSE_TYPE.BLOB,\n webp: Resource.XHR_RESPONSE_TYPE.BLOB,\n tga: Resource.XHR_RESPONSE_TYPE.BLOB,\n\n // json\n json: Resource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n text: Resource.XHR_RESPONSE_TYPE.TEXT,\n txt: Resource.XHR_RESPONSE_TYPE.TEXT,\n\n // fonts\n ttf: Resource.XHR_RESPONSE_TYPE.BUFFER,\n otf: Resource.XHR_RESPONSE_TYPE.BUFFER\n};\n\n// We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\nResource.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n *\n * @ignore\n * @param {object} map - The map to set on.\n * @param {string} extname - The extension (or key) to set.\n * @param {number} val - The value to set.\n */\nfunction setExtMap(map, extname, val) {\n if (extname && extname.indexOf('.') === 0) {\n extname = extname.substring(1);\n }\n\n if (!extname) {\n return;\n }\n\n map[extname] = val;\n}\n\n/**\n * Quick helper to get string xhr type.\n *\n * @ignore\n * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check.\n * @return {string} The type.\n */\nfunction reqType(xhr) {\n return xhr.toString().replace('object ', '');\n}\n\n// Backwards compat\nif (typeof module !== 'undefined') {\n module.exports.default = Resource; // eslint-disable-line no-undef\n}\n//# sourceMappingURL=Resource.js.map","'use strict';\n\nexports.__esModule = true;\nexports.eachSeries = eachSeries;\nexports.queue = queue;\n/**\n * Smaller version of the async library constructs.\n *\n * @namespace async\n */\n\n/**\n * Noop function\n *\n * @ignore\n * @function\n * @memberof async\n */\nfunction _noop() {} /* empty */\n\n/**\n * Iterates an array in series.\n *\n * @memberof async\n * @param {Array.<*>} array - Array to iterate.\n * @param {function} iterator - Function to call for each element.\n * @param {function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\nfunction eachSeries(array, iterator, callback, deferNext) {\n var i = 0;\n var len = array.length;\n\n (function next(err) {\n if (err || i === len) {\n if (callback) {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext) {\n setTimeout(function () {\n iterator(array[i++], next);\n }, 1);\n } else {\n iterator(array[i++], next);\n }\n })();\n}\n\n/**\n * Ensures a function is only called once.\n *\n * @ignore\n * @memberof async\n * @param {function} fn - The function to wrap.\n * @return {function} The wrapping function.\n */\nfunction onlyOnce(fn) {\n return function onceWrapper() {\n if (fn === null) {\n throw new Error('Callback was already called.');\n }\n\n var callFn = fn;\n\n fn = null;\n callFn.apply(this, arguments);\n };\n}\n\n/**\n * Async queue implementation,\n *\n * @memberof async\n * @param {function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @return {*} The async queue object.\n */\nfunction queue(worker, concurrency) {\n if (concurrency == null) {\n // eslint-disable-line no-eq-null,eqeqeq\n concurrency = 1;\n } else if (concurrency === 0) {\n throw new Error('Concurrency must not be zero');\n }\n\n var workers = 0;\n var q = {\n _tasks: [],\n concurrency: concurrency,\n saturated: _noop,\n unsaturated: _noop,\n buffer: concurrency / 4,\n empty: _noop,\n drain: _noop,\n error: _noop,\n started: false,\n paused: false,\n push: function push(data, callback) {\n _insert(data, false, callback);\n },\n kill: function kill() {\n workers = 0;\n q.drain = _noop;\n q.started = false;\n q._tasks = [];\n },\n unshift: function unshift(data, callback) {\n _insert(data, true, callback);\n },\n process: function process() {\n while (!q.paused && workers < q.concurrency && q._tasks.length) {\n var task = q._tasks.shift();\n\n if (q._tasks.length === 0) {\n q.empty();\n }\n\n workers += 1;\n\n if (workers === q.concurrency) {\n q.saturated();\n }\n\n worker(task.data, onlyOnce(_next(task)));\n }\n },\n length: function length() {\n return q._tasks.length;\n },\n running: function running() {\n return workers;\n },\n idle: function idle() {\n return q._tasks.length + workers === 0;\n },\n pause: function pause() {\n if (q.paused === true) {\n return;\n }\n\n q.paused = true;\n },\n resume: function resume() {\n if (q.paused === false) {\n return;\n }\n\n q.paused = false;\n\n // Need to call q.process once per concurrent\n // worker to preserve full concurrency after pause\n for (var w = 1; w <= q.concurrency; w++) {\n q.process();\n }\n }\n };\n\n function _insert(data, insertAtFront, callback) {\n if (callback != null && typeof callback !== 'function') {\n // eslint-disable-line no-eq-null,eqeqeq\n throw new Error('task callback must be a function');\n }\n\n q.started = true;\n\n if (data == null && q.idle()) {\n // eslint-disable-line no-eq-null,eqeqeq\n // call drain immediately if there are no tasks\n setTimeout(function () {\n return q.drain();\n }, 1);\n\n return;\n }\n\n var item = {\n data: data,\n callback: typeof callback === 'function' ? callback : _noop\n };\n\n if (insertAtFront) {\n q._tasks.unshift(item);\n } else {\n q._tasks.push(item);\n }\n\n setTimeout(function () {\n return q.process();\n }, 1);\n }\n\n function _next(task) {\n return function next() {\n workers -= 1;\n\n task.callback.apply(task, arguments);\n\n if (arguments[0] != null) {\n // eslint-disable-line no-eq-null,eqeqeq\n q.error(arguments[0], task.data);\n }\n\n if (workers <= q.concurrency - q.buffer) {\n q.unsaturated();\n }\n\n if (q.idle()) {\n q.drain();\n }\n\n q.process();\n };\n }\n\n return q;\n}\n//# sourceMappingURL=async.js.map","'use strict';\n\nexports.__esModule = true;\nexports.encodeBinary = encodeBinary;\nvar _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes binary into base64.\n *\n * @param {string} input The input data to encode.\n * @returns {string} The encoded base64 string\n */\nfunction encodeBinary(input) {\n var output = '';\n var inx = 0;\n\n while (inx < input.length) {\n // Fill byte buffer array\n var bytebuffer = [0, 0, 0];\n var encodedCharIndexes = [0, 0, 0, 0];\n\n for (var jnx = 0; jnx < bytebuffer.length; ++jnx) {\n if (inx < input.length) {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n } else {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = (bytebuffer[0] & 0x3) << 4 | bytebuffer[1] >> 4;\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = (bytebuffer[1] & 0x0f) << 2 | bytebuffer[2] >> 6;\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n var paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes) {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (var _jnx = 0; _jnx < encodedCharIndexes.length; ++_jnx) {\n output += _keyStr.charAt(encodedCharIndexes[_jnx]);\n }\n }\n\n return output;\n}\n\n// Backwards compat\nif (typeof module !== 'undefined') {\n module.exports.default = encodeBinary; // eslint-disable-line no-undef\n}\n//# sourceMappingURL=b64.js.map","'use strict';\n\n// import Loader from './Loader';\n// import Resource from './Resource';\n// import * as async from './async';\n// import * as b64 from './b64';\n\n/* eslint-disable no-undef */\n\nvar Loader = require('./Loader').Loader;\nvar Resource = require('./Resource').Resource;\nvar async = require('./async');\nvar b64 = require('./b64');\n\n/**\n *\n * @static\n * @memberof Loader\n * @member {Class<Resource>}\n */\nLoader.Resource = Resource;\n\n/**\n *\n * @static\n * @memberof Loader\n * @member {Class<async>}\n */\nLoader.async = async;\n\n/**\n *\n * @static\n * @memberof Loader\n * @member {Class<encodeBinary>}\n */\nLoader.encodeBinary = b64;\n\n/**\n *\n * @deprecated\n * @see Loader.encodeBinary\n *\n * @static\n * @memberof Loader\n * @member {Class<encodeBinary>}\n */\nLoader.base64 = b64;\n\n// export manually, and also as default\nmodule.exports = Loader;\n\n// default & named export\nmodule.exports.Loader = Loader;\nmodule.exports.default = Loader;\n//# sourceMappingURL=index.js.map","'use strict';\n\nexports.__esModule = true;\nexports.blobMiddlewareFactory = blobMiddlewareFactory;\n\nvar _Resource = require('../../Resource');\n\nvar _b = require('../../b64');\n\nvar Url = window.URL || window.webkitURL;\n\n// a middleware for transforming XHR loaded Blobs into more useful objects\nfunction blobMiddlewareFactory() {\n return function blobMiddleware(resource, next) {\n if (!resource.data) {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === _Resource.Resource.XHR_RESPONSE_TYPE.BLOB) {\n // if there is no blob support we probably got a binary string back\n if (!window.Blob || typeof resource.data === 'string') {\n var type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0) {\n resource.data = new Image();\n resource.data.src = 'data:' + type + ';base64,' + (0, _b.encodeBinary)(resource.xhr.responseText);\n\n resource.type = _Resource.Resource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = function () {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0) {\n var src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = _Resource.Resource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = function () {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\n };\n}\n//# sourceMappingURL=blob.js.map","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n","'use strict';\n\nmodule.exports = {\n isString: function(arg) {\n return typeof(arg) === 'string';\n },\n isObject: function(arg) {\n return typeof(arg) === 'object' && arg !== null;\n },\n isNull: function(arg) {\n return arg === null;\n },\n isNullOrUndefined: function(arg) {\n return arg == null;\n }\n};\n","import * as core from '../core';\nimport Device from 'ismobilejs';\nimport accessibleTarget from './accessibleTarget';\n\n// add some extra variables to the container..\ncore.utils.mixins.delayMixin(\n core.DisplayObject.prototype,\n accessibleTarget\n);\n\nconst KEY_CODE_TAB = 9;\n\nconst DIV_TOUCH_SIZE = 100;\nconst DIV_TOUCH_POS_X = 0;\nconst DIV_TOUCH_POS_Y = 0;\nconst DIV_TOUCH_ZINDEX = 2;\n\nconst DIV_HOOK_SIZE = 1;\nconst DIV_HOOK_POS_X = -1000;\nconst DIV_HOOK_POS_Y = -1000;\nconst DIV_HOOK_ZINDEX = 2;\n\n/**\n * The Accessibility manager recreates the ability to tab and have content read by screen\n * readers. This is very important as it can possibly help people with disabilities access pixi\n * content.\n *\n * Much like interaction any DisplayObject can be made accessible. This manager will map the\n * events as if the mouse was being used, minimizing the effort required to implement.\n *\n * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility\n *\n * @class\n * @memberof PIXI.accessibility\n */\nexport default class AccessibilityManager\n{\n /**\n * @param {PIXI.CanvasRenderer|PIXI.WebGLRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer)\n {\n if ((Device.tablet || Device.phone) && !navigator.isCocoonJS)\n {\n this.createTouchHook();\n }\n\n // first we create a div that will sit over the PixiJS element. This is where the div overlays will go.\n const div = document.createElement('div');\n\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.position = 'absolute';\n div.style.top = `${DIV_TOUCH_POS_X}px`;\n div.style.left = `${DIV_TOUCH_POS_Y}px`;\n div.style.zIndex = DIV_TOUCH_ZINDEX;\n\n /**\n * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go.\n *\n * @type {HTMLElement}\n * @private\n */\n this.div = div;\n\n /**\n * A simple pool for storing divs.\n *\n * @type {*}\n * @private\n */\n this.pool = [];\n\n /**\n * This is a tick used to check if an object is no longer being rendered.\n *\n * @type {Number}\n * @private\n */\n this.renderId = 0;\n\n /**\n * Setting this to true will visually show the divs.\n *\n * @type {boolean}\n */\n this.debug = false;\n\n /**\n * The renderer this accessibility manager works for.\n *\n * @member {PIXI.SystemRenderer}\n */\n this.renderer = renderer;\n\n /**\n * The array of currently active accessible items.\n *\n * @member {Array<*>}\n * @private\n */\n this.children = [];\n\n /**\n * pre-bind the functions\n *\n * @private\n */\n this._onKeyDown = this._onKeyDown.bind(this);\n this._onMouseMove = this._onMouseMove.bind(this);\n\n /**\n * stores the state of the manager. If there are no accessible objects or the mouse is moving, this will be false.\n *\n * @member {Array<*>}\n * @private\n */\n this.isActive = false;\n this.isMobileAccessabillity = false;\n\n // let listen for tab.. once pressed we can fire up and show the accessibility layer\n window.addEventListener('keydown', this._onKeyDown, false);\n }\n\n /**\n * Creates the touch hooks.\n *\n */\n createTouchHook()\n {\n const hookDiv = document.createElement('button');\n\n hookDiv.style.width = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.height = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.position = 'absolute';\n hookDiv.style.top = `${DIV_HOOK_POS_X}px`;\n hookDiv.style.left = `${DIV_HOOK_POS_Y}px`;\n hookDiv.style.zIndex = DIV_HOOK_ZINDEX;\n hookDiv.style.backgroundColor = '#FF0000';\n hookDiv.title = 'HOOK DIV';\n\n hookDiv.addEventListener('focus', () =>\n {\n this.isMobileAccessabillity = true;\n this.activate();\n document.body.removeChild(hookDiv);\n });\n\n document.body.appendChild(hookDiv);\n }\n\n /**\n * Activating will cause the Accessibility layer to be shown. This is called when a user\n * preses the tab key.\n *\n * @private\n */\n activate()\n {\n if (this.isActive)\n {\n return;\n }\n\n this.isActive = true;\n\n window.document.addEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown, false);\n\n this.renderer.on('postrender', this.update, this);\n\n if (this.renderer.view.parentNode)\n {\n this.renderer.view.parentNode.appendChild(this.div);\n }\n }\n\n /**\n * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves\n * the mouse.\n *\n * @private\n */\n deactivate()\n {\n if (!this.isActive || this.isMobileAccessabillity)\n {\n return;\n }\n\n this.isActive = false;\n\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.addEventListener('keydown', this._onKeyDown, false);\n\n this.renderer.off('postrender', this.update);\n\n if (this.div.parentNode)\n {\n this.div.parentNode.removeChild(this.div);\n }\n }\n\n /**\n * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.\n *\n * @private\n * @param {PIXI.Container} displayObject - The DisplayObject to check.\n */\n updateAccessibleObjects(displayObject)\n {\n if (!displayObject.visible)\n {\n return;\n }\n\n if (displayObject.accessible && displayObject.interactive)\n {\n if (!displayObject._accessibleActive)\n {\n this.addChild(displayObject);\n }\n\n displayObject.renderId = this.renderId;\n }\n\n const children = displayObject.children;\n\n for (let i = 0; i < children.length; i++)\n {\n this.updateAccessibleObjects(children[i]);\n }\n }\n\n /**\n * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.\n *\n * @private\n */\n update()\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n // update children...\n this.updateAccessibleObjects(this.renderer._lastObjectRendered);\n\n const rect = this.renderer.view.getBoundingClientRect();\n const sx = rect.width / this.renderer.width;\n const sy = rect.height / this.renderer.height;\n\n let div = this.div;\n\n div.style.left = `${rect.left}px`;\n div.style.top = `${rect.top}px`;\n div.style.width = `${this.renderer.width}px`;\n div.style.height = `${this.renderer.height}px`;\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (child.renderId !== this.renderId)\n {\n child._accessibleActive = false;\n\n core.utils.removeItems(this.children, i, 1);\n this.div.removeChild(child._accessibleDiv);\n this.pool.push(child._accessibleDiv);\n child._accessibleDiv = null;\n\n i--;\n\n if (this.children.length === 0)\n {\n this.deactivate();\n }\n }\n else\n {\n // map div to display..\n div = child._accessibleDiv;\n let hitArea = child.hitArea;\n const wt = child.worldTransform;\n\n if (child.hitArea)\n {\n div.style.left = `${(wt.tx + (hitArea.x * wt.a)) * sx}px`;\n div.style.top = `${(wt.ty + (hitArea.y * wt.d)) * sy}px`;\n\n div.style.width = `${hitArea.width * wt.a * sx}px`;\n div.style.height = `${hitArea.height * wt.d * sy}px`;\n }\n else\n {\n hitArea = child.getBounds();\n\n this.capHitArea(hitArea);\n\n div.style.left = `${hitArea.x * sx}px`;\n div.style.top = `${hitArea.y * sy}px`;\n\n div.style.width = `${hitArea.width * sx}px`;\n div.style.height = `${hitArea.height * sy}px`;\n\n // update button titles and hints if they exist and they've changed\n if (div.title !== child.accessibleTitle && child.accessibleTitle !== null)\n {\n div.title = child.accessibleTitle;\n }\n if (div.getAttribute('aria-label') !== child.accessibleHint\n && child.accessibleHint !== null)\n {\n div.setAttribute('aria-label', child.accessibleHint);\n }\n }\n }\n }\n\n // increment the render id..\n this.renderId++;\n }\n\n /**\n * TODO: docs.\n *\n * @param {Rectangle} hitArea - TODO docs\n */\n capHitArea(hitArea)\n {\n if (hitArea.x < 0)\n {\n hitArea.width += hitArea.x;\n hitArea.x = 0;\n }\n\n if (hitArea.y < 0)\n {\n hitArea.height += hitArea.y;\n hitArea.y = 0;\n }\n\n if (hitArea.x + hitArea.width > this.renderer.width)\n {\n hitArea.width = this.renderer.width - hitArea.x;\n }\n\n if (hitArea.y + hitArea.height > this.renderer.height)\n {\n hitArea.height = this.renderer.height - hitArea.y;\n }\n }\n\n /**\n * Adds a DisplayObject to the accessibility manager\n *\n * @private\n * @param {DisplayObject} displayObject - The child to make accessible.\n */\n addChild(displayObject)\n {\n // this.activate();\n\n let div = this.pool.pop();\n\n if (!div)\n {\n div = document.createElement('button');\n\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.backgroundColor = this.debug ? 'rgba(255,0,0,0.5)' : 'transparent';\n div.style.position = 'absolute';\n div.style.zIndex = DIV_TOUCH_ZINDEX;\n div.style.borderStyle = 'none';\n\n // ARIA attributes ensure that button title and hint updates are announced properly\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused.\n div.setAttribute('aria-live', 'off');\n }\n else\n {\n div.setAttribute('aria-live', 'polite');\n }\n\n if (navigator.userAgent.match(/rv:.*Gecko\\//))\n {\n // FireFox needs this to announce only the new button name\n div.setAttribute('aria-relevant', 'additions');\n }\n else\n {\n // required by IE, other browsers don't much care\n div.setAttribute('aria-relevant', 'text');\n }\n\n div.addEventListener('click', this._onClick.bind(this));\n div.addEventListener('focus', this._onFocus.bind(this));\n div.addEventListener('focusout', this._onFocusOut.bind(this));\n }\n\n if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null)\n {\n div.title = displayObject.accessibleTitle;\n }\n else if (!displayObject.accessibleHint\n || displayObject.accessibleHint === null)\n {\n div.title = `displayObject ${displayObject.tabIndex}`;\n }\n\n if (displayObject.accessibleHint\n && displayObject.accessibleHint !== null)\n {\n div.setAttribute('aria-label', displayObject.accessibleHint);\n }\n\n //\n\n displayObject._accessibleActive = true;\n displayObject._accessibleDiv = div;\n div.displayObject = displayObject;\n\n this.children.push(displayObject);\n this.div.appendChild(displayObject._accessibleDiv);\n displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;\n }\n\n /**\n * Maps the div button press to pixi's InteractionManager (click)\n *\n * @private\n * @param {MouseEvent} e - The click event.\n */\n _onClick(e)\n {\n const interactionManager = this.renderer.plugins.interaction;\n\n interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData);\n }\n\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseover)\n *\n * @private\n * @param {FocusEvent} e - The focus event.\n */\n _onFocus(e)\n {\n if (!e.target.getAttribute('aria-live', 'off'))\n {\n e.target.setAttribute('aria-live', 'assertive');\n }\n const interactionManager = this.renderer.plugins.interaction;\n\n interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData);\n }\n\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseout)\n *\n * @private\n * @param {FocusEvent} e - The focusout event.\n */\n _onFocusOut(e)\n {\n if (!e.target.getAttribute('aria-live', 'off'))\n {\n e.target.setAttribute('aria-live', 'polite');\n }\n const interactionManager = this.renderer.plugins.interaction;\n\n interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData);\n }\n\n /**\n * Is called when a key is pressed\n *\n * @private\n * @param {KeyboardEvent} e - The keydown event.\n */\n _onKeyDown(e)\n {\n if (e.keyCode !== KEY_CODE_TAB)\n {\n return;\n }\n\n this.activate();\n }\n\n /**\n * Is called when the mouse moves across the renderer element\n *\n * @private\n * @param {MouseEvent} e - The mouse event.\n */\n _onMouseMove(e)\n {\n if (e.movementX === 0 && e.movementY === 0)\n {\n return;\n }\n\n this.deactivate();\n }\n\n /**\n * Destroys the accessibility manager\n *\n */\n destroy()\n {\n this.div = null;\n\n for (let i = 0; i < this.children.length; i++)\n {\n this.children[i].div = null;\n }\n\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown);\n\n this.pool = null;\n this.children = null;\n this.renderer = null;\n }\n}\n\ncore.WebGLRenderer.registerPlugin('accessibility', AccessibilityManager);\ncore.CanvasRenderer.registerPlugin('accessibility', AccessibilityManager);\n","/**\n * Default property values of accessible objects\n * used by {@link PIXI.accessibility.AccessibilityManager}.\n *\n * @function accessibleTarget\n * @memberof PIXI.accessibility\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * MyObject.prototype,\n * PIXI.accessibility.accessibleTarget\n * );\n */\nexport default {\n /**\n * Flag for if the object is accessible. If true AccessibilityManager will overlay a\n * shadow div with attributes set\n *\n * @member {boolean}\n */\n accessible: false,\n\n /**\n * Sets the title attribute of the shadow div\n * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'\n *\n * @member {string}\n */\n accessibleTitle: null,\n\n /**\n * Sets the aria-label attribute of the shadow div\n *\n * @member {string}\n */\n accessibleHint: null,\n\n /**\n * @todo Needs docs.\n */\n tabIndex: 0,\n\n /**\n * @todo Needs docs.\n */\n _accessibleActive: false,\n\n /**\n * @todo Needs docs.\n */\n _accessibleDiv: false,\n};\n","/**\n * This namespace contains a renderer plugin for interaction accessibility for end-users\n * with physical impairments which require screen-renders, keyboard navigation, etc.\n *\n * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.WebGLRenderer#plugins}.\n * @namespace PIXI.accessibility\n */\nexport { default as accessibleTarget } from './accessibleTarget';\nexport { default as AccessibilityManager } from './AccessibilityManager';\n","import { autoDetectRenderer } from './autoDetectRenderer';\nimport Container from './display/Container';\nimport { shared, Ticker } from './ticker';\nimport settings from './settings';\nimport { UPDATE_PRIORITY } from './const';\n\n/**\n * Convenience class to create a new PIXI application.\n * This class automatically creates the renderer, ticker\n * and root container.\n *\n * @example\n * // Create the application\n * const app = new PIXI.Application();\n *\n * // Add the view to the DOM\n * document.body.appendChild(app.view);\n *\n * // ex, add display objects\n * app.stage.addChild(PIXI.Sprite.fromImage('something.png'));\n *\n * @class\n * @memberof PIXI\n */\nexport default class Application\n{\n // eslint-disable-next-line valid-jsdoc\n /**\n * @param {object} [options] - The optional renderer parameters\n * @param {boolean} [options.autoStart=true] - automatically starts the rendering after the construction.\n * Note that setting this parameter to false does NOT stop the shared ticker even if you set\n * options.sharedTicker to true in case that it is already started. Stop it by your own.\n * @param {number} [options.width=800] - the width of the renderers view\n * @param {number} [options.height=600] - the height of the renderers view\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.antialias=false] - sets antialias (only applicable in chrome at the moment)\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the webgl context\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {boolean} [options.roundPixels=false] - If true PixiJS will Math.floor() x/y values when rendering,\n * stopping pixel interpolation.\n * @param {boolean} [options.forceFXAA=false] - forces FXAA antialiasing to be used over native.\n * FXAA is faster, but may not always look as great **webgl only**\n * @param {boolean} [options.legacy=false] - `true` to ensure compatibility with older / less advanced devices.\n * If you experience unexplained flickering try setting this to true. **webgl only**\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card **webgl only**\n * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.ticker.shared, `false` to create new ticker.\n * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.loaders.shared, `false` to create new Loader.\n */\n constructor(options, arg2, arg3, arg4, arg5)\n {\n // Support for constructor(width, height, options, noWebGL, useSharedTicker)\n if (typeof options === 'number')\n {\n options = Object.assign({\n width: options,\n height: arg2 || settings.RENDER_OPTIONS.height,\n forceCanvas: !!arg4,\n sharedTicker: !!arg5,\n }, arg3);\n }\n\n /**\n * The default options, so we mixin functionality later.\n * @member {object}\n * @protected\n */\n this._options = options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n forceCanvas: false,\n sharedLoader: false,\n }, options);\n\n /**\n * WebGL renderer if available, otherwise CanvasRenderer\n * @member {PIXI.WebGLRenderer|PIXI.CanvasRenderer}\n */\n this.renderer = autoDetectRenderer(options);\n\n /**\n * The root display container that's rendered.\n * @member {PIXI.Container}\n */\n this.stage = new Container();\n\n /**\n * Internal reference to the ticker\n * @member {PIXI.ticker.Ticker}\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n * @member {PIXI.ticker.Ticker}\n * @default PIXI.ticker.shared\n */\n this.ticker = options.sharedTicker ? shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n set ticker(ticker) // eslint-disable-line require-jsdoc\n {\n if (this._ticker)\n {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker)\n {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n }\n get ticker() // eslint-disable-line require-jsdoc\n {\n return this._ticker;\n }\n\n /**\n * Render the current stage.\n */\n render()\n {\n this.renderer.render(this.stage);\n }\n\n /**\n * Convenience method for stopping the render.\n */\n stop()\n {\n this._ticker.stop();\n }\n\n /**\n * Convenience method for starting the render.\n */\n start()\n {\n this._ticker.start();\n }\n\n /**\n * Reference to the renderer's canvas element.\n * @member {HTMLCanvasElement}\n * @readonly\n */\n get view()\n {\n return this.renderer.view;\n }\n\n /**\n * Reference to the renderer's screen rectangle. Its safe to use as filterArea or hitArea for whole screen\n * @member {PIXI.Rectangle}\n * @readonly\n */\n get screen()\n {\n return this.renderer.screen;\n }\n\n /**\n * Destroy and don't use after this.\n * @param {Boolean} [removeView=false] Automatically remove canvas from DOM.\n * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'stageOptions' will be passed on to those calls.\n * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the texture of the child sprite\n * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the base texture of the child sprite\n */\n destroy(removeView, stageOptions)\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n\n this.stage.destroy(stageOptions);\n this.stage = null;\n\n this.renderer.destroy(removeView);\n this.renderer = null;\n\n this._options = null;\n }\n}\n","import { GLShader } from 'pixi-gl-core';\nimport settings from './settings';\n\nfunction checkPrecision(src, def)\n{\n if (src instanceof Array)\n {\n if (src[0].substring(0, 9) !== 'precision')\n {\n const copy = src.slice(0);\n\n copy.unshift(`precision ${def} float;`);\n\n return copy;\n }\n }\n else if (src.trim().substring(0, 9) !== 'precision')\n {\n return `precision ${def} float;\\n${src}`;\n }\n\n return src;\n}\n\n/**\n * Wrapper class, webGL Shader for Pixi.\n * Adds precision string if vertexSrc or fragmentSrc have no mention of it.\n *\n * @class\n * @extends GLShader\n * @memberof PIXI\n */\nexport default class Shader extends GLShader\n{\n /**\n *\n * @param {WebGLRenderingContext} gl - The current WebGL rendering context\n * @param {string|string[]} vertexSrc - The vertex shader source as an array of strings.\n * @param {string|string[]} fragmentSrc - The fragment shader source as an array of strings.\n * @param {object} [attributeLocations] - A key value pair showing which location eact attribute should sit.\n e.g. {position:0, uvs:1}.\n * @param {string} [precision] - The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'.\n */\n constructor(gl, vertexSrc, fragmentSrc, attributeLocations, precision)\n {\n super(gl, checkPrecision(vertexSrc, precision || settings.PRECISION_VERTEX),\n checkPrecision(fragmentSrc, precision || settings.PRECISION_FRAGMENT), undefined, attributeLocations);\n }\n}\n","import * as utils from './utils';\nimport CanvasRenderer from './renderers/canvas/CanvasRenderer';\nimport WebGLRenderer from './renderers/webgl/WebGLRenderer';\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by\n * the browser then this function will return a canvas renderer\n *\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the renderers view\n * @param {number} [options.height=600] - the height of the renderers view\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.antialias=false] - sets antialias (only applicable in chrome at the moment)\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the webgl context\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present\n * @param {boolean} [options.roundPixels=false] - If true PixiJS will Math.floor() x/y values when rendering,\n * stopping pixel interpolation.\n * @param {boolean} [options.forceFXAA=false] - forces FXAA antialiasing to be used over native.\n * FXAA is faster, but may not always look as great **webgl only**\n * @param {boolean} [options.legacy=false] - `true` to ensure compatibility with older / less advanced devices.\n * If you experience unexplained flickering try setting this to true. **webgl only**\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card **webgl only**\n * @return {PIXI.WebGLRenderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer\n */\nexport function autoDetectRenderer(options, arg1, arg2, arg3)\n{\n // Backward-compatible support for noWebGL option\n let forceCanvas = options && options.forceCanvas;\n\n if (arg3 !== undefined)\n {\n forceCanvas = arg3;\n }\n\n if (!forceCanvas && utils.isWebGLSupported())\n {\n return new WebGLRenderer(options, arg1, arg2);\n }\n\n return new CanvasRenderer(options, arg1, arg2);\n}\n","/**\n * String of the current PIXI version.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name VERSION\n * @type {string}\n */\nexport const VERSION = __VERSION__;\n\n/**\n * Two Pi.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @type {number}\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @type {number}\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @type {number}\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\n/**\n * Constant to identify the Renderer Type.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @type {object}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nexport const RENDERER_TYPE = {\n UNKNOWN: 0,\n WEBGL: 1,\n CANVAS: 2,\n};\n\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name BLEND_MODES\n * @type {object}\n * @property {number} NORMAL\n * @property {number} ADD\n * @property {number} MULTIPLY\n * @property {number} SCREEN\n * @property {number} OVERLAY\n * @property {number} DARKEN\n * @property {number} LIGHTEN\n * @property {number} COLOR_DODGE\n * @property {number} COLOR_BURN\n * @property {number} HARD_LIGHT\n * @property {number} SOFT_LIGHT\n * @property {number} DIFFERENCE\n * @property {number} EXCLUSION\n * @property {number} HUE\n * @property {number} SATURATION\n * @property {number} COLOR\n * @property {number} LUMINOSITY\n */\nexport const BLEND_MODES = {\n NORMAL: 0,\n ADD: 1,\n MULTIPLY: 2,\n SCREEN: 3,\n OVERLAY: 4,\n DARKEN: 5,\n LIGHTEN: 6,\n COLOR_DODGE: 7,\n COLOR_BURN: 8,\n HARD_LIGHT: 9,\n SOFT_LIGHT: 10,\n DIFFERENCE: 11,\n EXCLUSION: 12,\n HUE: 13,\n SATURATION: 14,\n COLOR: 15,\n LUMINOSITY: 16,\n NORMAL_NPM: 17,\n ADD_NPM: 18,\n SCREEN_NPM: 19,\n};\n\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name DRAW_MODES\n * @type {object}\n * @property {number} POINTS\n * @property {number} LINES\n * @property {number} LINE_LOOP\n * @property {number} LINE_STRIP\n * @property {number} TRIANGLES\n * @property {number} TRIANGLE_STRIP\n * @property {number} TRIANGLE_FAN\n */\nexport const DRAW_MODES = {\n POINTS: 0,\n LINES: 1,\n LINE_LOOP: 2,\n LINE_STRIP: 3,\n TRIANGLES: 4,\n TRIANGLE_STRIP: 5,\n TRIANGLE_FAN: 6,\n};\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @name SCALE_MODES\n * @type {object}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nexport const SCALE_MODES = {\n LINEAR: 0,\n NEAREST: 1,\n};\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as webGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n *\n * @static\n * @constant\n * @name WRAP_MODES\n * @memberof PIXI\n * @type {object}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nexport const WRAP_MODES = {\n CLAMP: 0,\n REPEAT: 1,\n MIRRORED_REPEAT: 2,\n};\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n *\n * @static\n * @constant\n * @name GC_MODES\n * @memberof PIXI\n * @type {object}\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nexport const GC_MODES = {\n AUTO: 0,\n MANUAL: 1,\n};\n\n/**\n * Regexp for image type by extension.\n *\n * @static\n * @constant\n * @memberof PIXI\n * @type {RegExp|string}\n * @example `image.png`\n */\nexport const URL_FILE_EXTENSION = /\\.(\\w{3,4})(?:$|\\?|#)/i;\n\n/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n *\n * @static\n * @constant\n * @name DATA_URI\n * @memberof PIXI\n * @type {RegExp|string}\n * @example data:image/png;base64\n */\nexport const DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n\n/**\n * Regexp for SVG size.\n *\n * @static\n * @constant\n * @name SVG_SIZE\n * @memberof PIXI\n * @type {RegExp|string}\n * @example &lt;svg width=\"100\" height=\"100\"&gt;&lt;/svg&gt;\n */\nexport const SVG_SIZE = /<svg[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n *\n * @static\n * @constant\n * @name SHAPES\n * @memberof PIXI\n * @type {object}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n */\nexport const SHAPES = {\n POLY: 0,\n RECT: 1,\n CIRC: 2,\n ELIP: 3,\n RREC: 4,\n};\n\n/**\n * Constants that specify float precision in shaders.\n *\n * @static\n * @constant\n * @name PRECISION\n * @memberof PIXI\n * @type {object}\n * @property {string} LOW='lowp'\n * @property {string} MEDIUM='mediump'\n * @property {string} HIGH='highp'\n */\nexport const PRECISION = {\n LOW: 'lowp',\n MEDIUM: 'mediump',\n HIGH: 'highp',\n};\n\n/**\n * Constants that specify the transform type.\n *\n * @static\n * @constant\n * @name TRANSFORM_MODE\n * @memberof PIXI\n * @type {object}\n * @property {number} STATIC\n * @property {number} DYNAMIC\n */\nexport const TRANSFORM_MODE = {\n STATIC: 0,\n DYNAMIC: 1,\n};\n\n/**\n * Constants that define the type of gradient on text.\n *\n * @static\n * @constant\n * @name TEXT_GRADIENT\n * @memberof PIXI\n * @type {object}\n * @property {number} LINEAR_VERTICAL Vertical gradient\n * @property {number} LINEAR_HORIZONTAL Linear gradient\n */\nexport const TEXT_GRADIENT = {\n LINEAR_VERTICAL: 0,\n LINEAR_HORIZONTAL: 1,\n};\n\n/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.ticker.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n *\n * @static\n * @constant\n * @name UPDATE_PRIORITY\n * @memberof PIXI\n * @type {object}\n * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.interaction.InteractionManager}\n * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.extras.AnimatedSprite}\n * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.ticker.Ticker#add}.\n * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering.\n * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.prepare.BasePrepare} utility.\n */\nexport const UPDATE_PRIORITY = {\n INTERACTION: 50,\n HIGH: 25,\n NORMAL: 0,\n LOW: -25,\n UTILITY: -50,\n};\n","import { Rectangle } from '../math';\n\n/**\n * 'Builder' pattern for bounds rectangles\n * Axis-Aligned Bounding Box\n * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems\n *\n * @class\n * @memberof PIXI\n */\nexport default class Bounds\n{\n /**\n *\n */\n constructor()\n {\n /**\n * @member {number}\n * @default 0\n */\n this.minX = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.minY = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxX = -Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxY = -Infinity;\n\n this.rect = null;\n }\n\n /**\n * Checks if bounds are empty.\n *\n * @return {boolean} True if empty.\n */\n isEmpty()\n {\n return this.minX > this.maxX || this.minY > this.maxY;\n }\n\n /**\n * Clears the bounds and resets.\n *\n */\n clear()\n {\n this.updateID++;\n\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n }\n\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n *\n * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty\n * @returns {PIXI.Rectangle} A rectangle of the bounds\n */\n getRectangle(rect)\n {\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n }\n\n /**\n * This function should be inlined when its possible.\n *\n * @param {PIXI.Point} point - The point to add.\n */\n addPoint(point)\n {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n }\n\n /**\n * Adds a quad, not transformed\n *\n * @param {Float32Array} vertices - The verts to add.\n */\n addQuad(vertices)\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = vertices[0];\n let y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds sprite frame, transformed.\n *\n * @param {PIXI.TransformBase} transform - TODO\n * @param {number} x0 - TODO\n * @param {number} y0 - TODO\n * @param {number} x1 - TODO\n * @param {number} y1 - TODO\n */\n addFrame(transform, x0, y0, x1, y1)\n {\n const matrix = transform.worldTransform;\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = (a * x0) + (c * y0) + tx;\n let y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Add an array of vertices\n *\n * @param {PIXI.TransformBase} transform - TODO\n * @param {Float32Array} vertices - TODO\n * @param {number} beginOffset - TODO\n * @param {number} endOffset - TODO\n */\n addVertices(transform, vertices, beginOffset, endOffset)\n {\n const matrix = transform.worldTransform;\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const rawX = vertices[i];\n const rawY = vertices[i + 1];\n const x = (a * rawX) + (c * rawY) + tx;\n const y = (d * rawY) + (b * rawX) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds other Bounds\n *\n * @param {PIXI.Bounds} bounds - TODO\n */\n addBounds(bounds)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n }\n\n /**\n * Adds other Bounds, masked with Bounds\n *\n * @param {PIXI.Bounds} bounds - TODO\n * @param {PIXI.Bounds} mask - TODO\n */\n addBoundsMask(bounds, mask)\n {\n const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n const _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n const _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n const _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Adds other Bounds, masked with Rectangle\n *\n * @param {PIXI.Bounds} bounds - TODO\n * @param {PIXI.Rectangle} area - TODO\n */\n addBoundsArea(bounds, area)\n {\n const _minX = bounds.minX > area.x ? bounds.minX : area.x;\n const _minY = bounds.minY > area.y ? bounds.minY : area.y;\n const _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n const _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n}\n","import { removeItems } from '../utils';\nimport DisplayObject from './DisplayObject';\n\n/**\n * A Container represents a collection of display objects.\n * It is the base class of all display objects that act as a container for other objects.\n *\n *```js\n * let container = new PIXI.Container();\n * container.addChild(sprite);\n * ```\n *\n * @class\n * @extends PIXI.DisplayObject\n * @memberof PIXI\n */\nexport default class Container extends DisplayObject\n{\n /**\n *\n */\n constructor()\n {\n super();\n\n /**\n * The array of children of this container.\n *\n * @member {PIXI.DisplayObject[]}\n * @readonly\n */\n this.children = [];\n }\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified\n *\n * @private\n */\n onChildrenChange()\n {\n /* empty */\n }\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n *\n * @param {...PIXI.DisplayObject} child - The DisplayObject(s) to add to the container\n * @return {PIXI.DisplayObject} The first child that was added.\n */\n addChild(child)\n {\n const argumentsLength = arguments.length;\n\n // if there is only one argument we can bypass looping through the them\n if (argumentsLength > 1)\n {\n // loop through the arguments property and add all children\n // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes\n for (let i = 0; i < argumentsLength; i++)\n {\n this.addChild(arguments[i]);\n }\n }\n else\n {\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n child.emit('added', this);\n }\n\n return child;\n }\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n *\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @return {PIXI.DisplayObject} The child that was added.\n */\n addChildAt(child, index)\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n\n return child;\n }\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n *\n * @param {PIXI.DisplayObject} child - First display object to swap\n * @param {PIXI.DisplayObject} child2 - Second display object to swap\n */\n swapChildren(child, child2)\n {\n if (child === child2)\n {\n return;\n }\n\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n }\n\n /**\n * Returns the index position of a child DisplayObject instance\n *\n * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify\n * @return {number} The index position of the child display object to identify\n */\n getChildIndex(child)\n {\n const index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n }\n\n /**\n * Changes the position of an existing child in the display object container\n *\n * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number\n * @param {number} index - The resulting index number for the child display object\n */\n setChildIndex(child, index)\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n const currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n }\n\n /**\n * Returns the child at the specified index\n *\n * @param {number} index - The index to get the child at\n * @return {PIXI.DisplayObject} The child at the given index, if any.\n */\n getChildAt(index)\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n\n return this.children[index];\n }\n\n /**\n * Removes one or more children from the container.\n *\n * @param {...PIXI.DisplayObject} child - The DisplayObject(s) to remove\n * @return {PIXI.DisplayObject} The first child that was removed.\n */\n removeChild(child)\n {\n const argumentsLength = arguments.length;\n\n // if there is only one argument we can bypass looping through the them\n if (argumentsLength > 1)\n {\n // loop through the arguments property and add all children\n // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes\n for (let i = 0; i < argumentsLength; i++)\n {\n this.removeChild(arguments[i]);\n }\n }\n else\n {\n const index = this.children.indexOf(child);\n\n if (index === -1) return null;\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n }\n\n return child;\n }\n\n /**\n * Removes a child from the specified index position.\n *\n * @param {number} index - The index to get the child from\n * @return {PIXI.DisplayObject} The child that was removed.\n */\n removeChildAt(index)\n {\n const child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n\n return child;\n }\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n *\n * @param {number} [beginIndex=0] - The beginning position.\n * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container.\n * @returns {DisplayObject[]} List of removed children\n */\n removeChildren(beginIndex = 0, endIndex)\n {\n const begin = beginIndex;\n const end = typeof endIndex === 'number' ? endIndex : this.children.length;\n const range = end - begin;\n let removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].emit('removed', this);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n }\n\n /**\n * Updates the transform on all children of this container for rendering\n */\n updateTransform()\n {\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n /**\n * Recalculates the bounds of the container.\n *\n */\n calculateBounds()\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n child._mask.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, child._mask._bounds);\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._lastBoundsID = this._boundsID;\n }\n\n /**\n * Recalculates the bounds of the object. Override this to\n * calculate the bounds of the specific object (not including children).\n *\n */\n _calculateBounds()\n {\n // FILL IN//\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @param {PIXI.WebGLRenderer} renderer - The renderer\n */\n renderWebGL(renderer)\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || this._filters)\n {\n this.renderAdvancedWebGL(renderer);\n }\n else\n {\n this._renderWebGL(renderer);\n\n // simple render children!\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].renderWebGL(renderer);\n }\n }\n }\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n *\n * @private\n * @param {PIXI.WebGLRenderer} renderer - The renderer\n */\n renderAdvancedWebGL(renderer)\n {\n renderer.flush();\n\n const filters = this._filters;\n const mask = this._mask;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (let i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n\n if (this._enabledFilters.length)\n {\n renderer.filterManager.pushFilter(this, this._enabledFilters);\n }\n }\n\n if (mask)\n {\n renderer.maskManager.pushMask(this, this._mask);\n }\n\n // add this object to the batch, only rendered if it has a texture.\n this._renderWebGL(renderer);\n\n // now loop through the children and make sure they get rendered\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n this.children[i].renderWebGL(renderer);\n }\n\n renderer.flush();\n\n if (mask)\n {\n renderer.maskManager.popMask(this, this._mask);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filterManager.popFilter();\n }\n }\n\n /**\n * To be overridden by the subclasses.\n *\n * @private\n * @param {PIXI.WebGLRenderer} renderer - The renderer\n */\n _renderWebGL(renderer) // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * To be overridden by the subclass\n *\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\n _renderCanvas(renderer) // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * Renders the object using the Canvas renderer\n *\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\n renderCanvas(renderer)\n {\n // if not visible or the alpha is 0 then no need to render this\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n if (this._mask)\n {\n renderer.maskManager.pushMask(this._mask);\n }\n\n this._renderCanvas(renderer);\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].renderCanvas(renderer);\n }\n\n if (this._mask)\n {\n renderer.maskManager.popMask(renderer);\n }\n }\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options)\n {\n super.destroy();\n\n const destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n const oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (let i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n }\n\n /**\n * The width of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width()\n {\n return this.scale.x * this.getLocalBounds().width;\n }\n\n set width(value) // eslint-disable-line require-jsdoc\n {\n const width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n }\n\n /**\n * The height of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height()\n {\n return this.scale.y * this.getLocalBounds().height;\n }\n\n set height(value) // eslint-disable-line require-jsdoc\n {\n const height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n }\n}\n\n// performance increase to avoid using call.. (10x faster)\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n","import EventEmitter from 'eventemitter3';\nimport { TRANSFORM_MODE } from '../const';\nimport settings from '../settings';\nimport TransformStatic from './TransformStatic';\nimport Transform from './Transform';\nimport Bounds from './Bounds';\nimport { Rectangle } from '../math';\n// _tempDisplayObjectParent = new DisplayObject();\n\n/**\n * The base class for all objects that are rendered on the screen.\n * This is an abstract class and should not be used on its own rather it should be extended.\n *\n * @class\n * @extends EventEmitter\n * @memberof PIXI\n */\nexport default class DisplayObject extends EventEmitter\n{\n /**\n *\n */\n constructor()\n {\n super();\n\n const TransformClass = settings.TRANSFORM_MODE === TRANSFORM_MODE.STATIC ? TransformStatic : Transform;\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing\n *\n * @member {PIXI.TransformBase}\n */\n this.transform = new TransformClass();\n\n /**\n * The opacity of the object.\n *\n * @member {number}\n */\n this.alpha = 1;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually\n *\n * @member {boolean}\n */\n this.visible = true;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually\n *\n * @member {boolean}\n */\n this.renderable = true;\n\n /**\n * The display object container that contains this display object.\n *\n * @member {PIXI.Container}\n * @readonly\n */\n this.parent = null;\n\n /**\n * The multiplied alpha of the displayObject\n *\n * @member {number}\n * @readonly\n */\n this.worldAlpha = 1;\n\n /**\n * The area the filter is applied to. This is used as more of an optimisation\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle\n *\n * Also works as an interaction mask\n *\n * @member {PIXI.Rectangle}\n */\n this.filterArea = null;\n\n this._filters = null;\n this._enabledFilters = null;\n\n /**\n * The bounds object, this is used to calculate and store the bounds of the displayObject\n *\n * @member {PIXI.Rectangle}\n * @private\n */\n this._bounds = new Bounds();\n this._boundsID = 0;\n this._lastBoundsID = -1;\n this._boundsRect = null;\n this._localBoundsRect = null;\n\n /**\n * The original, cached mask of the object\n *\n * @member {PIXI.Graphics|PIXI.Sprite}\n * @private\n */\n this._mask = null;\n\n /**\n * If the object has been destroyed via destroy(). If true, it should not be used.\n *\n * @member {boolean}\n * @private\n * @readonly\n */\n this._destroyed = false;\n\n /**\n * Fired when this DisplayObject is added to a Container.\n *\n * @event PIXI.DisplayObject#added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n *\n * @event PIXI.DisplayObject#removed\n * @param {PIXI.Container} container - The container removed from.\n */\n }\n\n /**\n * @private\n * @member {PIXI.DisplayObject}\n */\n get _tempDisplayObjectParent()\n {\n if (this.tempDisplayObjectParent === null)\n {\n this.tempDisplayObjectParent = new DisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n }\n\n /**\n * Updates the object transform for rendering\n *\n * TODO - Optimization pass!\n */\n updateTransform()\n {\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n this._bounds.updateID++;\n }\n\n /**\n * recursively updates transform of all objects from the root to this one\n * internal function for toLocal()\n */\n _recursivePostUpdateTransform()\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n }\n\n /**\n * Retrieves the bounds of the displayObject as a rectangle object.\n *\n * @param {boolean} skipUpdate - setting to true will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost\n * @param {PIXI.Rectangle} rect - Optional rectangle to store the result of the bounds calculation\n * @return {PIXI.Rectangle} the rectangular bounding area\n */\n getBounds(skipUpdate, rect)\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._boundsID !== this._lastBoundsID)\n {\n this.calculateBounds();\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation\n * @return {PIXI.Rectangle} the rectangular bounding area\n */\n getLocalBounds(rect)\n {\n const transformRef = this.transform;\n const parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n const bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n return bounds;\n }\n\n /**\n * Calculates the global position of the display object\n *\n * @param {PIXI.Point} position - The world origin to calculate from\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point)\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform.\n * @return {PIXI.Point} A point object representing the position of this object\n */\n toGlobal(position, point, skipUpdate = false)\n {\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply(position, point);\n }\n\n /**\n * Calculates the local position of the display object relative to another point\n *\n * @param {PIXI.Point} position - The world origin to calculate from\n * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point)\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform\n * @return {PIXI.Point} A point object representing the position of this object\n */\n toLocal(position, from, point, skipUpdate)\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse(position, point);\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @param {PIXI.WebGLRenderer} renderer - The renderer\n */\n renderWebGL(renderer) // eslint-disable-line no-unused-vars\n {\n // OVERWRITE;\n }\n\n /**\n * Renders the object using the Canvas renderer\n *\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\n renderCanvas(renderer) // eslint-disable-line no-unused-vars\n {\n // OVERWRITE;\n }\n\n /**\n * Set the parent Container of this DisplayObject\n *\n * @param {PIXI.Container} container - The Container to add this DisplayObject to\n * @return {PIXI.Container} The Container that this DisplayObject was added to\n */\n setParent(container)\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n }\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n *\n * @param {number} [x=0] - The X position\n * @param {number} [y=0] - The Y position\n * @param {number} [scaleX=1] - The X scale value\n * @param {number} [scaleY=1] - The Y scale value\n * @param {number} [rotation=0] - The rotation\n * @param {number} [skewX=0] - The X skew value\n * @param {number} [skewY=0] - The Y skew value\n * @param {number} [pivotX=0] - The X pivot value\n * @param {number} [pivotY=0] - The Y pivot value\n * @return {PIXI.DisplayObject} The DisplayObject instance\n */\n setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0)\n {\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n }\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy`.\n *\n */\n destroy()\n {\n this.removeAllListeners();\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this.transform = null;\n\n this.parent = null;\n\n this._bounds = null;\n this._currentBounds = null;\n this._mask = null;\n\n this.filterArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this._destroyed = true;\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n *\n * @member {number}\n */\n get x()\n {\n return this.position.x;\n }\n\n set x(value) // eslint-disable-line require-jsdoc\n {\n this.transform.position.x = value;\n }\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n *\n * @member {number}\n */\n get y()\n {\n return this.position.y;\n }\n\n set y(value) // eslint-disable-line require-jsdoc\n {\n this.transform.position.y = value;\n }\n\n /**\n * Current transform of the object based on world (parent) factors\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get worldTransform()\n {\n return this.transform.worldTransform;\n }\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get localTransform()\n {\n return this.transform.localTransform;\n }\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.Point|PIXI.ObservablePoint}\n */\n get position()\n {\n return this.transform.position;\n }\n\n set position(value) // eslint-disable-line require-jsdoc\n {\n this.transform.position.copy(value);\n }\n\n /**\n * The scale factor of the object.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.Point|PIXI.ObservablePoint}\n */\n get scale()\n {\n return this.transform.scale;\n }\n\n set scale(value) // eslint-disable-line require-jsdoc\n {\n this.transform.scale.copy(value);\n }\n\n /**\n * The pivot point of the displayObject that it rotates around.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.Point|PIXI.ObservablePoint}\n */\n get pivot()\n {\n return this.transform.pivot;\n }\n\n set pivot(value) // eslint-disable-line require-jsdoc\n {\n this.transform.pivot.copy(value);\n }\n\n /**\n * The skew factor for the object in radians.\n * Assignment by value since pixi-v4.\n *\n * @member {PIXI.ObservablePoint}\n */\n get skew()\n {\n return this.transform.skew;\n }\n\n set skew(value) // eslint-disable-line require-jsdoc\n {\n this.transform.skew.copy(value);\n }\n\n /**\n * The rotation of the object in radians.\n *\n * @member {number}\n */\n get rotation()\n {\n return this.transform.rotation;\n }\n\n set rotation(value) // eslint-disable-line require-jsdoc\n {\n this.transform.rotation = value;\n }\n\n /**\n * Indicates if the object is globally visible.\n *\n * @member {boolean}\n * @readonly\n */\n get worldVisible()\n {\n let item = this;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n }\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PIXI a regular mask must be a\n * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it\n * utilises shape clipping. To remove a mask, set this property to null.\n *\n * @todo For the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n *\n * @member {PIXI.Graphics|PIXI.Sprite}\n */\n get mask()\n {\n return this._mask;\n }\n\n set mask(value) // eslint-disable-line require-jsdoc\n {\n if (this._mask)\n {\n this._mask.renderable = true;\n this._mask.isMask = false;\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n this._mask.renderable = false;\n this._mask.isMask = true;\n }\n }\n\n /**\n * Sets the filters for the displayObject.\n * * IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to 'null'\n *\n * @member {PIXI.Filter[]}\n */\n get filters()\n {\n return this._filters && this._filters.slice();\n }\n\n set filters(value) // eslint-disable-line require-jsdoc\n {\n this._filters = value && value.slice();\n }\n}\n\n// performance increase to avoid using call.. (10x faster)\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n","import { Point, ObservablePoint } from '../math';\nimport TransformBase from './TransformBase';\n\n/**\n * Generic class to deal with traditional 2D matrix transforms\n * local transformation is calculated from position,scale,skew and rotation\n *\n * @class\n * @extends PIXI.TransformBase\n * @memberof PIXI\n */\nexport default class Transform extends TransformBase\n{\n /**\n *\n */\n constructor()\n {\n super();\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @member {PIXI.Point}\n */\n this.position = new Point(0, 0);\n\n /**\n * The scale factor of the object.\n *\n * @member {PIXI.Point}\n */\n this.scale = new Point(1, 1);\n\n /**\n * The skew amount, on the x and y axis.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n /**\n * The pivot point of the displayObject that it rotates around.\n *\n * @member {PIXI.Point}\n */\n this.pivot = new Point(0, 0);\n\n /**\n * The rotation value of the object, in radians\n *\n * @member {Number}\n * @private\n */\n this._rotation = 0;\n\n this._cx = 1; // cos rotation + skewY;\n this._sx = 0; // sin rotation + skewY;\n this._cy = 0; // cos rotation + Math.PI/2 - skewX;\n this._sy = 1; // sin rotation + Math.PI/2 - skewX;\n }\n\n /**\n * Updates the skew values when the skew or rotation changes.\n *\n * @private\n */\n updateSkew()\n {\n this._cx = Math.cos(this._rotation + this.skew._y);\n this._sx = Math.sin(this._rotation + this.skew._y);\n this._cy = -Math.sin(this._rotation - this.skew._x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew._x); // sin, added PI/2\n }\n\n /**\n * Updates only local matrix\n */\n updateLocalTransform()\n {\n const lt = this.localTransform;\n\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n }\n\n /**\n * Updates the values of the object and applies the parent's transform.\n *\n * @param {PIXI.Transform} parentTransform - The transform of the parent of this object\n */\n updateTransform(parentTransform)\n {\n const lt = this.localTransform;\n\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._worldID ++;\n }\n\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n *\n * @param {PIXI.Matrix} matrix - The matrix to decompose\n */\n setFromMatrix(matrix)\n {\n matrix.decompose(this);\n }\n\n /**\n * The rotation of the object in radians.\n *\n * @member {number}\n */\n get rotation()\n {\n return this._rotation;\n }\n\n set rotation(value) // eslint-disable-line require-jsdoc\n {\n this._rotation = value;\n this.updateSkew();\n }\n}\n","import { Matrix } from '../math';\n\n/**\n * Generic class to deal with traditional 2D matrix transforms\n *\n * @class\n * @memberof PIXI\n */\nexport default class TransformBase\n{\n /**\n *\n */\n constructor()\n {\n /**\n * The global matrix transform. It can be swapped temporarily by some functions like getLocalBounds()\n *\n * @member {PIXI.Matrix}\n */\n this.worldTransform = new Matrix();\n\n /**\n * The local matrix transform\n *\n * @member {PIXI.Matrix}\n */\n this.localTransform = new Matrix();\n\n this._worldID = 0;\n this._parentID = 0;\n }\n\n /**\n * TransformBase does not have decomposition, so this function wont do anything\n */\n updateLocalTransform()\n {\n // empty\n }\n\n /**\n * Updates the values of the object and applies the parent's transform.\n *\n * @param {PIXI.TransformBase} parentTransform - The transform of the parent of this object\n */\n updateTransform(parentTransform)\n {\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n const lt = this.localTransform;\n\n // concat the parent matrix with the objects transform.\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._worldID ++;\n }\n\n}\n\n/**\n * Updates the values of the object and applies the parent's transform.\n * @param parentTransform {PIXI.Transform} The transform of the parent of this object\n *\n */\nTransformBase.prototype.updateWorldTransform = TransformBase.prototype.updateTransform;\n\nTransformBase.IDENTITY = new TransformBase();\n","import { ObservablePoint } from '../math';\nimport TransformBase from './TransformBase';\n\n/**\n * Transform that takes care about its versions\n *\n * @class\n * @extends PIXI.TransformBase\n * @memberof PIXI\n */\nexport default class TransformStatic extends TransformBase\n{\n /**\n *\n */\n constructor()\n {\n super();\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n\n /**\n * The scale factor of the object.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n\n /**\n * The pivot point of the displayObject that it rotates around.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n\n /**\n * The skew amount, on the x and y axis.\n *\n * @member {PIXI.ObservablePoint}\n */\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n this._rotation = 0;\n\n this._cx = 1; // cos rotation + skewY;\n this._sx = 0; // sin rotation + skewY;\n this._cy = 0; // cos rotation + Math.PI/2 - skewX;\n this._sy = 1; // sin rotation + Math.PI/2 - skewX;\n\n this._localID = 0;\n this._currentLocalID = 0;\n }\n\n /**\n * Called when a value changes.\n *\n * @private\n */\n onChange()\n {\n this._localID ++;\n }\n\n /**\n * Called when skew or rotation changes\n *\n * @private\n */\n updateSkew()\n {\n this._cx = Math.cos(this._rotation + this.skew._y);\n this._sx = Math.sin(this._rotation + this.skew._y);\n this._cy = -Math.sin(this._rotation - this.skew._x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew._x); // sin, added PI/2\n\n this._localID ++;\n }\n\n /**\n * Updates only local matrix\n */\n updateLocalTransform()\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale._x;\n lt.b = this._sx * this.scale._x;\n lt.c = this._cy * this.scale._y;\n lt.d = this._sy * this.scale._y;\n\n lt.tx = this.position._x - ((this.pivot._x * lt.a) + (this.pivot._y * lt.c));\n lt.ty = this.position._y - ((this.pivot._x * lt.b) + (this.pivot._y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n }\n\n /**\n * Updates the values of the object and applies the parent's transform.\n *\n * @param {PIXI.Transform} parentTransform - The transform of the parent of this object\n */\n updateTransform(parentTransform)\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale._x;\n lt.b = this._sx * this.scale._x;\n lt.c = this._cy * this.scale._y;\n lt.d = this._sy * this.scale._y;\n\n lt.tx = this.position._x - ((this.pivot._x * lt.a) + (this.pivot._y * lt.c));\n lt.ty = this.position._y - ((this.pivot._x * lt.b) + (this.pivot._y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n\n if (this._parentID !== parentTransform._worldID)\n {\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._parentID = parentTransform._worldID;\n\n // update the id of the transform..\n this._worldID ++;\n }\n }\n\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n *\n * @param {PIXI.Matrix} matrix - The matrix to decompose\n */\n setFromMatrix(matrix)\n {\n matrix.decompose(this);\n this._localID ++;\n }\n\n /**\n * The rotation of the object in radians.\n *\n * @member {number}\n */\n get rotation()\n {\n return this._rotation;\n }\n\n set rotation(value) // eslint-disable-line require-jsdoc\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n","import Container from '../display/Container';\nimport RenderTexture from '../textures/RenderTexture';\nimport Texture from '../textures/Texture';\nimport GraphicsData from './GraphicsData';\nimport Sprite from '../sprites/Sprite';\nimport { Matrix, Point, Rectangle, RoundedRectangle, Ellipse, Polygon, Circle } from '../math';\nimport { hex2rgb, rgb2hex } from '../utils';\nimport { SHAPES, BLEND_MODES, PI_2 } from '../const';\nimport Bounds from '../display/Bounds';\nimport bezierCurveTo from './utils/bezierCurveTo';\nimport CanvasRenderer from '../renderers/canvas/CanvasRenderer';\n\nlet canvasRenderer;\nconst tempMatrix = new Matrix();\nconst tempPoint = new Point();\nconst tempColor1 = new Float32Array(4);\nconst tempColor2 = new Float32Array(4);\n\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport default class Graphics extends Container\n{\n /**\n *\n * @param {boolean} [nativeLines=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n */\n constructor(nativeLines = false)\n {\n super();\n\n /**\n * The alpha value used when filling the Graphics object.\n *\n * @member {number}\n * @default 1\n */\n this.fillAlpha = 1;\n\n /**\n * The width (thickness) of any lines drawn.\n *\n * @member {number}\n * @default 0\n */\n this.lineWidth = 0;\n\n /**\n * If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n *\n * @member {boolean}\n */\n this.nativeLines = nativeLines;\n\n /**\n * The color of any lines drawn.\n *\n * @member {string}\n * @default 0\n */\n this.lineColor = 0;\n\n /**\n * The alignment of any lines drawn (0.5 = middle, 1 = outter, 0 = inner).\n *\n * @member {number}\n * @default 0.5\n */\n this.lineAlignment = 0.5;\n\n /**\n * Graphics data\n *\n * @member {PIXI.GraphicsData[]}\n * @private\n */\n this.graphicsData = [];\n\n /**\n * The tint applied to the graphic shape. This is a hex value. Apply a value of 0xFFFFFF to\n * reset the tint.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n this.tint = 0xFFFFFF;\n\n /**\n * The previous tint applied to the graphic shape. Used to compare to the current tint and\n * check if theres change.\n *\n * @member {number}\n * @private\n * @default 0xFFFFFF\n */\n this._prevTint = 0xFFFFFF;\n\n /**\n * The blend mode to be applied to the graphic shape. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * Current path\n *\n * @member {PIXI.GraphicsData}\n * @private\n */\n this.currentPath = null;\n\n /**\n * Array containing some WebGL-related properties used by the WebGL renderer.\n *\n * @member {object<number, object>}\n * @private\n */\n // TODO - _webgl should use a prototype object, not a random undocumented object...\n this._webGL = {};\n\n /**\n * Whether this shape is being used as a mask.\n *\n * @member {boolean}\n */\n this.isMask = false;\n\n /**\n * The bounds' padding used for bounds calculation.\n *\n * @member {number}\n */\n this.boundsPadding = 0;\n\n /**\n * A cache of the local bounds to prevent recalculation.\n *\n * @member {PIXI.Rectangle}\n * @private\n */\n this._localBounds = new Bounds();\n\n /**\n * Used to detect if the graphics object has changed. If this is set to true then the graphics\n * object will be recalculated.\n *\n * @member {boolean}\n * @private\n */\n this.dirty = 0;\n\n /**\n * Used to detect if we need to do a fast rect check using the id compare method\n * @type {Number}\n */\n this.fastRectDirty = -1;\n\n /**\n * Used to detect if we clear the graphics webGL data\n * @type {Number}\n */\n this.clearDirty = 0;\n\n /**\n * Used to detect if we we need to recalculate local bounds\n * @type {Number}\n */\n this.boundsDirty = -1;\n\n /**\n * Used to detect if the cached sprite object needs to be updated.\n *\n * @member {boolean}\n * @private\n */\n this.cachedSpriteDirty = false;\n\n this._spriteRect = null;\n this._fastRect = false;\n\n this._prevRectTint = null;\n this._prevRectFillColor = null;\n\n /**\n * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite.\n * This is useful if your graphics element does not change often, as it will speed up the rendering\n * of the object in exchange for taking up texture memory. It is also useful if you need the graphics\n * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if\n * you are constantly redrawing the graphics element.\n *\n * @name cacheAsBitmap\n * @member {boolean}\n * @memberof PIXI.Graphics#\n * @default false\n */\n }\n\n /**\n * Creates a new Graphics object with the same values as this one.\n * Note that the only the properties of the object are cloned, not its transform (position,scale,etc)\n *\n * @return {PIXI.Graphics} A clone of the graphics object\n */\n clone()\n {\n const clone = new Graphics();\n\n clone.renderable = this.renderable;\n clone.fillAlpha = this.fillAlpha;\n clone.lineWidth = this.lineWidth;\n clone.lineColor = this.lineColor;\n clone.lineAlignment = this.lineAlignment;\n clone.tint = this.tint;\n clone.blendMode = this.blendMode;\n clone.isMask = this.isMask;\n clone.boundsPadding = this.boundsPadding;\n clone.dirty = 0;\n clone.cachedSpriteDirty = this.cachedSpriteDirty;\n\n // copy graphics data\n for (let i = 0; i < this.graphicsData.length; ++i)\n {\n clone.graphicsData.push(this.graphicsData[i].clone());\n }\n\n clone.currentPath = clone.graphicsData[clone.graphicsData.length - 1];\n\n clone.updateLocalBounds();\n\n return clone;\n }\n\n /**\n * Calculate length of quadratic curve\n * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/}\n * for the detailed explanation of math behind this.\n *\n * @private\n * @param {number} fromX - x-coordinate of curve start point\n * @param {number} fromY - y-coordinate of curve start point\n * @param {number} cpX - x-coordinate of curve control point\n * @param {number} cpY - y-coordinate of curve control point\n * @param {number} toX - x-coordinate of curve end point\n * @param {number} toY - y-coordinate of curve end point\n * @return {number} Length of quadratic curve\n */\n _quadraticCurveLength(fromX, fromY, cpX, cpY, toX, toY)\n {\n const ax = fromX - (2.0 * cpX) + toX;\n const ay = fromY - (2.0 * cpY) + toY;\n const bx = (2.0 * cpX) - (2.0 * fromX);\n const by = (2.0 * cpY) - (2.0 * fromY);\n const a = 4.0 * ((ax * ax) + (ay * ay));\n const b = 4.0 * ((ax * bx) + (ay * by));\n const c = (bx * bx) + (by * by);\n\n const s = 2.0 * Math.sqrt(a + b + c);\n const a2 = Math.sqrt(a);\n const a32 = 2.0 * a * a2;\n const c2 = 2.0 * Math.sqrt(c);\n const ba = b / a2;\n\n return (\n (a32 * s)\n + (a2 * b * (s - c2))\n + (\n ((4.0 * c * a) - (b * b))\n * Math.log(((2.0 * a2) + ba + s) / (ba + c2))\n )\n )\n / (4.0 * a32);\n }\n\n /**\n * Calculate length of bezier curve.\n * Analytical solution is impossible, since it involves an integral that does not integrate in general.\n * Therefore numerical solution is used.\n *\n * @private\n * @param {number} fromX - Starting point x\n * @param {number} fromY - Starting point y\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {number} Length of bezier curve\n */\n _bezierCurveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)\n {\n const n = 10;\n let result = 0.0;\n let t = 0.0;\n let t2 = 0.0;\n let t3 = 0.0;\n let nt = 0.0;\n let nt2 = 0.0;\n let nt3 = 0.0;\n let x = 0.0;\n let y = 0.0;\n let dx = 0.0;\n let dy = 0.0;\n let prevX = fromX;\n let prevY = fromY;\n\n for (let i = 1; i <= n; ++i)\n {\n t = i / n;\n t2 = t * t;\n t3 = t2 * t;\n nt = (1.0 - t);\n nt2 = nt * nt;\n nt3 = nt2 * nt;\n\n x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX);\n y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY);\n dx = prevX - x;\n dy = prevY - y;\n prevX = x;\n prevY = y;\n\n result += Math.sqrt((dx * dx) + (dy * dy));\n }\n\n return result;\n }\n\n /**\n * Calculate number of segments for the curve based on its length to ensure its smoothness.\n *\n * @private\n * @param {number} length - length of curve\n * @return {number} Number of segments\n */\n _segmentsCount(length)\n {\n let result = Math.ceil(length / Graphics.CURVES.maxLength);\n\n if (result < Graphics.CURVES.minSegments)\n {\n result = Graphics.CURVES.minSegments;\n }\n else if (result > Graphics.CURVES.maxSegments)\n {\n result = Graphics.CURVES.maxSegments;\n }\n\n return result;\n }\n\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @param {number} [lineWidth=0] - width of the line to draw, will update the objects stored style\n * @param {number} [color=0] - color of the line to draw, will update the objects stored style\n * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n lineStyle(lineWidth = 0, color = 0, alpha = 1, alignment = 0.5)\n {\n this.lineWidth = lineWidth;\n this.lineColor = color;\n this.lineAlpha = alpha;\n this.lineAlignment = alignment;\n\n if (this.currentPath)\n {\n if (this.currentPath.shape.points.length)\n {\n // halfway through a line? start a new one!\n const shape = new Polygon(this.currentPath.shape.points.slice(-2));\n\n shape.closed = false;\n\n this.drawShape(shape);\n }\n else\n {\n // otherwise its empty so lets just set the line properties\n this.currentPath.lineWidth = this.lineWidth;\n this.currentPath.lineColor = this.lineColor;\n this.currentPath.lineAlpha = this.lineAlpha;\n this.currentPath.lineAlignment = this.lineAlignment;\n }\n }\n\n return this;\n }\n\n /**\n * Moves the current drawing position to x, y.\n *\n * @param {number} x - the X coordinate to move to\n * @param {number} y - the Y coordinate to move to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n moveTo(x, y)\n {\n const shape = new Polygon([x, y]);\n\n shape.closed = false;\n this.drawShape(shape);\n\n return this;\n }\n\n /**\n * Draws a line using the current line style from the current drawing position to (x, y);\n * The current drawing position is then set to (x, y).\n *\n * @param {number} x - the X coordinate to draw to\n * @param {number} y - the Y coordinate to draw to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n lineTo(x, y)\n {\n const points = this.currentPath.shape.points;\n\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n if (fromX !== x || fromY !== y)\n {\n points.push(x, y);\n this.dirty++;\n }\n\n return this;\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n quadraticCurveTo(cpX, cpY, toX, toY)\n {\n if (this.currentPath)\n {\n if (this.currentPath.shape.points.length === 0)\n {\n this.currentPath.shape.points = [0, 0];\n }\n }\n else\n {\n this.moveTo(0, 0);\n }\n\n const points = this.currentPath.shape.points;\n let xa = 0;\n let ya = 0;\n\n if (points.length === 0)\n {\n this.moveTo(0, 0);\n }\n\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n const n = Graphics.CURVES.adaptive\n ? this._segmentsCount(this._quadraticCurveLength(fromX, fromY, cpX, cpY, toX, toY))\n : 20;\n\n for (let i = 1; i <= n; ++i)\n {\n const j = i / n;\n\n xa = fromX + ((cpX - fromX) * j);\n ya = fromY + ((cpY - fromY) * j);\n\n points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j),\n ya + (((cpY + ((toY - cpY) * j)) - ya) * j));\n }\n\n this.dirty++;\n\n return this;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY)\n {\n if (this.currentPath)\n {\n if (this.currentPath.shape.points.length === 0)\n {\n this.currentPath.shape.points = [0, 0];\n }\n }\n else\n {\n this.moveTo(0, 0);\n }\n\n const points = this.currentPath.shape.points;\n\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n points.length -= 2;\n\n const n = Graphics.CURVES.adaptive\n ? this._segmentsCount(this._bezierCurveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY))\n : 20;\n\n bezierCurveTo(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY, n, points);\n\n this.dirty++;\n\n return this;\n }\n\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @param {number} x1 - The x-coordinate of the beginning of the arc\n * @param {number} y1 - The y-coordinate of the beginning of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n arcTo(x1, y1, x2, y2, radius)\n {\n if (this.currentPath)\n {\n if (this.currentPath.shape.points.length === 0)\n {\n this.currentPath.shape.points.push(x1, y1);\n }\n }\n else\n {\n this.moveTo(x1, y1);\n }\n\n const points = this.currentPath.shape.points;\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n const a1 = fromY - y1;\n const b1 = fromX - x1;\n const a2 = y2 - y1;\n const b2 = x2 - x1;\n const mm = Math.abs((a1 * b2) - (b1 * a2));\n\n if (mm < 1.0e-8 || radius === 0)\n {\n if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1)\n {\n points.push(x1, y1);\n }\n }\n else\n {\n const dd = (a1 * a1) + (b1 * b1);\n const cc = (a2 * a2) + (b2 * b2);\n const tt = (a1 * a2) + (b1 * b2);\n const k1 = radius * Math.sqrt(dd) / mm;\n const k2 = radius * Math.sqrt(cc) / mm;\n const j1 = k1 * tt / dd;\n const j2 = k2 * tt / cc;\n const cx = (k1 * b2) + (k2 * b1);\n const cy = (k1 * a2) + (k2 * a1);\n const px = b1 * (k2 + j1);\n const py = a1 * (k2 + j1);\n const qx = b2 * (k1 + j2);\n const qy = a2 * (k1 + j2);\n const startAngle = Math.atan2(py - cy, px - cx);\n const endAngle = Math.atan2(qy - cy, qx - cx);\n\n this.arc(cx + x1, cy + y1, radius, startAngle, endAngle, b1 * a2 > b2 * a1);\n }\n\n this.dirty++;\n\n return this;\n }\n\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n arc(cx, cy, radius, startAngle, endAngle, anticlockwise = false)\n {\n if (startAngle === endAngle)\n {\n return this;\n }\n\n if (!anticlockwise && endAngle <= startAngle)\n {\n endAngle += PI_2;\n }\n else if (anticlockwise && startAngle <= endAngle)\n {\n startAngle += PI_2;\n }\n\n const sweep = endAngle - startAngle;\n const segs = Graphics.CURVES.adaptive\n ? this._segmentsCount(Math.abs(sweep) * radius)\n : Math.ceil(Math.abs(sweep) / PI_2) * 40;\n\n if (sweep === 0)\n {\n return this;\n }\n\n const startX = cx + (Math.cos(startAngle) * radius);\n const startY = cy + (Math.sin(startAngle) * radius);\n\n // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path.\n let points = this.currentPath ? this.currentPath.shape.points : null;\n\n if (points)\n {\n // We check how far our start is from the last existing point\n const xDiff = Math.abs(points[points.length - 2] - startX);\n const yDiff = Math.abs(points[points.length - 1] - startY);\n\n if (xDiff < 0.001 && yDiff < 0.001)\n {\n // If the point is very close, we don't add it, since this would lead to artifacts\n // during tesselation due to floating point imprecision.\n }\n else\n {\n points.push(startX, startY);\n }\n }\n else\n {\n this.moveTo(startX, startY);\n points = this.currentPath.shape.points;\n }\n\n const theta = sweep / (segs * 2);\n const theta2 = theta * 2;\n\n const cTheta = Math.cos(theta);\n const sTheta = Math.sin(theta);\n\n const segMinus = segs - 1;\n\n const remainder = (segMinus % 1) / segMinus;\n\n for (let i = 0; i <= segMinus; ++i)\n {\n const real = i + (remainder * i);\n\n const angle = ((theta) + startAngle + (theta2 * real));\n\n const c = Math.cos(angle);\n const s = -Math.sin(angle);\n\n points.push(\n (((cTheta * c) + (sTheta * s)) * radius) + cx,\n (((cTheta * -s) + (sTheta * c)) * radius) + cy\n );\n }\n\n this.dirty++;\n\n return this;\n }\n\n /**\n * Specifies a simple one-color fill that subsequent calls to other Graphics methods\n * (such as lineTo() or drawCircle()) use when drawing.\n *\n * @param {number} [color=0] - the color of the fill\n * @param {number} [alpha=1] - the alpha of the fill\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n beginFill(color = 0, alpha = 1)\n {\n this.filling = true;\n this.fillColor = color;\n this.fillAlpha = alpha;\n\n if (this.currentPath)\n {\n if (this.currentPath.shape.points.length <= 2)\n {\n this.currentPath.fill = this.filling;\n this.currentPath.fillColor = this.fillColor;\n this.currentPath.fillAlpha = this.fillAlpha;\n }\n }\n\n return this;\n }\n\n /**\n * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n endFill()\n {\n this.filling = false;\n this.fillColor = null;\n this.fillAlpha = 1;\n\n return this;\n }\n\n /**\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n drawRect(x, y, width, height)\n {\n this.drawShape(new Rectangle(x, y, width, height));\n\n return this;\n }\n\n /**\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @param {number} radius - Radius of the rectangle corners\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n drawRoundedRect(x, y, width, height, radius)\n {\n this.drawShape(new RoundedRectangle(x, y, width, height, radius));\n\n return this;\n }\n\n /**\n * Draws a circle.\n *\n * @param {number} x - The X coordinate of the center of the circle\n * @param {number} y - The Y coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n drawCircle(x, y, radius)\n {\n this.drawShape(new Circle(x, y, radius));\n\n return this;\n }\n\n /**\n * Draws an ellipse.\n *\n * @param {number} x - The X coordinate of the center of the ellipse\n * @param {number} y - The Y coordinate of the center of the ellipse\n * @param {number} width - The half width of the ellipse\n * @param {number} height - The half height of the ellipse\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n drawEllipse(x, y, width, height)\n {\n this.drawShape(new Ellipse(x, y, width, height));\n\n return this;\n }\n\n /**\n * Draws a polygon using the given path.\n *\n * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n drawPolygon(path)\n {\n // prevents an argument assignment deopt\n // see section 3.1: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments\n let points = path;\n\n let closed = true;\n\n if (points instanceof Polygon)\n {\n closed = points.closed;\n points = points.points;\n }\n\n if (!Array.isArray(points))\n {\n // prevents an argument leak deopt\n // see section 3.2: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments\n points = new Array(arguments.length);\n\n for (let i = 0; i < points.length; ++i)\n {\n points[i] = arguments[i]; // eslint-disable-line prefer-rest-params\n }\n }\n\n const shape = new Polygon(points);\n\n shape.closed = closed;\n\n this.drawShape(shape);\n\n return this;\n }\n\n /**\n * Draw a star shape with an abitrary number of points.\n *\n * @param {number} x - Center X position of the star\n * @param {number} y - Center Y position of the star\n * @param {number} points - The number of points of the star, must be > 1\n * @param {number} radius - The outer radius of the star\n * @param {number} [innerRadius] - The inner radius between points, default half `radius`\n * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n drawStar(x, y, points, radius, innerRadius, rotation = 0)\n {\n innerRadius = innerRadius || radius / 2;\n\n const startAngle = (-1 * Math.PI / 2) + rotation;\n const len = points * 2;\n const delta = PI_2 / len;\n const polygon = [];\n\n for (let i = 0; i < len; i++)\n {\n const r = i % 2 ? innerRadius : radius;\n const angle = (i * delta) + startAngle;\n\n polygon.push(\n x + (r * Math.cos(angle)),\n y + (r * Math.sin(angle))\n );\n }\n\n return this.drawPolygon(polygon);\n }\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n clear()\n {\n if (this.lineWidth || this.filling || this.graphicsData.length > 0)\n {\n this.lineWidth = 0;\n this.lineAlignment = 0.5;\n\n this.filling = false;\n\n this.boundsDirty = -1;\n this.canvasTintDirty = -1;\n this.dirty++;\n this.clearDirty++;\n this.graphicsData.length = 0;\n }\n\n this.currentPath = null;\n this._spriteRect = null;\n\n return this;\n }\n\n /**\n * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and\n * masked with gl.scissor.\n *\n * @returns {boolean} True if only 1 rect.\n */\n isFastRect()\n {\n return this.graphicsData.length === 1\n && this.graphicsData[0].shape.type === SHAPES.RECT\n && !this.graphicsData[0].lineWidth;\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @private\n * @param {PIXI.WebGLRenderer} renderer - The renderer\n */\n _renderWebGL(renderer)\n {\n // if the sprite is not visible or the alpha is 0 then no need to render this element\n if (this.dirty !== this.fastRectDirty)\n {\n this.fastRectDirty = this.dirty;\n this._fastRect = this.isFastRect();\n }\n\n // TODO this check can be moved to dirty?\n if (this._fastRect)\n {\n this._renderSpriteRect(renderer);\n }\n else\n {\n renderer.setObjectRenderer(renderer.plugins.graphics);\n renderer.plugins.graphics.render(this);\n }\n }\n\n /**\n * Renders a sprite rectangle.\n *\n * @private\n * @param {PIXI.WebGLRenderer} renderer - The renderer\n */\n _renderSpriteRect(renderer)\n {\n const rect = this.graphicsData[0].shape;\n\n if (!this._spriteRect)\n {\n this._spriteRect = new Sprite(new Texture(Texture.WHITE));\n }\n\n const sprite = this._spriteRect;\n const fillColor = this.graphicsData[0].fillColor;\n\n if (this.tint === 0xffffff)\n {\n sprite.tint = fillColor;\n }\n else if (this.tint !== this._prevRectTint || fillColor !== this._prevRectFillColor)\n {\n const t1 = tempColor1;\n const t2 = tempColor2;\n\n hex2rgb(fillColor, t1);\n hex2rgb(this.tint, t2);\n\n t1[0] *= t2[0];\n t1[1] *= t2[1];\n t1[2] *= t2[2];\n\n sprite.tint = rgb2hex(t1);\n\n this._prevRectTint = this.tint;\n this._prevRectFillColor = fillColor;\n }\n\n sprite.alpha = this.graphicsData[0].fillAlpha;\n sprite.worldAlpha = this.worldAlpha * sprite.alpha;\n sprite.blendMode = this.blendMode;\n\n sprite._texture._frame.width = rect.width;\n sprite._texture._frame.height = rect.height;\n\n sprite.transform.worldTransform = this.transform.worldTransform;\n\n sprite.anchor.set(-rect.x / rect.width, -rect.y / rect.height);\n sprite._onAnchorUpdate();\n\n sprite._renderWebGL(renderer);\n }\n\n /**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\n _renderCanvas(renderer)\n {\n if (this.isMask === true)\n {\n return;\n }\n\n renderer.plugins.graphics.render(this);\n }\n\n /**\n * Retrieves the bounds of the graphic shape as a rectangle object\n *\n * @private\n */\n _calculateBounds()\n {\n if (this.boundsDirty !== this.dirty)\n {\n this.boundsDirty = this.dirty;\n this.updateLocalBounds();\n\n this.cachedSpriteDirty = true;\n }\n\n const lb = this._localBounds;\n\n this._bounds.addFrame(this.transform, lb.minX, lb.minY, lb.maxX, lb.maxY);\n }\n\n /**\n * Tests if a point is inside this graphics object\n *\n * @param {PIXI.Point} point - the point to test\n * @return {boolean} the result of the test\n */\n containsPoint(point)\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const graphicsData = this.graphicsData;\n\n for (let i = 0; i < graphicsData.length; ++i)\n {\n const data = graphicsData[i];\n\n if (!data.fill)\n {\n continue;\n }\n\n // only deal with fills..\n if (data.shape)\n {\n if (data.shape.contains(tempPoint.x, tempPoint.y))\n {\n if (data.holes)\n {\n for (let i = 0; i < data.holes.length; i++)\n {\n const hole = data.holes[i];\n\n if (hole.contains(tempPoint.x, tempPoint.y))\n {\n return false;\n }\n }\n }\n\n return true;\n }\n }\n }\n\n return false;\n }\n\n /**\n * Update the bounds of the object\n *\n */\n updateLocalBounds()\n {\n let minX = Infinity;\n let maxX = -Infinity;\n\n let minY = Infinity;\n let maxY = -Infinity;\n\n if (this.graphicsData.length)\n {\n let shape = 0;\n let x = 0;\n let y = 0;\n let w = 0;\n let h = 0;\n\n for (let i = 0; i < this.graphicsData.length; i++)\n {\n const data = this.graphicsData[i];\n const type = data.type;\n const lineWidth = data.lineWidth;\n const lineAlignment = data.lineAlignment;\n\n const lineOffset = lineWidth * lineAlignment;\n\n shape = data.shape;\n\n if (type === SHAPES.RECT || type === SHAPES.RREC)\n {\n x = shape.x - lineOffset;\n y = shape.y - lineOffset;\n w = shape.width + (lineOffset * 2);\n h = shape.height + (lineOffset * 2);\n\n minX = x < minX ? x : minX;\n maxX = x + w > maxX ? x + w : maxX;\n\n minY = y < minY ? y : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else if (type === SHAPES.CIRC)\n {\n x = shape.x;\n y = shape.y;\n w = shape.radius + lineOffset;\n h = shape.radius + lineOffset;\n\n minX = x - w < minX ? x - w : minX;\n maxX = x + w > maxX ? x + w : maxX;\n\n minY = y - h < minY ? y - h : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else if (type === SHAPES.ELIP)\n {\n x = shape.x;\n y = shape.y;\n w = shape.width + lineOffset;\n h = shape.height + lineOffset;\n\n minX = x - w < minX ? x - w : minX;\n maxX = x + w > maxX ? x + w : maxX;\n\n minY = y - h < minY ? y - h : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else\n {\n // POLY\n const points = shape.points;\n let x2 = 0;\n let y2 = 0;\n let dx = 0;\n let dy = 0;\n let rw = 0;\n let rh = 0;\n let cx = 0;\n let cy = 0;\n\n for (let j = 0; j + 2 < points.length; j += 2)\n {\n x = points[j];\n y = points[j + 1];\n x2 = points[j + 2];\n y2 = points[j + 3];\n dx = Math.abs(x2 - x);\n dy = Math.abs(y2 - y);\n h = lineOffset * 2;\n w = Math.sqrt((dx * dx) + (dy * dy));\n\n if (w < 1e-9)\n {\n continue;\n }\n\n rw = ((h / w * dy) + dx) / 2;\n rh = ((h / w * dx) + dy) / 2;\n cx = (x2 + x) / 2;\n cy = (y2 + y) / 2;\n\n minX = cx - rw < minX ? cx - rw : minX;\n maxX = cx + rw > maxX ? cx + rw : maxX;\n\n minY = cy - rh < minY ? cy - rh : minY;\n maxY = cy + rh > maxY ? cy + rh : maxY;\n }\n }\n }\n }\n else\n {\n minX = 0;\n maxX = 0;\n minY = 0;\n maxY = 0;\n }\n\n const padding = this.boundsPadding;\n\n this._localBounds.minX = minX - padding;\n this._localBounds.maxX = maxX + padding;\n\n this._localBounds.minY = minY - padding;\n this._localBounds.maxY = maxY + padding;\n }\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @return {PIXI.GraphicsData} The generated GraphicsData object.\n */\n drawShape(shape)\n {\n if (this.currentPath)\n {\n // check current path!\n if (this.currentPath.shape.points.length <= 2)\n {\n this.graphicsData.pop();\n }\n }\n\n this.currentPath = null;\n\n const data = new GraphicsData(\n this.lineWidth,\n this.lineColor,\n this.lineAlpha,\n this.fillColor,\n this.fillAlpha,\n this.filling,\n this.nativeLines,\n shape,\n this.lineAlignment\n );\n\n this.graphicsData.push(data);\n\n if (data.type === SHAPES.POLY)\n {\n data.shape.closed = data.shape.closed;\n this.currentPath = data;\n }\n\n this.dirty++;\n\n return data;\n }\n\n /**\n * Generates a canvas texture.\n *\n * @param {number} scaleMode - The scale mode of the texture.\n * @param {number} resolution - The resolution of the texture.\n * @return {PIXI.Texture} The new texture.\n */\n generateCanvasTexture(scaleMode, resolution = 1)\n {\n const bounds = this.getLocalBounds();\n\n const canvasBuffer = RenderTexture.create(bounds.width, bounds.height, scaleMode, resolution);\n\n if (!canvasRenderer)\n {\n canvasRenderer = new CanvasRenderer();\n }\n\n this.transform.updateLocalTransform();\n this.transform.localTransform.copy(tempMatrix);\n\n tempMatrix.invert();\n\n tempMatrix.tx -= bounds.x;\n tempMatrix.ty -= bounds.y;\n\n canvasRenderer.render(this, canvasBuffer, true, tempMatrix);\n\n const texture = Texture.fromCanvas(canvasBuffer.baseTexture._canvasRenderTarget.canvas, scaleMode, 'graphics');\n\n texture.baseTexture.resolution = resolution;\n texture.baseTexture.update();\n\n return texture;\n }\n\n /**\n * Closes the current path.\n *\n * @return {PIXI.Graphics} Returns itself.\n */\n closePath()\n {\n // ok so close path assumes next one is a hole!\n const currentPath = this.currentPath;\n\n if (currentPath && currentPath.shape)\n {\n currentPath.shape.close();\n }\n\n return this;\n }\n\n /**\n * Adds a hole in the current path.\n *\n * @return {PIXI.Graphics} Returns itself.\n */\n addHole()\n {\n // this is a hole!\n const hole = this.graphicsData.pop();\n\n this.currentPath = this.graphicsData[this.graphicsData.length - 1];\n\n this.currentPath.addHole(hole.shape);\n this.currentPath = null;\n\n return this;\n }\n\n /**\n * Destroys the Graphics object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options)\n {\n super.destroy(options);\n\n // destroy each of the GraphicsData objects\n for (let i = 0; i < this.graphicsData.length; ++i)\n {\n this.graphicsData[i].destroy();\n }\n\n // for each webgl data entry, destroy the WebGLGraphicsData\n for (const id in this._webGL)\n {\n for (let j = 0; j < this._webGL[id].data.length; ++j)\n {\n this._webGL[id].data[j].destroy();\n }\n }\n\n if (this._spriteRect)\n {\n this._spriteRect.destroy();\n }\n\n this.graphicsData = null;\n\n this.currentPath = null;\n this._webGL = null;\n this._localBounds = null;\n }\n\n}\n\nGraphics._SPRITE_TEXTURE = null;\n\n/**\n * Graphics curves resolution settings. If `adaptive` flag is set to `true`,\n * the resolution is calculated based on the curve's length to ensure better visual quality.\n * Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`.\n *\n * @static\n * @constant\n * @memberof PIXI.Graphics\n * @name CURVES\n * @type {object}\n * @property {boolean} adaptive=false - flag indicating if the resolution should be adaptive\n * @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored)\n * @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored)\n * @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored)\n */\nGraphics.CURVES = {\n adaptive: false,\n maxLength: 10,\n minSegments: 8,\n maxSegments: 2048,\n};\n","/**\n * A GraphicsData object.\n *\n * @class\n * @memberof PIXI\n */\nexport default class GraphicsData\n{\n /**\n *\n * @param {number} lineWidth - the width of the line to draw\n * @param {number} lineColor - the color of the line to draw\n * @param {number} lineAlpha - the alpha of the line to draw\n * @param {number} fillColor - the color of the fill\n * @param {number} fillAlpha - the alpha of the fill\n * @param {boolean} fill - whether or not the shape is filled with a colour\n * @param {boolean} nativeLines - the method for drawing lines\n * @param {PIXI.Circle|PIXI.Rectangle|PIXI.Ellipse|PIXI.Polygon} shape - The shape object to draw.\n * @param {number} lineAlignment - the alignment of the line.\n */\n constructor(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, nativeLines, shape, lineAlignment)\n {\n /**\n * the width of the line to draw\n * @member {number}\n */\n this.lineWidth = lineWidth;\n\n /**\n * The alignment of any lines drawn (0.5 = middle, 1 = outter, 0 = inner).\n *\n * @member {number}\n * @default 0\n */\n this.lineAlignment = lineAlignment;\n\n /**\n * if true the liens will be draw using LINES instead of TRIANGLE_STRIP\n * @member {boolean}\n */\n this.nativeLines = nativeLines;\n\n /**\n * the color of the line to draw\n * @member {number}\n */\n this.lineColor = lineColor;\n\n /**\n * the alpha of the line to draw\n * @member {number}\n */\n this.lineAlpha = lineAlpha;\n\n /**\n * cached tint of the line to draw\n * @member {number}\n * @private\n */\n this._lineTint = lineColor;\n\n /**\n * the color of the fill\n * @member {number}\n */\n this.fillColor = fillColor;\n\n /**\n * the alpha of the fill\n * @member {number}\n */\n this.fillAlpha = fillAlpha;\n\n /**\n * cached tint of the fill\n * @member {number}\n * @private\n */\n this._fillTint = fillColor;\n\n /**\n * whether or not the shape is filled with a colour\n * @member {boolean}\n */\n this.fill = fill;\n\n this.holes = [];\n\n /**\n * The shape object to draw.\n * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle}\n */\n this.shape = shape;\n\n /**\n * The type of the shape, see the Const.Shapes file for all the existing types,\n * @member {number}\n */\n this.type = shape.type;\n }\n\n /**\n * Creates a new GraphicsData object with the same values as this one.\n *\n * @return {PIXI.GraphicsData} Cloned GraphicsData object\n */\n clone()\n {\n return new GraphicsData(\n this.lineWidth,\n this.lineColor,\n this.lineAlpha,\n this.fillColor,\n this.fillAlpha,\n this.fill,\n this.nativeLines,\n this.shape,\n this.lineAlignment\n );\n }\n\n /**\n * Adds a hole to the shape.\n *\n * @param {PIXI.Rectangle|PIXI.Circle} shape - The shape of the hole.\n */\n addHole(shape)\n {\n this.holes.push(shape);\n }\n\n /**\n * Destroys the Graphics data.\n */\n destroy()\n {\n this.shape = null;\n this.holes = null;\n }\n}\n","import CanvasRenderer from '../../renderers/canvas/CanvasRenderer';\nimport { SHAPES } from '../../const';\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers <mattdesl> https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they\n * now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's CanvasGraphicsRenderer:\n * https://github.com/libgdx/libgdx/blob/1.0.0/gdx/src/com/badlogic/gdx/graphics/glutils/ShapeRenderer.java\n */\n\n/**\n * Renderer dedicated to drawing and batching graphics objects.\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport default class CanvasGraphicsRenderer\n{\n /**\n * @param {PIXI.CanvasRenderer} renderer - The current PIXI renderer.\n */\n constructor(renderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Renders a Graphics object to a canvas.\n *\n * @param {PIXI.Graphics} graphics - the actual graphics object to render\n */\n render(graphics)\n {\n const renderer = this.renderer;\n const context = renderer.context;\n const worldAlpha = graphics.worldAlpha;\n const transform = graphics.transform.worldTransform;\n const resolution = renderer.resolution;\n\n context.setTransform(\n transform.a * resolution,\n transform.b * resolution,\n transform.c * resolution,\n transform.d * resolution,\n transform.tx * resolution,\n transform.ty * resolution\n );\n\n // update tint if graphics was dirty\n if (graphics.canvasTintDirty !== graphics.dirty\n || graphics._prevTint !== graphics.tint)\n {\n this.updateGraphicsTint(graphics);\n }\n\n renderer.setBlendMode(graphics.blendMode);\n\n for (let i = 0; i < graphics.graphicsData.length; i++)\n {\n const data = graphics.graphicsData[i];\n const shape = data.shape;\n\n const fillColor = data._fillTint;\n const lineColor = data._lineTint;\n\n context.lineWidth = data.lineWidth;\n\n if (data.type === SHAPES.POLY)\n {\n context.beginPath();\n\n let points = shape.points;\n const holes = data.holes;\n let outerArea;\n let innerArea;\n\n context.moveTo(points[0], points[1]);\n\n for (let j = 2; j < points.length; j += 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n\n // if the first and last point are the same close the path - much neater :)\n if (shape.closed)\n {\n context.closePath();\n }\n\n if (holes.length > 0)\n {\n outerArea = 0;\n for (let j = 0; j < points.length; j += 2)\n {\n outerArea += (points[j] * points[j + 3]) - (points[j + 1] * points[j + 2]);\n }\n\n for (let k = 0; k < holes.length; k++)\n {\n points = holes[k].points;\n\n innerArea = 0;\n for (let j = 0; j < points.length; j += 2)\n {\n innerArea += (points[j] * points[j + 3]) - (points[j + 1] * points[j + 2]);\n }\n\n context.moveTo(points[0], points[1]);\n\n if (innerArea * outerArea < 0)\n {\n for (let j = 2; j < points.length; j += 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n }\n else\n {\n for (let j = points.length - 2; j >= 2; j -= 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n }\n\n if (holes[k].closed)\n {\n context.closePath();\n }\n }\n }\n\n if (data.fill)\n {\n context.globalAlpha = data.fillAlpha * worldAlpha;\n context.fillStyle = `#${(`00000${(fillColor | 0).toString(16)}`).substr(-6)}`;\n context.fill();\n }\n if (data.lineWidth)\n {\n context.globalAlpha = data.lineAlpha * worldAlpha;\n context.strokeStyle = `#${(`00000${(lineColor | 0).toString(16)}`).substr(-6)}`;\n context.stroke();\n }\n }\n else if (data.type === SHAPES.RECT)\n {\n if (data.fillColor || data.fillColor === 0)\n {\n context.globalAlpha = data.fillAlpha * worldAlpha;\n context.fillStyle = `#${(`00000${(fillColor | 0).toString(16)}`).substr(-6)}`;\n context.fillRect(shape.x, shape.y, shape.width, shape.height);\n }\n if (data.lineWidth)\n {\n context.globalAlpha = data.lineAlpha * worldAlpha;\n context.strokeStyle = `#${(`00000${(lineColor | 0).toString(16)}`).substr(-6)}`;\n context.strokeRect(shape.x, shape.y, shape.width, shape.height);\n }\n }\n else if (data.type === SHAPES.CIRC)\n {\n // TODO - need to be Undefined!\n context.beginPath();\n context.arc(shape.x, shape.y, shape.radius, 0, 2 * Math.PI);\n context.closePath();\n\n if (data.fill)\n {\n context.globalAlpha = data.fillAlpha * worldAlpha;\n context.fillStyle = `#${(`00000${(fillColor | 0).toString(16)}`).substr(-6)}`;\n context.fill();\n }\n if (data.lineWidth)\n {\n context.globalAlpha = data.lineAlpha * worldAlpha;\n context.strokeStyle = `#${(`00000${(lineColor | 0).toString(16)}`).substr(-6)}`;\n context.stroke();\n }\n }\n else if (data.type === SHAPES.ELIP)\n {\n // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas\n\n const w = shape.width * 2;\n const h = shape.height * 2;\n\n const x = shape.x - (w / 2);\n const y = shape.y - (h / 2);\n\n context.beginPath();\n\n const kappa = 0.5522848;\n const ox = (w / 2) * kappa; // control point offset horizontal\n const oy = (h / 2) * kappa; // control point offset vertical\n const xe = x + w; // x-end\n const ye = y + h; // y-end\n const xm = x + (w / 2); // x-middle\n const ym = y + (h / 2); // y-middle\n\n context.moveTo(x, ym);\n context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);\n context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);\n context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);\n context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);\n\n context.closePath();\n\n if (data.fill)\n {\n context.globalAlpha = data.fillAlpha * worldAlpha;\n context.fillStyle = `#${(`00000${(fillColor | 0).toString(16)}`).substr(-6)}`;\n context.fill();\n }\n if (data.lineWidth)\n {\n context.globalAlpha = data.lineAlpha * worldAlpha;\n context.strokeStyle = `#${(`00000${(lineColor | 0).toString(16)}`).substr(-6)}`;\n context.stroke();\n }\n }\n else if (data.type === SHAPES.RREC)\n {\n const rx = shape.x;\n const ry = shape.y;\n const width = shape.width;\n const height = shape.height;\n let radius = shape.radius;\n\n const maxRadius = Math.min(width, height) / 2 | 0;\n\n radius = radius > maxRadius ? maxRadius : radius;\n\n context.beginPath();\n context.moveTo(rx, ry + radius);\n context.lineTo(rx, ry + height - radius);\n context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height);\n context.lineTo(rx + width - radius, ry + height);\n context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius);\n context.lineTo(rx + width, ry + radius);\n context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry);\n context.lineTo(rx + radius, ry);\n context.quadraticCurveTo(rx, ry, rx, ry + radius);\n context.closePath();\n\n if (data.fillColor || data.fillColor === 0)\n {\n context.globalAlpha = data.fillAlpha * worldAlpha;\n context.fillStyle = `#${(`00000${(fillColor | 0).toString(16)}`).substr(-6)}`;\n context.fill();\n }\n\n if (data.lineWidth)\n {\n context.globalAlpha = data.lineAlpha * worldAlpha;\n context.strokeStyle = `#${(`00000${(lineColor | 0).toString(16)}`).substr(-6)}`;\n context.stroke();\n }\n }\n }\n }\n\n /**\n * Updates the tint of a graphics object\n *\n * @private\n * @param {PIXI.Graphics} graphics - the graphics that will have its tint updated\n */\n updateGraphicsTint(graphics)\n {\n graphics._prevTint = graphics.tint;\n graphics.canvasTintDirty = graphics.dirty;\n\n const tintR = ((graphics.tint >> 16) & 0xFF) / 255;\n const tintG = ((graphics.tint >> 8) & 0xFF) / 255;\n const tintB = (graphics.tint & 0xFF) / 255;\n\n for (let i = 0; i < graphics.graphicsData.length; ++i)\n {\n const data = graphics.graphicsData[i];\n\n const fillColor = data.fillColor | 0;\n const lineColor = data.lineColor | 0;\n\n // super inline, cos optimization :)\n data._fillTint = (\n (((fillColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)\n + (((fillColor >> 8) & 0xFF) / 255 * tintG * 255 << 8)\n + (((fillColor & 0xFF) / 255) * tintB * 255)\n );\n\n data._lineTint = (\n (((lineColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)\n + (((lineColor >> 8) & 0xFF) / 255 * tintG * 255 << 8)\n + (((lineColor & 0xFF) / 255) * tintB * 255)\n );\n }\n }\n\n /**\n * Renders a polygon.\n *\n * @param {PIXI.Point[]} points - The points to render\n * @param {boolean} close - Should the polygon be closed\n * @param {CanvasRenderingContext2D} context - The rendering context to use\n */\n renderPolygon(points, close, context)\n {\n context.moveTo(points[0], points[1]);\n\n for (let j = 1; j < points.length / 2; ++j)\n {\n context.lineTo(points[j * 2], points[(j * 2) + 1]);\n }\n\n if (close)\n {\n context.closePath();\n }\n }\n\n /**\n * destroy graphics object\n *\n */\n destroy()\n {\n this.renderer = null;\n }\n}\n\nCanvasRenderer.registerPlugin('graphics', CanvasGraphicsRenderer);\n","/**\n * Calculate the points for a bezier curve and then draws it.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @param {number} fromX - Starting point x\n * @param {number} fromY - Starting point y\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number} n - Number of segments approximating the bezier curve\n * @param {number[]} [path=[]] - Path array to push points into\n * @return {number[]} Array of points of the curve\n */\nexport default function bezierCurveTo(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY, n, path = [])\n{\n let dt = 0;\n let dt2 = 0;\n let dt3 = 0;\n let t2 = 0;\n let t3 = 0;\n\n path.push(fromX, fromY);\n\n for (let i = 1, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n dt = (1 - j);\n dt2 = dt * dt;\n dt3 = dt2 * dt;\n\n t2 = j * j;\n t3 = t2 * j;\n\n path.push(\n (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX),\n (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)\n );\n }\n\n return path;\n}\n","import { hex2rgb } from '../../utils';\nimport { SHAPES } from '../../const';\nimport ObjectRenderer from '../../renderers/webgl/utils/ObjectRenderer';\nimport WebGLRenderer from '../../renderers/webgl/WebGLRenderer';\nimport WebGLGraphicsData from './WebGLGraphicsData';\nimport PrimitiveShader from './shaders/PrimitiveShader';\n\nimport buildPoly from './utils/buildPoly';\nimport buildRectangle from './utils/buildRectangle';\nimport buildRoundedRectangle from './utils/buildRoundedRectangle';\nimport buildCircle from './utils/buildCircle';\n\n/**\n * Renders the graphics object.\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nexport default class GraphicsRenderer extends ObjectRenderer\n{\n /**\n * @param {PIXI.WebGLRenderer} renderer - The renderer this object renderer works for.\n */\n constructor(renderer)\n {\n super(renderer);\n\n this.graphicsDataPool = [];\n\n this.primitiveShader = null;\n\n this.gl = renderer.gl;\n\n // easy access!\n this.CONTEXT_UID = 0;\n }\n\n /**\n * Called when there is a WebGL context change\n *\n * @private\n *\n */\n onContextChange()\n {\n this.gl = this.renderer.gl;\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.primitiveShader = new PrimitiveShader(this.gl);\n }\n\n /**\n * Destroys this renderer.\n *\n */\n destroy()\n {\n ObjectRenderer.prototype.destroy.call(this);\n\n for (let i = 0; i < this.graphicsDataPool.length; ++i)\n {\n this.graphicsDataPool[i].destroy();\n }\n\n this.graphicsDataPool = null;\n }\n\n /**\n * Renders a graphics object.\n *\n * @param {PIXI.Graphics} graphics - The graphics object to render.\n */\n render(graphics)\n {\n const renderer = this.renderer;\n const gl = renderer.gl;\n\n let webGLData;\n let webGL = graphics._webGL[this.CONTEXT_UID];\n\n if (!webGL || graphics.dirty !== webGL.dirty)\n {\n this.updateGraphics(graphics);\n\n webGL = graphics._webGL[this.CONTEXT_UID];\n }\n\n // This could be speeded up for sure!\n const shader = this.primitiveShader;\n\n renderer.bindShader(shader);\n renderer.state.setBlendMode(graphics.blendMode);\n\n for (let i = 0, n = webGL.data.length; i < n; i++)\n {\n webGLData = webGL.data[i];\n const shaderTemp = webGLData.shader;\n\n renderer.bindShader(shaderTemp);\n shaderTemp.uniforms.translationMatrix = graphics.transform.worldTransform.toArray(true);\n shaderTemp.uniforms.tint = hex2rgb(graphics.tint);\n shaderTemp.uniforms.alpha = graphics.worldAlpha;\n\n renderer.bindVao(webGLData.vao);\n\n if (webGLData.nativeLines)\n {\n gl.drawArrays(gl.LINES, 0, webGLData.points.length / 6);\n }\n else\n {\n webGLData.vao.draw(gl.TRIANGLE_STRIP, webGLData.indices.length);\n }\n }\n }\n\n /**\n * Updates the graphics object\n *\n * @private\n * @param {PIXI.Graphics} graphics - The graphics object to update\n */\n updateGraphics(graphics)\n {\n const gl = this.renderer.gl;\n\n // get the contexts graphics object\n let webGL = graphics._webGL[this.CONTEXT_UID];\n\n // if the graphics object does not exist in the webGL context time to create it!\n if (!webGL)\n {\n webGL = graphics._webGL[this.CONTEXT_UID] = { lastIndex: 0, data: [], gl, clearDirty: -1, dirty: -1 };\n }\n\n // flag the graphics as not dirty as we are about to update it...\n webGL.dirty = graphics.dirty;\n\n // if the user cleared the graphics object we will need to clear every object\n if (graphics.clearDirty !== webGL.clearDirty)\n {\n webGL.clearDirty = graphics.clearDirty;\n\n // loop through and return all the webGLDatas to the object pool so than can be reused later on\n for (let i = 0; i < webGL.data.length; i++)\n {\n this.graphicsDataPool.push(webGL.data[i]);\n }\n\n // clear the array and reset the index..\n webGL.data.length = 0;\n webGL.lastIndex = 0;\n }\n\n let webGLData;\n let webGLDataNativeLines;\n\n // loop through the graphics datas and construct each one..\n // if the object is a complex fill then the new stencil buffer technique will be used\n // other wise graphics objects will be pushed into a batch..\n for (let i = webGL.lastIndex; i < graphics.graphicsData.length; i++)\n {\n const data = graphics.graphicsData[i];\n\n // TODO - this can be simplified\n webGLData = this.getWebGLData(webGL, 0);\n\n if (data.nativeLines && data.lineWidth)\n {\n webGLDataNativeLines = this.getWebGLData(webGL, 0, true);\n webGL.lastIndex++;\n }\n\n if (data.type === SHAPES.POLY)\n {\n buildPoly(data, webGLData, webGLDataNativeLines);\n }\n if (data.type === SHAPES.RECT)\n {\n buildRectangle(data, webGLData, webGLDataNativeLines);\n }\n else if (data.type === SHAPES.CIRC || data.type === SHAPES.ELIP)\n {\n buildCircle(data, webGLData, webGLDataNativeLines);\n }\n else if (data.type === SHAPES.RREC)\n {\n buildRoundedRectangle(data, webGLData, webGLDataNativeLines);\n }\n\n webGL.lastIndex++;\n }\n\n this.renderer.bindVao(null);\n\n // upload all the dirty data...\n for (let i = 0; i < webGL.data.length; i++)\n {\n webGLData = webGL.data[i];\n\n if (webGLData.dirty)\n {\n webGLData.upload();\n }\n }\n }\n\n /**\n *\n * @private\n * @param {WebGLRenderingContext} gl - the current WebGL drawing context\n * @param {number} type - TODO @Alvin\n * @param {number} nativeLines - indicate whether the webGLData use for nativeLines.\n * @return {*} TODO\n */\n getWebGLData(gl, type, nativeLines)\n {\n let webGLData = gl.data[gl.data.length - 1];\n\n if (!webGLData || webGLData.nativeLines !== nativeLines || webGLData.points.length > 320000)\n {\n webGLData = this.graphicsDataPool.pop()\n || new WebGLGraphicsData(this.renderer.gl, this.primitiveShader, this.renderer.state.attribsState);\n webGLData.nativeLines = nativeLines;\n webGLData.reset(type);\n gl.data.push(webGLData);\n }\n\n webGLData.dirty = true;\n\n return webGLData;\n }\n}\n\nWebGLRenderer.registerPlugin('graphics', GraphicsRenderer);\n","import glCore from 'pixi-gl-core';\n\n/**\n * An object containing WebGL specific properties to be used by the WebGL renderer\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport default class WebGLGraphicsData\n{\n /**\n * @param {WebGLRenderingContext} gl - The current WebGL drawing context\n * @param {PIXI.Shader} shader - The shader\n * @param {object} attribsState - The state for the VAO\n */\n constructor(gl, shader, attribsState)\n {\n /**\n * The current WebGL drawing context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = gl;\n\n // TODO does this need to be split before uploading??\n /**\n * An array of color components (r,g,b)\n * @member {number[]}\n */\n this.color = [0, 0, 0]; // color split!\n\n /**\n * An array of points to draw\n * @member {PIXI.Point[]}\n */\n this.points = [];\n\n /**\n * The indices of the vertices\n * @member {number[]}\n */\n this.indices = [];\n /**\n * The main buffer\n * @member {WebGLBuffer}\n */\n this.buffer = glCore.GLBuffer.createVertexBuffer(gl);\n\n /**\n * The index buffer\n * @member {WebGLBuffer}\n */\n this.indexBuffer = glCore.GLBuffer.createIndexBuffer(gl);\n\n /**\n * Whether this graphics is dirty or not\n * @member {boolean}\n */\n this.dirty = true;\n\n /**\n * Whether this graphics is nativeLines or not\n * @member {boolean}\n */\n this.nativeLines = false;\n\n this.glPoints = null;\n this.glIndices = null;\n\n /**\n *\n * @member {PIXI.Shader}\n */\n this.shader = shader;\n\n this.vao = new glCore.VertexArrayObject(gl, attribsState)\n .addIndex(this.indexBuffer)\n .addAttribute(this.buffer, shader.attributes.aVertexPosition, gl.FLOAT, false, 4 * 6, 0)\n .addAttribute(this.buffer, shader.attributes.aColor, gl.FLOAT, false, 4 * 6, 2 * 4);\n }\n\n /**\n * Resets the vertices and the indices\n */\n reset()\n {\n this.points.length = 0;\n this.indices.length = 0;\n }\n\n /**\n * Binds the buffers and uploads the data\n */\n upload()\n {\n this.glPoints = new Float32Array(this.points);\n this.buffer.upload(this.glPoints);\n\n this.glIndices = new Uint16Array(this.indices);\n this.indexBuffer.upload(this.glIndices);\n\n this.dirty = false;\n }\n\n /**\n * Empties all the data\n */\n destroy()\n {\n this.color = null;\n this.points = null;\n this.indices = null;\n\n this.vao.destroy();\n this.buffer.destroy();\n this.indexBuffer.destroy();\n\n this.gl = null;\n\n this.buffer = null;\n this.indexBuffer = null;\n\n this.glPoints = null;\n this.glIndices = null;\n }\n}\n","import Shader from '../../../Shader';\n\n/**\n * This shader is used to draw simple primitive shapes for {@link PIXI.Graphics}.\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nexport default class PrimitiveShader extends Shader\n{\n /**\n * @param {WebGLRenderingContext} gl - The webgl shader manager this shader works for.\n */\n constructor(gl)\n {\n super(gl,\n // vertex shader\n [\n 'attribute vec2 aVertexPosition;',\n 'attribute vec4 aColor;',\n\n 'uniform mat3 translationMatrix;',\n 'uniform mat3 projectionMatrix;',\n\n 'uniform float alpha;',\n 'uniform vec3 tint;',\n\n 'varying vec4 vColor;',\n\n 'void main(void){',\n ' gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);',\n ' vColor = aColor * vec4(tint * alpha, alpha);',\n '}',\n ].join('\\n'),\n // fragment shader\n [\n 'varying vec4 vColor;',\n\n 'void main(void){',\n ' gl_FragColor = vColor;',\n '}',\n ].join('\\n')\n );\n }\n}\n","import buildLine from './buildLine';\nimport { SHAPES } from '../../../const';\nimport { hex2rgb } from '../../../utils';\n\n/**\n * Builds a circle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw\n * @param {object} webGLData - an object containing all the webGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines\n */\nexport default function buildCircle(graphicsData, webGLData, webGLDataNativeLines)\n{\n // need to convert points to a nice regular data\n const circleData = graphicsData.shape;\n const x = circleData.x;\n const y = circleData.y;\n let width;\n let height;\n\n // TODO - bit hacky??\n if (graphicsData.type === SHAPES.CIRC)\n {\n width = circleData.radius;\n height = circleData.radius;\n }\n else\n {\n width = circleData.width;\n height = circleData.height;\n }\n\n if (width === 0 || height === 0)\n {\n return;\n }\n\n const totalSegs = Math.floor(30 * Math.sqrt(circleData.radius))\n || Math.floor(15 * Math.sqrt(circleData.width + circleData.height));\n\n const seg = (Math.PI * 2) / totalSegs;\n\n if (graphicsData.fill)\n {\n const color = hex2rgb(graphicsData.fillColor);\n const alpha = graphicsData.fillAlpha;\n\n const r = color[0] * alpha;\n const g = color[1] * alpha;\n const b = color[2] * alpha;\n\n const verts = webGLData.points;\n const indices = webGLData.indices;\n\n let vecPos = verts.length / 6;\n\n indices.push(vecPos);\n\n for (let i = 0; i < totalSegs + 1; i++)\n {\n verts.push(x, y, r, g, b, alpha);\n\n verts.push(\n x + (Math.sin(seg * i) * width),\n y + (Math.cos(seg * i) * height),\n r, g, b, alpha\n );\n\n indices.push(vecPos++, vecPos++);\n }\n\n indices.push(vecPos - 1);\n }\n\n if (graphicsData.lineWidth)\n {\n const tempPoints = graphicsData.points;\n\n graphicsData.points = [];\n\n for (let i = 0; i < totalSegs; i++)\n {\n graphicsData.points.push(\n x + (Math.sin(seg * -i) * width),\n y + (Math.cos(seg * -i) * height)\n );\n }\n\n graphicsData.points.push(\n graphicsData.points[0],\n graphicsData.points[1]\n );\n\n buildLine(graphicsData, webGLData, webGLDataNativeLines);\n\n graphicsData.points = tempPoints;\n }\n}\n","import { Point } from '../../../math';\nimport { hex2rgb } from '../../../utils';\n\n/**\n * Builds a line to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the webGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines\n */\nexport default function (graphicsData, webGLData, webGLDataNativeLines)\n{\n if (graphicsData.nativeLines)\n {\n buildNativeLine(graphicsData, webGLDataNativeLines);\n }\n else\n {\n buildLine(graphicsData, webGLData);\n }\n}\n\n/**\n * Builds a line to draw using the poligon method.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the webGL-specific information to create this shape\n */\nfunction buildLine(graphicsData, webGLData)\n{\n // TODO OPTIMISE!\n let points = graphicsData.points;\n\n if (points.length === 0)\n {\n return;\n }\n // if the line width is an odd number add 0.5 to align to a whole pixel\n // commenting this out fixes #711 and #1620\n // if (graphicsData.lineWidth%2)\n // {\n // for (i = 0; i < points.length; i++)\n // {\n // points[i] += 0.5;\n // }\n // }\n\n // get first and last point.. figure out the middle!\n const firstPoint = new Point(points[0], points[1]);\n let lastPoint = new Point(points[points.length - 2], points[points.length - 1]);\n\n // if the first point is the last point - gonna have issues :)\n if (firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y)\n {\n // need to clone as we are going to slightly modify the shape..\n points = points.slice();\n\n points.pop();\n points.pop();\n\n lastPoint = new Point(points[points.length - 2], points[points.length - 1]);\n\n const midPointX = lastPoint.x + ((firstPoint.x - lastPoint.x) * 0.5);\n const midPointY = lastPoint.y + ((firstPoint.y - lastPoint.y) * 0.5);\n\n points.unshift(midPointX, midPointY);\n points.push(midPointX, midPointY);\n }\n\n const verts = webGLData.points;\n const indices = webGLData.indices;\n const length = points.length / 2;\n let indexCount = points.length;\n let indexStart = verts.length / 6;\n\n // DRAW the Line\n const width = graphicsData.lineWidth / 2;\n\n // sort color\n const color = hex2rgb(graphicsData.lineColor);\n const alpha = graphicsData.lineAlpha;\n const r = color[0] * alpha;\n const g = color[1] * alpha;\n const b = color[2] * alpha;\n\n let p1x = points[0];\n let p1y = points[1];\n let p2x = points[2];\n let p2y = points[3];\n let p3x = 0;\n let p3y = 0;\n\n let perpx = -(p1y - p2y);\n let perpy = p1x - p2x;\n let perp2x = 0;\n let perp2y = 0;\n let perp3x = 0;\n let perp3y = 0;\n\n let dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n const ratio = graphicsData.lineAlignment;// 0.5;\n const r1 = (1 - ratio) * 2;\n const r2 = ratio * 2;\n\n // start\n verts.push(\n p1x - (perpx * r1),\n p1y - (perpy * r1),\n r, g, b, alpha\n );\n\n verts.push(\n p1x + (perpx * r2),\n p1y + (perpy * r2),\n r, g, b, alpha\n );\n\n for (let i = 1; i < length - 1; ++i)\n {\n p1x = points[(i - 1) * 2];\n p1y = points[((i - 1) * 2) + 1];\n\n p2x = points[i * 2];\n p2y = points[(i * 2) + 1];\n\n p3x = points[(i + 1) * 2];\n p3y = points[((i + 1) * 2) + 1];\n\n perpx = -(p1y - p2y);\n perpy = p1x - p2x;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n perp2x = -(p2y - p3y);\n perp2y = p2x - p3x;\n\n dist = Math.sqrt((perp2x * perp2x) + (perp2y * perp2y));\n perp2x /= dist;\n perp2y /= dist;\n perp2x *= width;\n perp2y *= width;\n\n const a1 = (-perpy + p1y) - (-perpy + p2y);\n const b1 = (-perpx + p2x) - (-perpx + p1x);\n const c1 = ((-perpx + p1x) * (-perpy + p2y)) - ((-perpx + p2x) * (-perpy + p1y));\n const a2 = (-perp2y + p3y) - (-perp2y + p2y);\n const b2 = (-perp2x + p2x) - (-perp2x + p3x);\n const c2 = ((-perp2x + p3x) * (-perp2y + p2y)) - ((-perp2x + p2x) * (-perp2y + p3y));\n\n let denom = (a1 * b2) - (a2 * b1);\n\n if (Math.abs(denom) < 0.1)\n {\n denom += 10.1;\n verts.push(\n p2x - (perpx * r1),\n p2y - (perpy * r1),\n r, g, b, alpha\n );\n\n verts.push(\n p2x + (perpx * r2),\n p2y + (perpy * r2),\n r, g, b, alpha\n );\n\n continue;\n }\n\n const px = ((b1 * c2) - (b2 * c1)) / denom;\n const py = ((a2 * c1) - (a1 * c2)) / denom;\n const pdist = ((px - p2x) * (px - p2x)) + ((py - p2y) * (py - p2y));\n\n if (pdist > (196 * width * width))\n {\n perp3x = perpx - perp2x;\n perp3y = perpy - perp2y;\n\n dist = Math.sqrt((perp3x * perp3x) + (perp3y * perp3y));\n perp3x /= dist;\n perp3y /= dist;\n perp3x *= width;\n perp3y *= width;\n\n verts.push(p2x - (perp3x * r1), p2y - (perp3y * r1));\n verts.push(r, g, b, alpha);\n\n verts.push(p2x + (perp3x * r2), p2y + (perp3y * r2));\n verts.push(r, g, b, alpha);\n\n verts.push(p2x - (perp3x * r2 * r1), p2y - (perp3y * r1));\n verts.push(r, g, b, alpha);\n\n indexCount++;\n }\n else\n {\n verts.push(p2x + ((px - p2x) * r1), p2y + ((py - p2y) * r1));\n verts.push(r, g, b, alpha);\n\n verts.push(p2x - ((px - p2x) * r2), p2y - ((py - p2y) * r2));\n verts.push(r, g, b, alpha);\n }\n }\n\n p1x = points[(length - 2) * 2];\n p1y = points[((length - 2) * 2) + 1];\n\n p2x = points[(length - 1) * 2];\n p2y = points[((length - 1) * 2) + 1];\n\n perpx = -(p1y - p2y);\n perpy = p1x - p2x;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n verts.push(p2x - (perpx * r1), p2y - (perpy * r1));\n verts.push(r, g, b, alpha);\n\n verts.push(p2x + (perpx * r2), p2y + (perpy * r2));\n verts.push(r, g, b, alpha);\n\n indices.push(indexStart);\n\n for (let i = 0; i < indexCount; ++i)\n {\n indices.push(indexStart++);\n }\n\n indices.push(indexStart - 1);\n}\n\n/**\n * Builds a line to draw using the gl.drawArrays(gl.LINES) method\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the webGL-specific information to create this shape\n */\nfunction buildNativeLine(graphicsData, webGLData)\n{\n let i = 0;\n const points = graphicsData.points;\n\n if (points.length === 0) return;\n\n const verts = webGLData.points;\n const length = points.length / 2;\n\n // sort color\n const color = hex2rgb(graphicsData.lineColor);\n const alpha = graphicsData.lineAlpha;\n const r = color[0] * alpha;\n const g = color[1] * alpha;\n const b = color[2] * alpha;\n\n for (i = 1; i < length; i++)\n {\n const p1x = points[(i - 1) * 2];\n const p1y = points[((i - 1) * 2) + 1];\n\n const p2x = points[i * 2];\n const p2y = points[(i * 2) + 1];\n\n verts.push(p1x, p1y);\n verts.push(r, g, b, alpha);\n\n verts.push(p2x, p2y);\n verts.push(r, g, b, alpha);\n }\n}\n","import buildLine from './buildLine';\nimport { hex2rgb } from '../../../utils';\nimport earcut from 'earcut';\n\n/**\n * Builds a polygon to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the webGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines\n */\nexport default function buildPoly(graphicsData, webGLData, webGLDataNativeLines)\n{\n graphicsData.points = graphicsData.shape.points.slice();\n\n let points = graphicsData.points;\n\n if (graphicsData.fill && points.length >= 6)\n {\n const holeArray = [];\n // Process holes..\n const holes = graphicsData.holes;\n\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n\n holeArray.push(points.length / 2);\n\n points = points.concat(hole.points);\n }\n\n // get first and last point.. figure out the middle!\n const verts = webGLData.points;\n const indices = webGLData.indices;\n\n const length = points.length / 2;\n\n // sort color\n const color = hex2rgb(graphicsData.fillColor);\n const alpha = graphicsData.fillAlpha;\n const r = color[0] * alpha;\n const g = color[1] * alpha;\n const b = color[2] * alpha;\n\n const triangles = earcut(points, holeArray, 2);\n\n if (!triangles)\n {\n return;\n }\n\n const vertPos = verts.length / 6;\n\n for (let i = 0; i < triangles.length; i += 3)\n {\n indices.push(triangles[i] + vertPos);\n indices.push(triangles[i] + vertPos);\n indices.push(triangles[i + 1] + vertPos);\n indices.push(triangles[i + 2] + vertPos);\n indices.push(triangles[i + 2] + vertPos);\n }\n\n for (let i = 0; i < length; i++)\n {\n verts.push(points[i * 2], points[(i * 2) + 1],\n r, g, b, alpha);\n }\n }\n\n if (graphicsData.lineWidth > 0)\n {\n buildLine(graphicsData, webGLData, webGLDataNativeLines);\n }\n}\n","import buildLine from './buildLine';\nimport { hex2rgb } from '../../../utils';\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the webGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines\n */\nexport default function buildRectangle(graphicsData, webGLData, webGLDataNativeLines)\n{\n // --- //\n // need to convert points to a nice regular data\n //\n const rectData = graphicsData.shape;\n const x = rectData.x;\n const y = rectData.y;\n const width = rectData.width;\n const height = rectData.height;\n\n if (graphicsData.fill)\n {\n const color = hex2rgb(graphicsData.fillColor);\n const alpha = graphicsData.fillAlpha;\n\n const r = color[0] * alpha;\n const g = color[1] * alpha;\n const b = color[2] * alpha;\n\n const verts = webGLData.points;\n const indices = webGLData.indices;\n\n const vertPos = verts.length / 6;\n\n // start\n verts.push(x, y);\n verts.push(r, g, b, alpha);\n\n verts.push(x + width, y);\n verts.push(r, g, b, alpha);\n\n verts.push(x, y + height);\n verts.push(r, g, b, alpha);\n\n verts.push(x + width, y + height);\n verts.push(r, g, b, alpha);\n\n // insert 2 dead triangles..\n indices.push(vertPos, vertPos, vertPos + 1, vertPos + 2, vertPos + 3, vertPos + 3);\n }\n\n if (graphicsData.lineWidth)\n {\n const tempPoints = graphicsData.points;\n\n graphicsData.points = [x, y,\n x + width, y,\n x + width, y + height,\n x, y + height,\n x, y];\n\n buildLine(graphicsData, webGLData, webGLDataNativeLines);\n\n graphicsData.points = tempPoints;\n }\n}\n","import earcut from 'earcut';\nimport buildLine from './buildLine';\nimport { hex2rgb } from '../../../utils';\n\n/**\n * Builds a rounded rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the webGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines\n */\nexport default function buildRoundedRectangle(graphicsData, webGLData, webGLDataNativeLines)\n{\n const rrectData = graphicsData.shape;\n const x = rrectData.x;\n const y = rrectData.y;\n const width = rrectData.width;\n const height = rrectData.height;\n\n const radius = rrectData.radius;\n\n const recPoints = [];\n\n recPoints.push(x + radius, y);\n quadraticBezierCurve(x + width - radius, y, x + width, y, x + width, y + radius, recPoints);\n quadraticBezierCurve(x + width, y + height - radius, x + width, y + height, x + width - radius, y + height, recPoints);\n quadraticBezierCurve(x + radius, y + height, x, y + height, x, y + height - radius, recPoints);\n quadraticBezierCurve(x, y + radius, x, y, x + radius + 0.0000000001, y, recPoints);\n\n // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item.\n // TODO - fix this properly, this is not very elegant.. but it works for now.\n\n if (graphicsData.fill)\n {\n const color = hex2rgb(graphicsData.fillColor);\n const alpha = graphicsData.fillAlpha;\n\n const r = color[0] * alpha;\n const g = color[1] * alpha;\n const b = color[2] * alpha;\n\n const verts = webGLData.points;\n const indices = webGLData.indices;\n\n const vecPos = verts.length / 6;\n\n const triangles = earcut(recPoints, null, 2);\n\n for (let i = 0, j = triangles.length; i < j; i += 3)\n {\n indices.push(triangles[i] + vecPos);\n indices.push(triangles[i] + vecPos);\n indices.push(triangles[i + 1] + vecPos);\n indices.push(triangles[i + 2] + vecPos);\n indices.push(triangles[i + 2] + vecPos);\n }\n\n for (let i = 0, j = recPoints.length; i < j; i++)\n {\n verts.push(recPoints[i], recPoints[++i], r, g, b, alpha);\n }\n }\n\n if (graphicsData.lineWidth)\n {\n const tempPoints = graphicsData.points;\n\n graphicsData.points = recPoints;\n\n buildLine(graphicsData, webGLData, webGLDataNativeLines);\n\n graphicsData.points = tempPoints;\n }\n}\n\n/**\n * Calculate a single point for a quadratic bezier curve.\n * Utility function used by quadraticBezierCurve.\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} n1 - first number\n * @param {number} n2 - second number\n * @param {number} perc - percentage\n * @return {number} the result\n *\n */\nfunction getPt(n1, n2, perc)\n{\n const diff = n2 - n1;\n\n return n1 + (diff * perc);\n}\n\n/**\n * Calculate the points for a quadratic bezier curve. (helper function..)\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} fromX - Origin point x\n * @param {number} fromY - Origin point x\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created.\n * @return {number[]} an array of points\n */\nfunction quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY, out = [])\n{\n const n = 20;\n const points = out;\n\n let xa = 0;\n let ya = 0;\n let xb = 0;\n let yb = 0;\n let x = 0;\n let y = 0;\n\n for (let i = 0, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n // The Green Line\n xa = getPt(fromX, cpX, j);\n ya = getPt(fromY, cpY, j);\n xb = getPt(cpX, toX, j);\n yb = getPt(cpY, toY, j);\n\n // The Black Dot\n x = getPt(xa, xb, j);\n y = getPt(ya, yb, j);\n\n points.push(x, y);\n }\n\n return points;\n}\n","/**\n * @namespace PIXI\n */\nexport * from './const';\nexport * from './math';\n\nimport * as utils from './utils';\nimport * as ticker from './ticker';\nimport settings from './settings';\nimport CanvasRenderer from './renderers/canvas/CanvasRenderer';\nimport WebGLRenderer from './renderers/webgl/WebGLRenderer';\n\nexport { settings, utils, ticker, CanvasRenderer, WebGLRenderer };\n\nexport { default as glCore } from 'pixi-gl-core';\n\nexport { default as Bounds } from './display/Bounds';\nexport { default as DisplayObject } from './display/DisplayObject';\nexport { default as Container } from './display/Container';\nexport { default as Transform } from './display/Transform';\nexport { default as TransformStatic } from './display/TransformStatic';\nexport { default as TransformBase } from './display/TransformBase';\nexport { default as Sprite } from './sprites/Sprite';\nexport { default as CanvasSpriteRenderer } from './sprites/canvas/CanvasSpriteRenderer';\nexport { default as CanvasTinter } from './sprites/canvas/CanvasTinter';\nexport { default as SpriteRenderer } from './sprites/webgl/SpriteRenderer';\nexport { default as Text } from './text/Text';\nexport { default as TextStyle } from './text/TextStyle';\nexport { default as TextMetrics } from './text/TextMetrics';\nexport { default as Graphics } from './graphics/Graphics';\nexport { default as GraphicsData } from './graphics/GraphicsData';\nexport { default as GraphicsRenderer } from './graphics/webgl/GraphicsRenderer';\nexport { default as CanvasGraphicsRenderer } from './graphics/canvas/CanvasGraphicsRenderer';\nexport { default as Spritesheet } from './textures/Spritesheet';\nexport { default as Texture } from './textures/Texture';\nexport { default as TextureMatrix } from './textures/TextureMatrix';\nexport { default as BaseTexture } from './textures/BaseTexture';\nexport { default as RenderTexture } from './textures/RenderTexture';\nexport { default as BaseRenderTexture } from './textures/BaseRenderTexture';\nexport { default as VideoBaseTexture } from './textures/VideoBaseTexture';\nexport { default as TextureUvs } from './textures/TextureUvs';\nexport { default as CanvasRenderTarget } from './renderers/canvas/utils/CanvasRenderTarget';\nexport { default as Shader } from './Shader';\nexport { default as WebGLManager } from './renderers/webgl/managers/WebGLManager';\nexport { default as ObjectRenderer } from './renderers/webgl/utils/ObjectRenderer';\nexport { default as RenderTarget } from './renderers/webgl/utils/RenderTarget';\nexport { default as Quad } from './renderers/webgl/utils/Quad';\nexport { default as SpriteMaskFilter } from './renderers/webgl/filters/spriteMask/SpriteMaskFilter';\nexport { default as Filter } from './renderers/webgl/filters/Filter';\nexport { default as Application } from './Application';\nexport { autoDetectRenderer } from './autoDetectRenderer';\n","// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group of order 16\nimport Matrix from './Matrix';\n\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\nconst tempMatrices = [];\n\nconst mul = [];\n\nfunction signum(x)\n{\n if (x < 0)\n {\n return -1;\n }\n if (x > 0)\n {\n return 1;\n }\n\n return 0;\n}\n\nfunction init()\n{\n for (let i = 0; i < 16; i++)\n {\n const row = [];\n\n mul.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n const _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n const _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n const _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n const _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy && vx[k] === _vx && vy[k] === _vy)\n {\n row.push(k);\n break;\n }\n }\n }\n }\n\n for (let i = 0; i < 16; i++)\n {\n const mat = new Matrix();\n\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n tempMatrices.push(mat);\n }\n}\n\ninit();\n\n/**\n * Implements Dihedral Group D_8, see [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html},\n * D8 is the same but with diagonals. Used for texture rotations.\n *\n * Vector xX(i), xY(i) is U-axis of sprite with rotation i\n * Vector yY(i), yY(i) is V-axis of sprite with rotation i\n * Rotations: 0 grad (0), 90 grad (2), 180 grad (4), 270 grad (6)\n * Mirrors: vertical (8), main diagonal (10), horizontal (12), reverse diagonal (14)\n * This is the small part of gameofbombs.com portal system. It works.\n *\n * @author Ivan @ivanpopelyshev\n * @class\n * @memberof PIXI\n */\nconst GroupD8 = {\n E: 0,\n SE: 1,\n S: 2,\n SW: 3,\n W: 4,\n NW: 5,\n N: 6,\n NE: 7,\n MIRROR_VERTICAL: 8,\n MIRROR_HORIZONTAL: 12,\n uX: (ind) => ux[ind],\n uY: (ind) => uy[ind],\n vX: (ind) => vx[ind],\n vY: (ind) => vy[ind],\n inv: (rotation) =>\n {\n if (rotation & 8)\n {\n return rotation & 15;\n }\n\n return (-rotation) & 7;\n },\n add: (rotationSecond, rotationFirst) => mul[rotationSecond][rotationFirst],\n sub: (rotationSecond, rotationFirst) => mul[rotationSecond][GroupD8.inv(rotationFirst)],\n\n /**\n * Adds 180 degrees to rotation. Commutative operation.\n *\n * @memberof PIXI.GroupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} rotated number\n */\n rotate180: (rotation) => rotation ^ 4,\n\n /**\n * Direction of main vector can be horizontal, vertical or diagonal.\n * Some objects work with vertical directions different.\n *\n * @memberof PIXI.GroupD8\n * @param {number} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation) => (rotation & 3) === 2,\n\n /**\n * @memberof PIXI.GroupD8\n * @param {number} dx - TODO\n * @param {number} dy - TODO\n *\n * @return {number} TODO\n */\n byDirection: (dx, dy) =>\n {\n if (Math.abs(dx) * 2 <= Math.abs(dy))\n {\n if (dy >= 0)\n {\n return GroupD8.S;\n }\n\n return GroupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx))\n {\n if (dx > 0)\n {\n return GroupD8.E;\n }\n\n return GroupD8.W;\n }\n else if (dy > 0)\n {\n if (dx > 0)\n {\n return GroupD8.SE;\n }\n\n return GroupD8.SW;\n }\n else if (dx > 0)\n {\n return GroupD8.NE;\n }\n\n return GroupD8.NW;\n },\n\n /**\n * Helps sprite to compensate texture packer rotation.\n *\n * @memberof PIXI.GroupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {number} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix, rotation, tx = 0, ty = 0) =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat = tempMatrices[GroupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n\nexport default GroupD8;\n","import Point from './Point';\nimport { PI_2 } from '../const';\n\n/**\n * The PixiJS Matrix class as an object, which makes it a lot faster,\n * here is a representation of it :\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n *\n * @class\n * @memberof PIXI\n */\nexport default class Matrix\n{\n /**\n * @param {number} [a=1] - x scale\n * @param {number} [b=0] - x skew\n * @param {number} [c=0] - y skew\n * @param {number} [d=1] - y scale\n * @param {number} [tx=0] - x translation\n * @param {number} [ty=0] - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\n {\n /**\n * @member {number}\n * @default 1\n */\n this.a = a;\n\n /**\n * @member {number}\n * @default 0\n */\n this.b = b;\n\n /**\n * @member {number}\n * @default 0\n */\n this.c = c;\n\n /**\n * @member {number}\n * @default 1\n */\n this.d = d;\n\n /**\n * @member {number}\n * @default 0\n */\n this.tx = tx;\n\n /**\n * @member {number}\n * @default 0\n */\n this.ty = ty;\n\n this.array = null;\n }\n\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n *\n * @param {number[]} array - The array that the matrix will be populated from.\n */\n fromArray(array)\n {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n }\n\n /**\n * sets the matrix properties\n *\n * @param {number} a - Matrix component\n * @param {number} b - Matrix component\n * @param {number} c - Matrix component\n * @param {number} d - Matrix component\n * @param {number} tx - Matrix component\n * @param {number} ty - Matrix component\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n set(a, b, c, d, tx, ty)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n\n return this;\n }\n\n /**\n * Creates an array from the current Matrix object.\n *\n * @param {boolean} transpose - Whether we need to transpose the matrix or not\n * @param {Float32Array} [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @return {number[]} the newly created array which contains the matrix\n */\n toArray(transpose, out)\n {\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n const array = out || this.array;\n\n if (transpose)\n {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else\n {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n\n return array;\n }\n\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n *\n * @param {PIXI.Point} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, transformed through this matrix\n */\n apply(pos, newPos)\n {\n newPos = newPos || new Point();\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n\n return newPos;\n }\n\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n *\n * @param {PIXI.Point} pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse(pos, newPos)\n {\n newPos = newPos || new Point();\n\n const id = 1 / ((this.a * this.d) + (this.c * -this.b));\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n\n return newPos;\n }\n\n /**\n * Translates the matrix on the x and y.\n *\n * @param {number} x How much to translate x by\n * @param {number} y How much to translate y by\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n translate(x, y)\n {\n this.tx += x;\n this.ty += y;\n\n return this;\n }\n\n /**\n * Applies a scale transformation to the matrix.\n *\n * @param {number} x The amount to scale horizontally\n * @param {number} y The amount to scale vertically\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n scale(x, y)\n {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n\n return this;\n }\n\n /**\n * Applies a rotation transformation to the matrix.\n *\n * @param {number} angle - The angle in radians.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n rotate(angle)\n {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n\n return this;\n }\n\n /**\n * Appends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to append.\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n append(matrix)\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n\n return this;\n }\n\n /**\n * Sets the matrix based on all the available properties\n *\n * @param {number} x - Position on the x axis\n * @param {number} y - Position on the y axis\n * @param {number} pivotX - Pivot on the x axis\n * @param {number} pivotY - Pivot on the y axis\n * @param {number} scaleX - Scale on the x axis\n * @param {number} scaleY - Scale on the y axis\n * @param {number} rotation - Rotation in radians\n * @param {number} skewX - Skew on the x axis\n * @param {number} skewY - Skew on the y axis\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n setTransform(x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY)\n {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n\n return this;\n }\n\n /**\n * Prepends the given Matrix to this Matrix.\n *\n * @param {PIXI.Matrix} matrix - The matrix to prepend\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n prepend(matrix)\n {\n const tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\n const a1 = this.a;\n const c1 = this.c;\n\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n\n return this;\n }\n\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n *\n * @param {PIXI.Transform|PIXI.TransformStatic} transform - The transform to apply the properties to.\n * @return {PIXI.Transform|PIXI.TransformStatic} The transform with the newly applied properties\n */\n decompose(transform)\n {\n // sort out rotation / skew..\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n\n const delta = Math.abs(skewX + skewY);\n\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)\n {\n transform.rotation = skewY;\n\n if (a < 0 && d >= 0)\n {\n transform.rotation += (transform.rotation <= 0) ? Math.PI : -Math.PI;\n }\n\n transform.skew.x = transform.skew.y = 0;\n }\n else\n {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n\n // next set position\n transform.position.x = this.tx;\n transform.position.y = this.ty;\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n invert()\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = (a1 * d1) - (b1 * c1);\n\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n\n return this;\n }\n\n /**\n * Resets this Matix to an identity (default) matrix.\n *\n * @return {PIXI.Matrix} This matrix. Good for chaining method calls.\n */\n identity()\n {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n\n return this;\n }\n\n /**\n * Creates a new Matrix object with the same values as this one.\n *\n * @return {PIXI.Matrix} A copy of this matrix. Good for chaining method calls.\n */\n clone()\n {\n const matrix = new Matrix();\n\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @return {PIXI.Matrix} The matrix given in parameter with its values updated.\n */\n copy(matrix)\n {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * A default (identity) matrix\n *\n * @static\n * @const\n */\n static get IDENTITY()\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n *\n * @static\n * @const\n */\n static get TEMP_MATRIX()\n {\n return new Matrix();\n }\n}\n","/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n * An observable point is a point that triggers a callback when the point's position is changed.\n *\n * @class\n * @memberof PIXI\n */\nexport default class ObservablePoint\n{\n /**\n * @param {Function} cb - callback when changed\n * @param {object} scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(cb, scope, x = 0, y = 0)\n {\n this._x = x;\n this._y = y;\n\n this.cb = cb;\n this.scope = scope;\n }\n\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overidden otherwise they will default\n * to the clone object's values.\n *\n * @override\n * @param {Function} [cb=null] - callback when changed\n * @param {object} [scope=null] - owner of callback\n * @return {PIXI.ObservablePoint} a copy of the point\n */\n clone(cb = null, scope = null)\n {\n const _cb = cb || this.cb;\n const _scope = scope || this.scope;\n\n return new ObservablePoint(_cb, _scope, this._x, this._y);\n }\n\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n set(x, y)\n {\n const _x = x || 0;\n const _y = y || ((y !== 0) ? _x : 0);\n\n if (this._x !== _x || this._y !== _y)\n {\n this._x = _x;\n this._y = _y;\n this.cb.call(this.scope);\n }\n }\n\n /**\n * Copies the data from another point\n *\n * @param {PIXI.Point|PIXI.ObservablePoint} point - point to copy from\n */\n copy(point)\n {\n if (this._x !== point.x || this._y !== point.y)\n {\n this._x = point.x;\n this._y = point.y;\n this.cb.call(this.scope);\n }\n }\n\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.Point|PIXI.ObservablePoint} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n equals(p)\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get x()\n {\n return this._x;\n }\n\n set x(value) // eslint-disable-line require-jsdoc\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n *\n * @member {number}\n */\n get y()\n {\n return this._y;\n }\n\n set y(value) // eslint-disable-line require-jsdoc\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n","/**\n * The Point object represents a location in a two-dimensional coordinate system, where x represents\n * the horizontal axis and y represents the vertical axis.\n *\n * @class\n * @memberof PIXI\n */\nexport default class Point\n{\n /**\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n *\n * @return {PIXI.Point} a copy of the point\n */\n clone()\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies x and y from the given point\n *\n * @param {PIXI.Point} p - The point to copy.\n */\n copy(p)\n {\n this.set(p.x, p.y);\n }\n\n /**\n * Returns true if the given point is equal to this point\n *\n * @param {PIXI.Point} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n equals(p)\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n set(x, y)\n {\n this.x = x || 0;\n this.y = y || ((y !== 0) ? this.x : 0);\n }\n\n}\n","/**\n * Math classes and utilities mixed into PIXI namespace.\n *\n * @lends PIXI\n */\nexport { default as Point } from './Point';\nexport { default as ObservablePoint } from './ObservablePoint';\nexport { default as Matrix } from './Matrix';\nexport { default as GroupD8 } from './GroupD8';\n\nexport { default as Circle } from './shapes/Circle';\nexport { default as Ellipse } from './shapes/Ellipse';\nexport { default as Polygon } from './shapes/Polygon';\nexport { default as Rectangle } from './shapes/Rectangle';\nexport { default as RoundedRectangle } from './shapes/RoundedRectangle';\n","import Rectangle from './Rectangle';\nimport { SHAPES } from '../../const';\n\n/**\n * The Circle object can be used to specify a hit area for displayObjects\n *\n * @class\n * @memberof PIXI\n */\nexport default class Circle\n{\n /**\n * @param {number} [x=0] - The X coordinate of the center of this circle\n * @param {number} [y=0] - The Y coordinate of the center of this circle\n * @param {number} [radius=0] - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.radius = radius;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.CIRC;\n }\n\n /**\n * Creates a clone of this Circle instance\n *\n * @return {PIXI.Circle} a copy of the Circle\n */\n clone()\n {\n return new Circle(this.x, this.y, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Circle\n */\n contains(x, y)\n {\n if (this.radius <= 0)\n {\n return false;\n }\n\n const r2 = this.radius * this.radius;\n let dx = (this.x - x);\n let dy = (this.y - y);\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n }\n\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n getBounds()\n {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n }\n}\n","import Rectangle from './Rectangle';\nimport { SHAPES } from '../../const';\n\n/**\n * The Ellipse object can be used to specify a hit area for displayObjects\n *\n * @class\n * @memberof PIXI\n */\nexport default class Ellipse\n{\n /**\n * @param {number} [x=0] - The X coordinate of the center of this ellipse\n * @param {number} [y=0] - The Y coordinate of the center of this ellipse\n * @param {number} [halfWidth=0] - The half width of this ellipse\n * @param {number} [halfHeight=0] - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = halfWidth;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = halfHeight;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.ELIP;\n }\n\n /**\n * Creates a clone of this Ellipse instance\n *\n * @return {PIXI.Ellipse} a copy of the ellipse\n */\n clone()\n {\n return new Ellipse(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coords are within this ellipse\n */\n contains(x, y)\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n // normalize the coords to an ellipse with center 0,0\n let normx = ((x - this.x) / this.width);\n let normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n }\n\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n *\n * @return {PIXI.Rectangle} the framing rectangle\n */\n getBounds()\n {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n }\n}\n","import Point from '../Point';\nimport { SHAPES } from '../../const';\n\n/**\n * @class\n * @memberof PIXI\n */\nexport default class Polygon\n{\n /**\n * @param {PIXI.Point[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points)\n {\n if (Array.isArray(points[0]))\n {\n points = points[0];\n }\n\n // if this is an array of points, convert it to a flat array of numbers\n if (points[0] instanceof Point)\n {\n const p = [];\n\n for (let i = 0, il = points.length; i < il; i++)\n {\n p.push(points[i].x, points[i].y);\n }\n\n points = p;\n }\n\n this.closed = true;\n\n /**\n * An array of the points of this polygon\n *\n * @member {number[]}\n */\n this.points = points;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.POLY;\n }\n\n /**\n * Creates a clone of this polygon\n *\n * @return {PIXI.Polygon} a copy of the polygon\n */\n clone()\n {\n return new Polygon(this.points.slice());\n }\n\n /**\n * Closes the polygon, adding points if necessary.\n *\n */\n close()\n {\n const points = this.points;\n\n // close the poly if the value is true!\n if (points[0] !== points[points.length - 2] || points[1] !== points[points.length - 1])\n {\n points.push(points[0], points[1]);\n }\n }\n\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this polygon\n */\n contains(x, y)\n {\n let inside = false;\n\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n const length = this.points.length / 2;\n\n for (let i = 0, j = length - 1; i < length; j = i++)\n {\n const xi = this.points[i * 2];\n const yi = this.points[(i * 2) + 1];\n const xj = this.points[j * 2];\n const yj = this.points[(j * 2) + 1];\n const intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n }\n}\n","import { SHAPES } from '../../const';\n\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n *\n * @class\n * @memberof PIXI\n */\nexport default class Rectangle\n{\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle\n * @param {number} [width=0] - The overall width of this rectangle\n * @param {number} [height=0] - The overall height of this rectangle\n */\n constructor(x = 0, y = 0, width = 0, height = 0)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = Number(x);\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = Number(y);\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = Number(width);\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = Number(height);\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readOnly\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RECT;\n }\n\n /**\n * returns the left edge of the rectangle\n *\n * @member {number}\n */\n get left()\n {\n return this.x;\n }\n\n /**\n * returns the right edge of the rectangle\n *\n * @member {number}\n */\n get right()\n {\n return this.x + this.width;\n }\n\n /**\n * returns the top edge of the rectangle\n *\n * @member {number}\n */\n get top()\n {\n return this.y;\n }\n\n /**\n * returns the bottom edge of the rectangle\n *\n * @member {number}\n */\n get bottom()\n {\n return this.y + this.height;\n }\n\n /**\n * A constant empty rectangle.\n *\n * @static\n * @constant\n */\n static get EMPTY()\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n *\n * @return {PIXI.Rectangle} a copy of the rectangle\n */\n clone()\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to copy.\n * @return {PIXI.Rectangle} Returns itself.\n */\n copy(rectangle)\n {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n\n return this;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rectangle\n */\n contains(x, y)\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n *\n * @param {number} paddingX - The horizontal padding amount.\n * @param {number} [paddingY] - The vertical padding amount.\n */\n pad(paddingX, paddingY)\n {\n paddingX = paddingX || 0;\n paddingY = paddingY || ((paddingY !== 0) ? paddingX : 0);\n\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n }\n\n /**\n * Fits this rectangle around the passed one.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to fit.\n */\n fit(rectangle)\n {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n *\n * @param {PIXI.Rectangle} rectangle - The rectangle to include.\n */\n enlarge(rectangle)\n {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n *\n * @param {number} [resolution=1] resolution\n * @param {number} [eps=0.001] precision\n */\n ceil(resolution = 1, eps = 0.001)\n {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n }\n}\n","import { SHAPES } from '../../const';\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n *\n * @class\n * @memberof PIXI\n */\nexport default class RoundedRectangle\n{\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [width=0] - The overall width of this rounded rectangle\n * @param {number} [height=0] - The overall height of this rounded rectangle\n * @param {number} [radius=20] - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = width;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = height;\n\n /**\n * @member {number}\n * @default 20\n */\n this.radius = radius;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readonly\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RREC;\n }\n\n /**\n * Creates a clone of this Rounded Rectangle\n *\n * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle\n */\n clone()\n {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n *\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle\n */\n contains(x, y)\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius)\n || (x >= this.x + this.radius && x <= this.x + this.width - this.radius))\n {\n return true;\n }\n let dx = x - (this.x + this.radius);\n let dy = y - (this.y + this.radius);\n const radius2 = this.radius * this.radius;\n\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.width - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dy = y - (this.y + this.height - this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n }\n }\n\n return false;\n }\n}\n","import { sayHello, hex2string, hex2rgb } from '../utils';\nimport { Matrix, Rectangle } from '../math';\nimport { RENDERER_TYPE } from '../const';\nimport settings from '../settings';\nimport Container from '../display/Container';\nimport RenderTexture from '../textures/RenderTexture';\nimport EventEmitter from 'eventemitter3';\n\nconst tempMatrix = new Matrix();\n\n/**\n * The SystemRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.WebGLRenderer} which can be used for rendering a PixiJS scene.\n *\n * @abstract\n * @class\n * @extends EventEmitter\n * @memberof PIXI\n */\nexport default class SystemRenderer extends EventEmitter\n{\n // eslint-disable-next-line valid-jsdoc\n /**\n * @param {string} system - The name of the system this renderer is for.\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the screen\n * @param {number} [options.height=600] - the height of the screen\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.autoResize=false] - If the render view is automatically resized, default false\n * @param {boolean} [options.antialias=false] - sets antialias (only applicable in chrome at the moment)\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The\n * resolution of the renderer retina would be 2.\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the webgl context.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.roundPixels=false] - If true PixiJS will Math.floor() x/y values when rendering,\n * stopping pixel interpolation.\n */\n constructor(system, options, arg2, arg3)\n {\n super();\n\n sayHello(system);\n\n // Support for constructor(system, screenWidth, screenHeight, options)\n if (typeof options === 'number')\n {\n options = Object.assign({\n width: options,\n height: arg2 || settings.RENDER_OPTIONS.height,\n }, arg3);\n }\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n /**\n * The supplied constructor options.\n *\n * @member {Object}\n * @readOnly\n */\n this.options = options;\n\n /**\n * The type of the renderer.\n *\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n this.type = RENDERER_TYPE.UNKNOWN;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight)\n *\n * Its safe to use as filterArea or hitArea for whole stage\n *\n * @member {PIXI.Rectangle}\n */\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n /**\n * The canvas element that everything is drawn to\n *\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || document.createElement('canvas');\n\n /**\n * The resolution / device pixel ratio of the renderer\n *\n * @member {number}\n * @default 1\n */\n this.resolution = options.resolution || settings.RESOLUTION;\n\n /**\n * Whether the render view is transparent\n *\n * @member {boolean}\n */\n this.transparent = options.transparent;\n\n /**\n * Whether css dimensions of canvas view should be resized to screen dimensions automatically\n *\n * @member {boolean}\n */\n this.autoResize = options.autoResize || false;\n\n /**\n * Tracks the blend modes useful for this renderer.\n *\n * @member {object<string, mixed>}\n */\n this.blendModes = null;\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n *\n * @member {boolean}\n */\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example if\n * your game has a canvas filling background image you often don't need this set.\n *\n * @member {boolean}\n * @default\n */\n this.clearBeforeRender = options.clearBeforeRender;\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Handy for crisp pixel art and speed on legacy devices.\n *\n * @member {boolean}\n */\n this.roundPixels = options.roundPixels;\n\n /**\n * The background color as a number.\n *\n * @member {number}\n * @private\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B] array.\n *\n * @member {number[]}\n * @private\n */\n this._backgroundColorRgba = [0, 0, 0, 0];\n\n /**\n * The background color as a string.\n *\n * @member {string}\n * @private\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n\n /**\n * This temporary display object used as the parent of the currently being rendered item\n *\n * @member {PIXI.DisplayObject}\n * @private\n */\n this._tempDisplayObjectParent = new Container();\n\n /**\n * The last root object that the renderer tried to render.\n *\n * @member {PIXI.DisplayObject}\n * @private\n */\n this._lastObjectRendered = this._tempDisplayObjectParent;\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal\n *\n * @member {number}\n * @readonly\n * @default 800\n */\n get width()\n {\n return this.view.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical\n *\n * @member {number}\n * @readonly\n * @default 600\n */\n get height()\n {\n return this.view.height;\n }\n\n /**\n * Resizes the screen and canvas to the specified width and height\n * Canvas dimensions are multiplied by resolution\n *\n * @param {number} screenWidth - the new width of the screen\n * @param {number} screenHeight - the new height of the screen\n */\n resize(screenWidth, screenHeight)\n {\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n this.view.width = screenWidth * this.resolution;\n this.view.height = screenHeight * this.resolution;\n\n if (this.autoResize)\n {\n this.view.style.width = `${screenWidth}px`;\n this.view.style.height = `${screenHeight}px`;\n }\n }\n\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n *\n * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from\n * @param {number} scaleMode - Should be one of the scaleMode consts\n * @param {number} resolution - The resolution / device pixel ratio of the texture being generated\n * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @return {PIXI.Texture} a texture of the graphics object\n */\n generateTexture(displayObject, scaleMode, resolution, region)\n {\n region = region || displayObject.getLocalBounds();\n\n const renderTexture = RenderTexture.create(region.width | 0, region.height | 0, scaleMode, resolution);\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent);\n\n return renderTexture;\n }\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n */\n destroy(removeView)\n {\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n this.type = RENDERER_TYPE.UNKNOWN;\n\n this.view = null;\n\n this.screen = null;\n\n this.resolution = 0;\n\n this.transparent = false;\n\n this.autoResize = false;\n\n this.blendModes = null;\n\n this.options = null;\n\n this.preserveDrawingBuffer = false;\n this.clearBeforeRender = false;\n\n this.roundPixels = false;\n\n this._backgroundColor = 0;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n\n this._tempDisplayObjectParent = null;\n this._lastObjectRendered = null;\n }\n\n /**\n * The background color to fill if not transparent\n *\n * @member {number}\n */\n get backgroundColor()\n {\n return this._backgroundColor;\n }\n\n set backgroundColor(value) // eslint-disable-line require-jsdoc\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n }\n}\n","import SystemRenderer from '../SystemRenderer';\nimport CanvasMaskManager from './utils/CanvasMaskManager';\nimport CanvasRenderTarget from './utils/CanvasRenderTarget';\nimport mapCanvasBlendModesToPixi from './utils/mapCanvasBlendModesToPixi';\nimport { pluginTarget } from '../../utils';\nimport { RENDERER_TYPE, SCALE_MODES, BLEND_MODES } from '../../const';\nimport settings from '../../settings';\n\n/**\n * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should\n * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to\n * your DOM or you will not see anything :)\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.SystemRenderer\n */\nexport default class CanvasRenderer extends SystemRenderer\n{\n // eslint-disable-next-line valid-jsdoc\n /**\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the screen\n * @param {number} [options.height=600] - the height of the screen\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.autoResize=false] - If the render view is automatically resized, default false\n * @param {boolean} [options.antialias=false] - sets antialias (only applicable in chrome at the moment)\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The\n * resolution of the renderer retina would be 2.\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the webgl context.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.roundPixels=false] - If true PixiJS will Math.floor() x/y values when rendering,\n * stopping pixel interpolation.\n */\n constructor(options, arg2, arg3)\n {\n super('Canvas', options, arg2, arg3);\n\n this.type = RENDERER_TYPE.CANVAS;\n\n /**\n * The root canvas 2d context that everything is drawn with.\n *\n * @member {CanvasRenderingContext2D}\n */\n this.rootContext = this.view.getContext('2d', { alpha: this.transparent });\n\n /**\n * The currently active canvas 2d context (could change with renderTextures)\n *\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.rootContext;\n\n /**\n * Boolean flag controlling canvas refresh.\n *\n * @member {boolean}\n */\n this.refresh = true;\n\n /**\n * Instance of a CanvasMaskManager, handles masking when using the canvas renderer.\n *\n * @member {PIXI.CanvasMaskManager}\n */\n this.maskManager = new CanvasMaskManager(this);\n\n /**\n * The canvas property used to set the canvas smoothing property.\n *\n * @member {string}\n */\n this.smoothProperty = 'imageSmoothingEnabled';\n\n if (!this.rootContext.imageSmoothingEnabled)\n {\n if (this.rootContext.webkitImageSmoothingEnabled)\n {\n this.smoothProperty = 'webkitImageSmoothingEnabled';\n }\n else if (this.rootContext.mozImageSmoothingEnabled)\n {\n this.smoothProperty = 'mozImageSmoothingEnabled';\n }\n else if (this.rootContext.oImageSmoothingEnabled)\n {\n this.smoothProperty = 'oImageSmoothingEnabled';\n }\n else if (this.rootContext.msImageSmoothingEnabled)\n {\n this.smoothProperty = 'msImageSmoothingEnabled';\n }\n }\n\n this.initPlugins();\n\n this.blendModes = mapCanvasBlendModesToPixi();\n this._activeBlendMode = null;\n\n this.renderingToScreen = false;\n\n this.resize(this.options.width, this.options.height);\n\n /**\n * Fired after rendering finishes.\n *\n * @event PIXI.CanvasRenderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n *\n * @event PIXI.CanvasRenderer#prerender\n */\n }\n\n /**\n * Renders the object to this canvas view\n *\n * @param {PIXI.DisplayObject} displayObject - The object to be rendered\n * @param {PIXI.RenderTexture} [renderTexture] - A render texture to be rendered to.\n * If unset, it will render to the root context.\n * @param {boolean} [clear=false] - Whether to clear the canvas before drawing\n * @param {PIXI.Matrix} [transform] - A transformation to be applied\n * @param {boolean} [skipUpdateTransform=false] - Whether to skip the update transform\n */\n render(displayObject, renderTexture, clear, transform, skipUpdateTransform)\n {\n if (!this.view)\n {\n return;\n }\n\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.emit('prerender');\n\n const rootResolution = this.resolution;\n\n if (renderTexture)\n {\n renderTexture = renderTexture.baseTexture || renderTexture;\n\n if (!renderTexture._canvasRenderTarget)\n {\n renderTexture._canvasRenderTarget = new CanvasRenderTarget(\n renderTexture.width,\n renderTexture.height,\n renderTexture.resolution\n );\n renderTexture.source = renderTexture._canvasRenderTarget.canvas;\n renderTexture.valid = true;\n }\n\n this.context = renderTexture._canvasRenderTarget.context;\n this.resolution = renderTexture._canvasRenderTarget.resolution;\n }\n else\n {\n this.context = this.rootContext;\n }\n\n const context = this.context;\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.parent;\n const tempWt = this._tempDisplayObjectParent.transform.worldTransform;\n\n if (transform)\n {\n transform.copy(tempWt);\n\n // lets not forget to flag the parent transform as dirty...\n this._tempDisplayObjectParent.transform._worldID = -1;\n }\n else\n {\n tempWt.identity();\n }\n\n displayObject.parent = this._tempDisplayObjectParent;\n\n displayObject.updateTransform();\n displayObject.parent = cacheParent;\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n context.save();\n context.setTransform(1, 0, 0, 1, 0, 0);\n context.globalAlpha = 1;\n this._activeBlendMode = BLEND_MODES.NORMAL;\n context.globalCompositeOperation = this.blendModes[BLEND_MODES.NORMAL];\n\n if (navigator.isCocoonJS && this.view.screencanvas)\n {\n context.fillStyle = 'black';\n context.clear();\n }\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n if (this.renderingToScreen)\n {\n if (this.transparent)\n {\n context.clearRect(0, 0, this.width, this.height);\n }\n else\n {\n context.fillStyle = this._backgroundColorString;\n context.fillRect(0, 0, this.width, this.height);\n }\n } // else {\n // TODO: implement background for CanvasRenderTarget or RenderTexture?\n // }\n }\n\n // TODO RENDER TARGET STUFF HERE..\n const tempContext = this.context;\n\n this.context = context;\n displayObject.renderCanvas(this);\n this.context = tempContext;\n\n context.restore();\n\n this.resolution = rootResolution;\n\n this.emit('postrender');\n }\n\n /**\n * Clear the canvas of renderer.\n *\n * @param {string} [clearColor] - Clear the canvas with this color, except the canvas is transparent.\n */\n clear(clearColor)\n {\n const context = this.context;\n\n clearColor = clearColor || this._backgroundColorString;\n\n if (!this.transparent && clearColor)\n {\n context.fillStyle = clearColor;\n context.fillRect(0, 0, this.width, this.height);\n }\n else\n {\n context.clearRect(0, 0, this.width, this.height);\n }\n }\n\n /**\n * Sets the blend mode of the renderer.\n *\n * @param {number} blendMode - See {@link PIXI.BLEND_MODES} for valid values.\n */\n setBlendMode(blendMode)\n {\n if (this._activeBlendMode === blendMode)\n {\n return;\n }\n\n this._activeBlendMode = blendMode;\n this.context.globalCompositeOperation = this.blendModes[blendMode];\n }\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n */\n destroy(removeView)\n {\n this.destroyPlugins();\n\n // call the base destroy\n super.destroy(removeView);\n\n this.context = null;\n\n this.refresh = true;\n\n this.maskManager.destroy();\n this.maskManager = null;\n\n this.smoothProperty = null;\n }\n\n /**\n * Resizes the canvas view to the specified width and height.\n *\n * @extends PIXI.SystemRenderer#resize\n *\n * @param {number} screenWidth - the new width of the screen\n * @param {number} screenHeight - the new height of the screen\n */\n resize(screenWidth, screenHeight)\n {\n super.resize(screenWidth, screenHeight);\n\n // reset the scale mode.. oddly this seems to be reset when the canvas is resized.\n // surely a browser bug?? Let PixiJS fix that for you..\n if (this.smoothProperty)\n {\n this.rootContext[this.smoothProperty] = (settings.SCALE_MODE === SCALE_MODES.LINEAR);\n }\n }\n\n /**\n * Checks if blend mode has changed.\n */\n invalidateBlendMode()\n {\n this._activeBlendMode = this.blendModes.indexOf(this.context.globalCompositeOperation);\n }\n}\n\n/**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @name PIXI.CanvasRenderer#plugins\n * @type {object}\n * @readonly\n * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.extract.CanvasExtract} extract Extract image data from renderer.\n * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.prepare.CanvasPrepare} prepare Pre-render display objects.\n */\n\n/**\n * Adds a plugin to the renderer.\n *\n * @method PIXI.CanvasRenderer#registerPlugin\n * @param {string} pluginName - The name of the plugin.\n * @param {Function} ctor - The constructor function or class for the plugin.\n */\n\npluginTarget.mixin(CanvasRenderer);\n","import { SHAPES } from '../../../const';\n\n/**\n * A set of functions used to handle masking.\n *\n * @class\n * @memberof PIXI\n */\nexport default class CanvasMaskManager\n{\n /**\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\n constructor(renderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * This method adds it to the current stack of masks.\n *\n * @param {object} maskData - the maskData that will be pushed\n */\n pushMask(maskData)\n {\n const renderer = this.renderer;\n\n renderer.context.save();\n\n const cacheAlpha = maskData.alpha;\n const transform = maskData.transform.worldTransform;\n const resolution = renderer.resolution;\n\n renderer.context.setTransform(\n transform.a * resolution,\n transform.b * resolution,\n transform.c * resolution,\n transform.d * resolution,\n transform.tx * resolution,\n transform.ty * resolution\n );\n\n // TODO suport sprite alpha masks??\n // lots of effort required. If demand is great enough..\n if (!maskData._texture)\n {\n this.renderGraphicsShape(maskData);\n renderer.context.clip();\n }\n\n maskData.worldAlpha = cacheAlpha;\n }\n\n /**\n * Renders a PIXI.Graphics shape.\n *\n * @param {PIXI.Graphics} graphics - The object to render.\n */\n renderGraphicsShape(graphics)\n {\n const context = this.renderer.context;\n const len = graphics.graphicsData.length;\n\n if (len === 0)\n {\n return;\n }\n\n context.beginPath();\n\n for (let i = 0; i < len; i++)\n {\n const data = graphics.graphicsData[i];\n const shape = data.shape;\n\n if (data.type === SHAPES.POLY)\n {\n let points = shape.points;\n const holes = data.holes;\n let outerArea;\n let innerArea;\n\n context.moveTo(points[0], points[1]);\n\n for (let j = 2; j < points.length; j += 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n\n // if the first and last point are the same close the path - much neater :)\n if (points[0] === points[points.length - 2] && points[1] === points[points.length - 1])\n {\n context.closePath();\n }\n\n if (holes.length > 0)\n {\n outerArea = 0;\n for (let j = 0; j < points.length; j += 2)\n {\n outerArea += (points[j] * points[j + 3]) - (points[j + 1] * points[j + 2]);\n }\n\n for (let k = 0; k < holes.length; k++)\n {\n points = holes[k].points;\n\n innerArea = 0;\n for (let j = 0; j < points.length; j += 2)\n {\n innerArea += (points[j] * points[j + 3]) - (points[j + 1] * points[j + 2]);\n }\n\n context.moveTo(points[0], points[1]);\n\n if (innerArea * outerArea < 0)\n {\n for (let j = 2; j < points.length; j += 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n }\n else\n {\n for (let j = points.length - 2; j >= 2; j -= 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n }\n }\n }\n }\n else if (data.type === SHAPES.RECT)\n {\n context.rect(shape.x, shape.y, shape.width, shape.height);\n context.closePath();\n }\n else if (data.type === SHAPES.CIRC)\n {\n // TODO - need to be Undefined!\n context.arc(shape.x, shape.y, shape.radius, 0, 2 * Math.PI);\n context.closePath();\n }\n else if (data.type === SHAPES.ELIP)\n {\n // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas\n\n const w = shape.width * 2;\n const h = shape.height * 2;\n\n const x = shape.x - (w / 2);\n const y = shape.y - (h / 2);\n\n const kappa = 0.5522848;\n const ox = (w / 2) * kappa; // control point offset horizontal\n const oy = (h / 2) * kappa; // control point offset vertical\n const xe = x + w; // x-end\n const ye = y + h; // y-end\n const xm = x + (w / 2); // x-middle\n const ym = y + (h / 2); // y-middle\n\n context.moveTo(x, ym);\n context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);\n context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);\n context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);\n context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);\n context.closePath();\n }\n else if (data.type === SHAPES.RREC)\n {\n const rx = shape.x;\n const ry = shape.y;\n const width = shape.width;\n const height = shape.height;\n let radius = shape.radius;\n\n const maxRadius = Math.min(width, height) / 2 | 0;\n\n radius = radius > maxRadius ? maxRadius : radius;\n\n context.moveTo(rx, ry + radius);\n context.lineTo(rx, ry + height - radius);\n context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height);\n context.lineTo(rx + width - radius, ry + height);\n context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius);\n context.lineTo(rx + width, ry + radius);\n context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry);\n context.lineTo(rx + radius, ry);\n context.quadraticCurveTo(rx, ry, rx, ry + radius);\n context.closePath();\n }\n }\n }\n\n /**\n * Restores the current drawing context to the state it was before the mask was applied.\n *\n * @param {PIXI.CanvasRenderer} renderer - The renderer context to use.\n */\n popMask(renderer)\n {\n renderer.context.restore();\n renderer.invalidateBlendMode();\n }\n\n /**\n * Destroys this canvas mask manager.\n *\n */\n destroy()\n {\n /* empty */\n }\n}\n","import settings from '../../../settings';\n\n/**\n * Creates a Canvas element of the given size.\n *\n * @class\n * @memberof PIXI\n */\nexport default class CanvasRenderTarget\n{\n /**\n * @param {number} width - the width for the newly created canvas\n * @param {number} height - the height for the newly created canvas\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the canvas\n */\n constructor(width, height, resolution)\n {\n /**\n * The Canvas object that belongs to this CanvasRenderTarget.\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = document.createElement('canvas');\n\n /**\n * A CanvasRenderingContext2D object representing a two-dimensional rendering context.\n *\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n }\n\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n *\n * @private\n */\n clear()\n {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n\n /**\n * Resizes the canvas to the specified width and height.\n *\n * @param {number} width - the new width of the canvas\n * @param {number} height - the new height of the canvas\n */\n resize(width, height)\n {\n this.canvas.width = width * this.resolution;\n this.canvas.height = height * this.resolution;\n }\n\n /**\n * Destroys this canvas.\n *\n */\n destroy()\n {\n this.context = null;\n this.canvas = null;\n }\n\n /**\n * The width of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get width()\n {\n return this.canvas.width;\n }\n\n set width(val) // eslint-disable-line require-jsdoc\n {\n this.canvas.width = val;\n }\n\n /**\n * The height of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get height()\n {\n return this.canvas.height;\n }\n\n set height(val) // eslint-disable-line require-jsdoc\n {\n this.canvas.height = val;\n }\n}\n","/**\n * Creates a little colored canvas\n *\n * @ignore\n * @param {string} color - The color to make the canvas\n * @return {canvas} a small canvas element\n */\nfunction createColoredCanvas(color)\n{\n const canvas = document.createElement('canvas');\n\n canvas.width = 6;\n canvas.height = 1;\n\n const context = canvas.getContext('2d');\n\n context.fillStyle = color;\n context.fillRect(0, 0, 6, 1);\n\n return canvas;\n}\n\n/**\n * Checks whether the Canvas BlendModes are supported by the current browser\n *\n * @return {boolean} whether they are supported\n */\nexport default function canUseNewCanvasBlendModes()\n{\n if (typeof document === 'undefined')\n {\n return false;\n }\n\n const magenta = createColoredCanvas('#ff00ff');\n const yellow = createColoredCanvas('#ffff00');\n\n const canvas = document.createElement('canvas');\n\n canvas.width = 6;\n canvas.height = 1;\n\n const context = canvas.getContext('2d');\n\n context.globalCompositeOperation = 'multiply';\n context.drawImage(magenta, 0, 0);\n context.drawImage(yellow, 2, 0);\n\n const imageData = context.getImageData(2, 0, 1, 1);\n\n if (!imageData)\n {\n return false;\n }\n\n const data = imageData.data;\n\n return (data[0] === 255 && data[1] === 0 && data[2] === 0);\n}\n","import { BLEND_MODES } from '../../../const';\nimport canUseNewCanvasBlendModes from './canUseNewCanvasBlendModes';\n\n/**\n * Maps blend combinations to Canvas.\n *\n * @memberof PIXI\n * @function mapCanvasBlendModesToPixi\n * @private\n * @param {string[]} [array=[]] - The array to output into.\n * @return {string[]} Mapped modes.\n */\nexport default function mapCanvasBlendModesToPixi(array = [])\n{\n if (canUseNewCanvasBlendModes())\n {\n array[BLEND_MODES.NORMAL] = 'source-over';\n array[BLEND_MODES.ADD] = 'lighter'; // IS THIS OK???\n array[BLEND_MODES.MULTIPLY] = 'multiply';\n array[BLEND_MODES.SCREEN] = 'screen';\n array[BLEND_MODES.OVERLAY] = 'overlay';\n array[BLEND_MODES.DARKEN] = 'darken';\n array[BLEND_MODES.LIGHTEN] = 'lighten';\n array[BLEND_MODES.COLOR_DODGE] = 'color-dodge';\n array[BLEND_MODES.COLOR_BURN] = 'color-burn';\n array[BLEND_MODES.HARD_LIGHT] = 'hard-light';\n array[BLEND_MODES.SOFT_LIGHT] = 'soft-light';\n array[BLEND_MODES.DIFFERENCE] = 'difference';\n array[BLEND_MODES.EXCLUSION] = 'exclusion';\n array[BLEND_MODES.HUE] = 'hue';\n array[BLEND_MODES.SATURATION] = 'saturate';\n array[BLEND_MODES.COLOR] = 'color';\n array[BLEND_MODES.LUMINOSITY] = 'luminosity';\n }\n else\n {\n // this means that the browser does not support the cool new blend modes in canvas 'cough' ie 'cough'\n array[BLEND_MODES.NORMAL] = 'source-over';\n array[BLEND_MODES.ADD] = 'lighter'; // IS THIS OK???\n array[BLEND_MODES.MULTIPLY] = 'source-over';\n array[BLEND_MODES.SCREEN] = 'source-over';\n array[BLEND_MODES.OVERLAY] = 'source-over';\n array[BLEND_MODES.DARKEN] = 'source-over';\n array[BLEND_MODES.LIGHTEN] = 'source-over';\n array[BLEND_MODES.COLOR_DODGE] = 'source-over';\n array[BLEND_MODES.COLOR_BURN] = 'source-over';\n array[BLEND_MODES.HARD_LIGHT] = 'source-over';\n array[BLEND_MODES.SOFT_LIGHT] = 'source-over';\n array[BLEND_MODES.DIFFERENCE] = 'source-over';\n array[BLEND_MODES.EXCLUSION] = 'source-over';\n array[BLEND_MODES.HUE] = 'source-over';\n array[BLEND_MODES.SATURATION] = 'source-over';\n array[BLEND_MODES.COLOR] = 'source-over';\n array[BLEND_MODES.LUMINOSITY] = 'source-over';\n }\n // not-premultiplied, only for webgl\n array[BLEND_MODES.NORMAL_NPM] = array[BLEND_MODES.NORMAL];\n array[BLEND_MODES.ADD_NPM] = array[BLEND_MODES.ADD];\n array[BLEND_MODES.SCREEN_NPM] = array[BLEND_MODES.SCREEN];\n\n return array;\n}\n","import { GC_MODES } from '../../const';\nimport settings from '../../settings';\n\n/**\n * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged\n * up with textures that are no longer being used.\n *\n * @class\n * @memberof PIXI\n */\nexport default class TextureGarbageCollector\n{\n /**\n * @param {PIXI.WebGLRenderer} renderer - The renderer this manager works for.\n */\n constructor(renderer)\n {\n this.renderer = renderer;\n\n this.count = 0;\n this.checkCount = 0;\n this.maxIdle = settings.GC_MAX_IDLE;\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n this.mode = settings.GC_MODE;\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n update()\n {\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n run()\n {\n const tm = this.renderer.textureManager;\n const managedTextures = tm._managedTextures;\n let wasRemoved = false;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n const texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!texture._glRenderTargets && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n let j = 0;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n if (managedTextures[i] !== null)\n {\n managedTextures[j++] = managedTextures[i];\n }\n }\n\n managedTextures.length = j;\n }\n }\n\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n *\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject)\n {\n const tm = this.renderer.textureManager;\n\n // only destroy non generated textures\n if (displayObject._texture && displayObject._texture._glRenderTargets)\n {\n tm.destroyTexture(displayObject._texture, true);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n}\n","import { GLTexture } from 'pixi-gl-core';\nimport { WRAP_MODES, SCALE_MODES } from '../../const';\nimport RenderTarget from './utils/RenderTarget';\nimport { removeItems } from '../../utils';\n\n/**\n * Helper class to create a webGL Texture\n *\n * @class\n * @memberof PIXI\n */\nexport default class TextureManager\n{\n /**\n * @param {PIXI.WebGLRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer)\n {\n /**\n * A reference to the current renderer\n *\n * @member {PIXI.WebGLRenderer}\n */\n this.renderer = renderer;\n\n /**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = renderer.gl;\n\n /**\n * Track textures in the renderer so we can no longer listen to them on destruction.\n *\n * @member {Array<*>}\n * @private\n */\n this._managedTextures = [];\n }\n\n /**\n * Binds a texture.\n *\n */\n bindTexture()\n {\n // empty\n }\n\n /**\n * Gets a texture.\n *\n */\n getTexture()\n {\n // empty\n }\n\n /**\n * Updates and/or Creates a WebGL texture for the renderer's context.\n *\n * @param {PIXI.BaseTexture|PIXI.Texture} texture - the texture to update\n * @param {number} location - the location the texture will be bound to.\n * @return {GLTexture} The gl texture.\n */\n updateTexture(texture, location)\n {\n // assume it good!\n // texture = texture.baseTexture || texture;\n\n const gl = this.gl;\n\n const isRenderTexture = !!texture._glRenderTargets;\n\n if (!texture.hasLoaded)\n {\n return null;\n }\n\n const boundTextures = this.renderer.boundTextures;\n\n // if the location is undefined then this may have been called by n event.\n // this being the case the texture may already be bound to a slot. As a texture can only be bound once\n // we need to find its current location if it exists.\n if (location === undefined)\n {\n location = 0;\n\n // TODO maybe we can use texture bound ids later on...\n // check if texture is already bound..\n for (let i = 0; i < boundTextures.length; ++i)\n {\n if (boundTextures[i] === texture)\n {\n location = i;\n break;\n }\n }\n }\n\n boundTextures[location] = texture;\n\n gl.activeTexture(gl.TEXTURE0 + location);\n\n let glTexture = texture._glTextures[this.renderer.CONTEXT_UID];\n\n if (!glTexture)\n {\n if (isRenderTexture)\n {\n const renderTarget = new RenderTarget(\n this.gl,\n texture.width,\n texture.height,\n texture.scaleMode,\n texture.resolution\n );\n\n renderTarget.resize(texture.width, texture.height);\n texture._glRenderTargets[this.renderer.CONTEXT_UID] = renderTarget;\n glTexture = renderTarget.texture;\n\n // framebuffer constructor disactivates current framebuffer\n if (!this.renderer._activeRenderTarget.root)\n {\n this.renderer._activeRenderTarget.frameBuffer.bind();\n }\n }\n else\n {\n glTexture = new GLTexture(this.gl, null, null, null, null);\n glTexture.bind(location);\n glTexture.premultiplyAlpha = true;\n glTexture.upload(texture.source);\n }\n\n texture._glTextures[this.renderer.CONTEXT_UID] = glTexture;\n\n texture.on('update', this.updateTexture, this);\n texture.on('dispose', this.destroyTexture, this);\n\n this._managedTextures.push(texture);\n\n if (texture.isPowerOfTwo)\n {\n if (texture.mipmap)\n {\n glTexture.enableMipmap();\n }\n\n if (texture.wrapMode === WRAP_MODES.CLAMP)\n {\n glTexture.enableWrapClamp();\n }\n else if (texture.wrapMode === WRAP_MODES.REPEAT)\n {\n glTexture.enableWrapRepeat();\n }\n else\n {\n glTexture.enableWrapMirrorRepeat();\n }\n }\n else\n {\n glTexture.enableWrapClamp();\n }\n\n if (texture.scaleMode === SCALE_MODES.NEAREST)\n {\n glTexture.enableNearestScaling();\n }\n else\n {\n glTexture.enableLinearScaling();\n }\n }\n // the texture already exists so we only need to update it..\n else if (isRenderTexture)\n {\n texture._glRenderTargets[this.renderer.CONTEXT_UID].resize(texture.width, texture.height);\n }\n else\n {\n glTexture.upload(texture.source);\n }\n\n return glTexture;\n }\n\n /**\n * Deletes the texture from WebGL\n *\n * @param {PIXI.BaseTexture|PIXI.Texture} texture - the texture to destroy\n * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture, skipRemove)\n {\n texture = texture.baseTexture || texture;\n\n if (!texture.hasLoaded)\n {\n return;\n }\n\n const renderer = this.renderer;\n const uid = renderer.CONTEXT_UID;\n const glTextures = texture._glTextures;\n const glRenderTargets = texture._glRenderTargets;\n\n if (glTextures[uid])\n {\n renderer.unbindTexture(texture);\n\n glTextures[uid].destroy();\n texture.off('update', this.updateTexture, this);\n texture.off('dispose', this.destroyTexture, this);\n\n delete glTextures[uid];\n\n if (!skipRemove)\n {\n const i = this._managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this._managedTextures, i, 1);\n }\n }\n }\n\n if (glRenderTargets && glRenderTargets[uid])\n {\n if (renderer._activeRenderTarget === glRenderTargets[uid])\n {\n renderer.bindRenderTarget(renderer.rootRenderTarget);\n }\n\n glRenderTargets[uid].destroy();\n delete glRenderTargets[uid];\n }\n }\n\n /**\n * Deletes all the textures from WebGL\n */\n removeAll()\n {\n // empty all the old gl textures as they are useless now\n for (let i = 0; i < this._managedTextures.length; ++i)\n {\n const texture = this._managedTextures[i];\n\n if (texture._glTextures[this.renderer.CONTEXT_UID])\n {\n delete texture._glTextures[this.renderer.CONTEXT_UID];\n }\n }\n }\n\n /**\n * Destroys this manager and removes all its textures\n */\n destroy()\n {\n // destroy managed textures\n for (let i = 0; i < this._managedTextures.length; ++i)\n {\n const texture = this._managedTextures[i];\n\n this.destroyTexture(texture, true);\n\n texture.off('update', this.updateTexture, this);\n texture.off('dispose', this.destroyTexture, this);\n }\n\n this._managedTextures = null;\n }\n}\n","import SystemRenderer from '../SystemRenderer';\nimport MaskManager from './managers/MaskManager';\nimport StencilManager from './managers/StencilManager';\nimport FilterManager from './managers/FilterManager';\nimport RenderTarget from './utils/RenderTarget';\nimport ObjectRenderer from './utils/ObjectRenderer';\nimport TextureManager from './TextureManager';\nimport BaseTexture from '../../textures/BaseTexture';\nimport TextureGarbageCollector from './TextureGarbageCollector';\nimport WebGLState from './WebGLState';\nimport mapWebGLDrawModesToPixi from './utils/mapWebGLDrawModesToPixi';\nimport validateContext from './utils/validateContext';\nimport { pluginTarget } from '../../utils';\nimport glCore from 'pixi-gl-core';\nimport { RENDERER_TYPE } from '../../const';\n\nlet CONTEXT_UID = 0;\n\n/**\n * The WebGLRenderer draws the scene and all its content onto a webGL enabled canvas. This renderer\n * should be used for browsers that support webGL. This Render works by automatically managing webGLBatchs.\n * So no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything :)\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.SystemRenderer\n */\nexport default class WebGLRenderer extends SystemRenderer\n{\n // eslint-disable-next-line valid-jsdoc\n /**\n *\n * @param {object} [options] - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the screen\n * @param {number} [options.height=600] - the height of the screen\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.transparent=false] - If the render view is transparent, default false\n * @param {boolean} [options.autoResize=false] - If the render view is automatically resized, default false\n * @param {boolean} [options.antialias=false] - sets antialias. If not available natively then FXAA\n * antialiasing is used\n * @param {boolean} [options.forceFXAA=false] - forces FXAA antialiasing to be used over native.\n * FXAA is faster, but may not always look as great\n * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer.\n * The resolution of the renderer retina would be 2.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear\n * the canvas or not before the new render pass. If you wish to set this to false, you *must* set\n * preserveDrawingBuffer to `true`.\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the webgl context.\n * @param {boolean} [options.roundPixels=false] - If true PixiJS will Math.floor() x/y values when\n * rendering, stopping pixel interpolation.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {boolean} [options.legacy=false] - If true PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering try setting this to true.\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card\n */\n constructor(options, arg2, arg3)\n {\n super('WebGL', options, arg2, arg3);\n\n this.legacy = this.options.legacy;\n\n if (this.legacy)\n {\n glCore.VertexArrayObject.FORCE_NATIVE = true;\n }\n\n /**\n * The type of this renderer as a standardised const\n *\n * @member {number}\n * @see PIXI.RENDERER_TYPE\n */\n this.type = RENDERER_TYPE.WEBGL;\n\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n this.view.addEventListener('webglcontextlost', this.handleContextLost, false);\n this.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n\n /**\n * The options passed in to create a new webgl context.\n *\n * @member {object}\n * @private\n */\n this._contextOptions = {\n alpha: this.transparent,\n antialias: this.options.antialias,\n premultipliedAlpha: this.transparent && this.transparent !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: this.options.preserveDrawingBuffer,\n powerPreference: this.options.powerPreference,\n };\n\n this._backgroundColorRgba[3] = this.transparent ? 0 : 1;\n\n /**\n * Manages the masks using the stencil buffer.\n *\n * @member {PIXI.MaskManager}\n */\n this.maskManager = new MaskManager(this);\n\n /**\n * Manages the stencil buffer.\n *\n * @member {PIXI.StencilManager}\n */\n this.stencilManager = new StencilManager(this);\n\n /**\n * An empty renderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n this.emptyRenderer = new ObjectRenderer(this);\n\n /**\n * The currently active ObjectRenderer.\n *\n * @member {PIXI.ObjectRenderer}\n */\n this.currentRenderer = this.emptyRenderer;\n\n /**\n * Manages textures\n * @member {PIXI.TextureManager}\n */\n this.textureManager = null;\n\n /**\n * Manages the filters.\n *\n * @member {PIXI.FilterManager}\n */\n this.filterManager = null;\n\n this.initPlugins();\n\n /**\n * The current WebGL rendering context, it is created here\n *\n * @member {WebGLRenderingContext}\n */\n // initialize the context so it is ready for the managers.\n if (this.options.context)\n {\n // checks to see if a context is valid..\n validateContext(this.options.context);\n }\n\n this.gl = this.options.context || glCore.createContext(this.view, this._contextOptions);\n\n this.CONTEXT_UID = CONTEXT_UID++;\n\n /**\n * The currently active ObjectRenderer.\n *\n * @member {PIXI.WebGLState}\n */\n this.state = new WebGLState(this.gl);\n\n this.renderingToScreen = true;\n\n /**\n * Holds the current state of textures bound to the GPU.\n * @type {Array}\n */\n this.boundTextures = null;\n\n /**\n * Holds the current shader\n *\n * @member {PIXI.Shader}\n */\n this._activeShader = null;\n\n this._activeVao = null;\n\n /**\n * Holds the current render target\n *\n * @member {PIXI.RenderTarget}\n */\n this._activeRenderTarget = null;\n\n this._initContext();\n\n // map some webGL blend and drawmodes..\n this.drawModes = mapWebGLDrawModesToPixi(this.gl);\n\n this._nextTextureLocation = 0;\n\n this.setBlendMode(0);\n\n /**\n * Fired after rendering finishes.\n *\n * @event PIXI.WebGLRenderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n *\n * @event PIXI.WebGLRenderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n *\n * @event PIXI.WebGLRenderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n }\n\n /**\n * Creates the WebGL context\n *\n * @private\n */\n _initContext()\n {\n const gl = this.gl;\n\n // restore a context if it was previously lost\n if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context'))\n {\n gl.getExtension('WEBGL_lose_context').restoreContext();\n }\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this._activeShader = null;\n this._activeVao = null;\n\n this.boundTextures = new Array(maxTextures);\n this.emptyTextures = new Array(maxTextures);\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @member {boolean}\n * @private\n */\n this._unknownBoundTextures = false;\n\n // create a texture manager...\n this.textureManager = new TextureManager(this);\n this.filterManager = new FilterManager(this);\n this.textureGC = new TextureGarbageCollector(this);\n\n this.state.resetToDefault();\n\n this.rootRenderTarget = new RenderTarget(gl, this.width, this.height, null, this.resolution, true);\n this.rootRenderTarget.clearColor = this._backgroundColorRgba;\n\n this.bindRenderTarget(this.rootRenderTarget);\n\n // now lets fill up the textures with empty ones!\n const emptyGLTexture = new glCore.GLTexture.fromData(gl, null, 1, 1);\n\n const tempObj = { _glTextures: {} };\n\n tempObj._glTextures[this.CONTEXT_UID] = {};\n\n for (let i = 0; i < maxTextures; i++)\n {\n const empty = new BaseTexture();\n\n empty._glTextures[this.CONTEXT_UID] = emptyGLTexture;\n\n this.boundTextures[i] = tempObj;\n this.emptyTextures[i] = empty;\n this.bindTexture(null, i);\n }\n\n this.emit('context', gl);\n\n // setup the width/height properties and gl viewport\n this.resize(this.screen.width, this.screen.height);\n }\n\n /**\n * Renders the object to its webGL view\n *\n * @param {PIXI.DisplayObject} displayObject - the object to be rendered\n * @param {PIXI.RenderTexture} renderTexture - The render texture to render to.\n * @param {boolean} [clear] - Should the canvas be cleared before the new render\n * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [skipUpdateTransform] - Should we skip the update transform pass?\n */\n render(displayObject, renderTexture, clear, transform, skipUpdateTransform)\n {\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.emit('prerender');\n\n // no point rendering if our context has been blown up!\n if (!this.gl || this.gl.isContextLost())\n {\n return;\n }\n\n this._nextTextureLocation = 0;\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.parent;\n\n displayObject.parent = this._tempDisplayObjectParent;\n displayObject.updateTransform();\n displayObject.parent = cacheParent;\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.bindRenderTexture(renderTexture, transform);\n\n this.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this._activeRenderTarget.clear();\n }\n\n displayObject.renderWebGL(this);\n\n // apply transform..\n this.currentRenderer.flush();\n\n // this.setObjectRenderer(this.emptyRenderer);\n\n this.textureGC.update();\n\n this.emit('postrender');\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n *\n * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer)\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n this.currentRenderer.start();\n }\n\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n *\n */\n flush()\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Resizes the webGL view to the specified width and height.\n *\n * @param {number} screenWidth - the new width of the screen\n * @param {number} screenHeight - the new height of the screen\n */\n resize(screenWidth, screenHeight)\n {\n // if(width * this.resolution === this.width && height * this.resolution === this.height)return;\n\n SystemRenderer.prototype.resize.call(this, screenWidth, screenHeight);\n\n this.rootRenderTarget.resize(screenWidth, screenHeight);\n\n if (this._activeRenderTarget === this.rootRenderTarget)\n {\n this.rootRenderTarget.activate();\n\n if (this._activeShader)\n {\n this._activeShader.uniforms.projectionMatrix = this.rootRenderTarget.projectionMatrix.toArray(true);\n }\n }\n }\n\n /**\n * Resizes the webGL view to the specified width and height.\n *\n * @param {number} blendMode - the desired blend mode\n */\n setBlendMode(blendMode)\n {\n this.state.setBlendMode(blendMode);\n }\n\n /**\n * Erases the active render target and fills the drawing area with a colour\n *\n * @param {number} [clearColor] - The colour\n */\n clear(clearColor)\n {\n this._activeRenderTarget.clear(clearColor);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix\n *\n * @param {PIXI.Matrix} matrix - The transformation matrix\n */\n setTransform(matrix)\n {\n this._activeRenderTarget.transform = matrix;\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour\n *\n * @param {PIXI.RenderTexture} renderTexture - The render texture to clear\n * @param {number} [clearColor] - The colour\n * @return {PIXI.WebGLRenderer} Returns itself.\n */\n clearRenderTexture(renderTexture, clearColor)\n {\n const baseTexture = renderTexture.baseTexture;\n const renderTarget = baseTexture._glRenderTargets[this.CONTEXT_UID];\n\n if (renderTarget)\n {\n renderTarget.clear(clearColor);\n }\n\n return this;\n }\n\n /**\n * Binds a render texture for rendering\n *\n * @param {PIXI.RenderTexture} renderTexture - The render texture to render\n * @param {PIXI.Matrix} transform - The transform to be applied to the render texture\n * @return {PIXI.WebGLRenderer} Returns itself.\n */\n bindRenderTexture(renderTexture, transform)\n {\n let renderTarget;\n\n if (renderTexture)\n {\n const baseTexture = renderTexture.baseTexture;\n\n if (!baseTexture._glRenderTargets[this.CONTEXT_UID])\n {\n // bind the current texture\n this.textureManager.updateTexture(baseTexture, 0);\n }\n\n this.unbindTexture(baseTexture);\n\n renderTarget = baseTexture._glRenderTargets[this.CONTEXT_UID];\n renderTarget.setFrame(renderTexture.frame);\n }\n else\n {\n renderTarget = this.rootRenderTarget;\n }\n\n renderTarget.transform = transform;\n this.bindRenderTarget(renderTarget);\n\n return this;\n }\n\n /**\n * Changes the current render target to the one given in parameter\n *\n * @param {PIXI.RenderTarget} renderTarget - the new render target\n * @return {PIXI.WebGLRenderer} Returns itself.\n */\n bindRenderTarget(renderTarget)\n {\n if (renderTarget !== this._activeRenderTarget)\n {\n this._activeRenderTarget = renderTarget;\n renderTarget.activate();\n\n if (this._activeShader)\n {\n this._activeShader.uniforms.projectionMatrix = renderTarget.projectionMatrix.toArray(true);\n }\n\n this.stencilManager.setMaskStack(renderTarget.stencilMaskStack);\n }\n\n return this;\n }\n\n /**\n * Changes the current shader to the one given in parameter\n *\n * @param {PIXI.Shader} shader - the new shader\n * @param {boolean} [autoProject=true] - Whether automatically set the projection matrix\n * @return {PIXI.WebGLRenderer} Returns itself.\n */\n bindShader(shader, autoProject)\n {\n // TODO cache\n if (this._activeShader !== shader)\n {\n this._activeShader = shader;\n shader.bind();\n\n // `autoProject` normally would be a default parameter set to true\n // but because of how Babel transpiles default parameters\n // it hinders the performance of this method.\n if (autoProject !== false)\n {\n // automatically set the projection matrix\n shader.uniforms.projectionMatrix = this._activeRenderTarget.projectionMatrix.toArray(true);\n }\n }\n\n return this;\n }\n\n /**\n * Binds the texture. This will return the location of the bound texture.\n * It may not be the same as the one you pass in. This is due to optimisation that prevents\n * needless binding of textures. For example if the texture is already bound it will return the\n * current location of the texture instead of the one provided. To bypass this use force location\n *\n * @param {PIXI.Texture} texture - the new texture\n * @param {number} location - the suggested texture location\n * @param {boolean} forceLocation - force the location\n * @return {number} bound texture location\n */\n bindTexture(texture, location, forceLocation)\n {\n texture = texture || this.emptyTextures[location];\n texture = texture.baseTexture || texture;\n texture.touched = this.textureGC.count;\n\n if (!forceLocation)\n {\n // TODO - maybe look into adding boundIds.. save us the loop?\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n if (this.boundTextures[i] === texture)\n {\n return i;\n }\n }\n\n if (location === undefined)\n {\n this._nextTextureLocation++;\n this._nextTextureLocation %= this.boundTextures.length;\n location = this.boundTextures.length - this._nextTextureLocation - 1;\n }\n }\n else\n {\n location = location || 0;\n }\n\n const gl = this.gl;\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n // this will also bind the texture..\n this.textureManager.updateTexture(texture, location);\n }\n else\n {\n // bind the current texture\n this.boundTextures[location] = texture;\n gl.activeTexture(gl.TEXTURE0 + location);\n gl.bindTexture(gl.TEXTURE_2D, glTexture.texture);\n }\n\n return location;\n }\n\n /**\n * unbinds the texture ...\n *\n * @param {PIXI.Texture} texture - the texture to unbind\n * @return {PIXI.WebGLRenderer} Returns itself.\n */\n unbindTexture(texture)\n {\n const gl = this.gl;\n\n texture = texture.baseTexture || texture;\n\n if (this._unknownBoundTextures)\n {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multitexture renderer samplers\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n if (this.boundTextures[i] === this.emptyTextures[i])\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[i]._glTextures[this.CONTEXT_UID].texture);\n }\n }\n }\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n if (this.boundTextures[i] === texture)\n {\n this.boundTextures[i] = this.emptyTextures[i];\n\n gl.activeTexture(gl.TEXTURE0 + i);\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[i]._glTextures[this.CONTEXT_UID].texture);\n }\n }\n\n return this;\n }\n\n /**\n * Creates a new VAO from this renderer's context and state.\n *\n * @return {VertexArrayObject} The new VAO.\n */\n createVao()\n {\n return new glCore.VertexArrayObject(this.gl, this.state.attribState);\n }\n\n /**\n * Changes the current Vao to the one given in parameter\n *\n * @param {PIXI.VertexArrayObject} vao - the new Vao\n * @return {PIXI.WebGLRenderer} Returns itself.\n */\n bindVao(vao)\n {\n if (this._activeVao === vao)\n {\n return this;\n }\n\n if (vao)\n {\n vao.bind();\n }\n else if (this._activeVao)\n {\n // TODO this should always be true i think?\n this._activeVao.unbind();\n }\n\n this._activeVao = vao;\n\n return this;\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n *\n * @return {PIXI.WebGLRenderer} Returns itself.\n */\n reset()\n {\n this.setObjectRenderer(this.emptyRenderer);\n\n this.bindVao(null);\n this._activeShader = null;\n this._activeRenderTarget = this.rootRenderTarget;\n\n this._unknownBoundTextures = true;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.emptyTextures[i];\n }\n\n // bind the main frame buffer (the screen);\n this.rootRenderTarget.activate();\n\n this.state.resetToDefault();\n\n return this;\n }\n\n /**\n * Handles a lost webgl context\n *\n * @private\n * @param {WebGLContextEvent} event - The context lost event.\n */\n handleContextLost(event)\n {\n event.preventDefault();\n }\n\n /**\n * Handles a restored webgl context\n *\n * @private\n */\n handleContextRestored()\n {\n this.textureManager.removeAll();\n this.filterManager.destroy(true);\n this._initContext();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n destroy(removeView)\n {\n this.destroyPlugins();\n\n // remove listeners\n this.view.removeEventListener('webglcontextlost', this.handleContextLost);\n this.view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.textureManager.destroy();\n\n // call base destroy\n super.destroy(removeView);\n\n this.uid = 0;\n\n // destroy the managers\n this.maskManager.destroy();\n this.stencilManager.destroy();\n this.filterManager.destroy();\n\n this.maskManager = null;\n this.filterManager = null;\n this.textureManager = null;\n this.currentRenderer = null;\n\n this.handleContextLost = null;\n this.handleContextRestored = null;\n\n this._contextOptions = null;\n this.gl.useProgram(null);\n\n if (this.gl.getExtension('WEBGL_lose_context'))\n {\n this.gl.getExtension('WEBGL_lose_context').loseContext();\n }\n\n this.gl = null;\n\n // this = null;\n }\n}\n\n/**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @name PIXI.WebGLRenderer#plugins\n * @type {object}\n * @readonly\n * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.extract.WebGLExtract} extract Extract image data from renderer.\n * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.prepare.WebGLPrepare} prepare Pre-render display objects.\n */\n\n/**\n * Adds a plugin to the renderer.\n *\n * @method PIXI.WebGLRenderer#registerPlugin\n * @param {string} pluginName - The name of the plugin.\n * @param {Function} ctor - The constructor function or class for the plugin.\n */\n\npluginTarget.mixin(WebGLRenderer);\n","import mapWebGLBlendModesToPixi from './utils/mapWebGLBlendModesToPixi';\n\nconst BLEND = 0;\nconst DEPTH_TEST = 1;\nconst FRONT_FACE = 2;\nconst CULL_FACE = 3;\nconst BLEND_FUNC = 4;\n\n/**\n * A WebGL state machines\n *\n * @memberof PIXI\n * @class\n */\nexport default class WebGLState\n{\n /**\n * @param {WebGLRenderingContext} gl - The current WebGL rendering context\n */\n constructor(gl)\n {\n /**\n * The current active state\n *\n * @member {Uint8Array}\n */\n this.activeState = new Uint8Array(16);\n\n /**\n * The default state\n *\n * @member {Uint8Array}\n */\n this.defaultState = new Uint8Array(16);\n\n // default blend mode..\n this.defaultState[0] = 1;\n\n /**\n * The current state index in the stack\n *\n * @member {number}\n * @private\n */\n this.stackIndex = 0;\n\n /**\n * The stack holding all the different states\n *\n * @member {Array<*>}\n * @private\n */\n this.stack = [];\n\n /**\n * The current WebGL rendering context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = gl;\n\n this.maxAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n\n this.attribState = {\n tempAttribState: new Array(this.maxAttribs),\n attribState: new Array(this.maxAttribs),\n };\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n // check we have vao..\n this.nativeVaoExtension = (\n gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object')\n );\n }\n\n /**\n * Pushes a new active state\n */\n push()\n {\n // next state..\n let state = this.stack[this.stackIndex];\n\n if (!state)\n {\n state = this.stack[this.stackIndex] = new Uint8Array(16);\n }\n\n ++this.stackIndex;\n\n // copy state..\n // set active state so we can force overrides of gl state\n for (let i = 0; i < this.activeState.length; i++)\n {\n state[i] = this.activeState[i];\n }\n }\n\n /**\n * Pops a state out\n */\n pop()\n {\n const state = this.stack[--this.stackIndex];\n\n this.setState(state);\n }\n\n /**\n * Sets the current state\n *\n * @param {*} state - The state to set.\n */\n setState(state)\n {\n this.setBlend(state[BLEND]);\n this.setDepthTest(state[DEPTH_TEST]);\n this.setFrontFace(state[FRONT_FACE]);\n this.setCullFace(state[CULL_FACE]);\n this.setBlendMode(state[BLEND_FUNC]);\n }\n\n /**\n * Enables or disabled blending.\n *\n * @param {boolean} value - Turn on or off webgl blending.\n */\n setBlend(value)\n {\n value = value ? 1 : 0;\n\n if (this.activeState[BLEND] === value)\n {\n return;\n }\n\n this.activeState[BLEND] = value;\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Sets the blend mode.\n *\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value)\n {\n if (value === this.activeState[BLEND_FUNC])\n {\n return;\n }\n\n this.activeState[BLEND_FUNC] = value;\n\n const mode = this.blendModes[value];\n\n if (mode.length === 2)\n {\n this.gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n this.gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n }\n\n /**\n * Sets whether to enable or disable depth test.\n *\n * @param {boolean} value - Turn on or off webgl depth testing.\n */\n setDepthTest(value)\n {\n value = value ? 1 : 0;\n\n if (this.activeState[DEPTH_TEST] === value)\n {\n return;\n }\n\n this.activeState[DEPTH_TEST] = value;\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n *\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value)\n {\n value = value ? 1 : 0;\n\n if (this.activeState[CULL_FACE] === value)\n {\n return;\n }\n\n this.activeState[CULL_FACE] = value;\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n *\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value)\n {\n value = value ? 1 : 0;\n\n if (this.activeState[FRONT_FACE] === value)\n {\n return;\n }\n\n this.activeState[FRONT_FACE] = value;\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Disables all the vaos in use\n *\n */\n resetAttributes()\n {\n for (let i = 0; i < this.attribState.tempAttribState.length; i++)\n {\n this.attribState.tempAttribState[i] = 0;\n }\n\n for (let i = 0; i < this.attribState.attribState.length; i++)\n {\n this.attribState.attribState[i] = 0;\n }\n\n // im going to assume one is always active for performance reasons.\n for (let i = 1; i < this.maxAttribs; i++)\n {\n this.gl.disableVertexAttribArray(i);\n }\n }\n\n // used\n /**\n * Resets all the logic and disables the vaos\n */\n resetToDefault()\n {\n // unbind any VAO if they exist..\n if (this.nativeVaoExtension)\n {\n this.nativeVaoExtension.bindVertexArrayOES(null);\n }\n\n // reset all attributes..\n this.resetAttributes();\n\n // set active state so we can force overrides of gl state\n for (let i = 0; i < this.activeState.length; ++i)\n {\n this.activeState[i] = 32;\n }\n\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.setState(this.defaultState);\n }\n}\n","import extractUniformsFromSrc from './extractUniformsFromSrc';\nimport { uid } from '../../../utils';\nimport { BLEND_MODES } from '../../../const';\nimport settings from '../../../settings';\n\nconst SOURCE_KEY_MAP = {};\n\n// let math = require('../../../math');\n/**\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nexport default class Filter\n{\n /**\n * @param {string} [vertexSrc] - The source of the vertex shader.\n * @param {string} [fragmentSrc] - The source of the fragment shader.\n * @param {object} [uniformData] - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc, fragmentSrc, uniformData)\n {\n /**\n * The vertex shader.\n *\n * @member {string}\n */\n this.vertexSrc = vertexSrc || Filter.defaultVertexSrc;\n\n /**\n * The fragment shader.\n *\n * @member {string}\n */\n this.fragmentSrc = fragmentSrc || Filter.defaultFragmentSrc;\n\n this._blendMode = BLEND_MODES.NORMAL;\n\n this.uniformData = uniformData || extractUniformsFromSrc(\n this.vertexSrc,\n this.fragmentSrc,\n 'projectionMatrix|uSampler'\n );\n\n /**\n * An object containing the current values of custom uniforms.\n * @example <caption>Updating the value of a custom uniform</caption>\n * filter.uniforms.time = performance.now();\n *\n * @member {object}\n */\n this.uniforms = {};\n\n for (const i in this.uniformData)\n {\n this.uniforms[i] = this.uniformData[i].value;\n if (this.uniformData[i].type)\n {\n this.uniformData[i].type = this.uniformData[i].type.toLowerCase();\n }\n }\n\n // this is where we store shader references..\n // TODO we could cache this!\n this.glShaders = {};\n\n // used for caching.. sure there is a better way!\n if (!SOURCE_KEY_MAP[this.vertexSrc + this.fragmentSrc])\n {\n SOURCE_KEY_MAP[this.vertexSrc + this.fragmentSrc] = uid();\n }\n\n this.glShaderKey = SOURCE_KEY_MAP[this.vertexSrc + this.fragmentSrc];\n\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n *\n * @member {number}\n */\n this.padding = 4;\n\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n *\n * @member {number}\n */\n this.resolution = settings.FILTER_RESOLUTION;\n\n /**\n * If enabled is true the filter is applied, if false it will not.\n *\n * @member {boolean}\n */\n this.enabled = true;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n *\n * @member {boolean}\n */\n this.autoFit = true;\n }\n\n /**\n * Applies the filter\n *\n * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTarget} input - The input render target.\n * @param {PIXI.RenderTarget} output - The target to output to.\n * @param {boolean} clear - Should the output be cleared before rendering to it\n * @param {object} [currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n apply(filterManager, input, output, clear, currentState) // eslint-disable-line no-unused-vars\n {\n // --- //\n // this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(tempMatrix, window.panda );\n\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clear);\n\n // or just do a regular render..\n }\n\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode()\n {\n return this._blendMode;\n }\n\n set blendMode(value) // eslint-disable-line require-jsdoc\n {\n this._blendMode = value;\n }\n\n /**\n * The default vertex shader source\n *\n * @static\n * @constant\n */\n static get defaultVertexSrc()\n {\n return [\n 'attribute vec2 aVertexPosition;',\n 'attribute vec2 aTextureCoord;',\n\n 'uniform mat3 projectionMatrix;',\n 'uniform mat3 filterMatrix;',\n\n 'varying vec2 vTextureCoord;',\n 'varying vec2 vFilterCoord;',\n\n 'void main(void){',\n ' gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);',\n ' vFilterCoord = ( filterMatrix * vec3( aTextureCoord, 1.0) ).xy;',\n ' vTextureCoord = aTextureCoord ;',\n '}',\n ].join('\\n');\n }\n\n /**\n * The default fragment shader source\n *\n * @static\n * @constant\n */\n static get defaultFragmentSrc()\n {\n return [\n 'varying vec2 vTextureCoord;',\n 'varying vec2 vFilterCoord;',\n\n 'uniform sampler2D uSampler;',\n 'uniform sampler2D filterSampler;',\n\n 'void main(void){',\n ' vec4 masky = texture2D(filterSampler, vFilterCoord);',\n ' vec4 sample = texture2D(uSampler, vTextureCoord);',\n ' vec4 color;',\n ' if(mod(vFilterCoord.x, 1.0) > 0.5)',\n ' {',\n ' color = vec4(1.0, 0.0, 0.0, 1.0);',\n ' }',\n ' else',\n ' {',\n ' color = vec4(0.0, 1.0, 0.0, 1.0);',\n ' }',\n // ' gl_FragColor = vec4(mod(vFilterCoord.x, 1.5), vFilterCoord.y,0.0,1.0);',\n ' gl_FragColor = mix(sample, masky, 0.5);',\n ' gl_FragColor *= sample.a;',\n '}',\n ].join('\\n');\n }\n}\n","import glCore from 'pixi-gl-core';\n\nconst defaultValue = glCore.shader.defaultValue;\n\nexport default function extractUniformsFromSrc(vertexSrc, fragmentSrc, mask)\n{\n const vertUniforms = extractUniformsFromString(vertexSrc, mask);\n const fragUniforms = extractUniformsFromString(fragmentSrc, mask);\n\n return Object.assign(vertUniforms, fragUniforms);\n}\n\nfunction extractUniformsFromString(string)\n{\n const maskRegex = new RegExp('^(projectionMatrix|uSampler|filterArea|filterClamp)$');\n\n const uniforms = {};\n let nameSplit;\n\n // clean the lines a little - remove extra spaces / tabs etc\n // then split along ';'\n const lines = string.replace(/\\s+/g, ' ')\n .split(/\\s*;\\s*/);\n\n // loop through..\n for (let i = 0; i < lines.length; i++)\n {\n const line = lines[i].trim();\n\n if (line.indexOf('uniform') > -1)\n {\n const splitLine = line.split(' ');\n const type = splitLine[1];\n\n let name = splitLine[2];\n let size = 1;\n\n if (name.indexOf('[') > -1)\n {\n // array!\n nameSplit = name.split(/\\[|]/);\n name = nameSplit[0];\n size *= Number(nameSplit[1]);\n }\n\n if (!name.match(maskRegex))\n {\n uniforms[name] = {\n value: defaultValue(type, size),\n name,\n type,\n };\n }\n }\n }\n\n return uniforms;\n}\n","import { Matrix } from '../../../math';\n\n/**\n * Calculates the mapped matrix\n * @param filterArea {Rectangle} The filter area\n * @param sprite {Sprite} the target sprite\n * @param outputMatrix {Matrix} @alvin\n * @private\n */\n// TODO playing around here.. this is temporary - (will end up in the shader)\n// this returns a matrix that will normalise map filter cords in the filter to screen space\nexport function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize)\n{\n // let worldTransform = sprite.worldTransform.copy(Matrix.TEMP_MATRIX),\n // let texture = {width:1136, height:700};//sprite._texture.baseTexture;\n\n // TODO unwrap?\n const mappedMatrix = outputMatrix.identity();\n\n mappedMatrix.translate(filterArea.x / textureSize.width, filterArea.y / textureSize.height);\n\n mappedMatrix.scale(textureSize.width, textureSize.height);\n\n return mappedMatrix;\n}\n\nexport function calculateNormalizedScreenSpaceMatrix(outputMatrix, filterArea, textureSize)\n{\n const mappedMatrix = outputMatrix.identity();\n\n mappedMatrix.translate(filterArea.x / textureSize.width, filterArea.y / textureSize.height);\n\n const translateScaleX = (textureSize.width / filterArea.width);\n const translateScaleY = (textureSize.height / filterArea.height);\n\n mappedMatrix.scale(translateScaleX, translateScaleY);\n\n return mappedMatrix;\n}\n\n// this will map the filter coord so that a texture can be used based on the transform of a sprite\nexport function calculateSpriteMatrix(outputMatrix, filterArea, textureSize, sprite)\n{\n const orig = sprite._texture.orig;\n const mappedMatrix = outputMatrix.set(textureSize.width, 0, 0, textureSize.height, filterArea.x, filterArea.y);\n const worldTransform = sprite.worldTransform.copy(Matrix.TEMP_MATRIX);\n\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n}\n","import Filter from '../Filter';\nimport { Matrix } from '../../../../math';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\nimport { default as TextureMatrix } from '../../../../textures/TextureMatrix';\n\n/**\n * The SpriteMaskFilter class\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI\n */\nexport default class SpriteMaskFilter extends Filter\n{\n /**\n * @param {PIXI.Sprite} sprite - the target sprite\n */\n constructor(sprite)\n {\n const maskMatrix = new Matrix();\n\n super(\n readFileSync(join(__dirname, './spriteMaskFilter.vert'), 'utf8'),\n readFileSync(join(__dirname, './spriteMaskFilter.frag'), 'utf8')\n );\n\n sprite.renderable = false;\n\n this.maskSprite = sprite;\n this.maskMatrix = maskMatrix;\n }\n\n /**\n * Applies the filter\n *\n * @param {PIXI.FilterManager} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTarget} input - The input render target.\n * @param {PIXI.RenderTarget} output - The target to output to.\n * @param {boolean} clear - Should the output be cleared before rendering to it\n */\n apply(filterManager, input, output, clear)\n {\n const maskSprite = this.maskSprite;\n const tex = this.maskSprite.texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.transform)\n {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.transform = new TextureMatrix(tex, 0.0);\n }\n tex.transform.update();\n\n this.uniforms.mask = tex;\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.transform.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.transform.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clear);\n }\n}\n","import WebGLManager from './WebGLManager';\nimport RenderTarget from '../utils/RenderTarget';\nimport Quad from '../utils/Quad';\nimport { Rectangle } from '../../../math';\nimport Shader from '../../../Shader';\nimport * as filterTransforms from '../filters/filterTransforms';\nimport bitTwiddle from 'bit-twiddle';\n\n/**\n * @ignore\n * @class\n */\nclass FilterState\n{\n /**\n *\n */\n constructor()\n {\n this.renderTarget = null;\n this.target = null;\n this.resolution = 1;\n\n // those three objects are used only for root\n // re-assigned for everything else\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.filters = [];\n }\n\n /**\n * clears the state\n */\n clear()\n {\n this.filters = null;\n this.target = null;\n this.renderTarget = null;\n }\n}\n\nconst screenKey = 'screen';\n\n/**\n * @class\n * @memberof PIXI\n * @extends PIXI.WebGLManager\n */\nexport default class FilterManager extends WebGLManager\n{\n /**\n * @param {PIXI.WebGLRenderer} renderer - The renderer this manager works for.\n */\n constructor(renderer)\n {\n super(renderer);\n\n this.gl = this.renderer.gl;\n // know about sprites!\n this.quad = new Quad(this.gl, renderer.state.attribState);\n\n this.shaderCache = {};\n // todo add default!\n this.pool = {};\n\n this.filterData = null;\n\n this.managedFilters = [];\n\n this.renderer.on('prerender', this.onPrerender, this);\n\n this._screenWidth = renderer.view.width;\n this._screenHeight = renderer.view.height;\n }\n\n /**\n * Adds a new filter to the manager.\n *\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param {PIXI.Filter[]} filters - The filters to apply.\n */\n pushFilter(target, filters)\n {\n const renderer = this.renderer;\n\n let filterData = this.filterData;\n\n if (!filterData)\n {\n filterData = this.renderer._activeRenderTarget.filterStack;\n\n // add new stack\n const filterState = new FilterState();\n\n filterState.sourceFrame = filterState.destinationFrame = this.renderer._activeRenderTarget.size;\n filterState.renderTarget = renderer._activeRenderTarget;\n\n this.renderer._activeRenderTarget.filterData = filterData = {\n index: 0,\n stack: [filterState],\n };\n\n this.filterData = filterData;\n }\n\n // get the current filter state..\n let currentState = filterData.stack[++filterData.index];\n const renderTargetFrame = filterData.stack[0].destinationFrame;\n\n if (!currentState)\n {\n currentState = filterData.stack[filterData.index] = new FilterState();\n }\n\n const fullScreen = target.filterArea\n && target.filterArea.x === 0\n && target.filterArea.y === 0\n && target.filterArea.width === renderer.screen.width\n && target.filterArea.height === renderer.screen.height;\n\n // for now we go off the filter of the first resolution..\n const resolution = filters[0].resolution;\n const padding = filters[0].padding | 0;\n const targetBounds = fullScreen ? renderer.screen : (target.filterArea || target.getBounds(true));\n const sourceFrame = currentState.sourceFrame;\n const destinationFrame = currentState.destinationFrame;\n\n sourceFrame.x = ((targetBounds.x * resolution) | 0) / resolution;\n sourceFrame.y = ((targetBounds.y * resolution) | 0) / resolution;\n sourceFrame.width = ((targetBounds.width * resolution) | 0) / resolution;\n sourceFrame.height = ((targetBounds.height * resolution) | 0) / resolution;\n\n if (!fullScreen)\n {\n if (filterData.stack[0].renderTarget.transform)\n { //\n\n // TODO we should fit the rect around the transform..\n }\n else if (filters[0].autoFit)\n {\n sourceFrame.fit(renderTargetFrame);\n }\n\n // lets apply the padding After we fit the element to the screen.\n // this should stop the strange side effects that can occur when cropping to the edges\n sourceFrame.pad(padding);\n }\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n\n // lets play the padding after we fit the element to the screen.\n // this should stop the strange side effects that can occur when cropping to the edges\n\n const renderTarget = this.getPotRenderTarget(renderer.gl, sourceFrame.width, sourceFrame.height, resolution);\n\n currentState.target = target;\n currentState.filters = filters;\n currentState.resolution = resolution;\n currentState.renderTarget = renderTarget;\n\n // bind the render target to draw the shape in the top corner..\n\n renderTarget.setFrame(destinationFrame, sourceFrame);\n\n // bind the render target\n renderer.bindRenderTarget(renderTarget);\n renderTarget.clear();\n }\n\n /**\n * Pops off the filter and applies it.\n *\n */\n popFilter()\n {\n const filterData = this.filterData;\n\n const lastState = filterData.stack[filterData.index - 1];\n const currentState = filterData.stack[filterData.index];\n\n this.quad.map(currentState.renderTarget.size, currentState.sourceFrame).upload();\n\n const filters = currentState.filters;\n\n if (filters.length === 1)\n {\n filters[0].apply(this, currentState.renderTarget, lastState.renderTarget, false, currentState);\n this.freePotRenderTarget(currentState.renderTarget);\n }\n else\n {\n let flip = currentState.renderTarget;\n let flop = this.getPotRenderTarget(\n this.renderer.gl,\n currentState.sourceFrame.width,\n currentState.sourceFrame.height,\n currentState.resolution\n );\n\n flop.setFrame(currentState.destinationFrame, currentState.sourceFrame);\n\n // finally lets clear the render target before drawing to it..\n flop.clear();\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n filters[i].apply(this, flip, flop, true, currentState);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTarget, false, currentState);\n\n this.freePotRenderTarget(flip);\n this.freePotRenderTarget(flop);\n }\n\n currentState.clear();\n filterData.index--;\n\n if (filterData.index === 0)\n {\n this.filterData = null;\n }\n }\n\n /**\n * Draws a filter.\n *\n * @param {PIXI.Filter} filter - The filter to draw.\n * @param {PIXI.RenderTarget} input - The input render target.\n * @param {PIXI.RenderTarget} output - The target to output to.\n * @param {boolean} clear - Should the output be cleared before rendering to it\n */\n applyFilter(filter, input, output, clear)\n {\n const renderer = this.renderer;\n const gl = renderer.gl;\n\n let shader = filter.glShaders[renderer.CONTEXT_UID];\n\n // caching..\n if (!shader)\n {\n if (filter.glShaderKey)\n {\n shader = this.shaderCache[filter.glShaderKey];\n\n if (!shader)\n {\n shader = new Shader(this.gl, filter.vertexSrc, filter.fragmentSrc);\n\n filter.glShaders[renderer.CONTEXT_UID] = this.shaderCache[filter.glShaderKey] = shader;\n this.managedFilters.push(filter);\n }\n }\n else\n {\n shader = filter.glShaders[renderer.CONTEXT_UID] = new Shader(this.gl, filter.vertexSrc, filter.fragmentSrc);\n this.managedFilters.push(filter);\n }\n\n // TODO - this only needs to be done once?\n renderer.bindVao(null);\n\n this.quad.initVao(shader);\n }\n\n renderer.bindVao(this.quad.vao);\n\n renderer.bindRenderTarget(output);\n\n if (clear)\n {\n gl.disable(gl.SCISSOR_TEST);\n renderer.clear();// [1, 1, 1, 1]);\n gl.enable(gl.SCISSOR_TEST);\n }\n\n // in case the render target is being masked using a scissor rect\n if (output === renderer.maskManager.scissorRenderTarget)\n {\n renderer.maskManager.pushScissorMask(null, renderer.maskManager.scissorData);\n }\n\n renderer.bindShader(shader);\n\n // free unit 0 for us, doesn't matter what was there\n // don't try to restore it, because syncUniforms can upload it to another slot\n // and it'll be a problem\n const tex = this.renderer.emptyTextures[0];\n\n this.renderer.boundTextures[0] = tex;\n // this syncs the PixiJS filters uniforms with glsl uniforms\n this.syncUniforms(shader, filter);\n\n renderer.state.setBlendMode(filter.blendMode);\n\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, input.texture.texture);\n\n this.quad.vao.draw(this.renderer.gl.TRIANGLES, 6, 0);\n\n gl.bindTexture(gl.TEXTURE_2D, tex._glTextures[this.renderer.CONTEXT_UID].texture);\n }\n\n /**\n * Uploads the uniforms of the filter.\n *\n * @param {GLShader} shader - The underlying gl shader.\n * @param {PIXI.Filter} filter - The filter we are synchronizing.\n */\n syncUniforms(shader, filter)\n {\n const uniformData = filter.uniformData;\n const uniforms = filter.uniforms;\n\n // 0 is reserved for the PixiJS texture so we start at 1!\n let textureCount = 1;\n let currentState;\n\n // filterArea and filterClamp that are handled by FilterManager directly\n // they must not appear in uniformData\n\n if (shader.uniforms.filterArea)\n {\n currentState = this.filterData.stack[this.filterData.index];\n\n const filterArea = shader.uniforms.filterArea;\n\n filterArea[0] = currentState.renderTarget.size.width;\n filterArea[1] = currentState.renderTarget.size.height;\n filterArea[2] = currentState.sourceFrame.x;\n filterArea[3] = currentState.sourceFrame.y;\n\n shader.uniforms.filterArea = filterArea;\n }\n\n // use this to clamp displaced texture coords so they belong to filterArea\n // see displacementFilter fragment shader for an example\n if (shader.uniforms.filterClamp)\n {\n currentState = currentState || this.filterData.stack[this.filterData.index];\n\n const filterClamp = shader.uniforms.filterClamp;\n\n filterClamp[0] = 0;\n filterClamp[1] = 0;\n filterClamp[2] = (currentState.sourceFrame.width - 1) / currentState.renderTarget.size.width;\n filterClamp[3] = (currentState.sourceFrame.height - 1) / currentState.renderTarget.size.height;\n\n shader.uniforms.filterClamp = filterClamp;\n }\n\n // TODO Caching layer..\n for (const i in uniformData)\n {\n if (!shader.uniforms.data[i])\n {\n continue;\n }\n\n const type = uniformData[i].type;\n\n if (type === 'sampler2d' && uniforms[i] !== 0)\n {\n if (uniforms[i].baseTexture)\n {\n shader.uniforms[i] = this.renderer.bindTexture(uniforms[i].baseTexture, textureCount);\n }\n else\n {\n shader.uniforms[i] = textureCount;\n\n // TODO\n // this is helpful as renderTargets can also be set.\n // Although thinking about it, we could probably\n // make the filter texture cache return a RenderTexture\n // rather than a renderTarget\n const gl = this.renderer.gl;\n\n this.renderer.boundTextures[textureCount] = this.renderer.emptyTextures[textureCount];\n gl.activeTexture(gl.TEXTURE0 + textureCount);\n\n uniforms[i].texture.bind();\n }\n\n textureCount++;\n }\n else if (type === 'mat3')\n {\n // check if its PixiJS matrix..\n if (uniforms[i].a !== undefined)\n {\n shader.uniforms[i] = uniforms[i].toArray(true);\n }\n else\n {\n shader.uniforms[i] = uniforms[i];\n }\n }\n else if (type === 'vec2')\n {\n // check if its a point..\n if (uniforms[i].x !== undefined)\n {\n const val = shader.uniforms[i] || new Float32Array(2);\n\n val[0] = uniforms[i].x;\n val[1] = uniforms[i].y;\n shader.uniforms[i] = val;\n }\n else\n {\n shader.uniforms[i] = uniforms[i];\n }\n }\n else if (type === 'float')\n {\n if (shader.uniforms.data[i].value !== uniformData[i])\n {\n shader.uniforms[i] = uniforms[i];\n }\n }\n else\n {\n shader.uniforms[i] = uniforms[i];\n }\n }\n }\n\n /**\n * Gets a render target from the pool, or creates a new one.\n *\n * @param {boolean} clear - Should we clear the render texture when we get it?\n * @param {number} resolution - The resolution of the target.\n * @return {PIXI.RenderTarget} The new render target\n */\n getRenderTarget(clear, resolution)\n {\n const currentState = this.filterData.stack[this.filterData.index];\n const renderTarget = this.getPotRenderTarget(\n this.renderer.gl,\n currentState.sourceFrame.width,\n currentState.sourceFrame.height,\n resolution || currentState.resolution\n );\n\n renderTarget.setFrame(currentState.destinationFrame, currentState.sourceFrame);\n\n return renderTarget;\n }\n\n /**\n * Returns a render target to the pool.\n *\n * @param {PIXI.RenderTarget} renderTarget - The render target to return.\n */\n returnRenderTarget(renderTarget)\n {\n this.freePotRenderTarget(renderTarget);\n }\n\n /**\n * Calculates the mapped matrix.\n *\n * TODO playing around here.. this is temporary - (will end up in the shader)\n * this returns a matrix that will normalise map filter cords in the filter to screen space\n *\n * @param {PIXI.Matrix} outputMatrix - the matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateScreenSpaceMatrix(outputMatrix)\n {\n const currentState = this.filterData.stack[this.filterData.index];\n\n return filterTransforms.calculateScreenSpaceMatrix(\n outputMatrix,\n currentState.sourceFrame,\n currentState.renderTarget.size\n );\n }\n\n /**\n * Multiply vTextureCoord to this matrix to achieve (0,0,1,1) for filterArea\n *\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateNormalizedScreenSpaceMatrix(outputMatrix)\n {\n const currentState = this.filterData.stack[this.filterData.index];\n\n return filterTransforms.calculateNormalizedScreenSpaceMatrix(\n outputMatrix,\n currentState.sourceFrame,\n currentState.renderTarget.size,\n currentState.destinationFrame\n );\n }\n\n /**\n * This will map the filter coord so that a texture can be used based on the transform of a sprite\n *\n * @param {PIXI.Matrix} outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @return {PIXI.Matrix} The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix, sprite)\n {\n const currentState = this.filterData.stack[this.filterData.index];\n\n return filterTransforms.calculateSpriteMatrix(\n outputMatrix,\n currentState.sourceFrame,\n currentState.renderTarget.size,\n sprite\n );\n }\n\n /**\n * Destroys this Filter Manager.\n *\n * @param {boolean} [contextLost=false] context was lost, do not free shaders\n *\n */\n destroy(contextLost = false)\n {\n const renderer = this.renderer;\n const filters = this.managedFilters;\n\n renderer.off('prerender', this.onPrerender, this);\n\n for (let i = 0; i < filters.length; i++)\n {\n if (!contextLost)\n {\n filters[i].glShaders[renderer.CONTEXT_UID].destroy();\n }\n delete filters[i].glShaders[renderer.CONTEXT_UID];\n }\n\n this.shaderCache = {};\n if (!contextLost)\n {\n this.emptyPool();\n }\n else\n {\n this.pool = {};\n }\n }\n\n /**\n * Gets a Power-of-Two render texture.\n *\n * TODO move to a separate class could be on renderer?\n * also - could cause issue with multiple contexts?\n *\n * @private\n * @param {WebGLRenderingContext} gl - The webgl rendering context\n * @param {number} minWidth - The minimum width of the render target.\n * @param {number} minHeight - The minimum height of the render target.\n * @param {number} resolution - The resolution of the render target.\n * @return {PIXI.RenderTarget} The new render target.\n */\n getPotRenderTarget(gl, minWidth, minHeight, resolution)\n {\n let key = screenKey;\n\n minWidth *= resolution;\n minHeight *= resolution;\n\n if (minWidth !== this._screenWidth\n || minHeight !== this._screenHeight)\n {\n // TODO you could return a bigger texture if there is not one in the pool?\n minWidth = bitTwiddle.nextPow2(minWidth);\n minHeight = bitTwiddle.nextPow2(minHeight);\n key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF);\n }\n\n if (!this.pool[key])\n {\n this.pool[key] = [];\n }\n\n let renderTarget = this.pool[key].pop();\n\n // creating render target will cause texture to be bound!\n if (!renderTarget)\n {\n // temporary bypass cache..\n const tex = this.renderer.boundTextures[0];\n\n gl.activeTexture(gl.TEXTURE0);\n\n // internally - this will cause a texture to be bound..\n renderTarget = new RenderTarget(gl, minWidth, minHeight, null, 1);\n\n // set the current one back\n gl.bindTexture(gl.TEXTURE_2D, tex._glTextures[this.renderer.CONTEXT_UID].texture);\n }\n\n // manually tweak the resolution...\n // this will not modify the size of the frame buffer, just its resolution.\n renderTarget.resolution = resolution;\n renderTarget.defaultFrame.width = renderTarget.size.width = minWidth / resolution;\n renderTarget.defaultFrame.height = renderTarget.size.height = minHeight / resolution;\n renderTarget.filterPoolKey = key;\n\n return renderTarget;\n }\n\n /**\n * Empties the texture pool.\n *\n */\n emptyPool()\n {\n for (const i in this.pool)\n {\n const textures = this.pool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n\n this.pool = {};\n }\n\n /**\n * Frees a render target back into the pool.\n *\n * @param {PIXI.RenderTarget} renderTarget - The renderTarget to free\n */\n freePotRenderTarget(renderTarget)\n {\n this.pool[renderTarget.filterPoolKey].push(renderTarget);\n }\n\n /**\n * Called before the renderer starts rendering.\n *\n */\n onPrerender()\n {\n if (this._screenWidth !== this.renderer.view.width\n || this._screenHeight !== this.renderer.view.height)\n {\n this._screenWidth = this.renderer.view.width;\n this._screenHeight = this.renderer.view.height;\n\n const textures = this.pool[screenKey];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n this.pool[screenKey] = [];\n }\n }\n}\n","import WebGLManager from './WebGLManager';\nimport AlphaMaskFilter from '../filters/spriteMask/SpriteMaskFilter';\n\n/**\n * @class\n * @extends PIXI.WebGLManager\n * @memberof PIXI\n */\nexport default class MaskManager extends WebGLManager\n{\n /**\n * @param {PIXI.WebGLRenderer} renderer - The renderer this manager works for.\n */\n constructor(renderer)\n {\n super(renderer);\n\n // TODO - we don't need both!\n this.scissor = false;\n this.scissorData = null;\n this.scissorRenderTarget = null;\n\n this.enableScissor = true;\n\n this.alphaMaskPool = [];\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.Sprite|PIXI.Graphics} maskData - The masking data.\n */\n pushMask(target, maskData)\n {\n // TODO the root check means scissor rect will not\n // be used on render textures more info here:\n // https://github.com/pixijs/pixi.js/pull/3545\n\n if (maskData.texture)\n {\n this.pushSpriteMask(target, maskData);\n }\n else if (this.enableScissor\n && !this.scissor\n && this.renderer._activeRenderTarget.root\n && !this.renderer.stencilManager.stencilMaskStack.length\n && maskData.isFastRect())\n {\n const matrix = maskData.worldTransform;\n\n let rot = Math.atan2(matrix.b, matrix.a);\n\n // use the nearest degree!\n rot = Math.round(rot * (180 / Math.PI));\n\n if (rot % 90)\n {\n this.pushStencilMask(maskData);\n }\n else\n {\n this.pushScissorMask(target, maskData);\n }\n }\n else\n {\n this.pushStencilMask(maskData);\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n *\n * @param {PIXI.DisplayObject} target - Display Object to pop the mask from\n * @param {PIXI.Sprite|PIXI.Graphics} maskData - The masking data.\n */\n popMask(target, maskData)\n {\n if (maskData.texture)\n {\n this.popSpriteMask(target, maskData);\n }\n else if (this.enableScissor && !this.renderer.stencilManager.stencilMaskStack.length)\n {\n this.popScissorMask(target, maskData);\n }\n else\n {\n this.popStencilMask(target, maskData);\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param {PIXI.RenderTarget} target - Display Object to push the sprite mask to\n * @param {PIXI.Sprite} maskData - Sprite to be used as the mask\n */\n pushSpriteMask(target, maskData)\n {\n let alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new AlphaMaskFilter(maskData)];\n }\n\n alphaMaskFilter[0].resolution = this.renderer.resolution;\n alphaMaskFilter[0].maskSprite = maskData;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskData.getBounds(true);\n this.renderer.filterManager.pushFilter(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n this.alphaMaskIndex++;\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n *\n */\n popSpriteMask()\n {\n this.renderer.filterManager.popFilter();\n this.alphaMaskIndex--;\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param {PIXI.Sprite|PIXI.Graphics} maskData - The masking data.\n */\n pushStencilMask(maskData)\n {\n this.renderer.currentRenderer.stop();\n this.renderer.stencilManager.pushStencil(maskData);\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n *\n */\n popStencilMask()\n {\n this.renderer.currentRenderer.stop();\n this.renderer.stencilManager.popStencil();\n }\n\n /**\n *\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.Graphics} maskData - The masking data.\n */\n pushScissorMask(target, maskData)\n {\n maskData.renderable = true;\n\n const renderTarget = this.renderer._activeRenderTarget;\n\n const bounds = maskData.getBounds();\n\n bounds.fit(renderTarget.size);\n maskData.renderable = false;\n\n this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);\n\n const resolution = this.renderer.resolution;\n\n this.renderer.gl.scissor(\n bounds.x * resolution,\n (renderTarget.root ? renderTarget.size.height - bounds.y - bounds.height : bounds.y) * resolution,\n bounds.width * resolution,\n bounds.height * resolution\n );\n\n this.scissorRenderTarget = renderTarget;\n this.scissorData = maskData;\n this.scissor = true;\n }\n\n /**\n *\n *\n */\n popScissorMask()\n {\n this.scissorRenderTarget = null;\n this.scissorData = null;\n this.scissor = false;\n\n // must be scissor!\n const gl = this.renderer.gl;\n\n gl.disable(gl.SCISSOR_TEST);\n }\n}\n","import WebGLManager from './WebGLManager';\n\n/**\n * @class\n * @extends PIXI.WebGLManager\n * @memberof PIXI\n */\nexport default class StencilManager extends WebGLManager\n{\n /**\n * @param {PIXI.WebGLRenderer} renderer - The renderer this manager works for.\n */\n constructor(renderer)\n {\n super(renderer);\n this.stencilMaskStack = null;\n }\n\n /**\n * Changes the mask stack that is used by this manager.\n *\n * @param {PIXI.Graphics[]} stencilMaskStack - The mask stack\n */\n setMaskStack(stencilMaskStack)\n {\n this.stencilMaskStack = stencilMaskStack;\n\n const gl = this.renderer.gl;\n\n if (stencilMaskStack.length === 0)\n {\n gl.disable(gl.STENCIL_TEST);\n }\n else\n {\n gl.enable(gl.STENCIL_TEST);\n }\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack. @alvin\n *\n * @param {PIXI.Graphics} graphics - The mask\n */\n pushStencil(graphics)\n {\n this.renderer.setObjectRenderer(this.renderer.plugins.graphics);\n\n this.renderer._activeRenderTarget.attachStencilBuffer();\n\n const gl = this.renderer.gl;\n const prevMaskCount = this.stencilMaskStack.length;\n\n if (prevMaskCount === 0)\n {\n gl.enable(gl.STENCIL_TEST);\n }\n\n this.stencilMaskStack.push(graphics);\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.colorMask(false, false, false, false);\n gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n this.renderer.plugins.graphics.render(graphics);\n\n this._useCurrent();\n }\n\n /**\n * Removes the last mask from the stencil stack. @alvin\n */\n popStencil()\n {\n this.renderer.setObjectRenderer(this.renderer.plugins.graphics);\n\n const gl = this.renderer.gl;\n const graphics = this.stencilMaskStack.pop();\n\n if (this.stencilMaskStack.length === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.clearStencil(0);\n }\n else\n {\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.colorMask(false, false, false, false);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n this.renderer.plugins.graphics.render(graphics);\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n */\n _useCurrent()\n {\n const gl = this.renderer.gl;\n\n gl.colorMask(true, true, true, true);\n gl.stencilFunc(gl.EQUAL, this.stencilMaskStack.length, this._getBitwiseMask());\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n\n /**\n * Fill 1s equal to the number of acitve stencil masks.\n *\n * @return {number} The bitwise mask.\n */\n _getBitwiseMask()\n {\n return (1 << this.stencilMaskStack.length) - 1;\n }\n\n /**\n * Destroys the mask stack.\n *\n */\n destroy()\n {\n WebGLManager.prototype.destroy.call(this);\n\n this.stencilMaskStack.stencilStack = null;\n }\n}\n","/**\n * @class\n * @memberof PIXI\n */\nexport default class WebGLManager\n{\n /**\n * @param {PIXI.WebGLRenderer} renderer - The renderer this manager works for.\n */\n constructor(renderer)\n {\n /**\n * The renderer this manager works for.\n *\n * @member {PIXI.WebGLRenderer}\n */\n this.renderer = renderer;\n\n this.renderer.on('context', this.onContextChange, this);\n }\n\n /**\n * Generic method called when there is a WebGL context change.\n *\n */\n onContextChange()\n {\n // do some codes init!\n }\n\n /**\n * Generic destroy methods to be overridden by the subclass\n *\n */\n destroy()\n {\n this.renderer.off('context', this.onContextChange, this);\n\n this.renderer = null;\n }\n}\n","import WebGLManager from '../managers/WebGLManager';\n\n/**\n * Base for a common object renderer that can be used as a system renderer plugin.\n *\n * @class\n * @extends PIXI.WebGLManager\n * @memberof PIXI\n */\nexport default class ObjectRenderer extends WebGLManager\n{\n /**\n * Starts the renderer and sets the shader\n *\n */\n start()\n {\n // set the shader..\n }\n\n /**\n * Stops the renderer\n *\n */\n stop()\n {\n this.flush();\n }\n\n /**\n * Stub method for rendering content and emptying the current batch.\n *\n */\n flush()\n {\n // flush!\n }\n\n /**\n * Renders an object\n *\n * @param {PIXI.DisplayObject} object - The object to render.\n */\n render(object) // eslint-disable-line no-unused-vars\n {\n // render the object\n }\n}\n","import glCore from 'pixi-gl-core';\nimport createIndicesForQuads from '../../../utils/createIndicesForQuads';\n\n/**\n * Helper class to create a quad\n *\n * @class\n * @memberof PIXI\n */\nexport default class Quad\n{\n /**\n * @param {WebGLRenderingContext} gl - The gl context for this quad to use.\n * @param {object} state - TODO: Description\n */\n constructor(gl, state)\n {\n /**\n * the current WebGL drawing context\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = gl;\n\n /**\n * An array of vertices\n *\n * @member {Float32Array}\n */\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n /**\n * The Uvs of the quad\n *\n * @member {Float32Array}\n */\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.interleaved = new Float32Array(8 * 2);\n\n for (let i = 0; i < 4; i++)\n {\n this.interleaved[i * 4] = this.vertices[(i * 2)];\n this.interleaved[(i * 4) + 1] = this.vertices[(i * 2) + 1];\n this.interleaved[(i * 4) + 2] = this.uvs[i * 2];\n this.interleaved[(i * 4) + 3] = this.uvs[(i * 2) + 1];\n }\n\n /**\n * An array containing the indices of the vertices\n *\n * @member {Uint16Array}\n */\n this.indices = createIndicesForQuads(1);\n\n /**\n * The vertex buffer\n *\n * @member {glCore.GLBuffer}\n */\n this.vertexBuffer = glCore.GLBuffer.createVertexBuffer(gl, this.interleaved, gl.STATIC_DRAW);\n\n /**\n * The index buffer\n *\n * @member {glCore.GLBuffer}\n */\n this.indexBuffer = glCore.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW);\n\n /**\n * The vertex array object\n *\n * @member {glCore.VertexArrayObject}\n */\n this.vao = new glCore.VertexArrayObject(gl, state);\n }\n\n /**\n * Initialises the vaos and uses the shader.\n *\n * @param {PIXI.Shader} shader - the shader to use\n */\n initVao(shader)\n {\n this.vao.clear()\n .addIndex(this.indexBuffer)\n .addAttribute(this.vertexBuffer, shader.attributes.aVertexPosition, this.gl.FLOAT, false, 4 * 4, 0)\n .addAttribute(this.vertexBuffer, shader.attributes.aTextureCoord, this.gl.FLOAT, false, 4 * 4, 2 * 4);\n }\n\n /**\n * Maps two Rectangle to the quad.\n *\n * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle\n * @param {PIXI.Rectangle} destinationFrame - the second rectangle\n * @return {PIXI.Quad} Returns itself.\n */\n map(targetTextureFrame, destinationFrame)\n {\n let x = 0; // destinationFrame.x / targetTextureFrame.width;\n let y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n return this;\n }\n\n /**\n * Binds the buffer and uploads the data\n *\n * @return {PIXI.Quad} Returns itself.\n */\n upload()\n {\n for (let i = 0; i < 4; i++)\n {\n this.interleaved[i * 4] = this.vertices[(i * 2)];\n this.interleaved[(i * 4) + 1] = this.vertices[(i * 2) + 1];\n this.interleaved[(i * 4) + 2] = this.uvs[i * 2];\n this.interleaved[(i * 4) + 3] = this.uvs[(i * 2) + 1];\n }\n\n this.vertexBuffer.upload(this.interleaved);\n\n return this;\n }\n\n /**\n * Removes this quad from WebGL\n */\n destroy()\n {\n const gl = this.gl;\n\n gl.deleteBuffer(this.vertexBuffer);\n gl.deleteBuffer(this.indexBuffer);\n }\n}\n","import { Rectangle, Matrix } from '../../../math';\nimport { SCALE_MODES } from '../../../const';\nimport settings from '../../../settings';\nimport { GLFramebuffer } from 'pixi-gl-core';\n\n/**\n * @class\n * @memberof PIXI\n */\nexport default class RenderTarget\n{\n /**\n * @param {WebGLRenderingContext} gl - The current WebGL drawing context\n * @param {number} [width=0] - the horizontal range of the filter\n * @param {number} [height=0] - the vertical range of the filter\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [resolution=1] - The current resolution / device pixel ratio\n * @param {boolean} [root=false] - Whether this object is the root element or not\n */\n constructor(gl, width, height, scaleMode, resolution, root)\n {\n // TODO Resolution could go here ( eg low res blurs )\n\n /**\n * The current WebGL drawing context.\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = gl;\n\n // next time to create a frame buffer and texture\n\n /**\n * A frame buffer\n *\n * @member {PIXI.glCore.GLFramebuffer}\n */\n this.frameBuffer = null;\n\n /**\n * The texture\n *\n * @member {PIXI.glCore.GLTexture}\n */\n this.texture = null;\n\n /**\n * The background colour of this render target, as an array of [r,g,b,a] values\n *\n * @member {number[]}\n */\n this.clearColor = [0, 0, 0, 0];\n\n /**\n * The size of the object as a rectangle\n *\n * @member {PIXI.Rectangle}\n */\n this.size = new Rectangle(0, 0, 1, 1);\n\n /**\n * The current resolution / device pixel ratio\n *\n * @member {number}\n * @default 1\n */\n this.resolution = resolution || settings.RESOLUTION;\n\n /**\n * The projection matrix\n *\n * @member {PIXI.Matrix}\n */\n this.projectionMatrix = new Matrix();\n\n /**\n * The object's transform\n *\n * @member {PIXI.Matrix}\n */\n this.transform = null;\n\n /**\n * The frame.\n *\n * @member {PIXI.Rectangle}\n */\n this.frame = null;\n\n /**\n * The stencil buffer stores masking data for the render target\n *\n * @member {glCore.GLBuffer}\n */\n this.defaultFrame = new Rectangle();\n this.destinationFrame = null;\n this.sourceFrame = null;\n\n /**\n * The stencil buffer stores masking data for the render target\n *\n * @member {glCore.GLBuffer}\n */\n this.stencilBuffer = null;\n\n /**\n * The data structure for the stencil masks\n *\n * @member {PIXI.Graphics[]}\n */\n this.stencilMaskStack = [];\n\n /**\n * Stores filter data for the render target\n *\n * @member {object[]}\n */\n this.filterData = null;\n\n /**\n * The key for pooled texture of FilterSystem\n * @private\n * @member {string}\n */\n this.filterPoolKey = '';\n\n /**\n * The scale mode.\n *\n * @member {number}\n * @default PIXI.settings.SCALE_MODE\n * @see PIXI.SCALE_MODES\n */\n this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n\n /**\n * Whether this object is the root element or not\n *\n * @member {boolean}\n * @default false\n */\n this.root = root || false;\n\n if (!this.root)\n {\n this.frameBuffer = GLFramebuffer.createRGBA(gl, 100, 100);\n\n if (this.scaleMode === SCALE_MODES.NEAREST)\n {\n this.frameBuffer.texture.enableNearestScaling();\n }\n else\n {\n this.frameBuffer.texture.enableLinearScaling();\n }\n /*\n A frame buffer needs a target to render to..\n create a texture and bind it attach it to the framebuffer..\n */\n\n // this is used by the base texture\n this.texture = this.frameBuffer.texture;\n }\n else\n {\n // make it a null framebuffer..\n this.frameBuffer = new GLFramebuffer(gl, 100, 100);\n this.frameBuffer.framebuffer = null;\n }\n\n this.setFrame();\n\n this.resize(width, height);\n }\n\n /**\n * Clears the filter texture.\n *\n * @param {number[]} [clearColor=this.clearColor] - Array of [r,g,b,a] to clear the framebuffer\n */\n clear(clearColor)\n {\n const cc = clearColor || this.clearColor;\n\n this.frameBuffer.clear(cc[0], cc[1], cc[2], cc[3]);// r,g,b,a);\n }\n\n /**\n * Binds the stencil buffer.\n *\n */\n attachStencilBuffer()\n {\n // TODO check if stencil is done?\n /**\n * The stencil buffer is used for masking in pixi\n * lets create one and then add attach it to the framebuffer..\n */\n if (!this.root)\n {\n this.frameBuffer.enableStencil();\n }\n }\n\n /**\n * Sets the frame of the render target.\n *\n * @param {Rectangle} destinationFrame - The destination frame.\n * @param {Rectangle} sourceFrame - The source frame.\n */\n setFrame(destinationFrame, sourceFrame)\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || this.destinationFrame;\n }\n\n /**\n * Binds the buffers and initialises the viewport.\n *\n */\n activate()\n {\n // TODO refactor usage of frame..\n const gl = this.gl;\n\n // make sure the texture is unbound!\n this.frameBuffer.bind();\n\n this.calculateProjection(this.destinationFrame, this.sourceFrame);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n // TODO add a check as them may be the same!\n if (this.destinationFrame !== this.sourceFrame)\n {\n gl.enable(gl.SCISSOR_TEST);\n gl.scissor(\n this.destinationFrame.x | 0,\n this.destinationFrame.y | 0,\n (this.destinationFrame.width * this.resolution) | 0,\n (this.destinationFrame.height * this.resolution) | 0\n );\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n\n // TODO - does not need to be updated all the time??\n gl.viewport(\n this.destinationFrame.x | 0,\n this.destinationFrame.y | 0,\n (this.destinationFrame.width * this.resolution) | 0,\n (this.destinationFrame.height * this.resolution) | 0\n );\n }\n\n /**\n * Updates the projection matrix based on a projection frame (which is a rectangle)\n *\n * @param {Rectangle} destinationFrame - The destination frame.\n * @param {Rectangle} sourceFrame - The source frame.\n */\n calculateProjection(destinationFrame, sourceFrame)\n {\n const pm = this.projectionMatrix;\n\n sourceFrame = sourceFrame || destinationFrame;\n\n pm.identity();\n\n // TODO: make dest scale source\n if (!this.root)\n {\n pm.a = 1 / destinationFrame.width * 2;\n pm.d = 1 / destinationFrame.height * 2;\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -1 - (sourceFrame.y * pm.d);\n }\n else\n {\n pm.a = 1 / destinationFrame.width * 2;\n pm.d = -1 / destinationFrame.height * 2;\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = 1 - (sourceFrame.y * pm.d);\n }\n }\n\n /**\n * Resizes the texture to the specified width and height\n *\n * @param {number} width - the new width of the texture\n * @param {number} height - the new height of the texture\n */\n resize(width, height)\n {\n width = width | 0;\n height = height | 0;\n\n if (this.size.width === width && this.size.height === height)\n {\n return;\n }\n\n this.size.width = width;\n this.size.height = height;\n\n this.defaultFrame.width = width;\n this.defaultFrame.height = height;\n\n this.frameBuffer.resize(width * this.resolution, height * this.resolution);\n\n const projectionFrame = this.frame || this.size;\n\n this.calculateProjection(projectionFrame);\n }\n\n /**\n * Destroys the render target.\n *\n */\n destroy()\n {\n if (this.frameBuffer.stencil)\n {\n this.gl.deleteRenderbuffer(this.frameBuffer.stencil);\n }\n this.frameBuffer.destroy();\n\n this.frameBuffer = null;\n this.texture = null;\n }\n}\n","import glCore from 'pixi-gl-core';\n\nconst fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}',\n].join('\\n');\n\nexport default function checkMaxIfStatmentsInShader(maxIfs, gl)\n{\n const createTempContext = !gl;\n\n // @if DEBUG\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n // @endif\n\n if (createTempContext)\n {\n const tinyCanvas = document.createElement('canvas');\n\n tinyCanvas.width = 1;\n tinyCanvas.height = 1;\n\n gl = glCore.createContext(tinyCanvas);\n }\n\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n if (createTempContext)\n {\n // get rid of context\n if (gl.getExtension('WEBGL_lose_context'))\n {\n gl.getExtension('WEBGL_lose_context').loseContext();\n }\n }\n\n return maxIfs;\n}\n\nfunction generateIfTestSrc(maxIfs)\n{\n let src = '';\n\n for (let i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += `if(test == ${i}.0){}`;\n }\n }\n\n return src;\n}\n","import { BLEND_MODES } from '../../../const';\n\n/**\n * Maps gl blend combinations to WebGL.\n *\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {string[]} [array=[]] - The array to output into.\n * @return {string[]} Mapped modes.\n */\nexport default function mapWebGLBlendModesToPixi(gl, array = [])\n{\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.DST_ALPHA];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.DST_ALPHA, gl.ONE, gl.DST_ALPHA];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_COLOR];\n\n return array;\n}\n","import { DRAW_MODES } from '../../../const';\n\n/**\n * Generic Mask Stack data structure.\n *\n * @memberof PIXI\n * @function mapWebGLDrawModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The current WebGL drawing context\n * @param {object} [object={}] - The object to map into\n * @return {object} The mapped draw modes.\n */\nexport default function mapWebGLDrawModesToPixi(gl, object = {})\n{\n object[DRAW_MODES.POINTS] = gl.POINTS;\n object[DRAW_MODES.LINES] = gl.LINES;\n object[DRAW_MODES.LINE_LOOP] = gl.LINE_LOOP;\n object[DRAW_MODES.LINE_STRIP] = gl.LINE_STRIP;\n object[DRAW_MODES.TRIANGLES] = gl.TRIANGLES;\n object[DRAW_MODES.TRIANGLE_STRIP] = gl.TRIANGLE_STRIP;\n object[DRAW_MODES.TRIANGLE_FAN] = gl.TRIANGLE_FAN;\n\n return object;\n}\n","export default function validateContext(gl)\n{\n const attributes = gl.getContextAttributes();\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (!attributes.stencil)\n {\n /* eslint-disable no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable no-console */\n }\n}\n","import maxRecommendedTextures from './utils/maxRecommendedTextures';\nimport canUploadSameBuffer from './utils/canUploadSameBuffer';\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float percision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio.\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nexport default {\n\n /**\n * Target frames per millisecond.\n *\n * @static\n * @memberof PIXI.settings\n * @type {number}\n * @default 0.06\n */\n TARGET_FPMS: 0.06,\n\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n *\n * @static\n * @memberof PIXI.settings\n * @type {boolean}\n * @default true\n */\n MIPMAP_TEXTURES: true,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n *\n * @static\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Default filter resolution.\n *\n * @static\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n\n /**\n * The maximum textures that this device supports.\n *\n * @static\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n *\n * @static\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n\n /**\n * The prefix that denotes a URL is for a retina asset.\n *\n * @static\n * @memberof PIXI.settings\n * @type {RegExp}\n * @example `@2x`\n * @default /@([0-9\\.]+)x/\n */\n RETINA_PREFIX: /@([0-9\\.]+)x/,\n\n /**\n * The default render options if none are supplied to {@link PIXI.WebGLRenderer}\n * or {@link PIXI.CanvasRenderer}.\n *\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {object}\n * @property {HTMLCanvasElement} view=null\n * @property {number} resolution=1\n * @property {boolean} antialias=false\n * @property {boolean} forceFXAA=false\n * @property {boolean} autoResize=false\n * @property {boolean} transparent=false\n * @property {number} backgroundColor=0x000000\n * @property {boolean} clearBeforeRender=true\n * @property {boolean} preserveDrawingBuffer=false\n * @property {boolean} roundPixels=false\n * @property {number} width=800\n * @property {number} height=600\n * @property {boolean} legacy=false\n */\n RENDER_OPTIONS: {\n view: null,\n antialias: false,\n forceFXAA: false,\n autoResize: false,\n transparent: false,\n backgroundColor: 0x000000,\n clearBeforeRender: true,\n preserveDrawingBuffer: false,\n roundPixels: false,\n width: 800,\n height: 600,\n legacy: false,\n },\n\n /**\n * Default transform type.\n *\n * @static\n * @memberof PIXI.settings\n * @type {PIXI.TRANSFORM_MODE}\n * @default PIXI.TRANSFORM_MODE.STATIC\n */\n TRANSFORM_MODE: 0,\n\n /**\n * Default Garbage Collection mode.\n *\n * @static\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: 0,\n\n /**\n * Default Garbage Collection max idle.\n *\n * @static\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n\n /**\n * Default Garbage Collection maximum check count.\n *\n * @static\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n\n /**\n * Default wrap modes that are supported by pixi.\n *\n * @static\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: 0,\n\n /**\n * The scale modes that are supported by pixi.\n *\n * @static\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: 0,\n\n /**\n * Default specify float precision in vertex shader.\n *\n * @static\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: 'highp',\n\n /**\n * Default specify float precision in fragment shader.\n *\n * @static\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: 'mediump',\n\n /**\n * Can we upload the same buffer in a single frame?\n *\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n\n /**\n * Default Mesh `canvasPadding`.\n *\n * @see PIXI.mesh.Mesh#canvasPadding\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {number}\n */\n MESH_CANVAS_PADDING: 0,\n};\n","import { Point, ObservablePoint, Rectangle } from '../math';\nimport { sign, TextureCache } from '../utils';\nimport { BLEND_MODES } from '../const';\nimport Texture from '../textures/Texture';\nimport Container from '../display/Container';\n\nconst tempPoint = new Point();\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n *\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = new PIXI.Sprite.fromImage('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}:\n *\n * ```js\n * PIXI.loader.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.loader.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport default class Sprite extends Container\n{\n /**\n * @param {PIXI.Texture} texture - The texture for this sprite\n */\n constructor(texture)\n {\n super();\n\n /**\n * The anchor sets the origin point of the texture.\n * The default is 0,0 or taken from the {@link PIXI.Texture#defaultAnchor|Texture}\n * passed to the constructor. A value of 0,0 means the texture's origin is the top left.\n * Setting the anchor to 0.5,0.5 means the texture's origin is centered.\n * Setting the anchor to 1,1 would mean the texture's origin point will be the bottom right corner.\n * Note: Updating the {@link PIXI.Texture#defaultAnchor} after a Texture is\n * created does _not_ update the Sprite's anchor values.\n *\n * @member {PIXI.ObservablePoint}\n * @private\n */\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n /**\n * The texture that the sprite is using\n *\n * @private\n * @member {PIXI.Texture}\n */\n this._texture = null;\n\n /**\n * The width of the sprite (this is initially set by the texture)\n *\n * @private\n * @member {number}\n */\n this._width = 0;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n *\n * @private\n * @member {number}\n */\n this._height = 0;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this._tint = null;\n this._tintRGB = null;\n this.tint = 0xFFFFFF;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = BLEND_MODES.NORMAL;\n\n /**\n * The shader that will be used to render the sprite. Set to null to remove a current shader.\n *\n * @member {PIXI.Filter|PIXI.Shader}\n */\n this.shader = null;\n\n /**\n * An internal cached value of the tint.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this.cachedTint = 0xFFFFFF;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n\n /**\n * this is used to store the vertex data of the sprite (basically a quad)\n *\n * @private\n * @member {Float32Array}\n */\n this.vertexData = new Float32Array(8);\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite\n *\n * @private\n * @member {Float32Array}\n */\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_renderWebGL' & '_renderCanvas' methods.\n *\n * @member {string}\n * @default 'sprite'\n */\n this.pluginName = 'sprite';\n }\n\n /**\n * When the texture is updated, this event will fire to update the scale and frame\n *\n * @private\n */\n _onTextureUpdate()\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this.cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n }\n\n /**\n * Called when the anchor position updates.\n *\n * @private\n */\n _onAnchorUpdate()\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }\n\n /**\n * calculates worldTransform * vertices, store it in vertexData\n */\n calculateVertices()\n {\n if (this._transformID === this.transform._worldID && this._textureID === this._texture._updateID)\n {\n return;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = this._texture._updateID;\n\n // set the vertex data\n\n const texture = this._texture;\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const vertexData = this.vertexData;\n const trim = texture.trim;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData\n * This is used to ensure that the true width and height of a trimmed texture is respected\n */\n calculateTrimmedVertices()\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n const texture = this._texture;\n const vertexData = this.vertexTrimmedData;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const w1 = -anchor._x * orig.width;\n const w0 = w1 + orig.width;\n\n const h1 = -anchor._y * orig.height;\n const h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n *\n * Renders the object using the WebGL renderer\n *\n * @private\n * @param {PIXI.WebGLRenderer} renderer - The webgl renderer to use.\n */\n _renderWebGL(renderer)\n {\n this.calculateVertices();\n\n renderer.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\n _renderCanvas(renderer)\n {\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * Updates the bounds of the sprite.\n *\n * @private\n */\n _calculateBounds()\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n getLocalBounds(rect)\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._texture.orig.width * -this._anchor._x;\n this._bounds.minY = this._texture.orig.height * -this._anchor._y;\n this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Tests if a point is inside this sprite\n *\n * @param {PIXI.Point} point - the point to test\n * @return {boolean} the result of the test\n */\n containsPoint(point)\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._texture.orig.width;\n const height = this._texture.orig.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n destroy(options)\n {\n super.destroy(options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n const destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n const destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n this.shader = null;\n }\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source Source to create texture from\n * @return {PIXI.Sprite} The newly created sprite\n */\n static from(source)\n {\n return new Sprite(Texture.from(source));\n }\n\n /**\n * Helper function that creates a sprite that will contain a texture from the TextureCache based on the frameId\n * The frame ids are created when a Texture packer file has been loaded\n *\n * @static\n * @param {string} frameId - The frame Id of the texture in the cache\n * @return {PIXI.Sprite} A new Sprite using a texture from the texture cache matching the frameId\n */\n static fromFrame(frameId)\n {\n const texture = TextureCache[frameId];\n\n if (!texture)\n {\n throw new Error(`The frameId \"${frameId}\" does not exist in the texture cache`);\n }\n\n return new Sprite(texture);\n }\n\n /**\n * Helper function that creates a sprite that will contain a texture based on an image url\n * If the image is not in the texture cache it will be loaded\n *\n * @static\n * @param {string} imageId - The image url of the texture\n * @param {boolean} [crossorigin=(auto)] - if you want to specify the cross-origin parameter\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - if you want to specify the scale mode,\n * see {@link PIXI.SCALE_MODES} for possible values\n * @return {PIXI.Sprite} A new Sprite using a texture from the texture cache matching the image id\n */\n static fromImage(imageId, crossorigin, scaleMode)\n {\n return new Sprite(Texture.fromImage(imageId, crossorigin, scaleMode));\n }\n\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width()\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value) // eslint-disable-line require-jsdoc\n {\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /**\n * The height of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height()\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value) // eslint-disable-line require-jsdoc\n {\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * The anchor sets the origin point of the texture.\n * The default is 0,0 or taken from the {@link PIXI.Texture|Texture} passed to the constructor.\n * Setting the texture at a later point of time does not change the anchor.\n *\n * 0,0 means the texture's origin is the top left, 0.5,0.5 is the center, 1,1 the bottom right corner.\n *\n * @member {PIXI.ObservablePoint}\n */\n get anchor()\n {\n return this._anchor;\n }\n\n set anchor(value) // eslint-disable-line require-jsdoc\n {\n this._anchor.copy(value);\n }\n\n /**\n * The tint applied to the sprite. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint()\n {\n return this._tint;\n }\n\n set tint(value) // eslint-disable-line require-jsdoc\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /**\n * The texture that the sprite is using\n *\n * @member {PIXI.Texture}\n */\n get texture()\n {\n return this._texture;\n }\n\n set texture(value) // eslint-disable-line require-jsdoc\n {\n if (this._texture === value)\n {\n return;\n }\n\n this._texture = value || Texture.EMPTY;\n this.cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.hasLoaded)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n}\n","import CanvasRenderer from '../../renderers/canvas/CanvasRenderer';\nimport { SCALE_MODES } from '../../const';\nimport { Matrix, GroupD8 } from '../../math';\nimport CanvasTinter from './CanvasTinter';\n\nconst canvasRenderWorldTransform = new Matrix();\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers <mattdesl> https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now\n * share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's CanvasSpriteRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/CanvasSpriteRenderer.java\n */\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport default class CanvasSpriteRenderer\n{\n /**\n * @param {PIXI.WebGLRenderer} renderer -The renderer sprite this batch works for.\n */\n constructor(renderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Renders the sprite object.\n *\n * @param {PIXI.Sprite} sprite - the sprite to render when using this spritebatch\n */\n render(sprite)\n {\n const texture = sprite._texture;\n const renderer = this.renderer;\n\n const width = texture._frame.width;\n const height = texture._frame.height;\n\n let wt = sprite.transform.worldTransform;\n let dx = 0;\n let dy = 0;\n\n if (texture.orig.width <= 0 || texture.orig.height <= 0 || !texture.baseTexture.source)\n {\n return;\n }\n\n renderer.setBlendMode(sprite.blendMode);\n\n // Ignore null sources\n if (texture.valid)\n {\n renderer.context.globalAlpha = sprite.worldAlpha;\n\n // If smoothingEnabled is supported and we need to change the smoothing property for sprite texture\n const smoothingEnabled = texture.baseTexture.scaleMode === SCALE_MODES.LINEAR;\n\n if (renderer.smoothProperty && renderer.context[renderer.smoothProperty] !== smoothingEnabled)\n {\n renderer.context[renderer.smoothProperty] = smoothingEnabled;\n }\n\n if (texture.trim)\n {\n dx = (texture.trim.width / 2) + texture.trim.x - (sprite.anchor.x * texture.orig.width);\n dy = (texture.trim.height / 2) + texture.trim.y - (sprite.anchor.y * texture.orig.height);\n }\n else\n {\n dx = (0.5 - sprite.anchor.x) * texture.orig.width;\n dy = (0.5 - sprite.anchor.y) * texture.orig.height;\n }\n\n if (texture.rotate)\n {\n wt.copy(canvasRenderWorldTransform);\n wt = canvasRenderWorldTransform;\n GroupD8.matrixAppendRotationInv(wt, texture.rotate, dx, dy);\n // the anchor has already been applied above, so lets set it to zero\n dx = 0;\n dy = 0;\n }\n\n dx -= width / 2;\n dy -= height / 2;\n\n // Allow for pixel rounding\n if (renderer.roundPixels)\n {\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n (wt.tx * renderer.resolution) | 0,\n (wt.ty * renderer.resolution) | 0\n );\n\n dx = dx | 0;\n dy = dy | 0;\n }\n else\n {\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n\n const resolution = texture.baseTexture.resolution;\n\n if (sprite.tint !== 0xFFFFFF)\n {\n if (sprite.cachedTint !== sprite.tint || sprite.tintedTexture.tintId !== sprite._texture._updateID)\n {\n sprite.cachedTint = sprite.tint;\n\n // TODO clean up caching - how to clean up the caches?\n sprite.tintedTexture = CanvasTinter.getTintedTexture(sprite, sprite.tint);\n }\n\n renderer.context.drawImage(\n sprite.tintedTexture,\n 0,\n 0,\n width * resolution,\n height * resolution,\n dx * renderer.resolution,\n dy * renderer.resolution,\n width * renderer.resolution,\n height * renderer.resolution\n );\n }\n else\n {\n renderer.context.drawImage(\n texture.baseTexture.source,\n texture._frame.x * resolution,\n texture._frame.y * resolution,\n width * resolution,\n height * resolution,\n dx * renderer.resolution,\n dy * renderer.resolution,\n width * renderer.resolution,\n height * renderer.resolution\n );\n }\n }\n }\n\n /**\n * destroy the sprite object.\n *\n */\n destroy()\n {\n this.renderer = null;\n }\n}\n\nCanvasRenderer.registerPlugin('sprite', CanvasSpriteRenderer);\n","import { hex2rgb, rgb2hex } from '../../utils';\nimport canUseNewCanvasBlendModes from '../../renderers/canvas/utils/canUseNewCanvasBlendModes';\n\n/**\n * Utility methods for Sprite/Texture tinting.\n *\n * @class\n * @memberof PIXI\n */\nconst CanvasTinter = {\n /**\n * Basically this method just needs a sprite and a color and tints the sprite with the given color.\n *\n * @memberof PIXI.CanvasTinter\n * @param {PIXI.Sprite} sprite - the sprite to tint\n * @param {number} color - the color to use to tint the sprite with\n * @return {HTMLCanvasElement} The tinted canvas\n */\n getTintedTexture: (sprite, color) =>\n {\n const texture = sprite._texture;\n\n color = CanvasTinter.roundColor(color);\n\n const stringColor = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n\n texture.tintCache = texture.tintCache || {};\n\n const cachedTexture = texture.tintCache[stringColor];\n\n let canvas;\n\n if (cachedTexture)\n {\n if (cachedTexture.tintId === texture._updateID)\n {\n return texture.tintCache[stringColor];\n }\n\n canvas = texture.tintCache[stringColor];\n }\n else\n {\n canvas = CanvasTinter.canvas || document.createElement('canvas');\n }\n\n CanvasTinter.tintMethod(texture, color, canvas);\n\n canvas.tintId = texture._updateID;\n\n if (CanvasTinter.convertTintToImage)\n {\n // is this better?\n const tintImage = new Image();\n\n tintImage.src = canvas.toDataURL();\n\n texture.tintCache[stringColor] = tintImage;\n }\n else\n {\n texture.tintCache[stringColor] = canvas;\n // if we are not converting the texture to an image then we need to lose the reference to the canvas\n CanvasTinter.canvas = null;\n }\n\n return canvas;\n },\n\n /**\n * Tint a texture using the 'multiply' operation.\n *\n * @memberof PIXI.CanvasTinter\n * @param {PIXI.Texture} texture - the texture to tint\n * @param {number} color - the color to use to tint the sprite with\n * @param {HTMLCanvasElement} canvas - the current canvas\n */\n tintWithMultiply: (texture, color, canvas) =>\n {\n const context = canvas.getContext('2d');\n const crop = texture._frame.clone();\n const resolution = texture.baseTexture.resolution;\n\n crop.x *= resolution;\n crop.y *= resolution;\n crop.width *= resolution;\n crop.height *= resolution;\n\n canvas.width = Math.ceil(crop.width);\n canvas.height = Math.ceil(crop.height);\n\n context.save();\n context.fillStyle = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n\n context.fillRect(0, 0, crop.width, crop.height);\n\n context.globalCompositeOperation = 'multiply';\n\n context.drawImage(\n texture.baseTexture.source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n\n context.globalCompositeOperation = 'destination-atop';\n\n context.drawImage(\n texture.baseTexture.source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n context.restore();\n },\n\n /**\n * Tint a texture using the 'overlay' operation.\n *\n * @memberof PIXI.CanvasTinter\n * @param {PIXI.Texture} texture - the texture to tint\n * @param {number} color - the color to use to tint the sprite with\n * @param {HTMLCanvasElement} canvas - the current canvas\n */\n tintWithOverlay(texture, color, canvas)\n {\n const context = canvas.getContext('2d');\n const crop = texture._frame.clone();\n const resolution = texture.baseTexture.resolution;\n\n crop.x *= resolution;\n crop.y *= resolution;\n crop.width *= resolution;\n crop.height *= resolution;\n\n canvas.width = Math.ceil(crop.width);\n canvas.height = Math.ceil(crop.height);\n\n context.save();\n context.globalCompositeOperation = 'copy';\n context.fillStyle = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n context.fillRect(0, 0, crop.width, crop.height);\n\n context.globalCompositeOperation = 'destination-atop';\n context.drawImage(\n texture.baseTexture.source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n\n // context.globalCompositeOperation = 'copy';\n context.restore();\n },\n\n /**\n * Tint a texture pixel per pixel.\n *\n * @memberof PIXI.CanvasTinter\n * @param {PIXI.Texture} texture - the texture to tint\n * @param {number} color - the color to use to tint the sprite with\n * @param {HTMLCanvasElement} canvas - the current canvas\n */\n tintWithPerPixel: (texture, color, canvas) =>\n {\n const context = canvas.getContext('2d');\n const crop = texture._frame.clone();\n const resolution = texture.baseTexture.resolution;\n\n crop.x *= resolution;\n crop.y *= resolution;\n crop.width *= resolution;\n crop.height *= resolution;\n\n canvas.width = Math.ceil(crop.width);\n canvas.height = Math.ceil(crop.height);\n\n context.save();\n context.globalCompositeOperation = 'copy';\n context.drawImage(\n texture.baseTexture.source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n context.restore();\n\n const rgbValues = hex2rgb(color);\n const r = rgbValues[0];\n const g = rgbValues[1];\n const b = rgbValues[2];\n\n const pixelData = context.getImageData(0, 0, crop.width, crop.height);\n\n const pixels = pixelData.data;\n\n for (let i = 0; i < pixels.length; i += 4)\n {\n pixels[i + 0] *= r;\n pixels[i + 1] *= g;\n pixels[i + 2] *= b;\n }\n\n context.putImageData(pixelData, 0, 0);\n },\n\n /**\n * Rounds the specified color according to the CanvasTinter.cacheStepsPerColorChannel.\n *\n * @memberof PIXI.CanvasTinter\n * @param {number} color - the color to round, should be a hex color\n * @return {number} The rounded color.\n */\n roundColor: (color) =>\n {\n const step = CanvasTinter.cacheStepsPerColorChannel;\n\n const rgbValues = hex2rgb(color);\n\n rgbValues[0] = Math.min(255, (rgbValues[0] / step) * step);\n rgbValues[1] = Math.min(255, (rgbValues[1] / step) * step);\n rgbValues[2] = Math.min(255, (rgbValues[2] / step) * step);\n\n return rgb2hex(rgbValues);\n },\n\n /**\n * Number of steps which will be used as a cap when rounding colors.\n *\n * @memberof PIXI.CanvasTinter\n * @type {number}\n */\n cacheStepsPerColorChannel: 8,\n\n /**\n * Tint cache boolean flag.\n *\n * @memberof PIXI.CanvasTinter\n * @type {boolean}\n */\n convertTintToImage: false,\n\n /**\n * Whether or not the Canvas BlendModes are supported, consequently the ability to tint using the multiply method.\n *\n * @memberof PIXI.CanvasTinter\n * @type {boolean}\n */\n canUseMultiply: canUseNewCanvasBlendModes(),\n\n /**\n * The tinting method that will be used.\n *\n * @memberof PIXI.CanvasTinter\n * @type {tintMethodFunctionType}\n */\n tintMethod: 0,\n};\n\nCanvasTinter.tintMethod = CanvasTinter.canUseMultiply ? CanvasTinter.tintWithMultiply : CanvasTinter.tintWithPerPixel;\n\n/**\n * The tintMethod type.\n *\n * @memberof PIXI.CanvasTinter\n * @callback tintMethodFunctionType\n * @param texture {PIXI.Texture} the texture to tint\n * @param color {number} the color to use to tint the sprite with\n * @param canvas {HTMLCanvasElement} the current canvas\n */\n\nexport default CanvasTinter;\n","/**\n * @class\n * @memberof PIXI\n */\nexport default class Buffer\n{\n /**\n * @param {number} size - The size of the buffer in bytes.\n */\n constructor(size)\n {\n this.vertices = new ArrayBuffer(size);\n\n /**\n * View on the vertices as a Float32Array for positions\n *\n * @member {Float32Array}\n */\n this.float32View = new Float32Array(this.vertices);\n\n /**\n * View on the vertices as a Uint32Array for uvs\n *\n * @member {Float32Array}\n */\n this.uint32View = new Uint32Array(this.vertices);\n }\n\n /**\n * Destroys the buffer.\n *\n */\n destroy()\n {\n this.vertices = null;\n this.positions = null;\n this.uvs = null;\n this.colors = null;\n }\n}\n","import ObjectRenderer from '../../renderers/webgl/utils/ObjectRenderer';\nimport WebGLRenderer from '../../renderers/webgl/WebGLRenderer';\nimport createIndicesForQuads from '../../utils/createIndicesForQuads';\nimport generateMultiTextureShader from './generateMultiTextureShader';\nimport checkMaxIfStatmentsInShader from '../../renderers/webgl/utils/checkMaxIfStatmentsInShader';\nimport Buffer from './BatchBuffer';\nimport settings from '../../settings';\nimport { premultiplyBlendMode, premultiplyTint } from '../../utils';\nimport glCore from 'pixi-gl-core';\nimport bitTwiddle from 'bit-twiddle';\n\nlet TICK = 0;\nlet TEXTURE_TICK = 0;\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * @class\n * @private\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nexport default class SpriteRenderer extends ObjectRenderer\n{\n /**\n * @param {PIXI.WebGLRenderer} renderer - The renderer this sprite batch works for.\n */\n constructor(renderer)\n {\n super(renderer);\n\n /**\n * Number of values sent in the vertex buffer.\n * aVertexPosition(2), aTextureCoord(1), aColor(1), aTextureId(1) = 5\n *\n * @member {number}\n */\n this.vertSize = 5;\n\n /**\n * The size of the vertex information in bytes.\n *\n * @member {number}\n */\n this.vertByteSize = this.vertSize * 4;\n\n /**\n * The number of images in the SpriteRenderer before it flushes.\n *\n * @member {number}\n */\n this.size = settings.SPRITE_BATCH_SIZE; // 2000 is a nice balance between mobile / desktop\n\n // the total number of bytes in our batch\n // let numVerts = this.size * 4 * this.vertByteSize;\n\n this.buffers = [];\n for (let i = 1; i <= bitTwiddle.nextPow2(this.size); i *= 2)\n {\n this.buffers.push(new Buffer(i * 4 * this.vertByteSize));\n }\n\n /**\n * Holds the indices of the geometry (quads) to draw\n *\n * @member {Uint16Array}\n */\n this.indices = createIndicesForQuads(this.size);\n\n /**\n * The default shaders that is used if a sprite doesn't have a more specific one.\n * there is a shader for each number of textures that can be rendererd.\n * These shaders will also be generated on the fly as required.\n * @member {PIXI.Shader[]}\n */\n this.shader = null;\n\n this.currentIndex = 0;\n this.groups = [];\n\n for (let k = 0; k < this.size; k++)\n {\n this.groups[k] = { textures: [], textureCount: 0, ids: [], size: 0, start: 0, blend: 0 };\n }\n\n this.sprites = [];\n\n this.vertexBuffers = [];\n this.vaos = [];\n\n this.vaoMax = 2;\n this.vertexCount = 0;\n\n this.renderer.on('prerender', this.onPrerender, this);\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n */\n onContextChange()\n {\n const gl = this.renderer.gl;\n\n if (this.renderer.legacy)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatmentsInShader(this.MAX_TEXTURES, gl);\n }\n\n this.shader = generateMultiTextureShader(gl, this.MAX_TEXTURES);\n\n // create a couple of buffers\n this.indexBuffer = glCore.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW);\n\n // we use the second shader as the first one depending on your browser may omit aTextureId\n // as it is not used by the shader so is optimized out.\n\n this.renderer.bindVao(null);\n\n const attrs = this.shader.attributes;\n\n for (let i = 0; i < this.vaoMax; i++)\n {\n /* eslint-disable max-len */\n const vertexBuffer = this.vertexBuffers[i] = glCore.GLBuffer.createVertexBuffer(gl, null, gl.STREAM_DRAW);\n /* eslint-enable max-len */\n\n // build the vao object that will render..\n const vao = this.renderer.createVao()\n .addIndex(this.indexBuffer)\n .addAttribute(vertexBuffer, attrs.aVertexPosition, gl.FLOAT, false, this.vertByteSize, 0)\n .addAttribute(vertexBuffer, attrs.aTextureCoord, gl.UNSIGNED_SHORT, true, this.vertByteSize, 2 * 4)\n .addAttribute(vertexBuffer, attrs.aColor, gl.UNSIGNED_BYTE, true, this.vertByteSize, 3 * 4);\n\n if (attrs.aTextureId)\n {\n vao.addAttribute(vertexBuffer, attrs.aTextureId, gl.FLOAT, false, this.vertByteSize, 4 * 4);\n }\n\n this.vaos[i] = vao;\n }\n\n this.vao = this.vaos[0];\n this.currentBlendMode = 99999;\n\n this.boundTextures = new Array(this.MAX_TEXTURES);\n }\n\n /**\n * Called before the renderer starts rendering.\n *\n */\n onPrerender()\n {\n this.vertexCount = 0;\n }\n\n /**\n * Renders the sprite object.\n *\n * @param {PIXI.Sprite} sprite - the sprite to render when using this spritebatch\n */\n render(sprite)\n {\n // TODO set blend modes..\n // check texture..\n if (this.currentIndex >= this.size)\n {\n this.flush();\n }\n\n // get the uvs for the texture\n\n // if the uvs have not updated then no point rendering just yet!\n if (!sprite._texture._uvs)\n {\n return;\n }\n\n // push a texture.\n // increment the batchsize\n this.sprites[this.currentIndex++] = sprite;\n }\n\n /**\n * Renders the content and empties the current batch.\n *\n */\n flush()\n {\n if (this.currentIndex === 0)\n {\n return;\n }\n\n const gl = this.renderer.gl;\n const MAX_TEXTURES = this.MAX_TEXTURES;\n\n const np2 = bitTwiddle.nextPow2(this.currentIndex);\n const log2 = bitTwiddle.log2(np2);\n const buffer = this.buffers[log2];\n\n const sprites = this.sprites;\n const groups = this.groups;\n\n const float32View = buffer.float32View;\n const uint32View = buffer.uint32View;\n\n const boundTextures = this.boundTextures;\n const rendererBoundTextures = this.renderer.boundTextures;\n const touch = this.renderer.textureGC.count;\n\n let index = 0;\n let nextTexture;\n let currentTexture;\n let groupCount = 1;\n let textureCount = 0;\n let currentGroup = groups[0];\n let vertexData;\n let uvs;\n let blendMode = premultiplyBlendMode[\n sprites[0]._texture.baseTexture.premultipliedAlpha ? 1 : 0][sprites[0].blendMode];\n\n currentGroup.textureCount = 0;\n currentGroup.start = 0;\n currentGroup.blend = blendMode;\n\n TICK++;\n\n let i;\n\n // copy textures..\n for (i = 0; i < MAX_TEXTURES; ++i)\n {\n const bt = rendererBoundTextures[i];\n\n if (bt._enabled === TICK)\n {\n boundTextures[i] = this.renderer.emptyTextures[i];\n continue;\n }\n\n boundTextures[i] = bt;\n bt._virtalBoundId = i;\n bt._enabled = TICK;\n }\n TICK++;\n\n for (i = 0; i < this.currentIndex; ++i)\n {\n // upload the sprite elemetns...\n // they have all ready been calculated so we just need to push them into the buffer.\n const sprite = sprites[i];\n\n sprites[i] = null;\n\n nextTexture = sprite._texture.baseTexture;\n\n const spriteBlendMode = premultiplyBlendMode[Number(nextTexture.premultipliedAlpha)][sprite.blendMode];\n\n if (blendMode !== spriteBlendMode)\n {\n // finish a group..\n blendMode = spriteBlendMode;\n\n // force the batch to break!\n currentTexture = null;\n textureCount = MAX_TEXTURES;\n TICK++;\n }\n\n if (currentTexture !== nextTexture)\n {\n currentTexture = nextTexture;\n\n if (nextTexture._enabled !== TICK)\n {\n if (textureCount === MAX_TEXTURES)\n {\n TICK++;\n\n currentGroup.size = i - currentGroup.start;\n\n textureCount = 0;\n\n currentGroup = groups[groupCount++];\n currentGroup.blend = blendMode;\n currentGroup.textureCount = 0;\n currentGroup.start = i;\n }\n\n nextTexture.touched = touch;\n\n if (nextTexture._virtalBoundId === -1)\n {\n for (let j = 0; j < MAX_TEXTURES; ++j)\n {\n const tIndex = (j + TEXTURE_TICK) % MAX_TEXTURES;\n\n const t = boundTextures[tIndex];\n\n if (t._enabled !== TICK)\n {\n TEXTURE_TICK++;\n\n t._virtalBoundId = -1;\n\n nextTexture._virtalBoundId = tIndex;\n\n boundTextures[tIndex] = nextTexture;\n break;\n }\n }\n }\n\n nextTexture._enabled = TICK;\n\n currentGroup.textureCount++;\n currentGroup.ids[textureCount] = nextTexture._virtalBoundId;\n currentGroup.textures[textureCount++] = nextTexture;\n }\n }\n\n vertexData = sprite.vertexData;\n\n // TODO this sum does not need to be set each frame..\n uvs = sprite._texture._uvs.uvsUint32;\n\n if (this.renderer.roundPixels)\n {\n const resolution = this.renderer.resolution;\n\n // xy\n float32View[index] = ((vertexData[0] * resolution) | 0) / resolution;\n float32View[index + 1] = ((vertexData[1] * resolution) | 0) / resolution;\n\n // xy\n float32View[index + 5] = ((vertexData[2] * resolution) | 0) / resolution;\n float32View[index + 6] = ((vertexData[3] * resolution) | 0) / resolution;\n\n // xy\n float32View[index + 10] = ((vertexData[4] * resolution) | 0) / resolution;\n float32View[index + 11] = ((vertexData[5] * resolution) | 0) / resolution;\n\n // xy\n float32View[index + 15] = ((vertexData[6] * resolution) | 0) / resolution;\n float32View[index + 16] = ((vertexData[7] * resolution) | 0) / resolution;\n }\n else\n {\n // xy\n float32View[index] = vertexData[0];\n float32View[index + 1] = vertexData[1];\n\n // xy\n float32View[index + 5] = vertexData[2];\n float32View[index + 6] = vertexData[3];\n\n // xy\n float32View[index + 10] = vertexData[4];\n float32View[index + 11] = vertexData[5];\n\n // xy\n float32View[index + 15] = vertexData[6];\n float32View[index + 16] = vertexData[7];\n }\n\n uint32View[index + 2] = uvs[0];\n uint32View[index + 7] = uvs[1];\n uint32View[index + 12] = uvs[2];\n uint32View[index + 17] = uvs[3];\n /* eslint-disable max-len */\n const alpha = Math.min(sprite.worldAlpha, 1.0);\n // we dont call extra function if alpha is 1.0, that's faster\n const argb = alpha < 1.0 && nextTexture.premultipliedAlpha ? premultiplyTint(sprite._tintRGB, alpha)\n : sprite._tintRGB + (alpha * 255 << 24);\n\n uint32View[index + 3] = uint32View[index + 8] = uint32View[index + 13] = uint32View[index + 18] = argb;\n float32View[index + 4] = float32View[index + 9] = float32View[index + 14] = float32View[index + 19] = nextTexture._virtalBoundId;\n /* eslint-enable max-len */\n\n index += 20;\n }\n\n currentGroup.size = i - currentGroup.start;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // this is still needed for IOS performance..\n // it really does not like uploading to the same buffer in a single frame!\n if (this.vaoMax <= this.vertexCount)\n {\n this.vaoMax++;\n\n const attrs = this.shader.attributes;\n\n /* eslint-disable max-len */\n const vertexBuffer = this.vertexBuffers[this.vertexCount] = glCore.GLBuffer.createVertexBuffer(gl, null, gl.STREAM_DRAW);\n /* eslint-enable max-len */\n\n // build the vao object that will render..\n const vao = this.renderer.createVao()\n .addIndex(this.indexBuffer)\n .addAttribute(vertexBuffer, attrs.aVertexPosition, gl.FLOAT, false, this.vertByteSize, 0)\n .addAttribute(vertexBuffer, attrs.aTextureCoord, gl.UNSIGNED_SHORT, true, this.vertByteSize, 2 * 4)\n .addAttribute(vertexBuffer, attrs.aColor, gl.UNSIGNED_BYTE, true, this.vertByteSize, 3 * 4);\n\n if (attrs.aTextureId)\n {\n vao.addAttribute(vertexBuffer, attrs.aTextureId, gl.FLOAT, false, this.vertByteSize, 4 * 4);\n }\n\n this.vaos[this.vertexCount] = vao;\n }\n\n this.renderer.bindVao(this.vaos[this.vertexCount]);\n\n this.vertexBuffers[this.vertexCount].upload(buffer.vertices, 0, false);\n\n this.vertexCount++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n this.vertexBuffers[this.vertexCount].upload(buffer.vertices, 0, true);\n }\n\n for (i = 0; i < MAX_TEXTURES; ++i)\n {\n rendererBoundTextures[i]._virtalBoundId = -1;\n }\n\n // render the groups..\n for (i = 0; i < groupCount; ++i)\n {\n const group = groups[i];\n const groupTextureCount = group.textureCount;\n\n for (let j = 0; j < groupTextureCount; j++)\n {\n currentTexture = group.textures[j];\n\n // reset virtual ids..\n // lets do a quick check..\n if (rendererBoundTextures[group.ids[j]] !== currentTexture)\n {\n this.renderer.bindTexture(currentTexture, group.ids[j], true);\n }\n\n // reset the virtualId..\n currentTexture._virtalBoundId = -1;\n }\n\n // set the blend mode..\n this.renderer.state.setBlendMode(group.blend);\n\n gl.drawElements(gl.TRIANGLES, group.size * 6, gl.UNSIGNED_SHORT, group.start * 6 * 2);\n }\n\n // reset elements for the next flush\n this.currentIndex = 0;\n }\n\n /**\n * Starts a new sprite batch.\n */\n start()\n {\n this.renderer.bindShader(this.shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.bindVao(this.vaos[this.vertexCount]);\n\n this.vertexBuffers[this.vertexCount].bind();\n }\n }\n\n /**\n * Stops and flushes the current batch.\n *\n */\n stop()\n {\n this.flush();\n }\n\n /**\n * Destroys the SpriteRenderer.\n *\n */\n destroy()\n {\n for (let i = 0; i < this.vaoMax; i++)\n {\n if (this.vertexBuffers[i])\n {\n this.vertexBuffers[i].destroy();\n }\n if (this.vaos[i])\n {\n this.vaos[i].destroy();\n }\n }\n\n if (this.indexBuffer)\n {\n this.indexBuffer.destroy();\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n super.destroy();\n\n if (this.shader)\n {\n this.shader.destroy();\n this.shader = null;\n }\n\n this.vertexBuffers = null;\n this.vaos = null;\n this.indexBuffer = null;\n this.indices = null;\n\n this.sprites = null;\n\n for (let i = 0; i < this.buffers.length; ++i)\n {\n this.buffers[i].destroy();\n }\n }\n}\n\nWebGLRenderer.registerPlugin('sprite', SpriteRenderer);\n","import Shader from '../../Shader';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\n\nconst fragTemplate = [\n 'varying vec2 vTextureCoord;',\n 'varying vec4 vColor;',\n 'varying float vTextureId;',\n 'uniform sampler2D uSamplers[%count%];',\n\n 'void main(void){',\n 'vec4 color;',\n 'float textureId = floor(vTextureId+0.5);',\n '%forloop%',\n 'gl_FragColor = color * vColor;',\n '}',\n].join('\\n');\n\nexport default function generateMultiTextureShader(gl, maxTextures)\n{\n const vertexSrc = readFileSync(join(__dirname, './texture.vert'), 'utf8');\n let fragmentSrc = fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, maxTextures);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, generateSampleSrc(maxTextures));\n\n const shader = new Shader(gl, vertexSrc, fragmentSrc);\n\n const sampleValues = [];\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n shader.bind();\n shader.uniforms.uSamplers = sampleValues;\n\n return shader;\n}\n\nfunction generateSampleSrc(maxTextures)\n{\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (let i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += `if(textureId == ${i}.0)`;\n }\n\n src += '\\n{';\n src += `\\n\\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`;\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/* eslint max-depth: [2, 8] */\nimport Sprite from '../sprites/Sprite';\nimport Texture from '../textures/Texture';\nimport { Rectangle } from '../math';\nimport { sign } from '../utils';\nimport { TEXT_GRADIENT } from '../const';\nimport settings from '../settings';\nimport TextStyle from './TextStyle';\nimport TextMetrics from './TextMetrics';\nimport trimCanvas from '../utils/trimCanvas';\n\nconst defaultDestroyOptions = {\n texture: true,\n children: false,\n baseTexture: true,\n};\n\n/**\n * A Text Object will create a line or multiple lines of text. To split a line you can use '\\n' in your text string,\n * or add a wordWrap property set to true and and wordWrapWidth property with a value in the style object.\n *\n * A Text can be created directly from a string and a style object,\n * which can be generated [here](https://pixijs.io/pixi-text-style).\n *\n * ```js\n * let text = new PIXI.Text('This is a PixiJS text',{fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'});\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI\n */\nexport default class Text extends Sprite\n{\n /**\n * @param {string} text - The string that you would like the text to display\n * @param {object|PIXI.TextStyle} [style] - The style parameters\n * @param {HTMLCanvasElement} [canvas] - The canvas element for drawing text\n */\n constructor(text, style, canvas)\n {\n canvas = canvas || document.createElement('canvas');\n\n canvas.width = 3;\n canvas.height = 3;\n\n const texture = Texture.fromCanvas(canvas, settings.SCALE_MODE, 'text');\n\n texture.orig = new Rectangle();\n texture.trim = new Rectangle();\n\n super(texture);\n\n // base texture is already automatically added to the cache, now adding the actual texture\n Texture.addToCache(this._texture, this._texture.baseTexture.textureCacheIds[0]);\n\n /**\n * The canvas element that everything is drawn to\n *\n * @member {HTMLCanvasElement}\n */\n this.canvas = canvas;\n\n /**\n * The canvas 2d context that everything is drawn with\n * @member {CanvasRenderingContext2D}\n */\n this.context = this.canvas.getContext('2d');\n\n /**\n * The resolution / device pixel ratio of the canvas. This is set automatically by the renderer.\n * @member {number}\n * @default 1\n */\n this.resolution = settings.RESOLUTION;\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = null;\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._style = null;\n /**\n * Private listener to track style changes.\n *\n * @member {Function}\n * @private\n */\n this._styleListener = null;\n\n /**\n * Private tracker for the current font.\n *\n * @member {string}\n * @private\n */\n this._font = '';\n\n this.text = text;\n this.style = style;\n\n this.localStyleID = -1;\n }\n\n /**\n * Renders text and updates it when needed.\n *\n * @private\n * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called.\n */\n updateText(respectDirty)\n {\n const style = this._style;\n\n // check if style has changed..\n if (this.localStyleID !== style.styleID)\n {\n this.dirty = true;\n this.localStyleID = style.styleID;\n }\n\n if (!this.dirty && respectDirty)\n {\n return;\n }\n\n this._font = this._style.toFontString();\n\n const context = this.context;\n const measured = TextMetrics.measureText(this._text, this._style, this._style.wordWrap, this.canvas);\n const width = measured.width;\n const height = measured.height;\n const lines = measured.lines;\n const lineHeight = measured.lineHeight;\n const lineWidths = measured.lineWidths;\n const maxLineWidth = measured.maxLineWidth;\n const fontProperties = measured.fontProperties;\n\n this.canvas.width = Math.ceil((Math.max(1, width) + (style.padding * 2)) * this.resolution);\n this.canvas.height = Math.ceil((Math.max(1, height) + (style.padding * 2)) * this.resolution);\n\n context.scale(this.resolution, this.resolution);\n\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n context.font = this._font;\n context.strokeStyle = style.stroke;\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n let linePositionX;\n let linePositionY;\n\n if (style.dropShadow)\n {\n context.fillStyle = style.dropShadowColor;\n context.globalAlpha = style.dropShadowAlpha;\n context.shadowBlur = style.dropShadowBlur;\n\n if (style.dropShadowBlur > 0)\n {\n context.shadowColor = style.dropShadowColor;\n }\n\n const xShadowOffset = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n const yShadowOffset = Math.sin(style.dropShadowAngle) * style.dropShadowDistance;\n\n for (let i = 0; i < lines.length; i++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = ((style.strokeThickness / 2) + (i * lineHeight)) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style.fill)\n {\n this.drawLetterSpacing(\n lines[i],\n linePositionX + xShadowOffset + style.padding, linePositionY + yShadowOffset + style.padding\n );\n\n if (style.stroke && style.strokeThickness)\n {\n context.strokeStyle = style.dropShadowColor;\n this.drawLetterSpacing(\n lines[i],\n linePositionX + xShadowOffset + style.padding, linePositionY + yShadowOffset + style.padding,\n true\n );\n context.strokeStyle = style.stroke;\n }\n }\n }\n }\n\n // reset the shadow blur and alpha that was set by the drop shadow, for the regular text\n context.shadowBlur = 0;\n context.globalAlpha = 1;\n\n // set canvas text styles\n context.fillStyle = this._generateFillStyle(style, lines);\n\n // draw lines line by line\n for (let i = 0; i < lines.length; i++)\n {\n linePositionX = style.strokeThickness / 2;\n linePositionY = ((style.strokeThickness / 2) + (i * lineHeight)) + fontProperties.ascent;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n this.drawLetterSpacing(\n lines[i],\n linePositionX + style.padding,\n linePositionY + style.padding,\n true\n );\n }\n\n if (style.fill)\n {\n this.drawLetterSpacing(\n lines[i],\n linePositionX + style.padding,\n linePositionY + style.padding\n );\n }\n }\n\n this.updateTexture();\n }\n\n /**\n * Render the text with letter-spacing.\n * @param {string} text - The text to draw\n * @param {number} x - Horizontal position to draw the text\n * @param {number} y - Vertical position to draw the text\n * @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the\n * text? If not, it's for the inside fill\n * @private\n */\n drawLetterSpacing(text, x, y, isStroke = false)\n {\n const style = this._style;\n\n // letterSpacing of 0 means normal\n const letterSpacing = style.letterSpacing;\n\n if (letterSpacing === 0)\n {\n if (isStroke)\n {\n this.context.strokeText(text, x, y);\n }\n else\n {\n this.context.fillText(text, x, y);\n }\n\n return;\n }\n\n const characters = String.prototype.split.call(text, '');\n let currentPosition = x;\n let index = 0;\n let current = '';\n\n while (index < text.length)\n {\n current = characters[index++];\n if (isStroke)\n {\n this.context.strokeText(current, currentPosition, y);\n }\n else\n {\n this.context.fillText(current, currentPosition, y);\n }\n currentPosition += this.context.measureText(current).width + letterSpacing;\n }\n }\n\n /**\n * Updates texture size based on canvas size\n *\n * @private\n */\n updateTexture()\n {\n const canvas = this.canvas;\n\n if (this._style.trim)\n {\n const trimmed = trimCanvas(canvas);\n\n if (trimmed.data)\n {\n canvas.width = trimmed.width;\n canvas.height = trimmed.height;\n this.context.putImageData(trimmed.data, 0, 0);\n }\n }\n\n const texture = this._texture;\n const style = this._style;\n const padding = style.trim ? 0 : style.padding;\n const baseTexture = texture.baseTexture;\n\n baseTexture.hasLoaded = true;\n baseTexture.resolution = this.resolution;\n\n baseTexture.realWidth = canvas.width;\n baseTexture.realHeight = canvas.height;\n baseTexture.width = canvas.width / this.resolution;\n baseTexture.height = canvas.height / this.resolution;\n\n texture.trim.width = texture._frame.width = canvas.width / this.resolution;\n texture.trim.height = texture._frame.height = canvas.height / this.resolution;\n texture.trim.x = -padding;\n texture.trim.y = -padding;\n\n texture.orig.width = texture._frame.width - (padding * 2);\n texture.orig.height = texture._frame.height - (padding * 2);\n\n // call sprite onTextureUpdate to update scale if _width or _height were set\n this._onTextureUpdate();\n\n baseTexture.emit('update', baseTexture);\n\n this.dirty = false;\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @param {PIXI.WebGLRenderer} renderer - The renderer\n */\n renderWebGL(renderer)\n {\n if (this.resolution !== renderer.resolution)\n {\n this.resolution = renderer.resolution;\n this.dirty = true;\n }\n\n this.updateText(true);\n\n super.renderWebGL(renderer);\n }\n\n /**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\n _renderCanvas(renderer)\n {\n if (this.resolution !== renderer.resolution)\n {\n this.resolution = renderer.resolution;\n this.dirty = true;\n }\n\n this.updateText(true);\n\n super._renderCanvas(renderer);\n }\n\n /**\n * Gets the local bounds of the text object.\n *\n * @param {Rectangle} rect - The output rectangle.\n * @return {Rectangle} The bounds.\n */\n getLocalBounds(rect)\n {\n this.updateText(true);\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.\n */\n _calculateBounds()\n {\n this.updateText(true);\n this.calculateVertices();\n // if we have already done this on THIS frame.\n this._bounds.addQuad(this.vertexData);\n }\n\n /**\n * Method to be called upon a TextStyle change.\n * @private\n */\n _onStyleChange()\n {\n this.dirty = true;\n }\n\n /**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\n _generateFillStyle(style, lines)\n {\n if (!Array.isArray(style.fill))\n {\n return style.fill;\n }\n\n // cocoon on canvas+ cannot generate textures, so use the first colour instead\n if (navigator.isCocoonJS)\n {\n return style.fill[0];\n }\n\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n let gradient;\n let totalIterations;\n let currentIteration;\n let stop;\n\n const width = this.canvas.width / this.resolution;\n const height = this.canvas.height / this.resolution;\n\n // make a copy of the style settings, so we can manipulate them later\n const fill = style.fill.slice();\n const fillGradientStops = style.fillGradientStops.slice();\n\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length)\n {\n const lengthPlus1 = fill.length + 1;\n\n for (let i = 1; i < lengthPlus1; ++i)\n {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(style.fill[0]);\n fillGradientStops.unshift(0);\n\n fill.push(style.fill[style.fill.length - 1]);\n fillGradientStops.push(1);\n\n if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL)\n {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = this.context.createLinearGradient(width / 2, 0, width / 2, height);\n\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n totalIterations = (fill.length + 1) * lines.length;\n currentIteration = 0;\n for (let i = 0; i < lines.length; i++)\n {\n currentIteration += 1;\n for (let j = 0; j < fill.length; j++)\n {\n if (typeof fillGradientStops[j] === 'number')\n {\n stop = (fillGradientStops[j] / lines.length) + (i / lines.length);\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[j]);\n currentIteration++;\n }\n }\n }\n else\n {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = this.context.createLinearGradient(0, height / 2, width, height / 2);\n\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n totalIterations = fill.length + 1;\n currentIteration = 1;\n\n for (let i = 0; i < fill.length; i++)\n {\n if (typeof fillGradientStops[i] === 'number')\n {\n stop = fillGradientStops[i];\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i]);\n currentIteration++;\n }\n }\n\n return gradient;\n }\n\n /**\n * Destroys this text object.\n * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as\n * the majority of the time the texture will not be shared with any other Sprites.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well\n */\n destroy(options)\n {\n if (typeof options === 'boolean')\n {\n options = { children: options };\n }\n\n options = Object.assign({}, defaultDestroyOptions, options);\n\n super.destroy(options);\n\n // make sure to reset the the context and canvas.. dont want this hanging around in memory!\n this.context = null;\n this.canvas = null;\n\n this._style = null;\n }\n\n /**\n * The width of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width()\n {\n this.updateText(true);\n\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value) // eslint-disable-line require-jsdoc\n {\n this.updateText(true);\n\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /**\n * The height of the Text, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height()\n {\n this.updateText(true);\n\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value) // eslint-disable-line require-jsdoc\n {\n this.updateText(true);\n\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * Set the style of the text. Set up an event listener to listen for changes on the style\n * object and mark the text as dirty.\n *\n * @member {object|PIXI.TextStyle}\n */\n get style()\n {\n return this._style;\n }\n\n set style(style) // eslint-disable-line require-jsdoc\n {\n style = style || {};\n\n if (style instanceof TextStyle)\n {\n this._style = style;\n }\n else\n {\n this._style = new TextStyle(style);\n }\n\n this.localStyleID = -1;\n this.dirty = true;\n }\n\n /**\n * Set the copy for the text object. To split a line you can use '\\n'.\n *\n * @member {string}\n */\n get text()\n {\n return this._text;\n }\n\n set text(text) // eslint-disable-line require-jsdoc\n {\n text = String(text === '' || text === null || text === undefined ? ' ' : text);\n\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n}\n","/**\n * The TextMetrics object represents the measurement of a block of text with a specified style.\n *\n * ```js\n * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'})\n * let textMetrics = PIXI.TextMetrics.measureText('Your text', style)\n * ```\n *\n * @class\n * @memberOf PIXI\n */\nexport default class TextMetrics\n{\n /**\n * @param {string} text - the text that was measured\n * @param {PIXI.TextStyle} style - the style that was measured\n * @param {number} width - the measured width of the text\n * @param {number} height - the measured height of the text\n * @param {array} lines - an array of the lines of text broken by new lines and wrapping if specified in style\n * @param {array} lineWidths - an array of the line widths for each line matched to `lines`\n * @param {number} lineHeight - the measured line height for this style\n * @param {number} maxLineWidth - the maximum line width for all measured lines\n * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont\n */\n constructor(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties)\n {\n this.text = text;\n this.style = style;\n this.width = width;\n this.height = height;\n this.lines = lines;\n this.lineWidths = lineWidths;\n this.lineHeight = lineHeight;\n this.maxLineWidth = maxLineWidth;\n this.fontProperties = fontProperties;\n }\n\n /**\n * Measures the supplied string of text and returns a Rectangle.\n *\n * @param {string} text - the text to measure.\n * @param {PIXI.TextStyle} style - the text style to use for measuring\n * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text.\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {PIXI.TextMetrics} measured width and height of the text.\n */\n static measureText(text, style, wordWrap, canvas = TextMetrics._canvas)\n {\n wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap;\n const font = style.toFontString();\n const fontProperties = TextMetrics.measureFont(font);\n const context = canvas.getContext('2d');\n\n context.font = font;\n\n const outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text;\n const lines = outputText.split(/(?:\\r\\n|\\r|\\n)/);\n const lineWidths = new Array(lines.length);\n let maxLineWidth = 0;\n\n for (let i = 0; i < lines.length; i++)\n {\n const lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing);\n\n lineWidths[i] = lineWidth;\n maxLineWidth = Math.max(maxLineWidth, lineWidth);\n }\n let width = maxLineWidth + style.strokeThickness;\n\n if (style.dropShadow)\n {\n width += style.dropShadowDistance;\n }\n\n const lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness;\n let height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness)\n + ((lines.length - 1) * (lineHeight + style.leading));\n\n if (style.dropShadow)\n {\n height += style.dropShadowDistance;\n }\n\n return new TextMetrics(\n text,\n style,\n width,\n height,\n lines,\n lineWidths,\n lineHeight + style.leading,\n maxLineWidth,\n fontProperties\n );\n }\n\n /**\n * Applies newlines to a string to have it optimally fit into the horizontal\n * bounds set by the Text object's wordWrapWidth property.\n *\n * @private\n * @param {string} text - String to apply word wrapping to\n * @param {PIXI.TextStyle} style - the style to use when wrapping\n * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.\n * @return {string} New string with new lines applied where required\n */\n static wordWrap(text, style, canvas = TextMetrics._canvas)\n {\n const context = canvas.getContext('2d');\n\n let width = 0;\n let line = '';\n let lines = '';\n\n const cache = {};\n const { letterSpacing, whiteSpace } = style;\n\n // How to handle whitespaces\n const collapseSpaces = TextMetrics.collapseSpaces(whiteSpace);\n const collapseNewlines = TextMetrics.collapseNewlines(whiteSpace);\n\n // whether or not spaces may be added to the beginning of lines\n let canPrependSpaces = !collapseSpaces;\n\n // There is letterSpacing after every char except the last one\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!\n // so for convenience the above needs to be compared to width + 1 extra letterSpace\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_\n // ________________________________________________\n // And then the final space is simply no appended to each line\n const wordWrapWidth = style.wordWrapWidth + letterSpacing;\n\n // break text into words, spaces and newline chars\n const tokens = TextMetrics.tokenize(text);\n\n for (let i = 0; i < tokens.length; i++)\n {\n // get the word, space or newlineChar\n let token = tokens[i];\n\n // if word is a new line\n if (TextMetrics.isNewline(token))\n {\n // keep the new line\n if (!collapseNewlines)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = !collapseSpaces;\n line = '';\n width = 0;\n continue;\n }\n\n // if we should collapse new lines\n // we simply convert it into a space\n token = ' ';\n }\n\n // if we should collapse repeated whitespaces\n if (collapseSpaces)\n {\n // check both this and the last tokens for spaces\n const currIsBreakingSpace = TextMetrics.isBreakingSpace(token);\n const lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]);\n\n if (currIsBreakingSpace && lastIsBreakingSpace)\n {\n continue;\n }\n }\n\n // get word width from cache if possible\n const tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context);\n\n // word is longer than desired bounds\n if (tokenWidth > wordWrapWidth)\n {\n // if we are not already at the beginning of a line\n if (line !== '')\n {\n // start newlines for overflow words\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n // break large word over multiple lines\n if (TextMetrics.canBreakWords(token, style.breakWords))\n {\n // break word into characters\n const characters = token.split('');\n\n // loop the characters\n for (let j = 0; j < characters.length; j++)\n {\n let char = characters[j];\n\n let k = 1;\n // we are not at the end of the token\n\n while (characters[j + k])\n {\n const nextChar = characters[j + k];\n const lastChar = char[char.length - 1];\n\n // should not split chars\n if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords))\n {\n // combine chars & move forward one\n char += nextChar;\n }\n else\n {\n break;\n }\n\n k++;\n }\n\n j += char.length - 1;\n\n const characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context);\n\n if (characterWidth + width > wordWrapWidth)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n\n line += char;\n width += characterWidth;\n }\n }\n\n // run word out of the bounds\n else\n {\n // if there are words in this line already\n // finish that line and start a new one\n if (line.length > 0)\n {\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n const isLastToken = i === tokens.length - 1;\n\n // give it its own line if it's not the end\n lines += TextMetrics.addLine(token, !isLastToken);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n }\n\n // word could fit\n else\n {\n // word won't fit because of existing words\n // start a new line\n if (tokenWidth + width > wordWrapWidth)\n {\n // if its a space we don't want it\n canPrependSpaces = false;\n\n // add a new line\n lines += TextMetrics.addLine(line);\n\n // start a new line\n line = '';\n width = 0;\n }\n\n // don't add spaces to the beginning of lines\n if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces)\n {\n // add the word to the current line\n line += token;\n\n // update width counter\n width += tokenWidth;\n }\n }\n }\n\n lines += TextMetrics.addLine(line, false);\n\n return lines;\n }\n\n /**\n * Convienience function for logging each line added during the wordWrap\n * method\n *\n * @private\n * @param {string} line - The line of text to add\n * @param {boolean} newLine - Add new line character to end\n * @return {string} A formatted line\n */\n static addLine(line, newLine = true)\n {\n line = TextMetrics.trimRight(line);\n\n line = (newLine) ? `${line}\\n` : line;\n\n return line;\n }\n\n /**\n * Gets & sets the widths of calculated characters in a cache object\n *\n * @private\n * @param {string} key The key\n * @param {number} letterSpacing The letter spacing\n * @param {object} cache The cache\n * @param {CanvasRenderingContext2D} context The canvas context\n * @return {number} The from cache.\n */\n static getFromCache(key, letterSpacing, cache, context)\n {\n let width = cache[key];\n\n if (width === undefined)\n {\n const spacing = ((key.length) * letterSpacing);\n\n width = context.measureText(key).width + spacing;\n cache[key] = width;\n }\n\n return width;\n }\n\n /**\n * Determines whether we should collapse breaking spaces\n *\n * @private\n * @param {string} whiteSpace The TextStyle property whiteSpace\n * @return {boolean} should collapse\n */\n static collapseSpaces(whiteSpace)\n {\n return (whiteSpace === 'normal' || whiteSpace === 'pre-line');\n }\n\n /**\n * Determines whether we should collapse newLine chars\n *\n * @private\n * @param {string} whiteSpace The white space\n * @return {boolean} should collapse\n */\n static collapseNewlines(whiteSpace)\n {\n return (whiteSpace === 'normal');\n }\n\n /**\n * trims breaking whitespaces from string\n *\n * @private\n * @param {string} text The text\n * @return {string} trimmed string\n */\n static trimRight(text)\n {\n if (typeof text !== 'string')\n {\n return '';\n }\n\n for (let i = text.length - 1; i >= 0; i--)\n {\n const char = text[i];\n\n if (!TextMetrics.isBreakingSpace(char))\n {\n break;\n }\n\n text = text.slice(0, -1);\n }\n\n return text;\n }\n\n /**\n * Determines if char is a newline.\n *\n * @private\n * @param {string} char The character\n * @return {boolean} True if newline, False otherwise.\n */\n static isNewline(char)\n {\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0);\n }\n\n /**\n * Determines if char is a breaking whitespace.\n *\n * @private\n * @param {string} char The character\n * @return {boolean} True if whitespace, False otherwise.\n */\n static isBreakingSpace(char)\n {\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0);\n }\n\n /**\n * Splits a string into words, breaking-spaces and newLine characters\n *\n * @private\n * @param {string} text The text\n * @return {array} A tokenized array\n */\n static tokenize(text)\n {\n const tokens = [];\n let token = '';\n\n if (typeof text !== 'string')\n {\n return tokens;\n }\n\n for (let i = 0; i < text.length; i++)\n {\n const char = text[i];\n\n if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char))\n {\n if (token !== '')\n {\n tokens.push(token);\n token = '';\n }\n\n tokens.push(char);\n\n continue;\n }\n\n token += char;\n }\n\n if (token !== '')\n {\n tokens.push(token);\n }\n\n return tokens;\n }\n\n /**\n * This method exists to be easily overridden\n * It allows one to customise which words should break\n * Examples are if the token is CJK or numbers.\n * It must return a boolean.\n *\n * @private\n * @param {string} token The token\n * @param {boolean} breakWords The style attr break words\n * @return {boolean} whether to break word or not\n */\n static canBreakWords(token, breakWords)\n {\n return breakWords;\n }\n\n /**\n * This method exists to be easily overridden\n * It allows one to determine whether a pair of characters\n * should be broken by newlines\n * For example certain characters in CJK langs or numbers.\n * It must return a boolean.\n *\n * @private\n * @param {string} char The character\n * @param {string} nextChar The next character\n * @param {string} token The token/word the characters are from\n * @param {number} index The index in the token of the char\n * @param {boolean} breakWords The style attr break words\n * @return {boolean} whether to break word or not\n */\n static canBreakChars(char, nextChar, token, index, breakWords) // eslint-disable-line no-unused-vars\n {\n return true;\n }\n\n /**\n * Calculates the ascent, descent and fontSize of a given font-style\n *\n * @static\n * @param {string} font - String representing the style of the font\n * @return {PIXI.TextMetrics~FontMetrics} Font properties object\n */\n static measureFont(font)\n {\n // as this method is used for preparing assets, don't recalculate things if we don't need to\n if (TextMetrics._fonts[font])\n {\n return TextMetrics._fonts[font];\n }\n\n const properties = {};\n\n const canvas = TextMetrics._canvas;\n const context = TextMetrics._context;\n\n context.font = font;\n\n const metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL;\n const width = Math.ceil(context.measureText(metricsString).width);\n let baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width);\n const height = 2 * baseline;\n\n baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0;\n\n canvas.width = width;\n canvas.height = height;\n\n context.fillStyle = '#f00';\n context.fillRect(0, 0, width, height);\n\n context.font = font;\n\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#000';\n context.fillText(metricsString, 0, baseline);\n\n const imagedata = context.getImageData(0, 0, width, height).data;\n const pixels = imagedata.length;\n const line = width * 4;\n\n let i = 0;\n let idx = 0;\n let stop = false;\n\n // ascent. scan from top to bottom until we find a non red pixel\n for (i = 0; i < baseline; ++i)\n {\n for (let j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n if (!stop)\n {\n idx += line;\n }\n else\n {\n break;\n }\n }\n\n properties.ascent = baseline - i;\n\n idx = pixels - line;\n stop = false;\n\n // descent. scan from bottom to top until we find a non red pixel\n for (i = height; i > baseline; --i)\n {\n for (let j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n\n if (!stop)\n {\n idx -= line;\n }\n else\n {\n break;\n }\n }\n\n properties.descent = i - baseline;\n properties.fontSize = properties.ascent + properties.descent;\n\n TextMetrics._fonts[font] = properties;\n\n return properties;\n }\n\n /**\n * Clear font metrics in metrics cache.\n *\n * @static\n * @param {string} [font] - font name. If font name not set then clear cache for all fonts.\n */\n static clearMetrics(font = '')\n {\n if (font)\n {\n delete TextMetrics._fonts[font];\n }\n else\n {\n TextMetrics._fonts = {};\n }\n }\n}\n\n/**\n * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}.\n * @class FontMetrics\n * @memberof PIXI.TextMetrics~\n * @property {number} ascent - The ascent distance\n * @property {number} descent - The descent distance\n * @property {number} fontSize - Font size from ascent to descent\n */\n\nconst canvas = document.createElement('canvas');\n\ncanvas.width = canvas.height = 10;\n\n/**\n * Cached canvas element for measuring text\n * @memberof PIXI.TextMetrics\n * @type {HTMLCanvasElement}\n * @private\n */\nTextMetrics._canvas = canvas;\n\n/**\n * Cache for context to use.\n * @memberof PIXI.TextMetrics\n * @type {CanvasRenderingContext2D}\n * @private\n */\nTextMetrics._context = canvas.getContext('2d');\n\n/**\n * Cache of PIXI.TextMetrics~FontMetrics objects.\n * @memberof PIXI.TextMetrics\n * @type {Object}\n * @private\n */\nTextMetrics._fonts = {};\n\n/**\n * String used for calculate font metrics.\n * @static\n * @memberof PIXI.TextMetrics\n * @name METRICS_STRING\n * @type {string}\n * @default |Éq\n */\nTextMetrics.METRICS_STRING = '|Éq';\n\n/**\n * Baseline symbol for calculate font metrics.\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_SYMBOL\n * @type {string}\n * @default M\n */\nTextMetrics.BASELINE_SYMBOL = 'M';\n\n/**\n * Baseline multiplier for calculate font metrics.\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_MULTIPLIER\n * @type {number}\n * @default 1.4\n */\nTextMetrics.BASELINE_MULTIPLIER = 1.4;\n\n/**\n * Cache of new line chars.\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._newlines = [\n 0x000A, // line feed\n 0x000D, // carriage return\n];\n\n/**\n * Cache of breaking spaces.\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._breakingSpaces = [\n 0x0009, // character tabulation\n 0x0020, // space\n 0x2000, // en quad\n 0x2001, // em quad\n 0x2002, // en space\n 0x2003, // em space\n 0x2004, // three-per-em space\n 0x2005, // four-per-em space\n 0x2006, // six-per-em space\n 0x2008, // punctuation space\n 0x2009, // thin space\n 0x200A, // hair space\n 0x205F, // medium mathematical space\n 0x3000, // ideographic space\n];\n","// disabling eslint for now, going to rewrite this in v5\n/* eslint-disable */\n\nimport { TEXT_GRADIENT } from '../const';\nimport { hex2string } from '../utils';\n\nconst defaultStyle = {\n align: 'left',\n breakWords: false,\n dropShadow: false,\n dropShadowAlpha: 1,\n dropShadowAngle: Math.PI / 6,\n dropShadowBlur: 0,\n dropShadowColor: 'black',\n dropShadowDistance: 5,\n fill: 'black',\n fillGradientType: TEXT_GRADIENT.LINEAR_VERTICAL,\n fillGradientStops: [],\n fontFamily: 'Arial',\n fontSize: 26,\n fontStyle: 'normal',\n fontVariant: 'normal',\n fontWeight: 'normal',\n letterSpacing: 0,\n lineHeight: 0,\n lineJoin: 'miter',\n miterLimit: 10,\n padding: 0,\n stroke: 'black',\n strokeThickness: 0,\n textBaseline: 'alphabetic',\n trim: false,\n whiteSpace: 'pre',\n wordWrap: false,\n wordWrapWidth: 100,\n leading: 0,\n};\n\nconst genericFontFamilies = [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n]\n\n/**\n * A TextStyle Object decorates a Text Object. It can be shared between\n * multiple Text objects. Changing the style will update all text objects using it.\n * It can be generated [here](https://pixijs.io/pixi-text-style).\n *\n * @class\n * @memberof PIXI\n */\nexport default class TextStyle\n{\n /**\n * @param {object} [style] - The style parameters\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'),\n * does not affect single line text\n * @param {boolean} [style.breakWords=false] - Indicates if lines can be wrapped within words, it\n * needs wordWrap to be set to true\n * @param {boolean} [style.dropShadow=false] - Set a drop shadow for the text\n * @param {number} [style.dropShadowAlpha=1] - Set alpha for the drop shadow\n * @param {number} [style.dropShadowAngle=Math.PI/6] - Set a angle of the drop shadow\n * @param {number} [style.dropShadowBlur=0] - Set a shadow blur radius\n * @param {string|number} [style.dropShadowColor='black'] - A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param {number} [style.dropShadowDistance=5] - Set a distance of the drop shadow\n * @param {string|string[]|number|number[]|CanvasGradient|CanvasPattern} [style.fill='black'] - A canvas\n * fillstyle that will be used on the text e.g 'red', '#00FF00'. Can be an array to create a gradient\n * eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n * @param {number} [style.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL] - If fill is an array of colours\n * to create a gradient, this can change the type/direction of the gradient. See {@link PIXI.TEXT_GRADIENT}\n * @param {number[]} [style.fillGradientStops] - If fill is an array of colours to create a gradient, this array can set\n * the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n * @param {string|string[]} [style.fontFamily='Arial'] - The font family\n * @param {number|string} [style.fontSize=26] - The font size (as a number it converts to px, but as a string,\n * equivalents are '26px','20pt','160%' or '1.6em')\n * @param {string} [style.fontStyle='normal'] - The font style ('normal', 'italic' or 'oblique')\n * @param {string} [style.fontVariant='normal'] - The font variant ('normal' or 'small-caps')\n * @param {string} [style.fontWeight='normal'] - The font weight ('normal', 'bold', 'bolder', 'lighter' and '100',\n * '200', '300', '400', '500', '600', '700', 800' or '900')\n * @param {number} [style.leading=0] - The space between lines\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters, default is 0\n * @param {number} [style.lineHeight] - The line height, a number that represents the vertical space that a letter uses\n * @param {string} [style.lineJoin='miter'] - The lineJoin property sets the type of corner created, it can resolve\n * spiked text issues. Possible values \"miter\" (creates a sharp corner), \"round\" (creates a round corner) or \"bevel\"\n * (creates a squared corner).\n * @param {number} [style.miterLimit=10] - The miter limit to use when using the 'miter' lineJoin mode. This can reduce\n * or increase the spikiness of rendered text.\n * @param {number} [style.padding=0] - Occasionally some fonts are cropped. Adding some padding will prevent this from\n * happening by adding padding to all sides of the text.\n * @param {string|number} [style.stroke='black'] - A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n * @param {boolean} [style.trim=false] - Trim transparent borders\n * @param {string} [style.textBaseline='alphabetic'] - The baseline of the text that is rendered.\n * @param {boolean} [style.whiteSpace='pre'] - Determines whether newlines & spaces are collapsed or preserved \"normal\"\n * (collapse, collapse), \"pre\" (preserve, preserve) | \"pre-line\" (preserve, collapse). It needs wordWrap to be set to true\n * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used\n * @param {number} [style.wordWrapWidth=100] - The width at which text will wrap, it needs wordWrap to be set to true\n */\n constructor(style)\n {\n this.styleID = 0;\n\n this.reset();\n\n deepCopyProperties(this, style, style);\n }\n\n /**\n * Creates a new TextStyle object with the same values as this one.\n * Note that the only the properties of the object are cloned.\n *\n * @return {PIXI.TextStyle} New cloned TextStyle object\n */\n clone()\n {\n const clonedProperties = {};\n\n deepCopyProperties(clonedProperties, this, defaultStyle);\n\n return new TextStyle(clonedProperties);\n }\n\n /**\n * Resets all properties to the defaults specified in TextStyle.prototype._default\n */\n reset()\n {\n deepCopyProperties(this, defaultStyle, defaultStyle);\n }\n\n /**\n * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n *\n * @member {string}\n */\n get align()\n {\n return this._align;\n }\n set align(align) // eslint-disable-line require-jsdoc\n {\n if (this._align !== align)\n {\n this._align = align;\n this.styleID++;\n }\n }\n\n /**\n * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true\n *\n * @member {boolean}\n */\n get breakWords()\n {\n return this._breakWords;\n }\n set breakWords(breakWords) // eslint-disable-line require-jsdoc\n {\n if (this._breakWords !== breakWords)\n {\n this._breakWords = breakWords;\n this.styleID++;\n }\n }\n\n /**\n * Set a drop shadow for the text\n *\n * @member {boolean}\n */\n get dropShadow()\n {\n return this._dropShadow;\n }\n set dropShadow(dropShadow) // eslint-disable-line require-jsdoc\n {\n if (this._dropShadow !== dropShadow)\n {\n this._dropShadow = dropShadow;\n this.styleID++;\n }\n }\n\n /**\n * Set alpha for the drop shadow\n *\n * @member {number}\n */\n get dropShadowAlpha()\n {\n return this._dropShadowAlpha;\n }\n set dropShadowAlpha(dropShadowAlpha) // eslint-disable-line require-jsdoc\n {\n if (this._dropShadowAlpha !== dropShadowAlpha)\n {\n this._dropShadowAlpha = dropShadowAlpha;\n this.styleID++;\n }\n }\n\n /**\n * Set a angle of the drop shadow\n *\n * @member {number}\n */\n get dropShadowAngle()\n {\n return this._dropShadowAngle;\n }\n set dropShadowAngle(dropShadowAngle) // eslint-disable-line require-jsdoc\n {\n if (this._dropShadowAngle !== dropShadowAngle)\n {\n this._dropShadowAngle = dropShadowAngle;\n this.styleID++;\n }\n }\n\n /**\n * Set a shadow blur radius\n *\n * @member {number}\n */\n get dropShadowBlur()\n {\n return this._dropShadowBlur;\n }\n set dropShadowBlur(dropShadowBlur) // eslint-disable-line require-jsdoc\n {\n if (this._dropShadowBlur !== dropShadowBlur)\n {\n this._dropShadowBlur = dropShadowBlur;\n this.styleID++;\n }\n }\n\n /**\n * A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n *\n * @member {string|number}\n */\n get dropShadowColor()\n {\n return this._dropShadowColor;\n }\n set dropShadowColor(dropShadowColor) // eslint-disable-line require-jsdoc\n {\n const outputColor = getColor(dropShadowColor);\n if (this._dropShadowColor !== outputColor)\n {\n this._dropShadowColor = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * Set a distance of the drop shadow\n *\n * @member {number}\n */\n get dropShadowDistance()\n {\n return this._dropShadowDistance;\n }\n set dropShadowDistance(dropShadowDistance) // eslint-disable-line require-jsdoc\n {\n if (this._dropShadowDistance !== dropShadowDistance)\n {\n this._dropShadowDistance = dropShadowDistance;\n this.styleID++;\n }\n }\n\n /**\n * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'.\n * Can be an array to create a gradient eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n *\n * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern}\n */\n get fill()\n {\n return this._fill;\n }\n set fill(fill) // eslint-disable-line require-jsdoc\n {\n const outputColor = getColor(fill);\n if (this._fill !== outputColor)\n {\n this._fill = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient.\n * See {@link PIXI.TEXT_GRADIENT}\n *\n * @member {number}\n */\n get fillGradientType()\n {\n return this._fillGradientType;\n }\n set fillGradientType(fillGradientType) // eslint-disable-line require-jsdoc\n {\n if (this._fillGradientType !== fillGradientType)\n {\n this._fillGradientType = fillGradientType;\n this.styleID++;\n }\n }\n\n /**\n * If fill is an array of colours to create a gradient, this array can set the stop points\n * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n *\n * @member {number[]}\n */\n get fillGradientStops()\n {\n return this._fillGradientStops;\n }\n set fillGradientStops(fillGradientStops) // eslint-disable-line require-jsdoc\n {\n if (!areArraysEqual(this._fillGradientStops,fillGradientStops))\n {\n this._fillGradientStops = fillGradientStops;\n this.styleID++;\n }\n }\n\n /**\n * The font family\n *\n * @member {string|string[]}\n */\n get fontFamily()\n {\n return this._fontFamily;\n }\n set fontFamily(fontFamily) // eslint-disable-line require-jsdoc\n {\n if (this.fontFamily !== fontFamily)\n {\n this._fontFamily = fontFamily;\n this.styleID++;\n }\n }\n\n /**\n * The font size\n * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')\n *\n * @member {number|string}\n */\n get fontSize()\n {\n return this._fontSize;\n }\n set fontSize(fontSize) // eslint-disable-line require-jsdoc\n {\n if (this._fontSize !== fontSize)\n {\n this._fontSize = fontSize;\n this.styleID++;\n }\n }\n\n /**\n * The font style\n * ('normal', 'italic' or 'oblique')\n *\n * @member {string}\n */\n get fontStyle()\n {\n return this._fontStyle;\n }\n set fontStyle(fontStyle) // eslint-disable-line require-jsdoc\n {\n if (this._fontStyle !== fontStyle)\n {\n this._fontStyle = fontStyle;\n this.styleID++;\n }\n }\n\n /**\n * The font variant\n * ('normal' or 'small-caps')\n *\n * @member {string}\n */\n get fontVariant()\n {\n return this._fontVariant;\n }\n set fontVariant(fontVariant) // eslint-disable-line require-jsdoc\n {\n if (this._fontVariant !== fontVariant)\n {\n this._fontVariant = fontVariant;\n this.styleID++;\n }\n }\n\n /**\n * The font weight\n * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900')\n *\n * @member {string}\n */\n get fontWeight()\n {\n return this._fontWeight;\n }\n set fontWeight(fontWeight) // eslint-disable-line require-jsdoc\n {\n if (this._fontWeight !== fontWeight)\n {\n this._fontWeight = fontWeight;\n this.styleID++;\n }\n }\n\n /**\n * The amount of spacing between letters, default is 0\n *\n * @member {number}\n */\n get letterSpacing()\n {\n return this._letterSpacing;\n }\n set letterSpacing(letterSpacing) // eslint-disable-line require-jsdoc\n {\n if (this._letterSpacing !== letterSpacing)\n {\n this._letterSpacing = letterSpacing;\n this.styleID++;\n }\n }\n\n /**\n * The line height, a number that represents the vertical space that a letter uses\n *\n * @member {number}\n */\n get lineHeight()\n {\n return this._lineHeight;\n }\n set lineHeight(lineHeight) // eslint-disable-line require-jsdoc\n {\n if (this._lineHeight !== lineHeight)\n {\n this._lineHeight = lineHeight;\n this.styleID++;\n }\n }\n\n /**\n * The space between lines\n *\n * @member {number}\n */\n get leading()\n {\n return this._leading;\n }\n set leading(leading) // eslint-disable-line require-jsdoc\n {\n if (this._leading !== leading)\n {\n this._leading = leading;\n this.styleID++;\n }\n }\n\n /**\n * The lineJoin property sets the type of corner created, it can resolve spiked text issues.\n * Default is 'miter' (creates a sharp corner).\n *\n * @member {string}\n */\n get lineJoin()\n {\n return this._lineJoin;\n }\n set lineJoin(lineJoin) // eslint-disable-line require-jsdoc\n {\n if (this._lineJoin !== lineJoin)\n {\n this._lineJoin = lineJoin;\n this.styleID++;\n }\n }\n\n /**\n * The miter limit to use when using the 'miter' lineJoin mode\n * This can reduce or increase the spikiness of rendered text.\n *\n * @member {number}\n */\n get miterLimit()\n {\n return this._miterLimit;\n }\n set miterLimit(miterLimit) // eslint-disable-line require-jsdoc\n {\n if (this._miterLimit !== miterLimit)\n {\n this._miterLimit = miterLimit;\n this.styleID++;\n }\n }\n\n /**\n * Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n * by adding padding to all sides of the text.\n *\n * @member {number}\n */\n get padding()\n {\n return this._padding;\n }\n set padding(padding) // eslint-disable-line require-jsdoc\n {\n if (this._padding !== padding)\n {\n this._padding = padding;\n this.styleID++;\n }\n }\n\n /**\n * A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n *\n * @member {string|number}\n */\n get stroke()\n {\n return this._stroke;\n }\n set stroke(stroke) // eslint-disable-line require-jsdoc\n {\n const outputColor = getColor(stroke);\n if (this._stroke !== outputColor)\n {\n this._stroke = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n *\n * @member {number}\n */\n get strokeThickness()\n {\n return this._strokeThickness;\n }\n set strokeThickness(strokeThickness) // eslint-disable-line require-jsdoc\n {\n if (this._strokeThickness !== strokeThickness)\n {\n this._strokeThickness = strokeThickness;\n this.styleID++;\n }\n }\n\n /**\n * The baseline of the text that is rendered.\n *\n * @member {string}\n */\n get textBaseline()\n {\n return this._textBaseline;\n }\n set textBaseline(textBaseline) // eslint-disable-line require-jsdoc\n {\n if (this._textBaseline !== textBaseline)\n {\n this._textBaseline = textBaseline;\n this.styleID++;\n }\n }\n\n /**\n * Trim transparent borders\n *\n * @member {boolean}\n */\n get trim()\n {\n return this._trim;\n }\n set trim(trim) // eslint-disable-line require-jsdoc\n {\n if (this._trim !== trim)\n {\n this._trim = trim;\n this.styleID++;\n }\n }\n\n /**\n * How newlines and spaces should be handled.\n * Default is 'pre' (preserve, preserve).\n *\n * value | New lines | Spaces\n * --- | --- | ---\n * 'normal' | Collapse | Collapse\n * 'pre' | Preserve | Preserve\n * 'pre-line' | Preserve | Collapse\n *\n * @member {string}\n */\n get whiteSpace()\n {\n return this._whiteSpace;\n }\n set whiteSpace(whiteSpace) // eslint-disable-line require-jsdoc\n {\n if (this._whiteSpace !== whiteSpace)\n {\n this._whiteSpace = whiteSpace;\n this.styleID++;\n }\n }\n\n /**\n * Indicates if word wrap should be used\n *\n * @member {boolean}\n */\n get wordWrap()\n {\n return this._wordWrap;\n }\n set wordWrap(wordWrap) // eslint-disable-line require-jsdoc\n {\n if (this._wordWrap !== wordWrap)\n {\n this._wordWrap = wordWrap;\n this.styleID++;\n }\n }\n\n /**\n * The width at which text will wrap, it needs wordWrap to be set to true\n *\n * @member {number}\n */\n get wordWrapWidth()\n {\n return this._wordWrapWidth;\n }\n set wordWrapWidth(wordWrapWidth) // eslint-disable-line require-jsdoc\n {\n if (this._wordWrapWidth !== wordWrapWidth)\n {\n this._wordWrapWidth = wordWrapWidth;\n this.styleID++;\n }\n }\n\n /**\n * Generates a font style string to use for `TextMetrics.measureFont()`.\n *\n * @return {string} Font style string, for passing to `TextMetrics.measureFont()`\n */\n toFontString()\n {\n // build canvas api font setting from individual components. Convert a numeric this.fontSize to px\n const fontSizeString = (typeof this.fontSize === 'number') ? `${this.fontSize}px` : this.fontSize;\n\n // Clean-up fontFamily property by quoting each font name\n // this will support font names with spaces\n let fontFamilies = this.fontFamily;\n\n if (!Array.isArray(this.fontFamily))\n {\n fontFamilies = this.fontFamily.split(',');\n }\n\n for (let i = fontFamilies.length - 1; i >= 0; i--)\n {\n // Trim any extra white-space\n let fontFamily = fontFamilies[i].trim();\n\n // Check if font is already escaped in quotes except for CSS generic fonts\n if (!(/([\\\"\\'])[^\\'\\\"]+\\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0)\n {\n fontFamily = `\"${fontFamily}\"`;\n }\n fontFamilies[i] = fontFamily;\n }\n\n return `${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${fontSizeString} ${fontFamilies.join(',')}`;\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * @private\n * @param {number|number[]} color\n * @return {string} The color as a string.\n */\nfunction getSingleColor(color)\n{\n if (typeof color === 'number')\n {\n return hex2string(color);\n }\n else if ( typeof color === 'string' )\n {\n if ( color.indexOf('0x') === 0 )\n {\n color = color.replace('0x', '#');\n }\n }\n\n return color;\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {number|number[]} color\n * @return {string} The color as a string.\n */\nfunction getColor(color)\n{\n if (!Array.isArray(color))\n {\n return getSingleColor(color);\n }\n else\n {\n for (let i = 0; i < color.length; ++i)\n {\n color[i] = getSingleColor(color[i]);\n }\n\n return color;\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param {Array} array1 First array to compare\n * @param {Array} array2 Second array to compare\n * @return {boolean} Do the arrays contain the same values in the same order\n */\nfunction areArraysEqual(array1, array2)\n{\n if (!Array.isArray(array1) || !Array.isArray(array2))\n {\n return false;\n }\n\n if (array1.length !== array2.length)\n {\n return false;\n }\n\n for (let i = 0; i < array1.length; ++i)\n {\n if (array1[i] !== array2[i])\n {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Utility function to ensure that object properties are copied by value, and not by reference\n * @private\n * @param {Object} target Target object to copy properties into\n * @param {Object} source Source object for the proporties to copy\n * @param {string} propertyObj Object containing properties names we want to loop over\n */\nfunction deepCopyProperties(target, source, propertyObj) {\n for (const prop in propertyObj) {\n if (Array.isArray(source[prop])) {\n target[prop] = source[prop].slice();\n } else {\n target[prop] = source[prop];\n }\n }\n}\n","import BaseTexture from './BaseTexture';\nimport settings from '../settings';\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer(1024, 1024);\n * let baseRenderTexture = new PIXI.BaseRenderTexture(800, 600);\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.fromImage(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture(100, 100);\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.BaseTexture\n * @memberof PIXI\n */\nexport default class BaseRenderTexture extends BaseTexture\n{\n /**\n * @param {number} [width=100] - The width of the base render texture\n * @param {number} [height=100] - The height of the base render texture\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the texture being generated\n */\n constructor(width = 100, height = 100, scaleMode, resolution)\n {\n super(null, scaleMode);\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.width = Math.ceil(width);\n this.height = Math.ceil(height);\n\n this.realWidth = this.width * this.resolution;\n this.realHeight = this.height * this.resolution;\n\n this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n this.hasLoaded = true;\n\n /**\n * A map of renderer IDs to webgl renderTargets\n *\n * @private\n * @member {object<number, WebGLTexture>}\n */\n this._glRenderTargets = {};\n\n /**\n * A reference to the canvas render target (we only need one as this can be shared across renderers)\n *\n * @private\n * @member {object<number, WebGLTexture>}\n */\n this._canvasRenderTarget = null;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = false;\n }\n\n /**\n * Resizes the BaseRenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n */\n resize(width, height)\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n\n if (width === this.width && height === this.height)\n {\n return;\n }\n\n this.valid = (width > 0 && height > 0);\n\n this.width = width;\n this.height = height;\n\n this.realWidth = this.width * this.resolution;\n this.realHeight = this.height * this.resolution;\n\n if (!this.valid)\n {\n return;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n *\n */\n destroy()\n {\n super.destroy(true);\n this.renderer = null;\n }\n}\n","import {\n uid, getUrlFileExtension, decomposeDataUri, getSvgSize,\n getResolutionOfUrl, BaseTextureCache, TextureCache,\n} from '../utils';\nimport settings from '../settings';\nimport EventEmitter from 'eventemitter3';\nimport determineCrossOrigin from '../utils/determineCrossOrigin';\nimport bitTwiddle from 'bit-twiddle';\n\n/**\n * A texture stores the information that represents an image. All textures have a base texture.\n *\n * @class\n * @extends EventEmitter\n * @memberof PIXI\n */\nexport default class BaseTexture extends EventEmitter\n{\n /**\n * @param {HTMLImageElement|HTMLCanvasElement} [source] - the source object of the texture.\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the texture\n */\n constructor(source, scaleMode, resolution)\n {\n super();\n\n this.uid = uid();\n\n this.touched = 0;\n\n /**\n * The resolution / device pixel ratio of the texture\n *\n * @member {number}\n * @default 1\n */\n this.resolution = resolution || settings.RESOLUTION;\n\n /**\n * The width of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n this.width = 100;\n\n /**\n * The height of the base texture set when the image has loaded\n *\n * @readonly\n * @member {number}\n */\n this.height = 100;\n\n // TODO docs\n // used to store the actual dimensions of the source\n /**\n * Used to store the actual width of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n this.realWidth = 100;\n /**\n * Used to store the actual height of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n this.realHeight = 100;\n\n /**\n * The scale mode to apply when scaling this texture\n *\n * @member {number}\n * @default PIXI.settings.SCALE_MODE\n * @see PIXI.SCALE_MODES\n */\n this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n\n /**\n * Set to true once the base texture has successfully loaded.\n *\n * This is never true if the underlying source fails to load or has no texture data.\n *\n * @readonly\n * @member {boolean}\n */\n this.hasLoaded = false;\n\n /**\n * Set to true if the source is currently loading.\n *\n * If an Image source is loading the 'loaded' or 'error' event will be\n * dispatched when the operation ends. An underyling source that is\n * immediately-available bypasses loading entirely.\n *\n * @readonly\n * @member {boolean}\n */\n this.isLoading = false;\n\n /**\n * The image source that is used to create the texture.\n *\n * TODO: Make this a setter that calls loadSource();\n *\n * @readonly\n * @member {HTMLImageElement|HTMLCanvasElement}\n */\n this.source = null; // set in loadSource, if at all\n\n /**\n * The image source that is used to create the texture. This is used to\n * store the original Svg source when it is replaced with a canvas element.\n *\n * TODO: Currently not in use but could be used when re-scaling svg.\n *\n * @readonly\n * @member {Image}\n */\n this.origSource = null; // set in loadSvg, if at all\n\n /**\n * Type of image defined in source, eg. `png` or `svg`\n *\n * @readonly\n * @member {string}\n */\n this.imageType = null; // set in updateImageType\n\n /**\n * Scale for source image. Used with Svg images to scale them before rasterization.\n *\n * @readonly\n * @member {number}\n */\n this.sourceScale = 1.0;\n\n /**\n * Controls if RGB channels should be pre-multiplied by Alpha (WebGL only)\n * All blend modes, and shaders written for default value. Change it on your own risk.\n *\n * @member {boolean}\n * @default true\n */\n this.premultipliedAlpha = true;\n\n /**\n * The image url of the texture\n *\n * @member {string}\n */\n this.imageUrl = null;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n *\n * @private\n * @member {boolean}\n */\n this.isPowerOfTwo = false;\n\n // used for webGL\n\n /**\n *\n * Set this to true if a mipmap of this texture needs to be generated. This value needs\n * to be set before the texture is used\n * Also the texture must be a power of two size to work\n *\n * @member {boolean}\n * @see PIXI.MIPMAP_TEXTURES\n */\n this.mipmap = settings.MIPMAP_TEXTURES;\n\n /**\n *\n * WebGL Texture wrap mode\n *\n * @member {number}\n * @see PIXI.WRAP_MODES\n */\n this.wrapMode = settings.WRAP_MODE;\n\n /**\n * A map of renderer IDs to webgl textures\n *\n * @private\n * @member {object<number, WebGLTexture>}\n */\n this._glTextures = {};\n\n this._enabled = 0;\n this._virtalBoundId = -1;\n\n /**\n * If the object has been destroyed via destroy(). If true, it should not be used.\n *\n * @member {boolean}\n * @private\n * @readonly\n */\n this._destroyed = false;\n\n /**\n * The ids under which this BaseTexture has been added to the base texture cache. This is\n * automatically set as long as BaseTexture.addToCache is used, but may not be set if a\n * BaseTexture is added directly to the BaseTextureCache array.\n *\n * @member {string[]}\n */\n this.textureCacheIds = [];\n\n // if no source passed don't try to load\n if (source)\n {\n this.loadSource(source);\n }\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n *\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n */\n\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n\n /**\n * Fired when BaseTexture is destroyed.\n *\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n }\n\n /**\n * Updates the texture on all the webgl renderers, this also assumes the src has changed.\n *\n * @fires PIXI.BaseTexture#update\n */\n update()\n {\n // Svg size is handled during load\n if (this.imageType !== 'svg')\n {\n this.realWidth = this.source.naturalWidth || this.source.videoWidth || this.source.width;\n this.realHeight = this.source.naturalHeight || this.source.videoHeight || this.source.height;\n\n this._updateDimensions();\n }\n\n this.emit('update', this);\n }\n\n /**\n * Update dimensions from real values\n */\n _updateDimensions()\n {\n this.width = this.realWidth / this.resolution;\n this.height = this.realHeight / this.resolution;\n\n this.isPowerOfTwo = bitTwiddle.isPow2(this.realWidth) && bitTwiddle.isPow2(this.realHeight);\n }\n\n /**\n * Load a source.\n *\n * If the source is not-immediately-available, such as an image that needs to be\n * downloaded, then the 'loaded' or 'error' event will be dispatched in the future\n * and `hasLoaded` will remain false after this call.\n *\n * The logic state after calling `loadSource` directly or indirectly (eg. `fromImage`, `new BaseTexture`) is:\n *\n * if (texture.hasLoaded) {\n * // texture ready for use\n * } else if (texture.isLoading) {\n * // listen to 'loaded' and/or 'error' events on texture\n * } else {\n * // not loading, not going to load UNLESS the source is reloaded\n * // (it may still make sense to listen to the events)\n * }\n *\n * @protected\n * @param {HTMLImageElement|HTMLCanvasElement} source - the source object of the texture.\n */\n loadSource(source)\n {\n const wasLoading = this.isLoading;\n\n this.hasLoaded = false;\n this.isLoading = false;\n\n if (wasLoading && this.source)\n {\n this.source.onload = null;\n this.source.onerror = null;\n }\n\n const firstSourceLoaded = !this.source;\n\n this.source = source;\n\n // Apply source if loaded. Otherwise setup appropriate loading monitors.\n if (((source.src && source.complete) || source.getContext) && source.width && source.height)\n {\n this._updateImageType();\n\n if (this.imageType === 'svg')\n {\n this._loadSvgSource();\n }\n else\n {\n this._sourceLoaded();\n }\n\n if (firstSourceLoaded)\n {\n // send loaded event if previous source was null and we have been passed a pre-loaded IMG element\n this.emit('loaded', this);\n }\n }\n else if (!source.getContext)\n {\n // Image fail / not ready\n this.isLoading = true;\n\n const scope = this;\n\n source.onload = () =>\n {\n scope._updateImageType();\n source.onload = null;\n source.onerror = null;\n\n if (!scope.isLoading)\n {\n return;\n }\n\n scope.isLoading = false;\n scope._sourceLoaded();\n\n if (scope.imageType === 'svg')\n {\n scope._loadSvgSource();\n\n return;\n }\n\n scope.emit('loaded', scope);\n };\n\n source.onerror = () =>\n {\n source.onload = null;\n source.onerror = null;\n\n if (!scope.isLoading)\n {\n return;\n }\n\n scope.isLoading = false;\n scope.emit('error', scope);\n };\n\n // Per http://www.w3.org/TR/html5/embedded-content-0.html#the-img-element\n // \"The value of `complete` can thus change while a script is executing.\"\n // So complete needs to be re-checked after the callbacks have been added..\n // NOTE: complete will be true if the image has no src so best to check if the src is set.\n if (source.complete && source.src)\n {\n // ..and if we're complete now, no need for callbacks\n source.onload = null;\n source.onerror = null;\n\n if (scope.imageType === 'svg')\n {\n scope._loadSvgSource();\n\n return;\n }\n\n this.isLoading = false;\n\n if (source.width && source.height)\n {\n this._sourceLoaded();\n\n // If any previous subscribers possible\n if (wasLoading)\n {\n this.emit('loaded', this);\n }\n }\n // If any previous subscribers possible\n else if (wasLoading)\n {\n this.emit('error', this);\n }\n }\n }\n }\n\n /**\n * Updates type of the source image.\n */\n _updateImageType()\n {\n if (!this.imageUrl)\n {\n return;\n }\n\n const dataUri = decomposeDataUri(this.imageUrl);\n let imageType;\n\n if (dataUri && dataUri.mediaType === 'image')\n {\n // Check for subType validity\n const firstSubType = dataUri.subType.split('+')[0];\n\n imageType = getUrlFileExtension(`.${firstSubType}`);\n\n if (!imageType)\n {\n throw new Error('Invalid image type in data URI.');\n }\n }\n else\n {\n imageType = getUrlFileExtension(this.imageUrl);\n\n if (!imageType)\n {\n imageType = 'png';\n }\n }\n\n this.imageType = imageType;\n }\n\n /**\n * Checks if `source` is an SVG image and whether it's loaded via a URL or a data URI. Then calls\n * `_loadSvgSourceUsingDataUri` or `_loadSvgSourceUsingXhr`.\n */\n _loadSvgSource()\n {\n if (this.imageType !== 'svg')\n {\n // Do nothing if source is not svg\n return;\n }\n\n const dataUri = decomposeDataUri(this.imageUrl);\n\n if (dataUri)\n {\n this._loadSvgSourceUsingDataUri(dataUri);\n }\n else\n {\n // We got an URL, so we need to do an XHR to check the svg size\n this._loadSvgSourceUsingXhr();\n }\n }\n\n /**\n * Reads an SVG string from data URI and then calls `_loadSvgSourceUsingString`.\n *\n * @param {string} dataUri - The data uri to load from.\n */\n _loadSvgSourceUsingDataUri(dataUri)\n {\n let svgString;\n\n if (dataUri.encoding === 'base64')\n {\n if (!atob)\n {\n throw new Error('Your browser doesn\\'t support base64 conversions.');\n }\n svgString = atob(dataUri.data);\n }\n else\n {\n svgString = dataUri.data;\n }\n\n this._loadSvgSourceUsingString(svgString);\n }\n\n /**\n * Loads an SVG string from `imageUrl` using XHR and then calls `_loadSvgSourceUsingString`.\n */\n _loadSvgSourceUsingXhr()\n {\n const svgXhr = new XMLHttpRequest();\n\n // This throws error on IE, so SVG Document can't be used\n // svgXhr.responseType = 'document';\n\n // This is not needed since we load the svg as string (breaks IE too)\n // but overrideMimeType() can be used to force the response to be parsed as XML\n // svgXhr.overrideMimeType('image/svg+xml');\n\n svgXhr.onload = () =>\n {\n if (svgXhr.readyState !== svgXhr.DONE || svgXhr.status !== 200)\n {\n throw new Error('Failed to load SVG using XHR.');\n }\n\n this._loadSvgSourceUsingString(svgXhr.response);\n };\n\n svgXhr.onerror = () => this.emit('error', this);\n\n svgXhr.open('GET', this.imageUrl, true);\n svgXhr.send();\n }\n\n /**\n * Loads texture using an SVG string. The original SVG Image is stored as `origSource` and the\n * created canvas is the new `source`. The SVG is scaled using `sourceScale`. Called by\n * `_loadSvgSourceUsingXhr` or `_loadSvgSourceUsingDataUri`.\n *\n * @param {string} svgString SVG source as string\n *\n * @fires PIXI.BaseTexture#loaded\n */\n _loadSvgSourceUsingString(svgString)\n {\n const svgSize = getSvgSize(svgString);\n\n const svgWidth = svgSize.width;\n const svgHeight = svgSize.height;\n\n if (!svgWidth || !svgHeight)\n {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n\n // Scale realWidth and realHeight\n this.realWidth = Math.round(svgWidth * this.sourceScale);\n this.realHeight = Math.round(svgHeight * this.sourceScale);\n\n this._updateDimensions();\n\n // Create a canvas element\n const canvas = document.createElement('canvas');\n\n canvas.width = this.realWidth;\n canvas.height = this.realHeight;\n canvas._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(this.source, 0, 0, svgWidth, svgHeight, 0, 0, this.realWidth, this.realHeight);\n\n // Replace the original source image with the canvas\n this.origSource = this.source;\n this.source = canvas;\n\n // Add also the canvas in cache (destroy clears by `imageUrl` and `source._pixiId`)\n BaseTexture.addToCache(this, canvas._pixiId);\n\n this.isLoading = false;\n this._sourceLoaded();\n this.emit('loaded', this);\n }\n\n /**\n * Used internally to update the width, height, and some other tracking vars once\n * a source has successfully loaded.\n *\n * @private\n */\n _sourceLoaded()\n {\n this.hasLoaded = true;\n this.update();\n }\n\n /**\n * Destroys this base texture\n *\n */\n destroy()\n {\n if (this.imageUrl)\n {\n delete TextureCache[this.imageUrl];\n\n this.imageUrl = null;\n\n if (!navigator.isCocoonJS)\n {\n this.source.src = '';\n }\n }\n\n this.source = null;\n\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this._destroyed = true;\n }\n\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n dispose()\n {\n this.emit('dispose', this);\n }\n\n /**\n * Changes the source image of the texture.\n * The original source must be an Image element.\n *\n * @param {string} newSrc - the path of the image\n */\n updateSourceImage(newSrc)\n {\n this.source.src = newSrc;\n\n this.loadSource(this.source);\n }\n\n /**\n * Helper function that creates a base texture from the given image url.\n * If the image is not in the base texture cache it will be created and loaded.\n *\n * @static\n * @param {string} imageUrl - The image url of the texture\n * @param {boolean} [crossorigin=(auto)] - Should use anonymous CORS? Defaults to true if the URL is not a data-URI.\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [sourceScale=(auto)] - Scale for the original image, used with Svg images.\n * @return {PIXI.BaseTexture} The new base texture.\n */\n static fromImage(imageUrl, crossorigin, scaleMode, sourceScale)\n {\n let baseTexture = BaseTextureCache[imageUrl];\n\n if (!baseTexture)\n {\n // new Image() breaks tex loading in some versions of Chrome.\n // See https://code.google.com/p/chromium/issues/detail?id=238071\n const image = new Image();// document.createElement('img');\n\n if (crossorigin === undefined && imageUrl.indexOf('data:') !== 0)\n {\n image.crossOrigin = determineCrossOrigin(imageUrl);\n }\n else if (crossorigin)\n {\n image.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n\n baseTexture = new BaseTexture(image, scaleMode);\n baseTexture.imageUrl = imageUrl;\n\n if (sourceScale)\n {\n baseTexture.sourceScale = sourceScale;\n }\n\n // if there is an @2x at the end of the url we are going to assume its a highres image\n baseTexture.resolution = getResolutionOfUrl(imageUrl);\n\n image.src = imageUrl; // Setting this triggers load\n\n BaseTexture.addToCache(baseTexture, imageUrl);\n }\n\n return baseTexture;\n }\n\n /**\n * Helper function that creates a base texture from the given canvas element.\n *\n * @static\n * @param {HTMLCanvasElement} canvas - The canvas element source of the texture\n * @param {number} scaleMode - See {@link PIXI.SCALE_MODES} for possible values\n * @param {string} [origin='canvas'] - A string origin of who created the base texture\n * @return {PIXI.BaseTexture} The new base texture.\n */\n static fromCanvas(canvas, scaleMode, origin = 'canvas')\n {\n if (!canvas._pixiId)\n {\n canvas._pixiId = `${origin}_${uid()}`;\n }\n\n let baseTexture = BaseTextureCache[canvas._pixiId];\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(canvas, scaleMode);\n BaseTexture.addToCache(baseTexture, canvas._pixiId);\n }\n\n return baseTexture;\n }\n\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement} source - The source to create base texture from.\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [sourceScale=(auto)] - Scale for the original image, used with Svg images.\n * @return {PIXI.BaseTexture} The new base texture.\n */\n static from(source, scaleMode, sourceScale)\n {\n if (typeof source === 'string')\n {\n return BaseTexture.fromImage(source, undefined, scaleMode, sourceScale);\n }\n else if (source instanceof HTMLImageElement)\n {\n const imageUrl = source.src;\n let baseTexture = BaseTextureCache[imageUrl];\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, scaleMode);\n baseTexture.imageUrl = imageUrl;\n\n if (sourceScale)\n {\n baseTexture.sourceScale = sourceScale;\n }\n\n // if there is an @2x at the end of the url we are going to assume its a highres image\n baseTexture.resolution = getResolutionOfUrl(imageUrl);\n\n BaseTexture.addToCache(baseTexture, imageUrl);\n }\n\n return baseTexture;\n }\n else if (source instanceof HTMLCanvasElement)\n {\n return BaseTexture.fromCanvas(source, scaleMode);\n }\n\n // lets assume its a base texture!\n return source;\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n static addToCache(baseTexture, id)\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n // @if DEBUG\n /* eslint-disable no-console */\n if (BaseTextureCache[id])\n {\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n /* eslint-enable no-console */\n // @endif\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n *\n * @static\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @return {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture)\n {\n if (typeof baseTexture === 'string')\n {\n const baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n const index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (let i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n }\n}\n","import BaseRenderTexture from './BaseRenderTexture';\nimport Texture from './Texture';\n\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer(1024, 1024);\n * let renderTexture = PIXI.RenderTexture.create(800, 600);\n * let sprite = PIXI.Sprite.fromImage(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, renderTexture);\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create(100, 100);\n *\n * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.Texture\n * @memberof PIXI\n */\nexport default class RenderTexture extends Texture\n{\n /**\n * @param {PIXI.BaseRenderTexture} baseRenderTexture - The renderer used for this RenderTexture\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n */\n constructor(baseRenderTexture, frame)\n {\n // support for legacy..\n let _legacyRenderer = null;\n\n if (!(baseRenderTexture instanceof BaseRenderTexture))\n {\n /* eslint-disable prefer-rest-params, no-console */\n const width = arguments[1];\n const height = arguments[2];\n const scaleMode = arguments[3];\n const resolution = arguments[4];\n\n // we have an old render texture..\n console.warn(`Please use RenderTexture.create(${width}, ${height}) instead of the ctor directly.`);\n _legacyRenderer = arguments[0];\n /* eslint-enable prefer-rest-params, no-console */\n\n frame = null;\n baseRenderTexture = new BaseRenderTexture(width, height, scaleMode, resolution);\n }\n\n /**\n * The base texture object that this texture uses\n *\n * @member {BaseTexture}\n */\n super(\n baseRenderTexture,\n frame\n );\n\n this.legacyRenderer = _legacyRenderer;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = true;\n\n this._updateUvs();\n }\n\n /**\n * Resizes the RenderTexture.\n *\n * @param {number} width - The width to resize to.\n * @param {number} height - The height to resize to.\n * @param {boolean} doNotResizeBaseTexture - Should the baseTexture.width and height values be resized as well?\n */\n resize(width, height, doNotResizeBaseTexture)\n {\n width = Math.ceil(width);\n height = Math.ceil(height);\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (!doNotResizeBaseTexture)\n {\n this.baseTexture.resize(width, height);\n }\n\n this._updateUvs();\n }\n\n /**\n * A short hand way of creating a render texture.\n *\n * @param {number} [width=100] - The width of the render texture\n * @param {number} [height=100] - The height of the render texture\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the texture being generated\n * @return {PIXI.RenderTexture} The new render texture\n */\n static create(width, height, scaleMode, resolution)\n {\n return new RenderTexture(new BaseRenderTexture(width, height, scaleMode, resolution));\n }\n}\n","import { Rectangle, Texture } from '../';\nimport { getResolutionOfUrl } from '../utils';\n\n/**\n * Utility class for maintaining reference to a collection\n * of Textures on a single Spritesheet.\n *\n * To access a sprite sheet from your code pass its JSON data file to Pixi's loader:\n *\n * ```js\n * PIXI.loader.add(\"images/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.loader.resources[\"images/spritesheet.json\"].spritesheet;\n * ...\n * }\n * ```\n * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite.\n *\n * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker},\n * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}.\n * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only\n * supported by TexturePacker.\n *\n * @class\n * @memberof PIXI\n */\nexport default class Spritesheet\n{\n /**\n * The maximum number of Textures to build per process.\n *\n * @type {number}\n * @default 1000\n */\n static get BATCH_SIZE()\n {\n return 1000;\n }\n\n /**\n * @param {PIXI.BaseTexture} baseTexture Reference to the source BaseTexture object.\n * @param {Object} data - Spritesheet image data.\n * @param {string} [resolutionFilename] - The filename to consider when determining\n * the resolution of the spritesheet. If not provided, the imageUrl will\n * be used on the BaseTexture.\n */\n constructor(baseTexture, data, resolutionFilename = null)\n {\n /**\n * Reference to ths source texture\n * @type {PIXI.BaseTexture}\n */\n this.baseTexture = baseTexture;\n\n /**\n * A map containing all textures of the sprite sheet.\n * Can be used to create a {@link PIXI.Sprite|Sprite}:\n * ```js\n * new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ```\n * @member {Object}\n */\n this.textures = {};\n\n /**\n * A map containing the textures for each animation.\n * Can be used to create an {@link PIXI.extras.AnimatedSprite|AnimatedSprite}:\n * ```js\n * new PIXI.extras.AnimatedSprite(sheet.animations[\"anim_name\"])\n * ```\n * @member {Object}\n */\n this.animations = {};\n\n /**\n * Reference to the original JSON data.\n * @type {Object}\n */\n this.data = data;\n\n /**\n * The resolution of the spritesheet.\n * @type {number}\n */\n this.resolution = this._updateResolution(\n resolutionFilename || this.baseTexture.imageUrl\n );\n\n /**\n * Map of spritesheet frames.\n * @type {Object}\n * @private\n */\n this._frames = this.data.frames;\n\n /**\n * Collection of frame names.\n * @type {string[]}\n * @private\n */\n this._frameKeys = Object.keys(this._frames);\n\n /**\n * Current batch index being processed.\n * @type {number}\n * @private\n */\n this._batchIndex = 0;\n\n /**\n * Callback when parse is completed.\n * @type {Function}\n * @private\n */\n this._callback = null;\n }\n\n /**\n * Generate the resolution from the filename or fallback\n * to the meta.scale field of the JSON data.\n *\n * @private\n * @param {string} resolutionFilename - The filename to use for resolving\n * the default resolution.\n * @return {number} Resolution to use for spritesheet.\n */\n _updateResolution(resolutionFilename)\n {\n const scale = this.data.meta.scale;\n\n // Use a defaultValue of `null` to check if a url-based resolution is set\n let resolution = getResolutionOfUrl(resolutionFilename, null);\n\n // No resolution found via URL\n if (resolution === null)\n {\n // Use the scale value or default to 1\n resolution = scale !== undefined ? parseFloat(scale) : 1;\n }\n\n // For non-1 resolutions, update baseTexture\n if (resolution !== 1)\n {\n this.baseTexture.resolution = resolution;\n this.baseTexture.update();\n }\n\n return resolution;\n }\n\n /**\n * Parser spritesheet from loaded data. This is done asynchronously\n * to prevent creating too many Texture within a single process.\n *\n * @param {Function} callback - Callback when complete returns\n * a map of the Textures for this spritesheet.\n */\n parse(callback)\n {\n this._batchIndex = 0;\n this._callback = callback;\n\n if (this._frameKeys.length <= Spritesheet.BATCH_SIZE)\n {\n this._processFrames(0);\n this._processAnimations();\n this._parseComplete();\n }\n else\n {\n this._nextBatch();\n }\n }\n\n /**\n * Process a batch of frames\n *\n * @private\n * @param {number} initialFrameIndex - The index of frame to start.\n */\n _processFrames(initialFrameIndex)\n {\n let frameIndex = initialFrameIndex;\n const maxFrames = Spritesheet.BATCH_SIZE;\n const sourceScale = this.baseTexture.sourceScale;\n\n while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length)\n {\n const i = this._frameKeys[frameIndex];\n const data = this._frames[i];\n const rect = data.frame;\n\n if (rect)\n {\n let frame = null;\n let trim = null;\n const sourceSize = data.trimmed !== false && data.sourceSize\n ? data.sourceSize : data.frame;\n\n const orig = new Rectangle(\n 0,\n 0,\n Math.floor(sourceSize.w * sourceScale) / this.resolution,\n Math.floor(sourceSize.h * sourceScale) / this.resolution\n );\n\n if (data.rotated)\n {\n frame = new Rectangle(\n Math.floor(rect.x * sourceScale) / this.resolution,\n Math.floor(rect.y * sourceScale) / this.resolution,\n Math.floor(rect.h * sourceScale) / this.resolution,\n Math.floor(rect.w * sourceScale) / this.resolution\n );\n }\n else\n {\n frame = new Rectangle(\n Math.floor(rect.x * sourceScale) / this.resolution,\n Math.floor(rect.y * sourceScale) / this.resolution,\n Math.floor(rect.w * sourceScale) / this.resolution,\n Math.floor(rect.h * sourceScale) / this.resolution\n );\n }\n\n // Check to see if the sprite is trimmed\n if (data.trimmed !== false && data.spriteSourceSize)\n {\n trim = new Rectangle(\n Math.floor(data.spriteSourceSize.x * sourceScale) / this.resolution,\n Math.floor(data.spriteSourceSize.y * sourceScale) / this.resolution,\n Math.floor(rect.w * sourceScale) / this.resolution,\n Math.floor(rect.h * sourceScale) / this.resolution\n );\n }\n\n this.textures[i] = new Texture(\n this.baseTexture,\n frame,\n orig,\n trim,\n data.rotated ? 2 : 0,\n data.anchor\n );\n\n // lets also add the frame to pixi's global cache for fromFrame and fromImage functions\n Texture.addToCache(this.textures[i], i);\n }\n\n frameIndex++;\n }\n }\n\n /**\n * Parse animations config\n *\n * @private\n */\n _processAnimations()\n {\n const animations = this.data.animations || {};\n\n for (const animName in animations)\n {\n this.animations[animName] = [];\n for (const frameName of animations[animName])\n {\n this.animations[animName].push(this.textures[frameName]);\n }\n }\n }\n\n /**\n * The parse has completed.\n *\n * @private\n */\n _parseComplete()\n {\n const callback = this._callback;\n\n this._callback = null;\n this._batchIndex = 0;\n callback.call(this, this.textures);\n }\n\n /**\n * Begin the next batch of textures.\n *\n * @private\n */\n _nextBatch()\n {\n this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE);\n this._batchIndex++;\n setTimeout(() =>\n {\n if (this._batchIndex * Spritesheet.BATCH_SIZE < this._frameKeys.length)\n {\n this._nextBatch();\n }\n else\n {\n this._processAnimations();\n this._parseComplete();\n }\n }, 0);\n }\n\n /**\n * Destroy Spritesheet and don't use after this.\n *\n * @param {boolean} [destroyBase=false] Whether to destroy the base texture as well\n */\n destroy(destroyBase = false)\n {\n for (const i in this.textures)\n {\n this.textures[i].destroy();\n }\n this._frames = null;\n this._frameKeys = null;\n this.data = null;\n this.textures = null;\n if (destroyBase)\n {\n this.baseTexture.destroy();\n }\n this.baseTexture = null;\n }\n}\n","import BaseTexture from './BaseTexture';\nimport VideoBaseTexture from './VideoBaseTexture';\nimport TextureUvs from './TextureUvs';\nimport EventEmitter from 'eventemitter3';\nimport { Rectangle, Point } from '../math';\nimport { TextureCache, getResolutionOfUrl } from '../utils';\nimport settings from '../settings';\n\n/**\n * A texture stores the information that represents an image or part of an image. It cannot be added\n * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided\n * then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.fromImage('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.fromImage('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n *\n * @class\n * @extends EventEmitter\n * @memberof PIXI\n */\nexport default class Texture extends EventEmitter\n{\n /**\n * @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n * @param {PIXI.Rectangle} [orig] - The area of original texture\n * @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture\n * @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.GroupD8}\n * @param {PIXI.Point} [anchor] - Default anchor point used for sprite placement / rotation\n */\n constructor(baseTexture, frame, orig, trim, rotate, anchor)\n {\n super();\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * @member {boolean}\n */\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n /**\n * The base texture that this texture uses.\n *\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = baseTexture;\n\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n *\n * @member {PIXI.Rectangle}\n */\n this._frame = frame;\n\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `_updateUvs()` after you change coordinates of `trim` manually.\n *\n * @member {PIXI.Rectangle}\n */\n this.trim = trim;\n\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n this.valid = false;\n\n /**\n * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates)\n *\n * @member {boolean}\n */\n this.requiresUpdate = false;\n\n /**\n * The WebGL UV data cache.\n *\n * @member {PIXI.TextureUvs}\n * @private\n */\n this._uvs = null;\n\n /**\n * This is the area of original texture, before it was put in atlas\n *\n * @member {PIXI.Rectangle}\n */\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate === true)\n {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n this._rotate = 2;\n }\n else if (this._rotate % 2 !== 0)\n {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n\n if (baseTexture.hasLoaded)\n {\n if (this.noFrame)\n {\n frame = new Rectangle(0, 0, baseTexture.width, baseTexture.height);\n\n // if there is no frame we should monitor for any base texture changes..\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n this.frame = frame;\n }\n else\n {\n baseTexture.once('loaded', this.onBaseTextureLoaded, this);\n }\n\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @member {PIXI.Point}\n * @default {0,0}\n */\n this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n\n /**\n * Fired when the texture is updated. This happens if the frame or the baseTexture is updated.\n *\n * @event PIXI.Texture#update\n * @protected\n * @param {PIXI.Texture} texture - Instance of texture being updated.\n */\n\n this._updateID = 0;\n\n /**\n * Contains data for uvs. May contain clamp settings and some matrices.\n * Its a bit heavy, so by default that object is not created.\n * @member {PIXI.TextureMatrix}\n * @default null\n */\n this.transform = null;\n\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n *\n * @member {string[]}\n */\n this.textureCacheIds = [];\n }\n\n /**\n * Updates this texture on the gpu.\n *\n */\n update()\n {\n this.baseTexture.update();\n }\n\n /**\n * Called when the base texture is loaded\n *\n * @private\n * @param {PIXI.BaseTexture} baseTexture - The base texture.\n */\n onBaseTextureLoaded(baseTexture)\n {\n this._updateID++;\n\n // TODO this code looks confusing.. boo to abusing getters and setters!\n if (this.noFrame)\n {\n this.frame = new Rectangle(0, 0, baseTexture.width, baseTexture.height);\n }\n else\n {\n this.frame = this._frame;\n }\n\n this.baseTexture.on('update', this.onBaseTextureUpdated, this);\n this.emit('update', this);\n }\n\n /**\n * Called when the base texture is updated\n *\n * @private\n * @param {PIXI.BaseTexture} baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture)\n {\n this._updateID++;\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n *\n * @param {boolean} [destroyBase=false] Whether to destroy the base texture as well\n */\n destroy(destroyBase)\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (TextureCache[this.baseTexture.imageUrl])\n {\n Texture.removeFromCache(this.baseTexture.imageUrl);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n this.baseTexture.off('loaded', this.onBaseTextureLoaded, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n }\n\n /**\n * Creates a new texture object that acts the same as this one.\n *\n * @return {PIXI.Texture} The new texture\n */\n clone()\n {\n return new Texture(this.baseTexture, this.frame, this.orig, this.trim, this.rotate, this.defaultAnchor);\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n */\n _updateUvs()\n {\n if (!this._uvs)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n }\n\n /**\n * Helper function that creates a Texture object from the given image url.\n * If the image is not in the texture cache it will be created and loaded.\n *\n * @static\n * @param {string} imageUrl - The image url of the texture\n * @param {boolean} [crossorigin] - Whether requests should be treated as crossorigin\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {number} [sourceScale=(auto)] - Scale for the original image, used with SVG images.\n * @return {PIXI.Texture} The newly created texture\n */\n static fromImage(imageUrl, crossorigin, scaleMode, sourceScale)\n {\n let texture = TextureCache[imageUrl];\n\n if (!texture)\n {\n texture = new Texture(BaseTexture.fromImage(imageUrl, crossorigin, scaleMode, sourceScale));\n Texture.addToCache(texture, imageUrl);\n }\n\n return texture;\n }\n\n /**\n * Helper function that creates a sprite that will contain a texture from the TextureCache based on the frameId\n * The frame ids are created when a Texture packer file has been loaded\n *\n * @static\n * @param {string} frameId - The frame Id of the texture in the cache\n * @return {PIXI.Texture} The newly created texture\n */\n static fromFrame(frameId)\n {\n const texture = TextureCache[frameId];\n\n if (!texture)\n {\n throw new Error(`The frameId \"${frameId}\" does not exist in the texture cache`);\n }\n\n return texture;\n }\n\n /**\n * Helper function that creates a new Texture based on the given canvas element.\n *\n * @static\n * @param {HTMLCanvasElement} canvas - The canvas element source of the texture\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {string} [origin='canvas'] - A string origin of who created the base texture\n * @return {PIXI.Texture} The newly created texture\n */\n static fromCanvas(canvas, scaleMode, origin = 'canvas')\n {\n return new Texture(BaseTexture.fromCanvas(canvas, scaleMode, origin));\n }\n\n /**\n * Helper function that creates a new Texture based on the given video element.\n *\n * @static\n * @param {HTMLVideoElement|string} video - The URL or actual element of the video\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {boolean} [crossorigin=(auto)] - Should use anonymous CORS? Defaults to true if the URL is not a data-URI.\n * @param {boolean} [autoPlay=true] - Start playing video as soon as it is loaded\n * @return {PIXI.Texture} The newly created texture\n */\n static fromVideo(video, scaleMode, crossorigin, autoPlay)\n {\n if (typeof video === 'string')\n {\n return Texture.fromVideoUrl(video, scaleMode, crossorigin, autoPlay);\n }\n\n return new Texture(VideoBaseTexture.fromVideo(video, scaleMode, autoPlay));\n }\n\n /**\n * Helper function that creates a new Texture based on the video url.\n *\n * @static\n * @param {string} videoUrl - URL of the video\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {boolean} [crossorigin=(auto)] - Should use anonymous CORS? Defaults to true if the URL is not a data-URI.\n * @param {boolean} [autoPlay=true] - Start playing video as soon as it is loaded\n * @return {PIXI.Texture} The newly created texture\n */\n static fromVideoUrl(videoUrl, scaleMode, crossorigin, autoPlay)\n {\n return new Texture(VideoBaseTexture.fromUrl(videoUrl, scaleMode, crossorigin, autoPlay));\n }\n\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {number|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture}\n * source - Source to create texture from\n * @return {PIXI.Texture} The newly created texture\n */\n static from(source)\n {\n // TODO auto detect cross origin..\n // TODO pass in scale mode?\n if (typeof source === 'string')\n {\n const texture = TextureCache[source];\n\n if (!texture)\n {\n // check if its a video..\n const isVideo = source.match(/\\.(mp4|webm|ogg|h264|avi|mov)$/) !== null;\n\n if (isVideo)\n {\n return Texture.fromVideoUrl(source);\n }\n\n return Texture.fromImage(source);\n }\n\n return texture;\n }\n else if (source instanceof HTMLImageElement)\n {\n return new Texture(BaseTexture.from(source));\n }\n else if (source instanceof HTMLCanvasElement)\n {\n return Texture.fromCanvas(source, settings.SCALE_MODE, 'HTMLCanvasElement');\n }\n else if (source instanceof HTMLVideoElement)\n {\n return Texture.fromVideo(source);\n }\n else if (source instanceof BaseTexture)\n {\n return new Texture(source);\n }\n\n // lets assume its a texture!\n return source;\n }\n\n /**\n * Create a texture from a source and add to the cache.\n *\n * @static\n * @param {HTMLImageElement|HTMLCanvasElement} source - The input source.\n * @param {String} imageUrl - File name of texture, for cache and resolving resolution.\n * @param {String} [name] - Human readible name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @return {PIXI.Texture} Output texture\n */\n static fromLoader(source, imageUrl, name)\n {\n const baseTexture = new BaseTexture(source, undefined, getResolutionOfUrl(imageUrl));\n const texture = new Texture(baseTexture);\n\n baseTexture.imageUrl = imageUrl;\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\n\n // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n return texture;\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.Texture} texture - The Texture to add to the cache.\n * @param {string} id - The id that the Texture will be stored against.\n */\n static addToCache(texture, id)\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n // @if DEBUG\n /* eslint-disable no-console */\n if (TextureCache[id])\n {\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n /* eslint-enable no-console */\n // @endif\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n *\n * @static\n * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself\n * @return {PIXI.Texture|null} The Texture that was removed\n */\n static removeFromCache(texture)\n {\n if (typeof texture === 'string')\n {\n const textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n const index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (let i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n }\n\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `_updateUvs()` after you change coordinates of `frame` manually.\n *\n * @member {PIXI.Rectangle}\n */\n get frame()\n {\n return this._frame;\n }\n\n set frame(frame) // eslint-disable-line require-jsdoc\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n const { x, y, width, height } = frame;\n const xNotFit = x + width > this.baseTexture.width;\n const yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n const relationship = xNotFit && yNotFit ? 'and' : 'or';\n const errorX = `X: ${x} + ${width} = ${x + width} > ${this.baseTexture.width}`;\n const errorY = `Y: ${y} + ${height} = ${y + height} > ${this.baseTexture.height}`;\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + `${errorX} ${relationship} ${errorY}`);\n }\n\n // this.valid = width && height && this.baseTexture.source && this.baseTexture.hasLoaded;\n this.valid = width && height && this.baseTexture.hasLoaded;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this._updateUvs();\n }\n }\n\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.GroupD8} for explanation\n *\n * @member {number}\n */\n get rotate()\n {\n return this._rotate;\n }\n\n set rotate(rotate) // eslint-disable-line require-jsdoc\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this._updateUvs();\n }\n }\n\n /**\n * The width of the Texture in pixels.\n *\n * @member {number}\n */\n get width()\n {\n return this.orig.width;\n }\n\n /**\n * The height of the Texture in pixels.\n *\n * @member {number}\n */\n get height()\n {\n return this.orig.height;\n }\n}\n\nfunction createWhiteTexture()\n{\n const canvas = document.createElement('canvas');\n\n canvas.width = 10;\n canvas.height = 10;\n\n const context = canvas.getContext('2d');\n\n context.fillStyle = 'white';\n context.fillRect(0, 0, 10, 10);\n\n return new Texture(new BaseTexture(canvas));\n}\n\nfunction removeAllHandlers(tex)\n{\n tex.destroy = function _emptyDestroy() { /* empty */ };\n tex.on = function _emptyOn() { /* empty */ };\n tex.once = function _emptyOnce() { /* empty */ };\n tex.emit = function _emptyEmit() { /* empty */ };\n}\n\n/**\n * An empty texture, used often to not have to create multiple empty textures.\n * Can not be destroyed.\n *\n * @static\n * @constant\n */\nTexture.EMPTY = new Texture(new BaseTexture());\nremoveAllHandlers(Texture.EMPTY);\nremoveAllHandlers(Texture.EMPTY.baseTexture);\n\n/**\n * A white texture of 10x10 size, used for graphics and other things\n * Can not be destroyed.\n *\n * @static\n * @constant\n */\nTexture.WHITE = createWhiteTexture();\nremoveAllHandlers(Texture.WHITE);\nremoveAllHandlers(Texture.WHITE.baseTexture);\n","import { default as Matrix } from '../math/Matrix';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv transform and frame clamp for texture\n * Can be used in Texture \"transform\" field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * @see PIXI.Texture\n * @see PIXI.mesh.Mesh\n * @see PIXI.extras.TilingSprite\n * @class\n * @memberof PIXI\n */\nexport default class TextureMatrix\n{\n /**\n *\n * @param {PIXI.Texture} texture observed texture\n * @param {number} [clampMargin] Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n * @constructor\n */\n constructor(texture, clampMargin)\n {\n this._texture = texture;\n\n this.mapCoord = new Matrix();\n\n this.uClampFrame = new Float32Array(4);\n\n this.uClampOffset = new Float32Array(2);\n\n this._lastTextureID = -1;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n *\n * @default 0\n * @member {number}\n */\n this.clampOffset = 0;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n }\n\n /**\n * texture property\n * @member {PIXI.Texture}\n */\n get texture()\n {\n return this._texture;\n }\n\n set texture(value) // eslint-disable-line require-jsdoc\n {\n this._texture = value;\n this._lastTextureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param {Float32Array} uvs mesh uvs\n * @param {Float32Array} [out=uvs] output\n * @returns {Float32Array} output\n */\n multiplyUvs(uvs, out)\n {\n if (out === undefined)\n {\n out = uvs;\n }\n\n const mat = this.mapCoord;\n\n for (let i = 0; i < uvs.length; i += 2)\n {\n const x = uvs[i];\n const y = uvs[i + 1];\n\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n\n return out;\n }\n\n /**\n * updates matrices if texture was changed\n * @param {boolean} forceUpdate if true, matrices will be updated any case\n * @returns {boolean} whether or not it was updated\n */\n update(forceUpdate)\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._lastTextureID === tex._updateID)\n {\n return false;\n }\n\n this._lastTextureID = tex._updateID;\n\n const uvs = tex._uvs;\n\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n\n const orig = tex.orig;\n const trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n const texBase = tex.baseTexture;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase.resolution;\n const offset = this.clampOffset;\n\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n\n return true;\n }\n}\n","import GroupD8 from '../math/GroupD8';\n\n/**\n * A standard object to store the Uvs of a texture\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport default class TextureUvs\n{\n /**\n *\n */\n constructor()\n {\n this.x0 = 0;\n this.y0 = 0;\n\n this.x1 = 1;\n this.y1 = 0;\n\n this.x2 = 1;\n this.y2 = 1;\n\n this.x3 = 0;\n this.y3 = 1;\n\n this.uvsUint32 = new Uint32Array(4);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n *\n * @private\n * @param {PIXI.Rectangle} frame - The frame of the texture\n * @param {PIXI.Rectangle} baseFrame - The base frame of the texture\n * @param {number} rotate - Rotation of frame, see {@link PIXI.GroupD8}\n */\n set(frame, baseFrame, rotate)\n {\n const tw = baseFrame.width;\n const th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n const w2 = frame.width / 2 / tw;\n const h2 = frame.height / 2 / th;\n\n // coordinates of center\n const cX = (frame.x / tw) + w2;\n const cY = (frame.y / th) + h2;\n\n rotate = GroupD8.add(rotate, GroupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * GroupD8.uX(rotate));\n this.y0 = cY + (h2 * GroupD8.uY(rotate));\n\n rotate = GroupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * GroupD8.uX(rotate));\n this.y1 = cY + (h2 * GroupD8.uY(rotate));\n\n rotate = GroupD8.add(rotate, 2);\n this.x2 = cX + (w2 * GroupD8.uX(rotate));\n this.y2 = cY + (h2 * GroupD8.uY(rotate));\n\n rotate = GroupD8.add(rotate, 2);\n this.x3 = cX + (w2 * GroupD8.uX(rotate));\n this.y3 = cY + (h2 * GroupD8.uY(rotate));\n }\n else\n {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n\n this.uvsUint32[0] = ((Math.round(this.y0 * 65535) & 0xFFFF) << 16) | (Math.round(this.x0 * 65535) & 0xFFFF);\n this.uvsUint32[1] = ((Math.round(this.y1 * 65535) & 0xFFFF) << 16) | (Math.round(this.x1 * 65535) & 0xFFFF);\n this.uvsUint32[2] = ((Math.round(this.y2 * 65535) & 0xFFFF) << 16) | (Math.round(this.x2 * 65535) & 0xFFFF);\n this.uvsUint32[3] = ((Math.round(this.y3 * 65535) & 0xFFFF) << 16) | (Math.round(this.x3 * 65535) & 0xFFFF);\n }\n}\n","import BaseTexture from './BaseTexture';\nimport { uid, BaseTextureCache } from '../utils';\nimport { shared } from '../ticker';\nimport { UPDATE_PRIORITY } from '../const';\nimport determineCrossOrigin from '../utils/determineCrossOrigin';\n\n/**\n * A texture of a [playing] Video.\n *\n * Video base textures mimic PixiJS BaseTexture.from.... method in their creation process.\n *\n * This can be used in several ways, such as:\n *\n * ```js\n * let texture = PIXI.VideoBaseTexture.fromUrl('http://mydomain.com/video.mp4');\n *\n * let texture = PIXI.VideoBaseTexture.fromUrl({ src: 'http://mydomain.com/video.mp4', mime: 'video/mp4' });\n *\n * let texture = PIXI.VideoBaseTexture.fromUrls(['/video.webm', '/video.mp4']);\n *\n * let texture = PIXI.VideoBaseTexture.fromUrls([\n * { src: '/video.webm', mime: 'video/webm' },\n * { src: '/video.mp4', mime: 'video/mp4' }\n * ]);\n * ```\n *\n * See the [\"deus\" demo](http://www.goodboydigital.com/pixijs/examples/deus/).\n *\n * @class\n * @extends PIXI.BaseTexture\n * @memberof PIXI\n */\nexport default class VideoBaseTexture extends BaseTexture\n{\n /**\n * @param {HTMLVideoElement} source - Video source\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {boolean} [autoPlay=true] - Start playing video as soon as it is loaded\n */\n constructor(source, scaleMode, autoPlay = true)\n {\n if (!source)\n {\n throw new Error('No video source element specified.');\n }\n\n // hook in here to check if video is already available.\n // BaseTexture looks for a source.complete boolean, plus width & height.\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n source.complete = true;\n }\n\n super(source, scaleMode);\n\n this.width = source.videoWidth;\n this.height = source.videoHeight;\n\n this._autoUpdate = true;\n this._isAutoUpdating = false;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPlay = autoPlay;\n\n this.update = this.update.bind(this);\n this._onCanPlay = this._onCanPlay.bind(this);\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n this.hasLoaded = false;\n this.__loaded = false;\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n }\n else\n {\n this._onCanPlay();\n }\n }\n\n /**\n * Returns true if the underlying source is playing.\n *\n * @private\n * @return {boolean} True if playing.\n */\n _isSourcePlaying()\n {\n const source = this.source;\n\n return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2);\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n *\n * @private\n * @return {boolean} True if ready.\n */\n _isSourceReady()\n {\n return this.source.readyState === 3 || this.source.readyState === 4;\n }\n\n /**\n * Runs the update loop when the video is ready to play\n *\n * @private\n */\n _onPlayStart()\n {\n // Just in case the video has not received its can play even yet..\n if (!this.hasLoaded)\n {\n this._onCanPlay();\n }\n\n if (!this._isAutoUpdating && this.autoUpdate)\n {\n shared.add(this.update, this, UPDATE_PRIORITY.HIGH);\n this._isAutoUpdating = true;\n }\n }\n\n /**\n * Fired when a pause event is triggered, stops the update loop\n *\n * @private\n */\n _onPlayStop()\n {\n if (this._isAutoUpdating)\n {\n shared.remove(this.update, this);\n this._isAutoUpdating = false;\n }\n }\n\n /**\n * Fired when the video is loaded and ready to play\n *\n * @private\n */\n _onCanPlay()\n {\n this.hasLoaded = true;\n\n if (this.source)\n {\n this.source.removeEventListener('canplay', this._onCanPlay);\n this.source.removeEventListener('canplaythrough', this._onCanPlay);\n\n this.width = this.source.videoWidth;\n this.height = this.source.videoHeight;\n\n // prevent multiple loaded dispatches..\n if (!this.__loaded)\n {\n this.__loaded = true;\n this.emit('loaded', this);\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n this.source.play();\n }\n }\n }\n\n /**\n * Destroys this texture\n *\n */\n destroy()\n {\n if (this._isAutoUpdating)\n {\n shared.remove(this.update, this);\n }\n\n if (this.source && this.source._pixiId)\n {\n BaseTexture.removeFromCache(this.source._pixiId);\n delete this.source._pixiId;\n\n this.source.pause();\n this.source.src = '';\n this.source.load();\n }\n\n super.destroy();\n }\n\n /**\n * Mimic PixiJS BaseTexture.from.... method.\n *\n * @static\n * @param {HTMLVideoElement} video - Video to create texture from\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values\n * @param {boolean} [autoPlay=true] - Start playing video as soon as it is loaded\n * @return {PIXI.VideoBaseTexture} Newly created VideoBaseTexture\n */\n static fromVideo(video, scaleMode, autoPlay)\n {\n if (!video._pixiId)\n {\n video._pixiId = `video_${uid()}`;\n }\n\n let baseTexture = BaseTextureCache[video._pixiId];\n\n if (!baseTexture)\n {\n baseTexture = new VideoBaseTexture(video, scaleMode, autoPlay);\n BaseTexture.addToCache(baseTexture, video._pixiId);\n }\n\n return baseTexture;\n }\n\n /**\n * Helper function that creates a new BaseTexture based on the given video element.\n * This BaseTexture can then be used to create a texture\n *\n * @static\n * @param {string|object|string[]|object[]} videoSrc - The URL(s) for the video.\n * @param {string} [videoSrc.src] - One of the source urls for the video\n * @param {string} [videoSrc.mime] - The mimetype of the video (e.g. 'video/mp4'). If not specified\n * the url's extension will be used as the second part of the mime type.\n * @param {number} scaleMode - See {@link PIXI.SCALE_MODES} for possible values\n * @param {boolean} [crossorigin=(auto)] - Should use anonymous CORS? Defaults to true if the URL is not a data-URI.\n * @param {boolean} [autoPlay=true] - Start playing video as soon as it is loaded\n * @return {PIXI.VideoBaseTexture} Newly created VideoBaseTexture\n */\n static fromUrl(videoSrc, scaleMode, crossorigin, autoPlay)\n {\n const video = document.createElement('video');\n\n video.setAttribute('webkit-playsinline', '');\n video.setAttribute('playsinline', '');\n\n const url = Array.isArray(videoSrc) ? (videoSrc[0].src || videoSrc[0]) : (videoSrc.src || videoSrc);\n\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n video.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin)\n {\n video.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n\n // array of objects or strings\n if (Array.isArray(videoSrc))\n {\n for (let i = 0; i < videoSrc.length; ++i)\n {\n video.appendChild(createSource(videoSrc[i].src || videoSrc[i], videoSrc[i].mime));\n }\n }\n // single object or string\n else\n {\n video.appendChild(createSource(url, videoSrc.mime));\n }\n\n video.load();\n\n return VideoBaseTexture.fromVideo(video, scaleMode, autoPlay);\n }\n\n /**\n * Should the base texture automatically update itself, set to true by default\n *\n * @member {boolean}\n */\n get autoUpdate()\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value) // eslint-disable-line require-jsdoc\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isAutoUpdating)\n {\n shared.remove(this.update, this);\n this._isAutoUpdating = false;\n }\n else if (this._autoUpdate && !this._isAutoUpdating)\n {\n shared.add(this.update, this, UPDATE_PRIORITY.HIGH);\n this._isAutoUpdating = true;\n }\n }\n }\n}\n\nVideoBaseTexture.fromUrls = VideoBaseTexture.fromUrl;\n\nfunction createSource(path, type)\n{\n if (!type)\n {\n const purePath = path.split('?').shift().toLowerCase();\n\n type = `video/${purePath.substr(purePath.lastIndexOf('.') + 1)}`;\n }\n\n const source = document.createElement('source');\n\n source.src = path;\n source.type = type;\n\n return source;\n}\n","import settings from '../settings';\nimport { UPDATE_PRIORITY } from '../const';\nimport TickerListener from './TickerListener';\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n * This class is composed around listeners\n * meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary,\n * e.g. When the ticker is started and the emitter has listeners.\n *\n * @class\n * @memberof PIXI.ticker\n */\nexport default class Ticker\n{\n /**\n *\n */\n constructor()\n {\n /**\n * The first listener. All new listeners added are chained on this.\n * @private\n * @type {TickerListener}\n */\n this._head = new TickerListener(null, null, Infinity);\n\n /**\n * Internal current frame request ID\n * @private\n */\n this._requestId = null;\n\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n * @private\n */\n this._maxElapsedMS = 100;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.ticker.Ticker#start} automatically\n * when a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.autoStart = false;\n\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.ticker.Ticker#minFPS}\n * and is scaled with {@link PIXI.ticker.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n *\n * @member {number}\n * @default 1\n */\n this.deltaTime = 1;\n\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.ticker.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n *\n * @member {number}\n * @default 16.66\n */\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n\n /**\n * The last time {@link PIXI.ticker.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n *\n * @member {number}\n * @default -1\n */\n this.lastTime = -1;\n\n /**\n * Factor of current {@link PIXI.ticker.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n *\n * @member {number}\n * @default 1\n */\n this.speed = 1;\n\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.ticker.Ticker#start} has been called.\n * `false` if {@link PIXI.ticker.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.ticker.Ticker#autoStart} being `true`\n * and a listener is added.\n *\n * @member {boolean}\n * @default false\n */\n this.started = false;\n\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n *\n * @private\n * @param {number} time - Time since last tick.\n */\n this._tick = (time) =>\n {\n this._requestId = null;\n\n if (this.started)\n {\n // Invoke listeners now\n this.update(time);\n // Listener side effects may have modified ticker state.\n if (this.started && this._requestId === null && this._head.next)\n {\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n };\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n *\n * @private\n */\n _requestIfNeeded()\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n *\n * @private\n */\n _cancelIfNeeded()\n {\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n *\n * @private\n */\n _startIfPossible()\n {\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n *\n * @param {Function} fn - The listener function to be added for updates\n * @param {Function} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.ticker.Ticker} This instance of a ticker\n */\n add(fn, context, priority = UPDATE_PRIORITY.NORMAL)\n {\n return this._addListener(new TickerListener(fn, context, priority));\n }\n\n /**\n * Add a handler for the tick event which is only execute once.\n *\n * @param {Function} fn - The listener function to be added for one update\n * @param {Function} [context] - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns {PIXI.ticker.Ticker} This instance of a ticker\n */\n addOnce(fn, context, priority = UPDATE_PRIORITY.NORMAL)\n {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\n\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n *\n * @private\n * @param {TickerListener} listener - Current listener being added.\n * @returns {PIXI.ticker.Ticker} This instance of a ticker\n */\n _addListener(listener)\n {\n // For attaching to head\n let current = this._head.next;\n let previous = this._head;\n\n // Add the first item\n if (!current)\n {\n listener.connect(previous);\n }\n else\n {\n // Go from highest to lowest priority\n while (current)\n {\n if (listener.priority > current.priority)\n {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n\n // Not yet connected\n if (!listener.previous)\n {\n listener.connect(previous);\n }\n }\n\n this._startIfPossible();\n\n return this;\n }\n\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n *\n * @param {Function} fn - The listener function to be removed\n * @param {Function} [context] - The listener context to be removed\n * @returns {PIXI.ticker.Ticker} This instance of a ticker\n */\n remove(fn, context)\n {\n let listener = this._head.next;\n\n while (listener)\n {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context))\n {\n listener = listener.destroy();\n }\n else\n {\n listener = listener.next;\n }\n }\n\n if (!this._head.next)\n {\n this._cancelIfNeeded();\n }\n\n return this;\n }\n\n /**\n * Starts the ticker. If the ticker has listeners\n * a new animation frame is requested at this point.\n */\n start()\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /**\n * Stops the ticker. If the ticker has requested\n * an animation frame it is canceled at this point.\n */\n stop()\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /**\n * Destroy the ticker and don't use after this. Calling\n * this method removes all references to internal events.\n */\n destroy()\n {\n this.stop();\n\n let listener = this._head.next;\n\n while (listener)\n {\n listener = listener.destroy(true);\n }\n\n this._head.destroy();\n this._head = null;\n }\n\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.ticker.Ticker#elapsedMS},\n * the current {@link PIXI.ticker.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.ticker.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n *\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now())\n {\n let elapsedMS;\n\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n\n if (currentTime > this.lastTime)\n {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n this.deltaTime = elapsedMS * settings.TARGET_FPMS * this.speed;\n\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n const head = this._head;\n\n // Invoke listeners added to internal emitter\n let listener = head.next;\n\n while (listener)\n {\n listener = listener.emit(this.deltaTime);\n }\n\n if (!head.next)\n {\n this._cancelIfNeeded();\n }\n }\n else\n {\n this.deltaTime = this.elapsedMS = 0;\n }\n\n this.lastTime = currentTime;\n }\n\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.ticker.Ticker#speed}, which is specific\n * to scaling {@link PIXI.ticker.Ticker#deltaTime}.\n *\n * @member {number}\n * @readonly\n */\n get FPS()\n {\n return 1000 / this.elapsedMS;\n }\n\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.ticker.Ticker#update}.\n * This value is used to cap {@link PIXI.ticker.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.ticker.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n *\n * @member {number}\n * @default 10\n */\n get minFPS()\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps) // eslint-disable-line require-jsdoc\n {\n // Clamp: 0 to TARGET_FPMS\n const minFPMS = Math.min(Math.max(0, fps) / 1000, settings.TARGET_FPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n}\n","/**\n * Internal class for handling the priority sorting of ticker handlers.\n *\n * @private\n * @class\n * @memberof PIXI.ticker\n */\nexport default class TickerListener\n{\n /**\n * Constructor\n *\n * @param {Function} fn - The listener function to be added for one update\n * @param {Function} [context=null] - The listener context\n * @param {number} [priority=0] - The priority for emitting\n * @param {boolean} [once=false] - If the handler should fire once\n */\n constructor(fn, context = null, priority = 0, once = false)\n {\n /**\n * The handler function to execute.\n * @member {Function}\n */\n this.fn = fn;\n\n /**\n * The calling to execute.\n * @member {Function}\n */\n this.context = context;\n\n /**\n * The current priority.\n * @member {number}\n */\n this.priority = priority;\n\n /**\n * If this should only execute once.\n * @member {boolean}\n */\n this.once = once;\n\n /**\n * The next item in chain.\n * @member {TickerListener}\n */\n this.next = null;\n\n /**\n * The previous item in chain.\n * @member {TickerListener}\n */\n this.previous = null;\n\n /**\n * `true` if this listener has been destroyed already.\n * @member {boolean}\n * @private\n */\n this._destroyed = false;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n *\n * @param {Function} fn - The listener function to be added for one update\n * @param {Function} context - The listener context\n * @return {boolean} `true` if the listener match the arguments\n */\n match(fn, context)\n {\n context = context || null;\n\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @param {number} deltaTime - time since the last emit.\n * @return {TickerListener} Next ticker\n */\n emit(deltaTime)\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n this.fn(deltaTime);\n }\n }\n\n const redirect = this.next;\n\n if (this.once)\n {\n this.destroy(true);\n }\n\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed)\n {\n this.next = null;\n }\n\n return redirect;\n }\n\n /**\n * Connect to the list.\n * @param {TickerListener} previous - Input node, previous listener\n */\n connect(previous)\n {\n this.previous = previous;\n if (previous.next)\n {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\n\n /**\n * Destroy and don't use after this.\n * @param {boolean} [hard = false] `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @return {TickerListener} The listener to redirect while emitting or removing.\n */\n destroy(hard = false)\n {\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n\n // Disconnect, hook up next and previous\n if (this.previous)\n {\n this.previous.next = this.next;\n }\n\n if (this.next)\n {\n this.next.previous = this.previous;\n }\n\n // Redirect to the next item\n const redirect = this.next;\n\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n\n return redirect;\n }\n}\n","import Ticker from './Ticker';\n\n/**\n * The shared ticker instance used by {@link PIXI.extras.AnimatedSprite}.\n * and by {@link PIXI.interaction.InteractionManager}.\n * The property {@link PIXI.ticker.Ticker#autoStart} is set to `true`\n * for this instance. Please follow the examples for usage, including\n * how to opt-out of auto-starting the shared ticker.\n *\n * @example\n * let ticker = PIXI.ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n *\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer(800, 600);\n * let stage = new PIXI.Container();\n * let interactionManager = PIXI.interaction.InteractionManager(renderer);\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n *\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n *\n * @type {PIXI.ticker.Ticker}\n * @memberof PIXI.ticker\n */\nconst shared = new Ticker();\n\nshared.autoStart = true;\nshared.destroy = () =>\n{\n\t// protect destroying shared ticker\n\t// this is used by other internal systems\n\t// like AnimatedSprite and InteractionManager\n};\n\n/**\n * This namespace contains an API for interacting with PIXI's internal global update loop.\n *\n * This ticker is used for rendering, {@link PIXI.extras.AnimatedSprite AnimatedSprite},\n * {@link PIXI.interaction.InteractionManager InteractionManager} and many other time-based PIXI systems.\n * @example\n * const ticker = new PIXI.ticker.Ticker();\n * ticker.stop();\n * ticker.add((deltaTime) => {\n * // do something every frame\n * });\n * ticker.start();\n * @namespace PIXI.ticker\n */\nexport { shared, Ticker };\n","export default function canUploadSameBuffer()\n{\n\t// Uploading the same buffer multiple times in a single frame can cause perf issues.\n\t// Apparent on IOS so only check for that at the moment\n\t// this check may become more complex if this issue pops up elsewhere.\n const ios = !!navigator.platform && (/iPad|iPhone|iPod/).test(navigator.platform);\n\n return !ios;\n}\n","/**\n * Generic Mask Stack data structure\n *\n * @memberof PIXI\n * @function createIndicesForQuads\n * @private\n * @param {number} size - Number of quads\n * @return {Uint16Array} indices\n */\nexport default function createIndicesForQuads(size)\n{\n // the total number of indices in our array, there are 6 points per quad.\n\n const totalIndices = size * 6;\n\n const indices = new Uint16Array(totalIndices);\n\n // fill the indices with the quads to draw\n for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n indices[i + 0] = j + 0;\n indices[i + 1] = j + 1;\n indices[i + 2] = j + 2;\n indices[i + 3] = j + 0;\n indices[i + 4] = j + 2;\n indices[i + 5] = j + 3;\n }\n\n return indices;\n}\n","import _url from 'url';\n\nlet tempAnchor;\n\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n *\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\nexport default function determineCrossOrigin(url, loc = window.location)\n{\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || window.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n url = _url.parse(tempAnchor.href);\n\n const samePort = (!url.port && loc.port === '') || (url.port === loc.port);\n\n // if cross origin\n if (url.hostname !== loc.hostname || !samePort || url.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n","import { DATA_URI, URL_FILE_EXTENSION, SVG_SIZE, VERSION } from '../const';\nimport settings from '../settings';\nimport EventEmitter from 'eventemitter3';\nimport pluginTarget from './pluginTarget';\nimport * as mixins from './mixin';\nimport * as isMobile from 'ismobilejs';\nimport removeItems from 'remove-array-items';\nimport mapPremultipliedBlendModes from './mapPremultipliedBlendModes';\nimport earcut from 'earcut';\n\nlet nextUid = 0;\nlet saidHello = false;\n\n/**\n * Generalized convenience utilities for PIXI.\n * @example\n * // Extend PIXI's internal Event Emitter.\n * class MyEmitter extends PIXI.utils.EventEmitter {\n * constructor() {\n * super();\n * console.log(\"Emitter created!\");\n * }\n * }\n *\n * // Get info on current device\n * console.log(PIXI.utils.isMobile);\n *\n * // Convert hex color to string\n * console.log(PIXI.utils.hex2string(0xff00ff)); // returns: \"#ff00ff\"\n * @namespace PIXI.utils\n */\nexport {\n /**\n * @see {@link https://github.com/kaimallea/isMobile}\n *\n * @memberof PIXI.utils\n * @function isMobile\n * @type {Object}\n */\n isMobile,\n\n /**\n * @see {@link https://github.com/mreinstein/remove-array-items}\n *\n * @memberof PIXI.utils\n * @function removeItems\n * @type {Object}\n */\n removeItems,\n /**\n * @see {@link https://github.com/primus/eventemitter3}\n *\n * @memberof PIXI.utils\n * @class EventEmitter\n * @type {EventEmitter}\n */\n EventEmitter,\n /**\n * @memberof PIXI.utils\n * @function pluginTarget\n * @type {mixin}\n */\n pluginTarget,\n mixins,\n /**\n * @see {@link https://github.com/mapbox/earcut}\n *\n * @memberof PIXI.utils\n * @function earcut\n * @param {number[]} vertices - A flat array of vertice coordinates\n * @param {number[]} [holes] - An array of hole indices\n * @param {number} [dimensions=2] The number of coordinates per vertice in the input array\n * @return {number[]} Triangulated polygon\n */\n earcut,\n};\n\n/**\n * Gets the next unique identifier\n *\n * @memberof PIXI.utils\n * @function uid\n * @return {number} The next unique identifier to use.\n */\nexport function uid()\n{\n return ++nextUid;\n}\n\n/**\n * Converts a hex color number to an [R, G, B] array\n *\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The number to convert\n * @param {number[]} [out=[]] If supplied, this array will be used rather than returning a new one\n * @return {number[]} An array representing the [R, G, B] of the color.\n */\nexport function hex2rgb(hex, out)\n{\n out = out || [];\n\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\n\n/**\n * Converts a hex color number to a string.\n *\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex\n * @return {string} The string color.\n */\nexport function hex2string(hex)\n{\n hex = hex.toString(16);\n hex = '000000'.substr(0, 6 - hex.length) + hex;\n\n return `#${hex}`;\n}\n\n/**\n * Converts a color as an [R, G, B] array to a hex number\n *\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - rgb array\n * @return {number} The color number\n */\nexport function rgb2hex(rgb)\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n *\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @return {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url, defaultValue)\n{\n const resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n\n/**\n * Typedef for decomposeDataUri return object.\n *\n * @typedef {object} PIXI.utils~DecomposedDataUri\n * @property {mediaType} Media type, eg. `image`\n * @property {subType} Sub type, eg. `png`\n * @property {encoding} Data encoding, eg. `base64`\n * @property {data} The actual data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n *\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @return {PIXI.utils~DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nexport function decomposeDataUri(dataUri)\n{\n const dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n\n/**\n * Get type of the image by regexp for extension. Returns undefined for unknown extensions.\n *\n * @memberof PIXI.utils\n * @function getUrlFileExtension\n * @param {string} url - the image path\n * @return {string|undefined} image extension\n */\nexport function getUrlFileExtension(url)\n{\n const extension = URL_FILE_EXTENSION.exec(url);\n\n if (extension)\n {\n return extension[1].toLowerCase();\n }\n\n return undefined;\n}\n\n/**\n * Typedef for Size object.\n *\n * @typedef {object} PIXI.utils~Size\n * @property {width} Width component\n * @property {height} Height component\n */\n\n/**\n * Get size from an svg string using regexp.\n *\n * @memberof PIXI.utils\n * @function getSvgSize\n * @param {string} svgString - a serialized svg element\n * @return {PIXI.utils~Size|undefined} image extension\n */\nexport function getSvgSize(svgString)\n{\n const sizeMatch = SVG_SIZE.exec(svgString);\n const size = {};\n\n if (sizeMatch)\n {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n\n return size;\n}\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n *\n * @function skipHello\n * @memberof PIXI.utils\n */\nexport function skipHello()\n{\n saidHello = true;\n}\n\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever makes you a jerk face.\n *\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nexport function sayHello(type)\n{\n if (saidHello)\n {\n return;\n }\n\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n const args = [\n `\\n %c %c %c PixiJS ${VERSION} - ✰ ${type} ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\n\\n`,\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n ];\n\n window.console.log.apply(console, args);\n }\n else if (window.console)\n {\n window.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n\n saidHello = true;\n}\n\n/**\n * Helper for checking for webgl support\n *\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @return {boolean} is webgl supported\n */\nexport function isWebGLSupported()\n{\n const contextOptions = { stencil: true, failIfMajorPerformanceCaveat: true };\n\n try\n {\n if (!window.WebGLRenderingContext)\n {\n return false;\n }\n\n const canvas = document.createElement('canvas');\n let gl = canvas.getContext('webgl', contextOptions) || canvas.getContext('experimental-webgl', contextOptions);\n\n const success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n const loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n}\n\n/**\n * Returns sign of number\n *\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nexport function sign(n)\n{\n if (n === 0) return 0;\n\n return n < 0 ? -1 : 1;\n}\n\n/**\n * @todo Describe property usage\n *\n * @memberof PIXI.utils\n * @private\n */\nexport const TextureCache = Object.create(null);\n\n/**\n * @todo Describe property usage\n *\n * @memberof PIXI.utils\n * @private\n */\nexport const BaseTextureCache = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n *\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache()\n{\n let key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n *\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache()\n{\n let key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @const premultiplyBlendMode\n * @type {Array<number[]>}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n *\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode supposed blend mode\n * @param {boolean} premultiplied whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nexport function correctBlendMode(blendMode, premultiplied)\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * premultiplies tint\n *\n * @memberof PIXI.utils\n * @param {number} tint integet RGB\n * @param {number} alpha floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nexport function premultiplyTint(tint, alpha)\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n let R = ((tint >> 16) & 0xFF);\n let G = ((tint >> 8) & 0xFF);\n let B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * combines rgb and alpha to out array\n *\n * @memberof PIXI.utils\n * @param {Float32Array|number[]} rgb input rgb\n * @param {number} alpha alpha param\n * @param {Float32Array} [out] output\n * @param {boolean} [premultiply=true] do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyRgba(rgb, alpha, out, premultiply)\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n *\n * @memberof PIXI.utils\n * @param {number} tint input tint\n * @param {number} alpha alpha param\n * @param {Float32Array} [out] output\n * @param {boolean} [premultiply=true] do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyTintToRgba(tint, alpha, out, premultiply)\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n","import { BLEND_MODES } from '../const';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n *\n * @memberof PIXI\n * @function mapPremultipliedBlendModes\n * @private\n * @param {Array<number[]>} [array] - The array to output into.\n * @return {Array<number[]>} Mapped modes.\n */\n\nexport default function mapPremultipliedBlendModes()\n{\n const pm = [];\n const npm = [];\n\n for (let i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\n\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n\n const array = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n","import Device from 'ismobilejs';\n\nexport default function maxRecommendedTextures(max)\n{\n if (Device.tablet || Device.phone)\n {\n // check if the res is iphone 6 or higher..\n return 4;\n }\n\n // desktop should be ok\n return max;\n}\n","/**\n * Mixes all enumerable properties and methods from a source object to a target object.\n *\n * @memberof PIXI.utils.mixins\n * @function mixin\n * @param {object} target The prototype or instance that properties and methods should be added to.\n * @param {object} source The source of properties and methods to mix in.\n */\nexport function mixin(target, source)\n{\n if (!target || !source) return;\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i)\n {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(target, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));\n }\n}\n\nconst mixins = [];\n\n/**\n * Queues a mixin to be handled towards the end of the initialization of PIXI, so that deprecation\n * can take effect.\n *\n * @memberof PIXI.utils.mixins\n * @function delayMixin\n * @private\n * @param {object} target The prototype or instance that properties and methods should be added to.\n * @param {object} source The source of properties and methods to mix in.\n */\nexport function delayMixin(target, source)\n{\n mixins.push(target, source);\n}\n\n/**\n * Handles all mixins queued via delayMixin().\n *\n * @memberof PIXI.utils.mixins\n * @function performMixins\n * @private\n */\nexport function performMixins()\n{\n for (let i = 0; i < mixins.length; i += 2)\n {\n mixin(mixins[i], mixins[i + 1]);\n }\n mixins.length = 0;\n}\n","/**\n * Mixins functionality to make an object have \"plugins\".\n *\n * @example\n * function MyObject() {}\n *\n * pluginTarget.mixin(MyObject);\n *\n * @mixin\n * @memberof PIXI.utils\n * @param {object} obj - The object to mix into.\n */\nfunction pluginTarget(obj)\n{\n obj.__plugins = {};\n\n /**\n * Adds a plugin to an object\n *\n * @param {string} pluginName - The events that should be listed.\n * @param {Function} ctor - The constructor function for the plugin.\n */\n obj.registerPlugin = function registerPlugin(pluginName, ctor)\n {\n obj.__plugins[pluginName] = ctor;\n };\n\n /**\n * Instantiates all the plugins of this object\n *\n */\n obj.prototype.initPlugins = function initPlugins()\n {\n this.plugins = this.plugins || {};\n\n for (const o in obj.__plugins)\n {\n this.plugins[o] = new (obj.__plugins[o])(this);\n }\n };\n\n /**\n * Removes all the plugins of this object\n *\n */\n obj.prototype.destroyPlugins = function destroyPlugins()\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n this.plugins = null;\n };\n}\n\nexport default {\n /**\n * Mixes in the properties of the pluginTarget into another object\n *\n * @param {object} obj - The obj to mix into\n */\n mixin: function mixin(obj)\n {\n pluginTarget(obj);\n },\n};\n","/**\n * Trim transparent borders from a canvas\n *\n * @memberof PIXI\n * @function trimCanvas\n * @private\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nexport default function trimCanvas(canvas)\n{\n // https://gist.github.com/remy/784508\n\n let width = canvas.width;\n let height = canvas.height;\n\n const context = canvas.getContext('2d');\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = imageData.data;\n const len = pixels.length;\n\n const bound = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n let data = null;\n let i;\n let x;\n let y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height,\n width,\n data,\n };\n}\n","// provide method to give a stack track for warnings\n// useful for tracking-down where deprecated methods/properties/classes\n// are being used within the code\n\n// A map of warning messages already fired\nconst warnings = {};\n\n// provide method to give a stack track for warnings\n// useful for tracking-down where deprecated methods/properties/classes\n// are being used within the code\nfunction warn(msg)\n{\n // Ignore duplicat\n if (warnings[msg])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('Deprecation Warning: ', msg);\n }\n else\n {\n // chop off the stack trace which includes pixi.js internal calls\n stack = stack.split('\\n').splice(3).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cDeprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n msg\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('Deprecation Warning: ', msg);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[msg] = true;\n}\n\nexport default function deprecation(core)\n{\n const { mesh, particles, extras, filters, prepare, loaders, interaction } = core;\n\n Object.defineProperties(core, {\n\n /**\n * @class\n * @private\n * @name SpriteBatch\n * @memberof PIXI\n * @see PIXI.ParticleContainer\n * @throws {ReferenceError} SpriteBatch does not exist any more, please use the new ParticleContainer instead.\n * @deprecated since version 3.0.0\n */\n SpriteBatch: {\n get()\n {\n throw new ReferenceError('SpriteBatch does not exist any more, '\n + 'please use the new ParticleContainer instead.');\n },\n },\n\n /**\n * @class\n * @private\n * @name AssetLoader\n * @memberof PIXI\n * @see PIXI.loaders.Loader\n * @throws {ReferenceError} The loader system was overhauled in PixiJS v3,\n * please see the new PIXI.loaders.Loader class.\n * @deprecated since version 3.0.0\n */\n AssetLoader: {\n get()\n {\n throw new ReferenceError('The loader system was overhauled in PixiJS v3, '\n + 'please see the new PIXI.loaders.Loader class.');\n },\n },\n\n /**\n * @class\n * @private\n * @name Stage\n * @memberof PIXI\n * @see PIXI.Container\n * @deprecated since version 3.0.0\n */\n Stage: {\n get()\n {\n warn('You do not need to use a PIXI Stage any more, you can simply render any container.');\n\n return core.Container;\n },\n },\n\n /**\n * @class\n * @private\n * @name DisplayObjectContainer\n * @memberof PIXI\n * @see PIXI.Container\n * @deprecated since version 3.0.0\n */\n DisplayObjectContainer: {\n get()\n {\n warn('DisplayObjectContainer has been shortened to Container, please use Container from now on.');\n\n return core.Container;\n },\n },\n\n /**\n * @class\n * @private\n * @name Strip\n * @memberof PIXI\n * @see PIXI.mesh.Mesh\n * @deprecated since version 3.0.0\n */\n Strip: {\n get()\n {\n warn('The Strip class has been renamed to Mesh and moved to mesh.Mesh, please use mesh.Mesh from now on.');\n\n return mesh.Mesh;\n },\n },\n\n /**\n * @class\n * @private\n * @name Rope\n * @memberof PIXI\n * @see PIXI.mesh.Rope\n * @deprecated since version 3.0.0\n */\n Rope: {\n get()\n {\n warn('The Rope class has been moved to mesh.Rope, please use mesh.Rope from now on.');\n\n return mesh.Rope;\n },\n },\n\n /**\n * @class\n * @private\n * @name ParticleContainer\n * @memberof PIXI\n * @see PIXI.particles.ParticleContainer\n * @deprecated since version 4.0.0\n */\n ParticleContainer: {\n get()\n {\n warn('The ParticleContainer class has been moved to particles.ParticleContainer, '\n + 'please use particles.ParticleContainer from now on.');\n\n return particles.ParticleContainer;\n },\n },\n\n /**\n * @class\n * @private\n * @name MovieClip\n * @memberof PIXI\n * @see PIXI.extras.MovieClip\n * @deprecated since version 3.0.0\n */\n MovieClip: {\n get()\n {\n warn('The MovieClip class has been moved to extras.AnimatedSprite, please use extras.AnimatedSprite.');\n\n return extras.AnimatedSprite;\n },\n },\n\n /**\n * @class\n * @private\n * @name TilingSprite\n * @memberof PIXI\n * @see PIXI.extras.TilingSprite\n * @deprecated since version 3.0.0\n */\n TilingSprite: {\n get()\n {\n warn('The TilingSprite class has been moved to extras.TilingSprite, '\n + 'please use extras.TilingSprite from now on.');\n\n return extras.TilingSprite;\n },\n },\n\n /**\n * @class\n * @private\n * @name BitmapText\n * @memberof PIXI\n * @see PIXI.extras.BitmapText\n * @deprecated since version 3.0.0\n */\n BitmapText: {\n get()\n {\n warn('The BitmapText class has been moved to extras.BitmapText, '\n + 'please use extras.BitmapText from now on.');\n\n return extras.BitmapText;\n },\n },\n\n /**\n * @class\n * @private\n * @name blendModes\n * @memberof PIXI\n * @see PIXI.BLEND_MODES\n * @deprecated since version 3.0.0\n */\n blendModes: {\n get()\n {\n warn('The blendModes has been moved to BLEND_MODES, please use BLEND_MODES from now on.');\n\n return core.BLEND_MODES;\n },\n },\n\n /**\n * @class\n * @private\n * @name scaleModes\n * @memberof PIXI\n * @see PIXI.SCALE_MODES\n * @deprecated since version 3.0.0\n */\n scaleModes: {\n get()\n {\n warn('The scaleModes has been moved to SCALE_MODES, please use SCALE_MODES from now on.');\n\n return core.SCALE_MODES;\n },\n },\n\n /**\n * @class\n * @private\n * @name BaseTextureCache\n * @memberof PIXI\n * @see PIXI.utils.BaseTextureCache\n * @deprecated since version 3.0.0\n */\n BaseTextureCache: {\n get()\n {\n warn('The BaseTextureCache class has been moved to utils.BaseTextureCache, '\n + 'please use utils.BaseTextureCache from now on.');\n\n return core.utils.BaseTextureCache;\n },\n },\n\n /**\n * @class\n * @private\n * @name TextureCache\n * @memberof PIXI\n * @see PIXI.utils.TextureCache\n * @deprecated since version 3.0.0\n */\n TextureCache: {\n get()\n {\n warn('The TextureCache class has been moved to utils.TextureCache, '\n + 'please use utils.TextureCache from now on.');\n\n return core.utils.TextureCache;\n },\n },\n\n /**\n * @namespace\n * @private\n * @name math\n * @memberof PIXI\n * @see PIXI\n * @deprecated since version 3.0.6\n */\n math: {\n get()\n {\n warn('The math namespace is deprecated, please access members already accessible on PIXI.');\n\n return core;\n },\n },\n\n /**\n * @class\n * @private\n * @name PIXI.AbstractFilter\n * @see PIXI.Filter\n * @deprecated since version 3.0.6\n */\n AbstractFilter: {\n get()\n {\n warn('AstractFilter has been renamed to Filter, please use PIXI.Filter');\n\n return core.Filter;\n },\n },\n\n /**\n * @class\n * @private\n * @name PIXI.TransformManual\n * @see PIXI.TransformBase\n * @deprecated since version 4.0.0\n */\n TransformManual: {\n get()\n {\n warn('TransformManual has been renamed to TransformBase, please update your pixi-spine');\n\n return core.TransformBase;\n },\n },\n\n /**\n * @static\n * @constant\n * @name PIXI.TARGET_FPMS\n * @see PIXI.settings.TARGET_FPMS\n * @deprecated since version 4.2.0\n */\n TARGET_FPMS: {\n get()\n {\n warn('PIXI.TARGET_FPMS has been deprecated, please use PIXI.settings.TARGET_FPMS');\n\n return core.settings.TARGET_FPMS;\n },\n set(value)\n {\n warn('PIXI.TARGET_FPMS has been deprecated, please use PIXI.settings.TARGET_FPMS');\n\n core.settings.TARGET_FPMS = value;\n },\n },\n\n /**\n * @static\n * @constant\n * @name PIXI.FILTER_RESOLUTION\n * @see PIXI.settings.FILTER_RESOLUTION\n * @deprecated since version 4.2.0\n */\n FILTER_RESOLUTION: {\n get()\n {\n warn('PIXI.FILTER_RESOLUTION has been deprecated, please use PIXI.settings.FILTER_RESOLUTION');\n\n return core.settings.FILTER_RESOLUTION;\n },\n set(value)\n {\n warn('PIXI.FILTER_RESOLUTION has been deprecated, please use PIXI.settings.FILTER_RESOLUTION');\n\n core.settings.FILTER_RESOLUTION = value;\n },\n },\n\n /**\n * @static\n * @constant\n * @name PIXI.RESOLUTION\n * @see PIXI.settings.RESOLUTION\n * @deprecated since version 4.2.0\n */\n RESOLUTION: {\n get()\n {\n warn('PIXI.RESOLUTION has been deprecated, please use PIXI.settings.RESOLUTION');\n\n return core.settings.RESOLUTION;\n },\n set(value)\n {\n warn('PIXI.RESOLUTION has been deprecated, please use PIXI.settings.RESOLUTION');\n\n core.settings.RESOLUTION = value;\n },\n },\n\n /**\n * @static\n * @constant\n * @name PIXI.MIPMAP_TEXTURES\n * @see PIXI.settings.MIPMAP_TEXTURES\n * @deprecated since version 4.2.0\n */\n MIPMAP_TEXTURES: {\n get()\n {\n warn('PIXI.MIPMAP_TEXTURES has been deprecated, please use PIXI.settings.MIPMAP_TEXTURES');\n\n return core.settings.MIPMAP_TEXTURES;\n },\n set(value)\n {\n warn('PIXI.MIPMAP_TEXTURES has been deprecated, please use PIXI.settings.MIPMAP_TEXTURES');\n\n core.settings.MIPMAP_TEXTURES = value;\n },\n },\n\n /**\n * @static\n * @constant\n * @name PIXI.SPRITE_BATCH_SIZE\n * @see PIXI.settings.SPRITE_BATCH_SIZE\n * @deprecated since version 4.2.0\n */\n SPRITE_BATCH_SIZE: {\n get()\n {\n warn('PIXI.SPRITE_BATCH_SIZE has been deprecated, please use PIXI.settings.SPRITE_BATCH_SIZE');\n\n return core.settings.SPRITE_BATCH_SIZE;\n },\n set(value)\n {\n warn('PIXI.SPRITE_BATCH_SIZE has been deprecated, please use PIXI.settings.SPRITE_BATCH_SIZE');\n\n core.settings.SPRITE_BATCH_SIZE = value;\n },\n },\n\n /**\n * @static\n * @constant\n * @name PIXI.SPRITE_MAX_TEXTURES\n * @see PIXI.settings.SPRITE_MAX_TEXTURES\n * @deprecated since version 4.2.0\n */\n SPRITE_MAX_TEXTURES: {\n get()\n {\n warn('PIXI.SPRITE_MAX_TEXTURES has been deprecated, please use PIXI.settings.SPRITE_MAX_TEXTURES');\n\n return core.settings.SPRITE_MAX_TEXTURES;\n },\n set(value)\n {\n warn('PIXI.SPRITE_MAX_TEXTURES has been deprecated, please use PIXI.settings.SPRITE_MAX_TEXTURES');\n\n core.settings.SPRITE_MAX_TEXTURES = value;\n },\n },\n\n /**\n * @static\n * @constant\n * @name PIXI.RETINA_PREFIX\n * @see PIXI.settings.RETINA_PREFIX\n * @deprecated since version 4.2.0\n */\n RETINA_PREFIX: {\n get()\n {\n warn('PIXI.RETINA_PREFIX has been deprecated, please use PIXI.settings.RETINA_PREFIX');\n\n return core.settings.RETINA_PREFIX;\n },\n set(value)\n {\n warn('PIXI.RETINA_PREFIX has been deprecated, please use PIXI.settings.RETINA_PREFIX');\n\n core.settings.RETINA_PREFIX = value;\n },\n },\n\n /**\n * @static\n * @constant\n * @name PIXI.DEFAULT_RENDER_OPTIONS\n * @see PIXI.settings.RENDER_OPTIONS\n * @deprecated since version 4.2.0\n */\n DEFAULT_RENDER_OPTIONS: {\n get()\n {\n warn('PIXI.DEFAULT_RENDER_OPTIONS has been deprecated, please use PIXI.settings.DEFAULT_RENDER_OPTIONS');\n\n return core.settings.RENDER_OPTIONS;\n },\n },\n });\n\n // Move the default properties to settings\n const defaults = [\n { parent: 'TRANSFORM_MODE', target: 'TRANSFORM_MODE' },\n { parent: 'GC_MODES', target: 'GC_MODE' },\n { parent: 'WRAP_MODES', target: 'WRAP_MODE' },\n { parent: 'SCALE_MODES', target: 'SCALE_MODE' },\n { parent: 'PRECISION', target: 'PRECISION_FRAGMENT' },\n ];\n\n for (let i = 0; i < defaults.length; i++)\n {\n const deprecation = defaults[i];\n\n Object.defineProperty(core[deprecation.parent], 'DEFAULT', {\n get()\n {\n warn(`PIXI.${deprecation.parent}.DEFAULT has been deprecated, `\n + `please use PIXI.settings.${deprecation.target}`);\n\n return core.settings[deprecation.target];\n },\n set(value)\n {\n warn(`PIXI.${deprecation.parent}.DEFAULT has been deprecated, `\n + `please use PIXI.settings.${deprecation.target}`);\n\n core.settings[deprecation.target] = value;\n },\n });\n }\n\n Object.defineProperties(core.settings, {\n\n /**\n * @static\n * @name PRECISION\n * @memberof PIXI.settings\n * @see PIXI.PRECISION\n * @deprecated since version 4.4.0\n */\n PRECISION: {\n get()\n {\n warn('PIXI.settings.PRECISION has been deprecated, please use PIXI.settings.PRECISION_FRAGMENT');\n\n return core.settings.PRECISION_FRAGMENT;\n },\n set(value)\n {\n warn('PIXI.settings.PRECISION has been deprecated, please use PIXI.settings.PRECISION_FRAGMENT');\n\n core.settings.PRECISION_FRAGMENT = value;\n },\n },\n });\n\n if (extras.AnimatedSprite)\n {\n Object.defineProperties(extras, {\n\n /**\n * @class\n * @name MovieClip\n * @memberof PIXI.extras\n * @see PIXI.extras.AnimatedSprite\n * @deprecated since version 4.2.0\n */\n MovieClip: {\n get()\n {\n warn('The MovieClip class has been renamed to AnimatedSprite, please use AnimatedSprite from now on.');\n\n return extras.AnimatedSprite;\n },\n },\n });\n }\n\n if (extras)\n {\n Object.defineProperties(extras, {\n /**\n * @class\n * @name TextureTransform\n * @memberof PIXI.extras\n * @see PIXI.TextureMatrix\n * @deprecated since version 4.6.0\n */\n TextureTransform: {\n get()\n {\n warn('The TextureTransform class has been renamed to TextureMatrix, '\n + 'please use PIXI.TextureMatrix from now on.');\n\n return core.TextureMatrix;\n },\n },\n });\n }\n\n core.DisplayObject.prototype.generateTexture = function generateTexture(renderer, scaleMode, resolution)\n {\n warn('generateTexture has moved to the renderer, please use renderer.generateTexture(displayObject)');\n\n return renderer.generateTexture(this, scaleMode, resolution);\n };\n\n core.Graphics.prototype.generateTexture = function generateTexture(scaleMode, resolution)\n {\n warn('graphics generate texture has moved to the renderer. '\n + 'Or to render a graphics to a texture using canvas please use generateCanvasTexture');\n\n return this.generateCanvasTexture(scaleMode, resolution);\n };\n\n /**\n * @method\n * @name PIXI.GroupD8.isSwapWidthHeight\n * @see PIXI.GroupD8.isVertical\n * @param {number} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n * @deprecated since version 4.6.0\n */\n core.GroupD8.isSwapWidthHeight = function isSwapWidthHeight(rotation)\n {\n warn('GroupD8.isSwapWidthHeight was renamed to GroupD8.isVertical');\n\n return core.GroupD8.isVertical(rotation);\n };\n\n core.RenderTexture.prototype.render = function render(displayObject, matrix, clear, updateTransform)\n {\n this.legacyRenderer.render(displayObject, this, clear, matrix, !updateTransform);\n warn('RenderTexture.render is now deprecated, please use renderer.render(displayObject, renderTexture)');\n };\n\n core.RenderTexture.prototype.getImage = function getImage(target)\n {\n warn('RenderTexture.getImage is now deprecated, please use renderer.extract.image(target)');\n\n return this.legacyRenderer.extract.image(target);\n };\n\n core.RenderTexture.prototype.getBase64 = function getBase64(target)\n {\n warn('RenderTexture.getBase64 is now deprecated, please use renderer.extract.base64(target)');\n\n return this.legacyRenderer.extract.base64(target);\n };\n\n core.RenderTexture.prototype.getCanvas = function getCanvas(target)\n {\n warn('RenderTexture.getCanvas is now deprecated, please use renderer.extract.canvas(target)');\n\n return this.legacyRenderer.extract.canvas(target);\n };\n\n core.RenderTexture.prototype.getPixels = function getPixels(target)\n {\n warn('RenderTexture.getPixels is now deprecated, please use renderer.extract.pixels(target)');\n\n return this.legacyRenderer.pixels(target);\n };\n\n /**\n * @method\n * @private\n * @name PIXI.Sprite#setTexture\n * @see PIXI.Sprite#texture\n * @deprecated since version 3.0.0\n * @param {PIXI.Texture} texture - The texture to set to.\n */\n core.Sprite.prototype.setTexture = function setTexture(texture)\n {\n this.texture = texture;\n warn('setTexture is now deprecated, please use the texture property, e.g : sprite.texture = texture;');\n };\n\n if (extras.BitmapText)\n {\n /**\n * @method\n * @name PIXI.extras.BitmapText#setText\n * @see PIXI.extras.BitmapText#text\n * @deprecated since version 3.0.0\n * @param {string} text - The text to set to.\n */\n extras.BitmapText.prototype.setText = function setText(text)\n {\n this.text = text;\n warn(`setText is now deprecated, please use the text property, e.g : myBitmapText.text = 'my text';`);\n };\n }\n\n /**\n * @method\n * @name PIXI.Text#setText\n * @see PIXI.Text#text\n * @deprecated since version 3.0.0\n * @param {string} text - The text to set to.\n */\n core.Text.prototype.setText = function setText(text)\n {\n this.text = text;\n warn(`setText is now deprecated, please use the text property, e.g : myText.text = 'my text';`);\n };\n\n /**\n * Calculates the ascent, descent and fontSize of a given fontStyle\n *\n * @name PIXI.Text.calculateFontProperties\n * @see PIXI.TextMetrics.measureFont\n * @deprecated since version 4.5.0\n * @param {string} font - String representing the style of the font\n * @return {Object} Font properties object\n */\n core.Text.calculateFontProperties = function calculateFontProperties(font)\n {\n warn(`Text.calculateFontProperties is now deprecated, please use the TextMetrics.measureFont`);\n\n return core.TextMetrics.measureFont(font);\n };\n\n Object.defineProperties(core.Text, {\n fontPropertiesCache: {\n get()\n {\n warn(`Text.fontPropertiesCache is deprecated`);\n\n return core.TextMetrics._fonts;\n },\n },\n fontPropertiesCanvas: {\n get()\n {\n warn(`Text.fontPropertiesCanvas is deprecated`);\n\n return core.TextMetrics._canvas;\n },\n },\n fontPropertiesContext: {\n get()\n {\n warn(`Text.fontPropertiesContext is deprecated`);\n\n return core.TextMetrics._context;\n },\n },\n });\n\n /**\n * @method\n * @name PIXI.Text#setStyle\n * @see PIXI.Text#style\n * @deprecated since version 3.0.0\n * @param {*} style - The style to set to.\n */\n core.Text.prototype.setStyle = function setStyle(style)\n {\n this.style = style;\n warn('setStyle is now deprecated, please use the style property, e.g : myText.style = style;');\n };\n\n /**\n * @method\n * @name PIXI.Text#determineFontProperties\n * @see PIXI.Text#measureFontProperties\n * @deprecated since version 4.2.0\n * @private\n * @param {string} fontStyle - String representing the style of the font\n * @return {Object} Font properties object\n */\n core.Text.prototype.determineFontProperties = function determineFontProperties(fontStyle)\n {\n warn('determineFontProperties is now deprecated, please use TextMetrics.measureFont method');\n\n return core.TextMetrics.measureFont(fontStyle);\n };\n\n /**\n * @method\n * @name PIXI.Text.getFontStyle\n * @see PIXI.TextMetrics.getFontStyle\n * @deprecated since version 4.5.0\n * @param {PIXI.TextStyle} style - The style to use.\n * @return {string} Font string\n */\n core.Text.getFontStyle = function getFontStyle(style)\n {\n warn('getFontStyle is now deprecated, please use TextStyle.toFontString() instead');\n\n style = style || {};\n\n if (!(style instanceof core.TextStyle))\n {\n style = new core.TextStyle(style);\n }\n\n return style.toFontString();\n };\n\n Object.defineProperties(core.TextStyle.prototype, {\n /**\n * Set all properties of a font as a single string\n *\n * @name PIXI.TextStyle#font\n * @deprecated since version 4.0.0\n */\n font: {\n get()\n {\n warn(`text style property 'font' is now deprecated, please use the `\n + `'fontFamily', 'fontSize', 'fontStyle', 'fontVariant' and 'fontWeight' properties from now on`);\n\n const fontSizeString = (typeof this._fontSize === 'number') ? `${this._fontSize}px` : this._fontSize;\n\n return `${this._fontStyle} ${this._fontVariant} ${this._fontWeight} ${fontSizeString} ${this._fontFamily}`;\n },\n set(font)\n {\n warn(`text style property 'font' is now deprecated, please use the `\n + `'fontFamily','fontSize',fontStyle','fontVariant' and 'fontWeight' properties from now on`);\n\n // can work out fontStyle from search of whole string\n if (font.indexOf('italic') > 1)\n {\n this._fontStyle = 'italic';\n }\n else if (font.indexOf('oblique') > -1)\n {\n this._fontStyle = 'oblique';\n }\n else\n {\n this._fontStyle = 'normal';\n }\n\n // can work out fontVariant from search of whole string\n if (font.indexOf('small-caps') > -1)\n {\n this._fontVariant = 'small-caps';\n }\n else\n {\n this._fontVariant = 'normal';\n }\n\n // fontWeight and fontFamily are tricker to find, but it's easier to find the fontSize due to it's units\n const splits = font.split(' ');\n let fontSizeIndex = -1;\n\n this._fontSize = 26;\n for (let i = 0; i < splits.length; ++i)\n {\n if (splits[i].match(/(px|pt|em|%)/))\n {\n fontSizeIndex = i;\n this._fontSize = splits[i];\n break;\n }\n }\n\n // we can now search for fontWeight as we know it must occur before the fontSize\n this._fontWeight = 'normal';\n for (let i = 0; i < fontSizeIndex; ++i)\n {\n if (splits[i].match(/(bold|bolder|lighter|100|200|300|400|500|600|700|800|900)/))\n {\n this._fontWeight = splits[i];\n break;\n }\n }\n\n // and finally join everything together after the fontSize in case the font family has multiple words\n if (fontSizeIndex > -1 && fontSizeIndex < splits.length - 1)\n {\n this._fontFamily = '';\n for (let i = fontSizeIndex + 1; i < splits.length; ++i)\n {\n this._fontFamily += `${splits[i]} `;\n }\n\n this._fontFamily = this._fontFamily.slice(0, -1);\n }\n else\n {\n this._fontFamily = 'Arial';\n }\n\n this.styleID++;\n },\n },\n });\n\n /**\n * @method\n * @name PIXI.Texture#setFrame\n * @see PIXI.Texture#setFrame\n * @deprecated since version 3.0.0\n * @param {PIXI.Rectangle} frame - The frame to set.\n */\n core.Texture.prototype.setFrame = function setFrame(frame)\n {\n this.frame = frame;\n warn('setFrame is now deprecated, please use the frame property, e.g: myTexture.frame = frame;');\n };\n\n /**\n * @static\n * @function\n * @name PIXI.Texture.addTextureToCache\n * @see PIXI.Texture.addToCache\n * @deprecated since 4.5.0\n * @param {PIXI.Texture} texture - The Texture to add to the cache.\n * @param {string} id - The id that the texture will be stored against.\n */\n core.Texture.addTextureToCache = function addTextureToCache(texture, id)\n {\n core.Texture.addToCache(texture, id);\n warn('Texture.addTextureToCache is deprecated, please use Texture.addToCache from now on.');\n };\n\n /**\n * @static\n * @function\n * @name PIXI.Texture.removeTextureFromCache\n * @see PIXI.Texture.removeFromCache\n * @deprecated since 4.5.0\n * @param {string} id - The id of the texture to be removed\n * @return {PIXI.Texture|null} The texture that was removed\n */\n core.Texture.removeTextureFromCache = function removeTextureFromCache(id)\n {\n warn('Texture.removeTextureFromCache is deprecated, please use Texture.removeFromCache from now on. '\n + 'Be aware that Texture.removeFromCache does not automatically its BaseTexture from the BaseTextureCache. '\n + 'For that, use BaseTexture.removeFromCache');\n\n core.BaseTexture.removeFromCache(id);\n\n return core.Texture.removeFromCache(id);\n };\n\n Object.defineProperties(filters, {\n\n /**\n * @class\n * @private\n * @name PIXI.filters.AbstractFilter\n * @see PIXI.AbstractFilter\n * @deprecated since version 3.0.6\n */\n AbstractFilter: {\n get()\n {\n warn('AstractFilter has been renamed to Filter, please use PIXI.Filter');\n\n return core.AbstractFilter;\n },\n },\n\n /**\n * @class\n * @private\n * @name PIXI.filters.SpriteMaskFilter\n * @see PIXI.SpriteMaskFilter\n * @deprecated since version 3.0.6\n */\n SpriteMaskFilter: {\n get()\n {\n warn('filters.SpriteMaskFilter is an undocumented alias, please use SpriteMaskFilter from now on.');\n\n return core.SpriteMaskFilter;\n },\n },\n\n /**\n * @class\n * @private\n * @name PIXI.filters.VoidFilter\n * @see PIXI.filters.AlphaFilter\n * @deprecated since version 4.5.7\n */\n VoidFilter: {\n get()\n {\n warn('VoidFilter has been renamed to AlphaFilter, please use PIXI.filters.AlphaFilter');\n\n return filters.AlphaFilter;\n },\n },\n });\n\n /**\n * @method\n * @name PIXI.utils.uuid\n * @see PIXI.utils.uid\n * @deprecated since version 3.0.6\n * @return {number} The uid\n */\n core.utils.uuid = () =>\n {\n warn('utils.uuid() is deprecated, please use utils.uid() from now on.');\n\n return core.utils.uid();\n };\n\n /**\n * @method\n * @name PIXI.utils.canUseNewCanvasBlendModes\n * @see PIXI.CanvasTinter\n * @deprecated\n * @return {boolean} Can use blend modes.\n */\n core.utils.canUseNewCanvasBlendModes = () =>\n {\n warn('utils.canUseNewCanvasBlendModes() is deprecated, please use CanvasTinter.canUseMultiply from now on');\n\n return core.CanvasTinter.canUseMultiply;\n };\n\n let saidHello = true;\n\n /**\n * @name PIXI.utils._saidHello\n * @type {boolean}\n * @see PIXI.utils.skipHello\n * @deprecated since 4.1.0\n */\n Object.defineProperty(core.utils, '_saidHello', {\n set(bool)\n {\n if (bool)\n {\n warn('PIXI.utils._saidHello is deprecated, please use PIXI.utils.skipHello()');\n this.skipHello();\n }\n saidHello = bool;\n },\n get()\n {\n return saidHello;\n },\n });\n\n if (prepare.BasePrepare)\n {\n /**\n * @method\n * @name PIXI.prepare.BasePrepare#register\n * @see PIXI.prepare.BasePrepare#registerFindHook\n * @deprecated since version 4.4.2\n * @param {Function} [addHook] - Function call that takes two parameters: `item:*, queue:Array`\n * function must return `true` if it was able to add item to the queue.\n * @param {Function} [uploadHook] - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and\n * function must return `true` if it was able to handle upload of item.\n * @return {PIXI.BasePrepare} Instance of plugin for chaining.\n */\n prepare.BasePrepare.prototype.register = function register(addHook, uploadHook)\n {\n warn('renderer.plugins.prepare.register is now deprecated, '\n + 'please use renderer.plugins.prepare.registerFindHook & renderer.plugins.prepare.registerUploadHook');\n\n if (addHook)\n {\n this.registerFindHook(addHook);\n }\n\n if (uploadHook)\n {\n this.registerUploadHook(uploadHook);\n }\n\n return this;\n };\n }\n\n if (prepare.canvas)\n {\n /**\n * The number of graphics or textures to upload to the GPU.\n *\n * @name PIXI.prepare.canvas.UPLOADS_PER_FRAME\n * @static\n * @type {number}\n * @see PIXI.prepare.BasePrepare.limiter\n * @deprecated since 4.2.0\n */\n Object.defineProperty(prepare.canvas, 'UPLOADS_PER_FRAME', {\n set()\n {\n warn('PIXI.CanvasPrepare.UPLOADS_PER_FRAME has been removed. Please set '\n + 'renderer.plugins.prepare.limiter.maxItemsPerFrame on your renderer');\n // because we don't have a reference to the renderer, we can't actually set\n // the uploads per frame, so we'll have to stick with the warning.\n },\n get()\n {\n warn('PIXI.CanvasPrepare.UPLOADS_PER_FRAME has been removed. Please use '\n + 'renderer.plugins.prepare.limiter');\n\n return NaN;\n },\n });\n }\n\n if (prepare.webgl)\n {\n /**\n * The number of graphics or textures to upload to the GPU.\n *\n * @name PIXI.prepare.webgl.UPLOADS_PER_FRAME\n * @static\n * @type {number}\n * @see PIXI.prepare.BasePrepare.limiter\n * @deprecated since 4.2.0\n */\n Object.defineProperty(prepare.webgl, 'UPLOADS_PER_FRAME', {\n set()\n {\n warn('PIXI.WebGLPrepare.UPLOADS_PER_FRAME has been removed. Please set '\n + 'renderer.plugins.prepare.limiter.maxItemsPerFrame on your renderer');\n // because we don't have a reference to the renderer, we can't actually set\n // the uploads per frame, so we'll have to stick with the warning.\n },\n get()\n {\n warn('PIXI.WebGLPrepare.UPLOADS_PER_FRAME has been removed. Please use '\n + 'renderer.plugins.prepare.limiter');\n\n return NaN;\n },\n });\n }\n\n if (loaders.Loader)\n {\n const Resource = loaders.Resource;\n const Loader = loaders.Loader;\n\n Object.defineProperties(Resource.prototype, {\n isJson: {\n get()\n {\n warn('The isJson property is deprecated, please use `resource.type === Resource.TYPE.JSON`.');\n\n return this.type === Resource.TYPE.JSON;\n },\n },\n isXml: {\n get()\n {\n warn('The isXml property is deprecated, please use `resource.type === Resource.TYPE.XML`.');\n\n return this.type === Resource.TYPE.XML;\n },\n },\n isImage: {\n get()\n {\n warn('The isImage property is deprecated, please use `resource.type === Resource.TYPE.IMAGE`.');\n\n return this.type === Resource.TYPE.IMAGE;\n },\n },\n isAudio: {\n get()\n {\n warn('The isAudio property is deprecated, please use `resource.type === Resource.TYPE.AUDIO`.');\n\n return this.type === Resource.TYPE.AUDIO;\n },\n },\n isVideo: {\n get()\n {\n warn('The isVideo property is deprecated, please use `resource.type === Resource.TYPE.VIDEO`.');\n\n return this.type === Resource.TYPE.VIDEO;\n },\n },\n });\n\n Object.defineProperties(Loader.prototype, {\n before: {\n get()\n {\n warn('The before() method is deprecated, please use pre().');\n\n return this.pre;\n },\n },\n after: {\n get()\n {\n warn('The after() method is deprecated, please use use().');\n\n return this.use;\n },\n },\n });\n }\n\n if (interaction.interactiveTarget)\n {\n /**\n * @name PIXI.interaction.interactiveTarget#defaultCursor\n * @static\n * @type {number}\n * @see PIXI.interaction.interactiveTarget#cursor\n * @deprecated since 4.3.0\n */\n Object.defineProperty(interaction.interactiveTarget, 'defaultCursor', {\n set(value)\n {\n warn('Property defaultCursor has been replaced with \\'cursor\\'. ');\n this.cursor = value;\n },\n get()\n {\n warn('Property defaultCursor has been replaced with \\'cursor\\'. ');\n\n return this.cursor;\n },\n });\n }\n\n if (interaction.InteractionManager)\n {\n /**\n * @name PIXI.interaction.InteractionManager#defaultCursorStyle\n * @static\n * @type {string}\n * @see PIXI.interaction.InteractionManager#cursorStyles\n * @deprecated since 4.3.0\n */\n Object.defineProperty(interaction.InteractionManager, 'defaultCursorStyle', {\n set(value)\n {\n warn('Property defaultCursorStyle has been replaced with \\'cursorStyles.default\\'. ');\n this.cursorStyles.default = value;\n },\n get()\n {\n warn('Property defaultCursorStyle has been replaced with \\'cursorStyles.default\\'. ');\n\n return this.cursorStyles.default;\n },\n });\n\n /**\n * @name PIXI.interaction.InteractionManager#currentCursorStyle\n * @static\n * @type {string}\n * @see PIXI.interaction.InteractionManager#cursorStyles\n * @deprecated since 4.3.0\n */\n Object.defineProperty(interaction.InteractionManager, 'currentCursorStyle', {\n set(value)\n {\n warn('Property currentCursorStyle has been removed.'\n + 'See the currentCursorMode property, which works differently.');\n this.currentCursorMode = value;\n },\n get()\n {\n warn('Property currentCursorStyle has been removed.'\n + 'See the currentCursorMode property, which works differently.');\n\n return this.currentCursorMode;\n },\n });\n }\n}\n","import * as core from '../../core';\n\nconst TEMP_RECT = new core.Rectangle();\n\n/**\n * The extract manager provides functionality to export content from the renderers.\n *\n * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract\n *\n * @class\n * @memberof PIXI.extract\n */\nexport default class CanvasExtract\n{\n /**\n * @param {PIXI.CanvasRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer)\n {\n this.renderer = renderer;\n /**\n * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture\n *\n * @member {PIXI.extract.CanvasExtract} extract\n * @memberof PIXI.CanvasRenderer#\n * @see PIXI.extract.CanvasExtract\n */\n renderer.extract = this;\n }\n\n /**\n * Will return a HTML Image of the target\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use use the main renderer\n * @return {HTMLImageElement} HTML Image of the target\n */\n image(target)\n {\n const image = new Image();\n\n image.src = this.base64(target);\n\n return image;\n }\n\n /**\n * Will return a a base64 encoded string of this target. It works by calling\n * `CanvasExtract.getCanvas` and then running toDataURL on that.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use use the main renderer\n * @return {string} A base64 encoded string of the texture.\n */\n base64(target)\n {\n return this.canvas(target).toDataURL();\n }\n\n /**\n * Creates a Canvas element, renders this target to it and then returns it.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use use the main renderer\n * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.\n */\n canvas(target)\n {\n const renderer = this.renderer;\n let context;\n let resolution;\n let frame;\n let renderTexture;\n\n if (target)\n {\n if (target instanceof core.RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = renderer.generateTexture(target);\n }\n }\n\n if (renderTexture)\n {\n context = renderTexture.baseTexture._canvasRenderTarget.context;\n resolution = renderTexture.baseTexture._canvasRenderTarget.resolution;\n frame = renderTexture.frame;\n }\n else\n {\n context = renderer.rootContext;\n resolution = renderer.resolution;\n frame = TEMP_RECT;\n frame.width = this.renderer.width;\n frame.height = this.renderer.height;\n }\n\n const width = frame.width * resolution;\n const height = frame.height * resolution;\n\n const canvasBuffer = new core.CanvasRenderTarget(width, height, 1);\n const canvasData = context.getImageData(frame.x * resolution, frame.y * resolution, width, height);\n\n canvasBuffer.context.putImageData(canvasData, 0, 0);\n\n // send the canvas back..\n return canvasBuffer.canvas;\n }\n\n /**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use use the main renderer\n * @return {Uint8ClampedArray} One-dimensional array containing the pixel data of the entire texture\n */\n pixels(target)\n {\n const renderer = this.renderer;\n let context;\n let resolution;\n let frame;\n let renderTexture;\n\n if (target)\n {\n if (target instanceof core.RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = renderer.generateTexture(target);\n }\n }\n\n if (renderTexture)\n {\n context = renderTexture.baseTexture._canvasRenderTarget.context;\n resolution = renderTexture.baseTexture._canvasRenderTarget.resolution;\n frame = renderTexture.frame;\n }\n else\n {\n context = renderer.rootContext;\n\n frame = TEMP_RECT;\n frame.width = renderer.width;\n frame.height = renderer.height;\n }\n\n return context.getImageData(0, 0, frame.width * resolution, frame.height * resolution).data;\n }\n\n /**\n * Destroys the extract\n *\n */\n destroy()\n {\n this.renderer.extract = null;\n this.renderer = null;\n }\n}\n\ncore.CanvasRenderer.registerPlugin('extract', CanvasExtract);\n","/**\n * This namespace provides renderer-specific plugins for exporting content from a renderer.\n * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).\n *\n * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.WebGLRenderer#plugins}.\n * @example\n * // Create a new app (will auto-add extract plugin to renderer)\n * const app = new PIXI.Application();\n *\n * // Draw a red circle\n * const graphics = new PIXI.Graphics()\n * .beginFill(0xFF0000)\n * .drawCircle(0, 0, 50);\n *\n * // Render the graphics as an HTMLImageElement\n * const image = app.renderer.plugins.extract.image(graphics);\n * document.body.appendChild(image);\n * @namespace PIXI.extract\n */\nexport { default as webgl } from './webgl/WebGLExtract';\nexport { default as canvas } from './canvas/CanvasExtract';\n","import * as core from '../../core';\n\nconst TEMP_RECT = new core.Rectangle();\nconst BYTES_PER_PIXEL = 4;\n\n/**\n * The extract manager provides functionality to export content from the renderers.\n *\n * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract\n *\n * @class\n * @memberof PIXI.extract\n */\nexport default class WebGLExtract\n{\n /**\n * @param {PIXI.WebGLRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer)\n {\n this.renderer = renderer;\n /**\n * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture\n *\n * @member {PIXI.extract.WebGLExtract} extract\n * @memberof PIXI.WebGLRenderer#\n * @see PIXI.extract.WebGLExtract\n */\n renderer.extract = this;\n }\n\n /**\n * Will return a HTML Image of the target\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use use the main renderer\n * @return {HTMLImageElement} HTML Image of the target\n */\n image(target)\n {\n const image = new Image();\n\n image.src = this.base64(target);\n\n return image;\n }\n\n /**\n * Will return a a base64 encoded string of this target. It works by calling\n * `WebGLExtract.getCanvas` and then running toDataURL on that.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use use the main renderer\n * @return {string} A base64 encoded string of the texture.\n */\n base64(target)\n {\n return this.canvas(target).toDataURL();\n }\n\n /**\n * Creates a Canvas element, renders this target to it and then returns it.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use use the main renderer\n * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.\n */\n canvas(target)\n {\n const renderer = this.renderer;\n let textureBuffer;\n let resolution;\n let frame;\n let flipY = false;\n let renderTexture;\n let generated = false;\n\n if (target)\n {\n if (target instanceof core.RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n textureBuffer = renderTexture.baseTexture._glRenderTargets[this.renderer.CONTEXT_UID];\n resolution = textureBuffer.resolution;\n frame = renderTexture.frame;\n flipY = false;\n }\n else\n {\n textureBuffer = this.renderer.rootRenderTarget;\n resolution = textureBuffer.resolution;\n flipY = true;\n\n frame = TEMP_RECT;\n frame.width = textureBuffer.size.width;\n frame.height = textureBuffer.size.height;\n }\n\n const width = frame.width * resolution;\n const height = frame.height * resolution;\n\n const canvasBuffer = new core.CanvasRenderTarget(width, height, 1);\n\n if (textureBuffer)\n {\n // bind the buffer\n renderer.bindRenderTarget(textureBuffer);\n\n // set up an array of pixels\n const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n const gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n // add the pixels to the canvas\n const canvasData = canvasBuffer.context.getImageData(0, 0, width, height);\n\n canvasData.data.set(webglPixels);\n\n canvasBuffer.context.putImageData(canvasData, 0, 0);\n\n // pulling pixels\n if (flipY)\n {\n canvasBuffer.context.scale(1, -1);\n canvasBuffer.context.drawImage(canvasBuffer.canvas, 0, -height);\n }\n }\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n // send the canvas back..\n\n return canvasBuffer.canvas;\n }\n\n /**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use use the main renderer\n * @return {Uint8ClampedArray} One-dimensional array containing the pixel data of the entire texture\n */\n pixels(target)\n {\n const renderer = this.renderer;\n let textureBuffer;\n let resolution;\n let frame;\n let renderTexture;\n let generated = false;\n\n if (target)\n {\n if (target instanceof core.RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n textureBuffer = renderTexture.baseTexture._glRenderTargets[this.renderer.CONTEXT_UID];\n resolution = textureBuffer.resolution;\n frame = renderTexture.frame;\n }\n else\n {\n textureBuffer = this.renderer.rootRenderTarget;\n resolution = textureBuffer.resolution;\n\n frame = TEMP_RECT;\n frame.width = textureBuffer.size.width;\n frame.height = textureBuffer.size.height;\n }\n\n const width = frame.width * resolution;\n const height = frame.height * resolution;\n\n const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n if (textureBuffer)\n {\n // bind the buffer\n renderer.bindRenderTarget(textureBuffer);\n // read pixels to the array\n const gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n }\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n return webglPixels;\n }\n\n /**\n * Destroys the extract\n *\n */\n destroy()\n {\n this.renderer.extract = null;\n this.renderer = null;\n }\n}\n\ncore.WebGLRenderer.registerPlugin('extract', WebGLExtract);\n","import * as core from '../core';\n\n/**\n * @typedef PIXI.extras.AnimatedSprite~FrameObject\n * @type {object}\n * @property {PIXI.Texture} texture - The {@link PIXI.Texture} of the frame\n * @property {number} time - the duration of the frame in ms\n */\n\n/**\n * An AnimatedSprite is a simple way to display an animation depicted by a list of textures.\n *\n * ```js\n * let alienImages = [\"image_sequence_01.png\",\"image_sequence_02.png\",\"image_sequence_03.png\",\"image_sequence_04.png\"];\n * let textureArray = [];\n *\n * for (let i=0; i < 4; i++)\n * {\n * let texture = PIXI.Texture.fromImage(alienImages[i]);\n * textureArray.push(texture);\n * };\n *\n * let animatedSprite = new PIXI.extras.AnimatedSprite(textureArray);\n * ```\n *\n * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet}\n * containing the animation definitions:\n *\n * ```js\n * PIXI.loader.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.loader.resources[\"assets/spritesheet.json\"].spritesheet;\n * animatedSprite = new PIXI.extras.AnimatedSprite(sheet.animations[\"image_sequence\"]);\n * ...\n * }\n * ```\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI.extras\n */\nexport default class AnimatedSprite extends core.Sprite\n{\n /**\n * @param {PIXI.Texture[]|PIXI.extras.AnimatedSprite~FrameObject[]} textures - an array of {@link PIXI.Texture} or frame\n * objects that make up the animation\n * @param {boolean} [autoUpdate=true] - Whether to use PIXI.ticker.shared to auto update animation time.\n */\n constructor(textures, autoUpdate)\n {\n super(textures[0] instanceof core.Texture ? textures[0] : textures[0].texture);\n\n /**\n * @private\n */\n this._textures = null;\n\n /**\n * @private\n */\n this._durations = null;\n\n this.textures = textures;\n\n /**\n * `true` uses PIXI.ticker.shared to auto update animation time.\n * @type {boolean}\n * @default true\n * @private\n */\n this._autoUpdate = autoUpdate !== false;\n\n /**\n * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower\n *\n * @member {number}\n * @default 1\n */\n this.animationSpeed = 1;\n\n /**\n * Whether or not the animate sprite repeats after playing.\n *\n * @member {boolean}\n * @default true\n */\n this.loop = true;\n\n /**\n * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes.\n *\n * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools.\n * Changing anchor for each frame allows to pin sprite origin to certain moving feature\n * of the frame (e.g. left foot).\n *\n * Note: Enabling this will override any previously set `anchor` on each frame change.\n *\n * @member {boolean}\n * @default false\n */\n this.updateAnchor = false;\n\n /**\n * Function to call when a AnimatedSprite finishes playing\n *\n * @member {Function}\n */\n this.onComplete = null;\n\n /**\n * Function to call when a AnimatedSprite changes which texture is being rendered\n *\n * @member {Function}\n */\n this.onFrameChange = null;\n\n /**\n * Function to call when 'loop' is true, and an AnimatedSprite is played and loops around to start again\n *\n * @member {Function}\n */\n this.onLoop = null;\n\n /**\n * Elapsed time since animation has been started, used internally to display current texture\n *\n * @member {number}\n * @private\n */\n this._currentTime = 0;\n\n /**\n * Indicates if the AnimatedSprite is currently playing\n *\n * @member {boolean}\n * @readonly\n */\n this.playing = false;\n }\n\n /**\n * Stops the AnimatedSprite\n *\n */\n stop()\n {\n if (!this.playing)\n {\n return;\n }\n\n this.playing = false;\n if (this._autoUpdate)\n {\n core.ticker.shared.remove(this.update, this);\n }\n }\n\n /**\n * Plays the AnimatedSprite\n *\n */\n play()\n {\n if (this.playing)\n {\n return;\n }\n\n this.playing = true;\n if (this._autoUpdate)\n {\n core.ticker.shared.add(this.update, this, core.UPDATE_PRIORITY.HIGH);\n }\n }\n\n /**\n * Stops the AnimatedSprite and goes to a specific frame\n *\n * @param {number} frameNumber - frame index to stop at\n */\n gotoAndStop(frameNumber)\n {\n this.stop();\n\n const previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n }\n\n /**\n * Goes to a specific frame and begins playing the AnimatedSprite\n *\n * @param {number} frameNumber - frame index to start at\n */\n gotoAndPlay(frameNumber)\n {\n const previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n\n this.play();\n }\n\n /**\n * Updates the object transform for rendering.\n *\n * @private\n * @param {number} deltaTime - Time since last tick.\n */\n update(deltaTime)\n {\n const elapsed = this.animationSpeed * deltaTime;\n const previousFrame = this.currentFrame;\n\n if (this._durations !== null)\n {\n let lag = this._currentTime % 1 * this._durations[this.currentFrame];\n\n lag += elapsed / 60 * 1000;\n\n while (lag < 0)\n {\n this._currentTime--;\n lag += this._durations[this.currentFrame];\n }\n\n const sign = Math.sign(this.animationSpeed * deltaTime);\n\n this._currentTime = Math.floor(this._currentTime);\n\n while (lag >= this._durations[this.currentFrame])\n {\n lag -= this._durations[this.currentFrame] * sign;\n this._currentTime += sign;\n }\n\n this._currentTime += lag / this._durations[this.currentFrame];\n }\n else\n {\n this._currentTime += elapsed;\n }\n\n if (this._currentTime < 0 && !this.loop)\n {\n this.gotoAndStop(0);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (this._currentTime >= this._textures.length && !this.loop)\n {\n this.gotoAndStop(this._textures.length - 1);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (previousFrame !== this.currentFrame)\n {\n if (this.loop && this.onLoop)\n {\n if (this.animationSpeed > 0 && this.currentFrame < previousFrame)\n {\n this.onLoop();\n }\n else if (this.animationSpeed < 0 && this.currentFrame > previousFrame)\n {\n this.onLoop();\n }\n }\n\n this.updateTexture();\n }\n }\n\n /**\n * Updates the displayed texture to match the current frame index\n *\n * @private\n */\n updateTexture()\n {\n this._texture = this._textures[this.currentFrame];\n this._textureID = -1;\n this.cachedTint = 0xFFFFFF;\n\n if (this.updateAnchor)\n {\n this._anchor.copy(this._texture.defaultAnchor);\n }\n\n if (this.onFrameChange)\n {\n this.onFrameChange(this.currentFrame);\n }\n }\n\n /**\n * Stops the AnimatedSprite and destroys it\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n destroy(options)\n {\n this.stop();\n super.destroy(options);\n }\n\n /**\n * A short hand way of creating a movieclip from an array of frame ids\n *\n * @static\n * @param {string[]} frames - The array of frames ids the movieclip will use as its texture frames\n * @return {AnimatedSprite} The new animated sprite with the specified frames.\n */\n static fromFrames(frames)\n {\n const textures = [];\n\n for (let i = 0; i < frames.length; ++i)\n {\n textures.push(core.Texture.fromFrame(frames[i]));\n }\n\n return new AnimatedSprite(textures);\n }\n\n /**\n * A short hand way of creating a movieclip from an array of image ids\n *\n * @static\n * @param {string[]} images - the array of image urls the movieclip will use as its texture frames\n * @return {AnimatedSprite} The new animate sprite with the specified images as frames.\n */\n static fromImages(images)\n {\n const textures = [];\n\n for (let i = 0; i < images.length; ++i)\n {\n textures.push(core.Texture.fromImage(images[i]));\n }\n\n return new AnimatedSprite(textures);\n }\n\n /**\n * totalFrames is the total number of frames in the AnimatedSprite. This is the same as number of textures\n * assigned to the AnimatedSprite.\n *\n * @readonly\n * @member {number}\n * @default 0\n */\n get totalFrames()\n {\n return this._textures.length;\n }\n\n /**\n * The array of textures used for this AnimatedSprite\n *\n * @member {PIXI.Texture[]}\n */\n get textures()\n {\n return this._textures;\n }\n\n set textures(value) // eslint-disable-line require-jsdoc\n {\n if (value[0] instanceof core.Texture)\n {\n this._textures = value;\n this._durations = null;\n }\n else\n {\n this._textures = [];\n this._durations = [];\n\n for (let i = 0; i < value.length; i++)\n {\n this._textures.push(value[i].texture);\n this._durations.push(value[i].time);\n }\n }\n this.gotoAndStop(0);\n this.updateTexture();\n }\n\n /**\n * The AnimatedSprites current frame index\n *\n * @member {number}\n * @readonly\n */\n get currentFrame()\n {\n let currentFrame = Math.floor(this._currentTime) % this._textures.length;\n\n if (currentFrame < 0)\n {\n currentFrame += this._textures.length;\n }\n\n return currentFrame;\n }\n}\n","import * as core from '../core';\nimport ObservablePoint from '../core/math/ObservablePoint';\nimport { getResolutionOfUrl } from '../core/utils';\nimport settings from '../core/settings';\n\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font. To\n * split a line you can use '\\n', '\\r' or '\\r\\n' in your string. You can generate the fnt files using:\n *\n * A BitmapText can only be created when the font is loaded\n *\n * ```js\n * // in this case the font is in a file called 'desyrel.fnt'\n * let bitmapText = new PIXI.extras.BitmapText(\"text using a fancy font!\", {font: \"35px Desyrel\", align: \"right\"});\n * ```\n *\n * http://www.angelcode.com/products/bmfont/ for windows or\n * http://www.bmglyph.com/ for mac.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI.extras\n */\nexport default class BitmapText extends core.Container\n{\n /**\n * @param {string} text - The copy that you would like the text to display\n * @param {object} style - The style parameters\n * @param {string|object} style.font - The font descriptor for the object, can be passed as a string of form\n * \"24px FontName\" or \"FontName\" or as an object with explicit name/size properties.\n * @param {string} [style.font.name] - The bitmap font id\n * @param {number} [style.font.size] - The size of the font in pixels, e.g. 24\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), does not affect\n * single line text\n * @param {number} [style.tint=0xFFFFFF] - The tint color\n */\n constructor(text, style = {})\n {\n super();\n\n /**\n * Private tracker for the width of the overall text\n *\n * @member {number}\n * @private\n */\n this._textWidth = 0;\n\n /**\n * Private tracker for the height of the overall text\n *\n * @member {number}\n * @private\n */\n this._textHeight = 0;\n\n /**\n * Private tracker for the letter sprite pool.\n *\n * @member {PIXI.Sprite[]}\n * @private\n */\n this._glyphs = [];\n\n /**\n * Private tracker for the current style.\n *\n * @member {object}\n * @private\n */\n this._font = {\n tint: style.tint !== undefined ? style.tint : 0xFFFFFF,\n align: style.align || 'left',\n name: null,\n size: 0,\n };\n\n /**\n * Private tracker for the current font.\n *\n * @member {object}\n * @private\n */\n this.font = style.font; // run font setter\n\n /**\n * Private tracker for the current text.\n *\n * @member {string}\n * @private\n */\n this._text = text;\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n * @private\n */\n this._maxWidth = 0;\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * ie: when trying to vertically align.\n *\n * @member {number}\n * @private\n */\n this._maxLineHeight = 0;\n\n /**\n * Letter spacing. This is useful for setting the space between characters.\n * @member {number}\n * @private\n */\n this._letterSpacing = 0;\n\n /**\n * Text anchor. read-only\n *\n * @member {PIXI.ObservablePoint}\n * @private\n */\n this._anchor = new ObservablePoint(() => { this.dirty = true; }, this, 0, 0);\n\n /**\n * The dirty state of this object.\n *\n * @member {boolean}\n */\n this.dirty = false;\n\n this.updateText();\n }\n\n /**\n * Renders text and updates it when needed\n *\n * @private\n */\n updateText()\n {\n const data = BitmapText.fonts[this._font.name];\n const scale = this._font.size / data.size;\n const pos = new core.Point();\n const chars = [];\n const lineWidths = [];\n const text = this.text.replace(/(?:\\r\\n|\\r)/g, '\\n');\n const textLength = text.length;\n const maxWidth = this._maxWidth * data.size / this._font.size;\n\n let prevCharCode = null;\n let lastLineWidth = 0;\n let maxLineWidth = 0;\n let line = 0;\n let lastBreakPos = -1;\n let lastBreakWidth = 0;\n let spacesRemoved = 0;\n let maxLineHeight = 0;\n\n for (let i = 0; i < textLength; i++)\n {\n const charCode = text.charCodeAt(i);\n const char = text.charAt(i);\n\n if (/(?:\\s)/.test(char))\n {\n lastBreakPos = i;\n lastBreakWidth = lastLineWidth;\n }\n\n if (char === '\\r' || char === '\\n')\n {\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n ++line;\n ++spacesRemoved;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n continue;\n }\n\n const charData = data.chars[charCode];\n\n if (!charData)\n {\n continue;\n }\n\n if (prevCharCode && charData.kerning[prevCharCode])\n {\n pos.x += charData.kerning[prevCharCode];\n }\n\n chars.push({\n texture: charData.texture,\n line,\n charCode,\n position: new core.Point(pos.x + charData.xOffset + (this._letterSpacing / 2), pos.y + charData.yOffset),\n });\n pos.x += charData.xAdvance + this._letterSpacing;\n lastLineWidth = pos.x;\n maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height));\n prevCharCode = charCode;\n\n if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth)\n {\n ++spacesRemoved;\n core.utils.removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos);\n i = lastBreakPos;\n lastBreakPos = -1;\n\n lineWidths.push(lastBreakWidth);\n maxLineWidth = Math.max(maxLineWidth, lastBreakWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n }\n }\n\n const lastChar = text.charAt(text.length - 1);\n\n if (lastChar !== '\\r' && lastChar !== '\\n')\n {\n if (/(?:\\s)/.test(lastChar))\n {\n lastLineWidth = lastBreakWidth;\n }\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n }\n\n const lineAlignOffsets = [];\n\n for (let i = 0; i <= line; i++)\n {\n let alignOffset = 0;\n\n if (this._font.align === 'right')\n {\n alignOffset = maxLineWidth - lineWidths[i];\n }\n else if (this._font.align === 'center')\n {\n alignOffset = (maxLineWidth - lineWidths[i]) / 2;\n }\n\n lineAlignOffsets.push(alignOffset);\n }\n\n const lenChars = chars.length;\n const tint = this.tint;\n\n for (let i = 0; i < lenChars; i++)\n {\n let c = this._glyphs[i]; // get the next glyph sprite\n\n if (c)\n {\n c.texture = chars[i].texture;\n }\n else\n {\n c = new core.Sprite(chars[i].texture);\n this._glyphs.push(c);\n }\n\n c.position.x = (chars[i].position.x + lineAlignOffsets[chars[i].line]) * scale;\n c.position.y = chars[i].position.y * scale;\n c.scale.x = c.scale.y = scale;\n c.tint = tint;\n\n if (!c.parent)\n {\n this.addChild(c);\n }\n }\n\n // remove unnecessary children.\n for (let i = lenChars; i < this._glyphs.length; ++i)\n {\n this.removeChild(this._glyphs[i]);\n }\n\n this._textWidth = maxLineWidth * scale;\n this._textHeight = (pos.y + data.lineHeight) * scale;\n\n // apply anchor\n if (this.anchor.x !== 0 || this.anchor.y !== 0)\n {\n for (let i = 0; i < lenChars; i++)\n {\n this._glyphs[i].x -= this._textWidth * this.anchor.x;\n this._glyphs[i].y -= this._textHeight * this.anchor.y;\n }\n }\n this._maxLineHeight = maxLineHeight * scale;\n }\n\n /**\n * Updates the transform of this object\n *\n * @private\n */\n updateTransform()\n {\n this.validate();\n this.containerUpdateTransform();\n }\n\n /**\n * Validates text before calling parent's getLocalBounds\n *\n * @return {PIXI.Rectangle} The rectangular bounding area\n */\n getLocalBounds()\n {\n this.validate();\n\n return super.getLocalBounds();\n }\n\n /**\n * Updates text when needed\n *\n * @private\n */\n validate()\n {\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n }\n\n /**\n * The tint of the BitmapText object\n *\n * @member {number}\n */\n get tint()\n {\n return this._font.tint;\n }\n\n set tint(value) // eslint-disable-line require-jsdoc\n {\n this._font.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF;\n\n this.dirty = true;\n }\n\n /**\n * The alignment of the BitmapText object\n *\n * @member {string}\n * @default 'left'\n */\n get align()\n {\n return this._font.align;\n }\n\n set align(value) // eslint-disable-line require-jsdoc\n {\n this._font.align = value || 'left';\n\n this.dirty = true;\n }\n\n /**\n * The anchor sets the origin point of the text.\n * The default is 0,0 this means the text's origin is the top left\n * Setting the anchor to 0.5,0.5 means the text's origin is centered\n * Setting the anchor to 1,1 would mean the text's origin point will be the bottom right corner\n *\n * @member {PIXI.Point | number}\n */\n get anchor()\n {\n return this._anchor;\n }\n\n set anchor(value) // eslint-disable-line require-jsdoc\n {\n if (typeof value === 'number')\n {\n this._anchor.set(value);\n }\n else\n {\n this._anchor.copy(value);\n }\n }\n\n /**\n * The font descriptor of the BitmapText object\n *\n * @member {string|object}\n */\n get font()\n {\n return this._font;\n }\n\n set font(value) // eslint-disable-line require-jsdoc\n {\n if (!value)\n {\n return;\n }\n\n if (typeof value === 'string')\n {\n value = value.split(' ');\n\n this._font.name = value.length === 1 ? value[0] : value.slice(1).join(' ');\n this._font.size = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this._font.name].size;\n }\n else\n {\n this._font.name = value.name;\n this._font.size = typeof value.size === 'number' ? value.size : parseInt(value.size, 10);\n }\n\n this.dirty = true;\n }\n\n /**\n * The text of the BitmapText object\n *\n * @member {string}\n */\n get text()\n {\n return this._text;\n }\n\n set text(value) // eslint-disable-line require-jsdoc\n {\n value = value.toString() || ' ';\n if (this._text === value)\n {\n return;\n }\n this._text = value;\n this.dirty = true;\n }\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @member {number}\n */\n get maxWidth()\n {\n return this._maxWidth;\n }\n\n set maxWidth(value) // eslint-disable-line require-jsdoc\n {\n if (this._maxWidth === value)\n {\n return;\n }\n this._maxWidth = value;\n this.dirty = true;\n }\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * ie: when trying to vertically align.\n *\n * @member {number}\n * @readonly\n */\n get maxLineHeight()\n {\n this.validate();\n\n return this._maxLineHeight;\n }\n\n /**\n * The width of the overall text, different from fontSize,\n * which is defined in the style object\n *\n * @member {number}\n * @readonly\n */\n get textWidth()\n {\n this.validate();\n\n return this._textWidth;\n }\n\n /**\n * Additional space between characters.\n *\n * @member {number}\n */\n get letterSpacing()\n {\n return this._letterSpacing;\n }\n\n set letterSpacing(value) // eslint-disable-line require-jsdoc\n {\n if (this._letterSpacing !== value)\n {\n this._letterSpacing = value;\n this.dirty = true;\n }\n }\n\n /**\n * The height of the overall text, different from fontSize,\n * which is defined in the style object\n *\n * @member {number}\n * @readonly\n */\n get textHeight()\n {\n this.validate();\n\n return this._textHeight;\n }\n\n /**\n * Register a bitmap font with data and a texture.\n *\n * @static\n * @param {XMLDocument} xml - The XML document data.\n * @param {Object.<string, PIXI.Texture>|PIXI.Texture|PIXI.Texture[]} textures - List of textures for each page.\n * If providing an object, the key is the `<page>` element's `file` attribute in the FNT file.\n * @return {Object} Result font object with font, size, lineHeight and char fields.\n */\n static registerFont(xml, textures)\n {\n const data = {};\n const info = xml.getElementsByTagName('info')[0];\n const common = xml.getElementsByTagName('common')[0];\n const pages = xml.getElementsByTagName('page');\n const res = getResolutionOfUrl(pages[0].getAttribute('file'), settings.RESOLUTION);\n const pagesTextures = {};\n\n data.font = info.getAttribute('face');\n data.size = parseInt(info.getAttribute('size'), 10);\n data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10) / res;\n data.chars = {};\n\n // Single texture, convert to list\n if (textures instanceof core.Texture)\n {\n textures = [textures];\n }\n\n // Convert the input Texture, Textures or object\n // into a page Texture lookup by \"id\"\n for (let i = 0; i < pages.length; i++)\n {\n const id = pages[i].getAttribute('id');\n const file = pages[i].getAttribute('file');\n\n pagesTextures[id] = textures instanceof Array ? textures[i] : textures[file];\n }\n\n // parse letters\n const letters = xml.getElementsByTagName('char');\n\n for (let i = 0; i < letters.length; i++)\n {\n const letter = letters[i];\n const charCode = parseInt(letter.getAttribute('id'), 10);\n const page = letter.getAttribute('page') || 0;\n const textureRect = new core.Rectangle(\n (parseInt(letter.getAttribute('x'), 10) / res) + (pagesTextures[page].frame.x / res),\n (parseInt(letter.getAttribute('y'), 10) / res) + (pagesTextures[page].frame.y / res),\n parseInt(letter.getAttribute('width'), 10) / res,\n parseInt(letter.getAttribute('height'), 10) / res\n );\n\n data.chars[charCode] = {\n xOffset: parseInt(letter.getAttribute('xoffset'), 10) / res,\n yOffset: parseInt(letter.getAttribute('yoffset'), 10) / res,\n xAdvance: parseInt(letter.getAttribute('xadvance'), 10) / res,\n kerning: {},\n texture: new core.Texture(pagesTextures[page].baseTexture, textureRect),\n page,\n };\n }\n\n // parse kernings\n const kernings = xml.getElementsByTagName('kerning');\n\n for (let i = 0; i < kernings.length; i++)\n {\n const kerning = kernings[i];\n const first = parseInt(kerning.getAttribute('first'), 10) / res;\n const second = parseInt(kerning.getAttribute('second'), 10) / res;\n const amount = parseInt(kerning.getAttribute('amount'), 10) / res;\n\n if (data.chars[second])\n {\n data.chars[second].kerning[first] = amount;\n }\n }\n\n // I'm leaving this as a temporary fix so we can test the bitmap fonts in v3\n // but it's very likely to change\n BitmapText.fonts[data.font] = data;\n\n return data;\n }\n}\n\nBitmapText.fonts = {};\n","import * as core from '../core';\nimport CanvasTinter from '../core/sprites/canvas/CanvasTinter';\n\nconst tempPoint = new core.Point();\n\n/**\n * A tiling sprite is a fast way of rendering a tiling image\n *\n * @class\n * @extends PIXI.Sprite\n * @memberof PIXI.extras\n */\nexport default class TilingSprite extends core.Sprite\n{\n /**\n * @param {PIXI.Texture} texture - the texture of the tiling sprite\n * @param {number} [width=100] - the width of the tiling sprite\n * @param {number} [height=100] - the height of the tiling sprite\n */\n constructor(texture, width = 100, height = 100)\n {\n super(texture);\n\n /**\n * Tile transform\n *\n * @member {PIXI.TransformStatic}\n */\n this.tileTransform = new core.TransformStatic();\n\n // /// private\n\n /**\n * The with of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._width = width;\n\n /**\n * The height of the tiling sprite\n *\n * @member {number}\n * @private\n */\n this._height = height;\n\n /**\n * Canvas pattern\n *\n * @type {CanvasPattern}\n * @private\n */\n this._canvasPattern = null;\n\n /**\n * transform that is applied to UV to get the texture coords\n *\n * @member {PIXI.TextureMatrix}\n */\n this.uvTransform = texture.transform || new core.TextureMatrix(texture);\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_renderWebGL' method.\n *\n * @member {string}\n * @default 'tilingSprite'\n */\n this.pluginName = 'tilingSprite';\n\n /**\n * Whether or not anchor affects uvs\n *\n * @member {boolean}\n * @default false\n */\n this.uvRespectAnchor = false;\n }\n /**\n * Changes frame clamping in corresponding textureTransform, shortcut\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n get clampMargin()\n {\n return this.uvTransform.clampMargin;\n }\n\n set clampMargin(value) // eslint-disable-line require-jsdoc\n {\n this.uvTransform.clampMargin = value;\n this.uvTransform.update(true);\n }\n\n /**\n * The scaling of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n get tileScale()\n {\n return this.tileTransform.scale;\n }\n\n set tileScale(value) // eslint-disable-line require-jsdoc\n {\n this.tileTransform.scale.copy(value);\n }\n\n /**\n * The offset of the image that is being tiled\n *\n * @member {PIXI.ObservablePoint}\n */\n get tilePosition()\n {\n return this.tileTransform.position;\n }\n\n set tilePosition(value) // eslint-disable-line require-jsdoc\n {\n this.tileTransform.position.copy(value);\n }\n\n /**\n * @private\n */\n _onTextureUpdate()\n {\n if (this.uvTransform)\n {\n this.uvTransform.texture = this._texture;\n }\n this.cachedTint = 0xFFFFFF;\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @private\n * @param {PIXI.WebGLRenderer} renderer - The renderer\n */\n _renderWebGL(renderer)\n {\n // tweak our texture temporarily..\n const texture = this._texture;\n\n if (!texture || !texture.valid)\n {\n return;\n }\n\n this.tileTransform.updateLocalTransform();\n this.uvTransform.update();\n\n renderer.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer\n */\n _renderCanvas(renderer)\n {\n const texture = this._texture;\n\n if (!texture.baseTexture.hasLoaded)\n {\n return;\n }\n\n const context = renderer.context;\n const transform = this.worldTransform;\n const resolution = renderer.resolution;\n const isTextureRotated = texture.rotate === 2;\n const baseTexture = texture.baseTexture;\n const baseTextureResolution = baseTexture.resolution;\n const modX = ((this.tilePosition.x / this.tileScale.x) % texture.orig.width) * baseTextureResolution;\n const modY = ((this.tilePosition.y / this.tileScale.y) % texture.orig.height) * baseTextureResolution;\n\n // create a nice shiny pattern!\n if (this._textureID !== this._texture._updateID || this.cachedTint !== this.tint)\n {\n this._textureID = this._texture._updateID;\n // cut an object from a spritesheet..\n const tempCanvas = new core.CanvasRenderTarget(texture.orig.width,\n texture.orig.height,\n baseTextureResolution);\n\n // Tint the tiling sprite\n if (this.tint !== 0xFFFFFF)\n {\n this.tintedTexture = CanvasTinter.getTintedTexture(this, this.tint);\n tempCanvas.context.drawImage(this.tintedTexture, 0, 0);\n }\n else\n {\n const sx = texture._frame.x * baseTextureResolution;\n const sy = texture._frame.y * baseTextureResolution;\n const sWidth = texture._frame.width * baseTextureResolution;\n const sHeight = texture._frame.height * baseTextureResolution;\n const dWidth = (texture.trim ? texture.trim.width : texture.orig.width) * baseTextureResolution;\n const dHeight = (texture.trim ? texture.trim.height : texture.orig.height) * baseTextureResolution;\n const dx = (texture.trim ? texture.trim.x : 0) * baseTextureResolution;\n const dy = (texture.trim ? texture.trim.y : 0) * baseTextureResolution;\n\n if (isTextureRotated)\n {\n // Apply rotation and transform\n tempCanvas.context.rotate(-Math.PI / 2);\n tempCanvas.context.translate(-dHeight, 0);\n tempCanvas.context.drawImage(baseTexture.source,\n sx, sy,\n sWidth, sHeight,\n -dy, dx,\n dHeight, dWidth);\n }\n else\n {\n tempCanvas.context.drawImage(baseTexture.source,\n sx, sy,\n sWidth, sHeight,\n dx, dy,\n dWidth, dHeight);\n }\n }\n\n this.cachedTint = this.tint;\n this._canvasPattern = tempCanvas.context.createPattern(tempCanvas.canvas, 'repeat');\n }\n\n // set context state..\n context.globalAlpha = this.worldAlpha;\n context.setTransform(transform.a * resolution,\n transform.b * resolution,\n transform.c * resolution,\n transform.d * resolution,\n transform.tx * resolution,\n transform.ty * resolution);\n\n renderer.setBlendMode(this.blendMode);\n\n // fill the pattern!\n context.fillStyle = this._canvasPattern;\n\n // TODO - this should be rolled into the setTransform above..\n context.scale(this.tileScale.x / baseTextureResolution, this.tileScale.y / baseTextureResolution);\n\n const anchorX = this.anchor.x * -this._width * baseTextureResolution;\n const anchorY = this.anchor.y * -this._height * baseTextureResolution;\n\n if (this.uvRespectAnchor)\n {\n context.translate(modX, modY);\n\n context.fillRect(-modX + anchorX, -modY + anchorY,\n this._width / this.tileScale.x * baseTextureResolution,\n this._height / this.tileScale.y * baseTextureResolution);\n }\n else\n {\n context.translate(modX + anchorX, modY + anchorY);\n\n context.fillRect(-modX, -modY,\n this._width / this.tileScale.x * baseTextureResolution,\n this._height / this.tileScale.y * baseTextureResolution);\n }\n }\n\n /**\n * Updates the bounds of the tiling sprite.\n *\n * @private\n */\n _calculateBounds()\n {\n const minX = this._width * -this._anchor._x;\n const minY = this._height * -this._anchor._y;\n const maxX = this._width * (1 - this._anchor._x);\n const maxY = this._height * (1 - this._anchor._y);\n\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n }\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param {PIXI.Rectangle} rect - The output rectangle.\n * @return {PIXI.Rectangle} The bounds.\n */\n getLocalBounds(rect)\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._width * -this._anchor._x;\n this._bounds.minY = this._height * -this._anchor._y;\n this._bounds.maxX = this._width * (1 - this._anchor._x);\n this._bounds.maxY = this._height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new core.Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Checks if a point is inside this tiling sprite.\n *\n * @param {PIXI.Point} point - the point to check\n * @return {boolean} Whether or not the sprite contains the point.\n */\n containsPoint(point)\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._width;\n const height = this._height;\n const x1 = -width * this.anchor._x;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n const y1 = -height * this.anchor._y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n destroy(options)\n {\n super.destroy(options);\n\n this.tileTransform = null;\n this.uvTransform = null;\n }\n\n /**\n * Helper function that creates a new tiling sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {number|string|PIXI.BaseTexture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {number} width - the width of the tiling sprite\n * @param {number} height - the height of the tiling sprite\n * @return {PIXI.Texture} The newly created texture\n */\n static from(source, width, height)\n {\n return new TilingSprite(core.Texture.from(source), width, height);\n }\n\n /**\n * Helper function that creates a tiling sprite that will use a texture from the TextureCache based on the frameId\n * The frame ids are created when a Texture packer file has been loaded\n *\n * @static\n * @param {string} frameId - The frame Id of the texture in the cache\n * @param {number} width - the width of the tiling sprite\n * @param {number} height - the height of the tiling sprite\n * @return {PIXI.extras.TilingSprite} A new TilingSprite using a texture from the texture cache matching the frameId\n */\n static fromFrame(frameId, width, height)\n {\n const texture = core.utils.TextureCache[frameId];\n\n if (!texture)\n {\n throw new Error(`The frameId \"${frameId}\" does not exist in the texture cache ${this}`);\n }\n\n return new TilingSprite(texture, width, height);\n }\n\n /**\n * Helper function that creates a sprite that will contain a texture based on an image url\n * If the image is not in the texture cache it will be loaded\n *\n * @static\n * @param {string} imageId - The image url of the texture\n * @param {number} width - the width of the tiling sprite\n * @param {number} height - the height of the tiling sprite\n * @param {boolean} [crossorigin] - if you want to specify the cross-origin parameter\n * @param {number} [scaleMode=PIXI.settings.SCALE_MODE] - if you want to specify the scale mode,\n * see {@link PIXI.SCALE_MODES} for possible values\n * @return {PIXI.extras.TilingSprite} A new TilingSprite using a texture from the texture cache matching the image id\n */\n static fromImage(imageId, width, height, crossorigin, scaleMode)\n {\n return new TilingSprite(core.Texture.fromImage(imageId, crossorigin, scaleMode), width, height);\n }\n\n /**\n * The width of the sprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width()\n {\n return this._width;\n }\n\n set width(value) // eslint-disable-line require-jsdoc\n {\n this._width = value;\n }\n\n /**\n * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height()\n {\n return this._height;\n }\n\n set height(value) // eslint-disable-line require-jsdoc\n {\n this._height = value;\n }\n}\n","import * as core from '../core';\nimport Texture from '../core/textures/Texture';\nimport BaseTexture from '../core/textures/BaseTexture';\nimport { uid } from '../core/utils';\n\nconst DisplayObject = core.DisplayObject;\nconst _tempMatrix = new core.Matrix();\n\nDisplayObject.prototype._cacheAsBitmap = false;\nDisplayObject.prototype._cacheData = false;\n\n// figured theres no point adding ALL the extra variables to prototype.\n// this model can hold the information needed. This can also be generated on demand as\n// most objects are not cached as bitmaps.\n/**\n * @class\n * @ignore\n */\nclass CacheData\n{\n /**\n *\n */\n constructor()\n {\n this.textureCacheId = null;\n\n this.originalRenderWebGL = null;\n this.originalRenderCanvas = null;\n this.originalCalculateBounds = null;\n this.originalGetLocalBounds = null;\n\n this.originalUpdateTransform = null;\n this.originalHitTest = null;\n this.originalDestroy = null;\n this.originalMask = null;\n this.originalFilterArea = null;\n this.sprite = null;\n }\n}\n\nObject.defineProperties(DisplayObject.prototype, {\n /**\n * Set this to true if you want this display object to be cached as a bitmap.\n * This basically takes a snap shot of the display object as it is at that moment. It can\n * provide a performance benefit for complex static displayObjects.\n * To remove simply set this property to 'false'\n *\n * IMPORTANT GOTCHA - make sure that all your textures are preloaded BEFORE setting this property to true\n * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n cacheAsBitmap: {\n get()\n {\n return this._cacheAsBitmap;\n },\n set(value)\n {\n if (this._cacheAsBitmap === value)\n {\n return;\n }\n\n this._cacheAsBitmap = value;\n\n let data;\n\n if (value)\n {\n if (!this._cacheData)\n {\n this._cacheData = new CacheData();\n }\n\n data = this._cacheData;\n\n data.originalRenderWebGL = this.renderWebGL;\n data.originalRenderCanvas = this.renderCanvas;\n\n data.originalUpdateTransform = this.updateTransform;\n data.originalCalculateBounds = this.calculateBounds;\n data.originalGetLocalBounds = this.getLocalBounds;\n\n data.originalDestroy = this.destroy;\n\n data.originalContainsPoint = this.containsPoint;\n\n data.originalMask = this._mask;\n data.originalFilterArea = this.filterArea;\n\n this.renderWebGL = this._renderCachedWebGL;\n this.renderCanvas = this._renderCachedCanvas;\n\n this.destroy = this._cacheAsBitmapDestroy;\n }\n else\n {\n data = this._cacheData;\n\n if (data.sprite)\n {\n this._destroyCachedDisplayObject();\n }\n\n this.renderWebGL = data.originalRenderWebGL;\n this.renderCanvas = data.originalRenderCanvas;\n this.calculateBounds = data.originalCalculateBounds;\n this.getLocalBounds = data.originalGetLocalBounds;\n\n this.destroy = data.originalDestroy;\n\n this.updateTransform = data.originalUpdateTransform;\n this.containsPoint = data.originalContainsPoint;\n\n this._mask = data.originalMask;\n this.filterArea = data.originalFilterArea;\n }\n },\n },\n});\n\n/**\n * Renders a cached version of the sprite with WebGL\n *\n * @private\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.WebGLRenderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._renderCachedWebGL = function _renderCachedWebGL(renderer)\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n this._initCachedDisplayObject(renderer);\n\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n this._cacheData.sprite._renderWebGL(renderer);\n};\n\n/**\n * Prepares the WebGL renderer to cache the sprite\n *\n * @private\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.WebGLRenderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer)\n{\n if (this._cacheData && this._cacheData.sprite)\n {\n return;\n }\n\n // make sure alpha is set to 1 otherwise it will get rendered as invisible!\n const cacheAlpha = this.alpha;\n\n this.alpha = 1;\n\n // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture)\n renderer.currentRenderer.flush();\n // this.filters= [];\n\n // next we find the dimensions of the untransformed object\n // this function also calls updatetransform on all its children as part of the measuring.\n // This means we don't need to update the transform again in this function\n // TODO pass an object to clone too? saves having to create a new one each time!\n const bounds = this.getLocalBounds().clone();\n\n // add some padding!\n if (this._filters && this._filters.length)\n {\n const padding = this._filters[0].padding;\n\n bounds.pad(padding);\n }\n\n bounds.ceil(core.settings.RESOLUTION);\n\n // for now we cache the current renderTarget that the webGL renderer is currently using.\n // this could be more elegent..\n const cachedRenderTarget = renderer._activeRenderTarget;\n // We also store the filter stack - I will definitely look to change how this works a little later down the line.\n const stack = renderer.filterManager.filterStack;\n\n // this renderTexture will be used to store the cached DisplayObject\n\n const renderTexture = core.RenderTexture.create(bounds.width, bounds.height);\n\n const textureCacheId = `cacheAsBitmap_${uid()}`;\n\n this._cacheData.textureCacheId = textureCacheId;\n\n BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n Texture.addToCache(renderTexture, textureCacheId);\n\n // need to set //\n const m = _tempMatrix;\n\n m.tx = -bounds.x;\n m.ty = -bounds.y;\n\n // reset\n this.transform.worldTransform.identity();\n\n // set all properties to there original so we can render to a texture\n this.renderWebGL = this._cacheData.originalRenderWebGL;\n\n renderer.render(this, renderTexture, true, m, true);\n // now restore the state be setting the new properties\n\n renderer.bindRenderTarget(cachedRenderTarget);\n\n renderer.filterManager.filterStack = stack;\n\n this.renderWebGL = this._renderCachedWebGL;\n // the rest is the same as for Canvas\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n\n this._mask = null;\n this.filterArea = null;\n\n // create our cached sprite\n const cachedSprite = new core.Sprite(renderTexture);\n\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n\n this._cacheData.sprite = cachedSprite;\n\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent)\n {\n this.parent = renderer._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this.updateTransform();\n }\n\n // map the hit test..\n this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n\n/**\n * Renders a cached version of the sprite with canvas\n *\n * @private\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.WebGLRenderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer)\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n this._initCachedDisplayObjectCanvas(renderer);\n\n this._cacheData.sprite.worldAlpha = this.worldAlpha;\n this._cacheData.sprite._renderCanvas(renderer);\n};\n\n// TODO this can be the same as the webGL verison.. will need to do a little tweaking first though..\n/**\n * Prepares the Canvas renderer to cache the sprite\n *\n * @private\n * @memberof PIXI.DisplayObject#\n * @param {PIXI.WebGLRenderer} renderer - the WebGL renderer\n */\nDisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(renderer)\n{\n if (this._cacheData && this._cacheData.sprite)\n {\n return;\n }\n\n // get bounds actually transforms the object for us already!\n const bounds = this.getLocalBounds();\n\n const cacheAlpha = this.alpha;\n\n this.alpha = 1;\n\n const cachedRenderTarget = renderer.context;\n\n bounds.ceil(core.settings.RESOLUTION);\n\n const renderTexture = core.RenderTexture.create(bounds.width, bounds.height);\n\n const textureCacheId = `cacheAsBitmap_${uid()}`;\n\n this._cacheData.textureCacheId = textureCacheId;\n\n BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId);\n Texture.addToCache(renderTexture, textureCacheId);\n\n // need to set //\n const m = _tempMatrix;\n\n this.transform.localTransform.copy(m);\n m.invert();\n\n m.tx -= bounds.x;\n m.ty -= bounds.y;\n\n // m.append(this.transform.worldTransform.)\n // set all properties to there original so we can render to a texture\n this.renderCanvas = this._cacheData.originalRenderCanvas;\n\n // renderTexture.render(this, m, true);\n renderer.render(this, renderTexture, true, m, false);\n\n // now restore the state be setting the new properties\n renderer.context = cachedRenderTarget;\n\n this.renderCanvas = this._renderCachedCanvas;\n // the rest is the same as for WebGL\n this.updateTransform = this.displayObjectUpdateTransform;\n this.calculateBounds = this._calculateCachedBounds;\n this.getLocalBounds = this._getCachedLocalBounds;\n\n this._mask = null;\n this.filterArea = null;\n\n // create our cached sprite\n const cachedSprite = new core.Sprite(renderTexture);\n\n cachedSprite.transform.worldTransform = this.transform.worldTransform;\n cachedSprite.anchor.x = -(bounds.x / bounds.width);\n cachedSprite.anchor.y = -(bounds.y / bounds.height);\n cachedSprite.alpha = cacheAlpha;\n cachedSprite._bounds = this._bounds;\n\n this._cacheData.sprite = cachedSprite;\n\n this.transform._parentID = -1;\n // restore the transform of the cached sprite to avoid the nasty flicker..\n if (!this.parent)\n {\n this.parent = renderer._tempDisplayObjectParent;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this.updateTransform();\n }\n\n // map the hit test..\n this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite);\n};\n\n/**\n * Calculates the bounds of the cached sprite\n *\n * @private\n */\nDisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds()\n{\n this._bounds.clear();\n this._cacheData.sprite.transform._worldID = this.transform._worldID;\n this._cacheData.sprite._calculateBounds();\n this._lastBoundsID = this._boundsID;\n};\n\n/**\n * Gets the bounds of the cached sprite.\n *\n * @private\n * @return {Rectangle} The local bounds.\n */\nDisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds()\n{\n return this._cacheData.sprite.getLocalBounds();\n};\n\n/**\n * Destroys the cached sprite.\n *\n * @private\n */\nDisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject()\n{\n this._cacheData.sprite._texture.destroy(true);\n this._cacheData.sprite = null;\n\n BaseTexture.removeFromCache(this._cacheData.textureCacheId);\n Texture.removeFromCache(this._cacheData.textureCacheId);\n\n this._cacheData.textureCacheId = null;\n};\n\n/**\n * Destroys the cached object.\n *\n * @private\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * Used when destroying containers, see the Container.destroy method.\n */\nDisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options)\n{\n this.cacheAsBitmap = false;\n this.destroy(options);\n};\n","import * as core from '../core';\n\n/**\n * The instance name of the object.\n *\n * @memberof PIXI.DisplayObject#\n * @member {string} name\n */\ncore.DisplayObject.prototype.name = null;\n\n/**\n * Returns the display object in the container\n *\n * @method getChildByName\n * @memberof PIXI.Container#\n * @param {string} name - instance name\n * @return {PIXI.DisplayObject} The child with the specified name.\n */\ncore.Container.prototype.getChildByName = function getChildByName(name)\n{\n for (let i = 0; i < this.children.length; i++)\n {\n if (this.children[i].name === name)\n {\n return this.children[i];\n }\n }\n\n return null;\n};\n","import * as core from '../core';\n\n/**\n * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.\n *\n * @method getGlobalPosition\n * @memberof PIXI.DisplayObject#\n * @param {Point} point - the point to write the global value to. If null a new point will be returned\n * @param {boolean} skipUpdate - setting to true will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost\n * @return {Point} The updated point\n */\ncore.DisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point = new core.Point(), skipUpdate = false)\n{\n if (this.parent)\n {\n this.parent.toGlobal(this.position, point, skipUpdate);\n }\n else\n {\n point.x = this.position.x;\n point.y = this.position.y;\n }\n\n return point;\n};\n","/**\n * Additional PIXI DisplayObjects for animation, tiling and bitmap text.\n * @namespace PIXI.extras\n */\nexport { default as AnimatedSprite } from './AnimatedSprite';\nexport { default as TilingSprite } from './TilingSprite';\nexport { default as TilingSpriteRenderer } from './webgl/TilingSpriteRenderer';\nexport { default as BitmapText } from './BitmapText';\n\n// imported for side effect of extending the prototype only, contains no exports\nimport './cacheAsBitmap';\nimport './getChildByName';\nimport './getGlobalPosition';\n","import * as core from '../../core';\nimport { WRAP_MODES } from '../../core/const';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\n\nconst tempMat = new core.Matrix();\n\n/**\n * WebGL renderer plugin for tiling sprites\n *\n * @class\n * @memberof PIXI.extras\n * @extends PIXI.ObjectRenderer\n */\nexport default class TilingSpriteRenderer extends core.ObjectRenderer\n{\n\n /**\n * constructor for renderer\n *\n * @param {WebGLRenderer} renderer The renderer this tiling awesomeness works for.\n */\n constructor(renderer)\n {\n super(renderer);\n\n this.shader = null;\n this.simpleShader = null;\n this.quad = null;\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n */\n onContextChange()\n {\n const gl = this.renderer.gl;\n\n this.shader = new core.Shader(gl,\n readFileSync(join(__dirname, './tilingSprite.vert'), 'utf8'),\n readFileSync(join(__dirname, './tilingSprite.frag'), 'utf8'));\n this.simpleShader = new core.Shader(gl,\n readFileSync(join(__dirname, './tilingSprite.vert'), 'utf8'),\n readFileSync(join(__dirname, './tilingSprite_simple.frag'), 'utf8'));\n\n this.renderer.bindVao(null);\n this.quad = new core.Quad(gl, this.renderer.state.attribState);\n this.quad.initVao(this.shader);\n }\n\n /**\n *\n * @param {PIXI.extras.TilingSprite} ts tilingSprite to be rendered\n */\n render(ts)\n {\n const renderer = this.renderer;\n const quad = this.quad;\n\n renderer.bindVao(quad.vao);\n\n let vertices = quad.vertices;\n\n vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x;\n vertices[1] = vertices[3] = ts._height * -ts.anchor.y;\n\n vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x);\n vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y);\n\n if (ts.uvRespectAnchor)\n {\n vertices = quad.uvs;\n\n vertices[0] = vertices[6] = -ts.anchor.x;\n vertices[1] = vertices[3] = -ts.anchor.y;\n\n vertices[2] = vertices[4] = 1.0 - ts.anchor.x;\n vertices[5] = vertices[7] = 1.0 - ts.anchor.y;\n }\n\n quad.upload();\n\n const tex = ts._texture;\n const baseTex = tex.baseTexture;\n const lt = ts.tileTransform.localTransform;\n const uv = ts.uvTransform;\n let isSimple = baseTex.isPowerOfTwo\n && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;\n\n // auto, force repeat wrapMode for big tiling textures\n if (isSimple)\n {\n if (!baseTex._glTextures[renderer.CONTEXT_UID])\n {\n if (baseTex.wrapMode === WRAP_MODES.CLAMP)\n {\n baseTex.wrapMode = WRAP_MODES.REPEAT;\n }\n }\n else\n {\n isSimple = baseTex.wrapMode !== WRAP_MODES.CLAMP;\n }\n }\n\n const shader = isSimple ? this.simpleShader : this.shader;\n\n renderer.bindShader(shader);\n\n const w = tex.width;\n const h = tex.height;\n const W = ts._width;\n const H = ts._height;\n\n tempMat.set(lt.a * w / W,\n lt.b * w / H,\n lt.c * h / W,\n lt.d * h / H,\n lt.tx / W,\n lt.ty / H);\n\n // that part is the same as above:\n // tempMat.identity();\n // tempMat.scale(tex.width, tex.height);\n // tempMat.prepend(lt);\n // tempMat.scale(1.0 / ts._width, 1.0 / ts._height);\n\n tempMat.invert();\n if (isSimple)\n {\n tempMat.prepend(uv.mapCoord);\n }\n else\n {\n shader.uniforms.uMapCoord = uv.mapCoord.toArray(true);\n shader.uniforms.uClampFrame = uv.uClampFrame;\n shader.uniforms.uClampOffset = uv.uClampOffset;\n }\n\n shader.uniforms.uTransform = tempMat.toArray(true);\n shader.uniforms.uColor = core.utils.premultiplyTintToRgba(ts.tint, ts.worldAlpha,\n shader.uniforms.uColor, baseTex.premultipliedAlpha);\n shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);\n\n shader.uniforms.uSampler = renderer.bindTexture(tex);\n\n renderer.setBlendMode(core.utils.correctBlendMode(ts.blendMode, baseTex.premultipliedAlpha));\n\n quad.vao.draw(this.renderer.gl.TRIANGLES, 6, 0);\n }\n}\n\ncore.WebGLRenderer.registerPlugin('tilingSprite', TilingSpriteRenderer);\n","import * as core from '../../core';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\n\n/**\n * Simplest filter - applies alpha\n *\n * Use this instead of Container's alpha property to avoid visual layering of individual elements.\n * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains.\n * If elements are not opaque, they will blend with each other anyway.\n *\n * Very handy if you want to use common features of all filters:\n *\n * 1. Assign a blendMode to this filter, blend all elements inside display object with background.\n *\n * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport default class AlphaFilter extends core.Filter\n{\n /**\n * @param {number} [alpha=1] Amount of alpha from 0 to 1, where 0 is transparent\n */\n constructor(alpha = 1.0)\n {\n super(\n // vertex shader\n readFileSync(join(__dirname, '../fragments/default.vert'), 'utf8'),\n // fragment shader\n readFileSync(join(__dirname, './alpha.frag'), 'utf8')\n );\n\n this.alpha = alpha;\n this.glShaderKey = 'alpha';\n }\n\n /**\n * Coefficient for alpha multiplication\n *\n * @member {number}\n * @default 1\n */\n get alpha()\n {\n return this.uniforms.uAlpha;\n }\n\n set alpha(value) // eslint-disable-line require-jsdoc\n {\n this.uniforms.uAlpha = value;\n }\n}\n","import * as core from '../../core';\nimport BlurXFilter from './BlurXFilter';\nimport BlurYFilter from './BlurYFilter';\n\n/**\n * The BlurFilter applies a Gaussian blur to an object.\n * The strength of the blur can be set for x- and y-axis separately.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport default class BlurFilter extends core.Filter\n{\n /**\n * @param {number} strength - The strength of the blur filter.\n * @param {number} quality - The quality of the blur filter.\n * @param {number} resolution - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(strength, quality, resolution, kernelSize)\n {\n super();\n\n this.blurXFilter = new BlurXFilter(strength, quality, resolution, kernelSize);\n this.blurYFilter = new BlurYFilter(strength, quality, resolution, kernelSize);\n\n this.padding = 0;\n this.resolution = resolution || core.settings.RESOLUTION;\n this.quality = quality || 4;\n this.blur = strength || 8;\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.FilterManager} filterManager - The manager.\n * @param {PIXI.RenderTarget} input - The input target.\n * @param {PIXI.RenderTarget} output - The output target.\n */\n apply(filterManager, input, output)\n {\n const renderTarget = filterManager.getRenderTarget(true);\n\n this.blurXFilter.apply(filterManager, input, renderTarget, true);\n this.blurYFilter.apply(filterManager, renderTarget, output, false);\n\n filterManager.returnRenderTarget(renderTarget);\n }\n\n /**\n * Sets the strength of both the blurX and blurY properties simultaneously\n *\n * @member {number}\n * @default 2\n */\n get blur()\n {\n return this.blurXFilter.blur;\n }\n\n set blur(value) // eslint-disable-line require-jsdoc\n {\n this.blurXFilter.blur = this.blurYFilter.blur = value;\n this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;\n }\n\n /**\n * Sets the number of passes for blur. More passes means higher quaility bluring.\n *\n * @member {number}\n * @default 1\n */\n get quality()\n {\n return this.blurXFilter.quality;\n }\n\n set quality(value) // eslint-disable-line require-jsdoc\n {\n this.blurXFilter.quality = this.blurYFilter.quality = value;\n }\n\n /**\n * Sets the strength of the blurX property\n *\n * @member {number}\n * @default 2\n */\n get blurX()\n {\n return this.blurXFilter.blur;\n }\n\n set blurX(value) // eslint-disable-line require-jsdoc\n {\n this.blurXFilter.blur = value;\n this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;\n }\n\n /**\n * Sets the strength of the blurY property\n *\n * @member {number}\n * @default 2\n */\n get blurY()\n {\n return this.blurYFilter.blur;\n }\n\n set blurY(value) // eslint-disable-line require-jsdoc\n {\n this.blurYFilter.blur = value;\n this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;\n }\n\n /**\n * Sets the blendmode of the filter\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode()\n {\n return this.blurYFilter._blendMode;\n }\n\n set blendMode(value) // eslint-disable-line require-jsdoc\n {\n this.blurYFilter._blendMode = value;\n }\n}\n","import * as core from '../../core';\nimport generateBlurVertSource from './generateBlurVertSource';\nimport generateBlurFragSource from './generateBlurFragSource';\nimport getMaxBlurKernelSize from './getMaxBlurKernelSize';\n\n/**\n * The BlurXFilter applies a horizontal Gaussian blur to an object.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport default class BlurXFilter extends core.Filter\n{\n /**\n * @param {number} strength - The strength of the blur filter.\n * @param {number} quality - The quality of the blur filter.\n * @param {number} resolution - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(strength, quality, resolution, kernelSize)\n {\n kernelSize = kernelSize || 5;\n const vertSrc = generateBlurVertSource(kernelSize, true);\n const fragSrc = generateBlurFragSource(kernelSize);\n\n super(\n // vertex shader\n vertSrc,\n // fragment shader\n fragSrc\n );\n\n this.resolution = resolution || core.settings.RESOLUTION;\n\n this._quality = 0;\n\n this.quality = quality || 4;\n this.strength = strength || 8;\n\n this.firstRun = true;\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.FilterManager} filterManager - The manager.\n * @param {PIXI.RenderTarget} input - The input target.\n * @param {PIXI.RenderTarget} output - The output target.\n * @param {boolean} clear - Should the output be cleared before rendering?\n */\n apply(filterManager, input, output, clear)\n {\n if (this.firstRun)\n {\n const gl = filterManager.renderer.gl;\n const kernelSize = getMaxBlurKernelSize(gl);\n\n this.vertexSrc = generateBlurVertSource(kernelSize, true);\n this.fragmentSrc = generateBlurFragSource(kernelSize);\n\n this.firstRun = false;\n }\n\n this.uniforms.strength = (1 / output.size.width) * (output.size.width / input.size.width);\n\n // screen space!\n this.uniforms.strength *= this.strength;\n this.uniforms.strength /= this.passes;// / this.passes//Math.pow(1, this.passes);\n\n if (this.passes === 1)\n {\n filterManager.applyFilter(this, input, output, clear);\n }\n else\n {\n const renderTarget = filterManager.getRenderTarget(true);\n let flip = input;\n let flop = renderTarget;\n\n for (let i = 0; i < this.passes - 1; i++)\n {\n filterManager.applyFilter(this, flip, flop, true);\n\n const temp = flop;\n\n flop = flip;\n flip = temp;\n }\n\n filterManager.applyFilter(this, flip, output, clear);\n\n filterManager.returnRenderTarget(renderTarget);\n }\n }\n\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @default 16\n */\n get blur()\n {\n return this.strength;\n }\n\n set blur(value) // eslint-disable-line require-jsdoc\n {\n this.padding = Math.abs(value) * 2;\n this.strength = value;\n }\n\n /**\n * Sets the quality of the blur by modifying the number of passes. More passes means higher\n * quaility bluring but the lower the performance.\n *\n * @member {number}\n * @default 4\n */\n get quality()\n {\n return this._quality;\n }\n\n set quality(value) // eslint-disable-line require-jsdoc\n {\n this._quality = value;\n this.passes = value;\n }\n}\n","import * as core from '../../core';\nimport generateBlurVertSource from './generateBlurVertSource';\nimport generateBlurFragSource from './generateBlurFragSource';\nimport getMaxBlurKernelSize from './getMaxBlurKernelSize';\n\n/**\n * The BlurYFilter applies a horizontal Gaussian blur to an object.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport default class BlurYFilter extends core.Filter\n{\n /**\n * @param {number} strength - The strength of the blur filter.\n * @param {number} quality - The quality of the blur filter.\n * @param {number} resolution - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(strength, quality, resolution, kernelSize)\n {\n kernelSize = kernelSize || 5;\n const vertSrc = generateBlurVertSource(kernelSize, false);\n const fragSrc = generateBlurFragSource(kernelSize);\n\n super(\n // vertex shader\n vertSrc,\n // fragment shader\n fragSrc\n );\n\n this.resolution = resolution || core.settings.RESOLUTION;\n\n this._quality = 0;\n\n this.quality = quality || 4;\n this.strength = strength || 8;\n\n this.firstRun = true;\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.FilterManager} filterManager - The manager.\n * @param {PIXI.RenderTarget} input - The input target.\n * @param {PIXI.RenderTarget} output - The output target.\n * @param {boolean} clear - Should the output be cleared before rendering?\n */\n apply(filterManager, input, output, clear)\n {\n if (this.firstRun)\n {\n const gl = filterManager.renderer.gl;\n const kernelSize = getMaxBlurKernelSize(gl);\n\n this.vertexSrc = generateBlurVertSource(kernelSize, false);\n this.fragmentSrc = generateBlurFragSource(kernelSize);\n\n this.firstRun = false;\n }\n\n this.uniforms.strength = (1 / output.size.height) * (output.size.height / input.size.height);\n\n this.uniforms.strength *= this.strength;\n this.uniforms.strength /= this.passes;\n\n if (this.passes === 1)\n {\n filterManager.applyFilter(this, input, output, clear);\n }\n else\n {\n const renderTarget = filterManager.getRenderTarget(true);\n let flip = input;\n let flop = renderTarget;\n\n for (let i = 0; i < this.passes - 1; i++)\n {\n filterManager.applyFilter(this, flip, flop, true);\n\n const temp = flop;\n\n flop = flip;\n flip = temp;\n }\n\n filterManager.applyFilter(this, flip, output, clear);\n\n filterManager.returnRenderTarget(renderTarget);\n }\n }\n\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @default 2\n */\n get blur()\n {\n return this.strength;\n }\n\n set blur(value) // eslint-disable-line require-jsdoc\n {\n this.padding = Math.abs(value) * 2;\n this.strength = value;\n }\n\n /**\n * Sets the quality of the blur by modifying the number of passes. More passes means higher\n * quaility bluring but the lower the performance.\n *\n * @member {number}\n * @default 4\n */\n get quality()\n {\n return this._quality;\n }\n\n set quality(value) // eslint-disable-line require-jsdoc\n {\n this._quality = value;\n this.passes = value;\n }\n}\n","const GAUSSIAN_VALUES = {\n 5: [0.153388, 0.221461, 0.250301],\n 7: [0.071303, 0.131514, 0.189879, 0.214607],\n 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236],\n 11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596],\n 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641],\n 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448],\n};\n\nconst fragTemplate = [\n 'varying vec2 vBlurTexCoords[%size%];',\n 'uniform sampler2D uSampler;',\n\n 'void main(void)',\n '{',\n ' gl_FragColor = vec4(0.0);',\n ' %blur%',\n '}',\n\n].join('\\n');\n\nexport default function generateFragBlurSource(kernelSize)\n{\n const kernel = GAUSSIAN_VALUES[kernelSize];\n const halfLength = kernel.length;\n\n let fragSource = fragTemplate;\n\n let blurLoop = '';\n const template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;';\n let value;\n\n for (let i = 0; i < kernelSize; i++)\n {\n let blur = template.replace('%index%', i);\n\n value = i;\n\n if (i >= halfLength)\n {\n value = kernelSize - i - 1;\n }\n\n blur = blur.replace('%value%', kernel[value]);\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n fragSource = fragSource.replace('%blur%', blurLoop);\n fragSource = fragSource.replace('%size%', kernelSize);\n\n return fragSource;\n}\n","const vertTemplate = [\n 'attribute vec2 aVertexPosition;',\n 'attribute vec2 aTextureCoord;',\n\n 'uniform float strength;',\n 'uniform mat3 projectionMatrix;',\n\n 'varying vec2 vBlurTexCoords[%size%];',\n\n 'void main(void)',\n '{',\n 'gl_Position = vec4((projectionMatrix * vec3((aVertexPosition), 1.0)).xy, 0.0, 1.0);',\n '%blur%',\n '}',\n].join('\\n');\n\nexport default function generateVertBlurSource(kernelSize, x)\n{\n const halfLength = Math.ceil(kernelSize / 2);\n\n let vertSource = vertTemplate;\n\n let blurLoop = '';\n let template;\n // let value;\n\n if (x)\n {\n template = 'vBlurTexCoords[%index%] = aTextureCoord + vec2(%sampleIndex% * strength, 0.0);';\n }\n else\n {\n template = 'vBlurTexCoords[%index%] = aTextureCoord + vec2(0.0, %sampleIndex% * strength);';\n }\n\n for (let i = 0; i < kernelSize; i++)\n {\n let blur = template.replace('%index%', i);\n\n // value = i;\n\n // if(i >= halfLength)\n // {\n // value = kernelSize - i - 1;\n // }\n\n blur = blur.replace('%sampleIndex%', `${i - (halfLength - 1)}.0`);\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n vertSource = vertSource.replace('%blur%', blurLoop);\n vertSource = vertSource.replace('%size%', kernelSize);\n\n return vertSource;\n}\n","export default function getMaxKernelSize(gl)\n{\n const maxVaryings = (gl.getParameter(gl.MAX_VARYING_VECTORS));\n let kernelSize = 15;\n\n while (kernelSize > maxVaryings)\n {\n kernelSize -= 2;\n }\n\n return kernelSize;\n}\n","import * as core from '../../core';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\n\n/**\n * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA\n * color and alpha values of every pixel on your displayObject to produce a result\n * with a new set of RGBA color and alpha values. It's pretty powerful!\n *\n * ```js\n * let colorMatrix = new PIXI.filters.ColorMatrixFilter();\n * container.filters = [colorMatrix];\n * colorMatrix.contrast(2);\n * ```\n * @author Clément Chenebault <clement@goodboydigital.com>\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport default class ColorMatrixFilter extends core.Filter\n{\n /**\n *\n */\n constructor()\n {\n super(\n // vertex shader\n readFileSync(join(__dirname, '../fragments/default.vert'), 'utf8'),\n // fragment shader\n readFileSync(join(__dirname, './colorMatrix.frag'), 'utf8')\n );\n\n this.uniforms.m = [\n 1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0];\n\n this.alpha = 1;\n }\n\n /**\n * Transforms current matrix and set the new one\n *\n * @param {number[]} matrix - 5x4 matrix\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n _loadMatrix(matrix, multiply = false)\n {\n let newMatrix = matrix;\n\n if (multiply)\n {\n this._multiply(newMatrix, this.uniforms.m, matrix);\n newMatrix = this._colorMatrix(newMatrix);\n }\n\n // set the new matrix\n this.uniforms.m = newMatrix;\n }\n\n /**\n * Multiplies two mat5's\n *\n * @private\n * @param {number[]} out - 5x4 matrix the receiving matrix\n * @param {number[]} a - 5x4 matrix the first operand\n * @param {number[]} b - 5x4 matrix the second operand\n * @returns {number[]} 5x4 matrix\n */\n _multiply(out, a, b)\n {\n // Red Channel\n out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]);\n out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]);\n out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]);\n out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]);\n out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]) + a[4];\n\n // Green Channel\n out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]);\n out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]);\n out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]);\n out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]);\n out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]) + a[9];\n\n // Blue Channel\n out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]);\n out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]);\n out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]);\n out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]);\n out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]) + a[14];\n\n // Alpha Channel\n out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]);\n out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]);\n out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]);\n out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]);\n out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]) + a[19];\n\n return out;\n }\n\n /**\n * Create a Float32 Array and normalize the offset component to 0-1\n *\n * @private\n * @param {number[]} matrix - 5x4 matrix\n * @return {number[]} 5x4 matrix with all values between 0-1\n */\n _colorMatrix(matrix)\n {\n // Create a Float32 Array and normalize the offset component to 0-1\n const m = new Float32Array(matrix);\n\n m[4] /= 255;\n m[9] /= 255;\n m[14] /= 255;\n m[19] /= 255;\n\n return m;\n }\n\n /**\n * Adjusts brightness\n *\n * @param {number} b - value of the brigthness (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n brightness(b, multiply)\n {\n const matrix = [\n b, 0, 0, 0, 0,\n 0, b, 0, 0, 0,\n 0, 0, b, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the matrices in grey scales\n *\n * @param {number} scale - value of the grey (0-1, where 0 is black)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n greyscale(scale, multiply)\n {\n const matrix = [\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the black and white matrice.\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n blackAndWhite(multiply)\n {\n const matrix = [\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the hue property of the color\n *\n * @param {number} rotation - in degrees\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n hue(rotation, multiply)\n {\n rotation = (rotation || 0) / 180 * Math.PI;\n\n const cosR = Math.cos(rotation);\n const sinR = Math.sin(rotation);\n const sqrt = Math.sqrt;\n\n /* a good approximation for hue rotation\n This matrix is far better than the versions with magic luminance constants\n formerly used here, but also used in the starling framework (flash) and known from this\n old part of the internet: quasimondo.com/archives/000565.php\n\n This new matrix is based on rgb cube rotation in space. Look here for a more descriptive\n implementation as a shader not a general matrix:\n https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js\n\n This is the source for the code:\n see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751\n */\n\n const w = 1 / 3;\n const sqrW = sqrt(w); // weight is\n\n const a00 = cosR + ((1.0 - cosR) * w);\n const a01 = (w * (1.0 - cosR)) - (sqrW * sinR);\n const a02 = (w * (1.0 - cosR)) + (sqrW * sinR);\n\n const a10 = (w * (1.0 - cosR)) + (sqrW * sinR);\n const a11 = cosR + (w * (1.0 - cosR));\n const a12 = (w * (1.0 - cosR)) - (sqrW * sinR);\n\n const a20 = (w * (1.0 - cosR)) - (sqrW * sinR);\n const a21 = (w * (1.0 - cosR)) + (sqrW * sinR);\n const a22 = cosR + (w * (1.0 - cosR));\n\n const matrix = [\n a00, a01, a02, 0, 0,\n a10, a11, a12, 0, 0,\n a20, a21, a22, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the contrast matrix, increase the separation between dark and bright\n * Increase contrast : shadows darker and highlights brighter\n * Decrease contrast : bring the shadows up and the highlights down\n *\n * @param {number} amount - value of the contrast (0-1)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n contrast(amount, multiply)\n {\n const v = (amount || 0) + 1;\n const o = -0.5 * (v - 1);\n\n const matrix = [\n v, 0, 0, 0, o,\n 0, v, 0, 0, o,\n 0, 0, v, 0, o,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the saturation matrix, increase the separation between colors\n * Increase saturation : increase contrast, brightness, and sharpness\n *\n * @param {number} amount - The saturation amount (0-1)\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n saturate(amount = 0, multiply)\n {\n const x = (amount * 2 / 3) + 1;\n const y = ((x - 1) * -0.5);\n\n const matrix = [\n x, y, y, 0, 0,\n y, x, y, 0, 0,\n y, y, x, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Desaturate image (remove color)\n *\n * Call the saturate function\n *\n */\n desaturate() // eslint-disable-line no-unused-vars\n {\n this.saturate(-1);\n }\n\n /**\n * Negative image (inverse of classic rgb matrix)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n negative(multiply)\n {\n const matrix = [\n -1, 0, 0, 1, 0,\n 0, -1, 0, 1, 0,\n 0, 0, -1, 1, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Sepia image\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n sepia(multiply)\n {\n const matrix = [\n 0.393, 0.7689999, 0.18899999, 0, 0,\n 0.349, 0.6859999, 0.16799999, 0, 0,\n 0.272, 0.5339999, 0.13099999, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Color motion picture process invented in 1916 (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n technicolor(multiply)\n {\n const matrix = [\n 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337,\n -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398,\n -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Polaroid filter\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n polaroid(multiply)\n {\n const matrix = [\n 1.438, -0.062, -0.062, 0, 0,\n -0.122, 1.378, -0.122, 0, 0,\n -0.016, -0.016, 1.483, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Filter who transforms : Red -> Blue and Blue -> Red\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n toBGR(multiply)\n {\n const matrix = [\n 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 0,\n 1, 0, 0, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n kodachrome(multiply)\n {\n const matrix = [\n 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502,\n -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203,\n -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Brown delicious browni filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n browni(multiply)\n {\n const matrix = [\n 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873,\n -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127,\n 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Vintage filter (thanks Dominic Szablewski)\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n vintage(multiply)\n {\n const matrix = [\n 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123,\n 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591,\n 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * We don't know exactly what it does, kind of gradient map, but funny to play with!\n *\n * @param {number} desaturation - Tone values.\n * @param {number} toned - Tone values.\n * @param {string} lightColor - Tone values, example: `0xFFE580`\n * @param {string} darkColor - Tone values, example: `0xFFE580`\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n colorTone(desaturation, toned, lightColor, darkColor, multiply)\n {\n desaturation = desaturation || 0.2;\n toned = toned || 0.15;\n lightColor = lightColor || 0xFFE580;\n darkColor = darkColor || 0x338000;\n\n const lR = ((lightColor >> 16) & 0xFF) / 255;\n const lG = ((lightColor >> 8) & 0xFF) / 255;\n const lB = (lightColor & 0xFF) / 255;\n\n const dR = ((darkColor >> 16) & 0xFF) / 255;\n const dG = ((darkColor >> 8) & 0xFF) / 255;\n const dB = (darkColor & 0xFF) / 255;\n\n const matrix = [\n 0.3, 0.59, 0.11, 0, 0,\n lR, lG, lB, desaturation, 0,\n dR, dG, dB, toned, 0,\n lR - dR, lG - dG, lB - dB, 0, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Night effect\n *\n * @param {number} intensity - The intensity of the night effect.\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n night(intensity, multiply)\n {\n intensity = intensity || 0.1;\n const matrix = [\n intensity * (-2.0), -intensity, 0, 0, 0,\n -intensity, 0, intensity, 0, 0,\n 0, intensity, intensity * 2.0, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Predator effect\n *\n * Erase the current matrix by setting a new indepent one\n *\n * @param {number} amount - how much the predator feels his future victim\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n predator(amount, multiply)\n {\n const matrix = [\n // row 1\n 11.224130630493164 * amount,\n -4.794486999511719 * amount,\n -2.8746118545532227 * amount,\n 0 * amount,\n 0.40342438220977783 * amount,\n // row 2\n -3.6330697536468506 * amount,\n 9.193157196044922 * amount,\n -2.951810836791992 * amount,\n 0 * amount,\n -1.316135048866272 * amount,\n // row 3\n -3.2184197902679443 * amount,\n -4.2375030517578125 * amount,\n 7.476448059082031 * amount,\n 0 * amount,\n 0.8044459223747253 * amount,\n // row 4\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * LSD effect\n *\n * Multiply the current matrix\n *\n * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n lsd(multiply)\n {\n const matrix = [\n 2, -0.4, 0.5, 0, 0,\n -0.5, 2, -0.4, 0, 0,\n -0.4, -0.5, 3, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Erase the current matrix by setting the default one\n *\n */\n reset()\n {\n const matrix = [\n 1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, false);\n }\n\n /**\n * The matrix of the color matrix filter\n *\n * @member {number[]}\n * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]\n */\n get matrix()\n {\n return this.uniforms.m;\n }\n\n set matrix(value) // eslint-disable-line require-jsdoc\n {\n this.uniforms.m = value;\n }\n\n /**\n * The opacity value to use when mixing the original and resultant colors.\n *\n * When the value is 0, the original color is used without modification.\n * When the value is 1, the result color is used.\n * When in the range (0, 1) the color is interpolated between the original and result by this amount.\n *\n * @member {number}\n * @default 1\n */\n get alpha()\n {\n return this.uniforms.uAlpha;\n }\n\n set alpha(value) // eslint-disable-line require-jsdoc\n {\n this.uniforms.uAlpha = value;\n }\n}\n\n// Americanized alias\nColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale;\n","import * as core from '../../core';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\n\n/**\n * The DisplacementFilter class uses the pixel values from the specified texture\n * (called the displacement map) to perform a displacement of an object. You can\n * use this filter to apply all manor of crazy warping effects. Currently the r\n * property of the texture is used to offset the x and the g property of the texture\n * is used to offset the y.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport default class DisplacementFilter extends core.Filter\n{\n /**\n * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!)\n * @param {number} scale - The scale of the displacement\n */\n constructor(sprite, scale)\n {\n const maskMatrix = new core.Matrix();\n\n sprite.renderable = false;\n\n super(\n // vertex shader\n readFileSync(join(__dirname, '../fragments/default-filter-matrix.vert'), 'utf8'),\n // fragment shader\n readFileSync(join(__dirname, './displacement.frag'), 'utf8')\n );\n\n this.maskSprite = sprite;\n this.maskMatrix = maskMatrix;\n\n this.uniforms.mapSampler = sprite._texture;\n this.uniforms.filterMatrix = maskMatrix;\n this.uniforms.scale = { x: 1, y: 1 };\n\n if (scale === null || scale === undefined)\n {\n scale = 20;\n }\n\n this.scale = new core.Point(scale, scale);\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.FilterManager} filterManager - The manager.\n * @param {PIXI.RenderTarget} input - The input target.\n * @param {PIXI.RenderTarget} output - The output target.\n */\n apply(filterManager, input, output)\n {\n this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite);\n this.uniforms.scale.x = this.scale.x;\n this.uniforms.scale.y = this.scale.y;\n\n // draw the filter...\n filterManager.applyFilter(this, input, output);\n }\n\n /**\n * The texture used for the displacement map. Must be power of 2 sized texture.\n *\n * @member {PIXI.Texture}\n */\n get map()\n {\n return this.uniforms.mapSampler;\n }\n\n set map(value) // eslint-disable-line require-jsdoc\n {\n this.uniforms.mapSampler = value;\n }\n}\n","import * as core from '../../core';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\n\n/**\n *\n * Basic FXAA implementation based on the code on geeks3d.com with the\n * modification that the texture2DLod stuff was removed since it's\n * unsupported by WebGL.\n *\n * @see https://github.com/mitsuhiko/webgl-meincraft\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n *\n */\nexport default class FXAAFilter extends core.Filter\n{\n /**\n *\n */\n constructor()\n {\n // TODO - needs work\n super(\n // vertex shader\n readFileSync(join(__dirname, './fxaa.vert'), 'utf8'),\n // fragment shader\n readFileSync(join(__dirname, './fxaa.frag'), 'utf8')\n );\n }\n}\n","/**\n * This namespace contains WebGL-only display filters that can be applied\n * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property.\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n *\n * // Draw a green rectangle\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add a blur filter\n * rect.filters = [new PIXI.filters.BlurFilter()];\n *\n * // Display rectangle\n * app.stage.addChild(rect);\n * document.body.appendChild(app.view);\n * @namespace PIXI.filters\n */\nexport { default as FXAAFilter } from './fxaa/FXAAFilter';\nexport { default as NoiseFilter } from './noise/NoiseFilter';\nexport { default as DisplacementFilter } from './displacement/DisplacementFilter';\nexport { default as BlurFilter } from './blur/BlurFilter';\nexport { default as BlurXFilter } from './blur/BlurXFilter';\nexport { default as BlurYFilter } from './blur/BlurYFilter';\nexport { default as ColorMatrixFilter } from './colormatrix/ColorMatrixFilter';\nexport { default as AlphaFilter } from './alpha/AlphaFilter';\n","import * as core from '../../core';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\n\n/**\n * @author Vico @vicocotea\n * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js\n */\n\n/**\n * A Noise effect filter.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport default class NoiseFilter extends core.Filter\n{\n /**\n * @param {number} noise - The noise intensity, should be a normalized value in the range [0, 1].\n * @param {number} seed - A random seed for the noise generation. Default is `Math.random()`.\n */\n constructor(noise = 0.5, seed = Math.random())\n {\n super(\n // vertex shader\n readFileSync(join(__dirname, '../fragments/default.vert'), 'utf8'),\n // fragment shader\n readFileSync(join(__dirname, './noise.frag'), 'utf8')\n );\n\n this.noise = noise;\n this.seed = seed;\n }\n\n /**\n * The amount of noise to apply, this value should be in the range (0, 1].\n *\n * @member {number}\n * @default 0.5\n */\n get noise()\n {\n return this.uniforms.uNoise;\n }\n\n set noise(value) // eslint-disable-line require-jsdoc\n {\n this.uniforms.uNoise = value;\n }\n\n /**\n * A seed value to apply to the random noise generation. `Math.random()` is a good value to use.\n *\n * @member {number}\n */\n get seed()\n {\n return this.uniforms.uSeed;\n }\n\n set seed(value) // eslint-disable-line require-jsdoc\n {\n this.uniforms.uSeed = value;\n }\n}\n","import * as core from '../core';\n\n/**\n * Holds all information related to an Interaction event\n *\n * @class\n * @memberof PIXI.interaction\n */\nexport default class InteractionData\n{\n /**\n *\n */\n constructor()\n {\n /**\n * This point stores the global coords of where the touch/mouse event happened\n *\n * @member {PIXI.Point}\n */\n this.global = new core.Point();\n\n /**\n * The target DisplayObject that was interacted with\n *\n * @member {PIXI.DisplayObject}\n */\n this.target = null;\n\n /**\n * When passed to an event handler, this will be the original DOM Event that was captured\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent\n * @member {MouseEvent|TouchEvent|PointerEvent}\n */\n this.originalEvent = null;\n\n /**\n * Unique identifier for this interaction\n *\n * @member {number}\n */\n this.identifier = null;\n\n /**\n * Indicates whether or not the pointer device that created the event is the primary pointer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary\n * @type {Boolean}\n */\n this.isPrimary = false;\n\n /**\n * Indicates which button was pressed on the mouse or pointer device to trigger the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n * @type {number}\n */\n this.button = 0;\n\n /**\n * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n * @type {number}\n */\n this.buttons = 0;\n\n /**\n * The width of the pointer's contact along the x-axis, measured in CSS pixels.\n * radiusX of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width\n * @type {number}\n */\n this.width = 0;\n\n /**\n * The height of the pointer's contact along the y-axis, measured in CSS pixels.\n * radiusY of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height\n * @type {number}\n */\n this.height = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX\n * @type {number}\n */\n this.tiltX = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY\n * @type {number}\n */\n this.tiltY = 0;\n\n /**\n * The type of pointer that triggered the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType\n * @type {string}\n */\n this.pointerType = null;\n\n /**\n * Pressure applied by the pointing device during the event. A Touch's force property\n * will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure\n * @type {number}\n */\n this.pressure = 0;\n\n /**\n * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle\n * @type {number}\n */\n this.rotationAngle = 0;\n\n /**\n * Twist of a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.twist = 0;\n\n /**\n * Barrel pressure on a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.tangentialPressure = 0;\n }\n\n /**\n * The unique identifier of the pointer. It will be the same as `identifier`.\n * @readonly\n * @member {number}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId\n */\n get pointerId()\n {\n return this.identifier;\n }\n\n /**\n * This will return the local coordinates of the specified displayObject for this InteractionData\n *\n * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local\n * coords off\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise\n * will create a new point)\n * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional\n * (otherwise will use the current global coords)\n * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative\n * to the DisplayObject\n */\n getLocalPosition(displayObject, point, globalPos)\n {\n return displayObject.worldTransform.applyInverse(globalPos || this.global, point);\n }\n\n /**\n * Copies properties from normalized event data.\n *\n * @param {Touch|MouseEvent|PointerEvent} event The normalized event data\n */\n copyEvent(event)\n {\n // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite\n // it with \"false\" on later events when our shim for it on touch events might not be\n // accurate\n if (event.isPrimary)\n {\n this.isPrimary = true;\n }\n this.button = event.button;\n // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard\n // event.which property instead, which conveys the same information.\n this.buttons = Number.isInteger(event.buttons) ? event.buttons : event.which;\n this.width = event.width;\n this.height = event.height;\n this.tiltX = event.tiltX;\n this.tiltY = event.tiltY;\n this.pointerType = event.pointerType;\n this.pressure = event.pressure;\n this.rotationAngle = event.rotationAngle;\n this.twist = event.twist || 0;\n this.tangentialPressure = event.tangentialPressure || 0;\n }\n\n /**\n * Resets the data for pooling.\n */\n reset()\n {\n // isPrimary is the only property that we really need to reset - everything else is\n // guaranteed to be overwritten\n this.isPrimary = false;\n }\n}\n","/**\n * Event class that mimics native DOM events.\n *\n * @class\n * @memberof PIXI.interaction\n */\nexport default class InteractionEvent\n{\n /**\n *\n */\n constructor()\n {\n /**\n * Whether this event will continue propagating in the tree\n *\n * @member {boolean}\n */\n this.stopped = false;\n\n /**\n * The object which caused this event to be dispatched.\n * For listener callback see {@link PIXI.interaction.InteractionEvent.currentTarget}.\n *\n * @member {PIXI.DisplayObject}\n */\n this.target = null;\n\n /**\n * The object whose event listeners callback is currently being invoked.\n *\n * @member {PIXI.DisplayObject}\n */\n this.currentTarget = null;\n\n /**\n * Type of the event\n *\n * @member {string}\n */\n this.type = null;\n\n /**\n * InteractionData related to this event\n *\n * @member {PIXI.interaction.InteractionData}\n */\n this.data = null;\n }\n\n /**\n * Prevents event from reaching any objects other than the current object.\n *\n */\n stopPropagation()\n {\n this.stopped = true;\n }\n\n /**\n * Resets the event.\n */\n reset()\n {\n this.stopped = false;\n this.currentTarget = null;\n this.target = null;\n }\n}\n","import * as core from '../core';\nimport InteractionData from './InteractionData';\nimport InteractionEvent from './InteractionEvent';\nimport InteractionTrackingData from './InteractionTrackingData';\nimport EventEmitter from 'eventemitter3';\nimport interactiveTarget from './interactiveTarget';\n\n// Mix interactiveTarget into core.DisplayObject.prototype, after deprecation has been handled\ncore.utils.mixins.delayMixin(\n core.DisplayObject.prototype,\n interactiveTarget\n);\n\nconst MOUSE_POINTER_ID = 1;\n\n// helpers for hitTest() - only used inside hitTest()\nconst hitTestEvent = {\n target: null,\n data: {\n global: null,\n },\n};\n\n/**\n * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive\n * if its interactive parameter is set to true\n * This manager also supports multitouch.\n *\n * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction\n *\n * @class\n * @extends EventEmitter\n * @memberof PIXI.interaction\n */\nexport default class InteractionManager extends EventEmitter\n{\n /**\n * @param {PIXI.CanvasRenderer|PIXI.WebGLRenderer} renderer - A reference to the current renderer\n * @param {object} [options] - The options for the manager.\n * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions.\n * @param {number} [options.interactionFrequency=10] - Frequency increases the interaction events will be checked.\n */\n constructor(renderer, options)\n {\n super();\n\n options = options || {};\n\n /**\n * The renderer this interaction manager works for.\n *\n * @member {PIXI.SystemRenderer}\n */\n this.renderer = renderer;\n\n /**\n * Should default browser actions automatically be prevented.\n * Does not apply to pointer events for backwards compatibility\n * preventDefault on pointer events stops mouse events from firing\n * Thus, for every pointer event, there will always be either a mouse of touch event alongside it.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true;\n\n /**\n * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked.\n *\n * @member {number}\n * @default 10\n */\n this.interactionFrequency = options.interactionFrequency || 10;\n\n /**\n * The mouse data\n *\n * @member {PIXI.interaction.InteractionData}\n */\n this.mouse = new InteractionData();\n this.mouse.identifier = MOUSE_POINTER_ID;\n\n // setting the mouse to start off far off screen will mean that mouse over does\n // not get called before we even move the mouse.\n this.mouse.global.set(-999999);\n\n /**\n * Actively tracked InteractionData\n *\n * @private\n * @member {Object.<number,PIXI.interation.InteractionData>}\n */\n this.activeInteractionData = {};\n this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse;\n\n /**\n * Pool of unused InteractionData\n *\n * @private\n * @member {PIXI.interation.InteractionData[]}\n */\n this.interactionDataPool = [];\n\n /**\n * An event data object to handle all the event tracking/dispatching\n *\n * @member {object}\n */\n this.eventData = new InteractionEvent();\n\n /**\n * The DOM element to bind to.\n *\n * @private\n * @member {HTMLElement}\n */\n this.interactionDOMElement = null;\n\n /**\n * This property determines if mousemove and touchmove events are fired only when the cursor\n * is over the object.\n * Setting to true will make things work more in line with how the DOM verison works.\n * Setting to false can make things easier for things like dragging\n * It is currently set to false as this is how PixiJS used to work. This will be set to true in\n * future versions of pixi.\n *\n * @member {boolean}\n * @default false\n */\n this.moveWhenInside = false;\n\n /**\n * Have events been attached to the dom element?\n *\n * @private\n * @member {boolean}\n */\n this.eventsAdded = false;\n\n /**\n * Is the mouse hovering over the renderer?\n *\n * @private\n * @member {boolean}\n */\n this.mouseOverRenderer = false;\n\n /**\n * Does the device support touch events\n * https://www.w3.org/TR/touch-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsTouchEvents = 'ontouchstart' in window;\n\n /**\n * Does the device support pointer events\n * https://www.w3.org/Submission/pointer-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsPointerEvents = !!window.PointerEvent;\n\n // this will make it so that you don't have to call bind all the time\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerUp = this.onPointerUp.bind(this);\n this.processPointerUp = this.processPointerUp.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerCancel = this.onPointerCancel.bind(this);\n this.processPointerCancel = this.processPointerCancel.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerDown = this.onPointerDown.bind(this);\n this.processPointerDown = this.processPointerDown.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerMove = this.onPointerMove.bind(this);\n this.processPointerMove = this.processPointerMove.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOut = this.onPointerOut.bind(this);\n this.processPointerOverOut = this.processPointerOverOut.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOver = this.onPointerOver.bind(this);\n\n /**\n * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor\n * values, objects are handled as dictionaries of CSS values for interactionDOMElement,\n * and functions are called instead of changing the CSS.\n * Default CSS cursor values are provided for 'default' and 'pointer' modes.\n * @member {Object.<string, (string|Function|Object.<string, string>)>}\n */\n this.cursorStyles = {\n default: 'inherit',\n pointer: 'pointer',\n };\n\n /**\n * The mode of the cursor that is being used.\n * The value of this is a key from the cursorStyles dictionary.\n *\n * @member {string}\n */\n this.currentCursorMode = null;\n\n /**\n * Internal cached let.\n *\n * @private\n * @member {string}\n */\n this.cursor = null;\n\n /**\n * Internal cached let.\n *\n * @private\n * @member {PIXI.Point}\n */\n this._tempPoint = new core.Point();\n\n /**\n * The current resolution / device pixel ratio.\n *\n * @member {number}\n * @default 1\n */\n this.resolution = 1;\n\n this.setTargetElement(this.renderer.view, this.renderer.resolution);\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display\n * object.\n *\n * @event PIXI.interaction.InteractionManager#mousedown\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object.\n *\n * @event PIXI.interaction.InteractionManager#rightdown\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object.\n *\n * @event PIXI.interaction.InteractionManager#mouseup\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object.\n *\n * @event PIXI.interaction.InteractionManager#rightup\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object.\n *\n * @event PIXI.interaction.InteractionManager#click\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object.\n *\n * @event PIXI.interaction.InteractionManager#rightclick\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown}.\n *\n * @event PIXI.interaction.InteractionManager#mouseupoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.interaction.InteractionManager#event:rightdown}.\n *\n * @event PIXI.interaction.InteractionManager#rightupoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object\n *\n * @event PIXI.interaction.InteractionManager#mousemove\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object\n *\n * @event PIXI.interaction.InteractionManager#mouseover\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object\n *\n * @event PIXI.interaction.InteractionManager#mouseout\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n *\n * @event PIXI.interaction.InteractionManager#pointerdown\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * Not always fired when some buttons are held down while others are released. In those cases,\n * use [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown} and\n * [mouseup]{@link PIXI.interaction.InteractionManager#event:mouseup} instead.\n *\n * @event PIXI.interaction.InteractionManager#pointerup\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event\n *\n * @event PIXI.interaction.InteractionManager#pointercancel\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n *\n * @event PIXI.interaction.InteractionManager#pointertap\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.interaction.InteractionManager#event:pointerdown}.\n *\n * @event PIXI.interaction.InteractionManager#pointerupoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object\n *\n * @event PIXI.interaction.InteractionManager#pointermove\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object\n *\n * @event PIXI.interaction.InteractionManager#pointerover\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object\n *\n * @event PIXI.interaction.InteractionManager#pointerout\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n *\n * @event PIXI.interaction.InteractionManager#touchstart\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n *\n * @event PIXI.interaction.InteractionManager#touchend\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch\n *\n * @event PIXI.interaction.InteractionManager#touchcancel\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n *\n * @event PIXI.interaction.InteractionManager#tap\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.interaction.InteractionManager#event:touchstart}.\n *\n * @event PIXI.interaction.InteractionManager#touchendoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n *\n * @event PIXI.interaction.InteractionManager#touchmove\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display.\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousedown\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightdown\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseup\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightup\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#click\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightclick\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.DisplayObject#event:mousedown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseupoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.DisplayObject#event:rightdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#rightupoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mousemove\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseover\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#mouseout\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerdown\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerup\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointercancel\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointertap\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerupoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointermove\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerover\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#pointerout\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchstart\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchend\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchcancel\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#tap\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchendoutside\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * @event PIXI.DisplayObject#touchmove\n * @param {PIXI.interaction.InteractionEvent} event - Interaction event\n */\n }\n\n /**\n * Hit tests a point against the display tree, returning the first interactive object that is hit.\n *\n * @param {PIXI.Point} globalPoint - A point to hit test with, in global space.\n * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults\n * to the last rendered root of the associated renderer.\n * @return {PIXI.DisplayObject} The hit display object, if any.\n */\n hitTest(globalPoint, root)\n {\n // clear the target for our hit test\n hitTestEvent.target = null;\n // assign the global point\n hitTestEvent.data.global = globalPoint;\n // ensure safety of the root\n if (!root)\n {\n root = this.renderer._lastObjectRendered;\n }\n // run the hit test\n this.processInteractive(hitTestEvent, root, null, true);\n // return our found object - it'll be null if we didn't hit anything\n\n return hitTestEvent.target;\n }\n\n /**\n * Sets the DOM element which will receive mouse/touch events. This is useful for when you have\n * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate\n * another DOM element to receive those events.\n *\n * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events.\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas).\n */\n setTargetElement(element, resolution = 1)\n {\n this.removeEvents();\n\n this.interactionDOMElement = element;\n\n this.resolution = resolution;\n\n this.addEvents();\n }\n\n /**\n * Registers all the DOM events\n *\n * @private\n */\n addEvents()\n {\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n core.ticker.shared.add(this.update, this, core.UPDATE_PRIORITY.INTERACTION);\n\n if (window.navigator.msPointerEnabled)\n {\n this.interactionDOMElement.style['-ms-content-zooming'] = 'none';\n this.interactionDOMElement.style['-ms-touch-action'] = 'none';\n }\n else if (this.supportsPointerEvents)\n {\n this.interactionDOMElement.style['touch-action'] = 'none';\n }\n\n /**\n * These events are added first, so that if pointer events are normalised, they are fired\n * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd\n */\n if (this.supportsPointerEvents)\n {\n window.document.addEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true);\n // pointerout is fired in addition to pointerup (for touch events) and pointercancel\n // we already handle those, so for the purposes of what we do in onPointerOut, we only\n // care about the pointerleave event\n this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true);\n window.addEventListener('pointercancel', this.onPointerCancel, true);\n window.addEventListener('pointerup', this.onPointerUp, true);\n }\n else\n {\n window.document.addEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true);\n window.addEventListener('mouseup', this.onPointerUp, true);\n }\n\n // always look directly for touch events so that we can provide original data\n // In a future version we should change this to being just a fallback and rely solely on\n // PointerEvents whenever available\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true);\n }\n\n this.eventsAdded = true;\n }\n\n /**\n * Removes all the DOM events that were previously registered\n *\n * @private\n */\n removeEvents()\n {\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n core.ticker.shared.remove(this.update, this);\n\n if (window.navigator.msPointerEnabled)\n {\n this.interactionDOMElement.style['-ms-content-zooming'] = '';\n this.interactionDOMElement.style['-ms-touch-action'] = '';\n }\n else if (this.supportsPointerEvents)\n {\n this.interactionDOMElement.style['touch-action'] = '';\n }\n\n if (this.supportsPointerEvents)\n {\n window.document.removeEventListener('pointermove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true);\n window.removeEventListener('pointercancel', this.onPointerCancel, true);\n window.removeEventListener('pointerup', this.onPointerUp, true);\n }\n else\n {\n window.document.removeEventListener('mousemove', this.onPointerMove, true);\n this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true);\n this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true);\n window.removeEventListener('mouseup', this.onPointerUp, true);\n }\n\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true);\n this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true);\n this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true);\n this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true);\n }\n\n this.interactionDOMElement = null;\n\n this.eventsAdded = false;\n }\n\n /**\n * Updates the state of interactive objects.\n * Invoked by a throttled ticker update from {@link PIXI.ticker.shared}.\n *\n * @param {number} deltaTime - time delta since last tick\n */\n update(deltaTime)\n {\n this._deltaTime += deltaTime;\n\n if (this._deltaTime < this.interactionFrequency)\n {\n return;\n }\n\n this._deltaTime = 0;\n\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n // if the user move the mouse this check has already been done using the mouse move!\n if (this.didMove)\n {\n this.didMove = false;\n\n return;\n }\n\n this.cursor = null;\n\n // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind,\n // but there was a scenario of a display object moving under a static mouse cursor.\n // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function\n for (const k in this.activeInteractionData)\n {\n // eslint-disable-next-line no-prototype-builtins\n if (this.activeInteractionData.hasOwnProperty(k))\n {\n const interactionData = this.activeInteractionData[k];\n\n if (interactionData.originalEvent && interactionData.pointerType !== 'touch')\n {\n const interactionEvent = this.configureInteractionEventForDOMEvent(\n this.eventData,\n interactionData.originalEvent,\n interactionData\n );\n\n this.processInteractive(\n interactionEvent,\n this.renderer._lastObjectRendered,\n this.processPointerOverOut,\n true\n );\n }\n }\n }\n\n this.setCursorMode(this.cursor);\n\n // TODO\n }\n\n /**\n * Sets the current cursor mode, handling any callbacks or CSS style changes.\n *\n * @param {string} mode - cursor mode, a key from the cursorStyles dictionary\n */\n setCursorMode(mode)\n {\n mode = mode || 'default';\n // if the mode didn't actually change, bail early\n if (this.currentCursorMode === mode)\n {\n return;\n }\n this.currentCursorMode = mode;\n const style = this.cursorStyles[mode];\n\n // only do things if there is a cursor style for it\n if (style)\n {\n switch (typeof style)\n {\n case 'string':\n // string styles are handled as cursor CSS\n this.interactionDOMElement.style.cursor = style;\n break;\n case 'function':\n // functions are just called, and passed the cursor mode\n style(mode);\n break;\n case 'object':\n // if it is an object, assume that it is a dictionary of CSS styles,\n // apply it to the interactionDOMElement\n Object.assign(this.interactionDOMElement.style, style);\n break;\n }\n }\n else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode))\n {\n // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry\n // for the mode, then assume that the dev wants it to be CSS for the cursor.\n this.interactionDOMElement.style.cursor = mode;\n }\n }\n\n /**\n * Dispatches an event on the display object that was interacted with\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {object} eventData - the event data object\n * @private\n */\n dispatchEvent(displayObject, eventString, eventData)\n {\n if (!eventData.stopped)\n {\n eventData.currentTarget = displayObject;\n eventData.type = eventString;\n\n displayObject.emit(eventString, eventData);\n\n if (displayObject[eventString])\n {\n displayObject[eventString](eventData);\n }\n }\n }\n\n /**\n * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The\n * resulting value is stored in the point. This takes into account the fact that the DOM\n * element could be scaled and positioned anywhere on the screen.\n *\n * @param {PIXI.Point} point - the point that the result will be stored in\n * @param {number} x - the x coord of the position to map\n * @param {number} y - the y coord of the position to map\n */\n mapPositionToPoint(point, x, y)\n {\n let rect;\n\n // IE 11 fix\n if (!this.interactionDOMElement.parentElement)\n {\n rect = { x: 0, y: 0, width: 0, height: 0 };\n }\n else\n {\n rect = this.interactionDOMElement.getBoundingClientRect();\n }\n\n const resolutionMultiplier = navigator.isCocoonJS ? this.resolution : (1.0 / this.resolution);\n\n point.x = ((x - rect.left) * (this.interactionDOMElement.width / rect.width)) * resolutionMultiplier;\n point.y = ((y - rect.top) * (this.interactionDOMElement.height / rect.height)) * resolutionMultiplier;\n }\n\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @param {boolean} [interactive] - Whether the displayObject is interactive\n * @return {boolean} returns true if the displayObject hit the point\n */\n processInteractive(interactionEvent, displayObject, func, hitTest, interactive)\n {\n if (!displayObject || !displayObject.visible)\n {\n return false;\n }\n\n const point = interactionEvent.data.global;\n\n // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^\n //\n // This function will now loop through all objects and then only hit test the objects it HAS\n // to, not all of them. MUCH faster..\n // An object will be hit test if the following is true:\n //\n // 1: It is interactive.\n // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit.\n //\n // As another little optimisation once an interactive object has been hit we can carry on\n // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests\n // A final optimisation is that an object is not hit test directly if a child has already been hit.\n\n interactive = displayObject.interactive || interactive;\n\n let hit = false;\n let interactiveParent = interactive;\n\n // Flag here can set to false if the event is outside the parents hitArea or mask\n let hitTestChildren = true;\n\n // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea\n // There is also no longer a need to hitTest children.\n if (displayObject.hitArea)\n {\n if (hitTest)\n {\n displayObject.worldTransform.applyInverse(point, this._tempPoint);\n if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y))\n {\n hitTest = false;\n hitTestChildren = false;\n }\n else\n {\n hit = true;\n }\n }\n interactiveParent = false;\n }\n // If there is a mask, no need to test against anything else if the pointer is not within the mask\n else if (displayObject._mask)\n {\n if (hitTest)\n {\n if (!displayObject._mask.containsPoint(point))\n {\n hitTest = false;\n hitTestChildren = false;\n }\n }\n }\n\n // ** FREE TIP **! If an object is not interactive or has no buttons in it\n // (such as a game scene!) set interactiveChildren to false for that displayObject.\n // This will allow PixiJS to completely ignore and bypass checking the displayObjects children.\n if (hitTestChildren && displayObject.interactiveChildren && displayObject.children)\n {\n const children = displayObject.children;\n\n for (let i = children.length - 1; i >= 0; i--)\n {\n const child = children[i];\n\n // time to get recursive.. if this function will return if something is hit..\n const childHit = this.processInteractive(interactionEvent, child, func, hitTest, interactiveParent);\n\n if (childHit)\n {\n // its a good idea to check if a child has lost its parent.\n // this means it has been removed whilst looping so its best\n if (!child.parent)\n {\n continue;\n }\n\n // we no longer need to hit test any more objects in this container as we we\n // now know the parent has been hit\n interactiveParent = false;\n\n // If the child is interactive , that means that the object hit was actually\n // interactive and not just the child of an interactive object.\n // This means we no longer need to hit test anything else. We still need to run\n // through all objects, but we don't need to perform any hit tests.\n\n if (childHit)\n {\n if (interactionEvent.target)\n {\n hitTest = false;\n }\n hit = true;\n }\n }\n }\n }\n\n // no point running this if the item is not interactive or does not have an interactive parent.\n if (interactive)\n {\n // if we are hit testing (as in we have no hit any objects yet)\n // We also don't need to worry about hit testing if once of the displayObjects children\n // has already been hit - but only if it was interactive, otherwise we need to keep\n // looking for an interactive child, just in case we hit one\n if (hitTest && !interactionEvent.target)\n {\n // already tested against hitArea if it is defined\n if (!displayObject.hitArea && displayObject.containsPoint)\n {\n if (displayObject.containsPoint(point))\n {\n hit = true;\n }\n }\n }\n\n if (displayObject.interactive)\n {\n if (hit && !interactionEvent.target)\n {\n interactionEvent.target = displayObject;\n }\n\n if (func)\n {\n func(interactionEvent, displayObject, !!hit);\n }\n }\n }\n\n return hit;\n }\n\n /**\n * Is called when the pointer button is pressed down on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down\n */\n onPointerDown(originalEvent)\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n /**\n * No need to prevent default on natural pointer events, as there are no side effects\n * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser,\n * so still need to be prevented.\n */\n\n // Guaranteed that there will be at least one event in events, and all events must have the same pointer type\n\n if (this.autoPreventDefault && events[0].isNormalized)\n {\n originalEvent.preventDefault();\n }\n\n const eventLen = events.length;\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerDown, true);\n\n this.emit('pointerdown', interactionEvent);\n if (event.pointerType === 'touch')\n {\n this.emit('touchstart', interactionEvent);\n }\n // emit a mouse event for \"pen\" pointers, the way a browser would emit a fallback event\n else if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n const isRightButton = event.button === 2;\n\n this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData);\n }\n }\n }\n\n /**\n * Processes the result of the pointer down check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n processPointerDown(interactionEvent, displayObject, hit)\n {\n const data = interactionEvent.data;\n const id = interactionEvent.data.identifier;\n\n if (hit)\n {\n if (!displayObject.trackedPointers[id])\n {\n displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n this.dispatchEvent(displayObject, 'pointerdown', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchstart', interactionEvent);\n }\n else if (data.pointerType === 'mouse' || data.pointerType === 'pen')\n {\n const isRightButton = data.button === 2;\n\n if (isRightButton)\n {\n displayObject.trackedPointers[id].rightDown = true;\n }\n else\n {\n displayObject.trackedPointers[id].leftDown = true;\n }\n\n this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent);\n }\n }\n }\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released\n * @param {boolean} cancelled - true if the pointer is cancelled\n * @param {Function} func - Function passed to {@link processInteractive}\n */\n onPointerComplete(originalEvent, cancelled, func)\n {\n const events = this.normalizeToPointerData(originalEvent);\n\n const eventLen = events.length;\n\n // if the event wasn't targeting our canvas, then consider it to be pointerupoutside\n // in all cases (unless it was a pointercancel)\n const eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : '';\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n // perform hit testing for events targeting our canvas or cancel events\n this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, func, cancelled || !eventAppend);\n\n this.emit(cancelled ? 'pointercancel' : `pointerup${eventAppend}`, interactionEvent);\n\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n const isRightButton = event.button === 2;\n\n this.emit(isRightButton ? `rightup${eventAppend}` : `mouseup${eventAppend}`, interactionEvent);\n }\n else if (event.pointerType === 'touch')\n {\n this.emit(cancelled ? 'touchcancel' : `touchend${eventAppend}`, interactionEvent);\n this.releaseInteractionDataForPointerId(event.pointerId, interactionData);\n }\n }\n }\n\n /**\n * Is called when the pointer button is cancelled\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n onPointerCancel(event)\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && event.pointerType === 'touch') return;\n\n this.onPointerComplete(event, true, this.processPointerCancel);\n }\n\n /**\n * Processes the result of the pointer cancel check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - The display object that was tested\n */\n processPointerCancel(interactionEvent, displayObject)\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n if (displayObject.trackedPointers[id] !== undefined)\n {\n delete displayObject.trackedPointers[id];\n this.dispatchEvent(displayObject, 'pointercancel', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchcancel', interactionEvent);\n }\n }\n }\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n onPointerUp(event)\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && event.pointerType === 'touch') return;\n\n this.onPointerComplete(event, false, this.processPointerUp);\n }\n\n /**\n * Processes the result of the pointer up check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n processPointerUp(interactionEvent, displayObject, hit)\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n const trackingData = displayObject.trackedPointers[id];\n\n const isTouch = data.pointerType === 'touch';\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n // need to track mouse down status in the mouse block so that we can emit\n // event in a later block\n let isMouseTap = false;\n\n // Mouse only\n if (isMouse)\n {\n const isRightButton = data.button === 2;\n\n const flags = InteractionTrackingData.FLAGS;\n\n const test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN;\n\n const isDown = trackingData !== undefined && (trackingData.flags & test);\n\n if (hit)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent);\n\n if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent);\n // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap\n isMouseTap = true;\n }\n }\n else if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent);\n }\n // update the down state of the tracking data\n if (trackingData)\n {\n if (isRightButton)\n {\n trackingData.rightDown = false;\n }\n else\n {\n trackingData.leftDown = false;\n }\n }\n }\n\n // Pointers and Touches, and Mouse\n if (hit)\n {\n this.dispatchEvent(displayObject, 'pointerup', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchend', interactionEvent);\n\n if (trackingData)\n {\n // emit pointertap if not a mouse, or if the mouse block decided it was a tap\n if (!isMouse || isMouseTap)\n {\n this.dispatchEvent(displayObject, 'pointertap', interactionEvent);\n }\n if (isTouch)\n {\n this.dispatchEvent(displayObject, 'tap', interactionEvent);\n // touches are no longer over (if they ever were) when we get the touchend\n // so we should ensure that we don't keep pretending that they are\n trackingData.over = false;\n }\n }\n }\n else if (trackingData)\n {\n this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent);\n }\n // Only remove the tracking data if there is no over/down state still associated with it\n if (trackingData && trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n\n /**\n * Is called when the pointer moves across the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer moving\n */\n onPointerMove(originalEvent)\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen')\n {\n this.didMove = true;\n\n this.cursor = null;\n }\n\n const eventLen = events.length;\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n const interactive = event.pointerType === 'touch' ? this.moveWhenInside : true;\n\n this.processInteractive(\n interactionEvent,\n this.renderer._lastObjectRendered,\n this.processPointerMove,\n interactive\n );\n this.emit('pointermove', interactionEvent);\n if (event.pointerType === 'touch') this.emit('touchmove', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen') this.emit('mousemove', interactionEvent);\n }\n\n if (events[0].pointerType === 'mouse')\n {\n this.setCursorMode(this.cursor);\n\n // TODO BUG for parents interactive object (border order issue)\n }\n }\n\n /**\n * Processes the result of the pointer move check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n processPointerMove(interactionEvent, displayObject, hit)\n {\n const data = interactionEvent.data;\n\n const isTouch = data.pointerType === 'touch';\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n if (isMouse)\n {\n this.processPointerOverOut(interactionEvent, displayObject, hit);\n }\n\n if (!this.moveWhenInside || hit)\n {\n this.dispatchEvent(displayObject, 'pointermove', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchmove', interactionEvent);\n if (isMouse) this.dispatchEvent(displayObject, 'mousemove', interactionEvent);\n }\n }\n\n /**\n * Is called when the pointer is moved out of the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out\n */\n onPointerOut(originalEvent)\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOut, so events will always be length 1\n const event = events[0];\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = false;\n this.setCursorMode(null);\n }\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerOverOut, false);\n\n this.emit('pointerout', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseout', interactionEvent);\n }\n else\n {\n // we can get touchleave events after touchend, so we want to make sure we don't\n // introduce memory leaks\n this.releaseInteractionDataForPointerId(interactionData.identifier);\n }\n }\n\n /**\n * Processes the result of the pointer over/out check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n processPointerOverOut(interactionEvent, displayObject, hit)\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n let trackingData = displayObject.trackedPointers[id];\n\n // if we just moused over the display object, then we need to track that state\n if (hit && !trackingData)\n {\n trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n\n if (trackingData === undefined) return;\n\n if (hit && this.mouseOverRenderer)\n {\n if (!trackingData.over)\n {\n trackingData.over = true;\n this.dispatchEvent(displayObject, 'pointerover', interactionEvent);\n if (isMouse)\n {\n this.dispatchEvent(displayObject, 'mouseover', interactionEvent);\n }\n }\n\n // only change the cursor if it has not already been changed (by something deeper in the\n // display tree)\n if (isMouse && this.cursor === null)\n {\n this.cursor = displayObject.cursor;\n }\n }\n else if (trackingData.over)\n {\n trackingData.over = false;\n this.dispatchEvent(displayObject, 'pointerout', this.eventData);\n if (isMouse)\n {\n this.dispatchEvent(displayObject, 'mouseout', interactionEvent);\n }\n // if there is no mouse down information for the pointer, then it is safe to delete\n if (trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n }\n\n /**\n * Is called when the pointer is moved into the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view\n */\n onPointerOver(originalEvent)\n {\n const events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOver, so events will always be length 1\n const event = events[0];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = true;\n }\n\n this.emit('pointerover', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseover', interactionEvent);\n }\n }\n\n /**\n * Get InteractionData for a given pointerId. Store that data as well\n *\n * @private\n * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData\n * @return {PIXI.interaction.InteractionData} - Interaction data for the given pointer identifier\n */\n getInteractionDataForPointerId(event)\n {\n const pointerId = event.pointerId;\n\n let interactionData;\n\n if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse')\n {\n interactionData = this.mouse;\n }\n else if (this.activeInteractionData[pointerId])\n {\n interactionData = this.activeInteractionData[pointerId];\n }\n else\n {\n interactionData = this.interactionDataPool.pop() || new InteractionData();\n interactionData.identifier = pointerId;\n this.activeInteractionData[pointerId] = interactionData;\n }\n // copy properties from the event, so that we can make sure that touch/pointer specific\n // data is available\n interactionData.copyEvent(event);\n\n return interactionData;\n }\n\n /**\n * Return unused InteractionData to the pool, for a given pointerId\n *\n * @private\n * @param {number} pointerId - Identifier from a pointer event\n */\n releaseInteractionDataForPointerId(pointerId)\n {\n const interactionData = this.activeInteractionData[pointerId];\n\n if (interactionData)\n {\n delete this.activeInteractionData[pointerId];\n interactionData.reset();\n this.interactionDataPool.push(interactionData);\n }\n }\n\n /**\n * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData\n *\n * @private\n * @param {PIXI.interaction.InteractionEvent} interactionEvent - The event to be configured\n * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent\n * @param {PIXI.interaction.InteractionData} interactionData - The InteractionData that will be paired\n * with the InteractionEvent\n * @return {PIXI.interaction.InteractionEvent} the interaction event that was passed in\n */\n configureInteractionEventForDOMEvent(interactionEvent, pointerEvent, interactionData)\n {\n interactionEvent.data = interactionData;\n\n this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY);\n\n // This is the way InteractionManager processed touch events before the refactoring, so I've kept\n // it here. But it doesn't make that much sense to me, since mapPositionToPoint already factors\n // in this.resolution, so this just divides by this.resolution twice for touch events...\n if (navigator.isCocoonJS && pointerEvent.pointerType === 'touch')\n {\n interactionData.global.x = interactionData.global.x / this.resolution;\n interactionData.global.y = interactionData.global.y / this.resolution;\n }\n\n // Not really sure why this is happening, but it's how a previous version handled things\n if (pointerEvent.pointerType === 'touch')\n {\n pointerEvent.globalX = interactionData.global.x;\n pointerEvent.globalY = interactionData.global.y;\n }\n\n interactionData.originalEvent = pointerEvent;\n interactionEvent.reset();\n\n return interactionEvent;\n }\n\n /**\n * Ensures that the original event object contains all data that a regular pointer event would have\n *\n * @private\n * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event\n * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer\n * or mouse event, or a multiple normalized pointer events if there are multiple changed touches\n */\n normalizeToPointerData(event)\n {\n const normalizedEvents = [];\n\n if (this.supportsTouchEvents && event instanceof TouchEvent)\n {\n for (let i = 0, li = event.changedTouches.length; i < li; i++)\n {\n const touch = event.changedTouches[i];\n\n if (typeof touch.button === 'undefined') touch.button = event.touches.length ? 1 : 0;\n if (typeof touch.buttons === 'undefined') touch.buttons = event.touches.length ? 1 : 0;\n if (typeof touch.isPrimary === 'undefined')\n {\n touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';\n }\n if (typeof touch.width === 'undefined') touch.width = touch.radiusX || 1;\n if (typeof touch.height === 'undefined') touch.height = touch.radiusY || 1;\n if (typeof touch.tiltX === 'undefined') touch.tiltX = 0;\n if (typeof touch.tiltY === 'undefined') touch.tiltY = 0;\n if (typeof touch.pointerType === 'undefined') touch.pointerType = 'touch';\n if (typeof touch.pointerId === 'undefined') touch.pointerId = touch.identifier || 0;\n if (typeof touch.pressure === 'undefined') touch.pressure = touch.force || 0.5;\n if (typeof touch.twist === 'undefined') touch.twist = 0;\n if (typeof touch.tangentialPressure === 'undefined') touch.tangentialPressure = 0;\n // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven\n // support, and the fill ins are not quite the same\n // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top\n // left is not 0,0 on the page\n if (typeof touch.layerX === 'undefined') touch.layerX = touch.offsetX = touch.clientX;\n if (typeof touch.layerY === 'undefined') touch.layerY = touch.offsetY = touch.clientY;\n\n // mark the touch as normalized, just so that we know we did it\n touch.isNormalized = true;\n\n normalizedEvents.push(touch);\n }\n }\n // apparently PointerEvent subclasses MouseEvent, so yay\n else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent)))\n {\n if (typeof event.isPrimary === 'undefined') event.isPrimary = true;\n if (typeof event.width === 'undefined') event.width = 1;\n if (typeof event.height === 'undefined') event.height = 1;\n if (typeof event.tiltX === 'undefined') event.tiltX = 0;\n if (typeof event.tiltY === 'undefined') event.tiltY = 0;\n if (typeof event.pointerType === 'undefined') event.pointerType = 'mouse';\n if (typeof event.pointerId === 'undefined') event.pointerId = MOUSE_POINTER_ID;\n if (typeof event.pressure === 'undefined') event.pressure = 0.5;\n if (typeof event.twist === 'undefined') event.twist = 0;\n if (typeof event.tangentialPressure === 'undefined') event.tangentialPressure = 0;\n\n // mark the mouse event as normalized, just so that we know we did it\n event.isNormalized = true;\n\n normalizedEvents.push(event);\n }\n else\n {\n normalizedEvents.push(event);\n }\n\n return normalizedEvents;\n }\n\n /**\n * Destroys the interaction manager\n *\n */\n destroy()\n {\n this.removeEvents();\n\n this.removeAllListeners();\n\n this.renderer = null;\n\n this.mouse = null;\n\n this.eventData = null;\n\n this.interactionDOMElement = null;\n\n this.onPointerDown = null;\n this.processPointerDown = null;\n\n this.onPointerUp = null;\n this.processPointerUp = null;\n\n this.onPointerCancel = null;\n this.processPointerCancel = null;\n\n this.onPointerMove = null;\n this.processPointerMove = null;\n\n this.onPointerOut = null;\n this.processPointerOverOut = null;\n\n this.onPointerOver = null;\n\n this._tempPoint = null;\n }\n}\n\ncore.WebGLRenderer.registerPlugin('interaction', InteractionManager);\ncore.CanvasRenderer.registerPlugin('interaction', InteractionManager);\n","/**\n * DisplayObjects with the {@link PIXI.interaction.interactiveTarget} mixin use this class to track interactions\n *\n * @class\n * @private\n * @memberof PIXI.interaction\n */\nexport default class InteractionTrackingData\n{\n /**\n * @param {number} pointerId - Unique pointer id of the event\n */\n constructor(pointerId)\n {\n this._pointerId = pointerId;\n this._flags = InteractionTrackingData.FLAGS.NONE;\n }\n\n /**\n *\n * @private\n * @param {number} flag - The interaction flag to set\n * @param {boolean} yn - Should the flag be set or unset\n */\n _doSet(flag, yn)\n {\n if (yn)\n {\n this._flags = this._flags | flag;\n }\n else\n {\n this._flags = this._flags & (~flag);\n }\n }\n\n /**\n * Unique pointer id of the event\n *\n * @readonly\n * @member {number}\n */\n get pointerId()\n {\n return this._pointerId;\n }\n\n /**\n * State of the tracking data, expressed as bit flags\n *\n * @member {number}\n * @memberof PIXI.interaction.InteractionTrackingData#\n */\n get flags()\n {\n return this._flags;\n }\n\n /**\n * Set the flags for the tracking data\n *\n * @param {number} flags - Flags to set\n */\n set flags(flags)\n {\n this._flags = flags;\n }\n\n /**\n * Is the tracked event inactive (not over or down)?\n *\n * @member {number}\n * @memberof PIXI.interaction.InteractionTrackingData#\n */\n get none()\n {\n return this._flags === this.constructor.FLAGS.NONE;\n }\n\n /**\n * Is the tracked event over the DisplayObject?\n *\n * @member {boolean}\n * @memberof PIXI.interaction.InteractionTrackingData#\n */\n get over()\n {\n return (this._flags & this.constructor.FLAGS.OVER) !== 0;\n }\n\n /**\n * Set the over flag\n *\n * @param {boolean} yn - Is the event over?\n */\n set over(yn)\n {\n this._doSet(this.constructor.FLAGS.OVER, yn);\n }\n\n /**\n * Did the right mouse button come down in the DisplayObject?\n *\n * @member {boolean}\n * @memberof PIXI.interaction.InteractionTrackingData#\n */\n get rightDown()\n {\n return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0;\n }\n\n /**\n * Set the right down flag\n *\n * @param {boolean} yn - Is the right mouse button down?\n */\n set rightDown(yn)\n {\n this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn);\n }\n\n /**\n * Did the left mouse button come down in the DisplayObject?\n *\n * @member {boolean}\n * @memberof PIXI.interaction.InteractionTrackingData#\n */\n get leftDown()\n {\n return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0;\n }\n\n /**\n * Set the left down flag\n *\n * @param {boolean} yn - Is the left mouse button down?\n */\n set leftDown(yn)\n {\n this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn);\n }\n}\n\nInteractionTrackingData.FLAGS = Object.freeze({\n NONE: 0,\n OVER: 1 << 0,\n LEFT_DOWN: 1 << 1,\n RIGHT_DOWN: 1 << 2,\n});\n","/**\n * This namespace contains a renderer plugin for handling mouse, pointer, and touch events.\n *\n * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.WebGLRenderer#plugins}.\n * @namespace PIXI.interaction\n */\nexport { default as InteractionData } from './InteractionData';\nexport { default as InteractionManager } from './InteractionManager';\nexport { default as interactiveTarget } from './interactiveTarget';\nexport { default as InteractionTrackingData } from './InteractionTrackingData';\nexport { default as InteractionEvent } from './InteractionEvent';\n","/**\n * Default property values of interactive objects\n * Used by {@link PIXI.interaction.InteractionManager} to automatically give all DisplayObjects these properties\n *\n * @private\n * @name interactiveTarget\n * @memberof PIXI.interaction\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * core.DisplayObject.prototype,\n * PIXI.interaction.interactiveTarget\n * );\n */\nexport default {\n\n /**\n * Enable interaction events for the DisplayObject. Touch, pointer and mouse\n * events will not be emitted unless `interactive` is set to `true`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.on('tap', (event) => {\n * //handle event\n * });\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n interactive: false,\n\n /**\n * Determines if the children to the displayObject can be clicked/touched\n * Setting this to false allows PixiJS to bypass a recursive `hitTest` function\n *\n * @member {boolean}\n * @memberof PIXI.Container#\n */\n interactiveChildren: true,\n\n /**\n * Interaction shape. Children will be hit first, then this shape will be checked.\n * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100);\n * @member {PIXI.Rectangle|PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.RoundedRectangle}\n * @memberof PIXI.DisplayObject#\n */\n hitArea: null,\n\n /**\n * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive\n * Setting this changes the 'cursor' property to `'pointer'`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.buttonMode = true;\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n get buttonMode()\n {\n return this.cursor === 'pointer';\n },\n set buttonMode(value)\n {\n if (value)\n {\n this.cursor = 'pointer';\n }\n else if (this.cursor === 'pointer')\n {\n this.cursor = null;\n }\n },\n\n /**\n * This defines what cursor mode is used when the mouse cursor\n * is hovered over the displayObject.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.cursor = 'wait';\n * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n cursor: null,\n\n /**\n * Internal set of all active pointers, by identifier\n *\n * @member {Map<number, InteractionTrackingData>}\n * @memberof PIXI.DisplayObject#\n * @private\n */\n get trackedPointers()\n {\n if (this._trackedPointers === undefined) this._trackedPointers = {};\n\n return this._trackedPointers;\n },\n\n /**\n * Map of all tracked pointers, by identifier. Use trackedPointers to access.\n *\n * @private\n * @type {Map<number, InteractionTrackingData>}\n */\n _trackedPointers: undefined,\n};\n","import * as path from 'path';\nimport { Resource } from 'resource-loader';\nimport { BitmapText } from '../extras';\n\n/**\n * Register a BitmapText font from loader resource.\n *\n * @function parseBitmapFontData\n * @memberof PIXI.loaders\n * @param {PIXI.loaders.Resource} resource - Loader resource.\n * @param {PIXI.Texture|PIXI.Texture[]} textures - List of textures for each page.\n */\nexport function parse(resource, textures)\n{\n resource.bitmapFont = BitmapText.registerFont(resource.data, textures);\n}\n\nexport default function ()\n{\n return function bitmapFontParser(resource, next)\n {\n // skip if no data or not xml data\n if (!resource.data || resource.type !== Resource.TYPE.XML)\n {\n next();\n\n return;\n }\n\n // skip if not bitmap font data, using some silly duck-typing\n if (resource.data.getElementsByTagName('page').length === 0\n || resource.data.getElementsByTagName('info').length === 0\n || resource.data.getElementsByTagName('info')[0].getAttribute('face') === null\n )\n {\n next();\n\n return;\n }\n\n let xmlUrl = !resource.isDataUrl ? path.dirname(resource.url) : '';\n\n if (resource.isDataUrl)\n {\n if (xmlUrl === '.')\n {\n xmlUrl = '';\n }\n\n if (this.baseUrl && xmlUrl)\n {\n // if baseurl has a trailing slash then add one to xmlUrl so the replace works below\n if (this.baseUrl.charAt(this.baseUrl.length - 1) === '/')\n {\n xmlUrl += '/';\n }\n }\n }\n\n // remove baseUrl from xmlUrl\n xmlUrl = xmlUrl.replace(this.baseUrl, '');\n\n // if there is an xmlUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty.\n if (xmlUrl && xmlUrl.charAt(xmlUrl.length - 1) !== '/')\n {\n xmlUrl += '/';\n }\n\n const pages = resource.data.getElementsByTagName('page');\n const textures = {};\n\n // Handle completed, when the number of textures\n // load is the same number as references in the fnt file\n const completed = (page) =>\n {\n textures[page.metadata.pageFile] = page.texture;\n\n if (Object.keys(textures).length === pages.length)\n {\n parse(resource, textures);\n next();\n }\n };\n\n for (let i = 0; i < pages.length; ++i)\n {\n const pageFile = pages[i].getAttribute('file');\n const url = xmlUrl + pageFile;\n let exists = false;\n\n // incase the image is loaded outside\n // using the same loader, resource will be available\n for (const name in this.resources)\n {\n const bitmapResource = this.resources[name];\n\n if (bitmapResource.url === url)\n {\n bitmapResource.metadata.pageFile = pageFile;\n if (bitmapResource.texture)\n {\n completed(bitmapResource);\n }\n else\n {\n bitmapResource.onAfterMiddleware.add(completed);\n }\n exists = true;\n break;\n }\n }\n\n // texture is not loaded, we'll attempt to add\n // it to the load and add the texture to the list\n if (!exists)\n {\n // Standard loading options for images\n const options = {\n crossOrigin: resource.crossOrigin,\n loadType: Resource.LOAD_TYPE.IMAGE,\n metadata: Object.assign(\n { pageFile },\n resource.metadata.imageMetadata\n ),\n parentResource: resource,\n };\n\n this.add(url, options, completed);\n }\n }\n };\n}\n","import Application from '../core/Application';\nimport Loader from './loader';\n\n/**\n * This namespace contains APIs which extends the {@link https://github.com/englercj/resource-loader resource-loader} module\n * for loading assets, data, and other resources dynamically.\n * @example\n * const loader = new PIXI.loaders.Loader();\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.load((loader, resources) => {\n * // resources.bunny\n * // resources.spaceship\n * });\n * @namespace PIXI.loaders\n */\nexport { Loader };\nexport { default as bitmapFontParser, parse as parseBitmapFontData } from './bitmapFontParser';\nexport { default as spritesheetParser, getResourcePath } from './spritesheetParser';\nexport { default as textureParser } from './textureParser';\n\n/**\n * Reference to **resource-loader**'s Resource class.\n * See https://github.com/englercj/resource-loader\n * @class Resource\n * @memberof PIXI.loaders\n */\nexport { Resource } from 'resource-loader';\n\n/**\n * A premade instance of the loader that can be used to load resources.\n * @name shared\n * @memberof PIXI.loaders\n * @type {PIXI.loaders.Loader}\n */\nconst shared = new Loader();\n\nshared.destroy = () =>\n{\n // protect destroying shared loader\n};\n\nexport { shared };\n\n// Mixin the loader construction\nconst AppPrototype = Application.prototype;\n\nAppPrototype._loader = null;\n\n/**\n * Loader instance to help with asset loading.\n * @name PIXI.Application#loader\n * @type {PIXI.loaders.Loader}\n */\nObject.defineProperty(AppPrototype, 'loader', {\n get()\n {\n if (!this._loader)\n {\n const sharedLoader = this._options.sharedLoader;\n\n this._loader = sharedLoader ? shared : new Loader();\n }\n\n return this._loader;\n },\n});\n\n// Override the destroy function\n// making sure to destroy the current Loader\nAppPrototype._parentDestroy = AppPrototype.destroy;\nAppPrototype.destroy = function destroy(removeView, stageOptions)\n{\n if (this._loader)\n {\n this._loader.destroy();\n this._loader = null;\n }\n this._parentDestroy(removeView, stageOptions);\n};\n","import ResourceLoader from 'resource-loader';\nimport { blobMiddlewareFactory } from 'resource-loader/lib/middlewares/parsing/blob';\nimport EventEmitter from 'eventemitter3';\nimport textureParser from './textureParser';\nimport spritesheetParser from './spritesheetParser';\nimport bitmapFontParser from './bitmapFontParser';\n\n/**\n *\n * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.loader; // PixiJS exposes a premade instance for you to use.\n * //or\n * const loader = new PIXI.loaders.Loader(); // you can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n *\n * @see https://github.com/englercj/resource-loader\n *\n * @class\n * @extends module:resource-loader.ResourceLoader\n * @memberof PIXI.loaders\n */\nexport default class Loader extends ResourceLoader\n{\n /**\n * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.\n * @param {number} [concurrency=10] - The number of resources to load concurrently.\n */\n constructor(baseUrl, concurrency)\n {\n super(baseUrl, concurrency);\n EventEmitter.call(this);\n\n for (let i = 0; i < Loader._pixiMiddleware.length; ++i)\n {\n this.use(Loader._pixiMiddleware[i]());\n }\n\n // Compat layer, translate the new v2 signals into old v1 events.\n this.onStart.add((l) => this.emit('start', l));\n this.onProgress.add((l, r) => this.emit('progress', l, r));\n this.onError.add((e, l, r) => this.emit('error', e, l, r));\n this.onLoad.add((l, r) => this.emit('load', l, r));\n this.onComplete.add((l, r) => this.emit('complete', l, r));\n }\n\n /**\n * Adds a default middleware to the PixiJS loader.\n *\n * @static\n * @param {Function} fn - The middleware to add.\n */\n static addPixiMiddleware(fn)\n {\n Loader._pixiMiddleware.push(fn);\n }\n\n /**\n * Destroy the loader, removes references.\n */\n destroy()\n {\n this.removeAllListeners();\n this.reset();\n }\n}\n\n// Copy EE3 prototype (mixin)\nfor (const k in EventEmitter.prototype)\n{\n Loader.prototype[k] = EventEmitter.prototype[k];\n}\n\nLoader._pixiMiddleware = [\n // parse any blob into more usable objects (e.g. Image)\n blobMiddlewareFactory,\n // parse any Image objects into textures\n textureParser,\n // parse any spritesheet data into multiple textures\n spritesheetParser,\n // parse bitmap font data into multiple textures\n bitmapFontParser,\n];\n\n// Add custom extentions\nconst Resource = ResourceLoader.Resource;\n\nResource.setExtensionXhrType('fnt', Resource.XHR_RESPONSE_TYPE.DOCUMENT);\n","import { Resource } from 'resource-loader';\nimport url from 'url';\nimport { Spritesheet } from '../core';\n\nexport default function ()\n{\n return function spritesheetParser(resource, next)\n {\n const imageResourceName = `${resource.name}_image`;\n\n // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists\n if (!resource.data\n || resource.type !== Resource.TYPE.JSON\n || !resource.data.frames\n || this.resources[imageResourceName]\n )\n {\n next();\n\n return;\n }\n\n const loadOptions = {\n crossOrigin: resource.crossOrigin,\n metadata: resource.metadata.imageMetadata,\n parentResource: resource,\n };\n\n const resourcePath = getResourcePath(resource, this.baseUrl);\n\n // load the image for this sheet\n this.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res)\n {\n if (res.error)\n {\n next(res.error);\n\n return;\n }\n\n const spritesheet = new Spritesheet(\n res.texture.baseTexture,\n resource.data,\n resource.url\n );\n\n spritesheet.parse(() =>\n {\n resource.spritesheet = spritesheet;\n resource.textures = spritesheet.textures;\n next();\n });\n });\n };\n}\n\nexport function getResourcePath(resource, baseUrl)\n{\n // Prepend url path unless the resource image is a data url\n if (resource.isDataUrl)\n {\n return resource.data.meta.image;\n }\n\n return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image);\n}\n","import { Resource } from 'resource-loader';\nimport Texture from '../core/textures/Texture';\n\nexport default function ()\n{\n return function textureParser(resource, next)\n {\n // create a new texture if the data is an Image object\n if (resource.data && resource.type === Resource.TYPE.IMAGE)\n {\n resource.texture = Texture.fromLoader(\n resource.data,\n resource.url,\n resource.name\n );\n }\n next();\n };\n}\n","import * as core from '../core';\nimport Texture from '../core/textures/Texture';\n\nconst tempPoint = new core.Point();\nconst tempPolygon = new core.Polygon();\n\n/**\n * Base mesh class\n * @class\n * @extends PIXI.Container\n * @memberof PIXI.mesh\n */\nexport default class Mesh extends core.Container\n{\n /**\n * @param {PIXI.Texture} texture - The texture to use\n * @param {Float32Array} [vertices] - if you want to specify the vertices\n * @param {Float32Array} [uvs] - if you want to specify the uvs\n * @param {Uint16Array} [indices] - if you want to specify the indices\n * @param {number} [drawMode] - the drawMode, can be any of the Mesh.DRAW_MODES consts\n */\n constructor(texture, vertices, uvs, indices, drawMode)\n {\n super();\n\n /**\n * The texture of the Mesh\n *\n * @member {PIXI.Texture}\n * @default PIXI.Texture.EMPTY\n * @private\n */\n this._texture = texture || Texture.EMPTY;\n\n /**\n * The Uvs of the Mesh\n *\n * @member {Float32Array}\n */\n this.uvs = uvs || new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1]);\n\n /**\n * An array of vertices\n *\n * @member {Float32Array}\n */\n this.vertices = vertices || new Float32Array([\n 0, 0,\n 100, 0,\n 100, 100,\n 0, 100]);\n\n /**\n * An array containing the indices of the vertices\n *\n * @member {Uint16Array}\n */\n // TODO auto generate this based on draw mode!\n this.indices = indices || new Uint16Array([0, 1, 3, 2]);\n\n /**\n * Version of mesh uvs are dirty or not\n *\n * @member {number}\n */\n this.dirty = 0;\n\n /**\n * Version of mesh indices\n *\n * @member {number}\n */\n this.indexDirty = 0;\n\n /**\n * Version of mesh verticies array\n *\n * @member {number}\n */\n this.vertexDirty = 0;\n\n /**\n * For backwards compatibility the default is to re-upload verticies each render call.\n * Set this to `false` and increase `vertexDirty` to manually re-upload the buffer.\n *\n * @member {boolean}\n */\n this.autoUpdate = true;\n\n /**\n * The blend mode to be applied to the sprite. Set to `PIXI.BLEND_MODES.NORMAL` to remove\n * any blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = core.BLEND_MODES.NORMAL;\n\n /**\n * Triangles in canvas mode are automatically antialiased, use this value to force triangles\n * to overlap a bit with each other.\n *\n * @member {number}\n */\n this.canvasPadding = core.settings.MESH_CANVAS_PADDING;\n\n /**\n * The way the Mesh should be drawn, can be any of the {@link PIXI.mesh.Mesh.DRAW_MODES} consts\n *\n * @member {number}\n * @see PIXI.mesh.Mesh.DRAW_MODES\n */\n this.drawMode = drawMode || Mesh.DRAW_MODES.TRIANGLE_MESH;\n\n /**\n * The default shader that is used if a mesh doesn't have a more specific one.\n *\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n /**\n * The tint applied to the mesh. This is a [r,g,b] value. A value of [1,1,1] will remove any\n * tint effect.\n *\n * @member {number}\n */\n this.tintRgb = new Float32Array([1, 1, 1]);\n\n /**\n * A map of renderer IDs to webgl render data\n *\n * @private\n * @member {object<number, object>}\n */\n this._glDatas = {};\n\n /**\n * transform that is applied to UV to get the texture coords\n * its updated independently from texture uvTransform\n * updates of uvs are tied to that thing\n *\n * @member {PIXI.TextureMatrix}\n * @private\n */\n this._uvTransform = new core.TextureMatrix(this._texture);\n\n /**\n * whether or not upload uvTransform to shader\n * if its false, then uvs should be pre-multiplied\n * if you change it for generated mesh, please call 'refresh(true)'\n * @member {boolean}\n * @default false\n */\n this.uploadUvTransform = false;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_renderWebGL' & '_renderCanvas' methods.\n * @member {string}\n * @default 'mesh'\n */\n this.pluginName = 'mesh';\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @private\n * @param {PIXI.WebGLRenderer} renderer - a reference to the WebGL renderer\n */\n _renderWebGL(renderer)\n {\n this.refresh();\n renderer.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\n _renderCanvas(renderer)\n {\n this.refresh();\n renderer.plugins[this.pluginName].render(this);\n }\n\n /**\n * When the texture is updated, this event will fire to update the scale and frame\n *\n * @private\n */\n _onTextureUpdate()\n {\n this._uvTransform.texture = this._texture;\n this.refresh();\n }\n\n /**\n * multiplies uvs only if uploadUvTransform is false\n * call it after you change uvs manually\n * make sure that texture is valid\n */\n multiplyUvs()\n {\n if (!this.uploadUvTransform)\n {\n this._uvTransform.multiplyUvs(this.uvs);\n }\n }\n\n /**\n * Refreshes uvs for generated meshes (rope, plane)\n * sometimes refreshes vertices too\n *\n * @param {boolean} [forceUpdate=false] if true, matrices will be updated any case\n */\n refresh(forceUpdate)\n {\n if (this.autoUpdate)\n {\n this.vertexDirty++;\n }\n if (this._uvTransform.update(forceUpdate))\n {\n this._refresh();\n }\n }\n\n /**\n * re-calculates mesh coords\n * @protected\n */\n _refresh()\n {\n /* empty */\n }\n\n /**\n * Returns the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account.\n *\n */\n _calculateBounds()\n {\n // TODO - we can cache local bounds and use them if they are dirty (like graphics)\n this._bounds.addVertices(this.transform, this.vertices, 0, this.vertices.length);\n }\n\n /**\n * Tests if a point is inside this mesh. Works only for TRIANGLE_MESH\n *\n * @param {PIXI.Point} point - the point to test\n * @return {boolean} the result of the test\n */\n containsPoint(point)\n {\n if (!this.getBounds().contains(point.x, point.y))\n {\n return false;\n }\n\n this.worldTransform.applyInverse(point, tempPoint);\n\n const vertices = this.vertices;\n const points = tempPolygon.points;\n const indices = this.indices;\n const len = this.indices.length;\n const step = this.drawMode === Mesh.DRAW_MODES.TRIANGLES ? 3 : 1;\n\n for (let i = 0; i + 2 < len; i += step)\n {\n const ind0 = indices[i] * 2;\n const ind1 = indices[i + 1] * 2;\n const ind2 = indices[i + 2] * 2;\n\n points[0] = vertices[ind0];\n points[1] = vertices[ind0 + 1];\n points[2] = vertices[ind1];\n points[3] = vertices[ind1 + 1];\n points[4] = vertices[ind2];\n points[5] = vertices[ind2 + 1];\n\n if (tempPolygon.contains(tempPoint.x, tempPoint.y))\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * The texture that the mesh uses.\n *\n * @member {PIXI.Texture}\n */\n get texture()\n {\n return this._texture;\n }\n\n set texture(value) // eslint-disable-line require-jsdoc\n {\n if (this._texture === value)\n {\n return;\n }\n\n this._texture = value;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.hasLoaded)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n\n /**\n * The tint applied to the mesh. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint()\n {\n return core.utils.rgb2hex(this.tintRgb);\n }\n\n set tint(value) // eslint-disable-line require-jsdoc\n {\n this.tintRgb = core.utils.hex2rgb(value, this.tintRgb);\n }\n\n /**\n * Destroys the Mesh object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options)\n {\n // for each webgl data entry, destroy the WebGLGraphicsData\n for (const id in this._glDatas)\n {\n const data = this._glDatas[id];\n\n if (data.destroy)\n {\n data.destroy();\n }\n else\n {\n if (data.vertexBuffer)\n {\n data.vertexBuffer.destroy();\n data.vertexBuffer = null;\n }\n if (data.indexBuffer)\n {\n data.indexBuffer.destroy();\n data.indexBuffer = null;\n }\n if (data.uvBuffer)\n {\n data.uvBuffer.destroy();\n data.uvBuffer = null;\n }\n if (data.vao)\n {\n data.vao.destroy();\n data.vao = null;\n }\n }\n }\n\n this._glDatas = null;\n\n super.destroy(options);\n }\n}\n\n/**\n * Different drawing buffer modes supported\n *\n * @static\n * @constant\n * @type {object}\n * @property {number} TRIANGLE_MESH\n * @property {number} TRIANGLES\n */\nMesh.DRAW_MODES = {\n TRIANGLE_MESH: 0,\n TRIANGLES: 1,\n};\n","import Plane from './Plane';\nimport CanvasTinter from '../core/sprites/canvas/CanvasTinter';\n\nconst DEFAULT_BORDER_SIZE = 10;\n\n/**\n * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful\n * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically\n *\n *```js\n * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.fromImage('BoxWithRoundedCorners.png'), 15, 15, 15, 15);\n * ```\n * <pre>\n * A B\n * +---+----------------------+---+\n * C | 1 | 2 | 3 |\n * +---+----------------------+---+\n * | | | |\n * | 4 | 5 | 6 |\n * | | | |\n * +---+----------------------+---+\n * D | 7 | 8 | 9 |\n * +---+----------------------+---+\n\n * When changing this objects width and/or height:\n * areas 1 3 7 and 9 will remain unscaled.\n * areas 2 and 8 will be stretched horizontally\n * areas 4 and 6 will be stretched vertically\n * area 5 will be stretched both horizontally and vertically\n * </pre>\n *\n * @class\n * @extends PIXI.mesh.Plane\n * @memberof PIXI.mesh\n *\n */\nexport default class NineSlicePlane extends Plane\n{\n /**\n * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane.\n * @param {int} [leftWidth=10] size of the left vertical bar (A)\n * @param {int} [topHeight=10] size of the top horizontal bar (C)\n * @param {int} [rightWidth=10] size of the right vertical bar (B)\n * @param {int} [bottomHeight=10] size of the bottom horizontal bar (D)\n */\n constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight)\n {\n super(texture, 4, 4);\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @memberof PIXI.NineSlicePlane#\n * @override\n */\n this._width = this._origWidth;\n\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n * @memberof PIXI.NineSlicePlane#\n * @override\n */\n this._height = this._origHeight;\n\n /**\n * The width of the left column (a)\n *\n * @member {number}\n * @memberof PIXI.NineSlicePlane#\n * @override\n */\n this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE;\n\n /**\n * The width of the right column (b)\n *\n * @member {number}\n * @memberof PIXI.NineSlicePlane#\n * @override\n */\n this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE;\n\n /**\n * The height of the top row (c)\n *\n * @member {number}\n * @memberof PIXI.NineSlicePlane#\n * @override\n */\n this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE;\n\n /**\n * The height of the bottom row (d)\n *\n * @member {number}\n * @memberof PIXI.NineSlicePlane#\n * @override\n */\n this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n *\n * @member {number}\n * @protected\n */\n this._cachedTint = 0xFFFFFF;\n\n /**\n * Cached tinted texture.\n *\n * @member {HTMLCanvasElement}\n * @protected\n */\n this._tintedTexture = null;\n\n /**\n * Temporary storage for canvas source coords\n *\n * @member {number[]}\n * @private\n */\n this._canvasUvs = null;\n\n this.refresh(true);\n }\n\n /**\n * Updates the horizontal vertices.\n *\n */\n updateHorizontalVertices()\n {\n const vertices = this.vertices;\n\n const h = this._topHeight + this._bottomHeight;\n const scale = this._height > h ? 1.0 : this._height / h;\n\n vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale;\n vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale);\n vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height;\n }\n\n /**\n * Updates the vertical vertices.\n *\n */\n updateVerticalVertices()\n {\n const vertices = this.vertices;\n\n const w = this._leftWidth + this._rightWidth;\n const scale = this._width > w ? 1.0 : this._width / w;\n\n vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale;\n vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale);\n vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width;\n }\n\n /**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer to render with.\n */\n _renderCanvas(renderer)\n {\n const context = renderer.context;\n const transform = this.worldTransform;\n const res = renderer.resolution;\n const isTinted = this.tint !== 0xFFFFFF;\n const texture = this._texture;\n\n // Work out tinting\n if (isTinted)\n {\n if (this._cachedTint !== this.tint)\n {\n // Tint has changed, need to update the tinted texture and use that instead\n\n this._cachedTint = this.tint;\n\n this._tintedTexture = CanvasTinter.getTintedTexture(this, this.tint);\n }\n }\n\n const textureSource = !isTinted ? texture.baseTexture.source : this._tintedTexture;\n\n if (!this._canvasUvs)\n {\n this._canvasUvs = [0, 0, 0, 0, 0, 0, 0, 0];\n }\n\n const vertices = this.vertices;\n const uvs = this._canvasUvs;\n const u0 = isTinted ? 0 : texture.frame.x;\n const v0 = isTinted ? 0 : texture.frame.y;\n const u1 = u0 + texture.frame.width;\n const v1 = v0 + texture.frame.height;\n\n uvs[0] = u0;\n uvs[1] = u0 + this._leftWidth;\n uvs[2] = u1 - this._rightWidth;\n uvs[3] = u1;\n uvs[4] = v0;\n uvs[5] = v0 + this._topHeight;\n uvs[6] = v1 - this._bottomHeight;\n uvs[7] = v1;\n\n for (let i = 0; i < 8; i++)\n {\n uvs[i] *= texture.baseTexture.resolution;\n }\n\n context.globalAlpha = this.worldAlpha;\n renderer.setBlendMode(this.blendMode);\n\n if (renderer.roundPixels)\n {\n context.setTransform(\n transform.a * res,\n transform.b * res,\n transform.c * res,\n transform.d * res,\n (transform.tx * res) | 0,\n (transform.ty * res) | 0\n );\n }\n else\n {\n context.setTransform(\n transform.a * res,\n transform.b * res,\n transform.c * res,\n transform.d * res,\n transform.tx * res,\n transform.ty * res\n );\n }\n\n for (let row = 0; row < 3; row++)\n {\n for (let col = 0; col < 3; col++)\n {\n const ind = (col * 2) + (row * 8);\n const sw = Math.max(1, uvs[col + 1] - uvs[col]);\n const sh = Math.max(1, uvs[row + 5] - uvs[row + 4]);\n const dw = Math.max(1, vertices[ind + 10] - vertices[ind]);\n const dh = Math.max(1, vertices[ind + 11] - vertices[ind + 1]);\n\n context.drawImage(textureSource, uvs[col], uvs[row + 4], sw, sh,\n vertices[ind], vertices[ind + 1], dw, dh);\n }\n }\n }\n\n /**\n * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n get width()\n {\n return this._width;\n }\n\n set width(value) // eslint-disable-line require-jsdoc\n {\n this._width = value;\n this._refresh();\n }\n\n /**\n * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane\n *\n * @member {number}\n */\n get height()\n {\n return this._height;\n }\n\n set height(value) // eslint-disable-line require-jsdoc\n {\n this._height = value;\n this._refresh();\n }\n\n /**\n * The width of the left column\n *\n * @member {number}\n */\n get leftWidth()\n {\n return this._leftWidth;\n }\n\n set leftWidth(value) // eslint-disable-line require-jsdoc\n {\n this._leftWidth = value;\n this._refresh();\n }\n\n /**\n * The width of the right column\n *\n * @member {number}\n */\n get rightWidth()\n {\n return this._rightWidth;\n }\n\n set rightWidth(value) // eslint-disable-line require-jsdoc\n {\n this._rightWidth = value;\n this._refresh();\n }\n\n /**\n * The height of the top row\n *\n * @member {number}\n */\n get topHeight()\n {\n return this._topHeight;\n }\n\n set topHeight(value) // eslint-disable-line require-jsdoc\n {\n this._topHeight = value;\n this._refresh();\n }\n\n /**\n * The height of the bottom row\n *\n * @member {number}\n */\n get bottomHeight()\n {\n return this._bottomHeight;\n }\n\n set bottomHeight(value) // eslint-disable-line require-jsdoc\n {\n this._bottomHeight = value;\n this._refresh();\n }\n\n /**\n * Refreshes NineSlicePlane coords. All of them.\n */\n _refresh()\n {\n super._refresh();\n\n const uvs = this.uvs;\n const texture = this._texture;\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n const _uvw = 1.0 / this._origWidth;\n const _uvh = 1.0 / this._origHeight;\n\n uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;\n uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;\n uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;\n uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;\n\n uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;\n uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth);\n uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;\n uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight);\n\n this.updateHorizontalVertices();\n this.updateVerticalVertices();\n\n this.dirty++;\n\n this.multiplyUvs();\n }\n}\n","import Mesh from './Mesh';\n\n/**\n * The Plane allows you to draw a texture across several points and them manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let Plane = new PIXI.Plane(PIXI.Texture.fromImage(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.mesh.Mesh\n * @memberof PIXI.mesh\n *\n */\nexport default class Plane extends Mesh\n{\n /**\n * @param {PIXI.Texture} texture - The texture to use on the Plane.\n * @param {number} [verticesX=10] - The number of vertices in the x-axis\n * @param {number} [verticesY=10] - The number of vertices in the y-axis\n */\n constructor(texture, verticesX, verticesY)\n {\n super(texture);\n\n /**\n * Tracker for if the Plane is ready to be drawn. Needed because Mesh ctor can\n * call _onTextureUpdated which could call refresh too early.\n *\n * @member {boolean}\n * @private\n */\n this._ready = true;\n\n this.verticesX = verticesX || 10;\n this.verticesY = verticesY || 10;\n\n this.drawMode = Mesh.DRAW_MODES.TRIANGLES;\n this.refresh();\n }\n\n /**\n * Refreshes plane coordinates\n *\n */\n _refresh()\n {\n const texture = this._texture;\n const total = this.verticesX * this.verticesY;\n const verts = [];\n const colors = [];\n const uvs = [];\n const indices = [];\n\n const segmentsX = this.verticesX - 1;\n const segmentsY = this.verticesY - 1;\n\n const sizeX = texture.width / segmentsX;\n const sizeY = texture.height / segmentsY;\n\n for (let i = 0; i < total; i++)\n {\n const x = (i % this.verticesX);\n const y = ((i / this.verticesX) | 0);\n\n verts.push(x * sizeX, y * sizeY);\n\n uvs.push(x / segmentsX, y / segmentsY);\n }\n\n // cons\n\n const totalSub = segmentsX * segmentsY;\n\n for (let i = 0; i < totalSub; i++)\n {\n const xpos = i % segmentsX;\n const ypos = (i / segmentsX) | 0;\n\n const value = (ypos * this.verticesX) + xpos;\n const value2 = (ypos * this.verticesX) + xpos + 1;\n const value3 = ((ypos + 1) * this.verticesX) + xpos;\n const value4 = ((ypos + 1) * this.verticesX) + xpos + 1;\n\n indices.push(value, value2, value3);\n indices.push(value2, value4, value3);\n }\n\n // console.log(indices)\n this.vertices = new Float32Array(verts);\n this.uvs = new Float32Array(uvs);\n this.colors = new Float32Array(colors);\n this.indices = new Uint16Array(indices);\n\n this.dirty++;\n this.indexDirty++;\n\n this.multiplyUvs();\n }\n\n /**\n * Clear texture UVs when new texture is set\n *\n * @private\n */\n _onTextureUpdate()\n {\n Mesh.prototype._onTextureUpdate.call(this);\n\n // wait for the Plane ctor to finish before calling refresh\n if (this._ready)\n {\n this.refresh();\n }\n }\n\n}\n","import Mesh from './Mesh';\n\n/**\n * The rope allows you to draw a texture across several points and them manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let rope = new PIXI.Rope(PIXI.Texture.fromImage(\"snake.png\"), points);\n * ```\n *\n * @class\n * @extends PIXI.mesh.Mesh\n * @memberof PIXI.mesh\n *\n */\nexport default class Rope extends Mesh\n{\n /**\n * @param {PIXI.Texture} texture - The texture to use on the rope.\n * @param {PIXI.Point[]} points - An array of {@link PIXI.Point} objects to construct this rope.\n */\n constructor(texture, points)\n {\n super(texture);\n\n /**\n * An array of points that determine the rope\n *\n * @member {PIXI.Point[]}\n */\n this.points = points;\n\n /**\n * An array of vertices used to construct this rope.\n *\n * @member {Float32Array}\n */\n this.vertices = new Float32Array(points.length * 4);\n\n /**\n * The WebGL Uvs of the rope.\n *\n * @member {Float32Array}\n */\n this.uvs = new Float32Array(points.length * 4);\n\n /**\n * An array containing the color components\n *\n * @member {Float32Array}\n */\n this.colors = new Float32Array(points.length * 2);\n\n /**\n * An array containing the indices of the vertices\n *\n * @member {Uint16Array}\n */\n this.indices = new Uint16Array(points.length * 2);\n\n /**\n * refreshes vertices on every updateTransform\n * @member {boolean}\n * @default true\n */\n this.autoUpdate = true;\n\n this.refresh();\n }\n\n /**\n * Refreshes\n *\n */\n _refresh()\n {\n const points = this.points;\n\n // if too little points, or texture hasn't got UVs set yet just move on.\n if (points.length < 1 || !this._texture._uvs)\n {\n return;\n }\n\n // if the number of points has changed we will need to recreate the arraybuffers\n if (this.vertices.length / 4 !== points.length)\n {\n this.vertices = new Float32Array(points.length * 4);\n this.uvs = new Float32Array(points.length * 4);\n this.colors = new Float32Array(points.length * 2);\n this.indices = new Uint16Array(points.length * 2);\n }\n\n const uvs = this.uvs;\n\n const indices = this.indices;\n const colors = this.colors;\n\n uvs[0] = 0;\n uvs[1] = 0;\n uvs[2] = 0;\n uvs[3] = 1;\n\n colors[0] = 1;\n colors[1] = 1;\n\n indices[0] = 0;\n indices[1] = 1;\n\n const total = points.length;\n\n for (let i = 1; i < total; i++)\n {\n // time to do some smart drawing!\n let index = i * 4;\n const amount = i / (total - 1);\n\n uvs[index] = amount;\n uvs[index + 1] = 0;\n\n uvs[index + 2] = amount;\n uvs[index + 3] = 1;\n\n index = i * 2;\n colors[index] = 1;\n colors[index + 1] = 1;\n\n index = i * 2;\n indices[index] = index;\n indices[index + 1] = index + 1;\n }\n\n // ensure that the changes are uploaded\n this.dirty++;\n this.indexDirty++;\n\n this.multiplyUvs();\n this.refreshVertices();\n }\n\n /**\n * refreshes vertices of Rope mesh\n */\n refreshVertices()\n {\n const points = this.points;\n\n if (points.length < 1)\n {\n return;\n }\n\n let lastPoint = points[0];\n let nextPoint;\n let perpX = 0;\n let perpY = 0;\n\n // this.count -= 0.2;\n\n const vertices = this.vertices;\n const total = points.length;\n\n for (let i = 0; i < total; i++)\n {\n const point = points[i];\n const index = i * 4;\n\n if (i < points.length - 1)\n {\n nextPoint = points[i + 1];\n }\n else\n {\n nextPoint = point;\n }\n\n perpY = -(nextPoint.x - lastPoint.x);\n perpX = nextPoint.y - lastPoint.y;\n\n let ratio = (1 - (i / (total - 1))) * 10;\n\n if (ratio > 1)\n {\n ratio = 1;\n }\n\n const perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY));\n const num = this._texture.height / 2; // (20 + Math.abs(Math.sin((i + this.count) * 0.3) * 50) )* ratio;\n\n perpX /= perpLength;\n perpY /= perpLength;\n\n perpX *= num;\n perpY *= num;\n\n vertices[index] = point.x + perpX;\n vertices[index + 1] = point.y + perpY;\n vertices[index + 2] = point.x - perpX;\n vertices[index + 3] = point.y - perpY;\n\n lastPoint = point;\n }\n }\n\n /**\n * Updates the object transform for rendering\n *\n * @private\n */\n updateTransform()\n {\n if (this.autoUpdate)\n {\n this.refreshVertices();\n }\n this.containerUpdateTransform();\n }\n\n}\n","import * as core from '../../core';\nimport { default as Mesh } from '../Mesh';\n\n/**\n * Renderer dedicated to meshes.\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport default class MeshSpriteRenderer\n{\n /**\n * @param {PIXI.CanvasRenderer} renderer - The renderer this downport works for\n */\n constructor(renderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Renders the Mesh\n *\n * @param {PIXI.mesh.Mesh} mesh - the Mesh to render\n */\n render(mesh)\n {\n const renderer = this.renderer;\n const context = renderer.context;\n\n const transform = mesh.worldTransform;\n const res = renderer.resolution;\n\n if (renderer.roundPixels)\n {\n context.setTransform(\n transform.a * res,\n transform.b * res,\n transform.c * res,\n transform.d * res,\n (transform.tx * res) | 0,\n (transform.ty * res) | 0\n );\n }\n else\n {\n context.setTransform(\n transform.a * res,\n transform.b * res,\n transform.c * res,\n transform.d * res,\n transform.tx * res,\n transform.ty * res\n );\n }\n\n renderer.context.globalAlpha = mesh.worldAlpha;\n renderer.setBlendMode(mesh.blendMode);\n\n if (mesh.drawMode === Mesh.DRAW_MODES.TRIANGLE_MESH)\n {\n this._renderTriangleMesh(mesh);\n }\n else\n {\n this._renderTriangles(mesh);\n }\n }\n\n /**\n * Draws the object in Triangle Mesh mode\n *\n * @private\n * @param {PIXI.mesh.Mesh} mesh - the Mesh to render\n */\n _renderTriangleMesh(mesh)\n {\n // draw triangles!!\n const length = mesh.vertices.length / 2;\n\n for (let i = 0; i < length - 2; i++)\n {\n // draw some triangles!\n const index = i * 2;\n\n this._renderDrawTriangle(mesh, index, (index + 2), (index + 4));\n }\n }\n\n /**\n * Draws the object in triangle mode using canvas\n *\n * @private\n * @param {PIXI.mesh.Mesh} mesh - the current mesh\n */\n _renderTriangles(mesh)\n {\n // draw triangles!!\n const indices = mesh.indices;\n const length = indices.length;\n\n for (let i = 0; i < length; i += 3)\n {\n // draw some triangles!\n const index0 = indices[i] * 2;\n const index1 = indices[i + 1] * 2;\n const index2 = indices[i + 2] * 2;\n\n this._renderDrawTriangle(mesh, index0, index1, index2);\n }\n }\n\n /**\n * Draws one of the triangles that from the Mesh\n *\n * @private\n * @param {PIXI.mesh.Mesh} mesh - the current mesh\n * @param {number} index0 - the index of the first vertex\n * @param {number} index1 - the index of the second vertex\n * @param {number} index2 - the index of the third vertex\n */\n _renderDrawTriangle(mesh, index0, index1, index2)\n {\n const context = this.renderer.context;\n const uvs = mesh.uvs;\n const vertices = mesh.vertices;\n const texture = mesh._texture;\n\n if (!texture.valid)\n {\n return;\n }\n\n const base = texture.baseTexture;\n const textureSource = base.source;\n const textureWidth = base.width;\n const textureHeight = base.height;\n\n let u0;\n let u1;\n let u2;\n let v0;\n let v1;\n let v2;\n\n if (mesh.uploadUvTransform)\n {\n const ut = mesh._uvTransform.mapCoord;\n\n u0 = ((uvs[index0] * ut.a) + (uvs[index0 + 1] * ut.c) + ut.tx) * base.width;\n u1 = ((uvs[index1] * ut.a) + (uvs[index1 + 1] * ut.c) + ut.tx) * base.width;\n u2 = ((uvs[index2] * ut.a) + (uvs[index2 + 1] * ut.c) + ut.tx) * base.width;\n v0 = ((uvs[index0] * ut.b) + (uvs[index0 + 1] * ut.d) + ut.ty) * base.height;\n v1 = ((uvs[index1] * ut.b) + (uvs[index1 + 1] * ut.d) + ut.ty) * base.height;\n v2 = ((uvs[index2] * ut.b) + (uvs[index2 + 1] * ut.d) + ut.ty) * base.height;\n }\n else\n {\n u0 = uvs[index0] * base.width;\n u1 = uvs[index1] * base.width;\n u2 = uvs[index2] * base.width;\n v0 = uvs[index0 + 1] * base.height;\n v1 = uvs[index1 + 1] * base.height;\n v2 = uvs[index2 + 1] * base.height;\n }\n\n let x0 = vertices[index0];\n let x1 = vertices[index1];\n let x2 = vertices[index2];\n let y0 = vertices[index0 + 1];\n let y1 = vertices[index1 + 1];\n let y2 = vertices[index2 + 1];\n\n const canvasPadding = mesh.canvasPadding / this.renderer.resolution;\n\n if (canvasPadding > 0)\n {\n const paddingX = canvasPadding / Math.abs(mesh.worldTransform.a);\n const paddingY = canvasPadding / Math.abs(mesh.worldTransform.d);\n const centerX = (x0 + x1 + x2) / 3;\n const centerY = (y0 + y1 + y2) / 3;\n\n let normX = x0 - centerX;\n let normY = y0 - centerY;\n\n let dist = Math.sqrt((normX * normX) + (normY * normY));\n\n x0 = centerX + ((normX / dist) * (dist + paddingX));\n y0 = centerY + ((normY / dist) * (dist + paddingY));\n\n //\n\n normX = x1 - centerX;\n normY = y1 - centerY;\n\n dist = Math.sqrt((normX * normX) + (normY * normY));\n x1 = centerX + ((normX / dist) * (dist + paddingX));\n y1 = centerY + ((normY / dist) * (dist + paddingY));\n\n normX = x2 - centerX;\n normY = y2 - centerY;\n\n dist = Math.sqrt((normX * normX) + (normY * normY));\n x2 = centerX + ((normX / dist) * (dist + paddingX));\n y2 = centerY + ((normY / dist) * (dist + paddingY));\n }\n\n context.save();\n context.beginPath();\n\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n\n context.closePath();\n\n context.clip();\n\n // Compute matrix transform\n const delta = (u0 * v1) + (v0 * u2) + (u1 * v2) - (v1 * u2) - (v0 * u1) - (u0 * v2);\n const deltaA = (x0 * v1) + (v0 * x2) + (x1 * v2) - (v1 * x2) - (v0 * x1) - (x0 * v2);\n const deltaB = (u0 * x1) + (x0 * u2) + (u1 * x2) - (x1 * u2) - (x0 * u1) - (u0 * x2);\n const deltaC = (u0 * v1 * x2) + (v0 * x1 * u2) + (x0 * u1 * v2) - (x0 * v1 * u2) - (v0 * u1 * x2) - (u0 * x1 * v2);\n const deltaD = (y0 * v1) + (v0 * y2) + (y1 * v2) - (v1 * y2) - (v0 * y1) - (y0 * v2);\n const deltaE = (u0 * y1) + (y0 * u2) + (u1 * y2) - (y1 * u2) - (y0 * u1) - (u0 * y2);\n const deltaF = (u0 * v1 * y2) + (v0 * y1 * u2) + (y0 * u1 * v2) - (y0 * v1 * u2) - (v0 * u1 * y2) - (u0 * y1 * v2);\n\n context.transform(\n deltaA / delta,\n deltaD / delta,\n deltaB / delta,\n deltaE / delta,\n deltaC / delta,\n deltaF / delta\n );\n\n context.drawImage(\n textureSource,\n 0,\n 0,\n textureWidth * base.resolution,\n textureHeight * base.resolution,\n 0,\n 0,\n textureWidth,\n textureHeight\n );\n\n context.restore();\n this.renderer.invalidateBlendMode();\n }\n\n /**\n * Renders a flat Mesh\n *\n * @private\n * @param {PIXI.mesh.Mesh} mesh - The Mesh to render\n */\n renderMeshFlat(mesh)\n {\n const context = this.renderer.context;\n const vertices = mesh.vertices;\n const length = vertices.length / 2;\n\n // this.count++;\n\n context.beginPath();\n\n for (let i = 1; i < length - 2; ++i)\n {\n // draw some triangles!\n const index = i * 2;\n\n const x0 = vertices[index];\n const y0 = vertices[index + 1];\n\n const x1 = vertices[index + 2];\n const y1 = vertices[index + 3];\n\n const x2 = vertices[index + 4];\n const y2 = vertices[index + 5];\n\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n }\n\n context.fillStyle = '#FF0000';\n context.fill();\n context.closePath();\n }\n\n /**\n * destroy the the renderer.\n *\n */\n destroy()\n {\n this.renderer = null;\n }\n}\n\ncore.CanvasRenderer.registerPlugin('mesh', MeshSpriteRenderer);\n","/**\n * @namespace PIXI.mesh\n */\nexport { default as Mesh } from './Mesh';\nexport { default as MeshRenderer } from './webgl/MeshRenderer';\nexport { default as CanvasMeshRenderer } from './canvas/CanvasMeshRenderer';\nexport { default as Plane } from './Plane';\nexport { default as NineSlicePlane } from './NineSlicePlane';\nexport { default as Rope } from './Rope';\n","import * as core from '../../core';\nimport glCore from 'pixi-gl-core';\nimport { default as Mesh } from '../Mesh';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\n\nconst matrixIdentity = core.Matrix.IDENTITY;\n\n/**\n * WebGL renderer plugin for tiling sprites\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nexport default class MeshRenderer extends core.ObjectRenderer\n{\n\n /**\n * constructor for renderer\n *\n * @param {WebGLRenderer} renderer The renderer this tiling awesomeness works for.\n */\n constructor(renderer)\n {\n super(renderer);\n\n this.shader = null;\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n */\n onContextChange()\n {\n const gl = this.renderer.gl;\n\n this.shader = new core.Shader(gl,\n readFileSync(join(__dirname, './mesh.vert'), 'utf8'),\n readFileSync(join(__dirname, './mesh.frag'), 'utf8'));\n }\n\n /**\n * renders mesh\n *\n * @param {PIXI.mesh.Mesh} mesh mesh instance\n */\n render(mesh)\n {\n const renderer = this.renderer;\n const gl = renderer.gl;\n const texture = mesh._texture;\n\n if (!texture.valid)\n {\n return;\n }\n\n let glData = mesh._glDatas[renderer.CONTEXT_UID];\n\n if (!glData)\n {\n renderer.bindVao(null);\n\n glData = {\n shader: this.shader,\n vertexBuffer: glCore.GLBuffer.createVertexBuffer(gl, mesh.vertices, gl.STREAM_DRAW),\n uvBuffer: glCore.GLBuffer.createVertexBuffer(gl, mesh.uvs, gl.STREAM_DRAW),\n indexBuffer: glCore.GLBuffer.createIndexBuffer(gl, mesh.indices, gl.STATIC_DRAW),\n // build the vao object that will render..\n vao: null,\n dirty: mesh.dirty,\n indexDirty: mesh.indexDirty,\n vertexDirty: mesh.vertexDirty,\n };\n\n // build the vao object that will render..\n glData.vao = new glCore.VertexArrayObject(gl)\n .addIndex(glData.indexBuffer)\n .addAttribute(glData.vertexBuffer, glData.shader.attributes.aVertexPosition, gl.FLOAT, false, 2 * 4, 0)\n .addAttribute(glData.uvBuffer, glData.shader.attributes.aTextureCoord, gl.FLOAT, false, 2 * 4, 0);\n\n mesh._glDatas[renderer.CONTEXT_UID] = glData;\n }\n\n renderer.bindVao(glData.vao);\n\n if (mesh.dirty !== glData.dirty)\n {\n glData.dirty = mesh.dirty;\n glData.uvBuffer.upload(mesh.uvs);\n }\n\n if (mesh.indexDirty !== glData.indexDirty)\n {\n glData.indexDirty = mesh.indexDirty;\n glData.indexBuffer.upload(mesh.indices);\n }\n\n if (mesh.vertexDirty !== glData.vertexDirty)\n {\n glData.vertexDirty = mesh.vertexDirty;\n glData.vertexBuffer.upload(mesh.vertices);\n }\n\n renderer.bindShader(glData.shader);\n\n glData.shader.uniforms.uSampler = renderer.bindTexture(texture);\n\n renderer.state.setBlendMode(core.utils.correctBlendMode(mesh.blendMode, texture.baseTexture.premultipliedAlpha));\n\n if (glData.shader.uniforms.uTransform)\n {\n if (mesh.uploadUvTransform)\n {\n glData.shader.uniforms.uTransform = mesh._uvTransform.mapCoord.toArray(true);\n }\n else\n {\n glData.shader.uniforms.uTransform = matrixIdentity.toArray(true);\n }\n }\n glData.shader.uniforms.translationMatrix = mesh.worldTransform.toArray(true);\n\n glData.shader.uniforms.uColor = core.utils.premultiplyRgba(mesh.tintRgb,\n mesh.worldAlpha, glData.shader.uniforms.uColor, texture.baseTexture.premultipliedAlpha);\n\n const drawMode = mesh.drawMode === Mesh.DRAW_MODES.TRIANGLE_MESH ? gl.TRIANGLE_STRIP : gl.TRIANGLES;\n\n glData.vao.draw(drawMode, mesh.indices.length, 0);\n }\n}\n\ncore.WebGLRenderer.registerPlugin('mesh', MeshRenderer);\n","import * as core from '../core';\nimport { hex2rgb } from '../core/utils';\n\n/**\n * The ParticleContainer class is a really fast version of the Container built solely for speed,\n * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced\n * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation)\n * and some advanced functionality like tint (as of v4.5.6).\n * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch.\n *\n * It's extremely easy to use :\n *\n * ```js\n * let container = new ParticleContainer();\n *\n * for (let i = 0; i < 100; ++i)\n * {\n * let sprite = new PIXI.Sprite.fromImage(\"myImage.png\");\n * container.addChild(sprite);\n * }\n * ```\n *\n * And here you have a hundred sprites that will be rendered at the speed of light.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI.particles\n */\nexport default class ParticleContainer extends core.Container\n{\n /**\n * @param {number} [maxSize=1500] - The maximum number of particles that can be rendered by the container.\n * Affects size of allocated buffers.\n * @param {object} [properties] - The properties of children that should be uploaded to the gpu and applied.\n * @param {boolean} [properties.vertices=false] - When true, vertices be uploaded and applied.\n * if sprite's ` scale/anchor/trim/frame/orig` is dynamic, please set `true`.\n * @param {boolean} [properties.position=true] - When true, position be uploaded and applied.\n * @param {boolean} [properties.rotation=false] - When true, rotation be uploaded and applied.\n * @param {boolean} [properties.uvs=false] - When true, uvs be uploaded and applied.\n * @param {boolean} [properties.tint=false] - When true, alpha and tint be uploaded and applied.\n * @param {number} [batchSize=16384] - Number of particles per batch. If less than maxSize, it uses maxSize instead.\n * @param {boolean} [autoResize=false] If true, container allocates more batches in case\n * there are more than `maxSize` particles.\n */\n constructor(maxSize = 1500, properties, batchSize = 16384, autoResize = false)\n {\n super();\n\n // Making sure the batch size is valid\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n const maxBatchSize = 16384;\n\n if (batchSize > maxBatchSize)\n {\n batchSize = maxBatchSize;\n }\n\n if (batchSize > maxSize)\n {\n batchSize = maxSize;\n }\n\n /**\n * Set properties to be dynamic (true) / static (false)\n *\n * @member {boolean[]}\n * @private\n */\n this._properties = [false, true, false, false, false];\n\n /**\n * @member {number}\n * @private\n */\n this._maxSize = maxSize;\n\n /**\n * @member {number}\n * @private\n */\n this._batchSize = batchSize;\n\n /**\n * @member {object<number, WebGLBuffer>}\n * @private\n */\n this._glBuffers = {};\n\n /**\n * for every batch stores _updateID corresponding to the last change in that batch\n * @member {number[]}\n * @private\n */\n this._bufferUpdateIDs = [];\n\n /**\n * when child inserted, removed or changes position this number goes up\n * @member {number[]}\n * @private\n */\n this._updateID = 0;\n\n /**\n * @member {boolean}\n *\n */\n this.interactiveChildren = false;\n\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL`\n * to reset the blend mode.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL\n * @see PIXI.BLEND_MODES\n */\n this.blendMode = core.BLEND_MODES.NORMAL;\n\n /**\n * If true, container allocates more batches in case there are more than `maxSize` particles.\n * @member {boolean}\n * @default false\n */\n this.autoResize = autoResize;\n\n /**\n * Used for canvas renderering. If true then the elements will be positioned at the\n * nearest pixel. This provides a nice speed boost.\n *\n * @member {boolean}\n * @default true;\n */\n this.roundPixels = true;\n\n /**\n * The texture used to render the children.\n *\n * @readonly\n * @member {BaseTexture}\n */\n this.baseTexture = null;\n\n this.setProperties(properties);\n\n /**\n * The tint applied to the container.\n * This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @member {number}\n * @default 0xFFFFFF\n */\n this._tint = 0;\n this.tintRgb = new Float32Array(4);\n this.tint = 0xFFFFFF;\n }\n\n /**\n * Sets the private properties array to dynamic / static based on the passed properties object\n *\n * @param {object} properties - The properties to be uploaded\n */\n setProperties(properties)\n {\n if (properties)\n {\n this._properties[0] = 'vertices' in properties || 'scale' in properties\n ? !!properties.vertices || !!properties.scale : this._properties[0];\n this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1];\n this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2];\n this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3];\n this._properties[4] = 'tint' in properties || 'alpha' in properties\n ? !!properties.tint || !!properties.alpha : this._properties[4];\n }\n }\n\n /**\n * Updates the object transform for rendering\n *\n * @private\n */\n updateTransform()\n {\n // TODO don't need to!\n this.displayObjectUpdateTransform();\n // PIXI.Container.prototype.updateTransform.call( this );\n }\n\n /**\n * The tint applied to the container. This is a hex value.\n * A value of 0xFFFFFF will remove any tint effect.\n ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer.\n * @member {number}\n * @default 0xFFFFFF\n */\n get tint()\n {\n return this._tint;\n }\n\n set tint(value) // eslint-disable-line require-jsdoc\n {\n this._tint = value;\n hex2rgb(value, this.tintRgb);\n }\n\n /**\n * Renders the container using the WebGL renderer\n *\n * @private\n * @param {PIXI.WebGLRenderer} renderer - The webgl renderer\n */\n renderWebGL(renderer)\n {\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)\n {\n return;\n }\n\n if (!this.baseTexture)\n {\n this.baseTexture = this.children[0]._texture.baseTexture;\n if (!this.baseTexture.hasLoaded)\n {\n this.baseTexture.once('update', () => this.onChildrenChange(0));\n }\n }\n\n renderer.setObjectRenderer(renderer.plugins.particle);\n renderer.plugins.particle.render(this);\n }\n\n /**\n * Set the flag that static data should be updated to true\n *\n * @private\n * @param {number} smallestChildIndex - The smallest child index\n */\n onChildrenChange(smallestChildIndex)\n {\n const bufferIndex = Math.floor(smallestChildIndex / this._batchSize);\n\n while (this._bufferUpdateIDs.length < bufferIndex)\n {\n this._bufferUpdateIDs.push(0);\n }\n this._bufferUpdateIDs[bufferIndex] = ++this._updateID;\n }\n\n /**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer\n */\n renderCanvas(renderer)\n {\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)\n {\n return;\n }\n\n const context = renderer.context;\n const transform = this.worldTransform;\n let isRotated = true;\n\n let positionX = 0;\n let positionY = 0;\n\n let finalWidth = 0;\n let finalHeight = 0;\n\n renderer.setBlendMode(this.blendMode);\n\n context.globalAlpha = this.worldAlpha;\n\n this.displayObjectUpdateTransform();\n\n for (let i = 0; i < this.children.length; ++i)\n {\n const child = this.children[i];\n\n if (!child.visible)\n {\n continue;\n }\n\n const frame = child._texture.frame;\n\n context.globalAlpha = this.worldAlpha * child.alpha;\n\n if (child.rotation % (Math.PI * 2) === 0)\n {\n // this is the fastest way to optimise! - if rotation is 0 then we can avoid any kind of setTransform call\n if (isRotated)\n {\n context.setTransform(\n transform.a,\n transform.b,\n transform.c,\n transform.d,\n transform.tx * renderer.resolution,\n transform.ty * renderer.resolution\n );\n\n isRotated = false;\n }\n\n positionX = ((child.anchor.x) * (-frame.width * child.scale.x)) + child.position.x + 0.5;\n positionY = ((child.anchor.y) * (-frame.height * child.scale.y)) + child.position.y + 0.5;\n\n finalWidth = frame.width * child.scale.x;\n finalHeight = frame.height * child.scale.y;\n }\n else\n {\n if (!isRotated)\n {\n isRotated = true;\n }\n\n child.displayObjectUpdateTransform();\n\n const childTransform = child.worldTransform;\n\n if (renderer.roundPixels)\n {\n context.setTransform(\n childTransform.a,\n childTransform.b,\n childTransform.c,\n childTransform.d,\n (childTransform.tx * renderer.resolution) | 0,\n (childTransform.ty * renderer.resolution) | 0\n );\n }\n else\n {\n context.setTransform(\n childTransform.a,\n childTransform.b,\n childTransform.c,\n childTransform.d,\n childTransform.tx * renderer.resolution,\n childTransform.ty * renderer.resolution\n );\n }\n\n positionX = ((child.anchor.x) * (-frame.width)) + 0.5;\n positionY = ((child.anchor.y) * (-frame.height)) + 0.5;\n\n finalWidth = frame.width;\n finalHeight = frame.height;\n }\n\n const resolution = child._texture.baseTexture.resolution;\n\n context.drawImage(\n child._texture.baseTexture.source,\n frame.x * resolution,\n frame.y * resolution,\n frame.width * resolution,\n frame.height * resolution,\n positionX * renderer.resolution,\n positionY * renderer.resolution,\n finalWidth * renderer.resolution,\n finalHeight * renderer.resolution\n );\n }\n }\n\n /**\n * Destroys the container\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their\n * destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options)\n {\n super.destroy(options);\n\n if (this._buffers)\n {\n for (let i = 0; i < this._buffers.length; ++i)\n {\n this._buffers[i].destroy();\n }\n }\n\n this._properties = null;\n this._buffers = null;\n this._bufferUpdateIDs = null;\n }\n}\n","/**\n * @namespace PIXI.particles\n */\nexport { default as ParticleContainer } from './ParticleContainer';\nexport { default as ParticleRenderer } from './webgl/ParticleRenderer';\n","import glCore from 'pixi-gl-core';\nimport createIndicesForQuads from '../../core/utils/createIndicesForQuads';\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers <mattdesl> https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that\n * they now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleBuffer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java\n */\n\n/**\n * The particle buffer manages the static and dynamic buffers for a particle container.\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport default class ParticleBuffer\n{\n /**\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {object} properties - The properties to upload.\n * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic.\n * @param {number} size - The size of the batch.\n */\n constructor(gl, properties, dynamicPropertyFlags, size)\n {\n /**\n * The current WebGL drawing context.\n *\n * @member {WebGLRenderingContext}\n */\n this.gl = gl;\n\n /**\n * The number of particles the buffer can hold\n *\n * @member {number}\n */\n this.size = size;\n\n /**\n * A list of the properties that are dynamic.\n *\n * @member {object[]}\n */\n this.dynamicProperties = [];\n\n /**\n * A list of the properties that are static.\n *\n * @member {object[]}\n */\n this.staticProperties = [];\n\n for (let i = 0; i < properties.length; ++i)\n {\n let property = properties[i];\n\n // Make copy of properties object so that when we edit the offset it doesn't\n // change all other instances of the object literal\n property = {\n attribute: property.attribute,\n size: property.size,\n uploadFunction: property.uploadFunction,\n unsignedByte: property.unsignedByte,\n offset: property.offset,\n };\n\n if (dynamicPropertyFlags[i])\n {\n this.dynamicProperties.push(property);\n }\n else\n {\n this.staticProperties.push(property);\n }\n }\n\n this.staticStride = 0;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n\n this.dynamicStride = 0;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this._updateID = 0;\n\n this.initBuffers();\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n */\n initBuffers()\n {\n const gl = this.gl;\n let dynamicOffset = 0;\n\n /**\n * Holds the indices of the geometry (quads) to draw\n *\n * @member {Uint16Array}\n */\n this.indices = createIndicesForQuads(this.size);\n this.indexBuffer = glCore.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW);\n\n this.dynamicStride = 0;\n\n for (let i = 0; i < this.dynamicProperties.length; ++i)\n {\n const property = this.dynamicProperties[i];\n\n property.offset = dynamicOffset;\n dynamicOffset += property.size;\n this.dynamicStride += property.size;\n }\n\n const dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4);\n\n this.dynamicData = new Float32Array(dynBuffer);\n this.dynamicDataUint32 = new Uint32Array(dynBuffer);\n this.dynamicBuffer = glCore.GLBuffer.createVertexBuffer(gl, dynBuffer, gl.STREAM_DRAW);\n\n // static //\n let staticOffset = 0;\n\n this.staticStride = 0;\n\n for (let i = 0; i < this.staticProperties.length; ++i)\n {\n const property = this.staticProperties[i];\n\n property.offset = staticOffset;\n staticOffset += property.size;\n this.staticStride += property.size;\n }\n\n const statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4);\n\n this.staticData = new Float32Array(statBuffer);\n this.staticDataUint32 = new Uint32Array(statBuffer);\n this.staticBuffer = glCore.GLBuffer.createVertexBuffer(gl, statBuffer, gl.STATIC_DRAW);\n\n this.vao = new glCore.VertexArrayObject(gl)\n .addIndex(this.indexBuffer);\n\n for (let i = 0; i < this.dynamicProperties.length; ++i)\n {\n const property = this.dynamicProperties[i];\n\n if (property.unsignedByte)\n {\n this.vao.addAttribute(\n this.dynamicBuffer,\n property.attribute,\n gl.UNSIGNED_BYTE,\n true,\n this.dynamicStride * 4,\n property.offset * 4\n );\n }\n else\n {\n this.vao.addAttribute(\n this.dynamicBuffer,\n property.attribute,\n gl.FLOAT,\n false,\n this.dynamicStride * 4,\n property.offset * 4\n );\n }\n }\n\n for (let i = 0; i < this.staticProperties.length; ++i)\n {\n const property = this.staticProperties[i];\n\n if (property.unsignedByte)\n {\n this.vao.addAttribute(\n this.staticBuffer,\n property.attribute,\n gl.UNSIGNED_BYTE,\n true,\n this.staticStride * 4,\n property.offset * 4\n );\n }\n else\n {\n this.vao.addAttribute(\n this.staticBuffer,\n property.attribute,\n gl.FLOAT,\n false,\n this.staticStride * 4,\n property.offset * 4\n );\n }\n }\n }\n\n /**\n * Uploads the dynamic properties.\n *\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n uploadDynamic(children, startIndex, amount)\n {\n for (let i = 0; i < this.dynamicProperties.length; i++)\n {\n const property = this.dynamicProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.unsignedByte ? this.dynamicDataUint32 : this.dynamicData,\n this.dynamicStride, property.offset);\n }\n\n this.dynamicBuffer.upload();\n }\n\n /**\n * Uploads the static properties.\n *\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n uploadStatic(children, startIndex, amount)\n {\n for (let i = 0; i < this.staticProperties.length; i++)\n {\n const property = this.staticProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.unsignedByte ? this.staticDataUint32 : this.staticData,\n this.staticStride, property.offset);\n }\n\n this.staticBuffer.upload();\n }\n\n /**\n * Destroys the ParticleBuffer.\n *\n */\n destroy()\n {\n this.dynamicProperties = null;\n this.dynamicBuffer.destroy();\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this.staticProperties = null;\n this.staticBuffer.destroy();\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n }\n\n}\n","import * as core from '../../core';\nimport ParticleShader from './ParticleShader';\nimport ParticleBuffer from './ParticleBuffer';\nimport { premultiplyTint } from '../../core/utils';\n\n/**\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers <mattdesl> https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now\n * share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java\n */\n\n/**\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport default class ParticleRenderer extends core.ObjectRenderer\n{\n /**\n * @param {PIXI.WebGLRenderer} renderer - The renderer this sprite batch works for.\n */\n constructor(renderer)\n {\n super(renderer);\n\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n // and max number of element in the index buffer is 16384 * 6 = 98304\n // Creating a full index buffer, overhead is 98304 * 2 = 196Ko\n // let numIndices = 98304;\n\n /**\n * The default shader that is used if a sprite doesn't have a more specific one.\n *\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n this.indexBuffer = null;\n\n this.properties = null;\n\n this.tempMatrix = new core.Matrix();\n\n this.CONTEXT_UID = 0;\n }\n\n /**\n * When there is a WebGL context change\n *\n * @private\n */\n onContextChange()\n {\n const gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // setup default shader\n this.shader = new ParticleShader(gl);\n\n this.properties = [\n // verticesData\n {\n attribute: this.shader.attributes.aVertexPosition,\n size: 2,\n uploadFunction: this.uploadVertices,\n offset: 0,\n },\n // positionData\n {\n attribute: this.shader.attributes.aPositionCoord,\n size: 2,\n uploadFunction: this.uploadPosition,\n offset: 0,\n },\n // rotationData\n {\n attribute: this.shader.attributes.aRotation,\n size: 1,\n uploadFunction: this.uploadRotation,\n offset: 0,\n },\n // uvsData\n {\n attribute: this.shader.attributes.aTextureCoord,\n size: 2,\n uploadFunction: this.uploadUvs,\n offset: 0,\n },\n // tintData\n {\n attribute: this.shader.attributes.aColor,\n size: 1,\n unsignedByte: true,\n uploadFunction: this.uploadTint,\n offset: 0,\n },\n ];\n }\n\n /**\n * Starts a new particle batch.\n *\n */\n start()\n {\n this.renderer.bindShader(this.shader);\n }\n\n /**\n * Renders the particle container object.\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n */\n render(container)\n {\n const children = container.children;\n const maxSize = container._maxSize;\n const batchSize = container._batchSize;\n const renderer = this.renderer;\n let totalChildren = children.length;\n\n if (totalChildren === 0)\n {\n return;\n }\n else if (totalChildren > maxSize)\n {\n totalChildren = maxSize;\n }\n\n let buffers = container._glBuffers[renderer.CONTEXT_UID];\n\n if (!buffers)\n {\n buffers = container._glBuffers[renderer.CONTEXT_UID] = this.generateBuffers(container);\n }\n\n const baseTexture = children[0]._texture.baseTexture;\n\n // if the uvs have not updated then no point rendering just yet!\n this.renderer.setBlendMode(core.utils.correctBlendMode(container.blendMode, baseTexture.premultipliedAlpha));\n\n const gl = renderer.gl;\n\n const m = container.worldTransform.copy(this.tempMatrix);\n\n m.prepend(renderer._activeRenderTarget.projectionMatrix);\n\n this.shader.uniforms.projectionMatrix = m.toArray(true);\n\n this.shader.uniforms.uColor = core.utils.premultiplyRgba(container.tintRgb,\n container.worldAlpha, this.shader.uniforms.uColor, baseTexture.premultipliedAlpha);\n\n // make sure the texture is bound..\n this.shader.uniforms.uSampler = renderer.bindTexture(baseTexture);\n\n let updateStatic = false;\n\n // now lets upload and render the buffers..\n for (let i = 0, j = 0; i < totalChildren; i += batchSize, j += 1)\n {\n let amount = (totalChildren - i);\n\n if (amount > batchSize)\n {\n amount = batchSize;\n }\n\n if (j >= buffers.length)\n {\n if (!container.autoResize)\n {\n break;\n }\n buffers.push(this._generateOneMoreBuffer(container));\n }\n\n const buffer = buffers[j];\n\n // we always upload the dynamic\n buffer.uploadDynamic(children, i, amount);\n\n const bid = container._bufferUpdateIDs[j] || 0;\n\n updateStatic = updateStatic || (buffer._updateID < bid);\n // we only upload the static content when we have to!\n if (updateStatic)\n {\n buffer._updateID = container._updateID;\n buffer.uploadStatic(children, i, amount);\n }\n\n // bind the buffer\n renderer.bindVao(buffer.vao);\n buffer.vao.draw(gl.TRIANGLES, amount * 6);\n }\n }\n\n /**\n * Creates one particle buffer for each child in the container we want to render and updates internal properties\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer[]} The buffers\n */\n generateBuffers(container)\n {\n const gl = this.renderer.gl;\n const buffers = [];\n const size = container._maxSize;\n const batchSize = container._batchSize;\n const dynamicPropertyFlags = container._properties;\n\n for (let i = 0; i < size; i += batchSize)\n {\n buffers.push(new ParticleBuffer(gl, this.properties, dynamicPropertyFlags, batchSize));\n }\n\n return buffers;\n }\n\n /**\n * Creates one more particle buffer, because container has autoResize feature\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer} generated buffer\n * @private\n */\n _generateOneMoreBuffer(container)\n {\n const gl = this.renderer.gl;\n const batchSize = container._batchSize;\n const dynamicPropertyFlags = container._properties;\n\n return new ParticleBuffer(gl, this.properties, dynamicPropertyFlags, batchSize);\n }\n\n /**\n * Uploads the verticies.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their vertices uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n uploadVertices(children, startIndex, amount, array, stride, offset)\n {\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n for (let i = 0; i < amount; ++i)\n {\n const sprite = children[startIndex + i];\n const texture = sprite._texture;\n const sx = sprite.scale.x;\n const sy = sprite.scale.y;\n const trim = texture.trim;\n const orig = texture.orig;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the\n // extra space before transforming the sprite coords..\n w1 = trim.x - (sprite.anchor.x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (sprite.anchor.y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w0 = (orig.width) * (1 - sprite.anchor.x);\n w1 = (orig.width) * -sprite.anchor.x;\n\n h0 = orig.height * (1 - sprite.anchor.y);\n h1 = orig.height * -sprite.anchor.y;\n }\n\n array[offset] = w1 * sx;\n array[offset + 1] = h1 * sy;\n\n array[offset + stride] = w0 * sx;\n array[offset + stride + 1] = h1 * sy;\n\n array[offset + (stride * 2)] = w0 * sx;\n array[offset + (stride * 2) + 1] = h0 * sy;\n\n array[offset + (stride * 3)] = w1 * sx;\n array[offset + (stride * 3) + 1] = h0 * sy;\n\n offset += stride * 4;\n }\n }\n\n /**\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their positions uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n uploadPosition(children, startIndex, amount, array, stride, offset)\n {\n for (let i = 0; i < amount; i++)\n {\n const spritePosition = children[startIndex + i].position;\n\n array[offset] = spritePosition.x;\n array[offset + 1] = spritePosition.y;\n\n array[offset + stride] = spritePosition.x;\n array[offset + stride + 1] = spritePosition.y;\n\n array[offset + (stride * 2)] = spritePosition.x;\n array[offset + (stride * 2) + 1] = spritePosition.y;\n\n array[offset + (stride * 3)] = spritePosition.x;\n array[offset + (stride * 3) + 1] = spritePosition.y;\n\n offset += stride * 4;\n }\n }\n\n /**\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n uploadRotation(children, startIndex, amount, array, stride, offset)\n {\n for (let i = 0; i < amount; i++)\n {\n const spriteRotation = children[startIndex + i].rotation;\n\n array[offset] = spriteRotation;\n array[offset + stride] = spriteRotation;\n array[offset + (stride * 2)] = spriteRotation;\n array[offset + (stride * 3)] = spriteRotation;\n\n offset += stride * 4;\n }\n }\n\n /**\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n uploadUvs(children, startIndex, amount, array, stride, offset)\n {\n for (let i = 0; i < amount; ++i)\n {\n const textureUvs = children[startIndex + i]._texture._uvs;\n\n if (textureUvs)\n {\n array[offset] = textureUvs.x0;\n array[offset + 1] = textureUvs.y0;\n\n array[offset + stride] = textureUvs.x1;\n array[offset + stride + 1] = textureUvs.y1;\n\n array[offset + (stride * 2)] = textureUvs.x2;\n array[offset + (stride * 2) + 1] = textureUvs.y2;\n\n array[offset + (stride * 3)] = textureUvs.x3;\n array[offset + (stride * 3) + 1] = textureUvs.y3;\n\n offset += stride * 4;\n }\n else\n {\n // TODO you know this can be easier!\n array[offset] = 0;\n array[offset + 1] = 0;\n\n array[offset + stride] = 0;\n array[offset + stride + 1] = 0;\n\n array[offset + (stride * 2)] = 0;\n array[offset + (stride * 2) + 1] = 0;\n\n array[offset + (stride * 3)] = 0;\n array[offset + (stride * 3) + 1] = 0;\n\n offset += stride * 4;\n }\n }\n }\n\n /**\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n uploadTint(children, startIndex, amount, array, stride, offset)\n {\n for (let i = 0; i < amount; ++i)\n {\n const sprite = children[startIndex + i];\n const premultiplied = sprite._texture.baseTexture.premultipliedAlpha;\n const alpha = sprite.alpha;\n // we dont call extra function if alpha is 1.0, that's faster\n const argb = alpha < 1.0 && premultiplied ? premultiplyTint(sprite._tintRGB, alpha)\n : sprite._tintRGB + (alpha * 255 << 24);\n\n array[offset] = argb;\n array[offset + stride] = argb;\n array[offset + (stride * 2)] = argb;\n array[offset + (stride * 3)] = argb;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Destroys the ParticleRenderer.\n *\n */\n destroy()\n {\n if (this.renderer.gl)\n {\n this.renderer.gl.deleteBuffer(this.indexBuffer);\n }\n\n super.destroy();\n\n this.shader.destroy();\n\n this.indices = null;\n this.tempMatrix = null;\n }\n\n}\n\ncore.WebGLRenderer.registerPlugin('particle', ParticleRenderer);\n","import Shader from '../../core/Shader';\n\n/**\n * @class\n * @extends PIXI.Shader\n * @memberof PIXI\n */\nexport default class ParticleShader extends Shader\n{\n /**\n * @param {PIXI.Shader} gl - The webgl shader manager this shader works for.\n */\n constructor(gl)\n {\n super(\n gl,\n // vertex shader\n [\n 'attribute vec2 aVertexPosition;',\n 'attribute vec2 aTextureCoord;',\n 'attribute vec4 aColor;',\n\n 'attribute vec2 aPositionCoord;',\n 'attribute float aRotation;',\n\n 'uniform mat3 projectionMatrix;',\n 'uniform vec4 uColor;',\n\n 'varying vec2 vTextureCoord;',\n 'varying vec4 vColor;',\n\n 'void main(void){',\n ' float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);',\n ' float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);',\n\n ' vec2 v = vec2(x, y);',\n ' v = v + aPositionCoord;',\n\n ' gl_Position = vec4((projectionMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);',\n\n ' vTextureCoord = aTextureCoord;',\n ' vColor = aColor * uColor;',\n '}',\n ].join('\\n'),\n // hello\n [\n 'varying vec2 vTextureCoord;',\n 'varying vec4 vColor;',\n\n 'uniform sampler2D uSampler;',\n\n 'void main(void){',\n ' vec4 color = texture2D(uSampler, vTextureCoord) * vColor;',\n ' gl_FragColor = color;',\n '}',\n ].join('\\n')\n );\n }\n}\n","// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign\n\nif (!Math.sign)\n{\n Math.sign = function mathSign(x)\n {\n x = Number(x);\n\n if (x === 0 || isNaN(x))\n {\n return x;\n }\n\n return x > 0 ? 1 : -1;\n };\n}\n","// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger\n\nif (!Number.isInteger)\n{\n Number.isInteger = function numberIsInteger(value)\n {\n return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;\n };\n}\n","// References:\n// https://github.com/sindresorhus/object-assign\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n\nimport objectAssign from 'object-assign';\n\nif (!Object.assign)\n{\n Object.assign = objectAssign;\n}\n","import './Object.assign';\nimport './requestAnimationFrame';\nimport './Math.sign';\nimport './Number.isInteger';\n\nif (!window.ArrayBuffer)\n{\n window.ArrayBuffer = Array;\n}\n\nif (!window.Float32Array)\n{\n window.Float32Array = Array;\n}\n\nif (!window.Uint32Array)\n{\n window.Uint32Array = Array;\n}\n\nif (!window.Uint16Array)\n{\n window.Uint16Array = Array;\n}\n","// References:\n// http://paulirish.com/2011/requestanimationframe-for-smart-animating/\n// https://gist.github.com/1579671\n// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision\n// https://gist.github.com/timhall/4078614\n// https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame\n\n// Expected to be used with Browserfiy\n// Browserify automatically detects the use of `global` and passes the\n// correct reference of `global`, `self`, and finally `window`\n\nconst ONE_FRAME_TIME = 16;\n\n// Date.now\nif (!(Date.now && Date.prototype.getTime))\n{\n Date.now = function now()\n {\n return new Date().getTime();\n };\n}\n\n// performance.now\nif (!(global.performance && global.performance.now))\n{\n const startTime = Date.now();\n\n if (!global.performance)\n {\n global.performance = {};\n }\n\n global.performance.now = () => Date.now() - startTime;\n}\n\n// requestAnimationFrame\nlet lastTime = Date.now();\nconst vendors = ['ms', 'moz', 'webkit', 'o'];\n\nfor (let x = 0; x < vendors.length && !global.requestAnimationFrame; ++x)\n{\n const p = vendors[x];\n\n global.requestAnimationFrame = global[`${p}RequestAnimationFrame`];\n global.cancelAnimationFrame = global[`${p}CancelAnimationFrame`] || global[`${p}CancelRequestAnimationFrame`];\n}\n\nif (!global.requestAnimationFrame)\n{\n global.requestAnimationFrame = (callback) =>\n {\n if (typeof callback !== 'function')\n {\n throw new TypeError(`${callback}is not a function`);\n }\n\n const currentTime = Date.now();\n let delay = ONE_FRAME_TIME + lastTime - currentTime;\n\n if (delay < 0)\n {\n delay = 0;\n }\n\n lastTime = currentTime;\n\n return setTimeout(() =>\n {\n lastTime = Date.now();\n callback(performance.now());\n }, delay);\n };\n}\n\nif (!global.cancelAnimationFrame)\n{\n global.cancelAnimationFrame = (id) => clearTimeout(id);\n}\n","import * as core from '../core';\nimport CountLimiter from './limiters/CountLimiter';\nconst SharedTicker = core.ticker.shared;\n\n/**\n * Default number of uploads per frame using prepare plugin.\n *\n * @static\n * @memberof PIXI.settings\n * @name UPLOADS_PER_FRAME\n * @type {number}\n * @default 4\n */\ncore.settings.UPLOADS_PER_FRAME = 4;\n\n/**\n * The prepare manager provides functionality to upload content to the GPU. BasePrepare handles\n * basic queuing functionality and is extended by {@link PIXI.prepare.WebGLPrepare} and {@link PIXI.prepare.CanvasPrepare}\n * to provide preparation capabilities specific to their respective renderers.\n *\n * @example\n * // Create a sprite\n * const sprite = new PIXI.Sprite.fromImage('something.png');\n *\n * // Load object into GPU\n * app.renderer.plugins.prepare.upload(sprite, () => {\n *\n * //Texture(s) has been uploaded to GPU\n * app.stage.addChild(sprite);\n *\n * })\n *\n * @abstract\n * @class\n * @memberof PIXI.prepare\n */\nexport default class BasePrepare\n{\n /**\n * @param {PIXI.SystemRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer)\n {\n /**\n * The limiter to be used to control how quickly items are prepared.\n * @type {PIXI.prepare.CountLimiter|PIXI.prepare.TimeLimiter}\n */\n this.limiter = new CountLimiter(core.settings.UPLOADS_PER_FRAME);\n\n /**\n * Reference to the renderer.\n * @type {PIXI.SystemRenderer}\n * @protected\n */\n this.renderer = renderer;\n\n /**\n * The only real difference between CanvasPrepare and WebGLPrepare is what they pass\n * to upload hooks. That different parameter is stored here.\n * @type {PIXI.prepare.CanvasPrepare|PIXI.WebGLRenderer}\n * @protected\n */\n this.uploadHookHelper = null;\n\n /**\n * Collection of items to uploads at once.\n * @type {Array<*>}\n * @private\n */\n this.queue = [];\n\n /**\n * Collection of additional hooks for finding assets.\n * @type {Array<Function>}\n * @private\n */\n this.addHooks = [];\n\n /**\n * Collection of additional hooks for processing assets.\n * @type {Array<Function>}\n * @private\n */\n this.uploadHooks = [];\n\n /**\n * Callback to call after completed.\n * @type {Array<Function>}\n * @private\n */\n this.completes = [];\n\n /**\n * If prepare is ticking (running).\n * @type {boolean}\n * @private\n */\n this.ticking = false;\n\n /**\n * 'bound' call for prepareItems().\n * @type {Function}\n * @private\n */\n this.delayedTick = () =>\n {\n // unlikely, but in case we were destroyed between tick() and delayedTick()\n if (!this.queue)\n {\n return;\n }\n this.prepareItems();\n };\n\n // hooks to find the correct texture\n this.registerFindHook(findText);\n this.registerFindHook(findTextStyle);\n this.registerFindHook(findMultipleBaseTextures);\n this.registerFindHook(findBaseTexture);\n this.registerFindHook(findTexture);\n\n // upload hooks\n this.registerUploadHook(drawText);\n this.registerUploadHook(calculateTextStyle);\n }\n\n /**\n * Upload all the textures and graphics to the GPU.\n *\n * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item -\n * Either the container or display object to search for items to upload, the items to upload themselves,\n * or the callback function, if items have been added using `prepare.add`.\n * @param {Function} [done] - Optional callback when all queued uploads have completed\n */\n upload(item, done)\n {\n if (typeof item === 'function')\n {\n done = item;\n item = null;\n }\n\n // If a display object, search for items\n // that we could upload\n if (item)\n {\n this.add(item);\n }\n\n // Get the items for upload from the display\n if (this.queue.length)\n {\n if (done)\n {\n this.completes.push(done);\n }\n\n if (!this.ticking)\n {\n this.ticking = true;\n SharedTicker.addOnce(this.tick, this, core.UPDATE_PRIORITY.UTILITY);\n }\n }\n else if (done)\n {\n done();\n }\n }\n\n /**\n * Handle tick update\n *\n * @private\n */\n tick()\n {\n setTimeout(this.delayedTick, 0);\n }\n\n /**\n * Actually prepare items. This is handled outside of the tick because it will take a while\n * and we do NOT want to block the current animation frame from rendering.\n *\n * @private\n */\n prepareItems()\n {\n this.limiter.beginFrame();\n // Upload the graphics\n while (this.queue.length && this.limiter.allowedToUpload())\n {\n const item = this.queue[0];\n let uploaded = false;\n\n if (item && !item._destroyed)\n {\n for (let i = 0, len = this.uploadHooks.length; i < len; i++)\n {\n if (this.uploadHooks[i](this.uploadHookHelper, item))\n {\n this.queue.shift();\n uploaded = true;\n break;\n }\n }\n }\n\n if (!uploaded)\n {\n this.queue.shift();\n }\n }\n\n // We're finished\n if (!this.queue.length)\n {\n this.ticking = false;\n\n const completes = this.completes.slice(0);\n\n this.completes.length = 0;\n\n for (let i = 0, len = completes.length; i < len; i++)\n {\n completes[i]();\n }\n }\n else\n {\n // if we are not finished, on the next rAF do this again\n SharedTicker.addOnce(this.tick, this, core.UPDATE_PRIORITY.UTILITY);\n }\n }\n\n /**\n * Adds hooks for finding items.\n *\n * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array`\n * function must return `true` if it was able to add item to the queue.\n * @return {PIXI.BasePrepare} Instance of plugin for chaining.\n */\n registerFindHook(addHook)\n {\n if (addHook)\n {\n this.addHooks.push(addHook);\n }\n\n return this;\n }\n\n /**\n * Adds hooks for uploading items.\n *\n * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and\n * function must return `true` if it was able to handle upload of item.\n * @return {PIXI.BasePrepare} Instance of plugin for chaining.\n */\n registerUploadHook(uploadHook)\n {\n if (uploadHook)\n {\n this.uploadHooks.push(uploadHook);\n }\n\n return this;\n }\n\n /**\n * Manually add an item to the uploading queue.\n *\n * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to\n * add to the queue\n * @return {PIXI.CanvasPrepare} Instance of plugin for chaining.\n */\n add(item)\n {\n // Add additional hooks for finding elements on special\n // types of objects that\n for (let i = 0, len = this.addHooks.length; i < len; i++)\n {\n if (this.addHooks[i](item, this.queue))\n {\n break;\n }\n }\n\n // Get childen recursively\n if (item instanceof core.Container)\n {\n for (let i = item.children.length - 1; i >= 0; i--)\n {\n this.add(item.children[i]);\n }\n }\n\n return this;\n }\n\n /**\n * Destroys the plugin, don't use after this.\n *\n */\n destroy()\n {\n if (this.ticking)\n {\n SharedTicker.remove(this.tick, this);\n }\n this.ticking = false;\n this.addHooks = null;\n this.uploadHooks = null;\n this.renderer = null;\n this.completes = null;\n this.queue = null;\n this.limiter = null;\n this.uploadHookHelper = null;\n }\n\n}\n\n/**\n * Built-in hook to find multiple textures from objects like AnimatedSprites.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findMultipleBaseTextures(item, queue)\n{\n let result = false;\n\n // Objects with mutliple textures\n if (item && item._textures && item._textures.length)\n {\n for (let i = 0; i < item._textures.length; i++)\n {\n if (item._textures[i] instanceof core.Texture)\n {\n const baseTexture = item._textures[i].baseTexture;\n\n if (queue.indexOf(baseTexture) === -1)\n {\n queue.push(baseTexture);\n result = true;\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Built-in hook to find BaseTextures from Sprites.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findBaseTexture(item, queue)\n{\n // Objects with textures, like Sprites/Text\n if (item instanceof core.BaseTexture)\n {\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find textures from objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Texture object was found.\n */\nfunction findTexture(item, queue)\n{\n if (item._texture && item._texture instanceof core.Texture)\n {\n const texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to draw PIXI.Text to its texture.\n *\n * @private\n * @param {PIXI.WebGLRenderer|PIXI.CanvasPrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction drawText(helper, item)\n{\n if (item instanceof core.Text)\n {\n // updating text will return early if it is not dirty\n item.updateText(true);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to calculate a text style for a PIXI.Text object.\n *\n * @private\n * @param {PIXI.WebGLRenderer|PIXI.CanvasPrepare} helper - Not used by this upload handler\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction calculateTextStyle(helper, item)\n{\n if (item instanceof core.TextStyle)\n {\n const font = item.toFontString();\n\n core.TextMetrics.measureFont(font);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find Text objects.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Text object was found.\n */\nfunction findText(item, queue)\n{\n if (item instanceof core.Text)\n {\n // push the text style to prepare it - this can be really expensive\n if (queue.indexOf(item.style) === -1)\n {\n queue.push(item.style);\n }\n // also push the text object so that we can render it (to canvas/texture) if needed\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n // also push the Text's texture for upload to GPU\n const texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find TextStyle objects.\n *\n * @private\n * @param {PIXI.TextStyle} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.TextStyle object was found.\n */\nfunction findTextStyle(item, queue)\n{\n if (item instanceof core.TextStyle)\n {\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n\n return true;\n }\n\n return false;\n}\n","import * as core from '../../core';\nimport BasePrepare from '../BasePrepare';\n\nconst CANVAS_START_SIZE = 16;\n\n/**\n * The prepare manager provides functionality to upload content to the GPU\n * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing\n * textures to an offline canvas.\n * This draw call will force the texture to be moved onto the GPU.\n *\n * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare\n *\n * @class\n * @extends PIXI.prepare.BasePrepare\n * @memberof PIXI.prepare\n */\nexport default class CanvasPrepare extends BasePrepare\n{\n /**\n * @param {PIXI.CanvasRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer)\n {\n super(renderer);\n\n this.uploadHookHelper = this;\n\n /**\n * An offline canvas to render textures to\n * @type {HTMLCanvasElement}\n * @private\n */\n this.canvas = document.createElement('canvas');\n this.canvas.width = CANVAS_START_SIZE;\n this.canvas.height = CANVAS_START_SIZE;\n\n /**\n * The context to the canvas\n * @type {CanvasRenderingContext2D}\n * @private\n */\n this.ctx = this.canvas.getContext('2d');\n\n // Add textures to upload\n this.registerUploadHook(uploadBaseTextures);\n }\n\n /**\n * Destroys the plugin, don't use after this.\n *\n */\n destroy()\n {\n super.destroy();\n this.ctx = null;\n this.canvas = null;\n }\n\n}\n\n/**\n * Built-in hook to upload PIXI.Texture objects to the GPU.\n *\n * @private\n * @param {*} prepare - Instance of CanvasPrepare\n * @param {*} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadBaseTextures(prepare, item)\n{\n if (item instanceof core.BaseTexture)\n {\n const image = item.source;\n\n // Sometimes images (like atlas images) report a size of zero, causing errors on windows phone.\n // So if the width or height is equal to zero then use the canvas size\n // Otherwise use whatever is smaller, the image dimensions or the canvas dimensions.\n const imageWidth = image.width === 0 ? prepare.canvas.width : Math.min(prepare.canvas.width, image.width);\n const imageHeight = image.height === 0 ? prepare.canvas.height : Math.min(prepare.canvas.height, image.height);\n\n // Only a small subsections is required to be drawn to have the whole texture uploaded to the GPU\n // A smaller draw can be faster.\n prepare.ctx.drawImage(image, 0, 0, imageWidth, imageHeight, 0, 0, prepare.canvas.width, prepare.canvas.height);\n\n return true;\n }\n\n return false;\n}\n\ncore.CanvasRenderer.registerPlugin('prepare', CanvasPrepare);\n","/**\n * The prepare namespace provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for\n * asynchronously preparing assets, textures, graphics waiting to be displayed.\n *\n * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.WebGLRenderer#plugins}.\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n * document.body.appendChild(app.view);\n *\n * // Don't start rendering right away\n * app.stop();\n *\n * // create a display object\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add to the stage\n * app.stage.addChild(rect);\n *\n * // Don't start rendering until the graphic is uploaded to the GPU\n * app.renderer.plugins.prepare.upload(app.stage, () => {\n * app.start();\n * });\n * @namespace PIXI.prepare\n */\nexport { default as webgl } from './webgl/WebGLPrepare';\nexport { default as canvas } from './canvas/CanvasPrepare';\nexport { default as BasePrepare } from './BasePrepare';\nexport { default as CountLimiter } from './limiters/CountLimiter';\nexport { default as TimeLimiter } from './limiters/TimeLimiter';\n","/**\n * CountLimiter limits the number of items handled by a {@link PIXI.prepare.BasePrepare} to a specified\n * number of items per frame.\n *\n * @class\n * @memberof PIXI\n */\nexport default class CountLimiter\n{\n /**\n * @param {number} maxItemsPerFrame - The maximum number of items that can be prepared each frame.\n */\n constructor(maxItemsPerFrame)\n {\n /**\n * The maximum number of items that can be prepared each frame.\n * @private\n */\n this.maxItemsPerFrame = maxItemsPerFrame;\n /**\n * The number of items that can be prepared in the current frame.\n * @type {number}\n * @private\n */\n this.itemsLeft = 0;\n }\n\n /**\n * Resets any counting properties to start fresh on a new frame.\n */\n beginFrame()\n {\n this.itemsLeft = this.maxItemsPerFrame;\n }\n\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\n allowedToUpload()\n {\n return this.itemsLeft-- > 0;\n }\n}\n","/**\n * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of milliseconds per frame.\n *\n * @class\n * @memberof PIXI\n */\nexport default class TimeLimiter\n{\n /**\n * @param {number} maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame.\n */\n constructor(maxMilliseconds)\n {\n /**\n * The maximum milliseconds that can be spent preparing items each frame.\n * @private\n */\n this.maxMilliseconds = maxMilliseconds;\n /**\n * The start time of the current frame.\n * @type {number}\n * @private\n */\n this.frameStart = 0;\n }\n\n /**\n * Resets any counting properties to start fresh on a new frame.\n */\n beginFrame()\n {\n this.frameStart = Date.now();\n }\n\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n * @return {boolean} If the item is allowed to be uploaded.\n */\n allowedToUpload()\n {\n return Date.now() - this.frameStart < this.maxMilliseconds;\n }\n}\n","import * as core from '../../core';\nimport BasePrepare from '../BasePrepare';\n\n/**\n * The prepare manager provides functionality to upload content to the GPU.\n *\n * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare\n *\n * @class\n * @extends PIXI.prepare.BasePrepare\n * @memberof PIXI.prepare\n */\nexport default class WebGLPrepare extends BasePrepare\n{\n /**\n * @param {PIXI.WebGLRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer)\n {\n super(renderer);\n\n this.uploadHookHelper = this.renderer;\n\n // Add textures and graphics to upload\n this.registerFindHook(findGraphics);\n this.registerUploadHook(uploadBaseTextures);\n this.registerUploadHook(uploadGraphics);\n }\n}\n/**\n * Built-in hook to upload PIXI.Texture objects to the GPU.\n *\n * @private\n * @param {PIXI.WebGLRenderer} renderer - instance of the webgl renderer\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadBaseTextures(renderer, item)\n{\n if (item instanceof core.BaseTexture)\n {\n // if the texture already has a GL texture, then the texture has been prepared or rendered\n // before now. If the texture changed, then the changer should be calling texture.update() which\n // reuploads the texture without need for preparing it again\n if (!item._glTextures[renderer.CONTEXT_UID])\n {\n renderer.textureManager.updateTexture(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to upload PIXI.Graphics to the GPU.\n *\n * @private\n * @param {PIXI.WebGLRenderer} renderer - instance of the webgl renderer\n * @param {PIXI.DisplayObject} item - Item to check\n * @return {boolean} If item was uploaded.\n */\nfunction uploadGraphics(renderer, item)\n{\n if (item instanceof core.Graphics)\n {\n // if the item is not dirty and already has webgl data, then it got prepared or rendered\n // before now and we shouldn't waste time updating it again\n if (item.dirty || item.clearDirty || !item._webGL[renderer.plugins.graphics.CONTEXT_UID])\n {\n renderer.plugins.graphics.updateGraphics(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find graphics.\n *\n * @private\n * @param {PIXI.DisplayObject} item - Display object to check\n * @param {Array<*>} queue - Collection of items to upload\n * @return {boolean} if a PIXI.Graphics object was found.\n */\nfunction findGraphics(item, queue)\n{\n if (item instanceof core.Graphics)\n {\n queue.push(item);\n\n return true;\n }\n\n return false;\n}\n\ncore.WebGLRenderer.registerPlugin('prepare', WebGLPrepare);\n","// import polyfills. Done as an export to make sure polyfills are imported first\nexport * from './polyfill';\n\n// export core\nexport * from './core';\n\n// export libs\nimport deprecation from './deprecation';\nimport * as accessibility from './accessibility';\nimport * as extract from './extract';\nimport * as extras from './extras';\nimport * as filters from './filters';\nimport * as interaction from './interaction';\nimport * as loaders from './loaders';\nimport * as mesh from './mesh';\nimport * as particles from './particles';\nimport * as prepare from './prepare';\n\n// handle mixins now, after all code has been added, including deprecation\nimport { utils } from './core';\nutils.mixins.performMixins();\n\n/**\n * Alias for {@link PIXI.loaders.shared}.\n * @name loader\n * @memberof PIXI\n * @type {PIXI.loader.Loader}\n */\nconst loader = loaders.shared || null;\n\nexport {\n accessibility,\n extract,\n extras,\n filters,\n interaction,\n loaders,\n mesh,\n particles,\n prepare,\n loader,\n};\n\n// Apply the deprecations\nif (typeof deprecation === 'function')\n{\n deprecation(exports);\n}\n\n// Always export PixiJS globally.\nglobal.PIXI = exports; // eslint-disable-line\n\n"],"sourceRoot":"."}